From 3c315f0fff93aa072472abc10815963ac0035268 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 12 Aug 2022 09:26:11 +0200 Subject: Adding upstream version 1.36.0. Signed-off-by: Daniel Baumann --- .codacy.yml | 2 + .github/CODEOWNERS | 44 +- .github/ISSUE_TEMPLATE/config.yml | 3 - .github/data/distros.yml | 92 +- .github/scripts/check-updater.sh | 13 +- .github/scripts/ci-support-pkgs.sh | 14 + .github/scripts/gen-docker-tags.py | 5 +- .github/scripts/netdata-pkgcloud-cleanup.py | 190 + .github/scripts/old_package_purging.sh | 88 - .github/scripts/package-upload.sh | 43 + .github/scripts/prepare-release-base.sh | 5 +- .github/scripts/run-updater-check.sh | 2 + .github/workflows/add-to-project.yml | 26 + .github/workflows/build.yml | 59 +- .github/workflows/cloud_regression.yml | 1 + .github/workflows/docker.yml | 88 +- .github/workflows/packagecloud.yml | 36 + .github/workflows/packaging.yml | 50 +- .github/workflows/release.yml | 9 +- .github/workflows/repoconfig-packages.yml | 43 +- .gitignore | 4 + .lgtm.yml | 1 + .travis.yml | 2 +- CHANGELOG.md | 409 +- CMakeLists.txt | 137 +- Makefile.am | 130 +- README.md | 11 +- aclk/README.md | 20 +- aclk/aclk.c | 495 +- aclk/aclk.h | 16 - aclk/aclk_api.c | 39 +- aclk/aclk_api.h | 18 +- aclk/aclk_charts_api.c | 9 + aclk/aclk_charts_api.h | 2 + aclk/aclk_collector_list.c | 193 - aclk/aclk_collector_list.h | 41 - aclk/aclk_contexts_api.c | 23 + aclk/aclk_contexts_api.h | 12 + aclk/aclk_otp.c | 48 +- aclk/aclk_otp.h | 4 + aclk/aclk_query.c | 130 +- aclk/aclk_query_queue.c | 11 +- aclk/aclk_query_queue.h | 21 +- aclk/aclk_rrdhost_state.h | 34 - aclk/aclk_rx_msgs.c | 84 +- aclk/aclk_rx_msgs.h | 4 +- aclk/aclk_stats.c | 48 +- aclk/aclk_stats.h | 4 +- aclk/aclk_tx_msgs.c | 233 +- aclk/aclk_tx_msgs.h | 13 - aclk/aclk_util.c | 25 +- aclk/aclk_util.h | 6 +- aclk/schema-wrappers/alarm_stream.cc | 3 + aclk/schema-wrappers/alarm_stream.h | 2 + aclk/schema-wrappers/chart_stream.cc | 9 +- aclk/schema-wrappers/chart_stream.h | 2 +- aclk/schema-wrappers/context.cc | 125 + aclk/schema-wrappers/context.h | 53 + aclk/schema-wrappers/context_stream.cc | 42 + aclk/schema-wrappers/context_stream.h | 36 + aclk/schema-wrappers/node_connection.cc | 9 + aclk/schema-wrappers/node_connection.h | 3 + aclk/schema-wrappers/node_info.cc | 35 +- aclk/schema-wrappers/node_info.h | 21 +- aclk/schema-wrappers/proto_2_json.cc | 101 + aclk/schema-wrappers/proto_2_json.h | 18 + aclk/schema-wrappers/schema_wrapper_utils.cc | 7 + aclk/schema-wrappers/schema_wrapper_utils.h | 4 + aclk/schema-wrappers/schema_wrappers.h | 2 + claim/claim.c | 2 +- claim/claim.h | 2 +- cli/README.md | 2 +- collectors/COLLECTORS.md | 55 +- collectors/apps.plugin/apps_groups.conf | 4 +- collectors/apps.plugin/apps_plugin.c | 18 +- collectors/cgroups.plugin/cgroup-name.sh | 54 +- collectors/cgroups.plugin/sys_fs_cgroup.c | 303 +- collectors/cgroups.plugin/sys_fs_cgroup.h | 2 +- .../cgroups.plugin/tests/test_cgroups_plugin.c | 87 +- collectors/cgroups.plugin/tests/test_doubles.c | 29 +- collectors/cups.plugin/cups_plugin.c | 12 +- collectors/diskspace.plugin/plugin_diskspace.c | 501 +- collectors/ebpf.plugin/README.md | 4 +- collectors/ebpf.plugin/ebpf.c | 456 +- collectors/ebpf.plugin/ebpf.h | 11 +- collectors/ebpf.plugin/ebpf_apps.c | 4 +- collectors/ebpf.plugin/ebpf_apps.h | 2 - collectors/ebpf.plugin/ebpf_cachestat.c | 128 +- collectors/ebpf.plugin/ebpf_cachestat.h | 1 - collectors/ebpf.plugin/ebpf_cgroup.c | 20 - collectors/ebpf.plugin/ebpf_cgroup.h | 1 - collectors/ebpf.plugin/ebpf_dcstat.c | 130 +- collectors/ebpf.plugin/ebpf_dcstat.h | 1 - collectors/ebpf.plugin/ebpf_disk.c | 95 +- collectors/ebpf.plugin/ebpf_fd.c | 110 +- collectors/ebpf.plugin/ebpf_fd.h | 1 - collectors/ebpf.plugin/ebpf_filesystem.c | 135 +- collectors/ebpf.plugin/ebpf_filesystem.h | 20 - collectors/ebpf.plugin/ebpf_hardirq.c | 112 +- collectors/ebpf.plugin/ebpf_mdflush.c | 98 +- collectors/ebpf.plugin/ebpf_mount.c | 85 +- collectors/ebpf.plugin/ebpf_oomkill.c | 56 +- collectors/ebpf.plugin/ebpf_process.c | 223 +- collectors/ebpf.plugin/ebpf_process.h | 2 + collectors/ebpf.plugin/ebpf_shm.c | 123 +- collectors/ebpf.plugin/ebpf_shm.h | 1 - collectors/ebpf.plugin/ebpf_socket.c | 562 +- collectors/ebpf.plugin/ebpf_socket.h | 5 +- collectors/ebpf.plugin/ebpf_softirq.c | 105 +- collectors/ebpf.plugin/ebpf_swap.c | 114 +- collectors/ebpf.plugin/ebpf_swap.h | 1 - collectors/ebpf.plugin/ebpf_sync.c | 202 +- collectors/ebpf.plugin/ebpf_sync.h | 17 - collectors/ebpf.plugin/ebpf_vfs.c | 116 +- collectors/ebpf.plugin/ebpf_vfs.h | 1 - collectors/freebsd.plugin/freebsd_sysctl.c | 54 +- collectors/perf.plugin/perf_plugin.c | 4 +- collectors/plugins.d/README.md | 61 +- collectors/plugins.d/plugins_d.c | 6 +- collectors/plugins.d/pluginsd_parser.c | 72 +- collectors/plugins.d/pluginsd_parser.h | 15 +- collectors/proc.plugin/plugin_proc.h | 7 +- collectors/proc.plugin/proc_diskstats.c | 127 +- collectors/proc.plugin/proc_interrupts.c | 4 + collectors/proc.plugin/proc_mdstat.c | 42 +- collectors/proc.plugin/proc_net_dev.c | 202 +- collectors/proc.plugin/proc_net_wireless.c | 286 +- collectors/proc.plugin/proc_pagetypeinfo.c | 12 +- collectors/proc.plugin/proc_self_mountinfo.c | 41 + collectors/proc.plugin/proc_self_mountinfo.h | 1 + collectors/proc.plugin/proc_softirqs.c | 4 + collectors/proc.plugin/proc_stat.c | 4 + collectors/proc.plugin/sys_block_zram.c | 4 + collectors/proc.plugin/sys_class_power_supply.c | 8 + .../proc.plugin/sys_devices_system_edac_mc.c | 2 +- collectors/proc.plugin/sys_devices_system_node.c | 2 + collectors/proc.plugin/sys_fs_btrfs.c | 13 + collectors/python.d.plugin/Makefile.am | 2 - collectors/python.d.plugin/chrony/Makefile.inc | 13 - collectors/python.d.plugin/chrony/README.md | 61 - collectors/python.d.plugin/chrony/chrony.chart.py | 118 - collectors/python.d.plugin/chrony/chrony.conf | 77 - collectors/python.d.plugin/haproxy/README.md | 42 +- .../python.d.plugin/mongodb/mongodb.chart.py | 4 +- .../python.d.plugin/ovpn_status_log/Makefile.inc | 13 - .../python.d.plugin/ovpn_status_log/README.md | 50 - .../ovpn_status_log/ovpn_status_log.chart.py | 136 - .../ovpn_status_log/ovpn_status_log.conf | 97 - collectors/python.d.plugin/postgres/README.md | 29 +- collectors/python.d.plugin/python.d.conf | 26 - collectors/python.d.plugin/python.d.plugin.in | 114 +- .../bases/FrameworkServices/SimpleService.py | 5 +- .../python_modules/urllib3/_collections.py | 7 +- .../python_modules/urllib3/util/selectors.py | 8 +- .../python.d.plugin/smartd_log/smartd_log.chart.py | 6 +- .../python.d.plugin/smartd_log/smartd_log.conf | 8 + collectors/python.d.plugin/zscores/README.md | 4 +- collectors/statsd.plugin/README.md | 2 +- collectors/statsd.plugin/statsd.c | 69 +- configure.ac | 148 +- contrib/debian/control | 1 - contrib/debian/control.xenial | 1 - contrib/debian/netdata.postinst | 56 +- daemon/README.md | 8 + daemon/analytics.c | 27 +- daemon/buildinfo.c | 15 +- daemon/commands.c | 12 +- daemon/common.h | 3 - daemon/config/README.md | 90 +- daemon/get-kubernetes-labels.sh.in | 17 +- daemon/global_statistics.c | 104 +- daemon/main.c | 202 +- daemon/static_threads.c | 12 +- daemon/system-info.sh | 10 +- daemon/unit_test.c | 581 +- daemon/unit_test.h | 1 + database/Makefile.am | 2 + database/README.md | 220 +- database/engine/README.md | 227 +- database/engine/datafile.c | 28 +- database/engine/journalfile.c | 30 +- database/engine/metadata_log/metalogpluginsd.c | 2 +- database/engine/pagecache.c | 207 +- database/engine/pagecache.h | 12 +- database/engine/rrddiskprotocol.h | 3 +- database/engine/rrdengine.c | 79 +- database/engine/rrdengine.h | 9 +- database/engine/rrdengineapi.c | 766 +- database/engine/rrdengineapi.h | 105 +- database/metric_correlations.c | 300 - database/metric_correlations.h | 11 - database/ram/Makefile.am | 11 + database/ram/README.md | 7 + database/ram/rrddim_mem.c | 205 +- database/ram/rrddim_mem.h | 34 +- database/rrd.h | 546 +- database/rrdcalc.c | 105 +- database/rrdcalc.h | 12 +- database/rrdcalctemplate.c | 102 +- database/rrdcalctemplate.h | 8 +- database/rrdcontext.c | 2908 +++ database/rrdcontext.h | 92 + database/rrddim.c | 474 +- database/rrdhost.c | 783 +- database/rrdlabels.c | 1241 +- database/rrdset.c | 933 +- database/rrdsetvar.c | 9 +- database/rrdsetvar.h | 2 +- database/rrdvar.c | 20 +- database/rrdvar.h | 4 +- database/sqlite/sqlite3.c | 19818 +++++++++++-------- database/sqlite/sqlite3.h | 541 +- database/sqlite/sqlite_aclk.c | 164 +- database/sqlite/sqlite_aclk.h | 9 +- database/sqlite/sqlite_aclk_alert.c | 144 +- database/sqlite/sqlite_aclk_chart.c | 138 +- database/sqlite/sqlite_aclk_node.c | 67 +- database/sqlite/sqlite_aclk_node.h | 1 + database/sqlite/sqlite_context.c | 551 + database/sqlite/sqlite_context.h | 68 + database/sqlite/sqlite_db_migration.c | 185 + database/sqlite/sqlite_db_migration.h | 12 + database/sqlite/sqlite_functions.c | 650 +- database/sqlite/sqlite_functions.h | 19 +- database/sqlite/sqlite_health.c | 29 +- database/storage_engine.c | 14 + database/storage_engine.h | 2 + docs/Demo-Sites.md | 1 - docs/Running-behind-h2o.md | 183 + docs/anonymous-statistics.md | 4 +- docs/collect/application-metrics.md | 39 +- docs/configure/nodes.md | 4 + docs/guides/deploy/ansible.md | 2 + docs/guides/longer-metrics-storage.md | 218 +- docs/guides/monitor/anomaly-detection.md | 271 +- .../troubleshooting-agent-with-cloud-connection.md | 117 + docs/store/change-metrics-storage.md | 95 +- docs/store/distributed-data-architecture.md | 67 +- exporting/aws_kinesis/aws_kinesis.c | 1 + exporting/check_filters.c | 8 + exporting/clean_connectors.c | 2 +- exporting/exporting.conf | 1 + exporting/exporting_engine.h | 19 +- exporting/graphite/graphite.c | 34 +- exporting/graphite/graphite.h | 2 +- exporting/init_connectors.c | 8 +- exporting/json/json.c | 40 +- exporting/mongodb/mongodb.c | 1 + exporting/opentsdb/opentsdb.c | 79 +- exporting/opentsdb/opentsdb.h | 2 +- exporting/process_data.c | 54 +- exporting/prometheus/prometheus.c | 153 +- exporting/prometheus/remote_write/remote_write.c | 88 +- exporting/prometheus/remote_write/remote_write.h | 7 + .../remote_write/remote_write_request.cc | 32 + .../prometheus/remote_write/remote_write_request.h | 3 + exporting/pubsub/pubsub.c | 1 + exporting/read_config.c | 5 + exporting/tests/exporting_doubles.c | 14 +- exporting/tests/exporting_fixtures.c | 39 +- exporting/tests/netdata_doubles.c | 30 +- exporting/tests/test_exporting_engine.c | 38 +- exporting/tests/test_exporting_engine.h | 20 +- health/Makefile.am | 1 + health/REFERENCE.md | 62 + health/health.c | 112 +- health/health.d/cgroups.conf | 70 + health/health.d/go.d.plugin.conf | 2 +- health/health.d/ml.conf | 36 + health/health.d/python.d.plugin.conf | 2 +- health/health.d/ram.conf | 6 +- health/health.d/redis.conf | 7 +- health/health.d/web_log.conf | 214 - health/health.h | 7 +- health/health_config.c | 42 +- health/health_json.c | 2 + health/health_log.c | 32 +- health/notifications/alarm-notify.sh.in | 8 + health/notifications/msteams/README.md | 2 - libnetdata/Makefile.am | 1 + libnetdata/arrayalloc/Makefile.am | 8 + libnetdata/arrayalloc/README.md | 7 + libnetdata/arrayalloc/arrayalloc.c | 335 + libnetdata/arrayalloc/arrayalloc.h | 35 + libnetdata/buffer/buffer.c | 8 +- libnetdata/buffer/buffer.h | 2 +- libnetdata/clocks/clocks.c | 2 +- libnetdata/config/appconfig.c | 59 +- libnetdata/config/appconfig.h | 6 +- libnetdata/dictionary/README.md | 74 +- libnetdata/dictionary/dictionary.c | 1829 +- libnetdata/dictionary/dictionary.h | 108 +- libnetdata/ebpf/ebpf.c | 4 +- libnetdata/ebpf/ebpf.h | 48 +- libnetdata/eval/eval.c | 112 +- libnetdata/eval/eval.h | 6 +- libnetdata/inlined.h | 99 +- libnetdata/json/json.c | 4 +- libnetdata/json/json.h | 19 +- libnetdata/libjudy/src/Judy.h | 622 + libnetdata/libjudy/src/JudyCommon/JudyMalloc.c | 87 + libnetdata/libjudy/src/JudyCommon/JudyPrivate.h | 1613 ++ libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h | 485 + .../libjudy/src/JudyCommon/JudyPrivateBranch.h | 788 + libnetdata/libjudy/src/JudyHS/JudyHS.c | 771 + libnetdata/libjudy/src/JudyL/JudyL.h | 505 + libnetdata/libjudy/src/JudyL/JudyLByCount.c | 954 + libnetdata/libjudy/src/JudyL/JudyLCascade.c | 1942 ++ libnetdata/libjudy/src/JudyL/JudyLCount.c | 1195 ++ libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c | 314 + libnetdata/libjudy/src/JudyL/JudyLDecascade.c | 1206 ++ libnetdata/libjudy/src/JudyL/JudyLDel.c | 2146 ++ libnetdata/libjudy/src/JudyL/JudyLFirst.c | 213 + libnetdata/libjudy/src/JudyL/JudyLFreeArray.c | 363 + libnetdata/libjudy/src/JudyL/JudyLGet.c | 1094 + libnetdata/libjudy/src/JudyL/JudyLIns.c | 1873 ++ libnetdata/libjudy/src/JudyL/JudyLInsArray.c | 1178 ++ libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c | 135 + libnetdata/libjudy/src/JudyL/JudyLMallocIF.c | 782 + libnetdata/libjudy/src/JudyL/JudyLMemActive.c | 259 + libnetdata/libjudy/src/JudyL/JudyLMemUsed.c | 61 + libnetdata/libjudy/src/JudyL/JudyLNext.c | 1890 ++ libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c | 1390 ++ libnetdata/libjudy/src/JudyL/JudyLPrev.c | 1890 ++ libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c | 1390 ++ libnetdata/libjudy/src/JudyL/JudyLTablesGen.c | 296 + libnetdata/libjudy/src/JudyL/j__udyLGet.c | 1094 + libnetdata/libnetdata.c | 16 + libnetdata/libnetdata.h | 19 + libnetdata/log/log.c | 101 +- libnetdata/log/log.h | 24 +- libnetdata/onewayalloc/onewayalloc.c | 35 +- libnetdata/onewayalloc/onewayalloc.h | 2 + libnetdata/required_dummies.h | 2 +- libnetdata/socket/security.h | 8 + libnetdata/statistical/statistical.c | 180 +- libnetdata/statistical/statistical.h | 40 +- libnetdata/storage_number/storage_number.c | 71 +- libnetdata/storage_number/storage_number.h | 222 +- .../storage_number/tests/test_storage_number.c | 20 +- libnetdata/tests/test_str2ld.c | 4 +- ml/Config.cc | 6 +- ml/Dimension.cc | 55 +- ml/Dimension.h | 6 +- ml/Query.h | 15 +- ml/README.md | 53 +- ml/ml.cc | 14 +- netdata-installer.sh | 98 - netdata.spec.in | 29 +- packaging/PLATFORM_SUPPORT.md | 11 +- packaging/bundle-judy.sh | 23 - packaging/docker/Dockerfile | 8 +- packaging/docker/README.md | 57 +- packaging/docker/gen-cflags.sh | 9 + packaging/go.d.checksums | 32 +- packaging/go.d.version | 2 +- packaging/installer/dependencies/arch.sh | 1 - packaging/installer/dependencies/centos.sh | 3 - packaging/installer/dependencies/debian.sh | 1 - packaging/installer/dependencies/fedora.sh | 1 - packaging/installer/dependencies/freebsd.sh | 2 - packaging/installer/dependencies/gentoo.sh | 1 - packaging/installer/dependencies/ol.sh | 22 +- packaging/installer/dependencies/opensuse.sh | 1 - packaging/installer/dependencies/ubuntu.sh | 1 - packaging/installer/install-required-packages.sh | 117 +- packaging/installer/kickstart.sh | 30 +- packaging/installer/methods/freebsd.md | 2 +- packaging/installer/methods/manual.md | 14 +- packaging/installer/methods/pfsense.md | 1 - packaging/installer/methods/source.md | 1 - packaging/installer/netdata-updater.sh | 63 +- packaging/judy.checksums | 1 - packaging/judy.version | 1 - packaging/makeself/build-static.sh | 32 +- packaging/makeself/install-alpine-packages.sh | 1 + .../makeself/jobs/90-netdata-runtime-check.sh | 54 + packaging/version | 2 +- parser/parser.c | 4 +- parser/parser.h | 10 +- registry/registry_internals.h | 2 +- streaming/receiver.c | 28 +- streaming/rrdpush.c | 68 +- streaming/rrdpush.h | 2 +- streaming/sender.c | 42 +- system/netdata.service.in | 4 +- tests/profile/test-eval.c | 10 +- web/api/README.md | 6 +- web/api/badges/web_buffer_svg.c | 51 +- web/api/badges/web_buffer_svg.h | 6 +- web/api/exporters/shell/allmetrics_shell.c | 20 +- web/api/formatters/csv/csv.c | 10 +- web/api/formatters/json/json.c | 21 +- web/api/formatters/json_wrapper.c | 102 +- web/api/formatters/json_wrapper.h | 5 +- web/api/formatters/rrd2json.c | 104 +- web/api/formatters/rrd2json.h | 14 +- web/api/formatters/rrdset2json.c | 24 +- web/api/formatters/ssv/ssv.c | 2 +- web/api/formatters/value/value.c | 25 +- web/api/formatters/value/value.h | 2 +- web/api/netdata-swagger.json | 1130 +- web/api/netdata-swagger.yaml | 912 +- web/api/queries/Makefile.am | 3 + web/api/queries/average/average.c | 14 +- web/api/queries/average/average.h | 6 +- web/api/queries/countif/Makefile.am | 8 + web/api/queries/countif/README.md | 36 + web/api/queries/countif/countif.c | 136 + web/api/queries/countif/countif.h | 15 + web/api/queries/des/des.c | 36 +- web/api/queries/des/des.h | 6 +- web/api/queries/incremental_sum/incremental_sum.c | 16 +- web/api/queries/incremental_sum/incremental_sum.h | 6 +- web/api/queries/max/max.c | 16 +- web/api/queries/max/max.h | 6 +- web/api/queries/median/README.md | 17 +- web/api/queries/median/median.c | 111 +- web/api/queries/median/median.h | 14 +- web/api/queries/min/min.c | 16 +- web/api/queries/min/min.h | 6 +- web/api/queries/percentile/Makefile.am | 8 + web/api/queries/percentile/README.md | 58 + web/api/queries/percentile/percentile.c | 169 + web/api/queries/percentile/percentile.h | 23 + web/api/queries/query.c | 2409 ++- web/api/queries/query.h | 35 + web/api/queries/rrdr.c | 90 +- web/api/queries/rrdr.h | 92 +- web/api/queries/ses/ses.c | 28 +- web/api/queries/ses/ses.h | 6 +- web/api/queries/stddev/stddev.c | 42 +- web/api/queries/stddev/stddev.h | 12 +- web/api/queries/sum/sum.c | 14 +- web/api/queries/sum/sum.h | 6 +- web/api/queries/trimmed_mean/Makefile.am | 8 + web/api/queries/trimmed_mean/README.md | 56 + web/api/queries/trimmed_mean/trimmed_mean.c | 166 + web/api/queries/trimmed_mean/trimmed_mean.h | 22 + web/api/queries/weights.c | 1220 ++ web/api/queries/weights.h | 33 + web/api/web_api_v1.c | 468 +- web/api/web_api_v1.h | 5 +- web/gui/dashboard/Makefile.am | 26 +- web/gui/dashboard/asset-manifest.json | 24 +- web/gui/dashboard/css/dashboard.css | 2 +- web/gui/dashboard/css/dashboard.slate.css | 2 +- web/gui/dashboard/dashboard-react.js | 2 +- web/gui/dashboard/dashboard.css | 2 +- web/gui/dashboard/dashboard.html | 10 +- web/gui/dashboard/dashboard.js | 6 +- web/gui/dashboard/dashboard.slate.css | 2 +- web/gui/dashboard/images/alerts.jpg | Bin 0 -> 388104 bytes web/gui/dashboard/images/alerts.png | Bin 0 -> 59943 bytes web/gui/dashboard/images/dashboards.png | Bin 0 -> 175464 bytes web/gui/dashboard/images/home.png | Bin 0 -> 98888 bytes web/gui/dashboard/images/nodeView.png | Bin 0 -> 645133 bytes web/gui/dashboard/images/nodes.jpg | Bin 0 -> 452421 bytes web/gui/dashboard/images/overview.png | Bin 0 -> 101515 bytes web/gui/dashboard/images/pricing.png | Bin 0 -> 148860 bytes web/gui/dashboard/index.html | 4 +- ...he-manifest.b443acc162e1adddca46165b647e9f4b.js | 190 - ...he-manifest.e95d658eed560f9e0189217cc6919238.js | 190 + web/gui/dashboard/service-worker.js | 2 +- .../dashboard/static/css/main.102ce44c.chunk.css | 2 - .../static/css/main.102ce44c.chunk.css.map | 1 - .../dashboard/static/css/main.53ba10f1.chunk.css | 2 + .../static/css/main.53ba10f1.chunk.css.map | 1 + web/gui/dashboard/static/js/2.3123f37d.chunk.js | 3 + .../static/js/2.3123f37d.chunk.js.LICENSE | 260 + .../dashboard/static/js/2.3123f37d.chunk.js.map | 1 + web/gui/dashboard/static/js/2.97b8fd9b.chunk.js | 3 - .../static/js/2.97b8fd9b.chunk.js.LICENSE | 260 - .../dashboard/static/js/2.97b8fd9b.chunk.js.map | 1 - web/gui/dashboard/static/js/main.2d23101e.chunk.js | 3 - .../static/js/main.2d23101e.chunk.js.LICENSE | 8 - .../dashboard/static/js/main.2d23101e.chunk.js.map | 1 - web/gui/dashboard/static/js/main.cc0e57d1.chunk.js | 3 + .../static/js/main.cc0e57d1.chunk.js.LICENSE | 8 + .../dashboard/static/js/main.cc0e57d1.chunk.js.map | 1 + web/gui/dashboard_info.js | 925 +- web/server/web_client.h | 1 + 482 files changed, 65211 insertions(+), 20464 deletions(-) create mode 100755 .github/scripts/ci-support-pkgs.sh create mode 100755 .github/scripts/netdata-pkgcloud-cleanup.py delete mode 100755 .github/scripts/old_package_purging.sh create mode 100755 .github/scripts/package-upload.sh create mode 100644 .github/workflows/add-to-project.yml create mode 100644 .github/workflows/packagecloud.yml delete mode 100644 aclk/aclk_collector_list.c delete mode 100644 aclk/aclk_collector_list.h create mode 100644 aclk/aclk_contexts_api.c create mode 100644 aclk/aclk_contexts_api.h create mode 100644 aclk/schema-wrappers/context.cc create mode 100644 aclk/schema-wrappers/context.h create mode 100644 aclk/schema-wrappers/context_stream.cc create mode 100644 aclk/schema-wrappers/context_stream.h create mode 100644 aclk/schema-wrappers/proto_2_json.cc create mode 100644 aclk/schema-wrappers/proto_2_json.h delete mode 100644 collectors/python.d.plugin/chrony/Makefile.inc delete mode 100644 collectors/python.d.plugin/chrony/README.md delete mode 100644 collectors/python.d.plugin/chrony/chrony.chart.py delete mode 100644 collectors/python.d.plugin/chrony/chrony.conf delete mode 100644 collectors/python.d.plugin/ovpn_status_log/Makefile.inc delete mode 100644 collectors/python.d.plugin/ovpn_status_log/README.md delete mode 100644 collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py delete mode 100644 collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.conf delete mode 100644 database/metric_correlations.c delete mode 100644 database/metric_correlations.h create mode 100644 database/ram/Makefile.am create mode 100644 database/ram/README.md create mode 100644 database/rrdcontext.c create mode 100644 database/rrdcontext.h create mode 100644 database/sqlite/sqlite_context.c create mode 100644 database/sqlite/sqlite_context.h create mode 100644 database/sqlite/sqlite_db_migration.c create mode 100644 database/sqlite/sqlite_db_migration.h create mode 100644 docs/Running-behind-h2o.md create mode 100644 docs/guides/troubleshoot/troubleshooting-agent-with-cloud-connection.md create mode 100644 health/health.d/ml.conf create mode 100644 libnetdata/arrayalloc/Makefile.am create mode 100644 libnetdata/arrayalloc/README.md create mode 100644 libnetdata/arrayalloc/arrayalloc.c create mode 100644 libnetdata/arrayalloc/arrayalloc.h create mode 100644 libnetdata/libjudy/src/Judy.h create mode 100644 libnetdata/libjudy/src/JudyCommon/JudyMalloc.c create mode 100644 libnetdata/libjudy/src/JudyCommon/JudyPrivate.h create mode 100644 libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h create mode 100644 libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h create mode 100644 libnetdata/libjudy/src/JudyHS/JudyHS.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyL.h create mode 100644 libnetdata/libjudy/src/JudyL/JudyLByCount.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLCascade.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLCount.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLDecascade.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLDel.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLFirst.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLFreeArray.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLGet.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLIns.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLInsArray.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLMallocIF.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLMemActive.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLMemUsed.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLNext.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLPrev.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c create mode 100644 libnetdata/libjudy/src/JudyL/JudyLTablesGen.c create mode 100644 libnetdata/libjudy/src/JudyL/j__udyLGet.c delete mode 100755 packaging/bundle-judy.sh create mode 100755 packaging/docker/gen-cflags.sh delete mode 100644 packaging/judy.checksums delete mode 100644 packaging/judy.version create mode 100755 packaging/makeself/jobs/90-netdata-runtime-check.sh create mode 100644 web/api/queries/countif/Makefile.am create mode 100644 web/api/queries/countif/README.md create mode 100644 web/api/queries/countif/countif.c create mode 100644 web/api/queries/countif/countif.h create mode 100644 web/api/queries/percentile/Makefile.am create mode 100644 web/api/queries/percentile/README.md create mode 100644 web/api/queries/percentile/percentile.c create mode 100644 web/api/queries/percentile/percentile.h create mode 100644 web/api/queries/trimmed_mean/Makefile.am create mode 100644 web/api/queries/trimmed_mean/README.md create mode 100644 web/api/queries/trimmed_mean/trimmed_mean.c create mode 100644 web/api/queries/trimmed_mean/trimmed_mean.h create mode 100644 web/api/queries/weights.c create mode 100644 web/api/queries/weights.h create mode 100644 web/gui/dashboard/images/alerts.jpg create mode 100644 web/gui/dashboard/images/alerts.png create mode 100644 web/gui/dashboard/images/dashboards.png create mode 100644 web/gui/dashboard/images/home.png create mode 100644 web/gui/dashboard/images/nodeView.png create mode 100644 web/gui/dashboard/images/nodes.jpg create mode 100644 web/gui/dashboard/images/overview.png create mode 100644 web/gui/dashboard/images/pricing.png delete mode 100644 web/gui/dashboard/precache-manifest.b443acc162e1adddca46165b647e9f4b.js create mode 100644 web/gui/dashboard/precache-manifest.e95d658eed560f9e0189217cc6919238.js delete mode 100644 web/gui/dashboard/static/css/main.102ce44c.chunk.css delete mode 100644 web/gui/dashboard/static/css/main.102ce44c.chunk.css.map create mode 100644 web/gui/dashboard/static/css/main.53ba10f1.chunk.css create mode 100644 web/gui/dashboard/static/css/main.53ba10f1.chunk.css.map create mode 100644 web/gui/dashboard/static/js/2.3123f37d.chunk.js create mode 100644 web/gui/dashboard/static/js/2.3123f37d.chunk.js.LICENSE create mode 100644 web/gui/dashboard/static/js/2.3123f37d.chunk.js.map delete mode 100644 web/gui/dashboard/static/js/2.97b8fd9b.chunk.js delete mode 100644 web/gui/dashboard/static/js/2.97b8fd9b.chunk.js.LICENSE delete mode 100644 web/gui/dashboard/static/js/2.97b8fd9b.chunk.js.map delete mode 100644 web/gui/dashboard/static/js/main.2d23101e.chunk.js delete mode 100644 web/gui/dashboard/static/js/main.2d23101e.chunk.js.LICENSE delete mode 100644 web/gui/dashboard/static/js/main.2d23101e.chunk.js.map create mode 100644 web/gui/dashboard/static/js/main.cc0e57d1.chunk.js create mode 100644 web/gui/dashboard/static/js/main.cc0e57d1.chunk.js.LICENSE create mode 100644 web/gui/dashboard/static/js/main.cc0e57d1.chunk.js.map diff --git a/.codacy.yml b/.codacy.yml index f1a4259a0..f4fd5d6d2 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -13,3 +13,5 @@ exclude_paths: - web/gui/main.js - tests/** - aclk/tests/** + - libnetdata/libjudy/** + diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b0a6db160..dac9f84cb 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -5,11 +5,11 @@ * @Ferroin # Ownership by directory structure -.travis/ @Ferroin @iigorkarpov @maneamarius -.github/ @Ferroin @iigorkarpov @maneamarius +.travis/ @Ferroin +.github/ @Ferroin aclk/ @stelfrag @underhood -build/ @Ferroin @iigorkarpov @maneamarius -contrib/debian @Ferroin @iigorkarpov @maneamarius +build/ @Ferroin +contrib/debian @Ferroin collectors/ @vlvkobal collectors/ebpf.plugin/ @thiagoftsm @vlvkobal collectors/charts.d.plugin/ @ilyam8 @Ferroin @@ -26,32 +26,32 @@ health/health.d/ @thiagoftsm @vlvkobal health/notifications/ @Ferroin @thiagoftsm ml/ @andrewm4894 @vkalintiris libnetdata/ @thiagoftsm @vkalintiris -packaging/ @Ferroin @iigorkarpov @maneamarius +packaging/ @Ferroin registry/ @jacekkolasa streaming/ @thiagoftsm @vlvkobal -system/ @Ferroin @iigorkarpov @maneamarius -tests/ @Ferroin @iigorkarpov @maneamarius @vkalintiris +system/ @Ferroin +tests/ @Ferroin @vkalintiris web/ @thiagoftsm @vlvkobal @vkalintiris web/gui/ @jacekkolasa # Ownership by filetype (overwrites ownership by directory) -*.am @Ferroin @iigorkarpov @maneamarius +*.am @Ferroin *.md @DShreve2 -Dockerfile* @Ferroin @iigorkarpov @maneamarius +Dockerfile* @Ferroin # Ownership of specific files -.gitignore @Ferroin @iigorkarpov @maneamarius @vkalintiris -.travis.yml @Ferroin @iigorkarpov @maneamarius -.lgtm.yml @Ferroin @iigorkarpov @maneamarius -.eslintrc @Ferroin @iigorkarpov @maneamarius -.eslintignore @Ferroin @iigorkarpov @maneamarius -.csslintrc @Ferroin @iigorkarpov @maneamarius -.codeclimate.yml @Ferroin @iigorkarpov @maneamarius -.codacy.yml @Ferroin @iigorkarpov @maneamarius -.yamllint.yml @Ferroin @iigorkarpov @maneamarius -netdata.spec.in @Ferroin @iigorkarpov @maneamarius -netdata-installer.sh @Ferroin @iigorkarpov @maneamarius -packaging/version @netdatabot @Ferroin @iigorkarpov @maneamarius +.gitignore @Ferroin @vkalintiris +.travis.yml @Ferroin +.lgtm.yml @Ferroin +.eslintrc @Ferroin +.eslintignore @Ferroin +.csslintrc @Ferroin +.codeclimate.yml @Ferroin +.codacy.yml @Ferroin +.yamllint.yml @Ferroin +netdata.spec.in @Ferroin +netdata-installer.sh @Ferroin +packaging/version @netdatabot @Ferroin LICENSE.md @DShreve2 @Ferroin @vkalintiris -CHANGELOG.md @netdatabot @Ferroin @iigorkarpov @maneamarius +CHANGELOG.md @netdatabot @Ferroin diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index c21d50e0c..79678d7b5 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -4,9 +4,6 @@ contact_links: - name: "Netdata Agent: Question" url: https://github.com/netdata/netdata/discussions/new?category=q-a about: Ask a question about Netdata Agent - - name: "Netdata Agent Dashboard" - url: https://github.com/netdata/dashboard/issues/new/choose - about: Create a report to help us improve our dashboard - name: "Netdata Cloud" url: https://github.com/netdata/netdata-cloud/issues/new/choose about: Create a report to help us improve our web application diff --git a/.github/data/distros.yml b/.github/data/distros.yml index 133cdbd13..8ef32785b 100644 --- a/.github/data/distros.yml +++ b/.github/data/distros.yml @@ -1,10 +1,21 @@ # This defines the full set of distros we run CI on. --- platform_map: # map packaging architectures to docker platforms - i386: linux/i386 + aarch64: linux/arm64/v8 amd64: linux/amd64 - armhf: linux/arm/v7 arm64: linux/arm64/v8 + armhf: linux/arm/v7 + armhfp: linux/arm/v7 + i386: linux/i386 + x86_64: linux/amd64 +arch_order: # sort order for per-architecture jobs in CI + - amd64 + - x86_64 + - i386 + - armhf + - armhfp + - arm64 + - aarch64 include: - &alpine distro: alpine @@ -13,6 +24,8 @@ include: apk add -U bash jsonc_removal: | apk del json-c-dev + test: + ebpf-core: true - <<: *alpine version: "3.16" - <<: *alpine @@ -26,6 +39,8 @@ include: version: latest env_prep: | pacman --noconfirm -Syu && pacman --noconfirm -Sy grep libffi + test: + ebpf-core: true - &alma distro: almalinux @@ -37,8 +52,10 @@ include: type: rpm repo_distro: el/9 arches: - - amd64 - - arm64 + - x86_64 + - aarch64 + test: + ebpf-core: true - <<: *alma version: "8" packages: @@ -51,7 +68,9 @@ include: type: rpm repo_distro: el/7 arches: - - amd64 + - x86_64 + test: + ebpf-core: false - &debian distro: debian @@ -68,16 +87,15 @@ include: - amd64 - armhf - arm64 + test: + ebpf-core: true - <<: *debian version: "10" packages: <<: *debian_packages repo_distro: debian/buster - - <<: *debian - version: "9" - packages: - <<: *debian_packages - repo_distro: debian/stretch + test: + ebpf-core: false - &fedora distro: fedora @@ -88,38 +106,59 @@ include: type: rpm repo_distro: fedora/36 arches: - - amd64 - - armhf - - arm64 + - x86_64 + - armhfp + - aarch64 + test: + ebpf-core: true - <<: *fedora version: "35" packages: <<: *fedora_packages repo_distro: fedora/35 + test: + ebpf-core: true - &opensuse distro: opensuse - version: "15.3" + version: "15.4" base_image: opensuse/leap jsonc_removal: | zypper rm -y libjson-c-devel - packages: + packages: &opensuse_packages type: rpm - repo_distro: opensuse/15.3 + repo_distro: opensuse/15.4 arches: - - amd64 - - arm64 + - x86_64 + - aarch64 + test: + ebpf-core: true + - <<: *opensuse + version: "15.3" + packages: + <<: *opensuse_packages + repo_distro: opensuse/15.3 + test: + ebpf-core: false - - distro: oraclelinux + - &oracle + distro: oraclelinux version: "8" jsonc_removal: | dnf remove -y json-c-devel - packages: + packages: &oracle_packages type: rpm repo_distro: ol/8 arches: - - amd64 - - arm64 + - x86_64 + - aarch64 + test: + ebpf-core: true + - <<: *oracle + version: "9" + packages: + <<: *oracle_packages + repo_distro: ol/9 - &ubuntu distro: ubuntu @@ -135,11 +174,8 @@ include: - amd64 - armhf - arm64 - - <<: *ubuntu - version: "21.10" - packages: - <<: *ubuntu_packages - repo_distro: ubuntu/impish + test: + ebpf-core: true - <<: *ubuntu version: "20.04" packages: @@ -155,3 +191,5 @@ include: - amd64 - armhf - arm64 + test: + ebpf-core: false diff --git a/.github/scripts/check-updater.sh b/.github/scripts/check-updater.sh index 1051f1eee..3df0c9de4 100755 --- a/.github/scripts/check-updater.sh +++ b/.github/scripts/check-updater.sh @@ -17,7 +17,18 @@ check_successful_update() { ) >&2 } -steps="check_successful_update" +check_autoupdate_enabled() { + progress "Check autoupdate still enabled after update" + ( + if [ -f /etc/periodic/daily/netdata-updater ] || [ -f /etc/cron.daily/netdata-updater ]; then + echo "Update successful!" + else + exit 1 + fi + ) >&2 +} + +steps="check_successful_update check_autoupdate_enabled" _main() { for step in $steps; do diff --git a/.github/scripts/ci-support-pkgs.sh b/.github/scripts/ci-support-pkgs.sh new file mode 100755 index 000000000..bfa9c83a5 --- /dev/null +++ b/.github/scripts/ci-support-pkgs.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# This script installs supporting packages needed for CI, which provide following: +# cron, pidof + +set -e + +if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || [ -f /etc/fedora-release ] || [ -f /etc/almalinux-release ]; then + # Alma, Fedora, CentOS, Redhat + dnf install -y procps-ng cronie cronie-anacron || yum install -y procps-ng cronie cronie-anacron +elif [ -f /etc/arch-release ]; then + # Arch + pacman -S --noconfirm cronie +fi diff --git a/.github/scripts/gen-docker-tags.py b/.github/scripts/gen-docker-tags.py index 6c6251155..df4dc0263 100755 --- a/.github/scripts/gen-docker-tags.py +++ b/.github/scripts/gen-docker-tags.py @@ -2,9 +2,10 @@ import sys -REPO = 'netdata/netdata' - version = sys.argv[1].split('.') +suffix = sys.argv[2] + +REPO = f'netdata/netdata{suffix}' MAJOR = ':'.join([REPO, version[0]]) MINOR = ':'.join([REPO, '.'.join(version[0:2])]) diff --git a/.github/scripts/netdata-pkgcloud-cleanup.py b/.github/scripts/netdata-pkgcloud-cleanup.py new file mode 100755 index 000000000..f6311e47c --- /dev/null +++ b/.github/scripts/netdata-pkgcloud-cleanup.py @@ -0,0 +1,190 @@ +#!/bin/env python3 + +import requests +from requests.auth import HTTPBasicAuth +from datetime import date, datetime, timedelta +import os +import sys +import argparse +from pprint import pprint +from datetime import datetime +from dateutil import parser + + +class PackageCloud: + NUM_PACKAGE_MINOR_TO_KEEP = 5 + NUM_RETENTION_DAYS = 30 + # number of pages to process. Use '0' to process all + MAX_PAGES = 0 + + def __init__(self, repo_type, dry_run=True, auth_token=None): + self.headers = { + "Accept" : "application/json", + "Content-Type" : "application/json", + } + self.dry_run = dry_run + self.repo_type = repo_type + if repo_type == "stable": + repo = "netdata/netdata" + elif repo_type == "devel": + repo = "netdata/netdata-devel" + elif repo_type == "edge": + repo = "netdata/netdata-edge" + else: + print(f"ERROR: unknown repo type '{repo_type}'!\nAccepted values are: stable,devel,edge") + sys.exit(1) + self.base_url = f"https://packagecloud.io/api/v1/repos/{repo}" + self.auth = HTTPBasicAuth(username=auth_token, password='') if auth_token else None + + def get_all_packages(self): + page = 1 + all_pkg_list = [] + while True: + url = f"{self.base_url}/packages.json?page={page}" + if page > self.MAX_PAGES and self.MAX_PAGES != 0: + break + else: + pkg_list = requests.get(url, auth=self.auth, headers=self.headers).json() + if len(pkg_list) == 0: + break + else: + print(f"Processing page: {page}") + for element in pkg_list: + self.is_pkg_older_than_days(element, 30) + if element['name'] != 'netdata-repo' and element['name'] != 'netdata-repo-edge': + all_pkg_list.append(element) + page += 1 + return all_pkg_list + + def delete_package(self, destroy_url): + if self.dry_run: + print(f" - DRY_RUN mode. Not deleting package '{destroy_url}'.") + else: + print(f" - Deleting package: {destroy_url}") + url = f"https://packagecloud.io{destroy_url}" + response = requests.delete(url, auth=self.auth, headers=self.headers).json() + response = None + if not response: + print(f" Package deleted successfully.") + else: + print(f" Failed deleting package!") + + def get_destroy_url(self, pkg_url): + url = f"https://packagecloud.io{pkg_url}" + response = requests.get(url, auth=self.auth, headers=self.headers) + response.raise_for_status() + return response.json()['destroy_url'] + + def get_packages_for_distro(self, distro, all_pkg_list): + distro_pkg_list = [ pkg for pkg in all_pkg_list if pkg['distro_version'] == distro ] + return distro_pkg_list + + def get_packages_for_arch(self, arch, all_pkg_list): + arch_pkg_list = [ pkg for pkg in all_pkg_list if pkg['package_url'].split('/')[11] == arch ] + return arch_pkg_list + + def get_arches(self, pkg_list): + arches = list(set([pkg['package_url'].split('/')[11] for pkg in pkg_list ])) + return arches + + def get_pkg_list(self, pkg_name, pkg_list): + filtered_list = [ pkg for pkg in pkg_list if pkg['name'] == pkg_name ] + return filtered_list + + def get_minor_versions(self, all_versions): + minor_versions = ['.'.join(version.split('.')[:-1]) for version in all_versions ] + minor_versions = list(set(minor_versions)) + minor_versions.sort() + return minor_versions + + def is_pkg_older_than_days(self, pkg, num_days): + pkg_create_date = datetime.strptime(pkg['created_at'], '%Y-%m-%dT%H:%M:%S.%fZ') + time_difference = datetime.now() - pkg_create_date + return time_difference.days > num_days + + def cleanup_repo(self): + if self.repo_type == 'stable': + self.cleanup_stable_repo() + else: + self.cleanup_edge_repo() + + def cleanup_edge_repo(self): + all_pkg_list = self.get_all_packages() + pkgs_to_delete = [] + pkgs_to_keep = [] + for package in all_pkg_list: + if self.is_pkg_older_than_days(package, self.NUM_RETENTION_DAYS): + pkgs_to_delete.append(package) + else: + pkgs_to_keep.append(package) + print(f"Keeping the following packages (newer than {self.NUM_RETENTION_DAYS} days):") + for pkg in pkgs_to_keep: + print(f" > pkg: {pkg['package_html_url']} / created_at: {pkg['created_at']}") + print(f"Deleting the following packages (older than {self.NUM_RETENTION_DAYS} days):") + for pkg in pkgs_to_delete: + print(f" > pkg: {pkg['package_html_url']} / created_at: {pkg['created_at']}") + self.delete_package(pkg['destroy_url']) + + def cleanup_stable_repo(self): + all_pkg_list = self.get_all_packages() + all_distros = list(set([ pkg['distro_version'] for pkg in all_pkg_list ])) + all_distros = sorted(all_distros) + print(f"<> Distributions list: {all_distros}") + + for distro in all_distros: + print(f">> Processing distro: {distro}") + pkg_list_distro = self.get_packages_for_distro(distro, all_pkg_list) + arches = self.get_arches(pkg_list_distro) + print(f" <> Arch list: {arches}") + for arch in arches: + print(f" >> Processing arch: {distro} -> {arch}") + pkg_list_arch = self.get_packages_for_arch(arch, pkg_list_distro) + pkg_names = [pkg['name'] for pkg in pkg_list_arch] + pkg_names = list(set(pkg_names)) + print(f" <> Package names: {pkg_names}") + for pkg_name in pkg_names: + print(f" >> Processing package: {distro} -> {arch} -> {pkg_name}") + pkg_list = self.get_pkg_list(pkg_name, pkg_list_arch) + pkg_versions = [pkg['version'] for pkg in pkg_list] + pkg_minor_versions = self.get_minor_versions(pkg_versions) + pkg_minor_to_keep = pkg_minor_versions[-self.NUM_PACKAGE_MINOR_TO_KEEP:] + print(f" <> Minor Package Versions to Keep: {pkg_minor_to_keep}") + pkg_minor_to_delete = list(set(pkg_minor_versions) - set(pkg_minor_to_keep)) + print(f" <> Minor Package Versions to Delete: {pkg_minor_to_delete}") + urls_to_keep = [pkg['package_url'] for pkg in pkg_list if '.'.join(pkg['version'].split('.')[:-1]) in pkg_minor_to_keep] + urls_to_delete = [pkg['package_url'] for pkg in pkg_list if '.'.join(pkg['version'].split('.')[:-1]) in pkg_minor_to_delete] + for pkg_url in urls_to_delete: + destroy_url = self.get_destroy_url(pkg_url) + self.delete_package(destroy_url) + + +def configure(): + parser = argparse.ArgumentParser() + parser.add_argument('--repo-type', '-r', required=True, + help='Repository type against to perform cleanup') + parser.add_argument('--dry-run', '-d', action='store_true', + help='Dry-run Mode') + args = parser.parse_args() + try: + token = os.environ['PKGCLOUD_TOKEN'] + except Exception as e: + print(f"FATAL: 'PKGCLOUD_TOKEN' environment variable is not set!", file=sys.stderr) + sys.exit(1) + repo_type = args.repo_type + dry_run = args.dry_run + conf = { + 'repo_type': args.repo_type, + 'dry_run': args.dry_run, + 'token': token + } + return conf + + +def main(): + config = configure() + pkg_cloud = PackageCloud(config['repo_type'], config['dry_run'], config['token']) + pkg_cloud.cleanup_repo() + + +if __name__ == "__main__": + main() diff --git a/.github/scripts/old_package_purging.sh b/.github/scripts/old_package_purging.sh deleted file mode 100755 index 727a1c256..000000000 --- a/.github/scripts/old_package_purging.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env bash -# -# Script to handle package cloud retention policy -# Our open source subscription is limited, -# so we use this script to control the number of packages maintained historically -# -# Dependencies: -# - PACKAGE_CLOUD_RETENTION_DAYS -# This is to indicate for how many days back we want to maintain the various RPM and DEB packages on package cloud -# -# Copyright : SPDX-License-Identifier: GPL-3.0-or-later -# -# Author : Pavlos Emm. Katsoulakis -# -set -e - -delete_files_for_version() { - local v="$1" - - # Delete the selected filenames in version - FILES_IN_VERSION=$(jq --sort-keys --arg v "${v}" '.[] | select ( .version | contains($v))' "${PKG_LIST_FILE}" | grep filename | cut -d':' -f 2) - - # Iterate through the files and delete them - for pkg in ${FILES_IN_VERSION/\\n/}; do - pkg=${pkg/,/} - pkg=${pkg/\"/} - pkg=${pkg/\"/} - echo "Attempting yank on ${pkg}.." - .github/scripts/package_cloud_wrapper.sh yank "${REPO}" "${pkg}" || echo "Nothing to yank or error on ${pkg}" - done -} - -# If we are not in netdata git repo, at the top level directory, fail -TOP_LEVEL=$(basename "$(git rev-parse --show-toplevel)") -CWD=$(git rev-parse --show-cdup) -if [ -n "$CWD" ] || [ ! "${TOP_LEVEL}" == "netdata" ]; then - echo "Run as .github/scripts/$(basename "$0") from top level directory of netdata git repository" - echo "Old packages yanking cancelled" - exit 1 -fi - -if [ -z "${REPO}" ]; then - echo "No REPO variable found" - exit 1 -fi - -if [ -z ${PKG_CLOUD_TOKEN} ]; then - echo "No PKG_CLOUD_TOKEN variable found" - exit 1 -fi - -if [ -z ${PACKAGE_CLOUD_RETENTION_DAYS} ]; then - echo "No PACKAGE_CLOUD_RETENTION_DAYS variable found" - exit 1 -fi - -TMP_DIR="$(mktemp -d /tmp/netdata-old-package-yanking-XXXXXX)" -PKG_LIST_FILE="${TMP_DIR}/complete_package_list.json" -DATE_EPOCH="1970-01-01" -DATE_UNTIL_TO_DELETE=$(date --date="${PACKAGE_CLOUD_RETENTION_DAYS} day ago" +%Y-%m-%d) - - -echo "Created temp directory: ${TMP_DIR}" -echo "We will be purging contents up until ${DATE_UNTIL_TO_DELETE}" - -echo "Calling package could to retrieve all available packages on ${REPO}" -curl -sS "https://${PKG_CLOUD_TOKEN}:@packagecloud.io/api/v1/repos/${REPO}/packages.json" > "${PKG_LIST_FILE}" - -# Get versions within the desired duration -# -VERSIONS_TO_PURGE=$(jq --arg s "${DATE_EPOCH}" --arg e "${DATE_UNTIL_TO_DELETE}" ' -[($s, $e) | strptime("%Y-%m-%d")[0:3]] as $r - | map(select( - (.created_at[:19] | strptime("%Y-%m-%dT%H:%M:%S")[0:3]) as $d - | $d >= $r[0] and $d <= $r[1] -))' "${PKG_LIST_FILE}" | grep '"version":' | sort -u | sed -e 's/ //g' | cut -d':' -f2) - -echo "We will be deleting the following versions: ${VERSIONS_TO_PURGE}" -for v in ${VERSIONS_TO_PURGE/\n//}; do - v=${v/\"/} - v=${v/\"/} - v=${v/,/} - echo "Remove all files for version $v" - delete_files_for_version "${v}" -done - -# Done, clean up -[ -d "${TMP_DIR}" ] && rm -rf "${TMP_DIR}" diff --git a/.github/scripts/package-upload.sh b/.github/scripts/package-upload.sh new file mode 100755 index 000000000..fd8a8cda2 --- /dev/null +++ b/.github/scripts/package-upload.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +set -e + +host="packages.netdata.cloud" +user="netdatabot" + +distro="${1}" +arch="${2}" +format="${3}" +repo="${4}" + +staging="${TMPDIR:-/tmp}/package-staging" +prefix="/home/netdatabot/incoming/${repo}/" + +packages="$(find artifacts -name "*.${format}")" + +mkdir -p "${staging}" + +case "${format}" in + deb) + src="${staging}/$(echo "${distro}" | cut -f 1 -d '/')/pool/" + mkdir -p "${src}" + + for pkg in ${packages}; do + cp "${pkg}" "${src}" + done + ;; + rpm) + src="${staging}/${distro}/${arch}/" + mkdir -p "${src}" + + for pkg in ${packages}; do + cp "${pkg}" "${src}" + done + ;; + *) + echo "Unrecognized package format ${format}." + exit 1 + ;; +esac + +rsync -vrptO "${staging}/" "${user}@${host}:${prefix}" diff --git a/.github/scripts/prepare-release-base.sh b/.github/scripts/prepare-release-base.sh index 838c4e86b..7c24f6b66 100755 --- a/.github/scripts/prepare-release-base.sh +++ b/.github/scripts/prepare-release-base.sh @@ -6,6 +6,7 @@ REPO="${1}" EVENT_NAME="${2}" EVENT_TYPE="${3}" EVENT_VERSION="${4}" +RELEASE_TEST="${5}" ############################################################## # Version validation functions @@ -94,7 +95,7 @@ check_newer_patch_version() { git config user.name "netdatabot" git config user.email "bot@netdata.cloud" -if [ "${REPO}" != "netdata/netdata" ]; then +if [ "${REPO}" != "netdata/netdata" ] && [ -z "${RELEASE_TEST}" ]; then echo "::notice::Not running in the netdata/netdata repository, not queueing a release build." echo "::set-output name=run::false" elif [ "${EVENT_NAME}" = 'schedule' ] || [ "${EVENT_TYPE}" = 'nightly' ]; then @@ -153,7 +154,7 @@ elif [ "${EVENT_TYPE}" = 'minor' ] && [ "${EVENT_VERSION}" != "nightly" ]; then echo "::set-output name=ref::${EVENT_VERSION}" echo "::set-output name=type::release" echo "::set-output name=branch::master" - echo "::set-output name=new-branch:${branch_name}" + echo "::set-output name=new-branch::${branch_name}" echo "::set-output name=version::$(tr -d 'v' < packaging/version)" elif [ "${EVENT_TYPE}" = 'major' ] && [ "${EVENT_VERSION}" != "nightly" ]; then echo "::notice::Preparing a major release build." diff --git a/.github/scripts/run-updater-check.sh b/.github/scripts/run-updater-check.sh index d8961f8b4..31ab71de8 100755 --- a/.github/scripts/run-updater-check.sh +++ b/.github/scripts/run-updater-check.sh @@ -1,5 +1,7 @@ #!/bin/sh +echo ">>> Installing CI support packages..." +/netdata/.github/scripts/ci-support-pkgs.sh echo ">>> Installing Netdata..." /netdata/packaging/installer/kickstart.sh --dont-wait --build-only --disable-telemetry || exit 1 echo "::group::Environment File Contents" diff --git a/.github/workflows/add-to-project.yml b/.github/workflows/add-to-project.yml new file mode 100644 index 000000000..ae58cfce2 --- /dev/null +++ b/.github/workflows/add-to-project.yml @@ -0,0 +1,26 @@ +name: Add issues to Agent Board + +on: + issues: + types: + - opened + - transferred + +jobs: + add-to-project: + name: Add issue to project + if: github.repository == 'netdata/netdata' + runs-on: ubuntu-latest + steps: + - name: Add issues to Agent project board + uses: actions/add-to-project@v0.3.0 + with: + project-url: https://github.com/orgs/netdata/projects/32 + github-token: ${{ secrets.NETDATABOT_ORG_GITHUB_TOKEN }} + + - name: Add issues to Product Bug project board + uses: actions/add-to-project@v0.3.0 + with: + project-url: https://github.com/orgs/netdata/projects/45 + github-token: ${{ secrets.NETDATABOT_ORG_GITHUB_TOKEN }} + labeled: bug diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16196342b..2b31cc261 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,11 @@ jobs: with: fetch-depth: 0 submodules: recursive + - name: Fix tags + id: fix-tags + if: github.event_name != 'push' + run: | + git fetch -f origin ${{ github.ref }}:${{ github.ref }} - name: Mark Stable id: channel if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' @@ -40,6 +45,7 @@ jobs: - name: Build id: build run: | + git describe mkdir -p artifacts ./packaging/installer/install-required-packages.sh --dont-wait --non-interactive netdata autoreconf -ivf @@ -71,6 +77,7 @@ jobs: SLACK_MESSAGE: |- ${{ github.repository }}: Failed to create source tarball for distribution. Checkout: ${{ steps.checkout.outcome }} + Fix Tags: ${{ steps.fix-tags.outcome }} Mark stable: ${{ steps.channel.outcome }} Build: ${{ steps.build.outcome }} Store: ${{ steps.store.outcome }} @@ -80,6 +87,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} build-static: # Build the static binary archives, and store them as artifacts. @@ -99,6 +107,11 @@ jobs: with: fetch-depth: 0 submodules: recursive + - name: Fix tags + id: fix-tags + if: github.event_name != 'push' + run: | + git fetch -f origin ${{ github.ref }}:${{ github.ref }} - name: Mark Stable id: channel if: github.event_name == 'workflow_dispatch' && github.event.inputs.type != 'nightly' @@ -142,6 +155,7 @@ jobs: SLACK_MESSAGE: |- ${{ github.repository }}: Failed to create static installer archive for ${{ matrix.arch }}. Checkout: ${{ steps.checkout.outcome }} + Fix Tags: ${{ steps.fix-tags.outcome }} Mark stable: ${{ steps.channel.outcome }} Build: ${{ steps.build.outcome }} Store: ${{ steps.store.outcome }} @@ -151,6 +165,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} matrix: # Generate the shared build matrix for our build tests. @@ -173,19 +188,32 @@ jobs: from ruamel.yaml import YAML import json yaml = YAML(typ='safe') + entries = list() + with open('.github/data/distros.yml') as f: data = yaml.load(f) - del data['platform_map'] + for i, v in enumerate(data['include']): - data['include'][i]['artifact_key'] = data['include'][i]['distro'] + str(data['include'][i]['version']).replace('.', '') - if 'packages' in data['include'][i]: - del data['include'][i]['packages'] - if 'base_image' in data['include'][i]: - data['include'][i]['distro'] = data['include'][i]['base_image'] - del data['include'][i]['base_image'] - data['include'][i]['distro'] = ':'.join([data['include'][i]['distro'], str(data['include'][i]['version'])]) - del data['include'][i]['version'] - matrix = json.dumps(data, sort_keys=True) + e = { + 'artifact_key': v['distro'] + str(v['version']).replace('.', ''), + 'version': v['version'], + } + + if 'base_image' in v: + e['distro'] = ':'.join([v['base_image'], str(v['version'])]) + else: + e['distro'] = ':'.join([v['distro'], str(v['version'])]) + + if 'env_prep' in v: + e['env_prep'] = v['env_prep'] + + if 'jsonc_removal' in v: + e['jsonc_removal'] = v['jsonc_removal'] + + entries.append(e) + + entries.sort(key=lambda k: k['distro']) + matrix = json.dumps({'include': entries}, sort_keys=True) print('Generated Matrix: ' + matrix) print('::set-output name=matrix::' + matrix) - name: Failure Notification @@ -207,6 +235,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} prepare-test-images: # Prepare the test environments for our build checks. This also checks dependency handling code for each tested environment. @@ -306,6 +335,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} source-build: # Test various source build arrangements. @@ -378,6 +408,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} updater-check: # Test the generated dist archive using the updater code. @@ -455,6 +486,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} prepare-upload: # Consolidate the artifacts for uploading or releasing. @@ -521,6 +553,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} artifact-verification-dist: # Verify the regular installer works with the consolidated artifacts. @@ -569,6 +602,7 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} artifact-verification-static: # Verify the static installer works with the consolidated artifacts. @@ -617,12 +651,13 @@ jobs: failure() && startsWith(github.ref, 'refs/heads/master') && github.event_name != 'pull_request' + && github.repository == 'netdata/netdata' }} upload-nightly: # Upload the nightly build artifacts to GCS. name: Upload Nightly Artifacts runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'nightly' && github.repository == 'netdata/netdata' needs: - updater-check - source-build @@ -690,7 +725,7 @@ jobs: upload-release: # Create the draft release and upload the build artifacts. name: Create Release Draft runs-on: ubuntu-latest - if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.type == 'release' && github.repository == 'netdata/netdata' needs: - updater-check - source-build diff --git a/.github/workflows/cloud_regression.yml b/.github/workflows/cloud_regression.yml index 03b12c157..b6e321fe1 100644 --- a/.github/workflows/cloud_regression.yml +++ b/.github/workflows/cloud_regression.yml @@ -13,6 +13,7 @@ on: jobs: trigger_cloud_regression_tests: runs-on: ubuntu-latest + if: github.repository == 'netdata/netdata' steps: - name: Evaluate workflow dispatch parameters env: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b1df95c33..b7eb53c8e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -59,6 +59,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} docker-ci: @@ -114,6 +115,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} normalize-tag: # Fix the release tag if needed @@ -149,7 +151,7 @@ jobs: id: release-tags if: github.event.inputs.version != 'nightly' run: | - echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }})" \ + echo "tags=netdata/netdata:latest,netdata/netdata:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '')" \ >> "${GITHUB_ENV}" - name: Determine which tags to use id: nightly-tags @@ -168,6 +170,7 @@ jobs: uses: docker/setup-buildx-action@v2 - name: Docker Hub Login id: login + if: github.repository == 'netdata/netdata' uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} @@ -177,7 +180,7 @@ jobs: uses: docker/build-push-action@v3 with: platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64,linux/ppc64le - push: true + push: ${{ github.repository == 'netdata/netdata' }} tags: ${{ env.tags }} build-args: OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }} - name: Failure Notification @@ -204,9 +207,10 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} - name: Trigger Helmchart PR - if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly' + if: github.event_name == 'workflow_dispatch' && github.event.inputs.version != 'nightly' && github.repository == 'netdata/netdata' uses: benc-uk/workflow-dispatch@v1 with: token: ${{ secrets.NETDATABOT_GITHUB_TOKEN }} @@ -214,3 +218,81 @@ jobs: workflow: Agent Version PR ref: refs/heads/master inputs: '{"agent_version": "${{ needs.normalize-tag.outputs.tag }}"}' + + docker-dbg-publish: + if: github.event_name == 'workflow_dispatch' + name: Docker Build and Publish (Debuging Image) + needs: + - docker-test + - normalize-tag + runs-on: ubuntu-latest + steps: + - name: Checkout + id: checkout + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Determine which tags to use + id: release-tags + if: github.event.inputs.version != 'nightly' + run: | + echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:stable,$(.github/scripts/gen-docker-tags.py ${{ needs.normalize-tag.outputs.tag }} '-debug')" \ + >> "${GITHUB_ENV}" + - name: Determine which tags to use + id: nightly-tags + if: github.event.inputs.version == 'nightly' + run: | + echo "tags=netdata/netdata-debug:latest,netdata/netdata-debug:edge" >> "${GITHUB_ENV}" + - name: Mark image as official + id: env + if: github.repository == 'netdata/netdata' + run: echo "OFFICIAL_IMAGE=true" >> "${GITHUB_ENV}" + - name: Setup QEMU + id: qemu + uses: docker/setup-qemu-action@v2 + - name: Setup Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + - name: Docker Hub Login + id: login + if: github.repository == 'netdata/netdata' + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_PASSWORD }} + - name: Docker Build + id: build + uses: docker/build-push-action@v3 + with: + platforms: linux/amd64,linux/i386,linux/arm/v7,linux/arm64,linux/ppc64le + push: ${{ github.repository == 'netdata/netdata' }} + tags: ${{ env.tags }} + build-args: | + OFFICIAL_IMAGE=${{ env.OFFICIAL_IMAGE }} + DEBUG_BUILD=1 + - name: Failure Notification + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_COLOR: 'danger' + SLACK_FOOTER: '' + SLACK_ICON_EMOJI: ':github-actions:' + SLACK_TITLE: 'Docker Debug Build failed:' + SLACK_USERNAME: 'GitHub Actions' + SLACK_MESSAGE: |- + ${{ github.repository }}: Failed to build or publish Docker debug images. + CHeckout: ${{ steps.checkout.outcome }} + Generate release tags: ${{ steps.release-tags.outcome }} + Generate nightly tags: ${{ steps.nightly-tags.outcome }} + Setup environment: ${{ steps.env.outcome }} + Setup QEMU: ${{ steps.qemu.outcome }} + Setup buildx: ${{ steps.buildx.outcome }} + Authenticate against DockerHub: ${{ steps.login.outcome }} + Build and publish images: ${{ steps.build.outcome }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + if: >- + ${{ + failure() + && github.event_name != 'pull_request' + && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' + }} diff --git a/.github/workflows/packagecloud.yml b/.github/workflows/packagecloud.yml new file mode 100644 index 000000000..ba70c177b --- /dev/null +++ b/.github/workflows/packagecloud.yml @@ -0,0 +1,36 @@ +--- +# Runs PackageCloud cleanup every day at 9pm +name: PackageCloud Cleanup +on: + schedule: + - cron: '0 21 * * *' + workflow_dispatch: null + +jobs: + cleanup: + name: PackageCloud Cleanup + runs-on: ubuntu-latest + if: github.repository == 'netdata/netdata' + strategy: + fail-fast: false + matrix: + repos: + - stable + - edge + - devel + steps: + - name: Checkout + uses: actions/checkout@v3 + id: checkout + with: + submodules: recursive + - name: Prepare environment + id: prepare + run: | + pip3 install requests python-dateutil + - name: Run PackageCloud Cleanup + id: cleanup + env: + PKGCLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }} + run: | + python3 .github/scripts/netdata-pkgcloud-cleanup.py -r ${{ matrix.repos }} diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml index d793d48a8..ec4e42c00 100644 --- a/.github/workflows/packaging.yml +++ b/.github/workflows/packaging.yml @@ -46,7 +46,7 @@ jobs: import json import re FULL_CI_REGEX = '/actions run full ci' - ALWAYS_RUN_ARCHES = ["amd64"] + ALWAYS_RUN_ARCHES = ["amd64", "x86_64"] PR_BODY = """${{ github.event.pull_request.body }}""" yaml = YAML(typ='safe') entries = list() @@ -65,14 +65,14 @@ jobs: entries.append({ 'distro': data['include'][i]['distro'], 'version': data['include'][i]['version'], - 'pkgclouddistro': data['include'][i]['packages']['repo_distro'], + 'repo_distro': data['include'][i]['packages']['repo_distro'], 'format': data['include'][i]['packages']['type'], 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'], 'platform': data['platform_map'][arch], 'arch': arch }) - entries.sort(key=lambda k: (k['arch'], k['distro'], k['version'])) + entries.sort(key=lambda k: (data['arch_order'].index(k['arch']), k['distro'], k['version'])) matrix = json.dumps({'include': entries}, sort_keys=True) print('Generated Matrix: ' + matrix) print('::set-output name=matrix::' + matrix) @@ -94,6 +94,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} version-check: @@ -149,6 +150,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} build: @@ -214,28 +216,38 @@ jobs: -e VERSION=${{ needs.version-check.outputs.version }} -e DISTRO_VERSION=${{ matrix.version }} \ --platform=${{ matrix.platform }} -v "$PWD":/netdata ${{ matrix.base_image }}:${{ matrix.version }} \ /netdata/.github/scripts/pkg-test.sh + - name: SSH setup + id: ssh-setup + if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' + continue-on-error: true + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }} + name: id_ecdsa + known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }} + - name: Upload to packages.netdata.cloud + id: package-upload + continue-on-error: true + if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' + run: | + .github/scripts/package-upload.sh \ + ${{ matrix.repo_distro }} \ + ${{ matrix.arch }} \ + ${{ matrix.format }} \ + ${{ needs.version-check.outputs.repo }} - name: Upload to PackageCloud id: upload - if: github.event_name == 'workflow_dispatch' + if: github.event_name == 'workflow_dispatch' && github.repository == 'netdata/netdata' shell: bash env: PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }} run: | printf "Packages to upload:\n%s" "$(ls artifacts/*.${{ matrix.format }})" for pkgfile in artifacts/*.${{ matrix.format }} ; do - .github/scripts/package_cloud_wrapper.sh yank ${{ needs.version-check.outputs.repo }}/${{ matrix.pkgclouddistro }} \ + .github/scripts/package_cloud_wrapper.sh yank ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} \ "$(basename "${pkgfile}")" || true - .github/scripts/package_cloud_wrapper.sh push ${{ needs.version-check.outputs.repo }}/${{ matrix.pkgclouddistro }} "${pkgfile}" + .github/scripts/package_cloud_wrapper.sh push ${{ needs.version-check.outputs.repo }}/${{ matrix.repo_distro }} "${pkgfile}" done - - name: Clean - id: cleanup - if: github.event_name == 'workflow_dispatch' - shell: bash - env: - REPO: ${{ needs.version-check.outputs.repo }} - PKG_CLOUD_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_KEY }} - PACKAGE_CLOUD_RETENTION_DAYS: ${{ needs.version-check.outputs.retention }} - run: .github/scripts/old_package_purging.sh - name: Failure Notification uses: rtCamp/action-slack-notify@v2 env: @@ -244,19 +256,21 @@ jobs: SLACK_TITLE: 'Package Build failed:' SLACK_USERNAME: 'GitHub Actions' SLACK_MESSAGE: |- - ${{ github.repository }}: ${{ matrix.pkgclouddistro }} ${{ matrix.version }} package build for ${{ matrix.arch }} failed. + ${{ github.repository }}: ${{ matrix.repo_distro }} ${{ matrix.version }} package build for ${{ matrix.arch }} failed. Checkout: ${{ steps.checkout.outcome }} Setup QEMU: ${{ steps.qemu.outcome }} Setup Docker: ${{ steps.docker-config.outcome }} Fetch images: ${{ steps.fetch-images.outcome }} Build: ${{ steps.build.outcome }} Test: ${{ steps.test.outcome }} - Publish: ${{ steps.upload.outcome }} - Cleanup: ${{ steps.cleanup.outcome }} + Import SSH Key: ${{ steps.ssh-setup.outcome }} + Publish to packages.netdata.cloud: ${{ steps.package-upload.outcome }} + Publish to PackageCloud: ${{ steps.upload.outcome }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} if: >- ${{ failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae28c0019..e16ecaba7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,7 +41,8 @@ jobs: ${{ github.repository }} \ ${{ github.event_name }} \ ${{ github.event.inputs.type }} \ - ${{ github.event.inputs.version }} + ${{ github.event.inputs.version }} \ + ${{ secrets.NETDATA_RELEASE_TEST }} - name: Generate Nightly Changleog id: nightly-changelog if: steps.target.outputs.run == 'true' && steps.target.outputs.type == 'nightly' @@ -111,7 +112,7 @@ jobs: name: Trigger artifact builds runs-on: ubuntu-latest needs: update-changelogs - if: ${{ needs.update-changelogs.outputs.run }} == 'true' + if: needs.update-changelogs.outputs.run == 'true' steps: - name: Checkout id: checkout @@ -146,7 +147,7 @@ jobs: name: Trigger docker builds runs-on: ubuntu-latest needs: update-changelogs - if: ${{ needs.update-changelogs.outputs.run }} == 'true' + if: needs.update-changelogs.outputs.run == 'true' steps: - name: Checkout id: checkout @@ -181,7 +182,7 @@ jobs: name: Trigger package builds runs-on: ubuntu-latest needs: update-changelogs - if: ${{ needs.update-changelogs.outputs.run }} == 'true' + if: needs.update-changelogs.outputs.run == 'true' steps: - name: Checkout id: checkout diff --git a/.github/workflows/repoconfig-packages.yml b/.github/workflows/repoconfig-packages.yml index b0600cc0b..824ddd341 100644 --- a/.github/workflows/repoconfig-packages.yml +++ b/.github/workflows/repoconfig-packages.yml @@ -7,12 +7,14 @@ on: paths: - packaging/repoconfig/** - .github/workflows/repoconfig-packages.yml + - .github/data/distros.yml push: branches: - master paths: - packaging/repoconfig/** - .github/workflows/repoconfig-packages.yml + - .github/data/distros.yml env: DISABLE_TELEMETRY: 1 REPO_PREFIX: netdata/netdata @@ -50,11 +52,10 @@ jobs: 'pkgclouddistro': data['include'][i]['packages']['repo_distro'], 'format': data['include'][i]['packages']['type'], 'base_image': data['include'][i]['base_image'] if 'base_image' in data['include'][i] else data['include'][i]['distro'], - 'platform': data['platform_map']['amd64'], - 'arch': 'amd64' + 'platform': data['platform_map']['amd64'] }) - entries.sort(key=lambda k: (k['arch'], k['distro'], k['version'])) + entries.sort(key=lambda k: (k['distro'], k['version'])) matrix = json.dumps({'include': entries}, sort_keys=True) print('Generated Matrix: ' + matrix) print('::set-output name=matrix::' + matrix) @@ -76,6 +77,7 @@ jobs: failure() && github.event_name != 'pull_request' && startsWith(github.ref, 'refs/heads/master') + && github.repository == 'netdata/netdata' }} build: @@ -113,6 +115,35 @@ jobs: docker run --security-opt seccomp=unconfined -e DISABLE_TELEMETRY=1 --platform ${{ matrix.platform }} \ -v "$PWD":/netdata ${{ matrix.base_image }}:${{ matrix.version }} \ /netdata/packaging/repoconfig/build-${{ matrix.format }}.sh + - name: SSH setup + id: ssh-setup + if: github.event_name == 'workflow_dispatch' + continue-on-error: true + uses: shimataro/ssh-key-action@v2 + with: + key: ${{ secrets.NETDATABOT_PACKAGES_SSH_KEY }} + name: id_ecdsa + known_hosts: ${{ secrets.PACKAGES_KNOWN_HOSTS }} + - name: Upload to packages.netdata.cloud + id: package-upload + continue-on-error: true + if: github.event_name == 'workflow_dispatch' + run: | + .github/scripts/package-upload.sh \ + ${{ matrix.repo_distro }} \ + ${{ matrix.arch }} \ + ${{ matrix.format }} \ + netdata/netdata + .github/scripts/package-upload.sh \ + ${{ matrix.repo_distro }} \ + ${{ matrix.arch }} \ + ${{ matrix.format }} \ + netdata/netdata-edge + .github/scripts/package-upload.sh \ + ${{ matrix.repo_distro }} \ + ${{ matrix.arch }} \ + ${{ matrix.format }} \ + netdata/netdata-repoconfig - name: Upload Packages id: publish if: github.event_name != 'pull_request' && github.repository == 'netdata/netdata' @@ -133,7 +164,7 @@ jobs: .github/scripts/package_cloud_wrapper.sh push "${REPO_PREFIX}-repoconfig/${{ matrix.pkgclouddistro }}" "${pkgfile}" done - name: Failure Notification - if: ${{ failure() }} + if: ${{ failure() && github.repository == 'netdata/netdata' }} uses: rtCamp/action-slack-notify@v2 env: SLACK_COLOR: 'danger' @@ -146,5 +177,7 @@ jobs: Checkout: ${{ steps.checkout.outcome }} Fetch images: ${{ steps.fetch-images.outcome }} Build: ${{ steps.build.outcome }} - Publish: ${{ steps.publish.outcome }} + Import SSH Key: ${{ steps.ssh-setup.outcome }} + Publish to packages.netdata.cloud: ${{ steps.package-upload.outcome }} + Publish to PackageCloud: ${{ steps.publish.outcome }} SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.gitignore b/.gitignore index 2d7051485..275b5d007 100644 --- a/.gitignore +++ b/.gitignore @@ -228,3 +228,7 @@ Session.*.vim # Jupyter notebook checkpoints .ipynb_checkpoints + +# Judy stuff +JudyLTables.c +judyltablesgen diff --git a/.lgtm.yml b/.lgtm.yml index f6c740891..dcbd7853d 100644 --- a/.lgtm.yml +++ b/.lgtm.yml @@ -17,5 +17,6 @@ path_classifiers: - web/gui/lib/ - web/gui/src/ - web/gui/css/ + - libnetdata/libjudy/ test: - tests/ diff --git a/.travis.yml b/.travis.yml index 838799f8f..e729815a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ before_install: # Install dependencies for all, once # install: - - sudo apt-get install -y libuv1-dev liblz4-dev libjudy-dev libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev gnupg python3-pip + - sudo apt-get install -y libuv1-dev liblz4-dev libcap2-bin zlib1g-dev uuid-dev fakeroot libipmimonitoring-dev libmnl-dev libnetfilter-acct-dev gnupg python3-pip - sudo pip3 install git-semver==0.3.2 # 11/Sep/2019: git-semver tip was broken, so we had to force last good run of it - source tests/installer/slack.sh - export NOTIF_CHANNEL="automation-beta" diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a90778b8..53ab78a01 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,218 @@ # Changelog -## [v1.35.1](https://github.com/netdata/netdata/tree/v1.35.1) (2022-06-10) +## [v1.36.0](https://github.com/netdata/netdata/tree/v1.36.0) (2022-08-10) -[Full Changelog](https://github.com/netdata/netdata/compare/v1.35.0...v1.35.1) +[Full Changelog](https://github.com/netdata/netdata/compare/v1.35.1...v1.36.0) **Merged pull requests:** +- rrdcontexts allow not linked dimensions and charts [\#13501](https://github.com/netdata/netdata/pull/13501) ([ktsaou](https://github.com/ktsaou)) +- docs: add deprecation notice to python.d/postgres readme [\#13497](https://github.com/netdata/netdata/pull/13497) ([ilyam8](https://github.com/ilyam8)) +- docs: change postgres links to go version [\#13496](https://github.com/netdata/netdata/pull/13496) ([ilyam8](https://github.com/ilyam8)) +- bump go.d version to v0.35.0 [\#13494](https://github.com/netdata/netdata/pull/13494) ([ilyam8](https://github.com/ilyam8)) +- add PgBouncer charts description and icon to dashboard info [\#13493](https://github.com/netdata/netdata/pull/13493) ([ilyam8](https://github.com/ilyam8)) +- Add chart\_context to alert snapshots [\#13492](https://github.com/netdata/netdata/pull/13492) ([MrZammler](https://github.com/MrZammler)) +- Remove prompt to add dashboard issues [\#13490](https://github.com/netdata/netdata/pull/13490) ([cakrit](https://github.com/cakrit)) +- docs: fix unresolved file references [\#13488](https://github.com/netdata/netdata/pull/13488) ([ilyam8](https://github.com/ilyam8)) +- docs: add a note about edit-config for docker installs [\#13487](https://github.com/netdata/netdata/pull/13487) ([ilyam8](https://github.com/ilyam8)) +- health: disable go python last collected alarms [\#13485](https://github.com/netdata/netdata/pull/13485) ([ilyam8](https://github.com/ilyam8)) +- bump go.d.plugin version to v0.34.0 [\#13484](https://github.com/netdata/netdata/pull/13484) ([ilyam8](https://github.com/ilyam8)) +- chore: add WireGuard description and icon to dashboard info [\#13483](https://github.com/netdata/netdata/pull/13483) ([ilyam8](https://github.com/ilyam8)) +- feat\(cgroups.plugin\): resolve nomad containers name \(docker driver only\) [\#13481](https://github.com/netdata/netdata/pull/13481) ([ilyam8](https://github.com/ilyam8)) +- Check for protected when excluding mounts [\#13479](https://github.com/netdata/netdata/pull/13479) ([MrZammler](https://github.com/MrZammler)) +- update postgres dashboard info [\#13474](https://github.com/netdata/netdata/pull/13474) ([ilyam8](https://github.com/ilyam8)) +- Remove the single threaded arrayallocator optiomization during agent startup [\#13473](https://github.com/netdata/netdata/pull/13473) ([stelfrag](https://github.com/stelfrag)) +- Handle cases where entries where stored as text \(with strftime\("%s"\)\) [\#13472](https://github.com/netdata/netdata/pull/13472) ([stelfrag](https://github.com/stelfrag)) +- Enable rrdcontexts by default [\#13471](https://github.com/netdata/netdata/pull/13471) ([stelfrag](https://github.com/stelfrag)) +- Fix cgroup name detection for docker containers in containerd cgroup [\#13470](https://github.com/netdata/netdata/pull/13470) ([xkisu](https://github.com/xkisu)) +- Trimmed-median, trimmed-mean and percentile [\#13469](https://github.com/netdata/netdata/pull/13469) ([ktsaou](https://github.com/ktsaou)) +- rrdcontext support for hidden charts [\#13466](https://github.com/netdata/netdata/pull/13466) ([ktsaou](https://github.com/ktsaou)) +- Load host labels for archived hosts [\#13464](https://github.com/netdata/netdata/pull/13464) ([stelfrag](https://github.com/stelfrag)) +- fix\(python.d/smartd\_log\): handle log rotation [\#13460](https://github.com/netdata/netdata/pull/13460) ([ilyam8](https://github.com/ilyam8)) +- docs: add a note about network interface monitoring when running in a Docker container [\#13458](https://github.com/netdata/netdata/pull/13458) ([ilyam8](https://github.com/ilyam8)) +- fix a guide so we can reference it's subsections [\#13455](https://github.com/netdata/netdata/pull/13455) ([tkatsoulas](https://github.com/tkatsoulas)) +- Revert "Query queue only for queries" [\#13452](https://github.com/netdata/netdata/pull/13452) ([stelfrag](https://github.com/stelfrag)) +- /api/v1/weights endpoint [\#13449](https://github.com/netdata/netdata/pull/13449) ([ktsaou](https://github.com/ktsaou)) +- Get last\_entry\_t only when st changes [\#13448](https://github.com/netdata/netdata/pull/13448) ([MrZammler](https://github.com/MrZammler)) +- additional stats [\#13445](https://github.com/netdata/netdata/pull/13445) ([ktsaou](https://github.com/ktsaou)) +- Store host label information in the metadata database [\#13441](https://github.com/netdata/netdata/pull/13441) ([stelfrag](https://github.com/stelfrag)) +- Fix typo in PostgreSQL section header [\#13440](https://github.com/netdata/netdata/pull/13440) ([shyamvalsan](https://github.com/shyamvalsan)) +- Fix tests so that the actual metadata database is not accessed [\#13439](https://github.com/netdata/netdata/pull/13439) ([stelfrag](https://github.com/stelfrag)) +- Delete aclk\_alert table on start streaming from seq 1 batch 1 [\#13438](https://github.com/netdata/netdata/pull/13438) ([MrZammler](https://github.com/MrZammler)) +- Fix agent crash when archived host has not been registered to the cloud [\#13437](https://github.com/netdata/netdata/pull/13437) ([stelfrag](https://github.com/stelfrag)) +- Dont duplicate buffered bytes [\#13435](https://github.com/netdata/netdata/pull/13435) ([vlvkobal](https://github.com/vlvkobal)) +- Show last 15 alerts in notification [\#13434](https://github.com/netdata/netdata/pull/13434) ([MrZammler](https://github.com/MrZammler)) +- Query queue only for queries [\#13431](https://github.com/netdata/netdata/pull/13431) ([underhood](https://github.com/underhood)) +- Remove octopus from demo-sites [\#13423](https://github.com/netdata/netdata/pull/13423) ([cakrit](https://github.com/cakrit)) +- Tiering statistics API endpoint [\#13420](https://github.com/netdata/netdata/pull/13420) ([ktsaou](https://github.com/ktsaou)) +- add discord, youtube, linkedin links to README [\#13419](https://github.com/netdata/netdata/pull/13419) ([andrewm4894](https://github.com/andrewm4894)) +- add ML bullet point to features section on README [\#13418](https://github.com/netdata/netdata/pull/13418) ([andrewm4894](https://github.com/andrewm4894)) +- Set value to SN\_EMPTY\_SLOT if flags is SN\_EMPTY\_SLOT [\#13417](https://github.com/netdata/netdata/pull/13417) ([MrZammler](https://github.com/MrZammler)) +- Add missing comma \(handle coverity warning CID 379360\) [\#13413](https://github.com/netdata/netdata/pull/13413) ([stelfrag](https://github.com/stelfrag)) +- codacy/lgtm ignore judy sources [\#13411](https://github.com/netdata/netdata/pull/13411) ([underhood](https://github.com/underhood)) +- Send chart context with alert events to the cloud [\#13409](https://github.com/netdata/netdata/pull/13409) ([MrZammler](https://github.com/MrZammler)) +- Remove SIGSEGV and SIGABRT \(ebpf.plugin\) [\#13407](https://github.com/netdata/netdata/pull/13407) ([thiagoftsm](https://github.com/thiagoftsm)) +- minor fixes on metadata fields [\#13406](https://github.com/netdata/netdata/pull/13406) ([tkatsoulas](https://github.com/tkatsoulas)) +- chore\(health\): remove py web\_log alarms [\#13404](https://github.com/netdata/netdata/pull/13404) ([ilyam8](https://github.com/ilyam8)) +- Store host system information in the database [\#13402](https://github.com/netdata/netdata/pull/13402) ([stelfrag](https://github.com/stelfrag)) +- Fix coverity issue 379240 \(Unchecked return value\) [\#13401](https://github.com/netdata/netdata/pull/13401) ([stelfrag](https://github.com/stelfrag)) +- Fix netdata-updater.sh sha256sum on BSDs [\#13391](https://github.com/netdata/netdata/pull/13391) ([tnyeanderson](https://github.com/tnyeanderson)) +- chore\(python.d\): clarify haproxy module readme [\#13388](https://github.com/netdata/netdata/pull/13388) ([ilyam8](https://github.com/ilyam8)) +- Fix bitmap unit tests [\#13374](https://github.com/netdata/netdata/pull/13374) ([stelfrag](https://github.com/stelfrag)) +- chore\(dashboard\): update chrony dashboard info [\#13371](https://github.com/netdata/netdata/pull/13371) ([ilyam8](https://github.com/ilyam8)) +- chore\(python.d\): remove python.d/\* announced in v1.35.0 deprecation notice [\#13370](https://github.com/netdata/netdata/pull/13370) ([ilyam8](https://github.com/ilyam8)) +- bump go.d.plugin version to v0.33.1 [\#13369](https://github.com/netdata/netdata/pull/13369) ([ilyam8](https://github.com/ilyam8)) +- Add Oracle Linux 9 to officially supported platforms. [\#13367](https://github.com/netdata/netdata/pull/13367) ([Ferroin](https://github.com/Ferroin)) +- Address Coverity issues [\#13364](https://github.com/netdata/netdata/pull/13364) ([stelfrag](https://github.com/stelfrag)) +- chore\(python.d\): improve config file parsing error message [\#13363](https://github.com/netdata/netdata/pull/13363) ([ilyam8](https://github.com/ilyam8)) +- in source Judy [\#13362](https://github.com/netdata/netdata/pull/13362) ([underhood](https://github.com/underhood)) +- Add additional Docker image build with debug info included. [\#13359](https://github.com/netdata/netdata/pull/13359) ([Ferroin](https://github.com/Ferroin)) +- Move host tags to netdata\_info [\#13358](https://github.com/netdata/netdata/pull/13358) ([vlvkobal](https://github.com/vlvkobal)) +- Get rid of extra comma in OpenTSDB exporting [\#13355](https://github.com/netdata/netdata/pull/13355) ([vlvkobal](https://github.com/vlvkobal)) +- Fix chart update ebpf.plugin [\#13351](https://github.com/netdata/netdata/pull/13351) ([thiagoftsm](https://github.com/thiagoftsm)) +- add job to move bugs to project board [\#13350](https://github.com/netdata/netdata/pull/13350) ([hugovalente-pm](https://github.com/hugovalente-pm)) +- added another way to get ansible plays [\#13349](https://github.com/netdata/netdata/pull/13349) ([mhkarimi1383](https://github.com/mhkarimi1383)) +- Send node info message sooner [\#13348](https://github.com/netdata/netdata/pull/13348) ([MrZammler](https://github.com/MrZammler)) +- query engine: omit first point if not needed [\#13345](https://github.com/netdata/netdata/pull/13345) ([ktsaou](https://github.com/ktsaou)) +- fix 32bit calculation on array allocator [\#13343](https://github.com/netdata/netdata/pull/13343) ([ktsaou](https://github.com/ktsaou)) +- fix crash on start on slow disks because ml is initialized before dbengine starts [\#13342](https://github.com/netdata/netdata/pull/13342) ([ktsaou](https://github.com/ktsaou)) +- fix\(packaging\): respect CFLAGS arg when building Docker image [\#13340](https://github.com/netdata/netdata/pull/13340) ([ilyam8](https://github.com/ilyam8)) +- add github stars badge to readme [\#13338](https://github.com/netdata/netdata/pull/13338) ([andrewm4894](https://github.com/andrewm4894)) +- Fix coverity 379241 [\#13336](https://github.com/netdata/netdata/pull/13336) ([MrZammler](https://github.com/MrZammler)) +- Rrdcontext [\#13335](https://github.com/netdata/netdata/pull/13335) ([ktsaou](https://github.com/ktsaou)) +- Detect stored metric size by page type [\#13334](https://github.com/netdata/netdata/pull/13334) ([stelfrag](https://github.com/stelfrag)) +- Silence compile warnings on external source [\#13332](https://github.com/netdata/netdata/pull/13332) ([MrZammler](https://github.com/MrZammler)) +- UpdateNodeCollectors message [\#13330](https://github.com/netdata/netdata/pull/13330) ([MrZammler](https://github.com/MrZammler)) +- Cid 379238 379238 [\#13328](https://github.com/netdata/netdata/pull/13328) ([stelfrag](https://github.com/stelfrag)) +- Docs fix metric storage [\#13327](https://github.com/netdata/netdata/pull/13327) ([tkatsoulas](https://github.com/tkatsoulas)) +- Fix two helgrind reports [\#13325](https://github.com/netdata/netdata/pull/13325) ([vkalintiris](https://github.com/vkalintiris)) +- fix\(cgroups.plugin\): adjust kubepods patterns to filter pods when using Kind cluster [\#13324](https://github.com/netdata/netdata/pull/13324) ([ilyam8](https://github.com/ilyam8)) +- Add link to docker config section [\#13323](https://github.com/netdata/netdata/pull/13323) ([cakrit](https://github.com/cakrit)) +- Guide for troubleshooting Agent with Cloud connection for new nodes [\#13322](https://github.com/netdata/netdata/pull/13322) ([Ancairon](https://github.com/Ancairon)) +- fix\(apps.plugin\): adjust `zmstat*` pattern to exclude zoneminder scripts [\#13314](https://github.com/netdata/netdata/pull/13314) ([ilyam8](https://github.com/ilyam8)) +- array allocator for dbengine page descriptors [\#13312](https://github.com/netdata/netdata/pull/13312) ([ktsaou](https://github.com/ktsaou)) +- fix\(health\): disable go.d last collected alarm for prometheus module [\#13309](https://github.com/netdata/netdata/pull/13309) ([ilyam8](https://github.com/ilyam8)) +- Explicitly skip uploads and notifications in third-party repositories. [\#13308](https://github.com/netdata/netdata/pull/13308) ([Ferroin](https://github.com/Ferroin)) +- Protect shared variables with log lock. [\#13306](https://github.com/netdata/netdata/pull/13306) ([vkalintiris](https://github.com/vkalintiris)) +- Keep rc before freeing it during labels unlink alarms [\#13305](https://github.com/netdata/netdata/pull/13305) ([MrZammler](https://github.com/MrZammler)) +- fix\(cgroups.plugin\): adjust kubepods regex to fix name resolution in a kind cluster [\#13302](https://github.com/netdata/netdata/pull/13302) ([ilyam8](https://github.com/ilyam8)) +- Null terminate string if file read was not successful [\#13299](https://github.com/netdata/netdata/pull/13299) ([stelfrag](https://github.com/stelfrag)) +- fix\(health\): fix incorrect Redis dimension names [\#13296](https://github.com/netdata/netdata/pull/13296) ([ilyam8](https://github.com/ilyam8)) +- chore: remove python-mysql from install-required-packages.sh [\#13288](https://github.com/netdata/netdata/pull/13288) ([ilyam8](https://github.com/ilyam8)) +- Use new MQTT as default \(revert \#13258\)" [\#13287](https://github.com/netdata/netdata/pull/13287) ([underhood](https://github.com/underhood)) +- query engine fixes for alarms and dashboards [\#13282](https://github.com/netdata/netdata/pull/13282) ([ktsaou](https://github.com/ktsaou)) +- Better ACLK debug communication log [\#13281](https://github.com/netdata/netdata/pull/13281) ([underhood](https://github.com/underhood)) +- bump go.d.plugin version to v0.33.0 [\#13280](https://github.com/netdata/netdata/pull/13280) ([ilyam8](https://github.com/ilyam8)) +- Fixes vbi parser in mqtt5 implementation [\#13277](https://github.com/netdata/netdata/pull/13277) ([underhood](https://github.com/underhood)) +- Fix alignment in charts endpoint [\#13275](https://github.com/netdata/netdata/pull/13275) ([thiagoftsm](https://github.com/thiagoftsm)) +- Dont print io errors for cgroups [\#13274](https://github.com/netdata/netdata/pull/13274) ([vlvkobal](https://github.com/vlvkobal)) +- Pluginsd doc [\#13273](https://github.com/netdata/netdata/pull/13273) ([thiagoftsm](https://github.com/thiagoftsm)) +- Remove obsolete --use-system-lws option from netdata-installer.sh help [\#13272](https://github.com/netdata/netdata/pull/13272) ([Dim-P](https://github.com/Dim-P)) +- Rename the chart of real memory usage in FreeBSD [\#13271](https://github.com/netdata/netdata/pull/13271) ([vlvkobal](https://github.com/vlvkobal)) +- Update documentation about our REST API documentation. [\#13269](https://github.com/netdata/netdata/pull/13269) ([Ferroin](https://github.com/Ferroin)) +- Fix package build filtering on PRs. [\#13267](https://github.com/netdata/netdata/pull/13267) ([Ferroin](https://github.com/Ferroin)) +- Add document explaining how to proxy Netdata via H2O [\#13266](https://github.com/netdata/netdata/pull/13266) ([Ferroin](https://github.com/Ferroin)) +- chore\(python.d\): remove deprecated modules from python.d.conf [\#13264](https://github.com/netdata/netdata/pull/13264) ([ilyam8](https://github.com/ilyam8)) +- Multi-Tier database backend for long term metrics storage [\#13263](https://github.com/netdata/netdata/pull/13263) ([stelfrag](https://github.com/stelfrag)) +- Get rid of extra semicolon in Graphite exporting [\#13261](https://github.com/netdata/netdata/pull/13261) ([vlvkobal](https://github.com/vlvkobal)) +- fix RAM calculation on macOS in system-info [\#13260](https://github.com/netdata/netdata/pull/13260) ([ilyam8](https://github.com/ilyam8)) +- Ebpf issues [\#13259](https://github.com/netdata/netdata/pull/13259) ([thiagoftsm](https://github.com/thiagoftsm)) +- Use old mqtt implementation as default [\#13258](https://github.com/netdata/netdata/pull/13258) ([MrZammler](https://github.com/MrZammler)) +- Remove warnings while compiling ML on FreeBSD [\#13255](https://github.com/netdata/netdata/pull/13255) ([thiagoftsm](https://github.com/thiagoftsm)) +- Fix issues with DEB postinstall script. [\#13252](https://github.com/netdata/netdata/pull/13252) ([Ferroin](https://github.com/Ferroin)) +- Remove strftime from statements and use unixepoch instead [\#13250](https://github.com/netdata/netdata/pull/13250) ([stelfrag](https://github.com/stelfrag)) +- Query engine with natural and virtual points [\#13248](https://github.com/netdata/netdata/pull/13248) ([ktsaou](https://github.com/ktsaou)) +- Add fstype labels to disk charts [\#13245](https://github.com/netdata/netdata/pull/13245) ([vlvkobal](https://github.com/vlvkobal)) +- Don’t pull in GCC for build if Clang is already present. [\#13244](https://github.com/netdata/netdata/pull/13244) ([Ferroin](https://github.com/Ferroin)) +- Delay health until obsoletions check is complete [\#13239](https://github.com/netdata/netdata/pull/13239) ([MrZammler](https://github.com/MrZammler)) +- Improve anomaly detection guide [\#13238](https://github.com/netdata/netdata/pull/13238) ([andrewm4894](https://github.com/andrewm4894)) +- Implement PackageCloud cleanup [\#13236](https://github.com/netdata/netdata/pull/13236) ([maneamarius](https://github.com/maneamarius)) +- Bump repoconfig package version used in kickstart.sh [\#13235](https://github.com/netdata/netdata/pull/13235) ([Ferroin](https://github.com/Ferroin)) +- Updates the sqlite version in the agent [\#13233](https://github.com/netdata/netdata/pull/13233) ([stelfrag](https://github.com/stelfrag)) +- Migrate data when machine GUID changes [\#13232](https://github.com/netdata/netdata/pull/13232) ([stelfrag](https://github.com/stelfrag)) +- Add more sqlite unittests [\#13227](https://github.com/netdata/netdata/pull/13227) ([stelfrag](https://github.com/stelfrag)) +- ci: add issues to the Agent Board project workflow [\#13225](https://github.com/netdata/netdata/pull/13225) ([ilyam8](https://github.com/ilyam8)) +- Exporting/send variables [\#13221](https://github.com/netdata/netdata/pull/13221) ([boxjan](https://github.com/boxjan)) +- fix\(cgroups.plugin\): fix qemu VMs and LXC containers name resolution [\#13220](https://github.com/netdata/netdata/pull/13220) ([ilyam8](https://github.com/ilyam8)) +- netdata doubles [\#13217](https://github.com/netdata/netdata/pull/13217) ([ktsaou](https://github.com/ktsaou)) +- deduplicate mountinfo based on mount point [\#13215](https://github.com/netdata/netdata/pull/13215) ([ktsaou](https://github.com/ktsaou)) +- feat\(python.d\): load modules from user plugin directories \(NETDATA\_USER\_PLUGINS\_DIRS\) [\#13214](https://github.com/netdata/netdata/pull/13214) ([ilyam8](https://github.com/ilyam8)) +- Properly handle interactivity in the updater code. [\#13209](https://github.com/netdata/netdata/pull/13209) ([Ferroin](https://github.com/Ferroin)) +- Don’t use realpath to find kickstart source path. [\#13208](https://github.com/netdata/netdata/pull/13208) ([Ferroin](https://github.com/Ferroin)) +- Print INTERNAL BUG messages only when NETDATA\_INTERNAL\_CHECKS is enabled [\#13207](https://github.com/netdata/netdata/pull/13207) ([MrZammler](https://github.com/MrZammler)) +- Ensure tmpdir is set for every function that uses it. [\#13206](https://github.com/netdata/netdata/pull/13206) ([Ferroin](https://github.com/Ferroin)) +- Add user plugin dirs to environment [\#13203](https://github.com/netdata/netdata/pull/13203) ([vlvkobal](https://github.com/vlvkobal)) +- Fix cgroups netdev chart labels [\#13200](https://github.com/netdata/netdata/pull/13200) ([vlvkobal](https://github.com/vlvkobal)) +- Add hostname in the worker structure to avoid constant lookups [\#13199](https://github.com/netdata/netdata/pull/13199) ([stelfrag](https://github.com/stelfrag)) +- Rpm group creation [\#13197](https://github.com/netdata/netdata/pull/13197) ([iigorkarpov](https://github.com/iigorkarpov)) +- Allow for an easy way to do metadata migrations [\#13196](https://github.com/netdata/netdata/pull/13196) ([stelfrag](https://github.com/stelfrag)) +- Dictionaries with reference counters and full deletion support during traversal [\#13195](https://github.com/netdata/netdata/pull/13195) ([ktsaou](https://github.com/ktsaou)) +- Add configuration for dbengine page fetch timeout and retry count [\#13194](https://github.com/netdata/netdata/pull/13194) ([stelfrag](https://github.com/stelfrag)) +- Clean sqlite prepared statements on thread shutdown [\#13193](https://github.com/netdata/netdata/pull/13193) ([stelfrag](https://github.com/stelfrag)) +- Update dashboard to version v2.26.5. [\#13192](https://github.com/netdata/netdata/pull/13192) ([netdatabot](https://github.com/netdatabot)) +- chore\(netdata-installer\): remove a call to 'cleanup\_old\_netdata\_updater\(\)' because it is no longer exists [\#13189](https://github.com/netdata/netdata/pull/13189) ([ilyam8](https://github.com/ilyam8)) +- feat\(python.d/smartd\_log\): add 2nd job that tries to read from '/var/lib/smartmontools/' [\#13188](https://github.com/netdata/netdata/pull/13188) ([ilyam8](https://github.com/ilyam8)) +- Add type label for network interfaces [\#13187](https://github.com/netdata/netdata/pull/13187) ([vlvkobal](https://github.com/vlvkobal)) +- fix\(freebsd.plugin\): fix wired/cached/avail memory calculation on FreeBSD with ZFS [\#13183](https://github.com/netdata/netdata/pull/13183) ([ilyam8](https://github.com/ilyam8)) +- make configuration example clearer [\#13182](https://github.com/netdata/netdata/pull/13182) ([andrewm4894](https://github.com/andrewm4894)) +- add k8s\_state dashboard\_info [\#13181](https://github.com/netdata/netdata/pull/13181) ([ilyam8](https://github.com/ilyam8)) +- Docs housekeeping [\#13179](https://github.com/netdata/netdata/pull/13179) ([tkatsoulas](https://github.com/tkatsoulas)) +- Update dashboard to version v2.26.2. [\#13177](https://github.com/netdata/netdata/pull/13177) ([netdatabot](https://github.com/netdatabot)) +- feat\(proc/proc\_net\_dev\): add dim per phys link state to the "Interface Physical Link State" chart [\#13176](https://github.com/netdata/netdata/pull/13176) ([ilyam8](https://github.com/ilyam8)) +- set default for `minimum num samples to train` to `900` [\#13174](https://github.com/netdata/netdata/pull/13174) ([andrewm4894](https://github.com/andrewm4894)) +- Add ml alerts examples [\#13173](https://github.com/netdata/netdata/pull/13173) ([andrewm4894](https://github.com/andrewm4894)) +- Revert "Configurable storage engine for Netdata agents: step 3 \(\#12892\)" [\#13171](https://github.com/netdata/netdata/pull/13171) ([vkalintiris](https://github.com/vkalintiris)) +- Remove warnings when openssl 3 is used. [\#13170](https://github.com/netdata/netdata/pull/13170) ([thiagoftsm](https://github.com/thiagoftsm)) +- Don’t manipulate positional parameters in DEB postinst script. [\#13169](https://github.com/netdata/netdata/pull/13169) ([Ferroin](https://github.com/Ferroin)) +- Fix coverity issues [\#13168](https://github.com/netdata/netdata/pull/13168) ([stelfrag](https://github.com/stelfrag)) +- feat\(proc/proc\_net\_dev\): add dim per operstate to the "Interface Operational State" chart [\#13167](https://github.com/netdata/netdata/pull/13167) ([ilyam8](https://github.com/ilyam8)) +- feat\(proc/proc\_net\_dev\): add dim per duplex state to the "Interface Duplex State" chart [\#13165](https://github.com/netdata/netdata/pull/13165) ([ilyam8](https://github.com/ilyam8)) +- allow traversing null-value dictionaries [\#13162](https://github.com/netdata/netdata/pull/13162) ([ktsaou](https://github.com/ktsaou)) +- Use memset to mark the empty words in the quoted\_strings\_splitter function [\#13161](https://github.com/netdata/netdata/pull/13161) ([stelfrag](https://github.com/stelfrag)) +- Fix data query on stale chart [\#13159](https://github.com/netdata/netdata/pull/13159) ([stelfrag](https://github.com/stelfrag)) +- enable ml by default [\#13158](https://github.com/netdata/netdata/pull/13158) ([andrewm4894](https://github.com/andrewm4894)) +- Fix labels unit test [\#13156](https://github.com/netdata/netdata/pull/13156) ([stelfrag](https://github.com/stelfrag)) +- Query Engine multi-granularity support \(and MC improvements\) [\#13155](https://github.com/netdata/netdata/pull/13155) ([ktsaou](https://github.com/ktsaou)) +- add CAP\_SYS\_RAWIO to Netdata's systemd unit CapabilityBoundingSet [\#13154](https://github.com/netdata/netdata/pull/13154) ([ilyam8](https://github.com/ilyam8)) +- Update docs on what to do if collector not there [\#13152](https://github.com/netdata/netdata/pull/13152) ([cakrit](https://github.com/cakrit)) +- revert to default of `host anomaly rate threshold=0.01` [\#13150](https://github.com/netdata/netdata/pull/13150) ([andrewm4894](https://github.com/andrewm4894)) +- fix conditions for nightly build triggers [\#13145](https://github.com/netdata/netdata/pull/13145) ([maneamarius](https://github.com/maneamarius)) +- Add cargo/rustc/bazel/buck to apps\_groups.conf [\#13143](https://github.com/netdata/netdata/pull/13143) ([vkalintiris](https://github.com/vkalintiris)) +- Add an option to use malloc for page cache instead of mmap [\#13142](https://github.com/netdata/netdata/pull/13142) ([stelfrag](https://github.com/stelfrag)) +- Add mem.available chart to FreeBSD [\#13140](https://github.com/netdata/netdata/pull/13140) ([MrZammler](https://github.com/MrZammler)) +- fix crashes due to misaligned allocations [\#13137](https://github.com/netdata/netdata/pull/13137) ([ktsaou](https://github.com/ktsaou)) +- fix\(python.d\): urllib3 import collection for py3.10+ [\#13136](https://github.com/netdata/netdata/pull/13136) ([ilyam8](https://github.com/ilyam8)) +- fix\(python.d/mongodb\): set `serverSelectionTimeoutMS` for pymongo4+ [\#13135](https://github.com/netdata/netdata/pull/13135) ([ilyam8](https://github.com/ilyam8)) +- Use new mqtt implementation as default [\#13132](https://github.com/netdata/netdata/pull/13132) ([underhood](https://github.com/underhood)) +- use ks2 as MC default [\#13131](https://github.com/netdata/netdata/pull/13131) ([andrewm4894](https://github.com/andrewm4894)) +- allow label names to have slashes [\#13125](https://github.com/netdata/netdata/pull/13125) ([ktsaou](https://github.com/ktsaou)) +- fixed coveriry 379136 379135 379134 379133 [\#13123](https://github.com/netdata/netdata/pull/13123) ([ktsaou](https://github.com/ktsaou)) +- buffer overflow detected by the compiler [\#13120](https://github.com/netdata/netdata/pull/13120) ([ktsaou](https://github.com/ktsaou)) +- Ci coverage [\#13118](https://github.com/netdata/netdata/pull/13118) ([maneamarius](https://github.com/maneamarius)) +- Add missing control to streaming [\#13112](https://github.com/netdata/netdata/pull/13112) ([thiagoftsm](https://github.com/thiagoftsm)) +- Removes Legacy JSON Cloud Protocol Support In Agent [\#13111](https://github.com/netdata/netdata/pull/13111) ([underhood](https://github.com/underhood)) +- Re-enable updates for systems using static builds. [\#13110](https://github.com/netdata/netdata/pull/13110) ([Ferroin](https://github.com/Ferroin)) +- Add user netdata to secondary group in DEB package [\#13109](https://github.com/netdata/netdata/pull/13109) ([iigorkarpov](https://github.com/iigorkarpov)) +- Remove pinned page reference [\#13108](https://github.com/netdata/netdata/pull/13108) ([stelfrag](https://github.com/stelfrag)) +- 73x times faster metrics correlations at the agent [\#13107](https://github.com/netdata/netdata/pull/13107) ([ktsaou](https://github.com/ktsaou)) +- fix\(updater\): fix updating when using `--force-update` and new version of the updater script is available [\#13104](https://github.com/netdata/netdata/pull/13104) ([ilyam8](https://github.com/ilyam8)) - Remove unnescesary ‘cleanup’ code. [\#13103](https://github.com/netdata/netdata/pull/13103) ([Ferroin](https://github.com/Ferroin)) - Temporarily disable updates for static builds. [\#13100](https://github.com/netdata/netdata/pull/13100) ([Ferroin](https://github.com/Ferroin)) +- docs\(statsd.plugin\): fix indentation [\#13096](https://github.com/netdata/netdata/pull/13096) ([ilyam8](https://github.com/ilyam8)) +- Statistics on bytes recvd and sent [\#13091](https://github.com/netdata/netdata/pull/13091) ([underhood](https://github.com/underhood)) +- fix virtualization detection on FreeBSD [\#13087](https://github.com/netdata/netdata/pull/13087) ([ilyam8](https://github.com/ilyam8)) +- Update netdata commands [\#13080](https://github.com/netdata/netdata/pull/13080) ([tkatsoulas](https://github.com/tkatsoulas)) +- fix: fix a base64\_encode bug [\#13074](https://github.com/netdata/netdata/pull/13074) ([kklionz](https://github.com/kklionz)) +- Labels with dictionary [\#13070](https://github.com/netdata/netdata/pull/13070) ([ktsaou](https://github.com/ktsaou)) +- Use a separate thread for slow mountpoints in the diskspace plugin [\#13067](https://github.com/netdata/netdata/pull/13067) ([vlvkobal](https://github.com/vlvkobal)) +- Remove official support for Debian 9. [\#13065](https://github.com/netdata/netdata/pull/13065) ([Ferroin](https://github.com/Ferroin)) +- Fix coverity 378587 [\#13024](https://github.com/netdata/netdata/pull/13024) ([MrZammler](https://github.com/MrZammler)) +- Remove Ubuntu 21.10 from CI and package builds. [\#12918](https://github.com/netdata/netdata/pull/12918) ([Ferroin](https://github.com/Ferroin)) +- Configurable storage engine for Netdata agents: step 3 [\#12892](https://github.com/netdata/netdata/pull/12892) ([aberaud](https://github.com/aberaud)) + +## [v1.35.1](https://github.com/netdata/netdata/tree/v1.35.1) (2022-06-10) + +[Full Changelog](https://github.com/netdata/netdata/compare/v1.35.0...v1.35.1) ## [v1.35.0](https://github.com/netdata/netdata/tree/v1.35.0) (2022-06-08) @@ -132,108 +337,6 @@ - feat\(cgroups.plugin\): add k8s cluster name label \(GKE only\) [\#12858](https://github.com/netdata/netdata/pull/12858) ([ilyam8](https://github.com/ilyam8)) - Autodetect channel for specific version [\#12856](https://github.com/netdata/netdata/pull/12856) ([maneamarius](https://github.com/maneamarius)) - Pause alert pushes to the cloud [\#12852](https://github.com/netdata/netdata/pull/12852) ([MrZammler](https://github.com/MrZammler)) -- fix\(proc.plugin\): consider ZFS ARC as cache when collecting memory usage on Linux [\#12847](https://github.com/netdata/netdata/pull/12847) ([ilyam8](https://github.com/ilyam8)) -- Resolve coverity related to memory and structure dereference [\#12846](https://github.com/netdata/netdata/pull/12846) ([stelfrag](https://github.com/stelfrag)) -- fix memory leaks and mismatches of the use of the z functions for allocations [\#12841](https://github.com/netdata/netdata/pull/12841) ([ktsaou](https://github.com/ktsaou)) -- Allow usage of new MQTT 5 implementation [\#12838](https://github.com/netdata/netdata/pull/12838) ([underhood](https://github.com/underhood)) -- Set a page wait timeout and retry count [\#12836](https://github.com/netdata/netdata/pull/12836) ([stelfrag](https://github.com/stelfrag)) -- Expose anomaly-bit option to health. [\#12835](https://github.com/netdata/netdata/pull/12835) ([vkalintiris](https://github.com/vkalintiris)) -- feat\(plugins.d\): allow external plugins to create chart labels [\#12834](https://github.com/netdata/netdata/pull/12834) ([ilyam8](https://github.com/ilyam8)) -- Ignore obsolete charts/dims in prediction thread. [\#12833](https://github.com/netdata/netdata/pull/12833) ([vkalintiris](https://github.com/vkalintiris)) -- fix\(exporting\)" make 'send charts matching' behave the same as 'filter' for prometheus format [\#12832](https://github.com/netdata/netdata/pull/12832) ([ilyam8](https://github.com/ilyam8)) -- Remove sync warning [\#12831](https://github.com/netdata/netdata/pull/12831) ([thiagoftsm](https://github.com/thiagoftsm)) -- Reduce the number of messages written in the error log due to out of bound timestamps [\#12829](https://github.com/netdata/netdata/pull/12829) ([stelfrag](https://github.com/stelfrag)) -- Bug fix in netdata-uninstaller.sh [\#12828](https://github.com/netdata/netdata/pull/12828) ([maneamarius](https://github.com/maneamarius)) -- Cleanup the node instance table on startup [\#12825](https://github.com/netdata/netdata/pull/12825) ([stelfrag](https://github.com/stelfrag)) -- Accept a data query timeout parameter from the cloud [\#12823](https://github.com/netdata/netdata/pull/12823) ([stelfrag](https://github.com/stelfrag)) -- Broadcast completion before unlocking condition variable's mutex [\#12822](https://github.com/netdata/netdata/pull/12822) ([vkalintiris](https://github.com/vkalintiris)) -- Add chart filtering parameter to the allmetrics API query [\#12820](https://github.com/netdata/netdata/pull/12820) ([vlvkobal](https://github.com/vlvkobal)) -- Write the entire request with parameters in the access.log file [\#12815](https://github.com/netdata/netdata/pull/12815) ([stelfrag](https://github.com/stelfrag)) -- Add a parameter for how many worker threads the libuv library needs to pre-initialize [\#12814](https://github.com/netdata/netdata/pull/12814) ([stelfrag](https://github.com/stelfrag)) -- Optimize linking of foreach alarms to dimensions. [\#12813](https://github.com/netdata/netdata/pull/12813) ([vkalintiris](https://github.com/vkalintiris)) -- fix!: do not replace a hyphen in the chart name with an underscore [\#12812](https://github.com/netdata/netdata/pull/12812) ([ilyam8](https://github.com/ilyam8)) -- speedup queries by providing optimization in the main loop [\#12811](https://github.com/netdata/netdata/pull/12811) ([ktsaou](https://github.com/ktsaou)) -- onewayallocator to use mallocz\(\) instead of mmap\(\) [\#12810](https://github.com/netdata/netdata/pull/12810) ([ktsaou](https://github.com/ktsaou)) -- Add support for installing static builds on systems without usable internet connections. [\#12809](https://github.com/netdata/netdata/pull/12809) ([Ferroin](https://github.com/Ferroin)) -- Configurable storage engine for Netdata agents: step 2 [\#12808](https://github.com/netdata/netdata/pull/12808) ([aberaud](https://github.com/aberaud)) -- Workers utilization charts [\#12807](https://github.com/netdata/netdata/pull/12807) ([ktsaou](https://github.com/ktsaou)) -- add --repositories-only option [\#12806](https://github.com/netdata/netdata/pull/12806) ([maneamarius](https://github.com/maneamarius)) -- Move kickstart argument parsing code to a function. [\#12805](https://github.com/netdata/netdata/pull/12805) ([Ferroin](https://github.com/Ferroin)) -- Fill missing removed events after a crash [\#12803](https://github.com/netdata/netdata/pull/12803) ([MrZammler](https://github.com/MrZammler)) -- Switch to Alma Linux for RHEL compatible support. [\#12799](https://github.com/netdata/netdata/pull/12799) ([Ferroin](https://github.com/Ferroin)) -- Rename --install option for kickstart.sh [\#12798](https://github.com/netdata/netdata/pull/12798) ([maneamarius](https://github.com/maneamarius)) -- chore\(python.d\): remove python.d/\* announced in v1.34.0 deprecation notice [\#12796](https://github.com/netdata/netdata/pull/12796) ([ilyam8](https://github.com/ilyam8)) -- Don't use MADV\_DONTDUMP on non-linux builds [\#12795](https://github.com/netdata/netdata/pull/12795) ([vkalintiris](https://github.com/vkalintiris)) -- Speed up BUFFER increases \(minimize reallocs\) [\#12792](https://github.com/netdata/netdata/pull/12792) ([ktsaou](https://github.com/ktsaou)) -- procfile: more comfortable initial settings and faster/fewer reallocs [\#12791](https://github.com/netdata/netdata/pull/12791) ([ktsaou](https://github.com/ktsaou)) -- just a simple fix to avoid recompiling protobuf all the time [\#12790](https://github.com/netdata/netdata/pull/12790) ([ktsaou](https://github.com/ktsaou)) -- fix\(proc/net/dev\): exclude Proxmox bridge interfaces [\#12789](https://github.com/netdata/netdata/pull/12789) ([ilyam8](https://github.com/ilyam8)) -- fix\(cgroups.plugin\): do not add network devices if cgroup proc is in the host net ns [\#12788](https://github.com/netdata/netdata/pull/12788) ([ilyam8](https://github.com/ilyam8)) -- One way allocator to double the speed of parallel context queries [\#12787](https://github.com/netdata/netdata/pull/12787) ([ktsaou](https://github.com/ktsaou)) -- fix\(installer\): non interpreted new lines when printing deferred errors [\#12786](https://github.com/netdata/netdata/pull/12786) ([ilyam8](https://github.com/ilyam8)) -- Trace rwlocks of netdata [\#12785](https://github.com/netdata/netdata/pull/12785) ([ktsaou](https://github.com/ktsaou)) -- update ml defaults in docs [\#12782](https://github.com/netdata/netdata/pull/12782) ([andrewm4894](https://github.com/andrewm4894)) -- fix: printing a warning msg in installer [\#12781](https://github.com/netdata/netdata/pull/12781) ([ilyam8](https://github.com/ilyam8)) -- feat\(cgroups.plugin\): add filtering by cgroups names and improve renaming in k8s [\#12778](https://github.com/netdata/netdata/pull/12778) ([ilyam8](https://github.com/ilyam8)) -- Skip ACLK dimension update when dimension is freed [\#12777](https://github.com/netdata/netdata/pull/12777) ([stelfrag](https://github.com/stelfrag)) -- Configurable storage engine for Netdata agents: step 1 [\#12776](https://github.com/netdata/netdata/pull/12776) ([aberaud](https://github.com/aberaud)) -- Fix coverity on receiver setsockopt [\#12772](https://github.com/netdata/netdata/pull/12772) ([MrZammler](https://github.com/MrZammler)) -- some config updates for ml [\#12771](https://github.com/netdata/netdata/pull/12771) ([andrewm4894](https://github.com/andrewm4894)) -- Remove node.d.plugin and relevant files [\#12769](https://github.com/netdata/netdata/pull/12769) ([surajnpn](https://github.com/surajnpn)) -- Fix checking of enviornment file in updater. [\#12768](https://github.com/netdata/netdata/pull/12768) ([Ferroin](https://github.com/Ferroin)) -- use aclk\_parse\_otp\_error on /env error [\#12767](https://github.com/netdata/netdata/pull/12767) ([underhood](https://github.com/underhood)) -- feat\(dbengine\): make dbengine page cache undumpable and dedupuble [\#12765](https://github.com/netdata/netdata/pull/12765) ([ilyam8](https://github.com/ilyam8)) -- fix: use 'diskutil info` to calculate the disk size on macOS [\#12764](https://github.com/netdata/netdata/pull/12764) ([ilyam8](https://github.com/ilyam8)) -- faster execution of external programs [\#12759](https://github.com/netdata/netdata/pull/12759) ([ktsaou](https://github.com/ktsaou)) -- Fix and improve netdata-updater.sh script [\#12757](https://github.com/netdata/netdata/pull/12757) ([MarianSavchuk](https://github.com/MarianSavchuk)) -- fix implicit declaration of function 'appconfig\_section\_option\_destroy\_non\_loaded' [\#12756](https://github.com/netdata/netdata/pull/12756) ([ilyam8](https://github.com/ilyam8)) -- Update netdata-installer.sh [\#12755](https://github.com/netdata/netdata/pull/12755) ([petecooper](https://github.com/petecooper)) -- Tag Gotify health notifications for the Gotify phone app [\#12753](https://github.com/netdata/netdata/pull/12753) ([JaphethLim](https://github.com/JaphethLim)) -- fix\(cgroups.plugin\): remove "search for cgroups under PATH" conf option to fix memory leak [\#12752](https://github.com/netdata/netdata/pull/12752) ([ilyam8](https://github.com/ilyam8)) -- fix\(cgroups.plugin\): run renaming script only for containers in k8s [\#12747](https://github.com/netdata/netdata/pull/12747) ([ilyam8](https://github.com/ilyam8)) -- fix\(cgroups.plugin\): remove "enable cgroup X" config option on cgroup deletion [\#12746](https://github.com/netdata/netdata/pull/12746) ([ilyam8](https://github.com/ilyam8)) -- chore\(cgroup.plugin\): remove undocumented feature reading cgroups-names.sh when renaming cgroups [\#12745](https://github.com/netdata/netdata/pull/12745) ([ilyam8](https://github.com/ilyam8)) -- feat\(cgroups.plugin\): add "CPU Time Relative Share" chart [\#12741](https://github.com/netdata/netdata/pull/12741) ([ilyam8](https://github.com/ilyam8)) -- chore: reduce logging in rrdset [\#12739](https://github.com/netdata/netdata/pull/12739) ([ilyam8](https://github.com/ilyam8)) -- feat\(cgroups.plugin\): add k8s\_qos\_class label [\#12737](https://github.com/netdata/netdata/pull/12737) ([ilyam8](https://github.com/ilyam8)) -- expand on the various parent-child config options [\#12734](https://github.com/netdata/netdata/pull/12734) ([andrewm4894](https://github.com/andrewm4894)) -- Mention serial numbers in chart names in the plugins.d API documentation [\#12733](https://github.com/netdata/netdata/pull/12733) ([vlvkobal](https://github.com/vlvkobal)) -- Make atomics a hard-dep. [\#12730](https://github.com/netdata/netdata/pull/12730) ([vkalintiris](https://github.com/vkalintiris)) -- add --install-version flag for installing specific version of Netdata [\#12729](https://github.com/netdata/netdata/pull/12729) ([maneamarius](https://github.com/maneamarius)) -- Remove per chart configuration. [\#12728](https://github.com/netdata/netdata/pull/12728) ([vkalintiris](https://github.com/vkalintiris)) -- Avoid clearing already unset flags. [\#12727](https://github.com/netdata/netdata/pull/12727) ([vkalintiris](https://github.com/vkalintiris)) -- Remove commented code. [\#12726](https://github.com/netdata/netdata/pull/12726) ([vkalintiris](https://github.com/vkalintiris)) -- chore\(kickstart.sh\): remove unused `--auto-update` option when using static/build install method [\#12725](https://github.com/netdata/netdata/pull/12725) ([ilyam8](https://github.com/ilyam8)) -- \[Chore\]: Small typo in macos document [\#12724](https://github.com/netdata/netdata/pull/12724) ([MrZammler](https://github.com/MrZammler)) -- fix upgrading all currently installed packages when updating Netdata on Debian [\#12716](https://github.com/netdata/netdata/pull/12716) ([iigorkarpov](https://github.com/iigorkarpov)) -- chore\(cgroups.plugin\): reduce the CPU time required for cgroup-network-helper.sh [\#12711](https://github.com/netdata/netdata/pull/12711) ([ilyam8](https://github.com/ilyam8)) -- Add `-pipe` to CFLAGS in most cases for builds. [\#12709](https://github.com/netdata/netdata/pull/12709) ([Ferroin](https://github.com/Ferroin)) -- Tweak static build process to improve build speed and debuggability. [\#12708](https://github.com/netdata/netdata/pull/12708) ([Ferroin](https://github.com/Ferroin)) -- Check for chart obsoletion on children re-connections [\#12707](https://github.com/netdata/netdata/pull/12707) ([MrZammler](https://github.com/MrZammler)) -- feat\(apps.plugin\): add proxmox-ve processes to apps\_groups.conf [\#12704](https://github.com/netdata/netdata/pull/12704) ([ilyam8](https://github.com/ilyam8)) -- chore\(ebpf.plugin\): re-enable socket module by default [\#12702](https://github.com/netdata/netdata/pull/12702) ([ilyam8](https://github.com/ilyam8)) -- Disable automake dependency tracking in our various one-time builds. [\#12701](https://github.com/netdata/netdata/pull/12701) ([Ferroin](https://github.com/Ferroin)) -- Add missing values to algorithm vector \(eBPF\) [\#12698](https://github.com/netdata/netdata/pull/12698) ([thiagoftsm](https://github.com/thiagoftsm)) -- Allocate buffer memory for uv\_write and release in the callback function [\#12688](https://github.com/netdata/netdata/pull/12688) ([stelfrag](https://github.com/stelfrag)) -- \[Uninstall Netdata\] - Add description in the docs to use uninstaller script with force arg [\#12687](https://github.com/netdata/netdata/pull/12687) ([odynik](https://github.com/odynik)) -- Correctly propagate errors and warnings up to the kickstart script from scripts it calls. [\#12686](https://github.com/netdata/netdata/pull/12686) ([Ferroin](https://github.com/Ferroin)) -- Memory CO-RE [\#12684](https://github.com/netdata/netdata/pull/12684) ([thiagoftsm](https://github.com/thiagoftsm)) -- Docs: fix GitHub format [\#12682](https://github.com/netdata/netdata/pull/12682) ([eltociear](https://github.com/eltociear)) -- feat\(apps.plugin\): add caddy to apps\_groups.conf [\#12678](https://github.com/netdata/netdata/pull/12678) ([simon300000](https://github.com/simon300000)) -- fix: use NETDATA\_LISTENER\_PORT in docker healtcheck [\#12676](https://github.com/netdata/netdata/pull/12676) ([ilyam8](https://github.com/ilyam8)) -- Add a 2 minute timeout to stream receiver socket [\#12673](https://github.com/netdata/netdata/pull/12673) ([MrZammler](https://github.com/MrZammler)) -- Add options to kickstart.sh for explicitly passing options to installer code. [\#12658](https://github.com/netdata/netdata/pull/12658) ([Ferroin](https://github.com/Ferroin)) -- Improve agent cloud chart synchronization [\#12655](https://github.com/netdata/netdata/pull/12655) ([stelfrag](https://github.com/stelfrag)) -- Add the ability to perform a data query using an offline node id [\#12650](https://github.com/netdata/netdata/pull/12650) ([stelfrag](https://github.com/stelfrag)) -- Gotify notifications [\#12639](https://github.com/netdata/netdata/pull/12639) ([coffeegrind123](https://github.com/coffeegrind123)) -- Improve handling of release channel selection in kickstart.sh. [\#12635](https://github.com/netdata/netdata/pull/12635) ([Ferroin](https://github.com/Ferroin)) -- Fix Valgrind errors [\#12619](https://github.com/netdata/netdata/pull/12619) ([vlvkobal](https://github.com/vlvkobal)) -- Pass the child machine's guid to the goto\_url link [\#12609](https://github.com/netdata/netdata/pull/12609) ([MrZammler](https://github.com/MrZammler)) -- Implements new capability fields in aclk\_schemas [\#12602](https://github.com/netdata/netdata/pull/12602) ([underhood](https://github.com/underhood)) -- Metric correlations [\#12582](https://github.com/netdata/netdata/pull/12582) ([MrZammler](https://github.com/MrZammler)) -- Reduce alert events sent to the cloud. [\#12544](https://github.com/netdata/netdata/pull/12544) ([MrZammler](https://github.com/MrZammler)) -- include proper package dependency [\#12518](https://github.com/netdata/netdata/pull/12518) ([atriwidada](https://github.com/atriwidada)) -- Docs templates [\#12466](https://github.com/netdata/netdata/pull/12466) ([kickoke](https://github.com/kickoke)) ## [v1.34.1](https://github.com/netdata/netdata/tree/v1.34.1) (2022-04-15) @@ -247,104 +350,6 @@ [Full Changelog](https://github.com/netdata/netdata/compare/v1.33.1...v1.34.0) -**Merged pull requests:** - -- Cancel anomaly detection threads before joining. [\#12681](https://github.com/netdata/netdata/pull/12681) ([vkalintiris](https://github.com/vkalintiris)) -- Update dashboard to version v2.25.0. [\#12680](https://github.com/netdata/netdata/pull/12680) ([netdatabot](https://github.com/netdatabot)) -- Delete ML-related data of a host in the proper order. [\#12672](https://github.com/netdata/netdata/pull/12672) ([vkalintiris](https://github.com/vkalintiris)) -- fix\(ebpf.plugin\): add missing chart context for cgroups charts [\#12671](https://github.com/netdata/netdata/pull/12671) ([ilyam8](https://github.com/ilyam8)) -- Remove on pull\_request trigger [\#12670](https://github.com/netdata/netdata/pull/12670) ([dimko](https://github.com/dimko)) -- \[Stream compression Docs\] - Enabled by default [\#12669](https://github.com/netdata/netdata/pull/12669) ([odynik](https://github.com/odynik)) -- Update dashboard to version v2.24.0. [\#12668](https://github.com/netdata/netdata/pull/12668) ([netdatabot](https://github.com/netdatabot)) -- Show error when clock synchronization state is unavailable [\#12667](https://github.com/netdata/netdata/pull/12667) ([vlvkobal](https://github.com/vlvkobal)) -- Dashboard network title [\#12665](https://github.com/netdata/netdata/pull/12665) ([thiagoftsm](https://github.com/thiagoftsm)) -- bump go.d.plugin version to v0.32.2 [\#12663](https://github.com/netdata/netdata/pull/12663) ([ilyam8](https://github.com/ilyam8)) -- Properly limit repository configuration dependencies. [\#12661](https://github.com/netdata/netdata/pull/12661) ([Ferroin](https://github.com/Ferroin)) -- Show --build-only instead of --only-build [\#12657](https://github.com/netdata/netdata/pull/12657) ([MrZammler](https://github.com/MrZammler)) -- Update dashboard to version v2.22.6. [\#12653](https://github.com/netdata/netdata/pull/12653) ([netdatabot](https://github.com/netdatabot)) -- Add a chart label filter parameter in context data queries [\#12652](https://github.com/netdata/netdata/pull/12652) ([stelfrag](https://github.com/stelfrag)) -- Add a timeout parameter to data queries [\#12649](https://github.com/netdata/netdata/pull/12649) ([stelfrag](https://github.com/stelfrag)) -- fix: remove instance-specific information from chart titles [\#12644](https://github.com/netdata/netdata/pull/12644) ([ilyam8](https://github.com/ilyam8)) -- feat: add k8s\_cluster\_name host tag \(GKE only\) [\#12638](https://github.com/netdata/netdata/pull/12638) ([ilyam8](https://github.com/ilyam8)) -- Summarize encountered errors and warnings at end of kickstart script run. [\#12636](https://github.com/netdata/netdata/pull/12636) ([Ferroin](https://github.com/Ferroin)) -- Add eBPF CO-RE version and checksum files to distfile list. [\#12627](https://github.com/netdata/netdata/pull/12627) ([Ferroin](https://github.com/Ferroin)) -- Fix ACLK shutdown [\#12625](https://github.com/netdata/netdata/pull/12625) ([underhood](https://github.com/underhood)) -- Don't do fatal on error writing the health api management key. [\#12623](https://github.com/netdata/netdata/pull/12623) ([MrZammler](https://github.com/MrZammler)) -- fix\(cgroups.plugin\): set CPU prev usage before first usage. [\#12622](https://github.com/netdata/netdata/pull/12622) ([ilyam8](https://github.com/ilyam8)) -- eBPF update dashboard [\#12617](https://github.com/netdata/netdata/pull/12617) ([thiagoftsm](https://github.com/thiagoftsm)) -- fix print: command not found issue [\#12615](https://github.com/netdata/netdata/pull/12615) ([maneamarius](https://github.com/maneamarius)) -- feat: add support for cloud providers info to /api/v1/info [\#12613](https://github.com/netdata/netdata/pull/12613) ([ilyam8](https://github.com/ilyam8)) -- Fix training/prediction stats charts context. [\#12610](https://github.com/netdata/netdata/pull/12610) ([vkalintiris](https://github.com/vkalintiris)) -- Fix a compilation warning [\#12608](https://github.com/netdata/netdata/pull/12608) ([vlvkobal](https://github.com/vlvkobal)) -- Update dashboard to version v2.22.3. [\#12607](https://github.com/netdata/netdata/pull/12607) ([netdatabot](https://github.com/netdatabot)) -- Enable streaming of anomaly\_detection.\* charts [\#12606](https://github.com/netdata/netdata/pull/12606) ([vkalintiris](https://github.com/vkalintiris)) -- Better check for IOMainPort on MacOS [\#12600](https://github.com/netdata/netdata/pull/12600) ([vlvkobal](https://github.com/vlvkobal)) -- Fix coverity issues [\#12598](https://github.com/netdata/netdata/pull/12598) ([vkalintiris](https://github.com/vkalintiris)) -- chore: make logs less noisy on child reconnect [\#12594](https://github.com/netdata/netdata/pull/12594) ([ilyam8](https://github.com/ilyam8)) -- feat\(cgroups.plugin\): add CPU throttling charts [\#12591](https://github.com/netdata/netdata/pull/12591) ([ilyam8](https://github.com/ilyam8)) -- Fix ebpf exit [\#12590](https://github.com/netdata/netdata/pull/12590) ([thiagoftsm](https://github.com/thiagoftsm)) -- feat\(collectors\): update go.d.plugin version to v0.32.1 [\#12586](https://github.com/netdata/netdata/pull/12586) ([ilyam8](https://github.com/ilyam8)) -- Check if libatomic can be linked [\#12583](https://github.com/netdata/netdata/pull/12583) ([MrZammler](https://github.com/MrZammler)) -- Update links to documentation \(eBPF\) [\#12581](https://github.com/netdata/netdata/pull/12581) ([thiagoftsm](https://github.com/thiagoftsm)) -- fix: re-add setuid bit to ioping after installing Debian package [\#12580](https://github.com/netdata/netdata/pull/12580) ([ilyam8](https://github.com/ilyam8)) -- Kickstart improved messaging [\#12577](https://github.com/netdata/netdata/pull/12577) ([Ferroin](https://github.com/Ferroin)) -- add some new ml params to README [\#12575](https://github.com/netdata/netdata/pull/12575) ([andrewm4894](https://github.com/andrewm4894)) -- Update ML-related charts [\#12574](https://github.com/netdata/netdata/pull/12574) ([vkalintiris](https://github.com/vkalintiris)) -- update anonymous-statistics readme for PH Cloud [\#12571](https://github.com/netdata/netdata/pull/12571) ([andrewm4894](https://github.com/andrewm4894)) -- Respect dimension hidden option when executing a query [\#12570](https://github.com/netdata/netdata/pull/12570) ([stelfrag](https://github.com/stelfrag)) -- \[Agent crash on api/v1/info call\] - fixes \#12559 [\#12565](https://github.com/netdata/netdata/pull/12565) ([erdem2000](https://github.com/erdem2000)) -- Fix temporary directory handling for dependency handling script in updater. [\#12562](https://github.com/netdata/netdata/pull/12562) ([Ferroin](https://github.com/Ferroin)) -- feat\(netdata-updater\): add the script name when logging [\#12557](https://github.com/netdata/netdata/pull/12557) ([ilyam8](https://github.com/ilyam8)) -- Fix Build on MacOS [\#12554](https://github.com/netdata/netdata/pull/12554) ([underhood](https://github.com/underhood)) -- Unblock cgroup version detection with systemd [\#12553](https://github.com/netdata/netdata/pull/12553) ([vlvkobal](https://github.com/vlvkobal)) -- fix FreeBSD bundled protobuf build if system one is present [\#12552](https://github.com/netdata/netdata/pull/12552) ([underhood](https://github.com/underhood)) -- fix: use `/proc/cpuinfo` for CPU freq detection as a last resort [\#12550](https://github.com/netdata/netdata/pull/12550) ([ilyam8](https://github.com/ilyam8)) -- add --reinstall-clean flag for kickstart.sh and update documentation [\#12548](https://github.com/netdata/netdata/pull/12548) ([maneamarius](https://github.com/maneamarius)) -- Don't send alert events without wc-\>host [\#12547](https://github.com/netdata/netdata/pull/12547) ([MrZammler](https://github.com/MrZammler)) -- reduce min `dbengine anomaly rate every` 60s-\>30s [\#12543](https://github.com/netdata/netdata/pull/12543) ([andrewm4894](https://github.com/andrewm4894)) -- Explicitly use debhelper to enable systemd service [\#12542](https://github.com/netdata/netdata/pull/12542) ([ralphm](https://github.com/ralphm)) -- Allocate buffer and release on callback when executing agent CLI commands [\#12540](https://github.com/netdata/netdata/pull/12540) ([stelfrag](https://github.com/stelfrag)) -- Make sure registered static threads are unique. [\#12538](https://github.com/netdata/netdata/pull/12538) ([vkalintiris](https://github.com/vkalintiris)) -- packaging: upgrage protocol buffer version to 3.19.4 [\#12537](https://github.com/netdata/netdata/pull/12537) ([surajnpn](https://github.com/surajnpn)) -- feat\(collectors\): update go.d.plugin version to v0.32.0 [\#12536](https://github.com/netdata/netdata/pull/12536) ([ilyam8](https://github.com/ilyam8)) -- Improve ACLK sync logging [\#12534](https://github.com/netdata/netdata/pull/12534) ([stelfrag](https://github.com/stelfrag)) -- Socket connections \(eBPF\) and bug fix [\#12532](https://github.com/netdata/netdata/pull/12532) ([thiagoftsm](https://github.com/thiagoftsm)) -- fix: use internal defaults for sched policy/oom score in native packages [\#12529](https://github.com/netdata/netdata/pull/12529) ([ilyam8](https://github.com/ilyam8)) -- docs: fix unresolved file references [\#12528](https://github.com/netdata/netdata/pull/12528) ([ilyam8](https://github.com/ilyam8)) -- fix\(kickstart.sh\): use `$ROOTCMD` when setting auto updates [\#12526](https://github.com/netdata/netdata/pull/12526) ([ilyam8](https://github.com/ilyam8)) -- fix\(netdata-updater\): properly handle update for debian packages [\#12524](https://github.com/netdata/netdata/pull/12524) ([ilyam8](https://github.com/ilyam8)) -- fix centos gpg key issue [\#12519](https://github.com/netdata/netdata/pull/12519) ([maneamarius](https://github.com/maneamarius)) -- fix: Netdata segfault because of 2 timex.plugin threads [\#12512](https://github.com/netdata/netdata/pull/12512) ([ilyam8](https://github.com/ilyam8)) -- Fix memory leaks on Netdata exit [\#12511](https://github.com/netdata/netdata/pull/12511) ([vlvkobal](https://github.com/vlvkobal)) -- fix centos7 gpg key issue [\#12506](https://github.com/netdata/netdata/pull/12506) ([maneamarius](https://github.com/maneamarius)) -- Use live charts to count the total number of dimensions. [\#12504](https://github.com/netdata/netdata/pull/12504) ([vkalintiris](https://github.com/vkalintiris)) -- Update ebpf doc [\#12503](https://github.com/netdata/netdata/pull/12503) ([thiagoftsm](https://github.com/thiagoftsm)) -- feat\(collectors/timex.plugin\): add clock status chart [\#12501](https://github.com/netdata/netdata/pull/12501) ([ilyam8](https://github.com/ilyam8)) -- PR template: Include user information section [\#12499](https://github.com/netdata/netdata/pull/12499) ([kickoke](https://github.com/kickoke)) -- add `locust` to `apps_groups.conf` [\#12498](https://github.com/netdata/netdata/pull/12498) ([andrewm4894](https://github.com/andrewm4894)) -- Properly skip running the updater in kickstart dry-run mode. [\#12497](https://github.com/netdata/netdata/pull/12497) ([Ferroin](https://github.com/Ferroin)) -- Adjust timex.plugin information to be less cryptic [\#12495](https://github.com/netdata/netdata/pull/12495) ([DanTheMediocre](https://github.com/DanTheMediocre)) -- ML-related changes to address issue/discussion comments. [\#12494](https://github.com/netdata/netdata/pull/12494) ([vkalintiris](https://github.com/vkalintiris)) -- fix: open fd 3 before first use in the netdata-updater.sh script [\#12491](https://github.com/netdata/netdata/pull/12491) ([ilyam8](https://github.com/ilyam8)) -- timex: this plugin enables timex plugin for non-linux systems [\#12489](https://github.com/netdata/netdata/pull/12489) ([surajnpn](https://github.com/surajnpn)) -- Bump the debhelper compat level to 10 in our DEB packaging code. [\#12488](https://github.com/netdata/netdata/pull/12488) ([Ferroin](https://github.com/Ferroin)) -- Properly recognize Almalinux as an RHEL clone. [\#12487](https://github.com/netdata/netdata/pull/12487) ([Ferroin](https://github.com/Ferroin)) -- minor - fix configure output of eBPF [\#12471](https://github.com/netdata/netdata/pull/12471) ([underhood](https://github.com/underhood)) -- Don't send an alert snapshot with snapshot\_id 0 [\#12469](https://github.com/netdata/netdata/pull/12469) ([MrZammler](https://github.com/MrZammler)) -- Update ebpf dashboard [\#12467](https://github.com/netdata/netdata/pull/12467) ([thiagoftsm](https://github.com/thiagoftsm)) -- docs\(collectors/python.d\): remove mention of compatibility with py2/py3 [\#12465](https://github.com/netdata/netdata/pull/12465) ([ilyam8](https://github.com/ilyam8)) -- feat\(collectors/cgroups\): prefer `blkio.*_recursive` when available [\#12462](https://github.com/netdata/netdata/pull/12462) ([ilyam8](https://github.com/ilyam8)) -- Updated static build components to latest versions. [\#12461](https://github.com/netdata/netdata/pull/12461) ([ktsaou](https://github.com/ktsaou)) -- Implement fine-grained errors to cloud queries [\#12460](https://github.com/netdata/netdata/pull/12460) ([underhood](https://github.com/underhood)) -- Extend aclk-state [\#12458](https://github.com/netdata/netdata/pull/12458) ([underhood](https://github.com/underhood)) -- Add support for passing extra claiming options when claiming with Docker. [\#12457](https://github.com/netdata/netdata/pull/12457) ([Ferroin](https://github.com/Ferroin)) -- Update dashboard to version v2.21.8. [\#12455](https://github.com/netdata/netdata/pull/12455) ([netdatabot](https://github.com/netdatabot)) -- fix\(collectors/cgroups\): use different context for cgroup network charts [\#12454](https://github.com/netdata/netdata/pull/12454) ([ilyam8](https://github.com/ilyam8)) -- Initialize foreach alarms of dimensions in health thread. [\#12452](https://github.com/netdata/netdata/pull/12452) ([vkalintiris](https://github.com/vkalintiris)) -- Fix issue with charts not properly synchronized with the cloud [\#12451](https://github.com/netdata/netdata/pull/12451) ([stelfrag](https://github.com/stelfrag)) -- Add delay on missing priv\_key [\#12450](https://github.com/netdata/netdata/pull/12450) ([underhood](https://github.com/underhood)) -- fix unclaimed agents [\#12449](https://github.com/netdata/netdata/pull/12449) ([underhood](https://github.com/underhood)) - ## [v1.33.1](https://github.com/netdata/netdata/tree/v1.33.1) (2022-02-14) [Full Changelog](https://github.com/netdata/netdata/compare/v1.33.0...v1.33.1) diff --git a/CMakeLists.txt b/CMakeLists.txt index 378e8a683..9752f3718 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -102,20 +102,7 @@ set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${LIBLZ4_INCLUDE_ # ----------------------------------------------------------------------------- # Judy General purpose dynamic array -# pkgconfig not working in Ubuntu, why? upstream package broken? -#pkg_check_modules(JUDY REQUIRED Judy) -#set(NETDATA_COMMON_CFLAGS ${NETDATA_COMMON_CFLAGS} ${JUDY_CFLAGS_OTHER}) -#set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} ${JUDY_LIBRARIES}) -#set(NETDATA_COMMON_INCLUDE_DIRS ${NETDATA_COMMON_INCLUDE_DIRS} ${JUDY_INCLUDE_DIRS}) -set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} "-lJudy") -set(CMAKE_REQUIRED_LIBRARIES "Judy") -include(CheckSymbolExists) -check_symbol_exists("JudyLLast" "Judy.h" HAVE_JUDY) -IF(HAVE_JUDY) - message(STATUS "Judy library found") -ELSE() - message( FATAL_ERROR "libJudy required but not found. Try installing 'libjudy-dev' or 'Judy-devel'." ) -ENDIF() +set(NETDATA_COMMON_LIBRARIES ${NETDATA_COMMON_LIBRARIES} judy) # ----------------------------------------------------------------------------- # OpenSSL Cryptography and SSL/TLS Toolkit @@ -362,6 +349,88 @@ ELSE() set(ENABLE_ML False) ENDIF() +set(LIBJUDY_SOURCES + libnetdata/libjudy/src/Judy.h + libnetdata/libjudy/src/JudyCommon/JudyMalloc.c + libnetdata/libjudy/src/JudyCommon/JudyPrivate.h + libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h + libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h + libnetdata/libjudy/src/JudyL/JudyL.h + libnetdata/libjudy/src/JudyL/JudyLByCount.c + libnetdata/libjudy/src/JudyL/JudyLCascade.c + libnetdata/libjudy/src/JudyL/JudyLCount.c + libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c + libnetdata/libjudy/src/JudyL/JudyLDecascade.c + libnetdata/libjudy/src/JudyL/JudyLDel.c + libnetdata/libjudy/src/JudyL/JudyLFirst.c + libnetdata/libjudy/src/JudyL/JudyLFreeArray.c + libnetdata/libjudy/src/JudyL/j__udyLGet.c + libnetdata/libjudy/src/JudyL/JudyLGet.c + libnetdata/libjudy/src/JudyL/JudyLInsArray.c + libnetdata/libjudy/src/JudyL/JudyLIns.c + libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c + libnetdata/libjudy/src/JudyL/JudyLMallocIF.c + libnetdata/libjudy/src/JudyL/JudyLMemActive.c + libnetdata/libjudy/src/JudyL/JudyLMemUsed.c + libnetdata/libjudy/src/JudyL/JudyLNext.c + libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c + libnetdata/libjudy/src/JudyL/JudyLPrev.c + libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c + JudyLTables.c + libnetdata/libjudy/src/JudyHS/JudyHS.c) + +ADD_LIBRARY(judy STATIC + ${LIBJUDY_SOURCES}) + +ADD_EXECUTABLE(judyltablesgen + libnetdata/libjudy/src/JudyL/JudyLTablesGen.c) + +target_include_directories(judyltablesgen PUBLIC + libnetdata/libjudy/src + libnetdata/libjudy/src/JudyCommon) + +target_compile_options(judyltablesgen PUBLIC + -Wno-format + -Wno-format-security) + +include_directories(BEFORE ${CMAKE_SOURCE_DIR}/libnetdata/libjudy/src) + +target_compile_definitions(judyltablesgen PUBLIC + JU_64BIT + JUDYL) + +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/JudyLTables.c + COMMAND judyltablesgen + DEPENDS judyltablesgen + ) + +target_include_directories(judy PUBLIC + libnetdata/libjudy/src + libnetdata/libjudy/src/JudyCommon) + +target_compile_definitions(judy PUBLIC + JU_64BIT + JUDYL) + +target_compile_options(judy PUBLIC + -Wno-sign-compare + -Wno-implicit-fallthrough) + +set(LIBJUDY_PREV_FILES + libnetdata/libjudy/src/JudyL/JudyLPrev.c + libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c) + +set(LIBJUDY_NEXT_FILES + libnetdata/libjudy/src/JudyL/JudyLNext.c + libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c) + +set_source_files_properties(${LIBJUDY_PREV_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYPREV") +set_source_files_properties(${LIBJUDY_NEXT_FILES} PROPERTIES COMPILE_OPTIONS "-DJUDYNEXT") +set_source_files_properties(libnetdata/libjudy/src/JudyL/j__udyLGet.c PROPERTIES COMPILE_OPTIONS "-DJUDYGETINLINE") +set_source_files_properties(libnetdata/libjudy/src/JudyL/JudyLByCount.c PROPERTIES COMPILE_OPTIONS "-DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB") +set_source_files_properties(JudyLTables.c PROPERTIES COMPILE_OPTIONS "-I${CMAKE_SOURCE_DIR}/libnetdata/libjudy/src/JudyL") + # ----------------------------------------------------------------------------- # netdata files @@ -370,6 +439,8 @@ set(LIBNETDATA_FILES libnetdata/adaptive_resortable_list/adaptive_resortable_list.h libnetdata/config/appconfig.c libnetdata/config/appconfig.h + libnetdata/arrayalloc/arrayalloc.c + libnetdata/arrayalloc/arrayalloc.h libnetdata/avl/avl.c libnetdata/avl/avl.h libnetdata/buffer/buffer.c @@ -639,6 +710,8 @@ set(RRD_PLUGIN_FILES database/rrdcalc.h database/rrdcalctemplate.c database/rrdcalctemplate.h + database/rrdcontext.c + database/rrdcontext.h database/rrddim.c database/rrddimvar.c database/rrddimvar.h @@ -658,6 +731,10 @@ set(RRD_PLUGIN_FILES database/ram/rrddim_mem.h database/sqlite/sqlite_functions.c database/sqlite/sqlite_functions.h + database/sqlite/sqlite_context.c + database/sqlite/sqlite_context.h + database/sqlite/sqlite_db_migration.c + database/sqlite/sqlite_db_migration.h database/sqlite/sqlite_aclk.c database/sqlite/sqlite_aclk.h database/sqlite/sqlite_health.c @@ -697,8 +774,6 @@ set(RRD_PLUGIN_FILES database/engine/metadata_log/compaction.h database/KolmogorovSmirnovDist.c database/KolmogorovSmirnovDist.h - database/metric_correlations.c - database/metric_correlations.h ) set(WEB_PLUGIN_FILES @@ -727,6 +802,8 @@ set(API_PLUGIN_FILES web/api/queries/query.h web/api/queries/average/average.c web/api/queries/average/average.h + web/api/queries/countif/countif.c + web/api/queries/countif/countif.h web/api/queries/incremental_sum/incremental_sum.c web/api/queries/incremental_sum/incremental_sum.h web/api/queries/max/max.c @@ -737,12 +814,18 @@ set(API_PLUGIN_FILES web/api/queries/sum/sum.h web/api/queries/median/median.c web/api/queries/median/median.h + web/api/queries/percentile/percentile.c + web/api/queries/percentile/percentile.h web/api/queries/stddev/stddev.c web/api/queries/stddev/stddev.h web/api/queries/ses/ses.c web/api/queries/ses/ses.h web/api/queries/des/des.c web/api/queries/des/des.h + web/api/queries/trimmed_mean/trimmed_mean.c + web/api/queries/trimmed_mean/trimmed_mean.h + web/api/queries/weights.c + web/api/queries/weights.h web/api/formatters/rrd2json.c web/api/formatters/rrd2json.h web/api/formatters/csv/csv.c @@ -783,11 +866,6 @@ set(ACLK_ALWAYS_BUILD aclk/aclk_proxy.h ) -set(ACLK_COMMON_FILES - aclk/aclk_collector_list.c - aclk/aclk_collector_list.h - ) - set(ACLK_FILES aclk/aclk.c aclk/aclk.h @@ -811,6 +889,8 @@ set(ACLK_FILES aclk/aclk_charts_api.h aclk/aclk_alarm_api.c aclk/aclk_alarm_api.h + aclk/aclk_contexts_api.c + aclk/aclk_contexts_api.h mqtt_websockets/src/mqtt_wss_client.c mqtt_websockets/src/include/mqtt_wss_client.h mqtt_websockets/src/mqtt_wss_log.c @@ -845,6 +925,12 @@ set(ACLK_FILES aclk/schema-wrappers/node_info.h aclk/schema-wrappers/capability.cc aclk/schema-wrappers/capability.h + aclk/schema-wrappers/proto_2_json.cc + aclk/schema-wrappers/proto_2_json.h + aclk/schema-wrappers/context_stream.cc + aclk/schema-wrappers/context_stream.h + aclk/schema-wrappers/context.cc + aclk/schema-wrappers/context.h aclk/schema-wrappers/schema_wrappers.h aclk/schema-wrappers/schema_wrapper_utils.cc aclk/schema-wrappers/schema_wrapper_utils.h @@ -1159,6 +1245,8 @@ set(ACLK_PROTO_DEFS aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto + aclk/aclk-schemas/proto/context/v1/context.proto + aclk/aclk-schemas/proto/context/v1/stream.proto ) PROTOBUF_ACLK_GENERATE_CPP(ACLK_PROTO_BUILT_SRCS ACLK_PROTO_BUILT_HDRS ${ACLK_PROTO_DEFS}) @@ -1168,7 +1256,6 @@ list(APPEND NETDATA_COMMON_CFLAGS ${PROTOBUF_CFLAGS_OTHER}) list(APPEND NETDATA_FILES ${ACLK_ALWAYS_BUILD}) list(APPEND NETDATA_FILES ${TIMEX_PLUGIN_FILES}) list(APPEND NETDATA_FILES ${ACLK_FILES} ${ACLK_PROTO_BUILT_SRCS} ${ACLK_PROTO_BUILT_HDRS}) -list(APPEND NETDATA_FILES ${ACLK_COMMON_FILES}) include_directories(BEFORE ${CMAKE_SOURCE_DIR}/aclk/aclk-schemas) include_directories(BEFORE ${CMAKE_SOURCE_DIR}/mqtt_websockets/MQTT-C/include) include_directories(BEFORE ${CMAKE_SOURCE_DIR}/mqtt_websockets/src/include) @@ -1412,6 +1499,7 @@ if(BUILD_TESTING) exporting/tests/exporting_doubles.c exporting/tests/netdata_doubles.c exporting/tests/system_doubles.c + database/rrdlabels.c ) set(TEST_NAME exporting_engine) set(PROMETHEUS_REMOTE_WRITE_LINK_OPTIONS) @@ -1569,11 +1657,6 @@ endif() database/rrd.h ) add_executable(cgroups_testdriver ${CGROUPS_TEST_FILES} ${CGROUPS_PLUGIN_FILES}) - target_link_options( - cgroups_testdriver - PRIVATE - -Wl,--wrap=add_label_to_list - ) target_link_libraries(cgroups_testdriver libnetdata ${NETDATA_COMMON_LIBRARIES} ${CMOCKA_LIBRARIES}) add_test(NAME test_cgroups COMMAND cgroups_testdriver) diff --git a/Makefile.am b/Makefile.am index 6241fc102..7f8adf6af 100644 --- a/Makefile.am +++ b/Makefile.am @@ -61,7 +61,6 @@ dist_noinst_DATA = \ netdata.spec \ packaging/bundle-ebpf.sh \ packaging/bundle-ebpf-co-re.sh \ - packaging/bundle-judy.sh \ packaging/bundle-libbpf.sh \ packaging/check-kernel-config.sh \ packaging/ebpf.checksums \ @@ -75,8 +74,6 @@ dist_noinst_DATA = \ packaging/installer/UPDATE.md \ packaging/jsonc.checksums \ packaging/jsonc.version \ - packaging/judy.checksums \ - packaging/judy.version \ packaging/libbpf.checksums \ packaging/libbpf.version \ packaging/protobuf.checksums \ @@ -136,6 +133,8 @@ LIBNETDATA_FILES = \ libnetdata/adaptive_resortable_list/adaptive_resortable_list.h \ libnetdata/config/appconfig.c \ libnetdata/config/appconfig.h \ + libnetdata/arrayalloc/arrayalloc.c \ + libnetdata/arrayalloc/arrayalloc.h \ libnetdata/avl/avl.c \ libnetdata/avl/avl.h \ libnetdata/buffer/buffer.c \ @@ -260,7 +259,7 @@ ML_FILES += \ $(NULL) # Disable warnings from dlib library -ml/kmeans/dlib/dlib/all/source.$(OBJEXT) : CXXFLAGS += -Wno-sign-compare -Wno-type-limits +ml/kmeans/dlib/dlib/all/source.$(OBJEXT) : CXXFLAGS += -Wno-sign-compare -Wno-type-limits -Wno-aggressive-loop-optimizations -Wno-stringop-overflow endif @@ -435,6 +434,8 @@ RRD_PLUGIN_FILES = \ database/rrdcalc.h \ database/rrdcalctemplate.c \ database/rrdcalctemplate.h \ + database/rrdcontext.c \ + database/rrdcontext.h \ database/rrddim.c \ database/rrddimvar.c \ database/rrddimvar.h \ @@ -454,6 +455,10 @@ RRD_PLUGIN_FILES = \ database/ram/rrddim_mem.h \ database/sqlite/sqlite_functions.c \ database/sqlite/sqlite_functions.h \ + database/sqlite/sqlite_context.c \ + database/sqlite/sqlite_context.h \ + database/sqlite/sqlite_db_migration.c \ + database/sqlite/sqlite_db_migration.h \ database/sqlite/sqlite_aclk.c \ database/sqlite/sqlite_aclk.h \ database/sqlite/sqlite_health.c \ @@ -468,11 +473,70 @@ RRD_PLUGIN_FILES = \ database/sqlite/sqlite3.h \ database/KolmogorovSmirnovDist.c \ database/KolmogorovSmirnovDist.h \ - database/metric_correlations.c \ - database/metric_correlations.h \ $(NULL) +database/sqlite/sqlite3.$(OBJEXT) : CFLAGS += -Wno-cast-function-type +database/KolmogorovSmirnovDist.$(OBJEXT) : CFLAGS += -Wno-maybe-uninitialized + if ENABLE_DBENGINE + noinst_LIBRARIES = libjudy.a + + libjudy_a_SOURCES = libnetdata/libjudy/src/Judy.h \ + libnetdata/libjudy/src/JudyCommon/JudyMalloc.c \ + libnetdata/libjudy/src/JudyCommon/JudyPrivate.h \ + libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h \ + libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h \ + libnetdata/libjudy/src/JudyL/JudyL.h \ + libnetdata/libjudy/src/JudyL/JudyLByCount.c \ + libnetdata/libjudy/src/JudyL/JudyLCascade.c \ + libnetdata/libjudy/src/JudyL/JudyLCount.c \ + libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c \ + libnetdata/libjudy/src/JudyL/JudyLDecascade.c \ + libnetdata/libjudy/src/JudyL/JudyLDel.c \ + libnetdata/libjudy/src/JudyL/JudyLFirst.c \ + libnetdata/libjudy/src/JudyL/JudyLFreeArray.c \ + libnetdata/libjudy/src/JudyL/j__udyLGet.c \ + libnetdata/libjudy/src/JudyL/JudyLGet.c \ + libnetdata/libjudy/src/JudyL/JudyLInsArray.c \ + libnetdata/libjudy/src/JudyL/JudyLIns.c \ + libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c \ + libnetdata/libjudy/src/JudyL/JudyLMallocIF.c \ + libnetdata/libjudy/src/JudyL/JudyLMemActive.c \ + libnetdata/libjudy/src/JudyL/JudyLMemUsed.c \ + libnetdata/libjudy/src/JudyL/JudyLNext.c \ + libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c \ + libnetdata/libjudy/src/JudyL/JudyLPrev.c \ + libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c \ + libnetdata/libjudy/src/JudyHS/JudyHS.c \ + $(NULL) + + nodist_libjudy_a_SOURCES = JudyLTables.c + + BUILT_SOURCES += JudyLTables.c + + CLEANFILES += JudyLTables.c + + libjudy_a_CFLAGS = $(LIBJUDY_CFLAGS) -DJUDYL -I$(abs_top_srcdir)/libnetdata/libjudy/src -I$(abs_top_srcdir)/libnetdata/libjudy/src/JudyCommon -Wno-sign-compare -Wno-implicit-fallthrough + + libnetdata/libjudy/src/JudyL/libjudy_a-JudyLPrev.$(OBJEXT) : CFLAGS += -DJUDYPREV + libnetdata/libjudy/src/JudyL/libjudy_a-JudyLPrevEmpty.$(OBJEXT) : CFLAGS += -DJUDYPREV + libnetdata/libjudy/src/JudyL/libjudy_a-JudyLNext.$(OBJEXT) : CFLAGS += -DJUDYNEXT + libnetdata/libjudy/src/JudyL/libjudy_a-JudyLNextEmpty.$(OBJEXT) : CFLAGS += -DJUDYNEXT + libnetdata/libjudy/src/JudyL/libjudy_a-JudyLByCount.$(OBJEXT) : CFLAGS += -DNOSMARTJBB -DNOSMARTJBU -DNOSMARTJLB + libnetdata/libjudy/src/JudyL/libjudy_a-j__udyLGet.$(OBJEXT) : CFLAGS += -DJUDYGETINLINE + + noinst_PROGRAMS = judyltablesgen + + judyltablesgen_SOURCES = libnetdata/libjudy/src/JudyL/JudyLTablesGen.c + judyltablesgen_CFLAGS = $(LIBJUDY_CFLAGS) -DJUDYL -I$(abs_top_srcdir)/libnetdata/libjudy/src -I$(abs_top_srcdir)/libnetdata/libjudy/src/JudyCommon -Wno-sign-compare -Wno-implicit-fallthrough + + judyltablesgen$(EXEEXT) : CFLAGS += -Wno-format -Wno-format-security + +JudyLTables.c: $(abs_top_srcdir)/libnetdata/libjudy/src/JudyL/JudyLTablesGen.c $(builddir)/judyltablesgen$(EXEEXT) + $(builddir)/judyltablesgen$(EXEEXT) + + libjudy_a-JudyLTables.$(OBJEXT) : CFLAGS += -I$(abs_top_srcdir)/libnetdata/libjudy/src/JudyL + RRD_PLUGIN_FILES += \ database/engine/rrdengine.c \ database/engine/rrdengine.h \ @@ -511,6 +575,8 @@ API_PLUGIN_FILES = \ web/api/exporters/shell/allmetrics_shell.h \ web/api/queries/average/average.c \ web/api/queries/average/average.h \ + web/api/queries/countif/countif.c \ + web/api/queries/countif/countif.h \ web/api/queries/des/des.c \ web/api/queries/des/des.h \ web/api/queries/incremental_sum/incremental_sum.c \ @@ -521,6 +587,10 @@ API_PLUGIN_FILES = \ web/api/queries/median/median.h \ web/api/queries/min/min.c \ web/api/queries/min/min.h \ + web/api/queries/percentile/percentile.c \ + web/api/queries/percentile/percentile.h \ + web/api/queries/trimmed_mean/trimmed_mean.c \ + web/api/queries/trimmed_mean/trimmed_mean.h \ web/api/queries/query.c \ web/api/queries/query.h \ web/api/queries/rrdr.c \ @@ -531,6 +601,8 @@ API_PLUGIN_FILES = \ web/api/queries/stddev/stddev.h \ web/api/queries/sum/sum.c \ web/api/queries/sum/sum.h \ + web/api/queries/weights.c \ + web/api/queries/weights.h \ web/api/formatters/rrd2json.c \ web/api/formatters/rrd2json.h \ web/api/formatters/csv/csv.c \ @@ -637,15 +709,13 @@ ACLK_FILES = \ mqtt_websockets/c-rbuf/include/ringbuffer.h \ mqtt_websockets/c-rbuf/src/ringbuffer_internal.h \ mqtt_websockets/MQTT-C/src/mqtt.c \ - mqtt_websockets/MQTT-C/include/mqtt.h - $(NULL) - -if ENABLE_NEW_CLOUD_PROTOCOL -ACLK_FILES += \ + mqtt_websockets/MQTT-C/include/mqtt.h \ aclk/aclk_charts_api.c \ aclk/aclk_charts_api.h \ aclk/aclk_alarm_api.c \ aclk/aclk_alarm_api.h \ + aclk/aclk_contexts_api.c \ + aclk/aclk_contexts_api.h \ aclk/schema-wrappers/connection.cc \ aclk/schema-wrappers/connection.h \ aclk/schema-wrappers/node_connection.cc \ @@ -664,11 +734,19 @@ ACLK_FILES += \ aclk/schema-wrappers/node_info.h \ aclk/schema-wrappers/capability.cc \ aclk/schema-wrappers/capability.h \ + aclk/schema-wrappers/proto_2_json.cc \ + aclk/schema-wrappers/proto_2_json.h \ aclk/schema-wrappers/schema_wrappers.h \ aclk/schema-wrappers/schema_wrapper_utils.cc \ aclk/schema-wrappers/schema_wrapper_utils.h \ + aclk/schema-wrappers/context_stream.cc \ + aclk/schema-wrappers/context_stream.h \ + aclk/schema-wrappers/context.cc \ + aclk/schema-wrappers/context.h \ $(NULL) +mqtt_websockets/src/mqtt_wss_client.$(OBJEXT) : CFLAGS += -Wno-unused-result + ACLK_PROTO_DEFINITIONS = \ aclk/aclk-schemas/proto/aclk/v1/lib.proto \ aclk/aclk-schemas/proto/agent/v1/disconnect.proto \ @@ -682,6 +760,8 @@ ACLK_PROTO_DEFINITIONS = \ aclk/aclk-schemas/proto/nodeinstance/connection/v1/connection.proto \ aclk/aclk-schemas/proto/nodeinstance/create/v1/creation.proto \ aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto \ + aclk/aclk-schemas/proto/context/v1/context.proto \ + aclk/aclk-schemas/proto/context/v1/stream.proto \ $(NULL) dist_noinst_DATA += $(ACLK_PROTO_DEFINITIONS) @@ -710,6 +790,10 @@ ACLK_PROTO_BUILT_FILES = aclk/aclk-schemas/proto/agent/v1/connection.pb.cc \ aclk/aclk-schemas/proto/alarm/v1/stream.pb.h \ aclk/aclk-schemas/proto/nodeinstance/info/v1/info.pb.cc \ aclk/aclk-schemas/proto/nodeinstance/info/v1/info.pb.h \ + aclk/aclk-schemas/proto/context/v1/context.pb.cc \ + aclk/aclk-schemas/proto/context/v1/context.pb.h \ + aclk/aclk-schemas/proto/context/v1/stream.pb.cc \ + aclk/aclk-schemas/proto/context/v1/stream.pb.h \ $(NULL) BUILT_SOURCES += $(ACLK_PROTO_BUILT_FILES) @@ -764,16 +848,15 @@ aclk/aclk-schemas/proto/nodeinstance/info/v1/info.pb.cc \ aclk/aclk-schemas/proto/nodeinstance/info/v1/info.pb.h: aclk/aclk-schemas/proto/nodeinstance/info/v1/info.proto $(PROTOC) -I=aclk/aclk-schemas --cpp_out=$(builddir)/aclk/aclk-schemas $^ -endif #ENABLE_NEW_CLOUD_PROTOCOL +aclk/aclk-schemas/proto/context/v1/context.pb.cc \ +aclk/aclk-schemas/proto/context/v1/context.pb.h: aclk/aclk-schemas/proto/context/v1/context.proto + $(PROTOC) -I=aclk/aclk-schemas --cpp_out=$(builddir)/aclk/aclk-schemas $^ -endif #ENABLE_ACLK +aclk/aclk-schemas/proto/context/v1/stream.pb.cc \ +aclk/aclk-schemas/proto/context/v1/stream.pb.h: aclk/aclk-schemas/proto/context/v1/stream.proto + $(PROTOC) -I=aclk/aclk-schemas --cpp_out=$(builddir)/aclk/aclk-schemas $^ -if ENABLE_ACLK -ACLK_COMMON_FILES = \ - aclk/aclk_collector_list.c \ - aclk/aclk_collector_list.h \ - $(NULL) -endif +endif #ENABLE_ACLK ACLK_ALWAYS_BUILD_FILES = \ aclk/aclk_rrdhost_state.h \ @@ -881,7 +964,6 @@ NETDATA_FILES = \ $(CLAIM_FILES) \ $(PARSER_FILES) \ $(ACLK_ALWAYS_BUILD_FILES) \ - $(ACLK_COMMON_FILES) \ $(ACLK_FILES) \ $(SPAWN_PLUGIN_FILES) \ $(TIMEX_PLUGIN_FILES) \ @@ -926,6 +1008,11 @@ NETDATA_COMMON_LIBS = \ $(OPTIONAL_ATOMIC_LIBS) \ $(NULL) +if ENABLE_DBENGINE + NETDATA_COMMON_LIBS += libjudy.a \ + $(NULL) +endif + if LINK_STATIC_JSONC NETDATA_COMMON_LIBS += $(abs_top_srcdir)/externaldeps/jsonc/libjson-c.a endif @@ -1166,6 +1253,7 @@ if ENABLE_UNITTESTS $(EXPORTING_ENGINE_TEST_FILES) \ $(EXPORTING_ENGINE_FILES) \ $(LIBNETDATA_FILES) \ + database/rrdlabels.c \ $(NULL) exporting_tests_exporting_engine_testdriver_CFLAGS = \ $(AM_CFLAGS) \ @@ -1259,7 +1347,7 @@ endif $(NULL) collectors_cgroups_plugin_tests_cgroups_testdriver_LDADD = $(NETDATA_COMMON_LIBS) $(TEST_LIBS) collectors_cgroups_plugin_tests_cgroups_testdriver_LDFLAGS = \ - -Wl,--wrap=add_label_to_list \ + -Wl,--wrap=rrdlabels_add \ $(NULL) endif diff --git a/README.md b/README.md index 75c616b61..f1f9a4c1a 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@

Netdata is high-fidelity infrastructure monitoring and troubleshooting.
Open-source, free, preconfigured, opinionated, and always real-time.


+ GitHub Stars +
Latest release Nightly release
@@ -70,6 +72,7 @@ Here's what you can expect from Netdata: synchronize charts as you pan through time, zoom in on anomalies, and more. - **Visual anomaly detection**: Our UI/UX emphasizes the relationships between charts to help you detect the root cause of anomalies. +- **Machine learning (ML) features out of the box**: Unsupervised ML-based [anomaly detection](https://learn.netdata.cloud/docs/cloud/insights/anomaly-advisor), every second, every metric, zero-config! [Metric correlations](https://learn.netdata.cloud/docs/cloud/insights/metric-correlations) to help with short-term change detection. And other [additional](https://learn.netdata.cloud/guides/monitor/anomaly-detection) ML-based features to help make your life easier. - **Scales to infinity**: You can install it on all your servers, containers, VMs, and IoT devices. Metrics are not centralized by default, so there is no limit. - **Several operating modes**: Autonomous host monitoring (the default), headless data collector, forwarding proxy, @@ -200,16 +203,18 @@ to collect metrics, troubleshoot via charts, export to external databases, and m Netdata is an inclusive open-source project and community. Please read our [Code of Conduct](https://learn.netdata.cloud/contribute/code-of-conduct). Find most of the Netdata team in our [community forums](https://community.netdata.cloud). It's the best place to -ask questions, find resources, and engage with passionate professionals. +ask questions, find resources, and engage with passionate professionals. The team is also available and active in our [Discord](https://discord.com/invite/mPZ6WZKKG2) too. You can also find Netdata on: -- [Reddit](https://www.reddit.com/r/netdata/) -- [Facebook](https://www.facebook.com/linuxnetdata/) - [Twitter](https://twitter.com/linuxnetdata) +- [YouTube](https://www.youtube.com/c/Netdata) +- [Reddit](https://www.reddit.com/r/netdata/) +- [LinkedIn](https://www.linkedin.com/company/netdata-cloud/) - [StackShare](https://stackshare.io/netdata) - [Product Hunt](https://www.producthunt.com/posts/netdata-monitoring-agent/) - [Repology](https://repology.org/metapackage/netdata/versions) +- [Facebook](https://www.facebook.com/linuxnetdata/) ## Contribute diff --git a/aclk/README.md b/aclk/README.md index f595726e3..6f541c38e 100644 --- a/aclk/README.md +++ b/aclk/README.md @@ -11,15 +11,25 @@ The Agent-Cloud link (ACLK) is the mechanism responsible for securely connecting through Netdata Cloud. The ACLK establishes an outgoing secure WebSocket (WSS) connection to Netdata Cloud on port `443`. The ACLK is encrypted, safe, and _is only established if you connect your node_. -The Cloud App lives at app.netdata.cloud which currently resolves to 35.196.244.138. However, this IP or range of -IPs can change without notice. Watch this page for updates. +The Cloud App lives at app.netdata.cloud which currently resolves to the following list of IPs: + +- 54.198.178.11 +- 44.207.131.212 +- 44.196.50.41 + +:::caution + +This list of IPs can change without notice, we strongly advise you to whitelist the domain `app.netdata.cloud`, if +this is not an option in your case always verify the current domain resolution (e.g via the `host` command). + +::: For a guide to connecting a node using the ACLK, plus additional troubleshooting and reference information, read our [get started with Cloud](https://learn.netdata.cloud/docs/cloud/get-started) guide or the full [connect to Cloud documentation](/claim/README.md). ## Data privacy -[Data privacy](https://netdata.cloud/data-privacy/) is very important to us. We firmly believe that your data belongs to +[Data privacy](https://netdata.cloud/privacy/) is very important to us. We firmly believe that your data belongs to you. This is why **we don't store any metric data in Netdata Cloud**. All the data that you see in the web browser when using Netdata Cloud, is actually streamed directly from the Netdata Agent to the Netdata Cloud dashboard. @@ -50,12 +60,12 @@ You can configure following keys in the `netdata.conf` section `[cloud]`: [cloud] statistics = yes query thread count = 2 - mqtt5 = no + mqtt5 = yes ``` - `statistics` enables/disables ACLK related statistics and their charts. You can disable this to save some space in the database and slightly reduce memory usage of Netdata Agent. - `query thread count` specifies the number of threads to process cloud queries. Increasing this setting is useful for nodes with many children (streaming), which can expect to handle more queries (and/or more complicated queries). -- `mqtt5` enables the new MQTT5 protocol implementation in the Agent. Currently a technical preview. +- `mqtt5` allows disabling the new MQTT5 implementation which is used now by default in case of issues. This option will be removed in future stable release. ## Disable the ACLK diff --git a/aclk/aclk.c b/aclk/aclk.c index 6426c5b5e..7b3641b1e 100644 --- a/aclk/aclk.c +++ b/aclk/aclk.c @@ -10,7 +10,6 @@ #include "aclk_query_queue.h" #include "aclk_util.h" #include "aclk_rx_msgs.h" -#include "aclk_collector_list.h" #include "https_client.h" #include "schema-wrappers/schema_wrappers.h" @@ -46,17 +45,29 @@ netdata_mutex_t aclk_shared_state_mutex = NETDATA_MUTEX_INITIALIZER; #define ACLK_SHARED_STATE_UNLOCK netdata_mutex_unlock(&aclk_shared_state_mutex) struct aclk_shared_state aclk_shared_state = { - .agent_state = ACLK_HOST_INITIALIZING, - .last_popcorn_interrupt = 0, .mqtt_shutdown_msg_id = -1, .mqtt_shutdown_msg_rcvd = 0 }; +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 +OSSL_DECODER_CTX *aclk_dctx = NULL; +EVP_PKEY *aclk_private_key = NULL; +#else static RSA *aclk_private_key = NULL; +#endif static int load_private_key() { - if (aclk_private_key != NULL) + if (aclk_private_key != NULL) { +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 + EVP_PKEY_free(aclk_private_key); + if (aclk_dctx) + OSSL_DECODER_CTX_free(aclk_dctx); + + aclk_dctx = NULL; +#else RSA_free(aclk_private_key); +#endif + } aclk_private_key = NULL; char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s/cloud.d/private.pem", netdata_configured_varlib_dir); @@ -75,7 +86,25 @@ static int load_private_key() goto biofailed; } +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 + aclk_dctx = OSSL_DECODER_CTX_new_for_pkey(&aclk_private_key, "PEM", NULL, + "RSA", + OSSL_KEYMGMT_SELECT_PRIVATE_KEY, + NULL, NULL); + + if (!aclk_dctx) { + error("Loading private key (from claiming) failed - no OpenSSL Decoders found"); + goto biofailed; + } + + // this is necesseary to avoid RSA key with wrong size + if (!OSSL_DECODER_from_bio(aclk_dctx, key_bio)) { + error("Decoding private key (from claiming) failed - invalid format."); + goto biofailed; + } +#else aclk_private_key = PEM_read_bio_RSAPrivateKey(key_bio, NULL, NULL, NULL); +#endif BIO_free(key_bio); if (aclk_private_key!=NULL) { @@ -112,12 +141,12 @@ static int wait_till_cloud_enabled() static int wait_till_agent_claimed(void) { //TODO prevent malloc and freez - char *agent_id = is_agent_claimed(); + char *agent_id = get_agent_claimid(); while (likely(!agent_id)) { sleep_usec(USEC_PER_SEC * 1); if (netdata_exit) return 1; - agent_id = is_agent_claimed(); + agent_id = get_agent_claimid(); } freez(agent_id); return 0; @@ -188,54 +217,10 @@ void aclk_mqtt_wss_log_cb(mqtt_wss_log_type_t log_type, const char* str) //TODO prevent big buffer on stack #define RX_MSGLEN_MAX 4096 -static void msg_callback_old_protocol(const char *topic, const void *msg, size_t msglen, int qos) -{ - UNUSED(qos); - char cmsg[RX_MSGLEN_MAX]; - size_t len = (msglen < RX_MSGLEN_MAX - 1) ? msglen : (RX_MSGLEN_MAX - 1); - const char *cmd_topic = aclk_get_topic(ACLK_TOPICID_COMMAND); - if (!cmd_topic) { - error("Error retrieving command topic"); - return; - } - - if (msglen > RX_MSGLEN_MAX - 1) - error("Incoming ACLK message was bigger than MAX of %d and got truncated.", RX_MSGLEN_MAX); - - memcpy(cmsg, - msg, - len); - cmsg[len] = 0; - -#ifdef ACLK_LOG_CONVERSATION_DIR -#define FN_MAX_LEN 512 - char filename[FN_MAX_LEN]; - int logfd; - snprintf(filename, FN_MAX_LEN, ACLK_LOG_CONVERSATION_DIR "/%010d-rx.json", ACLK_GET_CONV_LOG_NEXT()); - logfd = open(filename, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR ); - if(logfd < 0) - error("Error opening ACLK Conversation logfile \"%s\" for RX message.", filename); - write(logfd, msg, msglen); - close(logfd); -#endif - - debug(D_ACLK, "Got Message From Broker Topic \"%s\" QoS %d MSG: \"%s\"", topic, qos, cmsg); - - if (strcmp(cmd_topic, topic)) - error("Received message on unexpected topic %s", topic); - - if (aclk_shared_state.mqtt_shutdown_msg_id > 0) { - error("Link is shutting down. Ignoring incoming message."); - return; - } - - aclk_handle_cloud_cmd_message(cmsg); -} - -#ifdef ENABLE_NEW_CLOUD_PROTOCOL -static void msg_callback_new_protocol(const char *topic, const void *msg, size_t msglen, int qos) +static void msg_callback(const char *topic, const void *msg, size_t msglen, int qos) { UNUSED(qos); + aclk_rcvd_cloud_msgs++; if (msglen > RX_MSGLEN_MAX) error("Incoming ACLK message was bigger than MAX of %d and got truncated.", RX_MSGLEN_MAX); @@ -269,17 +254,8 @@ static void msg_callback_new_protocol(const char *topic, const void *msg, size_t close(logfd); #endif - aclk_handle_new_cloud_msg(msgtype, msg, msglen); -} - -static inline void msg_callback(const char *topic, const void *msg, size_t msglen, int qos) { - aclk_rcvd_cloud_msgs++; - if (aclk_use_new_cloud_arch) - msg_callback_new_protocol(topic, msg, msglen, qos); - else - msg_callback_old_protocol(topic, msg, msglen, qos); + aclk_handle_new_cloud_msg(msgtype, msg, msglen, topic); } -#endif /* ENABLE_NEW_CLOUD_PROTOCOL */ static void puback_callback(uint16_t packet_id) { @@ -356,40 +332,6 @@ static int handle_connection(mqtt_wss_client client) return 0; } -inline static int aclk_popcorn_check() -{ - ACLK_SHARED_STATE_LOCK; - if (unlikely(aclk_shared_state.agent_state == ACLK_HOST_INITIALIZING)) { - ACLK_SHARED_STATE_UNLOCK; - return 1; - } - ACLK_SHARED_STATE_UNLOCK; - return 0; -} - -inline static int aclk_popcorn_check_bump() -{ - ACLK_SHARED_STATE_LOCK; - if (unlikely(aclk_shared_state.agent_state == ACLK_HOST_INITIALIZING)) { - aclk_shared_state.last_popcorn_interrupt = now_realtime_sec(); - ACLK_SHARED_STATE_UNLOCK; - return 1; - } - ACLK_SHARED_STATE_UNLOCK; - return 0; -} - -static inline void queue_connect_payloads(void) -{ - aclk_query_t query = aclk_query_new(METADATA_INFO); - query->data.metadata_info.host = localhost; - query->data.metadata_info.initial_on_connect = 1; - aclk_queue_query(query); - query = aclk_query_new(METADATA_ALARMS); - query->data.metadata_alarms.initial_on_connect = 1; - aclk_queue_query(query); -} - static inline void mqtt_connected_actions(mqtt_wss_client client) { char *topic = (char*)aclk_get_topic(ACLK_TOPICID_COMMAND); @@ -399,15 +341,11 @@ static inline void mqtt_connected_actions(mqtt_wss_client client) else mqtt_wss_subscribe(client, topic, 1); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (aclk_use_new_cloud_arch) { - topic = (char*)aclk_get_topic(ACLK_TOPICID_CMD_NG_V1); - if (!topic) - error("Unable to fetch topic for protobuf COMMAND (to subscribe)"); - else - mqtt_wss_subscribe(client, topic, 1); - } -#endif + topic = (char*)aclk_get_topic(ACLK_TOPICID_CMD_NG_V1); + if (!topic) + error("Unable to fetch topic for protobuf COMMAND (to subscribe)"); + else + mqtt_wss_subscribe(client, topic, 1); aclk_stats_upd_online(1); aclk_connected = 1; @@ -415,55 +353,7 @@ static inline void mqtt_connected_actions(mqtt_wss_client client) aclk_rcvd_cloud_msgs = 0; aclk_connection_counter++; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (!aclk_use_new_cloud_arch) { -#endif - ACLK_SHARED_STATE_LOCK; - if (aclk_shared_state.agent_state != ACLK_HOST_INITIALIZING) { - error("Sending `connect` payload immediately as popcorning was finished already."); - queue_connect_payloads(); - } - ACLK_SHARED_STATE_UNLOCK; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - } else { - aclk_send_agent_connection_update(client, 1); - } -#endif -} - -/* Waits until agent is ready or needs to exit - * @param client instance of mqtt_wss_client - * @param query_threads pointer to aclk_query_threads - * structure where to store data about started query threads - * @return 0 - Popcorning Finished - Agent STABLE, - * !0 - netdata_exit - */ -static int wait_popcorning_finishes() -{ - time_t elapsed; - int need_wait; - if (aclk_use_new_cloud_arch) - return 0; - - while (!netdata_exit) { - ACLK_SHARED_STATE_LOCK; - if (likely(aclk_shared_state.agent_state != ACLK_HOST_INITIALIZING)) { - ACLK_SHARED_STATE_UNLOCK; - return 0; - } - elapsed = now_realtime_sec() - aclk_shared_state.last_popcorn_interrupt; - if (elapsed >= ACLK_STABLE_TIMEOUT) { - aclk_shared_state.agent_state = ACLK_HOST_STABLE; - ACLK_SHARED_STATE_UNLOCK; - error("ACLK localhost popcorn timer finished"); - return 0; - } - ACLK_SHARED_STATE_UNLOCK; - need_wait = ACLK_STABLE_TIMEOUT - elapsed; - error("ACLK localhost popcorn timer - wait %d seconds longer", need_wait); - sleep(need_wait); - } - return 1; + aclk_send_agent_connection_update(client, 1); } void aclk_graceful_disconnect(mqtt_wss_client client) @@ -471,12 +361,8 @@ void aclk_graceful_disconnect(mqtt_wss_client client) info("Preparing to gracefully shutdown ACLK connection"); aclk_queue_lock(); aclk_queue_flush(); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (aclk_use_new_cloud_arch) - aclk_shared_state.mqtt_shutdown_msg_id = aclk_send_agent_connection_update(client, 0); - else -#endif - aclk_shared_state.mqtt_shutdown_msg_id = aclk_send_app_layer_disconnect(client, "graceful"); + + aclk_shared_state.mqtt_shutdown_msg_id = aclk_send_agent_connection_update(client, 0); time_t t = now_monotonic_sec(); while (!mqtt_wss_service(client, 100)) { @@ -594,8 +480,6 @@ static int aclk_attempt_to_connect(mqtt_wss_client client) url_t mqtt_url; #endif - json_object *lwt = NULL; - while (!netdata_exit) { char *cloud_base_url = appconfig_get(&cloud_config, CONFIG_SECTION_GLOBAL, "cloud base url", NULL); if (cloud_base_url == NULL) { @@ -629,8 +513,6 @@ static int aclk_attempt_to_connect(mqtt_wss_client client) .drop_on_publish_fail = 1 }; - aclk_use_new_cloud_arch = 0; - #ifndef ACLK_DISABLE_CHALLENGE if (aclk_env) { aclk_env_t_destroy(aclk_env); @@ -649,20 +531,17 @@ static int aclk_attempt_to_connect(mqtt_wss_client client) if (netdata_exit) return 1; - if (aclk_env->encoding == ACLK_ENC_PROTO) { -#ifndef ENABLE_NEW_CLOUD_PROTOCOL - error("Cloud requested New Cloud Protocol to be used but this agent cannot support it!"); + if (aclk_env->encoding != ACLK_ENC_PROTO) { + error_report("This agent can only use the new cloud protocol but cloud requested old one."); continue; -#else - if (!aclk_env_has_capa("proto")) { - error ("Can't encoding=proto without at least \"proto\" capability."); - continue; - } - info("Switching ACLK to new protobuf protocol. Due to /env response."); - aclk_use_new_cloud_arch = 1; -#endif } + if (!aclk_env_has_capa("proto")) { + error ("Can't use encoding=proto without at least \"proto\" capability."); + continue; + } + info("New ACLK protobuf protocol negotiated successfully (/env response)."); + memset(&auth_url, 0, sizeof(url_t)); if (url_parse(aclk_env->auth_endpoint, &auth_url)) { error("Parsing URL returned by env endpoint for authentication failed. \"%s\"", aclk_env->auth_endpoint); @@ -679,10 +558,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client) // aclk_get_topic moved here as during OTP we // generate the topic cache - if (aclk_use_new_cloud_arch) - mqtt_conn_params.will_topic = aclk_get_topic(ACLK_TOPICID_AGENT_CONN); - else - mqtt_conn_params.will_topic = aclk_get_topic(ACLK_TOPICID_METADATA); + mqtt_conn_params.will_topic = aclk_get_topic(ACLK_TOPICID_AGENT_CONN); if (!mqtt_conn_params.will_topic) { error("Couldn't get LWT topic. Will not send LWT."); @@ -708,17 +584,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client) aclk_session_sec = aclk_session_newarch / USEC_PER_SEC; aclk_session_us = aclk_session_newarch % USEC_PER_SEC; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (aclk_use_new_cloud_arch) { - mqtt_conn_params.will_msg = aclk_generate_lwt(&mqtt_conn_params.will_msg_len); - } else { -#endif - lwt = aclk_generate_disconnect(NULL); - mqtt_conn_params.will_msg = json_object_to_json_string_ext(lwt, JSON_C_TO_STRING_PLAIN); - mqtt_conn_params.will_msg_len = strlen(mqtt_conn_params.will_msg); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - } -#endif + mqtt_conn_params.will_msg = aclk_generate_lwt(&mqtt_conn_params.will_msg_len); #ifdef ACLK_DISABLE_CHALLENGE ret = mqtt_wss_connect(client, base_url.host, base_url.port, &mqtt_conn_params, ACLK_SSL_FLAGS, &proxy_conf); @@ -732,10 +598,7 @@ static int aclk_attempt_to_connect(mqtt_wss_client client) freez((char*)mqtt_conn_params.username); #endif - if (aclk_use_new_cloud_arch) - freez((char *)mqtt_conn_params.will_msg); - else - json_object_put(lwt); + freez((char *)mqtt_conn_params.will_msg); if (!ret) { last_conn_time_mqtt = now_realtime_sec(); @@ -778,10 +641,7 @@ void *aclk_main(void *ptr) return NULL; } - unsigned int proto_hdl_cnt; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - proto_hdl_cnt = aclk_init_rx_msg_handlers(); -#endif + unsigned int proto_hdl_cnt = aclk_init_rx_msg_handlers(); // This thread is unusual in that it cannot be cancelled by cancel_main_threads() // as it must notify the far end that it shutdown gracefully and avoid the LWT. @@ -792,7 +652,6 @@ void *aclk_main(void *ptr) static_thread->enabled = NETDATA_MAIN_THREAD_EXITED; return NULL; #endif - aclk_popcorn_check_bump(); // start localhost popcorn timer query_threads.count = read_query_thread_count(); if (wait_till_cloud_enabled()) @@ -801,13 +660,9 @@ void *aclk_main(void *ptr) if (wait_till_agent_claim_ready()) goto exit; - use_mqtt_5 = config_get_boolean(CONFIG_SECTION_CLOUD, "mqtt5", CONFIG_BOOLEAN_NO); + use_mqtt_5 = config_get_boolean(CONFIG_SECTION_CLOUD, "mqtt5", CONFIG_BOOLEAN_YES); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL if (!(mqttwss_client = mqtt_wss_new("mqtt_wss", aclk_mqtt_wss_log_cb, msg_callback, puback_callback, use_mqtt_5))) { -#else - if (!(mqttwss_client = mqtt_wss_new("mqtt_wss", aclk_mqtt_wss_log_cb, msg_callback_old_protocol, puback_callback, use_mqtt_5))) { -#endif error("Couldn't initialize MQTT_WSS network library"); goto exit; } @@ -822,6 +677,7 @@ void *aclk_main(void *ptr) stats_thread = callocz(1, sizeof(struct aclk_stats_thread)); stats_thread->thread = mallocz(sizeof(netdata_thread_t)); stats_thread->query_thread_count = query_threads.count; + stats_thread->client = mqttwss_client; aclk_stats_thread_prepare(query_threads.count, proto_hdl_cnt); netdata_thread_create( stats_thread->thread, ACLK_STATS_THREAD_NAME, NETDATA_THREAD_OPTION_JOINABLE, aclk_stats_main_thread, @@ -834,28 +690,9 @@ void *aclk_main(void *ptr) if (aclk_attempt_to_connect(mqttwss_client)) goto exit_full; -#if defined(ENABLE_ACLK) && !defined(ENABLE_NEW_CLOUD_PROTOCOL) - error_report("############################ WARNING ###############################"); - error_report("# Your agent is configured to connect to cloud but has #"); - error_report("# no protobuf protocol support (uses legacy JSON protocol) #"); - error_report("# Legacy protocol will be deprecated soon (planned 1st March 2022) #"); - error_report("# Visit following link for more info and instructions how to solve #"); - error_report("# https://www.netdata.cloud/blog/netdata-clouds-new-architecture #"); - error_report("######################################################################"); -#endif - - // warning this assumes the popcorning is relative short (3s) - // if that changes call mqtt_wss_service from within - // to keep OpenSSL, WSS and MQTT connection alive - if (wait_popcorning_finishes()) - goto exit_full; - if (unlikely(!query_threads.thread_list)) aclk_query_threads_start(&query_threads, mqttwss_client); - if (!aclk_use_new_cloud_arch) - queue_connect_payloads(); - if (handle_connection(mqttwss_client)) { aclk_stats_upd_online(0); last_disconnect_time = now_realtime_sec(); @@ -889,168 +726,12 @@ exit: return NULL; } -// TODO this is taken over as workaround from old ACLK -// fix this in both old and new ACLK -extern void health_alarm_entry2json_nolock(BUFFER *wb, ALARM_ENTRY *ae, RRDHOST *host); - -void aclk_alarm_reload(void) -{ - ACLK_SHARED_STATE_LOCK; - if (unlikely(aclk_shared_state.agent_state == ACLK_HOST_INITIALIZING)) { - ACLK_SHARED_STATE_UNLOCK; - return; - } - ACLK_SHARED_STATE_UNLOCK; - - aclk_queue_query(aclk_query_new(METADATA_ALARMS)); -} - -int aclk_update_alarm(RRDHOST *host, ALARM_ENTRY *ae) -{ - BUFFER *local_buffer; - json_object *msg; - - if (host != localhost) - return 0; - - ACLK_SHARED_STATE_LOCK; - if (unlikely(aclk_shared_state.agent_state == ACLK_HOST_INITIALIZING)) { - ACLK_SHARED_STATE_UNLOCK; - return 0; - } - ACLK_SHARED_STATE_UNLOCK; - - local_buffer = buffer_create(NETDATA_WEB_RESPONSE_HEADER_SIZE); - - netdata_rwlock_rdlock(&host->health_log.alarm_log_rwlock); - health_alarm_entry2json_nolock(local_buffer, ae, host); - netdata_rwlock_unlock(&host->health_log.alarm_log_rwlock); - - msg = json_tokener_parse(local_buffer->buffer); - - struct aclk_query *query = aclk_query_new(ALARM_STATE_UPDATE); - query->data.alarm_update = msg; - aclk_queue_query(query); - - buffer_free(local_buffer); - return 0; -} - -int aclk_update_chart(RRDHOST *host, char *chart_name, int create) -{ - struct aclk_query *query; - - if (host == localhost ? aclk_popcorn_check_bump() : aclk_popcorn_check()) - return 0; - - query = aclk_query_new(create ? CHART_NEW : CHART_DEL); - if(create) { - query->data.chart_add_del.host = host; - query->data.chart_add_del.chart_name = strdupz(chart_name); - } else { - query->data.metadata_info.host = host; - query->data.metadata_info.initial_on_connect = 0; - } - - aclk_queue_query(query); - return 0; -} - -/* - * Add a new collector to the list - * If it exists, update the chart count - */ -void aclk_add_collector(RRDHOST *host, const char *plugin_name, const char *module_name) -{ - struct aclk_query *query; - struct _collector *tmp_collector; - if (unlikely(!netdata_ready || aclk_use_new_cloud_arch)) { - return; - } - - COLLECTOR_LOCK; - - tmp_collector = _add_collector(host->machine_guid, plugin_name, module_name); - - if (unlikely(tmp_collector->count != 1)) { - COLLECTOR_UNLOCK; - return; - } - - COLLECTOR_UNLOCK; - - if (aclk_popcorn_check_bump()) - return; - - if (host != localhost) - return; - - query = aclk_query_new(METADATA_INFO); - query->data.metadata_info.host = localhost; //TODO - query->data.metadata_info.initial_on_connect = 0; - aclk_queue_query(query); - - query = aclk_query_new(METADATA_ALARMS); - query->data.metadata_alarms.initial_on_connect = 0; - aclk_queue_query(query); -} - -/* - * Delete a collector from the list - * If the chart count reaches zero the collector will be removed - * from the list by calling del_collector. - * - * This function will release the memory used and schedule - * a cloud update - */ -void aclk_del_collector(RRDHOST *host, const char *plugin_name, const char *module_name) -{ - struct aclk_query *query; - struct _collector *tmp_collector; - if (unlikely(!netdata_ready || aclk_use_new_cloud_arch)) { - return; - } - - COLLECTOR_LOCK; - - tmp_collector = _del_collector(host->machine_guid, plugin_name, module_name); - - if (unlikely(!tmp_collector || tmp_collector->count)) { - COLLECTOR_UNLOCK; - return; - } - - debug( - D_ACLK, "DEL COLLECTOR [%s:%s] -- charts %u", plugin_name ? plugin_name : "*", module_name ? module_name : "*", - tmp_collector->count); - - COLLECTOR_UNLOCK; - - _free_collector(tmp_collector); - - if (aclk_popcorn_check_bump()) - return; - - if (host != localhost) - return; - - query = aclk_query_new(METADATA_INFO); - query->data.metadata_info.host = localhost; //TODO - query->data.metadata_info.initial_on_connect = 0; - aclk_queue_query(query); - - query = aclk_query_new(METADATA_ALARMS); - query->data.metadata_alarms.initial_on_connect = 0; - aclk_queue_query(query); -} - -#ifdef ENABLE_NEW_CLOUD_PROTOCOL void aclk_host_state_update(RRDHOST *host, int cmd) { uuid_t node_id; int ret; - if (!aclk_connected || !aclk_use_new_cloud_arch) + if (!aclk_connected) return; ret = get_node_id(&host->host_uuid, &node_id); @@ -1088,6 +769,16 @@ void aclk_host_state_update(RRDHOST *host, int cmd) }; node_state_update.node_id = mallocz(UUID_STR_LEN); uuid_unparse_lower(node_id, (char*)node_state_update.node_id); + + struct capability caps[] = { + { .name = "proto", .version = 1, .enabled = 1 }, + { .name = "ml", .version = ml_capable(localhost), .enabled = ml_enabled(host) }, + { .name = "mc", .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations }, + { .name = "ctx", .version = 1, .enabled = rrdcontext_enabled }, + { .name = NULL, .version = 0, .enabled = 0 } + }; + node_state_update.capabilities = caps; + rrdhost_aclk_state_lock(localhost); node_state_update.claim_id = localhost->aclk_state.claimed_id; query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); @@ -1120,6 +811,20 @@ void aclk_send_node_instances() }; node_state_update.node_id = mallocz(UUID_STR_LEN); uuid_unparse_lower(list->node_id, (char*)node_state_update.node_id); + + char host_id[UUID_STR_LEN]; + uuid_unparse_lower(list->host_id, host_id); + + RRDHOST *host = rrdhost_find_by_guid(host_id, 0); + struct capability caps[] = { + { .name = "proto", .version = 1, .enabled = 1 }, + { .name = "ml", .version = ml_capable(localhost), .enabled = host ? ml_enabled(host) : 0 }, + { .name = "mc", .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations }, + { .name = "ctx", .version = 1, .enabled = rrdcontext_enabled }, + { .name = NULL, .version = 0, .enabled = 0 } + }; + node_state_update.capabilities = caps; + rrdhost_aclk_state_lock(localhost); node_state_update.claim_id = localhost->aclk_state.claimed_id; query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); @@ -1157,14 +862,12 @@ void aclk_send_node_instances() } freez(list_head); } -#endif void aclk_send_bin_msg(char *msg, size_t msg_len, enum aclk_topics subtopic, const char *msgname) { aclk_send_bin_message_subtopic_pid(mqttwss_client, msg, msg_len, subtopic, msgname); } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL static void fill_alert_status_for_host(BUFFER *wb, RRDHOST *host) { struct proto_alert_status status; @@ -1220,7 +923,6 @@ static void fill_chart_status_for_host(BUFFER *wb, RRDHOST *host) ); freez(stats); } -#endif char *ng_aclk_state(void) { @@ -1231,15 +933,11 @@ char *ng_aclk_state(void) buffer_strcat(wb, "ACLK Available: Yes\n" "ACLK Version: 2\n" -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - "Protocols Supported: Legacy, Protobuf\n" -#else - "Protocols Supported: Legacy\n" -#endif + "Protocols Supported: Protobuf\n" ); - buffer_sprintf(wb, "Protocol Used: %s\nMQTT Version: %d\nClaimed: ", aclk_use_new_cloud_arch ? "Protobuf" : "Legacy", use_mqtt_5 ? 5 : 3); + buffer_sprintf(wb, "Protocol Used: Protobuf\nMQTT Version: %d\nClaimed: ", use_mqtt_5 ? 5 : 3); - char *agent_id = is_agent_claimed(); + char *agent_id = get_agent_claimid(); if (agent_id == NULL) buffer_strcat(wb, "No\n"); else { @@ -1273,7 +971,6 @@ char *ng_aclk_state(void) if (aclk_connected) { buffer_sprintf(wb, "Received Cloud MQTT Messages: %d\nMQTT Messages Confirmed by Remote Broker (PUBACKs): %d", aclk_rcvd_cloud_msgs, aclk_pubacks_per_conn); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL RRDHOST *host; rrd_rdlock(); rrdhost_foreach_read(host) { @@ -1308,7 +1005,6 @@ char *ng_aclk_state(void) fill_chart_status_for_host(wb, host); } rrd_unlock(); -#endif } ret = strdupz(buffer_tostring(wb)); @@ -1316,7 +1012,6 @@ char *ng_aclk_state(void) return ret; } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL static void fill_alert_status_for_host_json(json_object *obj, RRDHOST *host) { struct proto_alert_status status; @@ -1381,7 +1076,6 @@ static void fill_chart_status_for_host_json(json_object *obj, RRDHOST *host) freez(stats); } -#endif static json_object *timestamp_to_json(const time_t *t) { @@ -1405,18 +1099,11 @@ char *ng_aclk_state_json(void) json_object_object_add(msg, "aclk-version", tmp); grp = json_object_new_array(); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - tmp = json_object_new_string("Legacy"); - json_object_array_add(grp, tmp); tmp = json_object_new_string("Protobuf"); json_object_array_add(grp, tmp); -#else - tmp = json_object_new_string("Legacy"); - json_object_array_add(grp, tmp); -#endif json_object_object_add(msg, "protocols-supported", grp); - char *agent_id = is_agent_claimed(); + char *agent_id = get_agent_claimid(); tmp = json_object_new_boolean(agent_id != NULL); json_object_object_add(msg, "agent-claimed", tmp); @@ -1434,7 +1121,7 @@ char *ng_aclk_state_json(void) tmp = json_object_new_boolean(aclk_connected); json_object_object_add(msg, "online", tmp); - tmp = json_object_new_string(aclk_use_new_cloud_arch ? "Protobuf" : "Legacy"); + tmp = json_object_new_string("Protobuf"); json_object_object_add(msg, "used-cloud-protocol", tmp); tmp = json_object_new_int(use_mqtt_5 ? 5 : 3); @@ -1461,7 +1148,6 @@ char *ng_aclk_state_json(void) tmp = json_object_new_boolean(aclk_disable_runtime); json_object_object_add(msg, "banned-by-cloud", tmp); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL grp = json_object_new_array(); RRDHOST *host; @@ -1513,7 +1199,6 @@ char *ng_aclk_state_json(void) } rrd_unlock(); json_object_object_add(msg, "node-instances", grp); -#endif char *str = strdupz(json_object_to_json_string_ext(msg, JSON_C_TO_STRING_PLAIN)); json_object_put(msg); diff --git a/aclk/aclk.h b/aclk/aclk.h index 41c4e05e4..5065ac2bf 100644 --- a/aclk/aclk.h +++ b/aclk/aclk.h @@ -21,9 +21,6 @@ extern netdata_mutex_t aclk_shared_state_mutex; #define ACLK_SHARED_STATE_UNLOCK netdata_mutex_unlock(&aclk_shared_state_mutex) extern struct aclk_shared_state { - ACLK_AGENT_STATE agent_state; - time_t last_popcorn_interrupt; - // To wait for `disconnect` message PUBACK // when shutting down // at the same time if > 0 we know link is @@ -32,21 +29,8 @@ extern struct aclk_shared_state { int mqtt_shutdown_msg_rcvd; } aclk_shared_state; -void aclk_alarm_reload(void); -int aclk_update_alarm(RRDHOST *host, ALARM_ENTRY *ae); - -/* Informs ACLK about created/deleted chart - * @param create 0 - if chart was deleted, other if chart created - */ -int aclk_update_chart(RRDHOST *host, char *chart_name, int create); - -void aclk_add_collector(RRDHOST *host, const char *plugin_name, const char *module_name); -void aclk_del_collector(RRDHOST *host, const char *plugin_name, const char *module_name); - -#ifdef ENABLE_NEW_CLOUD_PROTOCOL void aclk_host_state_update(RRDHOST *host, int cmd); void aclk_send_node_instances(void); -#endif void aclk_send_bin_msg(char *msg, size_t msg_len, enum aclk_topics subtopic, const char *msgname); diff --git a/aclk/aclk_api.c b/aclk/aclk_api.c index a2e738ab1..141d267af 100644 --- a/aclk/aclk_api.c +++ b/aclk/aclk_api.c @@ -13,10 +13,10 @@ usec_t aclk_session_us = 0; time_t aclk_session_sec = 0; int aclk_disable_runtime = 0; -int aclk_disable_single_updates = 0; int aclk_stats_enabled; int use_mqtt_5 = 0; +int aclk_ctx_based = 0; #define ACLK_IMPL_KEY_NAME "aclk implementation" @@ -33,25 +33,17 @@ void *aclk_starter(void *ptr) { } return aclk_main(ptr); } - -void aclk_single_update_disable() -{ - aclk_disable_single_updates = 1; -} - -void aclk_single_update_enable() -{ - aclk_disable_single_updates = 0; -} #endif /* ENABLE_ACLK */ -struct label *add_aclk_host_labels(struct label *label) { +void add_aclk_host_labels(void) { + DICTIONARY *labels = localhost->host_labels; + #ifdef ENABLE_ACLK - label = add_label_to_list(label, "_aclk_ng_available", "true", LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_aclk_ng_available", "true", RRDLABEL_SRC_AUTO|RRDLABEL_SRC_ACLK); #else - label = add_label_to_list(label, "_aclk_ng_available", "false", LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_aclk_ng_available", "false", RRDLABEL_SRC_AUTO|RRDLABEL_SRC_ACLK); #endif - label = add_label_to_list(label, "_aclk_legacy_available", "false", LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_aclk_legacy_available", "false", RRDLABEL_SRC_AUTO|RRDLABEL_SRC_ACLK); #ifdef ENABLE_ACLK ACLK_PROXY_TYPE aclk_proxy; char *proxy_str; @@ -69,17 +61,14 @@ struct label *add_aclk_host_labels(struct label *label) { break; } - int mqtt5 = config_get_boolean(CONFIG_SECTION_CLOUD, "mqtt5", CONFIG_BOOLEAN_NO); - label = add_label_to_list(label, "_mqtt_version", mqtt5 ? "5" : "3", LABEL_SOURCE_AUTO); - label = add_label_to_list(label, "_aclk_impl", "Next Generation", LABEL_SOURCE_AUTO); - label = add_label_to_list(label, "_aclk_proxy", proxy_str, LABEL_SOURCE_AUTO); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - label = add_label_to_list(label, "_aclk_ng_new_cloud_protocol", "true", LABEL_SOURCE_AUTO); -#else - label = add_label_to_list(label, "_aclk_ng_new_cloud_protocol", "false", LABEL_SOURCE_AUTO); -#endif + + int mqtt5 = config_get_boolean(CONFIG_SECTION_CLOUD, "mqtt5", CONFIG_BOOLEAN_YES); + + rrdlabels_add(labels, "_mqtt_version", mqtt5 ? "5" : "3", RRDLABEL_SRC_AUTO); + rrdlabels_add(labels, "_aclk_impl", "Next Generation", RRDLABEL_SRC_AUTO); + rrdlabels_add(labels, "_aclk_proxy", proxy_str, RRDLABEL_SRC_AUTO); + rrdlabels_add(labels, "_aclk_ng_new_cloud_protocol", "true", RRDLABEL_SRC_AUTO|RRDLABEL_SRC_ACLK); #endif - return label; } char *aclk_state(void) { diff --git a/aclk/aclk_api.h b/aclk/aclk_api.h index 557b70d70..36a6d603f 100644 --- a/aclk/aclk_api.h +++ b/aclk/aclk_api.h @@ -15,31 +15,17 @@ extern usec_t aclk_session_us; extern time_t aclk_session_sec; extern int aclk_disable_runtime; -extern int aclk_disable_single_updates; extern int aclk_stats_enabled; extern int aclk_alert_reloaded; -extern int aclk_ng; extern int use_mqtt_5; +extern int aclk_ctx_based; #ifdef ENABLE_ACLK void *aclk_starter(void *ptr); -void aclk_single_update_disable(); -void aclk_single_update_enable(); - -void aclk_alarm_reload(void); - -int aclk_update_chart(RRDHOST *host, char *chart_name, int create); -int aclk_update_alarm(RRDHOST *host, ALARM_ENTRY *ae); - -void aclk_add_collector(RRDHOST *host, const char *plugin_name, const char *module_name); -void aclk_del_collector(RRDHOST *host, const char *plugin_name, const char *module_name); - -#ifdef ENABLE_NEW_CLOUD_PROTOCOL void aclk_host_state_update(RRDHOST *host, int connect); -#endif #define NETDATA_ACLK_HOOK \ { .name = "ACLK_Main", \ @@ -52,7 +38,7 @@ void aclk_host_state_update(RRDHOST *host, int connect); #endif -struct label *add_aclk_host_labels(struct label *label); +void add_aclk_host_labels(void); char *aclk_state(void); char *aclk_state_json(void); diff --git a/aclk/aclk_charts_api.c b/aclk/aclk_charts_api.c index 4e1c466e8..51d8dad58 100644 --- a/aclk/aclk_charts_api.c +++ b/aclk/aclk_charts_api.c @@ -66,3 +66,12 @@ void aclk_update_node_info(struct update_node_info *info) query->data.bin_payload.msg_name = "UpdateNodeInfo"; QUEUE_IF_PAYLOAD_PRESENT(query); } + +void aclk_update_node_collectors(struct update_node_collectors *collectors) +{ + aclk_query_t query = aclk_query_new(UPDATE_NODE_COLLECTORS); + query->data.bin_payload.topic = ACLK_TOPICID_NODE_COLLECTORS; + query->data.bin_payload.payload = generate_update_node_collectors_message(&query->data.bin_payload.size, collectors); + query->data.bin_payload.msg_name = "UpdateNodeCollectors"; + QUEUE_IF_PAYLOAD_PRESENT(query); +} diff --git a/aclk/aclk_charts_api.h b/aclk/aclk_charts_api.h index 305fe4f74..71f07dd33 100644 --- a/aclk/aclk_charts_api.h +++ b/aclk/aclk_charts_api.h @@ -17,4 +17,6 @@ void aclk_retention_updated(struct retention_updated *data); void aclk_update_node_info(struct update_node_info *info); +void aclk_update_node_collectors(struct update_node_collectors *collectors); + #endif /* ACLK_CHARTS_H */ diff --git a/aclk/aclk_collector_list.c b/aclk/aclk_collector_list.c deleted file mode 100644 index 2920c9a5c..000000000 --- a/aclk/aclk_collector_list.c +++ /dev/null @@ -1,193 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// This is copied from Legacy ACLK, Original Author: amoss - -// TODO unmess this - -#include "aclk_collector_list.h" - -netdata_mutex_t collector_mutex = NETDATA_MUTEX_INITIALIZER; - -struct _collector *collector_list = NULL; - -/* - * Free a collector structure - */ -void _free_collector(struct _collector *collector) -{ - if (likely(collector->plugin_name)) - freez(collector->plugin_name); - - if (likely(collector->module_name)) - freez(collector->module_name); - - if (likely(collector->hostname)) - freez(collector->hostname); - - freez(collector); -} - -/* - * This will report the collector list - * - */ -#ifdef ACLK_DEBUG -static void _dump_collector_list() -{ - struct _collector *tmp_collector; - - COLLECTOR_LOCK; - - info("DUMPING ALL COLLECTORS"); - - if (unlikely(!collector_list || !collector_list->next)) { - COLLECTOR_UNLOCK; - info("DUMPING ALL COLLECTORS -- nothing found"); - return; - } - - // Note that the first entry is "dummy" - tmp_collector = collector_list->next; - - while (tmp_collector) { - info( - "COLLECTOR %s : [%s:%s] count = %u", tmp_collector->hostname, - tmp_collector->plugin_name ? tmp_collector->plugin_name : "", - tmp_collector->module_name ? tmp_collector->module_name : "", tmp_collector->count); - - tmp_collector = tmp_collector->next; - } - info("DUMPING ALL COLLECTORS DONE"); - COLLECTOR_UNLOCK; -} -#endif - -/* - * This will cleanup the collector list - * - */ -void _reset_collector_list() -{ - struct _collector *tmp_collector, *next_collector; - - COLLECTOR_LOCK; - - if (unlikely(!collector_list || !collector_list->next)) { - COLLECTOR_UNLOCK; - return; - } - - // Note that the first entry is "dummy" - tmp_collector = collector_list->next; - collector_list->count = 0; - collector_list->next = NULL; - - // We broke the link; we can unlock - COLLECTOR_UNLOCK; - - while (tmp_collector) { - next_collector = tmp_collector->next; - _free_collector(tmp_collector); - tmp_collector = next_collector; - } -} - -/* - * Find a collector (if it exists) - * Must lock before calling this - * If last_collector is not null, it will return the previous collector in the linked - * list (used in collector delete) - */ -static struct _collector *_find_collector( - const char *hostname, const char *plugin_name, const char *module_name, struct _collector **last_collector) -{ - struct _collector *tmp_collector, *prev_collector; - uint32_t plugin_hash; - uint32_t module_hash; - uint32_t hostname_hash; - - if (unlikely(!collector_list)) { - collector_list = callocz(1, sizeof(struct _collector)); - return NULL; - } - - if (unlikely(!collector_list->next)) - return NULL; - - plugin_hash = plugin_name ? simple_hash(plugin_name) : 1; - module_hash = module_name ? simple_hash(module_name) : 1; - hostname_hash = simple_hash(hostname); - - // Note that the first entry is "dummy" - tmp_collector = collector_list->next; - prev_collector = collector_list; - while (tmp_collector) { - if (plugin_hash == tmp_collector->plugin_hash && module_hash == tmp_collector->module_hash && - hostname_hash == tmp_collector->hostname_hash && (!strcmp(hostname, tmp_collector->hostname)) && - (!plugin_name || !tmp_collector->plugin_name || !strcmp(plugin_name, tmp_collector->plugin_name)) && - (!module_name || !tmp_collector->module_name || !strcmp(module_name, tmp_collector->module_name))) { - if (unlikely(last_collector)) - *last_collector = prev_collector; - - return tmp_collector; - } - - prev_collector = tmp_collector; - tmp_collector = tmp_collector->next; - } - - return tmp_collector; -} - -/* - * Called to delete a collector - * It will reduce the count (chart_count) and will remove it - * from the linked list if the count reaches zero - * The structure will be returned to the caller to free - * the resources - * - */ -struct _collector *_del_collector(const char *hostname, const char *plugin_name, const char *module_name) -{ - struct _collector *tmp_collector, *prev_collector = NULL; - - tmp_collector = _find_collector(hostname, plugin_name, module_name, &prev_collector); - - if (likely(tmp_collector)) { - --tmp_collector->count; - if (unlikely(!tmp_collector->count)) - prev_collector->next = tmp_collector->next; - } - return tmp_collector; -} - -/* - * Add a new collector (plugin / module) to the list - * If it already exists just update the chart count - * - * Lock before calling - */ -struct _collector *_add_collector(const char *hostname, const char *plugin_name, const char *module_name) -{ - struct _collector *tmp_collector; - - tmp_collector = _find_collector(hostname, plugin_name, module_name, NULL); - - if (unlikely(!tmp_collector)) { - tmp_collector = callocz(1, sizeof(struct _collector)); - tmp_collector->hostname_hash = simple_hash(hostname); - tmp_collector->plugin_hash = plugin_name ? simple_hash(plugin_name) : 1; - tmp_collector->module_hash = module_name ? simple_hash(module_name) : 1; - - tmp_collector->hostname = strdupz(hostname); - tmp_collector->plugin_name = plugin_name ? strdupz(plugin_name) : NULL; - tmp_collector->module_name = module_name ? strdupz(module_name) : NULL; - - tmp_collector->next = collector_list->next; - collector_list->next = tmp_collector; - } - tmp_collector->count++; - debug( - D_ACLK, "ADD COLLECTOR %s [%s:%s] -- chart %u", hostname, plugin_name ? plugin_name : "*", - module_name ? module_name : "*", tmp_collector->count); - return tmp_collector; -} diff --git a/aclk/aclk_collector_list.h b/aclk/aclk_collector_list.h deleted file mode 100644 index 09c06b14a..000000000 --- a/aclk/aclk_collector_list.h +++ /dev/null @@ -1,41 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later -// This is copied from Legacy ACLK, Original Author: amoss - -// TODO unmess this - -#ifndef ACLK_COLLECTOR_LIST_H -#define ACLK_COLLECTOR_LIST_H - -#include "libnetdata/libnetdata.h" - -extern netdata_mutex_t collector_mutex; - -#define COLLECTOR_LOCK netdata_mutex_lock(&collector_mutex) -#define COLLECTOR_UNLOCK netdata_mutex_unlock(&collector_mutex) - -/* - * Maintain a list of collectors and chart count - * If all the charts of a collector are deleted - * then a new metadata dataset must be send to the cloud - * - */ -struct _collector { - time_t created; - uint32_t count; //chart count - uint32_t hostname_hash; - uint32_t plugin_hash; - uint32_t module_hash; - char *hostname; - char *plugin_name; - char *module_name; - struct _collector *next; -}; - -extern struct _collector *collector_list; - -struct _collector *_add_collector(const char *hostname, const char *plugin_name, const char *module_name); -struct _collector *_del_collector(const char *hostname, const char *plugin_name, const char *module_name); -void _reset_collector_list(); -void _free_collector(struct _collector *collector); - -#endif /* ACLK_COLLECTOR_LIST_H */ diff --git a/aclk/aclk_contexts_api.c b/aclk/aclk_contexts_api.c new file mode 100644 index 000000000..f17d3cabd --- /dev/null +++ b/aclk/aclk_contexts_api.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "aclk_query_queue.h" + +#include "aclk_contexts_api.h" + +void aclk_send_contexts_snapshot(contexts_snapshot_t data) +{ + aclk_query_t query = aclk_query_new(PROTO_BIN_MESSAGE); + query->data.bin_payload.topic = ACLK_TOPICID_CTXS_SNAPSHOT; + query->data.bin_payload.payload = contexts_snapshot_2bin(data, &query->data.bin_payload.size); + query->data.bin_payload.msg_name = "ContextsSnapshot"; + QUEUE_IF_PAYLOAD_PRESENT(query); +} + +void aclk_send_contexts_updated(contexts_updated_t data) +{ + aclk_query_t query = aclk_query_new(PROTO_BIN_MESSAGE); + query->data.bin_payload.topic = ACLK_TOPICID_CTXS_UPDATED; + query->data.bin_payload.payload = contexts_updated_2bin(data, &query->data.bin_payload.size); + query->data.bin_payload.msg_name = "ContextsUpdated"; + QUEUE_IF_PAYLOAD_PRESENT(query); +} diff --git a/aclk/aclk_contexts_api.h b/aclk/aclk_contexts_api.h new file mode 100644 index 000000000..46b916d22 --- /dev/null +++ b/aclk/aclk_contexts_api.h @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +#ifndef ACLK_CONTEXTS_API_H +#define ACLK_CONTEXTS_API_H + +#include "schema-wrappers/schema_wrappers.h" + + +void aclk_send_contexts_snapshot(contexts_snapshot_t data); +void aclk_send_contexts_updated(contexts_updated_t data); + +#endif /* ACLK_CONTEXTS_API_H */ + diff --git a/aclk/aclk_otp.c b/aclk/aclk_otp.c index c99c65637..b7bf173c4 100644 --- a/aclk/aclk_otp.c +++ b/aclk/aclk_otp.c @@ -446,11 +446,37 @@ cleanup_buffers: return rc; } +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 +static int private_decrypt(EVP_PKEY *p_key, unsigned char * enc_data, int data_len, unsigned char **decrypted) +#else static int private_decrypt(RSA *p_key, unsigned char * enc_data, int data_len, unsigned char **decrypted) +#endif { + int result; +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 + size_t outlen = EVP_PKEY_size(p_key); + EVP_PKEY_CTX *ctx = EVP_PKEY_CTX_new(p_key, NULL); + if (!ctx) + return 1; + + if (EVP_PKEY_decrypt_init(ctx) <= 0) + return 1; + + if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_OAEP_PADDING) <= 0) + return 1; + + *decrypted = mallocz(outlen); + + if (EVP_PKEY_decrypt(ctx, *decrypted, &outlen, enc_data, data_len) == 1) + result = (int) outlen; + else + result = -1; +#else *decrypted = mallocz(RSA_size(p_key)); - int result = RSA_private_decrypt(data_len, enc_data, *decrypted, p_key, RSA_PKCS1_OAEP_PADDING); - if (result == -1) { + result = RSA_private_decrypt(data_len, enc_data, *decrypted, p_key, RSA_PKCS1_OAEP_PADDING); +#endif + if (result == -1) + { char err[512]; ERR_error_string_n(ERR_get_error(), err, sizeof(err)); error("Decryption of the challenge failed: %s", err); @@ -458,12 +484,16 @@ static int private_decrypt(RSA *p_key, unsigned char * enc_data, int data_len, u return result; } +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 +int aclk_get_mqtt_otp(EVP_PKEY *p_key, char **mqtt_id, char **mqtt_usr, char **mqtt_pass, url_t *target) +#else int aclk_get_mqtt_otp(RSA *p_key, char **mqtt_id, char **mqtt_usr, char **mqtt_pass, url_t *target) +#endif { unsigned char *challenge; int challenge_bytes; - char *agent_id = is_agent_claimed(); + char *agent_id = get_agent_claimid(); if (agent_id == NULL) { error("Agent was not claimed - cannot perform challenge/response"); return 1; @@ -806,7 +836,7 @@ int aclk_get_env(aclk_env_t *env, const char* aclk_hostname, int aclk_port) { req.request_type = HTTP_REQ_GET; - char *agent_id = is_agent_claimed(); + char *agent_id = get_agent_claimid(); if (agent_id == NULL) { error("Agent was not claimed - cannot perform challenge/response"); @@ -814,11 +844,11 @@ int aclk_get_env(aclk_env_t *env, const char* aclk_hostname, int aclk_port) { return 1; } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - buffer_sprintf(buf, "/api/v1/env?v=%s&cap=json,proto&claim_id=%s", &(VERSION[1]) /* skip 'v' at beginning */, agent_id); -#else - buffer_sprintf(buf, "/api/v1/env?v=%s&cap=json&claim_id=%s", &(VERSION[1]) /* skip 'v' at beginning */, agent_id); -#endif + if (rrdcontext_enabled) + buffer_sprintf(buf, "/api/v1/env?v=%s&cap=proto,ctx&claim_id=%s", &(VERSION[1]) /* skip 'v' at beginning */, agent_id); + else + buffer_sprintf(buf, "/api/v1/env?v=%s&cap=proto&claim_id=%s", &(VERSION[1]) /* skip 'v' at beginning */, agent_id); + freez(agent_id); req.host = (char*)aclk_hostname; diff --git a/aclk/aclk_otp.h b/aclk/aclk_otp.h index 1ca9245c2..2d660e5a4 100644 --- a/aclk/aclk_otp.h +++ b/aclk/aclk_otp.h @@ -8,7 +8,11 @@ #include "https_client.h" #include "aclk_util.h" +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 +int aclk_get_mqtt_otp(EVP_PKEY *p_key, char **mqtt_id, char **mqtt_usr, char **mqtt_pass, url_t *target); +#else int aclk_get_mqtt_otp(RSA *p_key, char **mqtt_id, char **mqtt_usr, char **mqtt_pass, url_t *target); +#endif int aclk_get_env(aclk_env_t *env, const char *aclk_hostname, int aclk_port); #endif /* ACLK_OTP_H */ diff --git a/aclk/aclk_query.c b/aclk/aclk_query.c index de970fc3d..981c01965 100644 --- a/aclk/aclk_query.c +++ b/aclk/aclk_query.c @@ -13,27 +13,6 @@ pthread_mutex_t query_lock_wait = PTHREAD_MUTEX_INITIALIZER; #define QUERY_THREAD_LOCK pthread_mutex_lock(&query_lock_wait) #define QUERY_THREAD_UNLOCK pthread_mutex_unlock(&query_lock_wait) -typedef struct aclk_query_handler { - aclk_query_type_t type; - char *name; // for logging purposes - int(*fnc)(struct aclk_query_thread *query_thr, aclk_query_t query); -} aclk_query_handler; - -static int info_metadata(struct aclk_query_thread *query_thr, aclk_query_t query) -{ - aclk_send_info_metadata(query_thr->client, - !query->data.metadata_info.initial_on_connect, - query->data.metadata_info.host); - return 0; -} - -static int alarms_metadata(struct aclk_query_thread *query_thr, aclk_query_t query) -{ - aclk_send_alarm_metadata(query_thr->client, - !query->data.metadata_info.initial_on_connect); - return 0; -} - static usec_t aclk_web_api_v1_request(RRDHOST *host, struct web_client *w, char *url) { usec_t t; @@ -277,84 +256,63 @@ cleanup: return retval; } -static int chart_query(struct aclk_query_thread *query_thr, aclk_query_t query) -{ - aclk_chart_msg(query_thr->client, query->data.chart_add_del.host, query->data.chart_add_del.chart_name); - return 0; -} - -static int alarm_state_update_query(struct aclk_query_thread *query_thr, aclk_query_t query) -{ - aclk_alarm_state_msg(query_thr->client, query->data.alarm_update); - // aclk_alarm_state_msg frees the json object including the header it generates - query->data.alarm_update = NULL; - return 0; -} - -#ifdef ENABLE_NEW_CLOUD_PROTOCOL static int send_bin_msg(struct aclk_query_thread *query_thr, aclk_query_t query) { // this will be simplified when legacy support is removed aclk_send_bin_message_subtopic_pid(query_thr->client, query->data.bin_payload.payload, query->data.bin_payload.size, query->data.bin_payload.topic, query->data.bin_payload.msg_name); return 0; } -#endif - -aclk_query_handler aclk_query_handlers[] = { - { .type = HTTP_API_V2, .name = "http_api_request_v2", .fnc = http_api_v2 }, - { .type = ALARM_STATE_UPDATE, .name = "alarm_state_update", .fnc = alarm_state_update_query }, - { .type = METADATA_INFO, .name = "info_metadata", .fnc = info_metadata }, - { .type = METADATA_ALARMS, .name = "alarms_metadata", .fnc = alarms_metadata }, - { .type = CHART_NEW, .name = "chart_new", .fnc = chart_query }, - { .type = CHART_DEL, .name = "chart_delete", .fnc = info_metadata }, -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - { .type = REGISTER_NODE, .name = "register_node", .fnc = send_bin_msg }, - { .type = NODE_STATE_UPDATE, .name = "node_state_update", .fnc = send_bin_msg }, - { .type = CHART_DIMS_UPDATE, .name = "chart_and_dim_update", .fnc = send_bin_msg }, - { .type = CHART_CONFIG_UPDATED, .name = "chart_config_updated", .fnc = send_bin_msg }, - { .type = CHART_RESET, .name = "reset_chart_messages", .fnc = send_bin_msg }, - { .type = RETENTION_UPDATED, .name = "update_retention_info", .fnc = send_bin_msg }, - { .type = UPDATE_NODE_INFO, .name = "update_node_info", .fnc = send_bin_msg }, - { .type = ALARM_LOG_HEALTH, .name = "alarm_log_health", .fnc = send_bin_msg }, - { .type = ALARM_PROVIDE_CFG, .name = "provide_alarm_config", .fnc = send_bin_msg }, - { .type = ALARM_SNAPSHOT, .name = "alarm_snapshot", .fnc = send_bin_msg }, -#endif - { .type = UNKNOWN, .name = NULL, .fnc = NULL } -}; const char *aclk_query_get_name(aclk_query_type_t qt) { - aclk_query_handler *ptr = aclk_query_handlers; - while (ptr->type != UNKNOWN) { - if (ptr->type == qt) - return ptr->name; - ptr++; + switch (qt) { + case HTTP_API_V2: return "http_api_request_v2"; + case REGISTER_NODE: return "register_node"; + case NODE_STATE_UPDATE: return "node_state_update"; + case CHART_DIMS_UPDATE: return "chart_and_dim_update"; + case CHART_CONFIG_UPDATED: return "chart_config_updated"; + case CHART_RESET: return "reset_chart_messages"; + case RETENTION_UPDATED: return "update_retention_info"; + case UPDATE_NODE_INFO: return "update_node_info"; + case ALARM_LOG_HEALTH: return "alarm_log_health"; + case ALARM_PROVIDE_CFG: return "provide_alarm_config"; + case ALARM_SNAPSHOT: return "alarm_snapshot"; + case UPDATE_NODE_COLLECTORS: return "update_node_collectors"; + case PROTO_BIN_MESSAGE: return "generic_binary_proto_message"; + default: + error_report("Unknown query type used %d", (int) qt); + return "unknown"; } - return "unknown"; } static void aclk_query_process_msg(struct aclk_query_thread *query_thr, aclk_query_t query) -{ - for (int i = 0; aclk_query_handlers[i].type != UNKNOWN; i++) { - if (aclk_query_handlers[i].type == query->type) { - worker_is_busy(i); - - debug(D_ACLK, "Processing Queued Message of type: \"%s\"", aclk_query_handlers[i].name); - aclk_query_handlers[i].fnc(query_thr, query); - if (aclk_stats_enabled) { - ACLK_STATS_LOCK; - aclk_metrics_per_sample.queries_dispatched++; - aclk_queries_per_thread[query_thr->idx]++; - aclk_metrics_per_sample.queries_per_type[query->type]++; - ACLK_STATS_UNLOCK; - } - aclk_query_free(query); +{ + if (query->type == UNKNOWN || query->type >= ACLK_QUERY_TYPE_COUNT) { + error_report("Unknown query in query queue. %u", query->type); + aclk_query_free(query); + return; + } - worker_is_idle(); - return; - } + worker_is_busy(query->type); + if (query->type == HTTP_API_V2) { + debug(D_ACLK, "Processing Queued Message of type: \"http_api_request_v2\""); + http_api_v2(query_thr, query); + } else { + debug(D_ACLK, "Processing Queued Message of type: \"%s\"", query->data.bin_payload.msg_name); + send_bin_msg(query_thr, query); } - fatal("Unknown query in query queue. %u", query->type); + + if (aclk_stats_enabled) { + ACLK_STATS_LOCK; + aclk_metrics_per_sample.queries_dispatched++; + aclk_queries_per_thread[query_thr->idx]++; + aclk_metrics_per_sample.queries_per_type[query->type]++; + ACLK_STATS_UNLOCK; + } + + aclk_query_free(query); + + worker_is_idle(); } /* Processes messages from queue. Compete for work with other threads @@ -370,8 +328,8 @@ int aclk_query_process_msgs(struct aclk_query_thread *query_thr) static void worker_aclk_register(void) { worker_register("ACLKQUERY"); - for (int i = 0; aclk_query_handlers[i].type != UNKNOWN; i++) { - worker_register_job_name(i, aclk_query_handlers[i].name); + for (int i = 1; i < ACLK_QUERY_TYPE_COUNT; i++) { + worker_register_job_name(i, aclk_query_get_name(i)); } } diff --git a/aclk/aclk_query_queue.c b/aclk/aclk_query_queue.c index 2422b01e1..01b20d23f 100644 --- a/aclk/aclk_query_queue.c +++ b/aclk/aclk_query_queue.c @@ -111,15 +111,6 @@ void aclk_query_free(aclk_query_t query) freez(query->data.http_api_v2.query); break; - case CHART_NEW: - freez(query->data.chart_add_del.chart_name); - break; - - case ALARM_STATE_UPDATE: - if (query->data.alarm_update) - json_object_put(query->data.alarm_update); - break; - case NODE_STATE_UPDATE: case REGISTER_NODE: case CHART_DIMS_UPDATE: @@ -130,6 +121,8 @@ void aclk_query_free(aclk_query_t query) case ALARM_LOG_HEALTH: case ALARM_PROVIDE_CFG: case ALARM_SNAPSHOT: + case UPDATE_NODE_COLLECTORS: + case PROTO_BIN_MESSAGE: if (!use_mqtt_5) freez(query->data.bin_payload.payload); break; diff --git a/aclk/aclk_query_queue.h b/aclk/aclk_query_queue.h index 0b5ef8faa..ab94b6384 100644 --- a/aclk/aclk_query_queue.h +++ b/aclk/aclk_query_queue.h @@ -11,12 +11,7 @@ typedef enum { UNKNOWN = 0, - METADATA_INFO, - METADATA_ALARMS, HTTP_API_V2, - CHART_NEW, - CHART_DEL, - ALARM_STATE_UPDATE, REGISTER_NODE, NODE_STATE_UPDATE, CHART_DIMS_UPDATE, @@ -27,19 +22,11 @@ typedef enum { ALARM_LOG_HEALTH, ALARM_PROVIDE_CFG, ALARM_SNAPSHOT, + UPDATE_NODE_COLLECTORS, + PROTO_BIN_MESSAGE, ACLK_QUERY_TYPE_COUNT // always keep this as last } aclk_query_type_t; -struct aclk_query_metadata { - RRDHOST *host; - int initial_on_connect; -}; - -struct aclk_query_chart_add_del { - RRDHOST *host; - char* chart_name; -}; - struct aclk_query_http_api_v2 { char *payload; char *query; @@ -73,12 +60,8 @@ struct aclk_query { // TODO maybe remove? int version; union { - struct aclk_query_metadata metadata_info; - struct aclk_query_metadata metadata_alarms; struct aclk_query_http_api_v2 http_api_v2; - struct aclk_query_chart_add_del chart_add_del; struct aclk_bin_payload bin_payload; - json_object *alarm_update; } data; }; diff --git a/aclk/aclk_rrdhost_state.h b/aclk/aclk_rrdhost_state.h index 9138123df..5c8a2ddc9 100644 --- a/aclk/aclk_rrdhost_state.h +++ b/aclk/aclk_rrdhost_state.h @@ -3,43 +3,9 @@ #include "libnetdata/libnetdata.h" -#ifdef ACLK_LEGACY -typedef enum aclk_cmd { - ACLK_CMD_CLOUD, - ACLK_CMD_ONCONNECT, - ACLK_CMD_INFO, - ACLK_CMD_CHART, - ACLK_CMD_CHARTDEL, - ACLK_CMD_ALARM, - ACLK_CMD_CLOUD_QUERY_2, - ACLK_CMD_CHILD_CONNECT, - ACLK_CMD_CHILD_DISCONNECT -} ACLK_CMD; - -typedef enum aclk_metadata_state { - ACLK_METADATA_REQUIRED, - ACLK_METADATA_CMD_QUEUED, - ACLK_METADATA_SENT -} ACLK_METADATA_STATE; -#endif - -typedef enum aclk_agent_state { - ACLK_HOST_INITIALIZING, - ACLK_HOST_STABLE -} ACLK_AGENT_STATE; - typedef struct aclk_rrdhost_state { char *claimed_id; // Claimed ID if host has one otherwise NULL char *prev_claimed_id; // Claimed ID if changed (reclaimed) during runtime - -#ifdef ACLK_LEGACY - // per child popcorning - ACLK_AGENT_STATE state; - ACLK_METADATA_STATE metadata; - - time_t timestamp_created; - time_t t_last_popcorn_update; -#endif /* ACLK_LEGACY */ } aclk_rrdhost_state; #endif /* ACLK_RRDHOST_STATE_H */ diff --git a/aclk/aclk_rx_msgs.c b/aclk/aclk_rx_msgs.c index 27f1bf2dc..e6ed332cc 100644 --- a/aclk/aclk_rx_msgs.c +++ b/aclk/aclk_rx_msgs.c @@ -6,6 +6,8 @@ #include "aclk_query_queue.h" #include "aclk.h" +#include "schema-wrappers/proto_2_json.h" + #define ACLK_V2_PAYLOAD_SEPARATOR "\x0D\x0A\x0D\x0A" #define ACLK_CLOUD_REQ_V2_PREFIX "GET /" @@ -55,19 +57,19 @@ static int cloud_to_agent_parse(JSON_ENTRY *e) break; case JSON_NUMBER: if (!strcmp(e->name, "version")) { - data->version = e->data.number; + data->version = (int)e->data.number; break; } if (!strcmp(e->name, "timeout")) { - data->timeout = e->data.number; + data->timeout = (int)e->data.number; break; } if (!strcmp(e->name, "min-version")) { - data->min_version = e->data.number; + data->min_version = (int)e->data.number; break; } if (!strcmp(e->name, "max-version")) { - data->max_version = e->data.number; + data->max_version = (int)e->data.number; break; } @@ -116,20 +118,8 @@ static inline int aclk_v2_payload_get_query(const char *payload, char **query_ur return 0; } -#define HTTP_CHECK_AGENT_INITIALIZED() ACLK_SHARED_STATE_LOCK;\ - if (unlikely(aclk_shared_state.agent_state == ACLK_HOST_INITIALIZING)) {\ - debug(D_ACLK, "Ignoring \"http\" cloud request; agent not in stable state");\ - ACLK_SHARED_STATE_UNLOCK;\ - return 1;\ - }\ - ACLK_SHARED_STATE_UNLOCK; - static int aclk_handle_cloud_http_request_v2(struct aclk_request *cloud_to_agent, char *raw_payload) { - if (!aclk_use_new_cloud_arch) { - HTTP_CHECK_AGENT_INITIALIZED(); - } - aclk_query_t query; errno = 0; @@ -229,7 +219,6 @@ err_cleanup: return 1; } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL typedef uint32_t simple_hash_t; typedef int(*rx_msg_handler)(const char *msg, size_t msg_len); @@ -300,6 +289,15 @@ int create_node_instance_result(const char *msg, size_t msg_len) } } + struct capability caps[] = { + { .name = "proto", .version = 1, .enabled = 1 }, + { .name = "ml", .version = ml_capable(localhost), .enabled = host ? ml_enabled(host) : 0 }, + { .name = "mc", .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations }, + { .name = "ctx", .version = 1, .enabled = rrdcontext_enabled }, + { .name = NULL, .version = 0, .enabled = 0 } + }; + node_state_update.capabilities = caps; + rrdhost_aclk_state_lock(localhost); node_state_update.claim_id = localhost->aclk_state.claimed_id; query->data.bin_payload.payload = generate_node_instance_connection(&query->data.bin_payload.size, &node_state_update); @@ -324,6 +322,7 @@ int send_node_instances(const char *msg, size_t msg_len) int stream_charts_and_dimensions(const char *msg, size_t msg_len) { + aclk_ctx_based = 0; stream_charts_and_dims_t res = parse_stream_charts_and_dims(msg, msg_len); if (!res.claim_id || !res.node_id) { error("Error parsing StreamChartsAndDimensions msg"); @@ -437,6 +436,41 @@ int handle_disconnect_req(const char *msg, size_t msg_len) return 0; } +int contexts_checkpoint(const char *msg, size_t msg_len) +{ + aclk_ctx_based = 1; + + struct ctxs_checkpoint *cmd = parse_ctxs_checkpoint(msg, msg_len); + if (!cmd) + return 1; + + rrdcontext_hub_checkpoint_command(cmd); + + freez(cmd->claim_id); + freez(cmd->node_id); + freez(cmd); + return 0; +} + +int stop_streaming_contexts(const char *msg, size_t msg_len) +{ + if (!aclk_ctx_based) { + error_report("Received StopStreamingContexts message but context based communication was not enabled (Cloud violated the protocol). Ignoring message"); + return 1; + } + + struct stop_streaming_ctxs *cmd = parse_stop_streaming_ctxs(msg, msg_len); + if (!cmd) + return 1; + + rrdcontext_hub_stop_streaming_command(cmd); + + freez(cmd->claim_id); + freez(cmd->node_id); + freez(cmd); + return 0; +} + typedef struct { const char *name; simple_hash_t name_hash; @@ -455,6 +489,8 @@ new_cloud_rx_msg_t rx_msgs[] = { { .name = "SendAlarmConfiguration", .name_hash = 0, .fnc = send_alarm_configuration }, { .name = "SendAlarmSnapshot", .name_hash = 0, .fnc = send_alarm_snapshot }, { .name = "DisconnectReq", .name_hash = 0, .fnc = handle_disconnect_req }, + { .name = "ContextsCheckpoint", .name_hash = 0, .fnc = contexts_checkpoint }, + { .name = "StopStreamingContexts", .name_hash = 0, .fnc = stop_streaming_contexts }, { .name = NULL, .name_hash = 0, .fnc = NULL }, }; @@ -491,7 +527,7 @@ unsigned int aclk_init_rx_msg_handlers(void) return i; } -void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t msg_len) +void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t msg_len, const char *topic) { if (aclk_stats_enabled) { ACLK_STATS_LOCK; @@ -509,6 +545,17 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t } return; } + +#ifdef NETDATA_INTERNAL_CHECKS + if (!strncmp(message_type, "cmd", strlen("cmd"))) { + log_aclk_message_bin(msg, msg_len, 0, topic, msg_descriptor->name); + } else { + char *json = protomsg_to_json(msg, msg_len, msg_descriptor->name); + log_aclk_message_bin(json, strlen(json), 0, topic, msg_descriptor->name); + freez(json); + } +#endif + if (aclk_stats_enabled) { ACLK_STATS_LOCK; aclk_proto_rx_msgs_sample[msg_descriptor-rx_msgs]++; @@ -524,4 +571,3 @@ void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t return; } } -#endif diff --git a/aclk/aclk_rx_msgs.h b/aclk/aclk_rx_msgs.h index 00f88c6a8..61921faec 100644 --- a/aclk/aclk_rx_msgs.h +++ b/aclk/aclk_rx_msgs.h @@ -10,10 +10,8 @@ int aclk_handle_cloud_cmd_message(char *payload); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL const char *rx_handler_get_name(size_t i); unsigned int aclk_init_rx_msg_handlers(void); -void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t msg_len); -#endif +void aclk_handle_new_cloud_msg(const char *message_type, const char *msg, size_t msg_len, const char *topic); #endif /* ACLK_RX_MSGS_H */ diff --git a/aclk/aclk_stats.c b/aclk/aclk_stats.c index ca0532638..241e9b724 100644 --- a/aclk/aclk_stats.c +++ b/aclk/aclk_stats.c @@ -8,11 +8,9 @@ netdata_mutex_t aclk_stats_mutex = NETDATA_MUTEX_INITIALIZER; struct { int query_thread_count; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL unsigned int proto_hdl_cnt; uint32_t *aclk_proto_rx_msgs_sample; RRDDIM **rx_msg_dims; -#endif } aclk_stats_cfg; // there is only 1 stats thread at a time // data ACLK stats need per query thread @@ -237,7 +235,6 @@ static void aclk_stats_query_time(struct aclk_metrics_per_sample *per_sample) rrdset_done(st); } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL const char *rx_handler_get_name(size_t i); static void aclk_stats_newproto_rx(uint32_t *rx_msgs_sample) { @@ -259,35 +256,53 @@ static void aclk_stats_newproto_rx(uint32_t *rx_msgs_sample) rrdset_done(st); } -#endif -void aclk_stats_thread_prepare(int query_thread_count, unsigned int proto_hdl_cnt) +static void aclk_stats_mqtt_wss(struct mqtt_wss_stats *stats) { -#ifndef ENABLE_NEW_CLOUD_PROTOCOL - UNUSED(proto_hdl_cnt); -#endif + static RRDSET *st = NULL; + static RRDDIM *rd_sent = NULL; + static RRDDIM *rd_recvd = NULL; + static uint64_t sent = 0; + static uint64_t recvd = 0; + + sent += stats->bytes_tx; + recvd += stats->bytes_rx; + + if (unlikely(!st)) { + st = rrdset_create_localhost( + "netdata", "aclk_openssl_bytes", NULL, "aclk", NULL, "Received and Sent bytes.", "B/s", + "netdata", "stats", 200011, localhost->rrd_update_every, RRDSET_TYPE_STACKED); + + rd_sent = rrddim_add(st, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); + rd_recvd = rrddim_add(st, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + } else + rrdset_next(st); + + rrddim_set_by_pointer(st, rd_sent, sent); + rrddim_set_by_pointer(st, rd_recvd, recvd); + rrdset_done(st); +} + +void aclk_stats_thread_prepare(int query_thread_count, unsigned int proto_hdl_cnt) +{ aclk_qt_data = callocz(query_thread_count, sizeof(struct aclk_qt_data)); aclk_queries_per_thread = callocz(query_thread_count, sizeof(uint32_t)); aclk_queries_per_thread_sample = callocz(query_thread_count, sizeof(uint32_t)); memset(&aclk_metrics_per_sample, 0, sizeof(struct aclk_metrics_per_sample)); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL aclk_stats_cfg.proto_hdl_cnt = proto_hdl_cnt; aclk_stats_cfg.aclk_proto_rx_msgs_sample = callocz(proto_hdl_cnt, sizeof(*aclk_proto_rx_msgs_sample)); aclk_proto_rx_msgs_sample = callocz(proto_hdl_cnt, sizeof(*aclk_proto_rx_msgs_sample)); aclk_stats_cfg.rx_msg_dims = callocz(proto_hdl_cnt, sizeof(RRDDIM*)); -#endif } void aclk_stats_thread_cleanup() { -#ifdef ENABLE_NEW_CLOUD_PROTOCOL freez(aclk_stats_cfg.rx_msg_dims); freez(aclk_proto_rx_msgs_sample); freez(aclk_stats_cfg.aclk_proto_rx_msgs_sample); -#endif freez(aclk_qt_data); freez(aclk_queries_per_thread); freez(aclk_queries_per_thread_sample); @@ -318,10 +333,10 @@ void *aclk_stats_main_thread(void *ptr) // to not hold lock longer than necessary, especially not to hold it // during database rrd* operations memcpy(&per_sample, &aclk_metrics_per_sample, sizeof(struct aclk_metrics_per_sample)); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL + memcpy(aclk_stats_cfg.aclk_proto_rx_msgs_sample, aclk_proto_rx_msgs_sample, sizeof(*aclk_proto_rx_msgs_sample) * aclk_stats_cfg.proto_hdl_cnt); memset(aclk_proto_rx_msgs_sample, 0, sizeof(*aclk_proto_rx_msgs_sample) * aclk_stats_cfg.proto_hdl_cnt); -#endif + memcpy(&permanent, &aclk_metrics, sizeof(struct aclk_metrics)); memset(&aclk_metrics_per_sample, 0, sizeof(struct aclk_metrics_per_sample)); @@ -343,9 +358,10 @@ void *aclk_stats_main_thread(void *ptr) aclk_stats_query_time(&per_sample); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL + struct mqtt_wss_stats mqtt_wss_stats = mqtt_wss_get_stats(args->client); + aclk_stats_mqtt_wss(&mqtt_wss_stats); + aclk_stats_newproto_rx(aclk_stats_cfg.aclk_proto_rx_msgs_sample); -#endif } return 0; diff --git a/aclk/aclk_stats.h b/aclk/aclk_stats.h index 4f2894798..bec9ac247 100644 --- a/aclk/aclk_stats.h +++ b/aclk/aclk_stats.h @@ -6,6 +6,7 @@ #include "daemon/common.h" #include "libnetdata/libnetdata.h" #include "aclk_query_queue.h" +#include "mqtt_wss_client.h" #define ACLK_STATS_THREAD_NAME "ACLK_Stats" @@ -22,6 +23,7 @@ int aclk_cloud_req_http_type_to_idx(const char *name); struct aclk_stats_thread { netdata_thread_t *thread; int query_thread_count; + mqtt_wss_client client; }; // preserve between samples @@ -60,9 +62,7 @@ extern struct aclk_metrics_per_sample { volatile uint32_t cloud_q_process_max; } aclk_metrics_per_sample; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL extern uint32_t *aclk_proto_rx_msgs_sample; -#endif extern uint32_t *aclk_queries_per_thread; diff --git a/aclk/aclk_tx_msgs.c b/aclk/aclk_tx_msgs.c index 3530dccff..822a90fa2 100644 --- a/aclk/aclk_tx_msgs.c +++ b/aclk/aclk_tx_msgs.c @@ -6,6 +6,8 @@ #include "aclk_stats.h" #include "aclk.h" +#include "schema-wrappers/proto_2_json.h" + #ifndef __GNUC__ #pragma region aclk_tx_msgs helper functions #endif @@ -13,29 +15,6 @@ // version for aclk legacy (old cloud arch) #define ACLK_VERSION 2 -static void aclk_send_message_subtopic(mqtt_wss_client client, json_object *msg, enum aclk_topics subtopic) -{ - uint16_t packet_id; - const char *str = json_object_to_json_string_ext(msg, JSON_C_TO_STRING_PLAIN); - const char *topic = aclk_get_topic(subtopic); - - if (unlikely(!topic)) { - error("Couldn't get topic. Aborting message send"); - return; - } - - mqtt_wss_publish_pid(client, topic, str, strlen(str), MQTT_WSS_PUB_QOS1, &packet_id); -#ifdef NETDATA_INTERNAL_CHECKS - aclk_stats_msg_published(packet_id); -#endif -#ifdef ACLK_LOG_CONVERSATION_DIR -#define FN_MAX_LEN 1024 - char filename[FN_MAX_LEN]; - snprintf(filename, FN_MAX_LEN, ACLK_LOG_CONVERSATION_DIR "/%010d-tx.json", ACLK_GET_CONV_LOG_NEXT()); - json_object_to_file_ext(filename, msg, JSON_C_TO_STRING_PRETTY); -#endif -} - uint16_t aclk_send_bin_message_subtopic_pid(mqtt_wss_client client, char *msg, size_t msg_len, enum aclk_topics subtopic, const char *msgname) { #ifndef ACLK_LOG_CONVERSATION_DIR @@ -56,42 +35,11 @@ uint16_t aclk_send_bin_message_subtopic_pid(mqtt_wss_client client, char *msg, s #ifdef NETDATA_INTERNAL_CHECKS aclk_stats_msg_published(packet_id); + char *json = protomsg_to_json(msg, msg_len, msgname); + log_aclk_message_bin(json, strlen(json), 1, topic, msgname); + freez(json); #endif -#ifdef ACLK_LOG_CONVERSATION_DIR -#define FN_MAX_LEN 1024 - char filename[FN_MAX_LEN]; - snprintf(filename, FN_MAX_LEN, ACLK_LOG_CONVERSATION_DIR "/%010d-tx-%s.bin", ACLK_GET_CONV_LOG_NEXT(), msgname); - FILE *fptr; - if (fptr = fopen(filename,"w")) { - fwrite(msg, msg_len, 1, fptr); - fclose(fptr); - } -#endif - - return packet_id; -} - -static uint16_t aclk_send_message_subtopic_pid(mqtt_wss_client client, json_object *msg, enum aclk_topics subtopic) -{ - uint16_t packet_id; - const char *str = json_object_to_json_string_ext(msg, JSON_C_TO_STRING_PLAIN); - const char *topic = aclk_get_topic(subtopic); - - if (unlikely(!topic)) { - error("Couldn't get topic. Aborting message send"); - return 0; - } - mqtt_wss_publish_pid(client, topic, str, strlen(str), MQTT_WSS_PUB_QOS1, &packet_id); -#ifdef NETDATA_INTERNAL_CHECKS - aclk_stats_msg_published(packet_id); -#endif -#ifdef ACLK_LOG_CONVERSATION_DIR -#define FN_MAX_LEN 1024 - char filename[FN_MAX_LEN]; - snprintf(filename, FN_MAX_LEN, ACLK_LOG_CONVERSATION_DIR "/%010d-tx.json", ACLK_GET_CONV_LOG_NEXT()); - json_object_to_file_ext(filename, msg, JSON_C_TO_STRING_PRETTY); -#endif return packet_id; } @@ -231,17 +179,6 @@ static struct json_object *create_hdr(const char *type, const char *msg_id, time return obj; } -static char *create_uuid() -{ - uuid_t uuid; - char *uuid_str = mallocz(36 + 1); - - uuid_generate(uuid); - uuid_unparse(uuid, uuid_str); - - return uuid_str; -} - #ifndef __GNUC__ #pragma endregion #endif @@ -250,90 +187,6 @@ static char *create_uuid() #pragma region aclk_tx_msgs message generators #endif -/* - * This will send the /api/v1/info - */ -#define BUFFER_INITIAL_SIZE (1024 * 16) -void aclk_send_info_metadata(mqtt_wss_client client, int metadata_submitted, RRDHOST *host) -{ - BUFFER *local_buffer = buffer_create(BUFFER_INITIAL_SIZE); - json_object *msg, *payload, *tmp; - - char *msg_id = create_uuid(); - buffer_flush(local_buffer); - local_buffer->contenttype = CT_APPLICATION_JSON; - - // on_connect messages are sent on a health reload, if the on_connect message is real then we - // use the session time as the fake timestamp to indicate that it starts the session. If it is - // a fake on_connect message then use the real timestamp to indicate it is within the existing - // session. - if (metadata_submitted) - msg = create_hdr("update", msg_id, 0, 0, ACLK_VERSION); - else - msg = create_hdr("connect", msg_id, aclk_session_sec, aclk_session_us, ACLK_VERSION); - - payload = json_object_new_object(); - json_object_object_add(msg, "payload", payload); - - web_client_api_request_v1_info_fill_buffer(host, local_buffer); - tmp = json_tokener_parse(local_buffer->buffer); - json_object_object_add(payload, "info", tmp); - - buffer_flush(local_buffer); - - charts2json(host, local_buffer, 1, 0); - tmp = json_tokener_parse(local_buffer->buffer); - json_object_object_add(payload, "charts", tmp); - - aclk_send_message_subtopic(client, msg, ACLK_TOPICID_METADATA); - - json_object_put(msg); - freez(msg_id); - buffer_free(local_buffer); -} - -// TODO should include header instead -void health_active_log_alarms_2json(RRDHOST *host, BUFFER *wb); - -void aclk_send_alarm_metadata(mqtt_wss_client client, int metadata_submitted) -{ - BUFFER *local_buffer = buffer_create(BUFFER_INITIAL_SIZE); - json_object *msg, *payload, *tmp; - - char *msg_id = create_uuid(); - buffer_flush(local_buffer); - local_buffer->contenttype = CT_APPLICATION_JSON; - - // on_connect messages are sent on a health reload, if the on_connect message is real then we - // use the session time as the fake timestamp to indicate that it starts the session. If it is - // a fake on_connect message then use the real timestamp to indicate it is within the existing - // session. - - if (metadata_submitted) - msg = create_hdr("connect_alarms", msg_id, 0, 0, ACLK_VERSION); - else - msg = create_hdr("connect_alarms", msg_id, aclk_session_sec, aclk_session_us, ACLK_VERSION); - - payload = json_object_new_object(); - json_object_object_add(msg, "payload", payload); - - health_alarms2json(localhost, local_buffer, 1); - tmp = json_tokener_parse(local_buffer->buffer); - json_object_object_add(payload, "configured-alarms", tmp); - - buffer_flush(local_buffer); - - health_active_log_alarms_2json(localhost, local_buffer); - tmp = json_tokener_parse(local_buffer->buffer); - json_object_object_add(payload, "alarms-active", tmp); - - aclk_send_message_subtopic(client, msg, ACLK_TOPICID_ALARMS); - - json_object_put(msg); - freez(msg_id); - buffer_free(local_buffer); -} - void aclk_http_msg_v2_err(mqtt_wss_client client, const char *topic, const char *msg_id, int http_code, int ec, const char* emsg, const char *payload, size_t payload_len) { json_object *tmp, *msg; @@ -384,80 +237,6 @@ void aclk_http_msg_v2(mqtt_wss_client client, const char *topic, const char *msg } } -void aclk_chart_msg(mqtt_wss_client client, RRDHOST *host, const char *chart) -{ - json_object *msg, *payload; - BUFFER *tmp_buffer; - RRDSET *st; - - st = rrdset_find(host, chart); - if (!st) - st = rrdset_find_byname(host, chart); - if (!st) { - info("FAILED to find chart %s", chart); - return; - } - - tmp_buffer = buffer_create(BUFFER_INITIAL_SIZE); - rrdset2json(st, tmp_buffer, NULL, NULL, 1); - payload = json_tokener_parse(tmp_buffer->buffer); - if (!payload) { - error("Failed to parse JSON from rrdset2json"); - buffer_free(tmp_buffer); - return; - } - - msg = create_hdr("chart", NULL, 0, 0, ACLK_VERSION); - json_object_object_add(msg, "payload", payload); - - aclk_send_message_subtopic(client, msg, ACLK_TOPICID_CHART); - - buffer_free(tmp_buffer); - json_object_put(msg); -} - -void aclk_alarm_state_msg(mqtt_wss_client client, json_object *msg) -{ - // we create header here on purpose (and not send message with it already as `msg` param) - // timestamps etc. which in ACLK legacy would be wrong (because ACLK legacy - // send message with timestamps already to Query Queue they would be incorrect at time - // when query queue would get to send them) - json_object *obj = create_hdr("status-change", NULL, 0, 0, ACLK_VERSION); - json_object_object_add(obj, "payload", msg); - - aclk_send_message_subtopic(client, obj, ACLK_TOPICID_ALARMS); - json_object_put(obj); -} - -/* - * Will generate disconnect message. - * @param message if NULL it will generate LWT message (unexpected). - * Otherwise string pointed to by this parameter will be used as - * reason. - */ -json_object *aclk_generate_disconnect(const char *message) -{ - json_object *tmp, *msg; - - msg = create_hdr("disconnect", NULL, 0, 0, 2); - - tmp = json_object_new_string(message ? message : "unexpected"); - json_object_object_add(msg, "payload", tmp); - - return msg; -} - -int aclk_send_app_layer_disconnect(mqtt_wss_client client, const char *message) -{ - int pid; - json_object *msg = aclk_generate_disconnect(message); - pid = aclk_send_message_subtopic_pid(client, msg, ACLK_TOPICID_METADATA); - json_object_put(msg); - return pid; -} - -#ifdef ENABLE_NEW_CLOUD_PROTOCOL -// new protobuf msgs uint16_t aclk_send_agent_connection_update(mqtt_wss_client client, int reachable) { size_t len; uint16_t pid; @@ -469,6 +248,7 @@ uint16_t aclk_send_agent_connection_update(mqtt_wss_client client, int reachable { .name = "ml", .version = 1, .enabled = ml_enabled(localhost) }, #endif { .name = "mc", .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations }, + { .name = "ctx", .version = 1, .enabled = rrdcontext_enabled }, { .name = NULL, .version = 0, .enabled = 0 } }; @@ -532,7 +312,6 @@ char *aclk_generate_lwt(size_t *size) { return msg; } -#endif /* ENABLE_NEW_CLOUD_PROTOCOL */ #ifndef __GNUC__ #pragma endregion diff --git a/aclk/aclk_tx_msgs.h b/aclk/aclk_tx_msgs.h index 44281eb68..31e592410 100644 --- a/aclk/aclk_tx_msgs.h +++ b/aclk/aclk_tx_msgs.h @@ -11,23 +11,10 @@ uint16_t aclk_send_bin_message_subtopic_pid(mqtt_wss_client client, char *msg, size_t msg_len, enum aclk_topics subtopic, const char *msgname); -void aclk_send_info_metadata(mqtt_wss_client client, int metadata_submitted, RRDHOST *host); -void aclk_send_alarm_metadata(mqtt_wss_client client, int metadata_submitted); - void aclk_http_msg_v2_err(mqtt_wss_client client, const char *topic, const char *msg_id, int http_code, int ec, const char* emsg, const char *payload, size_t payload_len); void aclk_http_msg_v2(mqtt_wss_client client, const char *topic, const char *msg_id, usec_t t_exec, usec_t created, int http_code, const char *payload, size_t payload_len); -void aclk_chart_msg(mqtt_wss_client client, RRDHOST *host, const char *chart); - -void aclk_alarm_state_msg(mqtt_wss_client client, json_object *msg); - -json_object *aclk_generate_disconnect(const char *message); -int aclk_send_app_layer_disconnect(mqtt_wss_client client, const char *message); - -#ifdef ENABLE_NEW_CLOUD_PROTOCOL -// new protobuf msgs uint16_t aclk_send_agent_connection_update(mqtt_wss_client client, int reachable); char *aclk_generate_lwt(size_t *size); -#endif #endif diff --git a/aclk/aclk_util.c b/aclk/aclk_util.c index 430925460..ec021aec5 100644 --- a/aclk/aclk_util.c +++ b/aclk/aclk_util.c @@ -4,7 +4,6 @@ #include "daemon/common.h" -int aclk_use_new_cloud_arch = 0; usec_t aclk_session_newarch = 0; aclk_env_t *aclk_env = NULL; @@ -124,22 +123,17 @@ struct topic_name { { .id = ACLK_TOPICID_ALARM_HEALTH, .name = "alarm-health" }, { .id = ACLK_TOPICID_ALARM_CONFIG, .name = "alarm-config" }, { .id = ACLK_TOPICID_ALARM_SNAPSHOT, .name = "alarm-snapshot" }, + { .id = ACLK_TOPICID_NODE_COLLECTORS, .name = "node-instance-collectors" }, + { .id = ACLK_TOPICID_CTXS_SNAPSHOT, .name = "contexts-snapshot" }, + { .id = ACLK_TOPICID_CTXS_UPDATED, .name = "contexts-updated" }, { .id = ACLK_TOPICID_UNKNOWN, .name = NULL } }; -enum aclk_topics compulsory_topics_legacy[] = { - ACLK_TOPICID_CHART, - ACLK_TOPICID_ALARMS, - ACLK_TOPICID_METADATA, - ACLK_TOPICID_COMMAND, - ACLK_TOPICID_UNKNOWN -}; - -enum aclk_topics compulsory_topics_new_cloud_arch[] = { +enum aclk_topics compulsory_topics[] = { // TODO remove old topics once not needed anymore - ACLK_TOPICID_CHART, - ACLK_TOPICID_ALARMS, - ACLK_TOPICID_METADATA, + ACLK_TOPICID_CHART, //TODO from legacy + ACLK_TOPICID_ALARMS, //TODO from legacy + ACLK_TOPICID_METADATA, //TODO from legacy ACLK_TOPICID_COMMAND, ACLK_TOPICID_AGENT_CONN, ACLK_TOPICID_CMD_NG_V1, @@ -154,6 +148,9 @@ enum aclk_topics compulsory_topics_new_cloud_arch[] = { ACLK_TOPICID_ALARM_HEALTH, ACLK_TOPICID_ALARM_CONFIG, ACLK_TOPICID_ALARM_SNAPSHOT, + ACLK_TOPICID_NODE_COLLECTORS, + ACLK_TOPICID_CTXS_SNAPSHOT, + ACLK_TOPICID_CTXS_UPDATED, ACLK_TOPICID_UNKNOWN }; @@ -279,8 +276,6 @@ int aclk_generate_topic_cache(struct json_object *json) } } - enum aclk_topics *compulsory_topics = aclk_use_new_cloud_arch ? compulsory_topics_new_cloud_arch : compulsory_topics_legacy; - for (int i = 0; compulsory_topics[i] != ACLK_TOPICID_UNKNOWN; i++) { if (!aclk_get_topic(compulsory_topics[i])) { error("missing compulsory topic \"%s\" in password response from cloud", topic_id_to_name(compulsory_topics[i])); diff --git a/aclk/aclk_util.h b/aclk/aclk_util.h index fb0492ac8..ed715e046 100644 --- a/aclk/aclk_util.h +++ b/aclk/aclk_util.h @@ -20,7 +20,6 @@ // Helper stuff which should not have any further inside ACLK dependency // and are supposed not to be needed outside of ACLK -extern int aclk_use_new_cloud_arch; extern usec_t aclk_session_newarch; extern int chart_batch_id; @@ -88,7 +87,10 @@ enum aclk_topics { ACLK_TOPICID_ALARM_LOG = 14, ACLK_TOPICID_ALARM_HEALTH = 15, ACLK_TOPICID_ALARM_CONFIG = 16, - ACLK_TOPICID_ALARM_SNAPSHOT = 17 + ACLK_TOPICID_ALARM_SNAPSHOT = 17, + ACLK_TOPICID_NODE_COLLECTORS = 18, + ACLK_TOPICID_CTXS_SNAPSHOT = 19, + ACLK_TOPICID_CTXS_UPDATED = 20 }; const char *aclk_get_topic(enum aclk_topics topic); diff --git a/aclk/schema-wrappers/alarm_stream.cc b/aclk/schema-wrappers/alarm_stream.cc index 338e512d8..f64393300 100644 --- a/aclk/schema-wrappers/alarm_stream.cc +++ b/aclk/schema-wrappers/alarm_stream.cc @@ -118,6 +118,7 @@ void destroy_alarm_log_entry(struct alarm_log_entry *entry) freez(entry->old_value_string); freez(entry->rendered_info); + freez(entry->chart_context); } static void fill_alarm_log_entry(struct alarm_log_entry *data, AlarmLogEntry *proto) @@ -166,6 +167,8 @@ static void fill_alarm_log_entry(struct alarm_log_entry *data, AlarmLogEntry *pr proto->set_updated(data->updated); proto->set_rendered_info(data->rendered_info); + + proto->set_chart_context(data->chart_context); } char *generate_alarm_log_entry(size_t *len, struct alarm_log_entry *data) diff --git a/aclk/schema-wrappers/alarm_stream.h b/aclk/schema-wrappers/alarm_stream.h index 2932bb192..63911da3f 100644 --- a/aclk/schema-wrappers/alarm_stream.h +++ b/aclk/schema-wrappers/alarm_stream.h @@ -97,6 +97,8 @@ struct alarm_log_entry { // rendered_info char *rendered_info; + + char *chart_context; }; struct send_alarm_snapshot { diff --git a/aclk/schema-wrappers/chart_stream.cc b/aclk/schema-wrappers/chart_stream.cc index 7d820e533..54c940758 100644 --- a/aclk/schema-wrappers/chart_stream.cc +++ b/aclk/schema-wrappers/chart_stream.cc @@ -76,7 +76,7 @@ void chart_instance_updated_destroy(struct chart_instance_updated *instance) freez((char*)instance->id); freez((char*)instance->claim_id); - free_label_list(instance->label_head); + rrdlabels_destroy(instance->chart_labels); freez((char*)instance->config_hash); } @@ -85,7 +85,6 @@ static int set_chart_instance_updated(chart::v1::ChartInstanceUpdated *chart, co { google::protobuf::Map *map; aclk_lib::v1::ACLKMessagePosition *pos; - struct label *label; chart->set_id(update->id); chart->set_claim_id(update->claim_id); @@ -93,11 +92,7 @@ static int set_chart_instance_updated(chart::v1::ChartInstanceUpdated *chart, co chart->set_name(update->name); map = chart->mutable_chart_labels(); - label = update->label_head; - while (label) { - map->insert({label->key, label->value}); - label = label->next; - } + rrdlabels_walkthrough_read(update->chart_labels, label_add_to_map_callback, map); switch (update->memory_mode) { case RRD_MEMORY_MODE_NONE: diff --git a/aclk/schema-wrappers/chart_stream.h b/aclk/schema-wrappers/chart_stream.h index 7a46ecd8e..904866868 100644 --- a/aclk/schema-wrappers/chart_stream.h +++ b/aclk/schema-wrappers/chart_stream.h @@ -57,7 +57,7 @@ struct chart_instance_updated { const char *node_id; const char *name; - struct label *label_head; + DICTIONARY *chart_labels; RRD_MEMORY_MODE memory_mode; diff --git a/aclk/schema-wrappers/context.cc b/aclk/schema-wrappers/context.cc new file mode 100644 index 000000000..b04c9d20c --- /dev/null +++ b/aclk/schema-wrappers/context.cc @@ -0,0 +1,125 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "proto/context/v1/context.pb.h" + +#include "libnetdata/libnetdata.h" + +#include "schema_wrapper_utils.h" + +#include "context.h" + +using namespace context::v1; + +// ContextsSnapshot +contexts_snapshot_t contexts_snapshot_new(const char *claim_id, const char *node_id, uint64_t version) +{ + ContextsSnapshot *ctxs_snap = new ContextsSnapshot; + + if (ctxs_snap == NULL) + fatal("Cannot allocate ContextsSnapshot object. OOM"); + + ctxs_snap->set_claim_id(claim_id); + ctxs_snap->set_node_id(node_id); + ctxs_snap->set_version(version); + + return ctxs_snap; +} + +void contexts_snapshot_delete(contexts_snapshot_t snapshot) +{ + delete (ContextsSnapshot *)snapshot; +} + +void contexts_snapshot_set_version(contexts_snapshot_t ctxs_snapshot, uint64_t version) +{ + ((ContextsSnapshot *)ctxs_snapshot)->set_version(version); +} + +static void fill_ctx_updated(ContextUpdated *ctx, struct context_updated *c_ctx) +{ + ctx->set_id(c_ctx->id); + ctx->set_version(c_ctx->version); + ctx->set_first_entry(c_ctx->first_entry); + ctx->set_last_entry(c_ctx->last_entry); + ctx->set_deleted(c_ctx->deleted); + ctx->set_title(c_ctx->title); + ctx->set_priority(c_ctx->priority); + ctx->set_chart_type(c_ctx->chart_type); + ctx->set_units(c_ctx->units); + ctx->set_family(c_ctx->family); +} + +void contexts_snapshot_add_ctx_update(contexts_snapshot_t ctxs_snapshot, struct context_updated *ctx_update) +{ + ContextsSnapshot *ctxs_snap = (ContextsSnapshot *)ctxs_snapshot; + ContextUpdated *ctx = ctxs_snap->add_contexts(); + + fill_ctx_updated(ctx, ctx_update); +} + +char *contexts_snapshot_2bin(contexts_snapshot_t ctxs_snapshot, size_t *len) +{ + ContextsSnapshot *ctxs_snap = (ContextsSnapshot *)ctxs_snapshot; + *len = PROTO_COMPAT_MSG_SIZE_PTR(ctxs_snap); + char *bin = (char*)mallocz(*len); + if (!ctxs_snap->SerializeToArray(bin, *len)) { + freez(bin); + delete ctxs_snap; + return NULL; + } + + delete ctxs_snap; + return bin; +} + +// ContextsUpdated +contexts_updated_t contexts_updated_new(const char *claim_id, const char *node_id, uint64_t version_hash, uint64_t created_at) +{ + ContextsUpdated *ctxs_updated = new ContextsUpdated; + + if (ctxs_updated == NULL) + fatal("Cannot allocate ContextsUpdated object. OOM"); + + ctxs_updated->set_claim_id(claim_id); + ctxs_updated->set_node_id(node_id); + ctxs_updated->set_version_hash(version_hash); + ctxs_updated->set_created_at(created_at); + + return ctxs_updated; +} + +void contexts_updated_delete(contexts_updated_t ctxs_updated) +{ + delete (ContextsUpdated *)ctxs_updated; +} + +void contexts_updated_update_version_hash(contexts_updated_t ctxs_updated, uint64_t version_hash) +{ + ((ContextsUpdated *)ctxs_updated)->set_version_hash(version_hash); +} + +void contexts_updated_add_ctx_update(contexts_updated_t ctxs_updated, struct context_updated *ctx_update) +{ + ContextsUpdated *ctxs_update = (ContextsUpdated *)ctxs_updated; + ContextUpdated *ctx = ctxs_update->add_contextupdates(); + + if (ctx == NULL) + fatal("Cannot allocate ContextUpdated object. OOM"); + + fill_ctx_updated(ctx, ctx_update); +} + +char *contexts_updated_2bin(contexts_updated_t ctxs_updated, size_t *len) +{ + ContextsUpdated *ctxs_update = (ContextsUpdated *)ctxs_updated; + *len = PROTO_COMPAT_MSG_SIZE_PTR(ctxs_update); + char *bin = (char*)mallocz(*len); + if (!ctxs_update->SerializeToArray(bin, *len)) { + freez(bin); + delete ctxs_update; + return NULL; + } + + delete ctxs_update; + return bin; +} diff --git a/aclk/schema-wrappers/context.h b/aclk/schema-wrappers/context.h new file mode 100644 index 000000000..cbb7701a8 --- /dev/null +++ b/aclk/schema-wrappers/context.h @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef ACLK_SCHEMA_WRAPPER_CONTEXT_H +#define ACLK_SCHEMA_WRAPPER_CONTEXT_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* contexts_updated_t; +typedef void* contexts_snapshot_t; + +struct context_updated { + // context id + const char *id; + + uint64_t version; + + uint64_t first_entry; + uint64_t last_entry; + + int deleted; + + const char *title; + uint64_t priority; + const char *chart_type; + const char *units; + const char *family; +}; + +// ContextS Snapshot related +contexts_snapshot_t contexts_snapshot_new(const char *claim_id, const char *node_id, uint64_t version); +void contexts_snapshot_delete(contexts_snapshot_t ctxs_snapshot); +void contexts_snapshot_set_version(contexts_snapshot_t ctxs_snapshot, uint64_t version); +void contexts_snapshot_add_ctx_update(contexts_snapshot_t ctxs_snapshot, struct context_updated *ctx_update); +char *contexts_snapshot_2bin(contexts_snapshot_t ctxs_snapshot, size_t *len); + +// ContextS Updated related +contexts_updated_t contexts_updated_new(const char *claim_id, const char *node_id, uint64_t version_hash, uint64_t created_at); +void contexts_updated_delete(contexts_updated_t ctxs_updated); +void contexts_updated_update_version_hash(contexts_updated_t ctxs_updated, uint64_t version_hash); +void contexts_updated_add_ctx_update(contexts_updated_t ctxs_updated, struct context_updated *ctx_update); +char *contexts_updated_2bin(contexts_updated_t ctxs_updated, size_t *len); + + +#ifdef __cplusplus +} +#endif + +#endif /* ACLK_SCHEMA_WRAPPER_CONTEXT_H */ diff --git a/aclk/schema-wrappers/context_stream.cc b/aclk/schema-wrappers/context_stream.cc new file mode 100644 index 000000000..3bb1956cb --- /dev/null +++ b/aclk/schema-wrappers/context_stream.cc @@ -0,0 +1,42 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "proto/context/v1/stream.pb.h" + +#include "context_stream.h" + +#include "libnetdata/libnetdata.h" + +struct stop_streaming_ctxs *parse_stop_streaming_ctxs(const char *data, size_t len) +{ + context::v1::StopStreamingContexts msg; + + struct stop_streaming_ctxs *res; + + if (!msg.ParseFromArray(data, len)) + return NULL; + + res = (struct stop_streaming_ctxs *)callocz(1, sizeof(struct stop_streaming_ctxs)); + + res->claim_id = strdupz(msg.claim_id().c_str()); + res->node_id = strdupz(msg.node_id().c_str()); + + return res; +} + +struct ctxs_checkpoint *parse_ctxs_checkpoint(const char *data, size_t len) +{ + context::v1::ContextsCheckpoint msg; + + struct ctxs_checkpoint *res; + + if (!msg.ParseFromArray(data, len)) + return NULL; + + res = (struct ctxs_checkpoint *)callocz(1, sizeof(struct ctxs_checkpoint)); + + res->claim_id = strdupz(msg.claim_id().c_str()); + res->node_id = strdupz(msg.node_id().c_str()); + res->version_hash = msg.version_hash(); + + return res; +} diff --git a/aclk/schema-wrappers/context_stream.h b/aclk/schema-wrappers/context_stream.h new file mode 100644 index 000000000..8c691d2cc --- /dev/null +++ b/aclk/schema-wrappers/context_stream.h @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef ACLK_SCHEMA_WRAPPER_CONTEXT_STREAM_H +#define ACLK_SCHEMA_WRAPPER_CONTEXT_STREAM_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct stop_streaming_ctxs { + char *claim_id; + char *node_id; + // we omit reason as there is only one defined at this point + // as soon as there is more than one defined in StopStreaminContextsReason + // we should add it + // 0 - RATE_LIMIT_EXCEEDED +}; + +struct stop_streaming_ctxs *parse_stop_streaming_ctxs(const char *data, size_t len); + +struct ctxs_checkpoint { + char *claim_id; + char *node_id; + + uint64_t version_hash; +}; + +struct ctxs_checkpoint *parse_ctxs_checkpoint(const char *data, size_t len); + + + +#ifdef __cplusplus +} +#endif + +#endif /* ACLK_SCHEMA_WRAPPER_CONTEXT_STREAM_H */ diff --git a/aclk/schema-wrappers/node_connection.cc b/aclk/schema-wrappers/node_connection.cc index 0a4c8ece1..a6ca8ef98 100644 --- a/aclk/schema-wrappers/node_connection.cc +++ b/aclk/schema-wrappers/node_connection.cc @@ -28,6 +28,15 @@ char *generate_node_instance_connection(size_t *len, const node_instance_connect timestamp->set_seconds(tv.tv_sec); timestamp->set_nanos(tv.tv_usec * 1000); + if (data->capabilities) { + struct capability *capa = data->capabilities; + while (capa->name) { + aclk_lib::v1::Capability *proto_capa = msg.add_capabilities(); + capability_set(proto_capa, capa); + capa++; + } + } + *len = PROTO_COMPAT_MSG_SIZE(msg); char *bin = (char*)malloc(*len); if (bin) diff --git a/aclk/schema-wrappers/node_connection.h b/aclk/schema-wrappers/node_connection.h index 3fd207213..c27729d15 100644 --- a/aclk/schema-wrappers/node_connection.h +++ b/aclk/schema-wrappers/node_connection.h @@ -3,6 +3,8 @@ #ifndef ACLK_SCHEMA_WRAPPER_NODE_CONNECTION_H #define ACLK_SCHEMA_WRAPPER_NODE_CONNECTION_H +#include "capability.h" + #ifdef __cplusplus extern "C" { #endif @@ -17,6 +19,7 @@ typedef struct { int64_t session_id; int32_t hops; + struct capability *capabilities; } node_instance_connection_t; char *generate_node_instance_connection(size_t *len, const node_instance_connection_t *data); diff --git a/aclk/schema-wrappers/node_info.cc b/aclk/schema-wrappers/node_info.cc index f66985246..2a05ddaba 100644 --- a/aclk/schema-wrappers/node_info.cc +++ b/aclk/schema-wrappers/node_info.cc @@ -6,7 +6,6 @@ static int generate_node_info(nodeinstance::info::v1::NodeInfo *info, struct aclk_node_info *data) { - struct label *label; google::protobuf::Map *map; if (data->name) @@ -56,9 +55,6 @@ static int generate_node_info(nodeinstance::info::v1::NodeInfo *info, struct acl if (data->custom_info) info->set_custom_info(data->custom_info); - for (size_t i = 0; i < data->service_count; i++) - info->add_services(data->services[i]); - if (data->machine_guid) info->set_machine_guid(data->machine_guid); @@ -67,12 +63,7 @@ static int generate_node_info(nodeinstance::info::v1::NodeInfo *info, struct acl ml_info->set_ml_enabled(data->ml_info.ml_enabled); map = info->mutable_host_labels(); - label = data->host_labels_head; - while (label) { - map->insert({label->key, label->value}); - label = label->next; - } - + rrdlabels_walkthrough_read(data->host_labels_ptr, label_add_to_map_callback, map); return 0; } @@ -119,3 +110,27 @@ char *generate_update_node_info_message(size_t *len, struct update_node_info *in return bin; } + +char *generate_update_node_collectors_message(size_t *len, struct update_node_collectors *upd_node_collectors) +{ + nodeinstance::info::v1::UpdateNodeCollectors msg; + + msg.set_node_id(upd_node_collectors->node_id); + msg.set_claim_id(upd_node_collectors->claim_id); + + void *colls; + dfe_start_read(upd_node_collectors->node_collectors, colls) { + struct collector_info *c =(struct collector_info *)colls; + nodeinstance::info::v1::CollectorInfo *col = msg.add_collectors(); + col->set_plugin(c->plugin); + col->set_module(c->module); + } + dfe_done(colls); + + *len = PROTO_COMPAT_MSG_SIZE(msg); + char *bin = (char*)malloc(*len); + if (bin) + msg.SerializeToArray(bin, *len); + + return bin; +} diff --git a/aclk/schema-wrappers/node_info.h b/aclk/schema-wrappers/node_info.h index e67f3e1da..e8ac2d7c6 100644 --- a/aclk/schema-wrappers/node_info.h +++ b/aclk/schema-wrappers/node_info.h @@ -4,9 +4,10 @@ #define ACLK_SCHEMA_WRAPPER_NODE_INFO_H #include +#include -#include "database/rrd.h" #include "capability.h" +#include "database/rrd.h" #ifdef __cplusplus extern "C" { @@ -49,12 +50,9 @@ struct aclk_node_info { char *custom_info; - char **services; - size_t service_count; - char *machine_guid; - struct label *host_labels_head; + DICTIONARY *host_labels_ptr; struct machine_learning_info ml_info; }; @@ -73,8 +71,21 @@ struct update_node_info { struct capability *node_instance_capabilities; }; +struct collector_info { + char *module; + char *plugin; +}; + +struct update_node_collectors { + char *claim_id; + char *node_id; + DICTIONARY *node_collectors; +}; + char *generate_update_node_info_message(size_t *len, struct update_node_info *info); +char *generate_update_node_collectors_message(size_t *len, struct update_node_collectors *collectors); + #ifdef __cplusplus } #endif diff --git a/aclk/schema-wrappers/proto_2_json.cc b/aclk/schema-wrappers/proto_2_json.cc new file mode 100644 index 000000000..0e473eb6c --- /dev/null +++ b/aclk/schema-wrappers/proto_2_json.cc @@ -0,0 +1,101 @@ +#include +#include + +#include "proto/alarm/v1/config.pb.h" +#include "proto/alarm/v1/stream.pb.h" +#include "proto/aclk/v1/lib.pb.h" +#include "proto/chart/v1/config.pb.h" +#include "proto/chart/v1/stream.pb.h" +#include "proto/agent/v1/connection.pb.h" +#include "proto/agent/v1/disconnect.pb.h" +#include "proto/nodeinstance/connection/v1/connection.pb.h" +#include "proto/nodeinstance/create/v1/creation.pb.h" +#include "proto/nodeinstance/info/v1/info.pb.h" +#include "proto/context/v1/stream.pb.h" +#include "proto/context/v1/context.pb.h" + +#include "libnetdata/libnetdata.h" + +#include "proto_2_json.h" + +using namespace google::protobuf::util; + +static google::protobuf::Message *msg_name_to_protomsg(const char *msgname) +{ +//tx side + if (!strcmp(msgname, "UpdateAgentConnection")) + return new agent::v1::UpdateAgentConnection; + if (!strcmp(msgname, "UpdateNodeInstanceConnection")) + return new nodeinstance::v1::UpdateNodeInstanceConnection; + if (!strcmp(msgname, "CreateNodeInstance")) + return new nodeinstance::create::v1::CreateNodeInstance; + if (!strcmp(msgname, "ChartsAndDimensionsUpdated")) + return new chart::v1::ChartsAndDimensionsUpdated; + if (!strcmp(msgname, "ChartConfigsUpdated")) + return new chart::v1::ChartConfigsUpdated; + if (!strcmp(msgname, "ResetChartMessages")) + return new chart::v1::ResetChartMessages; + if (!strcmp(msgname, "RetentionUpdated")) + return new chart::v1::RetentionUpdated; + if (!strcmp(msgname, "UpdateNodeInfo")) + return new nodeinstance::info::v1::UpdateNodeInfo; + if (!strcmp(msgname, "AlarmLogHealth")) + return new alarms::v1::AlarmLogHealth; + if (!strcmp(msgname, "ProvideAlarmConfiguration")) + return new alarms::v1::ProvideAlarmConfiguration; + if (!strcmp(msgname, "AlarmSnapshot")) + return new alarms::v1::AlarmSnapshot; + if (!strcmp(msgname, "AlarmLogEntry")) + return new alarms::v1::AlarmLogEntry; + if (!strcmp(msgname, "UpdateNodeCollectors")) + return new nodeinstance::info::v1::UpdateNodeCollectors; + if (!strcmp(msgname, "ContextsUpdated")) + return new context::v1::ContextsUpdated; + if (!strcmp(msgname, "ContextsSnapshot")) + return new context::v1::ContextsSnapshot; + +//rx side + if (!strcmp(msgname, "CreateNodeInstanceResult")) + return new nodeinstance::create::v1::CreateNodeInstanceResult; + if (!strcmp(msgname, "SendNodeInstances")) + return new agent::v1::SendNodeInstances; + if (!strcmp(msgname, "StreamChartsAndDimensions")) + return new chart::v1::StreamChartsAndDimensions; + if (!strcmp(msgname, "ChartsAndDimensionsAck")) + return new chart::v1::ChartsAndDimensionsAck; + if (!strcmp(msgname, "UpdateChartConfigs")) + return new chart::v1::UpdateChartConfigs; + if (!strcmp(msgname, "StartAlarmStreaming")) + return new alarms::v1::StartAlarmStreaming; + if (!strcmp(msgname, "SendAlarmLogHealth")) + return new alarms::v1::SendAlarmLogHealth; + if (!strcmp(msgname, "SendAlarmConfiguration")) + return new alarms::v1::SendAlarmConfiguration; + if (!strcmp(msgname, "SendAlarmSnapshot")) + return new alarms::v1::SendAlarmSnapshot; + if (!strcmp(msgname, "DisconnectReq")) + return new agent::v1::DisconnectReq; + if (!strcmp(msgname, "ContextsCheckpoint")) + return new context::v1::ContextsCheckpoint; + if (!strcmp(msgname, "StopStreamingContexts")) + return new context::v1::StopStreamingContexts; + + return NULL; +} + +char *protomsg_to_json(const void *protobin, size_t len, const char *msgname) +{ + google::protobuf::Message *msg = msg_name_to_protomsg(msgname); + if (msg == NULL) + return strdupz("Don't know this message type by name."); + + if (!msg->ParseFromArray(protobin, len)) + return strdupz("Can't parse this message. Malformed or wrong parser used."); + + JsonPrintOptions options; + + std::string output; + google::protobuf::util::MessageToJsonString(*msg, &output, options); + delete msg; + return strdupz(output.c_str()); +} diff --git a/aclk/schema-wrappers/proto_2_json.h b/aclk/schema-wrappers/proto_2_json.h new file mode 100644 index 000000000..3bd98478c --- /dev/null +++ b/aclk/schema-wrappers/proto_2_json.h @@ -0,0 +1,18 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef PROTO_2_JSON_H +#define PROTO_2_JSON_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +char *protomsg_to_json(const void *protobin, size_t len, const char *msgname); + +#ifdef __cplusplus +} +#endif + +#endif /* PROTO_2_JSON_H */ diff --git a/aclk/schema-wrappers/schema_wrapper_utils.cc b/aclk/schema-wrappers/schema_wrapper_utils.cc index b100e20c3..6573e6299 100644 --- a/aclk/schema-wrappers/schema_wrapper_utils.cc +++ b/aclk/schema-wrappers/schema_wrapper_utils.cc @@ -13,3 +13,10 @@ void set_timeval_from_google_timestamp(const google::protobuf::Timestamp &ts, st tv->tv_sec = ts.seconds(); tv->tv_usec = ts.nanos()/1000; } + +int label_add_to_map_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) { + (void)ls; + auto map = (google::protobuf::Map *)data; + map->insert({name, value}); + return 1; +} diff --git a/aclk/schema-wrappers/schema_wrapper_utils.h b/aclk/schema-wrappers/schema_wrapper_utils.h index 494855f82..2815d0f20 100644 --- a/aclk/schema-wrappers/schema_wrapper_utils.h +++ b/aclk/schema-wrappers/schema_wrapper_utils.h @@ -3,8 +3,11 @@ #ifndef SCHEMA_WRAPPER_UTILS_H #define SCHEMA_WRAPPER_UTILS_H +#include "database/rrd.h" + #include #include +#include #if GOOGLE_PROTOBUF_VERSION < 3001000 #define PROTO_COMPAT_MSG_SIZE(msg) (size_t)msg.ByteSize(); @@ -16,5 +19,6 @@ void set_google_timestamp_from_timeval(struct timeval tv, google::protobuf::Timestamp *ts); void set_timeval_from_google_timestamp(const google::protobuf::Timestamp &ts, struct timeval *tv); +int label_add_to_map_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data); #endif /* SCHEMA_WRAPPER_UTILS_H */ diff --git a/aclk/schema-wrappers/schema_wrappers.h b/aclk/schema-wrappers/schema_wrappers.h index a3248a69b..26412cacc 100644 --- a/aclk/schema-wrappers/schema_wrappers.h +++ b/aclk/schema-wrappers/schema_wrappers.h @@ -14,5 +14,7 @@ #include "alarm_stream.h" #include "node_info.h" #include "capability.h" +#include "context_stream.h" +#include "context.h" #endif /* SCHEMA_WRAPPERS_H */ diff --git a/claim/claim.c b/claim/claim.c index f06679786..59c21aa35 100644 --- a/claim/claim.c +++ b/claim/claim.c @@ -31,7 +31,7 @@ static char *claiming_errors[] = { /* Retrieve the claim id for the agent. * Caller owns the string. */ -char *is_agent_claimed() +char *get_agent_claimid() { char *result; rrdhost_aclk_state_lock(localhost); diff --git a/claim/claim.h b/claim/claim.h index 171cc1fab..fc76037d3 100644 --- a/claim/claim.h +++ b/claim/claim.h @@ -9,7 +9,7 @@ extern char *claiming_pending_arguments; extern struct config cloud_config; void claim_agent(char *claiming_arguments); -char *is_agent_claimed(void); +char *get_agent_claimid(void); void load_claiming_state(void); void load_cloud_conf(int silent); diff --git a/cli/README.md b/cli/README.md index 75a90b08a..afd5651cb 100644 --- a/cli/README.md +++ b/cli/README.md @@ -20,7 +20,7 @@ reload-health reload-labels Reload all labels. save-database - Save internal DB to disk for memory mode save. + Save internal DB to disk for database mode save. reopen-logs Close and reopen log files. shutdown-agent diff --git a/collectors/COLLECTORS.md b/collectors/COLLECTORS.md index 02dfd50a1..1be50fd14 100644 --- a/collectors/COLLECTORS.md +++ b/collectors/COLLECTORS.md @@ -21,13 +21,19 @@ If you want to use a Python version of a collector, you need to explicitly [disa version](/docs/collect/enable-configure.md), and enable the Python version. Netdata then skips the Go version and attempts to load the Python version and its accompanying configuration file. -If you don't see the app/service you'd like to monitor in this list, check out our [GitHub -issues](https://github.com/netdata/netdata/issues). Use the search bar to look for previous discussions about that -collector—we may be looking for contributions from users such as yourself! If you don't see the collector there, make a -[feature request](https://community.netdata.cloud/c/feature-requests/7/none) on our community forums. +If you don't see the app/service you'd like to monitor in this list: -- [Supported collectors list](#supported-collectors-list) - - [Service and application collectors](#service-and-application-collectors) +- Check out our [GitHub issues](https://github.com/netdata/netdata/issues). Use the search bar to look for previous + discussions about that collector—we may be looking for assistance from users such as yourself! +- If you don't see the collector there, you can make + a [feature request](https://github.com/netdata/netdata/issues/new/choose) on GitHub. +- If you have basic software development skills, you can add your own plugin + in [Go](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin#how-to-develop-a-collector) + or [Python](https://learn.netdata.cloud/guides/python-collector) + +Supported Collectors List: + +- [Service and application collectors](#service-and-application-collectors) - [Generic](#generic) - [APM (application performance monitoring)](#apm-application-performance-monitoring) - [Containers and VMs](#containers-and-vms) @@ -43,7 +49,7 @@ collector—we may be looking for contributions from users such as yourself! If - [Search](#search) - [Storage](#storage) - [Web](#web) - - [System collectors](#system-collectors) +- [System collectors](#system-collectors) - [Applications](#applications) - [Disks and filesystems](#disks-and-filesystems) - [eBPF](#ebpf) @@ -54,10 +60,10 @@ collector—we may be looking for contributions from users such as yourself! If - [Processes](#processes) - [Resources](#resources) - [Users](#users) - - [Netdata collectors](#netdata-collectors) - - [Orchestrators](#orchestrators) - - [Third-party collectors](#third-party-collectors) - - [Etc](#etc) +- [Netdata collectors](#netdata-collectors) +- [Orchestrators](#orchestrators) +- [Third-party collectors](#third-party-collectors) +- [Etc](#etc) ## Service and application collectors @@ -125,7 +131,8 @@ configure any of these collectors according to your setup and infrastructure. - [OracleDB](/collectors/python.d.plugin/oracledb/README.md): Monitor database performance and health metrics. - [Pika](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/pika/): Gather metric, such as clients, memory usage, queries, and more from the Redis interface-compatible database. -- [Postgres](/collectors/python.d.plugin/postgres/README.md): Collect database health and performance metrics. +- [Postgres](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/postgres): Collect database health + and performance metrics. - [ProxySQL](/collectors/python.d.plugin/proxysql/README.md): Monitor database backend and frontend performance metrics. - [Redis](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/redis/): Monitor status from any @@ -168,9 +175,8 @@ configure any of these collectors according to your setup and infrastructure. plugins metrics from an endpoint provided by `in_monitor plugin`. - [Logstash](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/logstash/): Monitor JVM threads, memory usage, garbage collection statistics, and more. -- [OpenVPN status logs](/collectors/python.d.plugin/ovpn_status_log/README.md): Parse server log files and provide - summary - (client, traffic) metrics. +- [OpenVPN status logs](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/openvpn_status_log): Parse + server log files and provide summary (client, traffic) metrics. - [Squid web server logs](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/squidlog/): Tail Squid access logs to return the volume of requests, types of requests, bandwidth, and much more. - [Web server logs (Go version for Apache, @@ -199,8 +205,8 @@ configure any of these collectors according to your setup and infrastructure. - [Bind 9](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/bind/): Collect nameserver summary performance statistics via a web interface (`statistics-channels` feature). -- [Chrony](/collectors/python.d.plugin/chrony/README.md): Monitor the precision and statistics of a local `chronyd` - server. +- [Chrony](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/chrony): Monitor the precision and + statistics of a local `chronyd` server. - [CoreDNS](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/coredns/): Measure DNS query round trip time. - [Dnsmasq](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/dnsmasq_dhcp/): Automatically @@ -250,13 +256,14 @@ configure any of these collectors according to your setup and infrastructure. - [AM2320](/collectors/python.d.plugin/am2320/README.md): Monitor sensor temperature and humidity. - [Access point](/collectors/charts.d.plugin/ap/README.md): Monitor client, traffic and signal metrics using the `aw` - tool. + tool. - [APC UPS](/collectors/charts.d.plugin/apcupsd/README.md): Capture status information using the `apcaccess` tool. - [Energi Core](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/energid): Monitor - blockchain indexes, memory usage, network usage, and transactions of wallet instances. + blockchain indexes, memory usage, network usage, and transactions of wallet instances. - [UPS/PDU](/collectors/charts.d.plugin/nut/README.md): Read the status of UPS/PDU devices using the `upsc` tool. -- [SNMP devices](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/snmp): Gather data using the SNMP protocol. -- [1-Wire sensors](/collectors/python.d.plugin/w1sensor/README.md): Monitor sensor temperature. +- [SNMP devices](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/snmp): Gather data using the SNMP + protocol. +- [1-Wire sensors](/collectors/python.d.plugin/w1sensor/README.md): Monitor sensor temperature. ### Search @@ -481,9 +488,9 @@ Plugin orchestrators organize and run many of the above collectors. If you're interested in developing a new collector that you'd like to contribute to Netdata, we highly recommend using the `go.d.plugin`. -- [go.d.plugin](https://github.com/netdata/go.d.plugin): An orchestrator for data collection modules written in `go`. -- [python.d.plugin](python.d.plugin/README.md): An orchestrator for data collection modules written in `python` v2/v3. -- [charts.d.plugin](charts.d.plugin/README.md): An orchestrator for data collection modules written in `bash` v4+. +- [go.d.plugin](https://github.com/netdata/go.d.plugin): An orchestrator for data collection modules written in `go`. +- [python.d.plugin](python.d.plugin/README.md): An orchestrator for data collection modules written in `python` v2/v3. +- [charts.d.plugin](charts.d.plugin/README.md): An orchestrator for data collection modules written in `bash` v4+. ## Third-party collectors diff --git a/collectors/apps.plugin/apps_groups.conf b/collectors/apps.plugin/apps_groups.conf index 1d1af4b70..89db6c4e8 100644 --- a/collectors/apps.plugin/apps_groups.conf +++ b/collectors/apps.plugin/apps_groups.conf @@ -121,7 +121,7 @@ columndb: clickhouse-server* # ----------------------------------------------------------------------------- # email servers -email: dovecot imapd pop3d amavis* zmstat* zmmailboxdmgr saslauthd opendkim postfwd2 smtp* lmtp* sendmail postfix master pickup qmgr showq tlsmgr postscreen oqmgr +email: dovecot imapd pop3d amavis* zmstat-* zmdiaglog zmmailboxdmgr saslauthd opendkim postfwd2 smtp* lmtp* sendmail postfix master pickup qmgr showq tlsmgr postscreen oqmgr # ----------------------------------------------------------------------------- # network, routing, VPN @@ -227,7 +227,7 @@ dnsdist: dnsdist # installation / compilation / debugging build: cc1 cc1plus as gcc* cppcheck ld make cmake automake autoconf autoreconf -build: git gdb valgrind* +build: cargo rustc bazel buck git gdb valgrind* # ----------------------------------------------------------------------------- # antivirus diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c index 8a115d061..8521e078e 100644 --- a/collectors/apps.plugin/apps_plugin.c +++ b/collectors/apps.plugin/apps_plugin.c @@ -173,7 +173,8 @@ static kernel_uint_t global_gtime = 0; // the normalization ratios, as calculated by normalize_utilization() -double utime_fix_ratio = 1.0, +NETDATA_DOUBLE + utime_fix_ratio = 1.0, stime_fix_ratio = 1.0, gtime_fix_ratio = 1.0, minflt_fix_ratio = 1.0, @@ -501,7 +502,8 @@ struct file_descriptor { static int all_files_len = 0, all_files_size = 0; - long double currentmaxfds = 0; + +long currentmaxfds = 0; // ---------------------------------------------------------------------------- // read users and groups from files @@ -3021,7 +3023,7 @@ static inline void aggregate_pid_fds_on_targets(struct pid_stat *p) { reallocate_target_fds(u); reallocate_target_fds(g); - long double currentfds = 0; + long currentfds = 0; size_t c, size = p->fds_size; struct pid_fd *fds = p->fds; for(c = 0; c < size ;c++) { @@ -3373,7 +3375,7 @@ static void normalize_utilization(struct target *root) { gtime_fix_ratio = cutime_fix_ratio = cstime_fix_ratio = - cgtime_fix_ratio = 1.0; //(double)(global_utime + global_stime) / (double)(utime + cutime + stime + cstime); + cgtime_fix_ratio = 1.0; //(NETDATA_DOUBLE)(global_utime + global_stime) / (NETDATA_DOUBLE)(utime + cutime + stime + cstime); } else if((global_utime + global_stime > utime + stime) && (cutime || cstime)) { // children resources are too high @@ -3383,7 +3385,7 @@ static void normalize_utilization(struct target *root) { gtime_fix_ratio = 1.0; cutime_fix_ratio = cstime_fix_ratio = - cgtime_fix_ratio = (double)((global_utime + global_stime) - (utime + stime)) / (double)(cutime + cstime); + cgtime_fix_ratio = (NETDATA_DOUBLE)((global_utime + global_stime) - (utime + stime)) / (NETDATA_DOUBLE)(cutime + cstime); } else if(utime || stime) { // even running processes are unrealistic @@ -3391,7 +3393,7 @@ static void normalize_utilization(struct target *root) { // lower the running processes resources utime_fix_ratio = stime_fix_ratio = - gtime_fix_ratio = (double)(global_utime + global_stime) / (double)(utime + stime); + gtime_fix_ratio = (NETDATA_DOUBLE)(global_utime + global_stime) / (NETDATA_DOUBLE)(utime + stime); cutime_fix_ratio = cstime_fix_ratio = cgtime_fix_ratio = 0.0; @@ -3439,14 +3441,14 @@ static void normalize_utilization(struct target *root) { if(utime || stime || gtime) majflt_fix_ratio = - minflt_fix_ratio = (double)(utime * utime_fix_ratio + stime * stime_fix_ratio + gtime * gtime_fix_ratio) / (double)(utime + stime + gtime); + minflt_fix_ratio = (NETDATA_DOUBLE)(utime * utime_fix_ratio + stime * stime_fix_ratio + gtime * gtime_fix_ratio) / (NETDATA_DOUBLE)(utime + stime + gtime); else minflt_fix_ratio = majflt_fix_ratio = 1.0; if(cutime || cstime || cgtime) cmajflt_fix_ratio = - cminflt_fix_ratio = (double)(cutime * cutime_fix_ratio + cstime * cstime_fix_ratio + cgtime * cgtime_fix_ratio) / (double)(cutime + cstime + cgtime); + cminflt_fix_ratio = (NETDATA_DOUBLE)(cutime * cutime_fix_ratio + cstime * cstime_fix_ratio + cgtime * cgtime_fix_ratio) / (NETDATA_DOUBLE)(cutime + cstime + cgtime); else cminflt_fix_ratio = cmajflt_fix_ratio = 1.0; diff --git a/collectors/cgroups.plugin/cgroup-name.sh b/collectors/cgroups.plugin/cgroup-name.sh index 00d7e614c..d1277b745 100755 --- a/collectors/cgroups.plugin/cgroup-name.sh +++ b/collectors/cgroups.plugin/cgroup-name.sh @@ -45,11 +45,24 @@ fatal() { exit 1 } +function parse_docker_like_inspect_output() { + local output="${1}" + eval "$(grep -E "^(NOMAD_NAMESPACE|NOMAD_JOB_NAME|NOMAD_TASK_NAME|NOMAD_SHORT_ALLOC_ID|CONT_NAME)=" <<<"$output")" + if [ -n "$NOMAD_NAMESPACE" ] && [ -n "$NOMAD_JOB_NAME" ] && [ -n "$NOMAD_TASK_NAME" ] && [ -n "$NOMAD_SHORT_ALLOC_ID" ]; then + echo "${NOMAD_NAMESPACE}-${NOMAD_JOB_NAME}-${NOMAD_TASK_NAME}-${NOMAD_SHORT_ALLOC_ID}" + else + echo "${CONT_NAME}" | sed 's|^/||' + fi +} + function docker_like_get_name_command() { local command="${1}" local id="${2}" - info "Running command: ${command} ps --filter=id=\"${id}\" --format=\"{{.Names}}\"" - NAME="$(${command} ps --filter=id="${id}" --format="{{.Names}}")" + info "Running command: ${command} inspect --format='{{range .Config.Env}}{{println .}}{{end}}CONT_NAME={{ .Name}}' \"${id}\"" + if OUTPUT="$(${command} inspect --format='{{range .Config.Env}}{{println .}}{{end}}CONT_NAME={{ .Name}}' "${id}")" && + [ -n "$OUTPUT" ]; then + NAME="$(parse_docker_like_inspect_output "$OUTPUT")" + fi return 0 } @@ -61,7 +74,7 @@ function docker_like_get_name_api() { warning "No ${host_var} is set" return 1 fi - if ! command -v jq > /dev/null 2>&1; then + if ! command -v jq >/dev/null 2>&1; then warning "Can't find jq command line tool. jq is required for netdata to retrieve container name using ${host} API, falling back to docker ps" return 1 fi @@ -72,7 +85,9 @@ function docker_like_get_name_api() { info "Running API command: curl \"${host}${path}\"" JSON=$(curl -sS "${host}${path}") fi - NAME=$(echo "${JSON}" | jq -r .Name,.Config.Hostname | grep -v null | head -n1 | sed 's|^/||') + if OUTPUT=$(echo "${JSON}" | jq -r '.Config.Env[],"CONT_NAME=\(.Name)"') && [ -n "$OUTPUT" ]; then + NAME="$(parse_docker_like_inspect_output "$OUTPUT")" + fi return 0 } @@ -185,6 +200,13 @@ function k8s_get_kubepod_name() { # | | |-- kubepods-besteffort-pod10fb5647_c724_400c_b9cc_0e6eae3110e7.slice # | | | |-- docker-36e5eb5056dfdf6dbb75c0c44a1ecf23217fe2c50d606209d8130fcbb19fb5a7.scope # + # kind v0.14.0 + # |-- kubelet.slice + # | |-- kubelet-kubepods.slice + # | | |-- kubelet-kubepods-besteffort.slice + # | | | |-- kubelet-kubepods-besteffort-pod7881ed9e_c63e_4425_b5e0_ac55a08ae939.slice + # | | | | |-- cri-containerd-00c7939458bffc416bb03451526e9fde13301d6654cfeadf5b4964a7fb5be1a9.scope + # # NOTE: cgroups plugin # - uses '_' to join dir names (so it is ___...) # - replaces '.' with '-' @@ -193,7 +215,7 @@ function k8s_get_kubepod_name() { local cgroup_path="${1}" local id="${2}" - if [[ ! $id =~ ^kubepods ]]; then + if [[ ! $id =~ ^.*kubepods.* ]]; then warning "${fn}: '${id}' is not kubepod cgroup." return 1 fi @@ -371,7 +393,7 @@ function k8s_get_kubepod_name() { name+="_$(get_lbl_val "$labels" pod_name)" labels=$(add_lbl_prefix "$labels" "k8s_") name+=" $labels" - else + else return 2 fi fi @@ -393,7 +415,7 @@ function k8s_get_name() { local id="${2}" NAME=$(k8s_get_kubepod_name "$cgroup_path" "$id") - + case "$?" in 0) NAME="k8s_${NAME}" @@ -511,6 +533,11 @@ if [ -z "${NAME}" ]; then #shellcheck disable=SC1117 DOCKERID="$(echo "${CGROUP}" | sed "s|^.*ecs[-_/].*[-_/]\([a-fA-F0-9]\+\)[-_\.]\?.*$|\1|")" docker_validate_id "${DOCKERID}" + elif [[ ${CGROUP} =~ system.slice_containerd.service_cpuset_[a-fA-F0-9]+[-_\.]?.*$ ]]; then + # docker containers under containerd + #shellcheck disable=SC1117 + DOCKERID="$(echo "${CGROUP}" | sed "s|^.*ystem.slice_containerd.service_cpuset_\([a-fA-F0-9]\+\)[-_\.]\?.*$|\1|")" + docker_validate_id "${DOCKERID}" elif [[ ${CGROUP} =~ ^.*libpod-[a-fA-F0-9]+.*$ ]]; then # Podman PODMANID="$(echo "${CGROUP}" | sed "s|^.*libpod-\([a-fA-F0-9]\+\).*$|\1|")" @@ -522,16 +549,13 @@ if [ -z "${NAME}" ]; then elif [[ ${CGROUP} =~ machine.slice_machine.*-lxc ]]; then # libvirtd / lxc containers - # examples: - # before: machine.slice machine-lxc/x2d969/x2dhubud0xians01.scope - # after: lxc/hubud0xians01 - # before: machine.slice_machine-lxc/x2d969/x2dhubud0xians01.scope/libvirt_init.scope - # after: lxc/hubud0xians01/libvirt_init - NAME="lxc/$(echo "${CGROUP}" | sed 's/machine.slice_machine.*-lxc//; s/\/x2d[[:digit:]]*//; s/\/x2d//g; s/\.scope//g')" + # machine.slice machine-lxc/x2d969/x2dhubud0xians01.scope => lxc/hubud0xians01 + # machine.slice_machine-lxc/x2d969/x2dhubud0xians01.scope/libvirt_init.scope => lxc/hubud0xians01/libvirt_init + NAME="lxc/$(echo "${CGROUP}" | sed 's/machine.slice_machine.*-lxc//; s/[\/_]x2d[[:digit:]]*//; s/[\/_]x2d//g; s/\.scope//g')" elif [[ ${CGROUP} =~ machine.slice_machine.*-qemu ]]; then # libvirtd / qemu virtual machines - # NAME="$(echo ${CGROUP} | sed 's/machine.slice_machine.*-qemu//; s/\/x2d//; s/\/x2d/\-/g; s/\.scope//g')" - NAME="qemu_$(echo "${CGROUP}" | sed 's/machine.slice_machine.*-qemu//; s/\/x2d[[:digit:]]*//; s/\/x2d//g; s/\.scope//g')" + # machine.slice_machine-qemu_x2d1_x2dopnsense.scope => qemu_opnsense + NAME="qemu_$(echo "${CGROUP}" | sed 's/machine.slice_machine.*-qemu//; s/[\/_]x2d[[:digit:]]*//; s/[\/_]x2d//g; s/\.scope//g')" elif [[ ${CGROUP} =~ machine_.*\.libvirt-qemu ]]; then # libvirtd / qemu virtual machines diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.c b/collectors/cgroups.plugin/sys_fs_cgroup.c index 5676ef8ca..330562173 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.c +++ b/collectors/cgroups.plugin/sys_fs_cgroup.c @@ -6,6 +6,12 @@ #define PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME "systemd" #define PLUGIN_CGROUPS_MODULE_CGROUPS_NAME "/sys/fs/cgroup" +#ifdef NETDATA_INTERNAL_CHECKS +#define CGROUP_PROCFILE_FLAG PROCFILE_FLAG_DEFAULT +#else +#define CGROUP_PROCFILE_FLAG PROCFILE_FLAG_NO_ERROR_ON_FILE_IO +#endif + // main cgroups thread worker jobs #define WORKER_CGROUPS_LOCK 0 #define WORKER_CGROUPS_READ 1 @@ -446,12 +452,17 @@ void read_cgroup_plugin_configuration() { // ---------------------------------------------------------------- " /machine.slice/*.service " // #3367 systemd-nspawn - " /kubepods/pod*/* " // k8s containers - " /kubepods/*/pod*/* " // k8s containers // ---------------------------------------------------------------- - " !/kubepods* " // all other k8s cgroups + " */kubepods/pod*/* " // k8s containers + " */kubepods/*/pod*/* " // k8s containers + " */*-kubepods-pod*/* " // k8s containers + " */*-kubepods-*-pod*/* " // k8s containers + " !*kubepods* !*kubelet* " // all other k8s cgroups + + // ---------------------------------------------------------------- + " !*/vcpu* " // libvirtd adds these sub-cgroups " !*/emulator " // libvirtd adds these sub-cgroups " !*.mount " @@ -523,9 +534,11 @@ void read_cgroup_plugin_configuration() { " *docker* " " *lxc* " " *qemu* " - " /kubepods/pod*/* " // k8s containers - " /kubepods/*/pod*/* " // k8s containers - " !/kubepods* " // all other k8s cgroups + " */kubepods/pod*/* " // k8s containers + " */kubepods/*/pod*/* " // k8s containers + " */*-kubepods-pod*/* " // k8s containers + " */*-kubepods-*-pod*/* " // k8s containers + " !*kubepods* !*kubelet* " // all other k8s cgroups " *.libvirt-qemu " // #3010 " * " ), NULL, SIMPLE_PATTERN_EXACT); @@ -755,6 +768,12 @@ struct cgroup_network_interface { struct cgroup_network_interface *next; }; +enum cgroups_container_orchestrator { + CGROUPS_ORCHESTRATOR_UNSET, + CGROUPS_ORCHESTRATOR_UNKNOWN, + CGROUPS_ORCHESTRATOR_K8S +}; + // *** WARNING *** The fields are not thread safe. Take care of safe usage. struct cgroup { uint32_t options; @@ -776,7 +795,9 @@ struct cgroup { char *chart_title; - struct label *chart_labels; + DICTIONARY *chart_labels; + + int container_orchestrator; struct cpuacct_stat cpuacct_stat; struct cpuacct_usage cpuacct_usage; @@ -835,7 +856,7 @@ struct cgroup { unsigned long long cpu_cfs_quota; RRDSETVAR *chart_var_cpu_limit; - calculated_number prev_cpu_usage; + NETDATA_DOUBLE prev_cpu_usage; char *filename_memory_limit; unsigned long long memory_limit; @@ -922,6 +943,10 @@ static inline int is_cgroup_systemd_service(struct cgroup *cg) { } // --------------------------------------------------------------------------------------------- +static int k8s_is_kubepod(struct cgroup *cg) { + return cg->container_orchestrator == CGROUPS_ORCHESTRATOR_K8S; +} + static int k8s_is_container(const char *id) { // examples: // https://github.com/netdata/netdata/blob/0fc101679dcd12f1cb8acdd07bb4c85d8e553e53/collectors/cgroups.plugin/cgroup-name.sh#L121-L147 @@ -949,7 +974,7 @@ static int k8s_get_container_first_proc_comm(const char *id, char *comm) { char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s/%s/cgroup.procs", cgroup_cpuacct_base, id); - ff = procfile_reopen(ff, filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, filename, NULL, CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { debug(D_CGROUP, "CGROUP: k8s_is_pause_container(): cannot open file '%s'.", filename); return 1; @@ -1012,7 +1037,7 @@ static unsigned long long calc_percentage(unsigned long long value, unsigned lon if (total == 0) { return 0; } - return (calculated_number)value / (calculated_number)total * 100; + return (NETDATA_DOUBLE)value / (NETDATA_DOUBLE)total * 100; } static int calc_cgroup_depth(const char *id) { @@ -1031,7 +1056,7 @@ static inline void cgroup_read_cpuacct_stat(struct cpuacct_stat *cp) { static procfile *ff = NULL; if(likely(cp->filename)) { - ff = procfile_reopen(ff, cp->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cp->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { cp->updated = 0; cgroups_check = 1; @@ -1078,7 +1103,7 @@ static inline void cgroup_read_cpuacct_cpu_stat(struct cpuacct_cpu_throttling *c } static procfile *ff = NULL; - ff = procfile_reopen(ff, cp->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cp->filename, NULL, CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { cp->updated = 0; cgroups_check = 1; @@ -1134,7 +1159,7 @@ static inline void cgroup2_read_cpuacct_cpu_stat(struct cpuacct_stat *cp, struct return; } - ff = procfile_reopen(ff, cp->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cp->filename, NULL, CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { cp->updated = 0; cgroups_check = 1; @@ -1217,7 +1242,7 @@ static inline void cgroup_read_cpuacct_usage(struct cpuacct_usage *ca) { static procfile *ff = NULL; if(likely(ca->filename)) { - ff = procfile_reopen(ff, ca->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, ca->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { ca->updated = 0; cgroups_check = 1; @@ -1280,7 +1305,7 @@ static inline void cgroup_read_blkio(struct blkio *io) { if(likely(io->filename)) { static procfile *ff = NULL; - ff = procfile_reopen(ff, io->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, io->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { io->updated = 0; cgroups_check = 1; @@ -1352,7 +1377,7 @@ static inline void cgroup2_read_blkio(struct blkio *io, unsigned int word_offset if(likely(io->filename)) { static procfile *ff = NULL; - ff = procfile_reopen(ff, io->filename, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, io->filename, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { io->updated = 0; cgroups_check = 1; @@ -1397,7 +1422,7 @@ static inline void cgroup2_read_pressure(struct pressure *res) { static procfile *ff = NULL; if (likely(res->filename)) { - ff = procfile_reopen(ff, res->filename, " =", PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, res->filename, " =", CGROUP_PROCFILE_FLAG); if (unlikely(!ff)) { res->updated = 0; cgroups_check = 1; @@ -1454,7 +1479,7 @@ static inline void cgroup_read_memory(struct memory *mem, char parent_cg_is_unif goto memory_next; } - ff = procfile_reopen(ff, mem->filename_detailed, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, mem->filename_detailed, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { mem->updated_detailed = 0; cgroups_check = 1; @@ -1677,7 +1702,8 @@ static inline void read_cgroup_network_interfaces(struct cgroup *cg) { info("CGROUP: cgroup '%s' has network interface '%s' as '%s'", cg->id, i->host_device, i->container_device); // register a device rename to proc_net_dev.c - netdev_rename_device_add(i->host_device, i->container_device, cg->chart_id, cg->chart_labels); + netdev_rename_device_add( + i->host_device, i->container_device, cg->chart_id, cg->chart_labels, k8s_is_kubepod(cg) ? "k8s." : ""); } } @@ -1735,34 +1761,24 @@ static inline void substitute_dots_in_id(char *s) { } } -char *k8s_parse_resolved_name(struct label **labels, char *data) { - char *name = mystrsep(&data, " "); - - if (!data) { - return name; - } - - while (data) { - char *key = mystrsep(&data, "="); - - char *value; - if (data && *data == ',') { - value = ""; - *data++ = '\0'; - } else { - value = mystrsep(&data, ","); - } - value = strip_double_quotes(value, 1); +// ---------------------------------------------------------------------------- +// parse k8s labels - if (!key || *key == '\0' || !value || *value == '\0') - continue; +char *k8s_parse_resolved_name_and_labels(DICTIONARY *labels, char *data) { + // the first word, up to the first space is the name + char *name = mystrsep(&data, " "); - *labels = add_label_to_list(*labels, key, value, LABEL_SOURCE_KUBERNETES); + // the rest are key=value pairs separated by comma + while(data) { + char *pair = mystrsep(&data, ","); + rrdlabels_add_pair(labels, pair, RRDLABEL_SRC_AUTO| RRDLABEL_SRC_K8S); } return name; } +// ---------------------------------------------------------------------------- + static inline void free_pressure(struct pressure *res) { if (res->some.share_time.st) rrdset_is_obsolete(res->some.share_time.st); if (res->some.total_time.st) rrdset_is_obsolete(res->some.total_time.st); @@ -1834,7 +1850,7 @@ static inline void cgroup_free(struct cgroup *cg) { freez(cg->chart_id); freez(cg->chart_title); - free_label_list(cg->chart_labels); + rrdlabels_destroy(cg->chart_labels); freez(cg); @@ -1870,31 +1886,33 @@ static inline void discovery_rename_cgroup(struct cgroup *cg) { case 0: cg->pending_renames = 0; break; + case 3: cg->pending_renames = 0; cg->processed = 1; break; } - if (cg->pending_renames || cg->processed) { - return; - } - if (!(new_name && *new_name && *new_name != '\n')) { - return; - } - new_name = trim(new_name); - if (!(new_name)) { - return; - } + if(cg->pending_renames || cg->processed) return; + if(!new_name || !*new_name || *new_name == '\n') return; + if(!(new_name = trim(new_name))) return; + char *name = new_name; if (!strncmp(new_name, "k8s_", 4)) { - free_label_list(cg->chart_labels); - name = k8s_parse_resolved_name(&cg->chart_labels, new_name); + if(!cg->chart_labels) cg->chart_labels = rrdlabels_create(); + + // read the new labels and remove the obsolete ones + rrdlabels_unmark_all(cg->chart_labels); + name = k8s_parse_resolved_name_and_labels(cg->chart_labels, new_name); + rrdlabels_remove_all_unmarked(cg->chart_labels); } + freez(cg->chart_title); cg->chart_title = cgroup_title_strdupz(name); + freez(cg->chart_id); cg->chart_id = cgroup_chart_id_strdupz(name); + substitute_dots_in_id(cg->chart_id); cg->hash_chart = simple_hash(cg->chart_id); } @@ -2584,6 +2602,14 @@ static inline void discovery_process_first_time_seen_cgroup(struct cgroup *cg) { char comm[TASK_COMM_LEN]; + if (cg->container_orchestrator == CGROUPS_ORCHESTRATOR_UNSET) { + if (strstr(cg->id, "kubepods")) { + cg->container_orchestrator = CGROUPS_ORCHESTRATOR_K8S; + } else { + cg->container_orchestrator = CGROUPS_ORCHESTRATOR_UNKNOWN; + } + } + if (is_inside_k8s && !k8s_get_container_first_proc_comm(cg->id, comm)) { // container initialization may take some time when CPU % is high // seen on GKE: comm is '6' before 'runc:[2:INIT]' (dunno if it could be another number) @@ -2656,6 +2682,11 @@ static inline void discovery_process_cgroup(struct cgroup *cg) { cg->processed = 1; + if (strlen(cg->chart_id) >= RRD_ID_LENGTH_MAX) { + info("cgroup '%s' (chart id '%s') disabled because chart_id exceeds the limit (RRD_ID_LENGTH_MAX)", cg->id, cg->chart_id); + return; + } + if (is_cgroup_systemd_service(cg)) { cg->enabled = 1; return; @@ -3638,7 +3669,7 @@ static inline void update_cpu_limits2(struct cgroup *cg) { if(cg->filename_cpu_cfs_quota){ static procfile *ff = NULL; - ff = procfile_reopen(ff, cg->filename_cpu_cfs_quota, NULL, PROCFILE_FLAG_DEFAULT); + ff = procfile_reopen(ff, cg->filename_cpu_cfs_quota, NULL, CGROUP_PROCFILE_FLAG); if(unlikely(!ff)) { goto cpu_limits2_err; } @@ -3694,7 +3725,7 @@ static inline int update_memory_limits(char **filename, RRDSETVAR **chart_var, u *filename = NULL; } else { - rrdsetvar_custom_chart_variable_set(*chart_var, (calculated_number)(*value / (1024 * 1024))); + rrdsetvar_custom_chart_variable_set(*chart_var, (NETDATA_DOUBLE)(*value / (1024 * 1024))); return 1; } } else { @@ -3709,11 +3740,11 @@ static inline int update_memory_limits(char **filename, RRDSETVAR **chart_var, u char *s = "max\n\0"; if(strcmp(s, buffer) == 0){ *value = UINT64_MAX; - rrdsetvar_custom_chart_variable_set(*chart_var, (calculated_number)(*value / (1024 * 1024))); + rrdsetvar_custom_chart_variable_set(*chart_var, (NETDATA_DOUBLE)(*value / (1024 * 1024))); return 1; } *value = str2ull(buffer); - rrdsetvar_custom_chart_variable_set(*chart_var, (calculated_number)(*value / (1024 * 1024))); + rrdsetvar_custom_chart_variable_set(*chart_var, (NETDATA_DOUBLE)(*value / (1024 * 1024))); return 1; } } @@ -3772,7 +3803,7 @@ void update_cgroup_charts(int update_every) { , "cpu" , NULL , "cpu" - , "cgroup.cpu" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu" : "cgroup.cpu" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3782,7 +3813,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_cpu, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu, cg->chart_labels); if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) { rrddim_add(cg->st_cpu, "user", NULL, 100, system_hz, RRD_ALGORITHM_INCREMENTAL); @@ -3822,17 +3853,17 @@ void update_cgroup_charts(int update_every) { } } else { - calculated_number value = 0, quota = 0; + NETDATA_DOUBLE value = 0, quota = 0; if(likely( ((!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) && (cg->filename_cpuset_cpus || (cg->filename_cpu_cfs_period && cg->filename_cpu_cfs_quota))) || ((cg->options & CGROUP_OPTIONS_IS_UNIFIED) && cg->filename_cpu_cfs_quota))) { if(unlikely(cg->cpu_cfs_quota > 0)) - quota = (calculated_number)cg->cpu_cfs_quota / (calculated_number)cg->cpu_cfs_period; + quota = (NETDATA_DOUBLE)cg->cpu_cfs_quota / (NETDATA_DOUBLE)cg->cpu_cfs_period; if(unlikely(quota > 0 && quota < cg->cpuset_cpus)) value = quota * 100; else - value = (calculated_number)cg->cpuset_cpus * 100; + value = (NETDATA_DOUBLE)cg->cpuset_cpus * 100; } if(likely(value)) { rrdsetvar_custom_chart_variable_set(cg->chart_var_cpu_limit, value); @@ -3845,7 +3876,7 @@ void update_cgroup_charts(int update_every) { , "cpu_limit" , NULL , "cpu" - , "cgroup.cpu_limit" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_limit" : "cgroup.cpu_limit" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3855,20 +3886,20 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_limit, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_limit, cg->chart_labels); if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) rrddim_add(cg->st_cpu_limit, "used", NULL, 1, system_hz, RRD_ALGORITHM_ABSOLUTE); else rrddim_add(cg->st_cpu_limit, "used", NULL, 1, 1000000, RRD_ALGORITHM_ABSOLUTE); - cg->prev_cpu_usage = (calculated_number)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; + cg->prev_cpu_usage = (NETDATA_DOUBLE)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; } else rrdset_next(cg->st_cpu_limit); - calculated_number cpu_usage = 0; - cpu_usage = (calculated_number)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; - calculated_number cpu_used = 100 * (cpu_usage - cg->prev_cpu_usage) / (value * update_every); + NETDATA_DOUBLE cpu_usage = 0; + cpu_usage = (NETDATA_DOUBLE)(cg->cpuacct_stat.user + cg->cpuacct_stat.system) * 100; + NETDATA_DOUBLE cpu_used = 100 * (cpu_usage - cg->prev_cpu_usage) / (value * update_every); rrdset_isnot_obsolete(cg->st_cpu_limit); @@ -3898,7 +3929,7 @@ void update_cgroup_charts(int update_every) { , "throttled" , NULL , "cpu" - , "cgroup.throttled" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttled" : "cgroup.throttled" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3908,7 +3939,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_nr_throttled, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_nr_throttled, cg->chart_labels); rrddim_add(cg->st_cpu_nr_throttled, "throttled", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else { rrdset_next(cg->st_cpu_nr_throttled); @@ -3924,7 +3955,7 @@ void update_cgroup_charts(int update_every) { , "throttled_duration" , NULL , "cpu" - , "cgroup.throttled_duration" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttled_duration" : "cgroup.throttled_duration" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -3934,7 +3965,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_throttled_time, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_throttled_time, cg->chart_labels); rrddim_add(cg->st_cpu_throttled_time, "duration", NULL, 1, 1000000, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(cg->st_cpu_throttled_time); @@ -3952,7 +3983,7 @@ void update_cgroup_charts(int update_every) { , "cpu_shares" , NULL , "cpu" - , "cgroup.cpu_shares" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_shares" : "cgroup.cpu_shares" , title , "shares" , PLUGIN_CGROUPS_NAME @@ -3962,7 +3993,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_cpu_shares, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_shares, cg->chart_labels); rrddim_add(cg->st_cpu_shares, "shares", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else { rrdset_next(cg->st_cpu_shares); @@ -3983,7 +4014,7 @@ void update_cgroup_charts(int update_every) { , "cpu_per_core" , NULL , "cpu" - , "cgroup.cpu_per_core" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_per_core" : "cgroup.cpu_per_core" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -3993,7 +4024,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_cpu_per_core, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_cpu_per_core, cg->chart_labels); for(i = 0; i < cg->cpuacct_usage.cpus; i++) { snprintfz(id, RRD_ID_LENGTH_MAX, "cpu%u", i); @@ -4019,7 +4050,7 @@ void update_cgroup_charts(int update_every) { , "mem" , NULL , "mem" - , "cgroup.mem" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem" : "cgroup.mem" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4028,8 +4059,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_STACKED ); - - rrdset_update_labels(cg->st_mem, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_mem, cg->chart_labels); if(!(cg->options & CGROUP_OPTIONS_IS_UNIFIED)) { rrddim_add(cg->st_mem, "cache", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4079,7 +4110,7 @@ void update_cgroup_charts(int update_every) { , "writeback" , NULL , "mem" - , "cgroup.writeback" + , k8s_is_kubepod(cg) ? "k8s.cgroup.writeback" : "cgroup.writeback" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4089,7 +4120,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_AREA ); - rrdset_update_labels(cg->st_writeback, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_writeback, cg->chart_labels); if(cg->memory.detailed_has_dirty) rrddim_add(cg->st_writeback, "dirty", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4114,7 +4145,7 @@ void update_cgroup_charts(int update_every) { , "mem_activity" , NULL , "mem" - , "cgroup.mem_activity" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_activity" : "cgroup.mem_activity" , title , "MiB/s" , PLUGIN_CGROUPS_NAME @@ -4124,7 +4155,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_mem_activity, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_activity, cg->chart_labels); rrddim_add(cg->st_mem_activity, "pgpgin", "in", system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_mem_activity, "pgpgout", "out", -system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4145,7 +4176,7 @@ void update_cgroup_charts(int update_every) { , "pgfaults" , NULL , "mem" - , "cgroup.pgfaults" + , k8s_is_kubepod(cg) ? "k8s.cgroup.pgfaults" : "cgroup.pgfaults" , title , "MiB/s" , PLUGIN_CGROUPS_NAME @@ -4155,7 +4186,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_pgfaults, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_pgfaults, cg->chart_labels); rrddim_add(cg->st_pgfaults, "pgfault", NULL, system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_pgfaults, "pgmajfault", "swap", -system_page_size, 1024 * 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4177,7 +4208,7 @@ void update_cgroup_charts(int update_every) { , "mem_usage" , NULL , "mem" - , "cgroup.mem_usage" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_usage" : "cgroup.mem_usage" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4187,7 +4218,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_mem_usage, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_usage, cg->chart_labels); rrddim_add(cg->st_mem_usage, "ram", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); rrddim_add(cg->st_mem_usage, "swap", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4244,7 +4275,7 @@ void update_cgroup_charts(int update_every) { , "mem_usage_limit" , NULL , "mem" - , "cgroup.mem_usage_limit" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_usage_limit": "cgroup.mem_usage_limit" , title , "MiB" , PLUGIN_CGROUPS_NAME @@ -4254,7 +4285,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_STACKED ); - rrdset_update_labels(cg->st_mem_usage_limit, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_usage_limit, cg->chart_labels); rrddim_add(cg->st_mem_usage_limit, "available", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); rrddim_add(cg->st_mem_usage_limit, "used", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); @@ -4276,7 +4307,7 @@ void update_cgroup_charts(int update_every) { , "mem_utilization" , NULL , "mem" - , "cgroup.mem_utilization" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_utilization" : "cgroup.mem_utilization" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4286,7 +4317,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_AREA ); - rrdset_update_labels(cg->st_mem_utilization, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_mem_utilization, cg->chart_labels); rrddim_add(cg->st_mem_utilization, "utilization", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else @@ -4325,7 +4356,7 @@ void update_cgroup_charts(int update_every) { , "mem_failcnt" , NULL , "mem" - , "cgroup.mem_failcnt" + , k8s_is_kubepod(cg) ? "k8s.cgroup.mem_failcnt" : "cgroup.mem_failcnt" , title , "count" , PLUGIN_CGROUPS_NAME @@ -4334,8 +4365,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_mem_failcnt, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_mem_failcnt, cg->chart_labels); rrddim_add(cg->st_mem_failcnt, "failures", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } @@ -4355,7 +4386,7 @@ void update_cgroup_charts(int update_every) { , "io" , NULL , "disk" - , "cgroup.io" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io" : "cgroup.io" , title , "KiB/s" , PLUGIN_CGROUPS_NAME @@ -4365,7 +4396,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_AREA ); - rrdset_update_labels(cg->st_io, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_io, cg->chart_labels); rrddim_add(cg->st_io, "read", NULL, 1, 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_io, "write", NULL, -1, 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4387,7 +4418,7 @@ void update_cgroup_charts(int update_every) { , "serviced_ops" , NULL , "disk" - , "cgroup.serviced_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.serviced_ops" : "cgroup.serviced_ops" , title , "operations/s" , PLUGIN_CGROUPS_NAME @@ -4397,7 +4428,7 @@ void update_cgroup_charts(int update_every) { , RRDSET_TYPE_LINE ); - rrdset_update_labels(cg->st_serviced_ops, cg->chart_labels); + rrdset_update_rrdlabels(cg->st_serviced_ops, cg->chart_labels); rrddim_add(cg->st_serviced_ops, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_serviced_ops, "write", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -4419,7 +4450,7 @@ void update_cgroup_charts(int update_every) { , "throttle_io" , NULL , "disk" - , "cgroup.throttle_io" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttle_io" : "cgroup.throttle_io" , title , "KiB/s" , PLUGIN_CGROUPS_NAME @@ -4428,8 +4459,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_AREA ); - - rrdset_update_labels(cg->st_throttle_io, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_throttle_io, cg->chart_labels); rrddim_add(cg->st_throttle_io, "read", NULL, 1, 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_throttle_io, "write", NULL, -1, 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4451,7 +4482,7 @@ void update_cgroup_charts(int update_every) { , "throttle_serviced_ops" , NULL , "disk" - , "cgroup.throttle_serviced_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.throttle_serviced_ops" : "cgroup.throttle_serviced_ops" , title , "operations/s" , PLUGIN_CGROUPS_NAME @@ -4460,8 +4491,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_throttle_serviced_ops, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_throttle_serviced_ops, cg->chart_labels); rrddim_add(cg->st_throttle_serviced_ops, "read", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_throttle_serviced_ops, "write", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -4483,7 +4514,7 @@ void update_cgroup_charts(int update_every) { , "queued_ops" , NULL , "disk" - , "cgroup.queued_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.queued_ops" : "cgroup.queued_ops" , title , "operations" , PLUGIN_CGROUPS_NAME @@ -4492,8 +4523,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_queued_ops, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_queued_ops, cg->chart_labels); rrddim_add(cg->st_queued_ops, "read", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); rrddim_add(cg->st_queued_ops, "write", NULL, -1, 1, RRD_ALGORITHM_ABSOLUTE); @@ -4515,7 +4546,7 @@ void update_cgroup_charts(int update_every) { , "merged_ops" , NULL , "disk" - , "cgroup.merged_ops" + , k8s_is_kubepod(cg) ? "k8s.cgroup.merged_ops" : "cgroup.merged_ops" , title , "operations/s" , PLUGIN_CGROUPS_NAME @@ -4524,8 +4555,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(cg->st_merged_ops, cg->chart_labels); + + rrdset_update_rrdlabels(cg->st_merged_ops, cg->chart_labels); rrddim_add(cg->st_merged_ops, "read", NULL, 1, 1024, RRD_ALGORITHM_INCREMENTAL); rrddim_add(cg->st_merged_ops, "write", NULL, -1, 1024, RRD_ALGORITHM_INCREMENTAL); @@ -4553,7 +4584,7 @@ void update_cgroup_charts(int update_every) { , "cpu_some_pressure" , NULL , "cpu" - , "cgroup.cpu_some_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_some_pressure" : "cgroup.cpu_some_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4562,7 +4593,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "some 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "some 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "some 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4577,7 +4608,7 @@ void update_cgroup_charts(int update_every) { , "cpu_some_pressure_stall_time" , NULL , "cpu" - , "cgroup.cpu_some_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_some_pressure_stall_time" : "cgroup.cpu_some_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4586,7 +4617,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4605,7 +4636,7 @@ void update_cgroup_charts(int update_every) { , "cpu_full_pressure" , NULL , "cpu" - , "cgroup.cpu_full_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_full_pressure" : "cgroup.cpu_full_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4614,7 +4645,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "full 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "full 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "full 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4629,7 +4660,7 @@ void update_cgroup_charts(int update_every) { , "cpu_full_pressure_stall_time" , NULL , "cpu" - , "cgroup.cpu_full_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.cpu_full_pressure_stall_time" : "cgroup.cpu_full_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4638,7 +4669,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4660,7 +4691,7 @@ void update_cgroup_charts(int update_every) { , "mem_some_pressure" , NULL , "mem" - , "cgroup.memory_some_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_some_pressure" : "cgroup.memory_some_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4668,8 +4699,8 @@ void update_cgroup_charts(int update_every) { , cgroup_containers_chart_priority + 2300 , update_every , RRDSET_TYPE_LINE - ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + ); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "some 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "some 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "some 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4684,7 +4715,7 @@ void update_cgroup_charts(int update_every) { , "memory_some_pressure_stall_time" , NULL , "mem" - , "cgroup.memory_some_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_some_pressure_stall_time" : "cgroup.memory_some_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4693,7 +4724,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4714,7 +4745,7 @@ void update_cgroup_charts(int update_every) { , "mem_full_pressure" , NULL , "mem" - , "cgroup.memory_full_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_full_pressure" : "cgroup.memory_full_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4723,8 +4754,8 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "full 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "full 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "full 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4739,7 +4770,7 @@ void update_cgroup_charts(int update_every) { , "memory_full_pressure_stall_time" , NULL , "mem" - , "cgroup.memory_full_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.memory_full_pressure_stall_time" : "cgroup.memory_full_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4748,7 +4779,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4770,7 +4801,7 @@ void update_cgroup_charts(int update_every) { , "io_some_pressure" , NULL , "disk" - , "cgroup.io_some_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_some_pressure" : "cgroup.io_some_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4779,7 +4810,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "some 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "some 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "some 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4794,7 +4825,7 @@ void update_cgroup_charts(int update_every) { , "io_some_pressure_stall_time" , NULL , "disk" - , "cgroup.io_some_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_some_pressure_stall_time" : "cgroup.io_some_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4803,7 +4834,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); @@ -4823,7 +4854,7 @@ void update_cgroup_charts(int update_every) { , "io_full_pressure" , NULL , "disk" - , "cgroup.io_full_pressure" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_full_pressure" : "cgroup.io_full_pressure" , title , "percentage" , PLUGIN_CGROUPS_NAME @@ -4832,7 +4863,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->share_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->share_time.st, cg->chart_labels); pcs->share_time.rd10 = rrddim_add(chart, "full 10", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd60 = rrddim_add(chart, "full 60", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); pcs->share_time.rd300 = rrddim_add(chart, "full 300", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); @@ -4847,7 +4878,7 @@ void update_cgroup_charts(int update_every) { , "io_full_pressure_stall_time" , NULL , "disk" - , "cgroup.io_full_pressure_stall_time" + , k8s_is_kubepod(cg) ? "k8s.cgroup.io_full_pressure_stall_time" : "cgroup.io_full_pressure_stall_time" , title , "ms" , PLUGIN_CGROUPS_NAME @@ -4856,7 +4887,7 @@ void update_cgroup_charts(int update_every) { , update_every , RRDSET_TYPE_LINE ); - rrdset_update_labels(chart = pcs->total_time.st, cg->chart_labels); + rrdset_update_rrdlabels(chart = pcs->total_time.st, cg->chart_labels); pcs->total_time.rdtotal = rrddim_add(chart, "time", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); } else { rrdset_next(pcs->total_time.st); diff --git a/collectors/cgroups.plugin/sys_fs_cgroup.h b/collectors/cgroups.plugin/sys_fs_cgroup.h index 8301ec26a..d1adf8a93 100644 --- a/collectors/cgroups.plugin/sys_fs_cgroup.h +++ b/collectors/cgroups.plugin/sys_fs_cgroup.h @@ -39,6 +39,6 @@ typedef struct netdata_ebpf_cgroup_shm { #include "../proc.plugin/plugin_proc.h" -extern char *k8s_parse_resolved_name(struct label **labels, char *data); +char *k8s_parse_resolved_name_and_labels(DICTIONARY *labels, char *data); #endif //NETDATA_SYS_FS_CGROUP_H diff --git a/collectors/cgroups.plugin/tests/test_cgroups_plugin.c b/collectors/cgroups.plugin/tests/test_cgroups_plugin.c index 057ac9280..25939a9cd 100644 --- a/collectors/cgroups.plugin/tests/test_cgroups_plugin.c +++ b/collectors/cgroups.plugin/tests/test_cgroups_plugin.c @@ -8,18 +8,36 @@ int netdata_zero_metrics_enabled = 1; struct config netdata_config; char *netdata_configured_primary_plugins_dir = NULL; +struct k8s_test_data { + char *data; + char *name; + char *key[3]; + char *value[3]; + + const char *result_key[3]; + const char *result_value[3]; + int result_ls[3]; + int i; +}; + +static int read_label_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) +{ + struct k8s_test_data *test_data = (struct k8s_test_data *)data; + + test_data->result_key[test_data->i] = name; + test_data->result_value[test_data->i] = value; + test_data->result_ls[test_data->i] = ls; + + test_data->i++; + + return 1; +} + static void test_k8s_parse_resolved_name(void **state) { UNUSED(state); - struct label *labels = (struct label *)0xff; - - struct k8s_test_data { - char *data; - char *name; - char *key[3]; - char *value[3]; - }; + DICTIONARY *labels = rrdlabels_create(); struct k8s_test_data test_data[] = { // One label @@ -40,29 +58,29 @@ static void test_k8s_parse_resolved_name(void **state) .key[0] = "label1", .value[0] = "value1" }, // Equals sign in the value - { .data = "name label1=\"value=1\"", - .name = "name", - .key[0] = "label1", .value[0] = "value=1" }, + // { .data = "name label1=\"value=1\"", + // .name = "name", + // .key[0] = "label1", .value[0] = "value=1" }, // Double quotation mark in the value - { .data = "name label1=\"value\"1\"", - .name = "name", - .key[0] = "label1", .value[0] = "value" }, + // { .data = "name label1=\"value\"1\"", + // .name = "name", + // .key[0] = "label1", .value[0] = "value" }, // Escaped double quotation mark in the value - { .data = "name label1=\"value\\\"1\"", - .name = "name", - .key[0] = "label1", .value[0] = "value\\\"1" }, + // { .data = "name label1=\"value\\\"1\"", + // .name = "name", + // .key[0] = "label1", .value[0] = "value\\\"1" }, // Equals sign in the key - { .data = "name label=1=\"value1\"", - .name = "name", - .key[0] = "label", .value[0] = "1=\"value1\"" }, + // { .data = "name label=1=\"value1\"", + // .name = "name", + // .key[0] = "label", .value[0] = "1=\"value1\"" }, // Skipped value - { .data = "name label1=,label2=\"value2\"", - .name = "name", - .key[0] = "label2", .value[0] = "value2" }, + // { .data = "name label1=,label2=\"value2\"", + // .name = "name", + // .key[0] = "label2", .value[0] = "value2" }, // A pair of equals signs { .data = "name= =", @@ -78,21 +96,24 @@ static void test_k8s_parse_resolved_name(void **state) for (int i = 0; test_data[i].data != NULL; i++) { char *data = strdup(test_data[i].data); + char *name = k8s_parse_resolved_name_and_labels(labels, data); + + assert_string_equal(name, test_data[i].name); + + rrdlabels_walkthrough_read(labels, read_label_callback, &test_data[i]); + for (int l = 0; l < 3 && test_data[i].key[l] != NULL; l++) { char *key = test_data[i].key[l]; char *value = test_data[i].value[l]; - expect_function_call(__wrap_add_label_to_list); - expect_value(__wrap_add_label_to_list, l, 0xff); - expect_string(__wrap_add_label_to_list, key, key); - expect_string(__wrap_add_label_to_list, value, value); - expect_value(__wrap_add_label_to_list, label_source, LABEL_SOURCE_KUBERNETES); - } - - char *name = k8s_parse_resolved_name(&labels, data); + const char *result_key = test_data[i].result_key[l]; + const char *result_value = test_data[i].result_value[l]; + int ls = test_data[i].result_ls[l]; - assert_string_equal(name, test_data[i].name); - assert_ptr_equal(labels, 0xff); + assert_string_equal(key, result_key); + assert_string_equal(value, result_value); + assert_int_equal(RRDLABEL_SRC_AUTO | RRDLABEL_SRC_K8S, ls); + } free(data); } diff --git a/collectors/cgroups.plugin/tests/test_doubles.c b/collectors/cgroups.plugin/tests/test_doubles.c index 9cefa6c98..6203d444c 100644 --- a/collectors/cgroups.plugin/tests/test_doubles.c +++ b/collectors/cgroups.plugin/tests/test_doubles.c @@ -44,22 +44,6 @@ void mountinfo_free_all(struct mountinfo *mi) UNUSED(mi); } -struct label *__wrap_add_label_to_list(struct label *l, char *key, char *value, LABEL_SOURCE label_source) -{ - function_called(); - check_expected_ptr(l); - check_expected_ptr(key); - check_expected_ptr(value); - check_expected(label_source); - return l; -} - -void rrdset_update_labels(RRDSET *st, struct label *labels) -{ - UNUSED(st); - UNUSED(labels); -} - RRDSET *rrdset_create_custom( RRDHOST *host, const char *type, const char *id, const char *name, const char *family, const char *context, const char *title, const char *units, const char *plugin, const char *module, long priority, int update_every, @@ -125,7 +109,7 @@ RRDSETVAR *rrdsetvar_custom_chart_variable_create(RRDSET *st, const char *name) return NULL; } -void rrdsetvar_custom_chart_variable_set(RRDSETVAR *rs, calculated_number value) +void rrdsetvar_custom_chart_variable_set(RRDSETVAR *rs, NETDATA_DOUBLE value) { UNUSED(rs); UNUSED(value); @@ -148,15 +132,24 @@ void update_pressure_charts(struct pressure_charts *charts) } void netdev_rename_device_add( - const char *host_device, const char *container_device, const char *container_name, struct label *labels) + const char *host_device, const char *container_device, const char *container_name, DICTIONARY *labels, const char *ctx_prefix) { UNUSED(host_device); UNUSED(container_device); UNUSED(container_name); UNUSED(labels); + UNUSED(ctx_prefix); } void netdev_rename_device_del(const char *host_device) { UNUSED(host_device); } + +void sql_store_chart_label(uuid_t *chart_uuid, int source_type, char *label, char *value) +{ + UNUSED(chart_uuid); + UNUSED(source_type); + UNUSED(label); + UNUSED(value); +} diff --git a/collectors/cups.plugin/cups_plugin.c b/collectors/cups.plugin/cups_plugin.c index f6481a468..77bd3e0ed 100644 --- a/collectors/cups.plugin/cups_plugin.c +++ b/collectors/cups.plugin/cups_plugin.c @@ -162,12 +162,12 @@ struct job_metrics *get_job_metrics(char *dest) { reset_job_metrics(NULL, &new_job_metrics, NULL); jm = dictionary_set(dict_dest_job_metrics, dest, &new_job_metrics, sizeof(struct job_metrics)); - printf("CHART cups.job_num_%s '' 'Active job number of destination %s' jobs '%s' cups.job_num stacked %i %i\n", dest, dest, dest, netdata_priority++, netdata_update_every); + printf("CHART cups.job_num_%s '' 'Active jobs of %s' jobs '%s' cups.job_num stacked %i %i\n", dest, dest, dest, netdata_priority++, netdata_update_every); printf("DIMENSION pending '' absolute 1 1\n"); printf("DIMENSION held '' absolute 1 1\n"); printf("DIMENSION processing '' absolute 1 1\n"); - printf("CHART cups.job_size_%s '' 'Active job size of destination %s' KB '%s' cups.job_size stacked %i %i\n", dest, dest, dest, netdata_priority++, netdata_update_every); + printf("CHART cups.job_size_%s '' 'Active jobs size of %s' KB '%s' cups.job_size stacked %i %i\n", dest, dest, dest, netdata_priority++, netdata_update_every); printf("DIMENSION pending '' absolute 1 1\n"); printf("DIMENSION held '' absolute 1 1\n"); printf("DIMENSION processing '' absolute 1 1\n"); @@ -196,12 +196,12 @@ int collect_job_metrics(const char *name, void *entry, void *data) { "END\n", name, jm->size_pending, jm->size_held, jm->size_processing); } else { - printf("CHART cups.job_num_%s '' 'Active job number of destination %s' jobs '%s' cups.job_num stacked 1 %i 'obsolete'\n", name, name, name, netdata_update_every); + printf("CHART cups.job_num_%s '' 'Active jobs of %s' jobs '%s' cups.job_num stacked 1 %i 'obsolete'\n", name, name, name, netdata_update_every); printf("DIMENSION pending '' absolute 1 1\n"); printf("DIMENSION held '' absolute 1 1\n"); printf("DIMENSION processing '' absolute 1 1\n"); - printf("CHART cups.job_size_%s '' 'Active job size of destination %s' KB '%s' cups.job_size stacked 1 %i 'obsolete'\n", name, name, name, netdata_update_every); + printf("CHART cups.job_size_%s '' 'Active jobs size of %s' KB '%s' cups.job_size stacked 1 %i 'obsolete'\n", name, name, name, netdata_update_every); printf("DIMENSION pending '' absolute 1 1\n"); printf("DIMENSION held '' absolute 1 1\n"); printf("DIMENSION processing '' absolute 1 1\n"); @@ -387,12 +387,12 @@ int main(int argc, char **argv) { printf("DIMENSION acceptingjobs '' absolute 1 1\n"); printf("DIMENSION shared '' absolute 1 1\n"); - printf("CHART cups.job_num '' 'Total active job number' jobs overview cups.job_num stacked 100002 %i\n", netdata_update_every); + printf("CHART cups.job_num '' 'Active jobs' jobs overview cups.job_num stacked 100002 %i\n", netdata_update_every); printf("DIMENSION pending '' absolute 1 1\n"); printf("DIMENSION held '' absolute 1 1\n"); printf("DIMENSION processing '' absolute 1 1\n"); - printf("CHART cups.job_size '' 'Total active job size' KB overview cups.job_size stacked 100003 %i\n", netdata_update_every); + printf("CHART cups.job_size '' 'Active jobs size' KB overview cups.job_size stacked 100003 %i\n", netdata_update_every); printf("DIMENSION pending '' absolute 1 1\n"); printf("DIMENSION held '' absolute 1 1\n"); printf("DIMENSION processing '' absolute 1 1\n"); diff --git a/collectors/diskspace.plugin/plugin_diskspace.c b/collectors/diskspace.plugin/plugin_diskspace.c index 663bb82fc..5bdf8bc61 100644 --- a/collectors/diskspace.plugin/plugin_diskspace.c +++ b/collectors/diskspace.plugin/plugin_diskspace.c @@ -3,11 +3,17 @@ #include "../proc.plugin/plugin_proc.h" #define PLUGIN_DISKSPACE_NAME "diskspace.plugin" +#define THREAD_DISKSPACE_SLOW_NAME "PLUGIN[diskspace slow]" #define DEFAULT_EXCLUDED_PATHS "/proc/* /sys/* /var/run/user/* /run/user/* /snap/* /var/lib/docker/*" #define DEFAULT_EXCLUDED_FILESYSTEMS "*gvfs *gluster* *s3fs *ipfs *davfs2 *httpfs *sshfs *gdfs *moosefs fusectl autofs" #define CONFIG_SECTION_DISKSPACE "plugin:proc:diskspace" +#define MAX_STAT_USEC 10000LU +#define SLOW_UPDATE_EVERY 5 + +static netdata_thread_t *diskspace_slow_thread = NULL; + static struct mountinfo *disk_mountinfo_root = NULL; static int check_for_new_mountpoints_every = 15; static int cleanup_mount_points = 1; @@ -34,6 +40,9 @@ struct mount_point_metadata { int do_inodes; int shown_error; int updated; + int slow; + + DICTIONARY *chart_labels; size_t collected; // the number of times this has been collected @@ -52,13 +61,15 @@ static DICTIONARY *dict_mountpoints = NULL; #define rrdset_obsolete_and_pointer_null(st) do { if(st) { rrdset_is_obsolete(st); (st) = NULL; } } while(st) -int mount_point_cleanup(const char *name, void *entry, void *data) { +int mount_point_cleanup(const char *name, void *entry, int slow) { (void)name; - (void)data; - + struct mount_point_metadata *mp = (struct mount_point_metadata *)entry; if(!mp) return 0; + if (slow != mp->slow) + return 0; + if(likely(mp->updated)) { mp->updated = 0; return 0; @@ -84,34 +95,219 @@ int mount_point_cleanup(const char *name, void *entry, void *data) { return 0; } -// for the full list of protected mount points look at -// https://github.com/systemd/systemd/blob/1eb3ef78b4df28a9e9f464714208f2682f957e36/src/core/namespace.c#L142-L149 -// https://github.com/systemd/systemd/blob/1eb3ef78b4df28a9e9f464714208f2682f957e36/src/core/namespace.c#L180-L194 -static const char *systemd_protected_mount_points[] = { - "/home", - "/root", - "/usr", - "/boot", - "/efi", - "/etc", - NULL +int mount_point_cleanup_cb(const char *name, void *entry, void *data) { + UNUSED(data); + + return mount_point_cleanup(name, (struct mount_point_metadata *)entry, 0); +} + +// a copy of basic mountinfo fields +struct basic_mountinfo { + char *persistent_id; + char *root; + char *mount_point; + char *filesystem; + + struct basic_mountinfo *next; }; -int mount_point_is_protected(char *mount_point) +static struct basic_mountinfo *slow_mountinfo_tmp_root = NULL; +static netdata_mutex_t slow_mountinfo_mutex; + +static struct basic_mountinfo *basic_mountinfo_create_and_copy(struct mountinfo* mi) { - for (size_t i = 0; systemd_protected_mount_points[i] != NULL; i++) - if (!strcmp(mount_point, systemd_protected_mount_points[i])) - return 1; + struct basic_mountinfo *bmi = callocz(1, sizeof(struct basic_mountinfo)); + + if (mi) { + bmi->persistent_id = strdupz(mi->persistent_id); + bmi->root = strdupz(mi->root); + bmi->mount_point = strdupz(mi->mount_point); + bmi->filesystem = strdupz(mi->filesystem); + } - return 0; + return bmi; } -static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { +static void add_basic_mountinfo(struct basic_mountinfo **root, struct mountinfo *mi) +{ + if (!root) + return; + + struct basic_mountinfo *bmi = basic_mountinfo_create_and_copy(mi); + + bmi->next = *root; + *root = bmi; +}; + +static void free_basic_mountinfo(struct basic_mountinfo *bmi) +{ + if (bmi) { + freez(bmi->persistent_id); + freez(bmi->root); + freez(bmi->mount_point); + freez(bmi->filesystem); + + freez(bmi); + } +}; + +static void free_basic_mountinfo_list(struct basic_mountinfo *root) +{ + struct basic_mountinfo *bmi = root, *next; + + while (bmi) { + next = bmi->next; + free_basic_mountinfo(bmi); + bmi = next; + } +} + +static void calculate_values_and_show_charts( + struct basic_mountinfo *mi, + struct mount_point_metadata *m, + struct statvfs *buff_statvfs, + int update_every) +{ const char *family = mi->mount_point; const char *disk = mi->persistent_id; + // logic found at get_fs_usage() in coreutils + unsigned long bsize = (buff_statvfs->f_frsize) ? buff_statvfs->f_frsize : buff_statvfs->f_bsize; + + fsblkcnt_t bavail = buff_statvfs->f_bavail; + fsblkcnt_t btotal = buff_statvfs->f_blocks; + fsblkcnt_t bavail_root = buff_statvfs->f_bfree; + fsblkcnt_t breserved_root = bavail_root - bavail; + fsblkcnt_t bused = likely(btotal >= bavail_root) ? btotal - bavail_root : bavail_root - btotal; + +#ifdef NETDATA_INTERNAL_CHECKS + if(unlikely(btotal != bavail + breserved_root + bused)) + error("DISKSPACE: disk block statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)btotal, (unsigned long long)bavail, (unsigned long long)breserved_root, (unsigned long long)bused); +#endif + + // -------------------------------------------------------------------------- + + fsfilcnt_t favail = buff_statvfs->f_favail; + fsfilcnt_t ftotal = buff_statvfs->f_files; + fsfilcnt_t favail_root = buff_statvfs->f_ffree; + fsfilcnt_t freserved_root = favail_root - favail; + fsfilcnt_t fused = ftotal - favail_root; + + if(m->do_inodes == CONFIG_BOOLEAN_AUTO && favail == (fsfilcnt_t)-1) { + // this file system does not support inodes reporting + // eg. cephfs + m->do_inodes = CONFIG_BOOLEAN_NO; + } + +#ifdef NETDATA_INTERNAL_CHECKS + if(unlikely(btotal != bavail + breserved_root + bused)) + error("DISKSPACE: disk inode statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)ftotal, (unsigned long long)favail, (unsigned long long)freserved_root, (unsigned long long)fused); +#endif + + // -------------------------------------------------------------------------- + + int rendered = 0; + + if(m->do_space == CONFIG_BOOLEAN_YES || (m->do_space == CONFIG_BOOLEAN_AUTO && + (bavail || breserved_root || bused || + netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) { + if(unlikely(!m->st_space) || m->st_space->update_every != update_every) { + m->do_space = CONFIG_BOOLEAN_YES; + m->st_space = rrdset_find_active_bytype_localhost("disk_space", disk); + if(unlikely(!m->st_space || m->st_space->update_every != update_every)) { + char title[4096 + 1]; + snprintfz(title, 4096, "Disk Space Usage"); + m->st_space = rrdset_create_localhost( + "disk_space" + , disk + , NULL + , family + , "disk.space" + , title + , "GiB" + , PLUGIN_DISKSPACE_NAME + , NULL + , NETDATA_CHART_PRIO_DISKSPACE_SPACE + , update_every + , RRDSET_TYPE_STACKED + ); + } + + rrdset_update_rrdlabels(m->st_space, m->chart_labels); + + m->rd_space_avail = rrddim_add(m->st_space, "avail", NULL, (collected_number)bsize, 1024 * 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + m->rd_space_used = rrddim_add(m->st_space, "used", NULL, (collected_number)bsize, 1024 * 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + m->rd_space_reserved = rrddim_add(m->st_space, "reserved_for_root", "reserved for root", (collected_number)bsize, 1024 * 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + } + else + rrdset_next(m->st_space); + + rrddim_set_by_pointer(m->st_space, m->rd_space_avail, (collected_number)bavail); + rrddim_set_by_pointer(m->st_space, m->rd_space_used, (collected_number)bused); + rrddim_set_by_pointer(m->st_space, m->rd_space_reserved, (collected_number)breserved_root); + rrdset_done(m->st_space); + + rendered++; + } + + // -------------------------------------------------------------------------- + + if(m->do_inodes == CONFIG_BOOLEAN_YES || (m->do_inodes == CONFIG_BOOLEAN_AUTO && + (favail || freserved_root || fused || + netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) { + if(unlikely(!m->st_inodes) || m->st_inodes->update_every != update_every) { + m->do_inodes = CONFIG_BOOLEAN_YES; + m->st_inodes = rrdset_find_active_bytype_localhost("disk_inodes", disk); + if(unlikely(!m->st_inodes) || m->st_inodes->update_every != update_every) { + char title[4096 + 1]; + snprintfz(title, 4096, "Disk Files (inodes) Usage"); + m->st_inodes = rrdset_create_localhost( + "disk_inodes" + , disk + , NULL + , family + , "disk.inodes" + , title + , "inodes" + , PLUGIN_DISKSPACE_NAME + , NULL + , NETDATA_CHART_PRIO_DISKSPACE_INODES + , update_every + , RRDSET_TYPE_STACKED + ); + } + + rrdset_update_rrdlabels(m->st_inodes, m->chart_labels); + + m->rd_inodes_avail = rrddim_add(m->st_inodes, "avail", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + m->rd_inodes_used = rrddim_add(m->st_inodes, "used", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + m->rd_inodes_reserved = rrddim_add(m->st_inodes, "reserved_for_root", "reserved for root", 1, 1, RRD_ALGORITHM_ABSOLUTE); + } + else + rrdset_next(m->st_inodes); + + rrddim_set_by_pointer(m->st_inodes, m->rd_inodes_avail, (collected_number)favail); + rrddim_set_by_pointer(m->st_inodes, m->rd_inodes_used, (collected_number)fused); + rrddim_set_by_pointer(m->st_inodes, m->rd_inodes_reserved, (collected_number)freserved_root); + rrdset_done(m->st_inodes); + + rendered++; + } + + // -------------------------------------------------------------------------- + + if(likely(rendered)) + m->collected++; +} + +static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { + const char *disk = mi->persistent_id; + static SIMPLE_PATTERN *excluded_mountpoints = NULL; static SIMPLE_PATTERN *excluded_filesystems = NULL; + + usec_t slow_timeout = MAX_STAT_USEC * update_every; + int do_space, do_inodes; if(unlikely(!dict_mountpoints)) { @@ -139,6 +335,7 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { struct mount_point_metadata *m = dictionary_get(dict_mountpoints, mi->mount_point); if(unlikely(!m)) { + int slow = 0; char var_name[4096 + 1]; snprintfz(var_name, 4096, "plugin:proc:diskspace:%s", mi->mount_point); @@ -158,7 +355,9 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { // check if the mount point is a directory #2407 // but only when it is enabled by default #4491 if(def_space != CONFIG_BOOLEAN_NO || def_inodes != CONFIG_BOOLEAN_NO) { + usec_t start_time = now_monotonic_high_precision_usec(); struct stat bs; + if(stat(mi->mount_point, &bs) == -1) { error("DISKSPACE: Cannot stat() mount point '%s' (disk '%s', filesystem '%s', root '%s')." , mi->mount_point @@ -181,6 +380,9 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { def_inodes = CONFIG_BOOLEAN_NO; } } + + if ((now_monotonic_high_precision_usec() - start_time) > slow_timeout) + slow = 1; } do_space = config_get_boolean_ondemand(var_name, "space usage", def_space); @@ -191,6 +393,7 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { .do_inodes = do_inodes, .shown_error = 0, .updated = 0, + .slow = 0, .collected = 0, @@ -205,7 +408,19 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { .rd_inodes_reserved = NULL }; + mp.chart_labels = rrdlabels_create(); + rrdlabels_add(mp.chart_labels, "mount_point", mi->mount_point, RRDLABEL_SRC_AUTO); + rrdlabels_add(mp.chart_labels, "filesystem", mi->filesystem, RRDLABEL_SRC_AUTO); + rrdlabels_add(mp.chart_labels, "mount_root", mi->root, RRDLABEL_SRC_AUTO); + m = dictionary_set(dict_mountpoints, mi->mount_point, &mp, sizeof(struct mount_point_metadata)); + + m->slow = slow; + } + + if (m->slow) { + add_basic_mountinfo(&slow_mountinfo_tmp_root, mi); + return; } m->updated = 1; @@ -215,13 +430,15 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { if (unlikely( mi->flags & MOUNTINFO_READONLY && - !mount_point_is_protected(mi->mount_point) && + !(mi->flags & MOUNTINFO_IS_IN_SYSD_PROTECTED_LIST) && !m->collected && m->do_space != CONFIG_BOOLEAN_YES && m->do_inodes != CONFIG_BOOLEAN_YES)) return; + usec_t start_time = now_monotonic_high_precision_usec(); struct statvfs buff_statvfs; + if (statvfs(mi->mount_point, &buff_statvfs) < 0) { if(!m->shown_error) { error("DISKSPACE: failed to statvfs() mount point '%s' (disk '%s', filesystem '%s', root '%s')" @@ -234,135 +451,133 @@ static inline void do_disk_space_stats(struct mountinfo *mi, int update_every) { } return; } - m->shown_error = 0; - // logic found at get_fs_usage() in coreutils - unsigned long bsize = (buff_statvfs.f_frsize) ? buff_statvfs.f_frsize : buff_statvfs.f_bsize; + if ((now_monotonic_high_precision_usec() - start_time) > slow_timeout) + m->slow = 1; - fsblkcnt_t bavail = buff_statvfs.f_bavail; - fsblkcnt_t btotal = buff_statvfs.f_blocks; - fsblkcnt_t bavail_root = buff_statvfs.f_bfree; - fsblkcnt_t breserved_root = bavail_root - bavail; - fsblkcnt_t bused; - if(likely(btotal >= bavail_root)) - bused = btotal - bavail_root; - else - bused = bavail_root - btotal; + m->shown_error = 0; -#ifdef NETDATA_INTERNAL_CHECKS - if(unlikely(btotal != bavail + breserved_root + bused)) - error("DISKSPACE: disk block statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)btotal, (unsigned long long)bavail, (unsigned long long)breserved_root, (unsigned long long)bused); -#endif + struct basic_mountinfo bmi; + bmi.mount_point = mi->mount_point; + bmi.persistent_id = mi->persistent_id; + bmi.filesystem = mi->filesystem; + bmi.root = mi->root; - // -------------------------------------------------------------------------- + calculate_values_and_show_charts(&bmi, m, &buff_statvfs, update_every); +} - fsfilcnt_t favail = buff_statvfs.f_favail; - fsfilcnt_t ftotal = buff_statvfs.f_files; - fsfilcnt_t favail_root = buff_statvfs.f_ffree; - fsfilcnt_t freserved_root = favail_root - favail; - fsfilcnt_t fused = ftotal - favail_root; +static inline void do_slow_disk_space_stats(struct basic_mountinfo *mi, int update_every) { + struct mount_point_metadata *m = dictionary_get(dict_mountpoints, mi->mount_point); - if(m->do_inodes == CONFIG_BOOLEAN_AUTO && favail == (fsfilcnt_t)-1) { - // this file system does not support inodes reporting - // eg. cephfs - m->do_inodes = CONFIG_BOOLEAN_NO; + m->updated = 1; + + struct statvfs buff_statvfs; + if (statvfs(mi->mount_point, &buff_statvfs) < 0) { + if(!m->shown_error) { + error("DISKSPACE: failed to statvfs() mount point '%s' (disk '%s', filesystem '%s', root '%s')" + , mi->mount_point + , mi->persistent_id + , mi->filesystem?mi->filesystem:"" + , mi->root?mi->root:"" + ); + m->shown_error = 1; + } + return; } + m->shown_error = 0; -#ifdef NETDATA_INTERNAL_CHECKS - if(unlikely(btotal != bavail + breserved_root + bused)) - error("DISKSPACE: disk inode statistics for '%s' (disk '%s') do not sum up: total = %llu, available = %llu, reserved = %llu, used = %llu", mi->mount_point, disk, (unsigned long long)ftotal, (unsigned long long)favail, (unsigned long long)freserved_root, (unsigned long long)fused); -#endif + calculate_values_and_show_charts(mi, m, &buff_statvfs, update_every); +} - // -------------------------------------------------------------------------- +static void diskspace_slow_worker_cleanup(void *ptr) +{ + UNUSED(ptr); - int rendered = 0; + info("cleaning up..."); - if(m->do_space == CONFIG_BOOLEAN_YES || (m->do_space == CONFIG_BOOLEAN_AUTO && - (bavail || breserved_root || bused || - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) { - if(unlikely(!m->st_space)) { - m->do_space = CONFIG_BOOLEAN_YES; - m->st_space = rrdset_find_active_bytype_localhost("disk_space", disk); - if(unlikely(!m->st_space)) { - char title[4096 + 1]; - snprintfz(title, 4096, "Disk Space Usage"); - m->st_space = rrdset_create_localhost( - "disk_space" - , disk - , NULL - , family - , "disk.space" - , title - , "GiB" - , PLUGIN_DISKSPACE_NAME - , NULL - , NETDATA_CHART_PRIO_DISKSPACE_SPACE - , update_every - , RRDSET_TYPE_STACKED - ); - } + worker_unregister(); +} - m->rd_space_avail = rrddim_add(m->st_space, "avail", NULL, (collected_number)bsize, 1024 * 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); - m->rd_space_used = rrddim_add(m->st_space, "used", NULL, (collected_number)bsize, 1024 * 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); - m->rd_space_reserved = rrddim_add(m->st_space, "reserved_for_root", "reserved for root", (collected_number)bsize, 1024 * 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); - } - else - rrdset_next(m->st_space); +#define WORKER_JOB_SLOW_MOUNTPOINT 0 +#define WORKER_JOB_SLOW_CLEANUP 1 - rrddim_set_by_pointer(m->st_space, m->rd_space_avail, (collected_number)bavail); - rrddim_set_by_pointer(m->st_space, m->rd_space_used, (collected_number)bused); - rrddim_set_by_pointer(m->st_space, m->rd_space_reserved, (collected_number)breserved_root); - rrdset_done(m->st_space); +struct slow_worker_data { + netdata_thread_t *slow_thread; + int update_every; +}; - rendered++; - } +void *diskspace_slow_worker(void *ptr) +{ + struct slow_worker_data *data = (struct slow_worker_data *)ptr; + + worker_register("DISKSPACE_SLOW"); + worker_register_job_name(WORKER_JOB_SLOW_MOUNTPOINT, "mountpoint"); + worker_register_job_name(WORKER_JOB_SLOW_CLEANUP, "cleanup"); - // -------------------------------------------------------------------------- + struct basic_mountinfo *slow_mountinfo_root = NULL; - if(m->do_inodes == CONFIG_BOOLEAN_YES || (m->do_inodes == CONFIG_BOOLEAN_AUTO && - (favail || freserved_root || fused || - netdata_zero_metrics_enabled == CONFIG_BOOLEAN_YES))) { - if(unlikely(!m->st_inodes)) { - m->do_inodes = CONFIG_BOOLEAN_YES; - m->st_inodes = rrdset_find_active_bytype_localhost("disk_inodes", disk); - if(unlikely(!m->st_inodes)) { - char title[4096 + 1]; - snprintfz(title, 4096, "Disk Files (inodes) Usage"); - m->st_inodes = rrdset_create_localhost( - "disk_inodes" - , disk - , NULL - , family - , "disk.inodes" - , title - , "inodes" - , PLUGIN_DISKSPACE_NAME - , NULL - , NETDATA_CHART_PRIO_DISKSPACE_INODES - , update_every - , RRDSET_TYPE_STACKED - ); - } + int slow_update_every = data->update_every > SLOW_UPDATE_EVERY ? data->update_every : SLOW_UPDATE_EVERY; - m->rd_inodes_avail = rrddim_add(m->st_inodes, "avail", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); - m->rd_inodes_used = rrddim_add(m->st_inodes, "used", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); - m->rd_inodes_reserved = rrddim_add(m->st_inodes, "reserved_for_root", "reserved for root", 1, 1, RRD_ALGORITHM_ABSOLUTE); + netdata_thread_cleanup_push(diskspace_slow_worker_cleanup, data->slow_thread); + + usec_t step = slow_update_every * USEC_PER_SEC; + heartbeat_t hb; + heartbeat_init(&hb); + + while(!netdata_exit) { + worker_is_idle(); + heartbeat_next(&hb, step); + + usec_t start_time = now_monotonic_high_precision_usec(); + + if (!dict_mountpoints) + continue; + + if(unlikely(netdata_exit)) break; + + // -------------------------------------------------------------------------- + // disk space metrics + + worker_is_busy(WORKER_JOB_SLOW_MOUNTPOINT); + + netdata_mutex_lock(&slow_mountinfo_mutex); + free_basic_mountinfo_list(slow_mountinfo_root); + slow_mountinfo_root = slow_mountinfo_tmp_root; + slow_mountinfo_tmp_root = NULL; + netdata_mutex_unlock(&slow_mountinfo_mutex); + + struct basic_mountinfo *bmi; + for(bmi = slow_mountinfo_root; bmi; bmi = bmi->next) { + do_slow_disk_space_stats(bmi, slow_update_every); + + if(unlikely(netdata_exit)) break; } - else - rrdset_next(m->st_inodes); - rrddim_set_by_pointer(m->st_inodes, m->rd_inodes_avail, (collected_number)favail); - rrddim_set_by_pointer(m->st_inodes, m->rd_inodes_used, (collected_number)fused); - rrddim_set_by_pointer(m->st_inodes, m->rd_inodes_reserved, (collected_number)freserved_root); - rrdset_done(m->st_inodes); + if(unlikely(netdata_exit)) break; - rendered++; + worker_is_busy(WORKER_JOB_SLOW_CLEANUP); + + for(bmi = slow_mountinfo_root; bmi; bmi = bmi->next) { + struct mount_point_metadata *m = dictionary_get(dict_mountpoints, bmi->mount_point); + + if (m) + mount_point_cleanup(bmi->mount_point, m, 1); + } + + usec_t dt = now_monotonic_high_precision_usec() - start_time; + if (dt > step) { + slow_update_every = (dt / USEC_PER_SEC) * 3 / 2; + if (slow_update_every % SLOW_UPDATE_EVERY) + slow_update_every += SLOW_UPDATE_EVERY - slow_update_every % SLOW_UPDATE_EVERY; + step = slow_update_every * USEC_PER_SEC; + } } - // -------------------------------------------------------------------------- + netdata_thread_cleanup_pop(1); - if(likely(rendered)) - m->collected++; + free_basic_mountinfo_list(slow_mountinfo_root); + + return NULL; } static void diskspace_main_cleanup(void *ptr) { @@ -373,6 +588,13 @@ static void diskspace_main_cleanup(void *ptr) { info("cleaning up..."); + if (diskspace_slow_thread) { + netdata_thread_join(*diskspace_slow_thread, NULL); + freez(diskspace_slow_thread); + } + + free_basic_mountinfo_list(slow_mountinfo_tmp_root); + static_thread->enabled = NETDATA_MAIN_THREAD_EXITED; } @@ -402,6 +624,19 @@ void *diskspace_main(void *ptr) { if(check_for_new_mountpoints_every < update_every) check_for_new_mountpoints_every = update_every; + netdata_mutex_init(&slow_mountinfo_mutex); + + diskspace_slow_thread = mallocz(sizeof(netdata_thread_t)); + + struct slow_worker_data slow_worker_data = {.slow_thread = diskspace_slow_thread, .update_every = update_every}; + + netdata_thread_create( + diskspace_slow_thread, + THREAD_DISKSPACE_SLOW_NAME, + NETDATA_THREAD_OPTION_JOINABLE, + diskspace_slow_worker, + &slow_worker_data); + usec_t step = update_every * USEC_PER_SEC; heartbeat_t hb; heartbeat_init(&hb); @@ -411,7 +646,6 @@ void *diskspace_main(void *ptr) { if(unlikely(netdata_exit)) break; - // -------------------------------------------------------------------------- // this is smart enough not to reload it every time @@ -421,26 +655,31 @@ void *diskspace_main(void *ptr) { // -------------------------------------------------------------------------- // disk space metrics + netdata_mutex_lock(&slow_mountinfo_mutex); + free_basic_mountinfo_list(slow_mountinfo_tmp_root); + slow_mountinfo_tmp_root = NULL; + struct mountinfo *mi; for(mi = disk_mountinfo_root; mi; mi = mi->next) { - if(unlikely(mi->flags & (MOUNTINFO_IS_DUMMY | MOUNTINFO_IS_BIND))) continue; // exclude mounts made by ProtectHome and ProtectSystem systemd hardening options - if(mi->flags & MOUNTINFO_READONLY && !strcmp(mi->root, mi->mount_point)) + // https://github.com/netdata/netdata/issues/11498#issuecomment-950982878 + if(mi->flags & MOUNTINFO_READONLY && mi->flags & MOUNTINFO_IS_IN_SYSD_PROTECTED_LIST && !strcmp(mi->root, mi->mount_point)) continue; worker_is_busy(WORKER_JOB_MOUNTPOINT); do_disk_space_stats(mi, update_every); if(unlikely(netdata_exit)) break; } + netdata_mutex_unlock(&slow_mountinfo_mutex); if(unlikely(netdata_exit)) break; if(dict_mountpoints) { worker_is_busy(WORKER_JOB_CLEANUP); - dictionary_walkthrough_read(dict_mountpoints, mount_point_cleanup, NULL); + dictionary_walkthrough_read(dict_mountpoints, mount_point_cleanup_cb, NULL); } } diff --git a/collectors/ebpf.plugin/README.md b/collectors/ebpf.plugin/README.md index dc406b7f8..550982ad2 100644 --- a/collectors/ebpf.plugin/README.md +++ b/collectors/ebpf.plugin/README.md @@ -8,7 +8,7 @@ sidebar_label: "eBPF" # eBPF monitoring with Netdata -The Netdata Agent provides many [eBPF](https://ebpf.io/what-is-ebpf/) programs to help you troubleshoot and debug how applications interact with the Linux kernel. The `ebpf.plugin` uses [tracepoints, trampoline, and2 kprobes](#data-collection) to collect a wide array of high value data about the host that would otherwise be impossible to capture. +The Netdata Agent provides many [eBPF](https://ebpf.io/what-is-ebpf/) programs to help you troubleshoot and debug how applications interact with the Linux kernel. The `ebpf.plugin` uses [tracepoints, trampoline, and2 kprobes](#how-netdata-collects-data-using-probes-and-tracepoints) to collect a wide array of high value data about the host that would otherwise be impossible to capture. > ❗ eBPF monitoring only works on Linux systems and with specific Linux kernels, including all kernels newer than `4.11.0`, and all kernels on CentOS 7.6 or later. For kernels older than `4.11.0`, improved support is in active development. @@ -20,8 +20,6 @@ For hands-on configuration and troubleshooting tips see our [tutorial on trouble

An example of virtual file system (VFS) charts made possible by the eBPF collector plugin.
- - ## How Netdata collects data using probes and tracepoints Netdata uses the following features from the Linux kernel to run eBPF programs: diff --git a/collectors/ebpf.plugin/ebpf.c b/collectors/ebpf.plugin/ebpf.c index 2b25f50a3..65c96f672 100644 --- a/collectors/ebpf.plugin/ebpf.c +++ b/collectors/ebpf.plugin/ebpf.c @@ -18,8 +18,6 @@ char *ebpf_plugin_dir = PLUGINS_DIR; static char *ebpf_configured_log_dir = LOG_DIR; char *ebpf_algorithms[] = {"absolute", "incremental"}; -static int thread_finished = 0; -int close_ebpf_plugin = 0; struct config collector_config = { .first_section = NULL, .last_section = NULL, .mutex = NETDATA_MUTEX_INITIALIZER, @@ -29,7 +27,6 @@ struct config collector_config = { .first_section = NULL, int running_on_kernel = 0; int ebpf_nprocs; int isrh = 0; -uint32_t finalized_threads = 1; pthread_mutex_t lock; pthread_mutex_t collect_data_mutex; @@ -37,132 +34,264 @@ pthread_cond_t collect_data_cond_var; ebpf_module_t ebpf_modules[] = { { .thread_name = "process", .config_name = "process", .enabled = 0, .start_routine = ebpf_process_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_process_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &process_config, .config_file = NETDATA_PROCESS_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = "socket", .config_name = "socket", .enabled = 0, .start_routine = ebpf_socket_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_socket_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &socket_config, .config_file = NETDATA_NETWORK_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = socket_targets}, + .load = EBPF_LOAD_LEGACY, .targets = socket_targets, .probe_links = NULL, .objects = NULL}, { .thread_name = "cachestat", .config_name = "cachestat", .enabled = 0, .start_routine = ebpf_cachestat_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_cachestat_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &cachestat_config, .config_file = NETDATA_CACHESTAT_CONFIG_FILE, - .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18| - NETDATA_V5_4 | NETDATA_V5_15 | NETDATA_V5_16, - .load = EBPF_LOAD_LEGACY, .targets = cachestat_targets}, + .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18| NETDATA_V5_4 | NETDATA_V5_15 | + NETDATA_V5_16, + .load = EBPF_LOAD_LEGACY, .targets = cachestat_targets, .probe_links = NULL, .objects = NULL}, { .thread_name = "sync", .config_name = "sync", .enabled = 0, .start_routine = ebpf_sync_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &sync_config, .config_file = NETDATA_SYNC_CONFIG_FILE, // All syscalls have the same kernels .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = sync_targets}, + .load = EBPF_LOAD_LEGACY, .targets = sync_targets, .probe_links = NULL, .objects = NULL}, { .thread_name = "dc", .config_name = "dc", .enabled = 0, .start_routine = ebpf_dcstat_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_dcstat_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &dcstat_config, .config_file = NETDATA_DIRECTORY_DCSTAT_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = dc_targets}, + .load = EBPF_LOAD_LEGACY, .targets = dc_targets, .probe_links = NULL, .objects = NULL}, { .thread_name = "swap", .config_name = "swap", .enabled = 0, .start_routine = ebpf_swap_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_swap_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &swap_config, .config_file = NETDATA_DIRECTORY_SWAP_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = swap_targets}, + .load = EBPF_LOAD_LEGACY, .targets = swap_targets, .probe_links = NULL, .objects = NULL}, { .thread_name = "vfs", .config_name = "vfs", .enabled = 0, .start_routine = ebpf_vfs_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_vfs_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &vfs_config, .config_file = NETDATA_DIRECTORY_VFS_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = "filesystem", .config_name = "filesystem", .enabled = 0, .start_routine = ebpf_filesystem_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &fs_config, .config_file = NETDATA_FILESYSTEM_CONFIG_FILE, //We are setting kernels as zero, because we load eBPF programs according the kernel running. - .kernels = 0, .load = EBPF_LOAD_LEGACY, .targets = NULL }, + .kernels = 0, .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL }, { .thread_name = "disk", .config_name = "disk", .enabled = 0, .start_routine = ebpf_disk_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &disk_config, .config_file = NETDATA_DISK_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = "mount", .config_name = "mount", .enabled = 0, .start_routine = ebpf_mount_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &mount_config, .config_file = NETDATA_MOUNT_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = mount_targets}, + .load = EBPF_LOAD_LEGACY, .targets = mount_targets, .probe_links = NULL, .objects = NULL}, { .thread_name = "fd", .config_name = "fd", .enabled = 0, .start_routine = ebpf_fd_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_fd_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &fd_config, .config_file = NETDATA_FD_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_11, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = "hardirq", .config_name = "hardirq", .enabled = 0, .start_routine = ebpf_hardirq_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &hardirq_config, .config_file = NETDATA_HARDIRQ_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = "softirq", .config_name = "softirq", .enabled = 0, .start_routine = ebpf_softirq_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &softirq_config, .config_file = NETDATA_SOFTIRQ_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = "oomkill", .config_name = "oomkill", .enabled = 0, .start_routine = ebpf_oomkill_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_oomkill_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &oomkill_config, .config_file = NETDATA_OOMKILL_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = "shm", .config_name = "shm", .enabled = 0, .start_routine = ebpf_shm_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = ebpf_shm_create_apps_charts, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &shm_config, .config_file = NETDATA_DIRECTORY_SHM_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = shm_targets}, + .load = EBPF_LOAD_LEGACY, .targets = shm_targets, .probe_links = NULL, .objects = NULL}, { .thread_name = "mdflush", .config_name = "mdflush", .enabled = 0, .start_routine = ebpf_mdflush_thread, - .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = CONFIG_BOOLEAN_NO, + .update_every = EBPF_DEFAULT_UPDATE_EVERY, .global_charts = 1, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = ND_EBPF_DEFAULT_PID_SIZE, .names = NULL, .cfg = &mdflush_config, .config_file = NETDATA_DIRECTORY_MDFLUSH_CONFIG_FILE, .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4, - .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, .objects = NULL}, { .thread_name = NULL, .enabled = 0, .start_routine = NULL, .update_every = EBPF_DEFAULT_UPDATE_EVERY, - .global_charts = 0, .apps_charts = CONFIG_BOOLEAN_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, + .global_charts = 0, .apps_charts = NETDATA_EBPF_APPS_FLAG_NO, .cgroup_charts = CONFIG_BOOLEAN_NO, .mode = MODE_ENTRY, .optional = 0, .apps_routine = NULL, .maps = NULL, .pid_map_size = 0, .names = NULL, - .cfg = NULL, .config_name = NULL, .kernels = 0, .load = EBPF_LOAD_LEGACY, .targets = NULL}, + .cfg = NULL, .config_name = NULL, .kernels = 0, .load = EBPF_LOAD_LEGACY, .targets = NULL, .probe_links = NULL, + .objects = NULL}, +}; + +struct netdata_static_thread ebpf_threads[] = { + {"EBPF PROCESS", NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF SOCKET" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF CACHESTAT" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF SYNC" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF DCSTAT" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF SWAP" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF VFS" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF FILESYSTEM" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF DISK" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF MOUNT" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF FD" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF HARDIRQ" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF SOFTIRQ" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF OOMKILL" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF SHM" , NULL, NULL, 1, + NULL, NULL, NULL}, + {"EBPF MDFLUSH" , NULL, NULL, 1, + NULL, NULL, NULL}, + {NULL , NULL, NULL, 0, + NULL, NULL, NULL} +}; + +ebpf_filesystem_partitions_t localfs[] = + {{.filesystem = "ext4", + .optional_filesystem = NULL, + .family = "ext4", + .objects = NULL, + .probe_links = NULL, + .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, + .enabled = CONFIG_BOOLEAN_YES, + .addresses = {.function = NULL, .addr = 0}, + .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, + {.filesystem = "xfs", + .optional_filesystem = NULL, + .family = "xfs", + .objects = NULL, + .probe_links = NULL, + .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, + .enabled = CONFIG_BOOLEAN_YES, + .addresses = {.function = NULL, .addr = 0}, + .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, + {.filesystem = "nfs", + .optional_filesystem = "nfs4", + .family = "nfs", + .objects = NULL, + .probe_links = NULL, + .flags = NETDATA_FILESYSTEM_ATTR_CHARTS, + .enabled = CONFIG_BOOLEAN_YES, + .addresses = {.function = NULL, .addr = 0}, + .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, + {.filesystem = "zfs", + .optional_filesystem = NULL, + .family = "zfs", + .objects = NULL, + .probe_links = NULL, + .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, + .enabled = CONFIG_BOOLEAN_YES, + .addresses = {.function = NULL, .addr = 0}, + .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, + {.filesystem = "btrfs", + .optional_filesystem = NULL, + .family = "btrfs", + .objects = NULL, + .probe_links = NULL, + .flags = NETDATA_FILESYSTEM_FILL_ADDRESS_TABLE, + .enabled = CONFIG_BOOLEAN_YES, + .addresses = {.function = "btrfs_file_operations", .addr = 0}, + .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10}, + {.filesystem = NULL, + .optional_filesystem = NULL, + .family = NULL, + .objects = NULL, + .probe_links = NULL, + .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, + .enabled = CONFIG_BOOLEAN_YES, + .addresses = {.function = NULL, .addr = 0}, + .kernels = 0}}; + +ebpf_sync_syscalls_t local_syscalls[] = { + {.syscall = NETDATA_SYSCALLS_SYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, +#ifdef LIBBPF_MAJOR_VERSION + .sync_obj = NULL +#endif + }, + {.syscall = NETDATA_SYSCALLS_SYNCFS, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, +#ifdef LIBBPF_MAJOR_VERSION + .sync_obj = NULL +#endif + }, + {.syscall = NETDATA_SYSCALLS_MSYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, +#ifdef LIBBPF_MAJOR_VERSION + .sync_obj = NULL +#endif + }, + {.syscall = NETDATA_SYSCALLS_FSYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, +#ifdef LIBBPF_MAJOR_VERSION + .sync_obj = NULL +#endif + }, + {.syscall = NETDATA_SYSCALLS_FDATASYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, +#ifdef LIBBPF_MAJOR_VERSION + .sync_obj = NULL +#endif + }, + {.syscall = NETDATA_SYSCALLS_SYNC_FILE_RANGE, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, +#ifdef LIBBPF_MAJOR_VERSION + .sync_obj = NULL +#endif + }, + {.syscall = NULL, .enabled = CONFIG_BOOLEAN_NO, .objects = NULL, .probe_links = NULL, +#ifdef LIBBPF_MAJOR_VERSION + .sync_obj = NULL +#endif + } }; // Link with apps.plugin @@ -192,18 +321,6 @@ char *btf_path = NULL; * *****************************************************************/ -/** - * Clean Loaded Events - * - * This function cleans the events previous loaded on Linux. -void clean_loaded_events() -{ - int event_pid; - for (event_pid = 0; ebpf_modules[event_pid].probes; event_pid++) - clean_kprobe_events(NULL, (int)ebpf_modules[event_pid].thread_id, ebpf_modules[event_pid].probes); -} - */ - /** * Close the collector gracefully * @@ -211,107 +328,89 @@ void clean_loaded_events() */ static void ebpf_exit(int sig) { - close_ebpf_plugin = 1; - static int remove_pid = 0; - - // When both threads were not finished case I try to go in front this address, the collector will crash - if (!thread_finished) { - return; - } - - if (ebpf_modules[EBPF_MODULE_SOCKET_IDX].enabled) { - ebpf_modules[EBPF_MODULE_SOCKET_IDX].enabled = 0; - clean_socket_apps_structures(); - freez(socket_bandwidth_curr); +#ifdef LIBBPF_MAJOR_VERSION + if (default_btf) { + btf__free(default_btf); + default_btf = NULL; } +#endif - if (ebpf_modules[EBPF_MODULE_CACHESTAT_IDX].enabled) { - ebpf_modules[EBPF_MODULE_CACHESTAT_IDX].enabled = 0; - clean_cachestat_pid_structures(); - freez(cachestat_pid); - } + char filename[FILENAME_MAX + 1]; + ebpf_pid_file(filename, FILENAME_MAX); + if (unlink(filename)) + error("Cannot remove PID file %s", filename); - if (ebpf_modules[EBPF_MODULE_DCSTAT_IDX].enabled) { - ebpf_modules[EBPF_MODULE_DCSTAT_IDX].enabled = 0; - clean_dcstat_pid_structures(); - freez(dcstat_pid); - } + exit(sig); +} - if (ebpf_modules[EBPF_MODULE_SWAP_IDX].enabled) { - ebpf_modules[EBPF_MODULE_SWAP_IDX].enabled = 0; - clean_swap_pid_structures(); - freez(swap_pid); - } +/** + * Unload loegacy code + * + * @param objects objects loaded from eBPF programs + * @param probe_links links from loader + */ +static void ebpf_unload_legacy_code(struct bpf_object *objects, struct bpf_link **probe_links) +{ + if (!probe_links || !objects) + return; - if (ebpf_modules[EBPF_MODULE_VFS_IDX].enabled) { - ebpf_modules[EBPF_MODULE_VFS_IDX].enabled = 0; - clean_vfs_pid_structures(); - freez(vfs_pid); + struct bpf_program *prog; + size_t j = 0 ; + bpf_object__for_each_program(prog, objects) { + bpf_link__destroy(probe_links[j]); + j++; } + freez(probe_links); + if (objects) + bpf_object__close(objects); +} - if (ebpf_modules[EBPF_MODULE_FD_IDX].enabled) { - ebpf_modules[EBPF_MODULE_FD_IDX].enabled = 0; - clean_fd_pid_structures(); - freez(fd_pid); +int ebpf_exit_plugin = 0; +/** + * Close the collector gracefully + * + * @param sig is the signal number used to close the collector + */ +static void ebpf_stop_threads(int sig) +{ + ebpf_exit_plugin = 1; + int i; + for (i = 0; ebpf_threads[i].name != NULL; i++); + + usec_t max = 2 * USEC_PER_SEC, step = 100000; + while (i && max) { + max -= step; + sleep_usec(step); + i = 0; + int j; + for (j = 0; ebpf_threads[j].name != NULL; j++) { + if (ebpf_threads[j].enabled != NETDATA_MAIN_THREAD_EXITED) + i++; + } } - if (ebpf_modules[EBPF_MODULE_SHM_IDX].enabled) { - ebpf_modules[EBPF_MODULE_SHM_IDX].enabled = 0; - clean_shm_pid_structures(); - freez(shm_pid); + //Unload threads(except sync and filesystem) + for (i = 0; ebpf_threads[i].name != NULL; i++) { + if (ebpf_threads[i].enabled == NETDATA_MAIN_THREAD_EXITED && i != EBPF_MODULE_FILESYSTEM_IDX && + i != EBPF_MODULE_SYNC_IDX) + ebpf_unload_legacy_code(ebpf_modules[i].objects, ebpf_modules[i].probe_links); } - ebpf_close_cgroup_shm(); - - ebpf_clean_cgroup_pids(); - /* - int ret = fork(); - if (ret < 0) // error - error("Cannot fork(), so I won't be able to clean %skprobe_events", NETDATA_DEBUGFS); - else if (!ret) { // child - int i; - for (i = getdtablesize(); i >= 0; --i) - close(i); - - int fd = open("/dev/null", O_RDWR, 0); - if (fd != -1) { - dup2(fd, STDIN_FILENO); - dup2(fd, STDOUT_FILENO); - dup2(fd, STDERR_FILENO); - } - - if (fd > 2) - close(fd); - - int sid = setsid(); - if (sid >= 0) { - debug(D_EXIT, "Wait for father %d die", getpid()); - sleep_usec(200000); // Sleep 200 milliseconds to father dies. - clean_loaded_events(); - } else { - error("Cannot become session id leader, so I won't try to clean kprobe_events.\n"); + //Unload filesystem + if (ebpf_threads[EBPF_MODULE_FILESYSTEM_IDX].enabled == NETDATA_MAIN_THREAD_EXITED) { + for (i = 0; localfs[i].filesystem != NULL; i++) { + ebpf_unload_legacy_code(localfs[i].objects, localfs[i].probe_links); } - } else { // parent - exit(0); - } - */ - -#ifdef LIBBPF_MAJOR_VERSION - if (default_btf) { - btf__free(default_btf); - default_btf = NULL; } -#endif - if (!remove_pid) { - remove_pid = 1; - char filename[FILENAME_MAX + 1]; - ebpf_pid_file(filename, FILENAME_MAX); - if (unlink(filename)) - error("Cannot remove PID file %s", filename); + //Unload Sync + if (ebpf_threads[EBPF_MODULE_SYNC_IDX].enabled == NETDATA_MAIN_THREAD_EXITED) { + for (i = 0; local_syscalls[i].syscall != NULL; i++) { + ebpf_unload_legacy_code(local_syscalls[i].objects, local_syscalls[i].probe_links); + } } - exit(sig); + ebpf_exit(sig); } /***************************************************************** @@ -702,7 +801,7 @@ static inline void ebpf_enable_specific_chart(struct ebpf_module *em, int disabl // oomkill stores data inside apps submenu, so it always need to have apps_enabled for plugin to create // its chart, without this comparison eBPF.plugin will try to store invalid data when apps is disabled. if (!disable_apps || !strcmp(em->thread_name, "oomkill")) { - em->apps_charts = CONFIG_BOOLEAN_YES; + em->apps_charts = NETDATA_EBPF_APPS_FLAG_YES; } if (!disable_cgroup) { @@ -767,7 +866,7 @@ static inline void ebpf_disable_apps() { int i; for (i = 0; ebpf_modules[i].thread_name; i++) { - ebpf_modules[i].apps_charts = 0; + ebpf_modules[i].apps_charts = NETDATA_EBPF_APPS_FLAG_NO; } } @@ -1074,7 +1173,6 @@ int ebpf_start_pthread_variables() pthread_mutex_init(&collect_data_mutex, NULL); if (pthread_cond_init(&collect_data_cond_var, NULL)) { - thread_finished++; error("Cannot start conditional variable to control Apps charts."); return -1; } @@ -1094,7 +1192,7 @@ static inline uint32_t ebpf_am_i_collect_pids() uint32_t ret = 0; int i; for (i = 0; ebpf_modules[i].thread_name; i++) { - ret |= ebpf_modules[i].cgroup_charts | ebpf_modules[i].apps_charts; + ret |= ebpf_modules[i].cgroup_charts | (ebpf_modules[i].apps_charts & NETDATA_EBPF_APPS_FLAG_YES); } return ret; @@ -1718,7 +1816,6 @@ static void ebpf_parse_args(int argc, char **argv) &apps_groups_default_target, &apps_groups_root_target, ebpf_stock_config_dir, "groups")) { error("Cannot read process groups '%s/apps_groups.conf'. There are no internal defaults. Failing.", ebpf_stock_config_dir); - thread_finished++; ebpf_exit(1); } } else @@ -1874,6 +1971,19 @@ static void ebpf_manage_pid(pid_t pid) ebpf_update_pid_file(filename, pid); } +/** + * Set start routine + * + * Set static routine before threads to be created. + */ + static void ebpf_set_static_routine() + { + int i; + for (i = 0; ebpf_modules[i].thread_name; i++) { + ebpf_threads[i].start_routine = ebpf_modules[i].start_routine; + } + } + /** * Entry point * @@ -1918,16 +2028,19 @@ int main(int argc, char **argv) return 4; } - signal(SIGINT, ebpf_exit); - signal(SIGTERM, ebpf_exit); - signal(SIGPIPE, ebpf_exit); + signal(SIGINT, ebpf_stop_threads); + signal(SIGQUIT, ebpf_stop_threads); + signal(SIGTERM, ebpf_stop_threads); + signal(SIGPIPE, ebpf_stop_threads); if (ebpf_start_pthread_variables()) { - thread_finished++; error("Cannot start mutex to control overall charts."); ebpf_exit(5); } + netdata_configured_host_prefix = getenv("NETDATA_HOST_PREFIX"); + if(verify_netdata_host_prefix() == -1) ebpf_exit(6); + ebpf_allocate_common_vectors(); #ifdef LIBBPF_MAJOR_VERSION @@ -1940,44 +2053,7 @@ int main(int argc, char **argv) read_local_ports("/proc/net/udp", IPPROTO_UDP); read_local_ports("/proc/net/udp6", IPPROTO_UDP); - struct netdata_static_thread ebpf_threads[] = { - {"EBPF PROCESS", NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_PROCESS_IDX].start_routine}, - {"EBPF SOCKET" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_SOCKET_IDX].start_routine}, - {"EBPF CACHESTAT" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_CACHESTAT_IDX].start_routine}, - {"EBPF SYNC" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_SYNC_IDX].start_routine}, - {"EBPF DCSTAT" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_DCSTAT_IDX].start_routine}, - {"EBPF SWAP" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_SWAP_IDX].start_routine}, - {"EBPF VFS" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_VFS_IDX].start_routine}, - {"EBPF FILESYSTEM" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_FILESYSTEM_IDX].start_routine}, - {"EBPF DISK" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_DISK_IDX].start_routine}, - {"EBPF MOUNT" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_MOUNT_IDX].start_routine}, - {"EBPF FD" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_FD_IDX].start_routine}, - {"EBPF HARDIRQ" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_HARDIRQ_IDX].start_routine}, - {"EBPF SOFTIRQ" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_SOFTIRQ_IDX].start_routine}, - {"EBPF OOMKILL" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_OOMKILL_IDX].start_routine}, - {"EBPF SHM" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_SHM_IDX].start_routine}, - {"EBPF MDFLUSH" , NULL, NULL, 1, - NULL, NULL, ebpf_modules[EBPF_MODULE_MDFLUSH_IDX].start_routine}, - {NULL , NULL, NULL, 0, - NULL, NULL, NULL} - }; - - //clean_loaded_events(); + ebpf_set_static_routine(); int i; for (i = 0; ebpf_threads[i].name != NULL; i++) { @@ -1986,16 +2062,16 @@ int main(int argc, char **argv) ebpf_module_t *em = &ebpf_modules[i]; em->thread_id = i; - netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_JOINABLE, st->start_routine, em); + netdata_thread_create(st->thread, st->name, NETDATA_THREAD_OPTION_DEFAULT, st->start_routine, em); } - for (i = 0; ebpf_threads[i].name != NULL; i++) { - struct netdata_static_thread *st = &ebpf_threads[i]; - netdata_thread_join(*st->thread, NULL); + usec_t step = 60 * USEC_PER_SEC; + heartbeat_t hb; + heartbeat_init(&hb); + //Plugin will be killed when it receives a signal + for (;;) { + (void)heartbeat_next(&hb, step); } - thread_finished++; - ebpf_exit(0); - return 0; } diff --git a/collectors/ebpf.plugin/ebpf.h b/collectors/ebpf.plugin/ebpf.h index 337e4f471..c23ca332d 100644 --- a/collectors/ebpf.plugin/ebpf.h +++ b/collectors/ebpf.plugin/ebpf.h @@ -108,6 +108,12 @@ typedef struct ebpf_tracepoint { char *event; } ebpf_tracepoint_t; +enum ebpf_threads_status { + NETDATA_THREAD_EBPF_RUNNING, + NETDATA_THREAD_EBPF_STOPPING, + NETDATA_THREAD_EBPF_STOPPED +}; + // Copied from musl header #ifndef offsetof #if __GNUC__ > 3 @@ -162,7 +168,6 @@ extern void *ebpf_socket_thread(void *ptr); // Common variables extern pthread_mutex_t lock; -extern int close_ebpf_plugin; extern int ebpf_nprocs; extern int running_on_kernel; extern int isrh; @@ -265,7 +270,6 @@ extern int shm_fd_ebpf_cgroup; extern sem_t *shm_sem_ebpf_cgroup; extern pthread_mutex_t mutex_cgroup_shm; extern size_t all_pids_count; -extern uint32_t finalized_threads; extern ebpf_plugin_stats_t plugin_statistics; extern struct btf *default_btf; @@ -281,6 +285,9 @@ extern void ebpf_write_chart_obsolete(char *type, char *id, char *title, char *u char *charttype, char *context, int order, int update_every); extern void write_histogram_chart(char *family, char *name, const netdata_idx_t *hist, char **dimensions, uint32_t end); void ebpf_update_disabled_plugin_stats(ebpf_module_t *em); +extern ebpf_filesystem_partitions_t localfs[]; +extern ebpf_sync_syscalls_t local_syscalls[]; +extern int ebpf_exit_plugin; #define EBPF_MAX_SYNCHRONIZATION_TIME 300 diff --git a/collectors/ebpf.plugin/ebpf_apps.c b/collectors/ebpf.plugin/ebpf_apps.c index 2c65db8d1..7519e0640 100644 --- a/collectors/ebpf.plugin/ebpf_apps.c +++ b/collectors/ebpf.plugin/ebpf_apps.c @@ -134,7 +134,7 @@ size_t zero_all_targets(struct target *root) while (pid_on_target) { struct pid_on_target *pid_on_target_to_free = pid_on_target; pid_on_target = pid_on_target->next; - free(pid_on_target_to_free); + freez(pid_on_target_to_free); } w->root_pid = NULL; @@ -1119,7 +1119,7 @@ void collect_data_for_all_processes(int tbl_pid_stats_fd) key = pids->pid; ebpf_process_stat_t *w = global_process_stats[key]; if (!w) { - w = mallocz(sizeof(ebpf_process_stat_t)); + w = callocz(1, sizeof(ebpf_process_stat_t)); global_process_stats[key] = w; } diff --git a/collectors/ebpf.plugin/ebpf_apps.h b/collectors/ebpf.plugin/ebpf_apps.h index 259e642ad..f65a137b5 100644 --- a/collectors/ebpf.plugin/ebpf_apps.h +++ b/collectors/ebpf.plugin/ebpf_apps.h @@ -433,8 +433,6 @@ extern size_t read_bandwidth_statistic_using_pid_on_target(ebpf_bandwidth_t **ep extern void collect_data_for_all_processes(int tbl_pid_stats_fd); -extern void clean_global_memory(); - extern ebpf_process_stat_t **global_process_stats; extern ebpf_process_publish_apps_t **current_apps_data; extern netdata_publish_cachestat_t **cachestat_pid; diff --git a/collectors/ebpf.plugin/ebpf_cachestat.c b/collectors/ebpf.plugin/ebpf_cachestat.c index b565f635f..14669bf68 100644 --- a/collectors/ebpf.plugin/ebpf_cachestat.c +++ b/collectors/ebpf.plugin/ebpf_cachestat.c @@ -5,9 +5,6 @@ netdata_publish_cachestat_t **cachestat_pid; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - static char *cachestat_counter_dimension_name[NETDATA_CACHESTAT_END] = { "ratio", "dirty", "hit", "miss" }; static netdata_syscall_stat_t cachestat_counter_aggregated_data[NETDATA_CACHESTAT_END]; @@ -18,8 +15,6 @@ netdata_cachestat_pid_t *cachestat_vector = NULL; static netdata_idx_t cachestat_hash_values[NETDATA_CACHESTAT_END]; static netdata_idx_t *cachestat_values = NULL; -static int read_thread_closed = 1; - struct netdata_static_thread cachestat_threads = {"CACHESTAT KERNEL", NULL, NULL, 1, NULL, NULL, NULL}; @@ -44,6 +39,7 @@ struct config cachestat_config = { .first_section = NULL, .mutex = NETDATA_MUTEX_INITIALIZER, .index = { .avl_tree = { .root = NULL, .compar = appconfig_section_compare }, .rwlock = AVL_LOCK_INITIALIZER } }; +static enum ebpf_threads_status ebpf_cachestat_exited = NETDATA_THREAD_EBPF_RUNNING; netdata_ebpf_targets_t cachestat_targets[] = { {.name = "add_to_page_cache_lru", .mode = EBPF_LOAD_TRAMPOLINE}, {.name = "mark_page_accessed", .mode = EBPF_LOAD_TRAMPOLINE}, @@ -294,56 +290,48 @@ static inline int ebpf_cachestat_load_and_attach(struct cachestat_bpf *obj, ebpf *****************************************************************/ /** - * Clean PID structures + * Cachestat exit. * - * Clean the allocated structures. + * Cancel child and exit. + * + * @param ptr thread data. */ -void clean_cachestat_pid_structures() { - struct pid_stat *pids = root_of_pids; - while (pids) { - freez(cachestat_pid[pids->pid]); - - pids = pids->next; +static void ebpf_cachestat_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; } + + ebpf_cachestat_exited = NETDATA_THREAD_EBPF_STOPPING; } /** - * Clean up the main thread. + * Cachestat cleanup + * + * Clean up allocated addresses. * * @param ptr thread data. */ static void ebpf_cachestat_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (ebpf_cachestat_exited != NETDATA_THREAD_EBPF_STOPPED) return; - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2*USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - ebpf_cleanup_publish_syscall(cachestat_counter_publish_aggregated); freez(cachestat_vector); freez(cachestat_values); + freez(cachestat_threads.thread); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } #ifdef LIBBPF_MAJOR_VERSION - else if (bpf_obj) + if (bpf_obj) cachestat_bpf__destroy(bpf_obj); #endif + cachestat_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -367,23 +355,23 @@ void cachestat_update_publish(netdata_publish_cachestat_t *out, uint64_t mpa, ui uint64_t apcl, uint64_t apd) { // Adapted algorithm from https://github.com/iovisor/bcc/blob/master/tools/cachestat.py#L126-L138 - calculated_number total = (calculated_number) (((long long)mpa) - ((long long)mbd)); + NETDATA_DOUBLE total = (NETDATA_DOUBLE) (((long long)mpa) - ((long long)mbd)); if (total < 0) total = 0; - calculated_number misses = (calculated_number) ( ((long long) apcl) - ((long long) apd) ); + NETDATA_DOUBLE misses = (NETDATA_DOUBLE) ( ((long long) apcl) - ((long long) apd) ); if (misses < 0) misses = 0; // If hits are < 0, then its possible misses are overestimate due to possibly page cache read ahead adding // more pages than needed. In this case just assume misses as total and reset hits. - calculated_number hits = total - misses; + NETDATA_DOUBLE hits = total - misses; if (hits < 0 ) { misses = total; hits = 0; } - calculated_number ratio = (total > 0) ? hits/total : 1; + NETDATA_DOUBLE ratio = (total > 0) ? hits/total : 1; out->ratio = (long long )(ratio*100); out->hit = (long long)hits; @@ -607,6 +595,8 @@ void ebpf_cachestat_create_apps_charts(struct ebpf_module *em, void *ptr) 20093, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_CACHESTAT); + + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /***************************************************************** @@ -652,22 +642,25 @@ static void read_global_table() */ void *ebpf_cachestat_read_hash(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(ebpf_cachestat_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_LATENCY_CACHESTAT_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_cachestat_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_cachestat_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_cachestat_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -892,7 +885,7 @@ static int ebpf_send_systemd_cachestat_charts() for (ect = ebpf_cgroup_pids; ect; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, (long long)ect->publish_cachestat.ratio); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -1081,43 +1074,44 @@ void ebpf_cachestat_send_cgroup_data(int update_every) */ static void cachestat_collector(ebpf_module_t *em) { - cachestat_threads.thread = mallocz(sizeof(netdata_thread_t)); + cachestat_threads.thread = callocz(1, sizeof(netdata_thread_t)); cachestat_threads.start_routine = ebpf_cachestat_read_hash; - netdata_thread_create(cachestat_threads.thread, cachestat_threads.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(cachestat_threads.thread, cachestat_threads.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_cachestat_read_hash, em); netdata_publish_cachestat_t publish; memset(&publish, 0, sizeof(publish)); - int apps = em->apps_charts; int cgroups = em->cgroup_charts; int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = update_every * USEC_PER_SEC; + //This will be cancelled by its parent + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; + + netdata_apps_integration_flags_t apps = em->apps_charts; pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - if (apps) - read_apps_table(); + if (apps) + read_apps_table(); - if (cgroups) - ebpf_update_cachestat_cgroup(); + if (cgroups) + ebpf_update_cachestat_cgroup(); - pthread_mutex_lock(&lock); + pthread_mutex_lock(&lock); - cachestat_send_global(&publish); + cachestat_send_global(&publish); - if (apps) - ebpf_cache_send_apps_data(apps_groups_root_target); + if (apps & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) + ebpf_cache_send_apps_data(apps_groups_root_target); - if (cgroups) - ebpf_cachestat_send_cgroup_data(update_every); - - pthread_mutex_unlock(&lock); - } + if (cgroups) + ebpf_cachestat_send_cgroup_data(update_every); + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } @@ -1234,8 +1228,8 @@ static int ebpf_cachestat_load_bpf(ebpf_module_t *em) { int ret = 0; if (em->load == EBPF_LOAD_LEGACY) { - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { ret = -1; } } @@ -1266,7 +1260,7 @@ static int ebpf_cachestat_load_bpf(ebpf_module_t *em) */ void *ebpf_cachestat_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_cachestat_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_cachestat_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = cachestat_maps; diff --git a/collectors/ebpf.plugin/ebpf_cachestat.h b/collectors/ebpf.plugin/ebpf_cachestat.h index b386e383c..fdd88464a 100644 --- a/collectors/ebpf.plugin/ebpf_cachestat.h +++ b/collectors/ebpf.plugin/ebpf_cachestat.h @@ -82,7 +82,6 @@ typedef struct netdata_publish_cachestat { } netdata_publish_cachestat_t; extern void *ebpf_cachestat_thread(void *ptr); -extern void clean_cachestat_pid_structures(); extern struct config cachestat_config; extern netdata_ebpf_targets_t cachestat_targets[]; diff --git a/collectors/ebpf.plugin/ebpf_cgroup.c b/collectors/ebpf.plugin/ebpf_cgroup.c index e6b483baf..24469c642 100644 --- a/collectors/ebpf.plugin/ebpf_cgroup.c +++ b/collectors/ebpf.plugin/ebpf_cgroup.c @@ -133,26 +133,6 @@ static inline void ebpf_clean_specific_cgroup_pids(struct pid_on_target2 *pt) } } -/** - * Cleanup link list - */ -void ebpf_clean_cgroup_pids() -{ - if (!ebpf_cgroup_pids) - return; - - ebpf_cgroup_target_t *ect = ebpf_cgroup_pids; - while (ect) { - ebpf_cgroup_target_t *next_cgroup = ect->next; - - ebpf_clean_specific_cgroup_pids(ect->pids); - freez(ect); - - ect = next_cgroup; - } - ebpf_cgroup_pids = NULL; -} - /** * Remove Cgroup Update Target Update List * diff --git a/collectors/ebpf.plugin/ebpf_cgroup.h b/collectors/ebpf.plugin/ebpf_cgroup.h index 03969194a..cca9a950d 100644 --- a/collectors/ebpf.plugin/ebpf_cgroup.h +++ b/collectors/ebpf.plugin/ebpf_cgroup.h @@ -63,7 +63,6 @@ typedef struct ebpf_cgroup_target { extern void ebpf_map_cgroup_shared_memory(); extern void ebpf_parse_cgroup_shm_data(); extern void ebpf_close_cgroup_shm(); -extern void ebpf_clean_cgroup_pids(); extern void ebpf_create_charts_on_systemd(char *id, char *title, char *units, char *family, char *charttype, int order, char *algorithm, char *context, char *module, int update_every); diff --git a/collectors/ebpf.plugin/ebpf_dcstat.c b/collectors/ebpf.plugin/ebpf_dcstat.c index 619d8520b..8cf063ca1 100644 --- a/collectors/ebpf.plugin/ebpf_dcstat.c +++ b/collectors/ebpf.plugin/ebpf_dcstat.c @@ -10,14 +10,9 @@ static netdata_publish_syscall_t dcstat_counter_publish_aggregated[NETDATA_DCSTA netdata_dcstat_pid_t *dcstat_vector = NULL; netdata_publish_dcstat_t **dcstat_pid = NULL; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - static netdata_idx_t dcstat_hash_values[NETDATA_DCSTAT_IDX_END]; static netdata_idx_t *dcstat_values = NULL; -static int read_thread_closed = 1; - struct config dcstat_config = { .first_section = NULL, .last_section = NULL, .mutex = NETDATA_MUTEX_INITIALIZER, @@ -27,6 +22,7 @@ struct config dcstat_config = { .first_section = NULL, struct netdata_static_thread dcstat_threads = {"DCSTAT KERNEL", NULL, NULL, 1, NULL, NULL, NULL}; +static enum ebpf_threads_status ebpf_dcstat_exited = NETDATA_THREAD_EBPF_RUNNING; static ebpf_local_maps_t dcstat_maps[] = {{.name = "dcstat_global", .internal_input = NETDATA_DIRECTORY_CACHE_END, .user_input = 0, .type = NETDATA_EBPF_MAP_STATIC, @@ -239,8 +235,8 @@ static inline int ebpf_dc_load_and_attach(struct dc_bpf *obj, ebpf_module_t *em) */ void dcstat_update_publish(netdata_publish_dcstat_t *out, uint64_t cache_access, uint64_t not_found) { - calculated_number successful_access = (calculated_number) (((long long)cache_access) - ((long long)not_found)); - calculated_number ratio = (cache_access) ? successful_access/(calculated_number)cache_access : 0; + NETDATA_DOUBLE successful_access = (NETDATA_DOUBLE) (((long long)cache_access) - ((long long)not_found)); + NETDATA_DOUBLE ratio = (cache_access) ? successful_access/(NETDATA_DOUBLE)cache_access : 0; out->ratio = (long long )(ratio*100); } @@ -251,20 +247,6 @@ void dcstat_update_publish(netdata_publish_dcstat_t *out, uint64_t cache_access, * *****************************************************************/ -/** - * Clean PID structures - * - * Clean the allocated structures. - */ -void clean_dcstat_pid_structures() { - struct pid_stat *pids = root_of_pids; - while (pids) { - freez(dcstat_pid[pids->pid]); - - pids = pids->next; - } -} - /** * Clean names * @@ -279,6 +261,24 @@ void ebpf_dcstat_clean_names() } } +/** + * DCstat exit + * + * Cancel child and exit. + * + * @param ptr thread data. + */ +static void ebpf_dcstat_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; + } + + ebpf_dcstat_exited = NETDATA_THREAD_EBPF_STOPPING; +} + /** * Clean up the main thread. * @@ -287,37 +287,24 @@ void ebpf_dcstat_clean_names() static void ebpf_dcstat_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (ebpf_dcstat_exited != NETDATA_THREAD_EBPF_STOPPED) return; - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - freez(dcstat_vector); freez(dcstat_values); + freez(dcstat_threads.thread); ebpf_cleanup_publish_syscall(dcstat_counter_publish_aggregated); ebpf_dcstat_clean_names(); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } #ifdef LIBBPF_MAJOR_VERSION - else if (bpf_obj) + if (bpf_obj) dc_bpf__destroy(bpf_obj); #endif + + dcstat_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -371,6 +358,8 @@ void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr) 20103, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_DCSTAT); + + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /***************************************************************** @@ -535,22 +524,25 @@ static void read_global_table() */ void *ebpf_dcstat_read_hash(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(ebpf_dcstat_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_LATENCY_DCSTAT_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_dcstat_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_dcstat_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_dcstat_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -881,7 +873,7 @@ static int ebpf_send_systemd_dc_charts() for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, (long long) ect->publish_dc.ratio); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -1013,40 +1005,40 @@ static void dcstat_collector(ebpf_module_t *em) dcstat_threads.thread = mallocz(sizeof(netdata_thread_t)); dcstat_threads.start_routine = ebpf_dcstat_read_hash; - netdata_thread_create(dcstat_threads.thread, dcstat_threads.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(dcstat_threads.thread, dcstat_threads.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_dcstat_read_hash, em); netdata_publish_dcstat_t publish; memset(&publish, 0, sizeof(publish)); - int apps = em->apps_charts; int cgroups = em->cgroup_charts; int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - if (apps) - read_apps_table(); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - if (cgroups) - ebpf_update_dc_cgroup(); + netdata_apps_integration_flags_t apps = em->apps_charts; + pthread_mutex_lock(&collect_data_mutex); + if (apps) + read_apps_table(); - pthread_mutex_lock(&lock); + if (cgroups) + ebpf_update_dc_cgroup(); - dcstat_send_global(&publish); + pthread_mutex_lock(&lock); - if (apps) - ebpf_dcache_send_apps_data(apps_groups_root_target); + dcstat_send_global(&publish); - if (cgroups) - ebpf_dc_send_cgroup_data(update_every); + if (apps & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) + ebpf_dcache_send_apps_data(apps_groups_root_target); - pthread_mutex_unlock(&lock); - } + if (cgroups) + ebpf_dc_send_cgroup_data(update_every); + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } @@ -1125,8 +1117,8 @@ static int ebpf_dcstat_load_bpf(ebpf_module_t *em) { int ret = 0; if (em->load == EBPF_LOAD_LEGACY) { - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { ret = -1; } } @@ -1157,7 +1149,7 @@ static int ebpf_dcstat_load_bpf(ebpf_module_t *em) */ void *ebpf_dcstat_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_dcstat_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_dcstat_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = dcstat_maps; diff --git a/collectors/ebpf.plugin/ebpf_dcstat.h b/collectors/ebpf.plugin/ebpf_dcstat.h index 940864737..5c4a80cd7 100644 --- a/collectors/ebpf.plugin/ebpf_dcstat.h +++ b/collectors/ebpf.plugin/ebpf_dcstat.h @@ -77,7 +77,6 @@ typedef struct netdata_publish_dcstat { extern void *ebpf_dcstat_thread(void *ptr); extern void ebpf_dcstat_create_apps_charts(struct ebpf_module *em, void *ptr); -extern void clean_dcstat_pid_structures(); extern struct config dcstat_config; extern netdata_ebpf_targets_t dc_targets[]; diff --git a/collectors/ebpf.plugin/ebpf_disk.c b/collectors/ebpf.plugin/ebpf_disk.c index 3ddf50b93..96b1705ce 100644 --- a/collectors/ebpf.plugin/ebpf_disk.c +++ b/collectors/ebpf.plugin/ebpf_disk.c @@ -25,9 +25,6 @@ char *tracepoint_block_type = { "block"} ; char *tracepoint_block_issue = { "block_rq_issue" }; char *tracepoint_block_rq_complete = { "block_rq_complete" }; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - static int was_block_issue_enabled = 0; static int was_block_rq_complete_enabled = 0; @@ -35,12 +32,11 @@ static char **dimensions = NULL; static netdata_syscall_stat_t disk_aggregated_data[NETDATA_EBPF_HIST_MAX_BINS]; static netdata_publish_syscall_t disk_publish_aggregated[NETDATA_EBPF_HIST_MAX_BINS]; -static int read_thread_closed = 1; - static netdata_idx_t *disk_hash_values = NULL; static struct netdata_static_thread disk_threads = {"DISK KERNEL", NULL, NULL, 1, NULL, NULL, NULL }; +static enum ebpf_threads_status ebpf_disk_exited = NETDATA_THREAD_EBPF_RUNNING; ebpf_publish_disk_t *plot_disks = NULL; pthread_mutex_t plot_mutex; @@ -428,25 +424,37 @@ static void ebpf_cleanup_disk_list() } /** - * Clean up the main thread. + * Disk exit. + * + * Cancel child and exit. * * @param ptr thread data. */ -static void ebpf_disk_cleanup(void *ptr) +static void ebpf_disk_exit(void *ptr) { - ebpf_disk_disable_tracepoints(); + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; + } + ebpf_disk_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * Disk Cleanup + * + * Clean up allocated memory. + * + * @param ptr thread data. + */ +static void ebpf_disk_cleanup(void *ptr) +{ ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (ebpf_disk_exited != NETDATA_THREAD_EBPF_STOPPED) return; - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } + ebpf_disk_disable_tracepoints(); if (dimensions) ebpf_histogram_dimension_cleanup(dimensions, NETDATA_EBPF_HIST_MAX_BINS); @@ -458,15 +466,8 @@ static void ebpf_disk_cleanup(void *ptr) ebpf_cleanup_plot_disks(); ebpf_cleanup_disk_list(); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } + disk_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -582,19 +583,25 @@ static void read_hard_disk_tables(int table) */ void *ebpf_disk_read_hash(void *ptr) { + netdata_thread_cleanup_push(ebpf_disk_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_LATENCY_DISK_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_disk_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_disk_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_hard_disk_tables(disk_maps[NETDATA_DISK_READ].map_fd); } + ebpf_disk_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -724,30 +731,26 @@ static void disk_collector(ebpf_module_t *em) disk_threads.thread = mallocz(sizeof(netdata_thread_t)); disk_threads.start_routine = ebpf_disk_read_hash; - netdata_thread_create(disk_threads.thread, disk_threads.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(disk_threads.thread, disk_threads.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_disk_read_hash, em); int update_every = em->update_every; - int counter = update_every - 1; - read_thread_closed = 0; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); - ebpf_remove_pointer_from_plot_disk(em); - ebpf_latency_send_hd_data(update_every); - - pthread_mutex_unlock(&lock); - } + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - pthread_mutex_unlock(&collect_data_mutex); + pthread_mutex_lock(&lock); + ebpf_remove_pointer_from_plot_disk(em); + ebpf_latency_send_hd_data(update_every); + + pthread_mutex_unlock(&lock); ebpf_update_disks(em); } - read_thread_closed = 1; } /***************************************************************** @@ -797,7 +800,7 @@ static int ebpf_disk_enable_tracepoints() */ void *ebpf_disk_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_disk_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_disk_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = disk_maps; @@ -822,8 +825,8 @@ void *ebpf_disk_thread(void *ptr) goto enddisk; } - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = 0; goto enddisk; } diff --git a/collectors/ebpf.plugin/ebpf_fd.c b/collectors/ebpf.plugin/ebpf_fd.c index 10a50c4eb..b4e577dad 100644 --- a/collectors/ebpf.plugin/ebpf_fd.c +++ b/collectors/ebpf.plugin/ebpf_fd.c @@ -29,12 +29,9 @@ struct config fd_config = { .first_section = NULL, .last_section = NULL, .mutex .index = {.avl_tree = { .root = NULL, .compar = appconfig_section_compare }, .rwlock = AVL_LOCK_INITIALIZER } }; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - struct netdata_static_thread fd_thread = {"FD KERNEL", NULL, NULL, 1, NULL, NULL, NULL}; -static int read_thread_closed = 1; +static enum ebpf_threads_status ebpf_fd_exited = NETDATA_THREAD_EBPF_RUNNING; static netdata_idx_t fd_hash_values[NETDATA_FD_COUNTER]; static netdata_idx_t *fd_values = NULL; @@ -48,17 +45,21 @@ netdata_fd_stat_t **fd_pid = NULL; *****************************************************************/ /** - * Clean PID structures + * FD Exit + * + * Cancel child thread and exit. * - * Clean the allocated structures. + * @param ptr thread data. */ -void clean_fd_pid_structures() { - struct pid_stat *pids = root_of_pids; - while (pids) { - freez(fd_pid[pids->pid]); - - pids = pids->next; +static void ebpf_fd_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; } + + ebpf_fd_exited = NETDATA_THREAD_EBPF_STOPPING; } /** @@ -69,31 +70,16 @@ void clean_fd_pid_structures() { static void ebpf_fd_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (ebpf_fd_exited != NETDATA_THREAD_EBPF_STOPPED) return; - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - ebpf_cleanup_publish_syscall(fd_publish_aggregated); freez(fd_thread.thread); freez(fd_values); freez(fd_vector); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } + fd_thread.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -161,21 +147,24 @@ static void read_global_table() */ void *ebpf_fd_read_hash(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(ebpf_fd_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_FD_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_fd_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_fd_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_fd_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -572,7 +561,7 @@ static int ebpf_send_systemd_fd_charts(ebpf_module_t *em) for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, ect->publish_systemd_fd.open_call); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -665,38 +654,37 @@ static void fd_collector(ebpf_module_t *em) fd_thread.thread = mallocz(sizeof(netdata_thread_t)); fd_thread.start_routine = ebpf_fd_read_hash; - netdata_thread_create(fd_thread.thread, fd_thread.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(fd_thread.thread, fd_thread.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_fd_read_hash, em); - int apps = em->apps_charts; int cgroups = em->cgroup_charts; - int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = em->update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - if (++counter == update_every) { - counter = 0; - if (apps) - read_apps_table(); + netdata_apps_integration_flags_t apps = em->apps_charts; + pthread_mutex_lock(&collect_data_mutex); + if (apps) + read_apps_table(); - if (cgroups) - ebpf_update_fd_cgroup(); + if (cgroups) + ebpf_update_fd_cgroup(); - pthread_mutex_lock(&lock); + pthread_mutex_lock(&lock); - ebpf_fd_send_data(em); + ebpf_fd_send_data(em); - if (apps) - ebpf_fd_send_apps_data(em, apps_groups_root_target); + if (apps & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) + ebpf_fd_send_apps_data(em, apps_groups_root_target); - if (cgroups) - ebpf_fd_send_cgroup_data(em); - - pthread_mutex_unlock(&lock); - } + if (cgroups) + ebpf_fd_send_cgroup_data(em); + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } @@ -756,6 +744,8 @@ void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr) ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_PROCESS); } + + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /** @@ -831,7 +821,7 @@ static void ebpf_fd_allocate_global_vectors(int apps) */ void *ebpf_fd_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_fd_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_fd_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = fd_maps; @@ -841,8 +831,8 @@ void *ebpf_fd_thread(void *ptr) ebpf_fd_allocate_global_vectors(em->apps_charts); - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; goto endfd; } diff --git a/collectors/ebpf.plugin/ebpf_fd.h b/collectors/ebpf.plugin/ebpf_fd.h index 851e040e5..8742558df 100644 --- a/collectors/ebpf.plugin/ebpf_fd.h +++ b/collectors/ebpf.plugin/ebpf_fd.h @@ -79,7 +79,6 @@ extern void *ebpf_fd_thread(void *ptr); extern void ebpf_fd_create_apps_charts(struct ebpf_module *em, void *ptr); extern struct config fd_config; extern netdata_fd_stat_t **fd_pid; -extern void clean_fd_pid_structures(); #endif /* NETDATA_EBPF_FD_H */ diff --git a/collectors/ebpf.plugin/ebpf_filesystem.c b/collectors/ebpf.plugin/ebpf_filesystem.c index 415a42dbc..bc767fbc9 100644 --- a/collectors/ebpf.plugin/ebpf_filesystem.c +++ b/collectors/ebpf.plugin/ebpf_filesystem.c @@ -30,67 +30,11 @@ static ebpf_local_maps_t fs_maps[] = {{.name = "tbl_ext4", .internal_input = NET .type = NETDATA_EBPF_MAP_CONTROLLER, .map_fd = ND_EBPF_MAP_FD_NOT_INITIALIZED}}; -ebpf_filesystem_partitions_t localfs[] = - {{.filesystem = "ext4", - .optional_filesystem = NULL, - .family = "ext4", - .objects = NULL, - .probe_links = NULL, - .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, - .enabled = CONFIG_BOOLEAN_YES, - .addresses = {.function = NULL, .addr = 0}, - .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, - {.filesystem = "xfs", - .optional_filesystem = NULL, - .family = "xfs", - .objects = NULL, - .probe_links = NULL, - .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, - .enabled = CONFIG_BOOLEAN_YES, - .addresses = {.function = NULL, .addr = 0}, - .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, - {.filesystem = "nfs", - .optional_filesystem = "nfs4", - .family = "nfs", - .objects = NULL, - .probe_links = NULL, - .flags = NETDATA_FILESYSTEM_ATTR_CHARTS, - .enabled = CONFIG_BOOLEAN_YES, - .addresses = {.function = NULL, .addr = 0}, - .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, - {.filesystem = "zfs", - .optional_filesystem = NULL, - .family = "zfs", - .objects = NULL, - .probe_links = NULL, - .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, - .enabled = CONFIG_BOOLEAN_YES, - .addresses = {.function = NULL, .addr = 0}, - .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4}, - {.filesystem = "btrfs", - .optional_filesystem = NULL, - .family = "btrfs", - .objects = NULL, - .probe_links = NULL, - .flags = NETDATA_FILESYSTEM_FILL_ADDRESS_TABLE, - .enabled = CONFIG_BOOLEAN_YES, - .addresses = {.function = "btrfs_file_operations", .addr = 0}, - .kernels = NETDATA_V3_10 | NETDATA_V4_14 | NETDATA_V4_16 | NETDATA_V4_18 | NETDATA_V5_4 | NETDATA_V5_10}, - {.filesystem = NULL, - .optional_filesystem = NULL, - .family = NULL, - .objects = NULL, - .probe_links = NULL, - .flags = NETDATA_FILESYSTEM_FLAG_NO_PARTITION, - .enabled = CONFIG_BOOLEAN_YES, - .addresses = {.function = NULL, .addr = 0}, - .kernels = 0}}; - struct netdata_static_thread filesystem_threads = {"EBPF FS READ", NULL, NULL, 1, NULL, NULL, NULL }; +static enum ebpf_threads_status ebpf_fs_exited = NETDATA_THREAD_EBPF_RUNNING; -static int read_thread_closed = 1; static netdata_syscall_stat_t filesystem_aggregated_data[NETDATA_EBPF_HIST_MAX_BINS]; static netdata_publish_syscall_t filesystem_publish_aggregated[NETDATA_EBPF_HIST_MAX_BINS]; @@ -381,30 +325,44 @@ void ebpf_filesystem_cleanup_ebpf_data() bpf_link__destroy(probe_links[j]); j++; } - bpf_object__close(efp->objects); + freez(probe_links); + if (efp->objects) + bpf_object__close(efp->objects); } } } /** - * Clean up the main thread. + * Filesystem exit + * + * Cancel child thread. * * @param ptr thread data. */ -static void ebpf_filesystem_cleanup(void *ptr) +static void ebpf_filesystem_exit(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; return; - - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2*USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); } + ebpf_fs_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * File system cleanup + * + * Clean up allocated thread. + * + * @param ptr thread data. + */ +static void ebpf_filesystem_cleanup(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (ebpf_fs_exited != NETDATA_THREAD_EBPF_STOPPED) + return; + freez(filesystem_threads.thread); ebpf_cleanup_publish_syscall(filesystem_publish_aggregated); @@ -412,6 +370,9 @@ static void ebpf_filesystem_cleanup(void *ptr) if (dimensions) ebpf_histogram_dimension_cleanup(dimensions, NETDATA_EBPF_HIST_MAX_BINS); freez(filesystem_hash_values); + + filesystem_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -515,16 +476,18 @@ static void read_filesystem_tables() */ void *ebpf_filesystem_read_hash(void *ptr) { + netdata_thread_cleanup_push(ebpf_filesystem_cleanup, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; - read_thread_closed = 0; heartbeat_t hb; heartbeat_init(&hb); usec_t step = NETDATA_FILESYSTEM_READ_SLEEP_MS * em->update_every; int update_every = em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_fs_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_fs_exited == NETDATA_THREAD_EBPF_STOPPING) + break; (void) ebpf_update_partitions(em); ebpf_obsolete_fs_charts(update_every); @@ -536,7 +499,9 @@ void *ebpf_filesystem_read_hash(void *ptr) read_filesystem_tables(); } - read_thread_closed = 1; + ebpf_fs_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -578,25 +543,23 @@ static void filesystem_collector(ebpf_module_t *em) filesystem_threads.start_routine = ebpf_filesystem_read_hash; netdata_thread_create(filesystem_threads.thread, filesystem_threads.name, - NETDATA_THREAD_OPTION_JOINABLE, ebpf_filesystem_read_hash, em); + NETDATA_THREAD_OPTION_DEFAULT, ebpf_filesystem_read_hash, em); int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin || em->optional) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - ebpf_create_fs_charts(update_every); - ebpf_histogram_send_data(); + pthread_mutex_lock(&lock); - pthread_mutex_unlock(&lock); - } + ebpf_create_fs_charts(update_every); + ebpf_histogram_send_data(); - pthread_mutex_unlock(&collect_data_mutex); + pthread_mutex_unlock(&lock); } } @@ -634,7 +597,7 @@ static void ebpf_update_filesystem() */ void *ebpf_filesystem_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_filesystem_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_filesystem_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = fs_maps; diff --git a/collectors/ebpf.plugin/ebpf_filesystem.h b/collectors/ebpf.plugin/ebpf_filesystem.h index 8b7c54c58..f6a10c874 100644 --- a/collectors/ebpf.plugin/ebpf_filesystem.h +++ b/collectors/ebpf.plugin/ebpf_filesystem.h @@ -43,26 +43,6 @@ enum netdata_filesystem_table { NETDATA_ADDR_FS_TABLE }; -typedef struct ebpf_filesystem_partitions { - char *filesystem; - char *optional_filesystem; - char *family; - char *family_name; - struct bpf_object *objects; - struct bpf_link **probe_links; - - netdata_ebpf_histogram_t hread; - netdata_ebpf_histogram_t hwrite; - netdata_ebpf_histogram_t hopen; - netdata_ebpf_histogram_t hadditional; - - uint32_t flags; - uint32_t enabled; - - ebpf_addresses_t addresses; - uint64_t kernels; -} ebpf_filesystem_partitions_t; - extern void *ebpf_filesystem_thread(void *ptr); extern struct config fs_config; diff --git a/collectors/ebpf.plugin/ebpf_hardirq.c b/collectors/ebpf.plugin/ebpf_hardirq.c index 25b2a0ec6..41a881647 100644 --- a/collectors/ebpf.plugin/ebpf_hardirq.c +++ b/collectors/ebpf.plugin/ebpf_hardirq.c @@ -125,11 +125,6 @@ static hardirq_static_val_t hardirq_static_vals[] = { }, }; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - -static int read_thread_closed = 1; - // store for "published" data from the reader thread, which the collector // thread will write to netdata agent. static avl_tree_lock hardirq_pub; @@ -143,44 +138,49 @@ static hardirq_ebpf_static_val_t *hardirq_ebpf_static_vals = NULL; static struct netdata_static_thread hardirq_threads = {"HARDIRQ KERNEL", NULL, NULL, 1, NULL, NULL, NULL }; +static enum ebpf_threads_status ebpf_hardirq_exited = NETDATA_THREAD_EBPF_RUNNING; /** - * Clean up the main thread. + * Hardirq Exit + * + * Cancel child and exit. * * @param ptr thread data. */ -static void hardirq_cleanup(void *ptr) +static void hardirq_exit(void *ptr) { - for (int i = 0; hardirq_tracepoints[i].class != NULL; i++) { - ebpf_disable_tracepoint(&hardirq_tracepoints[i]); - } - ebpf_module_t *em = (ebpf_module_t *)ptr; if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; return; } - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 1 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } + ebpf_hardirq_exited = NETDATA_THREAD_EBPF_STOPPING; +} +/** + * Hardirq clean up + * + * Clean up allocated memory. + * + * @param ptr thread data. + */ +static void hardirq_cleanup(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + + if (ebpf_hardirq_exited != NETDATA_THREAD_EBPF_STOPPED) + return; + + freez(hardirq_threads.thread); + for (int i = 0; hardirq_tracepoints[i].class != NULL; i++) { + ebpf_disable_tracepoint(&hardirq_tracepoints[i]); + } freez(hardirq_ebpf_vals); freez(hardirq_ebpf_static_vals); - freez(hardirq_threads.thread); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } + hardirq_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -316,23 +316,25 @@ static void hardirq_read_latency_static_map(int mapfd) */ static void *hardirq_reader(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(hardirq_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_HARDIRQ_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_hardirq_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); UNUSED(dt); + if (ebpf_hardirq_exited == NETDATA_THREAD_EBPF_STOPPING) + break; hardirq_read_latency_map(hardirq_maps[HARDIRQ_MAP_LATENCY].map_fd); hardirq_read_latency_static_map(hardirq_maps[HARDIRQ_MAP_LATENCY_STATIC].map_fd); } + ebpf_hardirq_exited = NETDATA_THREAD_EBPF_STOPPED; - read_thread_closed = 1; + netdata_thread_cleanup_pop(1); return NULL; } @@ -419,7 +421,7 @@ static void hardirq_collector(ebpf_module_t *em) netdata_thread_create( hardirq_threads.thread, hardirq_threads.name, - NETDATA_THREAD_OPTION_JOINABLE, + NETDATA_THREAD_OPTION_DEFAULT, hardirq_reader, em ); @@ -432,26 +434,24 @@ static void hardirq_collector(ebpf_module_t *em) pthread_mutex_unlock(&lock); // loop and read from published data until ebpf plugin is closed. - int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); - - // write dims now for all hitherto discovered IRQs. - write_begin_chart(NETDATA_EBPF_SYSTEM_GROUP, "hardirq_latency"); - avl_traverse_lock(&hardirq_pub, hardirq_write_dims, NULL); - hardirq_write_static_dims(); - write_end_chart(); - - pthread_mutex_unlock(&lock); - } - - pthread_mutex_unlock(&collect_data_mutex); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = em->update_every * USEC_PER_SEC; + //This will be cancelled by its parent + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; + + pthread_mutex_lock(&lock); + + // write dims now for all hitherto discovered IRQs. + write_begin_chart(NETDATA_EBPF_SYSTEM_GROUP, "hardirq_latency"); + avl_traverse_lock(&hardirq_pub, hardirq_write_dims, NULL); + hardirq_write_static_dims(); + write_end_chart(); + + pthread_mutex_unlock(&lock); } } @@ -467,7 +467,7 @@ static void hardirq_collector(ebpf_module_t *em) */ void *ebpf_hardirq_thread(void *ptr) { - netdata_thread_cleanup_push(hardirq_cleanup, ptr); + netdata_thread_cleanup_push(hardirq_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = hardirq_maps; @@ -481,8 +481,8 @@ void *ebpf_hardirq_thread(void *ptr) goto endhardirq; } - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; goto endhardirq; } diff --git a/collectors/ebpf.plugin/ebpf_mdflush.c b/collectors/ebpf.plugin/ebpf_mdflush.c index 9f75543d7..4dca04505 100644 --- a/collectors/ebpf.plugin/ebpf_mdflush.c +++ b/collectors/ebpf.plugin/ebpf_mdflush.c @@ -35,47 +35,47 @@ static avl_tree_lock mdflush_pub; // tmp store for mdflush values we get from a per-CPU eBPF map. static mdflush_ebpf_val_t *mdflush_ebpf_vals = NULL; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - -static int read_thread_closed = 1; - static struct netdata_static_thread mdflush_threads = {"MDFLUSH KERNEL", NULL, NULL, 1, NULL, NULL, NULL }; +static enum ebpf_threads_status ebpf_mdflush_exited = NETDATA_THREAD_EBPF_RUNNING; /** - * Clean up the main thread. + * MDflush exit + * + * Cancel thread and exit. * * @param ptr thread data. */ -static void mdflush_cleanup(void *ptr) +static void mdflush_exit(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; return; } - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 1 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } + ebpf_mdflush_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * CLeanup + * + * Clean allocated memory. + * + * @param ptr thread data. + */ +static void mdflush_cleanup(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (ebpf_mdflush_exited != NETDATA_THREAD_EBPF_STOPPED) + return; freez(mdflush_ebpf_vals); freez(mdflush_threads.thread); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } + mdflush_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /** @@ -175,22 +175,25 @@ static void mdflush_read_count_map() */ static void *mdflush_reader(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(mdflush_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_MDFLUSH_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_mdflush_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); UNUSED(dt); + if (ebpf_mdflush_exited == NETDATA_THREAD_EBPF_STOPPING) + break; mdflush_read_count_map(); } - read_thread_closed = 1; + ebpf_mdflush_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -248,7 +251,7 @@ static void mdflush_collector(ebpf_module_t *em) netdata_thread_create( mdflush_threads.thread, mdflush_threads.name, - NETDATA_THREAD_OPTION_JOINABLE, + NETDATA_THREAD_OPTION_DEFAULT, mdflush_reader, em ); @@ -260,25 +263,20 @@ static void mdflush_collector(ebpf_module_t *em) pthread_mutex_unlock(&lock); // loop and read from published data until ebpf plugin is closed. - int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); - - // write dims now for all hitherto discovered devices. - write_begin_chart("mdstat", "mdstat_flush"); - avl_traverse_lock(&mdflush_pub, mdflush_write_dims, NULL); - write_end_chart(); - - pthread_mutex_unlock(&lock); - } - - pthread_mutex_unlock(&collect_data_mutex); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = em->update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; + + // write dims now for all hitherto discovered devices. + write_begin_chart("mdstat", "mdstat_flush"); + avl_traverse_lock(&mdflush_pub, mdflush_write_dims, NULL); + write_end_chart(); + + pthread_mutex_unlock(&lock); } } @@ -290,7 +288,7 @@ static void mdflush_collector(ebpf_module_t *em) */ void *ebpf_mdflush_thread(void *ptr) { - netdata_thread_cleanup_push(mdflush_cleanup, ptr); + netdata_thread_cleanup_push(mdflush_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = mdflush_maps; @@ -306,8 +304,8 @@ void *ebpf_mdflush_thread(void *ptr) goto endmdflush; } - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; goto endmdflush; } diff --git a/collectors/ebpf.plugin/ebpf_mount.c b/collectors/ebpf.plugin/ebpf_mount.c index 1ba1e135c..bca467bce 100644 --- a/collectors/ebpf.plugin/ebpf_mount.c +++ b/collectors/ebpf.plugin/ebpf_mount.c @@ -18,12 +18,8 @@ struct config mount_config = { .first_section = NULL, .last_section = NULL, .mut .index = {.avl_tree = { .root = NULL, .compar = appconfig_section_compare }, .rwlock = AVL_LOCK_INITIALIZER } }; -static int read_thread_closed = 1; static netdata_idx_t *mount_values = NULL; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - static netdata_idx_t mount_hash_values[NETDATA_MOUNT_END]; struct netdata_static_thread mount_thread = {"MOUNT KERNEL", @@ -33,6 +29,7 @@ struct netdata_static_thread mount_thread = {"MOUNT KERNEL", netdata_ebpf_targets_t mount_targets[] = { {.name = "mount", .mode = EBPF_LOAD_TRAMPOLINE}, {.name = "umount", .mode = EBPF_LOAD_TRAMPOLINE}, {.name = NULL, .mode = EBPF_LOAD_TRAMPOLINE}}; +static enum ebpf_threads_status ebpf_mount_exited = NETDATA_THREAD_EBPF_RUNNING; #ifdef LIBBPF_MAJOR_VERSION #include "includes/mount.skel.h" // BTF code @@ -227,33 +224,46 @@ static inline int ebpf_mount_load_and_attach(struct mount_bpf *obj, ebpf_module_ *****************************************************************/ /** - * Clean up the main thread. + * Mount Exit + * + * Cancel child thread. + * + * @param ptr thread data. + */ +static void ebpf_mount_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; + } + + ebpf_mount_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * Mount cleanup + * + * Clean up allocated memory. * * @param ptr thread data. */ static void ebpf_mount_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (ebpf_mount_exited != NETDATA_THREAD_EBPF_STOPPED) return; freez(mount_thread.thread); freez(mount_values); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } #ifdef LIBBPF_MAJOR_VERSION - else if (bpf_obj) + if (bpf_obj) mount_bpf__destroy(bpf_obj); #endif + mount_thread.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -299,22 +309,26 @@ static void read_global_table() */ void *ebpf_mount_read_hash(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(ebpf_mount_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_LATENCY_MOUNT_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + //This will be cancelled by its parent + while (ebpf_mount_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_mount_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_mount_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -348,25 +362,22 @@ static void mount_collector(ebpf_module_t *em) mount_values = callocz((size_t)ebpf_nprocs, sizeof(netdata_idx_t)); - netdata_thread_create(mount_thread.thread, mount_thread.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(mount_thread.thread, mount_thread.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_mount_read_hash, em); - int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = em->update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - ebpf_mount_send_data(); + pthread_mutex_lock(&lock); - pthread_mutex_unlock(&lock); - } + ebpf_mount_send_data(); - pthread_mutex_unlock(&collect_data_mutex); + pthread_mutex_unlock(&lock); } } @@ -425,8 +436,8 @@ static int ebpf_mount_load_bpf(ebpf_module_t *em) { int ret = 0; if (em->load == EBPF_LOAD_LEGACY) { - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; ret = -1; } @@ -458,7 +469,7 @@ static int ebpf_mount_load_bpf(ebpf_module_t *em) */ void *ebpf_mount_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_mount_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_mount_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = mount_maps; diff --git a/collectors/ebpf.plugin/ebpf_oomkill.c b/collectors/ebpf.plugin/ebpf_oomkill.c index 463a32904..33f505b0e 100644 --- a/collectors/ebpf.plugin/ebpf_oomkill.c +++ b/collectors/ebpf.plugin/ebpf_oomkill.c @@ -34,9 +34,6 @@ static ebpf_tracepoint_t oomkill_tracepoints[] = { {.enabled = false, .class = NULL, .event = NULL} }; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - static netdata_publish_syscall_t oomkill_publish_aggregated = {.name = "oomkill", .dimension = "oomkill", .algorithm = "absolute", .next = NULL}; @@ -49,19 +46,8 @@ static netdata_publish_syscall_t oomkill_publish_aggregated = {.name = "oomkill" static void oomkill_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) { - return; - } - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } + em->enabled = NETDATA_MAIN_THREAD_EXITED; } static void oomkill_write_data(int32_t *keys, uint32_t total) @@ -159,7 +145,7 @@ static int ebpf_send_systemd_oomkill_charts() if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, (long long) ect->oomkill); ect->oomkill = 0; - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -312,34 +298,36 @@ static void oomkill_collector(ebpf_module_t *em) { int cgroups = em->cgroup_charts; int update_every = em->update_every; - int counter = update_every - 1; int32_t keys[NETDATA_OOMKILL_MAX_ENTRIES]; memset(keys, 0, sizeof(keys)); // loop and read until ebpf plugin is closed. - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); + pthread_mutex_lock(&collect_data_mutex); + pthread_mutex_lock(&lock); - uint32_t count = oomkill_read_data(keys); - if (cgroups && count) - ebpf_update_oomkill_cgroup(keys, count); + uint32_t count = oomkill_read_data(keys); + if (cgroups && count) + ebpf_update_oomkill_cgroup(keys, count); - // write everything from the ebpf map. - if (cgroups) - ebpf_oomkill_send_cgroup_data(update_every); + // write everything from the ebpf map. + if (cgroups) + ebpf_oomkill_send_cgroup_data(update_every); + if (em->apps_charts & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) { write_begin_chart(NETDATA_APPS_FAMILY, NETDATA_OOMKILL_CHART); oomkill_write_data(keys, count); write_end_chart(); - - pthread_mutex_unlock(&lock); } + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } @@ -362,6 +350,8 @@ void ebpf_oomkill_create_apps_charts(struct ebpf_module *em, void *ptr) 20020, ebpf_algorithms[NETDATA_EBPF_ABSOLUTE_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_OOMKILL); + + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /** @@ -395,8 +385,8 @@ void *ebpf_oomkill_thread(void *ptr) goto endoomkill; } - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; goto endoomkill; } diff --git a/collectors/ebpf.plugin/ebpf_process.c b/collectors/ebpf.plugin/ebpf_process.c index f894f0707..f6b379a51 100644 --- a/collectors/ebpf.plugin/ebpf_process.c +++ b/collectors/ebpf.plugin/ebpf_process.c @@ -47,9 +47,6 @@ ebpf_process_publish_apps_t **current_apps_data = NULL; int process_enabled = 0; -static struct bpf_object *objects = NULL; -static struct bpf_link **probe_links = NULL; - struct config process_config = { .first_section = NULL, .last_section = NULL, .mutex = NETDATA_MUTEX_INITIALIZER, @@ -58,6 +55,7 @@ struct config process_config = { .first_section = NULL, static struct netdata_static_thread cgroup_thread = {"EBPF CGROUP", NULL, NULL, 1, NULL, NULL, NULL}; +static enum ebpf_threads_status ebpf_process_exited = NETDATA_THREAD_EBPF_RUNNING; static char *threads_stat[NETDATA_EBPF_THREAD_STAT_END] = {"total", "running"}; static char *load_event_stat[NETDATA_EBPF_LOAD_STAT_END] = {"legacy", "co-re"}; @@ -177,11 +175,9 @@ void ebpf_process_remove_pids() uint32_t pid = pids->pid; ebpf_process_stat_t *w = global_process_stats[pid]; if (w) { - if (w->removeme) { - freez(w); - global_process_stats[pid] = NULL; - bpf_map_delete_elem(pid_fd, &pid); - } + freez(w); + global_process_stats[pid] = NULL; + bpf_map_delete_elem(pid_fd, &pid); } pids = pids->next; @@ -568,6 +564,8 @@ void ebpf_process_create_apps_charts(struct ebpf_module *em, void *ptr) root, em->update_every, NETDATA_EBPF_MODULE_NAME_PROCESS); } + + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /** @@ -622,6 +620,72 @@ static void ebpf_create_apps_charts(struct target *root) } } +/***************************************************************** + * + * FUNCTIONS TO CLOSE THE THREAD + * + *****************************************************************/ + +/** + * Process disable tracepoints + * + * Disable tracepoints when the plugin was responsible to enable it. + */ +static void ebpf_process_disable_tracepoints() +{ + char *default_message = { "Cannot disable the tracepoint" }; + if (!was_sched_process_exit_enabled) { + if (ebpf_disable_tracing_values(tracepoint_sched_type, tracepoint_sched_process_exit)) + error("%s %s/%s.", default_message, tracepoint_sched_type, tracepoint_sched_process_exit); + } + + if (!was_sched_process_exec_enabled) { + if (ebpf_disable_tracing_values(tracepoint_sched_type, tracepoint_sched_process_exec)) + error("%s %s/%s.", default_message, tracepoint_sched_type, tracepoint_sched_process_exec); + } + + if (!was_sched_process_fork_enabled) { + if (ebpf_disable_tracing_values(tracepoint_sched_type, tracepoint_sched_process_fork)) + error("%s %s/%s.", default_message, tracepoint_sched_type, tracepoint_sched_process_fork); + } +} + +/** + * Process Exit + * + * Cancel child thread. + * + * @param ptr thread data. + */ +static void ebpf_process_exit(void *ptr) +{ + (void)ptr; + ebpf_process_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * Process cleanup + * + * Cleanup allocated memory. + * + * @param ptr thread data. + */ +static void ebpf_process_cleanup(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (ebpf_process_exited != NETDATA_THREAD_EBPF_STOPPED) + return; + + ebpf_cleanup_publish_syscall(process_publish_aggregated); + freez(process_hash_values); + freez(cgroup_thread.thread); + + ebpf_process_disable_tracepoints(); + + cgroup_thread.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; +} + /***************************************************************** * * FUNCTIONS WITH THE MAIN LOOP @@ -640,24 +704,33 @@ static void ebpf_create_apps_charts(struct target *root) */ void *ebpf_cgroup_update_shm(void *ptr) { - UNUSED(ptr); + netdata_thread_cleanup_push(ebpf_process_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); - usec_t step = 30 * USEC_PER_SEC; - while (!close_ebpf_plugin) { + usec_t step = 3 * USEC_PER_SEC; + int counter = NETDATA_EBPF_CGROUP_UPDATE - 1; + //This will be cancelled by its parent + while (ebpf_process_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; - - if (close_ebpf_plugin) + if (ebpf_process_exited == NETDATA_THREAD_EBPF_STOPPING) break; - if (!shm_ebpf_cgroup.header) - ebpf_map_cgroup_shared_memory(); + // We are using a small heartbeat time to wake up thread, + // but we should not update so frequently the shared memory data + if (++counter >= NETDATA_EBPF_CGROUP_UPDATE) { + counter = 0; + if (!shm_ebpf_cgroup.header) + ebpf_map_cgroup_shared_memory(); - ebpf_parse_cgroup_shm_data(); + ebpf_parse_cgroup_shm_data(); + } } + ebpf_process_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -884,7 +957,7 @@ static int ebpf_send_systemd_process_charts(ebpf_module_t *em) for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, ect->publish_systemd_ps.create_process); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -1019,32 +1092,36 @@ static void process_collector(ebpf_module_t *em) cgroup_thread.thread = mallocz(sizeof(netdata_thread_t)); cgroup_thread.start_routine = ebpf_cgroup_update_shm; - netdata_thread_create(cgroup_thread.thread, cgroup_thread.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(cgroup_thread.thread, cgroup_thread.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_cgroup_update_shm, em); heartbeat_t hb; heartbeat_init(&hb); int publish_global = em->global_charts; - int apps_enabled = em->apps_charts; int cgroups = em->cgroup_charts; int thread_enabled = em->enabled; if (cgroups) ebpf_process_update_cgroup_algorithm(); + int update_apps_every = (int) EBPF_CFG_UPDATE_APPS_EVERY_DEFAULT; int pid_fd = process_maps[NETDATA_PROCESS_PID_TABLE].map_fd; int update_every = em->update_every; int counter = update_every - 1; - while (!close_ebpf_plugin) { + int update_apps_list = update_apps_every - 1; + while (!ebpf_exit_plugin) { usec_t dt = heartbeat_next(&hb, USEC_PER_SEC); (void)dt; + if (ebpf_exit_plugin) + break; pthread_mutex_lock(&collect_data_mutex); - cleanup_exited_pids(); - collect_data_for_all_processes(pid_fd); + if (++update_apps_list == update_apps_every) { + update_apps_list = 0; + cleanup_exited_pids(); + collect_data_for_all_processes(pid_fd); - ebpf_create_apps_charts(apps_groups_root_target); - - pthread_cond_broadcast(&collect_data_cond_var); + ebpf_create_apps_charts(apps_groups_root_target); + } pthread_mutex_unlock(&collect_data_mutex); if (++counter == update_every) { @@ -1052,10 +1129,10 @@ static void process_collector(ebpf_module_t *em) read_hash_global_tables(); - int publish_apps = 0; + netdata_apps_integration_flags_t apps_enabled = em->apps_charts; + pthread_mutex_lock(&collect_data_mutex); if (all_pids_count > 0) { if (apps_enabled) { - publish_apps = 1; ebpf_process_update_apps_data(); } @@ -1072,7 +1149,7 @@ static void process_collector(ebpf_module_t *em) ebpf_process_send_data(em); } - if (publish_apps) { + if (apps_enabled & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) { ebpf_process_send_apps_data(apps_groups_root_target, em); } @@ -1081,95 +1158,13 @@ static void process_collector(ebpf_module_t *em) } } pthread_mutex_unlock(&lock); + pthread_mutex_unlock(&collect_data_mutex); } fflush(stdout); } } -/***************************************************************** - * - * FUNCTIONS TO CLOSE THE THREAD - * - *****************************************************************/ - -void clean_global_memory() { - int pid_fd = process_maps[NETDATA_PROCESS_PID_TABLE].map_fd; - struct pid_stat *pids = root_of_pids; - while (pids) { - uint32_t pid = pids->pid; - freez(global_process_stats[pid]); - - bpf_map_delete_elem(pid_fd, &pid); - freez(current_apps_data[pid]); - - pids = pids->next; - } -} - -/** - * Process disable tracepoints - * - * Disable tracepoints when the plugin was responsible to enable it. - */ -static void ebpf_process_disable_tracepoints() -{ - char *default_message = { "Cannot disable the tracepoint" }; - if (!was_sched_process_exit_enabled) { - if (ebpf_disable_tracing_values(tracepoint_sched_type, tracepoint_sched_process_exit)) - error("%s %s/%s.", default_message, tracepoint_sched_type, tracepoint_sched_process_exit); - } - - if (!was_sched_process_exec_enabled) { - if (ebpf_disable_tracing_values(tracepoint_sched_type, tracepoint_sched_process_exec)) - error("%s %s/%s.", default_message, tracepoint_sched_type, tracepoint_sched_process_exec); - } - - if (!was_sched_process_fork_enabled) { - if (ebpf_disable_tracing_values(tracepoint_sched_type, tracepoint_sched_process_fork)) - error("%s %s/%s.", default_message, tracepoint_sched_type, tracepoint_sched_process_fork); - } -} - -/** - * Clean up the main thread. - * - * @param ptr thread data. - */ -static void ebpf_process_cleanup(void *ptr) -{ - UNUSED(ptr); - - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 1 * USEC_PER_SEC; - while (!finalized_threads) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - - ebpf_cleanup_publish_syscall(process_publish_aggregated); - freez(process_hash_values); - - clean_global_memory(); - freez(global_process_stats); - freez(current_apps_data); - - ebpf_process_disable_tracepoints(); - - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } - - freez(cgroup_thread.thread); -} - /***************************************************************** * * FUNCTIONS TO START THREAD @@ -1293,7 +1288,7 @@ static int ebpf_process_enable_tracepoints() */ void *ebpf_process_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_process_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_process_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = process_maps; @@ -1309,8 +1304,8 @@ void *ebpf_process_thread(void *ptr) ebpf_update_pid_table(&process_maps[0], em); set_local_pointers(); - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; pthread_mutex_unlock(&lock); goto endprocess; diff --git a/collectors/ebpf.plugin/ebpf_process.h b/collectors/ebpf.plugin/ebpf_process.h index b0377b5db..43df34d48 100644 --- a/collectors/ebpf.plugin/ebpf_process.h +++ b/collectors/ebpf.plugin/ebpf_process.h @@ -39,6 +39,8 @@ #define NETDATA_SYSTEMD_PROCESS_EXIT_CONTEXT "services.task_exit" #define NETDATA_SYSTEMD_PROCESS_ERROR_CONTEXT "services.task_error" +#define NETDATA_EBPF_CGROUP_UPDATE 10 + // Statistical information enum netdata_ebpf_thread_stats{ NETDATA_EBPF_THREAD_STAT_TOTAL, diff --git a/collectors/ebpf.plugin/ebpf_shm.c b/collectors/ebpf.plugin/ebpf_shm.c index 939741e75..bd928cbdc 100644 --- a/collectors/ebpf.plugin/ebpf_shm.c +++ b/collectors/ebpf.plugin/ebpf_shm.c @@ -7,7 +7,6 @@ static char *shm_dimension_name[NETDATA_SHM_END] = { "get", "at", "dt", "ctl" }; static netdata_syscall_stat_t shm_aggregated_data[NETDATA_SHM_END]; static netdata_publish_syscall_t shm_publish_aggregated[NETDATA_SHM_END]; -static int read_thread_closed = 1; netdata_publish_shm_t *shm_vector = NULL; static netdata_idx_t shm_hash_values[NETDATA_SHM_END]; @@ -35,11 +34,9 @@ static ebpf_local_maps_t shm_maps[] = {{.name = "tbl_pid_shm", .internal_input = .map_fd = ND_EBPF_MAP_FD_NOT_INITIALIZED}, {.name = NULL, .internal_input = 0, .user_input = 0}}; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - struct netdata_static_thread shm_threads = {"SHM KERNEL", NULL, NULL, 1, NULL, NULL, NULL}; +static enum ebpf_threads_status ebpf_shm_exited = NETDATA_THREAD_EBPF_RUNNING; netdata_ebpf_targets_t shm_targets[] = { {.name = "shmget", .mode = EBPF_LOAD_TRAMPOLINE}, {.name = "shmat", .mode = EBPF_LOAD_TRAMPOLINE}, @@ -243,55 +240,48 @@ static inline int ebpf_shm_load_and_attach(struct shm_bpf *obj, ebpf_module_t *e *****************************************************************/ /** - * Clean shm structure + * SHM Exit + * + * Cancel child thread. + * + * @param ptr thread data. */ -void clean_shm_pid_structures() { - struct pid_stat *pids = root_of_pids; - while (pids) { - freez(shm_pid[pids->pid]); - - pids = pids->next; +static void ebpf_shm_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; } + + ebpf_shm_exited = NETDATA_THREAD_EBPF_STOPPING; } /** - * Clean up the main thread. + * SHM Cleanup + * + * Clean up allocated memory. * * @param ptr thread data. */ static void ebpf_shm_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) { + if (ebpf_shm_exited != NETDATA_THREAD_EBPF_STOPPED) return; - } - - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } ebpf_cleanup_publish_syscall(shm_publish_aggregated); freez(shm_vector); freez(shm_values); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } #ifdef LIBBPF_MAJOR_VERSION - else if (bpf_obj) + if (bpf_obj) shm_bpf__destroy(bpf_obj); #endif + + shm_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -467,21 +457,24 @@ static void read_global_table() */ void *ebpf_shm_read_hash(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(ebpf_shm_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_SHM_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_shm_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_shm_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_shm_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -740,7 +733,7 @@ static int ebpf_send_systemd_shm_charts() for (ect = ebpf_cgroup_pids; ect; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, (long long)ect->publish_shm.get); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -859,44 +852,44 @@ static void shm_collector(ebpf_module_t *em) netdata_thread_create( shm_threads.thread, shm_threads.name, - NETDATA_THREAD_OPTION_JOINABLE, + NETDATA_THREAD_OPTION_DEFAULT, ebpf_shm_read_hash, em ); - int apps = em->apps_charts; int cgroups = em->cgroup_charts; int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - if (apps) { - read_apps_table(); - } + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - if (cgroups) { - ebpf_update_shm_cgroup(); - } + netdata_apps_integration_flags_t apps = em->apps_charts; + pthread_mutex_lock(&collect_data_mutex); + if (apps) { + read_apps_table(); + } - pthread_mutex_lock(&lock); + if (cgroups) { + ebpf_update_shm_cgroup(); + } - shm_send_global(); + pthread_mutex_lock(&lock); - if (apps) { - ebpf_shm_send_apps_data(apps_groups_root_target); - } + shm_send_global(); - if (cgroups) { - ebpf_shm_send_cgroup_data(update_every); - } + if (apps & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) { + ebpf_shm_send_apps_data(apps_groups_root_target); + } - pthread_mutex_unlock(&lock); + if (cgroups) { + ebpf_shm_send_cgroup_data(update_every); } + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } @@ -950,6 +943,8 @@ void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr) 20194, ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_SHM); + + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /** @@ -1014,8 +1009,8 @@ static int ebpf_shm_load_bpf(ebpf_module_t *em) { int ret = 0; if (em->load == EBPF_LOAD_LEGACY) { - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; ret = -1; } @@ -1045,7 +1040,7 @@ static int ebpf_shm_load_bpf(ebpf_module_t *em) */ void *ebpf_shm_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_shm_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_shm_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = shm_maps; diff --git a/collectors/ebpf.plugin/ebpf_shm.h b/collectors/ebpf.plugin/ebpf_shm.h index f0559e431..8e118a6f5 100644 --- a/collectors/ebpf.plugin/ebpf_shm.h +++ b/collectors/ebpf.plugin/ebpf_shm.h @@ -56,7 +56,6 @@ extern netdata_publish_shm_t **shm_pid; extern void *ebpf_shm_thread(void *ptr); extern void ebpf_shm_create_apps_charts(struct ebpf_module *em, void *ptr); -extern void clean_shm_pid_structures(); extern netdata_ebpf_targets_t shm_targets[]; extern struct config shm_config; diff --git a/collectors/ebpf.plugin/ebpf_socket.c b/collectors/ebpf.plugin/ebpf_socket.c index 7b2d4a5bf..ba63934d5 100644 --- a/collectors/ebpf.plugin/ebpf_socket.c +++ b/collectors/ebpf.plugin/ebpf_socket.c @@ -61,10 +61,8 @@ static netdata_publish_syscall_t socket_publish_aggregated[NETDATA_MAX_SOCKET_VE ebpf_socket_publish_apps_t **socket_bandwidth_curr = NULL; static ebpf_bandwidth_t *bandwidth_vector = NULL; -static int socket_apps_created = 0; pthread_mutex_t nv_mutex; int wait_to_plot = 0; -int read_thread_closed = 1; netdata_vector_plot_t inbound_vectors = { .plot = NULL, .next = 0, .last = 0 }; netdata_vector_plot_t outbound_vectors = { .plot = NULL, .next = 0, .last = 0 }; @@ -72,9 +70,6 @@ netdata_socket_t *socket_values; ebpf_network_viewer_port_list_t *listen_ports = NULL; -static struct bpf_object *objects = NULL; -static struct bpf_link **probe_links = NULL; - struct config socket_config = { .first_section = NULL, .last_section = NULL, .mutex = NETDATA_MUTEX_INITIALIZER, @@ -92,6 +87,11 @@ netdata_ebpf_targets_t socket_targets[] = { {.name = "inet_csk_accept", .mode = {.name = "tcp_v6_connect", .mode = EBPF_LOAD_TRAMPOLINE}, {.name = NULL, .mode = EBPF_LOAD_TRAMPOLINE}}; +struct netdata_static_thread socket_threads = {"EBPF SOCKET READ", + NULL, NULL, 1, NULL, + NULL, NULL }; +static enum ebpf_threads_status ebpf_socket_exited = NETDATA_THREAD_EBPF_RUNNING; + #ifdef LIBBPF_MAJOR_VERSION #include "includes/socket.skel.h" // BTF code @@ -424,6 +424,225 @@ static inline int ebpf_socket_load_and_attach(struct socket_bpf *obj, ebpf_modul return ret; } #endif + +/***************************************************************** + * + * FUNCTIONS TO CLOSE THE THREAD + * + *****************************************************************/ + +/** + * Clean internal socket plot + * + * Clean all structures allocated with strdupz. + * + * @param ptr the pointer with addresses to clean. + */ +static inline void clean_internal_socket_plot(netdata_socket_plot_t *ptr) +{ + freez(ptr->dimension_recv); + freez(ptr->dimension_sent); + freez(ptr->resolved_name); + freez(ptr->dimension_retransmit); +} + +/** + * Clean socket plot + * + * Clean the allocated data for inbound and outbound vectors. + */ +static void clean_allocated_socket_plot() +{ + uint32_t i; + uint32_t end = inbound_vectors.last; + netdata_socket_plot_t *plot = inbound_vectors.plot; + for (i = 0; i < end; i++) { + clean_internal_socket_plot(&plot[i]); + } + + clean_internal_socket_plot(&plot[inbound_vectors.last]); + + end = outbound_vectors.last; + plot = outbound_vectors.plot; + for (i = 0; i < end; i++) { + clean_internal_socket_plot(&plot[i]); + } + clean_internal_socket_plot(&plot[outbound_vectors.last]); +} + +/** + * Clean network ports allocated during initialization. + * + * @param ptr a pointer to the link list. + */ +static void clean_network_ports(ebpf_network_viewer_port_list_t *ptr) +{ + if (unlikely(!ptr)) + return; + + while (ptr) { + ebpf_network_viewer_port_list_t *next = ptr->next; + freez(ptr->value); + freez(ptr); + ptr = next; + } +} + +/** + * Clean service names + * + * Clean the allocated link list that stores names. + * + * @param names the link list. + */ +static void clean_service_names(ebpf_network_viewer_dim_name_t *names) +{ + if (unlikely(!names)) + return; + + while (names) { + ebpf_network_viewer_dim_name_t *next = names->next; + freez(names->name); + freez(names); + names = next; + } +} + +/** + * Clean hostnames + * + * @param hostnames the hostnames to clean + */ +static void clean_hostnames(ebpf_network_viewer_hostname_list_t *hostnames) +{ + if (unlikely(!hostnames)) + return; + + while (hostnames) { + ebpf_network_viewer_hostname_list_t *next = hostnames->next; + freez(hostnames->value); + simple_pattern_free(hostnames->value_pattern); + freez(hostnames); + hostnames = next; + } +} + +/** + * Cleanup publish syscall + * + * @param nps list of structures to clean + */ +void ebpf_cleanup_publish_syscall(netdata_publish_syscall_t *nps) +{ + while (nps) { + freez(nps->algorithm); + nps = nps->next; + } +} + +/** + * Clean port Structure + * + * Clean the allocated list. + * + * @param clean the list that will be cleaned + */ +void clean_port_structure(ebpf_network_viewer_port_list_t **clean) +{ + ebpf_network_viewer_port_list_t *move = *clean; + while (move) { + ebpf_network_viewer_port_list_t *next = move->next; + freez(move->value); + freez(move); + + move = next; + } + *clean = NULL; +} + +/** + * Clean IP structure + * + * Clean the allocated list. + * + * @param clean the list that will be cleaned + */ +static void clean_ip_structure(ebpf_network_viewer_ip_list_t **clean) +{ + ebpf_network_viewer_ip_list_t *move = *clean; + while (move) { + ebpf_network_viewer_ip_list_t *next = move->next; + freez(move->value); + freez(move); + + move = next; + } + *clean = NULL; +} + +/** + * Socket exit + * + * Clean up the main thread. + * + * @param ptr thread data. + */ +static void ebpf_socket_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; + } + + ebpf_socket_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * Socket cleanup + * + * Clean up allocated addresses. + * + * @param ptr thread data. + */ +void ebpf_socket_cleanup(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (ebpf_socket_exited != NETDATA_THREAD_EBPF_STOPPED) + return; + + ebpf_cleanup_publish_syscall(socket_publish_aggregated); + freez(socket_hash_values); + + freez(bandwidth_vector); + + freez(socket_values); + clean_allocated_socket_plot(); + freez(inbound_vectors.plot); + freez(outbound_vectors.plot); + + clean_port_structure(&listen_ports); + + ebpf_modules[EBPF_MODULE_SOCKET_IDX].enabled = 0; + + clean_network_ports(network_viewer_opt.included_port); + clean_network_ports(network_viewer_opt.excluded_port); + clean_service_names(network_viewer_opt.names); + clean_hostnames(network_viewer_opt.included_hostnames); + clean_hostnames(network_viewer_opt.excluded_hostnames); + + pthread_mutex_destroy(&nv_mutex); + + freez(socket_threads.thread); + +#ifdef LIBBPF_MAJOR_VERSION + if (bpf_obj) + socket_bpf__destroy(bpf_obj); +#endif + socket_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; +} + /***************************************************************** * * PROCESS DATA AND SEND TO NETDATA @@ -737,8 +956,6 @@ long long ebpf_socket_sum_values_for_pids(struct pid_on_target *root, size_t off void ebpf_socket_send_apps_data(ebpf_module_t *em, struct target *root) { UNUSED(em); - if (!socket_apps_created) - return; struct target *w; collected_number value; @@ -1052,7 +1269,7 @@ void ebpf_socket_create_apps_charts(struct ebpf_module *em, void *ptr) ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_SOCKET); - socket_apps_created = 1; + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /** @@ -1814,15 +2031,6 @@ static void read_socket_hash_table(int fd, int family, int network_connection) key = next_key; } - - test = bpf_map_lookup_elem(fd, &next_key, values); - if (test < 0) { - return; - } - - if (network_connection) { - hash_accumulator(values, &next_key, family, end); - } } /** @@ -1929,18 +2137,20 @@ static void read_listen_table() */ void *ebpf_socket_read_hash(void *ptr) { + netdata_thread_cleanup_push(ebpf_socket_cleanup, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; - read_thread_closed = 0; heartbeat_t hb; heartbeat_init(&hb); usec_t step = NETDATA_SOCKET_READ_SLEEP_MS * em->update_every; int fd_ipv4 = socket_maps[NETDATA_SOCKET_TABLE_IPV4].map_fd; int fd_ipv6 = socket_maps[NETDATA_SOCKET_TABLE_IPV6].map_fd; int network_connection = em->optional; - while (!close_ebpf_plugin) { + while (ebpf_socket_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_socket_exited == NETDATA_THREAD_EBPF_STOPPING) + break; pthread_mutex_lock(&nv_mutex); read_listen_table(); @@ -1950,7 +2160,9 @@ void *ebpf_socket_read_hash(void *ptr) pthread_mutex_unlock(&nv_mutex); } - read_thread_closed = 1; + ebpf_socket_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -2502,7 +2714,7 @@ static int ebpf_send_systemd_socket_charts() for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, (long long)ect->publish_socket.call_tcp_v4_connection); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -2643,10 +2855,6 @@ static void ebpf_socket_send_cgroup_data(int update_every) * *****************************************************************/ -struct netdata_static_thread socket_threads = {"EBPF SOCKET READ", - NULL, NULL, 1, NULL, - NULL, ebpf_socket_read_hash }; - /** * Main loop for this collector. * @@ -2655,295 +2863,72 @@ struct netdata_static_thread socket_threads = {"EBPF SOCKET READ", */ static void socket_collector(usec_t step, ebpf_module_t *em) { - UNUSED(step); heartbeat_t hb; heartbeat_init(&hb); socket_threads.thread = mallocz(sizeof(netdata_thread_t)); + socket_threads.start_routine = ebpf_socket_read_hash; netdata_thread_create(socket_threads.thread, socket_threads.name, - NETDATA_THREAD_OPTION_JOINABLE, ebpf_socket_read_hash, em); + NETDATA_THREAD_OPTION_DEFAULT, ebpf_socket_read_hash, em); int cgroups = em->cgroup_charts; if (cgroups) ebpf_socket_update_cgroup_algorithm(); - int socket_apps_enabled = ebpf_modules[EBPF_MODULE_SOCKET_IDX].apps_charts; - int socket_global_enabled = ebpf_modules[EBPF_MODULE_SOCKET_IDX].global_charts; + int socket_global_enabled = em->global_charts; int network_connection = em->optional; int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; + + netdata_apps_integration_flags_t socket_apps_enabled = em->apps_charts; pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); + if (socket_global_enabled) + read_hash_global_tables(); - if (++counter == update_every) { - counter = 0; - if (socket_global_enabled) - read_hash_global_tables(); + if (socket_apps_enabled) + ebpf_socket_update_apps_data(); - if (socket_apps_enabled) - ebpf_socket_update_apps_data(); + if (cgroups) + ebpf_update_socket_cgroup(); - if (cgroups) - ebpf_update_socket_cgroup(); + calculate_nv_plot(); - calculate_nv_plot(); + pthread_mutex_lock(&lock); + if (socket_global_enabled) + ebpf_socket_send_data(em); - pthread_mutex_lock(&lock); - if (socket_global_enabled) - ebpf_socket_send_data(em); + if (socket_apps_enabled & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) + ebpf_socket_send_apps_data(em, apps_groups_root_target); - if (socket_apps_enabled) - ebpf_socket_send_apps_data(em, apps_groups_root_target); + if (cgroups) + ebpf_socket_send_cgroup_data(update_every); - if (cgroups) - ebpf_socket_send_cgroup_data(update_every); + fflush(stdout); + if (network_connection) { + // We are calling fflush many times, because when we have a lot of dimensions + // we began to have not expected outputs and Netdata closed the plugin. + pthread_mutex_lock(&nv_mutex); + ebpf_socket_create_nv_charts(&inbound_vectors, update_every); fflush(stdout); + ebpf_socket_send_nv_data(&inbound_vectors); - if (network_connection) { - // We are calling fflush many times, because when we have a lot of dimensions - // we began to have not expected outputs and Netdata closed the plugin. - pthread_mutex_lock(&nv_mutex); - ebpf_socket_create_nv_charts(&inbound_vectors, update_every); - fflush(stdout); - ebpf_socket_send_nv_data(&inbound_vectors); - - ebpf_socket_create_nv_charts(&outbound_vectors, update_every); - fflush(stdout); - ebpf_socket_send_nv_data(&outbound_vectors); - wait_to_plot = 0; - pthread_mutex_unlock(&nv_mutex); + ebpf_socket_create_nv_charts(&outbound_vectors, update_every); + fflush(stdout); + ebpf_socket_send_nv_data(&outbound_vectors); + wait_to_plot = 0; + pthread_mutex_unlock(&nv_mutex); - } - pthread_mutex_unlock(&lock); } - + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } -/***************************************************************** - * - * FUNCTIONS TO CLOSE THE THREAD - * - *****************************************************************/ - - -/** - * Clean internal socket plot - * - * Clean all structures allocated with strdupz. - * - * @param ptr the pointer with addresses to clean. - */ -static inline void clean_internal_socket_plot(netdata_socket_plot_t *ptr) -{ - freez(ptr->dimension_recv); - freez(ptr->dimension_sent); - freez(ptr->resolved_name); - freez(ptr->dimension_retransmit); -} - -/** - * Clean socket plot - * - * Clean the allocated data for inbound and outbound vectors. - */ -static void clean_allocated_socket_plot() -{ - uint32_t i; - uint32_t end = inbound_vectors.last; - netdata_socket_plot_t *plot = inbound_vectors.plot; - for (i = 0; i < end; i++) { - clean_internal_socket_plot(&plot[i]); - } - - clean_internal_socket_plot(&plot[inbound_vectors.last]); - - end = outbound_vectors.last; - plot = outbound_vectors.plot; - for (i = 0; i < end; i++) { - clean_internal_socket_plot(&plot[i]); - } - clean_internal_socket_plot(&plot[outbound_vectors.last]); -} - -/** - * Clean network ports allocated during initialization. - * - * @param ptr a pointer to the link list. - */ -static void clean_network_ports(ebpf_network_viewer_port_list_t *ptr) -{ - if (unlikely(!ptr)) - return; - - while (ptr) { - ebpf_network_viewer_port_list_t *next = ptr->next; - freez(ptr->value); - freez(ptr); - ptr = next; - } -} - -/** - * Clean service names - * - * Clean the allocated link list that stores names. - * - * @param names the link list. - */ -static void clean_service_names(ebpf_network_viewer_dim_name_t *names) -{ - if (unlikely(!names)) - return; - - while (names) { - ebpf_network_viewer_dim_name_t *next = names->next; - freez(names->name); - freez(names); - names = next; - } -} - -/** - * Clean hostnames - * - * @param hostnames the hostnames to clean - */ -static void clean_hostnames(ebpf_network_viewer_hostname_list_t *hostnames) -{ - if (unlikely(!hostnames)) - return; - - while (hostnames) { - ebpf_network_viewer_hostname_list_t *next = hostnames->next; - freez(hostnames->value); - simple_pattern_free(hostnames->value_pattern); - freez(hostnames); - hostnames = next; - } -} - -void clean_socket_apps_structures() { - struct pid_stat *pids = root_of_pids; - while (pids) { - freez(socket_bandwidth_curr[pids->pid]); - - pids = pids->next; - } -} - -/** - * Cleanup publish syscall - * - * @param nps list of structures to clean - */ -void ebpf_cleanup_publish_syscall(netdata_publish_syscall_t *nps) -{ - while (nps) { - freez(nps->algorithm); - nps = nps->next; - } -} - -/** - * Clean port Structure - * - * Clean the allocated list. - * - * @param clean the list that will be cleaned - */ -void clean_port_structure(ebpf_network_viewer_port_list_t **clean) -{ - ebpf_network_viewer_port_list_t *move = *clean; - while (move) { - ebpf_network_viewer_port_list_t *next = move->next; - freez(move->value); - freez(move); - - move = next; - } - *clean = NULL; -} - -/** - * Clean IP structure - * - * Clean the allocated list. - * - * @param clean the list that will be cleaned - */ -static void clean_ip_structure(ebpf_network_viewer_ip_list_t **clean) -{ - ebpf_network_viewer_ip_list_t *move = *clean; - while (move) { - ebpf_network_viewer_ip_list_t *next = move->next; - freez(move->value); - freez(move); - - move = next; - } - *clean = NULL; -} - -/** - * Clean up the main thread. - * - * @param ptr thread data. - */ -static void ebpf_socket_cleanup(void *ptr) -{ - ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) - return; - - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2*USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - - ebpf_cleanup_publish_syscall(socket_publish_aggregated); - freez(socket_hash_values); - - freez(bandwidth_vector); - - freez(socket_values); - clean_allocated_socket_plot(); - freez(inbound_vectors.plot); - freez(outbound_vectors.plot); - - clean_port_structure(&listen_ports); - - ebpf_modules[EBPF_MODULE_SOCKET_IDX].enabled = 0; - - clean_network_ports(network_viewer_opt.included_port); - clean_network_ports(network_viewer_opt.excluded_port); - clean_service_names(network_viewer_opt.names); - clean_hostnames(network_viewer_opt.included_hostnames); - clean_hostnames(network_viewer_opt.excluded_hostnames); - - pthread_mutex_destroy(&nv_mutex); - - freez(socket_threads.thread); - - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } - finalized_threads = 1; -} - /***************************************************************** * * FUNCTIONS TO START THREAD @@ -3891,8 +3876,8 @@ static int ebpf_socket_load_bpf(ebpf_module_t *em) int ret = 0; if (em->load == EBPF_LOAD_LEGACY) { - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { ret = -1; } } @@ -3924,7 +3909,7 @@ static int ebpf_socket_load_bpf(ebpf_module_t *em) */ void *ebpf_socket_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_socket_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_socket_exit, ptr); memset(&inbound_vectors.tree, 0, sizeof(avl_tree_lock)); memset(&outbound_vectors.tree, 0, sizeof(avl_tree_lock)); @@ -3946,7 +3931,6 @@ void *ebpf_socket_thread(void *ptr) error("Cannot initialize local mutex"); goto endsocket; } - pthread_mutex_lock(&lock); ebpf_socket_allocate_global_vectors(em->apps_charts); initialize_inbound_outbound(); @@ -3973,11 +3957,11 @@ void *ebpf_socket_thread(void *ptr) socket_aggregated_data, socket_publish_aggregated, socket_dimension_names, socket_id_names, algorithms, NETDATA_MAX_SOCKET_VECTOR); + pthread_mutex_lock(&lock); ebpf_create_global_charts(em); ebpf_update_stats(&plugin_statistics, em); - finalized_threads = 0; pthread_mutex_unlock(&lock); socket_collector((usec_t)(em->update_every * USEC_PER_SEC), em); diff --git a/collectors/ebpf.plugin/ebpf_socket.h b/collectors/ebpf.plugin/ebpf_socket.h index 672001301..711225acf 100644 --- a/collectors/ebpf.plugin/ebpf_socket.h +++ b/collectors/ebpf.plugin/ebpf_socket.h @@ -279,7 +279,7 @@ typedef struct netdata_socket { uint32_t retransmit; // It is never used with UDP uint16_t protocol; uint16_t reserved; -} netdata_socket_t __attribute__((__aligned__(8))); +} netdata_socket_t; typedef struct netdata_plot_values { // Values used in the previous iteration @@ -307,7 +307,7 @@ typedef struct netdata_socket_idx { uint16_t sport; union netdata_ip_t daddr; uint16_t dport; -} netdata_socket_idx_t __attribute__((__aligned__(8))); +} netdata_socket_idx_t; // Next values were defined according getnameinfo(3) #define NETDATA_MAX_NETWORK_COMBINED_LENGTH 1018 @@ -362,7 +362,6 @@ extern void update_listen_table(uint16_t value, uint16_t proto, netdata_passive_ extern void parse_network_viewer_section(struct config *cfg); extern void fill_ip_list(ebpf_network_viewer_ip_list_t **out, ebpf_network_viewer_ip_list_t *in, char *table); extern void parse_service_name_section(struct config *cfg); -extern void clean_socket_apps_structures(); extern ebpf_socket_publish_apps_t **socket_bandwidth_curr; extern struct config socket_config; diff --git a/collectors/ebpf.plugin/ebpf_softirq.c b/collectors/ebpf.plugin/ebpf_softirq.c index f5e79279f..ed13f027f 100644 --- a/collectors/ebpf.plugin/ebpf_softirq.c +++ b/collectors/ebpf.plugin/ebpf_softirq.c @@ -54,51 +54,51 @@ static softirq_val_t softirq_vals[] = { // tmp store for soft IRQ values we get from a per-CPU eBPF map. static softirq_ebpf_val_t *softirq_ebpf_vals = NULL; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - -static int read_thread_closed = 1; - static struct netdata_static_thread softirq_threads = {"SOFTIRQ KERNEL", NULL, NULL, 1, NULL, NULL, NULL }; +static enum ebpf_threads_status ebpf_softirq_exited = NETDATA_THREAD_EBPF_RUNNING; /** - * Clean up the main thread. + * Exit + * + * Cancel thread. * * @param ptr thread data. */ -static void softirq_cleanup(void *ptr) +static void softirq_exit(void *ptr) { - for (int i = 0; softirq_tracepoints[i].class != NULL; i++) { - ebpf_disable_tracepoint(&softirq_tracepoints[i]); - } - ebpf_module_t *em = (ebpf_module_t *)ptr; if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; return; } - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 1 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } + ebpf_softirq_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * Cleanup + * + * Clean up allocated memory. + * + * @param ptr thread data. + */ +static void softirq_cleanup(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (ebpf_softirq_exited != NETDATA_THREAD_EBPF_STOPPED) + return; - freez(softirq_ebpf_vals); freez(softirq_threads.thread); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); + for (int i = 0; softirq_tracepoints[i].class != NULL; i++) { + ebpf_disable_tracepoint(&softirq_tracepoints[i]); } + freez(softirq_ebpf_vals); + + softirq_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -131,22 +131,24 @@ static void softirq_read_latency_map() */ static void *softirq_reader(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(softirq_exit, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_SOFTIRQ_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_softirq_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); UNUSED(dt); + if (ebpf_softirq_exited == NETDATA_THREAD_EBPF_STOPPING) + break; softirq_read_latency_map(); } + ebpf_softirq_exited = NETDATA_THREAD_EBPF_STOPPED; - read_thread_closed = 1; + netdata_thread_cleanup_pop(1); return NULL; } @@ -200,7 +202,7 @@ static void softirq_collector(ebpf_module_t *em) netdata_thread_create( softirq_threads.thread, softirq_threads.name, - NETDATA_THREAD_OPTION_JOINABLE, + NETDATA_THREAD_OPTION_DEFAULT, softirq_reader, em ); @@ -213,24 +215,23 @@ static void softirq_collector(ebpf_module_t *em) pthread_mutex_unlock(&lock); // loop and read from published data until ebpf plugin is closed. - int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); - - // write dims now for all hitherto discovered IRQs. - write_begin_chart(NETDATA_EBPF_SYSTEM_GROUP, "softirq_latency"); - softirq_write_dims(); - write_end_chart(); - - pthread_mutex_unlock(&lock); - } - pthread_mutex_unlock(&collect_data_mutex); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = em->update_every * USEC_PER_SEC; + //This will be cancelled by its parent + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; + + pthread_mutex_lock(&lock); + + // write dims now for all hitherto discovered IRQs. + write_begin_chart(NETDATA_EBPF_SYSTEM_GROUP, "softirq_latency"); + softirq_write_dims(); + write_end_chart(); + + pthread_mutex_unlock(&lock); } } @@ -260,8 +261,8 @@ void *ebpf_softirq_thread(void *ptr) goto endsoftirq; } - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; goto endsoftirq; } diff --git a/collectors/ebpf.plugin/ebpf_swap.c b/collectors/ebpf.plugin/ebpf_swap.c index 7d8423358..71d0c402b 100644 --- a/collectors/ebpf.plugin/ebpf_swap.c +++ b/collectors/ebpf.plugin/ebpf_swap.c @@ -7,7 +7,6 @@ static char *swap_dimension_name[NETDATA_SWAP_END] = { "read", "write" }; static netdata_syscall_stat_t swap_aggregated_data[NETDATA_SWAP_END]; static netdata_publish_syscall_t swap_publish_aggregated[NETDATA_SWAP_END]; -static int read_thread_closed = 1; netdata_publish_swap_t *swap_vector = NULL; static netdata_idx_t swap_hash_values[NETDATA_SWAP_END]; @@ -35,11 +34,9 @@ static ebpf_local_maps_t swap_maps[] = {{.name = "tbl_pid_swap", .internal_input .map_fd = ND_EBPF_MAP_FD_NOT_INITIALIZED}, {.name = NULL, .internal_input = 0, .user_input = 0}}; -static struct bpf_link **probe_links = NULL; -static struct bpf_object *objects = NULL; - struct netdata_static_thread swap_threads = {"SWAP KERNEL", NULL, NULL, 1, NULL, NULL, NULL}; +static enum ebpf_threads_status ebpf_swap_exited = NETDATA_THREAD_EBPF_RUNNING; netdata_ebpf_targets_t swap_targets[] = { {.name = "swap_readpage", .mode = EBPF_LOAD_TRAMPOLINE}, {.name = "swap_writepage", .mode = EBPF_LOAD_TRAMPOLINE}, @@ -196,54 +193,48 @@ static inline int ebpf_swap_load_and_attach(struct swap_bpf *obj, ebpf_module_t *****************************************************************/ /** - * Clean swap structure + * Swap exit + * + * Cancel thread and exit. + * + * @param ptr thread data. */ -void clean_swap_pid_structures() { - struct pid_stat *pids = root_of_pids; - while (pids) { - freez(swap_pid[pids->pid]); - - pids = pids->next; +static void ebpf_swap_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; } + + ebpf_swap_exited = NETDATA_THREAD_EBPF_STOPPING; } /** - * Clean up the main thread. + * Swap cleanup + * + * Clean up allocated memory. * * @param ptr thread data. */ static void ebpf_swap_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (ebpf_swap_exited != NETDATA_THREAD_EBPF_STOPPED) return; - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - ebpf_cleanup_publish_syscall(swap_publish_aggregated); freez(swap_vector); freez(swap_values); + freez(swap_threads.thread); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } #ifdef LIBBPF_MAJOR_VERSION - else if (bpf_obj) + if (bpf_obj) swap_bpf__destroy(bpf_obj); #endif + swap_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -404,21 +395,24 @@ static void read_global_table() */ void *ebpf_swap_read_hash(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(ebpf_swap_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_SWAP_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_swap_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_swap_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_swap_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -523,7 +517,7 @@ static int ebpf_send_systemd_swap_charts() for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, (long long) ect->publish_systemd_swap.read); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -690,37 +684,38 @@ static void swap_collector(ebpf_module_t *em) swap_threads.thread = mallocz(sizeof(netdata_thread_t)); swap_threads.start_routine = ebpf_swap_read_hash; - netdata_thread_create(swap_threads.thread, swap_threads.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(swap_threads.thread, swap_threads.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_swap_read_hash, em); - int apps = em->apps_charts; int cgroup = em->cgroup_charts; int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - if (++counter == update_every) { - counter = 0; - if (apps) - read_apps_table(); + netdata_apps_integration_flags_t apps = em->apps_charts; + pthread_mutex_lock(&collect_data_mutex); + if (apps) + read_apps_table(); - if (cgroup) - ebpf_update_swap_cgroup(); + if (cgroup) + ebpf_update_swap_cgroup(); - pthread_mutex_lock(&lock); + pthread_mutex_lock(&lock); - swap_send_global(); + swap_send_global(); - if (apps) - ebpf_swap_send_apps_data(apps_groups_root_target); + if (apps & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) + ebpf_swap_send_apps_data(apps_groups_root_target); - if (cgroup) - ebpf_swap_send_cgroup_data(update_every); + if (cgroup) + ebpf_swap_send_cgroup_data(update_every); - pthread_mutex_unlock(&lock); - } + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } @@ -758,6 +753,7 @@ void ebpf_swap_create_apps_charts(struct ebpf_module *em, void *ptr) 20192, ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_SWAP); + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /** @@ -817,8 +813,8 @@ static int ebpf_swap_load_bpf(ebpf_module_t *em) { int ret = 0; if (em->load == EBPF_LOAD_LEGACY) { - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { ret = -1; } } @@ -849,7 +845,7 @@ static int ebpf_swap_load_bpf(ebpf_module_t *em) */ void *ebpf_swap_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_swap_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_swap_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = swap_maps; diff --git a/collectors/ebpf.plugin/ebpf_swap.h b/collectors/ebpf.plugin/ebpf_swap.h index 31bda16a2..80c2c8e94 100644 --- a/collectors/ebpf.plugin/ebpf_swap.h +++ b/collectors/ebpf.plugin/ebpf_swap.h @@ -46,7 +46,6 @@ extern netdata_publish_swap_t **swap_pid; extern void *ebpf_swap_thread(void *ptr); extern void ebpf_swap_create_apps_charts(struct ebpf_module *em, void *ptr); -extern void clean_swap_pid_structures(); extern struct config swap_config; extern netdata_ebpf_targets_t swap_targets[]; diff --git a/collectors/ebpf.plugin/ebpf_sync.c b/collectors/ebpf.plugin/ebpf_sync.c index b45ec86c1..0e56f541d 100644 --- a/collectors/ebpf.plugin/ebpf_sync.c +++ b/collectors/ebpf.plugin/ebpf_sync.c @@ -8,8 +8,6 @@ static char *sync_counter_dimension_name[NETDATA_SYNC_IDX_END] = { "sync", "sync static netdata_syscall_stat_t sync_counter_aggregated_data[NETDATA_SYNC_IDX_END]; static netdata_publish_syscall_t sync_counter_publish_aggregated[NETDATA_SYNC_IDX_END]; -static int read_thread_closed = 1; - static netdata_idx_t sync_hash_values[NETDATA_SYNC_IDX_END]; struct netdata_static_thread sync_threads = {"SYNC KERNEL", NULL, NULL, 1, @@ -43,44 +41,6 @@ struct config sync_config = { .first_section = NULL, .index = { .avl_tree = { .root = NULL, .compar = appconfig_section_compare }, .rwlock = AVL_LOCK_INITIALIZER } }; -ebpf_sync_syscalls_t local_syscalls[] = { - {.syscall = NETDATA_SYSCALLS_SYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, -#ifdef LIBBPF_MAJOR_VERSION - .sync_obj = NULL -#endif - }, - {.syscall = NETDATA_SYSCALLS_SYNCFS, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, -#ifdef LIBBPF_MAJOR_VERSION - .sync_obj = NULL -#endif - }, - {.syscall = NETDATA_SYSCALLS_MSYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, -#ifdef LIBBPF_MAJOR_VERSION - .sync_obj = NULL -#endif - }, - {.syscall = NETDATA_SYSCALLS_FSYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, -#ifdef LIBBPF_MAJOR_VERSION - .sync_obj = NULL -#endif - }, - {.syscall = NETDATA_SYSCALLS_FDATASYNC, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, -#ifdef LIBBPF_MAJOR_VERSION - .sync_obj = NULL -#endif - }, - {.syscall = NETDATA_SYSCALLS_SYNC_FILE_RANGE, .enabled = CONFIG_BOOLEAN_YES, .objects = NULL, .probe_links = NULL, -#ifdef LIBBPF_MAJOR_VERSION - .sync_obj = NULL -#endif - }, - {.syscall = NULL, .enabled = CONFIG_BOOLEAN_NO, .objects = NULL, .probe_links = NULL, -#ifdef LIBBPF_MAJOR_VERSION - .sync_obj = NULL -#endif - } -}; - netdata_ebpf_targets_t sync_targets[] = { {.name = NETDATA_SYSCALLS_SYNC, .mode = EBPF_LOAD_TRAMPOLINE}, {.name = NETDATA_SYSCALLS_SYNCFS, .mode = EBPF_LOAD_TRAMPOLINE}, {.name = NETDATA_SYSCALLS_MSYNC, .mode = EBPF_LOAD_TRAMPOLINE}, @@ -88,6 +48,7 @@ netdata_ebpf_targets_t sync_targets[] = { {.name = NETDATA_SYSCALLS_SYNC, .mode {.name = NETDATA_SYSCALLS_FDATASYNC, .mode = EBPF_LOAD_TRAMPOLINE}, {.name = NETDATA_SYSCALLS_SYNC_FILE_RANGE, .mode = EBPF_LOAD_TRAMPOLINE}, {.name = NULL, .mode = EBPF_LOAD_TRAMPOLINE}}; +static enum ebpf_threads_status ebpf_sync_exited = NETDATA_THREAD_EBPF_RUNNING; #ifdef LIBBPF_MAJOR_VERSION @@ -216,6 +177,76 @@ static inline int ebpf_sync_load_and_attach(struct sync_bpf *obj, ebpf_module_t } #endif +/***************************************************************** + * + * CLEANUP THREAD + * + *****************************************************************/ + +/** + * Cleanup Objects + * + * Cleanup loaded objects when thread was initialized. + */ +void ebpf_sync_cleanup_objects() +{ + int i; + for (i = 0; local_syscalls[i].syscall; i++) { + ebpf_sync_syscalls_t *w = &local_syscalls[i]; + if (w->probe_links) { + struct bpf_program *prog; + size_t j = 0 ; + bpf_object__for_each_program(prog, w->objects) { + bpf_link__destroy(w->probe_links[j]); + j++; + } + freez(w->probe_links); + if (w->objects) + bpf_object__close(w->objects); + } +#ifdef LIBBPF_MAJOR_VERSION + else if (w->sync_obj) + sync_bpf__destroy(w->sync_obj); +#endif + } +} + +/** + * Exit + * + * Clean up the main thread. + * + * @param ptr thread data. + */ +static void ebpf_sync_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; + } + + ebpf_sync_exited = NETDATA_THREAD_EBPF_STOPPING; +} + +/** + * Clean up the main thread. + * + * @param ptr thread data. + */ +static void ebpf_sync_cleanup(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (ebpf_sync_exited != NETDATA_THREAD_EBPF_STOPPED) + return; + + ebpf_sync_cleanup_objects(); + freez(sync_threads.thread); + + sync_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; +} + /***************************************************************** * * INITIALIZE THREAD @@ -334,21 +365,25 @@ static void read_global_table() */ void *ebpf_sync_read_hash(void *ptr) { + netdata_thread_cleanup_push(ebpf_sync_cleanup, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; - read_thread_closed = 0; heartbeat_t hb; heartbeat_init(&hb); usec_t step = NETDATA_EBPF_SYNC_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + while (ebpf_sync_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_sync_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_sync_exited = NETDATA_THREAD_EBPF_STOPPED; + + netdata_thread_cleanup_pop(1); return NULL; } @@ -414,82 +449,25 @@ static void sync_collector(ebpf_module_t *em) sync_threads.thread = mallocz(sizeof(netdata_thread_t)); sync_threads.start_routine = ebpf_sync_read_hash; - netdata_thread_create(sync_threads.thread, sync_threads.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(sync_threads.thread, sync_threads.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_sync_read_hash, em); - int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); - - if (++counter == update_every) { - counter = 0; - pthread_mutex_lock(&lock); - - sync_send_data(); - - pthread_mutex_unlock(&lock); - } - pthread_mutex_unlock(&collect_data_mutex); - } -} + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = em->update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; + pthread_mutex_lock(&lock); -/***************************************************************** - * - * CLEANUP THREAD - * - *****************************************************************/ + sync_send_data(); -/** - * Cleanup Objects - * - * Cleanup loaded objects when thread was initialized. - */ -void ebpf_sync_cleanup_objects() -{ - int i; - for (i = 0; local_syscalls[i].syscall; i++) { - ebpf_sync_syscalls_t *w = &local_syscalls[i]; - if (w->probe_links) { - struct bpf_program *prog; - size_t j = 0 ; - bpf_object__for_each_program(prog, w->objects) { - bpf_link__destroy(w->probe_links[j]); - j++; - } - bpf_object__close(w->objects); - } -#ifdef LIBBPF_MAJOR_VERSION - else if (w->sync_obj) - sync_bpf__destroy(w->sync_obj); -#endif + pthread_mutex_unlock(&lock); } } -/** - * Clean up the main thread. - * - * @param ptr thread data. - */ -static void ebpf_sync_cleanup(void *ptr) -{ - ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) - return; - - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 2*USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - - ebpf_sync_cleanup_objects(); - freez(sync_threads.thread); -} /***************************************************************** * @@ -587,7 +565,7 @@ static void ebpf_sync_parse_syscalls() */ void *ebpf_sync_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_sync_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_sync_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = sync_maps; diff --git a/collectors/ebpf.plugin/ebpf_sync.h b/collectors/ebpf.plugin/ebpf_sync.h index 2bc18c544..a52434c17 100644 --- a/collectors/ebpf.plugin/ebpf_sync.h +++ b/collectors/ebpf.plugin/ebpf_sync.h @@ -41,23 +41,6 @@ typedef enum sync_syscalls_index { NETDATA_SYNC_IDX_END } sync_syscalls_index_t; -typedef struct ebpf_sync_syscalls { - char *syscall; - int enabled; - uint32_t flags; - - // BTF structure - struct bpf_object *objects; - struct bpf_link **probe_links; - - // BPF structure -#ifdef LIBBPF_MAJOR_VERSION - struct sync_bpf *sync_obj; -#else - void *sync_obj; -#endif -} ebpf_sync_syscalls_t; - enum netdata_sync_charts { NETDATA_SYNC_CALL, diff --git a/collectors/ebpf.plugin/ebpf_vfs.c b/collectors/ebpf.plugin/ebpf_vfs.c index e14165fb7..6746cc624 100644 --- a/collectors/ebpf.plugin/ebpf_vfs.c +++ b/collectors/ebpf.plugin/ebpf_vfs.c @@ -34,33 +34,32 @@ struct config vfs_config = { .first_section = NULL, .index = { .avl_tree = { .root = NULL, .compar = appconfig_section_compare }, .rwlock = AVL_LOCK_INITIALIZER } }; -static struct bpf_object *objects = NULL; -static struct bpf_link **probe_links = NULL; - struct netdata_static_thread vfs_threads = {"VFS KERNEL", NULL, NULL, 1, NULL, NULL, NULL}; - -static int read_thread_closed = 1; +static enum ebpf_threads_status ebpf_vfs_exited = NETDATA_THREAD_EBPF_RUNNING; /***************************************************************** * * FUNCTIONS TO CLOSE THE THREAD * *****************************************************************/ - /** - * Clean PID structures + * Exit * - * Clean the allocated structures. - */ -void clean_vfs_pid_structures() { - struct pid_stat *pids = root_of_pids; - while (pids) { - freez(vfs_pid[pids->pid]); - - pids = pids->next; + * Cancel thread and exit. + * + * @param ptr thread data. +**/ +static void ebpf_vfs_exit(void *ptr) +{ + ebpf_module_t *em = (ebpf_module_t *)ptr; + if (!em->enabled) { + em->enabled = NETDATA_MAIN_THREAD_EXITED; + return; } + + ebpf_vfs_exited = NETDATA_THREAD_EBPF_STOPPING; } /** @@ -71,29 +70,15 @@ void clean_vfs_pid_structures() { static void ebpf_vfs_cleanup(void *ptr) { ebpf_module_t *em = (ebpf_module_t *)ptr; - if (!em->enabled) + if (ebpf_vfs_exited != NETDATA_THREAD_EBPF_STOPPED) return; - heartbeat_t hb; - heartbeat_init(&hb); - uint32_t tick = 50 * USEC_PER_MS; - while (!read_thread_closed) { - usec_t dt = heartbeat_next(&hb, tick); - UNUSED(dt); - } - freez(vfs_hash_values); freez(vfs_vector); + freez(vfs_threads.thread); - if (probe_links) { - struct bpf_program *prog; - size_t i = 0 ; - bpf_object__for_each_program(prog, objects) { - bpf_link__destroy(probe_links[i]); - i++; - } - bpf_object__close(objects); - } + vfs_threads.enabled = NETDATA_MAIN_THREAD_EXITED; + em->enabled = NETDATA_MAIN_THREAD_EXITED; } /***************************************************************** @@ -526,23 +511,26 @@ static void read_update_vfs_cgroup() */ void *ebpf_vfs_read_hash(void *ptr) { - read_thread_closed = 0; - + netdata_thread_cleanup_push(ebpf_vfs_cleanup, ptr); heartbeat_t hb; heartbeat_init(&hb); ebpf_module_t *em = (ebpf_module_t *)ptr; usec_t step = NETDATA_LATENCY_VFS_SLEEP_MS * em->update_every; - while (!close_ebpf_plugin) { + //This will be cancelled by its parent + while (ebpf_vfs_exited == NETDATA_THREAD_EBPF_RUNNING) { usec_t dt = heartbeat_next(&hb, step); (void)dt; + if (ebpf_vfs_exited == NETDATA_THREAD_EBPF_STOPPING) + break; read_global_table(); } - read_thread_closed = 1; + ebpf_vfs_exited = NETDATA_THREAD_EBPF_STOPPED; + netdata_thread_cleanup_pop(1); return NULL; } @@ -1000,7 +988,7 @@ static int ebpf_send_systemd_vfs_charts(ebpf_module_t *em) for (ect = ebpf_cgroup_pids; ect ; ect = ect->next) { if (unlikely(ect->systemd) && unlikely(ect->updated)) { write_chart_dimension(ect->name, ect->publish_systemd_vfs.unlink_call); - } else + } else if (unlikely(ect->systemd)) ret = 0; } write_end_chart(); @@ -1181,38 +1169,38 @@ static void vfs_collector(ebpf_module_t *em) vfs_threads.thread = mallocz(sizeof(netdata_thread_t)); vfs_threads.start_routine = ebpf_vfs_read_hash; - netdata_thread_create(vfs_threads.thread, vfs_threads.name, NETDATA_THREAD_OPTION_JOINABLE, + netdata_thread_create(vfs_threads.thread, vfs_threads.name, NETDATA_THREAD_OPTION_DEFAULT, ebpf_vfs_read_hash, em); - int apps = em->apps_charts; int cgroups = em->cgroup_charts; - int update_every = em->update_every; - int counter = update_every - 1; - while (!close_ebpf_plugin) { - pthread_mutex_lock(&collect_data_mutex); - pthread_cond_wait(&collect_data_cond_var, &collect_data_mutex); + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = em->update_every * USEC_PER_SEC; + while (!ebpf_exit_plugin) { + (void)heartbeat_next(&hb, step); + if (ebpf_exit_plugin) + break; - if (++counter == update_every) { - counter = 0; - if (apps) - ebpf_vfs_read_apps(); + netdata_apps_integration_flags_t apps = em->apps_charts; + pthread_mutex_lock(&collect_data_mutex); + if (apps) + ebpf_vfs_read_apps(); - if (cgroups) - read_update_vfs_cgroup(); + if (cgroups) + read_update_vfs_cgroup(); - pthread_mutex_lock(&lock); + pthread_mutex_lock(&lock); - ebpf_vfs_send_data(em); - fflush(stdout); + ebpf_vfs_send_data(em); + fflush(stdout); - if (apps) - ebpf_vfs_send_apps_data(em, apps_groups_root_target); + if (apps & NETDATA_EBPF_APPS_FLAG_CHART_CREATED) + ebpf_vfs_send_apps_data(em, apps_groups_root_target); - if (cgroups) - ebpf_vfs_send_cgroup_data(em); + if (cgroups) + ebpf_vfs_send_cgroup_data(em); - pthread_mutex_unlock(&lock); - } + pthread_mutex_unlock(&lock); pthread_mutex_unlock(&collect_data_mutex); } } @@ -1520,6 +1508,8 @@ void ebpf_vfs_create_apps_charts(struct ebpf_module *em, void *ptr) ebpf_algorithms[NETDATA_EBPF_INCREMENTAL_IDX], root, em->update_every, NETDATA_EBPF_MODULE_NAME_VFS); } + + em->apps_charts |= NETDATA_EBPF_APPS_FLAG_CHART_CREATED; } /***************************************************************** @@ -1564,7 +1554,7 @@ static void ebpf_vfs_allocate_global_vectors(int apps) */ void *ebpf_vfs_thread(void *ptr) { - netdata_thread_cleanup_push(ebpf_vfs_cleanup, ptr); + netdata_thread_cleanup_push(ebpf_vfs_exit, ptr); ebpf_module_t *em = (ebpf_module_t *)ptr; em->maps = vfs_maps; @@ -1576,8 +1566,8 @@ void *ebpf_vfs_thread(void *ptr) if (!em->enabled) goto endvfs; - probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &objects); - if (!probe_links) { + em->probe_links = ebpf_load_program(ebpf_plugin_dir, em, running_on_kernel, isrh, &em->objects); + if (!em->probe_links) { em->enabled = CONFIG_BOOLEAN_NO; goto endvfs; } diff --git a/collectors/ebpf.plugin/ebpf_vfs.h b/collectors/ebpf.plugin/ebpf_vfs.h index 67542ad44..87a21e39c 100644 --- a/collectors/ebpf.plugin/ebpf_vfs.h +++ b/collectors/ebpf.plugin/ebpf_vfs.h @@ -156,7 +156,6 @@ extern netdata_publish_vfs_t **vfs_pid; extern void *ebpf_vfs_thread(void *ptr); extern void ebpf_vfs_create_apps_charts(struct ebpf_module *em, void *ptr); -extern void clean_vfs_pid_structures(); extern struct config vfs_config; diff --git a/collectors/freebsd.plugin/freebsd_sysctl.c b/collectors/freebsd.plugin/freebsd_sysctl.c index c43743c35..016a71e37 100644 --- a/collectors/freebsd.plugin/freebsd_sysctl.c +++ b/collectors/freebsd.plugin/freebsd_sysctl.c @@ -178,15 +178,15 @@ int do_vm_loadavg(int update_every, usec_t dt){ int do_vm_vmtotal(int update_every, usec_t dt) { (void)dt; - static int do_all_processes = -1, do_processes = -1, do_committed = -1; + static int do_all_processes = -1, do_processes = -1, do_mem_real = -1; if (unlikely(do_all_processes == -1)) { do_all_processes = config_get_boolean("plugin:freebsd:vm.vmtotal", "enable total processes", 1); do_processes = config_get_boolean("plugin:freebsd:vm.vmtotal", "processes running", 1); - do_committed = config_get_boolean("plugin:freebsd:vm.vmtotal", "committed memory", 1); + do_mem_real = config_get_boolean("plugin:freebsd:vm.vmtotal", "real memory", 1); } - if (likely(do_all_processes | do_processes | do_committed)) { + if (likely(do_all_processes | do_processes | do_mem_real)) { static int mib[2] = {0, 0}; struct vmtotal vmtotal_data; @@ -195,8 +195,8 @@ int do_vm_vmtotal(int update_every, usec_t dt) { error("DISABLED: system.active_processes chart"); do_processes = 0; error("DISABLED: system.processes chart"); - do_committed = 0; - error("DISABLED: mem.committed chart"); + do_mem_real = 0; + error("DISABLED: mem.real chart"); error("DISABLED: vm.vmtotal module"); return 1; } else { @@ -264,18 +264,18 @@ int do_vm_vmtotal(int update_every, usec_t dt) { // -------------------------------------------------------------------- - if (likely(do_committed)) { + if (likely(do_mem_real)) { static RRDSET *st = NULL; static RRDDIM *rd = NULL; if (unlikely(!st)) { st = rrdset_create_localhost( "mem", - "committed", + "real", NULL, "system", NULL, - "Committed (Allocated) Memory", + "Total Real Memory In Use", "MiB", "freebsd.plugin", "vm.vmtotal", @@ -285,7 +285,7 @@ int do_vm_vmtotal(int update_every, usec_t dt) { ); rrdset_flag_set(st, RRDSET_FLAG_DETAIL); - rd = rrddim_add(st, "Committed_AS", NULL, system_pagesize, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); + rd = rrddim_add(st, "used", NULL, system_pagesize, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); } else rrdset_next(st); @@ -1005,9 +1005,9 @@ int do_system_ram(int update_every, usec_t dt) { // -------------------------------------------------------------------- - static RRDSET *st = NULL; + static RRDSET *st = NULL, *st_mem_available = NULL; static RRDDIM *rd_free = NULL, *rd_active = NULL, *rd_inactive = NULL, *rd_wired = NULL, - *rd_cache = NULL, *rd_buffers = NULL; + *rd_cache = NULL, *rd_buffers = NULL, *rd_avail = NULL; #if defined(NETDATA_COLLECT_LAUNDRY) static RRDDIM *rd_laundry = NULL; @@ -1044,9 +1044,9 @@ int do_system_ram(int update_every, usec_t dt) { rrddim_set_by_pointer(st, rd_free, vmmeter_data.v_free_count); rrddim_set_by_pointer(st, rd_active, vmmeter_data.v_active_count); rrddim_set_by_pointer(st, rd_inactive, vmmeter_data.v_inactive_count); - rrddim_set_by_pointer(st, rd_wired, vmmeter_data.v_wire_count * system_pagesize - zfs_arcstats_shrinkable_cache_size_bytes); + rrddim_set_by_pointer(st, rd_wired, (unsigned long long)vmmeter_data.v_wire_count * (unsigned long long)system_pagesize - zfs_arcstats_shrinkable_cache_size_bytes); #if __FreeBSD_version < 1200016 - rrddim_set_by_pointer(st, rd_cache, vmmeter_data.v_cache_count * system_pagesize + zfs_arcstats_shrinkable_cache_size_bytes); + rrddim_set_by_pointer(st, rd_cache, (unsigned long long)vmmeter_data.v_cache_count * (unsigned long long)system_pagesize + zfs_arcstats_shrinkable_cache_size_bytes); #else rrddim_set_by_pointer(st, rd_cache, zfs_arcstats_shrinkable_cache_size_bytes); #endif @@ -1055,6 +1055,34 @@ int do_system_ram(int update_every, usec_t dt) { #endif rrddim_set_by_pointer(st, rd_buffers, vfs_bufspace_count); rrdset_done(st); + + if (unlikely(!st_mem_available)) { + st_mem_available = rrdset_create_localhost( + "mem", + "available", + NULL, + "system", + NULL, + "Available RAM for applications", + "MiB", + "freebsd.plugin", + "system.ram", + NETDATA_CHART_PRIO_MEM_SYSTEM_AVAILABLE, + update_every, + RRDSET_TYPE_AREA + ); + + rd_avail = rrddim_add(st_mem_available, "MemAvailable", "avail", system_pagesize, MEGA_FACTOR, RRD_ALGORITHM_ABSOLUTE); + } + else rrdset_next(st_mem_available); + +#if __FreeBSD_version < 1200016 + rrddim_set_by_pointer(st_mem_available, rd_avail, vmmeter_data.v_inactive_count + vmmeter_data.v_free_count + vmmeter_data.v_cache_count + zfs_arcstats_shrinkable_cache_size_bytes / system_pagesize); +#else + rrddim_set_by_pointer(st_mem_available, rd_avail, vmmeter_data.v_inactive_count + vmmeter_data.v_free_count + zfs_arcstats_shrinkable_cache_size_bytes / system_pagesize); +#endif + + rrdset_done(st_mem_available); } return 0; diff --git a/collectors/perf.plugin/perf_plugin.c b/collectors/perf.plugin/perf_plugin.c index 80e042edc..b2f7d2e17 100644 --- a/collectors/perf.plugin/perf_plugin.c +++ b/collectors/perf.plugin/perf_plugin.c @@ -520,8 +520,8 @@ static void perf_send_metrics() { , "instructions_per_cycle" ); - calculated_number result = ((calculated_number)perf_events[EV_ID_INSTRUCTIONS].value / - (calculated_number)perf_events[EV_ID_CPU_CYCLES].value) * 100.0; + NETDATA_DOUBLE result = ((NETDATA_DOUBLE)perf_events[EV_ID_INSTRUCTIONS].value / + (NETDATA_DOUBLE)perf_events[EV_ID_CPU_CYCLES].value) * 100.0; printf("SET %s = %lld\n" , "ipc" , (collected_number) result diff --git a/collectors/plugins.d/README.md b/collectors/plugins.d/README.md index c84384215..0741636b9 100644 --- a/collectors/plugins.d/README.md +++ b/collectors/plugins.d/README.md @@ -116,15 +116,17 @@ For example, if your plugin wants to monitor `squid`, you can search for it on p Any program that can print a few values to its standard output can become a Netdata external plugin. -Netdata parses 7 lines starting with: - -- `CHART` - create or update a chart -- `DIMENSION` - add or update a dimension to the chart just created -- `BEGIN` - initialize data collection for a chart -- `SET` - set the value of a dimension for the initialized chart -- `END` - complete data collection for the initialized chart -- `FLUSH` - ignore the last collected values -- `DISABLE` - disable this plugin +Netdata parses 9 lines starting with: + +- `CHART` - create or update a chart +- `DIMENSION` - add or update a dimension to the chart just created +- `BEGIN` - initialize data collection for a chart +- `SET` - set the value of a dimension for the initialized chart +- `END` - complete data collection for the initialized chart +- `FLUSH` - ignore the last collected values +- `DISABLE` - disable this plugin +- `CLABEL` - add a label to a chart +- `CLABEL_COMMIT` - commit added labels to the chart. a single program can produce any number of charts with any number of dimensions each. @@ -151,6 +153,7 @@ available for the plugin to use. |`NETDATA_USER_CONFIG_DIR`|The directory where all Netdata-related user configuration should be stored. If the plugin requires custom user configuration, this is the place the user has saved it (normally under `/etc/netdata`).| |`NETDATA_STOCK_CONFIG_DIR`|The directory where all Netdata -related stock configuration should be stored. If the plugin is shipped with configuration files, this is the place they can be found (normally under `/usr/lib/netdata/conf.d`).| |`NETDATA_PLUGINS_DIR`|The directory where all Netdata plugins are stored.| +|`NETDATA_USER_PLUGINS_DIRS`|The list of directories where custom plugins are stored.| |`NETDATA_WEB_DIR`|The directory where the web files of Netdata are saved.| |`NETDATA_CACHE_DIR`|The directory where the cache files of Netdata are stored. Use this directory if the plugin requires a place to store data. A new directory should be created for the plugin for this purpose, inside this directory.| |`NETDATA_LOG_DIR`|The directory where the log files are stored. By default the `stderr` output of the plugin will be saved in the `error.log` file of Netdata.| @@ -319,6 +322,46 @@ The `value` is floating point (Netdata used `long double`). Variables are transferred to upstream Netdata servers (streaming and database replication). +#### CLABEL + +> CLABEL name value source + +`CLABEL` defines a label used to organize and identify a chart. + +Name and value accept characters according to the following table: + +| Character | Symbol | Label Name | Label Value | +|---------------------|:------:|:----------:|:-----------:| +| UTF-8 character | UTF-8 | _ | keep | +| Lower case letter | [a-z] | keep | keep | +| Upper case letter | [A-Z] | keep | [a-z] | +| Digit | [0-9] | keep | keep | +| Underscore | _ | keep | keep | +| Minus | - | keep | keep | +| Plus | + | _ | keep | +| Colon | : | _ | keep | +| Semicolon | ; | _ | : | +| Equal | = | _ | : | +| Period | . | keep | keep | +| Comma | , | . | . | +| Slash | / | keep | keep | +| Backslash | \ | / | / | +| At | @ | _ | keep | +| Space | ' ' | _ | keep | +| Opening parenthesis | ( | _ | keep | +| Closing parenthesis | ) | _ | keep | +| Anything else | | _ | _ | + +The `source` is an integer field that can have the following values: +- `1`: The value was set automatically. +- `2`: The value was set manually. +- `4`: This is a K8 label. +- `8`: This is a label defined using `netdata` agent cloud link. + +#### CLABEL_COMMIT + +`CLABEL_COMMIT` indicates that all labels were defined and the chart can be updated. + ## Data collection data collection is defined as a series of `BEGIN` -> `SET` -> `END` lines diff --git a/collectors/plugins.d/plugins_d.c b/collectors/plugins.d/plugins_d.c index 2916f1c13..377ec1401 100644 --- a/collectors/plugins.d/plugins_d.c +++ b/collectors/plugins.d/plugins_d.c @@ -39,7 +39,7 @@ inline int config_isspace(char c) inline int quoted_strings_splitter(char *str, char **words, int max_words, int (*custom_isspace)(char), char *recover_input, char **recover_location, int max_recover) { char *s = str, quote = 0; - int i = 0, j, rec = 0; + int i = 0, rec = 0; char *recover = recover_input; // skip all white space @@ -112,9 +112,7 @@ inline int quoted_strings_splitter(char *str, char **words, int max_words, int ( } // terminate the words - j = i; - while (likely(j < max_words)) - words[j++] = NULL; + memset(&words[i], 0, (max_words - i) * sizeof (char *)); return i; } diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c index f014a29d0..88e07fab7 100644 --- a/collectors/plugins.d/pluginsd_parser.c +++ b/collectors/plugins.d/pluginsd_parser.c @@ -96,7 +96,7 @@ PARSER_RC pluginsd_disable_action(void *user) } -PARSER_RC pluginsd_variable_action(void *user, RRDHOST *host, RRDSET *st, char *name, int global, calculated_number value) +PARSER_RC pluginsd_variable_action(void *user, RRDHOST *host, RRDSET *st, char *name, int global, NETDATA_DOUBLE value) { UNUSED(user); @@ -146,35 +146,41 @@ PARSER_RC pluginsd_dimension_action(void *user, RRDSET *st, char *id, char *name if (likely(unhide_dimension)) { rrddim_flag_clear(rd, RRDDIM_FLAG_HIDDEN); if (rrddim_flag_check(rd, RRDDIM_FLAG_META_HIDDEN)) { - (void)sql_set_dimension_option(&rd->state->metric_uuid, NULL); + (void)sql_set_dimension_option(&rd->metric_uuid, NULL); rrddim_flag_clear(rd, RRDDIM_FLAG_META_HIDDEN); } } else { rrddim_flag_set(rd, RRDDIM_FLAG_HIDDEN); if (!rrddim_flag_check(rd, RRDDIM_FLAG_META_HIDDEN)) { - (void)sql_set_dimension_option(&rd->state->metric_uuid, "hidden"); + (void)sql_set_dimension_option(&rd->metric_uuid, "hidden"); rrddim_flag_set(rd, RRDDIM_FLAG_META_HIDDEN); } } return PARSER_RC_OK; } -PARSER_RC pluginsd_label_action(void *user, char *key, char *value, LABEL_SOURCE source) +PARSER_RC pluginsd_label_action(void *user, char *key, char *value, RRDLABEL_SRC source) { - ((PARSER_USER_OBJECT *) user)->new_labels = add_label_to_list(((PARSER_USER_OBJECT *) user)->new_labels, key, value, source); + if(unlikely(!((PARSER_USER_OBJECT *) user)->new_host_labels)) + ((PARSER_USER_OBJECT *) user)->new_host_labels = rrdlabels_create(); + + rrdlabels_add(((PARSER_USER_OBJECT *)user)->new_host_labels, key, value, source); return PARSER_RC_OK; } -PARSER_RC pluginsd_clabel_action(void *user, char *key, char *value, LABEL_SOURCE source) +PARSER_RC pluginsd_clabel_action(void *user, char *key, char *value, RRDLABEL_SRC source) { - ((PARSER_USER_OBJECT *) user)->chart_labels = add_label_to_list(((PARSER_USER_OBJECT *) user)->chart_labels, key, value, source); + if(unlikely(!((PARSER_USER_OBJECT *) user)->new_chart_labels)) + ((PARSER_USER_OBJECT *) user)->new_chart_labels = rrdlabels_create(); + + rrdlabels_add(((PARSER_USER_OBJECT *)user)->new_chart_labels, key, value, source); return PARSER_RC_OK; } -PARSER_RC pluginsd_clabel_commit_action(void *user, RRDHOST *host, struct label *new_labels) +PARSER_RC pluginsd_clabel_commit_action(void *user, RRDHOST *host, DICTIONARY *new_chart_labels) { RRDSET *st = ((PARSER_USER_OBJECT *)user)->st; if (unlikely(!st)) { @@ -182,21 +188,21 @@ PARSER_RC pluginsd_clabel_commit_action(void *user, RRDHOST *host, struct label return PARSER_RC_OK; } - rrdset_update_labels(st, new_labels); + rrdset_update_rrdlabels(st, new_chart_labels); + return PARSER_RC_OK; } -PARSER_RC pluginsd_overwrite_action(void *user, RRDHOST *host, struct label *new_labels) +PARSER_RC pluginsd_overwrite_action(void *user, RRDHOST *host, DICTIONARY *new_host_labels) { UNUSED(user); - if (!host->labels.head) { - host->labels.head = new_labels; - } else { - rrdhost_rdlock(host); - replace_label_list(&host->labels, new_labels); - rrdhost_unlock(host); - } + if(!host->host_labels) + host->host_labels = rrdlabels_create(); + + rrdlabels_migrate_to_these(host->host_labels, new_host_labels); + sql_store_host_labels(host); + return PARSER_RC_OK; } @@ -468,7 +474,7 @@ PARSER_RC pluginsd_variable(char **words, void *user, PLUGINSD_ACTION *plugins_ { char *name = words[1]; char *value = words[2]; - calculated_number v; + NETDATA_DOUBLE v; RRDSET *st = ((PARSER_USER_OBJECT *) user)->st; RRDHOST *host = ((PARSER_USER_OBJECT *) user)->host; @@ -508,7 +514,7 @@ PARSER_RC pluginsd_variable(char **words, void *user, PLUGINSD_ACTION *plugins_ } char *endptr = NULL; - v = (calculated_number)str2ld(value, &endptr); + v = (NETDATA_DOUBLE)str2ndd(value, &endptr); if (unlikely(endptr && *endptr)) { if (endptr == value) error( @@ -615,14 +621,15 @@ PARSER_RC pluginsd_clabel_commit(char **words, void *user, PLUGINSD_ACTION *plu RRDHOST *host = ((PARSER_USER_OBJECT *) user)->host; debug(D_PLUGINSD, "requested to commit chart labels"); - struct label *chart_labels = ((PARSER_USER_OBJECT *)user)->chart_labels; - ((PARSER_USER_OBJECT *)user)->chart_labels = NULL; + PARSER_RC rc = PARSER_RC_OK; - if (plugins_action->clabel_commit_action) { - return plugins_action->clabel_commit_action(user, host, chart_labels); - } + if (plugins_action->clabel_commit_action) + rc = plugins_action->clabel_commit_action(user, host, ((PARSER_USER_OBJECT *)user)->new_chart_labels); - return PARSER_RC_OK; + rrdlabels_destroy(((PARSER_USER_OBJECT *)user)->new_chart_labels); + ((PARSER_USER_OBJECT *)user)->new_chart_labels = NULL; + + return rc; } PARSER_RC pluginsd_overwrite(char **words, void *user, PLUGINSD_ACTION *plugins_action) @@ -630,16 +637,17 @@ PARSER_RC pluginsd_overwrite(char **words, void *user, PLUGINSD_ACTION *plugins UNUSED(words); RRDHOST *host = ((PARSER_USER_OBJECT *) user)->host; - debug(D_PLUGINSD, "requested a OVERWRITE a variable"); + debug(D_PLUGINSD, "requested to OVERWRITE host labels"); - struct label *new_labels = ((PARSER_USER_OBJECT *)user)->new_labels; - ((PARSER_USER_OBJECT *)user)->new_labels = NULL; + PARSER_RC rc = PARSER_RC_OK; - if (plugins_action->overwrite_action) { - return plugins_action->overwrite_action(user, host, new_labels); - } + if (plugins_action->overwrite_action) + rc = plugins_action->overwrite_action(user, host, ((PARSER_USER_OBJECT *)user)->new_host_labels); - return PARSER_RC_OK; + rrdlabels_destroy(((PARSER_USER_OBJECT *)user)->new_host_labels); + ((PARSER_USER_OBJECT *)user)->new_host_labels = NULL; + + return rc; } PARSER_RC pluginsd_guid(char **words, void *user, PLUGINSD_ACTION *plugins_action) diff --git a/collectors/plugins.d/pluginsd_parser.h b/collectors/plugins.d/pluginsd_parser.h index fb4a45b7a..924d48b7b 100644 --- a/collectors/plugins.d/pluginsd_parser.h +++ b/collectors/plugins.d/pluginsd_parser.h @@ -13,8 +13,8 @@ typedef struct parser_user_object { void *opaque; struct plugind *cd; int trust_durations; - struct label *new_labels; - struct label *chart_labels; + DICTIONARY *new_host_labels; + DICTIONARY *new_chart_labels; size_t count; int enabled; uint8_t st_exists; @@ -30,14 +30,13 @@ extern PARSER_RC pluginsd_chart_action(void *user, char *type, char *id, char *n char *title, char *units, char *plugin, char *module, int priority, int update_every, RRDSET_TYPE chart_type, char *options); extern PARSER_RC pluginsd_disable_action(void *user); -extern PARSER_RC pluginsd_variable_action(void *user, RRDHOST *host, RRDSET *st, char *name, int global, - calculated_number value); +extern PARSER_RC pluginsd_variable_action(void *user, RRDHOST *host, RRDSET *st, char *name, int global, NETDATA_DOUBLE value); extern PARSER_RC pluginsd_dimension_action(void *user, RRDSET *st, char *id, char *name, char *algorithm, long multiplier, long divisor, char *options, RRD_ALGORITHM algorithm_type); -extern PARSER_RC pluginsd_label_action(void *user, char *key, char *value, LABEL_SOURCE source); -extern PARSER_RC pluginsd_overwrite_action(void *user, RRDHOST *host, struct label *new_labels); -extern PARSER_RC pluginsd_clabel_commit_action(void *user, RRDHOST *host, struct label *new_labels); -extern PARSER_RC pluginsd_clabel_action(void *user, char *key, char *value, LABEL_SOURCE source); +extern PARSER_RC pluginsd_label_action(void *user, char *key, char *value, RRDLABEL_SRC source); +extern PARSER_RC pluginsd_overwrite_action(void *user, RRDHOST *host, DICTIONARY *new_host_labels); +extern PARSER_RC pluginsd_clabel_commit_action(void *user, RRDHOST *host, DICTIONARY *new_chart_labels); +extern PARSER_RC pluginsd_clabel_action(void *user, char *key, char *value, RRDLABEL_SRC source); #endif //NETDATA_PLUGINSD_PARSER_H diff --git a/collectors/proc.plugin/plugin_proc.h b/collectors/proc.plugin/plugin_proc.h index 1e3b82965..8cb5431e5 100644 --- a/collectors/proc.plugin/plugin_proc.h +++ b/collectors/proc.plugin/plugin_proc.h @@ -54,7 +54,12 @@ extern unsigned long long zfs_arcstats_shrinkable_cache_size_bytes; // netdev renames extern void netdev_rename_device_add( - const char *host_device, const char *container_device, const char *container_name, struct label *labels); + const char *host_device, + const char *container_device, + const char *container_name, + DICTIONARY *labels, + const char *ctx_prefix); + extern void netdev_rename_device_del(const char *host_device); #include "proc_self_mountinfo.h" diff --git a/collectors/proc.plugin/proc_diskstats.c b/collectors/proc.plugin/proc_diskstats.c index cfaf2134a..be4a481cd 100644 --- a/collectors/proc.plugin/proc_diskstats.c +++ b/collectors/proc.plugin/proc_diskstats.c @@ -201,7 +201,7 @@ static unsigned long long int bcache_read_number_with_units(const char *filename static int unknown_units_error = 10; char *end = NULL; - long double value = str2ld(buffer, &end); + NETDATA_DOUBLE value = str2ndd(buffer, &end); if(end && *end) { if(*end == 'k') return (unsigned long long int)(value * 1024.0); @@ -830,6 +830,30 @@ static struct disk *get_disk(unsigned long major, unsigned long minor, char *dis return d; } +static void add_labels_to_disk(struct disk *d, RRDSET *st) { + rrdlabels_add(st->state->chart_labels, "device", d->disk, RRDLABEL_SRC_AUTO); + rrdlabels_add(st->state->chart_labels, "mount_point", d->mount_point, RRDLABEL_SRC_AUTO); + + switch (d->type) { + default: + case DISK_TYPE_UNKNOWN: + rrdlabels_add(st->state->chart_labels, "device_type", "unknown", RRDLABEL_SRC_AUTO); + break; + + case DISK_TYPE_PHYSICAL: + rrdlabels_add(st->state->chart_labels, "device_type", "physical", RRDLABEL_SRC_AUTO); + break; + + case DISK_TYPE_PARTITION: + rrdlabels_add(st->state->chart_labels, "device_type", "partition", RRDLABEL_SRC_AUTO); + break; + + case DISK_TYPE_VIRTUAL: + rrdlabels_add(st->state->chart_labels, "device_type", "virtual", RRDLABEL_SRC_AUTO); + break; + } +} + int do_proc_diskstats(int update_every, usec_t dt) { static procfile *ff = NULL; @@ -1067,6 +1091,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_io_reads = rrddim_add(d->st_io, "reads", NULL, d->sector_size, 1024, RRD_ALGORITHM_INCREMENTAL); d->rd_io_writes = rrddim_add(d->st_io, "writes", NULL, d->sector_size * -1, 1024, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_io); } else rrdset_next(d->st_io); @@ -1094,8 +1120,9 @@ int do_proc_diskstats(int update_every, usec_t dt) { , RRDSET_TYPE_AREA ); - d->rd_io_discards = - rrddim_add(d->st_ext_io, "discards", NULL, d->sector_size, 1024, RRD_ALGORITHM_INCREMENTAL); + d->rd_io_discards = rrddim_add(d->st_ext_io, "discards", NULL, d->sector_size, 1024, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_ext_io); } else rrdset_next(d->st_ext_io); @@ -1130,6 +1157,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_ops_reads = rrddim_add(d->st_ops, "reads", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_ops_writes = rrddim_add(d->st_ops, "writes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_ops); } else rrdset_next(d->st_ops); @@ -1162,7 +1191,10 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_ops_discards = rrddim_add(d->st_ext_ops, "discards", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); if (do_fl_stats) d->rd_ops_flushes = rrddim_add(d->st_ext_ops, "flushes", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - } else + + add_labels_to_disk(d, d->st_ext_ops); + } + else rrdset_next(d->st_ext_ops); last_discards = rrddim_set_by_pointer(d->st_ext_ops, d->rd_ops_discards, discards); @@ -1196,6 +1228,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { rrdset_flag_set(d->st_qops, RRDSET_FLAG_DETAIL); d->rd_qops_operations = rrddim_add(d->st_qops, "operations", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_qops); } else rrdset_next(d->st_qops); @@ -1228,6 +1262,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { rrdset_flag_set(d->st_backlog, RRDSET_FLAG_DETAIL); d->rd_backlog_backlog = rrddim_add(d->st_backlog, "backlog", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_backlog); } else rrdset_next(d->st_backlog); @@ -1259,8 +1295,9 @@ int do_proc_diskstats(int update_every, usec_t dt) { rrdset_flag_set(d->st_busy, RRDSET_FLAG_DETAIL); - d->rd_busy_busy = - rrddim_add(d->st_busy, "busy", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + d->rd_busy_busy = rrddim_add(d->st_busy, "busy", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_busy); } else rrdset_next(d->st_busy); @@ -1288,6 +1325,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { rrdset_flag_set(d->st_util, RRDSET_FLAG_DETAIL); d->rd_util_utilization = rrddim_add(d->st_util, "utilization", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_util); } else rrdset_next(d->st_util); @@ -1326,6 +1365,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_mops_reads = rrddim_add(d->st_mops, "reads", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_mops_writes = rrddim_add(d->st_mops, "writes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_mops); } else rrdset_next(d->st_mops); @@ -1358,7 +1399,10 @@ int do_proc_diskstats(int update_every, usec_t dt) { rrdset_flag_set(d->st_ext_mops, RRDSET_FLAG_DETAIL); d->rd_mops_discards = rrddim_add(d->st_ext_mops, "discards", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - } else + + add_labels_to_disk(d, d->st_ext_mops); + } + else rrdset_next(d->st_ext_mops); rrddim_set_by_pointer(d->st_ext_mops, d->rd_mops_discards, mdiscards); @@ -1391,6 +1435,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_iotime_reads = rrddim_add(d->st_iotime, "reads", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_iotime_writes = rrddim_add(d->st_iotime, "writes", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_iotime); } else rrdset_next(d->st_iotime); @@ -1422,9 +1468,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_iotime_discards = rrddim_add(d->st_ext_iotime, "discards", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); if (do_fl_stats) - d->rd_iotime_flushes = - rrddim_add(d->st_ext_iotime, "flushes", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - } else + d->rd_iotime_flushes = rrddim_add(d->st_ext_iotime, "flushes", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_ext_iotime); + } + else rrdset_next(d->st_ext_iotime); last_discardms = rrddim_set_by_pointer(d->st_ext_iotime, d->rd_iotime_discards, discardms); @@ -1465,6 +1513,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_await_reads = rrddim_add(d->st_await, "reads", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); d->rd_await_writes = rrddim_add(d->st_await, "writes", NULL, -1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_await); } else rrdset_next(d->st_await); @@ -1494,18 +1544,22 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_await_discards = rrddim_add(d->st_ext_await, "discards", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); if (do_fl_stats) - d->rd_await_flushes = - rrddim_add(d->st_ext_await, "flushes", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); - } else + d->rd_await_flushes = rrddim_add(d->st_ext_await, "flushes", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_ext_await); + } + else rrdset_next(d->st_ext_await); rrddim_set_by_pointer( d->st_ext_await, d->rd_await_discards, (discards - last_discards) ? (discardms - last_discardms) / (discards - last_discards) : 0); + if (do_fl_stats) rrddim_set_by_pointer( d->st_ext_await, d->rd_await_flushes, (flushes - last_flushes) ? (flushms - last_flushms) / (flushes - last_flushes) : 0); + rrdset_done(d->st_ext_await); } @@ -1534,6 +1588,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_avgsz_reads = rrddim_add(d->st_avgsz, "reads", NULL, d->sector_size, 1024, RRD_ALGORITHM_ABSOLUTE); d->rd_avgsz_writes = rrddim_add(d->st_avgsz, "writes", NULL, d->sector_size * -1, 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_avgsz); } else rrdset_next(d->st_avgsz); @@ -1561,9 +1617,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { rrdset_flag_set(d->st_ext_avgsz, RRDSET_FLAG_DETAIL); - d->rd_avgsz_discards = - rrddim_add(d->st_ext_avgsz, "discards", NULL, d->sector_size, 1024, RRD_ALGORITHM_ABSOLUTE); - } else + d->rd_avgsz_discards = rrddim_add(d->st_ext_avgsz, "discards", NULL, d->sector_size, 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_ext_avgsz); + } + else rrdset_next(d->st_ext_avgsz); rrddim_set_by_pointer( @@ -1599,8 +1657,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { rrdset_flag_set(d->st_svctm, RRDSET_FLAG_DETAIL); d->rd_svctm_svctm = rrddim_add(d->st_svctm, "svctm", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_svctm); } - else rrdset_next(d->st_svctm); + else + rrdset_next(d->st_svctm); rrddim_set_by_pointer(d->st_svctm, d->rd_svctm_svctm, ((reads - last_reads) + (writes - last_writes)) ? (busy_ms - last_busy_ms) / ((reads - last_reads) + (writes - last_writes)) : 0); rrdset_done(d->st_svctm); @@ -1705,8 +1766,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_bcache_hit_ratio_1hour = rrddim_add(d->st_bcache_hit_ratio, "1hour", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); d->rd_bcache_hit_ratio_1day = rrddim_add(d->st_bcache_hit_ratio, "1day", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); d->rd_bcache_hit_ratio_total = rrddim_add(d->st_bcache_hit_ratio, "ever", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_bcache_hit_ratio); } - else rrdset_next(d->st_bcache_hit_ratio); + else + rrdset_next(d->st_bcache_hit_ratio); rrddim_set_by_pointer(d->st_bcache_hit_ratio, d->rd_bcache_hit_ratio_5min, stats_five_minute_cache_hit_ratio); rrddim_set_by_pointer(d->st_bcache_hit_ratio, d->rd_bcache_hit_ratio_1hour, stats_hour_cache_hit_ratio); @@ -1735,8 +1799,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_bcache_rate_congested = rrddim_add(d->st_bcache_rates, "congested", NULL, 1, 1024, RRD_ALGORITHM_ABSOLUTE); d->rd_bcache_rate_writeback = rrddim_add(d->st_bcache_rates, "writeback", NULL, -1, 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_bcache_rates); } - else rrdset_next(d->st_bcache_rates); + else + rrdset_next(d->st_bcache_rates); rrddim_set_by_pointer(d->st_bcache_rates, d->rd_bcache_rate_writeback, writeback_rate); rrddim_set_by_pointer(d->st_bcache_rates, d->rd_bcache_rate_congested, cache_congested); @@ -1761,8 +1828,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { ); d->rd_bcache_dirty_size = rrddim_add(d->st_bcache_size, "dirty", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_bcache_size); } - else rrdset_next(d->st_bcache_size); + else + rrdset_next(d->st_bcache_size); rrddim_set_by_pointer(d->st_bcache_size, d->rd_bcache_dirty_size, dirty_data); rrdset_done(d->st_bcache_size); @@ -1786,8 +1856,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { ); d->rd_bcache_available_percent = rrddim_add(d->st_bcache_usage, "avail", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_disk(d, d->st_bcache_usage); } - else rrdset_next(d->st_bcache_usage); + else + rrdset_next(d->st_bcache_usage); rrddim_set_by_pointer(d->st_bcache_usage, d->rd_bcache_available_percent, cache_available_percent); rrdset_done(d->st_bcache_usage); @@ -1813,8 +1886,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_bcache_cache_read_races = rrddim_add(d->st_bcache_cache_read_races, "races", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_bcache_cache_io_errors = rrddim_add(d->st_bcache_cache_read_races, "errors", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_bcache_cache_read_races); } - else rrdset_next(d->st_bcache_cache_read_races); + else + rrdset_next(d->st_bcache_cache_read_races); rrddim_set_by_pointer(d->st_bcache_cache_read_races, d->rd_bcache_cache_read_races, cache_read_races); rrddim_set_by_pointer(d->st_bcache_cache_read_races, d->rd_bcache_cache_io_errors, cache_io_errors); @@ -1849,8 +1925,11 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_bcache_misses = rrddim_add(d->st_bcache, "misses", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_bcache_miss_collisions = rrddim_add(d->st_bcache, "collisions", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_bcache_readaheads = rrddim_add(d->st_bcache, "readaheads", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_bcache); } - else rrdset_next(d->st_bcache); + else + rrdset_next(d->st_bcache); rrddim_set_by_pointer(d->st_bcache, d->rd_bcache_hits, stats_total_cache_hits); rrddim_set_by_pointer(d->st_bcache, d->rd_bcache_misses, stats_total_cache_misses); @@ -1884,6 +1963,8 @@ int do_proc_diskstats(int update_every, usec_t dt) { d->rd_bcache_bypass_hits = rrddim_add(d->st_bcache_bypass, "hits", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_bcache_bypass_misses = rrddim_add(d->st_bcache_bypass, "misses", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_disk(d, d->st_bcache_bypass); } else rrdset_next(d->st_bcache_bypass); diff --git a/collectors/proc.plugin/proc_interrupts.c b/collectors/proc.plugin/proc_interrupts.c index 78883c475..46290554b 100644 --- a/collectors/proc.plugin/proc_interrupts.c +++ b/collectors/proc.plugin/proc_interrupts.c @@ -225,6 +225,10 @@ int do_proc_interrupts(int update_every, usec_t dt) { , update_every , RRDSET_TYPE_STACKED ); + + char core[50+1]; + snprintfz(core, 50, "cpu%d", c); + rrdlabels_add(core_st[c]->state->chart_labels, "cpu", core, RRDLABEL_SRC_AUTO); } else rrdset_next(core_st[c]); diff --git a/collectors/proc.plugin/proc_mdstat.c b/collectors/proc.plugin/proc_mdstat.c index bdc298d6b..c8015827e 100644 --- a/collectors/proc.plugin/proc_mdstat.c +++ b/collectors/proc.plugin/proc_mdstat.c @@ -77,6 +77,11 @@ static inline void make_chart_obsolete(char *name, const char *id_modifier) } } +static void add_labels_to_mdstat(struct raid *raid, RRDSET *st) { + rrdlabels_add(st->state->chart_labels, "device", raid->name, RRDLABEL_SRC_AUTO); + rrdlabels_add(st->state->chart_labels, "raid_level", raid->level, RRDLABEL_SRC_AUTO); +} + int do_proc_mdstat(int update_every, usec_t dt) { (void)dt; @@ -263,7 +268,7 @@ int do_proc_mdstat(int update_every, usec_t dt) word = procfile_lineword(ff, l, 3); remove_trailing_chars(word, '%'); - unsigned long long percentage = (unsigned long long)(str2ld(word, NULL) * 100); + unsigned long long percentage = (unsigned long long)(str2ndd(word, NULL) * 100); // possible operations: check, resync, recovery, reshape // 4-th character is unique for each operation so it is checked switch (procfile_lineword(ff, l, 1)[3]) { @@ -287,7 +292,7 @@ int do_proc_mdstat(int update_every, usec_t dt) word += 7; // skip leading "finish=" if (likely(s > word)) - raid->finish_in = (unsigned long long)(str2ld(word, NULL) * 60); + raid->finish_in = (unsigned long long)(str2ndd(word, NULL) * 60); word = procfile_lineword(ff, l, 6); s = remove_trailing_chars(word, 'K'); // remove trailing "K/sec" @@ -407,7 +412,8 @@ int do_proc_mdstat(int update_every, usec_t dt) RRDSET_TYPE_LINE); rrdset_isnot_obsolete(st_mdstat_health); - } else + } + else rrdset_next(st_mdstat_health); if (!redundant_num) { @@ -458,7 +464,10 @@ int do_proc_mdstat(int update_every, usec_t dt) RRDSET_TYPE_STACKED); rrdset_isnot_obsolete(raid->st_disks); - } else + + add_labels_to_mdstat(raid, raid->st_disks); + } + else rrdset_next(raid->st_disks); if (unlikely(!raid->rd_inuse && !(raid->rd_inuse = rrddim_find_active(raid->st_disks, "inuse")))) @@ -495,7 +504,10 @@ int do_proc_mdstat(int update_every, usec_t dt) RRDSET_TYPE_LINE); rrdset_isnot_obsolete(raid->st_mismatch_cnt); - } else + + add_labels_to_mdstat(raid, raid->st_mismatch_cnt); + } + else rrdset_next(raid->st_mismatch_cnt); if (unlikely(!raid->rd_mismatch_cnt && !(raid->rd_mismatch_cnt = rrddim_find_active(raid->st_mismatch_cnt, "count")))) @@ -529,7 +541,10 @@ int do_proc_mdstat(int update_every, usec_t dt) RRDSET_TYPE_LINE); rrdset_isnot_obsolete(raid->st_operation); - } else + + add_labels_to_mdstat(raid, raid->st_operation); + } + else rrdset_next(raid->st_operation); if(unlikely(!raid->rd_check && !(raid->rd_check = rrddim_find_active(raid->st_operation, "check")))) @@ -569,7 +584,10 @@ int do_proc_mdstat(int update_every, usec_t dt) update_every, RRDSET_TYPE_LINE); rrdset_isnot_obsolete(raid->st_finish); - } else + + add_labels_to_mdstat(raid, raid->st_finish); + } + else rrdset_next(raid->st_finish); if(unlikely(!raid->rd_finish_in && !(raid->rd_finish_in = rrddim_find_active(raid->st_finish, "finish_in")))) @@ -601,7 +619,10 @@ int do_proc_mdstat(int update_every, usec_t dt) RRDSET_TYPE_LINE); rrdset_isnot_obsolete(raid->st_speed); - } else + + add_labels_to_mdstat(raid, raid->st_speed); + } + else rrdset_next(raid->st_speed); if (unlikely(!raid->rd_speed && !(raid->rd_speed = rrddim_find_active(raid->st_speed, "speed")))) @@ -635,7 +656,10 @@ int do_proc_mdstat(int update_every, usec_t dt) RRDSET_TYPE_LINE); rrdset_isnot_obsolete(raid->st_nonredundant); - } else + + add_labels_to_mdstat(raid, raid->st_nonredundant); + } + else rrdset_next(raid->st_nonredundant); if (unlikely(!raid->rd_nonredundant && !(raid->rd_nonredundant = rrddim_find_active(raid->st_nonredundant, "available")))) diff --git a/collectors/proc.plugin/proc_net_dev.c b/collectors/proc.plugin/proc_net_dev.c index 74076ff76..79572f442 100644 --- a/collectors/proc.plugin/proc_net_dev.c +++ b/collectors/proc.plugin/proc_net_dev.c @@ -7,19 +7,39 @@ #define STATE_LENGTH_MAX 32 -// As defined in https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net -const char *operstate_names[] = { "unknown", "notpresent", "down", "lowerlayerdown", "testing", "dormant", "up" }; +enum { + NETDEV_DUPLEX_UNKNOWN, + NETDEV_DUPLEX_HALF, + NETDEV_DUPLEX_FULL +}; + +enum { + NETDEV_OPERSTATE_UNKNOWN, + NETDEV_OPERSTATE_NOTPRESENT, + NETDEV_OPERSTATE_DOWN, + NETDEV_OPERSTATE_LOWERLAYERDOWN, + NETDEV_OPERSTATE_TESTING, + NETDEV_OPERSTATE_DORMANT, + NETDEV_OPERSTATE_UP +}; static inline int get_operstate(char *operstate) { - int i; - - for (i = 0; i < (int) (sizeof(operstate_names) / sizeof(char *)); i++) { - if (!strcmp(operstate, operstate_names[i])) { - return i; - } - } - return 0; + // As defined in https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net + if (!strcmp(operstate, "up")) + return NETDEV_OPERSTATE_UP; + if (!strcmp(operstate, "down")) + return NETDEV_OPERSTATE_DOWN; + if (!strcmp(operstate, "notpresent")) + return NETDEV_OPERSTATE_NOTPRESENT; + if (!strcmp(operstate, "lowerlayerdown")) + return NETDEV_OPERSTATE_LOWERLAYERDOWN; + if (!strcmp(operstate, "testing")) + return NETDEV_OPERSTATE_TESTING; + if (!strcmp(operstate, "dormant")) + return NETDEV_OPERSTATE_DORMANT; + + return NETDEV_OPERSTATE_UNKNOWN; } // ---------------------------------------------------------------------------- @@ -90,7 +110,7 @@ static struct netdev { const char *chart_family; - struct label *chart_labels; + DICTIONARY *chart_labels; int flipped; unsigned long priority; @@ -153,9 +173,18 @@ static struct netdev { RRDDIM *rd_tcompressed; RRDDIM *rd_speed; - RRDDIM *rd_duplex; - RRDDIM *rd_operstate; - RRDDIM *rd_carrier; + RRDDIM *rd_duplex_full; + RRDDIM *rd_duplex_half; + RRDDIM *rd_duplex_unknown; + RRDDIM *rd_operstate_unknown; + RRDDIM *rd_operstate_notpresent; + RRDDIM *rd_operstate_down; + RRDDIM *rd_operstate_lowerlayerdown; + RRDDIM *rd_operstate_testing; + RRDDIM *rd_operstate_dormant; + RRDDIM *rd_operstate_up; + RRDDIM *rd_carrier_up; + RRDDIM *rd_carrier_down; RRDDIM *rd_mtu; char *filename_speed; @@ -219,11 +248,21 @@ static void netdev_charts_release(struct netdev *d) { d->rd_tcompressed = NULL; d->rd_speed = NULL; - d->rd_duplex = NULL; - d->rd_operstate = NULL; - d->rd_carrier = NULL; + d->rd_duplex_full = NULL; + d->rd_duplex_half = NULL; + d->rd_duplex_unknown = NULL; + d->rd_carrier_up = NULL; + d->rd_carrier_down = NULL; d->rd_mtu = NULL; + d->rd_operstate_unknown = NULL; + d->rd_operstate_notpresent = NULL; + d->rd_operstate_down = NULL; + d->rd_operstate_lowerlayerdown = NULL; + d->rd_operstate_testing = NULL; + d->rd_operstate_dormant = NULL; + d->rd_operstate_up = NULL; + d->chart_var_speed = NULL; } @@ -273,7 +312,7 @@ static void netdev_free_chart_strings(struct netdev *d) { static void netdev_free(struct netdev *d) { netdev_charts_release(d); netdev_free_chart_strings(d); - free_label_list(d->chart_labels); + rrdlabels_destroy(d->chart_labels); freez((void *)d->name); freez((void *)d->filename_speed); @@ -294,8 +333,9 @@ static struct netdev_rename { const char *container_device; const char *container_name; + const char *ctx_prefix; - struct label *chart_labels; + DICTIONARY *chart_labels; int processed; @@ -317,7 +357,11 @@ static struct netdev_rename *netdev_rename_find(const char *host_device, uint32_ // other threads can call this function to register a rename to a netdev void netdev_rename_device_add( - const char *host_device, const char *container_device, const char *container_name, struct label *labels) + const char *host_device, + const char *container_device, + const char *container_name, + DICTIONARY *labels, + const char *ctx_prefix) { netdata_mutex_lock(&netdev_rename_mutex); @@ -328,7 +372,9 @@ void netdev_rename_device_add( r->host_device = strdupz(host_device); r->container_device = strdupz(container_device); r->container_name = strdupz(container_name); - update_label_list(&r->chart_labels, labels); + r->ctx_prefix = strdupz(ctx_prefix); + r->chart_labels = rrdlabels_create(); + rrdlabels_migrate_to_these(r->chart_labels, labels); r->hash = hash; r->next = netdev_rename_root; r->processed = 0; @@ -344,7 +390,7 @@ void netdev_rename_device_add( r->container_device = strdupz(container_device); r->container_name = strdupz(container_name); - update_label_list(&r->chart_labels, labels); + rrdlabels_migrate_to_these(r->chart_labels, labels); r->processed = 0; netdev_pending_renames++; @@ -377,7 +423,8 @@ void netdev_rename_device_del(const char *host_device) { freez((void *) r->host_device); freez((void *) r->container_name); freez((void *) r->container_device); - free_label_list(r->chart_labels); + freez((void *) r->ctx_prefix); + rrdlabels_destroy(r->chart_labels); freez((void *) r); break; } @@ -433,23 +480,35 @@ static inline void netdev_rename_cgroup(struct netdev *d, struct netdev_rename * snprintfz(buffer, RRD_ID_LENGTH_MAX, "net_mtu_%s", r->container_device); d->chart_id_net_mtu = strdupz(buffer); - d->chart_ctx_net_bytes = strdupz("cgroup.net_net"); - d->chart_ctx_net_compressed = strdupz("cgroup.net_compressed"); - d->chart_ctx_net_drops = strdupz("cgroup.net_drops"); - d->chart_ctx_net_errors = strdupz("cgroup.net_errors"); - d->chart_ctx_net_events = strdupz("cgroup.net_events"); - d->chart_ctx_net_fifo = strdupz("cgroup.net_fifo"); - d->chart_ctx_net_packets = strdupz("cgroup.net_packets"); - d->chart_ctx_net_speed = strdupz("cgroup.net_speed"); - d->chart_ctx_net_duplex = strdupz("cgroup.net_duplex"); - d->chart_ctx_net_operstate = strdupz("cgroup.net_operstate"); - d->chart_ctx_net_carrier = strdupz("cgroup.net_carrier"); - d->chart_ctx_net_mtu = strdupz("cgroup.net_mtu"); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_net", r->ctx_prefix); + d->chart_ctx_net_bytes = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_compressed", r->ctx_prefix); + d->chart_ctx_net_compressed = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_drops", r->ctx_prefix); + d->chart_ctx_net_drops = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_errors", r->ctx_prefix); + d->chart_ctx_net_errors = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_events", r->ctx_prefix); + d->chart_ctx_net_events = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_fifo", r->ctx_prefix); + d->chart_ctx_net_fifo = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_packets", r->ctx_prefix); + d->chart_ctx_net_packets = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_speed", r->ctx_prefix); + d->chart_ctx_net_speed = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_duplex", r->ctx_prefix); + d->chart_ctx_net_duplex = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_operstate", r->ctx_prefix); + d->chart_ctx_net_operstate = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_carrier", r->ctx_prefix); + d->chart_ctx_net_carrier = strdupz(buffer); + snprintfz(buffer, RRD_ID_LENGTH_MAX, "%scgroup.net_mtu", r->ctx_prefix); + d->chart_ctx_net_mtu = strdupz(buffer); snprintfz(buffer, RRD_ID_LENGTH_MAX, "net %s", r->container_device); d->chart_family = strdupz(buffer); - update_label_list(&d->chart_labels, r->chart_labels); + rrdlabels_copy(d->chart_labels, r->chart_labels); d->priority = NETDATA_CHART_PRIO_CGROUP_NET_IFACE; d->flipped = 1; @@ -542,6 +601,7 @@ static struct netdev *get_netdev(const char *name) { d->name = strdupz(name); d->hash = simple_hash(d->name); d->len = strlen(d->name); + d->chart_labels = rrdlabels_create(); d->chart_type_net_bytes = strdupz("net"); d->chart_type_net_compressed = strdupz("net_compressed"); @@ -702,11 +762,15 @@ int do_proc_net_dev(int update_every, usec_t dt) { char buffer[FILENAME_MAX + 1]; snprintfz(buffer, FILENAME_MAX, path_to_sys_devices_virtual_net, d->name); - if(likely(access(buffer, R_OK) == 0)) { + if (likely(access(buffer, R_OK) == 0)) { d->virtual = 1; + rrdlabels_add(d->chart_labels, "interface_type", "virtual", RRDLABEL_SRC_AUTO|RRDLABEL_FLAG_PERMANENT); } - else + else { d->virtual = 0; + rrdlabels_add(d->chart_labels, "interface_type", "real", RRDLABEL_SRC_AUTO|RRDLABEL_FLAG_PERMANENT); + } + rrdlabels_add(d->chart_labels, "device", name, RRDLABEL_SRC_AUTO|RRDLABEL_FLAG_PERMANENT); if(likely(!d->virtual)) { // set the filename to get the interface speed @@ -813,11 +877,11 @@ int do_proc_net_dev(int update_every, usec_t dt) { } else { // values can be unknown, half or full -- just check the first letter for speed if (buffer[0] == 'f') - d->duplex = 2; + d->duplex = NETDEV_DUPLEX_FULL; else if (buffer[0] == 'h') - d->duplex = 1; + d->duplex = NETDEV_DUPLEX_HALF; else - d->duplex = 0; + d->duplex = NETDEV_DUPLEX_UNKNOWN; } } else { d->duplex = 0; @@ -881,7 +945,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { , RRDSET_TYPE_AREA ); - rrdset_update_labels(d->st_bandwidth, d->chart_labels); + rrdset_update_rrdlabels(d->st_bandwidth, d->chart_labels); d->rd_rbytes = rrddim_add(d->st_bandwidth, "received", NULL, 8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL); d->rd_tbytes = rrddim_add(d->st_bandwidth, "sent", NULL, -8, BITS_IN_A_KILOBIT, RRD_ALGORITHM_INCREMENTAL); @@ -926,7 +990,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { d->filename_speed = NULL; } else { - rrdsetvar_custom_chart_variable_set(d->chart_var_speed, (calculated_number) d->speed * KILOBITS_IN_A_MEGABIT); + rrdsetvar_custom_chart_variable_set(d->chart_var_speed, (NETDATA_DOUBLE) d->speed * KILOBITS_IN_A_MEGABIT); if(d->do_speed != CONFIG_BOOLEAN_NO) { if(unlikely(!d->st_speed)) { @@ -947,7 +1011,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_speed, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_speed, d->chart_labels); + rrdset_update_rrdlabels(d->st_speed, d->chart_labels); d->rd_speed = rrddim_add(d->st_speed, "speed", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } @@ -982,13 +1046,17 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_duplex, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_duplex, d->chart_labels); + rrdset_update_rrdlabels(d->st_duplex, d->chart_labels); - d->rd_duplex = rrddim_add(d->st_duplex, "duplex", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_duplex_full = rrddim_add(d->st_duplex, "full", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_duplex_half = rrddim_add(d->st_duplex, "half", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_duplex_unknown = rrddim_add(d->st_duplex, "unknown", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else rrdset_next(d->st_duplex); - rrddim_set_by_pointer(d->st_duplex, d->rd_duplex, (collected_number)d->duplex); + rrddim_set_by_pointer(d->st_duplex, d->rd_duplex_full, (collected_number)(d->duplex == NETDEV_DUPLEX_FULL)); + rrddim_set_by_pointer(d->st_duplex, d->rd_duplex_half, (collected_number)(d->duplex == NETDEV_DUPLEX_HALF)); + rrddim_set_by_pointer(d->st_duplex, d->rd_duplex_unknown, (collected_number)(d->duplex == NETDEV_DUPLEX_UNKNOWN)); rrdset_done(d->st_duplex); } @@ -1013,13 +1081,25 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_operstate, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_operstate, d->chart_labels); + rrdset_update_rrdlabels(d->st_operstate, d->chart_labels); - d->rd_operstate = rrddim_add(d->st_operstate, "state", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_operstate_up = rrddim_add(d->st_operstate, "up", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_operstate_down = rrddim_add(d->st_operstate, "down", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_operstate_notpresent = rrddim_add(d->st_operstate, "notpresent", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_operstate_lowerlayerdown = rrddim_add(d->st_operstate, "lowerlayerdown", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_operstate_testing = rrddim_add(d->st_operstate, "testing", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_operstate_dormant = rrddim_add(d->st_operstate, "dormant", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_operstate_unknown = rrddim_add(d->st_operstate, "unknown", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else rrdset_next(d->st_operstate); - rrddim_set_by_pointer(d->st_operstate, d->rd_operstate, (collected_number)d->operstate); + rrddim_set_by_pointer(d->st_operstate, d->rd_operstate_up, (collected_number)(d->operstate == NETDEV_OPERSTATE_UP)); + rrddim_set_by_pointer(d->st_operstate, d->rd_operstate_down, (collected_number)(d->operstate == NETDEV_OPERSTATE_DOWN)); + rrddim_set_by_pointer(d->st_operstate, d->rd_operstate_notpresent, (collected_number)(d->operstate == NETDEV_OPERSTATE_NOTPRESENT)); + rrddim_set_by_pointer(d->st_operstate, d->rd_operstate_lowerlayerdown, (collected_number)(d->operstate == NETDEV_OPERSTATE_LOWERLAYERDOWN)); + rrddim_set_by_pointer(d->st_operstate, d->rd_operstate_testing, (collected_number)(d->operstate == NETDEV_OPERSTATE_TESTING)); + rrddim_set_by_pointer(d->st_operstate, d->rd_operstate_dormant, (collected_number)(d->operstate == NETDEV_OPERSTATE_DORMANT)); + rrddim_set_by_pointer(d->st_operstate, d->rd_operstate_unknown, (collected_number)(d->operstate == NETDEV_OPERSTATE_UNKNOWN)); rrdset_done(d->st_operstate); } @@ -1044,13 +1124,15 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_carrier, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_carrier, d->chart_labels); + rrdset_update_rrdlabels(d->st_carrier, d->chart_labels); - d->rd_carrier = rrddim_add(d->st_carrier, "carrier", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_carrier_up = rrddim_add(d->st_carrier, "up", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + d->rd_carrier_down = rrddim_add(d->st_carrier, "down", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } else rrdset_next(d->st_carrier); - rrddim_set_by_pointer(d->st_carrier, d->rd_carrier, (collected_number)d->carrier); + rrddim_set_by_pointer(d->st_carrier, d->rd_carrier_up, (collected_number)(d->carrier == 1)); + rrddim_set_by_pointer(d->st_carrier, d->rd_carrier_down, (collected_number)(d->carrier != 1)); rrdset_done(d->st_carrier); } @@ -1075,7 +1157,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_mtu, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_mtu, d->chart_labels); + rrdset_update_rrdlabels(d->st_mtu, d->chart_labels); d->rd_mtu = rrddim_add(d->st_mtu, "mtu", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); } @@ -1111,7 +1193,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_packets, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_packets, d->chart_labels); + rrdset_update_rrdlabels(d->st_packets, d->chart_labels); d->rd_rpackets = rrddim_add(d->st_packets, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_tpackets = rrddim_add(d->st_packets, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1159,7 +1241,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_errors, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_errors, d->chart_labels); + rrdset_update_rrdlabels(d->st_errors, d->chart_labels); d->rd_rerrors = rrddim_add(d->st_errors, "inbound", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_terrors = rrddim_add(d->st_errors, "outbound", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1205,7 +1287,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_drops, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_drops, d->chart_labels); + rrdset_update_rrdlabels(d->st_drops, d->chart_labels); d->rd_rdrops = rrddim_add(d->st_drops, "inbound", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_tdrops = rrddim_add(d->st_drops, "outbound", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1251,7 +1333,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_fifo, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_fifo, d->chart_labels); + rrdset_update_rrdlabels(d->st_fifo, d->chart_labels); d->rd_rfifo = rrddim_add(d->st_fifo, "receive", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_tfifo = rrddim_add(d->st_fifo, "transmit", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1297,7 +1379,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_compressed, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_compressed, d->chart_labels); + rrdset_update_rrdlabels(d->st_compressed, d->chart_labels); d->rd_rcompressed = rrddim_add(d->st_compressed, "received", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_tcompressed = rrddim_add(d->st_compressed, "sent", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); @@ -1343,7 +1425,7 @@ int do_proc_net_dev(int update_every, usec_t dt) { rrdset_flag_set(d->st_events, RRDSET_FLAG_DETAIL); - rrdset_update_labels(d->st_events, d->chart_labels); + rrdset_update_rrdlabels(d->st_events, d->chart_labels); d->rd_rframe = rrddim_add(d->st_events, "frames", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); d->rd_tcollisions = rrddim_add(d->st_events, "collisions", NULL, -1, 1, RRD_ALGORITHM_INCREMENTAL); diff --git a/collectors/proc.plugin/proc_net_wireless.c b/collectors/proc.plugin/proc_net_wireless.c index cb2443b1e..c6ee4ff70 100644 --- a/collectors/proc.plugin/proc_net_wireless.c +++ b/collectors/proc.plugin/proc_net_wireless.c @@ -24,9 +24,9 @@ static struct netwireless { kernel_uint_t status; // Quality - calculated_number link; - calculated_number level; - calculated_number noise; + NETDATA_DOUBLE link; + NETDATA_DOUBLE level; + NETDATA_DOUBLE noise; // Discarded packets kernel_uint_t nwid; @@ -198,6 +198,10 @@ static void configure_device(int do_status, int do_quality, int do_discarded_pac wireless_dev->chart_id_net_missed_beacon = strdupz(buffer); } +static void add_labels_to_wireless(struct netwireless *w, RRDSET *st) { + rrdlabels_add(st->state->chart_labels, "device", w->name, RRDLABEL_SRC_AUTO); +} + int do_proc_net_wireless(int update_every, usec_t dt) { UNUSED(dt); @@ -209,21 +213,11 @@ int do_proc_net_wireless(int update_every, usec_t dt) char filename[FILENAME_MAX + 1]; snprintfz(filename, FILENAME_MAX, "%s%s", netdata_configured_host_prefix, "/proc/net/wireless"); - proc_net_wireless_filename = config_get(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS,"filename to monitor", - filename); - - do_status = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, - "status for all interfaces", CONFIG_BOOLEAN_AUTO); - - do_quality = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, - "quality for all interfaces", CONFIG_BOOLEAN_AUTO); - - do_discarded_packets = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, - "discarded packets for all interfaces", - CONFIG_BOOLEAN_AUTO); - - do_beacon = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, - "missed beacon for all interface", CONFIG_BOOLEAN_AUTO); + proc_net_wireless_filename = config_get(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS,"filename to monitor", filename); + do_status = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, "status for all interfaces", CONFIG_BOOLEAN_AUTO); + do_quality = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, "quality for all interfaces", CONFIG_BOOLEAN_AUTO); + do_discarded_packets = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, "discarded packets for all interfaces", CONFIG_BOOLEAN_AUTO); + do_beacon = config_get_boolean_ondemand(CONFIG_SECTION_PLUGIN_PROC_NETWIRELESS, "missed beacon for all interface", CONFIG_BOOLEAN_AUTO); } if (unlikely(!ff)) { @@ -255,25 +249,28 @@ int do_proc_net_wireless(int update_every, usec_t dt) wireless_dev->status = str2kernel_uint_t(procfile_lineword(ff, l, 1)); if (unlikely(!wireless_dev->st_status)) { - wireless_dev->st_status = rrdset_create_localhost("wireless", - wireless_dev->chart_id_net_status, - NULL, - wireless_dev->name, - "wireless.status", - "Internal status reported by interface.", - "status", - PLUGIN_PROC_NAME, - PLUGIN_PROC_MODULE_NETWIRELESS_NAME, - NETDATA_CHART_PRIO_WIRELESS_IFACE, - update_every, - RRDSET_TYPE_LINE); + wireless_dev->st_status = rrdset_create_localhost( + "wireless", + wireless_dev->chart_id_net_status, + NULL, + wireless_dev->name, + "wireless.status", + "Internal status reported by interface.", + "status", + PLUGIN_PROC_NAME, + PLUGIN_PROC_MODULE_NETWIRELESS_NAME, + NETDATA_CHART_PRIO_WIRELESS_IFACE, + update_every, + RRDSET_TYPE_LINE); + rrdset_flag_set(wireless_dev->st_status, RRDSET_FLAG_DETAIL); - wireless_dev->rd_status = rrddim_add(wireless_dev->st_status, "status", NULL, 1, - 1, RRD_ALGORITHM_ABSOLUTE); - } else { - rrdset_next(wireless_dev->st_status); + wireless_dev->rd_status = rrddim_add(wireless_dev->st_status, "status", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_wireless(wireless_dev, wireless_dev->st_status); } + else + rrdset_next(wireless_dev->st_status); rrddim_set_by_pointer(wireless_dev->st_status, wireless_dev->rd_status, (collected_number)wireless_dev->status); @@ -281,83 +278,86 @@ int do_proc_net_wireless(int update_every, usec_t dt) } if (likely(do_quality != CONFIG_BOOLEAN_NO)) { - wireless_dev->link = str2ld(procfile_lineword(ff, l, 2), NULL); - wireless_dev->level = str2ld(procfile_lineword(ff, l, 3), NULL); - wireless_dev->noise = str2ld(procfile_lineword(ff, l, 4), NULL); + wireless_dev->link = str2ndd(procfile_lineword(ff, l, 2), NULL); + wireless_dev->level = str2ndd(procfile_lineword(ff, l, 3), NULL); + wireless_dev->noise = str2ndd(procfile_lineword(ff, l, 4), NULL); if (unlikely(!wireless_dev->st_link)) { - wireless_dev->st_link = rrdset_create_localhost("wireless", - wireless_dev->chart_id_net_link, - NULL, - wireless_dev->name, - "wireless.link_quality", - "Overall quality of the link. This is an aggregate value, and depends on the driver and hardware.", - "value", - PLUGIN_PROC_NAME, - PLUGIN_PROC_MODULE_NETWIRELESS_NAME, - NETDATA_CHART_PRIO_WIRELESS_IFACE + 1, - update_every, - RRDSET_TYPE_LINE); + wireless_dev->st_link = rrdset_create_localhost( + "wireless", + wireless_dev->chart_id_net_link, + NULL, + wireless_dev->name, + "wireless.link_quality", + "Overall quality of the link. This is an aggregate value, and depends on the driver and hardware.", + "value", + PLUGIN_PROC_NAME, + PLUGIN_PROC_MODULE_NETWIRELESS_NAME, + NETDATA_CHART_PRIO_WIRELESS_IFACE + 1, + update_every, + RRDSET_TYPE_LINE); rrdset_flag_set(wireless_dev->st_link, RRDSET_FLAG_DETAIL); - wireless_dev->rd_link = rrddim_add(wireless_dev->st_link, "link_quality", NULL, 1, 1, - RRD_ALGORITHM_ABSOLUTE); - } else { - rrdset_next(wireless_dev->st_link); + wireless_dev->rd_link = rrddim_add(wireless_dev->st_link, "link_quality", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_wireless(wireless_dev, wireless_dev->st_link); } + else + rrdset_next(wireless_dev->st_link); if (unlikely(!wireless_dev->st_level)) { - wireless_dev->st_level = rrdset_create_localhost("wireless", - wireless_dev->chart_id_net_level, - NULL, - wireless_dev->name, - "wireless.signal_level", - "The signal level is the wireless signal power level received by the wireless client. The closer the value is to 0, the stronger the signal.", - "dBm", - PLUGIN_PROC_NAME, - PLUGIN_PROC_MODULE_NETWIRELESS_NAME, - NETDATA_CHART_PRIO_WIRELESS_IFACE + 2, - update_every, - RRDSET_TYPE_LINE); + wireless_dev->st_level = rrdset_create_localhost( + "wireless", + wireless_dev->chart_id_net_level, + NULL, + wireless_dev->name, + "wireless.signal_level", + "The signal level is the wireless signal power level received by the wireless client. The closer the value is to 0, the stronger the signal.", + "dBm", + PLUGIN_PROC_NAME, + PLUGIN_PROC_MODULE_NETWIRELESS_NAME, + NETDATA_CHART_PRIO_WIRELESS_IFACE + 2, + update_every, + RRDSET_TYPE_LINE); rrdset_flag_set(wireless_dev->st_level, RRDSET_FLAG_DETAIL); - wireless_dev->rd_level = rrddim_add(wireless_dev->st_level, "signal_level", NULL, 1, 1, - RRD_ALGORITHM_ABSOLUTE); - } else { - rrdset_next(wireless_dev->st_level); + wireless_dev->rd_level = rrddim_add(wireless_dev->st_level, "signal_level", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_wireless(wireless_dev, wireless_dev->st_level); } + else + rrdset_next(wireless_dev->st_level); if (unlikely(!wireless_dev->st_noise)) { - wireless_dev->st_noise = rrdset_create_localhost("wireless", - wireless_dev->chart_id_net_noise, - NULL, - wireless_dev->name, - "wireless.noise_level", - "The noise level indicates the amount of background noise in your environment. The closer the value to 0, the greater the noise level.", - "dBm", - PLUGIN_PROC_NAME, - PLUGIN_PROC_MODULE_NETWIRELESS_NAME, - NETDATA_CHART_PRIO_WIRELESS_IFACE + 3, - update_every, - RRDSET_TYPE_LINE); + wireless_dev->st_noise = rrdset_create_localhost( + "wireless", + wireless_dev->chart_id_net_noise, + NULL, + wireless_dev->name, + "wireless.noise_level", + "The noise level indicates the amount of background noise in your environment. The closer the value to 0, the greater the noise level.", + "dBm", + PLUGIN_PROC_NAME, + PLUGIN_PROC_MODULE_NETWIRELESS_NAME, + NETDATA_CHART_PRIO_WIRELESS_IFACE + 3, + update_every, + RRDSET_TYPE_LINE); rrdset_flag_set(wireless_dev->st_noise, RRDSET_FLAG_DETAIL); - wireless_dev->rd_noise = rrddim_add(wireless_dev->st_noise, "noise_level", NULL, 1, 1, - RRD_ALGORITHM_ABSOLUTE); - } else { - rrdset_next(wireless_dev->st_noise); + wireless_dev->rd_noise = rrddim_add(wireless_dev->st_noise, "noise_level", NULL, 1, 1, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_wireless(wireless_dev, wireless_dev->st_noise); } + else + rrdset_next(wireless_dev->st_noise); - rrddim_set_by_pointer(wireless_dev->st_link, wireless_dev->rd_link, - (collected_number)wireless_dev->link); + rrddim_set_by_pointer(wireless_dev->st_link, wireless_dev->rd_link, (collected_number)wireless_dev->link); rrdset_done(wireless_dev->st_link); - rrddim_set_by_pointer(wireless_dev->st_level, wireless_dev->rd_level, - (collected_number)wireless_dev->level); + rrddim_set_by_pointer(wireless_dev->st_level, wireless_dev->rd_level, (collected_number)wireless_dev->level); rrdset_done(wireless_dev->st_level); - rrddim_set_by_pointer(wireless_dev->st_noise, wireless_dev->rd_noise, - (collected_number)wireless_dev->noise); + rrddim_set_by_pointer(wireless_dev->st_noise, wireless_dev->rd_noise, (collected_number)wireless_dev->noise); rrdset_done(wireless_dev->st_noise); } @@ -369,49 +369,38 @@ int do_proc_net_wireless(int update_every, usec_t dt) wireless_dev->misc = str2kernel_uint_t(procfile_lineword(ff, l, 9)); if (unlikely(!wireless_dev->st_discarded_packets)) { - wireless_dev->st_discarded_packets = rrdset_create_localhost("wireless", - wireless_dev->chart_id_net_discarded_packets, - NULL, - wireless_dev->name, - "wireless.discarded_packets", - "Packet discarded in the wireless adapter due to \"wireless\" specific problems.", - "packets/s", - PLUGIN_PROC_NAME, - PLUGIN_PROC_MODULE_NETWIRELESS_NAME, - NETDATA_CHART_PRIO_WIRELESS_IFACE + 4, - update_every, - RRDSET_TYPE_LINE); + wireless_dev->st_discarded_packets = rrdset_create_localhost( + "wireless", + wireless_dev->chart_id_net_discarded_packets, + NULL, + wireless_dev->name, + "wireless.discarded_packets", + "Packet discarded in the wireless adapter due to \"wireless\" specific problems.", + "packets/s", + PLUGIN_PROC_NAME, + PLUGIN_PROC_MODULE_NETWIRELESS_NAME, + NETDATA_CHART_PRIO_WIRELESS_IFACE + 4, + update_every, + RRDSET_TYPE_LINE); rrdset_flag_set(wireless_dev->st_discarded_packets, RRDSET_FLAG_DETAIL); - wireless_dev->rd_nwid = rrddim_add(wireless_dev->st_discarded_packets, "nwid", NULL, 1, - 1, RRD_ALGORITHM_INCREMENTAL); - wireless_dev->rd_crypt = rrddim_add(wireless_dev->st_discarded_packets, "crypt", NULL, 1, - 1, RRD_ALGORITHM_INCREMENTAL); - wireless_dev->rd_frag = rrddim_add(wireless_dev->st_discarded_packets, "frag", NULL, 1, - 1, RRD_ALGORITHM_INCREMENTAL); - wireless_dev->rd_retry = rrddim_add(wireless_dev->st_discarded_packets, "retry", NULL, 1, - 1, RRD_ALGORITHM_INCREMENTAL); - wireless_dev->rd_misc = rrddim_add(wireless_dev->st_discarded_packets, "misc", NULL, 1, - 1, RRD_ALGORITHM_INCREMENTAL); - } else { - rrdset_next(wireless_dev->st_discarded_packets); - } - - rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_nwid, - (collected_number)wireless_dev->nwid); - - rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_crypt, - (collected_number)wireless_dev->crypt); + wireless_dev->rd_nwid = rrddim_add(wireless_dev->st_discarded_packets, "nwid", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + wireless_dev->rd_crypt = rrddim_add(wireless_dev->st_discarded_packets, "crypt", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + wireless_dev->rd_frag = rrddim_add(wireless_dev->st_discarded_packets, "frag", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + wireless_dev->rd_retry = rrddim_add(wireless_dev->st_discarded_packets, "retry", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + wireless_dev->rd_misc = rrddim_add(wireless_dev->st_discarded_packets, "misc", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_frag, - (collected_number)wireless_dev->frag); - - rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_retry, - (collected_number)wireless_dev->retry); + add_labels_to_wireless(wireless_dev, wireless_dev->st_discarded_packets); + } + else + rrdset_next(wireless_dev->st_discarded_packets); - rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_misc, - (collected_number)wireless_dev->misc); + rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_nwid, (collected_number)wireless_dev->nwid); + rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_crypt, (collected_number)wireless_dev->crypt); + rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_frag, (collected_number)wireless_dev->frag); + rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_retry, (collected_number)wireless_dev->retry); + rrddim_set_by_pointer(wireless_dev->st_discarded_packets, wireless_dev->rd_misc, (collected_number)wireless_dev->misc); rrdset_done(wireless_dev->st_discarded_packets); } @@ -420,28 +409,31 @@ int do_proc_net_wireless(int update_every, usec_t dt) wireless_dev->missed_beacon = str2kernel_uint_t(procfile_lineword(ff, l, 10)); if (unlikely(!wireless_dev->st_missed_beacon)) { - wireless_dev->st_missed_beacon = rrdset_create_localhost("wireless", - wireless_dev->chart_id_net_missed_beacon, - NULL, - wireless_dev->name, - "wireless.missed_beacons", - "Number of missed beacons.", - "frames/s", - PLUGIN_PROC_NAME, - PLUGIN_PROC_MODULE_NETWIRELESS_NAME, - NETDATA_CHART_PRIO_WIRELESS_IFACE + 5, - update_every, - RRDSET_TYPE_LINE); + wireless_dev->st_missed_beacon = rrdset_create_localhost( + "wireless", + wireless_dev->chart_id_net_missed_beacon, + NULL, + wireless_dev->name, + "wireless.missed_beacons", + "Number of missed beacons.", + "frames/s", + PLUGIN_PROC_NAME, + PLUGIN_PROC_MODULE_NETWIRELESS_NAME, + NETDATA_CHART_PRIO_WIRELESS_IFACE + 5, + update_every, + RRDSET_TYPE_LINE); + rrdset_flag_set(wireless_dev->st_missed_beacon, RRDSET_FLAG_DETAIL); - wireless_dev->rd_missed_beacon = rrddim_add(wireless_dev->st_missed_beacon, "missed_beacons", - NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); - } else { - rrdset_next(wireless_dev->st_missed_beacon); + wireless_dev->rd_missed_beacon = rrddim_add(wireless_dev->st_missed_beacon, "missed_beacons", NULL, 1, 1, RRD_ALGORITHM_INCREMENTAL); + + add_labels_to_wireless(wireless_dev, wireless_dev->st_missed_beacon); } + else + rrdset_next(wireless_dev->st_missed_beacon); + + rrddim_set_by_pointer(wireless_dev->st_missed_beacon, wireless_dev->rd_missed_beacon, (collected_number)wireless_dev->missed_beacon); - rrddim_set_by_pointer(wireless_dev->st_missed_beacon, wireless_dev->rd_missed_beacon, - (collected_number)wireless_dev->missed_beacon); rrdset_done(wireless_dev->st_missed_beacon); } diff --git a/collectors/proc.plugin/proc_pagetypeinfo.c b/collectors/proc.plugin/proc_pagetypeinfo.c index e1026cf51..017edc49a 100644 --- a/collectors/proc.plugin/proc_pagetypeinfo.c +++ b/collectors/proc.plugin/proc_pagetypeinfo.c @@ -242,15 +242,14 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) { // "Node" + NUMA-NodeID + ZoneName + TypeName char setname[4+1+MAX_ZONETYPE_NAME+1+MAX_PAGETYPE_NAME +1]; - snprintfz(setname, MAX_ZONETYPE_NAME + MAX_PAGETYPE_NAME, "Node %d %s %s", - pgl->node, pgl->zone, pgl->type); + snprintfz(setname, MAX_ZONETYPE_NAME + MAX_PAGETYPE_NAME, "Node %d %s %s", pgl->node, pgl->zone, pgl->type); st_nodezonetype[p] = rrdset_create_localhost( "mem" , setid , NULL , "pagetype" - , NULL + , "mem.pagetype" , setname , "B" , PLUGIN_PROC_NAME @@ -259,6 +258,13 @@ int do_proc_pagetypeinfo(int update_every, usec_t dt) { , update_every , RRDSET_TYPE_STACKED ); + + char node[50+1]; + snprintfz(node, 50, "node%d", pgl->node); + rrdlabels_add(st_nodezonetype[p]->state->chart_labels, "node_id", node, RRDLABEL_SRC_AUTO); + rrdlabels_add(st_nodezonetype[p]->state->chart_labels, "node_zone", pgl->zone, RRDLABEL_SRC_AUTO); + rrdlabels_add(st_nodezonetype[p]->state->chart_labels, "node_type", pgl->type, RRDLABEL_SRC_AUTO); + for (o = 0; o < pageorders_cnt; o++) { char dimid[3+1]; snprintfz(dimid, 3, "%lu", o); diff --git a/collectors/proc.plugin/proc_self_mountinfo.c b/collectors/proc.plugin/proc_self_mountinfo.c index ca00f8a89..4456d5978 100644 --- a/collectors/proc.plugin/proc_self_mountinfo.c +++ b/collectors/proc.plugin/proc_self_mountinfo.c @@ -182,6 +182,33 @@ static inline int is_read_only(const char *s) { return 0; } +// for the full list of protected mount points look at +// https://github.com/systemd/systemd/blob/1eb3ef78b4df28a9e9f464714208f2682f957e36/src/core/namespace.c#L142-L149 +// https://github.com/systemd/systemd/blob/1eb3ef78b4df28a9e9f464714208f2682f957e36/src/core/namespace.c#L180-L194 +static const char *systemd_protected_mount_points[] = { + "/home", + "/root", + "/usr", + "/boot", + "/efi", + "/etc", + "/run/user", + "/lib", + "/lib64", + "/bin", + "/sbin", + NULL +}; + +static inline int mount_point_is_protected(char *mount_point) +{ + for (size_t i = 0; systemd_protected_mount_points[i] != NULL; i++) + if (!strcmp(mount_point, systemd_protected_mount_points[i])) + return 1; + + return 0; +} + // read the whole mountinfo into a linked list struct mountinfo *mountinfo_read(int do_statvfs) { char filename[FILENAME_MAX + 1]; @@ -199,11 +226,21 @@ struct mountinfo *mountinfo_read(int do_statvfs) { struct mountinfo *root = NULL, *last = NULL, *mi = NULL; + // create a dictionary to track uniqueness + DICTIONARY *dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE); + unsigned long l, lines = procfile_lines(ff); for(l = 0; l < lines ;l++) { if(unlikely(procfile_linewords(ff, l) < 5)) continue; + // make sure we don't add the same item twice + char *v = (char *)dictionary_set(dict, procfile_lineword(ff, l, 4), "N", 2); + if(v) { + if(*v == 'O') continue; + *v = 'O'; + } + mi = mallocz(sizeof(struct mountinfo)); unsigned long w = 0; @@ -242,6 +279,9 @@ struct mountinfo *mountinfo_read(int do_statvfs) { if(unlikely(is_read_only(mi->mount_options))) mi->flags |= MOUNTINFO_READONLY; + if(unlikely(mount_point_is_protected(mi->mount_point))) + mi->flags |= MOUNTINFO_IS_IN_SYSD_PROTECTED_LIST; + // count the optional fields /* unsigned long wo = w; @@ -411,6 +451,7 @@ struct mountinfo *mountinfo_read(int do_statvfs) { } */ + dictionary_destroy(dict); procfile_close(ff); return root; } diff --git a/collectors/proc.plugin/proc_self_mountinfo.h b/collectors/proc.plugin/proc_self_mountinfo.h index 92918a73d..b915550a7 100644 --- a/collectors/proc.plugin/proc_self_mountinfo.h +++ b/collectors/proc.plugin/proc_self_mountinfo.h @@ -10,6 +10,7 @@ #define MOUNTINFO_NO_STAT 0x00000010 #define MOUNTINFO_NO_SIZE 0x00000020 #define MOUNTINFO_READONLY 0x00000040 +#define MOUNTINFO_IS_IN_SYSD_PROTECTED_LIST 0x00000080 struct mountinfo { long id; // mount ID: unique identifier of the mount (may be reused after umount(2)). diff --git a/collectors/proc.plugin/proc_softirqs.c b/collectors/proc.plugin/proc_softirqs.c index bb14c1596..7eff28c98 100644 --- a/collectors/proc.plugin/proc_softirqs.c +++ b/collectors/proc.plugin/proc_softirqs.c @@ -217,6 +217,10 @@ int do_proc_softirqs(int update_every, usec_t dt) { , update_every , RRDSET_TYPE_STACKED ); + + char core[50+1]; + snprintfz(core, 50, "cpu%d", c); + rrdlabels_add(core_st[c]->state->chart_labels, "cpu", core, RRDLABEL_SRC_AUTO); } else rrdset_next(core_st[c]); diff --git a/collectors/proc.plugin/proc_stat.c b/collectors/proc.plugin/proc_stat.c index c889f0736..6faba55a9 100644 --- a/collectors/proc.plugin/proc_stat.c +++ b/collectors/proc.plugin/proc_stat.c @@ -1039,6 +1039,10 @@ int do_proc_stat(int update_every, usec_t dt) { , RRDSET_TYPE_STACKED ); + char corebuf[50+1]; + snprintfz(corebuf, 50, "cpu%zu", core); + rrdlabels_add(cpuidle_charts[core].st->state->chart_labels, "cpu", corebuf, RRDLABEL_SRC_AUTO); + char cpuidle_dim_id[RRD_ID_LENGTH_MAX + 1]; cpuidle_charts[core].active_time_rd = rrddim_add(cpuidle_charts[core].st, "active", "C0 (active)", 1, 1, RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL); for(state = 0; state < cpuidle_charts[core].cpuidle_state_len; state++) { diff --git a/collectors/proc.plugin/sys_block_zram.c b/collectors/proc.plugin/sys_block_zram.c index 3a39b3b66..ddd1e7ae0 100644 --- a/collectors/proc.plugin/sys_block_zram.c +++ b/collectors/proc.plugin/sys_block_zram.c @@ -75,6 +75,7 @@ static inline void init_rrd(const char *name, ZRAM_DEVICE *d, int update_every) , RRDSET_TYPE_AREA); d->rd_compr_data_size = rrddim_add(d->st_usage, "compressed", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); d->rd_metadata_size = rrddim_add(d->st_usage, "metadata", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + rrdlabels_add(d->st_usage->state->chart_labels, "device", name, RRDLABEL_SRC_AUTO); snprintfz(chart_name, RRD_ID_LENGTH_MAX, "zram_savings.%s", name); d->st_savings = rrdset_create_localhost( @@ -92,6 +93,7 @@ static inline void init_rrd(const char *name, ZRAM_DEVICE *d, int update_every) , RRDSET_TYPE_AREA); d->rd_savings_size = rrddim_add(d->st_savings, "savings", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); d->rd_original_size = rrddim_add(d->st_savings, "original", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + rrdlabels_add(d->st_savings->state->chart_labels, "device", name, RRDLABEL_SRC_AUTO); snprintfz(chart_name, RRD_ID_LENGTH_MAX, "zram_ratio.%s", name); d->st_comp_ratio = rrdset_create_localhost( @@ -108,6 +110,7 @@ static inline void init_rrd(const char *name, ZRAM_DEVICE *d, int update_every) , update_every , RRDSET_TYPE_LINE); d->rd_comp_ratio = rrddim_add(d->st_comp_ratio, "ratio", NULL, 1, 100, RRD_ALGORITHM_ABSOLUTE); + rrdlabels_add(d->st_comp_ratio->state->chart_labels, "device", name, RRDLABEL_SRC_AUTO); snprintfz(chart_name, RRD_ID_LENGTH_MAX, "zram_efficiency.%s", name); d->st_alloc_efficiency = rrdset_create_localhost( @@ -124,6 +127,7 @@ static inline void init_rrd(const char *name, ZRAM_DEVICE *d, int update_every) , update_every , RRDSET_TYPE_LINE); d->rd_alloc_efficiency = rrddim_add(d->st_alloc_efficiency, "percent", NULL, 1, 10000, RRD_ALGORITHM_ABSOLUTE); + rrdlabels_add(d->st_alloc_efficiency->state->chart_labels, "device", name, RRDLABEL_SRC_AUTO); } static int init_devices(DICTIONARY *devices, unsigned int zram_id, int update_every) { diff --git a/collectors/proc.plugin/sys_class_power_supply.c b/collectors/proc.plugin/sys_class_power_supply.c index c558a384d..a80d46e93 100644 --- a/collectors/proc.plugin/sys_class_power_supply.c +++ b/collectors/proc.plugin/sys_class_power_supply.c @@ -112,6 +112,10 @@ void power_supply_free(struct power_supply *ps) { } } +static void add_labels_to_power_supply(struct power_supply *ps, RRDSET *st) { + rrdlabels_add(st->state->chart_labels, "device", ps->name, RRDLABEL_SRC_AUTO); +} + int do_sys_class_power_supply(int update_every, usec_t dt) { (void)dt; static int do_capacity = -1, do_property[3] = {-1}; @@ -358,6 +362,8 @@ int do_sys_class_power_supply(int update_every, usec_t dt) { , update_every , RRDSET_TYPE_LINE ); + + add_labels_to_power_supply(ps, ps->capacity->st); } else rrdset_next(ps->capacity->st); @@ -389,6 +395,8 @@ int do_sys_class_power_supply(int update_every, usec_t dt) { , update_every , RRDSET_TYPE_LINE ); + + add_labels_to_power_supply(ps, pr->st); } else rrdset_next(pr->st); diff --git a/collectors/proc.plugin/sys_devices_system_edac_mc.c b/collectors/proc.plugin/sys_devices_system_edac_mc.c index b11148375..290157903 100644 --- a/collectors/proc.plugin/sys_devices_system_edac_mc.c +++ b/collectors/proc.plugin/sys_devices_system_edac_mc.c @@ -74,7 +74,7 @@ int do_proc_sys_devices_system_edac_mc(int update_every, usec_t dt) { } static int do_ce = -1, do_ue = -1; - calculated_number ce_sum = 0, ue_sum = 0; + NETDATA_DOUBLE ce_sum = 0, ue_sum = 0; struct mc *m; if(unlikely(do_ce == -1)) { diff --git a/collectors/proc.plugin/sys_devices_system_node.c b/collectors/proc.plugin/sys_devices_system_node.c index ff408ed88..fd3394309 100644 --- a/collectors/proc.plugin/sys_devices_system_node.c +++ b/collectors/proc.plugin/sys_devices_system_node.c @@ -115,6 +115,8 @@ int do_proc_sys_devices_system_node(int update_every, usec_t dt) { , RRDSET_TYPE_LINE ); + rrdlabels_add(m->numastat_st->state->chart_labels, "numa_node", m->name, RRDLABEL_SRC_AUTO); + rrdset_flag_set(m->numastat_st, RRDSET_FLAG_DETAIL); rrddim_add(m->numastat_st, "numa_hit", "hit", 1, 1, RRD_ALGORITHM_INCREMENTAL); diff --git a/collectors/proc.plugin/sys_fs_btrfs.c b/collectors/proc.plugin/sys_fs_btrfs.c index e28b60a7a..158587a8f 100644 --- a/collectors/proc.plugin/sys_fs_btrfs.c +++ b/collectors/proc.plugin/sys_fs_btrfs.c @@ -448,6 +448,11 @@ static inline int find_all_btrfs_pools(const char *path) { return 0; } +static void add_labels_to_btrfs(BTRFS_NODE *n, RRDSET *st) { + rrdlabels_add(st->state->chart_labels, "device", n->id, RRDLABEL_SRC_AUTO); + rrdlabels_add(st->state->chart_labels, "device_label", n->label, RRDLABEL_SRC_AUTO); +} + int do_sys_fs_btrfs(int update_every, usec_t dt) { static int initialized = 0 , do_allocation_disks = CONFIG_BOOLEAN_AUTO @@ -579,6 +584,8 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) { node->rd_allocation_disks_metadata_used = rrddim_add(node->st_allocation_disks, "meta_used", "meta used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); node->rd_allocation_disks_system_free = rrddim_add(node->st_allocation_disks, "sys_free", "sys free", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); node->rd_allocation_disks_system_used = rrddim_add(node->st_allocation_disks, "sys_used", "sys used", 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_btrfs(node, node->st_allocation_disks); } else rrdset_next(node->st_allocation_disks); @@ -632,6 +639,8 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) { node->rd_allocation_data_free = rrddim_add(node->st_allocation_data, "free", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); node->rd_allocation_data_used = rrddim_add(node->st_allocation_data, "used", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_btrfs(node, node->st_allocation_data); } else rrdset_next(node->st_allocation_data); @@ -676,6 +685,8 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) { node->rd_allocation_metadata_free = rrddim_add(node->st_allocation_metadata, "free", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); node->rd_allocation_metadata_used = rrddim_add(node->st_allocation_metadata, "used", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); node->rd_allocation_metadata_reserved = rrddim_add(node->st_allocation_metadata, "reserved", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_btrfs(node, node->st_allocation_metadata); } else rrdset_next(node->st_allocation_metadata); @@ -720,6 +731,8 @@ int do_sys_fs_btrfs(int update_every, usec_t dt) { node->rd_allocation_system_free = rrddim_add(node->st_allocation_system, "free", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); node->rd_allocation_system_used = rrddim_add(node->st_allocation_system, "used", NULL, 1, 1024 * 1024, RRD_ALGORITHM_ABSOLUTE); + + add_labels_to_btrfs(node, node->st_allocation_system); } else rrdset_next(node->st_allocation_system); diff --git a/collectors/python.d.plugin/Makefile.am b/collectors/python.d.plugin/Makefile.am index 667f1627c..9377ebe8d 100644 --- a/collectors/python.d.plugin/Makefile.am +++ b/collectors/python.d.plugin/Makefile.am @@ -48,7 +48,6 @@ include bind_rndc/Makefile.inc include boinc/Makefile.inc include ceph/Makefile.inc include changefinder/Makefile.inc -include chrony/Makefile.inc include dockerd/Makefile.inc include dovecot/Makefile.inc include example/Makefile.inc @@ -71,7 +70,6 @@ include nginx_plus/Makefile.inc include nvidia_smi/Makefile.inc include nsd/Makefile.inc include ntpd/Makefile.inc -include ovpn_status_log/Makefile.inc include openldap/Makefile.inc include oracledb/Makefile.inc include postfix/Makefile.inc diff --git a/collectors/python.d.plugin/chrony/Makefile.inc b/collectors/python.d.plugin/chrony/Makefile.inc deleted file mode 100644 index 18a805b12..000000000 --- a/collectors/python.d.plugin/chrony/Makefile.inc +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -# THIS IS NOT A COMPLETE Makefile -# IT IS INCLUDED BY ITS PARENT'S Makefile.am -# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT - -# install these files -dist_python_DATA += chrony/chrony.chart.py -dist_pythonconfig_DATA += chrony/chrony.conf - -# do not install these files, but include them in the distribution -dist_noinst_DATA += chrony/README.md chrony/Makefile.inc - diff --git a/collectors/python.d.plugin/chrony/README.md b/collectors/python.d.plugin/chrony/README.md deleted file mode 100644 index 3093ec3f9..000000000 --- a/collectors/python.d.plugin/chrony/README.md +++ /dev/null @@ -1,61 +0,0 @@ - - -# Chrony monitoring with Netdata - -Monitors the precision and statistics of a local chronyd server, and produces: - -- frequency -- last offset -- RMS offset -- residual freq -- root delay -- root dispersion -- skew -- system time - -## Requirements - -Verify that user Netdata can execute `chronyc tracking`. If necessary, update `/etc/chrony.conf`, `cmdallow`. - -## Enable the collector - -The `chrony` collector is disabled by default. To enable it, use `edit-config` from the Netdata [config -directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`, to edit the `python.d.conf` file. - -```bash -cd /etc/netdata # Replace this path with your Netdata config directory, if different -sudo ./edit-config python.d.conf -``` - -Change the value of the `chrony` setting to `yes`. Save the file and restart the Netdata Agent with `sudo systemctl -restart netdata`, or the appropriate method for your system, to finish enabling the `chrony` collector. - -## Configuration - -Edit the `python.d/chrony.conf` configuration file using `edit-config` from the Netdata [config -directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. - -```bash -cd /etc/netdata # Replace this path with your Netdata config directory, if different -sudo ./edit-config python.d/chrony.conf -``` - -Sample: - -```yaml -# data collection frequency: -update_every: 1 - -# chrony query command: -local: - command: 'chronyc -n tracking' -``` - -Save the file and restart the Netdata Agent with `sudo systemctl restart netdata`, or the [appropriate -method](/docs/configure/start-stop-restart.md) for your system, to finish configuring the `chrony` collector. - - diff --git a/collectors/python.d.plugin/chrony/chrony.chart.py b/collectors/python.d.plugin/chrony/chrony.chart.py deleted file mode 100644 index 91f725001..000000000 --- a/collectors/python.d.plugin/chrony/chrony.chart.py +++ /dev/null @@ -1,118 +0,0 @@ -# -*- coding: utf-8 -*- -# Description: chrony netdata python.d module -# Author: Dominik Schloesser (domschl) -# SPDX-License-Identifier: GPL-3.0-or-later - -from bases.FrameworkServices.ExecutableService import ExecutableService - -# default module values (can be overridden per job in `config`) -update_every = 5 - -CHRONY_COMMAND = 'chronyc -n tracking' - -# charts order (can be overridden if you want less charts, or different order) -ORDER = [ - 'system', - 'offsets', - 'stratum', - 'root', - 'frequency', - 'residualfreq', - 'skew', -] - -CHARTS = { - 'system': { - 'options': [None, 'Chrony System Time Deltas', 'microseconds', 'system', 'chrony.system', 'area'], - 'lines': [ - ['timediff', 'system time', 'absolute', 1, 1000] - ] - }, - 'offsets': { - 'options': [None, 'Chrony System Time Offsets', 'microseconds', 'system', 'chrony.offsets', 'area'], - 'lines': [ - ['lastoffset', 'last offset', 'absolute', 1, 1000], - ['rmsoffset', 'RMS offset', 'absolute', 1, 1000] - ] - }, - 'stratum': { - 'options': [None, 'Chrony Stratum', 'stratum', 'root', 'chrony.stratum', 'line'], - 'lines': [ - ['stratum', None, 'absolute', 1, 1] - ] - }, - 'root': { - 'options': [None, 'Chrony Root Delays', 'milliseconds', 'root', 'chrony.root', 'line'], - 'lines': [ - ['rootdelay', 'delay', 'absolute', 1, 1000000], - ['rootdispersion', 'dispersion', 'absolute', 1, 1000000] - ] - }, - 'frequency': { - 'options': [None, 'Chrony Frequency', 'ppm', 'frequencies', 'chrony.frequency', 'area'], - 'lines': [ - ['frequency', None, 'absolute', 1, 1000] - ] - }, - 'residualfreq': { - 'options': [None, 'Chrony Residual frequency', 'ppm', 'frequencies', 'chrony.residualfreq', 'area'], - 'lines': [ - ['residualfreq', 'residual frequency', 'absolute', 1, 1000] - ] - }, - 'skew': { - 'options': [None, 'Chrony Skew, error bound on frequency', 'ppm', 'frequencies', 'chrony.skew', 'area'], - 'lines': [ - ['skew', None, 'absolute', 1, 1000] - ] - } -} - -CHRONY = [ - ('Frequency', 'frequency', 1e3), - ('Last offset', 'lastoffset', 1e9), - ('RMS offset', 'rmsoffset', 1e9), - ('Residual freq', 'residualfreq', 1e3), - ('Root delay', 'rootdelay', 1e9), - ('Root dispersion', 'rootdispersion', 1e9), - ('Skew', 'skew', 1e3), - ('Stratum', 'stratum', 1), - ('System time', 'timediff', 1e9) -] - - -class Service(ExecutableService): - def __init__(self, configuration=None, name=None): - ExecutableService.__init__( - self, configuration=configuration, name=name) - self.order = ORDER - self.definitions = CHARTS - self.command = CHRONY_COMMAND - - def _get_data(self): - """ - Format data received from shell command - :return: dict - """ - raw_data = self._get_raw_data() - if not raw_data: - return None - - raw_data = (line.split(':', 1) for line in raw_data) - parsed, data = dict(), dict() - - for line in raw_data: - try: - key, value = (l.strip() for l in line) - except ValueError: - continue - if value: - parsed[key] = value.split()[0] - - for key, dim_id, multiplier in CHRONY: - try: - data[dim_id] = int(float(parsed[key]) * multiplier) - except (KeyError, ValueError): - continue - - return data or None diff --git a/collectors/python.d.plugin/chrony/chrony.conf b/collectors/python.d.plugin/chrony/chrony.conf deleted file mode 100644 index fd95519b5..000000000 --- a/collectors/python.d.plugin/chrony/chrony.conf +++ /dev/null @@ -1,77 +0,0 @@ -# netdata python.d.plugin configuration for chrony -# -# This file is in YaML format. Generally the format is: -# -# name: value -# -# There are 2 sections: -# - global variables -# - one or more JOBS -# -# JOBS allow you to collect values from multiple sources. -# Each source will have its own set of charts. -# -# JOB parameters have to be indented (using spaces only, example below). - -# ---------------------------------------------------------------------- -# Global Variables -# These variables set the defaults for all JOBs, however each JOB -# may define its own, overriding the defaults. - -# update_every sets the default data collection frequency. -# If unset, the python.d.plugin default is used. -update_every: 5 - -# priority controls the order of charts at the netdata dashboard. -# Lower numbers move the charts towards the top of the page. -# If unset, the default for python.d.plugin is used. -# priority: 60000 - -# penalty indicates whether to apply penalty to update_every in case of failures. -# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes. -# penalty: yes - -# autodetection_retry sets the job re-check interval in seconds. -# The job is not deleted if check fails. -# Attempts to start the job are made once every autodetection_retry. -# This feature is disabled by default. -# autodetection_retry: 0 - -# ---------------------------------------------------------------------- -# JOBS (data collection sources) -# -# The default JOBS share the same *name*. JOBS with the same name -# are mutually exclusive. Only one of them will be allowed running at -# any time. This allows autodetection to try several alternatives and -# pick the one that works. -# -# Any number of jobs is supported. -# -# All python.d.plugin JOBS (for all its modules) support a set of -# predefined parameters. These are: -# -# job_name: -# name: myname # the JOB's name as it will appear at the -# # dashboard (by default is the job_name) -# # JOBs sharing a name are mutually exclusive -# update_every: 1 # the JOB's data collection frequency -# priority: 60000 # the JOB's order on the dashboard -# penalty: yes # the JOB's penalty -# autodetection_retry: 0 # the JOB's re-check interval in seconds -# -# Additionally to the above, chrony also supports the following: -# -# command: 'chrony tracking' # the command to run -# - -# ---------------------------------------------------------------------- -# REQUIRED chrony CONFIGURATION -# -# netdata will query chrony as user netdata. -# verify that user netdata is allowed to call 'chronyc tracking' -# Check cmdallow in chrony.conf -# ---------------------------------------------------------------------- -# AUTO-DETECTION JOBS - -local: - command: 'chronyc -n tracking' diff --git a/collectors/python.d.plugin/haproxy/README.md b/collectors/python.d.plugin/haproxy/README.md index 4eb962e24..f16e7258e 100644 --- a/collectors/python.d.plugin/haproxy/README.md +++ b/collectors/python.d.plugin/haproxy/README.md @@ -9,30 +9,32 @@ sidebar_label: "HAProxy" Monitors frontend and backend metrics such as bytes in, bytes out, sessions current, sessions in queue current. And health metrics such as backend servers status (server check should be used). -Plugin can obtain data from url **OR** unix socket. +Plugin can obtain data from URL or Unix socket. -**Requirement:** -Socket MUST be readable AND writable by the `netdata` user. +Requirement: + +- Socket must be readable and writable by the `netdata` user. +- URL must have `stats uri ` present in the haproxy config, otherwise you will get HTTP 503 in the haproxy logs. It produces: -1. **Frontend** family charts +1. **Frontend** family charts - - Kilobytes in/s - - Kilobytes out/s - - Sessions current - - Sessions in queue current + - Kilobytes in/s + - Kilobytes out/s + - Sessions current + - Sessions in queue current -2. **Backend** family charts +2. **Backend** family charts - - Kilobytes in/s - - Kilobytes out/s - - Sessions current - - Sessions in queue current + - Kilobytes in/s + - Kilobytes out/s + - Sessions current + - Sessions in queue current -3. **Health** chart +3. **Health** chart - - number of failed servers for every backend (in DOWN state) + - number of failed servers for every backend (in DOWN state) ## Configuration @@ -48,20 +50,18 @@ Sample: ```yaml via_url: - user : 'username' # ONLY IF stats auth is used - pass : 'password' # # ONLY IF stats auth is used - url : 'http://ip.address:port/url;csv;norefresh' + user: 'username' # ONLY IF stats auth is used + pass: 'password' # # ONLY IF stats auth is used + url: 'http://ip.address:port/url;csv;norefresh' ``` OR ```yaml via_socket: - socket : 'path/to/haproxy/sock' + socket: 'path/to/haproxy/sock' ``` If no configuration is given, module will fail to run. --- - - diff --git a/collectors/python.d.plugin/mongodb/mongodb.chart.py b/collectors/python.d.plugin/mongodb/mongodb.chart.py index bec94d3ef..5e8fec834 100644 --- a/collectors/python.d.plugin/mongodb/mongodb.chart.py +++ b/collectors/python.d.plugin/mongodb/mongodb.chart.py @@ -10,7 +10,7 @@ from datetime import datetime from sys import exc_info try: - from pymongo import MongoClient, ASCENDING, DESCENDING + from pymongo import MongoClient, ASCENDING, DESCENDING, version_tuple from pymongo.errors import PyMongoError PYMONGO = True @@ -750,7 +750,7 @@ class Service(SimpleService): CONN_PARAM_HOST: conf.get(CONN_PARAM_HOST, DEFAULT_HOST), CONN_PARAM_PORT: conf.get(CONN_PARAM_PORT, DEFAULT_PORT), } - if hasattr(MongoClient, 'server_selection_timeout'): + if hasattr(MongoClient, 'server_selection_timeout') or version_tuple[0] >= 4: params[CONN_PARAM_SERVER_SELECTION_TIMEOUT_MS] = conf.get('timeout', DEFAULT_TIMEOUT) params.update(self.build_ssl_connection_params()) diff --git a/collectors/python.d.plugin/ovpn_status_log/Makefile.inc b/collectors/python.d.plugin/ovpn_status_log/Makefile.inc deleted file mode 100644 index 1fbc506d6..000000000 --- a/collectors/python.d.plugin/ovpn_status_log/Makefile.inc +++ /dev/null @@ -1,13 +0,0 @@ -# SPDX-License-Identifier: GPL-3.0-or-later - -# THIS IS NOT A COMPLETE Makefile -# IT IS INCLUDED BY ITS PARENT'S Makefile.am -# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT - -# install these files -dist_python_DATA += ovpn_status_log/ovpn_status_log.chart.py -dist_pythonconfig_DATA += ovpn_status_log/ovpn_status_log.conf - -# do not install these files, but include them in the distribution -dist_noinst_DATA += ovpn_status_log/README.md ovpn_status_log/Makefile.inc - diff --git a/collectors/python.d.plugin/ovpn_status_log/README.md b/collectors/python.d.plugin/ovpn_status_log/README.md deleted file mode 100644 index 374d1910e..000000000 --- a/collectors/python.d.plugin/ovpn_status_log/README.md +++ /dev/null @@ -1,50 +0,0 @@ - - -# OpenVPN monitoring with Netdata - -Parses server log files and provides summary (client, traffic) metrics. - -## Requirements - -- If you are running multiple OpenVPN instances out of the same directory, MAKE SURE TO EDIT DIRECTIVES which create output files - so that multiple instances do not overwrite each other's output files. - -- Make sure NETDATA USER CAN READ openvpn-status.log - -- Update_every interval MUST MATCH interval on which OpenVPN writes operational status to log file. - -It produces: - -1. **Users** OpenVPN active users - - - users - -2. **Traffic** OpenVPN overall bandwidth usage in kilobit/s - - - in - - out - -## Configuration - -Edit the `python.d/ovpn_status_log.conf` configuration file using `edit-config` from the Netdata [config -directory](/docs/configure/nodes.md), which is typically at `/etc/netdata`. - -```bash -cd /etc/netdata # Replace this path with your Netdata config directory, if different -sudo ./edit-config python.d/ovpn_status_log.conf -``` - -Sample: - -```yaml -default - log_path : '/var/log/openvpn-status.log' -``` - ---- - - diff --git a/collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py b/collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py deleted file mode 100644 index cfc87be36..000000000 --- a/collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py +++ /dev/null @@ -1,136 +0,0 @@ -# -*- coding: utf-8 -*- -# Description: openvpn status log netdata python.d module -# Author: ilyam8 -# SPDX-License-Identifier: GPL-3.0-or-later - -import re - -from bases.FrameworkServices.SimpleService import SimpleService - -update_every = 10 - -ORDER = [ - 'users', - 'traffic', -] - -CHARTS = { - 'users': { - 'options': [None, 'OpenVPN Active Users', 'active users', 'users', 'openvpn_status.users', 'line'], - 'lines': [ - ['users', None, 'absolute'], - ] - }, - 'traffic': { - 'options': [None, 'OpenVPN Traffic', 'KiB/s', 'traffic', 'openvpn_status.traffic', 'area'], - 'lines': [ - ['bytes_in', 'in', 'incremental', 1, 1 << 10], - ['bytes_out', 'out', 'incremental', -1, 1 << 10] - ] - } -} - -TLS_REGEX = re.compile( - r'(?:[0-9a-f]+:[0-9a-f:]+|(?:\d{1,3}(?:\.\d{1,3}){3}(?::\d+)?)) (?P\d+) (?P\d+)' -) -STATIC_KEY_REGEX = re.compile( - r'TCP/[A-Z]+ (?P(?:read|write)) bytes,(?P\d+)' -) - - -class Service(SimpleService): - def __init__(self, configuration=None, name=None): - SimpleService.__init__(self, configuration=configuration, name=name) - self.order = ORDER - self.definitions = CHARTS - self.log_path = self.configuration.get('log_path') - self.regex = { - 'tls': TLS_REGEX, - 'static_key': STATIC_KEY_REGEX - } - - def check(self): - if not (self.log_path and isinstance(self.log_path, str)): - self.error("'log_path' is not defined") - return False - - data = self._get_raw_data() - if not data: - self.error('Make sure that the openvpn status log file exists and netdata has permission to read it') - return None - - found = None - for row in data: - if 'ROUTING' in row: - self.get_data = self.get_data_tls - found = True - break - elif 'STATISTICS' in row: - self.get_data = self.get_data_static_key - found = True - break - if found: - return True - self.error('Failed to parse openvpn log file') - return False - - def _get_raw_data(self): - """ - Open log file - :return: str - """ - - try: - with open(self.log_path) as log: - raw_data = log.readlines() or None - except OSError: - return None - else: - return raw_data - - def get_data_static_key(self): - """ - Parse openvpn-status log file. - """ - - raw_data = self._get_raw_data() - if not raw_data: - return None - - data = dict(bytes_in=0, bytes_out=0) - - for row in raw_data: - match = self.regex['static_key'].search(row) - if match: - match = match.groupdict() - if match['direction'] == 'read': - data['bytes_in'] += int(match['bytes']) - else: - data['bytes_out'] += int(match['bytes']) - - return data or None - - def get_data_tls(self): - """ - Parse openvpn-status log file. - """ - - raw_data = self._get_raw_data() - if not raw_data: - return None - - data = dict(users=0, bytes_in=0, bytes_out=0) - for row in raw_data: - columns = row.split(',') if ',' in row else row.split() - if 'UNDEF' in columns: - # see https://openvpn.net/archive/openvpn-users/2004-08/msg00116.html - continue - - match = self.regex['tls'].search(' '.join(columns)) - if match: - match = match.groupdict() - data['users'] += 1 - data['bytes_in'] += int(match['bytes_in']) - data['bytes_out'] += int(match['bytes_out']) - - return data or None diff --git a/collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.conf b/collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.conf deleted file mode 100644 index 1d71f6b8e..000000000 --- a/collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.conf +++ /dev/null @@ -1,97 +0,0 @@ -# netdata python.d.plugin configuration for openvpn status log -# -# This file is in YaML format. Generally the format is: -# -# name: value -# -# There are 2 sections: -# - global variables -# - one or more JOBS -# -# JOBS allow you to collect values from multiple sources. -# Each source will have its own set of charts. -# -# JOB parameters have to be indented (using spaces only, example below). - -# ---------------------------------------------------------------------- -# Global Variables -# These variables set the defaults for all JOBs, however each JOB -# may define its own, overriding the defaults. - -# update_every sets the default data collection frequency. -# If unset, the python.d.plugin default is used. -# update_every: 1 - -# priority controls the order of charts at the netdata dashboard. -# Lower numbers move the charts towards the top of the page. -# If unset, the default for python.d.plugin is used. -# priority: 60000 - -# penalty indicates whether to apply penalty to update_every in case of failures. -# Penalty will increase every 5 failed updates in a row. Maximum penalty is 10 minutes. -# penalty: yes - -# autodetection_retry sets the job re-check interval in seconds. -# The job is not deleted if check fails. -# Attempts to start the job are made once every autodetection_retry. -# This feature is disabled by default. -# autodetection_retry: 0 - -# ---------------------------------------------------------------------- -# JOBS (data collection sources) -# -# The default JOBS share the same *name*. JOBS with the same name -# are mutually exclusive. Only one of them will be allowed running at -# any time. This allows autodetection to try several alternatives and -# pick the one that works. -# -# Any number of jobs is supported. -# -# All python.d.plugin JOBS (for all its modules) support a set of -# predefined parameters. These are: -# -# job_name: -# name: myname # the JOB's name as it will appear at the -# # dashboard (by default is the job_name) -# # JOBs sharing a name are mutually exclusive -# update_every: 1 # the JOB's data collection frequency -# priority: 60000 # the JOB's order on the dashboard -# penalty: yes # the JOB's penalty -# autodetection_retry: 0 # the JOB's re-check interval in seconds -# -# Additionally to the above, openvpn status log also supports the following: -# -# log_path: 'PATH' # the path to openvpn status log file -# -# ---------------------------------------------------------------------- -# AUTO-DETECTION JOBS -# only one of them will run (they have the same name) -# -# IMPORTANT information -# -# 1. If you are running multiple OpenVPN instances out of the same directory, MAKE SURE TO EDIT DIRECTIVES which create output files -# so that multiple instances do not overwrite each other's output files. -# 2. Make sure NETDATA USER CAN READ openvpn-status.log -# -# * cd into directory with openvpn-status.log and run the following commands as root -# * #chown :netdata openvpn-status.log && chmod 640 openvpn-status.log -# * To check permission and group membership run -# * #ls -l openvpn-status.log -# -rw-r----- 1 root netdata 359 dec 21 21:22 openvpn-status.log -# -# 3. Update_every interval MUST MATCH interval on which OpenVPN writes operational status to log file. -# If its not true traffic chart WILL DISPLAY WRONG values -# -# Default OpenVPN update interval is 10 second on Debian 8 -# # ps -C openvpn -o command= -# /usr/sbin/openvpn --daemon ovpn-server --status /run/openvpn/server.status 10 --cd /etc/openvpn --config /etc/openvpn/server.conf -# -# 4. Confirm status is configured in your OpenVPN configuration. -# * Open OpenVPN config in an editor (e.g. sudo nano /etc/openvpn/default.conf) -# * Confirm status is enabled with below: -# status /var/log/openvpn-status.log -# -#default: -# log_path: '/var/log/openvpn-status.log' -# -# ---------------------------------------------------------------------- diff --git a/collectors/python.d.plugin/postgres/README.md b/collectors/python.d.plugin/postgres/README.md index 224b76ff5..7acb9a7a9 100644 --- a/collectors/python.d.plugin/postgres/README.md +++ b/collectors/python.d.plugin/postgres/README.md @@ -6,6 +6,9 @@ sidebar_label: "PostgreSQL" # PostgreSQL monitoring with Netdata +> **Warning**: This module is deprecated and will be deleted in v1.37.0. +> Use [go.d/postgres](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/postgres). + Collects database health and performance metrics. ## Requirements @@ -97,7 +100,8 @@ cd /etc/netdata # Replace this path with your Netdata config directory, if dif sudo ./edit-config python.d/postgres.conf ``` -When no configuration file is found, the module tries to connect to TCP/IP socket: `localhost:5432`. +When no configuration file is found, the module tries to connect to TCP/IP socket: `localhost:5432` with the +following collection jobs. ```yaml socket: @@ -113,6 +117,29 @@ tcp: port : 5432 ``` +**Note**: Every job collection must have a unique identifier. In cases that you monitor multiple DBs, every +job must have it's own name. Use a mnemonic of your preference (e.g us_east_db, us_east_tcp) + +## Troubleshooting + +To troubleshoot issues with the `postgres` collector, run the `python.d.plugin` with the debug option enabled. The output +should give you clues as to why the collector isn't working. + +First, navigate to your plugins directory, usually at `/usr/libexec/netdata/plugins.d/`. If that's not the case on your +system, open `netdata.conf` and look for the setting `plugins directory`. Once you're in the plugin's directory, switch +to the `netdata` user. + +```bash +cd /usr/libexec/netdata/plugins.d/ +sudo su -s /bin/bash netdata +``` + +You can now run the `python.d.plugin` to debug the collector: + +```bash +./python.d.plugin postgres debug trace +``` + --- diff --git a/collectors/python.d.plugin/python.d.conf b/collectors/python.d.plugin/python.d.conf index af58b451c..72e20fcd3 100644 --- a/collectors/python.d.plugin/python.d.conf +++ b/collectors/python.d.plugin/python.d.conf @@ -25,73 +25,48 @@ gc_run: yes # Garbage collection interval in seconds. Default is 300. gc_interval: 300 -# apache: yes - -# apache_cache has been replaced by web_log # adaptec_raid: yes # alarms: yes # am2320: yes # anomalies: no -apache_cache: no # beanstalk: yes # bind_rndc: yes # boinc: yes # ceph: yes -chrony: no # changefinder: no -# couchdb: yes -# dns_query_time: yes -# dnsdist: yes # dockerd: yes # dovecot: yes -# elasticsearch: yes -# energid: yes # this is just an example example: no # exim: yes # fail2ban: yes -# freeradius: yes # gearman: yes go_expvar: no -# gunicorn_log has been replaced by web_log -gunicorn_log: no # haproxy: yes # hddtemp: yes -# httpcheck: yes hpssa: no # icecast: yes # ipfs: yes -# isc_dhcpd: yes # litespeed: yes logind: no # megacli: yes # memcached: yes # mongodb: yes # monit: yes -# mysql: yes -# nginx: yes # nginx_plus: yes # nvidia_smi: yes - -# nginx_log has been replaced by web_log -nginx_log: no # nsd: yes # ntpd: yes # openldap: yes # oracledb: yes -# ovpn_status_log: yes -# phpfpm: yes -# portcheck: yes # postfix: yes # postgres: yes -# powerdns: yes # proxysql: yes # puppet: yes # rabbitmq: yes -# redis: yes # rethinkdbs: yes # retroshare: yes # riakkv: yes @@ -107,5 +82,4 @@ nginx_log: no # uwsgi: yes # varnish: yes # w1sensor: yes -# web_log: yes # zscores: no diff --git a/collectors/python.d.plugin/python.d.plugin.in b/collectors/python.d.plugin/python.d.plugin.in index b943f3a20..c04cb3ff0 100644 --- a/collectors/python.d.plugin/python.d.plugin.in +++ b/collectors/python.d.plugin/python.d.plugin.in @@ -31,8 +31,8 @@ import os import pprint import re import sys -import time import threading +import time import types try: @@ -50,6 +50,7 @@ else: ENV_NETDATA_USER_CONFIG_DIR = 'NETDATA_USER_CONFIG_DIR' ENV_NETDATA_STOCK_CONFIG_DIR = 'NETDATA_STOCK_CONFIG_DIR' ENV_NETDATA_PLUGINS_DIR = 'NETDATA_PLUGINS_DIR' +ENV_NETDATA_USER_PLUGINS_DIRS = 'NETDATA_USER_PLUGINS_DIRS' ENV_NETDATA_LIB_DIR = 'NETDATA_LIB_DIR' ENV_NETDATA_UPDATE_EVERY = 'NETDATA_UPDATE_EVERY' ENV_NETDATA_LOCK_DIR = 'NETDATA_LOCK_DIR' @@ -99,6 +100,9 @@ def dirs(): modules_user_config = os.path.join(plugin_user_config, 'python.d') modules_stock_config = os.path.join(plugin_stock_config, 'python.d') modules = os.path.abspath(pluginsd + '/../python.d') + user_modules = [os.path.join(p, 'python.d') for p in + os.getenv(ENV_NETDATA_USER_PLUGINS_DIRS, "").split(" ") if + p] Dirs = collections.namedtuple( 'Dirs', @@ -108,6 +112,7 @@ def dirs(): 'modules_user_config', 'modules_stock_config', 'modules', + 'user_modules', 'var_lib', 'locks', ] @@ -118,6 +123,7 @@ def dirs(): modules_user_config, modules_stock_config, modules, + user_modules, var_lib, locks, ) @@ -130,6 +136,28 @@ IS_ATTY = sys.stdout.isatty() MODULE_SUFFIX = '.chart.py' +def find_available_modules(*directories): + AvailableModule = collections.namedtuple( + 'AvailableModule', + [ + 'filepath', + 'name', + ] + ) + available = list() + for d in directories: + try: + if not os.path.isdir(d): + continue + files = sorted(os.listdir(d)) + except OSError: + continue + modules = [m for m in files if m.endswith(MODULE_SUFFIX)] + available.extend([AvailableModule(os.path.join(d, m), m[:-len(MODULE_SUFFIX)]) for m in modules]) + + return available + + def available_modules(): obsolete = ( 'apache_cache', # replaced by web_log @@ -143,10 +171,17 @@ def available_modules(): 'unbound', # rewritten in Go ) - files = sorted(os.listdir(DIRS.modules)) - modules = [m[:-len(MODULE_SUFFIX)] for m in files if m.endswith(MODULE_SUFFIX)] - avail = [m for m in modules if m not in obsolete] - return tuple(avail) + stock = [m for m in find_available_modules(DIRS.modules) if m.name not in obsolete] + user = find_available_modules(*DIRS.user_modules) + + available, seen = list(), set() + for m in user + stock: + if m.name in seen: + continue + seen.add(m.name) + available.append(m) + + return available AVAILABLE_MODULES = available_modules() @@ -176,9 +211,8 @@ def multi_path_find(name, *paths): return str() -def load_module(name): - abs_path = os.path.join(DIRS.modules, '{0}{1}'.format(name, MODULE_SUFFIX)) - module = SourceFileLoader('pythond_' + name, abs_path) +def load_module(name, filepath): + module = SourceFileLoader('pythond_' + name, filepath) if isinstance(module, types.ModuleType): return module return module.load_module() @@ -331,12 +365,13 @@ class Job(threading.Thread): class ModuleSrc: - def __init__(self, name): - self.name = name + def __init__(self, m): + self.name = m.name + self.filepath = m.filepath self.src = None def load(self): - self.src = load_module(self.name) + self.src = load_module(self.name, self.filepath) def get(self, key): return getattr(self.src, key, None) @@ -537,7 +572,8 @@ class Plugin: try: statuses = JobsStatuses().from_file(abs_path) except Exception as error: - self.log.warning("error on loading '{0}' : {1}".format(abs_path, repr(error))) + self.log.error("[{0}] config file invalid YAML format: {1}".format( + module_name, ' '.join([v.strip() for v in str(error).split('\n')]))) return None self.log.debug("'{0}' is loaded".format(abs_path)) return statuses @@ -553,37 +589,38 @@ class Plugin: builder.min_update_every = self.min_update_every jobs = list() - for mod_name in self.modules_to_run: - if not self.config.is_module_enabled(mod_name): - self.log.info("[{0}] is disabled in the configuration file, skipping it".format(mod_name)) + for m in self.modules_to_run: + if not self.config.is_module_enabled(m.name): + self.log.info("[{0}] is disabled in the configuration file, skipping it".format(m.name)) continue - src = ModuleSrc(mod_name) + src = ModuleSrc(m) try: src.load() except Exception as error: - self.log.warning("[{0}] error on loading source : {1}, skipping it".format(mod_name, repr(error))) + self.log.warning("[{0}] error on loading source : {1}, skipping it".format(m.name, repr(error))) continue + self.log.debug("[{0}] loaded module source : '{1}'".format(m.name, m.filepath)) if not (src.service() and callable(src.service())): - self.log.warning("[{0}] has no callable Service object, skipping it".format(mod_name)) + self.log.warning("[{0}] has no callable Service object, skipping it".format(m.name)) continue - if src.is_disabled_by_default() and not self.config.is_module_explicitly_enabled(mod_name): - self.log.info("[{0}] is disabled by default, skipping it".format(mod_name)) + if src.is_disabled_by_default() and not self.config.is_module_explicitly_enabled(m.name): + self.log.info("[{0}] is disabled by default, skipping it".format(m.name)) continue builder.module_defaults = src.defaults() - configs = builder.build(mod_name) + configs = builder.build(m.name) if not configs: - self.log.info("[{0}] has no job configs, skipping it".format(mod_name)) + self.log.info("[{0}] has no job configs, skipping it".format(m.name)) continue for config in configs: config['job_name'] = re.sub(r'\s+', '_', config['job_name']) config['override_name'] = re.sub(r'\s+', '_', config.pop('name')) - job = Job(src.service(), mod_name, config) + job = Job(src.service(), m.name, config) was_previously_active = job_statuses and job_statuses.has(job.module_name, job.real_name) if was_previously_active and job.autodetection_retry == 0: @@ -811,6 +848,20 @@ def disable(): exit(0) +def get_modules_to_run(cmd): + if not cmd.modules_to_run: + return AVAILABLE_MODULES + + modules_to_run, seen = list(), set() + for m in AVAILABLE_MODULES: + if m.name not in cmd.modules_to_run or m.name in seen: + continue + seen.add(m.name) + modules_to_run.append(m) + + return modules_to_run + + def main(): cmd = parse_command_line() log = PythonDLogger() @@ -822,21 +873,22 @@ def main(): log.info('using python v{0}'.format(PY_VERSION[0])) - unknown = set(cmd.modules_to_run) - set(AVAILABLE_MODULES) + if DIRS.locks and not cmd.nolock: + registry = FileLockRegistry(DIRS.locks) + else: + registry = DummyRegistry() + + unique_avail_module_names = set([m.name for m in AVAILABLE_MODULES]) + unknown = set(cmd.modules_to_run) - unique_avail_module_names if unknown: log.error('unknown modules : {0}'.format(sorted(list(unknown)))) - guessed = guess_module(AVAILABLE_MODULES, *cmd.modules_to_run) + guessed = guess_module(unique_avail_module_names, *cmd.modules_to_run) if guessed: log.info('probably you meant : \n{0}'.format(pprint.pformat(guessed, width=1))) return - if DIRS.locks and not cmd.nolock: - registry = FileLockRegistry(DIRS.locks) - else: - registry = DummyRegistry() - p = Plugin( - cmd.modules_to_run or AVAILABLE_MODULES, + get_modules_to_run(cmd), cmd.update_every, registry, ) diff --git a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py index c304ccec2..ed1b2e669 100644 --- a/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py +++ b/collectors/python.d.plugin/python_modules/bases/FrameworkServices/SimpleService.py @@ -95,8 +95,9 @@ class SimpleService(PythonDLimitedLogger, object): @property def name(self): - if self.job_name and self.job_name != self.module_name: - return '_'.join([self.module_name, self.override_name or self.job_name]) + name = self.override_name or self.job_name + if name and name != self.module_name: + return '_'.join([self.module_name, name]) return self.module_name def actual_name(self): diff --git a/collectors/python.d.plugin/python_modules/urllib3/_collections.py b/collectors/python.d.plugin/python_modules/urllib3/_collections.py index c1d2fad36..2a6b3ec70 100644 --- a/collectors/python.d.plugin/python_modules/urllib3/_collections.py +++ b/collectors/python.d.plugin/python_modules/urllib3/_collections.py @@ -1,6 +1,11 @@ # SPDX-License-Identifier: MIT from __future__ import absolute_import -from collections import Mapping, MutableMapping + +try: + from collections import Mapping, MutableMapping +except ImportError: + from collections.abc import Mapping, MutableMapping + try: from threading import RLock except ImportError: # Platform-specific: No threads available diff --git a/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py b/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py index c0997b1a2..de5e49838 100644 --- a/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py +++ b/collectors/python.d.plugin/python_modules/urllib3/util/selectors.py @@ -12,7 +12,13 @@ import select import socket import sys import time -from collections import namedtuple, Mapping + +from collections import namedtuple + +try: + from collections import Mapping +except ImportError: + from collections.abc import Mapping try: monotonic = time.monotonic diff --git a/collectors/python.d.plugin/smartd_log/smartd_log.chart.py b/collectors/python.d.plugin/smartd_log/smartd_log.chart.py index 75b8c8c40..dc4e95dec 100644 --- a/collectors/python.d.plugin/smartd_log/smartd_log.chart.py +++ b/collectors/python.d.plugin/smartd_log/smartd_log.chart.py @@ -630,6 +630,7 @@ class Service(SimpleService): self.exclude = configuration.get('exclude_disks', str()).split() self.disks = list() self.runs = 0 + self.do_force_rescan = False def check(self): return self.scan() > 0 @@ -637,9 +638,10 @@ class Service(SimpleService): def get_data(self): self.runs += 1 - if self.runs % DEF_RESCAN_INTERVAL == 0: + if self.do_force_rescan or self.runs % DEF_RESCAN_INTERVAL == 0: self.cleanup() self.scan() + self.do_force_rescan = False data = dict() @@ -654,10 +656,12 @@ class Service(SimpleService): if changed is None: disk.alive = False + self.do_force_rescan = True continue if changed and disk.populate_attrs() is None: disk.alive = False + self.do_force_rescan = True continue data.update(disk.data()) diff --git a/collectors/python.d.plugin/smartd_log/smartd_log.conf b/collectors/python.d.plugin/smartd_log/smartd_log.conf index 4f138d17a..6c01d953b 100644 --- a/collectors/python.d.plugin/smartd_log/smartd_log.conf +++ b/collectors/python.d.plugin/smartd_log/smartd_log.conf @@ -65,3 +65,11 @@ # exclude_disks: 'PATTERN1 PATTERN2' # space separated patterns. If the pattern is in the drive name, the module will not collect data for it. # # ---------------------------------------------------------------------- + +custom: + name: smartd_log + log_path: '/var/log/smartd/' + +debian: + name: smartd_log + log_path: '/var/lib/smartmontools/' diff --git a/collectors/python.d.plugin/zscores/README.md b/collectors/python.d.plugin/zscores/README.md index 7fb189f6a..4f84a6c1f 100644 --- a/collectors/python.d.plugin/zscores/README.md +++ b/collectors/python.d.plugin/zscores/README.md @@ -1,9 +1,7 @@ # Z-Scores - basic anomaly detection for your key metrics and charts @@ -143,4 +141,4 @@ per_chart_agg: 'mean' # 'absmax' will take the max absolute value across all dim - About ~50mb of ram (`apps.mem`) being continually used by the `python.d.plugin`. - If you activate this collector on a fresh node, it might take a little while to build up enough data to calculate a proper zscore. So until you actually have `train_secs` of available data the mean and stddev calculated will be subject - to more noise. \ No newline at end of file + to more noise. diff --git a/collectors/statsd.plugin/README.md b/collectors/statsd.plugin/README.md index 7dc5dbb72..b46ca28d9 100644 --- a/collectors/statsd.plugin/README.md +++ b/collectors/statsd.plugin/README.md @@ -77,7 +77,7 @@ Netdata fully supports the StatsD protocol and also extends it to support more a - **Sets** - The application sends `name:value|s`, where `value` is anything (**number or text**, leading and trailing spaces are removed), StatsD reports the number of unique values sent and the number of times it was updated (events). + The application sends `name:value|s`, where `value` is anything (**number or text**, leading and trailing spaces are removed), StatsD reports the number of unique values sent and the number of times it was updated (events). Sampling rate is **not** supported for Sets. `value` is always considered text (so `01` and `1` are considered different). diff --git a/collectors/statsd.plugin/statsd.c b/collectors/statsd.plugin/statsd.c index 63e3316cb..fef4206bc 100644 --- a/collectors/statsd.plugin/statsd.c +++ b/collectors/statsd.plugin/statsd.c @@ -35,7 +35,7 @@ // data specific to each metric type typedef struct statsd_metric_gauge { - LONG_DOUBLE value; + NETDATA_DOUBLE value; } STATSD_METRIC_GAUGE; typedef struct statsd_metric_counter { // counter and meter @@ -64,7 +64,7 @@ typedef struct statsd_histogram_extensions { size_t size; size_t used; - LONG_DOUBLE *values; // dynamic array of values collected + NETDATA_DOUBLE *values; // dynamic array of values collected } STATSD_METRIC_HISTOGRAM_EXTENSIONS; typedef struct statsd_metric_histogram { // histogram and timer @@ -271,9 +271,7 @@ static struct statsd { size_t tcp_idle_timeout; collected_number decimal_detail; size_t private_charts; - size_t max_private_charts; size_t max_private_charts_hard; - RRD_MEMORY_MODE private_charts_memory_mode; long private_charts_rrd_history_entries; unsigned int private_charts_hidden:1; @@ -290,7 +288,6 @@ static struct statsd { LISTEN_SOCKETS sockets; } statsd = { .enabled = 1, - .max_private_charts = 200, .max_private_charts_hard = 1000, .private_charts_hidden = 0, .recvmmsg_size = 10, @@ -390,7 +387,7 @@ static void dictionary_metric_insert_callback(const char *name, void *value, voi netdata_mutex_init(&m->histogram.ext->mutex); } - __atomic_fetch_add(&index->metrics, 1, __ATOMIC_SEQ_CST); + __atomic_fetch_add(&index->metrics, 1, __ATOMIC_RELAXED); } static void dictionary_metric_delete_callback(const char *name, void *value, void *data) { @@ -431,12 +428,12 @@ static inline STATSD_METRIC *statsd_find_or_add_metric(STATSD_INDEX *index, cons // -------------------------------------------------------------------------------------------------------------------- // statsd parsing numbers -static inline LONG_DOUBLE statsd_parse_float(const char *v, LONG_DOUBLE def) { - LONG_DOUBLE value; +static inline NETDATA_DOUBLE statsd_parse_float(const char *v, NETDATA_DOUBLE def) { + NETDATA_DOUBLE value; if(likely(v && *v)) { char *e = NULL; - value = str2ld(v, &e); + value = str2ndd(v, &e); if(unlikely(e && *e)) error("STATSD: excess data '%s' after value '%s'", e, v); } @@ -446,8 +443,8 @@ static inline LONG_DOUBLE statsd_parse_float(const char *v, LONG_DOUBLE def) { return value; } -static inline LONG_DOUBLE statsd_parse_sampling_rate(const char *v) { - LONG_DOUBLE sampling_rate = statsd_parse_float(v, 1.0); +static inline NETDATA_DOUBLE statsd_parse_sampling_rate(const char *v) { + NETDATA_DOUBLE sampling_rate = statsd_parse_float(v, 1.0); if(unlikely(isless(sampling_rate, 0.001))) sampling_rate = 0.001; if(unlikely(isgreater(sampling_rate, 1.0))) sampling_rate = 1.0; return sampling_rate; @@ -522,7 +519,7 @@ static inline void statsd_process_counter_or_meter(STATSD_METRIC *m, const char // magic loading of metric, without affecting anything } else { - m->counter.value += llrintl((LONG_DOUBLE) statsd_parse_int(value, 1) / statsd_parse_sampling_rate(sampling)); + m->counter.value += llrintndd((NETDATA_DOUBLE) statsd_parse_int(value, 1) / statsd_parse_sampling_rate(sampling)); m->events++; m->count++; @@ -549,18 +546,18 @@ static inline void statsd_process_histogram_or_timer(STATSD_METRIC *m, const cha // magic loading of metric, without affecting anything } else { - LONG_DOUBLE v = statsd_parse_float(value, 1.0); - LONG_DOUBLE sampling_rate = statsd_parse_sampling_rate(sampling); + NETDATA_DOUBLE v = statsd_parse_float(value, 1.0); + NETDATA_DOUBLE sampling_rate = statsd_parse_sampling_rate(sampling); if(unlikely(isless(sampling_rate, 0.01))) sampling_rate = 0.01; if(unlikely(isgreater(sampling_rate, 1.0))) sampling_rate = 1.0; - long long samples = llrintl(1.0 / sampling_rate); + long long samples = llrintndd(1.0 / sampling_rate); while(samples-- > 0) { if(unlikely(m->histogram.ext->used == m->histogram.ext->size)) { netdata_mutex_lock(&m->histogram.ext->mutex); m->histogram.ext->size += statsd.histogram_increase_step; - m->histogram.ext->values = reallocz(m->histogram.ext->values, sizeof(LONG_DOUBLE) * m->histogram.ext->size); + m->histogram.ext->values = reallocz(m->histogram.ext->values, sizeof(NETDATA_DOUBLE) * m->histogram.ext->size); netdata_mutex_unlock(&m->histogram.ext->mutex); } @@ -593,7 +590,6 @@ static inline void statsd_process_set(STATSD_METRIC *m, const char *value) { if(unlikely(m->reset)) { if(likely(m->set.dict)) { dictionary_destroy(m->set.dict); - dictionary_register_insert_callback(m->set.dict, dictionary_metric_set_value_insert_callback, m); m->set.dict = NULL; } statsd_reset_metric(m); @@ -601,6 +597,7 @@ static inline void statsd_process_set(STATSD_METRIC *m, const char *value) { if (unlikely(!m->set.dict)) { m->set.dict = dictionary_create(STATSD_DICTIONARY_OPTIONS); + dictionary_register_insert_callback(m->set.dict, dictionary_metric_set_value_insert_callback, m); m->set.unique = 0; } @@ -1591,7 +1588,7 @@ static inline void statsd_get_metric_type_and_id(STATSD_METRIC *m, char *type, c } static inline RRDSET *statsd_private_rrdset_create( - STATSD_METRIC *m + STATSD_METRIC *m __maybe_unused , const char *type , const char *id , const char *name @@ -1603,16 +1600,6 @@ static inline RRDSET *statsd_private_rrdset_create( , int update_every , RRDSET_TYPE chart_type ) { - RRD_MEMORY_MODE memory_mode = statsd.private_charts_memory_mode; - long history = statsd.private_charts_rrd_history_entries; - - if(unlikely(statsd.private_charts >= statsd.max_private_charts)) { - debug(D_STATSD, "STATSD: metric '%s' will be charted with memory mode = none, because the maximum number of charts has been reached.", m->name); - info("STATSD: metric '%s' will be charted with memory mode = none, because the maximum number of charts (%zu) has been reached. Increase the number of charts by editing netdata.conf, [statsd] section.", m->name, statsd.max_private_charts); - memory_mode = RRD_MEMORY_MODE_NONE; - history = 5; - } - statsd.private_charts++; RRDSET *st = rrdset_create_custom( localhost // host @@ -1628,8 +1615,8 @@ static inline RRDSET *statsd_private_rrdset_create( , priority // priority , update_every // update every , chart_type // chart type - , memory_mode // memory mode - , history // history + , default_rrd_memory_mode // memory mode + , default_rrd_history_entries // history ); rrdset_flag_set(st, RRDSET_FLAG_STORE_FIRST); @@ -1945,21 +1932,21 @@ static inline void statsd_flush_timer_or_histogram(STATSD_METRIC *m, const char netdata_mutex_lock(&m->histogram.ext->mutex); size_t len = m->histogram.ext->used; - LONG_DOUBLE *series = m->histogram.ext->values; + NETDATA_DOUBLE *series = m->histogram.ext->values; sort_series(series, len); - m->histogram.ext->last_min = (collected_number)roundl(series[0] * statsd.decimal_detail); - m->histogram.ext->last_max = (collected_number)roundl(series[len - 1] * statsd.decimal_detail); - m->last = (collected_number)roundl(average(series, len) * statsd.decimal_detail); - m->histogram.ext->last_median = (collected_number)roundl(median_on_sorted_series(series, len) * statsd.decimal_detail); - m->histogram.ext->last_stddev = (collected_number)roundl(standard_deviation(series, len) * statsd.decimal_detail); - m->histogram.ext->last_sum = (collected_number)roundl(sum(series, len) * statsd.decimal_detail); + m->histogram.ext->last_min = (collected_number)roundndd(series[0] * statsd.decimal_detail); + m->histogram.ext->last_max = (collected_number)roundndd(series[len - 1] * statsd.decimal_detail); + m->last = (collected_number)roundndd(average(series, len) * statsd.decimal_detail); + m->histogram.ext->last_median = (collected_number)roundndd(median_on_sorted_series(series, len) * statsd.decimal_detail); + m->histogram.ext->last_stddev = (collected_number)roundndd(standard_deviation(series, len) * statsd.decimal_detail); + m->histogram.ext->last_sum = (collected_number)roundndd(sum(series, len) * statsd.decimal_detail); size_t pct_len = (size_t)floor((double)len * statsd.histogram_percentile / 100.0); if(pct_len < 1) m->histogram.ext->last_percentile = (collected_number)(series[0] * statsd.decimal_detail); else - m->histogram.ext->last_percentile = (collected_number)roundl(series[pct_len - 1] * statsd.decimal_detail); + m->histogram.ext->last_percentile = (collected_number)roundndd(series[pct_len - 1] * statsd.decimal_detail); netdata_mutex_unlock(&m->histogram.ext->mutex); @@ -2300,7 +2287,7 @@ static inline void statsd_flush_index_metrics(STATSD_INDEX *index, void (*flush_ if(unlikely(!(m->options & STATSD_METRIC_OPTION_PRIVATE_CHART_CHECKED))) { if(unlikely(statsd.private_charts >= statsd.max_private_charts_hard)) { debug(D_STATSD, "STATSD: metric '%s' will not be charted, because the hard limit of the maximum number of charts has been reached.", m->name); - info("STATSD: metric '%s' will not be charted, because the hard limit of the maximum number of charts (%zu) has been reached. Increase the number of charts by editing netdata.conf, [statsd] section.", m->name, statsd.max_private_charts); + info("STATSD: metric '%s' will not be charted, because the hard limit of the maximum number of charts (%zu) has been reached. Increase the number of charts by editing netdata.conf, [statsd] section.", m->name, statsd.max_private_charts_hard); m->options &= ~STATSD_METRIC_OPTION_PRIVATE_CHART_ENABLED; } else { @@ -2446,9 +2433,7 @@ void *statsd_main(void *ptr) { #endif statsd.charts_for = simple_pattern_create(config_get(CONFIG_SECTION_STATSD, "create private charts for metrics matching", "*"), NULL, SIMPLE_PATTERN_EXACT); - statsd.max_private_charts = (size_t)config_get_number(CONFIG_SECTION_STATSD, "max private charts allowed", (long long)statsd.max_private_charts); - statsd.max_private_charts_hard = (size_t)config_get_number(CONFIG_SECTION_STATSD, "max private charts hard limit", (long long)statsd.max_private_charts * 5); - statsd.private_charts_memory_mode = rrd_memory_mode_id(config_get(CONFIG_SECTION_STATSD, "private charts memory mode", rrd_memory_mode_name(default_rrd_memory_mode))); + statsd.max_private_charts_hard = (size_t)config_get_number(CONFIG_SECTION_STATSD, "max private charts hard limit", (long long)statsd.max_private_charts_hard); statsd.private_charts_rrd_history_entries = (int)config_get_number(CONFIG_SECTION_STATSD, "private charts history", default_rrd_history_entries); statsd.decimal_detail = (collected_number)config_get_number(CONFIG_SECTION_STATSD, "decimal detail", (long long int)statsd.decimal_detail); statsd.tcp_idle_timeout = (size_t) config_get_number(CONFIG_SECTION_STATSD, "disconnect idle tcp clients after seconds", (long long int)statsd.tcp_idle_timeout); diff --git a/configure.ac b/configure.ac index 7af950aa0..40cd3869d 100644 --- a/configure.ac +++ b/configure.ac @@ -42,6 +42,7 @@ AC_PROG_CXX AC_PROG_INSTALL PKG_PROG_PKG_CONFIG AC_USE_SYSTEM_EXTENSIONS +AC_PROG_RANLIB # ----------------------------------------------------------------------------- # configurable options @@ -218,14 +219,6 @@ AC_ARG_ENABLE( [ enable_cloud="detect" ] ) -AC_ARG_WITH( - [new-cloud-protocol], - [AS_HELP_STRING([--with-new-cloud-protocol], - [Requires New Cloud Protocol support to be built])], - [new_cloud_protocol="$withval"], - [new_cloud_protocol="detect"] -) - if test "${enable_cloud}" = "no"; then AC_DEFINE([DISABLE_CLOUD], [1], [disable netdata cloud functionality]) fi @@ -363,6 +356,8 @@ else fi AC_MSG_RESULT([${with_math}]) +AC_CHECK_FUNCS([isfinite]) +AC_CHECK_FUNCS([finite]) # ----------------------------------------------------------------------------- # libuv multi-platform support library with a focus on asynchronous I/O @@ -474,45 +469,22 @@ OPTIONAL_JSONC_LIBS="${JSONC_LIBS}" test "${enable_dbengine}" = "yes" -a -z "${LZ4_LIBS}" && \ AC_MSG_ERROR([liblz4 required but not found. Try installing 'liblz4-dev' or 'lz4-devel'.]) - -AC_ARG_WITH([bundled-libJudy], - [AS_HELP_STRING([--with-bundled-libJudy],[Use the bundled version of Judy library (default is system-library)])], - [ - AC_MSG_CHECKING(for libJudy in $withval) - if test -f "externaldeps/libJudy/libJudy.a" -a -f "externaldeps/libJudy/Judy.h"; then - LIBS_BACKUP="${LIBS}" - LIBS="externaldeps/libJudy/libJudy.a" - AC_LINK_IFELSE([AC_LANG_SOURCE([[#include "externaldeps/libJudy/Judy.h" - int main (int argc, char **argv) { - Pvoid_t PJLArray = (Pvoid_t) NULL; - Word_t * PValue; - Word_t Index; - JLI(PValue, PJLArray, Index); - }]])], - [HAVE_libJudy_a="yes"], - [HAVE_libJudy_a="no"]) - LIBS="${LIBS_BACKUP}" - JUDY_LIBS="\$(abs_top_srcdir)/externaldeps/libJudy/libJudy.a" - JUDY_CFLAGS="-I \$(abs_top_srcdir)/externaldeps/libJudy" - AC_MSG_RESULT([$HAVE_libJudy_a]) - else - libjudy_dir="" - HAVE_libJudy_a="no" - AC_MSG_RESULT([$HAVE_libJudy_a]) - fi - ], - [HAVE_libJudy_a="no"]) - -if test "${HAVE_libJudy_a}" = "no"; then - AC_CHECK_LIB( - [Judy], - [JudyLIns], - [JUDY_LIBS="-lJudy"] - ) +AC_C_BIGENDIAN([], + [LIBJUDY_CFLAGS="-DJU_LITTLE_ENDIAN"], + [AC_MSG_ERROR([Could not find out system endiannnes])]) + +AC_CHECK_SIZEOF(void *) +if test "$ac_cv_sizeof_void_p" = 8; then + AC_MSG_RESULT(Detected 64-bit Build Environment) + LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -DJU_64BIT" +else + AC_MSG_RESULT(Detected 32-bit Build Environment) + LIBJUDY_CFLAGS="$LIBJUDY_CFLAGS -UJU_64BIT" fi -test "${enable_dbengine}" = "yes" -a -z "${JUDY_LIBS}" && \ - AC_MSG_ERROR([libJudy required but not found. Try installing 'libjudy-dev' or 'Judy-devel'.]) +AC_SUBST([LIBJUDY_CFLAGS]) + +JUDY_CFLAGS="-I \$(abs_top_srcdir)/libnetdata/libjudy/src" test "${enable_https}" = "yes" -a -z "${SSL_LIBS}" && \ AC_MSG_ERROR([OpenSSL required for HTTPS but not found. Try installing 'libssl-dev' or 'openssl-devel'.]) @@ -521,13 +493,12 @@ test "${enable_dbengine}" = "yes" -a -z "${SSL_LIBS}" && \ AC_MSG_ERROR([OpenSSL required for DBENGINE but not found. Try installing 'libssl-dev' or 'openssl-devel'.]) AC_MSG_CHECKING([if netdata dbengine should be used]) -if test "${enable_dbengine}" != "no" -a "${UV_LIBS}" -a "${LZ4_LIBS}" -a "${JUDY_LIBS}" -a "${SSL_LIBS}"; then +if test "${enable_dbengine}" != "no" -a "${UV_LIBS}" -a "${LZ4_LIBS}" -a "${SSL_LIBS}"; then enable_dbengine="yes" AC_DEFINE([ENABLE_DBENGINE], [1], [netdata dbengine usability]) OPTIONAL_LZ4_CFLAGS="${LZ4_CFLAGS}" OPTIONAL_LZ4_LIBS="${LZ4_LIBS}" OPTIONAL_JUDY_CFLAGS="${JUDY_CFLAGS}" - OPTIONAL_JUDY_LIBS="${JUDY_LIBS}" OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}" OPTIONAL_SSL_LIBS="${SSL_LIBS}" else @@ -766,16 +737,16 @@ AC_MSG_CHECKING([if Cloud functionality should be enabled]) AC_MSG_RESULT([${enable_cloud}]) if test "$enable_cloud" != "no"; then - AC_MSG_NOTICE([Checking if ACLK Next Generation can be built]) + AC_MSG_NOTICE([Checking if ACLK can be built]) can_enable_ng="yes" - AC_MSG_CHECKING([if git submodules present for ACLK Next Generation]) + AC_MSG_CHECKING([if git submodules present for ACLK]) if test -f "mqtt_websockets/src/mqtt_wss_client.c"; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) can_enable_ng="no" fi - AC_MSG_CHECKING([if SSL available for ACLK Next Generation]) + AC_MSG_CHECKING([if SSL available for ACLK]) if test -n "${SSL_LIBS}"; then AC_MSG_RESULT([yes]) OPTIONAL_SSL_CFLAGS="${SSL_CFLAGS}" @@ -783,7 +754,7 @@ if test "$enable_cloud" != "no"; then else AC_MSG_RESULT([no]) fi - AC_MSG_CHECKING([if JSON-C available for ACLK Next Generation]) + AC_MSG_CHECKING([if JSON-C available for ACLK]) if test "$enable_jsonc" != "yes"; then AC_MSG_RESULT([no]) can_enable_ng="no" @@ -791,6 +762,28 @@ if test "$enable_cloud" != "no"; then AC_MSG_RESULT([yes]) fi + AC_MSG_CHECKING([if protobuf available for ACLK New Cloud Protocol]) + if test "${have_libprotobuf}" != "yes"; then + AC_MSG_RESULT([no]) + can_enable_ng="no" + else + AC_MSG_RESULT([yes]) + fi + AC_MSG_CHECKING([if protoc available for ACLK New Cloud Protocol]) + if test "${have_protoc}" != "yes"; then + AC_MSG_RESULT([no]) + can_enable_ng="no" + else + AC_MSG_RESULT([yes]) + fi + AC_MSG_CHECKING([if C++ compiler available for ACLK New Cloud Protocol]) + if test "${have_CXX_compiler}" != "yes"; then + AC_MSG_RESULT([no]) + can_enable_ng="no" + else + AC_MSG_RESULT([yes]) + fi + AC_MSG_CHECKING([ACLK Next Generation can be built]) AC_MSG_RESULT([${can_enable_ng}]) if test "$can_enable_ng" = "no" -a "$enable_cloud" = "yes"; then @@ -799,46 +792,10 @@ if test "$enable_cloud" != "no"; then if test "$can_enable_ng" = "yes"; then enable_aclk="yes" AC_DEFINE([ENABLE_ACLK], [1], [netdata ACLK]) - OPTIONAL_ACLK_CFLAGS="-I \$(abs_top_srcdir)/mqtt_websockets/src/include -I \$(abs_top_srcdir)/mqtt_websockets/c-rbuf/include -I \$(abs_top_srcdir)/mqtt_websockets/MQTT-C/include" - fi - - if test "$new_cloud_protocol" != "no"; then - can_build_new_cloud_protocol="yes" - AC_MSG_CHECKING([if protobuf available for New Cloud Protocol]) - if test "${have_libprotobuf}" != "yes"; then - AC_MSG_RESULT([no]) - can_build_new_cloud_protocol="no" - else - AC_MSG_RESULT([yes]) - fi - AC_MSG_CHECKING([if protoc available for New Cloud Protocol]) - if test "${have_protoc}" != "yes"; then - AC_MSG_RESULT([no]) - can_build_new_cloud_protocol="no" - else - AC_MSG_RESULT([yes]) - fi - AC_MSG_CHECKING([if C++ compiler available for New Cloud Protocol]) - if test "${have_CXX_compiler}" != "yes"; then - AC_MSG_RESULT([no]) - can_build_new_cloud_protocol="no" - else - AC_MSG_RESULT([yes]) - fi - - AC_MSG_CHECKING([ACLK Next Generation can support New Cloud protocol]) - AC_MSG_RESULT([${can_build_new_cloud_protocol}]) - if test "$new_cloud_protocol" = "yes" -a "$can_build_new_cloud_protocol" != "yes"; then - AC_MSG_ERROR([Requested new cloud protocol support but it can't be build]) - fi - if test "$can_build_new_cloud_protocol" = "yes"; then - new_cloud_protocol="yes" - AC_DEFINE([ENABLE_NEW_CLOUD_PROTOCOL], [1], [New protobuf based Netdata Cloud Protocol Support]) - OPTIONAL_ACLK_CFLAGS="${OPTIONAL_ACLK_CFLAGS} -I \$(abs_top_srcdir)/aclk/aclk-schemas" - OPTIONAL_PROTOBUF_CFLAGS="${PROTOBUF_CFLAGS}" - CXX11FLAG="-std=c++11" - OPTIONAL_PROTOBUF_LIBS="${PROTOBUF_LIBS}" - fi + OPTIONAL_ACLK_CFLAGS="-I \$(abs_top_srcdir)/mqtt_websockets/src/include -I \$(abs_top_srcdir)/mqtt_websockets/c-rbuf/include -I \$(abs_top_srcdir)/mqtt_websockets/MQTT-C/include -I \$(abs_top_srcdir)/aclk/aclk-schemas" + OPTIONAL_PROTOBUF_CFLAGS="${PROTOBUF_CFLAGS}" + CXX11FLAG="-std=c++11" + OPTIONAL_PROTOBUF_LIBS="${PROTOBUF_LIBS}" fi fi @@ -849,7 +806,6 @@ fi AC_SUBST([enable_cloud]) AC_SUBST([enable_aclk]) AM_CONDITIONAL([ENABLE_ACLK], [test "${enable_aclk}" = "yes"]) -AM_CONDITIONAL([ENABLE_NEW_CLOUD_PROTOCOL], [test "${can_build_new_cloud_protocol}" = "yes"]) # ----------------------------------------------------------------------------- # apps.plugin @@ -1621,8 +1577,6 @@ AC_SUBST([OPTIONAL_MATH_CFLAGS]) AC_SUBST([OPTIONAL_MATH_LIBS]) AC_SUBST([OPTIONAL_UV_LIBS]) AC_SUBST([OPTIONAL_LZ4_LIBS]) -AC_SUBST([OPTIONAL_JUDY_CFLAGS]) -AC_SUBST([OPTIONAL_JUDY_LIBS]) AC_SUBST([OPTIONAL_SSL_LIBS]) AC_SUBST([OPTIONAL_JSONC_LIBS]) AC_SUBST([OPTIONAL_NFACCT_CFLAGS]) @@ -1727,6 +1681,8 @@ AC_CONFIG_FILES([ database/Makefile database/engine/Makefile database/engine/metadata_log/Makefile + database/ram/Makefile + database/sqlite/Makefile diagrams/Makefile exporting/Makefile exporting/graphite/Makefile @@ -1745,6 +1701,7 @@ AC_CONFIG_FILES([ libnetdata/Makefile libnetdata/tests/Makefile libnetdata/adaptive_resortable_list/Makefile + libnetdata/arrayalloc/Makefile libnetdata/avl/Makefile libnetdata/buffer/Makefile libnetdata/clocks/Makefile @@ -1785,14 +1742,17 @@ AC_CONFIG_FILES([ web/api/formatters/value/Makefile web/api/queries/Makefile web/api/queries/average/Makefile + web/api/queries/countif/Makefile web/api/queries/des/Makefile web/api/queries/incremental_sum/Makefile web/api/queries/max/Makefile web/api/queries/median/Makefile web/api/queries/min/Makefile + web/api/queries/percentile/Makefile web/api/queries/ses/Makefile web/api/queries/stddev/Makefile web/api/queries/sum/Makefile + web/api/queries/trimmed_mean/Makefile web/api/health/Makefile web/gui/Makefile web/gui/dashboard/Makefile diff --git a/contrib/debian/control b/contrib/debian/control index ed8a6d58d..c5e5791ff 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -7,7 +7,6 @@ Build-Depends: debhelper (>= 9.20160709), libelf-dev, libuv1-dev, liblz4-dev, - libjudy-dev, libssl-dev, libmnl-dev, libjson-c-dev, diff --git a/contrib/debian/control.xenial b/contrib/debian/control.xenial index 2659c389d..43246d716 100644 --- a/contrib/debian/control.xenial +++ b/contrib/debian/control.xenial @@ -8,7 +8,6 @@ Build-Depends: debhelper (>= 9), libelf-dev, libuv1-dev, liblz4-dev, - libjudy-dev, libssl-dev, libmnl-dev, libjson-c-dev, diff --git a/contrib/debian/netdata.postinst b/contrib/debian/netdata.postinst index a6bd29960..12b1d97b7 100644 --- a/contrib/debian/netdata.postinst +++ b/contrib/debian/netdata.postinst @@ -1,4 +1,4 @@ -#! /bin/sh +#!/bin/sh set -e @@ -16,36 +16,39 @@ dpkg-maintscript-helper dir_to_symlink \ /var/lib/netdata/www/static /usr/share/netdata/www/static 1.18.1~ netdata -- "$@" case "$1" in - configure) - if [ -z "$2" ]; then - if ! getent group netdata > /dev/null; then - addgroup --quiet --system netdata - fi + configure|recnfigure) + if ! getent group netdata > /dev/null; then + addgroup --quiet --system netdata + fi - if ! getent passwd netdata > /dev/null; then - adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata - fi + if ! getent passwd netdata > /dev/null; then + adduser --quiet --system --ingroup netdata --home /var/lib/netdata --no-create-home netdata + fi - if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then - dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata + for item in docker nginx varnish haproxy adm nsd proxy squid ceph nobody I2C; do + if getent group $item > /dev/null 2>&1; then + usermod -a -G $item netdata fi + done - if ! dpkg-statoverride --list /var/lib/netdata/www > /dev/null 2>&1; then - dpkg-statoverride --update --add root netdata 0755 /var/lib/netdata/www - fi + if ! dpkg-statoverride --list /var/lib/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/lib/netdata + fi - if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then - dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata - fi + if ! dpkg-statoverride --list /var/lib/netdata/www > /dev/null 2>&1; then + dpkg-statoverride --update --add root netdata 0755 /var/lib/netdata/www + fi - if ! dpkg-statoverride --list /var/run/netdata > /dev/null 2>&1; then - dpkg-statoverride --update --add netdata netdata 0755 /var/run/netdata - fi + if ! dpkg-statoverride --list /var/cache/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/cache/netdata + fi - if ! dpkg-statoverride --list /var/log/netdata > /dev/null 2>&1; then - dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata - fi + if ! dpkg-statoverride --list /var/run/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata netdata 0755 /var/run/netdata + fi + if ! dpkg-statoverride --list /var/log/netdata > /dev/null 2>&1; then + dpkg-statoverride --update --add netdata adm 02750 /var/log/netdata fi dpkg-statoverride --force --update --add root netdata 0775 /var/lib/netdata/registry > /dev/null 2>&1 @@ -53,7 +56,12 @@ case "$1" in chown -R root:netdata /usr/libexec/netdata/plugins.d setcap cap_dac_read_search,cap_sys_ptrace+ep /usr/libexec/netdata/plugins.d/apps.plugin setcap cap_dac_read_search+ep /usr/libexec/netdata/plugins.d/slabinfo.plugin - capsh --supports=cap_perfmon 2>/dev/null && setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin || setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin + + if capsh --supports=cap_perfmon 2>/dev/null; then + setcap cap_perfmon+ep /usr/libexec/netdata/plugins.d/perf.plugin + else + setcap cap_sys_admin+ep /usr/libexec/netdata/plugins.d/perf.plugin + fi chmod 4750 /usr/libexec/netdata/plugins.d/cgroup-network chmod 4750 /usr/libexec/netdata/plugins.d/nfacct.plugin diff --git a/daemon/README.md b/daemon/README.md index 44abfa8e9..3ebb405b2 100644 --- a/daemon/README.md +++ b/daemon/README.md @@ -180,6 +180,14 @@ The command line options of the Netdata 1.10.0 version are the following: -W set section option value set netdata.conf option from the command line. + -W buildinfo Print the version, the configure options, + a list of optional features, and whether they + are enabled or not. + + -W buildinfojson Print the version, the configure options, + a list of optional features, and whether they + are enabled or not, in JSON format. + -W simple-pattern pattern string Check if string matches pattern and exit. diff --git a/daemon/analytics.c b/daemon/analytics.c index 6c02561d0..370818b8a 100644 --- a/daemon/analytics.c +++ b/daemon/analytics.c @@ -7,7 +7,7 @@ struct analytics_data analytics_data; extern void analytics_exporting_connectors (BUFFER *b); extern void analytics_exporting_connectors_ssl (BUFFER *b); extern void analytics_build_info (BUFFER *b); -extern int aclk_connected, aclk_use_new_cloud_arch; +extern int aclk_connected; struct collector { char *plugin; @@ -382,7 +382,7 @@ void analytics_https(void) BUFFER *b = buffer_create(30); #ifdef ENABLE_HTTPS analytics_exporting_connectors_ssl(b); - buffer_strcat(b, netdata_client_ctx && localhost->ssl.flags == NETDATA_SSL_HANDSHAKE_COMPLETE && localhost->rrdpush_sender_connected == 1 ? "streaming|" : "|"); + buffer_strcat(b, netdata_client_ctx && localhost->ssl.flags == NETDATA_SSL_HANDSHAKE_COMPLETE && __atomic_load_n(&localhost->rrdpush_sender_connected, __ATOMIC_SEQ_CST) ? "streaming|" : "|"); buffer_strcat(b, netdata_srv_ctx ? "web" : ""); #else buffer_strcat(b, "||"); @@ -499,12 +499,7 @@ void analytics_aclk(void) #ifdef ENABLE_ACLK if (aclk_connected) { analytics_set_data(&analytics_data.netdata_host_aclk_available, "true"); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (aclk_use_new_cloud_arch) - analytics_set_data_str(&analytics_data.netdata_host_aclk_protocol, "New"); - else -#endif - analytics_set_data_str(&analytics_data.netdata_host_aclk_protocol, "Legacy"); + analytics_set_data_str(&analytics_data.netdata_host_aclk_protocol, "New"); } else #endif @@ -546,7 +541,7 @@ void analytics_gather_mutable_meta_data(void) analytics_set_data( &analytics_data.netdata_config_is_parent, (localhost->next || configured_as_parent()) ? "true" : "false"); - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); analytics_set_data(&analytics_data.netdata_host_agent_claimed, claim_id ? "true" : "false"); freez(claim_id); @@ -847,6 +842,20 @@ void set_global_environment() setenv("HOME", verify_required_directory(netdata_configured_home_dir), 1); setenv("NETDATA_HOST_PREFIX", netdata_configured_host_prefix, 1); + { + BUFFER *user_plugins_dirs = buffer_create(FILENAME_MAX); + + for (size_t i = 1; i < PLUGINSD_MAX_DIRECTORIES && plugin_directories[i]; i++) { + if (i > 1) + buffer_strcat(user_plugins_dirs, " "); + buffer_strcat(user_plugins_dirs, plugin_directories[i]); + } + + setenv("NETDATA_USER_PLUGINS_DIRS", buffer_tostring(user_plugins_dirs), 1); + + buffer_free(user_plugins_dirs); + } + analytics_data.data_length = 0; analytics_set_data(&analytics_data.netdata_config_stream_enabled, "null"); analytics_set_data(&analytics_data.netdata_config_memory_mode, "null"); diff --git a/daemon/buildinfo.c b/daemon/buildinfo.c index 86c586afc..0a64547af 100644 --- a/daemon/buildinfo.c +++ b/daemon/buildinfo.c @@ -20,12 +20,6 @@ #endif #endif -#ifdef ENABLE_NEW_CLOUD_PROTOCOL -#define NEW_CLOUD_PROTO 1 -#else -#define NEW_CLOUD_PROTO 0 -#endif - #ifdef ENABLE_DBENGINE #define FEAT_DBENGINE 1 #else @@ -273,7 +267,7 @@ void print_build_info(void) { printf(" Native HTTPS: %s\n", FEAT_YES_NO(FEAT_NATIVE_HTTPS)); printf(" Netdata Cloud: %s %s\n", FEAT_YES_NO(FEAT_CLOUD), FEAT_CLOUD_MSG); printf(" ACLK Next Generation: %s\n", FEAT_YES_NO(FEAT_CLOUD)); - printf(" ACLK-NG New Cloud Protocol: %s\n", FEAT_YES_NO(NEW_CLOUD_PROTO)); + printf(" ACLK-NG New Cloud Protocol: %s\n", FEAT_YES_NO(1)); printf(" ACLK Legacy: %s\n", FEAT_YES_NO(0)); printf(" TLS Host Verification: %s\n", FEAT_YES_NO(FEAT_TLS_HOST_VERIFY)); printf(" Machine Learning: %s\n", FEAT_YES_NO(FEAT_ML)); @@ -325,7 +319,7 @@ void print_build_info_json(void) { printf(" \"cloud-disabled\": false,\n"); #endif printf(" \"aclk-ng\": %s,\n", FEAT_JSON_BOOL(FEAT_CLOUD)); - printf(" \"aclk-ng-new-cloud-proto\": %s,\n", FEAT_JSON_BOOL(NEW_CLOUD_PROTO)); + printf(" \"aclk-ng-new-cloud-proto\": %s,\n", FEAT_JSON_BOOL(1)); printf(" \"aclk-legacy\": %s,\n", FEAT_JSON_BOOL(0)); printf(" \"tls-host-verify\": %s,\n", FEAT_JSON_BOOL(FEAT_TLS_HOST_VERIFY)); @@ -383,10 +377,7 @@ void analytics_build_info(BUFFER *b) { add_to_bi(b, "Native HTTPS"); #endif #ifdef ENABLE_ACLK - add_to_bi(b, "Netdata Cloud|ACLK Next Generation"); -#endif -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - add_to_bi(b, "New Cloud Protocol Support"); + add_to_bi(b, "Netdata Cloud|ACLK Next Generation|New Cloud Protocol Support"); #endif #if (FEAT_TLS_HOST_VERIFY!=0) add_to_bi(b, "TLS Host Verification"); diff --git a/daemon/commands.c b/daemon/commands.c index 6efc37c96..13d8dbd40 100644 --- a/daemon/commands.c +++ b/daemon/commands.c @@ -217,17 +217,7 @@ static cmd_status_t cmd_reload_labels_execute(char *args, char **message) reload_host_labels(); BUFFER *wb = buffer_create(10); - - rrdhost_rdlock(localhost); - netdata_rwlock_rdlock(&localhost->labels.labels_rwlock); - struct label *l = localhost->labels.head; - while (l != NULL) { - buffer_sprintf(wb,"Label [source id=%s]: \"%s\" -> \"%s\"\n", translate_label_source(l->label_source), l->key, l->value); - l = l->next; - } - netdata_rwlock_unlock(&localhost->labels.labels_rwlock); - rrdhost_unlock(localhost); - + rrdlabels_log_to_buffer(localhost->host_labels, wb); (*message)=strdupz(buffer_tostring(wb)); buffer_free(wb); diff --git a/daemon/common.h b/daemon/common.h index da96e2ac1..2a45ffe70 100644 --- a/daemon/common.h +++ b/daemon/common.h @@ -84,9 +84,6 @@ #include "commands.h" #include "analytics.h" -// metric correlations -#include "database/metric_correlations.h" - // global netdata daemon variables extern char *netdata_configured_hostname; extern char *netdata_configured_user_config_dir; diff --git a/daemon/config/README.md b/daemon/config/README.md index 72f688543..7b4d27ecf 100644 --- a/daemon/config/README.md +++ b/daemon/config/README.md @@ -26,20 +26,21 @@ the [web server access lists](/web/server/README.md#access-lists). `netdata.conf` has sections stated with `[section]`. You will see the following sections: 1. `[global]` to [configure](#global-section-options) the [Netdata daemon](/daemon/README.md). -2. `[directories]` to [configure](#directories-section-options) the directories used by Netdata. -3. `[logs]` to [configure](#logs-section-options) the Netdata logging. -4. `[environment variables]` to [configure](#environment-variables-section-options) the environment variables used +2. `[db]` to [configure](#db-section-options) the database of Netdata. +3. `[directories]` to [configure](#directories-section-options) the directories used by Netdata. +4. `[logs]` to [configure](#logs-section-options) the Netdata logging. +5. `[environment variables]` to [configure](#environment-variables-section-options) the environment variables used Netdata. -5. `[sqlite]` to [configure](#sqlite-section-options) the [Netdata daemon](/daemon/README.md) SQLite settings. -6. `[ml]` to configure settings for [machine learning](/ml/README.md). -7. `[health]` to [configure](#health-section-options) general settings for [health monitoring](/health/README.md). -8. `[web]` to [configure the web server](/web/server/README.md). -9. `[registry]` for the [Netdata registry](/registry/README.md). -10. `[global statistics]` for the [Netdata registry](/registry/README.md). -11. `[statsd]` for the general settings of the [stats.d.plugin](/collectors/statsd.plugin/README.md). -12. `[plugins]` to [configure](#plugins-section-options) which [collectors](/collectors/README.md) to use and PATH +6. `[sqlite]` to [configure](#sqlite-section-options) the [Netdata daemon](/daemon/README.md) SQLite settings. +7. `[ml]` to configure settings for [machine learning](/ml/README.md). +8. `[health]` to [configure](#health-section-options) general settings for [health monitoring](/health/README.md). +9. `[web]` to [configure the web server](/web/server/README.md). +10. `[registry]` for the [Netdata registry](/registry/README.md). +11. `[global statistics]` for the [Netdata registry](/registry/README.md). +12. `[statsd]` for the general settings of the [stats.d.plugin](/collectors/statsd.plugin/README.md). +13. `[plugins]` to [configure](#plugins-section-options) which [collectors](/collectors/README.md) to use and PATH settings. -13. `[plugin:NAME]` sections for each collector plugin, under the +14. `[plugin:NAME]` sections for each collector plugin, under the comment [Per plugin configuration](#per-plugin-configuration). The configuration file is a `name = value` dictionary. Netdata will not complain if you set options unknown to it. When @@ -67,30 +68,47 @@ Please note that your data history will be lost if you have modified `history` p ### [global] section options -| setting | default | info | -|:-------------------------------------:|:------------------------------------------------------------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| process scheduling policy | `keep` | See [Netdata process scheduling policy](/daemon/README.md#netdata-process-scheduling-policy) | -| OOM score | `0` | | -| glibc malloc arena max for plugins | `1` | See [Virtual memory](/daemon/README.md#virtual-memory). | -| glibc malloc arena max for Netdata | `1` | See [Virtual memory](/daemon/README.md#virtual-memory). | -| hostname | auto-detected | The hostname of the computer running Netdata. | -| history | `3996` | Used with `memory mode = save/map/ram/alloc`, not the default `memory mode = dbengine`. This number reflects the number of entries the `netdata` daemon will by default keep in memory for each chart dimension. This setting can also be configured per chart. Check [Memory Requirements](/database/README.md) for more information. | -| update every | `1` | The frequency in seconds, for data collection. For more information see the [performance guide](/docs/guides/configure/performance.md). | -| memory mode | `dbengine` | `dbengine`: The default for long-term metrics storage with efficient RAM and disk usage. Can be extended with `page cache size` and `dbengine disk space`.
`save`: Netdata will save its round robin database on exit and load it on startup.
`map`: Cache files will be updated in real-time. Not ideal for systems with high load or slow disks (check `man mmap`).
`ram`: The round-robin database will be temporary and it will be lost when Netdata exits.
`none`: Disables the database at this host, and disables health monitoring entirely, as that requires a database of metrics. | -| page cache size | 32 | Determines the amount of RAM in MiB that is dedicated to caching Netdata metric values. | -| dbengine disk space | 256 | Determines the amount of disk space in MiB that is dedicated to storing Netdata metric values and all related metadata describing them. | -| dbengine multihost disk space | 256 | Same functionality as `dbengine disk space`, but includes support for storing metrics streamed to a parent node by its children. Can be used in single-node environments as well. | -| host access prefix | | This is used in docker environments where /proc, /sys, etc have to be accessed via another path. You may also have to set SYS_PTRACE capability on the docker for this work. Check [issue 43](https://github.com/netdata/netdata/issues/43). | -| memory deduplication (ksm) | `yes` | When set to `yes`, Netdata will offer its in-memory round robin database to kernel same page merging (KSM) for deduplication. For more information check [Memory Deduplication - Kernel Same Page Merging - KSM](/database/README.md#ksm) | -| timezone | auto-detected | The timezone retrieved from the environment variable | -| run as user | `netdata` | The user Netdata will run as. | -| pthread stack size | auto-detected | | -| cleanup obsolete charts after seconds | `3600` | See [monitoring ephemeral containers](/collectors/cgroups.plugin/README.md#monitoring-ephemeral-containers), also sets the timeout for cleaning up obsolete dimensions | -| gap when lost iterations above | `1` | | -| cleanup orphan hosts after seconds | `3600` | How long to wait until automatically removing from the DB a remote Netdata host (child) that is no longer sending data. | -| delete obsolete charts files | `yes` | See [monitoring ephemeral containers](/collectors/cgroups.plugin/README.md#monitoring-ephemeral-containers), also affects the deletion of files for obsolete dimensions | -| delete orphan hosts files | `yes` | Set to `no` to disable non-responsive host removal. | -| enable zero metrics | `no` | Set to `yes` to show charts when all their metrics are zero. | +| setting | default | info | +|:-------------------------------------:|:-------------:|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| process scheduling policy | `keep` | See [Netdata process scheduling policy](/daemon/README.md#netdata-process-scheduling-policy) | +| OOM score | `0` | | +| glibc malloc arena max for plugins | `1` | See [Virtual memory](/daemon/README.md#virtual-memory). | +| glibc malloc arena max for Netdata | `1` | See [Virtual memory](/daemon/README.md#virtual-memory). | +| hostname | auto-detected | The hostname of the computer running Netdata. | +| host access prefix | empty | This is used in docker environments where /proc, /sys, etc have to be accessed via another path. You may also have to set SYS_PTRACE capability on the docker for this work. Check [issue 43](https://github.com/netdata/netdata/issues/43). | +| timezone | auto-detected | The timezone retrieved from the environment variable | +| run as user | `netdata` | The user Netdata will run as. | +| pthread stack size | auto-detected | | + +### [db] section options + +| setting | default | info | +|:---------------------------------------------:|:----------:|:------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| mode | `dbengine` | `dbengine`: The default for long-term metrics storage with efficient RAM and disk usage. Can be extended with `dbengine page cache size MB` and `dbengine disk space MB`.
`save`: Netdata will save its round robin database on exit and load it on startup.
`map`: Cache files will be updated in real-time. Not ideal for systems with high load or slow disks (check `man mmap`).
`ram`: The round-robin database will be temporary and it will be lost when Netdata exits.
`none`: Disables the database at this host, and disables health monitoring entirely, as that requires a database of metrics. | +| retention | `3600` | Used with `mode = save/map/ram/alloc`, not the default `mode = dbengine`. This number reflects the number of entries the `netdata` daemon will by default keep in memory for each chart dimension. Check [Memory Requirements](/database/README.md) for more information. | +| storage tiers | `1` | The number of storage tiers you want to have in your dbengine. Check the tiering mechanism in the [dbengine's reference](/database/engine/README.md#tiering). You can have up to 5 tiers of data (including the _Tier 0_). This number ranges between 1 and 5. | +| dbengine page cache size MB | `32` | Determines the amount of RAM in MiB that is dedicated to caching for _Tier 0_ Netdata metric values. | +| dbengine tier **`N`** page cache size MB | `32` | Determines the amount of RAM in MiB that is dedicated for caching Netdata metric values of the **`N`** tier.
`N belongs to [1..4]` || + | dbengine disk space MB | `256` | Determines the amount of disk space in MiB that is dedicated to storing _Tier 0_ Netdata metric values and all related metadata describing them. This option is available **only for legacy configuration** (`Agent v1.23.2 and prior`). | +| dbengine multihost disk space MB | `256` | Same functionality as `dbengine disk space MB`, but includes support for storing metrics streamed to a parent node by its children. Can be used in single-node environments as well. This setting is only for _Tier 0_ metrics. | +| dbengine tier **`N`** multihost disk space MB | `256` | Same functionality as `dbengine multihost disk space MB`, but stores metrics of the **`N`** tier (both parent node and its children). Can be used in single-node environments as well.
`N belongs to [1..4]` | +| update every | `1` | The frequency in seconds, for data collection. For more information see the [performance guide](/docs/guides/configure/performance.md). These metrics stored as _Tier 0_ data. Explore the tiering mechanism in the [dbengine's reference](/database/engine/README.md#tiering). | +| dbengine tier **`N`** update every iterations | `60` | The down sampling value of each tier from the previous one. For each Tier, the greater by one Tier has N (equal to 60 by default) less data points of any metric it collects. This setting can take values from `2` up to `255`.
`N belongs to [1..4]` | +| dbengine tier **`N`** back fill | `New` | Specifies the strategy of recreating missing data on each Tier from the exact lower Tier.
`New`: Sees the latest point on each Tier and save new points to it only if the exact lower Tier has available points for it's observation window (`dbengine tier N update every iterations` window).
`none`: No back filling is applied.
`N belongs to [1..4]` | +| memory deduplication (ksm) | `yes` | When set to `yes`, Netdata will offer its in-memory round robin database and the dbengine page cache to kernel same page merging (KSM) for deduplication. For more information check [Memory Deduplication - Kernel Same Page Merging - KSM](/database/README.md#ksm) | +| cleanup obsolete charts after secs | `3600` | See [monitoring ephemeral containers](/collectors/cgroups.plugin/README.md#monitoring-ephemeral-containers), also sets the timeout for cleaning up obsolete dimensions | +| gap when lost iterations above | `1` | | +| cleanup orphan hosts after secs | `3600` | How long to wait until automatically removing from the DB a remote Netdata host (child) that is no longer sending data. | +| delete obsolete charts files | `yes` | See [monitoring ephemeral containers](/collectors/cgroups.plugin/README.md#monitoring-ephemeral-containers), also affects the deletion of files for obsolete dimensions | +| delete orphan hosts files | `yes` | Set to `no` to disable non-responsive host removal. | +| enable zero metrics | `no` | Set to `yes` to show charts when all their metrics are zero. | + +:::info + +The multiplication of all the **enabled** tiers `dbengine tier N update every iterations` values must be less than `65535`. + +::: + ### [directories] section options diff --git a/daemon/get-kubernetes-labels.sh.in b/daemon/get-kubernetes-labels.sh.in index 7e11ba3dd..bc82c2aee 100644 --- a/daemon/get-kubernetes-labels.sh.in +++ b/daemon/get-kubernetes-labels.sh.in @@ -1,4 +1,5 @@ #!/usr/bin/env bash +me="$(basename "${0}")" # Checks if netdata is running in a kubernetes pod and fetches: # - pod's labels @@ -8,8 +9,8 @@ if [ -z "${KUBERNETES_SERVICE_HOST}" ] || [ -z "${KUBERNETES_PORT_443_TCP_PORT}" exit 0 fi -if ! command -v jq > /dev/null 2>&1; then - echo "jq command not available. Please install jq to get host labels for kubernetes pods." +if ! command -v jq >/dev/null 2>&1; then + echo >&2 "${me}: jq command not available. Please install jq to get host labels for kubernetes pods." exit 1 fi @@ -18,24 +19,24 @@ HEADER="Authorization: Bearer $TOKEN" HOST="$KUBERNETES_SERVICE_HOST:$KUBERNETES_PORT_443_TCP_PORT" URL="https://$HOST/api/v1/namespaces/$MY_POD_NAMESPACE/pods/$MY_POD_NAME" -if ! POD_DATA=$(curl -sSk -H "$HEADER" "$URL" 2>&1); then - echo "error on curl '${URL}': ${POD_DATA}." +if ! POD_DATA=$(curl --fail -sSk -H "$HEADER" "$URL" 2>&1); then + echo >&2 "${me}: error on curl '${URL}': ${POD_DATA}." exit 1 fi URL="https://$HOST/api/v1/namespaces/kube-system" -if ! KUBE_SYSTEM_NS_DATA=$(curl -sSk -H "$HEADER" "$URL" 2>&1); then - echo "error on curl '${URL}': ${KUBE_SYSTEM_NS_DATA}." +if ! KUBE_SYSTEM_NS_DATA=$(curl --fail -sSk -H "$HEADER" "$URL" 2>&1); then + echo >&2 "${me}: error on curl '${URL}': ${KUBE_SYSTEM_NS_DATA}." exit 1 fi if ! POD_LABELS=$(jq -r '.metadata.labels' <<< "$POD_DATA" | grep ':' | tr -d '," ' 2>&1); then - echo "error on 'jq' parse pod data: ${POD_LABELS}." + echo >&2 "${me}: error on 'jq' parse pod data: ${POD_LABELS}." exit 1 fi if ! KUBE_SYSTEM_NS_UID=$(jq -r '.metadata.uid' <<< "$KUBE_SYSTEM_NS_DATA" 2>&1); then - echo "error on 'jq' parse kube_system_ns: ${KUBE_SYSTEM_NS_UID}." + echo >&2 "${me}: error on 'jq' parse kube_system_ns: ${KUBE_SYSTEM_NS_UID}." exit 1 fi diff --git a/daemon/global_statistics.c b/daemon/global_statistics.c index 98bf0bf9a..249369519 100644 --- a/daemon/global_statistics.c +++ b/daemon/global_statistics.c @@ -46,9 +46,9 @@ static struct global_statistics { }; void rrdr_query_completed(uint64_t db_points_read, uint64_t result_points_generated) { - __atomic_fetch_add(&global_statistics.rrdr_queries_made, 1, __ATOMIC_SEQ_CST); - __atomic_fetch_add(&global_statistics.rrdr_db_points_read, db_points_read, __ATOMIC_SEQ_CST); - __atomic_fetch_add(&global_statistics.rrdr_result_points_generated, result_points_generated, __ATOMIC_SEQ_CST); + __atomic_fetch_add(&global_statistics.rrdr_queries_made, 1, __ATOMIC_RELAXED); + __atomic_fetch_add(&global_statistics.rrdr_db_points_read, db_points_read, __ATOMIC_RELAXED); + __atomic_fetch_add(&global_statistics.rrdr_result_points_generated, result_points_generated, __ATOMIC_RELAXED); } void finished_web_request_statistics(uint64_t dt, @@ -58,45 +58,44 @@ void finished_web_request_statistics(uint64_t dt, uint64_t compressed_content_size) { uint64_t old_web_usec_max = global_statistics.web_usec_max; while(dt > old_web_usec_max) - __atomic_compare_exchange(&global_statistics.web_usec_max, &old_web_usec_max, &dt, 1, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST); - - __atomic_fetch_add(&global_statistics.web_requests, 1, __ATOMIC_SEQ_CST); - __atomic_fetch_add(&global_statistics.web_usec, dt, __ATOMIC_SEQ_CST); - __atomic_fetch_add(&global_statistics.bytes_received, bytes_received, __ATOMIC_SEQ_CST); - __atomic_fetch_add(&global_statistics.bytes_sent, bytes_sent, __ATOMIC_SEQ_CST); - __atomic_fetch_add(&global_statistics.content_size, content_size, __ATOMIC_SEQ_CST); - __atomic_fetch_add(&global_statistics.compressed_content_size, compressed_content_size, __ATOMIC_SEQ_CST); + __atomic_compare_exchange(&global_statistics.web_usec_max, &old_web_usec_max, &dt, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); + + __atomic_fetch_add(&global_statistics.web_requests, 1, __ATOMIC_RELAXED); + __atomic_fetch_add(&global_statistics.web_usec, dt, __ATOMIC_RELAXED); + __atomic_fetch_add(&global_statistics.bytes_received, bytes_received, __ATOMIC_RELAXED); + __atomic_fetch_add(&global_statistics.bytes_sent, bytes_sent, __ATOMIC_RELAXED); + __atomic_fetch_add(&global_statistics.content_size, content_size, __ATOMIC_RELAXED); + __atomic_fetch_add(&global_statistics.compressed_content_size, compressed_content_size, __ATOMIC_RELAXED); } uint64_t web_client_connected(void) { - __atomic_fetch_add(&global_statistics.connected_clients, 1, __ATOMIC_SEQ_CST); - return __atomic_fetch_add(&global_statistics.web_client_count, 1, __ATOMIC_SEQ_CST); + __atomic_fetch_add(&global_statistics.connected_clients, 1, __ATOMIC_RELAXED); + return __atomic_fetch_add(&global_statistics.web_client_count, 1, __ATOMIC_RELAXED); } void web_client_disconnected(void) { - __atomic_fetch_sub(&global_statistics.connected_clients, 1, __ATOMIC_SEQ_CST); + __atomic_fetch_sub(&global_statistics.connected_clients, 1, __ATOMIC_RELAXED); } static inline void global_statistics_copy(struct global_statistics *gs, uint8_t options) { - gs->connected_clients = __atomic_fetch_add(&global_statistics.connected_clients, 0, __ATOMIC_SEQ_CST); - gs->web_requests = __atomic_fetch_add(&global_statistics.web_requests, 0, __ATOMIC_SEQ_CST); - gs->web_usec = __atomic_fetch_add(&global_statistics.web_usec, 0, __ATOMIC_SEQ_CST); - gs->web_usec_max = __atomic_fetch_add(&global_statistics.web_usec_max, 0, __ATOMIC_SEQ_CST); - gs->bytes_received = __atomic_fetch_add(&global_statistics.bytes_received, 0, __ATOMIC_SEQ_CST); - gs->bytes_sent = __atomic_fetch_add(&global_statistics.bytes_sent, 0, __ATOMIC_SEQ_CST); - gs->content_size = __atomic_fetch_add(&global_statistics.content_size, 0, __ATOMIC_SEQ_CST); - gs->compressed_content_size = __atomic_fetch_add(&global_statistics.compressed_content_size, 0, __ATOMIC_SEQ_CST); - gs->web_client_count = __atomic_fetch_add(&global_statistics.web_client_count, 0, __ATOMIC_SEQ_CST); - - gs->rrdr_queries_made = __atomic_fetch_add(&global_statistics.rrdr_queries_made, 0, __ATOMIC_SEQ_CST); - gs->rrdr_db_points_read = __atomic_fetch_add(&global_statistics.rrdr_db_points_read, 0, __ATOMIC_SEQ_CST); - gs->rrdr_result_points_generated = __atomic_fetch_add(&global_statistics.rrdr_result_points_generated, 0, __ATOMIC_SEQ_CST); + gs->connected_clients = __atomic_fetch_add(&global_statistics.connected_clients, 0, __ATOMIC_RELAXED); + gs->web_requests = __atomic_fetch_add(&global_statistics.web_requests, 0, __ATOMIC_RELAXED); + gs->web_usec = __atomic_fetch_add(&global_statistics.web_usec, 0, __ATOMIC_RELAXED); + gs->web_usec_max = __atomic_fetch_add(&global_statistics.web_usec_max, 0, __ATOMIC_RELAXED); + gs->bytes_received = __atomic_fetch_add(&global_statistics.bytes_received, 0, __ATOMIC_RELAXED); + gs->bytes_sent = __atomic_fetch_add(&global_statistics.bytes_sent, 0, __ATOMIC_RELAXED); + gs->content_size = __atomic_fetch_add(&global_statistics.content_size, 0, __ATOMIC_RELAXED); + gs->compressed_content_size = __atomic_fetch_add(&global_statistics.compressed_content_size, 0, __ATOMIC_RELAXED); + gs->web_client_count = __atomic_fetch_add(&global_statistics.web_client_count, 0, __ATOMIC_RELAXED); + + gs->rrdr_queries_made = __atomic_fetch_add(&global_statistics.rrdr_queries_made, 0, __ATOMIC_RELAXED); + gs->rrdr_db_points_read = __atomic_fetch_add(&global_statistics.rrdr_db_points_read, 0, __ATOMIC_RELAXED); + gs->rrdr_result_points_generated = __atomic_fetch_add(&global_statistics.rrdr_result_points_generated, 0, __ATOMIC_RELAXED); if(options & GLOBAL_STATS_RESET_WEB_USEC_MAX) { uint64_t n = 0; - __atomic_compare_exchange(&global_statistics.web_usec_max, (uint64_t *) &gs->web_usec_max, &n, 1, __ATOMIC_SEQ_CST, - __ATOMIC_SEQ_CST); + __atomic_compare_exchange(&global_statistics.web_usec_max, (uint64_t *) &gs->web_usec_max, &n, 1, __ATOMIC_RELAXED, __ATOMIC_RELAXED); } } @@ -452,21 +451,28 @@ static void dbengine_statistics_charts(void) { RRDHOST *host; unsigned long long stats_array[RRDENG_NR_STATS] = {0}; unsigned long long local_stats_array[RRDENG_NR_STATS]; - unsigned dbengine_contexts = 0, counted_multihost_db = 0, i; + unsigned dbengine_contexts = 0, counted_multihost_db[RRD_STORAGE_TIERS] = { 0 }, i; rrdhost_foreach_read(host) { if (host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && !rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) { - if (&multidb_ctx == host->rrdeng_ctx) { - if (counted_multihost_db) - continue; /* Only count multi-host DB once */ - counted_multihost_db = 1; - } - ++dbengine_contexts; - /* get localhost's DB engine's statistics */ - rrdeng_get_37_statistics(host->rrdeng_ctx, local_stats_array); - for (i = 0; i < RRDENG_NR_STATS; ++i) { - /* aggregate statistics across hosts */ - stats_array[i] += local_stats_array[i]; + + /* get localhost's DB engine's statistics for each tier */ + for(int tier = 0; tier < storage_tiers ;tier++) { + if(!host->storage_instance[tier]) continue; + + if(is_storage_engine_shared(host->storage_instance[tier])) { + if(counted_multihost_db[tier]) + continue; + else + counted_multihost_db[tier] = 1; + } + + ++dbengine_contexts; + rrdeng_get_37_statistics((struct rrdengine_instance *)host->storage_instance[tier], local_stats_array); + for (i = 0; i < RRDENG_NR_STATS; ++i) { + /* aggregate statistics across hosts */ + stats_array[i] += local_stats_array[i]; + } } } } @@ -796,7 +802,7 @@ static void dbengine_statistics_charts(void) { static RRDDIM *rd_index_metadata = NULL; static RRDDIM *rd_pages_metadata = NULL; - collected_number cached_pages, pinned_pages, API_producers, populated_pages, cache_metadata, pages_on_disk, + collected_number API_producers, populated_pages, cache_metadata, pages_on_disk, page_cache_descriptors, index_metadata, pages_metadata; if (unlikely(!st_ram_usage)) { @@ -827,13 +833,6 @@ static void dbengine_statistics_charts(void) { populated_pages = (collected_number)stats_array[3]; page_cache_descriptors = (collected_number)stats_array[27]; - if (API_producers * 2 > populated_pages) { - pinned_pages = API_producers; - } else { - pinned_pages = API_producers * 2; - } - cached_pages = populated_pages - pinned_pages; - cache_metadata = page_cache_descriptors * sizeof(struct page_cache_descr); pages_metadata = pages_on_disk * sizeof(struct rrdeng_page_descr); @@ -841,8 +840,8 @@ static void dbengine_statistics_charts(void) { /* This is an empirical estimation for Judy array indexing and extent structures */ index_metadata = pages_on_disk * 58; - rrddim_set_by_pointer(st_ram_usage, rd_cached, cached_pages); - rrddim_set_by_pointer(st_ram_usage, rd_pinned, pinned_pages); + rrddim_set_by_pointer(st_ram_usage, rd_cached, populated_pages - API_producers); + rrddim_set_by_pointer(st_ram_usage, rd_pinned, API_producers); rrddim_set_by_pointer(st_ram_usage, rd_cache_metadata, cache_metadata); rrddim_set_by_pointer(st_ram_usage, rd_pages_metadata, pages_metadata); rrddim_set_by_pointer(st_ram_usage, rd_index_metadata, index_metadata); @@ -997,6 +996,7 @@ static struct worker_utilization all_workers_utilization[] = { { .name = "TC", .family = "workers plugin tc", .priority = 1000000 }, { .name = "TIMEX", .family = "workers plugin timex", .priority = 1000000 }, { .name = "IDLEJITTER", .family = "workers plugin idlejitter", .priority = 1000000 }, + { .name = "RRDCONTEXT", .family = "workers aclk contexts", .priority = 1000000 }, // has to be terminated with a NULL { .name = NULL, .family = NULL } @@ -1153,7 +1153,7 @@ static void workers_utilization_update_chart(struct worker_utilization *wu) { if(wu->workers_cpu_registered == 0) rrddim_set_by_pointer(wu->st_workers_cpu, wu->rd_workers_cpu_avg, 0); else - rrddim_set_by_pointer(wu->st_workers_cpu, wu->rd_workers_cpu_avg, (collected_number)( wu->workers_cpu_total * 10000ULL / (calculated_number)wu->workers_cpu_registered )); + rrddim_set_by_pointer(wu->st_workers_cpu, wu->rd_workers_cpu_avg, (collected_number)( wu->workers_cpu_total * 10000ULL / (NETDATA_DOUBLE)wu->workers_cpu_registered )); rrdset_done(wu->st_workers_cpu); } diff --git a/daemon/main.c b/daemon/main.c index e10d38b40..ada3c14f2 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -47,7 +47,7 @@ void netdata_cleanup_and_exit(int ret) { // stop everything info("EXIT: stopping static threads..."); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK aclk_sync_exit_all(); #endif cancel_main_threads(); @@ -55,13 +55,16 @@ void netdata_cleanup_and_exit(int ret) { // free the database info("EXIT: freeing database memory..."); #ifdef ENABLE_DBENGINE - rrdeng_prepare_exit(&multidb_ctx); + for(int tier = 0; tier < storage_tiers ; tier++) + rrdeng_prepare_exit(multidb_ctx[tier]); #endif rrdhost_free_all(); #ifdef ENABLE_DBENGINE - rrdeng_exit(&multidb_ctx); + for(int tier = 0; tier < storage_tiers ; tier++) + rrdeng_exit(multidb_ctx[tier]); #endif } + sql_close_context_database(); sql_close_database(); // unlink the pid @@ -349,6 +352,12 @@ int help(int exitcode) { #endif " -W set section option value\n" " set netdata.conf option from the command line.\n\n" + " -W buildinfo Print the version, the configure options,\n" + " a list of optional features, and whether they\n" + " are enabled or not.\n\n" + " -W buildinfojson Print the version, the configure options,\n" + " a list of optional features, and whether they\n" + " are enabled or not, in JSON format.\n\n" " -W simple-pattern pattern string\n" " Check if string matches pattern and exit.\n\n" " -W \"claim -token=TOKEN -rooms=ROOM1,ROOM2\"\n" @@ -393,6 +402,14 @@ static void log_init(void) { snprintfz(filename, FILENAME_MAX, "%s/access.log", netdata_configured_log_dir); stdaccess_filename = config_get(CONFIG_SECTION_LOGS, "access", filename); +#ifdef ENABLE_ACLK + aclklog_enabled = config_get_boolean(CONFIG_SECTION_CLOUD, "conversation log", CONFIG_BOOLEAN_NO); + if (aclklog_enabled) { + snprintfz(filename, FILENAME_MAX, "%s/aclk.log", netdata_configured_log_dir); + aclklog_filename = config_get(CONFIG_SECTION_CLOUD, "conversation log file", filename); + } +#endif + char deffacility[8]; snprintfz(deffacility,7,"%s","daemon"); facility_log = config_get(CONFIG_SECTION_LOGS, "facility", deffacility); @@ -516,6 +533,64 @@ static void backwards_compatible_config() { config_move(CONFIG_SECTION_STATSD, "enabled", CONFIG_SECTION_PLUGINS, "statsd"); + + config_move(CONFIG_SECTION_GLOBAL, "memory mode", + CONFIG_SECTION_DB, "mode"); + + config_move(CONFIG_SECTION_GLOBAL, "history", + CONFIG_SECTION_DB, "retention"); + + config_move(CONFIG_SECTION_GLOBAL, "update every", + CONFIG_SECTION_DB, "update every"); + + config_move(CONFIG_SECTION_GLOBAL, "page cache size", + CONFIG_SECTION_DB, "dbengine page cache size MB"); + + config_move(CONFIG_SECTION_DB, "page cache size", + CONFIG_SECTION_DB, "dbengine page cache size MB"); + + config_move(CONFIG_SECTION_GLOBAL, "page cache uses malloc", + CONFIG_SECTION_DB, "dbengine page cache with malloc"); + + config_move(CONFIG_SECTION_DB, "page cache with malloc", + CONFIG_SECTION_DB, "dbengine page cache with malloc"); + + config_move(CONFIG_SECTION_GLOBAL, "dbengine disk space", + CONFIG_SECTION_DB, "dbengine disk space MB"); + + config_move(CONFIG_SECTION_GLOBAL, "dbengine multihost disk space", + CONFIG_SECTION_DB, "dbengine multihost disk space MB"); + + config_move(CONFIG_SECTION_GLOBAL, "memory deduplication (ksm)", + CONFIG_SECTION_DB, "memory deduplication (ksm)"); + + config_move(CONFIG_SECTION_GLOBAL, "dbengine page fetch timeout", + CONFIG_SECTION_DB, "dbengine page fetch timeout secs"); + + config_move(CONFIG_SECTION_GLOBAL, "dbengine page fetch retries", + CONFIG_SECTION_DB, "dbengine page fetch retries"); + + config_move(CONFIG_SECTION_GLOBAL, "dbengine extent pages", + CONFIG_SECTION_DB, "dbengine pages per extent"); + + config_move(CONFIG_SECTION_GLOBAL, "cleanup obsolete charts after seconds", + CONFIG_SECTION_DB, "cleanup obsolete charts after secs"); + + config_move(CONFIG_SECTION_GLOBAL, "gap when lost iterations above", + CONFIG_SECTION_DB, "gap when lost iterations above"); + + config_move(CONFIG_SECTION_GLOBAL, "cleanup orphan hosts after seconds", + CONFIG_SECTION_DB, "cleanup orphan hosts after secs"); + + config_move(CONFIG_SECTION_GLOBAL, "delete obsolete charts files", + CONFIG_SECTION_DB, "delete obsolete charts files"); + + config_move(CONFIG_SECTION_GLOBAL, "delete orphan hosts files", + CONFIG_SECTION_DB, "delete orphan hosts files"); + + config_move(CONFIG_SECTION_GLOBAL, "enable zero metrics", + CONFIG_SECTION_DB, "enable zero metrics"); + } static void get_netdata_configured_variables() { @@ -533,28 +608,40 @@ static void get_netdata_configured_variables() { debug(D_OPTIONS, "hostname set to '%s'", netdata_configured_hostname); // ------------------------------------------------------------------------ - // get default database size - - default_rrd_history_entries = (int) config_get_number(CONFIG_SECTION_GLOBAL, "history", align_entries_to_pagesize(default_rrd_memory_mode, RRD_DEFAULT_HISTORY_ENTRIES)); + // get default database update frequency - long h = align_entries_to_pagesize(default_rrd_memory_mode, default_rrd_history_entries); - if(h != default_rrd_history_entries) { - config_set_number(CONFIG_SECTION_GLOBAL, "history", h); - default_rrd_history_entries = (int)h; + default_rrd_update_every = (int) config_get_number(CONFIG_SECTION_DB, "update every", UPDATE_EVERY); + if(default_rrd_update_every < 1 || default_rrd_update_every > 600) { + error("Invalid data collection frequency (update every) %d given. Defaulting to %d.", default_rrd_update_every, UPDATE_EVERY); + default_rrd_update_every = UPDATE_EVERY; + config_set_number(CONFIG_SECTION_DB, "update every", default_rrd_update_every); } - if(default_rrd_history_entries < 5 || default_rrd_history_entries > RRD_HISTORY_ENTRIES_MAX) { - error("Invalid history entries %d given. Defaulting to %d.", default_rrd_history_entries, RRD_DEFAULT_HISTORY_ENTRIES); - default_rrd_history_entries = RRD_DEFAULT_HISTORY_ENTRIES; + // ------------------------------------------------------------------------ + // get default memory mode for the database + + { + const char *mode = config_get(CONFIG_SECTION_DB, "mode", rrd_memory_mode_name(default_rrd_memory_mode)); + default_rrd_memory_mode = rrd_memory_mode_id(mode); + if(strcmp(mode, rrd_memory_mode_name(default_rrd_memory_mode)) != 0) { + error("Invalid memory mode '%s' given. Using '%s'", mode, rrd_memory_mode_name(default_rrd_memory_mode)); + config_set(CONFIG_SECTION_DB, "mode", rrd_memory_mode_name(default_rrd_memory_mode)); + } } // ------------------------------------------------------------------------ - // get default database update frequency + // get default database size - default_rrd_update_every = (int) config_get_number(CONFIG_SECTION_GLOBAL, "update every", UPDATE_EVERY); - if(default_rrd_update_every < 1 || default_rrd_update_every > 600) { - error("Invalid data collection frequency (update every) %d given. Defaulting to %d.", default_rrd_update_every, UPDATE_EVERY_MAX); - default_rrd_update_every = UPDATE_EVERY; + if(default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE && default_rrd_memory_mode != RRD_MEMORY_MODE_NONE) { + default_rrd_history_entries = (int)config_get_number( + CONFIG_SECTION_DB, "retention", + align_entries_to_pagesize(default_rrd_memory_mode, RRD_DEFAULT_HISTORY_ENTRIES)); + + long h = align_entries_to_pagesize(default_rrd_memory_mode, default_rrd_history_entries); + if (h != default_rrd_history_entries) { + config_set_number(CONFIG_SECTION_DB, "retention", h); + default_rrd_history_entries = (int)h; + } } // ------------------------------------------------------------------------ @@ -576,38 +663,38 @@ static void get_netdata_configured_variables() { netdata_configured_primary_plugins_dir = plugin_directories[PLUGINSD_STOCK_PLUGINS_DIRECTORY_PATH]; } - // ------------------------------------------------------------------------ - // get default memory mode for the database - - default_rrd_memory_mode = rrd_memory_mode_id(config_get(CONFIG_SECTION_GLOBAL, "memory mode", rrd_memory_mode_name(default_rrd_memory_mode))); #ifdef ENABLE_DBENGINE // ------------------------------------------------------------------------ // get default Database Engine page cache size in MiB - default_rrdeng_page_cache_mb = (int) config_get_number(CONFIG_SECTION_GLOBAL, "page cache size", default_rrdeng_page_cache_mb); + db_engine_use_malloc = config_get_boolean(CONFIG_SECTION_DB, "dbengine page cache with malloc", CONFIG_BOOLEAN_NO); + default_rrdeng_page_cache_mb = (int) config_get_number(CONFIG_SECTION_DB, "dbengine page cache size MB", default_rrdeng_page_cache_mb); if(default_rrdeng_page_cache_mb < RRDENG_MIN_PAGE_CACHE_SIZE_MB) { error("Invalid page cache size %d given. Defaulting to %d.", default_rrdeng_page_cache_mb, RRDENG_MIN_PAGE_CACHE_SIZE_MB); default_rrdeng_page_cache_mb = RRDENG_MIN_PAGE_CACHE_SIZE_MB; + config_set_number(CONFIG_SECTION_DB, "dbengine page cache size MB", default_rrdeng_page_cache_mb); } // ------------------------------------------------------------------------ // get default Database Engine disk space quota in MiB - default_rrdeng_disk_quota_mb = (int) config_get_number(CONFIG_SECTION_GLOBAL, "dbengine disk space", default_rrdeng_disk_quota_mb); + default_rrdeng_disk_quota_mb = (int) config_get_number(CONFIG_SECTION_DB, "dbengine disk space MB", default_rrdeng_disk_quota_mb); if(default_rrdeng_disk_quota_mb < RRDENG_MIN_DISK_SPACE_MB) { error("Invalid dbengine disk space %d given. Defaulting to %d.", default_rrdeng_disk_quota_mb, RRDENG_MIN_DISK_SPACE_MB); default_rrdeng_disk_quota_mb = RRDENG_MIN_DISK_SPACE_MB; + config_set_number(CONFIG_SECTION_DB, "dbengine disk space MB", default_rrdeng_disk_quota_mb); } - default_multidb_disk_quota_mb = (int) config_get_number(CONFIG_SECTION_GLOBAL, "dbengine multihost disk space", compute_multidb_diskspace()); + default_multidb_disk_quota_mb = (int) config_get_number(CONFIG_SECTION_DB, "dbengine multihost disk space MB", compute_multidb_diskspace()); if(default_multidb_disk_quota_mb < RRDENG_MIN_DISK_SPACE_MB) { error("Invalid multidb disk space %d given. Defaulting to %d.", default_multidb_disk_quota_mb, default_rrdeng_disk_quota_mb); default_multidb_disk_quota_mb = default_rrdeng_disk_quota_mb; + config_set_number(CONFIG_SECTION_DB, "dbengine multihost disk space MB", default_multidb_disk_quota_mb); } #else if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { - error_report("RRD_MEMORY_MODE_DBENGINE is not supported in this platform. The agent will use memory mode ram instead."); - default_rrd_memory_mode = RRD_MEMORY_MODE_RAM; + error_report("RRD_MEMORY_MODE_DBENGINE is not supported in this platform. The agent will use db mode 'save' instead."); + default_rrd_memory_mode = RRD_MEMORY_MODE_SAVE; } #endif // ------------------------------------------------------------------------ @@ -619,12 +706,40 @@ static void get_netdata_configured_variables() { // get KSM settings #ifdef MADV_MERGEABLE - enable_ksm = config_get_boolean(CONFIG_SECTION_GLOBAL, "memory deduplication (ksm)", enable_ksm); + enable_ksm = config_get_boolean(CONFIG_SECTION_DB, "memory deduplication (ksm)", enable_ksm); #endif // -------------------------------------------------------------------- // metric correlations + enable_metric_correlations = config_get_boolean(CONFIG_SECTION_GLOBAL, "enable metric correlations", enable_metric_correlations); + default_metric_correlations_method = weights_string_to_method(config_get( + CONFIG_SECTION_GLOBAL, "metric correlations method", + weights_method_to_string(default_metric_correlations_method))); + + // -------------------------------------------------------------------- + + rrdset_free_obsolete_time = config_get_number(CONFIG_SECTION_DB, "cleanup obsolete charts after secs", rrdset_free_obsolete_time); + // Current chart locking and invalidation scheme doesn't prevent Netdata from segmentation faults if a short + // cleanup delay is set. Extensive stress tests showed that 10 seconds is quite a safe delay. Look at + // https://github.com/netdata/netdata/pull/11222#issuecomment-868367920 for more information. + if (rrdset_free_obsolete_time < 10) { + rrdset_free_obsolete_time = 10; + info("The \"cleanup obsolete charts after seconds\" option was set to 10 seconds."); + config_set_number(CONFIG_SECTION_DB, "cleanup obsolete charts after secs", rrdset_free_obsolete_time); + } + + gap_when_lost_iterations_above = (int)config_get_number(CONFIG_SECTION_DB, "gap when lost iterations above", gap_when_lost_iterations_above); + if (gap_when_lost_iterations_above < 1) { + gap_when_lost_iterations_above = 1; + config_set_number(CONFIG_SECTION_DB, "gap when lost iterations above", gap_when_lost_iterations_above); + } + + // -------------------------------------------------------------------- + // rrdcontext + + rrdcontext_enabled = config_get_boolean(CONFIG_SECTION_CLOUD, "rrdcontexts", rrdcontext_enabled); + // -------------------------------------------------------------------- // get various system parameters @@ -867,13 +982,16 @@ int main(int argc, char **argv) { return 1; if (unit_test_str2ld()) return 1; - + if (unit_test_bitmap256()) + return 1; // No call to load the config file on this code-path post_conf_load(&user); get_netdata_configured_variables(); + rrdcontext_enabled = CONFIG_BOOLEAN_NO; default_rrd_update_every = 1; default_rrd_memory_mode = RRD_MEMORY_MODE_RAM; default_health_enabled = 0; + storage_tiers = 1; registry_init(); if(rrd_init("unittest", NULL)) { fprintf(stderr, "rrd_init failed for unittest\n"); @@ -886,6 +1004,12 @@ int main(int argc, char **argv) { if(test_dbengine()) return 1; #endif if(test_sqlite()) return 1; + if (dictionary_unittest(10000)) + return 1; + if (rrdlabels_unittest()) + return 1; + if (ctx_unittest()) + return 1; fprintf(stderr, "\n\nALL TESTS PASSED\n\n"); return 0; } @@ -895,9 +1019,18 @@ int main(int argc, char **argv) { } #endif #ifdef ENABLE_DBENGINE + else if(strcmp(optarg, "mctest") == 0) { + return mc_unittest(); + } + else if(strcmp(optarg, "ctxtest") == 0) { + return ctx_unittest(); + } else if(strcmp(optarg, "dicttest") == 0) { return dictionary_unittest(10000); } + else if(strcmp(optarg, "rrdlabelstest") == 0) { + return rrdlabels_unittest(); + } else if(strncmp(optarg, createdataset_string, strlen(createdataset_string)) == 0) { optarg += strlen(createdataset_string); unsigned history_seconds = strtoul(optarg, NULL, 0); @@ -1214,25 +1347,31 @@ int main(int argc, char **argv) { // -------------------------------------------------------------------- // get log filenames and settings + log_init(); error_log_limit_unlimited(); + // initialize the log files open_all_log_files(); get_system_timezone(); + // -------------------------------------------------------------------- // get the certificate and start security + #ifdef ENABLE_HTTPS security_init(); #endif // -------------------------------------------------------------------- // This is the safest place to start the SILENCERS structure + set_silencers_filename(); health_initialize_global_silencers(); // -------------------------------------------------------------------- // Initialize ML configuration + ml_init(); // -------------------------------------------------------------------- @@ -1240,9 +1379,11 @@ int main(int argc, char **argv) { // block signals while initializing threads. // this causes the threads to block signals. + signals_block(); // setup the signals we want to use + signals_init(); // setup threads configs @@ -1271,6 +1412,7 @@ int main(int argc, char **argv) { if(web_server_mode != WEB_SERVER_MODE_NONE) api_listen_sockets_setup(); + } #ifdef NETDATA_INTERNAL_CHECKS @@ -1354,7 +1496,7 @@ int main(int argc, char **argv) { web_server_config_options(); - netdata_zero_metrics_enabled = config_get_boolean_ondemand(CONFIG_SECTION_GLOBAL, "enable zero metrics", CONFIG_BOOLEAN_NO); + netdata_zero_metrics_enabled = config_get_boolean_ondemand(CONFIG_SECTION_DB, "enable zero metrics", CONFIG_BOOLEAN_NO); set_late_global_environment(); diff --git a/daemon/static_threads.c b/daemon/static_threads.c index c07473bd6..96e279906 100644 --- a/daemon/static_threads.c +++ b/daemon/static_threads.c @@ -123,7 +123,7 @@ const struct netdata_static_thread static_threads_common[] = { .start_routine = socket_listen_main_static_threaded }, -#if defined(ENABLE_ACLK) || defined(ACLK_NG) +#ifdef ENABLE_ACLK { .name = "ACLK_Main", .config_section = NULL, @@ -135,6 +135,16 @@ const struct netdata_static_thread static_threads_common[] = { }, #endif + { + .name = "rrdcontext", + .config_section = NULL, + .config_name = NULL, + .enabled = 1, + .thread = NULL, + .init_routine = NULL, + .start_routine = rrdcontext_main + }, + {NULL, NULL, NULL, 0, NULL, NULL, NULL} }; diff --git a/daemon/system-info.sh b/daemon/system-info.sh index 12553e3da..101ccb0bf 100755 --- a/daemon/system-info.sh +++ b/daemon/system-info.sh @@ -44,9 +44,11 @@ if [ -z "${VIRTUALIZATION}" ]; then [ -n "$VIRTUALIZATION" ] && VIRT_DETECTION="dmidecode" fi - if [ -z "${VIRTUALIZATION}" ] && [ "${KERNEL_NAME}" = "FreeBSD" ]; then - VIRTUALIZATION=$(sysctl kern.vm_guest 2>/dev/null | cut -d: -f 2 | awk '{$1=$1};1') - [ -n "$VIRTUALIZATION" ] && VIRT_DETECTION="sysctl" + if [ -z "${VIRTUALIZATION}" ] || [ "$VIRTUALIZATION" = "unknown" ]; then + if [ "${KERNEL_NAME}" = "FreeBSD" ]; then + VIRTUALIZATION=$(sysctl kern.vm_guest 2>/dev/null | cut -d: -f 2 | awk '{$1=$1};1') + [ -n "$VIRTUALIZATION" ] && VIRT_DETECTION="sysctl" + fi fi if [ -z "${VIRTUALIZATION}" ]; then @@ -336,7 +338,7 @@ if [ "${KERNEL_NAME}" = FreeBSD ]; then TOTAL_RAM="$(sysctl -n hw.physmem)" elif [ "${KERNEL_NAME}" = Darwin ]; then RAM_DETECTION="sysctl" - TOTAL_RAM="$(sysctl -n hw.physmem)" + TOTAL_RAM="$(sysctl -n hw.memsize)" elif [ -r /proc/meminfo ]; then RAM_DETECTION="procfs" TOTAL_RAM="$(grep -F MemTotal /proc/meminfo | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | cut -f 1 -d ' ')" diff --git a/daemon/unit_test.c b/daemon/unit_test.c index 35f8613a2..8ba251b9a 100644 --- a/daemon/unit_test.c +++ b/daemon/unit_test.c @@ -4,7 +4,7 @@ static int check_number_printing(void) { struct { - calculated_number n; + NETDATA_DOUBLE n; const char *correct; } values[] = { { .n = 0, .correct = "0" }, @@ -22,8 +22,8 @@ static int check_number_printing(void) { char netdata[50], system[50]; int i, failed = 0; for(i = 0; values[i].correct ; i++) { - print_calculated_number(netdata, values[i].n); - snprintfz(system, 49, "%0.12" LONG_DOUBLE_MODIFIER, (LONG_DOUBLE)values[i].n); + print_netdata_double(netdata, values[i].n); + snprintfz(system, 49, "%0.12" NETDATA_DOUBLE_MODIFIER, (NETDATA_DOUBLE)values[i].n); int ok = 1; if(strcmp(netdata, values[i].correct) != 0) { @@ -95,35 +95,36 @@ static int check_rrdcalc_comparisons(void) { return 0; } -int check_storage_number(calculated_number n, int debug) { +int check_storage_number(NETDATA_DOUBLE n, int debug) { char buffer[100]; uint32_t flags = SN_DEFAULT_FLAGS; storage_number s = pack_storage_number(n, flags); - calculated_number d = unpack_storage_number(s); + NETDATA_DOUBLE d = unpack_storage_number(s); if(!does_storage_number_exist(s)) { - fprintf(stderr, "Exists flags missing for number " CALCULATED_NUMBER_FORMAT "!\n", n); + fprintf(stderr, "Exists flags missing for number " NETDATA_DOUBLE_FORMAT "!\n", n); return 5; } - calculated_number ddiff = d - n; - calculated_number dcdiff = ddiff * 100.0 / n; + NETDATA_DOUBLE ddiff = d - n; + NETDATA_DOUBLE dcdiff = ddiff * 100.0 / n; if(dcdiff < 0) dcdiff = -dcdiff; - size_t len = (size_t)print_calculated_number(buffer, d); - calculated_number p = str2ld(buffer, NULL); - calculated_number pdiff = n - p; - calculated_number pcdiff = pdiff * 100.0 / n; + size_t len = (size_t)print_netdata_double(buffer, d); + NETDATA_DOUBLE p = str2ndd(buffer, NULL); + NETDATA_DOUBLE pdiff = n - p; + NETDATA_DOUBLE pcdiff = pdiff * 100.0 / n; if(pcdiff < 0) pcdiff = -pcdiff; if(debug) { fprintf(stderr, - CALCULATED_NUMBER_FORMAT " original\n" - CALCULATED_NUMBER_FORMAT " packed and unpacked, (stored as 0x%08X, diff " CALCULATED_NUMBER_FORMAT ", " CALCULATED_NUMBER_FORMAT "%%)\n" - "%s printed after unpacked (%zu bytes)\n" - CALCULATED_NUMBER_FORMAT " re-parsed from printed (diff " CALCULATED_NUMBER_FORMAT ", " CALCULATED_NUMBER_FORMAT "%%)\n\n", + NETDATA_DOUBLE_FORMAT + " original\n" NETDATA_DOUBLE_FORMAT " packed and unpacked, (stored as 0x%08X, diff " NETDATA_DOUBLE_FORMAT + ", " NETDATA_DOUBLE_FORMAT "%%)\n" + "%s printed after unpacked (%zu bytes)\n" NETDATA_DOUBLE_FORMAT + " re-parsed from printed (diff " NETDATA_DOUBLE_FORMAT ", " NETDATA_DOUBLE_FORMAT "%%)\n\n", n, d, s, ddiff, dcdiff, buffer, len, @@ -132,10 +133,11 @@ int check_storage_number(calculated_number n, int debug) { if(len != strlen(buffer)) fprintf(stderr, "ERROR: printed number %s is reported to have length %zu but it has %zu\n", buffer, len, strlen(buffer)); if(dcdiff > ACCURACY_LOSS_ACCEPTED_PERCENT) - fprintf(stderr, "WARNING: packing number " CALCULATED_NUMBER_FORMAT " has accuracy loss " CALCULATED_NUMBER_FORMAT " %%\n", n, dcdiff); + fprintf(stderr, "WARNING: packing number " NETDATA_DOUBLE_FORMAT " has accuracy loss " NETDATA_DOUBLE_FORMAT " %%\n", n, dcdiff); if(pcdiff > ACCURACY_LOSS_ACCEPTED_PERCENT) - fprintf(stderr, "WARNING: re-parsing the packed, unpacked and printed number " CALCULATED_NUMBER_FORMAT " has accuracy loss " CALCULATED_NUMBER_FORMAT " %%\n", n, pcdiff); + fprintf(stderr, "WARNING: re-parsing the packed, unpacked and printed number " NETDATA_DOUBLE_FORMAT + " has accuracy loss " NETDATA_DOUBLE_FORMAT " %%\n", n, pcdiff); } if(len != strlen(buffer)) return 1; @@ -144,8 +146,8 @@ int check_storage_number(calculated_number n, int debug) { return 0; } -calculated_number storage_number_min(calculated_number n) { - calculated_number r = 1, last; +NETDATA_DOUBLE storage_number_min(NETDATA_DOUBLE n) { + NETDATA_DOUBLE r = 1, last; do { last = n; @@ -159,12 +161,12 @@ calculated_number storage_number_min(calculated_number n) { void benchmark_storage_number(int loop, int multiplier) { int i, j; - calculated_number n, d; + NETDATA_DOUBLE n, d; storage_number s; unsigned long long user, system, total, mine, their; - calculated_number storage_number_positive_min = unpack_storage_number(STORAGE_NUMBER_POSITIVE_MIN_RAW); - calculated_number storage_number_positive_max = unpack_storage_number(STORAGE_NUMBER_POSITIVE_MAX_RAW); + NETDATA_DOUBLE storage_number_positive_min = unpack_storage_number(STORAGE_NUMBER_POSITIVE_MIN_RAW); + NETDATA_DOUBLE storage_number_positive_max = unpack_storage_number(STORAGE_NUMBER_POSITIVE_MAX_RAW); char buffer[100]; @@ -174,25 +176,25 @@ void benchmark_storage_number(int loop, int multiplier) { // ------------------------------------------------------------------------ - fprintf(stderr, "SYSTEM LONG DOUBLE SIZE: %zu bytes\n", sizeof(calculated_number)); + fprintf(stderr, "SYSTEM LONG DOUBLE SIZE: %zu bytes\n", sizeof(NETDATA_DOUBLE)); fprintf(stderr, "NETDATA FLOATING POINT SIZE: %zu bytes\n", sizeof(storage_number)); - mine = (calculated_number)sizeof(storage_number) * (calculated_number)loop; - their = (calculated_number)sizeof(calculated_number) * (calculated_number)loop; + mine = (NETDATA_DOUBLE)sizeof(storage_number) * (NETDATA_DOUBLE)loop; + their = (NETDATA_DOUBLE)sizeof(NETDATA_DOUBLE) * (NETDATA_DOUBLE)loop; if(mine > their) { - fprintf(stderr, "\nNETDATA NEEDS %0.2" LONG_DOUBLE_MODIFIER " TIMES MORE MEMORY. Sorry!\n", (LONG_DOUBLE)(mine / their)); + fprintf(stderr, "\nNETDATA NEEDS %0.2" NETDATA_DOUBLE_MODIFIER " TIMES MORE MEMORY. Sorry!\n", (NETDATA_DOUBLE)(mine / their)); } else { - fprintf(stderr, "\nNETDATA INTERNAL FLOATING POINT ARITHMETICS NEEDS %0.2" LONG_DOUBLE_MODIFIER " TIMES LESS MEMORY.\n", (LONG_DOUBLE)(their / mine)); + fprintf(stderr, "\nNETDATA INTERNAL FLOATING POINT ARITHMETICS NEEDS %0.2" NETDATA_DOUBLE_MODIFIER " TIMES LESS MEMORY.\n", (NETDATA_DOUBLE)(their / mine)); } fprintf(stderr, "\nNETDATA FLOATING POINT\n"); - fprintf(stderr, "MIN POSITIVE VALUE " CALCULATED_NUMBER_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_POSITIVE_MIN_RAW)); - fprintf(stderr, "MAX POSITIVE VALUE " CALCULATED_NUMBER_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_POSITIVE_MAX_RAW)); - fprintf(stderr, "MIN NEGATIVE VALUE " CALCULATED_NUMBER_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_NEGATIVE_MIN_RAW)); - fprintf(stderr, "MAX NEGATIVE VALUE " CALCULATED_NUMBER_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_NEGATIVE_MAX_RAW)); - fprintf(stderr, "Maximum accuracy loss accepted: " CALCULATED_NUMBER_FORMAT "%%\n\n\n", (calculated_number)ACCURACY_LOSS_ACCEPTED_PERCENT); + fprintf(stderr, "MIN POSITIVE VALUE " NETDATA_DOUBLE_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_POSITIVE_MIN_RAW)); + fprintf(stderr, "MAX POSITIVE VALUE " NETDATA_DOUBLE_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_POSITIVE_MAX_RAW)); + fprintf(stderr, "MIN NEGATIVE VALUE " NETDATA_DOUBLE_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_NEGATIVE_MIN_RAW)); + fprintf(stderr, "MAX NEGATIVE VALUE " NETDATA_DOUBLE_FORMAT "\n", unpack_storage_number(STORAGE_NUMBER_NEGATIVE_MAX_RAW)); + fprintf(stderr, "Maximum accuracy loss accepted: " NETDATA_DOUBLE_FORMAT "%%\n\n\n", (NETDATA_DOUBLE)ACCURACY_LOSS_ACCEPTED_PERCENT); // ------------------------------------------------------------------------ @@ -207,7 +209,7 @@ void benchmark_storage_number(int loop, int multiplier) { n *= multiplier; if(n > storage_number_positive_max) n = storage_number_positive_min; - print_calculated_number(buffer, n); + print_netdata_double(buffer, n); } } @@ -217,7 +219,8 @@ void benchmark_storage_number(int loop, int multiplier) { total = user + system; mine = total; - fprintf(stderr, "user %0.5" LONG_DOUBLE_MODIFIER", system %0.5" LONG_DOUBLE_MODIFIER ", total %0.5" LONG_DOUBLE_MODIFIER "\n", (LONG_DOUBLE)(user / 1000000.0), (LONG_DOUBLE)(system / 1000000.0), (LONG_DOUBLE)(total / 1000000.0)); + fprintf(stderr, "user %0.5" NETDATA_DOUBLE_MODIFIER ", system %0.5" NETDATA_DOUBLE_MODIFIER + ", total %0.5" NETDATA_DOUBLE_MODIFIER "\n", (NETDATA_DOUBLE)(user / 1000000.0), (NETDATA_DOUBLE)(system / 1000000.0), (NETDATA_DOUBLE)(total / 1000000.0)); // ------------------------------------------------------------------------ @@ -231,7 +234,7 @@ void benchmark_storage_number(int loop, int multiplier) { for(i = 0; i < loop ;i++) { n *= multiplier; if(n > storage_number_positive_max) n = storage_number_positive_min; - snprintfz(buffer, 100, CALCULATED_NUMBER_FORMAT, n); + snprintfz(buffer, 100, NETDATA_DOUBLE_FORMAT, n); } } @@ -241,13 +244,14 @@ void benchmark_storage_number(int loop, int multiplier) { total = user + system; their = total; - fprintf(stderr, "user %0.5" LONG_DOUBLE_MODIFIER ", system %0.5" LONG_DOUBLE_MODIFIER ", total %0.5" LONG_DOUBLE_MODIFIER "\n", (LONG_DOUBLE)(user / 1000000.0), (LONG_DOUBLE)(system / 1000000.0), (LONG_DOUBLE)(total / 1000000.0)); + fprintf(stderr, "user %0.5" NETDATA_DOUBLE_MODIFIER ", system %0.5" NETDATA_DOUBLE_MODIFIER + ", total %0.5" NETDATA_DOUBLE_MODIFIER "\n", (NETDATA_DOUBLE)(user / 1000000.0), (NETDATA_DOUBLE)(system / 1000000.0), (NETDATA_DOUBLE)(total / 1000000.0)); if(mine > total) { - fprintf(stderr, "NETDATA CODE IS SLOWER %0.2" LONG_DOUBLE_MODIFIER " %%\n", (LONG_DOUBLE)(mine * 100.0 / their - 100.0)); + fprintf(stderr, "NETDATA CODE IS SLOWER %0.2" NETDATA_DOUBLE_MODIFIER " %%\n", (NETDATA_DOUBLE)(mine * 100.0 / their - 100.0)); } else { - fprintf(stderr, "NETDATA CODE IS F A S T E R %0.2" LONG_DOUBLE_MODIFIER " %%\n", (LONG_DOUBLE)(their * 100.0 / mine - 100.0)); + fprintf(stderr, "NETDATA CODE IS F A S T E R %0.2" NETDATA_DOUBLE_MODIFIER " %%\n", (NETDATA_DOUBLE)(their * 100.0 / mine - 100.0)); } // ------------------------------------------------------------------------ @@ -265,7 +269,7 @@ void benchmark_storage_number(int loop, int multiplier) { s = pack_storage_number(n, SN_DEFAULT_FLAGS); d = unpack_storage_number(s); - print_calculated_number(buffer, d); + print_netdata_double(buffer, d); } } @@ -275,13 +279,14 @@ void benchmark_storage_number(int loop, int multiplier) { total = user + system; mine = total; - fprintf(stderr, "user %0.5" LONG_DOUBLE_MODIFIER ", system %0.5" LONG_DOUBLE_MODIFIER ", total %0.5" LONG_DOUBLE_MODIFIER "\n", (LONG_DOUBLE)(user / 1000000.0), (LONG_DOUBLE)(system / 1000000.0), (LONG_DOUBLE)(total / 1000000.0)); + fprintf(stderr, "user %0.5" NETDATA_DOUBLE_MODIFIER ", system %0.5" NETDATA_DOUBLE_MODIFIER + ", total %0.5" NETDATA_DOUBLE_MODIFIER "\n", (NETDATA_DOUBLE)(user / 1000000.0), (NETDATA_DOUBLE)(system / 1000000.0), (NETDATA_DOUBLE)(total / 1000000.0)); if(mine > their) { - fprintf(stderr, "WITH PACKING UNPACKING NETDATA CODE IS SLOWER %0.2" LONG_DOUBLE_MODIFIER " %%\n", (LONG_DOUBLE)(mine * 100.0 / their - 100.0)); + fprintf(stderr, "WITH PACKING UNPACKING NETDATA CODE IS SLOWER %0.2" NETDATA_DOUBLE_MODIFIER " %%\n", (NETDATA_DOUBLE)(mine * 100.0 / their - 100.0)); } else { - fprintf(stderr, "EVEN WITH PACKING AND UNPACKING, NETDATA CODE IS F A S T E R %0.2" LONG_DOUBLE_MODIFIER " %%\n", (LONG_DOUBLE)(their * 100.0 / mine - 100.0)); + fprintf(stderr, "EVEN WITH PACKING AND UNPACKING, NETDATA CODE IS F A S T E R %0.2" NETDATA_DOUBLE_MODIFIER " %%\n", (NETDATA_DOUBLE)(their * 100.0 / mine - 100.0)); } // ------------------------------------------------------------------------ @@ -290,13 +295,13 @@ void benchmark_storage_number(int loop, int multiplier) { static int check_storage_number_exists() { uint32_t flags = SN_DEFAULT_FLAGS; - calculated_number n = 0.0; + NETDATA_DOUBLE n = 0.0; storage_number s = pack_storage_number(n, flags); - calculated_number d = unpack_storage_number(s); + NETDATA_DOUBLE d = unpack_storage_number(s); if(n != d) { - fprintf(stderr, "Wrong number returned. Expected " CALCULATED_NUMBER_FORMAT ", returned " CALCULATED_NUMBER_FORMAT "!\n", n, d); + fprintf(stderr, "Wrong number returned. Expected " NETDATA_DOUBLE_FORMAT ", returned " NETDATA_DOUBLE_FORMAT "!\n", n, d); return 1; } @@ -306,10 +311,10 @@ static int check_storage_number_exists() { int unit_test_storage() { if(check_storage_number_exists()) return 0; - calculated_number storage_number_positive_min = unpack_storage_number(STORAGE_NUMBER_POSITIVE_MIN_RAW); - calculated_number storage_number_negative_max = unpack_storage_number(STORAGE_NUMBER_NEGATIVE_MAX_RAW); + NETDATA_DOUBLE storage_number_positive_min = unpack_storage_number(STORAGE_NUMBER_POSITIVE_MIN_RAW); + NETDATA_DOUBLE storage_number_negative_max = unpack_storage_number(STORAGE_NUMBER_NEGATIVE_MAX_RAW); - calculated_number c, a = 0; + NETDATA_DOUBLE c, a = 0; int i, j, g, r = 0; for(g = -1; g <= 1 ; g++) { @@ -343,23 +348,26 @@ int unit_test_str2ld() { int i; for(i = 0; values[i] ; i++) { char *e_mine = "hello", *e_sys = "world"; - LONG_DOUBLE mine = str2ld(values[i], &e_mine); - LONG_DOUBLE sys = strtold(values[i], &e_sys); + NETDATA_DOUBLE mine = str2ndd(values[i], &e_mine); + NETDATA_DOUBLE sys = strtondd(values[i], &e_sys); if(isnan(mine)) { if(!isnan(sys)) { - fprintf(stderr, "Value '%s' is parsed as %" LONG_DOUBLE_MODIFIER ", but system believes it is %" LONG_DOUBLE_MODIFIER ".\n", values[i], mine, sys); + fprintf(stderr, "Value '%s' is parsed as %" NETDATA_DOUBLE_MODIFIER + ", but system believes it is %" NETDATA_DOUBLE_MODIFIER ".\n", values[i], mine, sys); return -1; } } else if(isinf(mine)) { if(!isinf(sys)) { - fprintf(stderr, "Value '%s' is parsed as %" LONG_DOUBLE_MODIFIER ", but system believes it is %" LONG_DOUBLE_MODIFIER ".\n", values[i], mine, sys); + fprintf(stderr, "Value '%s' is parsed as %" NETDATA_DOUBLE_MODIFIER + ", but system believes it is %" NETDATA_DOUBLE_MODIFIER ".\n", values[i], mine, sys); return -1; } } else if(mine != sys && ABS(mine-sys) > 0.000001) { - fprintf(stderr, "Value '%s' is parsed as %" LONG_DOUBLE_MODIFIER ", but system believes it is %" LONG_DOUBLE_MODIFIER ", delta %" LONG_DOUBLE_MODIFIER ".\n", values[i], mine, sys, sys-mine); + fprintf(stderr, "Value '%s' is parsed as %" NETDATA_DOUBLE_MODIFIER + ", but system believes it is %" NETDATA_DOUBLE_MODIFIER ", delta %" NETDATA_DOUBLE_MODIFIER ".\n", values[i], mine, sys, sys-mine); return -1; } @@ -368,7 +376,8 @@ int unit_test_str2ld() { return -1; } - fprintf(stderr, "str2ld() parsed value '%s' exactly the same way with strtold(), returned %" LONG_DOUBLE_MODIFIER " vs %" LONG_DOUBLE_MODIFIER "\n", values[i], mine, sys); + fprintf(stderr, "str2ndd() parsed value '%s' exactly the same way with strtold(), returned %" NETDATA_DOUBLE_MODIFIER + " vs %" NETDATA_DOUBLE_MODIFIER "\n", values[i], mine, sys); } return 0; @@ -461,10 +470,10 @@ struct test { unsigned long feed_entries; unsigned long result_entries; struct feed_values *feed; - calculated_number *results; + NETDATA_DOUBLE *results; collected_number *feed2; - calculated_number *results2; + NETDATA_DOUBLE *results2; }; // -------------------------------------------------------------------------------------------------------------------- @@ -484,7 +493,7 @@ struct feed_values test1_feed[] = { { 1000000, 100 }, }; -calculated_number test1_results[] = { +NETDATA_DOUBLE test1_results[] = { 20, 30, 40, 50, 60, 70, 80, 90, 100 }; @@ -520,7 +529,7 @@ struct feed_values test2_feed[] = { { 1000000, 100 }, }; -calculated_number test2_results[] = { +NETDATA_DOUBLE test2_results[] = { 20, 30, 40, 50, 60, 70, 80, 90, 100 }; @@ -555,7 +564,7 @@ struct feed_values test3_feed[] = { { 1000000, 100 }, }; -calculated_number test3_results[] = { +NETDATA_DOUBLE test3_results[] = { 10, 10, 10, 10, 10, 10, 10, 10, 10 }; @@ -590,7 +599,7 @@ struct feed_values test4_feed[] = { { 1000000, 100 }, }; -calculated_number test4_results[] = { +NETDATA_DOUBLE test4_results[] = { 10, 10, 10, 10, 10, 10, 10, 10, 10 }; @@ -625,7 +634,7 @@ struct feed_values test5_feed[] = { { 1000000, 0x00000000FFFFFFFFULL / 15 * 0 }, }; -calculated_number test5_results[] = { +NETDATA_DOUBLE test5_results[] = { 0x00000000FFFFFFFFULL / 15 * 7, 0x00000000FFFFFFFFULL / 15 * 7, 0x00000000FFFFFFFFULL / 15, @@ -668,7 +677,7 @@ struct feed_values test5b_feed[] = { { 1000000, 0xFFFFFFFFFFFFFFFFULL / 15 * 0 }, }; -calculated_number test5b_results[] = { +NETDATA_DOUBLE test5b_results[] = { 0xFFFFFFFFFFFFFFFFULL / 15 * 7, 0xFFFFFFFFFFFFFFFFULL / 15 * 7, 0xFFFFFFFFFFFFFFFFULL / 15, @@ -717,7 +726,7 @@ struct feed_values test6_feed[] = { { 250000, 16000 }, }; -calculated_number test6_results[] = { +NETDATA_DOUBLE test6_results[] = { 4000, 4000, 4000, 4000 }; @@ -752,7 +761,7 @@ struct feed_values test7_feed[] = { { 2000000, 10000 }, }; -calculated_number test7_results[] = { +NETDATA_DOUBLE test7_results[] = { 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500, 500 }; @@ -783,7 +792,7 @@ struct feed_values test8_feed[] = { { 2000000, 6000 }, }; -calculated_number test8_results[] = { +NETDATA_DOUBLE test8_results[] = { 1250, 2000, 2250, 3000, 3250, 4000, 4250, 5000, 5250, 6000 }; @@ -824,7 +833,7 @@ struct feed_values test9_feed[] = { { 250000, 16000 }, }; -calculated_number test9_results[] = { +NETDATA_DOUBLE test9_results[] = { 4000, 8000, 12000, 16000 }; @@ -859,7 +868,7 @@ struct feed_values test10_feed[] = { { 1000000, 6900 + 1000 }, }; -calculated_number test10_results[] = { +NETDATA_DOUBLE test10_results[] = { 1000, 1000, 1000, 1000, 1000, 1000, 1000 }; @@ -898,11 +907,11 @@ collected_number test11_feed2[] = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 }; -calculated_number test11_results[] = { +NETDATA_DOUBLE test11_results[] = { 50, 50, 50, 50, 50, 50, 50, 50, 50 }; -calculated_number test11_results2[] = { +NETDATA_DOUBLE test11_results2[] = { 50, 50, 50, 50, 50, 50, 50, 50, 50 }; @@ -941,11 +950,11 @@ collected_number test12_feed2[] = { 10*3, 20*3, 30*3, 40*3, 50*3, 60*3, 70*3, 80*3, 90*3, 100*3 }; -calculated_number test12_results[] = { +NETDATA_DOUBLE test12_results[] = { 25, 25, 25, 25, 25, 25, 25, 25, 25 }; -calculated_number test12_results2[] = { +NETDATA_DOUBLE test12_results2[] = { 75, 75, 75, 75, 75, 75, 75, 75, 75 }; @@ -980,7 +989,7 @@ struct feed_values test13_feed[] = { { 1000000, 6900 + 1000 }, }; -calculated_number test13_results[] = { +NETDATA_DOUBLE test13_results[] = { 83.3333300, 100, 100, 100, 100, 100, 100 }; @@ -1015,7 +1024,7 @@ struct feed_values test14_feed[] = { { 29942000, 0x0153987f888982d0ULL }, }; -calculated_number test14_results[] = { +NETDATA_DOUBLE test14_results[] = { 23.1383300, 21.8515600, 21.8804600, 21.7788000, 22.0112200, 22.4386100, 22.0906100, 21.9150800 }; @@ -1047,7 +1056,7 @@ struct feed_values test14b_feed[] = { { 29942000, 13573000 + 29969000 + 29958000 + 30054000 + 34952000 + 25046000 + 29947000 + 30054000 + 29942000 }, }; -calculated_number test14b_results[] = { +NETDATA_DOUBLE test14b_results[] = { 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000 }; @@ -1079,7 +1088,7 @@ struct feed_values test14c_feed[] = { { 30000000, 29000000 + 1000000 + 30000000 + 30000000 + 30000000 + 30000000 + 30000000 + 30000000 + 30000000 + 30000000 }, }; -calculated_number test14c_results[] = { +NETDATA_DOUBLE test14c_results[] = { 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000, 1000000 }; @@ -1118,11 +1127,11 @@ collected_number test15_feed2[] = { 178825286, 178825286, 178825286, 178825286, 178825498, 178825498, 179165652, 179202964, 179203282, 179204130 }; -calculated_number test15_results[] = { +NETDATA_DOUBLE test15_results[] = { 5857.4080000, 5898.4540000, 5891.6590000, 5806.3160000, 5914.2640000, 3202.2630000, 5589.6560000, 5822.5260000, 5911.7520000 }; -calculated_number test15_results2[] = { +NETDATA_DOUBLE test15_results2[] = { 0.0000000, 0.0000000, 0.0024944, 1.6324779, 0.0212777, 2655.1890000, 290.5387000, 5.6733610, 6.5960220 }; @@ -1173,12 +1182,13 @@ int run_test(struct test *test) if(c) { time_now += test->feed[c].microseconds; - fprintf(stderr, " > %s: feeding position %lu, after %0.3f seconds (%0.3f seconds from start), delta " CALCULATED_NUMBER_FORMAT ", rate " CALCULATED_NUMBER_FORMAT "\n", + fprintf(stderr, " > %s: feeding position %lu, after %0.3f seconds (%0.3f seconds from start), delta " NETDATA_DOUBLE_FORMAT + ", rate " NETDATA_DOUBLE_FORMAT "\n", test->name, c+1, (float)test->feed[c].microseconds / 1000000.0, (float)time_now / 1000000.0, - ((calculated_number)test->feed[c].value - (calculated_number)last) * (calculated_number)test->multiplier / (calculated_number)test->divisor, - (((calculated_number)test->feed[c].value - (calculated_number)last) * (calculated_number)test->multiplier / (calculated_number)test->divisor) / (calculated_number)test->feed[c].microseconds * (calculated_number)1000000); + ((NETDATA_DOUBLE)test->feed[c].value - (NETDATA_DOUBLE)last) * (NETDATA_DOUBLE)test->multiplier / (NETDATA_DOUBLE)test->divisor, + (((NETDATA_DOUBLE)test->feed[c].value - (NETDATA_DOUBLE)last) * (NETDATA_DOUBLE)test->multiplier / (NETDATA_DOUBLE)test->divisor) / (NETDATA_DOUBLE)test->feed[c].microseconds * (NETDATA_DOUBLE)1000000); // rrdset_next_usec_unfiltered(st, test->feed[c].microseconds); st->usec_since_last_update = test->feed[c].microseconds; @@ -1216,10 +1226,11 @@ int run_test(struct test *test) unsigned long max = (st->counter < test->result_entries)?st->counter:test->result_entries; for(c = 0 ; c < max ; c++) { - calculated_number v = unpack_storage_number(rd->values[c]); - calculated_number n = unpack_storage_number(pack_storage_number(test->results[c], SN_DEFAULT_FLAGS)); - int same = (calculated_number_round(v * 10000000.0) == calculated_number_round(n * 10000000.0))?1:0; - fprintf(stderr, " %s/%s: checking position %lu (at %"PRId64" secs), expecting value " CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT ", %s\n", + NETDATA_DOUBLE v = unpack_storage_number(rd->db[c]); + NETDATA_DOUBLE n = unpack_storage_number(pack_storage_number(test->results[c], SN_DEFAULT_FLAGS)); + int same = (roundndd(v * 10000000.0) == roundndd(n * 10000000.0))?1:0; + fprintf(stderr, " %s/%s: checking position %lu (at %"PRId64" secs), expecting value " NETDATA_DOUBLE_FORMAT + ", found " NETDATA_DOUBLE_FORMAT ", %s\n", test->name, rd->name, c+1, (int64_t)((rrdset_first_entry_t(st) + c * st->update_every) - time_start), n, v, (same)?"OK":"### E R R O R ###"); @@ -1227,10 +1238,11 @@ int run_test(struct test *test) if(!same) errors++; if(rd2) { - v = unpack_storage_number(rd2->values[c]); + v = unpack_storage_number(rd2->db[c]); n = test->results2[c]; - same = (calculated_number_round(v * 10000000.0) == calculated_number_round(n * 10000000.0))?1:0; - fprintf(stderr, " %s/%s: checking position %lu (at %"PRId64" secs), expecting value " CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT ", %s\n", + same = (roundndd(v * 10000000.0) == roundndd(n * 10000000.0))?1:0; + fprintf(stderr, " %s/%s: checking position %lu (at %"PRId64" secs), expecting value " NETDATA_DOUBLE_FORMAT + ", found " NETDATA_DOUBLE_FORMAT ", %s\n", test->name, rd2->name, c+1, (int64_t)((rrdset_first_entry_t(st) + c * st->update_every) - time_start), n, v, (same)?"OK":"### E R R O R ###"); @@ -1242,6 +1254,8 @@ int run_test(struct test *test) } static int test_variable_renames(void) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); + fprintf(stderr, "Creating chart\n"); RRDSET *st = rrdset_create_localhost("chart", "ID", NULL, "family", "context", "Unit Testing", "a value", "unittest", NULL, 1, 1, RRDSET_TYPE_LINE); fprintf(stderr, "Created chart with id '%s', name '%s'\n", st->id, st->name); @@ -1326,6 +1340,7 @@ int check_strdupz_path_subpath() { int run_all_mockup_tests(void) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); if(check_strdupz_path_subpath()) return 1; @@ -1399,6 +1414,7 @@ int run_all_mockup_tests(void) int unit_test(long delay, long shift) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); static int repeat = 0; repeat++; @@ -1466,14 +1482,14 @@ int unit_test(long delay, long shift) int ret = 0; storage_number sn; - calculated_number cn, v; + NETDATA_DOUBLE cn, v; for(c = 0 ; c < st->counter ; c++) { fprintf(stderr, "\nPOSITION: c = %lu, EXPECTED VALUE %lu\n", c, (oincrement + c * increment + increment * (1000000 - shift) / 1000000 )* 10); for(rd = st->dimensions ; rd ; rd = rd->next) { - sn = rd->values[c]; + sn = rd->db[c]; cn = unpack_storage_number(sn); - fprintf(stderr, "\t %s " CALCULATED_NUMBER_FORMAT " (PACKED AS " STORAGE_NUMBER_FORMAT ") -> ", rd->id, cn, sn); + fprintf(stderr, "\t %s " NETDATA_DOUBLE_FORMAT " (PACKED AS " STORAGE_NUMBER_FORMAT ") -> ", rd->id, cn, sn); if(rd == rdabs) v = ( oincrement @@ -1488,7 +1504,7 @@ int unit_test(long delay, long shift) if(v == cn) fprintf(stderr, "passed.\n"); else { - fprintf(stderr, "ERROR! (expected " CALCULATED_NUMBER_FORMAT ")\n", v); + fprintf(stderr, "ERROR! (expected " NETDATA_DOUBLE_FORMAT ")\n", v); ret = 1; } } @@ -1501,6 +1517,7 @@ int unit_test(long delay, long shift) } int test_sqlite(void) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); sqlite3 *db_meta; fprintf(stderr, "Testing SQLIte\n"); @@ -1527,10 +1544,194 @@ int test_sqlite(void) { fprintf(stderr,"Failed to test SQLite: Update with LIMIT failed\n"); return 1; } + + BUFFER *sql = buffer_create(ACLK_SYNC_QUERY_SIZE); + char *uuid_str = "0000_000"; + + buffer_sprintf(sql, TABLE_ACLK_CHART, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + buffer_flush(sql); + if (rc != SQLITE_OK) + goto error; + + buffer_sprintf(sql, TABLE_ACLK_CHART_PAYLOAD, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + buffer_flush(sql); + if (rc != SQLITE_OK) + goto error; + + buffer_sprintf(sql, TABLE_ACLK_CHART_LATEST, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + if (rc != SQLITE_OK) + goto error; + buffer_flush(sql); + + buffer_sprintf(sql, INDEX_ACLK_CHART, uuid_str, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + if (rc != SQLITE_OK) + goto error; + buffer_flush(sql); + + buffer_sprintf(sql, INDEX_ACLK_CHART_LATEST, uuid_str, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + if (rc != SQLITE_OK) + goto error; + buffer_flush(sql); + + buffer_sprintf(sql, TRIGGER_ACLK_CHART_PAYLOAD, uuid_str, uuid_str, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + if (rc != SQLITE_OK) + goto error; + buffer_flush(sql); + + buffer_sprintf(sql, TABLE_ACLK_ALERT, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + if (rc != SQLITE_OK) + goto error; + buffer_flush(sql); + + buffer_sprintf(sql, INDEX_ACLK_ALERT, uuid_str, uuid_str); + rc = sqlite3_exec(db_meta, buffer_tostring(sql), 0, 0, NULL); + if (rc != SQLITE_OK) + goto error; + buffer_flush(sql); + + buffer_free(sql); fprintf(stderr,"SQLite is OK\n"); return 0; +error: + fprintf(stderr,"SQLite statement failed: %s\n", buffer_tostring(sql)); + buffer_free(sql); + fprintf(stderr,"SQLite tests failed\n"); + return 1; } +int unit_test_bitmap256(void) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); + + BITMAP256 test_bitmap = {0}; + + bitmap256_set_bit(&test_bitmap, 0, 1); + bitmap256_set_bit(&test_bitmap, 64, 1); + bitmap256_set_bit(&test_bitmap, 128, 1); + bitmap256_set_bit(&test_bitmap, 192, 1); + if (test_bitmap.data[0] == 1) + fprintf(stderr, "%s() INDEX 1 is OK\n", __FUNCTION__ ); + if (test_bitmap.data[1] == 1) + fprintf(stderr, "%s() INDEX 65 is OK\n", __FUNCTION__ ); + if (test_bitmap.data[2] == 1) + fprintf(stderr, "%s() INDEX 129 is OK\n", __FUNCTION__ ); + if (test_bitmap.data[3] == 1) + fprintf(stderr, "%s() INDEX 192 is OK\n", __FUNCTION__ ); + + uint8_t i=0; + int j = 0; + do { + bitmap256_set_bit(&test_bitmap, i++, 1); + j++; + } while (j < 256); + + if (test_bitmap.data[0] == 0xffffffffffffffff) + fprintf(stderr, "%s() INDEX 0 is fully set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 0 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]); + return 1; + } + + if (test_bitmap.data[1] == 0xffffffffffffffff) + fprintf(stderr, "%s() INDEX 1 is fully set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 1 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]); + return 1; + } + + if (test_bitmap.data[2] == 0xffffffffffffffff) + fprintf(stderr, "%s() INDEX 2 is fully set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 2 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]); + return 1; + } + + if (test_bitmap.data[3] == 0xffffffffffffffff) + fprintf(stderr, "%s() INDEX 3 is fully set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 3 is %lx expected 0xffffffffffffffff\n", __FUNCTION__, test_bitmap.data[0]); + return 1; + } + + i = 0; + j = 0; + do { + bitmap256_set_bit(&test_bitmap, i++, 0); + j++; + } while (j < 256); + + if (test_bitmap.data[0] == 0) + fprintf(stderr, "%s() INDEX 0 is reset OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 0 is not reset FAILED\n", __FUNCTION__); + return 1; + } + if (test_bitmap.data[1] == 0) + fprintf(stderr, "%s() INDEX 1 is reset OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 1 is not reset FAILED\n", __FUNCTION__); + return 1; + } + + if (test_bitmap.data[2] == 0) + fprintf(stderr, "%s() INDEX 2 is reset OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 2 is not reset FAILED\n", __FUNCTION__); + return 1; + } + + if (test_bitmap.data[3] == 0) + fprintf(stderr, "%s() INDEX 3 is reset OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 3 is not reset FAILED\n", __FUNCTION__); + return 1; + } + + i=0; + j = 0; + do { + bitmap256_set_bit(&test_bitmap, i, 1); + i += 4; + j += 4; + } while (j < 256); + + if (test_bitmap.data[0] == 0x1111111111111111) + fprintf(stderr, "%s() INDEX 0 is 0x1111111111111111 set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 0 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[0]); + return 1; + } + + if (test_bitmap.data[1] == 0x1111111111111111) + fprintf(stderr, "%s() INDEX 1 is 0x1111111111111111 set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 1 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[1]); + return 1; + } + + if (test_bitmap.data[2] == 0x1111111111111111) + fprintf(stderr, "%s() INDEX 2 is 0x1111111111111111 set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 2 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[2]); + return 1; + } + + if (test_bitmap.data[3] == 0x1111111111111111) + fprintf(stderr, "%s() INDEX 3 is 0x1111111111111111 set OK\n", __FUNCTION__); + else { + fprintf(stderr, "%s() INDEX 3 is %lx expected 0x1111111111111111\n", __FUNCTION__, test_bitmap.data[3]); + return 1; + } + + fprintf(stderr, "%s() tests passed\n", __FUNCTION__); + return 0; +} #ifdef ENABLE_DBENGINE static inline void rrddim_set_by_pointer_fake_time(RRDDIM *rd, collected_number value, time_t now) @@ -1571,6 +1772,7 @@ static RRDHOST *dbengine_rrdhost_find_or_create(char *name) , default_rrdpush_api_key , default_rrdpush_send_charts_matching , NULL + , 0 ); } @@ -1590,6 +1792,7 @@ static const int QUERY_BATCH = 4096; static void test_dbengine_create_charts(RRDHOST *host, RRDSET *st[CHARTS], RRDDIM *rd[CHARTS][DIMS], int update_every) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); int i, j; char name[101]; @@ -1628,7 +1831,7 @@ static void test_dbengine_create_charts(RRDHOST *host, RRDSET *st[CHARTS], RRDDI // Fluh pages for subsequent real values for (i = 0 ; i < CHARTS ; ++i) { for (j = 0; j < DIMS; ++j) { - rrdeng_store_metric_flush_current_page(rd[i][j]); + rrdeng_store_metric_flush_current_page((rd[i][j])->tiers[0]->db_collection_handle); } } } @@ -1637,6 +1840,7 @@ static void test_dbengine_create_charts(RRDHOST *host, RRDSET *st[CHARTS], RRDDI static time_t test_dbengine_create_metrics(RRDSET *st[CHARTS], RRDDIM *rd[CHARTS][DIMS], int current_region, time_t time_start) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); time_t time_now; int i, j, c, update_every; collected_number next; @@ -1672,13 +1876,14 @@ static time_t test_dbengine_create_metrics(RRDSET *st[CHARTS], RRDDIM *rd[CHARTS static int test_dbengine_check_metrics(RRDSET *st[CHARTS], RRDDIM *rd[CHARTS][DIMS], int current_region, time_t time_start) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); uint8_t same; - time_t time_now, time_retrieved; + time_t time_now, time_retrieved, end_time; int i, j, k, c, errors, update_every; collected_number last; - calculated_number value, expected; - storage_number n; + NETDATA_DOUBLE value, expected; struct rrddim_query_handle handle; + size_t value_errors = 0, time_errors = 0; update_every = REGION_UPDATE_EVERY[current_region]; errors = 0; @@ -1688,32 +1893,45 @@ static int test_dbengine_check_metrics(RRDSET *st[CHARTS], RRDDIM *rd[CHARTS][DI time_now = time_start + (c + 1) * update_every; for (i = 0 ; i < CHARTS ; ++i) { for (j = 0; j < DIMS; ++j) { - rd[i][j]->state->query_ops.init(rd[i][j], &handle, time_now, time_now + QUERY_BATCH * update_every); + rd[i][j]->tiers[0]->query_ops.init(rd[i][j]->tiers[0]->db_metric_handle, &handle, time_now, time_now + QUERY_BATCH * update_every, TIER_QUERY_FETCH_SUM); for (k = 0; k < QUERY_BATCH; ++k) { last = ((collected_number)i * DIMS) * REGION_POINTS[current_region] + j * REGION_POINTS[current_region] + c + k; - expected = unpack_storage_number(pack_storage_number((calculated_number)last, SN_DEFAULT_FLAGS)); + expected = unpack_storage_number(pack_storage_number((NETDATA_DOUBLE)last, SN_DEFAULT_FLAGS)); - n = rd[i][j]->state->query_ops.next_metric(&handle, &time_retrieved); - value = unpack_storage_number(n); + STORAGE_POINT sp = rd[i][j]->tiers[0]->query_ops.next_metric(&handle); + value = sp.sum; + time_retrieved = sp.start_time; + end_time = sp.end_time; - same = (calculated_number_round(value) == calculated_number_round(expected)) ? 1 : 0; + same = (roundndd(value) == roundndd(expected)) ? 1 : 0; if(!same) { - fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, expecting value " - CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT ", ### E R R O R ###\n", + if(!value_errors) + fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, expecting value " NETDATA_DOUBLE_FORMAT + ", found " NETDATA_DOUBLE_FORMAT ", ### E R R O R ###\n", st[i]->name, rd[i][j]->name, (unsigned long)time_now + k * update_every, expected, value); + value_errors++; errors++; } - if(time_retrieved != time_now + k * update_every) { - fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, found timestamp %lu ### E R R O R ###\n", + if(end_time != time_now + k * update_every) { + if(!time_errors) + fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, found timestamp %lu ### E R R O R ###\n", st[i]->name, rd[i][j]->name, (unsigned long)time_now + k * update_every, (unsigned long)time_retrieved); + time_errors++; errors++; } } - rd[i][j]->state->query_ops.finalize(&handle); + rd[i][j]->tiers[0]->query_ops.finalize(&handle); } } } + + if(value_errors) + fprintf(stderr, "%zu value errors encountered\n", value_errors); + + if(time_errors) + fprintf(stderr, "%zu time errors encountered\n", time_errors); + return errors; } @@ -1721,49 +1939,55 @@ static int test_dbengine_check_metrics(RRDSET *st[CHARTS], RRDDIM *rd[CHARTS][DI static int test_dbengine_check_rrdr(RRDSET *st[CHARTS], RRDDIM *rd[CHARTS][DIMS], int current_region, time_t time_start, time_t time_end) { + int update_every = REGION_UPDATE_EVERY[current_region]; + fprintf(stderr, "%s() running on region %d, start time %ld, end time %ld, update every %d...\n", __FUNCTION__, current_region, time_start, time_end, update_every); uint8_t same; time_t time_now, time_retrieved; - int i, j, errors, update_every; + int i, j, errors, value_errors = 0, time_errors = 0; long c; collected_number last; - calculated_number value, expected; + NETDATA_DOUBLE value, expected; errors = 0; - update_every = REGION_UPDATE_EVERY[current_region]; long points = (time_end - time_start) / update_every; for (i = 0 ; i < CHARTS ; ++i) { ONEWAYALLOC *owa = onewayalloc_create(0); - RRDR *r = rrd2rrdr(owa, st[i], points, time_start + update_every, time_end, RRDR_GROUPING_AVERAGE, 0, 0, NULL, NULL, 0); + RRDR *r = rrd2rrdr(owa, st[i], points, time_start, time_end, + RRDR_GROUPING_AVERAGE, 0, RRDR_OPTION_NATURAL_POINTS, + NULL, NULL, NULL, 0, 0); + if (!r) { - fprintf(stderr, " DB-engine unittest %s: empty RRDR ### E R R O R ###\n", st[i]->name); + fprintf(stderr, " DB-engine unittest %s: empty RRDR on region %d ### E R R O R ###\n", st[i]->name, current_region); return ++errors; } else { assert(r->st == st[i]); for (c = 0; c != rrdr_rows(r) ; ++c) { RRDDIM *d; - time_now = time_start + (c + 2) * update_every; + time_now = time_start + (c + 1) * update_every; time_retrieved = r->t[c]; // for each dimension for (j = 0, d = r->st->dimensions ; d && j < r->d ; ++j, d = d->next) { - calculated_number *cn = &r->v[ c * r->d ]; + NETDATA_DOUBLE *cn = &r->v[ c * r->d ]; value = cn[j]; assert(rd[i][j] == d); - last = i * DIMS * REGION_POINTS[current_region] + j * REGION_POINTS[current_region] + c + 1; - expected = unpack_storage_number(pack_storage_number((calculated_number)last, SN_DEFAULT_FLAGS)); + last = i * DIMS * REGION_POINTS[current_region] + j * REGION_POINTS[current_region] + c; + expected = unpack_storage_number(pack_storage_number((NETDATA_DOUBLE)last, SN_DEFAULT_FLAGS)); - same = (calculated_number_round(value) == calculated_number_round(expected)) ? 1 : 0; + same = (roundndd(value) == roundndd(expected)) ? 1 : 0; if(!same) { - fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, expecting value " - CALCULATED_NUMBER_FORMAT ", RRDR found " CALCULATED_NUMBER_FORMAT ", ### E R R O R ###\n", + if(value_errors < 20) + fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, expecting value " NETDATA_DOUBLE_FORMAT + ", RRDR found " NETDATA_DOUBLE_FORMAT ", ### E R R O R ###\n", st[i]->name, rd[i][j]->name, (unsigned long)time_now, expected, value); - errors++; + value_errors++; } if(time_retrieved != time_now) { - fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, found RRDR timestamp %lu ### E R R O R ###\n", + if(time_errors < 20) + fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, found RRDR timestamp %lu ### E R R O R ###\n", st[i]->name, rd[i][j]->name, (unsigned long)time_now, (unsigned long)time_retrieved); - errors++; + time_errors++; } } } @@ -1771,12 +1995,20 @@ static int test_dbengine_check_rrdr(RRDSET *st[CHARTS], RRDDIM *rd[CHARTS][DIMS] } onewayalloc_destroy(owa); } - return errors; + + if(value_errors) + fprintf(stderr, "%d value errors encountered\n", value_errors); + + if(time_errors) + fprintf(stderr, "%d time errors encountered\n", time_errors); + + return errors + value_errors + time_errors; } int test_dbengine(void) { - int i, j, errors, update_every, current_region; + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); + int i, j, errors, value_errors = 0, time_errors = 0, update_every, current_region; RRDHOST *host = NULL; RRDSET *st[CHARTS]; RRDDIM *rd[CHARTS][DIMS]; @@ -1809,7 +2041,7 @@ int test_dbengine(void) for (i = 0 ; i < CHARTS ; ++i) { st[i]->update_every = update_every; for (j = 0; j < DIMS; ++j) { - rrdeng_store_metric_flush_current_page(rd[i][j]); + rrdeng_store_metric_flush_current_page((rd[i][j])->tiers[0]->db_collection_handle); } } @@ -1828,7 +2060,7 @@ int test_dbengine(void) for (i = 0 ; i < CHARTS ; ++i) { st[i]->update_every = update_every; for (j = 0; j < DIMS; ++j) { - rrdeng_store_metric_flush_current_page(rd[i][j]); + rrdeng_store_metric_flush_current_page((rd[i][j])->tiers[0]->db_collection_handle); } } @@ -1854,7 +2086,9 @@ int test_dbengine(void) long point_offset = (time_start[current_region] - time_start[0]) / update_every; for (i = 0 ; i < CHARTS ; ++i) { ONEWAYALLOC *owa = onewayalloc_create(0); - RRDR *r = rrd2rrdr(owa, st[i], points, time_start[0] + update_every, time_end[REGIONS - 1], RRDR_GROUPING_AVERAGE, 0, 0, NULL, NULL, 0); + RRDR *r = rrd2rrdr(owa, st[i], points, time_start[0] + update_every, + time_end[REGIONS - 1], RRDR_GROUPING_AVERAGE, 0, + RRDR_OPTION_NATURAL_POINTS, NULL, NULL, NULL, 0, 0); if (!r) { fprintf(stderr, " DB-engine unittest %s: empty RRDR ### E R R O R ###\n", st[i]->name); ++errors; @@ -1870,24 +2104,26 @@ int test_dbengine(void) // for each dimension for(j = 0, d = r->st->dimensions ; d && j < r->d ; ++j, d = d->next) { - calculated_number *cn = &r->v[ c * r->d ]; - calculated_number value = cn[j]; + NETDATA_DOUBLE *cn = &r->v[ c * r->d ]; + NETDATA_DOUBLE value = cn[j]; assert(rd[i][j] == d); collected_number last = i * DIMS * REGION_POINTS[current_region] + j * REGION_POINTS[current_region] + c - point_offset + 1; - calculated_number expected = unpack_storage_number(pack_storage_number((calculated_number)last, SN_DEFAULT_FLAGS)); + NETDATA_DOUBLE expected = unpack_storage_number(pack_storage_number((NETDATA_DOUBLE)last, SN_DEFAULT_FLAGS)); - uint8_t same = (calculated_number_round(value) == calculated_number_round(expected)) ? 1 : 0; + uint8_t same = (roundndd(value) == roundndd(expected)) ? 1 : 0; if(!same) { - fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, expecting value " - CALCULATED_NUMBER_FORMAT ", RRDR found " CALCULATED_NUMBER_FORMAT ", ### E R R O R ###\n", + if(!value_errors) + fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, expecting value " NETDATA_DOUBLE_FORMAT + ", RRDR found " NETDATA_DOUBLE_FORMAT ", ### E R R O R ###\n", st[i]->name, rd[i][j]->name, (unsigned long)time_now, expected, value); - errors++; + value_errors++; } if(time_retrieved != time_now) { - fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, found RRDR timestamp %lu ### E R R O R ###\n", + if(!time_errors) + fprintf(stderr, " DB-engine unittest %s/%s: at %lu secs, found RRDR timestamp %lu ### E R R O R ###\n", st[i]->name, rd[i][j]->name, (unsigned long)time_now, (unsigned long)time_retrieved); - errors++; + time_errors++; } } } @@ -1897,12 +2133,12 @@ int test_dbengine(void) } error_out: rrd_wrlock(); - rrdeng_prepare_exit(host->rrdeng_ctx); + rrdeng_prepare_exit((struct rrdengine_instance *)host->storage_instance[0]); rrdhost_delete_charts(host); - rrdeng_exit(host->rrdeng_ctx); + rrdeng_exit((struct rrdengine_instance *)host->storage_instance[0]); rrd_unlock(); - return errors; + return errors + value_errors + time_errors; } struct dbengine_chart_thread { @@ -1937,6 +2173,7 @@ collected_number generate_dbengine_chart_value(int chart_i, int dim_i, time_t ti static void generate_dbengine_chart(void *arg) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); struct dbengine_chart_thread *thread_info = (struct dbengine_chart_thread *)arg; RRDHOST *host = thread_info->host; char *chartname = thread_info->chartname; @@ -1983,12 +2220,13 @@ static void generate_dbengine_chart(void *arg) thread_info->time_max = time_current; } for (j = 0; j < DSET_DIMS; ++j) { - rrdeng_store_metric_finalize(rd[j]); + rrdeng_store_metric_finalize((rd[j])->tiers[0]->db_collection_handle); } } void generate_dbengine_dataset(unsigned history_seconds) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); const int DSET_CHARTS = 16; const int DSET_DIMS = 128; const uint64_t EXPECTED_COMPRESSION_RATIO = 20; @@ -2042,7 +2280,7 @@ void generate_dbengine_dataset(unsigned history_seconds) } freez(thread_info); rrd_wrlock(); - rrdhost_free(host); + rrdhost_free(host, 1); rrd_unlock(); } @@ -2063,6 +2301,7 @@ struct dbengine_query_thread { static void query_dbengine_chart(void *arg) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); struct dbengine_query_thread *thread_info = (struct dbengine_query_thread *)arg; const int DSET_CHARTS = thread_info->dset_charts; const int DSET_DIMS = thread_info->dset_dims; @@ -2071,11 +2310,11 @@ static void query_dbengine_chart(void *arg) RRDSET *st; RRDDIM *rd; uint8_t same; - time_t time_now, time_retrieved; + time_t time_now, time_retrieved, end_time; collected_number generatedv; - calculated_number value, expected; - storage_number n; + NETDATA_DOUBLE value, expected; struct rrddim_query_handle handle; + size_t value_errors = 0, time_errors = 0; do { // pick a chart and dimension @@ -2101,60 +2340,74 @@ static void query_dbengine_chart(void *arg) time_before = MIN(time_after + duration, time_max); /* up to 1 hour queries */ } - rd->state->query_ops.init(rd, &handle, time_after, time_before); + rd->tiers[0]->query_ops.init(rd->tiers[0]->db_metric_handle, &handle, time_after, time_before, TIER_QUERY_FETCH_SUM); ++thread_info->queries_nr; for (time_now = time_after ; time_now <= time_before ; time_now += update_every) { generatedv = generate_dbengine_chart_value(i, j, time_now); - expected = unpack_storage_number(pack_storage_number((calculated_number) generatedv, SN_DEFAULT_FLAGS)); + expected = unpack_storage_number(pack_storage_number((NETDATA_DOUBLE) generatedv, SN_DEFAULT_FLAGS)); - if (unlikely(rd->state->query_ops.is_finished(&handle))) { + if (unlikely(rd->tiers[0]->query_ops.is_finished(&handle))) { if (!thread_info->delete_old_data) { /* data validation only when we don't delete */ - fprintf(stderr, " DB-engine stresstest %s/%s: at %lu secs, expecting value " - CALCULATED_NUMBER_FORMAT ", found data gap, ### E R R O R ###\n", + fprintf(stderr, " DB-engine stresstest %s/%s: at %lu secs, expecting value " NETDATA_DOUBLE_FORMAT + ", found data gap, ### E R R O R ###\n", st->name, rd->name, (unsigned long) time_now, expected); ++thread_info->errors; } break; } - n = rd->state->query_ops.next_metric(&handle, &time_retrieved); - if (SN_EMPTY_SLOT == n) { + + STORAGE_POINT sp = rd->tiers[0]->query_ops.next_metric(&handle); + value = sp.sum; + time_retrieved = sp.start_time; + end_time = sp.end_time; + + if (!netdata_double_isnumber(value)) { if (!thread_info->delete_old_data) { /* data validation only when we don't delete */ - fprintf(stderr, " DB-engine stresstest %s/%s: at %lu secs, expecting value " - CALCULATED_NUMBER_FORMAT ", found data gap, ### E R R O R ###\n", + fprintf(stderr, " DB-engine stresstest %s/%s: at %lu secs, expecting value " NETDATA_DOUBLE_FORMAT + ", found data gap, ### E R R O R ###\n", st->name, rd->name, (unsigned long) time_now, expected); ++thread_info->errors; } break; } ++thread_info->queried_metrics_nr; - value = unpack_storage_number(n); - same = (calculated_number_round(value) == calculated_number_round(expected)) ? 1 : 0; + same = (roundndd(value) == roundndd(expected)) ? 1 : 0; if (!same) { if (!thread_info->delete_old_data) { /* data validation only when we don't delete */ - fprintf(stderr, " DB-engine stresstest %s/%s: at %lu secs, expecting value " - CALCULATED_NUMBER_FORMAT ", found " CALCULATED_NUMBER_FORMAT - ", ### E R R O R ###\n", + if(!value_errors) + fprintf(stderr, " DB-engine stresstest %s/%s: at %lu secs, expecting value " NETDATA_DOUBLE_FORMAT + ", found " NETDATA_DOUBLE_FORMAT ", ### E R R O R ###\n", st->name, rd->name, (unsigned long) time_now, expected, value); - ++thread_info->errors; + value_errors++; + thread_info->errors++; } } - if (time_retrieved != time_now) { + if (end_time != time_now) { if (!thread_info->delete_old_data) { /* data validation only when we don't delete */ - fprintf(stderr, + if(!time_errors) + fprintf(stderr, " DB-engine stresstest %s/%s: at %lu secs, found timestamp %lu ### E R R O R ###\n", st->name, rd->name, (unsigned long) time_now, (unsigned long) time_retrieved); - ++thread_info->errors; + time_errors++; + thread_info->errors++; } } } - rd->state->query_ops.finalize(&handle); + rd->tiers[0]->query_ops.finalize(&handle); } while(!thread_info->done); + + if(value_errors) + fprintf(stderr, "%zu value errors encountered\n", value_errors); + + if(time_errors) + fprintf(stderr, "%zu time errors encountered\n", time_errors); } void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsigned QUERY_THREADS, unsigned RAMP_UP_SECONDS, unsigned PAGE_CACHE_MB, unsigned DISK_SPACE_MB) { + fprintf(stderr, "%s() running...\n", __FUNCTION__ ); const unsigned DSET_DIMS = 128; const uint64_t EXPECTED_COMPRESSION_RATIO = 20; const unsigned HISTORY_SECONDS = 3600 * 24 * 365 * 50; /* 50 year of history */ @@ -2289,9 +2542,9 @@ void dbengine_stress_test(unsigned TEST_DURATION_SEC, unsigned DSET_CHARTS, unsi } freez(query_threads); rrd_wrlock(); - rrdeng_prepare_exit(host->rrdeng_ctx); + rrdeng_prepare_exit((struct rrdengine_instance *)host->storage_instance[0]); rrdhost_delete_charts(host); - rrdeng_exit(host->rrdeng_ctx); + rrdeng_exit((struct rrdengine_instance *)host->storage_instance[0]); rrd_unlock(); } diff --git a/daemon/unit_test.h b/daemon/unit_test.h index 6a7a966c3..2d2533afe 100644 --- a/daemon/unit_test.h +++ b/daemon/unit_test.h @@ -10,6 +10,7 @@ extern int unit_test_str2ld(void); extern int unit_test_buffer(void); extern int unit_test_static_threads(void); extern int test_sqlite(void); +extern int unit_test_bitmap256(void); #ifdef ENABLE_DBENGINE extern int test_dbengine(void); extern void generate_dbengine_dataset(unsigned history_seconds); diff --git a/database/Makefile.am b/database/Makefile.am index 9ab85b4e7..dc87e61bb 100644 --- a/database/Makefile.am +++ b/database/Makefile.am @@ -5,6 +5,8 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in SUBDIRS = \ engine \ + ram \ + sqlite \ $(NULL) dist_noinst_DATA = \ diff --git a/database/README.md b/database/README.md index a8bb21e4e..1453f9b39 100644 --- a/database/README.md +++ b/database/README.md @@ -7,206 +7,138 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/database/README. # Database Netdata is fully capable of long-term metrics storage, at per-second granularity, via its default database engine -(`dbengine`). But to remain as flexible as possible, Netdata supports a number of types of metrics storage: +(`dbengine`). But to remain as flexible as possible, Netdata supports several storage options: 1. `dbengine`, (the default) data are in database files. The [Database Engine](/database/engine/README.md) works like a - traditional database. There is some amount of RAM dedicated to data caching and indexing and the rest of the data - reside compressed on disk. The number of history entries is not fixed in this case, but depends on the configured - disk space and the effective compression ratio of the data stored. This is the **only mode** that supports changing - the data collection update frequency (`update_every`) **without losing** the previously stored metrics. For more - details see [here](/database/engine/README.md). + traditional database. There is some amount of RAM dedicated to data caching and indexing and the rest of the data + reside compressed on disk. The number of history entries is not fixed in this case, but depends on the configured + disk space and the effective compression ratio of the data stored. This is the **only mode** that supports changing + the data collection update frequency (`update every`) **without losing** the previously stored metrics. For more + details see [here](/database/engine/README.md). -2. `ram`, data are purely in memory. Data are never saved on disk. This mode uses `mmap()` and supports [KSM](#ksm). +2. `ram`, data are purely in memory. Data are never saved on disk. This mode uses `mmap()` and supports [KSM](#ksm). -3. `save`, data are only in RAM while Netdata runs and are saved to / loaded from disk on Netdata - restart. It also uses `mmap()` and supports [KSM](#ksm). +3. `save`, data are only in RAM while Netdata runs and are saved to / loaded from disk on Netdata restart. It also + uses `mmap()` and supports [KSM](#ksm). -4. `map`, data are in memory mapped files. This works like the swap. Keep in mind though, this will have a constant - write on your disk. When Netdata writes data on its memory, the Linux kernel marks the related memory pages as dirty - and automatically starts updating them on disk. Unfortunately we cannot control how frequently this works. The Linux - kernel uses exactly the same algorithm it uses for its swap memory. Check below for additional information on - running a dedicated central Netdata server. This mode uses `mmap()` but does not support [KSM](#ksm). +4. `map`, data are in memory mapped files. This works like the swap. When Netdata writes data on its memory, the Linux + kernel marks the related memory pages as dirty and automatically starts updating them on disk. Unfortunately we + cannot control how frequently this works. The Linux kernel uses exactly the same algorithm it uses for its swap + memory. This mode uses `mmap()` but does not support [KSM](#ksm). _Keep in mind though, this option will have a + constant write on your disk._ -5. `none`, without a database (collected metrics can only be streamed to another Netdata). +5. `alloc`, like `ram` but it uses `calloc()` and does not support [KSM](#ksm). This mode is the fallback for all others + except `none`. -6. `alloc`, like `ram` but it uses `calloc()` and does not support [KSM](#ksm). This mode is the fallback for all - others except `none`. +6. `none`, without a database (collected metrics can only be streamed to another Netdata). -You can select the memory mode by editing `netdata.conf` and setting: +## Which database mode to use -```conf -[global] - # dbengine (default), ram, save (the default if dbengine not available), map (swap like), none, alloc - memory mode = dbengine - - # the directory where data are saved - cache directory = /var/cache/netdata -``` - -## Running Netdata in embedded devices - -Embedded devices usually have very limited RAM resources available. - -There are 2 settings for you to tweak: - -1. `update every`, which controls the data collection frequency -2. `history`, which controls the size of the database in RAM (except for `memory mode = dbengine`) - -By default `update every = 1` and `history = 3600`. This gives you an hour of data with per second updates. - -If you set `update every = 2` and `history = 1800`, you will still have an hour of data, but collected once every 2 -seconds. This will **cut in half** both CPU and RAM resources consumed by Netdata. Of course experiment a bit. On very -weak devices you might have to use `update every = 5` and `history = 720` (still 1 hour of data, but 1/5 of the CPU and -RAM resources). - -You can also disable [data collection plugins](/collectors/README.md) you don't need. Disabling such plugins will also free both -CPU and RAM resources. - -## Running a dedicated central Netdata server - -Netdata allows streaming data between Netdata nodes. This allows us to have a central Netdata server that will maintain -the entire database for all nodes, and will also run health checks/alarms for all nodes. - -For this central Netdata, memory size can be a problem. Fortunately, Netdata supports several memory modes. **One -interesting option** for this setup is `memory mode = map`. - -### map +The default mode `[db].mode = dbengine` has been designed to scale for longer retentions and is the only mode suitable +for parent Agents in the _Parent - Child_ setups -In this mode, the database of Netdata is stored in memory mapped files. Netdata continues to read and write the database -in memory, but the kernel automatically loads and saves memory pages from/to disk. +The other available database modes are designed to minimize resource utilization and should only be considered on +[Parent - Child](/docs/metrics-storage-management/how-streaming-works.mdx) setups at the children side and only when the +resource constraints are very strict. -**We suggest _not_ to use this mode on nodes that run other applications.** There will always be dirty memory to be -synced and this syncing process may influence the way other applications work. This mode however is useful when we need -a central Netdata server that would normally need huge amounts of memory. Using memory mode `map` we can overcome all -memory restrictions. +So, -There are a few kernel options that provide finer control on the way this syncing works. But before explaining them, a -brief introduction of how Netdata database works is needed. +- On a single node setup, use `[db].mode = dbengine`. +- On a [Parent - Child](/docs/metrics-storage-management/how-streaming-works.mdx) setup, use `[db].mode = dbengine` on the + parent to increase retention, a more resource efficient mode like, `dbengine` with light retention settings, and + `save`, `ram` or `none` modes for the children to minimize resource utilization. -For each chart, Netdata maps the following files: +## Choose your database mode -1. `chart/main.db`, this is the file that maintains chart information. Every time data are collected for a chart, this - is updated. -2. `chart/dimension_name.db`, this is the file for each dimension. At its beginning there is a header, followed by the - round robin database where metrics are stored. +You can select the database mode by editing `netdata.conf` and setting: -So, every time Netdata collects data, the following pages will become dirty: - -1. the chart file -2. the header part of all dimension files -3. if the collected metrics are stored far enough in the dimension file, another page will become dirty, for each - dimension - -Each page in Linux is 4KB. So, with 200 charts and 1000 dimensions, there will be 1200 to 2200 4KB pages dirty pages -every second. Of course 1200 of them will always be dirty (the chart header and the dimensions headers) and 1000 will be -dirty for about 1000 seconds (4 bytes per metric, 4KB per page, so 1000 seconds, or 16 minutes per page). - -Hopefully, the Linux kernel does not sync all these data every second. The frequency they are synced is controlled by -`/proc/sys/vm/dirty_expire_centisecs` or the `sysctl` `vm.dirty_expire_centisecs`. The default on most systems is 3000 -(30 seconds). - -On a busy server centralizing metrics from 20+ servers you will experience this: - -![image](https://cloud.githubusercontent.com/assets/2662304/23834750/429ab0dc-0764-11e7-821a-d7908bc881ac.png) - -As you can see, there is quite some stress (this is `iowait`) every 30 seconds. - -A simple solution is to increase this time to 10 minutes (60000). This is the same system with this setting in 10 -minutes: - -![image](https://cloud.githubusercontent.com/assets/2662304/23834784/d2304f72-0764-11e7-8389-fb830ffd973a.png) - -Of course, setting this to 10 minutes means that data on disk might be up to 10 minutes old if you get an abnormal -shutdown. - -There are 2 more options to tweak: +```conf +[db] + # dbengine (default), ram, save (the default if dbengine not available), map (swap like), none, alloc + mode = dbengine +``` -1. `dirty_background_ratio`, by default `10`. -2. `dirty_ratio`, by default `20`. +## Netdata Longer Metrics Retention -These control the amount of memory that should be dirty for disk syncing to be triggered. On dedicated Netdata servers, -you can use: `80` and `90` respectively, so that all RAM is given to Netdata. +Metrics retention is controlled only by the disk space allocated to storing metrics. But it also affects the memory and +CPU required by the agent to query longer timeframes. -With these settings, you can expect a little `iowait` spike once every 10 minutes and in case of system crash, data on -disk will be up to 10 minutes old. +Since Netdata Agents usually run on the edge, on production systems, Netdata Agent **parents** should be considered. +When having a [**parent - child**](/docs/metrics-storage-management/how-streaming-works.mdx) setup, the child (the +Netdata Agent running on a production system) delegates all of its functions, including longer metrics retention and +querying, to the parent node that can dedicate more resources to this task. A single Netdata Agent parent can centralize +multiple children Netdata Agents (dozens, hundreds, or even thousands depending on its available resources). -![image](https://cloud.githubusercontent.com/assets/2662304/23835030/ba4bf506-0768-11e7-9bc6-3b23e080c69f.png) +## Running Netdata on embedded devices -To have these settings automatically applied on boot, create the file `/etc/sysctl.d/netdata-memory.conf` with these -contents: +Embedded devices typically have very limited RAM resources available. -```conf -vm.dirty_expire_centisecs = 60000 -vm.dirty_background_ratio = 80 -vm.dirty_ratio = 90 -vm.dirty_writeback_centisecs = 0 -``` +There are two settings for you to configure: -There is another memory mode to help overcome the memory size problem. What is **most interesting for this setup** is -`memory mode = dbengine`. +1. `[db].update every`, which controls the data collection frequency +2. `[db].retention`, which controls the size of the database in memory (except for `[db].mode = dbengine`) -### dbengine +By default `[db].update every = 1` and `[db].retention = 3600`. This gives you an hour of data with per second updates. -In this mode, the database of Netdata is stored in database files. The [Database Engine](/database/engine/README.md) -works like a traditional database. There is some amount of RAM dedicated to data caching and indexing and the rest of -the data reside compressed on disk. The number of history entries is not fixed in this case, but depends on the -configured disk space and the effective compression ratio of the data stored. +If you set `[db].update every = 2` and `[db].retention = 1800`, you will still have an hour of data, but collected once +every 2 seconds. This will **cut in half** both CPU and RAM resources consumed by Netdata. Of course experiment a bit to find the right setting. +On very weak devices you might have to use `[db].update every = 5` and `[db].retention = 720` (still 1 hour of data, but +1/5 of the CPU and RAM resources). -We suggest to use **this** mode on nodes that also run other applications. The Database Engine uses direct I/O to avoid -polluting the OS filesystem caches and does not generate excessive I/O traffic so as to create the minimum possible -interference with other applications. Using memory mode `dbengine` we can overcome most memory restrictions. For more -details see [here](/database/engine/README.md). +You can also disable [data collection plugins](/collectors/README.md) that you don't need. Disabling such plugins will also +free both CPU and RAM resources. -## KSM +## Memory optimizations -Netdata offers all its round robin database to kernel for deduplication (except for `memory mode = dbengine`). +### KSM -In the past KSM has been criticized for consuming a lot of CPU resources. Although this is true when KSM is used for -deduplicating certain applications, it is not true with netdata, since the Netdata memory is written very infrequently -(if you have 24 hours of metrics in netdata, each byte at the in-memory database will be updated just once per day). +KSM performs memory deduplication by scanning through main memory for physical pages that have identical content, and +identifies the virtual pages that are mapped to those physical pages. It leaves one page unchanged, and re-maps each +duplicate page to point to the same physical page. Netdata offers all of its in-memory database to kernel for +deduplication. -KSM is a solution that will provide 60+% memory savings to Netdata. +In the past, KSM has been criticized for consuming a lot of CPU resources. This is true when KSM is used for +deduplicating certain applications, but it is not true for Netdata. Agent's memory is written very infrequently +(if you have 24 hours of metrics in Netdata, each byte at the in-memory database will be updated just once per day). KSM +is a solution that will provide 60+% memory savings to Netdata. ### Enable KSM in kernel -You need to run a kernel compiled with: +To enable KSM in kernel, you need to run a kernel compiled with the following: ```sh CONFIG_KSM=y ``` -When KSM is enabled at the kernel is just available for the user to enable it. +When KSM is enabled at the kernel, it is just available for the user to enable it. -So, if you build a kernel with `CONFIG_KSM=y` you will just get a few files in `/sys/kernel/mm/ksm`. Nothing else -happens. There is no performance penalty (apart I guess from the memory this code occupies into the kernel). +If you build a kernel with `CONFIG_KSM=y`, you will just get a few files in `/sys/kernel/mm/ksm`. Nothing else +happens. There is no performance penalty (apart from the memory this code occupies into the kernel). The files that `CONFIG_KSM=y` offers include: -- `/sys/kernel/mm/ksm/run` by default `0`. You have to set this to `1` for the - kernel to spawn `ksmd`. -- `/sys/kernel/mm/ksm/sleep_millisecs`, by default `20`. The frequency ksmd - should evaluate memory for deduplication. -- `/sys/kernel/mm/ksm/pages_to_scan`, by default `100`. The amount of pages - ksmd will evaluate on each run. +- `/sys/kernel/mm/ksm/run` by default `0`. You have to set this to `1` for the kernel to spawn `ksmd`. +- `/sys/kernel/mm/ksm/sleep_millisecs`, by default `20`. The frequency ksmd should evaluate memory for deduplication. +- `/sys/kernel/mm/ksm/pages_to_scan`, by default `100`. The amount of pages ksmd will evaluate on each run. So, by default `ksmd` is just disabled. It will not harm performance and the user/admin can control the CPU resources -he/she is willing `ksmd` to use. +they are willing to have used by `ksmd`. ### Run `ksmd` kernel daemon -To activate / run `ksmd` you need to run: +To activate / run `ksmd,` you need to run the following: ```sh echo 1 >/sys/kernel/mm/ksm/run echo 1000 >/sys/kernel/mm/ksm/sleep_millisecs ``` -With these settings ksmd does not even appear in the running process list (it will run once per second and evaluate 100 +With these settings, ksmd does not even appear in the running process list (it will run once per second and evaluate 100 pages for de-duplication). Put the above lines in your boot sequence (`/etc/rc.local` or equivalent) to have `ksmd` run at boot. -## Monitoring Kernel Memory de-duplication performance +### Monitoring Kernel Memory de-duplication performance Netdata will create charts for kernel memory de-duplication performance, like this: diff --git a/database/engine/README.md b/database/engine/README.md index 7defcce9d..c67e400f4 100644 --- a/database/engine/README.md +++ b/database/engine/README.md @@ -6,75 +6,114 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/database/engine/ # Database engine -The Database Engine works like a traditional database. It dedicates a certain amount of RAM to data caching and -indexing, while the rest of the data resides compressed on disk. Unlike other [memory modes](/database/README.md), the -amount of historical metrics stored is based on the amount of disk space you allocate and the effective compression +The Database Engine works like a traditional time series database. Unlike other [database modes](/database/README.md), +the amount of historical metrics stored is based on the amount of disk space you allocate and the effective compression ratio, not a fixed number of metrics collected. -By using both RAM and disk space, the database engine allows for long-term storage of per-second metrics inside of the -Agent itself. +## Tiering -In addition, the database engine is the only memory mode that supports changing the data collection update frequency -(`update_every`) without losing the metrics your Agent already gathered and stored. +Tiering is a mechanism of providing multiple tiers of data with +different [granularity on metrics](/docs/store/distributed-data-architecture.md#granularity-of-metrics). -## Configuration +For Netdata Agents with version `netdata-1.35.0.138.nightly` and greater, `dbengine` supports Tiering, allowing almost +unlimited retention of data. -To use the database engine, open `netdata.conf` and set `memory mode` to `dbengine`. -```conf -[global] - memory mode = dbengine -``` +### Metric size -To configure the database engine, look for the `page cache size` and `dbengine multihost disk space` settings in the -`[global]` section of your `netdata.conf`. The Agent ignores the `history` setting when using the database engine. +Every Tier down samples the exact lower tier (lower tiers have greater resolution). You can have up to 5 +Tiers **[0. . 4]** of data (including the Tier 0, which has the highest resolution) -```conf -[global] - page cache size = 32 - dbengine multihost disk space = 256 -``` +Tier 0 is the default that was always available in `dbengine` mode. Tier 1 is the first level of aggregation, Tier 2 is +the second, and so on. -The above values are the default values for Page Cache size and DB engine disk space quota. Both numbers are -in **MiB**. +Metrics on all tiers except of the _Tier 0_ also store the following five additional values for every point for accurate +representation: -The `page cache size` option determines the amount of RAM in **MiB** dedicated to caching Netdata metric values. The -actual page cache size will be slightly larger than this figure—see the [memory requirements](#memory-requirements) -section for details. +1. The `sum` of the points aggregated +2. The `min` of the points aggregated +3. The `max` of the points aggregated +4. The `count` of the points aggregated (could be constant, but it may not be due to gaps in data collection) +5. The `anomaly_count` of the points aggregated (how many of the aggregated points found anomalous) -The `dbengine multihost disk space` option determines the amount of disk space in **MiB** that is dedicated to storing -Netdata metric values and all related metadata describing them. You can use the [**database engine -calculator**](/docs/store/change-metrics-storage.md#calculate-the-system-resources-ram-disk-space-needed-to-store-metrics) -to correctly set `dbengine multihost disk space` based on your metrics retention policy. The calculator gives an -accurate estimate based on how many child nodes you have, how many metrics your Agent collects, and more. +Among `min`, `max` and `sum`, the correct value is chosen based on the user query. `average` is calculated on the fly at +query time. -### Legacy configuration +### Tiering in a nutshell -The deprecated `dbengine disk space` option determines the amount of disk space in **MiB** that is dedicated to storing -Netdata metric values per legacy database engine instance (see [details on the legacy mode](#legacy-mode) below). +The `dbengine` is capable of retaining metrics for years. To further understand the `dbengine` tiering mechanism let's +explore the following configuration. -```conf -[global] - dbengine disk space = 256 ``` +[db] + mode = dbengine + + # per second data collection + update every = 1 + + # enables Tier 1 and Tier 2, Tier 0 is always enabled in dbengine mode + storage tiers = 3 + + # Tier 0, per second data for a week + dbengine multihost disk space MB = 1100 + + # Tier 1, per minute data for a month + dbengine tier 1 multihost disk space MB = 330 + + # Tier 2, per hour data for a year + dbengine tier 2 multihost disk space MB = 67 +``` + +For 2000 metrics, collected every second and retained for a week, Tier 0 needs: 1 byte x 2000 metrics x 3600 secs per +hour x 24 hours per day x 7 days per week = 1100MB. + +By setting `dbengine multihost disk space MB` to `1100`, this node will start maintaining about a week of data. But pay +attention to the number of metrics. If you have more than 2000 metrics on a node, or you need more that a week of high +resolution metrics, you may need to adjust this setting accordingly. + +Tier 1 is by default sampling the data every **60 points of Tier 0**. In our case, Tier 0 is per second, if we want to +transform this information in terms of time then the Tier 1 "resolution" is per minute. + +Tier 1 needs four times more storage per point compared to Tier 0. So, for 2000 metrics, with per minute resolution, +retained for a month, Tier 1 needs: 4 bytes x 2000 metrics x 60 minutes per hour x 24 hours per day x 30 days per month += 330MB. -### Streaming metrics to the database engine +Tier 2 is by default sampling data every 3600 points of Tier 0 (60 of Tier 1, which is the previous exact Tier). Again +in term of "time" (Tier 0 is per second), then Tier 2 is per hour. -When using the multihost database engine, all parent and child nodes share the same `page cache size` and `dbengine -multihost disk space` in a single dbengine instance. The [**database engine -calculator**](/docs/store/change-metrics-storage.md#calculate-the-system-resources-ram-disk-space-needed-to-store-metrics) -helps you properly set `page cache size` and `dbengine multihost disk space` on your parent node to allocate enough -resources based on your metrics retention policy and how many child nodes you have. +The storage requirements are the same to Tier 1. -#### Legacy mode +For 2000 metrics, with per hour resolution, retained for a year, Tier 2 needs: 4 bytes x 2000 metrics x 24 hours per day +x 365 days per year = 67MB. + +## Legacy configuration + +### v1.35.1 and prior + +These versions of the Agent do not support [Tiering](#Tiering). You could change the metric retention for the parent and +all of its children only with the `dbengine multihost disk space MB` setting. This setting accounts the space allocation +for the parent node and all of its children. + +To configure the database engine, look for the `page cache size MB` and `dbengine multihost disk space MB` settings in +the `[db]` section of your `netdata.conf`. + +```conf +[db] + dbengine page cache size MB = 32 + dbengine multihost disk space MB = 256 +``` + +### v1.23.2 and prior _For Netdata Agents earlier than v1.23.2_, the Agent on the parent node uses one dbengine instance for itself, and another instance for every child node it receives metrics from. If you had four streaming nodes, you would have five instances in total (`1 parent + 4 child nodes = 5 instances`). -The Agent allocates resources for each instance separately using the `dbengine disk space` (**deprecated**) setting. If -`dbengine disk space`(**deprecated**) is set to the default `256`, each instance is given 256 MiB in disk space, which -means the total disk space required to store all instances is, roughly, `256 MiB * 1 parent * 4 child nodes = 1280 MiB`. +The Agent allocates resources for each instance separately using the `dbengine disk space MB` (**deprecated**) setting. +If +`dbengine disk space MB`(**deprecated**) is set to the default `256`, each instance is given 256 MiB in disk space, +which means the total disk space required to store all instances is, +roughly, `256 MiB * 1 parent * 4 child nodes = 1280 MiB`. #### Backward compatibility @@ -88,51 +127,54 @@ Agent. ##### Information -For more information about setting `memory mode` on your nodes, in addition to other streaming configurations, see +For more information about setting `[db].mode` on your nodes, in addition to other streaming configurations, see [streaming](/streaming/README.md). -### Memory requirements +## Requirements & limitations -Using memory mode `dbengine` we can overcome most memory restrictions and store a dataset that is much larger than the +### Memory + +Using database mode `dbengine` we can overcome most memory restrictions and store a dataset that is much larger than the available memory. There are explicit memory requirements **per** DB engine **instance**: -- The total page cache memory footprint will be an additional `#dimensions-being-collected x 4096 x 2` bytes over what - the user configured with `page cache size`. +- The total page cache memory footprint will be an additional `#dimensions-being-collected x 4096 x 2` bytes over what + the user configured with `dbengine page cache size MB`. + -- an additional `#pages-on-disk x 4096 x 0.03` bytes of RAM are allocated for metadata. +- an additional `#pages-on-disk x 4096 x 0.03` bytes of RAM are allocated for metadata. - - roughly speaking this is 3% of the uncompressed disk space taken by the DB files. + - roughly speaking this is 3% of the uncompressed disk space taken by the DB files. - - for very highly compressible data (compression ratio > 90%) this RAM overhead is comparable to the disk space - footprint. + - for very highly compressible data (compression ratio > 90%) this RAM overhead is comparable to the disk space + footprint. An important observation is that RAM usage depends on both the `page cache size` and the `dbengine multihost disk space` options. -You can use our [database engine -calculator](/docs/store/change-metrics-storage.md#calculate-the-system-resources-ram-disk-space-needed-to-store-metrics) +You can use +our [database engine calculator](/docs/store/change-metrics-storage.md#calculate-the-system-resources-ram-disk-space-needed-to-store-metrics) to validate the memory requirements for your particular system(s) and configuration (**out-of-date**). -### Disk space requirements +### Disk space There are explicit disk space requirements **per** DB engine **instance**: -- The total disk space footprint will be the maximum between `#dimensions-being-collected x 4096 x 2` bytes or what - the user configured with `dbengine multihost disk space` or `dbengine disk space`. +- The total disk space footprint will be the maximum between `#dimensions-being-collected x 4096 x 2` bytes or what the + user configured with `dbengine multihost disk space` or `dbengine disk space`. -### File descriptor requirements +### File descriptor -The Database Engine may keep a **significant** amount of files open per instance (e.g. per streaming child or -parent server). When configuring your system you should make sure there are at least 50 file descriptors available per +The Database Engine may keep a **significant** amount of files open per instance (e.g. per streaming child or parent +server). When configuring your system you should make sure there are at least 50 file descriptors available per `dbengine` instance. Netdata allocates 25% of the available file descriptors to its Database Engine instances. This means that only 25% of the file descriptors that are available to the Netdata service are accessible by dbengine instances. You should take that into account when configuring your service or system-wide file descriptor limits. You can roughly estimate that the Netdata service needs 2048 file descriptors for every 10 streaming child hosts when streaming is configured to use -`memory mode = dbengine`. +`[db].mode = dbengine`. If for example one wants to allocate 65536 file descriptors to the Netdata service on a systemd system one needs to override the Netdata service by running `sudo systemctl edit netdata` and creating a file with contents: @@ -149,7 +191,7 @@ ulimit -n 65536 ``` at the beginning of the service file. Alternatively you can change the system-wide limits of the kernel by changing - `/etc/sysctl.conf`. For linux that would be: +`/etc/sysctl.conf`. For linux that would be: ```conf fs.file-max = 65536 @@ -166,8 +208,8 @@ You can apply the settings by running `sysctl -p` or by rebooting. ## Files -With the DB engine memory mode the metric data are stored in database files. These files are organized in pairs, the -datafiles and their corresponding journalfiles, e.g.: +With the DB engine mode the metric data are stored in database files. These files are organized in pairs, the datafiles +and their corresponding journalfiles, e.g.: ```sh datafile-1-0000000001.ndf @@ -192,15 +234,16 @@ storage at lower granularity. The DB engine stores chart metric values in 4096-byte pages in memory. Each chart dimension gets its own page to store consecutive values generated from the data collectors. Those pages comprise the **Page Cache**. -When those pages fill up they are slowly compressed and flushed to disk. It can take `4096 / 4 = 1024 seconds = 17 -minutes`, for a chart dimension that is being collected every 1 second, to fill a page. Pages can be cut short when we -stop Netdata or the DB engine instance so as to not lose the data. When we query the DB engine for data we trigger disk -read I/O requests that fill the Page Cache with the requested pages and potentially evict cold (not recently used) -pages. +When those pages fill up, they are slowly compressed and flushed to disk. It can +take `4096 / 4 = 1024 seconds = 17 minutes`, for a chart dimension that is being collected every 1 second, to fill a +page. Pages can be cut short when we stop Netdata or the DB engine instance so as to not lose the data. When we query +the DB engine for data we trigger disk read I/O requests that fill the Page Cache with the requested pages and +potentially evict cold (not recently used) +pages. When the disk quota is exceeded the oldest values are removed from the DB engine at real time, by automatically deleting the oldest datafile and journalfile pair. Any corresponding pages residing in the Page Cache will also be invalidated -and removed. The DB engine logic will try to maintain between 10 and 20 file pairs at any point in time. +and removed. The DB engine logic will try to maintain between 10 and 20 file pairs at any point in time. The Database Engine uses direct I/O to avoid polluting the OS filesystem caches and does not generate excessive I/O traffic so as to create the minimum possible interference with other applications. @@ -215,38 +258,38 @@ Constellation ES.3 2TB magnetic HDD and a SAMSUNG MZQLB960HAJR-00007 960GB NAND For our workload, we defined 32 charts with 128 metrics each, giving us a total of 4096 metrics. We defined 1 worker thread per chart (32 threads) that generates new data points with a data generation interval of 1 second. The time axis of the time-series is emulated and accelerated so that the worker threads can generate as many data points as possible -without delays. +without delays. -We also defined 32 worker threads that perform queries on random metrics with semi-random time ranges. The -starting time of the query is randomly selected between the beginning of the time-series and the time of the latest data -point. The ending time is randomly selected between 1 second and 1 hour after the starting time. The pseudo-random -numbers are generated with a uniform distribution. +We also defined 32 worker threads that perform queries on random metrics with semi-random time ranges. The starting time +of the query is randomly selected between the beginning of the time-series and the time of the latest data point. The +ending time is randomly selected between 1 second and 1 hour after the starting time. The pseudo-random numbers are +generated with a uniform distribution. The data are written to the database at the same time as they are read from it. This is a concurrent read/write mixed -workload with a duration of 60 seconds. The faster `dbengine` runs, the bigger the dataset size becomes since more -data points will be generated. We set a page cache size of 64MiB for the two disk-bound scenarios. This way, the dataset -size of the metric data is much bigger than the RAM that is being used for caching so as to trigger I/O requests most -of the time. In our final scenario, we set the page cache size to 16 GiB. That way, the dataset fits in the page cache -so as to avoid all disk bottlenecks. +workload with a duration of 60 seconds. The faster `dbengine` runs, the bigger the dataset size becomes since more data +points will be generated. We set a page cache size of 64MiB for the two disk-bound scenarios. This way, the dataset size +of the metric data is much bigger than the RAM that is being used for caching so as to trigger I/O requests most of the +time. In our final scenario, we set the page cache size to 16 GiB. That way, the dataset fits in the page cache so as to +avoid all disk bottlenecks. The reported numbers are the following: | device | page cache | dataset | reads/sec | writes/sec | -| :----: | :--------: | ------: | --------: | ---------: | -| HDD | 64 MiB | 4.1 GiB | 813K | 18.0M | -| SSD | 64 MiB | 9.8 GiB | 1.7M | 43.0M | -| N/A | 16 GiB | 6.8 GiB | 118.2M | 30.2M | +|:------:|:----------:|--------:|----------:|-----------:| +| HDD | 64 MiB | 4.1 GiB | 813K | 18.0M | +| SSD | 64 MiB | 9.8 GiB | 1.7M | 43.0M | +| N/A | 16 GiB | 6.8 GiB | 118.2M | 30.2M | where "reads/sec" is the number of metric data points being read from the database via its API per second and -"writes/sec" is the number of metric data points being written to the database per second. +"writes/sec" is the number of metric data points being written to the database per second. Notice that the HDD numbers are pretty high and not much slower than the SSD numbers. This is thanks to the database engine design being optimized for rotating media. In the database engine disk I/O requests are: -- asynchronous to mask the high I/O latency of HDDs. -- mostly large to reduce the amount of HDD seeking time. -- mostly sequential to reduce the amount of HDD seeking time. -- compressed to reduce the amount of required throughput. +- asynchronous to mask the high I/O latency of HDDs. +- mostly large to reduce the amount of HDD seeking time. +- mostly sequential to reduce the amount of HDD seeking time. +- compressed to reduce the amount of required throughput. As a result, the HDD is not thousands of times slower than the SSD, which is typical for other workloads. diff --git a/database/engine/datafile.c b/database/engine/datafile.c index 46d7a8f10..2ed98ef88 100644 --- a/database/engine/datafile.c +++ b/database/engine/datafile.c @@ -444,18 +444,44 @@ void finalize_data_files(struct rrdengine_instance *ctx) struct rrdengine_journalfile *journalfile; struct extent_info *extent, *next_extent; + size_t extents_number = 0; + size_t extents_bytes = 0; + size_t page_compressed_sizes = 0; + + size_t files_number = 0; + size_t files_bytes = 0; + for (datafile = ctx->datafiles.first ; datafile != NULL ; datafile = next_datafile) { journalfile = datafile->journalfile; next_datafile = datafile->next; for (extent = datafile->extents.first ; extent != NULL ; extent = next_extent) { + extents_number++; + extents_bytes += sizeof(*extent) + sizeof(struct rrdeng_page_descr *) * extent->number_of_pages; + page_compressed_sizes += extent->size; + next_extent = extent->next; freez(extent); } close_journal_file(journalfile, datafile); close_data_file(datafile); + + files_number++; + files_bytes += sizeof(*journalfile) + sizeof(*datafile); + freez(journalfile); freez(datafile); - } + + if(!files_number) files_number = 1; + if(!extents_number) extents_number = 1; + + info("DBENGINE STATISTICS ON DATAFILES:" + " Files %zu, structures %zu bytes, %0.2f bytes per file." + " Extents %zu, structures %zu bytes, %0.2f bytes per extent." + " Compressed size of all pages: %zu bytes." + , files_number, files_bytes, (double)files_bytes/files_number + , extents_number, extents_bytes, (double)extents_bytes/extents_number + , page_compressed_sizes + ); } diff --git a/database/engine/journalfile.c b/database/engine/journalfile.c index 0b3d3eeb8..dc61f569d 100644 --- a/database/engine/journalfile.c +++ b/database/engine/journalfile.c @@ -275,6 +275,7 @@ static int check_journal_file_superblock(uv_file file) static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrdengine_journalfile *journalfile, void *buf, unsigned max_size) { + static BITMAP256 page_error_map; struct page_cache *pg_cache = &ctx->pg_cache; unsigned i, count, payload_length, descr_size, valid_pages; struct rrdeng_page_descr *descr; @@ -301,11 +302,31 @@ static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrden uuid_t *temp_id; Pvoid_t *PValue; struct pg_cache_page_index *page_index = NULL; + uint8_t page_type = jf_metric_data->descr[i].type; - if (PAGE_METRICS != jf_metric_data->descr[i].type) { - error("Unknown page type encountered."); + if (page_type > PAGE_TYPE_MAX) { + if (!bitmap256_get_bit(&page_error_map, page_type)) { + error("Unknown page type %d encountered.", page_type); + bitmap256_set_bit(&page_error_map, page_type, 1); + } continue; } + uint64_t start_time = jf_metric_data->descr[i].start_time; + uint64_t end_time = jf_metric_data->descr[i].end_time; + + if (unlikely(start_time > end_time)) { + error("Invalid page encountered, start time %lu > end time %lu", start_time , end_time ); + continue; + } + + if (unlikely(start_time == end_time)) { + size_t entries = jf_metric_data->descr[i].page_length / page_type_size[page_type]; + if (unlikely(entries > 1)) { + error("Invalid page encountered, start time %lu = end time but %zu entries were found", start_time, entries); + continue; + } + } + temp_id = (uuid_t *)jf_metric_data->descr[i].uuid; uv_rwlock_rdlock(&pg_cache->metrics_index.lock); @@ -327,10 +348,11 @@ static void restore_extent_metadata(struct rrdengine_instance *ctx, struct rrden descr = pg_cache_create_descr(); descr->page_length = jf_metric_data->descr[i].page_length; - descr->start_time = jf_metric_data->descr[i].start_time; - descr->end_time = jf_metric_data->descr[i].end_time; + descr->start_time = start_time; + descr->end_time = end_time; descr->id = &page_index->id; descr->extent = extent; + descr->type = page_type; extent->pages[valid_pages++] = descr; pg_cache_insert(ctx, page_index, descr); } diff --git a/database/engine/metadata_log/metalogpluginsd.c b/database/engine/metadata_log/metalogpluginsd.c index 88c1453a9..a5301bc10 100755 --- a/database/engine/metadata_log/metalogpluginsd.c +++ b/database/engine/metadata_log/metalogpluginsd.c @@ -30,7 +30,7 @@ PARSER_RC metalog_pluginsd_host_action( } if (likely(!uuid_parse(machine_guid, state->host_uuid))) { - int rc = sql_store_host(&state->host_uuid, hostname, registry_hostname, update_every, os, timezone, tags); + int rc = sql_store_host(&state->host_uuid, hostname, registry_hostname, update_every, os, timezone, tags, 1); if (unlikely(rc)) { errno = 0; error("Failed to store host %s with UUID %s in the database", hostname, machine_guid); diff --git a/database/engine/pagecache.c b/database/engine/pagecache.c index cddbf9e1f..39f7642d0 100644 --- a/database/engine/pagecache.c +++ b/database/engine/pagecache.c @@ -3,6 +3,50 @@ #include "rrdengine.h" +ARAL page_descr_aral = { + .element_size = sizeof(struct rrdeng_page_descr), + .elements = 20000, + .filename = "page_descriptors", + .cache_dir = &netdata_configured_cache_dir, + .use_mmap = false, + .internal.initialized = false +}; + +void rrdeng_page_descr_aral_go_singlethreaded(void) { + page_descr_aral.internal.lockless = true; +} +void rrdeng_page_descr_aral_go_multithreaded(void) { + page_descr_aral.internal.lockless = false; +} + +struct rrdeng_page_descr *rrdeng_page_descr_mallocz(void) { + struct rrdeng_page_descr *descr; + descr = arrayalloc_mallocz(&page_descr_aral); + return descr; +} + +void rrdeng_page_descr_freez(struct rrdeng_page_descr *descr) { + arrayalloc_freez(&page_descr_aral, descr); +} + +void rrdeng_page_descr_use_malloc(void) { + if(page_descr_aral.internal.initialized) + error("DBENGINE: cannot change ARAL allocation policy after it has been initialized."); + else + page_descr_aral.use_mmap = false; +} + +void rrdeng_page_descr_use_mmap(void) { + if(page_descr_aral.internal.initialized) + error("DBENGINE: cannot change ARAL allocation policy after it has been initialized."); + else + page_descr_aral.use_mmap = true; +} + +bool rrdeng_page_descr_is_mmap(void) { + return page_descr_aral.use_mmap; +} + /* Forward declarations */ static int pg_cache_try_evict_one_page_unsafe(struct rrdengine_instance *ctx); @@ -81,7 +125,7 @@ struct rrdeng_page_descr *pg_cache_create_descr(void) { struct rrdeng_page_descr *descr; - descr = mallocz(sizeof(*descr)); + descr = rrdeng_page_descr_mallocz(); descr->page_length = 0; descr->start_time = INVALID_TIME; descr->end_time = INVALID_TIME; @@ -238,8 +282,7 @@ static void pg_cache_release_pages(struct rrdengine_instance *ctx, unsigned numb */ unsigned long pg_cache_hard_limit(struct rrdengine_instance *ctx) { - /* it's twice the number of producers since we pin 2 pages per producer */ - return ctx->max_cache_pages + 2 * (unsigned long)ctx->metric_API_max_producers; + return ctx->max_cache_pages + (unsigned long)ctx->metric_API_max_producers; } /* @@ -248,8 +291,7 @@ unsigned long pg_cache_hard_limit(struct rrdengine_instance *ctx) */ unsigned long pg_cache_soft_limit(struct rrdengine_instance *ctx) { - /* it's twice the number of producers since we pin 2 pages per producer */ - return ctx->cache_pages_low_watermark + 2 * (unsigned long)ctx->metric_API_max_producers; + return ctx->cache_pages_low_watermark + (unsigned long)ctx->metric_API_max_producers; } /* @@ -496,7 +538,7 @@ uint8_t pg_cache_punch_hole(struct rrdengine_instance *ctx, struct rrdeng_page_d (void)sleep_usec(1000); /* 1 msec */ } destroy: - freez(descr); + rrdeng_page_descr_freez(descr); pg_cache_update_metric_times(page_index); return can_delete_metric; @@ -1069,9 +1111,9 @@ pg_cache_lookup_next(struct rrdengine_instance *ctx, struct pg_cache_page_index int retry_count = 0; while (1) { descr = find_first_page_in_time_range(page_index, start_time, end_time); - if (NULL == descr || 0 == descr->page_length || retry_count == MAX_PAGE_CACHE_RETRY_WAIT) { + if (NULL == descr || 0 == descr->page_length || retry_count == default_rrdeng_page_fetch_retries) { /* non-empty page not found */ - if (retry_count == MAX_PAGE_CACHE_RETRY_WAIT) + if (retry_count == default_rrdeng_page_fetch_retries) error_report("Page cache timeout while waiting for page %p : returning FAIL", descr); uv_rwlock_rdunlock(&page_index->lock); @@ -1117,7 +1159,7 @@ pg_cache_lookup_next(struct rrdengine_instance *ctx, struct pg_cache_page_index if (!(flags & RRD_PAGE_POPULATED)) page_not_in_cache = 1; - if (pg_cache_timedwait_event_unsafe(descr, 1) == UV_ETIMEDOUT) { + if (pg_cache_timedwait_event_unsafe(descr, default_rrdeng_page_fetch_timeout) == UV_ETIMEDOUT) { error_report("Page cache timeout while waiting for page %p : retry count = %d", descr, retry_count); ++retry_count; } @@ -1196,24 +1238,66 @@ void init_page_cache(struct rrdengine_instance *ctx) init_committed_page_index(ctx); } + + +/* + * METRIC # number + * 1. INDEX: JudyHS # bytes + * 2. DATA: page_index # bytes + * + * PAGE (1 page of 1 metric) # number + * 1. INDEX AT METRIC: page_index->JudyL_array # bytes + * 2. DATA: descr # bytes + * + * PAGE CACHE (1 page of 1 metric at the cache) # number + * 1. pg_cache_descr (if PG_CACHE_DESCR_ALLOCATED) # bytes + * 2. data (if RRD_PAGE_POPULATED) # bytes + * + */ + + void free_page_cache(struct rrdengine_instance *ctx) { struct page_cache *pg_cache = &ctx->pg_cache; - Word_t ret_Judy, bytes_freed = 0; Pvoid_t *PValue; struct pg_cache_page_index *page_index, *prev_page_index; Word_t Index; struct rrdeng_page_descr *descr; struct page_cache_descr *pg_cache_descr; + Word_t metrics_number = 0, + metrics_bytes = 0, + metrics_index_bytes = 0, + metrics_duration = 0; + + Word_t pages_number = 0, + pages_bytes = 0, + pages_index_bytes = 0; + + Word_t pages_size_per_type[256] = { 0 }, + pages_count_per_type[256] = { 0 }; + + Word_t cache_pages_number = 0, + cache_pages_bytes = 0, + cache_pages_data_bytes = 0; + + size_t points_in_db = 0, + uncompressed_points_size = 0, + seconds_in_db = 0, + single_point_pages = 0; + + Word_t pages_dirty_index_bytes = 0; + + usec_t oldest_time_ut = LONG_MAX, latest_time_ut = 0; + /* Free committed page index */ - ret_Judy = JudyLFreeArray(&pg_cache->committed_page_index.JudyL_array, PJE0); + pages_dirty_index_bytes = JudyLFreeArray(&pg_cache->committed_page_index.JudyL_array, PJE0); fatal_assert(NULL == pg_cache->committed_page_index.JudyL_array); - bytes_freed += ret_Judy; for (page_index = pg_cache->metrics_index.last_page_index ; page_index != NULL ; page_index = prev_page_index) { + prev_page_index = page_index->prev; /* Find first page in range */ @@ -1221,37 +1305,116 @@ void free_page_cache(struct rrdengine_instance *ctx) PValue = JudyLFirst(page_index->JudyL_array, &Index, PJE0); descr = unlikely(NULL == PValue) ? NULL : *PValue; + size_t metric_duration = 0; + size_t metric_update_every = 0; + size_t metric_single_point_pages = 0; + while (descr != NULL) { /* Iterate all page descriptors of this metric */ if (descr->pg_cache_descr_state & PG_CACHE_DESCR_ALLOCATED) { + cache_pages_number++; + /* Check rrdenglocking.c */ pg_cache_descr = descr->pg_cache_descr; if (pg_cache_descr->flags & RRD_PAGE_POPULATED) { dbengine_page_free(pg_cache_descr->page); - bytes_freed += RRDENG_BLOCK_SIZE; + cache_pages_data_bytes += RRDENG_BLOCK_SIZE; } rrdeng_destroy_pg_cache_descr(ctx, pg_cache_descr); - bytes_freed += sizeof(*pg_cache_descr); + cache_pages_bytes += sizeof(*pg_cache_descr); } - freez(descr); - bytes_freed += sizeof(*descr); + + if(descr->start_time < oldest_time_ut) + oldest_time_ut = descr->start_time; + + if(descr->end_time > latest_time_ut) + latest_time_ut = descr->end_time; + + pages_size_per_type[descr->type] += descr->page_length; + pages_count_per_type[descr->type]++; + + size_t points_in_page = (descr->page_length / PAGE_POINT_SIZE_BYTES(descr)); + size_t page_duration = ((descr->end_time - descr->start_time) / USEC_PER_SEC); + size_t update_every = (page_duration == 0) ? 1 : page_duration / (points_in_page - 1); + + if (!page_duration && metric_update_every) { + page_duration = metric_update_every; + update_every = metric_update_every; + } + else if(page_duration) + metric_update_every = update_every; + + uncompressed_points_size += descr->page_length; + + if(page_duration > 0) { + page_duration = update_every * points_in_page; + metric_duration += page_duration; + seconds_in_db += page_duration; + points_in_db += descr->page_length / PAGE_POINT_SIZE_BYTES(descr); + } + else + metric_single_point_pages++; + + rrdeng_page_descr_freez(descr); + pages_bytes += sizeof(*descr); + pages_number++; PValue = JudyLNext(page_index->JudyL_array, &Index, PJE0); descr = unlikely(NULL == PValue) ? NULL : *PValue; } + if(metric_single_point_pages && metric_update_every) { + points_in_db += metric_single_point_pages; + seconds_in_db += metric_update_every * metric_single_point_pages; + metric_duration += metric_update_every * metric_single_point_pages; + } + else + single_point_pages += metric_single_point_pages; + /* Free page index */ - ret_Judy = JudyLFreeArray(&page_index->JudyL_array, PJE0); + pages_index_bytes += JudyLFreeArray(&page_index->JudyL_array, PJE0); fatal_assert(NULL == page_index->JudyL_array); - bytes_freed += ret_Judy; freez(page_index); - bytes_freed += sizeof(*page_index); + + metrics_number++; + metrics_bytes += sizeof(*page_index); + metrics_duration += metric_duration; } /* Free metrics index */ - ret_Judy = JudyHSFreeArray(&pg_cache->metrics_index.JudyHS_array, PJE0); + metrics_index_bytes = JudyHSFreeArray(&pg_cache->metrics_index.JudyHS_array, PJE0); fatal_assert(NULL == pg_cache->metrics_index.JudyHS_array); - bytes_freed += ret_Judy; - info("Freed %lu bytes of memory from page cache.", bytes_freed); + if(!metrics_number) metrics_number = 1; + if(!pages_number) pages_number = 1; + if(!cache_pages_number) cache_pages_number = 1; + if(!points_in_db) points_in_db = 1; + if(latest_time_ut == oldest_time_ut) oldest_time_ut -= USEC_PER_SEC; + + if(single_point_pages) { + long double avg_duration = (long double)seconds_in_db / points_in_db; + points_in_db += single_point_pages; + seconds_in_db += (size_t)(avg_duration * single_point_pages); + } + + info("DBENGINE STATISTICS ON METRICS:" + " Metrics: %lu (structures %lu bytes - per metric %0.2f, index (HS) %lu bytes - per metric %0.2f bytes - duration %zu secs) |" + " Page descriptors: %lu (structures %lu bytes - per page %0.2f bytes, index (L) %lu bytes - per page %0.2f, dirty index %lu bytes). |" + " Page cache: %lu pages (structures %lu bytes - per page %0.2f bytes, data %lu bytes). |" + " Points in db %zu, uncompressed size of points database %zu bytes. |" + " Duration of all points %zu seconds, average point duration %0.2f seconds." + " Duration of the database %llu seconds, average metric duration %0.2f seconds, average metric lifetime %0.2f%%." + , metrics_number, metrics_bytes, (double)metrics_bytes/metrics_number, metrics_index_bytes, (double)metrics_index_bytes/metrics_number, metrics_duration + , pages_number, pages_bytes, (double)pages_bytes/pages_number, pages_index_bytes, (double)pages_index_bytes/pages_number, pages_dirty_index_bytes + , cache_pages_number, cache_pages_bytes, (double)cache_pages_bytes/cache_pages_number, cache_pages_data_bytes + , points_in_db, uncompressed_points_size + , seconds_in_db, (double)seconds_in_db/points_in_db + , (latest_time_ut - oldest_time_ut) / USEC_PER_SEC, (double)metrics_duration/metrics_number + , (double)metrics_duration/metrics_number * 100.0 / ((latest_time_ut - oldest_time_ut) / USEC_PER_SEC) + ); + + for(int i = 0; i < 256 ;i++) { + if(pages_count_per_type[i]) + info("DBENGINE STATISTICS ON PAGE TYPES: page type %d total pages %lu, average page size %0.2f bytes", i, pages_count_per_type[i], (double)pages_size_per_type[i]/pages_count_per_type[i]); + } } diff --git a/database/engine/pagecache.h b/database/engine/pagecache.h index 0ba4639ce..b938b9e05 100644 --- a/database/engine/pagecache.h +++ b/database/engine/pagecache.h @@ -11,7 +11,8 @@ struct extent_info; struct rrdeng_page_descr; #define INVALID_TIME (0) -#define MAX_PAGE_CACHE_RETRY_WAIT (3) +#define MAX_PAGE_CACHE_FETCH_RETRIES (3) +#define PAGE_CACHE_FETCH_WAIT_TIMEOUT (3) /* Page flags */ #define RRD_PAGE_DIRTY (1LU << 0) @@ -62,6 +63,7 @@ struct rrdeng_page_descr { usec_t start_time; usec_t end_time; uint32_t page_length; + uint8_t type; }; #define PAGE_INFO_SCRATCH_SZ (8) @@ -193,6 +195,14 @@ extern unsigned long pg_cache_hard_limit(struct rrdengine_instance *ctx); extern unsigned long pg_cache_soft_limit(struct rrdengine_instance *ctx); extern unsigned long pg_cache_committed_hard_limit(struct rrdengine_instance *ctx); +extern void rrdeng_page_descr_aral_go_singlethreaded(void); +extern void rrdeng_page_descr_aral_go_multithreaded(void); +extern void rrdeng_page_descr_use_malloc(void); +extern void rrdeng_page_descr_use_mmap(void); +extern bool rrdeng_page_descr_is_mmap(void); +extern struct rrdeng_page_descr *rrdeng_page_descr_mallocz(void); +extern void rrdeng_page_descr_freez(struct rrdeng_page_descr *descr); + static inline void pg_cache_atomic_get_pg_info(struct rrdeng_page_descr *descr, usec_t *end_timep, uint32_t *page_lengthp) { diff --git a/database/engine/rrddiskprotocol.h b/database/engine/rrddiskprotocol.h index db47af531..cb57385a4 100644 --- a/database/engine/rrddiskprotocol.h +++ b/database/engine/rrddiskprotocol.h @@ -35,7 +35,8 @@ struct rrdeng_df_sb { * Page types */ #define PAGE_METRICS (0) -#define PAGE_LOGS (1) /* reserved */ +#define PAGE_TIER (1) +#define PAGE_TYPE_MAX 1 // Maximum page type (inclusive) /* * Data file page descriptor diff --git a/database/engine/rrdengine.c b/database/engine/rrdengine.c index 9f43f4456..8b35051d8 100644 --- a/database/engine/rrdengine.c +++ b/database/engine/rrdengine.c @@ -9,20 +9,28 @@ rrdeng_stats_t rrdeng_reserved_file_descriptors = 0; rrdeng_stats_t global_pg_cache_over_half_dirty_events = 0; rrdeng_stats_t global_flushing_pressure_page_deletions = 0; -static unsigned pages_per_extent = MAX_PAGES_PER_EXTENT; +unsigned rrdeng_pages_per_extent = MAX_PAGES_PER_EXTENT; #if WORKER_UTILIZATION_MAX_JOB_TYPES < (RRDENG_MAX_OPCODE + 2) #error Please increase WORKER_UTILIZATION_MAX_JOB_TYPES to at least (RRDENG_MAX_OPCODE + 2) #endif void *dbengine_page_alloc() { - void *page = netdata_mmap(NULL, RRDENG_BLOCK_SIZE, MAP_PRIVATE, enable_ksm); - if(!page) fatal("Cannot allocate dbengine page cache page, with mmap()"); + void *page = NULL; + if (unlikely(db_engine_use_malloc)) + page = mallocz(RRDENG_BLOCK_SIZE); + else { + page = netdata_mmap(NULL, RRDENG_BLOCK_SIZE, MAP_PRIVATE, enable_ksm); + if(!page) fatal("Cannot allocate dbengine page cache page, with mmap()"); + } return page; } void dbengine_page_free(void *page) { - munmap(page, RRDENG_BLOCK_SIZE); + if (unlikely(db_engine_use_malloc)) + freez(page); + else + munmap(page, RRDENG_BLOCK_SIZE); } static void sanity_check(void) @@ -227,6 +235,43 @@ void read_cached_extent_cb(struct rrdengine_worker_config* wc, unsigned idx, str freez(xt_io_descr); } +static void fill_page_with_nulls(void *page, uint32_t page_length, uint8_t type) { + switch(type) { + case PAGE_METRICS: { + storage_number n = pack_storage_number(NAN, SN_FLAG_NONE); + storage_number *array = (storage_number *)page; + size_t slots = page_length / sizeof(n); + for(size_t i = 0; i < slots ; i++) + array[i] = n; + } + break; + + case PAGE_TIER: { + storage_number_tier1_t n = { + .min_value = NAN, + .max_value = NAN, + .sum_value = NAN, + .count = 1, + .anomaly_count = 0, + }; + storage_number_tier1_t *array = (storage_number_tier1_t *)page; + size_t slots = page_length / sizeof(n); + for(size_t i = 0; i < slots ; i++) + array[i] = n; + } + break; + + default: { + static bool logged = false; + if(!logged) { + error("DBENGINE: cannot fill page with nulls on unknown page type id %d", type); + logged = true; + } + memset(page, 0, page_length); + } + } +} + void read_extent_cb(uv_fs_t* req) { struct rrdengine_worker_config* wc = req->loop->data; @@ -351,8 +396,7 @@ after_crc_check: /* care, we don't hold the descriptor mutex */ if (have_read_error) { - /* Applications should make sure NULL values match 0 as does SN_EMPTY_SLOT */ - memset(page, SN_EMPTY_SLOT, descr->page_length); + fill_page_with_nulls(page, descr->page_length, descr->type); } else if (RRD_NO_COMPRESSION == header->compression_algorithm) { (void) memcpy(page, xt_io_descr->buf + payload_offset + page_offset, descr->page_length); } else { @@ -697,7 +741,7 @@ static int do_flush_pages(struct rrdengine_worker_config* wc, int force, struct PValue = JudyLFirst(pg_cache->committed_page_index.JudyL_array, &Index, PJE0), descr = unlikely(NULL == PValue) ? NULL : *PValue ; - descr != NULL && count != pages_per_extent ; + descr != NULL && count != rrdeng_pages_per_extent; PValue = JudyLNext(pg_cache->committed_page_index.JudyL_array, &Index, PJE0), descr = unlikely(NULL == PValue) ? NULL : *PValue) { @@ -773,7 +817,7 @@ static int do_flush_pages(struct rrdengine_worker_config* wc, int force, struct xt_io_descr->descr_commit_idx_array[i] = descr_commit_idx_array[i]; descr = xt_io_descr->descr_array[i]; - header->descr[i].type = PAGE_METRICS; + header->descr[i].type = descr->type; uuid_copy(*(uuid_t *)header->descr[i].uuid, *descr->id); header->descr[i].page_length = descr->page_length; header->descr[i].start_time = descr->start_time; @@ -879,6 +923,7 @@ static void after_delete_old_data(struct rrdengine_worker_config* wc) wc->cleanup_thread_deleting_files = 0; aclk_data_rotated(); + rrdcontext_db_rotation(); /* interrupt event loop */ uv_stop(wc->loop); @@ -1066,16 +1111,12 @@ struct rrdeng_cmd rrdeng_deq_cmd(struct rrdengine_worker_config* wc) static void load_configuration_dynamic(void) { - unsigned read_num; - static int printed_error = 0; - - read_num = (unsigned) config_get_number(CONFIG_SECTION_GLOBAL, "dbengine extent pages", - MAX_PAGES_PER_EXTENT); - if (read_num > 0 && read_num <= MAX_PAGES_PER_EXTENT) { - pages_per_extent = read_num; - } else if (!printed_error) { - printed_error = 1; - error("Invalid dbengine extent pages %u given. Defaulting to %u.", read_num, pages_per_extent); + unsigned read_num = (unsigned)config_get_number(CONFIG_SECTION_DB, "dbengine pages per extent", MAX_PAGES_PER_EXTENT); + if (read_num > 0 && read_num <= MAX_PAGES_PER_EXTENT) + rrdeng_pages_per_extent = read_num; + else { + error("Invalid dbengine pages per extent %u given. Using %u.", read_num, rrdeng_pages_per_extent); + config_set_number(CONFIG_SECTION_DB, "dbengine pages per extent", rrdeng_pages_per_extent); } } @@ -1335,7 +1376,7 @@ void rrdengine_main(void) struct rrdengine_instance *ctx; sanity_check(); - ret = rrdeng_init(NULL, &ctx, "/tmp", RRDENG_MIN_PAGE_CACHE_SIZE_MB, RRDENG_MIN_DISK_SPACE_MB); + ret = rrdeng_init(NULL, &ctx, "/tmp", RRDENG_MIN_PAGE_CACHE_SIZE_MB, RRDENG_MIN_DISK_SPACE_MB, 0); if (ret) { exit(ret); } diff --git a/database/engine/rrdengine.h b/database/engine/rrdengine.h index c6f89a37a..4b383b622 100644 --- a/database/engine/rrdengine.h +++ b/database/engine/rrdengine.h @@ -26,6 +26,8 @@ #endif /* NETDATA_RRD_INTERNALS */ +extern unsigned rrdeng_pages_per_extent; + /* Forward declarations */ struct rrdengine_instance; @@ -35,7 +37,8 @@ struct rrdengine_instance; #define RRDENG_FILE_NUMBER_PRINT_TMPL "%1.1u-%10.10u" struct rrdeng_collect_handle { - struct rrdeng_page_descr *descr, *prev_descr; + struct rrdeng_metric_handle *metric_handle; + struct rrdeng_page_descr *descr; unsigned long page_correlation_id; struct rrdengine_instance *ctx; // set to 1 when this dimension is not page aligned with the other dimensions in the chart @@ -43,6 +46,7 @@ struct rrdeng_collect_handle { }; struct rrdeng_query_handle { + struct rrdeng_metric_handle *metric_handle; struct rrdeng_page_descr *descr; struct rrdengine_instance *ctx; struct pg_cache_page_index *page_index; @@ -50,6 +54,7 @@ struct rrdeng_query_handle { time_t now; unsigned position; unsigned entries; + TIER_QUERY_FETCH tier_query_fetch_type; storage_number *page; usec_t page_end_time; uint32_t page_length; @@ -239,12 +244,14 @@ struct rrdengine_instance { char machine_guid[GUID_LEN + 1]; /* the unique ID of the corresponding host, or localhost for multihost DB */ uint64_t disk_space; uint64_t max_disk_space; + int tier; unsigned last_fileno; /* newest index of datafile and journalfile */ unsigned long max_cache_pages; unsigned long cache_pages_low_watermark; unsigned long metric_API_max_producers; uint8_t quiesce; /* set to SET_QUIESCE before shutdown of the engine */ + uint8_t page_type; /* Default page type for this context */ struct rrdengine_statistics stats; }; diff --git a/database/engine/rrdengineapi.c b/database/engine/rrdengineapi.c index 76010a7c2..f4da29407 100755 --- a/database/engine/rrdengineapi.c +++ b/database/engine/rrdengineapi.c @@ -2,17 +2,43 @@ #include "rrdengine.h" /* Default global database instance */ -struct rrdengine_instance multidb_ctx; +struct rrdengine_instance multidb_ctx_storage_tier0; +struct rrdengine_instance multidb_ctx_storage_tier1; +struct rrdengine_instance multidb_ctx_storage_tier2; +struct rrdengine_instance multidb_ctx_storage_tier3; +struct rrdengine_instance multidb_ctx_storage_tier4; +#if RRD_STORAGE_TIERS != 5 +#error RRD_STORAGE_TIERS is not 5 - you need to add allocations here +#endif +struct rrdengine_instance *multidb_ctx[RRD_STORAGE_TIERS]; +uint8_t tier_page_type[RRD_STORAGE_TIERS] = {PAGE_METRICS, PAGE_TIER, PAGE_TIER, PAGE_TIER, PAGE_TIER}; + +#if PAGE_TYPE_MAX != 1 +#error PAGE_TYPE_MAX is not 1 - you need to add allocations here +#endif +size_t page_type_size[256] = {sizeof(storage_number), sizeof(storage_number_tier1_t)}; + +__attribute__((constructor)) void initialize_multidb_ctx(void) { + multidb_ctx[0] = &multidb_ctx_storage_tier0; + multidb_ctx[1] = &multidb_ctx_storage_tier1; + multidb_ctx[2] = &multidb_ctx_storage_tier2; + multidb_ctx[3] = &multidb_ctx_storage_tier3; + multidb_ctx[4] = &multidb_ctx_storage_tier4; +} +int db_engine_use_malloc = 0; +int default_rrdeng_page_fetch_timeout = 3; +int default_rrdeng_page_fetch_retries = 3; int default_rrdeng_page_cache_mb = 32; int default_rrdeng_disk_quota_mb = 256; int default_multidb_disk_quota_mb = 256; /* Default behaviour is to unblock data collection if the page cache is full of dirty pages by dropping metrics */ uint8_t rrdeng_drop_metrics_under_page_cache_pressure = 1; -static inline struct rrdengine_instance *get_rrdeng_ctx_from_host(RRDHOST *host) -{ - return host->rrdeng_ctx; +static inline struct rrdengine_instance *get_rrdeng_ctx_from_host(RRDHOST *host, int tier) { + if(tier < 0 || tier >= RRD_STORAGE_TIERS) tier = 0; + if(!host->storage_instance[tier]) tier = 0; + return (struct rrdengine_instance *)host->storage_instance[tier]; } /* This UUID is not unique across hosts */ @@ -49,10 +75,20 @@ void rrdeng_convert_legacy_uuid_to_multihost(char machine_guid[GUID_LEN + 1], uu memcpy(ret_uuid, hash_value, sizeof(uuid_t)); } -void rrdeng_metric_init(RRDDIM *rd) -{ - struct page_cache *pg_cache; +struct rrdeng_metric_handle { + RRDDIM *rd; struct rrdengine_instance *ctx; + uuid_t *rrdeng_uuid; // database engine metric UUID + struct pg_cache_page_index *page_index; +}; + +void rrdeng_metric_free(STORAGE_METRIC_HANDLE *db_metric_handle) { + freez(db_metric_handle); +} + +STORAGE_METRIC_HANDLE *rrdeng_metric_init(RRDDIM *rd, STORAGE_INSTANCE *db_instance) { + struct rrdengine_instance *ctx = (struct rrdengine_instance *)db_instance; + struct page_cache *pg_cache; uuid_t legacy_uuid; uuid_t multihost_legacy_uuid; Pvoid_t *PValue; @@ -60,15 +96,10 @@ void rrdeng_metric_init(RRDDIM *rd) int is_multihost_child = 0; RRDHOST *host = rd->rrdset->rrdhost; - ctx = get_rrdeng_ctx_from_host(rd->rrdset->rrdhost); - if (unlikely(!ctx)) { - error("Failed to fetch multidb context"); - return; - } pg_cache = &ctx->pg_cache; rrdeng_generate_legacy_uuid(rd->id, rd->rrdset->id, &legacy_uuid); - if (host != localhost && host->rrdeng_ctx == &multidb_ctx) + if (host != localhost && is_storage_engine_shared((STORAGE_INSTANCE *)ctx)) is_multihost_child = 1; uv_rwlock_rdlock(&pg_cache->metrics_index.lock); @@ -82,16 +113,16 @@ void rrdeng_metric_init(RRDDIM *rd) * Drop legacy support, normal path */ uv_rwlock_rdlock(&pg_cache->metrics_index.lock); - PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, &rd->state->metric_uuid, sizeof(uuid_t)); + PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, &rd->metric_uuid, sizeof(uuid_t)); if (likely(NULL != PValue)) { page_index = *PValue; } uv_rwlock_rdunlock(&pg_cache->metrics_index.lock); if (NULL == PValue) { uv_rwlock_wrlock(&pg_cache->metrics_index.lock); - PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, &rd->state->metric_uuid, sizeof(uuid_t), PJE0); + PValue = JudyHSIns(&pg_cache->metrics_index.JudyHS_array, &rd->metric_uuid, sizeof(uuid_t), PJE0); fatal_assert(NULL == *PValue); /* TODO: figure out concurrency model */ - *PValue = page_index = create_page_index(&rd->state->metric_uuid); + *PValue = page_index = create_page_index(&rd->metric_uuid); page_index->prev = pg_cache->metrics_index.last_page_index; pg_cache->metrics_index.last_page_index = page_index; uv_rwlock_wrunlock(&pg_cache->metrics_index.lock); @@ -102,84 +133,98 @@ void rrdeng_metric_init(RRDDIM *rd) rrdeng_convert_legacy_uuid_to_multihost(rd->rrdset->rrdhost->machine_guid, &legacy_uuid, &multihost_legacy_uuid); - int need_to_store = uuid_compare(rd->state->metric_uuid, multihost_legacy_uuid); + int need_to_store = uuid_compare(rd->metric_uuid, multihost_legacy_uuid); - uuid_copy(rd->state->metric_uuid, multihost_legacy_uuid); + uuid_copy(rd->metric_uuid, multihost_legacy_uuid); - if (unlikely(need_to_store)) - (void)sql_store_dimension(&rd->state->metric_uuid, rd->rrdset->chart_uuid, rd->id, rd->name, rd->multiplier, rd->divisor, + if (unlikely(need_to_store && !ctx->tier)) + (void)sql_store_dimension(&rd->metric_uuid, rd->rrdset->chart_uuid, rd->id, rd->name, rd->multiplier, rd->divisor, rd->algorithm); - } - rd->state->rrdeng_uuid = &page_index->id; - rd->state->page_index = page_index; + + struct rrdeng_metric_handle *mh = mallocz(sizeof(struct rrdeng_metric_handle)); + mh->rd = rd; + mh->ctx = ctx; + mh->rrdeng_uuid = &page_index->id; + mh->page_index = page_index; + return (STORAGE_METRIC_HANDLE *)mh; } /* * Gets a handle for storing metrics to the database. * The handle must be released with rrdeng_store_metric_final(). */ -void rrdeng_store_metric_init(RRDDIM *rd) -{ +STORAGE_COLLECT_HANDLE *rrdeng_store_metric_init(STORAGE_METRIC_HANDLE *db_metric_handle) { + struct rrdeng_metric_handle *metric_handle = (struct rrdeng_metric_handle *)db_metric_handle; + struct rrdeng_collect_handle *handle; - struct rrdengine_instance *ctx; struct pg_cache_page_index *page_index; - ctx = get_rrdeng_ctx_from_host(rd->rrdset->rrdhost); - handle = callocz(1, sizeof(struct rrdeng_collect_handle)); - handle->ctx = ctx; + handle->metric_handle = metric_handle; + handle->ctx = metric_handle->ctx; handle->descr = NULL; - handle->prev_descr = NULL; handle->unaligned_page = 0; - rd->state->handle = (STORAGE_COLLECT_HANDLE *)handle; - page_index = rd->state->page_index; + page_index = metric_handle->page_index; uv_rwlock_wrlock(&page_index->lock); ++page_index->writers; uv_rwlock_wrunlock(&page_index->lock); + + return (STORAGE_COLLECT_HANDLE *)handle; } /* The page must be populated and referenced */ static int page_has_only_empty_metrics(struct rrdeng_page_descr *descr) { - unsigned i; - uint8_t has_only_empty_metrics = 1; - storage_number *page; + switch(descr->type) { + case PAGE_METRICS: { + size_t slots = descr->page_length / PAGE_POINT_SIZE_BYTES(descr); + storage_number *array = (storage_number *)descr->pg_cache_descr->page; + for (size_t i = 0 ; i < slots; ++i) { + if(does_storage_number_exist(array[i])) + return 0; + } + } + break; + + case PAGE_TIER: { + size_t slots = descr->page_length / PAGE_POINT_SIZE_BYTES(descr); + storage_number_tier1_t *array = (storage_number_tier1_t *)descr->pg_cache_descr->page; + for (size_t i = 0 ; i < slots; ++i) { + if(fpclassify(array[i].sum_value) != FP_NAN) + return 0; + } + } + break; - page = descr->pg_cache_descr->page; - for (i = 0 ; i < descr->page_length / sizeof(storage_number); ++i) { - if (SN_EMPTY_SLOT != page[i]) { - has_only_empty_metrics = 0; - break; + default: { + static bool logged = false; + if(!logged) { + error("DBENGINE: cannot check page for nulls on unknown page type id %d", descr->type); + logged = true; + } + return 0; } } - return has_only_empty_metrics; + + return 1; } -void rrdeng_store_metric_flush_current_page(RRDDIM *rd) -{ - struct rrdeng_collect_handle *handle; - struct rrdengine_instance *ctx; - struct rrdeng_page_descr *descr; +void rrdeng_store_metric_flush_current_page(STORAGE_COLLECT_HANDLE *collection_handle) { + struct rrdeng_collect_handle *handle = (struct rrdeng_collect_handle *)collection_handle; + // struct rrdeng_metric_handle *metric_handle = (struct rrdeng_metric_handle *)handle->metric_handle; + struct rrdengine_instance *ctx = handle->ctx; + struct rrdeng_page_descr *descr = handle->descr; + + if (unlikely(!ctx)) return; + if (unlikely(!descr)) return; - handle = (struct rrdeng_collect_handle *)rd->state->handle; - ctx = handle->ctx; - if (unlikely(!ctx)) - return; - descr = handle->descr; - if (unlikely(NULL == descr)) { - return; - } if (likely(descr->page_length)) { int page_is_empty; rrd_stat_atomic_add(&ctx->stats.metric_API_producers, -1); - if (handle->prev_descr) { - /* unpin old second page */ - pg_cache_put(ctx, handle->prev_descr); - } page_is_empty = page_has_only_empty_metrics(descr); if (page_is_empty) { debug(D_RRDENGINE, "Page has empty metrics only, deleting:"); @@ -187,41 +232,34 @@ void rrdeng_store_metric_flush_current_page(RRDDIM *rd) print_page_cache_descr(descr); pg_cache_put(ctx, descr); pg_cache_punch_hole(ctx, descr, 1, 0, NULL); - handle->prev_descr = NULL; - } else { - /* - * Disable pinning for now as it leads to deadlocks. When a collector stops collecting the extra pinned page - * eventually gets rotated but it cannot be destroyed due to the extra reference. - */ - /* added 1 extra reference to keep 2 dirty pages pinned per metric, expected refcnt = 2 */ -/* rrdeng_page_descr_mutex_lock(ctx, descr); - ret = pg_cache_try_get_unsafe(descr, 0); - rrdeng_page_descr_mutex_unlock(ctx, descr); - fatal_assert(1 == ret);*/ - + } else rrdeng_commit_page(ctx, descr, handle->page_correlation_id); - /* handle->prev_descr = descr;*/ - } } else { dbengine_page_free(descr->pg_cache_descr->page); rrdeng_destroy_pg_cache_descr(ctx, descr->pg_cache_descr); - freez(descr); + rrdeng_page_descr_freez(descr); } handle->descr = NULL; } -void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number number) +void rrdeng_store_metric_next(STORAGE_COLLECT_HANDLE *collection_handle, + usec_t point_in_time, + NETDATA_DOUBLE n, + NETDATA_DOUBLE min_value, + NETDATA_DOUBLE max_value, + uint16_t count, + uint16_t anomaly_count, + SN_FLAGS flags) { - struct rrdeng_collect_handle *handle = (struct rrdeng_collect_handle *)rd->state->handle; - struct rrdengine_instance *ctx; - struct page_cache *pg_cache; - struct rrdeng_page_descr *descr; - storage_number *page; - uint8_t must_flush_unaligned_page = 0, perfect_page_alignment = 0; + struct rrdeng_collect_handle *handle = (struct rrdeng_collect_handle *)collection_handle; + struct rrdeng_metric_handle *metric_handle = (struct rrdeng_metric_handle *)handle->metric_handle; + struct rrdengine_instance *ctx = handle->ctx; + struct page_cache *pg_cache = &ctx->pg_cache; + struct rrdeng_page_descr *descr = handle->descr; + RRDDIM *rd = metric_handle->rd; - ctx = handle->ctx; - pg_cache = &ctx->pg_cache; - descr = handle->descr; + void *page; + uint8_t must_flush_unaligned_page = 0, perfect_page_alignment = 0; if (descr) { /* Make alignment decisions */ @@ -231,7 +269,7 @@ void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number n perfect_page_alignment = 1; } /* is the metric far enough out of alignment with the others? */ - if (unlikely(descr->page_length + sizeof(number) < rd->rrdset->rrddim_page_alignment)) { + if (unlikely(descr->page_length + PAGE_POINT_SIZE_BYTES(descr) < rd->rrdset->rrddim_page_alignment)) { handle->unaligned_page = 1; debug(D_RRDENGINE, "Metric page is not aligned with chart:"); if (unlikely(debug_flags & D_RRDENGINE)) @@ -239,18 +277,18 @@ void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number n } if (unlikely(handle->unaligned_page && /* did the other metrics change page? */ - rd->rrdset->rrddim_page_alignment <= sizeof(number))) { + rd->rrdset->rrddim_page_alignment <= PAGE_POINT_SIZE_BYTES(descr))) { debug(D_RRDENGINE, "Flushing unaligned metric page."); must_flush_unaligned_page = 1; handle->unaligned_page = 0; } } if (unlikely(NULL == descr || - descr->page_length + sizeof(number) > RRDENG_BLOCK_SIZE || + descr->page_length + PAGE_POINT_SIZE_BYTES(descr) > RRDENG_BLOCK_SIZE || must_flush_unaligned_page)) { - rrdeng_store_metric_flush_current_page(rd); + rrdeng_store_metric_flush_current_page(collection_handle); - page = rrdeng_create_page(ctx, &rd->state->page_index->id, &descr); + page = rrdeng_create_page(ctx, &metric_handle->page_index->id, &descr); fatal_assert(page); handle->descr = descr; @@ -262,9 +300,37 @@ void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number n perfect_page_alignment = 1; } } + page = descr->pg_cache_descr->page; - page[descr->page_length / sizeof(number)] = number; - pg_cache_atomic_set_pg_info(descr, point_in_time, descr->page_length + sizeof(number)); + + switch (descr->type) { + case PAGE_METRICS: { + ((storage_number *)page)[descr->page_length / PAGE_POINT_SIZE_BYTES(descr)] = pack_storage_number(n, flags); + } + break; + + case PAGE_TIER: { + storage_number_tier1_t number_tier1; + number_tier1.sum_value = (float)n; + number_tier1.min_value = (float)min_value; + number_tier1.max_value = (float)max_value; + number_tier1.anomaly_count = anomaly_count; + number_tier1.count = count; + ((storage_number_tier1_t *)page)[descr->page_length / PAGE_POINT_SIZE_BYTES(descr)] = number_tier1; + } + break; + + default: { + static bool logged = false; + if(!logged) { + error("DBENGINE: cannot store metric on unknown page type id %d", descr->type); + logged = true; + } + } + break; + } + + pg_cache_atomic_set_pg_info(descr, point_in_time, descr->page_length + PAGE_POINT_SIZE_BYTES(descr)); if (perfect_page_alignment) rd->rrdset->rrddim_page_alignment = descr->page_length; @@ -284,9 +350,9 @@ void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number n } } - pg_cache_insert(ctx, rd->state->page_index, descr); + pg_cache_insert(ctx, metric_handle->page_index, descr); } else { - pg_cache_add_new_metric_time(rd->state->page_index, descr); + pg_cache_add_new_metric_time(metric_handle->page_index, descr); } } @@ -294,21 +360,14 @@ void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number n * Releases the database reference from the handle for storing metrics. * Returns 1 if it's safe to delete the dimension. */ -int rrdeng_store_metric_finalize(RRDDIM *rd) -{ - struct rrdeng_collect_handle *handle; - struct rrdengine_instance *ctx; - struct pg_cache_page_index *page_index; +int rrdeng_store_metric_finalize(STORAGE_COLLECT_HANDLE *collection_handle) { + struct rrdeng_collect_handle *handle = (struct rrdeng_collect_handle *)collection_handle; + struct rrdeng_metric_handle *metric_handle = (struct rrdeng_metric_handle *)handle->metric_handle; + struct pg_cache_page_index *page_index = metric_handle->page_index; + uint8_t can_delete_metric = 0; - handle = (struct rrdeng_collect_handle *)rd->state->handle; - ctx = handle->ctx; - page_index = rd->state->page_index; - rrdeng_store_metric_flush_current_page(rd); - if (handle->prev_descr) { - /* unpin old second page */ - pg_cache_put(ctx, handle->prev_descr); - } + rrdeng_store_metric_flush_current_page(collection_handle); uv_rwlock_wrlock(&page_index->lock); if (!--page_index->writers && !page_index->page_count) { can_delete_metric = 1; @@ -316,241 +375,55 @@ int rrdeng_store_metric_finalize(RRDDIM *rd) uv_rwlock_wrunlock(&page_index->lock); freez(handle); - return can_delete_metric; -} - -/* Returns 1 if the data collection interval is well defined, 0 otherwise */ -static int metrics_with_known_interval(struct rrdeng_page_descr *descr) -{ - unsigned page_entries; - - if (unlikely(INVALID_TIME == descr->start_time || INVALID_TIME == descr->end_time)) - return 0; - page_entries = descr->page_length / sizeof(storage_number); - if (likely(page_entries > 1)) { - return 1; - } - return 0; -} - -static inline uint32_t *pginfo_to_dt(struct rrdeng_page_info *page_info) -{ - return (uint32_t *)&page_info->scratch[0]; -} - -static inline uint32_t *pginfo_to_points(struct rrdeng_page_info *page_info) -{ - return (uint32_t *)&page_info->scratch[sizeof(uint32_t)]; -} - -/** - * Calculates the regions of different data collection intervals in a netdata chart in the time range - * [start_time,end_time]. This call takes the netdata chart read lock. - * @param st the netdata chart whose data collection interval boundaries are calculated. - * @param start_time inclusive starting time in usec - * @param end_time inclusive ending time in usec - * @param region_info_arrayp It allocates (*region_info_arrayp) and populates it with information of regions of a - * reference dimension that that have different data collection intervals and overlap with the time range - * [start_time,end_time]. The caller must free (*region_info_arrayp) with freez(). If region_info_arrayp is set - * to NULL nothing was allocated. - * @param max_intervalp is dereferenced and set to be the largest data collection interval of all regions. - * @return number of regions with different data collection intervals. - */ -unsigned rrdeng_variable_step_boundaries(RRDSET *st, time_t start_time, time_t end_time, - struct rrdeng_region_info **region_info_arrayp, unsigned *max_intervalp, struct context_param *context_param_list) -{ - struct pg_cache_page_index *page_index; - struct rrdengine_instance *ctx; - unsigned pages_nr; - RRDDIM *rd_iter, *rd; - struct rrdeng_page_info *page_info_array, *curr, *prev, *old_prev; - unsigned i, j, page_entries, region_points, page_points, regions, max_interval; - time_t now; - usec_t dt, current_position_time, max_time = 0, min_time, curr_time, first_valid_time_in_page; - struct rrdeng_region_info *region_info_array; - uint8_t is_first_region_initialized; - - ctx = get_rrdeng_ctx_from_host(st->rrdhost); - regions = 1; - *max_intervalp = max_interval = 0; - region_info_array = NULL; - *region_info_arrayp = NULL; - page_info_array = NULL; - - RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL; - rrdset_rdlock(st); - for(rd_iter = temp_rd?temp_rd:st->dimensions, rd = NULL, min_time = (usec_t)-1 ; rd_iter ; rd_iter = rd_iter->next) { - /* - * Choose oldest dimension as reference. This is not equivalent to the union of all dimensions - * but it is a best effort approximation with a bias towards older metrics in a chart. It - * matches netdata behaviour in the sense that dimensions are generally aligned in a chart - * and older dimensions contain more information about the time range. It does not work well - * for metrics that have recently stopped being collected. - */ - curr_time = pg_cache_oldest_time_in_range(ctx, rd_iter->state->rrdeng_uuid, - start_time * USEC_PER_SEC, end_time * USEC_PER_SEC); - if (INVALID_TIME != curr_time && curr_time < min_time) { - rd = rd_iter; - min_time = curr_time; - } - } - rrdset_unlock(st); - if (NULL == rd) { - return 1; - } - pages_nr = pg_cache_preload(ctx, rd->state->rrdeng_uuid, start_time * USEC_PER_SEC, end_time * USEC_PER_SEC, - &page_info_array, &page_index); - if (pages_nr) { - /* conservative allocation, will reduce the size later if necessary */ - region_info_array = mallocz(sizeof(*region_info_array) * pages_nr); - } - is_first_region_initialized = 0; - region_points = 0; - - int is_out_of_order_reported = 0; - /* pages loop */ - for (i = 0, curr = NULL, prev = NULL ; i < pages_nr ; ++i) { - old_prev = prev; - prev = curr; - curr = &page_info_array[i]; - *pginfo_to_points(curr) = 0; /* initialize to invalid page */ - *pginfo_to_dt(curr) = 0; /* no known data collection interval yet */ - if (unlikely(INVALID_TIME == curr->start_time || INVALID_TIME == curr->end_time || - curr->end_time < curr->start_time)) { - info("Ignoring page with invalid timestamps."); - prev = old_prev; - continue; - } - page_entries = curr->page_length / sizeof(storage_number); - fatal_assert(0 != page_entries); - if (likely(1 != page_entries)) { - dt = (curr->end_time - curr->start_time) / (page_entries - 1); - *pginfo_to_dt(curr) = ROUND_USEC_TO_SEC(dt); - if (unlikely(0 == *pginfo_to_dt(curr))) - *pginfo_to_dt(curr) = 1; - } else { - dt = 0; - } - for (j = 0, page_points = 0 ; j < page_entries ; ++j) { - uint8_t is_metric_out_of_order, is_metric_earlier_than_range; - - is_metric_earlier_than_range = 0; - is_metric_out_of_order = 0; - - current_position_time = curr->start_time + j * dt; - now = current_position_time / USEC_PER_SEC; - if (now > end_time) { /* there will be no more pages in the time range */ - break; - } - if (now < start_time) - is_metric_earlier_than_range = 1; - if (unlikely(current_position_time < max_time)) /* just went back in time */ - is_metric_out_of_order = 1; - if (is_metric_earlier_than_range || unlikely(is_metric_out_of_order)) { - if (unlikely(is_metric_out_of_order)) - is_out_of_order_reported++; - continue; /* next entry */ - } - /* here is a valid metric */ - ++page_points; - region_info_array[regions - 1].points = ++region_points; - max_time = current_position_time; - if (1 == page_points) - first_valid_time_in_page = current_position_time; - if (unlikely(!is_first_region_initialized)) { - fatal_assert(1 == regions); - /* this is the first region */ - region_info_array[0].start_time = current_position_time; - is_first_region_initialized = 1; - } - } - *pginfo_to_points(curr) = page_points; - if (0 == page_points) { - prev = old_prev; - continue; - } - - if (unlikely(0 == *pginfo_to_dt(curr))) { /* unknown data collection interval */ - fatal_assert(1 == page_points); - - if (likely(NULL != prev)) { /* get interval from previous page */ - *pginfo_to_dt(curr) = *pginfo_to_dt(prev); - } else { /* there is no previous page in the query */ - struct rrdeng_page_info db_page_info; - - /* go to database */ - pg_cache_get_filtered_info_prev(ctx, page_index, curr->start_time, - metrics_with_known_interval, &db_page_info); - if (unlikely(db_page_info.start_time == INVALID_TIME || db_page_info.end_time == INVALID_TIME || - 0 == db_page_info.page_length)) { /* nothing in the database, default to update_every */ - *pginfo_to_dt(curr) = rd->update_every; - } else { - unsigned db_entries; - usec_t db_dt; - - db_entries = db_page_info.page_length / sizeof(storage_number); - db_dt = (db_page_info.end_time - db_page_info.start_time) / (db_entries - 1); - *pginfo_to_dt(curr) = ROUND_USEC_TO_SEC(db_dt); - if (unlikely(0 == *pginfo_to_dt(curr))) - *pginfo_to_dt(curr) = 1; - - } - } - } - if (likely(prev) && unlikely(*pginfo_to_dt(curr) != *pginfo_to_dt(prev))) { - info("Data collection interval change detected in query: %"PRIu32" -> %"PRIu32, - *pginfo_to_dt(prev), *pginfo_to_dt(curr)); - region_info_array[regions++ - 1].points -= page_points; - region_info_array[regions - 1].points = region_points = page_points; - region_info_array[regions - 1].start_time = first_valid_time_in_page; - } - if (*pginfo_to_dt(curr) > max_interval) - max_interval = *pginfo_to_dt(curr); - region_info_array[regions - 1].update_every = *pginfo_to_dt(curr); - } - if (page_info_array) - freez(page_info_array); - if (region_info_array) { - if (likely(is_first_region_initialized)) { - /* free unnecessary memory */ - region_info_array = reallocz(region_info_array, sizeof(*region_info_array) * regions); - *region_info_arrayp = region_info_array; - *max_intervalp = max_interval; - } else { - /* empty result */ - freez(region_info_array); - } - } - if (is_out_of_order_reported) - info("Ignored %d metrics with out of order timestamp in %u regions.", is_out_of_order_reported, regions); - return regions; + return can_delete_metric; } +//static inline uint32_t *pginfo_to_dt(struct rrdeng_page_info *page_info) +//{ +// return (uint32_t *)&page_info->scratch[0]; +//} +// +//static inline uint32_t *pginfo_to_points(struct rrdeng_page_info *page_info) +//{ +// return (uint32_t *)&page_info->scratch[sizeof(uint32_t)]; +//} +// /* * Gets a handle for loading metrics from the database. * The handle must be released with rrdeng_load_metric_final(). */ -void rrdeng_load_metric_init(RRDDIM *rd, struct rrddim_query_handle *rrdimm_handle, time_t start_time, time_t end_time) +void rrdeng_load_metric_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *rrdimm_handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type) { + struct rrdeng_metric_handle *metric_handle = (struct rrdeng_metric_handle *)db_metric_handle; + struct rrdengine_instance *ctx = metric_handle->ctx; + RRDDIM *rd = metric_handle->rd; + + // fprintf(stderr, "%s: %s/%s start time %ld, end time %ld\n", __FUNCTION__ , rd->rrdset->name, rd->name, start_time, end_time); + struct rrdeng_query_handle *handle; - struct rrdengine_instance *ctx; unsigned pages_nr; - ctx = get_rrdeng_ctx_from_host(rd->rrdset->rrdhost); rrdimm_handle->start_time = start_time; rrdimm_handle->end_time = end_time; handle = callocz(1, sizeof(struct rrdeng_query_handle)); handle->next_page_time = start_time; handle->now = start_time; + handle->tier_query_fetch_type = tier_query_fetch_type; + // TODO we should store the dt of each page in each page + // this will produce wrong values for dt in case the user changes + // the update every of the charts or the tier grouping iterations + handle->dt_sec = get_tier_grouping(ctx->tier) * (time_t)rd->update_every; + handle->dt = handle->dt_sec * USEC_PER_SEC; handle->position = 0; handle->ctx = ctx; + handle->metric_handle = metric_handle; handle->descr = NULL; rrdimm_handle->handle = (STORAGE_QUERY_HANDLE *)handle; - pages_nr = pg_cache_preload(ctx, rd->state->rrdeng_uuid, start_time * USEC_PER_SEC, end_time * USEC_PER_SEC, + pages_nr = pg_cache_preload(ctx, metric_handle->rrdeng_uuid, start_time * USEC_PER_SEC, end_time * USEC_PER_SEC, NULL, &handle->page_index); if (unlikely(NULL == handle->page_index || 0 == pages_nr)) - /* there are no metrics to load */ + // there are no metrics to load handle->next_page_time = INVALID_TIME; } @@ -595,7 +468,7 @@ static int rrdeng_load_page_next(struct rrddim_query_handle *rrdimm_handle) { if (unlikely(descr->start_time != page_end_time && next_page_time > descr->start_time)) { // we're in the middle of the page somewhere - unsigned entries = page_length / sizeof(storage_number); + unsigned entries = page_length / PAGE_POINT_SIZE_BYTES(descr); position = ((uint64_t)(next_page_time - descr->start_time)) * (entries - 1) / (page_end_time - descr->start_time); } @@ -605,53 +478,101 @@ static int rrdeng_load_page_next(struct rrddim_query_handle *rrdimm_handle) { handle->page_end_time = page_end_time; handle->page_length = page_length; handle->page = descr->pg_cache_descr->page; - usec_t entries = handle->entries = page_length / sizeof(storage_number); + usec_t entries = handle->entries = page_length / PAGE_POINT_SIZE_BYTES(descr); if (likely(entries > 1)) handle->dt = (page_end_time - descr->start_time) / (entries - 1); - else - handle->dt = 0; + else { + // TODO we should store the dt of each page in each page + // now we keep the dt of whatever was before + ; + } - handle->dt_sec = handle->dt / USEC_PER_SEC; + handle->dt_sec = (time_t)(handle->dt / USEC_PER_SEC); handle->position = position; return 0; } -/* Returns the metric and sets its timestamp into current_time */ -storage_number rrdeng_load_metric_next(struct rrddim_query_handle *rrdimm_handle, time_t *current_time) { +// Returns the metric and sets its timestamp into current_time +// IT IS REQUIRED TO **ALWAYS** SET ALL RETURN VALUES (current_time, end_time, flags) +// IT IS REQUIRED TO **ALWAYS** KEEP TRACK OF TIME, EVEN OUTSIDE THE DATABASE BOUNDARIES +STORAGE_POINT rrdeng_load_metric_next(struct rrddim_query_handle *rrdimm_handle) { struct rrdeng_query_handle *handle = (struct rrdeng_query_handle *)rrdimm_handle->handle; + // struct rrdeng_metric_handle *metric_handle = handle->metric_handle; - if (unlikely(INVALID_TIME == handle->next_page_time)) - return SN_EMPTY_SLOT; - + STORAGE_POINT sp; struct rrdeng_page_descr *descr = handle->descr; unsigned position = handle->position + 1; time_t now = handle->now + handle->dt_sec; + storage_number_tier1_t tier1_value; + + if (unlikely(INVALID_TIME == handle->next_page_time)) { + handle->next_page_time = INVALID_TIME; + handle->now = now; + storage_point_empty(sp, now - handle->dt_sec, now); + return sp; + } if (unlikely(!descr || position >= handle->entries)) { // We need to get a new page if(rrdeng_load_page_next(rrdimm_handle)) { // next calls will not load any more metrics handle->next_page_time = INVALID_TIME; - return SN_EMPTY_SLOT; + handle->now = now; + storage_point_empty(sp, now - handle->dt_sec, now); + return sp; } descr = handle->descr; position = handle->position; - now = (descr->start_time + position * handle->dt) / USEC_PER_SEC; + now = (time_t)((descr->start_time + position * handle->dt) / USEC_PER_SEC); } - storage_number ret = handle->page[position]; + sp.start_time = now - handle->dt_sec; + sp.end_time = now; + handle->position = position; handle->now = now; + switch(descr->type) { + case PAGE_METRICS: { + storage_number n = handle->page[position]; + sp.min = sp.max = sp.sum = unpack_storage_number(n); + sp.flags = n & SN_USER_FLAGS; + sp.count = 1; + sp.anomaly_count = is_storage_number_anomalous(n) ? 1 : 0; + } + break; + + case PAGE_TIER: { + tier1_value = ((storage_number_tier1_t *)handle->page)[position]; + sp.flags = tier1_value.anomaly_count ? SN_FLAG_NONE : SN_FLAG_NOT_ANOMALOUS; + sp.count = tier1_value.count; + sp.anomaly_count = tier1_value.anomaly_count; + sp.min = tier1_value.min_value; + sp.max = tier1_value.max_value; + sp.sum = tier1_value.sum_value; + } + break; + + // we don't know this page type + default: { + static bool logged = false; + if(!logged) { + error("DBENGINE: unknown page type %d found. Cannot decode it. Ignoring its metrics.", descr->type); + logged = true; + } + storage_point_empty(sp, sp.start_time, sp.end_time); + } + break; + } + if (unlikely(now >= rrdimm_handle->end_time)) { // next calls will not load any more metrics handle->next_page_time = INVALID_TIME; } - *current_time = now; - return ret; + return sp; } int rrdeng_load_metric_is_finished(struct rrddim_query_handle *rrdimm_handle) @@ -681,31 +602,27 @@ void rrdeng_load_metric_finalize(struct rrddim_query_handle *rrdimm_handle) rrdimm_handle->handle = NULL; } -time_t rrdeng_metric_latest_time(RRDDIM *rd) -{ - struct pg_cache_page_index *page_index; - - page_index = rd->state->page_index; +time_t rrdeng_metric_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle) { + struct rrdeng_metric_handle *metric_handle = (struct rrdeng_metric_handle *)db_metric_handle; + struct pg_cache_page_index *page_index = metric_handle->page_index; return page_index->latest_time / USEC_PER_SEC; } -time_t rrdeng_metric_oldest_time(RRDDIM *rd) -{ - struct pg_cache_page_index *page_index; - - page_index = rd->state->page_index; +time_t rrdeng_metric_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle) { + struct rrdeng_metric_handle *metric_handle = (struct rrdeng_metric_handle *)db_metric_handle; + struct pg_cache_page_index *page_index = metric_handle->page_index; return page_index->oldest_time / USEC_PER_SEC; } -int rrdeng_metric_latest_time_by_uuid(uuid_t *dim_uuid, time_t *first_entry_t, time_t *last_entry_t) +int rrdeng_metric_latest_time_by_uuid(uuid_t *dim_uuid, time_t *first_entry_t, time_t *last_entry_t, int tier) { struct page_cache *pg_cache; struct rrdengine_instance *ctx; Pvoid_t *PValue; struct pg_cache_page_index *page_index = NULL; - ctx = get_rrdeng_ctx_from_host(localhost); + ctx = get_rrdeng_ctx_from_host(localhost, tier); if (unlikely(!ctx)) { error("Failed to fetch multidb context"); return 1; @@ -728,6 +645,36 @@ int rrdeng_metric_latest_time_by_uuid(uuid_t *dim_uuid, time_t *first_entry_t, t return 1; } +int rrdeng_metric_retention_by_uuid(STORAGE_INSTANCE *si, uuid_t *dim_uuid, time_t *first_entry_t, time_t *last_entry_t) +{ + struct page_cache *pg_cache; + struct rrdengine_instance *ctx; + Pvoid_t *PValue; + struct pg_cache_page_index *page_index = NULL; + + ctx = (struct rrdengine_instance *)si; + if (unlikely(!ctx)) { + error("DBENGINE: invalid STORAGE INSTANCE to %s()", __FUNCTION__); + return 1; + } + pg_cache = &ctx->pg_cache; + + uv_rwlock_rdlock(&pg_cache->metrics_index.lock); + PValue = JudyHSGet(pg_cache->metrics_index.JudyHS_array, dim_uuid, sizeof(uuid_t)); + if (likely(NULL != PValue)) { + page_index = *PValue; + } + uv_rwlock_rdunlock(&pg_cache->metrics_index.lock); + + if (likely(page_index)) { + *first_entry_t = page_index->oldest_time / USEC_PER_SEC; + *last_entry_t = page_index->latest_time / USEC_PER_SEC; + return 0; + } + + return 1; +} + /* Also gets a reference for the page */ void *rrdeng_create_page(struct rrdengine_instance *ctx, uuid_t *id, struct rrdeng_page_descr **ret_descr) { @@ -738,6 +685,7 @@ void *rrdeng_create_page(struct rrdengine_instance *ctx, uuid_t *id, struct rrde descr = pg_cache_create_descr(); descr->id = id; /* TODO: add page type: metric, log, something? */ + descr->type = ctx->page_type; page = dbengine_page_alloc(); /*TODO: add page size */ rrdeng_page_descr_mutex_lock(ctx, descr); pg_cache_descr = descr->pg_cache_descr; @@ -901,8 +849,7 @@ void rrdeng_put_page(struct rrdengine_instance *ctx, void *handle) * Returns 0 on success, negative on error */ int rrdeng_init(RRDHOST *host, struct rrdengine_instance **ctxp, char *dbfiles_path, unsigned page_cache_mb, - unsigned disk_space_mb) -{ + unsigned disk_space_mb, int tier) { struct rrdengine_instance *ctx; int error; uint32_t max_open_files; @@ -914,19 +861,23 @@ int rrdeng_init(RRDHOST *host, struct rrdengine_instance **ctxp, char *dbfiles_p if (rrdeng_reserved_file_descriptors > max_open_files) { error( "Exceeded the budget of available file descriptors (%u/%u), cannot create new dbengine instance.", - (unsigned)rrdeng_reserved_file_descriptors, (unsigned)max_open_files); + (unsigned)rrdeng_reserved_file_descriptors, + (unsigned)max_open_files); rrd_stat_atomic_add(&global_fs_errors, 1); rrd_stat_atomic_add(&rrdeng_reserved_file_descriptors, -RRDENG_FD_BUDGET_PER_INSTANCE); return UV_EMFILE; } - if (NULL == ctxp) { - ctx = &multidb_ctx; + if(NULL == ctxp) { + ctx = multidb_ctx[tier]; memset(ctx, 0, sizeof(*ctx)); - } else { + } + else { *ctxp = ctx = callocz(1, sizeof(*ctx)); } + ctx->tier = tier; + ctx->page_type = tier_page_type[tier]; ctx->global_compress_alg = RRD_LZ4; if (page_cache_mb < RRDENG_MIN_PAGE_CACHE_SIZE_MB) page_cache_mb = RRDENG_MIN_PAGE_CACHE_SIZE_MB; @@ -979,9 +930,10 @@ error_after_rrdeng_worker: finalize_rrd_files(ctx); error_after_init_rrd_files: free_page_cache(ctx); - if (ctx != &multidb_ctx) { + if (!is_storage_engine_shared((STORAGE_INSTANCE *)ctx)) { freez(ctx); - *ctxp = NULL; + if (ctxp) + *ctxp = NULL; } rrd_stat_atomic_add(&rrdeng_reserved_file_descriptors, -RRDENG_FD_BUDGET_PER_INSTANCE); return UV_EIO; @@ -1008,9 +960,9 @@ int rrdeng_exit(struct rrdengine_instance *ctx) //metalog_exit(ctx->metalog_ctx); free_page_cache(ctx); - if (ctx != &multidb_ctx) { + if(!is_storage_engine_shared((STORAGE_INSTANCE *)ctx)) freez(ctx); - } + rrd_stat_atomic_add(&rrdeng_reserved_file_descriptors, -RRDENG_FD_BUDGET_PER_INSTANCE); return 0; } @@ -1034,3 +986,107 @@ void rrdeng_prepare_exit(struct rrdengine_instance *ctx) //metalog_prepare_exit(ctx->metalog_ctx); } +RRDENG_SIZE_STATS rrdeng_size_statistics(struct rrdengine_instance *ctx) { + RRDENG_SIZE_STATS stats = { 0 }; + + for(struct pg_cache_page_index *page_index = ctx->pg_cache.metrics_index.last_page_index; + page_index != NULL ;page_index = page_index->prev) { + stats.metrics++; + stats.metrics_pages += page_index->page_count; + } + + for(struct rrdengine_datafile *df = ctx->datafiles.first; df ;df = df->next) { + stats.datafiles++; + + for(struct extent_info *ei = df->extents.first; ei ; ei = ei->next) { + stats.extents++; + stats.extents_compressed_bytes += ei->size; + + for(int p = 0; p < ei->number_of_pages ;p++) { + struct rrdeng_page_descr *descr = ei->pages[p]; + + usec_t update_every_usec; + + size_t points = descr->page_length / PAGE_POINT_SIZE_BYTES(descr); + + if(likely(points > 1)) + update_every_usec = (descr->end_time - descr->start_time) / (points - 1); + else { + update_every_usec = default_rrd_update_every * get_tier_grouping(ctx->tier) * USEC_PER_SEC; + stats.single_point_pages++; + } + + time_t duration_secs = (time_t)((descr->end_time - descr->start_time + update_every_usec)/USEC_PER_SEC); + + stats.extents_pages++; + stats.pages_uncompressed_bytes += descr->page_length; + stats.pages_duration_secs += duration_secs; + stats.points += points; + + stats.page_types[descr->type].pages++; + stats.page_types[descr->type].pages_uncompressed_bytes += descr->page_length; + stats.page_types[descr->type].pages_duration_secs += duration_secs; + stats.page_types[descr->type].points += points; + + if(!stats.first_t || (descr->start_time - update_every_usec) < stats.first_t) + stats.first_t = (descr->start_time - update_every_usec) / USEC_PER_SEC; + + if(!stats.last_t || descr->end_time > stats.last_t) + stats.last_t = descr->end_time / USEC_PER_SEC; + } + } + } + + + stats.currently_collected_metrics = ctx->stats.metric_API_producers; + stats.max_concurrently_collected_metrics = ctx->metric_API_max_producers; + + internal_error(stats.metrics_pages != stats.extents_pages + stats.currently_collected_metrics, + "DBENGINE: metrics pages is %zu, but extents pages is %zu and API consumers is %zu", + stats.metrics_pages, stats.extents_pages, stats.currently_collected_metrics); + + stats.disk_space = ctx->disk_space; + stats.max_disk_space = ctx->max_disk_space; + + stats.database_retention_secs = (time_t)(stats.last_t - stats.first_t); + + if(stats.extents_pages) + stats.average_page_size_bytes = (double)stats.pages_uncompressed_bytes / (double)stats.extents_pages; + + if(stats.pages_uncompressed_bytes > 0) + stats.average_compression_savings = 100.0 - ((double)stats.extents_compressed_bytes * 100.0 / (double)stats.pages_uncompressed_bytes); + + if(stats.points) + stats.average_point_duration_secs = (double)stats.pages_duration_secs / (double)stats.points; + + if(stats.metrics) { + stats.average_metric_retention_secs = (double)stats.pages_duration_secs / (double)stats.metrics; + + if(stats.database_retention_secs) { + double metric_coverage = stats.average_metric_retention_secs / (double)stats.database_retention_secs; + double db_retention_days = (double)stats.database_retention_secs / 86400.0; + + stats.estimated_concurrently_collected_metrics = stats.metrics * metric_coverage; + + stats.ephemeral_metrics_per_day_percent = ((double)stats.metrics * 100.0 / (double)stats.estimated_concurrently_collected_metrics - 100.0) / (double)db_retention_days; + } + } + + stats.sizeof_metric = struct_natural_alignment(sizeof(struct pg_cache_page_index)); + stats.sizeof_page = struct_natural_alignment(sizeof(struct rrdeng_page_descr)); + stats.sizeof_datafile = struct_natural_alignment(sizeof(struct rrdengine_datafile)) + struct_natural_alignment(sizeof(struct rrdengine_journalfile)); + stats.sizeof_page_in_cache = struct_natural_alignment(sizeof(struct page_cache_descr)); + stats.sizeof_point_data = page_type_size[ctx->page_type]; + stats.sizeof_page_data = RRDENG_BLOCK_SIZE; + stats.pages_per_extent = rrdeng_pages_per_extent; + + stats.sizeof_extent = sizeof(struct extent_info); + stats.sizeof_page_in_extent = sizeof(struct rrdeng_page_descr *); + + stats.sizeof_metric_in_index = 40; + stats.sizeof_page_in_index = 24; + + stats.default_granularity_secs = (size_t)default_rrd_update_every * get_tier_grouping(ctx->tier); + + return stats; +} diff --git a/database/engine/rrdengineapi.h b/database/engine/rrdengineapi.h index d263259b6..509aa48ca 100644 --- a/database/engine/rrdengineapi.h +++ b/database/engine/rrdengineapi.h @@ -12,11 +12,17 @@ #define RRDENG_FD_BUDGET_PER_INSTANCE (50) +extern int db_engine_use_malloc; +extern int default_rrdeng_page_fetch_timeout; +extern int default_rrdeng_page_fetch_retries; extern int default_rrdeng_page_cache_mb; extern int default_rrdeng_disk_quota_mb; extern int default_multidb_disk_quota_mb; extern uint8_t rrdeng_drop_metrics_under_page_cache_pressure; -extern struct rrdengine_instance multidb_ctx; +extern struct rrdengine_instance *multidb_ctx[RRD_STORAGE_TIERS]; +extern size_t page_type_size[]; + +#define PAGE_POINT_SIZE_BYTES(x) page_type_size[(x)->type] struct rrdeng_region_info { time_t start_time; @@ -36,29 +42,98 @@ extern void rrdeng_convert_legacy_uuid_to_multihost(char machine_guid[GUID_LEN + uuid_t *ret_uuid); -extern void rrdeng_metric_init(RRDDIM *rd); -extern void rrdeng_store_metric_init(RRDDIM *rd); -extern void rrdeng_store_metric_flush_current_page(RRDDIM *rd); -extern void rrdeng_store_metric_next(RRDDIM *rd, usec_t point_in_time, storage_number number); -extern int rrdeng_store_metric_finalize(RRDDIM *rd); -extern unsigned - rrdeng_variable_step_boundaries(RRDSET *st, time_t start_time, time_t end_time, +extern STORAGE_METRIC_HANDLE *rrdeng_metric_init(RRDDIM *rd, STORAGE_INSTANCE *db_instance); +extern void rrdeng_metric_free(STORAGE_METRIC_HANDLE *db_metric_handle); + +extern STORAGE_COLLECT_HANDLE *rrdeng_store_metric_init(STORAGE_METRIC_HANDLE *db_metric_handle); +extern void rrdeng_store_metric_flush_current_page(STORAGE_COLLECT_HANDLE *collection_handle); +extern void rrdeng_store_metric_next(STORAGE_COLLECT_HANDLE *collection_handle, usec_t point_in_time, NETDATA_DOUBLE n, + NETDATA_DOUBLE min_value, + NETDATA_DOUBLE max_value, + uint16_t count, + uint16_t anomaly_count, + SN_FLAGS flags); +extern int rrdeng_store_metric_finalize(STORAGE_COLLECT_HANDLE *collection_handle); + +extern unsigned rrdeng_variable_step_boundaries(RRDSET *st, time_t start_time, time_t end_time, struct rrdeng_region_info **region_info_arrayp, unsigned *max_intervalp, struct context_param *context_param_list); -extern void rrdeng_load_metric_init(RRDDIM *rd, struct rrddim_query_handle *rrdimm_handle, - time_t start_time, time_t end_time); -extern storage_number rrdeng_load_metric_next(struct rrddim_query_handle *rrdimm_handle, time_t *current_time); + +extern void rrdeng_load_metric_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *rrdimm_handle, + time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type); +extern STORAGE_POINT rrdeng_load_metric_next(struct rrddim_query_handle *rrdimm_handle); + extern int rrdeng_load_metric_is_finished(struct rrddim_query_handle *rrdimm_handle); extern void rrdeng_load_metric_finalize(struct rrddim_query_handle *rrdimm_handle); -extern time_t rrdeng_metric_latest_time(RRDDIM *rd); -extern time_t rrdeng_metric_oldest_time(RRDDIM *rd); +extern time_t rrdeng_metric_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle); +extern time_t rrdeng_metric_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle); + extern void rrdeng_get_37_statistics(struct rrdengine_instance *ctx, unsigned long long *array); /* must call once before using anything */ extern int rrdeng_init(RRDHOST *host, struct rrdengine_instance **ctxp, char *dbfiles_path, unsigned page_cache_mb, - unsigned disk_space_mb); + unsigned disk_space_mb, int tier); extern int rrdeng_exit(struct rrdengine_instance *ctx); extern void rrdeng_prepare_exit(struct rrdengine_instance *ctx); -extern int rrdeng_metric_latest_time_by_uuid(uuid_t *dim_uuid, time_t *first_entry_t, time_t *last_entry_t); +extern int rrdeng_metric_latest_time_by_uuid(uuid_t *dim_uuid, time_t *first_entry_t, time_t *last_entry_t, int tier); +extern int rrdeng_metric_retention_by_uuid(STORAGE_INSTANCE *si, uuid_t *dim_uuid, time_t *first_entry_t, time_t *last_entry_t); + +typedef struct rrdengine_size_statistics { + size_t default_granularity_secs; + + size_t sizeof_metric; + size_t sizeof_metric_in_index; + size_t sizeof_page; + size_t sizeof_page_in_index; + size_t sizeof_extent; + size_t sizeof_page_in_extent; + size_t sizeof_datafile; + size_t sizeof_page_in_cache; + size_t sizeof_point_data; + size_t sizeof_page_data; + + size_t pages_per_extent; + + size_t datafiles; + size_t extents; + size_t extents_pages; + size_t points; + size_t metrics; + size_t metrics_pages; + + size_t extents_compressed_bytes; + size_t pages_uncompressed_bytes; + time_t pages_duration_secs; + + struct { + size_t pages; + size_t pages_uncompressed_bytes; + time_t pages_duration_secs; + size_t points; + } page_types[256]; + + size_t single_point_pages; + + usec_t first_t; + usec_t last_t; + + size_t currently_collected_metrics; + size_t max_concurrently_collected_metrics; + size_t estimated_concurrently_collected_metrics; + + size_t disk_space; + size_t max_disk_space; + + time_t database_retention_secs; + double average_compression_savings; + double average_point_duration_secs; + double average_metric_retention_secs; + + double ephemeral_metrics_per_day_percent; + + double average_page_size_bytes; +} RRDENG_SIZE_STATS; + +extern RRDENG_SIZE_STATS rrdeng_size_statistics(struct rrdengine_instance *ctx); #endif /* NETDATA_RRDENGINEAPI_H */ diff --git a/database/metric_correlations.c b/database/metric_correlations.c deleted file mode 100644 index 3b8968c99..000000000 --- a/database/metric_correlations.c +++ /dev/null @@ -1,300 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#include "daemon/common.h" -#include "KolmogorovSmirnovDist.h" - -#define MAX_POINTS 10000 -int enable_metric_correlations = CONFIG_BOOLEAN_NO; -int metric_correlations_version = 1; - -struct charts { - RRDSET *st; - struct charts *next; -}; - -struct per_dim { - char *dimension; - calculated_number baseline[MAX_POINTS]; - calculated_number highlight[MAX_POINTS]; - - double baseline_diffs[MAX_POINTS]; - double highlight_diffs[MAX_POINTS]; -}; - -int find_index(double arr[], long int n, double K, long int start) -{ - for (long int i = start; i < n; i++) { - if (K rt)) return 1; - return 0; -} - -void kstwo(double data1[], long int n1, double data2[], long int n2, double *d, double *prob) -{ - double en1, en2, en, data_all[MAX_POINTS*2], cdf1[MAX_POINTS], cdf2[MAX_POINTS], cddiffs[MAX_POINTS]; - double min = 0.0, max = 0.0; - qsort(data1, n1, sizeof(double), compare); - qsort(data2, n2, sizeof(double), compare); - - for (int i = 0; i < n1; i++) - data_all[i] = data1[i]; - for (int i = 0; i < n2; i++) - data_all[n1 + i] = data2[i]; - - en1 = (double)n1; - en2 = (double)n2; - *d = 0.0; - cddiffs[0]=0; //for uninitialized warning - - for (int i=0; i 1) min = 1; - - max = fabs(cddiffs[0]); - for ( int i=0;i= max) max = cddiffs[i]; - - if (fabs(min) < max) - *d = max; - else - *d = fabs(min); - - - - en = (en1*en2 / (en1 + en2)); - *prob = KSfbar(round(en), *d); -} - -void fill_nan (struct per_dim *d, long int hp, long int bp) -{ - int k; - - for (k = 0; k < bp; k++) { - if (isnan(d->baseline[k])) { - d->baseline[k] = 0.0; - } - } - - for (k = 0; k < hp; k++) { - if (isnan(d->highlight[k])) { - d->highlight[k] = 0.0; - } - } -} - -//TODO check counters -void run_diffs_and_rev (struct per_dim *d, long int hp, long int bp) -{ - int k, j; - - for (k = 0, j = bp; k < bp - 1; k++, j--) - d->baseline_diffs[k] = (double)d->baseline[j - 2] - (double)d->baseline[j - 1]; - for (k = 0, j = hp; k < hp - 1; k++, j--) { - d->highlight_diffs[k] = (double)d->highlight[j - 2] - (double)d->highlight[j - 1]; - } -} - -int run_metric_correlations (BUFFER *wb, RRDSET *st, long long baseline_after, long long baseline_before, long long highlight_after, long long highlight_before, long long max_points) -{ - uint32_t options = 0x00000000; - int group_method = RRDR_GROUPING_AVERAGE; - long group_time = 0; - struct context_param *context_param_list = NULL; - long c; - int i=0, j=0; - int b_dims = 0; - long int baseline_points = 0, highlight_points = 0; - - struct per_dim *pd = NULL; - - //TODO get everything in one go, when baseline is right before highlight - //get baseline - ONEWAYALLOC *owa = onewayalloc_create(0); - RRDR *rb = rrd2rrdr(owa, st, max_points, baseline_after, baseline_before, group_method, group_time, options, NULL, context_param_list, 0); - if(!rb) { - info("Cannot generate metric correlations output with these parameters on this chart."); - onewayalloc_destroy(owa); - return 0; - } else { - baseline_points = rrdr_rows(rb); - pd = mallocz(sizeof(struct per_dim) * rb->d); - b_dims = rb->d; - for (c = 0; c != rrdr_rows(rb) ; ++c) { - RRDDIM *d; - for (j = 0, d = rb->st->dimensions ; d && j < rb->d ; ++j, d = d->next) { - calculated_number *cn = &rb->v[ c * rb->d ]; - if (!c) { - //TODO use points from query - pd[j].dimension = strdupz (d->name); - pd[j].baseline[c] = cn[j]; - } else { - pd[j].baseline[c] = cn[j]; - } - } - } - } - rrdr_free(owa, rb); - onewayalloc_destroy(owa); - if (!pd) - return 0; - - //get highlight - owa = onewayalloc_create(0); - RRDR *rh = rrd2rrdr(owa, st, max_points, highlight_after, highlight_before, group_method, group_time, options, NULL, context_param_list, 0); - if(!rh) { - info("Cannot generate metric correlations output with these parameters on this chart."); - freez(pd); - onewayalloc_destroy(owa); - return 0; - } else { - if (rh->d != b_dims) { - //TODO handle different dims - rrdr_free(owa, rh); - onewayalloc_destroy(owa); - freez(pd); - return 0; - } - highlight_points = rrdr_rows(rh); - for (c = 0; c != rrdr_rows(rh) ; ++c) { - RRDDIM *d; - for (j = 0, d = rh->st->dimensions ; d && j < rh->d ; ++j, d = d->next) { - calculated_number *cn = &rh->v[ c * rh->d ]; - pd[j].highlight[c] = cn[j]; - } - } - } - rrdr_free(owa, rh); - onewayalloc_destroy(owa); - - for (i = 0; i < b_dims; i++) { - fill_nan(&pd[i], highlight_points, baseline_points); - } - - for (i = 0; i < b_dims; i++) { - run_diffs_and_rev(&pd[i], highlight_points, baseline_points); - } - - double d=0, prob=0; - for (i=0;i < j ;i++) { - if (baseline_points && highlight_points) { - kstwo(pd[i].baseline_diffs, baseline_points-1, pd[i].highlight_diffs, highlight_points-1, &d, &prob); - buffer_sprintf(wb, "\t\t\t\t\"%s\": %f", pd[i].dimension, prob); - if (i != j-1) - buffer_sprintf(wb, ",\n"); - else - buffer_sprintf(wb, "\n"); - } - } - - freez(pd); - return j; -} - -void metric_correlations (RRDHOST *host, BUFFER *wb, long long baseline_after, long long baseline_before, long long highlight_after, long long highlight_before, long long max_points) -{ - info ("Running metric correlations, highlight_after: %lld, highlight_before: %lld, baseline_after: %lld, baseline_before: %lld, max_points: %lld", highlight_after, highlight_before, baseline_after, baseline_before, max_points); - - if (!enable_metric_correlations) { - error("Metric correlations functionality is not enabled."); - buffer_strcat(wb, "{\"error\": \"Metric correlations functionality is not enabled.\" }"); - return; - } - - if (highlight_before <= highlight_after || baseline_before <= baseline_after) { - error("Invalid baseline or highlight ranges."); - buffer_strcat(wb, "{\"error\": \"Invalid baseline or highlight ranges.\" }"); - return; - } - - long long dims = 0, total_dims = 0; - RRDSET *st; - size_t c = 0; - BUFFER *wdims = buffer_create(1000); - - if (!max_points || max_points > MAX_POINTS) - max_points = MAX_POINTS; - - //dont lock here and wait for results - //get the charts and run mc after - //should not be a problem for the query - struct charts *charts = NULL; - rrdhost_rdlock(host); - rrdset_foreach_read(st, host) { - if (rrdset_is_available_for_viewers(st)) { - rrdset_rdlock(st); - struct charts *chart = callocz(1, sizeof(struct charts)); - chart->st = st; - chart->next = NULL; - if (charts) { - chart->next = charts; - } - charts = chart; - } - } - rrdhost_unlock(host); - - buffer_strcat(wb, "{\n\t\"correlated_charts\": {"); - - for (struct charts *ch = charts; ch; ch = ch->next) { - buffer_flush(wdims); - dims = run_metric_correlations(wdims, ch->st, baseline_after, baseline_before, highlight_after, highlight_before, max_points); - if (dims) { - if (c) - buffer_strcat(wb, "\t\t},"); - buffer_strcat(wb, "\n\t\t\""); - buffer_strcat(wb, ch->st->id); - buffer_strcat(wb, "\": {\n"); - buffer_strcat(wb, "\t\t\t\"context\": \""); - buffer_strcat(wb, ch->st->context); - buffer_strcat(wb, "\",\n\t\t\t\"dimensions\": {\n"); - buffer_sprintf(wb, "%s", buffer_tostring(wdims)); - buffer_strcat(wb, "\t\t\t}\n"); - total_dims += dims; - c++; - } - } - buffer_strcat(wb, "\t\t}\n"); - buffer_sprintf(wb, "\t},\n\t\"total_dimensions_count\": %lld\n}", total_dims); - - if (!total_dims) { - buffer_flush(wb); - buffer_strcat(wb, "{\"error\": \"No results from metric correlations.\" }"); - } - - struct charts* ch; - while(charts){ - ch = charts; - charts = charts->next; - rrdset_unlock(ch->st); - free(ch); - } - - buffer_free(wdims); - info ("Done running metric correlations"); -} diff --git a/database/metric_correlations.h b/database/metric_correlations.h deleted file mode 100644 index 83ea9b74d..000000000 --- a/database/metric_correlations.h +++ /dev/null @@ -1,11 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -#ifndef NETDATA_METRIC_CORRELATIONS_H -#define NETDATA_METRIC_CORRELATIONS_H 1 - -extern int enable_metric_correlations; -extern int metric_correlations_version; - -void metric_correlations (RRDHOST *host, BUFFER *wb, long long selected_after, long long selected_before, long long reference_after, long long reference_before, long long max_points); - -#endif //NETDATA_METRIC_CORRELATIONS_H diff --git a/database/ram/Makefile.am b/database/ram/Makefile.am new file mode 100644 index 000000000..59250a997 --- /dev/null +++ b/database/ram/Makefile.am @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +AUTOMAKE_OPTIONS = subdir-objects +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +SUBDIRS = \ + $(NULL) + +dist_noinst_DATA = \ + README.md \ + $(NULL) diff --git a/database/ram/README.md b/database/ram/README.md new file mode 100644 index 000000000..73562f0ff --- /dev/null +++ b/database/ram/README.md @@ -0,0 +1,7 @@ + + +# RAM modes \ No newline at end of file diff --git a/database/ram/rrddim_mem.c b/database/ram/rrddim_mem.c index b17f03ca5..3226d3c0d 100644 --- a/database/ram/rrddim_mem.c +++ b/database/ram/rrddim_mem.c @@ -5,63 +5,218 @@ // ---------------------------------------------------------------------------- // RRDDIM legacy data collection functions -void rrddim_collect_init(RRDDIM *rd) { - rd->values[rd->rrdset->current_entry] = SN_EMPTY_SLOT; - rd->state->handle = calloc(1, sizeof(struct mem_collect_handle)); +STORAGE_METRIC_HANDLE *rrddim_metric_init(RRDDIM *rd, STORAGE_INSTANCE *db_instance __maybe_unused) { + return (STORAGE_METRIC_HANDLE *)rd; } -void rrddim_collect_store_metric(RRDDIM *rd, usec_t point_in_time, storage_number number) { - (void)point_in_time; - rd->values[rd->rrdset->current_entry] = number; + +void rrddim_metric_free(STORAGE_METRIC_HANDLE *db_metric_handle __maybe_unused) { + ; +} + +STORAGE_COLLECT_HANDLE *rrddim_collect_init(STORAGE_METRIC_HANDLE *db_metric_handle) { + RRDDIM *rd = (RRDDIM *)db_metric_handle; + rd->db[rd->rrdset->current_entry] = pack_storage_number(NAN, SN_FLAG_NONE); + struct mem_collect_handle *ch = calloc(1, sizeof(struct mem_collect_handle)); + ch->rd = rd; + return (STORAGE_COLLECT_HANDLE *)ch; +} + +void rrddim_collect_store_metric(STORAGE_COLLECT_HANDLE *collection_handle, usec_t point_in_time, NETDATA_DOUBLE number, + NETDATA_DOUBLE min_value, + NETDATA_DOUBLE max_value, + uint16_t count, + uint16_t anomaly_count, + SN_FLAGS flags) +{ + UNUSED(point_in_time); + UNUSED(min_value); + UNUSED(max_value); + UNUSED(count); + UNUSED(anomaly_count); + + struct mem_collect_handle *ch = (struct mem_collect_handle *)collection_handle; + RRDDIM *rd = ch->rd; + rd->db[rd->rrdset->current_entry] = pack_storage_number(number, flags); +} + +void rrddim_store_metric_flush(STORAGE_COLLECT_HANDLE *collection_handle) { + struct mem_collect_handle *ch = (struct mem_collect_handle *)collection_handle; + RRDDIM *rd = ch->rd; + memset(rd->db, 0, rd->entries * sizeof(storage_number)); } -int rrddim_collect_finalize(RRDDIM *rd) { - free((struct mem_collect_handle*)rd->state->handle); + +int rrddim_collect_finalize(STORAGE_COLLECT_HANDLE *collection_handle) { + free(collection_handle); return 0; } +// ---------------------------------------------------------------------------- + +// get the total duration in seconds of the round robin database +#define rrddim_duration(st) (( (time_t)(rd)->rrdset->counter >= (time_t)(rd)->rrdset->entries ? (time_t)(rd)->rrdset->entries : (time_t)(rd)->rrdset->counter ) * (time_t)(rd)->rrdset->update_every) + +// get the last slot updated in the round robin database +#define rrddim_last_slot(rd) ((size_t)(((rd)->rrdset->current_entry == 0) ? (rd)->rrdset->entries - 1 : (rd)->rrdset->current_entry - 1)) + +// return the slot that has the oldest value +#define rrddim_first_slot(rd) ((size_t)((rd)->rrdset->counter >= (size_t)(rd)->rrdset->entries ? (rd)->rrdset->current_entry : 0)) + +// get the slot of the round robin database, for the given timestamp (t) +// it always returns a valid slot, although may not be for the time requested if the time is outside the round robin database +// only valid when not using dbengine +static inline size_t rrddim_time2slot(RRDDIM *rd, time_t t) { + size_t ret = 0; + time_t last_entry_t = rrddim_query_latest_time((STORAGE_METRIC_HANDLE *)rd); + time_t first_entry_t = rrddim_query_oldest_time((STORAGE_METRIC_HANDLE *)rd); + size_t entries = rd->rrdset->entries; + size_t first_slot = rrddim_first_slot(rd); + size_t last_slot = rrddim_last_slot(rd); + size_t update_every = rd->rrdset->update_every; + + if(t >= last_entry_t) { + // the requested time is after the last entry we have + ret = last_slot; + } + else { + if(t <= first_entry_t) { + // the requested time is before the first entry we have + ret = first_slot; + } + else { + if(last_slot >= (size_t)((last_entry_t - t) / update_every)) + ret = last_slot - ((last_entry_t - t) / update_every); + else + ret = last_slot - ((last_entry_t - t) / update_every) + entries; + } + } + + if(unlikely(ret >= entries)) { + error("INTERNAL ERROR: rrddim_time2slot() on %s returns values outside entries", rd->name); + ret = entries - 1; + } + + return ret; +} + +// get the timestamp of a specific slot in the round robin database +// only valid when not using dbengine +static inline time_t rrddim_slot2time(RRDDIM *rd, size_t slot) { + time_t ret; + time_t last_entry_t = rrddim_query_latest_time((STORAGE_METRIC_HANDLE *)rd); + time_t first_entry_t = rrddim_query_oldest_time((STORAGE_METRIC_HANDLE *)rd); + size_t entries = rd->rrdset->entries; + size_t last_slot = rrddim_last_slot(rd); + size_t update_every = rd->rrdset->update_every; + + if(slot >= entries) { + error("INTERNAL ERROR: caller of rrddim_slot2time() gives invalid slot %zu", slot); + slot = entries - 1; + } + + if(slot > last_slot) + ret = last_entry_t - (time_t)(update_every * (last_slot - slot + entries)); + else + ret = last_entry_t - (time_t)(update_every * (last_slot - slot)); + + if(unlikely(ret < first_entry_t)) { + error("INTERNAL ERROR: rrddim_slot2time() on %s returns time too far in the past", rd->name); + ret = first_entry_t; + } + + if(unlikely(ret > last_entry_t)) { + error("INTERNAL ERROR: rrddim_slot2time() on %s returns time into the future", rd->name); + ret = last_entry_t; + } + + return ret; +} + // ---------------------------------------------------------------------------- // RRDDIM legacy database query functions -void rrddim_query_init(RRDDIM *rd, struct rrddim_query_handle *handle, time_t start_time, time_t end_time) { +void rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type) { + UNUSED(tier_query_fetch_type); + + RRDDIM *rd = (RRDDIM *)db_metric_handle; + handle->rd = rd; handle->start_time = start_time; handle->end_time = end_time; struct mem_query_handle* h = calloc(1, sizeof(struct mem_query_handle)); - h->slot = rrdset_time2slot(rd->rrdset, start_time); - h->last_slot = rrdset_time2slot(rd->rrdset, end_time); - h->finished = 0; + h->slot = rrddim_time2slot(rd, start_time); + h->last_slot = rrddim_time2slot(rd, end_time); + h->dt = rd->rrdset->update_every; + + h->next_timestamp = start_time; + h->slot_timestamp = rrddim_slot2time(rd, h->slot); + h->last_timestamp = rrddim_slot2time(rd, h->last_slot); + + // info("RRDDIM QUERY INIT: start %ld, end %ld, next %ld, first %ld, last %ld, dt %ld", start_time, end_time, h->next_timestamp, h->slot_timestamp, h->last_timestamp, h->dt); + handle->handle = (STORAGE_QUERY_HANDLE *)h; } -storage_number rrddim_query_next_metric(struct rrddim_query_handle *handle, time_t *current_time) { +// Returns the metric and sets its timestamp into current_time +// IT IS REQUIRED TO **ALWAYS** SET ALL RETURN VALUES (current_time, end_time, flags) +// IT IS REQUIRED TO **ALWAYS** KEEP TRACK OF TIME, EVEN OUTSIDE THE DATABASE BOUNDARIES +STORAGE_POINT rrddim_query_next_metric(struct rrddim_query_handle *handle) { RRDDIM *rd = handle->rd; struct mem_query_handle* h = (struct mem_query_handle*)handle->handle; - long entries = rd->rrdset->entries; - long slot = h->slot; + size_t entries = rd->rrdset->entries; + size_t slot = h->slot; + + STORAGE_POINT sp; + sp.count = 1; + + time_t this_timestamp = h->next_timestamp; + h->next_timestamp += h->dt; - (void)current_time; - if (unlikely(h->slot == h->last_slot)) - h->finished = 1; - storage_number n = rd->values[slot++]; + // set this timestamp for our caller + sp.start_time = this_timestamp - h->dt; + sp.end_time = this_timestamp; + if(unlikely(this_timestamp < h->slot_timestamp)) { + storage_point_empty(sp, sp.start_time, sp.end_time); + return sp; + } + + if(unlikely(this_timestamp > h->last_timestamp)) { + storage_point_empty(sp, sp.start_time, sp.end_time); + return sp; + } + + storage_number n = rd->db[slot++]; if(unlikely(slot >= entries)) slot = 0; + h->slot = slot; + h->slot_timestamp += h->dt; + + sp.anomaly_count = is_storage_number_anomalous(n) ? 1 : 0; + sp.flags = (n & SN_USER_FLAGS); + sp.min = sp.max = sp.sum = unpack_storage_number(n); - return n; + return sp; } int rrddim_query_is_finished(struct rrddim_query_handle *handle) { struct mem_query_handle* h = (struct mem_query_handle*)handle->handle; - return h->finished; + return (h->next_timestamp > handle->end_time); } void rrddim_query_finalize(struct rrddim_query_handle *handle) { +#ifdef NETDATA_INTERNAL_CHECKS + if(!rrddim_query_is_finished(handle)) + error("QUERY: query for chart '%s' dimension '%s' has been stopped unfinished", handle->rd->rrdset->id, handle->rd->name); +#endif freez(handle->handle); } -time_t rrddim_query_latest_time(RRDDIM *rd) { - return rrdset_last_entry_t_nolock(rd->rrdset); +time_t rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle) { + RRDDIM *rd = (RRDDIM *)db_metric_handle; + return rd->rrdset->last_updated.tv_sec; } -time_t rrddim_query_oldest_time(RRDDIM *rd) { - return rrdset_first_entry_t_nolock(rd->rrdset); +time_t rrddim_query_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle) { + RRDDIM *rd = (RRDDIM *)db_metric_handle; + return (time_t)(rd->rrdset->last_updated.tv_sec - rrddim_duration(rd)); } diff --git a/database/ram/rrddim_mem.h b/database/ram/rrddim_mem.h index 9a215387a..400bdd0c2 100644 --- a/database/ram/rrddim_mem.h +++ b/database/ram/rrddim_mem.h @@ -6,24 +6,38 @@ #include "database/rrd.h" struct mem_collect_handle { + RRDDIM *rd; long slot; long entries; }; + struct mem_query_handle { - long slot; - long last_slot; - uint8_t finished; + time_t dt; + time_t next_timestamp; + time_t last_timestamp; + time_t slot_timestamp; + size_t slot; + size_t last_slot; }; -extern void rrddim_collect_init(RRDDIM *rd); -extern void rrddim_collect_store_metric(RRDDIM *rd, usec_t point_in_time, storage_number number); -extern int rrddim_collect_finalize(RRDDIM *rd); +extern STORAGE_METRIC_HANDLE *rrddim_metric_init(RRDDIM *rd, STORAGE_INSTANCE *db_instance); +extern void rrddim_metric_free(STORAGE_METRIC_HANDLE *db_metric_handle); + +extern STORAGE_COLLECT_HANDLE *rrddim_collect_init(STORAGE_METRIC_HANDLE *db_metric_handle); +extern void rrddim_collect_store_metric(STORAGE_COLLECT_HANDLE *collection_handle, usec_t point_in_time, NETDATA_DOUBLE number, + NETDATA_DOUBLE min_value, + NETDATA_DOUBLE max_value, + uint16_t count, + uint16_t anomaly_count, + SN_FLAGS flags); +extern void rrddim_store_metric_flush(STORAGE_COLLECT_HANDLE *collection_handle); +extern int rrddim_collect_finalize(STORAGE_COLLECT_HANDLE *collection_handle); -extern void rrddim_query_init(RRDDIM *rd, struct rrddim_query_handle *handle, time_t start_time, time_t end_time); -extern storage_number rrddim_query_next_metric(struct rrddim_query_handle *handle, time_t *current_time); +extern void rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type); +extern STORAGE_POINT rrddim_query_next_metric(struct rrddim_query_handle *handle); extern int rrddim_query_is_finished(struct rrddim_query_handle *handle); extern void rrddim_query_finalize(struct rrddim_query_handle *handle); -extern time_t rrddim_query_latest_time(RRDDIM *rd); -extern time_t rrddim_query_oldest_time(RRDDIM *rd); +extern time_t rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle); +extern time_t rrddim_query_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle); #endif diff --git a/database/rrd.h b/database/rrd.h index dc32b2a2d..605ff50bc 100644 --- a/database/rrd.h +++ b/database/rrd.h @@ -3,6 +3,15 @@ #ifndef NETDATA_RRD_H #define NETDATA_RRD_H 1 +#ifdef __cplusplus +extern "C" { +#endif + +// non-existing structs instead of voids +// to enable type checking at compile time +typedef struct storage_instance STORAGE_INSTANCE; +typedef struct storage_metric_handle STORAGE_METRIC_HANDLE; + // forward typedefs typedef struct rrdhost RRDHOST; typedef struct rrddim RRDDIM; @@ -19,10 +28,10 @@ typedef void *ml_host_t; typedef void *ml_dimension_t; // forward declarations -struct rrddim_volatile; +struct rrddim_tier; struct rrdset_volatile; struct context_param; -struct label; + #ifdef ENABLE_DBENGINE struct rrdeng_page_descr; struct rrdengine_instance; @@ -31,6 +40,7 @@ struct pg_cache_page_index; #include "daemon/common.h" #include "web/api/queries/query.h" +#include "web/api/queries/rrdr.h" #include "rrdvar.h" #include "rrdsetvar.h" #include "rrddimvar.h" @@ -39,6 +49,18 @@ struct pg_cache_page_index; #include "streaming/rrdpush.h" #include "aclk/aclk_rrdhost_state.h" #include "sqlite/sqlite_health.h" +#include "rrdcontext.h" + +extern int storage_tiers; +extern int storage_tiers_grouping_iterations[RRD_STORAGE_TIERS]; + +typedef enum { + RRD_BACKFILL_NONE, + RRD_BACKFILL_FULL, + RRD_BACKFILL_NEW +} RRD_BACKFILL; + +extern RRD_BACKFILL storage_tiers_backfill[RRD_STORAGE_TIERS]; enum { CONTEXT_FLAGS_ARCHIVE = 0x01, @@ -71,9 +93,6 @@ extern time_t rrdset_free_obsolete_time; #define RRD_ID_LENGTH_MAX 200 -#define RRDSET_MAGIC "NETDATA RRD SET FILE V019" -#define RRDDIMENSION_MAGIC "NETDATA RRD DIMENSION FILE V019" - typedef long long total_number; #define TOTAL_NUMBER_FORMAT "%lld" @@ -177,66 +196,48 @@ typedef enum rrddim_flags { #define rrddim_flag_set(rd, flag) __atomic_or_fetch(&((rd)->flags), (flag), __ATOMIC_SEQ_CST) #define rrddim_flag_clear(rd, flag) __atomic_and_fetch(&((rd)->flags), ~(flag), __ATOMIC_SEQ_CST) -typedef enum label_source { - LABEL_SOURCE_AUTO = 0, - LABEL_SOURCE_NETDATA_CONF = 1, - LABEL_SOURCE_DOCKER = 2, - LABEL_SOURCE_ENVIRONMENT = 3, - LABEL_SOURCE_KUBERNETES = 4 -} LABEL_SOURCE; - -#define LABEL_FLAG_UPDATE_STREAM 1 -#define LABEL_FLAG_STOP_STREAM 2 - -struct label { - char *key, *value; - uint32_t key_hash; - LABEL_SOURCE label_source; - struct label *next; -}; +typedef enum rrdlabel_source { + RRDLABEL_SRC_AUTO = (1 << 0), // set when Netdata found the label by some automation + RRDLABEL_SRC_CONFIG = (1 << 1), // set when the user configured the label + RRDLABEL_SRC_K8S = (1 << 2), // set when this label is found from k8s (RRDLABEL_SRC_AUTO should also be set) + RRDLABEL_SRC_ACLK = (1 << 3), // set when this label is found from ACLK (RRDLABEL_SRC_AUTO should also be set) -struct label_index { - struct label *head; // Label list - netdata_rwlock_t labels_rwlock; // lock for the label list - uint32_t labels_flag; // Flags for labels -}; + // more sources can be added here + + RRDLABEL_FLAG_PERMANENT = (1 << 29), // set when this label should never be removed (can be overwritten though) + RRDLABEL_FLAG_OLD = (1 << 30), // marks for rrdlabels internal use - they are not exposed outside rrdlabels + RRDLABEL_FLAG_NEW = (1 << 31) // marks for rrdlabels internal use - they are not exposed outside rrdlabels +} RRDLABEL_SRC; + +#define RRDLABEL_FLAG_INTERNAL (RRDLABEL_FLAG_OLD | RRDLABEL_FLAG_NEW | RRDLABEL_FLAG_PERMANENT) + +extern DICTIONARY *rrdlabels_create(void); +extern void rrdlabels_destroy(DICTIONARY *labels_dict); +extern void rrdlabels_add(DICTIONARY *dict, const char *name, const char *value, RRDLABEL_SRC ls); +extern void rrdlabels_add_pair(DICTIONARY *dict, const char *string, RRDLABEL_SRC ls); +extern void rrdlabels_get_value_to_buffer_or_null(DICTIONARY *labels, BUFFER *wb, const char *key, const char *quote, const char *null); + +extern void rrdlabels_unmark_all(DICTIONARY *labels); +extern void rrdlabels_remove_all_unmarked(DICTIONARY *labels); + +extern int rrdlabels_walkthrough_read(DICTIONARY *labels, int (*callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data), void *data); +extern int rrdlabels_sorted_walkthrough_read(DICTIONARY *labels, int (*callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data), void *data); + +extern void rrdlabels_log_to_buffer(DICTIONARY *labels, BUFFER *wb); +extern bool rrdlabels_match_simple_pattern(DICTIONARY *labels, const char *simple_pattern_txt); +extern bool rrdlabels_match_simple_pattern_parsed(DICTIONARY *labels, SIMPLE_PATTERN *pattern, char equal); +extern int rrdlabels_to_buffer(DICTIONARY *labels, BUFFER *wb, const char *before_each, const char *equal, const char *quote, const char *between_them, bool (*filter_callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data), void *filter_data, void (*name_sanitizer)(char *dst, const char *src, size_t dst_size), void (*value_sanitizer)(char *dst, const char *src, size_t dst_size)); + +extern void rrdlabels_migrate_to_these(DICTIONARY *dst, DICTIONARY *src); +extern void rrdlabels_copy(DICTIONARY *dst, DICTIONARY *src); -typedef enum strip_quotes { - DO_NOT_STRIP_QUOTES, - STRIP_QUOTES -} STRIP_QUOTES_OPTION; - -typedef enum skip_escaped_characters { - DO_NOT_SKIP_ESCAPED_CHARACTERS, - SKIP_ESCAPED_CHARACTERS -} SKIP_ESCAPED_CHARACTERS_OPTION; - -char *translate_label_source(LABEL_SOURCE l); -struct label *create_label(char *key, char *value, LABEL_SOURCE label_source); -extern struct label *add_label_to_list(struct label *l, char *key, char *value, LABEL_SOURCE label_source); -extern void update_label_list(struct label **labels, struct label *new_labels); -extern void replace_label_list(struct label_index *labels, struct label *new_labels); -extern int is_valid_label_value(char *value); -extern int is_valid_label_key(char *key); -extern void free_label_list(struct label *labels); -extern struct label *label_list_lookup_key(struct label *head, char *key, uint32_t key_hash); -extern struct label *label_list_lookup_keylist(struct label *head, char *keylist); -extern int label_list_contains_keylist(struct label *head, char *keylist); -extern int label_list_contains_key(struct label *head, char *key, uint32_t key_hash); -extern int label_list_contains(struct label *head, struct label *check); -extern struct label *merge_label_lists(struct label *lo_pri, struct label *hi_pri); -extern void strip_last_symbol( - char *str, - char symbol, - SKIP_ESCAPED_CHARACTERS_OPTION skip_escaped_characters); -extern char *strip_double_quotes(char *str, SKIP_ESCAPED_CHARACTERS_OPTION skip_escaped_characters); void reload_host_labels(void); -extern void rrdset_add_label_to_new_list(RRDSET *st, char *key, char *value, LABEL_SOURCE source); -extern void rrdset_finalize_labels(RRDSET *st); -extern void rrdset_update_labels(RRDSET *st, struct label *labels); -extern int rrdset_contains_label_keylist(RRDSET *st, char *key); -extern int rrdset_matches_label_keys(RRDSET *st, char *key, char *words[], uint32_t *hash_key_list, int *word_count, int size); -extern struct label *rrdset_lookup_label_key(RRDSET *st, char *key, uint32_t key_hash); +extern void rrdset_update_rrdlabels(RRDSET *st, DICTIONARY *new_rrdlabels); + +extern int rrdlabels_unittest(void); + +// unfortunately this break when defined in exporting_engine.h +extern bool exporting_labels_filter_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data); // ---------------------------------------------------------------------------- // RRD DIMENSION - this is a metric @@ -247,6 +248,8 @@ struct rrddim { avl_t avl; // the binary index - this has to be first member! + uuid_t metric_uuid; // global UUID for this metric (unique_across hosts) + // ------------------------------------------------------------------------ // the dimension definition @@ -255,55 +258,54 @@ struct rrddim { // this is a pointer to the config structure // since the config always has a higher priority // (the user overwrites the name of the charts) - // DO NOT FREE THIS - IT IS ALLOCATED IN CONFIG + uint32_t hash; // a simple hash of the id, to speed up searching / indexing + // instead of strcmp() every item in the binary index + // we first compare the hashes + uint32_t hash_name; // a simple hash of the name + RRD_ALGORITHM algorithm; // the algorithm that is applied to add new collected values RRD_MEMORY_MODE rrd_memory_mode; // the memory mode for this dimension + RRDDIM_FLAGS flags; // configuration flags for the dimension + + bool updated; // 1 when the dimension has been updated since the last processing + bool exposed; // 1 when set what have sent this dimension to the central netdata collected_number multiplier; // the multiplier of the collected values collected_number divisor; // the divider of the collected values - uint32_t flags; // configuration flags for the dimension - // ------------------------------------------------------------------------ // members for temporary data we need for calculations - uint32_t hash; // a simple hash of the id, to speed up searching / indexing - // instead of strcmp() every item in the binary index - // we first compare the hashes - - uint32_t hash_name; // a simple hash of the name - - char *cache_filename; // the filename we load/save from/to this set - - size_t collections_counter; // the number of times we added values to this rrdim - struct rrddim_volatile *state; // volatile state that is not persistently stored - size_t unused[8]; - - collected_number collected_value_max; // the absolute maximum of the collected value - - unsigned int updated:1; // 1 when the dimension has been updated since the last processing - unsigned int exposed:1; // 1 when set what have sent this dimension to the central netdata - struct timeval last_collected_time; // when was this dimension last updated // this is actual date time we updated the last_collected_value // THIS IS DIFFERENT FROM THE SAME MEMBER OF RRDSET - calculated_number calculated_value; // the current calculated value, after applying the algorithm - resets to zero after being used - calculated_number last_calculated_value; // the last calculated value processed +#ifdef ENABLE_ACLK + int aclk_live_status; +#endif + ml_dimension_t ml_dimension; + + struct rrddim_tier *tiers[RRD_STORAGE_TIERS]; // our tiers of databases + + size_t collections_counter; // the number of times we added values to this rrddim + collected_number collected_value_max; // the absolute maximum of the collected value - calculated_number last_stored_value; // the last value as stored in the database (after interpolation) + NETDATA_DOUBLE calculated_value; // the current calculated value, after applying the algorithm - resets to zero after being used + NETDATA_DOUBLE last_calculated_value; // the last calculated value processed + NETDATA_DOUBLE last_stored_value; // the last value as stored in the database (after interpolation) collected_number collected_value; // the current value, as collected - resets to 0 after being used collected_number last_collected_value; // the last value that was collected, after being processed // the *_volume members are used to calculate the accuracy of the rounding done by the // storage number - they are printed to debug.log when debug is enabled for a set. - calculated_number collected_volume; // the sum of all collected values so far - calculated_number stored_volume; // the sum of all stored values so far + NETDATA_DOUBLE collected_volume; // the sum of all collected values so far + NETDATA_DOUBLE stored_volume; // the sum of all stored values so far struct rrddim *next; // linking of dimensions within the same data set struct rrdset *rrdset; + RRDMETRIC_ACQUIRED *rrdmetric; // the rrdmetric of this dimension // ------------------------------------------------------------------------ // members for checking the data when loading from disk @@ -314,18 +316,33 @@ struct rrddim { int update_every; // every how many seconds is this updated - size_t memsize; // the memory allocated for this dimension - - char magic[sizeof(RRDDIMENSION_MAGIC) + 1]; // a string to be saved, used to identify our data file + size_t memsize; // the memory allocated for this dimension (without RRDDIM) struct rrddimvar *variables; // ------------------------------------------------------------------------ // the values stored in this dimension, using our floating point numbers - storage_number values[]; // the array of values - THIS HAS TO BE THE LAST MEMBER + void *rd_on_file; // pointer to the header written on disk + storage_number *db; // the array of values }; +// returns the RRDDIM cache filename, or NULL if it does not exist +extern const char *rrddim_cache_filename(RRDDIM *rd); + +// updated the header with the latest RRDDIM value, for memory mode MAP and SAVE +extern void rrddim_memory_file_update(RRDDIM *rd); + +// free the memory file structures for memory mode MAP and SAVE +extern void rrddim_memory_file_free(RRDDIM *rd); + +extern bool rrddim_memory_load_or_create_map_save(RRDSET *st, RRDDIM *rd, RRD_MEMORY_MODE memory_mode); + +// return the v019 header size of RRDDIM files +extern size_t rrddim_memory_file_header_size(void); + +extern void rrddim_memory_file_save(RRDDIM *rd); + // ---------------------------------------------------------------------------- // engine-specific iterator state for dimension data collection typedef struct storage_collect_handle STORAGE_COLLECT_HANDLE; @@ -340,30 +357,71 @@ struct rrddim_query_handle { RRDDIM *rd; time_t start_time; time_t end_time; + TIER_QUERY_FETCH tier_query_fetch_type; STORAGE_QUERY_HANDLE* handle; }; +typedef struct storage_point { + NETDATA_DOUBLE min; // when count > 1, this is the minimum among them + NETDATA_DOUBLE max; // when count > 1, this is the maximum among them + NETDATA_DOUBLE sum; // the point sum - divided by count gives the average + + // end_time - start_time = point duration + time_t start_time; // the time the point starts + time_t end_time; // the time the point ends + + unsigned count; // the number of original points aggregated + unsigned anomaly_count; // the number of original points found anomalous + + SN_FLAGS flags; // flags stored with the point +} STORAGE_POINT; + +#define storage_point_unset(x) do { \ + (x).min = (x).max = (x).sum = NAN; \ + (x).count = 0; \ + (x).anomaly_count = 0; \ + (x).flags = SN_FLAG_NONE; \ + (x).start_time = 0; \ + (x).end_time = 0; \ + } while(0) + +#define storage_point_empty(x, start_t, end_t) do { \ + (x).min = (x).max = (x).sum = NAN; \ + (x).count = 1; \ + (x).anomaly_count = 0; \ + (x).flags = SN_FLAG_NONE; \ + (x).start_time = start_t; \ + (x).end_time = end_t; \ + } while(0) + +#define storage_point_is_unset(x) (!(x).count) +#define storage_point_is_empty(x) (!netdata_double_isnumber((x).sum)) + // ------------------------------------------------------------------------ // function pointers that handle data collection struct rrddim_collect_ops { // an initialization function to run before starting collection - void (*init)(RRDDIM *rd); + STORAGE_COLLECT_HANDLE *(*init)(STORAGE_METRIC_HANDLE *db_metric_handle); // run this to store each metric into the database - void (*store_metric)(RRDDIM *rd, usec_t point_in_time, storage_number number); + void (*store_metric)(STORAGE_COLLECT_HANDLE *collection_handle, usec_t point_in_time, NETDATA_DOUBLE number, NETDATA_DOUBLE min_value, + NETDATA_DOUBLE max_value, uint16_t count, uint16_t anomaly_count, SN_FLAGS flags); + + // run this to flush / reset the current data collection sequence + void (*flush)(STORAGE_COLLECT_HANDLE *collection_handle); // an finalization function to run after collection is over // returns 1 if it's safe to delete the dimension - int (*finalize)(RRDDIM *rd); + int (*finalize)(STORAGE_COLLECT_HANDLE *collection_handle); }; // function pointers that handle database queries struct rrddim_query_ops { // run this before starting a series of next_metric() database queries - void (*init)(RRDDIM *rd, struct rrddim_query_handle *handle, time_t start_time, time_t end_time); + void (*init)(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type); // run this to load each metric number from the database - storage_number (*next_metric)(struct rrddim_query_handle *handle, time_t *current_time); + STORAGE_POINT (*next_metric)(struct rrddim_query_handle *handle); // run this to test if the series of next_metric() database queries is finished int (*is_finished)(struct rrddim_query_handle *handle); @@ -372,29 +430,31 @@ struct rrddim_query_ops { void (*finalize)(struct rrddim_query_handle *handle); // get the timestamp of the last entry of this metric - time_t (*latest_time)(RRDDIM *rd); + time_t (*latest_time)(STORAGE_METRIC_HANDLE *db_metric_handle); // get the timestamp of the first entry of this metric - time_t (*oldest_time)(RRDDIM *rd); + time_t (*oldest_time)(STORAGE_METRIC_HANDLE *db_metric_handle); }; + // ---------------------------------------------------------------------------- -// volatile state per RRD dimension -struct rrddim_volatile { -#ifdef ENABLE_DBENGINE - uuid_t *rrdeng_uuid; // database engine metric UUID - struct pg_cache_page_index *page_index; -#endif -#ifdef ENABLE_ACLK - int aclk_live_status; -#endif - uuid_t metric_uuid; // global UUID for this metric (unique_across hosts) - STORAGE_COLLECT_HANDLE* handle; +// Storage tier data for every dimension + +struct rrddim_tier { + int tier_grouping; + RRD_MEMORY_MODE mode; // the memory mode of this tier + RRD_BACKFILL backfill; // backfilling configuration + STORAGE_METRIC_HANDLE *db_metric_handle; // the metric handle inside the database + STORAGE_COLLECT_HANDLE *db_collection_handle; // the data collection handle + STORAGE_POINT virtual_point; + time_t next_point_time; + usec_t last_collected_ut; struct rrddim_collect_ops collect_ops; struct rrddim_query_ops query_ops; - ml_dimension_t ml_dimension; }; +extern void rrdr_fill_tier_gap_from_smaller_tiers(RRDDIM *rd, int tier, time_t now); + // ---------------------------------------------------------------------------- // volatile state per chart struct rrdset_volatile { @@ -402,8 +462,7 @@ struct rrdset_volatile { char *old_units; char *old_context; uuid_t hash_id; - struct label *new_labels; - struct label_index labels; + DICTIONARY *chart_labels; bool is_ar_chart; }; @@ -469,8 +528,6 @@ struct rrdset { // since the config always has a higher priority // (the user overwrites the name of the charts) - void *unused_ptr; // Unused field (previously it held the config section of the chart) - char *type; // the type of graph RRD_TYPE_* (a category, for determining graphing options) char *family; // grouping sets under the same family char *title; // title shown to user @@ -479,6 +536,9 @@ struct rrdset { char *context; // the template of this data set uint32_t hash_context; // the hash of the chart's context + RRDINSTANCE_ACQUIRED *rrdinstance; // the rrdinstance of this chart + RRDCONTEXT_ACQUIRED *rrdcontext; // the rrdcontext this chart belongs to + RRDSET_TYPE chart_type; // line, area, stacked int update_every; // every how many seconds is this updated? @@ -503,7 +563,6 @@ struct rrdset { RRD_MEMORY_MODE rrd_memory_mode; // if set to 1, this is memory mapped char *cache_dir; // the directory to store dimensions - char cache_filename[FILENAME_MAX+1]; // the filename to store this set netdata_rwlock_t rrdset_rwlock; // protects dimensions linked list @@ -521,7 +580,6 @@ struct rrdset { uuid_t *chart_uuid; // Store the global GUID for this chart // this object. struct rrdset_volatile *state; // volatile state that is not persistently stored - size_t unused[3]; size_t rrddim_page_alignment; // keeps metric pages in alignment when using dbengine @@ -546,8 +604,8 @@ struct rrdset { // ------------------------------------------------------------------------ // local variables - calculated_number green; // green threshold for this chart - calculated_number red; // red threshold for this chart + NETDATA_DOUBLE green; // green threshold for this chart + NETDATA_DOUBLE red; // red threshold for this chart avl_tree_lock rrdvar_root_index; // RRDVAR index for this chart RRDSETVAR *variables; // RRDSETVAR linked list for this chart (one RRDSETVAR, many RRDVARs) @@ -557,15 +615,13 @@ struct rrdset { // members for checking the data when loading from disk unsigned long memsize; // how much mem we have allocated for this (without dimensions) - - char magic[sizeof(RRDSET_MAGIC) + 1]; // our magic + void *st_on_file; // compatibility with V019 RRDSET files // ------------------------------------------------------------------------ // the dimensions avl_tree_lock dimensions_index; // the root of the dimensions index RRDDIM *dimensions; // the actual data for every dimension - }; #define rrdset_rdlock(st) netdata_rwlock_rdlock(&((st)->rrdset_rwlock)) @@ -583,6 +639,12 @@ struct rrdset { for((st) = (host)->rrdset_root, rrdhost_check_wrlock(host); st ; (st) = (st)->next) +extern void rrdset_memory_file_save(RRDSET *st); +extern void rrdset_memory_file_free(RRDSET *st); +extern void rrdset_memory_file_update(RRDSET *st); +extern const char *rrdset_cache_filename(RRDSET *st); +extern bool rrdset_memory_load_or_create_map_save(RRDSET *st_on_file, RRD_MEMORY_MODE memory_mode); + // ---------------------------------------------------------------------------- // RRDHOST flags // use this for configuration flags, not for state control @@ -590,14 +652,17 @@ struct rrdset { // and may lead to missing information. typedef enum rrdhost_flags { - RRDHOST_FLAG_ORPHAN = 1 << 0, // this host is orphan (not receiving data) - RRDHOST_FLAG_DELETE_OBSOLETE_CHARTS = 1 << 1, // delete files of obsolete charts - RRDHOST_FLAG_DELETE_ORPHAN_HOST = 1 << 2, // delete the entire host when orphan - RRDHOST_FLAG_EXPORTING_SEND = 1 << 3, // send it to external databases - RRDHOST_FLAG_EXPORTING_DONT_SEND = 1 << 4, // don't send it to external databases - RRDHOST_FLAG_ARCHIVED = 1 << 5, // The host is archived, no collected charts yet - RRDHOST_FLAG_MULTIHOST = 1 << 6, // Host belongs to localhost/megadb - RRDHOST_FLAG_PENDING_FOREACH_ALARMS = 1 << 7, // contains dims with uninitialized foreach alarms + RRDHOST_FLAG_ORPHAN = (1 << 0), // this host is orphan (not receiving data) + RRDHOST_FLAG_DELETE_OBSOLETE_CHARTS = (1 << 1), // delete files of obsolete charts + RRDHOST_FLAG_DELETE_ORPHAN_HOST = (1 << 2), // delete the entire host when orphan + RRDHOST_FLAG_EXPORTING_SEND = (1 << 3), // send it to external databases + RRDHOST_FLAG_EXPORTING_DONT_SEND = (1 << 4), // don't send it to external databases + RRDHOST_FLAG_ARCHIVED = (1 << 5), // The host is archived, no collected charts yet + RRDHOST_FLAG_MULTIHOST = (1 << 6), // Host belongs to localhost/megadb + RRDHOST_FLAG_PENDING_FOREACH_ALARMS = (1 << 7), // contains dims with uninitialized foreach alarms + RRDHOST_FLAG_STREAM_LABELS_UPDATE = (1 << 8), + RRDHOST_FLAG_STREAM_LABELS_STOP = (1 << 9), + RRDHOST_FLAG_ACLK_STREAM_CONTEXTS = (1 << 10), // when set, we should send ACLK stream context updates } RRDHOST_FLAGS; #define rrdhost_flag_check(host, flag) (__atomic_load_n(&((host)->flags), __ATOMIC_SEQ_CST) & (flag)) @@ -629,6 +694,7 @@ struct alarm_entry { char *chart; uint32_t hash_chart; + char *chart_context; char *family; @@ -646,8 +712,8 @@ struct alarm_entry { char *units; char *info; - calculated_number old_value; - calculated_number new_value; + NETDATA_DOUBLE old_value; + NETDATA_DOUBLE new_value; char *old_value_string; char *new_value_string; @@ -740,10 +806,6 @@ struct rrdhost { const char *tags; // tags for this host const char *timezone; // the timezone of the host -#ifdef ENABLE_ACLK - long deleted_charts_count; -#endif - const char *abbrev_timezone; // the abbriviated timezone of the host int32_t utc_offset; // the offset in seconds from utc @@ -778,7 +840,7 @@ struct rrdhost { netdata_thread_t rrdpush_sender_thread; // the sender thread void *dbsync_worker; - volatile unsigned int rrdpush_sender_connected; // 1 when the sender is ready to push metrics + bool rrdpush_sender_connected; // 1 when the sender is ready to push metrics int rrdpush_sender_socket; // the fd of the socket to the remote host, or -1 volatile unsigned int rrdpush_sender_error_shown; // 1 when we have logged a communication error @@ -859,7 +921,7 @@ struct rrdhost { // ------------------------------------------------------------------------ // Support for host-level labels - struct label_index labels; + DICTIONARY *host_labels; // ------------------------------------------------------------------------ // indexes @@ -870,9 +932,11 @@ struct rrdhost { avl_tree_lock rrdfamily_root_index; // the host's chart families index avl_tree_lock rrdvar_root_index; // the host's chart variables index -#ifdef ENABLE_DBENGINE - struct rrdengine_instance *rrdeng_ctx; // DB engine instance for this host -#endif + STORAGE_INSTANCE *storage_instance[RRD_STORAGE_TIERS]; // the database instances of the storage tiers + + RRDCONTEXTS *rrdctx_queue; + RRDCONTEXTS *rrdctx; + uuid_t host_uuid; // Global GUID for this host uuid_t *node_id; // Cloud node_id @@ -916,6 +980,10 @@ extern netdata_rwlock_t rrd_rwlock; // ---------------------------------------------------------------------------- +extern bool is_storage_engine_shared(STORAGE_INSTANCE *engine); + +// ---------------------------------------------------------------------------- + extern size_t rrd_hosts_available; extern time_t rrdhost_free_orphan_time; @@ -944,6 +1012,7 @@ extern RRDHOST *rrdhost_find_or_create( , char *rrdpush_api_key , char *rrdpush_send_charts_matching , struct rrdhost_system_info *system_info + , bool is_archived ); extern void rrdhost_update(RRDHOST *host @@ -1027,7 +1096,7 @@ extern void rrdhost_cleanup_all(void); extern void rrdhost_cleanup_orphan_hosts_nolock(RRDHOST *protected_host); extern void rrdhost_system_info_free(struct rrdhost_system_info *system_info); -extern void rrdhost_free(RRDHOST *host); +extern void rrdhost_free(RRDHOST *host, bool force); extern void rrdhost_save_charts(RRDHOST *host); extern void rrdhost_delete_charts(RRDHOST *host); extern void rrd_cleanup_obsolete_charts(); @@ -1083,28 +1152,49 @@ extern void rrdset_isnot_obsolete(RRDSET *st); #define rrdset_is_available_for_exporting_and_alarms(st) (!rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE) && !rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && (st)->dimensions) #define rrdset_is_archived(st) (rrdset_flag_check(st, RRDSET_FLAG_ARCHIVED) && (st)->dimensions) -// get the total duration in seconds of the round robin database -#define rrdset_duration(st) ((time_t)( (((st)->counter >= ((unsigned long)(st)->entries))?(unsigned long)(st)->entries:(st)->counter) * (st)->update_every )) - // get the timestamp of the last entry in the round robin database -static inline time_t rrdset_last_entry_t_nolock(RRDSET *st) -{ - if (st->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { - RRDDIM *rd; - time_t last_entry_t = 0; +static inline time_t rrddim_last_entry_t(RRDDIM *rd) { + time_t latest = rd->tiers[0]->query_ops.latest_time(rd->tiers[0]->db_metric_handle); - rrddim_foreach_read(rd, st) { - last_entry_t = MAX(last_entry_t, rd->state->query_ops.latest_time(rd)); - } + for(int tier = 1; tier < storage_tiers ;tier++) { + if(unlikely(!rd->tiers[tier])) continue; - return last_entry_t; - } else { - return (time_t)st->last_updated.tv_sec; + time_t t = rd->tiers[tier]->query_ops.latest_time(rd->tiers[tier]->db_metric_handle); + if(t > latest) + latest = t; } + + return latest; } -static inline time_t rrdset_last_entry_t(RRDSET *st) -{ +static inline time_t rrddim_first_entry_t(RRDDIM *rd) { + time_t oldest = 0; + + for(int tier = 0; tier < storage_tiers ;tier++) { + if(unlikely(!rd->tiers[tier])) continue; + + time_t t = rd->tiers[tier]->query_ops.oldest_time(rd->tiers[tier]->db_metric_handle); + if(t != 0 && (oldest == 0 || t < oldest)) + oldest = t; + } + + return oldest; +} + +// get the timestamp of the last entry in the round robin database +static inline time_t rrdset_last_entry_t_nolock(RRDSET *st) { + RRDDIM *rd; + time_t last_entry_t = 0; + + rrddim_foreach_read(rd, st) { + time_t t = rrddim_last_entry_t(rd); + if(t > last_entry_t) last_entry_t = t; + } + + return last_entry_t; +} + +static inline time_t rrdset_last_entry_t(RRDSET *st) { time_t last_entry_t; netdata_rwlock_rdlock(&st->rrdset_rwlock); @@ -1115,24 +1205,18 @@ static inline time_t rrdset_last_entry_t(RRDSET *st) } // get the timestamp of first entry in the round robin database -static inline time_t rrdset_first_entry_t_nolock(RRDSET *st) -{ - if (st->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { - RRDDIM *rd; - time_t first_entry_t = LONG_MAX; - - rrddim_foreach_read(rd, st) { - first_entry_t = - MIN(first_entry_t, - rd->state->query_ops.oldest_time(rd) > st->update_every ? - rd->state->query_ops.oldest_time(rd) - st->update_every : 0); - } - - if (unlikely(LONG_MAX == first_entry_t)) return 0; - return first_entry_t; - } else { - return (time_t)(rrdset_last_entry_t_nolock(st) - rrdset_duration(st)); +static inline time_t rrdset_first_entry_t_nolock(RRDSET *st) { + RRDDIM *rd; + time_t first_entry_t = LONG_MAX; + + rrddim_foreach_read(rd, st) { + time_t t = rrddim_first_entry_t(rd); + if(t < first_entry_t) + first_entry_t = t; } + + if (unlikely(LONG_MAX == first_entry_t)) return 0; + return first_entry_t; } static inline time_t rrdset_first_entry_t(RRDSET *st) @@ -1146,107 +1230,8 @@ static inline time_t rrdset_first_entry_t(RRDSET *st) return first_entry_t; } -// get the timestamp of the last entry in the round robin database -static inline time_t rrddim_last_entry_t(RRDDIM *rd) { - if (rd->rrdset->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) - return rd->state->query_ops.latest_time(rd); - return (time_t)rd->rrdset->last_updated.tv_sec; -} - -static inline time_t rrddim_first_entry_t(RRDDIM *rd) { - if (rd->rrdset->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) - return rd->state->query_ops.oldest_time(rd); - return (time_t)(rd->rrdset->last_updated.tv_sec - rrdset_duration(rd->rrdset)); -} - time_t rrdhost_last_entry_t(RRDHOST *h); -// get the last slot updated in the round robin database -#define rrdset_last_slot(st) ((size_t)(((st)->current_entry == 0) ? (st)->entries - 1 : (st)->current_entry - 1)) - -// get the first / oldest slot updated in the round robin database -// #define rrdset_first_slot(st) ((size_t)( (((st)->counter >= ((unsigned long)(st)->entries)) ? (unsigned long)( ((unsigned long)(st)->current_entry > 0) ? ((unsigned long)(st)->current_entry) : ((unsigned long)(st)->entries) ) - 1 : 0) )) - -// return the slot that has the oldest value - -static inline size_t rrdset_first_slot(RRDSET *st) { - if(st->counter >= (size_t)st->entries) { - // the database has been rotated at least once - // the oldest entry is the one that will be next - // overwritten by data collection - return (size_t)st->current_entry; - } - - // we do not have rotated the db yet - // so 0 is the first entry - return 0; -} - -// get the slot of the round robin database, for the given timestamp (t) -// it always returns a valid slot, although may not be for the time requested if the time is outside the round robin database -// only valid when not using dbengine -static inline size_t rrdset_time2slot(RRDSET *st, time_t t) { - size_t ret = 0; - time_t last_entry_t = rrdset_last_entry_t_nolock(st); - time_t first_entry_t = rrdset_first_entry_t_nolock(st); - - if(t >= last_entry_t) { - // the requested time is after the last entry we have - ret = rrdset_last_slot(st); - } - else { - if(t <= first_entry_t) { - // the requested time is before the first entry we have - ret = rrdset_first_slot(st); - } - else { - if(rrdset_last_slot(st) >= ((last_entry_t - t) / (size_t)(st->update_every))) - ret = rrdset_last_slot(st) - ((last_entry_t - t) / (size_t)(st->update_every)); - else - ret = rrdset_last_slot(st) - ((last_entry_t - t) / (size_t)(st->update_every)) + (unsigned long)st->entries; - } - } - - if(unlikely(ret >= (size_t)st->entries)) { - error("INTERNAL ERROR: rrdset_time2slot() on %s returns values outside entries", st->name); - ret = (size_t)(st->entries - 1); - } - - return ret; -} - -// get the timestamp of a specific slot in the round robin database -// only valid when not using dbengine -static inline time_t rrdset_slot2time(RRDSET *st, size_t slot) { - time_t ret; - time_t last_entry_t = rrdset_last_entry_t_nolock(st); - time_t first_entry_t = rrdset_first_entry_t_nolock(st); - - if(slot >= (size_t)st->entries) { - error("INTERNAL ERROR: caller of rrdset_slot2time() gives invalid slot %zu", slot); - slot = (size_t)st->entries - 1; - } - - if(slot > rrdset_last_slot(st)) { - ret = last_entry_t - (size_t)st->update_every * (rrdset_last_slot(st) - slot + (size_t)st->entries); - } - else { - ret = last_entry_t - (size_t)st->update_every; - } - - if(unlikely(ret < first_entry_t)) { - error("INTERNAL ERROR: rrdset_slot2time() on %s returns time too far in the past", st->name); - ret = first_entry_t; - } - - if(unlikely(ret > last_entry_t)) { - error("INTERNAL ERROR: rrdset_slot2time() on %s returns time into the future", st->name); - ret = last_entry_t; - } - - return ret; -} - // ---------------------------------------------------------------------------- // RRD DIMENSION functions @@ -1281,7 +1266,7 @@ extern void rrddim_isnot_obsolete(RRDSET *st, RRDDIM *rd); extern collected_number rrddim_set_by_pointer(RRDSET *st, RRDDIM *rd, collected_number value); extern collected_number rrddim_set(RRDSET *st, const char *id, collected_number value); -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK extern time_t calc_dimension_liveness(RRDDIM *rd, time_t now); #endif extern long align_entries_to_pagesize(RRD_MEMORY_MODE mode, long entries); @@ -1319,8 +1304,7 @@ extern RRDSET *rrdset_index_del_name(RRDHOST *host, RRDSET *st); extern void rrdset_free(RRDSET *st); extern void rrdset_reset(RRDSET *st); extern void rrdset_save(RRDSET *st); -#define rrdset_delete(st) rrdset_delete_custom(st, 0) -extern void rrdset_delete_custom(RRDSET *st, int db_rotated); +extern void rrdset_delete_files(RRDSET *st); extern void rrdset_delete_obsolete_dimensions(RRDSET *st); extern RRDHOST *rrdhost_create( @@ -1328,7 +1312,7 @@ extern RRDHOST *rrdhost_create( const char *abbrev_timezone, int32_t utc_offset,const char *tags, const char *program_name, const char *program_version, int update_every, long entries, RRD_MEMORY_MODE memory_mode, unsigned int health_enabled, unsigned int rrdpush_enabled, char *rrdpush_destination, char *rrdpush_api_key, char *rrdpush_send_charts_matching, struct rrdhost_system_info *system_info, - int is_localhost); //TODO: Remove , int is_archived); + int is_localhost, bool is_archived); #endif /* NETDATA_RRD_INTERNALS */ @@ -1337,6 +1321,8 @@ extern void set_host_properties( const char *guid, const char *os, const char *tags, const char *tzone, const char *abbrev_tzone, int32_t utc_offset, const char *program_name, const char *program_version); +extern int get_tier_grouping(int tier); + // ---------------------------------------------------------------------------- // RRD DB engine declarations @@ -1344,9 +1330,15 @@ extern void set_host_properties( #include "database/engine/rrdengineapi.h" #endif #include "sqlite/sqlite_functions.h" +#include "sqlite/sqlite_context.h" #include "sqlite/sqlite_aclk.h" #include "sqlite/sqlite_aclk_chart.h" #include "sqlite/sqlite_aclk_alert.h" #include "sqlite/sqlite_aclk_node.h" #include "sqlite/sqlite_health.h" + +#ifdef __cplusplus +} +#endif + #endif /* NETDATA_RRD_H */ diff --git a/database/rrdcalc.c b/database/rrdcalc.c index b29a0ffc0..cab60468b 100644 --- a/database/rrdcalc.c +++ b/database/rrdcalc.c @@ -57,12 +57,14 @@ static void rrdsetcalc_link(RRDSET *st, RRDCALC *rc) { } if(!isnan(rc->green) && isnan(st->green)) { - debug(D_HEALTH, "Health alarm '%s.%s' green threshold set from " CALCULATED_NUMBER_FORMAT_AUTO " to " CALCULATED_NUMBER_FORMAT_AUTO ".", rc->rrdset->id, rc->name, rc->rrdset->green, rc->green); + debug(D_HEALTH, "Health alarm '%s.%s' green threshold set from " NETDATA_DOUBLE_FORMAT_AUTO + " to " NETDATA_DOUBLE_FORMAT_AUTO ".", rc->rrdset->id, rc->name, rc->rrdset->green, rc->green); st->green = rc->green; } if(!isnan(rc->red) && isnan(st->red)) { - debug(D_HEALTH, "Health alarm '%s.%s' red threshold set from " CALCULATED_NUMBER_FORMAT_AUTO " to " CALCULATED_NUMBER_FORMAT_AUTO ".", rc->rrdset->id, rc->name, rc->rrdset->red, rc->red); + debug(D_HEALTH, "Health alarm '%s.%s' red threshold set from " NETDATA_DOUBLE_FORMAT_AUTO " to " NETDATA_DOUBLE_FORMAT_AUTO + ".", rc->rrdset->id, rc->name, rc->rrdset->red, rc->red); st->red = rc->red; } @@ -90,6 +92,7 @@ static void rrdsetcalc_link(RRDSET *st, RRDCALC *rc) { now, rc->name, rc->rrdset->id, + rc->rrdset->context, rc->rrdset->family, rc->classification, rc->component, @@ -109,51 +112,23 @@ static void rrdsetcalc_link(RRDSET *st, RRDCALC *rc) { health_alarm_log(host, ae); } -static inline int rrdcalc_test_additional_restriction(RRDCALC *rc, RRDSET *st){ - if (rc->module_match && !simple_pattern_matches(rc->module_pattern, st->module_name)) +static int rrdcalc_is_matching_rrdset(RRDCALC *rc, RRDSET *st) { + if((rc->hash_chart != st->hash || strcmp(rc->chart, st->id) != 0) && + (rc->hash_chart != st->hash_name || strcmp(rc->chart, st->name) != 0)) return 0; - if (rc->plugin_match && !simple_pattern_matches(rc->plugin_pattern, st->plugin_name)) + if (rc->module_pattern && !simple_pattern_matches(rc->module_pattern, st->module_name)) return 0; - if (rc->labels) { - int labels_count=1; - int labels_match=0; - char *s = rc->labels; - while (*s) { - if (*s==' ') - labels_count++; - s++; - } - RRDHOST *host = st->rrdhost; - char cmp[CONFIG_FILE_LINE_MAX+1]; - struct label *move = host->labels.head; - while(move) { - snprintf(cmp, CONFIG_FILE_LINE_MAX, "%s=%s", move->key, move->value); - if (simple_pattern_matches(rc->splabels, move->key) || - simple_pattern_matches(rc->splabels, cmp)) { - labels_match++; - } - move = move->next; - } + if (rc->plugin_pattern && !simple_pattern_matches(rc->plugin_pattern, st->plugin_name)) + return 0; - if (labels_match != labels_count) - return 0; - } + if (st->rrdhost->host_labels && rc->host_labels_pattern && !rrdlabels_match_simple_pattern_parsed(st->rrdhost->host_labels, rc->host_labels_pattern, '=')) + return 0; return 1; } -static inline int rrdcalc_is_matching_this_rrdset(RRDCALC *rc, RRDSET *st) { - if(((rc->hash_chart == st->hash && !strcmp(rc->chart, st->id)) || - (rc->hash_chart == st->hash_name && !strcmp(rc->chart, st->name))) && - rrdcalc_test_additional_restriction(rc, st)) { - return 1; - } - - return 0; -} - // this has to be called while the RRDHOST is locked inline void rrdsetcalc_link_matching(RRDSET *st) { RRDHOST *host = st->rrdhost; @@ -164,7 +139,7 @@ inline void rrdsetcalc_link_matching(RRDSET *st) { if(unlikely(rc->rrdset)) continue; - if(unlikely(rrdcalc_is_matching_this_rrdset(rc, st))) + if(unlikely(rrdcalc_is_matching_rrdset(rc, st))) rrdsetcalc_link(st, rc); } } @@ -190,6 +165,7 @@ inline void rrdsetcalc_unlink(RRDCALC *rc) { now, rc->name, rc->rrdset->id, + rc->rrdset->context, rc->rrdset->family, rc->classification, rc->component, @@ -382,7 +358,7 @@ inline void rrdcalc_add_to_host(RRDHOST *host, RRDCALC *rc) { // link it to its chart RRDSET *st; rrdset_foreach_read(st, host) { - if(rrdcalc_is_matching_this_rrdset(rc, st)) { + if(rrdcalc_is_matching_rrdset(rc, st)) { rrdsetcalc_link(st, rc); break; } @@ -473,7 +449,9 @@ inline RRDCALC *rrdcalc_create_from_template(RRDHOST *host, RRDCALCTEMPLATE *rt, error("Health alarm '%s.%s': failed to re-parse critical expression '%s'", chart, rt->name, rt->critical->source); } - debug(D_HEALTH, "Health runtime added alarm '%s.%s': exec '%s', recipient '%s', green " CALCULATED_NUMBER_FORMAT_AUTO ", red " CALCULATED_NUMBER_FORMAT_AUTO ", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u", + debug(D_HEALTH, "Health runtime added alarm '%s.%s': exec '%s', recipient '%s', green " NETDATA_DOUBLE_FORMAT_AUTO + ", red " NETDATA_DOUBLE_FORMAT_AUTO + ", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u", (rc->chart)?rc->chart:"NOCHART", rc->name, (rc->exec)?rc->exec:"DEFAULT", @@ -612,8 +590,8 @@ void rrdcalc_free(RRDCALC *rc) { freez(rc->component); freez(rc->type); simple_pattern_free(rc->spdim); - freez(rc->labels); - simple_pattern_free(rc->splabels); + freez(rc->host_labels); + simple_pattern_free(rc->host_labels_pattern); freez(rc->module_match); simple_pattern_free(rc->module_pattern); freez(rc->plugin_match); @@ -681,51 +659,32 @@ void rrdcalc_foreach_unlink_and_free(RRDHOST *host, RRDCALC *rc) { } static void rrdcalc_labels_unlink_alarm_loop(RRDHOST *host, RRDCALC *alarms) { - RRDCALC *rc = alarms; - while (rc) { - if (!rc->labels) { - rc = rc->next; - continue; - } - - char cmp[CONFIG_FILE_LINE_MAX+1]; - struct label *move = host->labels.head; - while(move) { - snprintf(cmp, CONFIG_FILE_LINE_MAX, "%s=%s", move->key, move->value); - if (simple_pattern_matches(rc->splabels, move->key) || - simple_pattern_matches(rc->splabels, cmp)) { - break; - } + for(RRDCALC *rc = alarms ; rc ; ) { + RRDCALC *rc_next = rc->next; - move = move->next; + if (!rc->host_labels) { + rc = rc_next; + continue; } - RRDCALC *next = rc->next; - if(!move) { + if(!rrdlabels_match_simple_pattern_parsed(host->host_labels, rc->host_labels_pattern, '=')) { info("Health configuration for alarm '%s' cannot be applied, because the host %s does not have the label(s) '%s'", rc->name, host->hostname, - rc->labels); + rc->host_labels); - if(host->alarms == alarms) { + if(host->alarms == alarms) rrdcalc_unlink_and_free(host, rc); - } else + else rrdcalc_foreach_unlink_and_free(host, rc); - } - - rc = next; + rc = rc_next; } } void rrdcalc_labels_unlink_alarm_from_host(RRDHOST *host) { - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - rrdcalc_labels_unlink_alarm_loop(host, host->alarms); rrdcalc_labels_unlink_alarm_loop(host, host->alarms_with_foreach); - - netdata_rwlock_unlock(&host->labels.labels_rwlock); } void rrdcalc_labels_unlink() { @@ -736,7 +695,7 @@ void rrdcalc_labels_unlink() { if (unlikely(!host->health_enabled)) continue; - if (host->labels.head) { + if (host->host_labels) { rrdhost_wrlock(host); rrdcalc_labels_unlink_alarm_from_host(host); diff --git a/database/rrdcalc.h b/database/rrdcalc.h index 2ae47788e..0dcd7ce69 100644 --- a/database/rrdcalc.h +++ b/database/rrdcalc.h @@ -63,8 +63,8 @@ struct rrdcalc { int update_every; // update frequency for the alarm // the red and green threshold of this alarm (to be set to the chart) - calculated_number green; - calculated_number red; + NETDATA_DOUBLE green; + NETDATA_DOUBLE red; // ------------------------------------------------------------------------ // database lookup settings @@ -103,8 +103,8 @@ struct rrdcalc { // ------------------------------------------------------------------------ // Labels settings - char *labels; // the label read from an alarm file - SIMPLE_PATTERN *splabels; // the simple pattern of labels + char *host_labels; // the label read from an alarm file + SIMPLE_PATTERN *host_labels_pattern; // the simple pattern of labels // ------------------------------------------------------------------------ // runtime information @@ -112,8 +112,8 @@ struct rrdcalc { RRDCALC_STATUS old_status; // the old status of the alarm RRDCALC_STATUS status; // the current status of the alarm - calculated_number value; // the current value of the alarm - calculated_number old_value; // the previous value of the alarm + NETDATA_DOUBLE value; // the current value of the alarm + NETDATA_DOUBLE old_value; // the previous value of the alarm uint32_t rrdcalc_flags; // check RRDCALC_FLAG_* diff --git a/database/rrdcalctemplate.c b/database/rrdcalctemplate.c index 9789f4bea..3f9804b93 100644 --- a/database/rrdcalctemplate.c +++ b/database/rrdcalctemplate.c @@ -4,98 +4,50 @@ #include "rrd.h" // ---------------------------------------------------------------------------- +// RRDCALCTEMPLATE management +/** + * RRDCALC TEMPLATE LINK MATCHING + * + * @param rt is the template used to create the chart. + * @param st is the chart where the alarm will be attached. + */ +void rrdcalctemplate_check_conditions_and_link(RRDCALCTEMPLATE *rt, RRDSET *st, RRDHOST *host) { + if(rt->hash_context != st->hash_context || strcmp(rt->context, st->context) != 0) + return; -static int rrdcalctemplate_is_there_label_restriction(RRDCALCTEMPLATE *rt, RRDHOST *host) { - if(!rt->labels) - return 0; - - errno = 0; - struct label *move = host->labels.head; - char cmp[CONFIG_FILE_LINE_MAX+1]; - - int ret; - if(move) { - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - while(move) { - snprintfz(cmp, CONFIG_FILE_LINE_MAX, "%s=%s", move->key, move->value); - if (simple_pattern_matches(rt->splabels, move->key) || - simple_pattern_matches(rt->splabels, cmp)) { - break; - } - move = move->next; - } - netdata_rwlock_unlock(&host->labels.labels_rwlock); - - if(!move) { - error("Health template '%s' cannot be applied, because the host %s does not have the label(s) '%s'", - rt->name, - host->hostname, - rt->labels - ); - ret = 1; - } else { - ret = 0; - } - } else { - ret =0; - } - - return ret; -} - -static inline int rrdcalctemplate_test_additional_restriction(RRDCALCTEMPLATE *rt, RRDSET *st) { if (rt->charts_pattern && !simple_pattern_matches(rt->charts_pattern, st->name)) - return 0; + return; if (rt->family_pattern && !simple_pattern_matches(rt->family_pattern, st->family)) - return 0; + return; if (rt->module_pattern && !simple_pattern_matches(rt->module_pattern, st->module_name)) - return 0; + return; if (rt->plugin_pattern && !simple_pattern_matches(rt->plugin_pattern, st->plugin_name)) - return 0; + return; - return 1; -} + if(host->host_labels && rt->host_labels_pattern && !rrdlabels_match_simple_pattern_parsed(host->host_labels, rt->host_labels_pattern, '=')) + return; -// RRDCALCTEMPLATE management -/** - * RRDCALC TEMPLATE LINK MATCHING - * - * @param rt is the template used to create the chart. - * @param st is the chart where the alarm will be attached. - */ -void rrdcalctemplate_link_matching_test(RRDCALCTEMPLATE *rt, RRDSET *st, RRDHOST *host) { - if(rt->hash_context == st->hash_context && !strcmp(rt->context, st->context) && - rrdcalctemplate_test_additional_restriction(rt, st) ) { - if (!rrdcalctemplate_is_there_label_restriction(rt, host)) { - RRDCALC *rc = rrdcalc_create_from_template(host, rt, st->id); - if (unlikely(!rc)) - info("Health tried to create alarm from template '%s' on chart '%s' of host '%s', but it failed", - rt->name, st->id, host->hostname); + RRDCALC *rc = rrdcalc_create_from_template(host, rt, st->id); + if (unlikely(!rc)) + info("Health tried to create alarm from template '%s' on chart '%s' of host '%s', but it failed", rt->name, st->id, host->hostname); #ifdef NETDATA_INTERNAL_CHECKS - else if (rc->rrdset != st && - !rc->foreachdim) //When we have a template with foreadhdim, the child will be added to the index late - error("Health alarm '%s.%s' should be linked to chart '%s', but it is not", - rc->chart ? rc->chart : "NOCHART", rc->name, st->id); + else if (rc->rrdset != st && !rc->foreachdim) //When we have a template with foreadhdim, the child will be added to the index late + error("Health alarm '%s.%s' should be linked to chart '%s', but it is not", rc->chart ? rc->chart : "NOCHART", rc->name, st->id); #endif - } - } } void rrdcalctemplate_link_matching(RRDSET *st) { RRDHOST *host = st->rrdhost; RRDCALCTEMPLATE *rt; - for(rt = host->templates; rt ; rt = rt->next) { - rrdcalctemplate_link_matching_test(rt, st, host); - } + for(rt = host->templates; rt ; rt = rt->next) + rrdcalctemplate_check_conditions_and_link(rt, st, host); - for(rt = host->alarms_template_with_foreach; rt ; rt = rt->next) { - rrdcalctemplate_link_matching_test(rt, st, host); - } + for(rt = host->alarms_template_with_foreach; rt ; rt = rt->next) + rrdcalctemplate_check_conditions_and_link(rt, st, host); } inline void rrdcalctemplate_free(RRDCALCTEMPLATE *rt) { @@ -129,9 +81,9 @@ inline void rrdcalctemplate_free(RRDCALCTEMPLATE *rt) { freez(rt->info); freez(rt->dimensions); freez(rt->foreachdim); - freez(rt->labels); + freez(rt->host_labels); simple_pattern_free(rt->spdim); - simple_pattern_free(rt->splabels); + simple_pattern_free(rt->host_labels_pattern); freez(rt); } diff --git a/database/rrdcalctemplate.h b/database/rrdcalctemplate.h index 0f12bba05..51aa33054 100644 --- a/database/rrdcalctemplate.h +++ b/database/rrdcalctemplate.h @@ -42,8 +42,8 @@ struct rrdcalctemplate { int update_every; // update frequency for the alarm // the red and green threshold of this alarm (to be set to the chart) - calculated_number green; - calculated_number red; + NETDATA_DOUBLE green; + NETDATA_DOUBLE red; // ------------------------------------------------------------------------ // database lookup settings @@ -74,8 +74,8 @@ struct rrdcalctemplate { // ------------------------------------------------------------------------ // Labels settings - char *labels; // the label read from an alarm file - SIMPLE_PATTERN *splabels; // the simple pattern of labels + char *host_labels; // the label read from an alarm file + SIMPLE_PATTERN *host_labels_pattern; // the simple pattern of labels // ------------------------------------------------------------------------ // expressions related to the alarm diff --git a/database/rrdcontext.c b/database/rrdcontext.c new file mode 100644 index 000000000..b6b9e945c --- /dev/null +++ b/database/rrdcontext.c @@ -0,0 +1,2908 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "rrdcontext.h" +#include "sqlite/sqlite_context.h" +#include "aclk/schema-wrappers/context.h" +#include "aclk/aclk_contexts_api.h" +#include "aclk/aclk_api.h" + +int rrdcontext_enabled = CONFIG_BOOLEAN_YES; + +#define MESSAGES_PER_BUNDLE_TO_SEND_TO_HUB_PER_HOST 5000 +#define FULL_RETENTION_SCAN_DELAY_AFTER_DB_ROTATION_SECS 120 +#define RRDCONTEXT_WORKER_THREAD_HEARTBEAT_SECS 1 +#define RRDCONTEXT_MINIMUM_ALLOWED_PRIORITY 10 + +// #define LOG_TRANSITIONS 1 +// #define LOG_RRDINSTANCES 1 + +typedef enum { + RRD_FLAG_NONE = 0, + RRD_FLAG_DELETED = (1 << 0), // this is a deleted object (metrics, instances, contexts) + RRD_FLAG_COLLECTED = (1 << 1), // this object is currently being collected + RRD_FLAG_UPDATED = (1 << 2), // this object has updates to propagate + RRD_FLAG_ARCHIVED = (1 << 3), // this object is not currently being collected + RRD_FLAG_OWN_LABELS = (1 << 4), // this instance has its own labels - not linked to an RRDSET + RRD_FLAG_LIVE_RETENTION = (1 << 5), // we have got live retention from the database + RRD_FLAG_QUEUED = (1 << 6), // this context is currently queued to be dispatched to hub + RRD_FLAG_DONT_PROCESS = (1 << 7), // don't process updates for this object + RRD_FLAG_HIDDEN = (1 << 8), // don't expose this to the hub or the API + + RRD_FLAG_UPDATE_REASON_LOAD_SQL = (1 << 10), // this object has just been loaded from SQL + RRD_FLAG_UPDATE_REASON_NEW_OBJECT = (1 << 11), // this object has just been created + RRD_FLAG_UPDATE_REASON_UPDATED_OBJECT = (1 << 12), // we received an update on this object + RRD_FLAG_UPDATE_REASON_CHANGED_LINKING = (1 << 13), // an instance or a metric switched RRDSET or RRDDIM + RRD_FLAG_UPDATE_REASON_CHANGED_UUID = (1 << 14), // an instance or a metric changed UUID + RRD_FLAG_UPDATE_REASON_CHANGED_NAME = (1 << 15), // an instance or a metric changed name + RRD_FLAG_UPDATE_REASON_CHANGED_UNITS = (1 << 16), // this context or instance changed units + RRD_FLAG_UPDATE_REASON_CHANGED_TITLE = (1 << 17), // this context or instance changed title + RRD_FLAG_UPDATE_REASON_CHANGED_FAMILY = (1 << 18), // the context or the instance changed family + RRD_FLAG_UPDATE_REASON_CHANGED_CHART_TYPE = (1 << 19), // this context or instance changed chart type + RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY = (1 << 20), // this context or instance changed its priority + RRD_FLAG_UPDATE_REASON_CHANGED_UPDATE_EVERY = (1 << 21), // the instance or the metric changed update frequency + RRD_FLAG_UPDATE_REASON_ZERO_RETENTION = (1 << 22), // this object has not retention + RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T = (1 << 23), // this object changed its oldest time in the db + RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T = (1 << 24), // this object change its latest time in the db + RRD_FLAG_UPDATE_REASON_STOPPED_BEING_COLLECTED = (1 << 25), // this object has stopped being collected + RRD_FLAG_UPDATE_REASON_STARTED_BEING_COLLECTED = (1 << 26), // this object has started being collected + RRD_FLAG_UPDATE_REASON_DISCONNECTED_CHILD = (1 << 27), // this context belongs to a host that just disconnected + RRD_FLAG_UPDATE_REASON_DB_ROTATION = (1 << 28), // this context changed because of a db rotation + RRD_FLAG_UPDATE_REASON_UNUSED = (1 << 29), // this context is not used anymore + RRD_FLAG_UPDATE_REASON_CHANGED_FLAGS = (1 << 30), // this context is not used anymore +} RRD_FLAGS; + +#define RRD_FLAG_ALL_UPDATE_REASONS ( \ + RRD_FLAG_UPDATE_REASON_LOAD_SQL \ + |RRD_FLAG_UPDATE_REASON_NEW_OBJECT \ + |RRD_FLAG_UPDATE_REASON_UPDATED_OBJECT \ + |RRD_FLAG_UPDATE_REASON_CHANGED_LINKING \ + |RRD_FLAG_UPDATE_REASON_CHANGED_UUID \ + |RRD_FLAG_UPDATE_REASON_CHANGED_NAME \ + |RRD_FLAG_UPDATE_REASON_CHANGED_UNITS \ + |RRD_FLAG_UPDATE_REASON_CHANGED_TITLE \ + |RRD_FLAG_UPDATE_REASON_CHANGED_FAMILY \ + |RRD_FLAG_UPDATE_REASON_CHANGED_CHART_TYPE \ + |RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY \ + |RRD_FLAG_UPDATE_REASON_CHANGED_UPDATE_EVERY \ + |RRD_FLAG_UPDATE_REASON_ZERO_RETENTION \ + |RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T \ + |RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T \ + |RRD_FLAG_UPDATE_REASON_STOPPED_BEING_COLLECTED \ + |RRD_FLAG_UPDATE_REASON_STARTED_BEING_COLLECTED \ + |RRD_FLAG_UPDATE_REASON_DISCONNECTED_CHILD \ + |RRD_FLAG_UPDATE_REASON_DB_ROTATION \ + |RRD_FLAG_UPDATE_REASON_UNUSED \ + |RRD_FLAG_UPDATE_REASON_CHANGED_FLAGS \ + ) + +#define RRD_FLAGS_ALLOWED_EXTERNALLY_ON_NEW_OBJECTS ( \ + RRD_FLAG_ARCHIVED \ + |RRD_FLAG_DONT_PROCESS \ + |RRD_FLAG_HIDDEN \ + |RRD_FLAG_ALL_UPDATE_REASONS \ + ) + +#define RRD_FLAGS_PREVENTING_DELETIONS ( \ + RRD_FLAG_QUEUED \ + |RRD_FLAG_COLLECTED \ + |RRD_FLAG_UPDATE_REASON_LOAD_SQL \ + |RRD_FLAG_UPDATE_REASON_NEW_OBJECT \ + |RRD_FLAG_UPDATE_REASON_UPDATED_OBJECT \ + |RRD_FLAG_UPDATE_REASON_CHANGED_LINKING \ +) + +#define rrd_flag_set_updated(obj, reason) (obj)->flags |= (RRD_FLAG_UPDATED | (reason)) +#define rrd_flag_unset_updated(obj) (obj)->flags &= ~(RRD_FLAG_UPDATED | RRD_FLAG_ALL_UPDATE_REASONS) + +#define rrd_flag_set_collected(obj) do { \ + if(likely( !((obj)->flags & RRD_FLAG_COLLECTED))) \ + (obj)->flags |= (RRD_FLAG_COLLECTED | RRD_FLAG_UPDATE_REASON_STARTED_BEING_COLLECTED | RRD_FLAG_UPDATED); \ + if(likely( ((obj)->flags & (RRD_FLAG_ARCHIVED | RRD_FLAG_UPDATE_REASON_STOPPED_BEING_COLLECTED)))) \ + (obj)->flags &= ~(RRD_FLAG_ARCHIVED | RRD_FLAG_UPDATE_REASON_STOPPED_BEING_COLLECTED); \ + if(unlikely(((obj)->flags & (RRD_FLAG_DELETED | RRD_FLAG_UPDATE_REASON_ZERO_RETENTION)))) \ + (obj)->flags &= ~(RRD_FLAG_DELETED | RRD_FLAG_UPDATE_REASON_ZERO_RETENTION); \ + if(unlikely(((obj)->flags & RRD_FLAG_DONT_PROCESS))) \ + (obj)->flags &= ~RRD_FLAG_DONT_PROCESS; \ +} while(0) + +#define rrd_flag_set_archived(obj) do { \ + if(likely( !((obj)->flags & RRD_FLAG_ARCHIVED))) \ + (obj)->flags |= (RRD_FLAG_ARCHIVED | RRD_FLAG_UPDATE_REASON_STOPPED_BEING_COLLECTED | RRD_FLAG_UPDATED); \ + if(likely( ((obj)->flags & (RRD_FLAG_COLLECTED | RRD_FLAG_UPDATE_REASON_STARTED_BEING_COLLECTED)))) \ + (obj)->flags &= ~(RRD_FLAG_COLLECTED | RRD_FLAG_UPDATE_REASON_STARTED_BEING_COLLECTED); \ + if(unlikely(((obj)->flags & (RRD_FLAG_DELETED | RRD_FLAG_UPDATE_REASON_ZERO_RETENTION)))) \ + (obj)->flags &= ~(RRD_FLAG_DELETED | RRD_FLAG_UPDATE_REASON_ZERO_RETENTION); \ +} while(0) + +#define rrd_flag_set_deleted(obj, reason) do { \ + if(likely( !((obj)->flags & RRD_FLAG_DELETED))) \ + (obj)->flags |= (RRD_FLAG_DELETED | RRD_FLAG_UPDATE_REASON_ZERO_RETENTION | RRD_FLAG_UPDATED | (reason)); \ + if(unlikely(((obj)->flags & RRD_FLAG_ARCHIVED))) \ + (obj)->flags &= ~RRD_FLAG_ARCHIVED; \ + if(likely( ((obj)->flags & RRD_FLAG_COLLECTED))) \ + (obj)->flags &= ~RRD_FLAG_COLLECTED; \ +} while(0) + + +#define rrd_flag_is_collected(obj) ((obj)->flags & RRD_FLAG_COLLECTED) +#define rrd_flag_is_archived(obj) ((obj)->flags & RRD_FLAG_ARCHIVED) + +static struct rrdcontext_reason { + RRD_FLAGS flag; + const char *name; + usec_t delay_ut; +} rrdcontext_reasons[] = { + // context related + { RRD_FLAG_UPDATE_REASON_NEW_OBJECT, "object created", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_UPDATED_OBJECT, "object updated", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_LOAD_SQL, "loaded from sql", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_TITLE, "changed title", 30 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_UNITS, "changed units", 30 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_FAMILY, "changed family", 30 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY, "changed priority", 30 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_ZERO_RETENTION, "has no retention", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T, "updated first_time_t", 30 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T, "updated last_time_t", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_CHART_TYPE, "changed chart type", 30 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_STOPPED_BEING_COLLECTED, "stopped collected", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_STARTED_BEING_COLLECTED, "started collected", 0 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_UNUSED, "unused", 0 * USEC_PER_SEC }, + + // not context related + { RRD_FLAG_UPDATE_REASON_CHANGED_UUID, "changed uuid", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_UPDATE_EVERY, "changed updated every",60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_LINKING, "changed rrd link", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_NAME, "changed name", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_DISCONNECTED_CHILD, "child disconnected", 30 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_DB_ROTATION, "db rotation", 60 * USEC_PER_SEC }, + { RRD_FLAG_UPDATE_REASON_CHANGED_FLAGS, "changed flags", 60 * USEC_PER_SEC }, + + // terminator + { 0, NULL, 0 }, +}; + + +typedef struct rrdmetric { + uuid_t uuid; + + STRING *id; + STRING *name; + + RRDDIM *rrddim; + + time_t first_time_t; + time_t last_time_t; + RRD_FLAGS flags; + + struct rrdinstance *ri; + + usec_t created_ut; // the time this object was created +} RRDMETRIC; + +typedef struct rrdinstance { + uuid_t uuid; + + STRING *id; + STRING *name; + STRING *title; + STRING *units; + STRING *family; + uint32_t priority; + RRDSET_TYPE chart_type; + + RRD_FLAGS flags; // flags related to this instance + time_t first_time_t; + time_t last_time_t; + + int update_every; // data collection frequency + RRDSET *rrdset; // pointer to RRDSET when collected, or NULL + + DICTIONARY *rrdlabels; // linked to RRDSET->state->chart_labels or own version + + struct rrdcontext *rc; + DICTIONARY *rrdmetrics; +} RRDINSTANCE; + +typedef struct rrdcontext { + uint64_t version; + + STRING *id; + STRING *title; + STRING *units; + STRING *family; + uint32_t priority; + RRDSET_TYPE chart_type; + + RRD_FLAGS flags; + time_t first_time_t; + time_t last_time_t; + + VERSIONED_CONTEXT_DATA hub; + + DICTIONARY *rrdinstances; + RRDHOST *rrdhost; + + struct { + RRD_FLAGS queued_flags; // the last flags that triggered the queueing + usec_t queued_ut; // the last time this was queued + usec_t delay_calc_ut; // the last time we calculated the scheduled_dispatched_ut + usec_t scheduled_dispatch_ut; // the time it was/is scheduled to be sent + usec_t dequeued_ut; // the last time we sent (or deduped) this context + } queue; + + netdata_mutex_t mutex; +} RRDCONTEXT; + +// ---------------------------------------------------------------------------- +// helper one-liners for RRDMETRIC + +static inline RRDMETRIC *rrdmetric_acquired_value(RRDMETRIC_ACQUIRED *rma) { + return dictionary_acquired_item_value((DICTIONARY_ITEM *)rma); +} + +static inline void rrdmetric_release(RRDMETRIC_ACQUIRED *rma) { + RRDMETRIC *rm = rrdmetric_acquired_value(rma); + dictionary_acquired_item_release(rm->ri->rrdmetrics, (DICTIONARY_ITEM *)rma); +} + +// ---------------------------------------------------------------------------- +// helper one-liners for RRDINSTANCE + +static inline RRDINSTANCE_ACQUIRED *rrdinstance_dup(RRDINSTANCE_ACQUIRED *ria) { + return (RRDINSTANCE_ACQUIRED *)dictionary_acquired_item_dup((DICTIONARY_ITEM *)ria); +} + +static inline RRDINSTANCE *rrdinstance_acquired_value(RRDINSTANCE_ACQUIRED *ria) { + return dictionary_acquired_item_value((DICTIONARY_ITEM *)ria); +} + +static inline const char *rrdinstance_acquired_name(RRDINSTANCE_ACQUIRED *ria) { + return dictionary_acquired_item_name((DICTIONARY_ITEM *)ria); +} + +static inline void rrdinstance_release(RRDINSTANCE_ACQUIRED *ria) { + RRDINSTANCE *ri = rrdinstance_acquired_value(ria); + dictionary_acquired_item_release(ri->rc->rrdinstances, (DICTIONARY_ITEM *)ria); +} + +// ---------------------------------------------------------------------------- +// helper one-liners for RRDCONTEXT + +static inline RRDCONTEXT_ACQUIRED *rrdcontext_dup(RRDCONTEXT_ACQUIRED *rca) { + return (RRDCONTEXT_ACQUIRED *)dictionary_acquired_item_dup((DICTIONARY_ITEM *)rca); +} + +static inline const char *rrdcontext_acquired_name(RRDCONTEXT_ACQUIRED *rca) { + return dictionary_acquired_item_name((DICTIONARY_ITEM *)rca); +} + +static inline RRDCONTEXT *rrdcontext_acquired_value(RRDCONTEXT_ACQUIRED *rca) { + return dictionary_acquired_item_value((DICTIONARY_ITEM *)rca); +} + +static inline RRDCONTEXT_ACQUIRED *rrdcontext_acquire(RRDHOST *host, const char *name) { + return (RRDCONTEXT_ACQUIRED *)dictionary_get_and_acquire_item((DICTIONARY *)host->rrdctx, name); +} + +static inline void rrdcontext_release(RRDCONTEXT_ACQUIRED *rca) { + RRDCONTEXT *rc = rrdcontext_acquired_value(rca); + dictionary_acquired_item_release((DICTIONARY *)rc->rrdhost->rrdctx, (DICTIONARY_ITEM *)rca); +} + +static void rrdcontext_recalculate_context_retention(RRDCONTEXT *rc, RRD_FLAGS reason, int job_id); +static void rrdcontext_recalculate_host_retention(RRDHOST *host, RRD_FLAGS reason, int job_id); + +#define rrdcontext_version_hash(host) rrdcontext_version_hash_with_callback(host, NULL, false, NULL) +static uint64_t rrdcontext_version_hash_with_callback(RRDHOST *host, void (*callback)(RRDCONTEXT *, bool, void *), bool snapshot, void *bundle); + +void rrdcontext_delete_from_sql_unsafe(RRDCONTEXT *rc); + +#define rrdcontext_lock(rc) netdata_mutex_lock(&((rc)->mutex)) +#define rrdcontext_unlock(rc) netdata_mutex_unlock(&((rc)->mutex)) + +// ---------------------------------------------------------------------------- +// Updates triggers + +static void rrdmetric_trigger_updates(RRDMETRIC *rm, bool force, bool escalate); +static void rrdinstance_trigger_updates(RRDINSTANCE *ri, bool force, bool escalate); +static void rrdcontext_trigger_updates(RRDCONTEXT *rc, bool force); + +// ---------------------------------------------------------------------------- +// visualizing flags + +static void rrd_flags_to_buffer(RRD_FLAGS flags, BUFFER *wb) { + if(flags & RRD_FLAG_QUEUED) + buffer_strcat(wb, "QUEUED "); + + if(flags & RRD_FLAG_DELETED) + buffer_strcat(wb, "DELETED "); + + if(flags & RRD_FLAG_COLLECTED) + buffer_strcat(wb, "COLLECTED "); + + if(flags & RRD_FLAG_UPDATED) + buffer_strcat(wb, "UPDATED "); + + if(flags & RRD_FLAG_ARCHIVED) + buffer_strcat(wb, "ARCHIVED "); + + if(flags & RRD_FLAG_OWN_LABELS) + buffer_strcat(wb, "OWN_LABELS "); + + if(flags & RRD_FLAG_LIVE_RETENTION) + buffer_strcat(wb, "LIVE_RETENTION "); + + if(flags & RRD_FLAG_DONT_PROCESS) + buffer_strcat(wb, "DONT_PROCESS "); + + if(flags & RRD_FLAG_HIDDEN) + buffer_strcat(wb, "HIDDEN "); +} + +static void rrd_reasons_to_buffer(RRD_FLAGS flags, BUFFER *wb) { + for(int i = 0, added = 0; rrdcontext_reasons[i].name ; i++) { + if (flags & rrdcontext_reasons[i].flag) { + if (added) + buffer_strcat(wb, ", "); + buffer_strcat(wb, rrdcontext_reasons[i].name); + added++; + } + } +} + +// ---------------------------------------------------------------------------- +// logging of all data collected + +#ifdef LOG_TRANSITIONS +static void log_transition(STRING *metric, STRING *instance, STRING *context, RRD_FLAGS flags, const char *msg) { + BUFFER *wb = buffer_create(1000); + + buffer_sprintf(wb, "RRD TRANSITION: context '%s'", string2str(context)); + + if(instance) + buffer_sprintf(wb, ", instance '%s'", string2str(instance)); + + if(metric) + buffer_sprintf(wb, ", metric '%s'", string2str(metric)); + + buffer_sprintf(wb, ", triggered by %s: ", msg); + + rrd_flags_to_buffer(flags, wb); + + buffer_strcat(wb, ", reasons: "); + + rrd_reasons_to_buffer(flags, wb); + + internal_error(true, "%s", buffer_tostring(wb)); + buffer_free(wb); +} +#else +#define log_transition(metric, instance, context, flags, msg) debug_dummy() +#endif + +#ifdef LOG_RRDINSTANCES +static void rrdinstance_log(RRDINSTANCE *ri, const char *msg) { + char uuid[UUID_STR_LEN]; + + uuid_unparse(ri->uuid, uuid); + + BUFFER *wb = buffer_create(1000); + + buffer_sprintf(wb, + "RRDINSTANCE: %s id '%s' (host '%s'), uuid '%s', name '%s', context '%s', title '%s', units '%s', family '%s', priority %zu, chart type '%s', update every %d, rrdset '%s', flags %s%s%s%s%s%s%s%s, first_time_t %ld, last_time_t %ld", + msg, + string2str(ri->id), + ri->rc->rrdhost->hostname, + uuid, + string2str(ri->name), + string2str(ri->rc->id), + string2str(ri->title), + string2str(ri->units), + string2str(ri->family), + ri->priority, + rrdset_type_name(ri->chart_type), + ri->update_every, + ri->rrdset?ri->rrdset->id:"NONE", + ri->flags & RRD_FLAG_DELETED ?"DELETED ":"", + ri->flags & RRD_FLAG_UPDATED ?"UPDATED ":"", + rrd_flag_is_collected(ri) ?"COLLECTED ":"", + rrd_flag_is_archived(ri) ?"ARCHIVED ":"", + ri->flags & RRD_FLAG_OWNLABELS ?"OWNLABELS ":"", + ri->flags & RRD_FLAG_LIVE_RETENTION ?"LIVE ":"", + ri->flags & RRD_FLAG_QUEUED ?"QUEUED ":"", + ri->flags & RRD_FLAG_DONT_TRIGGER ?"BLOCKED ":"", + ri->first_time_t, + ri->last_time_t + ); + + buffer_strcat(wb, ", update reasons: { "); + for(int i = 0, added = 0; rrdcontext_reasons[i].name ;i++) + if(ri->flags & rrdcontext_reasons[i].flag) { + if(added) buffer_strcat(wb, ", "); + buffer_strcat(wb, rrdcontext_reasons[i].name); + added++; + } + buffer_strcat(wb, " }"); + + buffer_strcat(wb, ", labels: { "); + if(ri->rrdlabels) { + if(!rrdlabels_to_buffer(ri->rrdlabels, wb, "", "=", "'", ", ", NULL, NULL, NULL, NULL)) + buffer_strcat(wb, "EMPTY }"); + else + buffer_strcat(wb, " }"); + } + else + buffer_strcat(wb, "NONE }"); + + buffer_strcat(wb, ", metrics: { "); + if(ri->rrdmetrics) { + RRDMETRIC *v; + int i = 0; + dfe_start_read((DICTIONARY *)ri->rrdmetrics, v) { + buffer_sprintf(wb, "%s%s", i?",":"", v_name); + i++; + } + dfe_done(v); + + if(!i) + buffer_strcat(wb, "EMPTY }"); + else + buffer_strcat(wb, " }"); + } + else + buffer_strcat(wb, "NONE }"); + + internal_error(true, "%s", buffer_tostring(wb)); + buffer_free(wb); +} +#else +#define rrdinstance_log(ir, msg) debug_dummy() +#endif + +// ---------------------------------------------------------------------------- +// RRDMETRIC + +static void rrdmetric_free(RRDMETRIC *rm) { + string_freez(rm->id); + string_freez(rm->name); + + rm->id = NULL; + rm->name = NULL; + rm->ri = NULL; +} + +static void rrdmetric_update_retention(RRDMETRIC *rm) { + time_t min_first_time_t = LONG_MAX, max_last_time_t = 0; + + if(rm->rrddim) { + min_first_time_t = rrddim_first_entry_t(rm->rrddim); + max_last_time_t = rrddim_last_entry_t(rm->rrddim); + } +#ifdef ENABLE_DBENGINE + else { + RRDHOST *rrdhost = rm->ri->rc->rrdhost; + for (int tier = 0; tier < storage_tiers; tier++) { + if(!rrdhost->storage_instance[tier]) continue; + + time_t first_time_t, last_time_t; + if (rrdeng_metric_retention_by_uuid(rrdhost->storage_instance[tier], &rm->uuid, &first_time_t, &last_time_t) == 0) { + if (first_time_t < min_first_time_t) + min_first_time_t = first_time_t; + + if (last_time_t > max_last_time_t) + max_last_time_t = last_time_t; + } + } + } +#endif + + if(min_first_time_t == LONG_MAX) + min_first_time_t = 0; + + if(min_first_time_t > max_last_time_t) { + internal_error(true, "RRDMETRIC: retention of '%s' is flipped", string2str(rm->id)); + time_t tmp = min_first_time_t; + min_first_time_t = max_last_time_t; + max_last_time_t = tmp; + } + + // check if retention changed + + if (min_first_time_t != rm->first_time_t) { + rm->first_time_t = min_first_time_t; + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if (max_last_time_t != rm->last_time_t) { + rm->last_time_t = max_last_time_t; + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + if(unlikely(!rm->first_time_t && !rm->last_time_t)) + rrd_flag_set_deleted(rm, RRD_FLAG_UPDATE_REASON_ZERO_RETENTION); + + rm->flags |= RRD_FLAG_LIVE_RETENTION; +} + +// called when this rrdmetric is inserted to the rrdmetrics dictionary of a rrdinstance +static void rrdmetric_insert_callback(const char *id __maybe_unused, void *value, void *data) { + RRDMETRIC *rm = value; + + // link it to its parent + rm->ri = data; + + // remove flags that we need to figure out at runtime + rm->flags = rm->flags & RRD_FLAGS_ALLOWED_EXTERNALLY_ON_NEW_OBJECTS; + + rm->created_ut = now_realtime_usec(); + + // signal the react callback to do the job + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_NEW_OBJECT); +} + +// called when this rrdmetric is deleted from the rrdmetrics dictionary of a rrdinstance +static void rrdmetric_delete_callback(const char *id __maybe_unused, void *value, void *data __maybe_unused) { + RRDMETRIC *rm = value; + + internal_error(rm->rrddim, "RRDMETRIC: '%s' is freed but there is a RRDDIM linked to it.", string2str(rm->id)); + + // free the resources + rrdmetric_free(rm); +} + +// called when the same rrdmetric is inserted again to the rrdmetrics dictionary of a rrdinstance +static void rrdmetric_conflict_callback(const char *id __maybe_unused, void *oldv, void *newv, void *data __maybe_unused) { + RRDMETRIC *rm = oldv; + RRDMETRIC *rm_new = newv; + + internal_error(rm->id != rm_new->id, + "RRDMETRIC: '%s' cannot change id to '%s'", + string2str(rm->id), string2str(rm_new->id)); + + if(uuid_compare(rm->uuid, rm_new->uuid) != 0) { + char uuid1[UUID_STR_LEN], uuid2[UUID_STR_LEN]; + uuid_unparse(rm->uuid, uuid1); + uuid_unparse(rm_new->uuid, uuid2); + internal_error(true, "RRDMETRIC: '%s' of instance '%s' changed uuid from '%s' to '%s'", string2str(rm->id), string2str(rm->ri->id), uuid1, uuid2); + uuid_copy(rm->uuid, rm_new->uuid); + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_CHANGED_UUID); + } + + if(rm->rrddim && rm_new->rrddim && rm->rrddim != rm_new->rrddim) { + rm->rrddim = rm_new->rrddim; + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_CHANGED_LINKING); + } + + if(rm->rrddim && uuid_compare(rm->uuid, rm->rrddim->metric_uuid) != 0) { + char uuid1[UUID_STR_LEN], uuid2[UUID_STR_LEN]; + uuid_unparse(rm->uuid, uuid1); + uuid_unparse(rm_new->uuid, uuid2); + internal_error(true, "RRDMETRIC: '%s' is linked to RRDDIM '%s' but they have different UUIDs. RRDMETRIC has '%s', RRDDIM has '%s'", string2str(rm->id), rm->rrddim->id, uuid1, uuid2); + } + + if(rm->rrddim != rm_new->rrddim) + rm->rrddim = rm_new->rrddim; + + if(rm->name != rm_new->name) { + STRING *old = rm->name; + rm->name = string_dup(rm_new->name); + string_freez(old); + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_CHANGED_NAME); + } + + if(!rm->first_time_t || (rm_new->first_time_t && rm_new->first_time_t < rm->first_time_t)) { + rm->first_time_t = rm_new->first_time_t; + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if(!rm->last_time_t || (rm_new->last_time_t && rm_new->last_time_t > rm->last_time_t)) { + rm->last_time_t = rm_new->last_time_t; + rrd_flag_set_updated(rm, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + rm->flags |= (rm_new->flags & RRD_FLAGS_ALLOWED_EXTERNALLY_ON_NEW_OBJECTS); + + if(rrd_flag_is_collected(rm) && rrd_flag_is_archived(rm)) + rrd_flag_set_collected(rm); + + if(rm->flags & RRD_FLAG_UPDATED) + rm->flags |= RRD_FLAG_UPDATE_REASON_UPDATED_OBJECT; + + rrdmetric_free(rm_new); + + // the react callback will continue from here +} + +static void rrdmetric_react_callback(const char *id __maybe_unused, void *value, void *data __maybe_unused) { + RRDMETRIC *rm = value; + + rrdmetric_trigger_updates(rm, false, true); +} + +static void rrdmetrics_create(RRDINSTANCE *ri) { + if(unlikely(!ri)) return; + if(likely(ri->rrdmetrics)) return; + + ri->rrdmetrics = dictionary_create(DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + dictionary_register_insert_callback(ri->rrdmetrics, rrdmetric_insert_callback, (void *)ri); + dictionary_register_delete_callback(ri->rrdmetrics, rrdmetric_delete_callback, (void *)ri); + dictionary_register_conflict_callback(ri->rrdmetrics, rrdmetric_conflict_callback, (void *)ri); + dictionary_register_react_callback(ri->rrdmetrics, rrdmetric_react_callback, (void *)ri); +} + +static void rrdmetrics_destroy(RRDINSTANCE *ri) { + if(unlikely(!ri || !ri->rrdmetrics)) return; + dictionary_destroy(ri->rrdmetrics); + ri->rrdmetrics = NULL; +} + +static inline bool rrdmetric_should_be_deleted(RRDMETRIC *rm) { + if(likely(!(rm->flags & RRD_FLAG_DELETED))) + return false; + + if(likely(!(rm->flags & RRD_FLAG_LIVE_RETENTION))) + return false; + + if(unlikely(rm->flags & RRD_FLAGS_PREVENTING_DELETIONS)) + return false; + + if(likely(rm->rrddim)) + return false; + + if((now_realtime_usec() - rm->created_ut) < 600 * USEC_PER_SEC) + return false; + + rrdmetric_update_retention(rm); + if(rm->first_time_t || rm->last_time_t) + return false; + + return true; +} + +static void rrdmetric_trigger_updates(RRDMETRIC *rm, bool force, bool escalate) { + if(likely(!force && !(rm->flags & RRD_FLAG_UPDATED))) return; + + if(unlikely(rrd_flag_is_collected(rm) && !rm->rrddim)) + rrd_flag_set_archived(rm); + + if(unlikely((rm->flags & RRD_FLAG_UPDATE_REASON_DISCONNECTED_CHILD) && rrd_flag_is_collected(rm))) + rrd_flag_set_archived(rm); + + rrdmetric_update_retention(rm); + + if(unlikely(escalate && rm->flags & RRD_FLAG_UPDATED && !(rm->ri->flags & RRD_FLAG_DONT_PROCESS))) { + log_transition(rm->id, rm->ri->id, rm->ri->rc->id, rm->flags, "RRDMETRIC"); + rrdinstance_trigger_updates(rm->ri, true, true); + } +} + +static inline void rrdmetric_from_rrddim(RRDDIM *rd) { + if(unlikely(!rd->rrdset)) + fatal("RRDMETRIC: rrddim '%s' does not have a rrdset.", rd->id); + + if(unlikely(!rd->rrdset->rrdhost)) + fatal("RRDMETRIC: rrdset '%s' does not have a rrdhost", rd->rrdset->id); + + if(unlikely(!rd->rrdset->rrdinstance)) + fatal("RRDMETRIC: rrdset '%s' does not have a rrdinstance", rd->rrdset->id); + + RRDINSTANCE *ri = rrdinstance_acquired_value(rd->rrdset->rrdinstance); + + RRDMETRIC trm = { + .id = string_strdupz(rd->id), + .name = string_strdupz(rd->name), + .flags = RRD_FLAG_NONE, + .rrddim = rd, + }; + uuid_copy(trm.uuid, rd->metric_uuid); + + RRDMETRIC_ACQUIRED *rma = (RRDMETRIC_ACQUIRED *)dictionary_set_and_acquire_item(ri->rrdmetrics, string2str(trm.id), &trm, sizeof(trm)); + + if(rd->rrdmetric) + rrdmetric_release(rd->rrdmetric); + + rd->rrdmetric = rma; +} + +#define rrddim_get_rrdmetric(rd) rrddim_get_rrdmetric_with_trace(rd, __FUNCTION__) +static inline RRDMETRIC *rrddim_get_rrdmetric_with_trace(RRDDIM *rd, const char *function) { + if(unlikely(!rd->rrdmetric)) { + error("RRDMETRIC: RRDDIM '%s' is not linked to an RRDMETRIC at %s()", rd->id, function); + return NULL; + } + + RRDMETRIC *rm = rrdmetric_acquired_value(rd->rrdmetric); + + if(unlikely(rm->rrddim != rd)) + fatal("RRDMETRIC: '%s' is not linked to RRDDIM '%s' at %s()", string2str(rm->id), rd->id, function); + + return rm; +} + +static inline void rrdmetric_rrddim_is_freed(RRDDIM *rd) { + RRDMETRIC *rm = rrddim_get_rrdmetric(rd); + if(unlikely(!rm)) return; + + if(unlikely(rrd_flag_is_collected(rm))) + rrd_flag_set_archived(rm); + + rm->rrddim = NULL; + rrdmetric_trigger_updates(rm, false, true); + rrdmetric_release(rd->rrdmetric); + rd->rrdmetric = NULL; +} + +static inline void rrdmetric_updated_rrddim_flags(RRDDIM *rd) { + RRDMETRIC *rm = rrddim_get_rrdmetric(rd); + if(unlikely(!rm)) return; + + if(unlikely(rd->flags & (RRDDIM_FLAG_ARCHIVED | RRDDIM_FLAG_OBSOLETE))) { + if(unlikely(rrd_flag_is_collected(rm))) + rrd_flag_set_archived(rm); + } + + rrdmetric_trigger_updates(rm, false, true); +} + +static inline void rrdmetric_collected_rrddim(RRDDIM *rd) { + RRDMETRIC *rm = rrddim_get_rrdmetric(rd); + if(unlikely(!rm)) return; + + if(unlikely(!rrd_flag_is_collected(rm))) + rrd_flag_set_collected(rm); + + rrdmetric_trigger_updates(rm, false, true); +} + +// ---------------------------------------------------------------------------- +// RRDINSTANCE + +static void rrdinstance_free(RRDINSTANCE *ri) { + + if(ri->flags & RRD_FLAG_OWN_LABELS) + dictionary_destroy(ri->rrdlabels); + + rrdmetrics_destroy(ri); + string_freez(ri->id); + string_freez(ri->name); + string_freez(ri->title); + string_freez(ri->units); + string_freez(ri->family); + + ri->id = NULL; + ri->name = NULL; + ri->title = NULL; + ri->units = NULL; + ri->family = NULL; + ri->rc = NULL; + ri->rrdlabels = NULL; + ri->rrdmetrics = NULL; + ri->rrdset = NULL; +} + +static void rrdinstance_insert_callback(const char *id __maybe_unused, void *value, void *data) { + static STRING *ml_anomaly_rates_id = NULL; + + if(unlikely(!ml_anomaly_rates_id)) + ml_anomaly_rates_id = string_strdupz(ML_ANOMALY_RATES_CHART_ID); + + RRDINSTANCE *ri = value; + + // link it to its parent + ri->rc = data; + + ri->flags = ri->flags & RRD_FLAGS_ALLOWED_EXTERNALLY_ON_NEW_OBJECTS; + + if(!ri->name) + ri->name = string_dup(ri->id); + + if(ri->rrdset && ri->rrdset->state) { + ri->rrdlabels = ri->rrdset->state->chart_labels; + if(ri->flags & RRD_FLAG_OWN_LABELS) + ri->flags &= ~RRD_FLAG_OWN_LABELS; + } + else { + ri->rrdlabels = rrdlabels_create(); + ri->flags |= RRD_FLAG_OWN_LABELS; + } + + if(ri->rrdset) { + if(unlikely((ri->rrdset->flags & RRDSET_FLAG_HIDDEN) || (ri->rrdset->state && ri->rrdset->state->is_ar_chart))) + ri->flags |= RRD_FLAG_HIDDEN; + else + ri->flags &= ~RRD_FLAG_HIDDEN; + } + + // we need this when loading from SQL + if(unlikely(ri->id == ml_anomaly_rates_id)) + ri->flags |= RRD_FLAG_HIDDEN; + + rrdmetrics_create(ri); + rrdinstance_log(ri, "INSERT"); + + // signal the react callback to do the job + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_NEW_OBJECT); +} + +static void rrdinstance_delete_callback(const char *id, void *value, void *data) { + (void)id; + RRDCONTEXT *rc = data; (void)rc; + RRDINSTANCE *ri = (RRDINSTANCE *)value; + + rrdinstance_log(ri, "DELETE"); + + internal_error(ri->rrdset, "RRDINSTANCE: '%s' is freed but there is a RRDSET linked to it.", string2str(ri->id)); + + rrdinstance_free(ri); +} + +static void rrdinstance_conflict_callback(const char *id __maybe_unused, void *oldv, void *newv, void *data __maybe_unused) { + RRDINSTANCE *ri = (RRDINSTANCE *)oldv; + RRDINSTANCE *ri_new = (RRDINSTANCE *)newv; + + internal_error(ri->id != ri_new->id, + "RRDINSTANCE: '%s' cannot change id to '%s'", + string2str(ri->id), string2str(ri_new->id)); + + if(uuid_compare(ri->uuid, ri_new->uuid) != 0) { + uuid_copy(ri->uuid, ri_new->uuid); + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_UUID); + } + + if(ri->rrdset && ri_new->rrdset && ri->rrdset != ri_new->rrdset) { + ri->rrdset = ri_new->rrdset; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_LINKING); + } + + if(ri->rrdset && ri->rrdset->chart_uuid && uuid_compare(ri->uuid, *ri->rrdset->chart_uuid) != 0) { + char uuid1[UUID_STR_LEN], uuid2[UUID_STR_LEN]; + uuid_unparse(ri->uuid, uuid1); + uuid_unparse(*ri->rrdset->chart_uuid, uuid2); + internal_error(true, "RRDINSTANCE: '%s' is linked to RRDSET '%s' but they have different UUIDs. RRDINSTANCE has '%s', RRDSET has '%s'", string2str(ri->id), ri->rrdset->id, uuid1, uuid2); + } + + if(ri->name != ri_new->name) { + STRING *old = ri->name; + ri->name = string_dup(ri_new->name); + string_freez(old); + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_NAME); + } + + if(ri->title != ri_new->title) { + STRING *old = ri->title; + ri->title = string_dup(ri_new->title); + string_freez(old); + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_TITLE); + } + + if(ri->units != ri_new->units) { + STRING *old = ri->units; + ri->units = string_dup(ri_new->units); + string_freez(old); + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_UNITS); + } + + if(ri->family != ri_new->family) { + STRING *old = ri->family; + ri->family = string_dup(ri_new->family); + string_freez(old); + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_FAMILY); + } + + if(ri->chart_type != ri_new->chart_type) { + ri->chart_type = ri_new->chart_type; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_CHART_TYPE); + } + + if(ri->priority != ri_new->priority) { + ri->priority = ri_new->priority; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY); + } + + if(ri->update_every != ri_new->update_every) { + ri->update_every = ri_new->update_every; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_UPDATE_EVERY); + } + + if(ri->rrdset != ri_new->rrdset) { + ri->rrdset = ri_new->rrdset; + + if(ri->rrdset && (ri->flags & RRD_FLAG_OWN_LABELS)) { + DICTIONARY *old = ri->rrdlabels; + ri->rrdlabels = ri->rrdset->state->chart_labels; + ri->flags &= ~RRD_FLAG_OWN_LABELS; + rrdlabels_destroy(old); + } + else if(!ri->rrdset && !(ri->flags & RRD_FLAG_OWN_LABELS)) { + ri->rrdlabels = rrdlabels_create(); + ri->flags |= RRD_FLAG_OWN_LABELS; + } + } + + if(ri->rrdset) { + if(unlikely((ri->rrdset->flags & RRDSET_FLAG_HIDDEN) || (ri->rrdset->state && ri->rrdset->state->is_ar_chart))) + ri->flags |= RRD_FLAG_HIDDEN; + else + ri->flags &= ~RRD_FLAG_HIDDEN; + } + + ri->flags |= (ri_new->flags & RRD_FLAGS_ALLOWED_EXTERNALLY_ON_NEW_OBJECTS); + + if(rrd_flag_is_collected(ri) && rrd_flag_is_archived(ri)) + rrd_flag_set_collected(ri); + + if(ri->flags & RRD_FLAG_UPDATED) + ri->flags |= RRD_FLAG_UPDATE_REASON_UPDATED_OBJECT; + + rrdinstance_log(ri, "CONFLICT"); + + // free the new one + rrdinstance_free(ri_new); + + // the react callback will continue from here +} + +static void rrdinstance_react_callback(const char *id __maybe_unused, void *value, void *data __maybe_unused) { + RRDINSTANCE *ri = value; + + rrdinstance_trigger_updates(ri, false, true); +} + +void rrdinstances_create(RRDCONTEXT *rc) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + if(unlikely(!rc || rc->rrdinstances)) return; + + rc->rrdinstances = dictionary_create(DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + dictionary_register_insert_callback(rc->rrdinstances, rrdinstance_insert_callback, (void *)rc); + dictionary_register_delete_callback(rc->rrdinstances, rrdinstance_delete_callback, (void *)rc); + dictionary_register_conflict_callback(rc->rrdinstances, rrdinstance_conflict_callback, (void *)rc); + dictionary_register_react_callback(rc->rrdinstances, rrdinstance_react_callback, (void *)rc); +} + +void rrdinstances_destroy(RRDCONTEXT *rc) { + if(unlikely(!rc || !rc->rrdinstances)) return; + + dictionary_destroy(rc->rrdinstances); + rc->rrdinstances = NULL; +} + +static inline bool rrdinstance_should_be_deleted(RRDINSTANCE *ri) { + if(likely(!(ri->flags & RRD_FLAG_DELETED))) + return false; + + if(likely(!(ri->flags & RRD_FLAG_LIVE_RETENTION))) + return false; + + if(unlikely(ri->flags & RRD_FLAGS_PREVENTING_DELETIONS)) + return false; + + if(likely(ri->rrdset)) + return false; + + if(unlikely(dictionary_stats_referenced_items(ri->rrdmetrics) != 0)) + return false; + + if(unlikely(dictionary_stats_entries(ri->rrdmetrics) != 0)) + return false; + + if(ri->first_time_t || ri->last_time_t) + return false; + + return true; +} + +static void rrdinstance_trigger_updates(RRDINSTANCE *ri, bool force, bool escalate) { + if(unlikely(ri->flags & RRD_FLAG_DONT_PROCESS)) return; + if(unlikely(!force && !(ri->flags & RRD_FLAG_UPDATED))) return; + + if(likely(ri->rrdset)) { + if(unlikely(ri->rrdset->priority != ri->priority)) { + ri->priority = ri->rrdset->priority; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY); + } + if(unlikely(ri->rrdset->update_every != ri->update_every)) { + ri->update_every = ri->rrdset->update_every; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_UPDATE_EVERY); + } + } + else if(unlikely(rrd_flag_is_collected(ri))) { + rrd_flag_set_archived(ri); + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_LINKING); + } + + time_t min_first_time_t = LONG_MAX, max_last_time_t = 0; + size_t metrics_active = 0, metrics_deleted = 0; + bool live_retention = true, currently_collected = false; + { + RRDMETRIC *rm; + dfe_start_read((DICTIONARY *)ri->rrdmetrics, rm) { + if(!(rm->flags & RRD_FLAG_LIVE_RETENTION)) + live_retention = false; + + if (unlikely((rrdmetric_should_be_deleted(rm)))) { + metrics_deleted++; + rrd_flag_unset_updated(rm); + continue; + } + + if(rm->flags & RRD_FLAG_COLLECTED) + currently_collected = true; + + metrics_active++; + + if (rm->first_time_t && rm->first_time_t < min_first_time_t) + min_first_time_t = rm->first_time_t; + + if (rm->last_time_t && rm->last_time_t > max_last_time_t) + max_last_time_t = rm->last_time_t; + + rrd_flag_unset_updated(rm); + } + dfe_done(rm); + } + + if(live_retention && !(ri->flags & RRD_FLAG_LIVE_RETENTION)) + ri->flags |= RRD_FLAG_LIVE_RETENTION; + else if(!live_retention && (ri->flags & RRD_FLAG_LIVE_RETENTION)) + ri->flags &= ~RRD_FLAG_LIVE_RETENTION; + + if(unlikely(!metrics_active)) { + // no metrics available + + if(ri->first_time_t) { + ri->first_time_t = 0; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if(ri->last_time_t) { + ri->last_time_t = 0; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + rrd_flag_set_deleted(ri, RRD_FLAG_UPDATE_REASON_ZERO_RETENTION); + } + else { + // we have active metrics... + + if (unlikely(min_first_time_t == LONG_MAX)) + min_first_time_t = 0; + + if (unlikely(min_first_time_t == 0 || max_last_time_t == 0)) { + if(ri->first_time_t) { + ri->first_time_t = 0; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if(ri->last_time_t) { + ri->last_time_t = 0; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + if(unlikely(live_retention)) + rrd_flag_set_deleted(ri, RRD_FLAG_UPDATE_REASON_ZERO_RETENTION); + } + else { + ri->flags &= ~RRD_FLAG_UPDATE_REASON_ZERO_RETENTION; + + if (unlikely(ri->first_time_t != min_first_time_t)) { + ri->first_time_t = min_first_time_t; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if (unlikely(ri->last_time_t != max_last_time_t)) { + ri->last_time_t = max_last_time_t; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + if(likely(currently_collected)) + rrd_flag_set_collected(ri); + else + rrd_flag_set_archived(ri); + } + } + + if(unlikely(escalate && ri->flags & RRD_FLAG_UPDATED && !(ri->rc->flags & RRD_FLAG_DONT_PROCESS))) { + log_transition(NULL, ri->id, ri->rc->id, ri->flags, "RRDINSTANCE"); + rrdcontext_trigger_updates(ri->rc, true); + } +} + +static inline void rrdinstance_from_rrdset(RRDSET *st) { + RRDCONTEXT trc = { + .id = string_strdupz(st->context), + .title = string_strdupz(st->title), + .units = string_strdupz(st->units), + .family = string_strdupz(st->family), + .priority = st->priority, + .chart_type = st->chart_type, + .flags = RRD_FLAG_NONE, + .rrdhost = st->rrdhost, + }; + + RRDCONTEXT_ACQUIRED *rca = (RRDCONTEXT_ACQUIRED *)dictionary_set_and_acquire_item((DICTIONARY *)st->rrdhost->rrdctx, string2str(trc.id), &trc, sizeof(trc)); + RRDCONTEXT *rc = rrdcontext_acquired_value(rca); + + RRDINSTANCE tri = { + .id = string_strdupz(st->id), + .name = string_strdupz(st->name), + .units = string_strdupz(st->units), + .family = string_strdupz(st->family), + .title = string_strdupz(st->title), + .chart_type = st->chart_type, + .priority = st->priority, + .update_every = st->update_every, + .flags = RRD_FLAG_DONT_PROCESS, + .rrdset = st, + }; + uuid_copy(tri.uuid, *st->chart_uuid); + + RRDINSTANCE_ACQUIRED *ria = (RRDINSTANCE_ACQUIRED *)dictionary_set_and_acquire_item(rc->rrdinstances, string2str(tri.id), &tri, sizeof(tri)); + + RRDCONTEXT_ACQUIRED *rca_old = st->rrdcontext; + RRDINSTANCE_ACQUIRED *ria_old = st->rrdinstance; + + st->rrdcontext = rca; + st->rrdinstance = ria; + + if(rca == rca_old) { + rrdcontext_release(rca_old); + rca_old = NULL; + } + + if(ria == ria_old) { + rrdinstance_release(ria_old); + ria_old = NULL; + } + + if(rca_old && ria_old) { + // the chart changed context + RRDCONTEXT *rc_old = rrdcontext_acquired_value(rca_old); + RRDINSTANCE *ri_old = rrdinstance_acquired_value(ria_old); + + // migrate all dimensions to the new metrics + rrdset_rdlock(st); + RRDDIM *rd; + rrddim_foreach_read(rd, st) { + if (!rd->rrdmetric) continue; + + RRDMETRIC *rm_old = rrdmetric_acquired_value(rd->rrdmetric); + rm_old->flags = RRD_FLAG_DELETED|RRD_FLAG_UPDATED|RRD_FLAG_LIVE_RETENTION|RRD_FLAG_UPDATE_REASON_UNUSED|RRD_FLAG_UPDATE_REASON_ZERO_RETENTION; + rm_old->rrddim = NULL; + rm_old->first_time_t = 0; + rm_old->last_time_t = 0; + + rrdmetric_release(rd->rrdmetric); + rd->rrdmetric = NULL; + + rrdmetric_from_rrddim(rd); + } + rrdset_unlock(st); + + // mark the old instance, ready to be deleted + if(!(ri_old->flags & RRD_FLAG_OWN_LABELS)) + ri_old->rrdlabels = rrdlabels_create(); + + ri_old->flags = RRD_FLAG_OWN_LABELS|RRD_FLAG_DELETED|RRD_FLAG_UPDATED|RRD_FLAG_LIVE_RETENTION|RRD_FLAG_UPDATE_REASON_UNUSED|RRD_FLAG_UPDATE_REASON_ZERO_RETENTION; + ri_old->rrdset = NULL; + ri_old->first_time_t = 0; + ri_old->last_time_t = 0; + + ri_old->flags &= ~RRD_FLAG_DONT_PROCESS; + rc_old->flags &= ~RRD_FLAG_DONT_PROCESS; + + rrdinstance_trigger_updates(ri_old, true, true); + + ri_old->flags |= RRD_FLAG_DONT_PROCESS; + rrdinstance_release(ria_old); + + /* + // trigger updates on the old context + if(!dictionary_stats_entries(rc_old->rrdinstances) && !dictionary_stats_referenced_items(rc_old->rrdinstances)) { + rrdcontext_lock(rc_old); + rc_old->flags = ((rc_old->flags & RRD_FLAG_QUEUED)?RRD_FLAG_QUEUED:RRD_FLAG_NONE)|RRD_FLAG_DELETED|RRD_FLAG_UPDATED|RRD_FLAG_LIVE_RETENTION|RRD_FLAG_UPDATE_REASON_UNUSED|RRD_FLAG_UPDATE_REASON_ZERO_RETENTION; + rc_old->first_time_t = 0; + rc_old->last_time_t = 0; + rrdcontext_unlock(rc_old); + rrdcontext_trigger_updates(rc_old, true); + } + else + rrdcontext_trigger_updates(rc_old, true); + */ + + rrdcontext_release(rca_old); + rca_old = NULL; + ria_old = NULL; + } + + if(rca_old || ria_old) + fatal("RRDCONTEXT: cannot switch rrdcontext without switching rrdinstance too"); +} + +#define rrdset_get_rrdinstance(st) rrdset_get_rrdinstance_with_trace(st, __FUNCTION__); +static inline RRDINSTANCE *rrdset_get_rrdinstance_with_trace(RRDSET *st, const char *function) { + if(unlikely(!st->rrdinstance)) { + error("RRDINSTANCE: RRDSET '%s' is not linked to an RRDINSTANCE at %s()", st->id, function); + return NULL; + } + + RRDINSTANCE *ri = rrdinstance_acquired_value(st->rrdinstance); + + if(unlikely(ri->rrdset != st)) + fatal("RRDINSTANCE: '%s' is not linked to RRDSET '%s' at %s()", string2str(ri->id), st->id, function); + + return ri; +} + +static inline void rrdinstance_rrdset_is_freed(RRDSET *st) { + RRDINSTANCE *ri = rrdset_get_rrdinstance(st); + if(unlikely(!ri)) return; + + rrd_flag_set_archived(ri); + + if(!(ri->flags & RRD_FLAG_OWN_LABELS)) { + ri->flags |= RRD_FLAG_OWN_LABELS; + ri->rrdlabels = rrdlabels_create(); + rrdlabels_copy(ri->rrdlabels, st->state->chart_labels); + } + + ri->rrdset = NULL; + + ri->flags &= ~RRD_FLAG_DONT_PROCESS; + rrdinstance_trigger_updates(ri, false, true); + ri->flags |= RRD_FLAG_DONT_PROCESS; + + rrdinstance_release(st->rrdinstance); + st->rrdinstance = NULL; + + rrdcontext_release(st->rrdcontext); + st->rrdcontext = NULL; +} + +static inline void rrdinstance_updated_rrdset_name(RRDSET *st) { + // the chart may not be initialized when this is called + if(unlikely(!st->rrdinstance)) return; + + RRDINSTANCE *ri = rrdset_get_rrdinstance(st); + if(unlikely(!ri)) return; + + STRING *old = ri->name; + ri->name = string_strdupz(st->name); + + if(ri->name != old) + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_NAME); + + string_freez(old); + + rrdinstance_trigger_updates(ri, false, true); +} + +static inline void rrdinstance_updated_rrdset_flags_no_action(RRDINSTANCE *ri, RRDSET *st) { + if(unlikely(st->flags & (RRDSET_FLAG_ARCHIVED | RRDSET_FLAG_OBSOLETE))) + rrd_flag_set_archived(ri); + + if(unlikely((st->flags & RRDSET_FLAG_HIDDEN) && !(ri->flags & RRD_FLAG_HIDDEN))) { + ri->flags |= RRD_FLAG_HIDDEN; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_FLAGS); + } + else if(unlikely(!(st->flags & RRDSET_FLAG_HIDDEN) && (ri->flags & RRD_FLAG_HIDDEN))) { + ri->flags &= ~RRD_FLAG_HIDDEN; + rrd_flag_set_updated(ri, RRD_FLAG_UPDATE_REASON_CHANGED_FLAGS); + } +} + +static inline void rrdinstance_updated_rrdset_flags(RRDSET *st) { + RRDINSTANCE *ri = rrdset_get_rrdinstance(st); + if(unlikely(!ri)) return; + + rrdinstance_updated_rrdset_flags_no_action(ri, st); + + ri->flags &= ~RRD_FLAG_DONT_PROCESS; + rrdinstance_trigger_updates(ri, false, true); + ri->flags |= RRD_FLAG_DONT_PROCESS; +} + +static inline void rrdinstance_collected_rrdset(RRDSET *st) { + RRDINSTANCE *ri = rrdset_get_rrdinstance(st); + if(unlikely(!ri)) return; + + rrdinstance_updated_rrdset_flags_no_action(ri, st); + + if(unlikely(!rrd_flag_is_collected(ri))) + rrd_flag_set_collected(ri); + + if(unlikely(ri->flags & RRD_FLAG_DONT_PROCESS)) + ri->flags &= ~RRD_FLAG_DONT_PROCESS; + + rrdinstance_trigger_updates(ri, false, true); +} + +// ---------------------------------------------------------------------------- +// RRDCONTEXT + +static void rrdcontext_freez(RRDCONTEXT *rc) { + string_freez(rc->id); + string_freez(rc->title); + string_freez(rc->units); + string_freez(rc->family); +} + +static uint64_t rrdcontext_get_next_version(RRDCONTEXT *rc) { + time_t now = now_realtime_sec(); + uint64_t version = MAX(rc->version, rc->hub.version); + version = MAX((uint64_t)now, version); + version++; + return version; +} + +static void rrdcontext_message_send_unsafe(RRDCONTEXT *rc, bool snapshot __maybe_unused, void *bundle __maybe_unused) { + + // save it, so that we know the last version we sent to hub + rc->version = rc->hub.version = rrdcontext_get_next_version(rc); + rc->hub.id = string2str(rc->id); + rc->hub.title = string2str(rc->title); + rc->hub.units = string2str(rc->units); + rc->hub.family = string2str(rc->family); + rc->hub.chart_type = rrdset_type_name(rc->chart_type); + rc->hub.priority = rc->priority; + rc->hub.first_time_t = rc->first_time_t; + rc->hub.last_time_t = rrd_flag_is_collected(rc) ? 0 : rc->last_time_t; + rc->hub.deleted = (rc->flags & RRD_FLAG_DELETED) ? true : false; + +#ifdef ENABLE_ACLK + struct context_updated message = { + .id = rc->hub.id, + .version = rc->hub.version, + .title = rc->hub.title, + .units = rc->hub.units, + .family = rc->hub.family, + .chart_type = rc->hub.chart_type, + .priority = rc->hub.priority, + .first_entry = rc->hub.first_time_t, + .last_entry = rc->hub.last_time_t, + .deleted = rc->hub.deleted, + }; + + if(likely(!(rc->flags & RRD_FLAG_HIDDEN))) { + if (snapshot) { + if (!rc->hub.deleted) + contexts_snapshot_add_ctx_update(bundle, &message); + } + else + contexts_updated_add_ctx_update(bundle, &message); + } +#endif + + // store it to SQL + + if(rc->flags & RRD_FLAG_DELETED) { + rrdcontext_delete_from_sql_unsafe(rc); + } + else { + if (ctx_store_context(&rc->rrdhost->host_uuid, &rc->hub) != 0) + error("RRDCONTEXT: failed to save context '%s' version %lu to SQL.", rc->hub.id, rc->hub.version); + } +} + +static bool check_if_cloud_version_changed_unsafe(RRDCONTEXT *rc, bool sending __maybe_unused) { + bool id_changed = false, + title_changed = false, + units_changed = false, + family_changed = false, + chart_type_changed = false, + priority_changed = false, + first_time_changed = false, + last_time_changed = false, + deleted_changed = false; + + if(unlikely(string2str(rc->id) != rc->hub.id)) + id_changed = true; + + if(unlikely(string2str(rc->title) != rc->hub.title)) + title_changed = true; + + if(unlikely(string2str(rc->units) != rc->hub.units)) + units_changed = true; + + if(unlikely(string2str(rc->family) != rc->hub.family)) + family_changed = true; + + if(unlikely(rrdset_type_name(rc->chart_type) != rc->hub.chart_type)) + chart_type_changed = true; + + if(unlikely(rc->priority != rc->hub.priority)) + priority_changed = true; + + if(unlikely((uint64_t)rc->first_time_t != rc->hub.first_time_t)) + first_time_changed = true; + + if(unlikely((uint64_t)(rrd_flag_is_collected(rc) ? 0 : rc->last_time_t) != rc->hub.last_time_t)) + last_time_changed = true; + + if(unlikely(((rc->flags & RRD_FLAG_DELETED) ? true : false) != rc->hub.deleted)) + deleted_changed = true; + + if(unlikely(id_changed || title_changed || units_changed || family_changed || chart_type_changed || priority_changed || first_time_changed || last_time_changed || deleted_changed)) { + + internal_error(true, "RRDCONTEXT: %s NEW VERSION '%s'%s, version %zu, title '%s'%s, units '%s'%s, family '%s'%s, chart type '%s'%s, priority %u%s, first_time_t %ld%s, last_time_t %ld%s, deleted '%s'%s, (queued for %llu ms, expected %llu ms)", + sending?"SENDING":"QUEUE", + string2str(rc->id), id_changed ? " (CHANGED)" : "", + rc->version, + string2str(rc->title), title_changed ? " (CHANGED)" : "", + string2str(rc->units), units_changed ? " (CHANGED)" : "", + string2str(rc->family), family_changed ? " (CHANGED)" : "", + rrdset_type_name(rc->chart_type), chart_type_changed ? " (CHANGED)" : "", + rc->priority, priority_changed ? " (CHANGED)" : "", + rc->first_time_t, first_time_changed ? " (CHANGED)" : "", + rrd_flag_is_collected(rc) ? 0 : rc->last_time_t, last_time_changed ? " (CHANGED)" : "", + (rc->flags & RRD_FLAG_DELETED) ? "true" : "false", deleted_changed ? " (CHANGED)" : "", + sending ? (now_realtime_usec() - rc->queue.queued_ut) / USEC_PER_MS : 0, + sending ? (rc->queue.scheduled_dispatch_ut - rc->queue.queued_ut) / USEC_PER_SEC : 0 + ); + return true; + } + + return false; +} + +static void rrdcontext_insert_callback(const char *id, void *value, void *data) { + (void)id; + RRDHOST *host = (RRDHOST *)data; + RRDCONTEXT *rc = (RRDCONTEXT *)value; + + rc->rrdhost = host; + rc->flags = rc->flags & RRD_FLAGS_ALLOWED_EXTERNALLY_ON_NEW_OBJECTS; + + if(rc->hub.version) { + // we are loading data from the SQL database + + if(rc->version) + error("RRDCONTEXT: context '%s' is already initialized with version %lu, but it is loaded again from SQL with version %lu", string2str(rc->id), rc->version, rc->hub.version); + + // IMPORTANT + // replace all string pointers in rc->hub with our own versions + // the originals are coming from a tmp allocation of sqlite + + string_freez(rc->id); + rc->id = string_strdupz(rc->hub.id); + rc->hub.id = string2str(rc->id); + + string_freez(rc->title); + rc->title = string_strdupz(rc->hub.title); + rc->hub.title = string2str(rc->title); + + string_freez(rc->units); + rc->units = string_strdupz(rc->hub.units); + rc->hub.units = string2str(rc->units); + + string_freez(rc->family); + rc->family = string_strdupz(rc->hub.family); + rc->hub.family = string2str(rc->family); + + rc->chart_type = rrdset_type_id(rc->hub.chart_type); + rc->hub.chart_type = rrdset_type_name(rc->chart_type); + + rc->version = rc->hub.version; + rc->priority = rc->hub.priority; + rc->first_time_t = rc->hub.first_time_t; + rc->last_time_t = rc->hub.last_time_t; + + if(rc->hub.deleted || !rc->hub.first_time_t) + rrd_flag_set_deleted(rc, 0); + else { + if (rc->last_time_t == 0) + rrd_flag_set_collected(rc); + else + rrd_flag_set_archived(rc); + } + + rc->flags |= RRD_FLAG_UPDATE_REASON_LOAD_SQL; + } + else { + // we are adding this context now for the first time + rc->version = now_realtime_sec(); + } + + rrdinstances_create(rc); + netdata_mutex_init(&rc->mutex); + + // signal the react callback to do the job + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_NEW_OBJECT); +} + +static void rrdcontext_delete_callback(const char *id, void *value, void *data) { + (void)id; + RRDHOST *host = (RRDHOST *)data; + (void)host; + + RRDCONTEXT *rc = (RRDCONTEXT *)value; + + rrdinstances_destroy(rc); + netdata_mutex_destroy(&rc->mutex); + rrdcontext_freez(rc); +} + +static void rrdcontext_conflict_callback(const char *id, void *oldv, void *newv, void *data) { + (void)id; + RRDHOST *host = (RRDHOST *)data; + (void)host; + + RRDCONTEXT *rc = (RRDCONTEXT *)oldv; + RRDCONTEXT *rc_new = (RRDCONTEXT *)newv; + + rrdcontext_lock(rc); + + if(rc->title != rc_new->title) { + STRING *old_title = rc->title; + rc->title = string_2way_merge(rc->title, rc_new->title); + string_freez(old_title); + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_TITLE); + } + + if(rc->units != rc_new->units) { + STRING *old_units = rc->units; + rc->units = string_dup(rc_new->units); + string_freez(old_units); + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_UNITS); + } + + if(rc->family != rc_new->family) { + STRING *old_family = rc->family; + rc->family = string_2way_merge(rc->family, rc_new->family); + string_freez(old_family); + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_FAMILY); + } + + if(rc->chart_type != rc_new->chart_type) { + rc->chart_type = rc_new->chart_type; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_CHART_TYPE); + } + + if(rc->priority != rc_new->priority) { + rc->priority = rc_new->priority; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY); + } + + rc->flags |= (rc_new->flags & RRD_FLAGS_ALLOWED_EXTERNALLY_ON_NEW_OBJECTS); + + if(rrd_flag_is_collected(rc) && rrd_flag_is_archived(rc)) + rrd_flag_set_collected(rc); + + if(rc->flags & RRD_FLAG_UPDATED) + rc->flags |= RRD_FLAG_UPDATE_REASON_UPDATED_OBJECT; + + rrdcontext_unlock(rc); + + // free the resources of the new one + rrdcontext_freez(rc_new); + + // the react callback will continue from here +} + +static void rrdcontext_react_callback(const char *id __maybe_unused, void *value, void *data __maybe_unused) { + RRDCONTEXT *rc = (RRDCONTEXT *)value; + + rrdcontext_trigger_updates(rc, false); +} + +void rrdhost_create_rrdcontexts(RRDHOST *host) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + if(unlikely(!host)) return; + if(likely(host->rrdctx)) return; + + host->rrdctx = (RRDCONTEXTS *)dictionary_create(DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + dictionary_register_insert_callback((DICTIONARY *)host->rrdctx, rrdcontext_insert_callback, (void *)host); + dictionary_register_delete_callback((DICTIONARY *)host->rrdctx, rrdcontext_delete_callback, (void *)host); + dictionary_register_conflict_callback((DICTIONARY *)host->rrdctx, rrdcontext_conflict_callback, (void *)host); + dictionary_register_react_callback((DICTIONARY *)host->rrdctx, rrdcontext_react_callback, (void *)host); + + host->rrdctx_queue = (RRDCONTEXTS *)dictionary_create(DICTIONARY_FLAG_DONT_OVERWRITE_VALUE | DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE); +} + +void rrdhost_destroy_rrdcontexts(RRDHOST *host) { + if(unlikely(!host)) return; + if(unlikely(!host->rrdctx)) return; + + if(host->rrdctx_queue) { + dictionary_destroy((DICTIONARY *)host->rrdctx_queue); + host->rrdctx_queue = NULL; + } + + dictionary_destroy((DICTIONARY *)host->rrdctx); + host->rrdctx = NULL; +} + +static inline bool rrdcontext_should_be_deleted(RRDCONTEXT *rc) { + if(likely(!(rc->flags & RRD_FLAG_DELETED))) + return false; + + if(likely(!(rc->flags & RRD_FLAG_LIVE_RETENTION))) + return false; + + if(unlikely(rc->flags & RRD_FLAGS_PREVENTING_DELETIONS)) + return false; + + if(unlikely(dictionary_stats_referenced_items(rc->rrdinstances) != 0)) + return false; + + if(unlikely(dictionary_stats_entries(rc->rrdinstances) != 0)) + return false; + + if(unlikely(rc->first_time_t || rc->last_time_t)) + return false; + + return true; +} + +static void rrdcontext_trigger_updates(RRDCONTEXT *rc, bool force) { + if(unlikely(rc->flags & RRD_FLAG_DONT_PROCESS)) return; + if(unlikely(!force && !(rc->flags & RRD_FLAG_UPDATED))) return; + + rrdcontext_lock(rc); + + size_t min_priority = LONG_MAX; + time_t min_first_time_t = LONG_MAX, max_last_time_t = 0; + size_t instances_active = 0, instances_deleted = 0; + bool live_retention = true, currently_collected = false, hidden = true; + { + RRDINSTANCE *ri; + dfe_start_read(rc->rrdinstances, ri) { + if(likely(!(ri->flags & RRD_FLAG_HIDDEN))) + hidden = false; + + if(!(ri->flags & RRD_FLAG_LIVE_RETENTION)) + live_retention = false; + + if (unlikely(rrdinstance_should_be_deleted(ri))) { + instances_deleted++; + rrd_flag_unset_updated(ri); + continue; + } + + if(ri->flags & RRD_FLAG_COLLECTED) + currently_collected = true; + + internal_error(rc->units != ri->units, + "RRDCONTEXT: '%s' rrdinstance '%s' has different units, context '%s', instance '%s'", + string2str(rc->id), string2str(ri->id), + string2str(rc->units), string2str(ri->units)); + + instances_active++; + + if (ri->priority >= RRDCONTEXT_MINIMUM_ALLOWED_PRIORITY && ri->priority < min_priority) + min_priority = ri->priority; + + if (ri->first_time_t && ri->first_time_t < min_first_time_t) + min_first_time_t = ri->first_time_t; + + if (ri->last_time_t && ri->last_time_t > max_last_time_t) + max_last_time_t = ri->last_time_t; + + rrd_flag_unset_updated(ri); + } + dfe_done(ri); + } + + if(hidden && !(rc->flags & RRD_FLAG_HIDDEN)) + rc->flags |= RRD_FLAG_HIDDEN; + else if(!hidden && (rc->flags & RRD_FLAG_HIDDEN)) + rc->flags &= ~RRD_FLAG_HIDDEN; + + if(live_retention && !(rc->flags & RRD_FLAG_LIVE_RETENTION)) + rc->flags |= RRD_FLAG_LIVE_RETENTION; + else if(!live_retention && (rc->flags & RRD_FLAG_LIVE_RETENTION)) + rc->flags &= ~RRD_FLAG_LIVE_RETENTION; + + if(unlikely(!instances_active)) { + // we had some instances, but they are gone now... + + if(rc->first_time_t) { + rc->first_time_t = 0; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if(rc->last_time_t) { + rc->last_time_t = 0; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + rrd_flag_set_deleted(rc, RRD_FLAG_UPDATE_REASON_ZERO_RETENTION); + } + else { + // we have some active instances... + + if (unlikely(min_first_time_t == LONG_MAX)) + min_first_time_t = 0; + + if (unlikely(min_first_time_t == 0 && max_last_time_t == 0)) { + if(rc->first_time_t) { + rc->first_time_t = 0; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if(rc->last_time_t) { + rc->last_time_t = 0; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + rrd_flag_set_deleted(rc, RRD_FLAG_UPDATE_REASON_ZERO_RETENTION); + } + else { + rc->flags &= ~RRD_FLAG_UPDATE_REASON_ZERO_RETENTION; + + if (unlikely(rc->first_time_t != min_first_time_t)) { + rc->first_time_t = min_first_time_t; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_FIRST_TIME_T); + } + + if (rc->last_time_t != max_last_time_t) { + rc->last_time_t = max_last_time_t; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_LAST_TIME_T); + } + + if(likely(currently_collected)) + rrd_flag_set_collected(rc); + else + rrd_flag_set_archived(rc); + } + + if (min_priority != LONG_MAX && rc->priority != min_priority) { + rc->priority = min_priority; + rrd_flag_set_updated(rc, RRD_FLAG_UPDATE_REASON_CHANGED_PRIORITY); + } + } + + if(unlikely(rc->flags & RRD_FLAG_UPDATED)) { + log_transition(NULL, NULL, rc->id, rc->flags, "RRDCONTEXT"); + + if(check_if_cloud_version_changed_unsafe(rc, false)) { + rc->version = rrdcontext_get_next_version(rc); + + if(rc->flags & RRD_FLAG_QUEUED) { + rc->queue.queued_ut = now_realtime_usec(); + rc->queue.queued_flags |= rc->flags; + } + else { + rc->queue.queued_ut = now_realtime_usec(); + rc->queue.queued_flags = rc->flags; + + rc->flags |= RRD_FLAG_QUEUED; + dictionary_set((DICTIONARY *)rc->rrdhost->rrdctx_queue, string2str(rc->id), rc, sizeof(*rc)); + } + } + + rrd_flag_unset_updated(rc); + } + + rrdcontext_unlock(rc); +} + +// ---------------------------------------------------------------------------- +// public API + +void rrdcontext_updated_rrddim(RRDDIM *rd) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdmetric_from_rrddim(rd); +} + +void rrdcontext_removed_rrddim(RRDDIM *rd) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdmetric_rrddim_is_freed(rd); +} + +void rrdcontext_updated_rrddim_algorithm(RRDDIM *rd) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdmetric_updated_rrddim_flags(rd); +} + +void rrdcontext_updated_rrddim_multiplier(RRDDIM *rd) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdmetric_updated_rrddim_flags(rd); +} + +void rrdcontext_updated_rrddim_divisor(RRDDIM *rd) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdmetric_updated_rrddim_flags(rd); +} + +void rrdcontext_updated_rrddim_flags(RRDDIM *rd) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdmetric_updated_rrddim_flags(rd); +} + +void rrdcontext_collected_rrddim(RRDDIM *rd) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdmetric_collected_rrddim(rd); +} + +void rrdcontext_updated_rrdset(RRDSET *st) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdinstance_from_rrdset(st); +} + +void rrdcontext_removed_rrdset(RRDSET *st) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdinstance_rrdset_is_freed(st); +} + +void rrdcontext_updated_rrdset_name(RRDSET *st) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdinstance_updated_rrdset_name(st); +} + +void rrdcontext_updated_rrdset_flags(RRDSET *st) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdinstance_updated_rrdset_flags(st); +} + +void rrdcontext_collected_rrdset(RRDSET *st) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdinstance_collected_rrdset(st); +} + +void rrdcontext_host_child_connected(RRDHOST *host) { + (void)host; + + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + // no need to do anything here + ; +} + +void rrdcontext_host_child_disconnected(RRDHOST *host) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + rrdcontext_recalculate_host_retention(host, RRD_FLAG_UPDATE_REASON_DISCONNECTED_CHILD, -1); +} + +// ---------------------------------------------------------------------------- +// ACLK interface + +static bool rrdhost_check_our_claim_id(const char *claim_id) { + if(!localhost->aclk_state.claimed_id) return false; + return (strcasecmp(claim_id, localhost->aclk_state.claimed_id) == 0) ? true : false; +} + +static RRDHOST *rrdhost_find_by_node_id(const char *node_id) { + uuid_t uuid; + if (uuid_parse(node_id, uuid)) + return NULL; + + RRDHOST *host = NULL; + + rrd_rdlock(); + rrdhost_foreach_read(host) { + if(!host->node_id) continue; + + if(uuid_compare(uuid, *host->node_id) == 0) + break; + } + rrd_unlock(); + + return host; +} + +void rrdcontext_hub_checkpoint_command(void *ptr) { + struct ctxs_checkpoint *cmd = ptr; + + if(!rrdhost_check_our_claim_id(cmd->claim_id)) { + error("RRDCONTEXT: received checkpoint command for claim_id '%s', node id '%s', but this is not our claim id. Ours '%s', received '%s'. Ignoring command.", + cmd->claim_id, cmd->node_id, + localhost->aclk_state.claimed_id?localhost->aclk_state.claimed_id:"NOT SET", + cmd->claim_id); + + return; + } + + RRDHOST *host = rrdhost_find_by_node_id(cmd->node_id); + if(!host) { + error("RRDCONTEXT: received checkpoint command for claim id '%s', node id '%s', but there is no node with such node id here. Ignoring command.", + cmd->claim_id, cmd->node_id); + + return; + } + + if(rrdhost_flag_check(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS)) { + info("RRDCONTEXT: received checkpoint command for claim id '%s', node id '%s', while node '%s' has an active context streaming.", + cmd->claim_id, cmd->node_id, host->hostname); + + // disable it temporarily, so that our worker will not attempt to send messages in parallel + rrdhost_flag_clear(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS); + } + + uint64_t our_version_hash = rrdcontext_version_hash(host); + + if(cmd->version_hash != our_version_hash) { + error("RRDCONTEXT: received version hash %lu for host '%s', does not match our version hash %lu. Sending snapshot of all contexts.", + cmd->version_hash, host->hostname, our_version_hash); + +#ifdef ENABLE_ACLK + // prepare the snapshot + char uuid[UUID_STR_LEN]; + uuid_unparse_lower(*host->node_id, uuid); + contexts_snapshot_t bundle = contexts_snapshot_new(cmd->claim_id, uuid, our_version_hash); + + // do a deep scan on every metric of the host to make sure all our data are updated + rrdcontext_recalculate_host_retention(host, RRD_FLAG_NONE, -1); + + // calculate version hash and pack all the messages together in one go + our_version_hash = rrdcontext_version_hash_with_callback(host, rrdcontext_message_send_unsafe, true, bundle); + + // update the version + contexts_snapshot_set_version(bundle, our_version_hash); + + // send it + aclk_send_contexts_snapshot(bundle); +#endif + } + + internal_error(true, "RRDCONTEXT: host '%s' enabling streaming of contexts", host->hostname); + rrdhost_flag_set(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS); + char node_str[UUID_STR_LEN]; + uuid_unparse_lower(*host->node_id, node_str); + log_access("ACLK REQ [%s (%s)]: STREAM CONTEXTS ENABLED", node_str, host->hostname); +} + +void rrdcontext_hub_stop_streaming_command(void *ptr) { + struct stop_streaming_ctxs *cmd = ptr; + + if(!rrdhost_check_our_claim_id(cmd->claim_id)) { + error("RRDCONTEXT: received stop streaming command for claim_id '%s', node id '%s', but this is not our claim id. Ours '%s', received '%s'. Ignoring command.", + cmd->claim_id, cmd->node_id, + localhost->aclk_state.claimed_id?localhost->aclk_state.claimed_id:"NOT SET", + cmd->claim_id); + + return; + } + + RRDHOST *host = rrdhost_find_by_node_id(cmd->node_id); + if(!host) { + error("RRDCONTEXT: received stop streaming command for claim id '%s', node id '%s', but there is no node with such node id here. Ignoring command.", + cmd->claim_id, cmd->node_id); + + return; + } + + if(!rrdhost_flag_check(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS)) { + error("RRDCONTEXT: received stop streaming command for claim id '%s', node id '%s', but node '%s' does not have active context streaming. Ignoring command.", + cmd->claim_id, cmd->node_id, host->hostname); + + return; + } + + internal_error(true, "RRDCONTEXT: host '%s' disabling streaming of contexts", host->hostname); + rrdhost_flag_clear(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS); +} + +// ---------------------------------------------------------------------------- +// web API + +struct rrdcontext_to_json { + BUFFER *wb; + RRDCONTEXT_TO_JSON_OPTIONS options; + time_t after; + time_t before; + SIMPLE_PATTERN *chart_label_key; + SIMPLE_PATTERN *chart_labels_filter; + SIMPLE_PATTERN *chart_dimensions; + size_t written; + time_t now; + time_t combined_first_time_t; + time_t combined_last_time_t; + RRD_FLAGS combined_flags; +}; + +static inline int rrdmetric_to_json_callback(const char *id, void *value, void *data) { + struct rrdcontext_to_json * t = data; + RRDMETRIC *rm = value; + BUFFER *wb = t->wb; + RRDCONTEXT_TO_JSON_OPTIONS options = t->options; + time_t after = t->after; + time_t before = t->before; + + if((rm->flags & RRD_FLAG_DELETED) && !(options & RRDCONTEXT_OPTION_SHOW_DELETED)) + return 0; + + if(after && (!rm->last_time_t || after > rm->last_time_t)) + return 0; + + if(before && (!rm->first_time_t || before < rm->first_time_t)) + return 0; + + if(t->chart_dimensions + && !simple_pattern_matches(t->chart_dimensions, string2str(rm->id)) + && !simple_pattern_matches(t->chart_dimensions, string2str(rm->name))) + return 0; + + if(t->written) { + buffer_strcat(wb, ",\n"); + t->combined_first_time_t = MIN(t->combined_first_time_t, rm->first_time_t); + t->combined_last_time_t = MAX(t->combined_last_time_t, rm->last_time_t); + t->combined_flags |= rm->flags; + } + else { + buffer_strcat(wb, "\n"); + t->combined_first_time_t = rm->first_time_t; + t->combined_last_time_t = rm->last_time_t; + t->combined_flags = rm->flags; + } + + buffer_sprintf(wb, "\t\t\t\t\t\t\"%s\": {", id); + + if(options & RRDCONTEXT_OPTION_SHOW_UUIDS) { + char uuid[UUID_STR_LEN]; + uuid_unparse(rm->uuid, uuid); + buffer_sprintf(wb, "\n\t\t\t\t\t\t\t\"uuid\":\"%s\",", uuid); + } + + buffer_sprintf(wb, + "\n\t\t\t\t\t\t\t\"name\":\"%s\"" + ",\n\t\t\t\t\t\t\t\"first_time_t\":%ld" + ",\n\t\t\t\t\t\t\t\"last_time_t\":%ld" + ",\n\t\t\t\t\t\t\t\"collected\":%s" + , string2str(rm->name) + , rm->first_time_t + , rrd_flag_is_collected(rm) ? t->now : rm->last_time_t + , rm->flags & RRD_FLAG_COLLECTED ? "true" : "false" + ); + + if(options & RRDCONTEXT_OPTION_SHOW_DELETED) { + buffer_sprintf(wb, + ",\n\t\t\t\t\t\t\t\"deleted\":%s" + , rm->flags & RRD_FLAG_DELETED ? "true" : "false" + ); + } + + if(options & RRDCONTEXT_OPTION_SHOW_FLAGS) { + buffer_strcat(wb, ",\n\t\t\t\t\t\t\t\"flags\":\""); + rrd_flags_to_buffer(rm->flags, wb); + buffer_strcat(wb, "\""); + } + + buffer_strcat(wb, "\n\t\t\t\t\t\t}"); + t->written++; + return 1; +} + +static inline int rrdinstance_to_json_callback(const char *id, void *value, void *data) { + struct rrdcontext_to_json *t_parent = data; + RRDINSTANCE *ri = value; + BUFFER *wb = t_parent->wb; + RRDCONTEXT_TO_JSON_OPTIONS options = t_parent->options; + time_t after = t_parent->after; + time_t before = t_parent->before; + bool has_filter = t_parent->chart_label_key || t_parent->chart_labels_filter || t_parent->chart_dimensions; + + if((ri->flags & RRD_FLAG_DELETED) && !(options & RRDCONTEXT_OPTION_SHOW_DELETED)) + return 0; + + if(after && (!ri->last_time_t || after > ri->last_time_t)) + return 0; + + if(before && (!ri->first_time_t || before < ri->first_time_t)) + return 0; + + if(t_parent->chart_label_key && !rrdlabels_match_simple_pattern_parsed(ri->rrdlabels, t_parent->chart_label_key, '\0')) + return 0; + + if(t_parent->chart_labels_filter && !rrdlabels_match_simple_pattern_parsed(ri->rrdlabels, t_parent->chart_labels_filter, ':')) + return 0; + + time_t first_time_t = ri->first_time_t; + time_t last_time_t = ri->last_time_t; + RRD_FLAGS flags = ri->flags; + + BUFFER *wb_metrics = NULL; + if(options & RRDCONTEXT_OPTION_SHOW_METRICS || t_parent->chart_dimensions) { + + wb_metrics = buffer_create(4096); + + struct rrdcontext_to_json t_metrics = { + .wb = wb_metrics, + .options = options, + .chart_label_key = t_parent->chart_label_key, + .chart_labels_filter = t_parent->chart_labels_filter, + .chart_dimensions = t_parent->chart_dimensions, + .after = after, + .before = before, + .written = 0, + .now = t_parent->now, + }; + dictionary_walkthrough_read(ri->rrdmetrics, rrdmetric_to_json_callback, &t_metrics); + + if(has_filter && !t_metrics.written) { + buffer_free(wb_metrics); + return 0; + } + + first_time_t = t_metrics.combined_first_time_t; + last_time_t = t_metrics.combined_last_time_t; + flags = t_metrics.combined_flags; + } + + if(t_parent->written) { + buffer_strcat(wb, ",\n"); + t_parent->combined_first_time_t = MIN(t_parent->combined_first_time_t, first_time_t); + t_parent->combined_last_time_t = MAX(t_parent->combined_last_time_t, last_time_t); + t_parent->combined_flags |= flags; + } + else { + buffer_strcat(wb, "\n"); + t_parent->combined_first_time_t = first_time_t; + t_parent->combined_last_time_t = last_time_t; + t_parent->combined_flags = flags; + } + + buffer_sprintf(wb, "\t\t\t\t\"%s\": {", id); + + if(options & RRDCONTEXT_OPTION_SHOW_UUIDS) { + char uuid[UUID_STR_LEN]; + uuid_unparse(ri->uuid, uuid); + buffer_sprintf(wb,"\n\t\t\t\t\t\"uuid\":\"%s\",", uuid); + } + + buffer_sprintf(wb, + "\n\t\t\t\t\t\"name\":\"%s\"" + ",\n\t\t\t\t\t\"context\":\"%s\"" + ",\n\t\t\t\t\t\"title\":\"%s\"" + ",\n\t\t\t\t\t\"units\":\"%s\"" + ",\n\t\t\t\t\t\"family\":\"%s\"" + ",\n\t\t\t\t\t\"chart_type\":\"%s\"" + ",\n\t\t\t\t\t\"priority\":%u" + ",\n\t\t\t\t\t\"update_every\":%d" + ",\n\t\t\t\t\t\"first_time_t\":%ld" + ",\n\t\t\t\t\t\"last_time_t\":%ld" + ",\n\t\t\t\t\t\"collected\":%s" + , string2str(ri->name) + , string2str(ri->rc->id) + , string2str(ri->title) + , string2str(ri->units) + , string2str(ri->family) + , rrdset_type_name(ri->chart_type) + , ri->priority + , ri->update_every + , first_time_t + , (flags & RRD_FLAG_COLLECTED) ? t_parent->now : last_time_t + , (flags & RRD_FLAG_COLLECTED) ? "true" : "false" + ); + + if(options & RRDCONTEXT_OPTION_SHOW_DELETED) { + buffer_sprintf(wb, + ",\n\t\t\t\t\t\"deleted\":%s" + , (ri->flags & RRD_FLAG_DELETED) ? "true" : "false" + ); + } + + if(options & RRDCONTEXT_OPTION_SHOW_FLAGS) { + buffer_strcat(wb, ",\n\t\t\t\t\t\"flags\":\""); + rrd_flags_to_buffer(ri->flags, wb); + buffer_strcat(wb, "\""); + } + + if(options & RRDCONTEXT_OPTION_SHOW_LABELS && ri->rrdlabels && dictionary_stats_entries(ri->rrdlabels)) { + buffer_sprintf(wb, ",\n\t\t\t\t\t\"labels\": {\n"); + rrdlabels_to_buffer(ri->rrdlabels, wb, "\t\t\t\t\t\t", ":", "\"", ",\n", NULL, NULL, NULL, NULL); + buffer_strcat(wb, "\n\t\t\t\t\t}"); + } + + if(wb_metrics) { + buffer_sprintf(wb, ",\n\t\t\t\t\t\"dimensions\": {"); + buffer_fast_strcat(wb, buffer_tostring(wb_metrics), buffer_strlen(wb_metrics)); + buffer_strcat(wb, "\n\t\t\t\t\t}"); + + buffer_free(wb_metrics); + } + + buffer_strcat(wb, "\n\t\t\t\t}"); + t_parent->written++; + return 1; +} + +static inline int rrdcontext_to_json_callback(const char *id, void *value, void *data) { + struct rrdcontext_to_json *t_parent = data; + RRDCONTEXT *rc = value; + BUFFER *wb = t_parent->wb; + RRDCONTEXT_TO_JSON_OPTIONS options = t_parent->options; + time_t after = t_parent->after; + time_t before = t_parent->before; + bool has_filter = t_parent->chart_label_key || t_parent->chart_labels_filter || t_parent->chart_dimensions; + + if(unlikely((rc->flags & RRD_FLAG_HIDDEN) && !(options & RRDCONTEXT_OPTION_SHOW_HIDDEN))) + return 0; + + if((rc->flags & RRD_FLAG_DELETED) && !(options & RRDCONTEXT_OPTION_SHOW_DELETED)) + return 0; + + if(options & RRDCONTEXT_OPTION_DEEPSCAN) + rrdcontext_recalculate_context_retention(rc, RRD_FLAG_NONE, -1); + + if(after && (!rc->last_time_t || after > rc->last_time_t)) + return 0; + + if(before && (!rc->first_time_t || before < rc->first_time_t)) + return 0; + + time_t first_time_t = rc->first_time_t; + time_t last_time_t = rc->last_time_t; + RRD_FLAGS flags = rc->flags; + + BUFFER *wb_instances = NULL; + if((options & (RRDCONTEXT_OPTION_SHOW_LABELS|RRDCONTEXT_OPTION_SHOW_INSTANCES|RRDCONTEXT_OPTION_SHOW_METRICS)) + || t_parent->chart_label_key + || t_parent->chart_labels_filter + || t_parent->chart_dimensions) { + + wb_instances = buffer_create(4096); + + struct rrdcontext_to_json t_instances = { + .wb = wb_instances, + .options = options, + .chart_label_key = t_parent->chart_label_key, + .chart_labels_filter = t_parent->chart_labels_filter, + .chart_dimensions = t_parent->chart_dimensions, + .after = after, + .before = before, + .written = 0, + .now = t_parent->now, + }; + dictionary_walkthrough_read(rc->rrdinstances, rrdinstance_to_json_callback, &t_instances); + + if(has_filter && !t_instances.written) { + buffer_free(wb_instances); + return 0; + } + + first_time_t = t_instances.combined_first_time_t; + last_time_t = t_instances.combined_last_time_t; + flags = t_instances.combined_flags; + } + + if(t_parent->written) + buffer_strcat(wb, ",\n"); + else + buffer_strcat(wb, "\n"); + + if(options & RRDCONTEXT_OPTION_SKIP_ID) + buffer_sprintf(wb, "\t\t\{"); + else + buffer_sprintf(wb, "\t\t\"%s\": {", id); + + rrdcontext_lock(rc); + + buffer_sprintf(wb, + "\n\t\t\t\"title\":\"%s\"" + ",\n\t\t\t\"units\":\"%s\"" + ",\n\t\t\t\"family\":\"%s\"" + ",\n\t\t\t\"chart_type\":\"%s\"" + ",\n\t\t\t\"priority\":%u" + ",\n\t\t\t\"first_time_t\":%ld" + ",\n\t\t\t\"last_time_t\":%ld" + ",\n\t\t\t\"collected\":%s" + , string2str(rc->title) + , string2str(rc->units) + , string2str(rc->family) + , rrdset_type_name(rc->chart_type) + , rc->priority + , first_time_t + , (flags & RRD_FLAG_COLLECTED) ? t_parent->now : last_time_t + , (flags & RRD_FLAG_COLLECTED) ? "true" : "false" + ); + + if(options & RRDCONTEXT_OPTION_SHOW_DELETED) { + buffer_sprintf(wb, + ",\n\t\t\t\"deleted\":%s" + , (rc->flags & RRD_FLAG_DELETED) ? "true" : "false" + ); + } + + if(options & RRDCONTEXT_OPTION_SHOW_FLAGS) { + buffer_strcat(wb, ",\n\t\t\t\"flags\":\""); + rrd_flags_to_buffer(rc->flags, wb); + buffer_strcat(wb, "\""); + } + + if(options & RRDCONTEXT_OPTION_SHOW_QUEUED) { + buffer_strcat(wb, ",\n\t\t\t\"queued_reasons\":\""); + rrd_reasons_to_buffer(rc->queue.queued_flags, wb); + buffer_strcat(wb, "\""); + + buffer_sprintf(wb, + ",\n\t\t\t\"last_queued\":%llu" + ",\n\t\t\t\"scheduled_dispatch\":%llu" + ",\n\t\t\t\"last_dequeued\":%llu" + ",\n\t\t\t\"hub_version\":%lu" + ",\n\t\t\t\"version\":%lu" + , rc->queue.queued_ut / USEC_PER_SEC + , rc->queue.scheduled_dispatch_ut / USEC_PER_SEC + , rc->queue.dequeued_ut / USEC_PER_SEC + , rc->hub.version + , rc->version + ); + } + + rrdcontext_unlock(rc); + + if(wb_instances) { + buffer_sprintf(wb, ",\n\t\t\t\"charts\": {"); + buffer_fast_strcat(wb, buffer_tostring(wb_instances), buffer_strlen(wb_instances)); + buffer_strcat(wb, "\n\t\t\t}"); + + buffer_free(wb_instances); + } + + buffer_strcat(wb, "\n\t\t}"); + t_parent->written++; + return 1; +} + +int rrdcontext_to_json(RRDHOST *host, BUFFER *wb, time_t after, time_t before, RRDCONTEXT_TO_JSON_OPTIONS options, const char *context, SIMPLE_PATTERN *chart_label_key, SIMPLE_PATTERN *chart_labels_filter, SIMPLE_PATTERN *chart_dimensions) { + RRDCONTEXT_ACQUIRED *rca = (RRDCONTEXT_ACQUIRED *)dictionary_get_and_acquire_item((DICTIONARY *)host->rrdctx, context); + if(!rca) return HTTP_RESP_NOT_FOUND; + + RRDCONTEXT *rc = rrdcontext_acquired_value(rca); + + if(after != 0 && before != 0) { + long long after_wanted = after; + long long before_wanted = before; + rrdr_relative_window_to_absolute(&after_wanted, &before_wanted); + after = after_wanted; + before = before_wanted; + } + + struct rrdcontext_to_json t_contexts = { + .wb = wb, + .options = options|RRDCONTEXT_OPTION_SKIP_ID, + .chart_label_key = chart_label_key, + .chart_labels_filter = chart_labels_filter, + .chart_dimensions = chart_dimensions, + .after = after, + .before = before, + .written = 0, + .now = now_realtime_sec(), + }; + rrdcontext_to_json_callback(context, rc, &t_contexts); + + rrdcontext_release(rca); + + if(!t_contexts.written) + return HTTP_RESP_NOT_FOUND; + + return HTTP_RESP_OK; +} + +int rrdcontexts_to_json(RRDHOST *host, BUFFER *wb, time_t after, time_t before, RRDCONTEXT_TO_JSON_OPTIONS options, SIMPLE_PATTERN *chart_label_key, SIMPLE_PATTERN *chart_labels_filter, SIMPLE_PATTERN *chart_dimensions) { + char node_uuid[UUID_STR_LEN] = ""; + + if(host->node_id) + uuid_unparse(*host->node_id, node_uuid); + + if(after != 0 && before != 0) { + long long after_wanted = after; + long long before_wanted = before; + rrdr_relative_window_to_absolute(&after_wanted, &before_wanted); + after = after_wanted; + before = before_wanted; + } + + buffer_sprintf(wb, "{\n" + "\t\"hostname\": \"%s\"" + ",\n\t\"machine_guid\": \"%s\"" + ",\n\t\"node_id\": \"%s\"" + ",\n\t\"claim_id\": \"%s\"" + , host->hostname + , host->machine_guid + , node_uuid + , host->aclk_state.claimed_id ? host->aclk_state.claimed_id : "" + ); + + if(options & RRDCONTEXT_OPTION_SHOW_LABELS) { + buffer_sprintf(wb, ",\n\t\"host_labels\": {\n"); + rrdlabels_to_buffer(host->host_labels, wb, "\t\t", ":", "\"", ",\n", NULL, NULL, NULL, NULL); + buffer_strcat(wb, "\n\t}"); + } + + buffer_sprintf(wb, ",\n\t\"contexts\": {"); + struct rrdcontext_to_json t_contexts = { + .wb = wb, + .options = options, + .chart_label_key = chart_label_key, + .chart_labels_filter = chart_labels_filter, + .chart_dimensions = chart_dimensions, + .after = after, + .before = before, + .written = 0, + .now = now_realtime_sec(), + }; + dictionary_walkthrough_read((DICTIONARY *)host->rrdctx, rrdcontext_to_json_callback, &t_contexts); + + // close contexts, close main + buffer_strcat(wb, "\n\t}\n}"); + + return HTTP_RESP_OK; +} + +// ---------------------------------------------------------------------------- +// load from SQL + +static void rrdinstance_load_clabel(SQL_CLABEL_DATA *sld, void *data) { + RRDINSTANCE *ri = data; + rrdlabels_add(ri->rrdlabels, sld->label_key, sld->label_value, sld->label_source); +} + +static void rrdinstance_load_dimension(SQL_DIMENSION_DATA *sd, void *data) { + RRDINSTANCE *ri = data; + + RRDMETRIC trm = { + .id = string_strdupz(sd->id), + .name = string_strdupz(sd->name), + .flags = RRD_FLAG_ARCHIVED | RRD_FLAG_UPDATE_REASON_LOAD_SQL, + }; + uuid_copy(trm.uuid, sd->dim_id); + + dictionary_set(ri->rrdmetrics, string2str(trm.id), &trm, sizeof(trm)); +} + +static void rrdinstance_load_chart_callback(SQL_CHART_DATA *sc, void *data) { + RRDHOST *host = data; + + RRDCONTEXT tc = { + .id = string_strdupz(sc->context), + .title = string_strdupz(sc->title), + .units = string_strdupz(sc->units), + .family = string_strdupz(sc->family), + .priority = sc->priority, + .chart_type = sc->chart_type, + .flags = RRD_FLAG_ARCHIVED | RRD_FLAG_DONT_PROCESS | RRD_FLAG_UPDATE_REASON_LOAD_SQL, + .rrdhost = host, + }; + + RRDCONTEXT_ACQUIRED *rca = (RRDCONTEXT_ACQUIRED *)dictionary_set_and_acquire_item((DICTIONARY *)host->rrdctx, string2str(tc.id), &tc, sizeof(tc)); + RRDCONTEXT *rc = rrdcontext_acquired_value(rca); + + RRDINSTANCE tri = { + .id = string_strdupz(sc->id), + .name = string_strdupz(sc->name), + .title = string_strdupz(sc->title), + .units = string_strdupz(sc->units), + .family = string_strdupz(sc->family), + .chart_type = sc->chart_type, + .priority = sc->priority, + .update_every = sc->update_every, + .flags = RRD_FLAG_ARCHIVED | RRD_FLAG_DONT_PROCESS | RRD_FLAG_UPDATE_REASON_LOAD_SQL, + }; + uuid_copy(tri.uuid, sc->chart_id); + + RRDINSTANCE_ACQUIRED *ria = (RRDINSTANCE_ACQUIRED *)dictionary_set_and_acquire_item(rc->rrdinstances, sc->id, &tri, sizeof(tri)); + RRDINSTANCE *ri = rrdinstance_acquired_value(ria); + + ctx_get_dimension_list(&ri->uuid, rrdinstance_load_dimension, ri); + ctx_get_label_list(&ri->uuid, rrdinstance_load_clabel, ri); + ri->flags &= ~RRD_FLAG_DONT_PROCESS; + rrdinstance_trigger_updates(ri, true, true); + + // let the instance be in "don't process" mode + // so that we process it once, when it is collected + ri->flags |= RRD_FLAG_DONT_PROCESS; + + rrdinstance_release(ria); + rrdcontext_release(rca); +} + +static void rrdcontext_load_context_callback(VERSIONED_CONTEXT_DATA *ctx_data, void *data) { + RRDHOST *host = data; + (void)host; + + RRDCONTEXT trc = { + .id = string_strdupz(ctx_data->id), + .flags = RRD_FLAG_ARCHIVED | RRD_FLAG_DONT_PROCESS | RRD_FLAG_UPDATE_REASON_LOAD_SQL, + + // no need to set more data here + // we only need the hub data + + .hub = *ctx_data, + }; + dictionary_set((DICTIONARY *)host->rrdctx, string2str(trc.id), &trc, sizeof(trc)); +} + +void rrdhost_load_rrdcontext_data(RRDHOST *host) { + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + return; + + if(host->rrdctx) return; + + rrdhost_create_rrdcontexts(host); + ctx_get_context_list(&host->host_uuid, rrdcontext_load_context_callback, host); + ctx_get_chart_list(&host->host_uuid, rrdinstance_load_chart_callback, host); + + RRDCONTEXT *rc; + dfe_start_read((DICTIONARY *)host->rrdctx, rc) { + rc->flags &= ~RRD_FLAG_DONT_PROCESS; + rrdcontext_trigger_updates(rc, true); + } + dfe_done(rc); +} + +// ---------------------------------------------------------------------------- +// the worker thread + +static inline usec_t rrdcontext_calculate_queued_dispatch_time_ut(RRDCONTEXT *rc, usec_t now_ut) { + + if(likely(rc->queue.delay_calc_ut >= rc->queue.queued_ut)) + return rc->queue.scheduled_dispatch_ut; + + RRD_FLAGS flags = rc->queue.queued_flags; + + usec_t delay = LONG_MAX; + int i; + struct rrdcontext_reason *reason; + for(i = 0, reason = &rrdcontext_reasons[i]; reason->name ; reason = &rrdcontext_reasons[++i]) { + if(unlikely(flags & reason->flag)) { + if(reason->delay_ut < delay) + delay = reason->delay_ut; + } + } + + if(unlikely(delay == LONG_MAX)) { + internal_error(true, "RRDCONTEXT: '%s', cannot find minimum delay of flags %x", string2str(rc->id), (unsigned int)flags); + delay = 60 * USEC_PER_SEC; + } + + rc->queue.delay_calc_ut = now_ut; + usec_t dispatch_ut = rc->queue.scheduled_dispatch_ut = rc->queue.queued_ut + delay; + return dispatch_ut; +} + +#define WORKER_JOB_HOSTS 1 +#define WORKER_JOB_CHECK 2 +#define WORKER_JOB_SEND 3 +#define WORKER_JOB_DEQUEUE 4 +#define WORKER_JOB_RETENTION 5 +#define WORKER_JOB_QUEUED 6 +#define WORKER_JOB_CLEANUP 7 +#define WORKER_JOB_CLEANUP_DELETE 8 + +static usec_t rrdcontext_next_db_rotation_ut = 0; +void rrdcontext_db_rotation(void) { + // called when the db rotates its database + rrdcontext_next_db_rotation_ut = now_realtime_usec() + FULL_RETENTION_SCAN_DELAY_AFTER_DB_ROTATION_SECS * USEC_PER_SEC; +} + +static uint64_t rrdcontext_version_hash_with_callback( + RRDHOST *host, + void (*callback)(RRDCONTEXT *, bool, void *), + bool snapshot, + void *bundle) { + + if(unlikely(!host || !host->rrdctx)) return 0; + + RRDCONTEXT *rc; + uint64_t hash = 0; + + // loop through all contexts of the host + dfe_start_read((DICTIONARY *)host->rrdctx, rc) { + + rrdcontext_lock(rc); + + if(unlikely(rc->flags & RRD_FLAG_HIDDEN)) { + rrdcontext_unlock(rc); + continue; + } + + if(unlikely(callback)) + callback(rc, snapshot, bundle); + + // skip any deleted contexts + if(unlikely(rc->flags & RRD_FLAG_DELETED)) { + rrdcontext_unlock(rc); + continue; + } + + // we use rc->hub.* which has the latest + // metadata we have sent to the hub + + // if a context is currently queued, rc->hub.* does NOT + // reflect the queued changes. rc->hub.* is updated with + // their metadata, after messages are dispatched to hub. + + // when the context is being collected, + // rc->hub.last_time_t is already zero + + hash += rc->hub.version + rc->hub.last_time_t - rc->hub.first_time_t; + + rrdcontext_unlock(rc); + + } + dfe_done(rc); + + return hash; +} + +static void rrdcontext_recalculate_context_retention(RRDCONTEXT *rc, RRD_FLAGS reason, int job_id) { + RRDINSTANCE *ri; + dfe_start_read(rc->rrdinstances, ri) { + RRDMETRIC *rm; + dfe_start_read(ri->rrdmetrics, rm) { + + if(job_id >= 0) + worker_is_busy(job_id); + + rrd_flag_set_updated(rm, reason); + + rm->flags &= ~RRD_FLAG_DONT_PROCESS; + rrdmetric_trigger_updates(rm, true, false); + } + dfe_done(rm); + + ri->flags &= ~RRD_FLAG_DONT_PROCESS; + rrdinstance_trigger_updates(ri, true, false); + ri->flags |= RRD_FLAG_DONT_PROCESS; + } + dfe_done(ri); + + rc->flags &= ~RRD_FLAG_DONT_PROCESS; + rrdcontext_trigger_updates(rc, true); +} + +static void rrdcontext_recalculate_host_retention(RRDHOST *host, RRD_FLAGS reason, int job_id) { + if(unlikely(!host || !host->rrdctx)) return; + + RRDCONTEXT *rc; + dfe_start_read((DICTIONARY *)host->rrdctx, rc) { + rrdcontext_recalculate_context_retention(rc, reason, job_id); + } + dfe_done(rc); +} + +static void rrdcontext_recalculate_retention(int job_id) { + rrdcontext_next_db_rotation_ut = 0; + rrd_rdlock(); + RRDHOST *host; + rrdhost_foreach_read(host) { + rrdcontext_recalculate_host_retention(host, RRD_FLAG_UPDATE_REASON_DB_ROTATION, job_id); + } + rrd_unlock(); +} + +void rrdcontext_delete_from_sql_unsafe(RRDCONTEXT *rc) { + // we need to refresh the string pointers in rc->hub + // in case the context changed values + rc->hub.id = string2str(rc->id); + rc->hub.title = string2str(rc->title); + rc->hub.units = string2str(rc->units); + rc->hub.family = string2str(rc->family); + + // delete it from SQL + if(ctx_delete_context(&rc->rrdhost->host_uuid, &rc->hub) != 0) + error("RRDCONTEXT: failed to delete context '%s' version %lu from SQL.", rc->hub.id, rc->hub.version); +} + +static void rrdcontext_garbage_collect(void) { + rrd_rdlock(); + RRDHOST *host; + rrdhost_foreach_read(host) { + RRDCONTEXT *rc; + dfe_start_write((DICTIONARY *)host->rrdctx, rc) { + worker_is_busy(WORKER_JOB_CLEANUP); + + rrdcontext_lock(rc); + + if(unlikely(rrdcontext_should_be_deleted(rc))) { + worker_is_busy(WORKER_JOB_CLEANUP_DELETE); + rrdcontext_delete_from_sql_unsafe(rc); + + if(dictionary_del_having_write_lock((DICTIONARY *)host->rrdctx, string2str(rc->id)) != 0) + error("RRDCONTEXT: '%s' of host '%s' failed to be deleted from rrdcontext dictionary.", + string2str(rc->id), host->hostname); + } + else { + RRDINSTANCE *ri; + dfe_start_write(rc->rrdinstances, ri) { + if(rrdinstance_should_be_deleted(ri)) { + worker_is_busy(WORKER_JOB_CLEANUP_DELETE); + dictionary_del_having_write_lock(rc->rrdinstances, string2str(ri->id)); + } + else { + RRDMETRIC *rm; + dfe_start_write(ri->rrdmetrics, rm) { + if(rrdmetric_should_be_deleted(rm)) { + worker_is_busy(WORKER_JOB_CLEANUP_DELETE); + dictionary_del_having_write_lock(ri->rrdmetrics, string2str(rm->id)); + } + } + dfe_done(rm); + } + } + dfe_done(ri); + } + + // the item is referenced in the dictionary + // so, it is still here to unlock, even if we have deleted it + rrdcontext_unlock(rc); + } + dfe_done(rc); + } + rrd_unlock(); +} + +static void rrdcontext_main_cleanup(void *ptr) { + struct netdata_static_thread *static_thread = (struct netdata_static_thread *)ptr; + static_thread->enabled = NETDATA_MAIN_THREAD_EXITING; + // custom code + static_thread->enabled = NETDATA_MAIN_THREAD_EXITED; +} + +void *rrdcontext_main(void *ptr) { + netdata_thread_cleanup_push(rrdcontext_main_cleanup, ptr); + + if(unlikely(rrdcontext_enabled == CONFIG_BOOLEAN_NO)) + goto exit; + + worker_register("RRDCONTEXT"); + worker_register_job_name(WORKER_JOB_HOSTS, "hosts"); + worker_register_job_name(WORKER_JOB_CHECK, "dedup checks"); + worker_register_job_name(WORKER_JOB_SEND, "sent contexts"); + worker_register_job_name(WORKER_JOB_DEQUEUE, "deduped contexts"); + worker_register_job_name(WORKER_JOB_RETENTION, "metrics retention"); + worker_register_job_name(WORKER_JOB_QUEUED, "queued contexts"); + worker_register_job_name(WORKER_JOB_CLEANUP, "cleanups"); + worker_register_job_name(WORKER_JOB_CLEANUP_DELETE, "deletes"); + + heartbeat_t hb; + heartbeat_init(&hb); + usec_t step = USEC_PER_SEC * RRDCONTEXT_WORKER_THREAD_HEARTBEAT_SECS; + + while (!netdata_exit) { + worker_is_idle(); + heartbeat_next(&hb, step); + + if(unlikely(netdata_exit)) break; + + if(!aclk_connected) continue; + + usec_t now_ut = now_realtime_usec(); + + if(rrdcontext_next_db_rotation_ut && now_ut > rrdcontext_next_db_rotation_ut) { + rrdcontext_recalculate_retention(WORKER_JOB_RETENTION); + rrdcontext_garbage_collect(); + rrdcontext_next_db_rotation_ut = 0; + } + + rrd_rdlock(); + RRDHOST *host; + rrdhost_foreach_read(host) { + if(unlikely(netdata_exit)) break; + + worker_is_busy(WORKER_JOB_HOSTS); + + // check if we have received a streaming command for this host + if(!rrdhost_flag_check(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS)) + continue; + + // check if there are queued items to send + if(!dictionary_stats_entries((DICTIONARY *)host->rrdctx_queue)) + continue; + + if(!host->node_id) + continue; + + size_t messages_added = 0; + contexts_updated_t bundle = NULL; + + RRDCONTEXT *rc; + dfe_start_write((DICTIONARY *)host->rrdctx_queue, rc) { + if(unlikely(netdata_exit)) break; + + if(unlikely(messages_added >= MESSAGES_PER_BUNDLE_TO_SEND_TO_HUB_PER_HOST)) + break; + + worker_is_busy(WORKER_JOB_QUEUED); + usec_t dispatch_ut = rrdcontext_calculate_queued_dispatch_time_ut(rc, now_ut); + char *claim_id = get_agent_claimid(); + if(unlikely(now_ut >= dispatch_ut) && claim_id) { + worker_is_busy(WORKER_JOB_CHECK); + + rrdcontext_lock(rc); + + if(check_if_cloud_version_changed_unsafe(rc, true)) { + worker_is_busy(WORKER_JOB_SEND); + +#ifdef ENABLE_ACLK + if(!bundle) { + // prepare the bundle to send the messages + char uuid[UUID_STR_LEN]; + uuid_unparse_lower(*host->node_id, uuid); + + bundle = contexts_updated_new(claim_id, uuid, 0, now_ut); + } +#endif + // update the hub data of the context, give a new version, pack the message + // and save an update to SQL + rrdcontext_message_send_unsafe(rc, false, bundle); + messages_added++; + + rc->queue.dequeued_ut = now_ut; + } + else + rc->version = rc->hub.version; + + // remove the queued flag, so that it can be queued again + rc->flags &= ~RRD_FLAG_QUEUED; + + // remove it from the queue + worker_is_busy(WORKER_JOB_DEQUEUE); + dictionary_del_having_write_lock((DICTIONARY *)host->rrdctx_queue, string2str(rc->id)); + + if(unlikely(rrdcontext_should_be_deleted(rc))) { + // this is a deleted context - delete it forever... + + worker_is_busy(WORKER_JOB_CLEANUP_DELETE); + rrdcontext_delete_from_sql_unsafe(rc); + + STRING *id = string_dup(rc->id); + rrdcontext_unlock(rc); + + // delete it from the master dictionary + if(dictionary_del((DICTIONARY *)host->rrdctx, string2str(rc->id)) != 0) + error("RRDCONTEXT: '%s' of host '%s' failed to be deleted from rrdcontext dictionary.", + string2str(id), host->hostname); + + string_freez(id); + } + else + rrdcontext_unlock(rc); + } + freez(claim_id); + } + dfe_done(rc); + +#ifdef ENABLE_ACLK + if(!netdata_exit && bundle) { + // we have a bundle to send messages + + // update the version hash + contexts_updated_update_version_hash(bundle, rrdcontext_version_hash(host)); + + // send it + aclk_send_contexts_updated(bundle); + } + else if(bundle) + contexts_updated_delete(bundle); +#endif + } + rrd_unlock(); + + } + +exit: + netdata_thread_cleanup_pop(1); + return NULL; +} diff --git a/database/rrdcontext.h b/database/rrdcontext.h new file mode 100644 index 000000000..a9e0bd2e3 --- /dev/null +++ b/database/rrdcontext.h @@ -0,0 +1,92 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_RRDCONTEXT_H +#define NETDATA_RRDCONTEXT_H 1 + +// ---------------------------------------------------------------------------- +// RRDMETRIC + +typedef struct rrdmetric_acquired RRDMETRIC_ACQUIRED; + + +// ---------------------------------------------------------------------------- +// RRDINSTANCE + +typedef struct rrdinstance_acquired RRDINSTANCE_ACQUIRED; + +// ---------------------------------------------------------------------------- +// RRDCONTEXT + +typedef struct rrdcontexts_dictionary RRDCONTEXTS; +typedef struct rrdcontext_acquired RRDCONTEXT_ACQUIRED; + +// ---------------------------------------------------------------------------- + +#include "rrd.h" + +// ---------------------------------------------------------------------------- +// public API for rrdhost + +extern void rrdhost_load_rrdcontext_data(RRDHOST *host); +extern void rrdhost_create_rrdcontexts(RRDHOST *host); +extern void rrdhost_destroy_rrdcontexts(RRDHOST *host); + +extern void rrdcontext_host_child_connected(RRDHOST *host); +extern void rrdcontext_host_child_disconnected(RRDHOST *host); + +typedef enum { + RRDCONTEXT_OPTION_NONE = 0, + RRDCONTEXT_OPTION_SHOW_METRICS = (1 << 0), + RRDCONTEXT_OPTION_SHOW_INSTANCES = (1 << 1), + RRDCONTEXT_OPTION_SHOW_LABELS = (1 << 2), + RRDCONTEXT_OPTION_SHOW_QUEUED = (1 << 3), + RRDCONTEXT_OPTION_SHOW_FLAGS = (1 << 4), + RRDCONTEXT_OPTION_SHOW_DELETED = (1 << 5), + RRDCONTEXT_OPTION_DEEPSCAN = (1 << 6), + RRDCONTEXT_OPTION_SHOW_UUIDS = (1 << 7), + RRDCONTEXT_OPTION_SHOW_HIDDEN = (1 << 8), + RRDCONTEXT_OPTION_SKIP_ID = (1 << 31), // internal use +} RRDCONTEXT_TO_JSON_OPTIONS; + +#define RRDCONTEXT_OPTIONS_ALL (RRDCONTEXT_OPTION_SHOW_METRICS|RRDCONTEXT_OPTION_SHOW_INSTANCES|RRDCONTEXT_OPTION_SHOW_LABELS|RRDCONTEXT_OPTION_SHOW_QUEUED|RRDCONTEXT_OPTION_SHOW_FLAGS|RRDCONTEXT_OPTION_SHOW_DELETED|RRDCONTEXT_OPTION_SHOW_UUIDS|RRDCONTEXT_OPTION_SHOW_HIDDEN) + +extern int rrdcontext_to_json(RRDHOST *host, BUFFER *wb, time_t after, time_t before, RRDCONTEXT_TO_JSON_OPTIONS options, const char *context, SIMPLE_PATTERN *chart_label_key, SIMPLE_PATTERN *chart_labels_filter, SIMPLE_PATTERN *chart_dimensions); +extern int rrdcontexts_to_json(RRDHOST *host, BUFFER *wb, time_t after, time_t before, RRDCONTEXT_TO_JSON_OPTIONS options, SIMPLE_PATTERN *chart_label_key, SIMPLE_PATTERN *chart_labels_filter, SIMPLE_PATTERN *chart_dimensions); + +// ---------------------------------------------------------------------------- +// public API for rrddims + +extern void rrdcontext_updated_rrddim(RRDDIM *rd); +extern void rrdcontext_removed_rrddim(RRDDIM *rd); +extern void rrdcontext_updated_rrddim_algorithm(RRDDIM *rd); +extern void rrdcontext_updated_rrddim_multiplier(RRDDIM *rd); +extern void rrdcontext_updated_rrddim_divisor(RRDDIM *rd); +extern void rrdcontext_updated_rrddim_flags(RRDDIM *rd); +extern void rrdcontext_collected_rrddim(RRDDIM *rd); + +// ---------------------------------------------------------------------------- +// public API for rrdsets + +extern void rrdcontext_updated_rrdset(RRDSET *st); +extern void rrdcontext_removed_rrdset(RRDSET *st); +extern void rrdcontext_updated_rrdset_name(RRDSET *st); +extern void rrdcontext_updated_rrdset_flags(RRDSET *st); +extern void rrdcontext_collected_rrdset(RRDSET *st); + +// ---------------------------------------------------------------------------- +// public API for ACLK + +extern void rrdcontext_hub_checkpoint_command(void *cmd); +extern void rrdcontext_hub_stop_streaming_command(void *cmd); + + +// ---------------------------------------------------------------------------- +// public API for threads + +extern int rrdcontext_enabled; + +extern void rrdcontext_db_rotation(void); +extern void *rrdcontext_main(void *); + +#endif // NETDATA_RRDCONTEXT_H + diff --git a/database/rrddim.c b/database/rrddim.c index e488d8b0b..90165a253 100644 --- a/database/rrddim.c +++ b/database/rrddim.c @@ -73,6 +73,7 @@ inline int rrddim_set_algorithm(RRDSET *st, RRDDIM *rd, RRD_ALGORITHM algorithm) rd->exposed = 0; rrdset_flag_set(st, RRDSET_FLAG_HOMOGENEOUS_CHECK); rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED); + rrdcontext_updated_rrddim_algorithm(rd); return 1; } @@ -85,6 +86,7 @@ inline int rrddim_set_multiplier(RRDSET *st, RRDDIM *rd, collected_number multip rd->exposed = 0; rrdset_flag_set(st, RRDSET_FLAG_HOMOGENEOUS_CHECK); rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED); + rrdcontext_updated_rrddim_multiplier(rd); return 1; } @@ -97,6 +99,7 @@ inline int rrddim_set_divisor(RRDSET *st, RRDDIM *rd, collected_number divisor) rd->exposed = 0; rrdset_flag_set(st, RRDSET_FLAG_HOMOGENEOUS_CHECK); rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED); + rrdcontext_updated_rrddim_divisor(rd); return 1; } @@ -139,12 +142,12 @@ void rrdcalc_link_to_rrddim(RRDDIM *rd, RRDSET *st, RRDHOST *host) { // 0 : Dimension is live // last collected time : Dimension is not live -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK time_t calc_dimension_liveness(RRDDIM *rd, time_t now) { time_t last_updated = rd->last_collected_time.tv_sec; int live; - if (rd->state->aclk_live_status == 1) + if (rd->aclk_live_status == 1) live = ((now - last_updated) < MIN(rrdset_free_obsolete_time, RRDSET_MINIMUM_DIM_OFFLINE_MULTIPLIER * rd->update_every)); @@ -168,9 +171,16 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte rc += rrddim_set_algorithm(st, rd, algorithm); rc += rrddim_set_multiplier(st, rd, multiplier); rc += rrddim_set_divisor(st, rd, divisor); + if (rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) { - store_active_dimension(&rd->state->metric_uuid); - rd->state->collect_ops.init(rd); + store_active_dimension(&rd->metric_uuid); + + for(int tier = 0; tier < storage_tiers ;tier++) { + if (rd->tiers[tier]) + rd->tiers[tier]->db_collection_handle = + rd->tiers[tier]->collect_ops.init(rd->tiers[tier]->db_metric_handle); + } + rrddim_flag_clear(rd, RRDDIM_FLAG_ARCHIVED); rrddimvar_create(rd, RRDVAR_TYPE_CALCULATED, NULL, NULL, &rd->last_stored_value, RRDVAR_OPTION_DEFAULT); rrddimvar_create(rd, RRDVAR_TYPE_COLLECTED, NULL, "_raw", &rd->last_collected_value, RRDVAR_OPTION_DEFAULT); @@ -180,129 +190,34 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte rrdset_flag_set(st, RRDSET_FLAG_PENDING_FOREACH_ALARMS); rrdhost_flag_set(host, RRDHOST_FLAG_PENDING_FOREACH_ALARMS); } + if (unlikely(rc)) { debug(D_METADATALOG, "DIMENSION [%s] metadata updated", rd->id); - (void)sql_store_dimension(&rd->state->metric_uuid, rd->rrdset->chart_uuid, rd->id, rd->name, rd->multiplier, rd->divisor, + (void)sql_store_dimension(&rd->metric_uuid, rd->rrdset->chart_uuid, rd->id, rd->name, rd->multiplier, rd->divisor, rd->algorithm); -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK queue_dimension_to_aclk(rd, calc_dimension_liveness(rd, now_realtime_sec())); #endif rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK); rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED); } rrdset_unlock(st); + rrdcontext_updated_rrddim(rd); return rd; } rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK); rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED); - char filename[FILENAME_MAX + 1]; - char fullfilename[FILENAME_MAX + 1]; - - unsigned long size = sizeof(RRDDIM) + (st->entries * sizeof(storage_number)); - - debug(D_RRD_CALLS, "Adding dimension '%s/%s'.", st->id, id); - - rrdset_strncpyz_name(filename, id, FILENAME_MAX); - snprintfz(fullfilename, FILENAME_MAX, "%s/%s.db", st->cache_dir, filename); - - if(memory_mode == RRD_MEMORY_MODE_SAVE || memory_mode == RRD_MEMORY_MODE_MAP || - memory_mode == RRD_MEMORY_MODE_RAM) { - rd = (RRDDIM *)netdata_mmap( - (memory_mode == RRD_MEMORY_MODE_RAM) ? NULL : fullfilename, - size, - ((memory_mode == RRD_MEMORY_MODE_MAP) ? MAP_SHARED : MAP_PRIVATE), - 1); - - if(likely(rd)) { - // we have a file mapped for rd - - memset(&rd->avl, 0, sizeof(avl_t)); - rd->id = NULL; - rd->name = NULL; - rd->cache_filename = NULL; - rd->variables = NULL; - rd->next = NULL; - rd->rrdset = NULL; - rd->exposed = 0; - - struct timeval now; - now_realtime_timeval(&now); - - if(memory_mode == RRD_MEMORY_MODE_RAM) { - memset(rd, 0, size); - } - else { - int reset = 0; - - if(strcmp(rd->magic, RRDDIMENSION_MAGIC) != 0) { - info("Initializing file %s.", fullfilename); - memset(rd, 0, size); - reset = 1; - } - else if(rd->memsize != size) { - error("File %s does not have the desired size, expected %lu but found %lu. Clearing it.", fullfilename, size, rd->memsize); - memset(rd, 0, size); - reset = 1; - } - else if(rd->update_every != st->update_every) { - error("File %s does not have the same update frequency, expected %d but found %d. Clearing it.", fullfilename, st->update_every, rd->update_every); - memset(rd, 0, size); - reset = 1; - } - else if(dt_usec(&now, &rd->last_collected_time) > (rd->entries * rd->update_every * USEC_PER_SEC)) { - info("File %s is too old (last collected %llu seconds ago, but the database is %ld seconds). Clearing it.", fullfilename, dt_usec(&now, &rd->last_collected_time) / USEC_PER_SEC, rd->entries * rd->update_every); - memset(rd, 0, size); - reset = 1; - } - - if(!reset) { - if(rd->algorithm != algorithm) { - info("File %s does not have the expected algorithm (expected %u '%s', found %u '%s'). Previous values may be wrong.", - fullfilename, algorithm, rrd_algorithm_name(algorithm), rd->algorithm, rrd_algorithm_name(rd->algorithm)); - } - - if(rd->multiplier != multiplier) { - info("File %s does not have the expected multiplier (expected " COLLECTED_NUMBER_FORMAT ", found " COLLECTED_NUMBER_FORMAT "). Previous values may be wrong.", fullfilename, multiplier, rd->multiplier); - } - - if(rd->divisor != divisor) { - info("File %s does not have the expected divisor (expected " COLLECTED_NUMBER_FORMAT ", found " COLLECTED_NUMBER_FORMAT "). Previous values may be wrong.", fullfilename, divisor, rd->divisor); - } - } - } - - // make sure we have the right memory mode - // even if we cleared the memory - rd->rrd_memory_mode = memory_mode; - } - } - - if(unlikely(!rd)) { - // if we didn't manage to get a mmap'd dimension, just create one - rd = callocz(1, size); - if (memory_mode == RRD_MEMORY_MODE_DBENGINE) - rd->rrd_memory_mode = RRD_MEMORY_MODE_DBENGINE; - else - rd->rrd_memory_mode = (memory_mode == RRD_MEMORY_MODE_NONE) ? RRD_MEMORY_MODE_NONE : RRD_MEMORY_MODE_ALLOC; - } - rd->memsize = size; - - strcpy(rd->magic, RRDDIMENSION_MAGIC); - + rd = callocz(1, sizeof(RRDDIM)); rd->id = strdupz(id); rd->hash = simple_hash(rd->id); - rd->cache_filename = strdupz(fullfilename); - rd->name = (name && *name)?strdupz(name):strdupz(rd->id); rd->hash_name = simple_hash(rd->name); rd->algorithm = algorithm; - rd->multiplier = multiplier; - rd->divisor = divisor; if(!rd->divisor) rd->divisor = 1; @@ -311,40 +226,86 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte if(rrdset_flag_check(st, RRDSET_FLAG_STORE_FIRST)) rd->collections_counter = 1; - else - rd->collections_counter = 0; - - rd->updated = 0; - rd->flags = 0x00000000; - - rd->calculated_value = 0; - rd->last_calculated_value = 0; - rd->collected_value = 0; - rd->last_collected_value = 0; - rd->collected_value_max = 0; - rd->collected_volume = 0; - rd->stored_volume = 0; - rd->last_stored_value = 0; - rd->last_collected_time.tv_sec = 0; - rd->last_collected_time.tv_usec = 0; + rd->rrdset = st; - rd->state = callocz(1, sizeof(*rd->state)); + + if(memory_mode == RRD_MEMORY_MODE_MAP || memory_mode == RRD_MEMORY_MODE_SAVE) { + if(!rrddim_memory_load_or_create_map_save(st, rd, memory_mode)) { + info("Failed to use memory mode %s for chart '%s', dimension '%s', falling back to ram", (memory_mode == RRD_MEMORY_MODE_MAP)?"map":"save", st->name, rd->name); + memory_mode = RRD_MEMORY_MODE_RAM; + } + } + + if(memory_mode == RRD_MEMORY_MODE_RAM) { + size_t entries = st->entries; + if(!entries) entries = 5; + + rd->db = netdata_mmap(NULL, entries * sizeof(storage_number), MAP_PRIVATE, 1); + if(!rd->db) { + info("Failed to use memory mode ram for chart '%s', dimension '%s', falling back to alloc", st->name, rd->name); + memory_mode = RRD_MEMORY_MODE_ALLOC; + } + else rd->memsize = entries * sizeof(storage_number); + } + + if(memory_mode == RRD_MEMORY_MODE_ALLOC || memory_mode == RRD_MEMORY_MODE_NONE) { + size_t entries = st->entries; + if(entries < 5) entries = 5; + + rd->db = callocz(entries, sizeof(storage_number)); + rd->memsize = entries * sizeof(storage_number); + } + + rd->rrd_memory_mode = memory_mode; + #ifdef ENABLE_ACLK - rd->state->aclk_live_status = -1; + rd->aclk_live_status = -1; #endif - (void) find_dimension_uuid(st, rd, &(rd->state->metric_uuid)); + (void) find_dimension_uuid(st, rd, &(rd->metric_uuid)); + + // initialize the db tiers + { + size_t initialized = 0; + RRD_MEMORY_MODE wanted_mode = memory_mode; + for(int tier = 0; tier < storage_tiers ; tier++, wanted_mode = RRD_MEMORY_MODE_DBENGINE) { + STORAGE_ENGINE *eng = storage_engine_get(wanted_mode); + if(!eng) continue; + + rd->tiers[tier] = callocz(1, sizeof(struct rrddim_tier)); + rd->tiers[tier]->tier_grouping = get_tier_grouping(tier); + rd->tiers[tier]->mode = eng->id; + rd->tiers[tier]->collect_ops = eng->api.collect_ops; + rd->tiers[tier]->query_ops = eng->api.query_ops; + rd->tiers[tier]->db_metric_handle = eng->api.init(rd, host->storage_instance[tier]); + storage_point_unset(rd->tiers[tier]->virtual_point); + initialized++; + + // internal_error(true, "TIER GROUPING of chart '%s', dimension '%s' for tier %d is set to %d", rd->rrdset->name, rd->name, tier, rd->tiers[tier]->tier_grouping); + } - STORAGE_ENGINE* eng = storage_engine_get(memory_mode); - rd->state->collect_ops = eng->api.collect_ops; - rd->state->query_ops = eng->api.query_ops; + if(!initialized) + error("Failed to initialize all db tiers for chart '%s', dimension '%s", st->name, rd->name); -#ifdef ENABLE_DBENGINE - if(memory_mode == RRD_MEMORY_MODE_DBENGINE) { - rrdeng_metric_init(rd); + if(!rd->tiers[0]) + error("Failed to initialize the first db tier for chart '%s', dimension '%s", st->name, rd->name); } -#endif - store_active_dimension(&rd->state->metric_uuid); - rd->state->collect_ops.init(rd); + + store_active_dimension(&rd->metric_uuid); + + // initialize data collection for all tiers + { + size_t initialized = 0; + for (int tier = 0; tier < storage_tiers; tier++) { + if (rd->tiers[tier]) { + rd->tiers[tier]->db_collection_handle = rd->tiers[tier]->collect_ops.init(rd->tiers[tier]->db_metric_handle); + initialized++; + } + } + + if(!initialized) + error("Failed to initialize data collection for all db tiers for chart '%s', dimension '%s", st->name, rd->name); + } + // append this dimension if(!st->dimensions) st->dimensions = rd; @@ -387,6 +348,7 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte ml_new_dimension(rd); rrdset_unlock(st); + rrdcontext_updated_rrddim(rd); return(rd); } @@ -395,15 +357,28 @@ RRDDIM *rrddim_add_custom(RRDSET *st, const char *id, const char *name, collecte void rrddim_free(RRDSET *st, RRDDIM *rd) { + rrdcontext_removed_rrddim(rd); ml_delete_dimension(rd); debug(D_RRD_CALLS, "rrddim_free() %s.%s", st->name, rd->name); if (!rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) { - uint8_t can_delete_metric = rd->state->collect_ops.finalize(rd); - if (can_delete_metric && rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { + + size_t tiers_available = 0, tiers_said_yes = 0; + for(int tier = 0; tier < storage_tiers ;tier++) { + if(rd->tiers[tier]) { + tiers_available++; + + if(rd->tiers[tier]->collect_ops.finalize(rd->tiers[tier]->db_collection_handle)) + tiers_said_yes++; + + rd->tiers[tier]->db_collection_handle = NULL; + } + } + + if (tiers_available == tiers_said_yes && tiers_said_yes && rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { /* This metric has no data and no references */ - delete_dimension_uuid(&rd->state->metric_uuid); + delete_dimension_uuid(&rd->metric_uuid); } } @@ -427,35 +402,35 @@ void rrddim_free(RRDSET *st, RRDDIM *rd) error("RRDDIM: INTERNAL ERROR: attempt to remove from index dimension '%s' on chart '%s', removed a different dimension.", rd->id, st->id); // free(rd->annotations); -//#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +//#ifdef ENABLE_ACLK // if (!netdata_exit) // aclk_send_dimension_update(rd); //#endif - RRD_MEMORY_MODE rrd_memory_mode = rd->rrd_memory_mode; - switch(rrd_memory_mode) { - case RRD_MEMORY_MODE_SAVE: - case RRD_MEMORY_MODE_MAP: - case RRD_MEMORY_MODE_RAM: - debug(D_RRD_CALLS, "Unmapping dimension '%s'.", rd->name); - freez((void *)rd->id); - freez((void *)rd->name); - freez(rd->cache_filename); - freez(rd->state); - munmap(rd, rd->memsize); - break; - - case RRD_MEMORY_MODE_ALLOC: - case RRD_MEMORY_MODE_NONE: - case RRD_MEMORY_MODE_DBENGINE: - debug(D_RRD_CALLS, "Removing dimension '%s'.", rd->name); - freez((void *)rd->id); - freez((void *)rd->name); - freez(rd->cache_filename); - freez(rd->state); - freez(rd); - break; + // this will free MEMORY_MODE_SAVE and MEMORY_MODE_MAP structures + rrddim_memory_file_free(rd); + + for(int tier = 0; tier < storage_tiers ;tier++) { + if(!rd->tiers[tier]) continue; + + STORAGE_ENGINE* eng = storage_engine_get(rd->tiers[tier]->mode); + if(eng) + eng->api.free(rd->tiers[tier]->db_metric_handle); + + freez(rd->tiers[tier]); + rd->tiers[tier] = NULL; + } + + if(rd->db) { + if(rd->rrd_memory_mode == RRD_MEMORY_MODE_RAM) + munmap(rd->db, rd->memsize); + else + freez(rd->db); } + + freez((void *)rd->id); + freez((void *)rd->name); + freez(rd); } @@ -473,10 +448,11 @@ int rrddim_hide(RRDSET *st, const char *id) { return 1; } if (!rrddim_flag_check(rd, RRDDIM_FLAG_META_HIDDEN)) - (void)sql_set_dimension_option(&rd->state->metric_uuid, "hidden"); + (void)sql_set_dimension_option(&rd->metric_uuid, "hidden"); rrddim_flag_set(rd, RRDDIM_FLAG_HIDDEN); rrddim_flag_set(rd, RRDDIM_FLAG_META_HIDDEN); + rrdcontext_updated_rrddim_flags(rd); return 0; } @@ -490,10 +466,11 @@ int rrddim_unhide(RRDSET *st, const char *id) { return 1; } if (rrddim_flag_check(rd, RRDDIM_FLAG_META_HIDDEN)) - (void)sql_set_dimension_option(&rd->state->metric_uuid, NULL); + (void)sql_set_dimension_option(&rd->metric_uuid, NULL); rrddim_flag_clear(rd, RRDDIM_FLAG_HIDDEN); rrddim_flag_clear(rd, RRDDIM_FLAG_META_HIDDEN); + rrdcontext_updated_rrddim_flags(rd); return 0; } @@ -506,12 +483,14 @@ inline void rrddim_is_obsolete(RRDSET *st, RRDDIM *rd) { } rrddim_flag_set(rd, RRDDIM_FLAG_OBSOLETE); rrdset_flag_set(st, RRDSET_FLAG_OBSOLETE_DIMENSIONS); + rrdcontext_updated_rrddim_flags(rd); } inline void rrddim_isnot_obsolete(RRDSET *st __maybe_unused, RRDDIM *rd) { debug(D_RRD_CALLS, "rrddim_isnot_obsolete() for chart %s, dimension %s", st->name, rd->name); rrddim_flag_clear(rd, RRDDIM_FLAG_OBSOLETE); + rrdcontext_updated_rrddim_flags(rd); } // ---------------------------------------------------------------------------- @@ -520,6 +499,8 @@ inline void rrddim_isnot_obsolete(RRDSET *st __maybe_unused, RRDDIM *rd) { inline collected_number rrddim_set_by_pointer(RRDSET *st __maybe_unused, RRDDIM *rd, collected_number value) { debug(D_RRD_CALLS, "rrddim_set_by_pointer() for chart %s, dimension %s, value " COLLECTED_NUMBER_FORMAT, st->name, rd->name, value); + rrdcontext_collected_rrddim(rd); + now_realtime_timeval(&rd->last_collected_time); rd->collected_value = value; rd->updated = 1; @@ -529,7 +510,7 @@ inline collected_number rrddim_set_by_pointer(RRDSET *st __maybe_unused, RRDDIM collected_number v = (value >= 0) ? value : -value; if(unlikely(v > rd->collected_value_max)) rd->collected_value_max = v; - // fprintf(stderr, "%s.%s %llu " COLLECTED_NUMBER_FORMAT " dt %0.6f" " rate " CALCULATED_NUMBER_FORMAT "\n", st->name, rd->name, st->usec_since_last_update, value, (float)((double)st->usec_since_last_update / (double)1000000), (calculated_number)((value - rd->last_collected_value) * (calculated_number)rd->multiplier / (calculated_number)rd->divisor * 1000000.0 / (calculated_number)st->usec_since_last_update)); + // fprintf(stderr, "%s.%s %llu " COLLECTED_NUMBER_FORMAT " dt %0.6f" " rate " NETDATA_DOUBLE_FORMAT "\n", st->name, rd->name, st->usec_since_last_update, value, (float)((double)st->usec_since_last_update / (double)1000000), (NETDATA_DOUBLE)((value - rd->last_collected_value) * (NETDATA_DOUBLE)rd->multiplier / (NETDATA_DOUBLE)rd->divisor * 1000000.0 / (NETDATA_DOUBLE)st->usec_since_last_update)); return rd->last_collected_value; } @@ -544,3 +525,172 @@ collected_number rrddim_set(RRDSET *st, const char *id, collected_number value) return rrddim_set_by_pointer(st, rd, value); } + + +// ---------------------------------------------------------------------------- +// compatibility layer for RRDDIM files v019 + +#define RRDDIMENSION_MAGIC_V019 "NETDATA RRD DIMENSION FILE V019" + +struct avl_element_v019 { + void *avl_link[2]; + signed char avl_balance; +}; + +struct rrddim_map_save_v019 { + struct avl_element_v019 avl; // ignored + void *id; // ignored + void *name; // ignored + uint32_t algorithm; // print warning on mismatch - update on load + uint32_t rrd_memory_mode; // ignored + long long multiplier; // print warning on mismatch - update on load + long long divisor; // print warning on mismatch - update on load + uint32_t flags; // ignored + uint32_t hash; // ignored + uint32_t hash_name; // ignored + void *cache_filename; // ignored - we use it to keep the filename to save back + size_t collections_counter; // ignored + void *state; // ignored + size_t unused[8]; // ignored + long long collected_value_max; // ignored + unsigned int updated:1; // ignored + unsigned int exposed:1; // ignored + struct timeval last_collected_time; // check to reset all - ignored after load + long double calculated_value; // ignored + long double last_calculated_value; // ignored + long double last_stored_value; // ignored + long long collected_value; // ignored + long long last_collected_value; // ignored + long double collected_volume; // ignored + long double stored_volume; // ignored + void *next; // ignored + void *rrdset; // ignored + long entries; // check to reset all - update on load + int update_every; // check to reset all - update on load + size_t memsize; // check to reset all - update on load + char magic[sizeof(RRDDIMENSION_MAGIC_V019) + 1];// check to reset all - update on load + void *variables; // ignored + storage_number values[]; // the array of values +}; + +size_t rrddim_memory_file_header_size(void) { + return sizeof(struct rrddim_map_save_v019); +} + +void rrddim_memory_file_update(RRDDIM *rd) { + if(!rd->rd_on_file) return; + struct rrddim_map_save_v019 *rd_on_file = rd->rd_on_file; + + rd_on_file->last_collected_time.tv_sec = rd->last_collected_time.tv_sec; + rd_on_file->last_collected_time.tv_usec = rd->last_collected_time.tv_usec; +} + +void rrddim_memory_file_free(RRDDIM *rd) { + if(!rd->rd_on_file) return; + + // needed for memory mode map, to save the latest state + rrddim_memory_file_update(rd); + + struct rrddim_map_save_v019 *rd_on_file = rd->rd_on_file; + freez(rd_on_file->cache_filename); + munmap(rd_on_file, rd_on_file->memsize); + + // remove the pointers from the RRDDIM + rd->rd_on_file = NULL; + rd->db = NULL; +} + +const char *rrddim_cache_filename(RRDDIM *rd) { + if(!rd->rd_on_file) return NULL; + struct rrddim_map_save_v019 *rd_on_file = rd->rd_on_file; + return rd_on_file->cache_filename; +} + +void rrddim_memory_file_save(RRDDIM *rd) { + if(!rd->rd_on_file) return; + + rrddim_memory_file_update(rd); + + struct rrddim_map_save_v019 *rd_on_file = rd->rd_on_file; + if(rd_on_file->rrd_memory_mode != RRD_MEMORY_MODE_SAVE) return; + + memory_file_save(rd_on_file->cache_filename, rd_on_file, rd_on_file->memsize); +} + +bool rrddim_memory_load_or_create_map_save(RRDSET *st, RRDDIM *rd, RRD_MEMORY_MODE memory_mode) { + if(memory_mode != RRD_MEMORY_MODE_SAVE && memory_mode != RRD_MEMORY_MODE_MAP) + return false; + + struct rrddim_map_save_v019 *rd_on_file = NULL; + + unsigned long size = sizeof(struct rrddim_map_save_v019) + (st->entries * sizeof(storage_number)); + + char filename[FILENAME_MAX + 1]; + char fullfilename[FILENAME_MAX + 1]; + rrdset_strncpyz_name(filename, rd->id, FILENAME_MAX); + snprintfz(fullfilename, FILENAME_MAX, "%s/%s.db", st->cache_dir, filename); + + rd_on_file = (struct rrddim_map_save_v019 *)netdata_mmap(fullfilename, size, + ((memory_mode == RRD_MEMORY_MODE_MAP) ? MAP_SHARED : MAP_PRIVATE), 1); + + if(unlikely(!rd_on_file)) return false; + + struct timeval now; + now_realtime_timeval(&now); + + int reset = 0; + rd_on_file->magic[sizeof(RRDDIMENSION_MAGIC_V019)] = '\0'; + if(strcmp(rd_on_file->magic, RRDDIMENSION_MAGIC_V019) != 0) { + info("Initializing file %s.", fullfilename); + memset(rd_on_file, 0, size); + reset = 1; + } + else if(rd_on_file->memsize != size) { + error("File %s does not have the desired size, expected %lu but found %lu. Clearing it.", fullfilename, size, rd_on_file->memsize); + memset(rd_on_file, 0, size); + reset = 1; + } + else if(rd_on_file->update_every != st->update_every) { + error("File %s does not have the same update frequency, expected %d but found %d. Clearing it.", fullfilename, st->update_every, rd_on_file->update_every); + memset(rd_on_file, 0, size); + reset = 1; + } + else if(dt_usec(&now, &rd_on_file->last_collected_time) > (rd_on_file->entries * rd_on_file->update_every * USEC_PER_SEC)) { + info("File %s is too old (last collected %llu seconds ago, but the database is %ld seconds). Clearing it.", fullfilename, dt_usec(&now, &rd_on_file->last_collected_time) / USEC_PER_SEC, rd_on_file->entries * rd_on_file->update_every); + memset(rd_on_file, 0, size); + reset = 1; + } + + if(!reset) { + if(rd_on_file->algorithm != rd->algorithm) + info("File %s does not have the expected algorithm (expected %u '%s', found %u '%s'). Previous values may be wrong.", + fullfilename, rd->algorithm, rrd_algorithm_name(rd->algorithm), rd_on_file->algorithm, rrd_algorithm_name(rd_on_file->algorithm)); + + if(rd_on_file->multiplier != rd->multiplier) + info("File %s does not have the expected multiplier (expected " COLLECTED_NUMBER_FORMAT ", found " COLLECTED_NUMBER_FORMAT "). Previous values may be wrong.", fullfilename, rd->multiplier, rd_on_file->multiplier); + + if(rd_on_file->divisor != rd->divisor) + info("File %s does not have the expected divisor (expected " COLLECTED_NUMBER_FORMAT ", found " COLLECTED_NUMBER_FORMAT "). Previous values may be wrong.", fullfilename, rd->divisor, rd_on_file->divisor); + } + + // zero the entire header + memset(rd_on_file, 0, sizeof(struct rrddim_map_save_v019)); + + // set the important fields + strcpy(rd_on_file->magic, RRDDIMENSION_MAGIC_V019); + rd_on_file->algorithm = rd->algorithm; + rd_on_file->multiplier = rd->multiplier; + rd_on_file->divisor = rd->divisor; + rd_on_file->entries = st->entries; + rd_on_file->update_every = rd->update_every; + rd_on_file->memsize = size; + rd_on_file->rrd_memory_mode = memory_mode; + rd_on_file->cache_filename = strdupz(fullfilename); + + rd->db = &rd_on_file->values[0]; + rd->rd_on_file = rd_on_file; + rd->memsize = size; + rrddim_memory_file_update(rd); + + return true; +} diff --git a/database/rrdhost.c b/database/rrdhost.c index cb56bf353..7f4bd95ba 100644 --- a/database/rrdhost.c +++ b/database/rrdhost.c @@ -3,6 +3,26 @@ #define NETDATA_RRD_INTERNALS #include "rrd.h" +int storage_tiers = 1; +int storage_tiers_grouping_iterations[RRD_STORAGE_TIERS] = { 1, 60, 60, 60, 60 }; +RRD_BACKFILL storage_tiers_backfill[RRD_STORAGE_TIERS] = { RRD_BACKFILL_NEW, RRD_BACKFILL_NEW, RRD_BACKFILL_NEW, RRD_BACKFILL_NEW, RRD_BACKFILL_NEW }; + +#if RRD_STORAGE_TIERS != 5 +#error RRD_STORAGE_TIERS is not 5 - you need to update the grouping iterations per tier +#endif + +int get_tier_grouping(int tier) { + if(unlikely(tier >= storage_tiers)) tier = storage_tiers - 1; + if(unlikely(tier < 0)) tier = 0; + + int grouping = 1; + // first tier is always 1 iteration of whatever update every the chart has + for(int i = 1; i <= tier ;i++) + grouping *= storage_tiers_grouping_iterations[i]; + + return grouping; +} + RRDHOST *localhost = NULL; size_t rrd_hosts_available = 0; netdata_rwlock_t rrd_rwlock = NETDATA_RWLOCK_INITIALIZER; @@ -10,6 +30,18 @@ netdata_rwlock_t rrd_rwlock = NETDATA_RWLOCK_INITIALIZER; time_t rrdset_free_obsolete_time = 3600; time_t rrdhost_free_orphan_time = 3600; +bool is_storage_engine_shared(STORAGE_INSTANCE *engine) { +#ifdef ENABLE_DBENGINE + for(int tier = 0; tier < storage_tiers ;tier++) { + if (engine == (STORAGE_INSTANCE *)multidb_ctx[tier]) + return true; + } +#endif + + return false; +} + + // ---------------------------------------------------------------------------- // RRDHOST index @@ -155,7 +187,8 @@ RRDHOST *rrdhost_create(const char *hostname, char *rrdpush_api_key, char *rrdpush_send_charts_matching, struct rrdhost_system_info *system_info, - int is_localhost + int is_localhost, + bool archived ) { debug(D_RRDHOST, "Host '%s': adding with guid '%s'", hostname, guid); @@ -175,8 +208,7 @@ RRDHOST *rrdhost_create(const char *hostname, host->rrd_history_entries = align_entries_to_pagesize(memory_mode, entries); host->health_enabled = ((memory_mode == RRD_MEMORY_MODE_NONE)) ? 0 : health_enabled; - host->sender = mallocz(sizeof(*host->sender)); - sender_init(host->sender, host); + sender_init(host); netdata_mutex_init(&host->receiver_lock); host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key) ? 1 : 0; @@ -199,7 +231,7 @@ RRDHOST *rrdhost_create(const char *hostname, #endif netdata_rwlock_init(&host->rrdhost_rwlock); - netdata_rwlock_init(&host->labels.labels_rwlock); + host->host_labels = rrdlabels_create(); netdata_mutex_init(&host->aclk_state_lock); @@ -210,10 +242,10 @@ RRDHOST *rrdhost_create(const char *hostname, avl_init_lock(&(host->rrdfamily_root_index), rrdfamily_compare); avl_init_lock(&(host->rrdvar_root_index), rrdvar_compare); - if(config_get_boolean(CONFIG_SECTION_GLOBAL, "delete obsolete charts files", 1)) + if(config_get_boolean(CONFIG_SECTION_DB, "delete obsolete charts files", 1)) rrdhost_flag_set(host, RRDHOST_FLAG_DELETE_OBSOLETE_CHARTS); - if(config_get_boolean(CONFIG_SECTION_GLOBAL, "delete orphan hosts files", 1) && !is_localhost) + if(config_get_boolean(CONFIG_SECTION_DB, "delete orphan hosts files", 1) && !is_localhost) rrdhost_flag_set(host, RRDHOST_FLAG_DELETE_ORPHAN_HOST); host->health_default_warn_repeat_every = config_get_duration(CONFIG_SECTION_HEALTH, "default repeat warning", "never"); @@ -303,18 +335,21 @@ RRDHOST *rrdhost_create(const char *hostname, if(t != host) { error("Host '%s': cannot add host with machine guid '%s' to index. It already exists as host '%s' with machine guid '%s'.", host->hostname, host->machine_guid, t->hostname, t->machine_guid); - rrdhost_free(host); + rrdhost_free(host, 1); return NULL; } if (likely(!uuid_parse(host->machine_guid, host->host_uuid))) { - int rc = sql_store_host(&host->host_uuid, hostname, registry_hostname, update_every, os, timezone, tags); - if (unlikely(rc)) - error_report("Failed to store machine GUID to the database"); + int rc; + if (!archived) { + rc = sql_store_host_info(host); + if (unlikely(rc)) + error_report("Failed to store machine GUID to the database"); + } sql_load_node_id(host); if (host->health_enabled) { if (!file_is_migrated(host->health_log_filename)) { - int rc = sql_create_health_log_table(host); + rc = sql_create_health_log_table(host); if (unlikely(rc)) { error_report("Failed to create health log table in the database"); health_alarm_log_load(host); @@ -343,16 +378,33 @@ RRDHOST *rrdhost_create(const char *hostname, if (ret != 0 && errno != EEXIST) error("Host '%s': cannot create directory '%s'", host->hostname, dbenginepath); else ret = 0; // succeed - if (is_legacy) // initialize legacy dbengine instance as needed - ret = rrdeng_init(host, &host->rrdeng_ctx, dbenginepath, default_rrdeng_page_cache_mb, - default_rrdeng_disk_quota_mb); // may fail here for legacy dbengine initialization - else - host->rrdeng_ctx = &multidb_ctx; + if (is_legacy) { + // initialize legacy dbengine instance as needed + + ret = rrdeng_init( + host, + (struct rrdengine_instance **)&host->storage_instance[0], + dbenginepath, + default_rrdeng_page_cache_mb, + default_rrdeng_disk_quota_mb, + 0); // may fail here for legacy dbengine initialization + + if(ret == 0) { + // assign the rest of the shared storage instances to it + // to allow them collect its metrics too + for(int tier = 1; tier < storage_tiers ; tier++) + host->storage_instance[tier] = (STORAGE_INSTANCE *)multidb_ctx[tier]; + } + } + else { + for(int tier = 0; tier < storage_tiers ; tier++) + host->storage_instance[tier] = (STORAGE_INSTANCE *)multidb_ctx[tier]; + } if (ret) { // check legacy or multihost initialization success error( "Host '%s': cannot initialize host with machine guid '%s'. Failed to initialize DB engine at '%s'.", host->hostname, host->machine_guid, host->cache_dir); - rrdhost_free(host); + rrdhost_free(host, 1); host = NULL; //rrd_hosts_available++; //TODO: maybe we want this? @@ -365,7 +417,9 @@ RRDHOST *rrdhost_create(const char *hostname, } else { #ifdef ENABLE_DBENGINE - host->rrdeng_ctx = &multidb_ctx; + // the first tier is reserved for the non-dbengine modes + for(int tier = 1; tier < storage_tiers ; tier++) + host->storage_instance[tier] = (STORAGE_INSTANCE *)multidb_ctx[tier]; #endif } @@ -395,8 +449,6 @@ RRDHOST *rrdhost_create(const char *hostname, host->system_info->mc_version = enable_metric_correlations ? metric_correlations_version : 0; } - ml_new_host(host); - info("Host '%s' (at registry as '%s') with guid '%s' initialized" ", os '%s'" ", timezone '%s'" @@ -435,9 +487,15 @@ RRDHOST *rrdhost_create(const char *hostname, , host->health_default_exec , host->health_default_recipient ); + sql_store_host_system_info(&host->host_uuid, system_info); rrd_hosts_available++; + rrdhost_load_rrdcontext_data(host); + if (!archived) + ml_new_host(host); + else + rrdhost_flag_set(host, RRDHOST_FLAG_ARCHIVED); return host; } @@ -474,6 +532,7 @@ void rrdhost_update(RRDHOST *host rrdhost_system_info_free(host->system_info); host->system_info = system_info; + sql_store_host_system_info(&host->host_uuid, system_info); rrdhost_init_os(host, os); rrdhost_init_timezone(host, timezone, abbrev_timezone, utc_offset); @@ -517,6 +576,14 @@ void rrdhost_update(RRDHOST *host if (rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) { rrdhost_flag_clear(host, RRDHOST_FLAG_ARCHIVED); + + host->rrdpush_send_enabled = (rrdpush_enabled && rrdpush_destination && *rrdpush_destination && rrdpush_api_key && *rrdpush_api_key) ? 1 : 0; + host->rrdpush_send_destination = (host->rrdpush_send_enabled)?strdupz(rrdpush_destination):NULL; + if (host->rrdpush_send_destination) + host->destinations = destinations_init(host->rrdpush_send_destination); + host->rrdpush_send_api_key = (host->rrdpush_send_enabled)?strdupz(rrdpush_api_key):NULL; + host->rrdpush_send_charts_matching = simple_pattern_create(rrdpush_send_charts_matching, NULL, SIMPLE_PATTERN_EXACT); + if(host->health_enabled) { int r; char filename[FILENAME_MAX + 1]; @@ -552,6 +619,8 @@ void rrdhost_update(RRDHOST *host } } rrd_hosts_available++; + ml_new_host(host); + rrdhost_load_rrdcontext_data(host); info("Host %s is not in archived mode anymore", host->hostname); } @@ -578,6 +647,7 @@ RRDHOST *rrdhost_find_or_create( , char *rrdpush_api_key , char *rrdpush_send_charts_matching , struct rrdhost_system_info *system_info + , bool archived ) { debug(D_RRDHOST, "Searching for host '%s' with guid '%s'", hostname, guid); @@ -587,7 +657,7 @@ RRDHOST *rrdhost_find_or_create( /* If a legacy memory mode instantiates all dbengine state must be discarded to avoid inconsistencies */ error("Archived host '%s' has memory mode '%s', but the wanted one is '%s'. Discarding archived state.", host->hostname, rrd_memory_mode_name(host->rrd_memory_mode), rrd_memory_mode_name(mode)); - rrdhost_free(host); + rrdhost_free(host, 1); host = NULL; } if(!host) { @@ -612,6 +682,7 @@ RRDHOST *rrdhost_find_or_create( , rrdpush_send_charts_matching , system_info , 0 + , archived ); } else { @@ -651,6 +722,7 @@ inline int rrdhost_should_be_removed(RRDHOST *host, RRDHOST *protected_host, tim if(host != protected_host && host != localhost && rrdhost_flag_check(host, RRDHOST_FLAG_ORPHAN) + && !rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED) && !host->receiver && host->senders_disconnected_time && host->senders_disconnected_time + rrdhost_free_orphan_time < now) @@ -672,14 +744,14 @@ restart_after_removal: if (rrdhost_flag_check(host, RRDHOST_FLAG_DELETE_ORPHAN_HOST) #ifdef ENABLE_DBENGINE /* don't delete multi-host DB host files */ - && !(host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && host->rrdeng_ctx == &multidb_ctx) + && !(host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && is_storage_engine_shared(host->storage_instance[0])) #endif ) rrdhost_delete_charts(host); else rrdhost_save_charts(host); - rrdhost_free(host); + rrdhost_free(host, 0); goto restart_after_removal; } } @@ -689,80 +761,177 @@ restart_after_removal: // RRDHOST global / startup initialization int rrd_init(char *hostname, struct rrdhost_system_info *system_info) { - rrdset_free_obsolete_time = config_get_number(CONFIG_SECTION_GLOBAL, "cleanup obsolete charts after seconds", rrdset_free_obsolete_time); - // Current chart locking and invalidation scheme doesn't prevent Netdata from segmentation faults if a short - // cleanup delay is set. Extensive stress tests showed that 10 seconds is quite a safe delay. Look at - // https://github.com/netdata/netdata/pull/11222#issuecomment-868367920 for more information. - if (rrdset_free_obsolete_time < 10) { - rrdset_free_obsolete_time = 10; - info("The \"cleanup obsolete charts after seconds\" option was set to 10 seconds. A lower delay can potentially cause a segmentation fault."); - } - gap_when_lost_iterations_above = (int)config_get_number(CONFIG_SECTION_GLOBAL, "gap when lost iterations above", gap_when_lost_iterations_above); - if (gap_when_lost_iterations_above < 1) - gap_when_lost_iterations_above = 1; - - if (unlikely(sql_init_database(DB_CHECK_NONE, 0))) { + + if (unlikely(sql_init_database(DB_CHECK_NONE, system_info ? 0 : 1))) { if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) fatal("Failed to initialize SQLite"); - info("Skipping SQLITE metadata initialization since memory mode is not db engine"); + info("Skipping SQLITE metadata initialization since memory mode is not dbengine"); } - health_init(); + if (unlikely(sql_init_context_database(system_info ? 0 : 1))) { + error_report("Failed to initialize context metadata database"); + } + + if (unlikely(!system_info)) + goto unittest; + +#ifdef ENABLE_DBENGINE + storage_tiers = config_get_number(CONFIG_SECTION_DB, "storage tiers", storage_tiers); + if(storage_tiers < 1) { + error("At least 1 storage tier is required. Assuming 1."); + storage_tiers = 1; + config_set_number(CONFIG_SECTION_DB, "storage tiers", storage_tiers); + } + if(storage_tiers > RRD_STORAGE_TIERS) { + error("Up to %d storage tier are supported. Assuming %d.", RRD_STORAGE_TIERS, RRD_STORAGE_TIERS); + storage_tiers = RRD_STORAGE_TIERS; + config_set_number(CONFIG_SECTION_DB, "storage tiers", storage_tiers); + } + + default_rrdeng_page_fetch_timeout = (int) config_get_number(CONFIG_SECTION_DB, "dbengine page fetch timeout secs", PAGE_CACHE_FETCH_WAIT_TIMEOUT); + if (default_rrdeng_page_fetch_timeout < 1) { + info("'dbengine page fetch timeout secs' cannot be %d, using 1", default_rrdeng_page_fetch_timeout); + default_rrdeng_page_fetch_timeout = 1; + config_set_number(CONFIG_SECTION_DB, "dbengine page fetch timeout secs", default_rrdeng_page_fetch_timeout); + } + + default_rrdeng_page_fetch_retries = (int) config_get_number(CONFIG_SECTION_DB, "dbengine page fetch retries", MAX_PAGE_CACHE_FETCH_RETRIES); + if (default_rrdeng_page_fetch_retries < 1) { + info("\"dbengine page fetch retries\" found in netdata.conf cannot be %d, using 1", default_rrdeng_page_fetch_retries); + default_rrdeng_page_fetch_retries = 1; + config_set_number(CONFIG_SECTION_DB, "dbengine page fetch retries", default_rrdeng_page_fetch_retries); + } + + if(config_get_boolean(CONFIG_SECTION_DB, "dbengine page descriptors in file mapped memory", rrdeng_page_descr_is_mmap()) == CONFIG_BOOLEAN_YES) + rrdeng_page_descr_use_mmap(); + else + rrdeng_page_descr_use_malloc(); + int created_tiers = 0; + char dbenginepath[FILENAME_MAX + 1]; + char dbengineconfig[200 + 1]; + for(int tier = 0; tier < storage_tiers ;tier++) { + if(tier == 0) + snprintfz(dbenginepath, FILENAME_MAX, "%s/dbengine", netdata_configured_cache_dir); + else + snprintfz(dbenginepath, FILENAME_MAX, "%s/dbengine-tier%d", netdata_configured_cache_dir, tier); + + int ret = mkdir(dbenginepath, 0775); + if (ret != 0 && errno != EEXIST) { + error("DBENGINE on '%s': cannot create directory '%s'", hostname, dbenginepath); + break; + } + + int page_cache_mb = default_rrdeng_page_cache_mb; + int disk_space_mb = default_multidb_disk_quota_mb; + int grouping_iterations = storage_tiers_grouping_iterations[tier]; + RRD_BACKFILL backfill = storage_tiers_backfill[tier]; + + if(tier > 0) { + snprintfz(dbengineconfig, 200, "dbengine tier %d page cache size MB", tier); + page_cache_mb = config_get_number(CONFIG_SECTION_DB, dbengineconfig, page_cache_mb); + + snprintfz(dbengineconfig, 200, "dbengine tier %d multihost disk space MB", tier); + disk_space_mb = config_get_number(CONFIG_SECTION_DB, dbengineconfig, disk_space_mb); + + snprintfz(dbengineconfig, 200, "dbengine tier %d update every iterations", tier); + grouping_iterations = config_get_number(CONFIG_SECTION_DB, dbengineconfig, grouping_iterations); + if(grouping_iterations < 2) { + grouping_iterations = 2; + config_set_number(CONFIG_SECTION_DB, dbengineconfig, grouping_iterations); + error("DBENGINE on '%s': 'dbegnine tier %d update every iterations' cannot be less than 2. Assuming 2.", hostname, tier); + } + + snprintfz(dbengineconfig, 200, "dbengine tier %d backfill", tier); + const char *bf = config_get(CONFIG_SECTION_DB, dbengineconfig, backfill == RRD_BACKFILL_NEW ? "new" : backfill == RRD_BACKFILL_FULL ? "full" : "none"); + if(strcmp(bf, "new") == 0) backfill = RRD_BACKFILL_NEW; + else if(strcmp(bf, "full") == 0) backfill = RRD_BACKFILL_FULL; + else if(strcmp(bf, "none") == 0) backfill = RRD_BACKFILL_NONE; + else { + error("DBENGINE: unknown backfill value '%s', assuming 'new'", bf); + config_set(CONFIG_SECTION_DB, dbengineconfig, "new"); + backfill = RRD_BACKFILL_NEW; + } + } + + storage_tiers_grouping_iterations[tier] = grouping_iterations; + storage_tiers_backfill[tier] = backfill; + + if(tier > 0 && get_tier_grouping(tier) > 65535) { + storage_tiers_grouping_iterations[tier] = 1; + error("DBENGINE on '%s': dbengine tier %d gives aggregation of more than 65535 points of tier 0. Disabling tiers above %d", hostname, tier, tier); + break; + } + + internal_error(true, "DBENGINE tier %d grouping iterations is set to %d", tier, storage_tiers_grouping_iterations[tier]); + ret = rrdeng_init(NULL, NULL, dbenginepath, page_cache_mb, disk_space_mb, tier); + if(ret != 0) { + error("DBENGINE on '%s': Failed to initialize multi-host database tier %d on path '%s'", + hostname, tier, dbenginepath); + break; + } + else + created_tiers++; + } + + if(created_tiers && created_tiers < storage_tiers) { + error("DBENGINE on '%s': Managed to create %d tiers instead of %d. Continuing with %d available.", + hostname, created_tiers, storage_tiers, created_tiers); + storage_tiers = created_tiers; + } + else if(!created_tiers) + fatal("DBENGINE on '%s', failed to initialize databases at '%s'.", hostname, netdata_configured_cache_dir); + +#else + storage_tiers = config_get_number(CONFIG_SECTION_DB, "storage tiers", 1); + if(storage_tiers != 1) { + error("DBENGINE is not available on '%s', so only 1 database tier can be supported.", hostname); + storage_tiers = 1; + config_set_number(CONFIG_SECTION_DB, "storage tiers", storage_tiers); + } +#endif + + health_init(); rrdpush_init(); +unittest: debug(D_RRDHOST, "Initializing localhost with hostname '%s'", hostname); rrd_wrlock(); localhost = rrdhost_create( - hostname - , registry_get_this_machine_hostname() + hostname + , registry_get_this_machine_hostname() , registry_get_this_machine_guid() , os_type - , netdata_configured_timezone - , netdata_configured_abbrev_timezone - , netdata_configured_utc_offset - , "" - , program_name - , program_version - , default_rrd_update_every - , default_rrd_history_entries - , default_rrd_memory_mode - , default_health_enabled - , default_rrdpush_enabled - , default_rrdpush_destination - , default_rrdpush_api_key - , default_rrdpush_send_charts_matching - , system_info - , 1 + , netdata_configured_timezone + , netdata_configured_abbrev_timezone + , netdata_configured_utc_offset + , "" + , program_name + , program_version + , default_rrd_update_every + , default_rrd_history_entries + , default_rrd_memory_mode + , default_health_enabled + , default_rrdpush_enabled + , default_rrdpush_destination + , default_rrdpush_api_key + , default_rrdpush_send_charts_matching + , system_info + , 1 + , 0 ); if (unlikely(!localhost)) { rrd_unlock(); return 1; } -#ifdef ENABLE_DBENGINE - char dbenginepath[FILENAME_MAX + 1]; - int ret; - snprintfz(dbenginepath, FILENAME_MAX, "%s/dbengine", localhost->cache_dir); - ret = mkdir(dbenginepath, 0775); - if (ret != 0 && errno != EEXIST) - error("Host '%s': cannot create directory '%s'", localhost->hostname, dbenginepath); - else // Unconditionally create multihost db to support on demand host creation - ret = rrdeng_init(NULL, NULL, dbenginepath, default_rrdeng_page_cache_mb, default_multidb_disk_quota_mb); - if (ret) { - error( - "Host '%s' with machine guid '%s' failed to initialize multi-host DB engine instance at '%s'.", - localhost->hostname, localhost->machine_guid, localhost->cache_dir); - rrdhost_free(localhost); - localhost = NULL; - rrd_unlock(); - fatal("Failed to initialize dbengine"); - } -#endif - sql_aclk_sync_init(); rrd_unlock(); - web_client_api_v1_management_init(); + if (likely(system_info)) { + migrate_localhost(&localhost->host_uuid); + sql_aclk_sync_init(); + web_client_api_v1_management_init(); + } return localhost==NULL; } @@ -844,19 +1013,12 @@ void rrdhost_system_info_free(struct rrdhost_system_info *system_info) { } void destroy_receiver_state(struct receiver_state *rpt); -void rrdhost_free(RRDHOST *host) { - if(!host) return; - - info("Freeing all memory for host '%s'...", host->hostname); - rrd_check_wrlock(); // make sure the RRDs are write locked - - rrdhost_wrlock(host); - ml_delete_host(host); - rrdhost_unlock(host); +void stop_streaming_sender(RRDHOST *host) +{ + if (unlikely(!host->sender)) + return; - // ------------------------------------------------------------------------ - // clean up streaming rrdpush_sender_thread_stop(host); // stop a possibly running thread cbuffer_free(host->sender->buffer); buffer_free(host->sender->build); @@ -866,49 +1028,57 @@ void rrdhost_free(RRDHOST *host) { #endif freez(host->sender); host->sender = NULL; - if (netdata_exit) { - netdata_mutex_lock(&host->receiver_lock); - if (host->receiver) { - if (!host->receiver->exited) - netdata_thread_cancel(host->receiver->thread); - netdata_mutex_unlock(&host->receiver_lock); - struct receiver_state *rpt = host->receiver; - while (host->receiver && !rpt->exited) - sleep_usec(50 * USEC_PER_MS); - // If the receiver detached from the host then its thread will destroy the state - if (host->receiver == rpt) - destroy_receiver_state(host->receiver); - } - else - netdata_mutex_unlock(&host->receiver_lock); - } +} + +void stop_streaming_receiver(RRDHOST *host) +{ + netdata_mutex_lock(&host->receiver_lock); + if (host->receiver) { + if (!host->receiver->exited) + netdata_thread_cancel(host->receiver->thread); + netdata_mutex_unlock(&host->receiver_lock); + struct receiver_state *rpt = host->receiver; + while (host->receiver && !rpt->exited) + sleep_usec(50 * USEC_PER_MS); + // If the receiver detached from the host then its thread will destroy the state + if (host->receiver == rpt) + destroy_receiver_state(host->receiver); + } else + netdata_mutex_unlock(&host->receiver_lock); +} + +void rrdhost_free(RRDHOST *host, bool force) { + if(!host) return; + + if (netdata_exit || force) + info("Freeing all memory for host '%s'...", host->hostname); + + rrd_check_wrlock(); // make sure the RRDs are write locked + rrdhost_wrlock(host); + ml_delete_host(host); + rrdhost_unlock(host); + + // ------------------------------------------------------------------------ + // clean up streaming + stop_streaming_sender(host); + if (netdata_exit || force) + stop_streaming_receiver(host); rrdhost_wrlock(host); // lock this RRDHOST -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) - struct aclk_database_worker_config *wc = host->dbsync_worker; - if (wc && !netdata_exit) { - struct aclk_database_cmd cmd; - memset(&cmd, 0, sizeof(cmd)); - cmd.opcode = ACLK_DATABASE_ORPHAN_HOST; - struct aclk_completion compl ; - init_aclk_completion(&compl ); - cmd.completion = &compl ; - aclk_database_enq_cmd(wc, &cmd); - wait_for_aclk_completion(&compl ); - destroy_aclk_completion(&compl ); - } -#endif // ------------------------------------------------------------------------ // release its children resources #ifdef ENABLE_DBENGINE - if (host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { - if (host->rrdeng_ctx != &multidb_ctx) - rrdeng_prepare_exit(host->rrdeng_ctx); + for(int tier = 0; tier < storage_tiers ;tier++) { + if(host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && + host->storage_instance[tier] && + !is_storage_engine_shared(host->storage_instance[tier])) + rrdeng_prepare_exit((struct rrdengine_instance *)host->storage_instance[tier]); } #endif + while(host->rrdset_root) rrdset_free(host->rrdset_root); @@ -940,8 +1110,34 @@ void rrdhost_free(RRDHOST *host) { health_alarm_log_free(host); #ifdef ENABLE_DBENGINE - if (host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && host->rrdeng_ctx != &multidb_ctx) - rrdeng_exit(host->rrdeng_ctx); + for(int tier = 0; tier < storage_tiers ;tier++) { + if(host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && + host->storage_instance[tier] && + !is_storage_engine_shared(host->storage_instance[tier])) + rrdeng_exit((struct rrdengine_instance *)host->storage_instance[tier]); + } +#endif + + if (!netdata_exit && !force) { + info("Setting archive mode for host '%s'...", host->hostname); + rrdhost_flag_set(host, RRDHOST_FLAG_ARCHIVED); + rrdhost_unlock(host); + return; + } + +#ifdef ENABLE_ACLK + struct aclk_database_worker_config *wc = host->dbsync_worker; + if (wc && !netdata_exit) { + struct aclk_database_cmd cmd; + memset(&cmd, 0, sizeof(cmd)); + cmd.opcode = ACLK_DATABASE_ORPHAN_HOST; + struct aclk_completion compl ; + init_aclk_completion(&compl ); + cmd.completion = &compl ; + aclk_database_enq_cmd(wc, &cmd); + wait_for_aclk_completion(&compl ); + destroy_aclk_completion(&compl ); + } #endif // ------------------------------------------------------------------------ @@ -950,7 +1146,6 @@ void rrdhost_free(RRDHOST *host) { if(rrdhost_index_del(host) != host) error("RRDHOST '%s' removed from index, deleted the wrong entry.", host->hostname); - // ------------------------------------------------------------------------ // unlink it from the host @@ -967,8 +1162,6 @@ void rrdhost_free(RRDHOST *host) { else error("Request to free RRDHOST '%s': cannot find it", host->hostname); } - - // ------------------------------------------------------------------------ // free it @@ -976,7 +1169,7 @@ void rrdhost_free(RRDHOST *host) { freez(host->aclk_state.claimed_id); freez(host->aclk_state.prev_claimed_id); freez((void *)host->tags); - free_label_list(host->labels.head); + rrdlabels_destroy(host->host_labels); freez((void *)host->os); freez((void *)host->timezone); freez((void *)host->abbrev_timezone); @@ -987,6 +1180,12 @@ void rrdhost_free(RRDHOST *host) { freez(host->varlib_dir); freez(host->rrdpush_send_api_key); freez(host->rrdpush_send_destination); + struct rrdpush_destinations *tmp_destination; + while (host->destinations) { + tmp_destination = host->destinations->next; + freez(host->destinations); + host->destinations = tmp_destination; + } freez(host->health_default_exec); freez(host->health_default_recipient); freez(host->health_log_filename); @@ -994,13 +1193,14 @@ void rrdhost_free(RRDHOST *host) { freez(host->registry_hostname); simple_pattern_free(host->rrdpush_send_charts_matching); rrdhost_unlock(host); - netdata_rwlock_destroy(&host->labels.labels_rwlock); netdata_rwlock_destroy(&host->health_log.alarm_log_rwlock); netdata_rwlock_destroy(&host->rrdhost_rwlock); freez(host->node_id); + rrdhost_destroy_rrdcontexts(host); + freez(host); -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK if (wc) wc->is_orphan = 0; #endif @@ -1010,8 +1210,8 @@ void rrdhost_free(RRDHOST *host) { void rrdhost_free_all(void) { rrd_wrlock(); /* Make sure child-hosts are released before the localhost. */ - while(localhost->next) rrdhost_free(localhost->next); - rrdhost_free(localhost); + while(localhost->next) rrdhost_free(localhost->next, 1); + rrdhost_free(localhost, 1); rrd_unlock(); } @@ -1038,297 +1238,139 @@ void rrdhost_save_charts(RRDHOST *host) { rrdhost_unlock(host); } -static struct label *rrdhost_load_auto_labels(void) -{ - struct label *label_list = NULL; +static void rrdhost_load_auto_labels(void) { + DICTIONARY *labels = localhost->host_labels; if (localhost->system_info->cloud_provider_type) - label_list = - add_label_to_list(label_list, "_cloud_provider_type", localhost->system_info->cloud_provider_type, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_cloud_provider_type", localhost->system_info->cloud_provider_type, RRDLABEL_SRC_AUTO); if (localhost->system_info->cloud_instance_type) - label_list = - add_label_to_list(label_list, "_cloud_instance_type", localhost->system_info->cloud_instance_type, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_cloud_instance_type", localhost->system_info->cloud_instance_type, RRDLABEL_SRC_AUTO); if (localhost->system_info->cloud_instance_region) - label_list = - add_label_to_list(label_list, "_cloud_instance_region", localhost->system_info->cloud_instance_region, LABEL_SOURCE_AUTO); + rrdlabels_add( + labels, "_cloud_instance_region", localhost->system_info->cloud_instance_region, RRDLABEL_SRC_AUTO); if (localhost->system_info->host_os_name) - label_list = - add_label_to_list(label_list, "_os_name", localhost->system_info->host_os_name, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_os_name", localhost->system_info->host_os_name, RRDLABEL_SRC_AUTO); if (localhost->system_info->host_os_version) - label_list = - add_label_to_list(label_list, "_os_version", localhost->system_info->host_os_version, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_os_version", localhost->system_info->host_os_version, RRDLABEL_SRC_AUTO); if (localhost->system_info->kernel_version) - label_list = - add_label_to_list(label_list, "_kernel_version", localhost->system_info->kernel_version, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_kernel_version", localhost->system_info->kernel_version, RRDLABEL_SRC_AUTO); if (localhost->system_info->host_cores) - label_list = - add_label_to_list(label_list, "_system_cores", localhost->system_info->host_cores, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_system_cores", localhost->system_info->host_cores, RRDLABEL_SRC_AUTO); if (localhost->system_info->host_cpu_freq) - label_list = - add_label_to_list(label_list, "_system_cpu_freq", localhost->system_info->host_cpu_freq, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_system_cpu_freq", localhost->system_info->host_cpu_freq, RRDLABEL_SRC_AUTO); if (localhost->system_info->host_ram_total) - label_list = - add_label_to_list(label_list, "_system_ram_total", localhost->system_info->host_ram_total, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_system_ram_total", localhost->system_info->host_ram_total, RRDLABEL_SRC_AUTO); if (localhost->system_info->host_disk_space) - label_list = - add_label_to_list(label_list, "_system_disk_space", localhost->system_info->host_disk_space, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_system_disk_space", localhost->system_info->host_disk_space, RRDLABEL_SRC_AUTO); if (localhost->system_info->architecture) - label_list = - add_label_to_list(label_list, "_architecture", localhost->system_info->architecture, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_architecture", localhost->system_info->architecture, RRDLABEL_SRC_AUTO); if (localhost->system_info->virtualization) - label_list = - add_label_to_list(label_list, "_virtualization", localhost->system_info->virtualization, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_virtualization", localhost->system_info->virtualization, RRDLABEL_SRC_AUTO); if (localhost->system_info->container) - label_list = - add_label_to_list(label_list, "_container", localhost->system_info->container, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_container", localhost->system_info->container, RRDLABEL_SRC_AUTO); if (localhost->system_info->container_detection) - label_list = - add_label_to_list(label_list, "_container_detection", localhost->system_info->container_detection, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_container_detection", localhost->system_info->container_detection, RRDLABEL_SRC_AUTO); if (localhost->system_info->virt_detection) - label_list = - add_label_to_list(label_list, "_virt_detection", localhost->system_info->virt_detection, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_virt_detection", localhost->system_info->virt_detection, RRDLABEL_SRC_AUTO); if (localhost->system_info->is_k8s_node) - label_list = - add_label_to_list(label_list, "_is_k8s_node", localhost->system_info->is_k8s_node, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_is_k8s_node", localhost->system_info->is_k8s_node, RRDLABEL_SRC_AUTO); if (localhost->system_info->install_type) - label_list = - add_label_to_list(label_list, "_install_type", localhost->system_info->install_type, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_install_type", localhost->system_info->install_type, RRDLABEL_SRC_AUTO); if (localhost->system_info->prebuilt_arch) - label_list = - add_label_to_list(label_list, "_prebuilt_arch", localhost->system_info->prebuilt_arch, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_prebuilt_arch", localhost->system_info->prebuilt_arch, RRDLABEL_SRC_AUTO); if (localhost->system_info->prebuilt_dist) - label_list = - add_label_to_list(label_list, "_prebuilt_dist", localhost->system_info->prebuilt_dist, LABEL_SOURCE_AUTO); + rrdlabels_add(labels, "_prebuilt_dist", localhost->system_info->prebuilt_dist, RRDLABEL_SRC_AUTO); - label_list = add_aclk_host_labels(label_list); + add_aclk_host_labels(); - label_list = add_label_to_list( - label_list, "_is_parent", (localhost->next || configured_as_parent()) ? "true" : "false", LABEL_SOURCE_AUTO); + rrdlabels_add( + labels, "_is_parent", (localhost->next || configured_as_parent()) ? "true" : "false", RRDLABEL_SRC_AUTO); if (localhost->rrdpush_send_destination) - label_list = - add_label_to_list(label_list, "_streams_to", localhost->rrdpush_send_destination, LABEL_SOURCE_AUTO); - - return label_list; -} - -static inline int rrdhost_is_valid_label_config_option(char *name, char *value) -{ - return (is_valid_label_key(name) && is_valid_label_value(value) && strcmp(name, "from environment") && - strcmp(name, "from kubernetes pods")); + rrdlabels_add(labels, "_streams_to", localhost->rrdpush_send_destination, RRDLABEL_SRC_AUTO); } -static struct label *rrdhost_load_config_labels() -{ +static void rrdhost_load_config_labels(void) { int status = config_load(NULL, 1, CONFIG_SECTION_HOST_LABEL); if(!status) { char *filename = CONFIG_DIR "/" CONFIG_FILENAME; - error("LABEL: Cannot reload the configuration file '%s', using labels in memory", filename); + error("RRDLABEL: Cannot reload the configuration file '%s', using labels in memory", filename); } - struct label *l = NULL; struct section *co = appconfig_get_section(&netdata_config, CONFIG_SECTION_HOST_LABEL); if(co) { config_section_wrlock(co); struct config_option *cv; for(cv = co->values; cv ; cv = cv->next) { - if(rrdhost_is_valid_label_config_option(cv->name, cv->value)) { - l = add_label_to_list(l, cv->name, cv->value, LABEL_SOURCE_NETDATA_CONF); - cv->flags |= CONFIG_VALUE_USED; - } else { - error("LABELS: It was not possible to create the label '%s' because it contains invalid character(s) or values." - , cv->name); - } + rrdlabels_add(localhost->host_labels, cv->name, cv->value, RRDLABEL_SRC_CONFIG); + cv->flags |= CONFIG_VALUE_USED; } config_section_unlock(co); } - - return l; } -struct label *parse_simple_tags( - struct label *label_list, - const char *tags, - char key_value_separator, - char label_separator, - STRIP_QUOTES_OPTION strip_quotes_from_key, - STRIP_QUOTES_OPTION strip_quotes_from_value, - SKIP_ESCAPED_CHARACTERS_OPTION skip_escaped_characters) -{ - const char *end = tags; - - while (*end) { - const char *start = end; - char key[CONFIG_MAX_VALUE + 1]; - char value[CONFIG_MAX_VALUE + 1]; - - while (*end && *end != key_value_separator) - end++; - strncpyz(key, start, end - start); - - if (*end) - start = ++end; - while (*end && *end != label_separator) - end++; - strncpyz(value, start, end - start); - - label_list = add_label_to_list( - label_list, - strip_quotes_from_key ? strip_double_quotes(trim(key), skip_escaped_characters) : trim(key), - strip_quotes_from_value ? strip_double_quotes(trim(value), skip_escaped_characters) : trim(value), - LABEL_SOURCE_NETDATA_CONF); +static void rrdhost_load_kubernetes_labels(void) { + char label_script[sizeof(char) * (strlen(netdata_configured_primary_plugins_dir) + strlen("get-kubernetes-labels.sh") + 2)]; + sprintf(label_script, "%s/%s", netdata_configured_primary_plugins_dir, "get-kubernetes-labels.sh"); - if (*end) - end++; + if (unlikely(access(label_script, R_OK) != 0)) { + error("Kubernetes pod label fetching script %s not found.",label_script); + return; } - return label_list; -} - -struct label *parse_json_tags(struct label *label_list, const char *tags) -{ - char tags_buf[CONFIG_MAX_VALUE + 1]; - strncpy(tags_buf, tags, CONFIG_MAX_VALUE); - char *str = tags_buf; - - switch (*str) { - case '{': - str++; - strip_last_symbol(str, '}', SKIP_ESCAPED_CHARACTERS); + debug(D_RRDHOST, "Attempting to fetch external labels via %s", label_script); - label_list = parse_simple_tags(label_list, str, ':', ',', STRIP_QUOTES, STRIP_QUOTES, SKIP_ESCAPED_CHARACTERS); + pid_t pid; + FILE *fp = mypopen(label_script, &pid); + if(!fp) return; - break; - case '[': - str++; - strip_last_symbol(str, ']', SKIP_ESCAPED_CHARACTERS); + char buffer[1000 + 1]; + while (fgets(buffer, 1000, fp) != NULL) + rrdlabels_add_pair(localhost->host_labels, buffer, RRDLABEL_SRC_AUTO|RRDLABEL_SRC_K8S); - char *end = str + strlen(str); - size_t i = 0; - - while (str < end) { - char key[CONFIG_MAX_VALUE + 1]; - snprintfz(key, CONFIG_MAX_VALUE, "host_tag%zu", i); - - str = strip_double_quotes(trim(str), SKIP_ESCAPED_CHARACTERS); - - label_list = add_label_to_list(label_list, key, str, LABEL_SOURCE_NETDATA_CONF); - - // skip to the next element in the array - str += strlen(str) + 1; - while (*str && *str != ',') - str++; - str++; - i++; - } - - break; - case '"': - label_list = add_label_to_list( - label_list, "host_tag", strip_double_quotes(str, SKIP_ESCAPED_CHARACTERS), LABEL_SOURCE_NETDATA_CONF); - break; - default: - label_list = add_label_to_list(label_list, "host_tag", str, LABEL_SOURCE_NETDATA_CONF); - break; - } - - return label_list; + // Non-zero exit code means that all the script output is error messages. We've shown already any message that didn't include a ':' + // Here we'll inform with an ERROR that the script failed, show whatever (if anything) was added to the list of labels, free the memory and set the return to null + int rc = mypclose(fp, pid); + if(rc) error("%s exited abnormally. Failed to get kubernetes labels.", label_script); } -static struct label *rrdhost_load_kubernetes_labels(void) -{ - struct label *l=NULL; - char *label_script = mallocz(sizeof(char) * (strlen(netdata_configured_primary_plugins_dir) + strlen("get-kubernetes-labels.sh") + 2)); - sprintf(label_script, "%s/%s", netdata_configured_primary_plugins_dir, "get-kubernetes-labels.sh"); - if (unlikely(access(label_script, R_OK) != 0)) { - error("Kubernetes pod label fetching script %s not found.",label_script); - freez(label_script); - } else { - pid_t command_pid; - - debug(D_RRDHOST, "Attempting to fetch external labels via %s", label_script); - - FILE *fp = mypopen(label_script, &command_pid); - if(fp) { - int MAX_LINE_SIZE=300; - char buffer[MAX_LINE_SIZE + 1]; - while (fgets(buffer, MAX_LINE_SIZE, fp) != NULL) { - char *name=buffer; - char *value=buffer; - while (*value && *value != ':') value++; - if (*value == ':') { - *value = '\0'; - value++; - } - char *eos=value; - while (*eos && *eos != '\n') eos++; - if (*eos == '\n') *eos = '\0'; - if (strlen(value)>0) { - if (is_valid_label_key(name)){ - l = add_label_to_list(l, name, value, LABEL_SOURCE_KUBERNETES); - } else { - info("Ignoring invalid label name '%s'", name); - } - } else { - error("%s outputted unexpected result: '%s'", label_script, name); - } - }; - // Non-zero exit code means that all the script output is error messages. We've shown already any message that didn't include a ':' - // Here we'll inform with an ERROR that the script failed, show whatever (if anything) was added to the list of labels, free the memory and set the return to null - int retcode=mypclose(fp, command_pid); - if (retcode) { - error("%s exited abnormally. No kubernetes labels will be added to the host.", label_script); - struct label *ll=l; - while (ll != NULL) { - info("Ignoring Label [source id=%s]: \"%s\" -> \"%s\"\n", translate_label_source(ll->label_source), ll->key, ll->value); - ll = ll->next; - freez(l); - l=ll; - } - } - } - freez(label_script); - } - - return l; -} +void reload_host_labels(void) { + if(!localhost->host_labels) + localhost->host_labels = rrdlabels_create(); -void reload_host_labels(void) -{ - struct label *from_auto = rrdhost_load_auto_labels(); - struct label *from_k8s = rrdhost_load_kubernetes_labels(); - struct label *from_config = rrdhost_load_config_labels(); + rrdlabels_unmark_all(localhost->host_labels); - struct label *new_labels = merge_label_lists(from_auto, from_k8s); - new_labels = merge_label_lists(new_labels, from_config); + // priority is important here + rrdhost_load_config_labels(); + rrdhost_load_kubernetes_labels(); + rrdhost_load_auto_labels(); - rrdhost_rdlock(localhost); - replace_label_list(&localhost->labels, new_labels); + rrdlabels_remove_all_unmarked(localhost->host_labels); + sql_store_host_labels(localhost); health_label_log_save(localhost); - rrdhost_unlock(localhost); /* TODO-GAPS - fix this so that it looks properly at the state and version of the sender if(localhost->rrdpush_send_enabled && localhost->rrdpush_sender_buffer){ - localhost->labels.labels_flag |= LABEL_FLAG_UPDATE_STREAM; + localhost->labels.labels_flag |= RRDHOST_FLAG_STREAM_LABELS_UPDATE; rrdpush_send_labels(localhost); } */ @@ -1351,7 +1393,7 @@ void rrdhost_delete_charts(RRDHOST *host) { rrdset_foreach_write(st, host) { rrdset_rdlock(st); - rrdset_delete(st); + rrdset_delete_files(st); rrdset_unlock(st); } @@ -1379,7 +1421,7 @@ void rrdhost_cleanup_charts(RRDHOST *host) { rrdset_rdlock(st); if(rrdhost_delete_obsolete_charts && rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE)) - rrdset_delete(st); + rrdset_delete_files(st); else if(rrdhost_delete_obsolete_charts && rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE_DIMENSIONS)) rrdset_delete_obsolete_dimensions(st); else @@ -1420,7 +1462,7 @@ void rrdhost_cleanup_all(void) { if (host != localhost && rrdhost_flag_check(host, RRDHOST_FLAG_DELETE_ORPHAN_HOST) && !host->receiver #ifdef ENABLE_DBENGINE /* don't delete multi-host DB host files */ - && !(host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && host->rrdeng_ctx == &multidb_ctx) + && !(host->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE && is_storage_engine_shared(host->storage_instance[0])) #endif ) rrdhost_delete_charts(host); @@ -1476,11 +1518,24 @@ restart_after_removal: if (rrddim_flag_check(rd, RRDDIM_FLAG_OBSOLETE)) { rrddim_flag_clear(rd, RRDDIM_FLAG_OBSOLETE); + /* only a collector can mark a chart as obsolete, so we must remove the reference */ - uint8_t can_delete_metric = rd->state->collect_ops.finalize(rd); - if (can_delete_metric) { + + size_t tiers_available = 0, tiers_said_yes = 0; + for(int tier = 0; tier < storage_tiers ;tier++) { + if(rd->tiers[tier]) { + tiers_available++; + + if(rd->tiers[tier]->collect_ops.finalize(rd->tiers[tier]->db_collection_handle)) + tiers_said_yes++; + + rd->tiers[tier]->db_collection_handle = NULL; + } + } + + if (tiers_available == tiers_said_yes && tiers_said_yes) { /* This metric has no data and no references */ - delete_dimension_uuid(&rd->state->metric_uuid); + delete_dimension_uuid(&rd->metric_uuid); rrddim_free(st, rd); if (unlikely(!last)) { rd = st->dimensions; @@ -1490,7 +1545,7 @@ restart_after_removal: } continue; } -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK else queue_dimension_to_aclk(rd, rd->last_collected_time.tv_sec); #endif @@ -1514,7 +1569,7 @@ restart_after_removal: rrdset_rdlock(st); if(rrdhost_delete_obsolete_charts) - rrdset_delete(st); + rrdset_delete_files(st); else rrdset_save(st); @@ -1523,7 +1578,7 @@ restart_after_removal: rrdset_free(st); goto restart_after_removal; } -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK else sql_check_chart_liveness(st); #endif @@ -1551,21 +1606,15 @@ void rrd_cleanup_obsolete_charts() { if (host->obsolete_charts_count) { rrdhost_wrlock(host); -#ifdef ENABLE_ACLK - host->deleted_charts_count = 0; -#endif rrdhost_cleanup_obsolete_charts(host); -#ifdef ENABLE_ACLK - if (host->deleted_charts_count) - aclk_update_chart(host, "dummy-chart", 0); -#endif rrdhost_unlock(host); } - if (host != localhost && - host->trigger_chart_obsoletion_check && - host->senders_last_chart_command && - host->senders_last_chart_command + 120 < now_realtime_sec()) { + if ( host != localhost && + host->trigger_chart_obsoletion_check && + ((host->senders_last_chart_command && + host->senders_last_chart_command + host->health_delay_up_to < now_realtime_sec()) + || (host->senders_connect_time + 300 < now_realtime_sec())) ) { rrdhost_rdlock(host); rrdset_check_obsoletion(host); rrdhost_unlock(host); diff --git a/database/rrdlabels.c b/database/rrdlabels.c index f9583769d..5198cb4aa 100644 --- a/database/rrdlabels.c +++ b/database/rrdlabels.c @@ -3,201 +3,1154 @@ #define NETDATA_RRD_INTERNALS #include "rrd.h" -char *translate_label_source(LABEL_SOURCE l) { - switch (l) { - case LABEL_SOURCE_AUTO: - return "AUTO"; - case LABEL_SOURCE_NETDATA_CONF: - return "NETDATA.CONF"; - case LABEL_SOURCE_DOCKER : - return "DOCKER"; - case LABEL_SOURCE_ENVIRONMENT : - return "ENVIRONMENT"; - case LABEL_SOURCE_KUBERNETES : - return "KUBERNETES"; - default: - return "Invalid label source"; - } -} - -int is_valid_label_value(char *value) { - while(*value) { - if(*value == '"' || *value == '\'' || *value == '*' || *value == '!') { - return 0; +// ---------------------------------------------------------------------------- +// labels sanitization + +/* + * All labels follow these rules: + * + * Character Symbol Values Names + * UTF-8 characters UTF-8 yes -> _ + * Lower case letter [a-z] yes yes + * Upper case letter [A-Z] yes -> [a-z] + * Digit [0-9] yes yes + * Underscore _ yes yes + * Minus - yes yes + * Plus + yes -> _ + * Colon : yes -> _ + * Semicolon ; -> : -> _ + * Equal = -> : -> _ + * Period . yes yes + * Comma , -> . -> . + * Slash / yes yes + * Backslash \ -> / -> / + * At @ yes -> _ + * Space yes -> _ + * Opening parenthesis ( yes -> _ + * Closing parenthesis ) yes -> _ + * anything else -> _ -> _ +* + * The above rules should allow users to set in tags (indicative): + * + * 1. hostnames and domain names as-is + * 2. email addresses as-is + * 3. floating point numbers, converted to always use a dot as the decimal point + * + * Leading and trailing spaces and control characters are removed from both label + * names and values. + * + * Multiple spaces inside the label name or the value are removed (only 1 is retained). + * In names spaces are also converted to underscores. + * + * Names that are only underscores are rejected (they do not enter the dictionary). + * + * The above rules do not require any conversion to be included in JSON strings. + * + * Label names and values are truncated to LABELS_MAX_LENGTH (200) characters. + * + * When parsing, label key and value are separated by the first colon (:) found. + * So label:value1:value2 is parsed as key = "label", value = "value1:value2" + * + * This means a label key cannot contain a colon (:) - it is converted to + * underscore if it does. + * + */ + +#define RRDLABELS_MAX_NAME_LENGTH 200 +#define RRDLABELS_MAX_VALUE_LENGTH 800 // 800 in bytes, up to 200 UTF-8 characters + +static unsigned char label_spaces_char_map[256]; +static unsigned char label_names_char_map[256]; +static unsigned char label_values_char_map[256] = { + [0] = '\0', // + [1] = '_', // + [2] = '_', // + [3] = '_', // + [4] = '_', // + [5] = '_', // + [6] = '_', // + [7] = '_', // + [8] = '_', // + [9] = '_', // + [10] = '_', // + [11] = '_', // + [12] = '_', // + [13] = '_', // + [14] = '_', // + [15] = '_', // + [16] = '_', // + [17] = '_', // + [18] = '_', // + [19] = '_', // + [20] = '_', // + [21] = '_', // + [22] = '_', // + [23] = '_', // + [24] = '_', // + [25] = '_', // + [26] = '_', // + [27] = '_', // + [28] = '_', // + [29] = '_', // + [30] = '_', // + [31] = '_', // + [32] = ' ', // SPACE keep + [33] = '_', // ! + [34] = '_', // " + [35] = '_', // # + [36] = '_', // $ + [37] = '_', // % + [38] = '_', // & + [39] = '_', // ' + [40] = '(', // ( keep + [41] = ')', // ) keep + [42] = '_', // * + [43] = '+', // + keep + [44] = '.', // , convert , to . + [45] = '-', // - keep + [46] = '.', // . keep + [47] = '/', // / keep + [48] = '0', // 0 keep + [49] = '1', // 1 keep + [50] = '2', // 2 keep + [51] = '3', // 3 keep + [52] = '4', // 4 keep + [53] = '5', // 5 keep + [54] = '6', // 6 keep + [55] = '7', // 7 keep + [56] = '8', // 8 keep + [57] = '9', // 9 keep + [58] = ':', // : keep + [59] = ':', // ; convert ; to : + [60] = '_', // < + [61] = ':', // = convert = to : + [62] = '_', // > + [63] = '_', // ? + [64] = '@', // @ + [65] = 'A', // A keep + [66] = 'B', // B keep + [67] = 'C', // C keep + [68] = 'D', // D keep + [69] = 'E', // E keep + [70] = 'F', // F keep + [71] = 'G', // G keep + [72] = 'H', // H keep + [73] = 'I', // I keep + [74] = 'J', // J keep + [75] = 'K', // K keep + [76] = 'L', // L keep + [77] = 'M', // M keep + [78] = 'N', // N keep + [79] = 'O', // O keep + [80] = 'P', // P keep + [81] = 'Q', // Q keep + [82] = 'R', // R keep + [83] = 'S', // S keep + [84] = 'T', // T keep + [85] = 'U', // U keep + [86] = 'V', // V keep + [87] = 'W', // W keep + [88] = 'X', // X keep + [89] = 'Y', // Y keep + [90] = 'Z', // Z keep + [91] = '_', // [ + [92] = '/', // backslash convert \ to / + [93] = '_', // ] + [94] = '_', // ^ + [95] = '_', // _ keep + [96] = '_', // ` + [97] = 'a', // a keep + [98] = 'b', // b keep + [99] = 'c', // c keep + [100] = 'd', // d keep + [101] = 'e', // e keep + [102] = 'f', // f keep + [103] = 'g', // g keep + [104] = 'h', // h keep + [105] = 'i', // i keep + [106] = 'j', // j keep + [107] = 'k', // k keep + [108] = 'l', // l keep + [109] = 'm', // m keep + [110] = 'n', // n keep + [111] = 'o', // o keep + [112] = 'p', // p keep + [113] = 'q', // q keep + [114] = 'r', // r keep + [115] = 's', // s keep + [116] = 't', // t keep + [117] = 'u', // u keep + [118] = 'v', // v keep + [119] = 'w', // w keep + [120] = 'x', // x keep + [121] = 'y', // y keep + [122] = 'z', // z keep + [123] = '_', // { + [124] = '_', // | + [125] = '_', // } + [126] = '_', // ~ + [127] = '_', // + [128] = '_', // + [129] = '_', // + [130] = '_', // + [131] = '_', // + [132] = '_', // + [133] = '_', // + [134] = '_', // + [135] = '_', // + [136] = '_', // + [137] = '_', // + [138] = '_', // + [139] = '_', // + [140] = '_', // + [141] = '_', // + [142] = '_', // + [143] = '_', // + [144] = '_', // + [145] = '_', // + [146] = '_', // + [147] = '_', // + [148] = '_', // + [149] = '_', // + [150] = '_', // + [151] = '_', // + [152] = '_', // + [153] = '_', // + [154] = '_', // + [155] = '_', // + [156] = '_', // + [157] = '_', // + [158] = '_', // + [159] = '_', // + [160] = '_', // + [161] = '_', // + [162] = '_', // + [163] = '_', // + [164] = '_', // + [165] = '_', // + [166] = '_', // + [167] = '_', // + [168] = '_', // + [169] = '_', // + [170] = '_', // + [171] = '_', // + [172] = '_', // + [173] = '_', // + [174] = '_', // + [175] = '_', // + [176] = '_', // + [177] = '_', // + [178] = '_', // + [179] = '_', // + [180] = '_', // + [181] = '_', // + [182] = '_', // + [183] = '_', // + [184] = '_', // + [185] = '_', // + [186] = '_', // + [187] = '_', // + [188] = '_', // + [189] = '_', // + [190] = '_', // + [191] = '_', // + [192] = '_', // + [193] = '_', // + [194] = '_', // + [195] = '_', // + [196] = '_', // + [197] = '_', // + [198] = '_', // + [199] = '_', // + [200] = '_', // + [201] = '_', // + [202] = '_', // + [203] = '_', // + [204] = '_', // + [205] = '_', // + [206] = '_', // + [207] = '_', // + [208] = '_', // + [209] = '_', // + [210] = '_', // + [211] = '_', // + [212] = '_', // + [213] = '_', // + [214] = '_', // + [215] = '_', // + [216] = '_', // + [217] = '_', // + [218] = '_', // + [219] = '_', // + [220] = '_', // + [221] = '_', // + [222] = '_', // + [223] = '_', // + [224] = '_', // + [225] = '_', // + [226] = '_', // + [227] = '_', // + [228] = '_', // + [229] = '_', // + [230] = '_', // + [231] = '_', // + [232] = '_', // + [233] = '_', // + [234] = '_', // + [235] = '_', // + [236] = '_', // + [237] = '_', // + [238] = '_', // + [239] = '_', // + [240] = '_', // + [241] = '_', // + [242] = '_', // + [243] = '_', // + [244] = '_', // + [245] = '_', // + [246] = '_', // + [247] = '_', // + [248] = '_', // + [249] = '_', // + [250] = '_', // + [251] = '_', // + [252] = '_', // + [253] = '_', // + [254] = '_', // + [255] = '_' // +}; + +__attribute__((constructor)) void initialize_labels_keys_char_map(void) { + // copy the values char map to the names char map + size_t i; + for(i = 0; i < 256 ;i++) + label_names_char_map[i] = label_values_char_map[i]; + + // apply overrides to the label names map + label_names_char_map['A'] = 'a'; + label_names_char_map['B'] = 'b'; + label_names_char_map['C'] = 'c'; + label_names_char_map['D'] = 'd'; + label_names_char_map['E'] = 'e'; + label_names_char_map['F'] = 'f'; + label_names_char_map['G'] = 'g'; + label_names_char_map['H'] = 'h'; + label_names_char_map['I'] = 'i'; + label_names_char_map['J'] = 'j'; + label_names_char_map['K'] = 'k'; + label_names_char_map['L'] = 'l'; + label_names_char_map['M'] = 'm'; + label_names_char_map['N'] = 'n'; + label_names_char_map['O'] = 'o'; + label_names_char_map['P'] = 'p'; + label_names_char_map['Q'] = 'q'; + label_names_char_map['R'] = 'r'; + label_names_char_map['S'] = 's'; + label_names_char_map['T'] = 't'; + label_names_char_map['U'] = 'u'; + label_names_char_map['V'] = 'v'; + label_names_char_map['W'] = 'w'; + label_names_char_map['X'] = 'x'; + label_names_char_map['Y'] = 'y'; + label_names_char_map['Z'] = 'z'; + label_names_char_map['='] = '_'; + label_names_char_map[':'] = '_'; + label_names_char_map['+'] = '_'; + label_names_char_map[';'] = '_'; + label_names_char_map['@'] = '_'; + label_names_char_map['('] = '_'; + label_names_char_map[')'] = '_'; + label_names_char_map[' '] = '_'; + label_names_char_map['\\'] = '/'; + + // create the spaces map + for(i = 0; i < 256 ;i++) + label_spaces_char_map[i] = (isspace(i) || iscntrl(i) || !isprint(i))?1:0; + +} + +static size_t rrdlabels_sanitize(unsigned char *dst, const unsigned char *src, size_t dst_size, unsigned char *char_map, bool utf, const char *empty) { + if(unlikely(!dst_size)) return 0; + if(unlikely(!src || !*src)) { + strncpyz((char *)dst, empty, dst_size); + dst[dst_size - 1] = '\0'; + return strlen((char *)dst); + } + + unsigned char *d = dst; + + // make room for the final string termination + unsigned char *end = &d[dst_size - 1]; + + // copy while converting, but keep only one white space + // we start wil last_is_space = 1 to skip leading spaces + int last_is_space = 1; + size_t mblen = 0; + while(*src && d < end) { + unsigned char c = *src; + + if(IS_UTF8_STARTBYTE(c) && IS_UTF8_BYTE(src[1]) && d + 2 < end) { + // UTF-8 multi-byte encoded character + + // find how big this character is (2-4 bytes) + size_t utf_character_size = 2; + while(utf_character_size <= 4 && src[utf_character_size] && IS_UTF8_BYTE(src[utf_character_size]) && !IS_UTF8_STARTBYTE(src[utf_character_size])) + utf_character_size++; + + if(utf) { + while(utf_character_size) { + utf_character_size--; + *d++ = *src++; + } + } + else { + // UTF-8 characters are not allowed. + // Assume it is an underscore + // and skip all except the first byte + *d++ = '_'; + src += (utf_character_size - 1); + } + + last_is_space = 0; + mblen++; + continue; + } + + if(label_spaces_char_map[c]) { + // a space character + + if(!last_is_space) { + // add one space + *d++ = char_map[c]; + mblen++; + } + + last_is_space++; + } + else { + *d++ = char_map[c]; + last_is_space = 0; + mblen++; } - value++; + src++; } - return 1; + // remove the last trailing space + if(last_is_space && d > dst) { + d--; + mblen--; + } + + // put a termination at the end of what we copied + *d = '\0'; + + // check if dst is all underscores and empty it if it is + d = dst; + while(*d == '_') d++; + if(unlikely(*d == '\0')) { + *dst = '\0'; + mblen = 0; + } + + if(unlikely(*dst == '\0')) { + strncpyz((char *)dst, empty, dst_size); + dst[dst_size - 1] = '\0'; + return strlen((char *)dst); + } + + return mblen; } -int is_valid_label_key(char *key) { - //Prometheus exporter - if(!strcmp(key, "chart") || !strcmp(key, "family") || !strcmp(key, "dimension")) - return 0; +static inline size_t rrdlabels_sanitize_name(char *dst, const char *src, size_t dst_size) { + return rrdlabels_sanitize((unsigned char *)dst, (const unsigned char *)src, dst_size, label_names_char_map, 0, ""); +} - //Netdata and Prometheus internal - if (*key == '_') - return 0; +static inline size_t rrdlabels_sanitize_value(char *dst, const char *src, size_t dst_size) { + return rrdlabels_sanitize((unsigned char *)dst, (const unsigned char *)src, dst_size, label_values_char_map, 1, "[none]"); +} - while(*key) { - if(!(isdigit(*key) || isalpha(*key) || *key == '.' || *key == '_' || *key == '-')) - return 0; +// ---------------------------------------------------------------------------- +// rrdlabels_create() - key++; - } +typedef struct rrdlabel { + STRING *label_value; + RRDLABEL_SRC label_source; +} RRDLABEL; - return 1; +static void rrdlabel_insert_callback(const char *name, void *value, void *data) { + (void)name; + DICTIONARY *dict = (DICTIONARY *)data; (void)dict; + RRDLABEL *lb = (RRDLABEL *)value; + + // label_value is already allocated by the STRING + lb->label_source |= RRDLABEL_FLAG_NEW; + lb->label_source &= ~RRDLABEL_FLAG_OLD; } -void strip_last_symbol( - char *str, - char symbol, - SKIP_ESCAPED_CHARACTERS_OPTION skip_escaped_characters) -{ - char *end = str; +static void rrdlabel_delete_callback(const char *name, void *value, void *data) { + (void)name; + DICTIONARY *dict = (DICTIONARY *)data; (void)dict; + RRDLABEL *lb = (RRDLABEL *)value; - while (*end && *end != symbol) { - if (unlikely(skip_escaped_characters && *end == '\\')) { - end++; - if (unlikely(!*end)) - break; - } - end++; + string_freez(lb->label_value); + lb->label_value = NULL; +} + +static void rrdlabel_conflict_callback(const char *name, void *oldvalue, void *newvalue, void *data) { + (void)name; + DICTIONARY *dict = (DICTIONARY *)data; (void)dict; + RRDLABEL *lbold = (RRDLABEL *)oldvalue; + RRDLABEL *lbnew = (RRDLABEL *)newvalue; + + if(lbold->label_value == lbnew->label_value || strcmp(string2str(lbold->label_value), string2str(lbnew->label_value)) == 0) { + // they are the same + lbold->label_source |= lbnew->label_source; + lbold->label_source |= RRDLABEL_FLAG_OLD; + lbold->label_source &= ~RRDLABEL_FLAG_NEW; + + // free the new one + string_freez(lbnew->label_value); + } + else { + // they are different + string_freez(lbold->label_value); + lbold->label_value = lbnew->label_value; + lbold->label_source = lbnew->label_source; + lbold->label_source |= RRDLABEL_FLAG_NEW; + lbold->label_source &= ~RRDLABEL_FLAG_OLD; } - if (likely(*end == symbol)) - *end = '\0'; } -char *strip_double_quotes(char *str, SKIP_ESCAPED_CHARACTERS_OPTION skip_escaped_characters) -{ - if (*str == '"') { - str++; - strip_last_symbol(str, '"', skip_escaped_characters); +DICTIONARY *rrdlabels_create(void) { + DICTIONARY *dict = dictionary_create(DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + dictionary_register_insert_callback(dict, rrdlabel_insert_callback, dict); + dictionary_register_delete_callback(dict, rrdlabel_delete_callback, dict); + dictionary_register_conflict_callback(dict, rrdlabel_conflict_callback, dict); + return dict; +} + + +// ---------------------------------------------------------------------------- +// rrdlabels_destroy() + +void rrdlabels_destroy(DICTIONARY *labels_dict) { + dictionary_destroy(labels_dict); +} + + +// ---------------------------------------------------------------------------- +// rrdlabels_add() + +static void labels_add_already_sanitized(DICTIONARY *dict, const char *key, const char *value, RRDLABEL_SRC ls) { + if(ls & RRDLABEL_FLAG_NEW) ls &= ~RRDLABEL_FLAG_NEW; + if(ls & RRDLABEL_FLAG_OLD) ls &= ~RRDLABEL_FLAG_OLD; + + RRDLABEL tmp = { + .label_source = ls, + .label_value = string_strdupz(value) + }; + dictionary_set(dict, key, &tmp, sizeof(RRDLABEL)); +} + + +void rrdlabels_add(DICTIONARY *dict, const char *name, const char *value, RRDLABEL_SRC ls) { + if(!dict) { + error("%s(): called with NULL dictionary.", __FUNCTION__ ); + return; + } + + char n[RRDLABELS_MAX_NAME_LENGTH + 1], v[RRDLABELS_MAX_VALUE_LENGTH + 1]; + rrdlabels_sanitize_name(n, name, RRDLABELS_MAX_NAME_LENGTH); + rrdlabels_sanitize_value(v, value, RRDLABELS_MAX_VALUE_LENGTH); + + if(!*n) { + error("%s: cannot add name '%s' (value '%s') which is sanitized as empty string", __FUNCTION__, name, value); + return; } - return str; + labels_add_already_sanitized(dict, n, v, ls); } -struct label *create_label(char *key, char *value, LABEL_SOURCE label_source) -{ - size_t key_len = strlen(key), value_len = strlen(value); - size_t n = sizeof(struct label) + key_len + 1 + value_len + 1; - struct label *result = callocz(1,n); - if (result != NULL) { - char *c = (char *)result; - c += sizeof(struct label); - strcpy(c, key); - result->key = c; - c += key_len + 1; - strcpy(c, value); - result->value = c; - result->label_source = label_source; - result->key_hash = simple_hash(result->key); +static const char *get_quoted_string_up_to(char *dst, size_t dst_size, const char *string, char upto1, char upto2) { + size_t len = 0; + char *d = dst, quote = 0; + while(*string && len++ < dst_size) { + if(unlikely(!quote && (*string == '\'' || *string == '"'))) { + quote = *string++; + continue; + } + + if(unlikely(quote && *string == quote)) { + quote = 0; + string++; + continue; + } + + if(unlikely(quote && *string == '\\' && string[1])) { + string++; + *d++ = *string++; + continue; + } + + if(unlikely(!quote && (*string == upto1 || *string == upto2))) break; + + *d++ = *string++; } - return result; + *d = '\0'; + + if(*string) string++; + + return string; } -void free_label_list(struct label *labels) -{ - while (labels != NULL) - { - struct label *current = labels; - labels = labels->next; - freez(current); +void rrdlabels_add_pair(DICTIONARY *dict, const char *string, RRDLABEL_SRC ls) { + if(!dict) { + error("%s(): called with NULL dictionary.", __FUNCTION__ ); + return; } + + char name[RRDLABELS_MAX_NAME_LENGTH + 1]; + string = get_quoted_string_up_to(name, RRDLABELS_MAX_NAME_LENGTH, string, '=', ':'); + + char value[RRDLABELS_MAX_VALUE_LENGTH + 1]; + get_quoted_string_up_to(value, RRDLABELS_MAX_VALUE_LENGTH, string, '\0', '\0'); + + rrdlabels_add(dict, name, value, ls); +} + +// ---------------------------------------------------------------------------- +// rrdlabels_get_to_buffer_or_null() + +void rrdlabels_get_value_to_buffer_or_null(DICTIONARY *labels, BUFFER *wb, const char *key, const char *quote, const char *null) { + DICTIONARY_ITEM *acquired_item = dictionary_get_and_acquire_item(labels, key); + RRDLABEL *lb = dictionary_acquired_item_value(acquired_item); + + if(lb && lb->label_value) + buffer_sprintf(wb, "%s%s%s", quote, string2str(lb->label_value), quote); + else + buffer_strcat(wb, null); + + dictionary_acquired_item_release(labels, acquired_item); } -void replace_label_list(struct label_index *labels, struct label *new_labels) -{ - netdata_rwlock_wrlock(&labels->labels_rwlock); - struct label *old_labels = labels->head; - labels->head = new_labels; - netdata_rwlock_unlock(&labels->labels_rwlock); - free_label_list(old_labels); +// ---------------------------------------------------------------------------- +// rrdlabels_unmark_all() +// remove labels RRDLABEL_FLAG_OLD and RRDLABEL_FLAG_NEW from all dictionary items + +static int remove_flags_old_new(const char *name, void *value, void *data) { + (void)name; + (void)data; + + RRDLABEL *lb = (RRDLABEL *)value; + + if(lb->label_source & RRDLABEL_FLAG_OLD) lb->label_source &= ~RRDLABEL_FLAG_OLD; + if(lb->label_source & RRDLABEL_FLAG_NEW) lb->label_source &= ~RRDLABEL_FLAG_NEW; + + return 1; } -struct label *add_label_to_list(struct label *l, char *key, char *value, LABEL_SOURCE label_source) -{ - struct label *lab = create_label(key, value, label_source); - lab->next = l; - return lab; +void rrdlabels_unmark_all(DICTIONARY *labels) { + dictionary_walkthrough_read(labels, remove_flags_old_new, NULL); } -void update_label_list(struct label **labels, struct label *new_labels) -{ - free_label_list(*labels); - *labels = NULL; - while (new_labels != NULL) - { - *labels = add_label_to_list(*labels, new_labels->key, new_labels->value, new_labels->label_source); - new_labels = new_labels->next; +// ---------------------------------------------------------------------------- +// rrdlabels_remove_all_unmarked() +// remove dictionary items that are neither old, nor new + +static int remove_not_old_not_new_callback(const char *name, void *value, void *data) { + DICTIONARY *dict = (DICTIONARY *)data; + RRDLABEL *lb = (RRDLABEL *)value; + + if(!(lb->label_source & (RRDLABEL_FLAG_OLD | RRDLABEL_FLAG_NEW | RRDLABEL_FLAG_PERMANENT))) { + dictionary_del_having_write_lock(dict, name); + return 1; } + + return 0; } -struct label *label_list_lookup_key(struct label *head, char *key, uint32_t key_hash) -{ - while (head != NULL) - { - if (head->key_hash == key_hash && !strcmp(head->key, key)) - return head; - head = head->next; - } - return NULL; +void rrdlabels_remove_all_unmarked(DICTIONARY *labels) { + dictionary_walkthrough_write(labels, remove_not_old_not_new_callback, labels); } -int label_list_contains_key(struct label *head, char *key, uint32_t key_hash) -{ - return (label_list_lookup_key(head, key, key_hash) != NULL); + +// ---------------------------------------------------------------------------- +// rrdlabels_walkthrough_read() + +struct labels_walkthrough { + int (*callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data); + void *data; +}; + +static int labels_walkthrough_callback(const char *name, void *value, void *data) { + struct labels_walkthrough *d = (struct labels_walkthrough *)data; + RRDLABEL *lb = (RRDLABEL *)value; + + RRDLABEL_SRC ls = lb->label_source; + if(ls & RRDLABEL_FLAG_NEW) ls &= ~RRDLABEL_FLAG_NEW; + if(ls & RRDLABEL_FLAG_OLD) ls &= ~RRDLABEL_FLAG_OLD; + + return d->callback(name, string2str(lb->label_value), ls, d->data); +} + +int rrdlabels_walkthrough_read(DICTIONARY *labels, int (*callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data), void *data) { + struct labels_walkthrough d = { + .callback = callback, + .data = data + }; + return dictionary_walkthrough_read(labels, labels_walkthrough_callback, &d); +} + +int rrdlabels_sorted_walkthrough_read(DICTIONARY *labels, int (*callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data), void *data) { + struct labels_walkthrough d = { + .callback = callback, + .data = data + }; + return dictionary_sorted_walkthrough_read(labels, labels_walkthrough_callback, &d); } -int label_list_contains(struct label *head, struct label *check) -{ - return label_list_contains_key(head, check->key, check->key_hash); + +// ---------------------------------------------------------------------------- +// rrdlabels_migrate_to_these() +// migrate an existing label list to a new list, INPLACE + +static int copy_label_to_dictionary_callback(const char *name, void *value, void *data) { + DICTIONARY *dst = (DICTIONARY *)data; + RRDLABEL *lb = (RRDLABEL *)value; + labels_add_already_sanitized(dst, name, string2str(lb->label_value), lb->label_source); + return 1; } -struct label *label_list_lookup_keylist(struct label *head, char *key) -{ - SIMPLE_PATTERN *pattern = NULL; +void rrdlabels_migrate_to_these(DICTIONARY *dst, DICTIONARY *src) { + if(!dst || !src) return; + + // remove the RRDLABEL_FLAG_OLD and RRDLABEL_FLAG_NEW from all items + rrdlabels_unmark_all(dst); + + // Mark the existing ones as RRDLABEL_FLAG_OLD, + // or the newly added ones as RRDLABEL_FLAG_NEW + dictionary_walkthrough_read(src, copy_label_to_dictionary_callback, dst); + + // remove the unmarked dst + rrdlabels_remove_all_unmarked(dst); +} + +void rrdlabels_copy(DICTIONARY *dst, DICTIONARY *src) { + if(!dst || !src) return; + + dictionary_walkthrough_read(src, copy_label_to_dictionary_callback, dst); +} + + +// ---------------------------------------------------------------------------- +// rrdlabels_match_simple_pattern() +// returns true when there are keys in the dictionary matching a simple pattern + +struct simple_pattern_match_name_value { + SIMPLE_PATTERN *pattern; + char equal; +}; + +static int simple_pattern_match_name_only_callback(const char *name, void *value, void *data) { + struct simple_pattern_match_name_value *t = (struct simple_pattern_match_name_value *)data; + (void)value; + + // we return -1 to stop the walkthrough on first match + if(simple_pattern_matches(t->pattern, name)) return -1; + + return 0; +} + +static int simple_pattern_match_name_and_value_callback(const char *name, void *value, void *data) { + struct simple_pattern_match_name_value *t = (struct simple_pattern_match_name_value *)data; + RRDLABEL *lb = (RRDLABEL *)value; + + // we return -1 to stop the walkthrough on first match + if(simple_pattern_matches(t->pattern, name)) return -1; + + size_t len = RRDLABELS_MAX_NAME_LENGTH + RRDLABELS_MAX_VALUE_LENGTH + 2; // +1 for =, +1 for \0 + char tmp[len], *dst = &tmp[0]; + const char *v = string2str(lb->label_value); - pattern = simple_pattern_create(key, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + // copy the name + while(*name) *dst++ = *name++; - while (head != NULL) - { - if (simple_pattern_matches(pattern, head->key)) + // add the equal + *dst++ = t->equal; + + // add the value + while(*v) *dst++ = *v++; + + // terminate it + *dst = '\0'; + + if(simple_pattern_matches(t->pattern, tmp)) return -1; + + return 0; +} + +bool rrdlabels_match_simple_pattern_parsed(DICTIONARY *labels, SIMPLE_PATTERN *pattern, char equal) { + if (!labels) return false; + + struct simple_pattern_match_name_value t = { + .pattern = pattern, + .equal = equal + }; + + int ret = dictionary_walkthrough_read(labels, equal?simple_pattern_match_name_and_value_callback:simple_pattern_match_name_only_callback, &t); + + return (ret == -1)?true:false; +} + +bool rrdlabels_match_simple_pattern(DICTIONARY *labels, const char *simple_pattern_txt) { + if (!labels) return false; + + SIMPLE_PATTERN *pattern = simple_pattern_create(simple_pattern_txt, " ,|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + char equal = '\0'; + + const char *s; + for(s = simple_pattern_txt; *s ; s++) { + if (*s == '=' || *s == ':') { + equal = *s; break; - head = head->next; + } } + + bool ret = rrdlabels_match_simple_pattern_parsed(labels, pattern, equal); + simple_pattern_free(pattern); - return head; + + return ret; } -int label_list_contains_keylist(struct label *head, char *keylist) -{ - return (label_list_lookup_keylist(head, keylist) != NULL); + +// ---------------------------------------------------------------------------- +// Log all labels + +static int rrdlabels_log_label_to_buffer_callback(const char *name, void *value, void *data) { + BUFFER *wb = (BUFFER *)data; + RRDLABEL *lb = (RRDLABEL *)value; + + buffer_sprintf(wb, "Label: %s: \"%s\" (", name, string2str(lb->label_value)); + + size_t sources = 0; + if(lb->label_source & RRDLABEL_SRC_AUTO) { + buffer_sprintf(wb, "auto"); + sources++; + } + + if(lb->label_source & RRDLABEL_SRC_CONFIG) + buffer_sprintf(wb, "%snetdata.conf", sources++?",":""); + + if(lb->label_source & RRDLABEL_SRC_K8S) + buffer_sprintf(wb, "%sk8s", sources++?",":""); + + if(lb->label_source & RRDLABEL_SRC_ACLK) + buffer_sprintf(wb, "%saclk", sources++?",":""); + + if(!sources) + buffer_strcat(wb, "unknown"); + + buffer_strcat(wb, ")\n"); + + return 1; +} + +void rrdlabels_log_to_buffer(DICTIONARY *labels, BUFFER *wb) { + dictionary_sorted_walkthrough_read(labels, rrdlabels_log_label_to_buffer_callback, wb); } -/* Create a list with entries from both lists. - If any entry in the low priority list is masked by an entry in the high priority list then delete it. -*/ -struct label *merge_label_lists(struct label *lo_pri, struct label *hi_pri) -{ - struct label *result = hi_pri; - while (lo_pri != NULL) - { - struct label *current = lo_pri; - lo_pri = lo_pri->next; - if (!label_list_contains(result, current)) { - current->next = result; - result = current; - } - else - freez(current); +// ---------------------------------------------------------------------------- +// rrdlabels_to_buffer() + +struct labels_to_buffer { + BUFFER *wb; + bool (*filter_callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data); + void *filter_data; + void (*name_sanitizer)(char *dst, const char *src, size_t dst_size); + void (*value_sanitizer)(char *dst, const char *src, size_t dst_size); + const char *before_each; + const char *quote; + const char *equal; + const char *between_them; + size_t count; +}; + +static int label_to_buffer_callback(const char *name, void *value, void *data) { + struct labels_to_buffer *t = (struct labels_to_buffer *)data; + RRDLABEL *lb = (RRDLABEL *)value; + + size_t n_size = (t->name_sanitizer ) ? ( RRDLABELS_MAX_NAME_LENGTH * 2 ) : 1; + size_t v_size = (t->value_sanitizer) ? ( RRDLABELS_MAX_VALUE_LENGTH * 2 ) : 1; + + char n[n_size]; + char v[v_size]; + + const char *nn = name, *vv = string2str(lb->label_value); + + if(t->name_sanitizer) { + t->name_sanitizer(n, name, n_size); + nn = n; + } + + if(t->value_sanitizer) { + t->value_sanitizer(v, string2str(lb->label_value), v_size); + vv = v; + } + + if(!t->filter_callback || t->filter_callback(name, string2str(lb->label_value), lb->label_source, t->filter_data)) { + buffer_sprintf(t->wb, "%s%s%s%s%s%s%s%s%s", t->count++?t->between_them:"", t->before_each, t->quote, nn, t->quote, t->equal, t->quote, vv, t->quote); + return 1; + } + + return 0; +} + +int rrdlabels_to_buffer(DICTIONARY *labels, BUFFER *wb, const char *before_each, const char *equal, const char *quote, const char *between_them, bool (*filter_callback)(const char *name, const char *value, RRDLABEL_SRC ls, void *data), void *filter_data, void (*name_sanitizer)(char *dst, const char *src, size_t dst_size), void (*value_sanitizer)(char *dst, const char *src, size_t dst_size)) { + struct labels_to_buffer tmp = { + .wb = wb, + .filter_callback = filter_callback, + .filter_data = filter_data, + .name_sanitizer = name_sanitizer, + .value_sanitizer = value_sanitizer, + .before_each = before_each, + .equal = equal, + .quote = quote, + .between_them = between_them, + .count = 0 + }; + return dictionary_walkthrough_read(labels, label_to_buffer_callback, (void *)&tmp); +} + +static int chart_label_store_to_sql_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) { + RRDSET *st = (RRDSET *)data; + sql_store_chart_label(st->chart_uuid, (int)ls, (char *)name, (char *)value); + return 1; +} + +void rrdset_update_rrdlabels(RRDSET *st, DICTIONARY *new_rrdlabels) { + if(!st->state->chart_labels) + st->state->chart_labels = rrdlabels_create(); + + if (new_rrdlabels) + rrdlabels_migrate_to_these(st->state->chart_labels, new_rrdlabels); + + // TODO - we should also cleanup sqlite from old new_rrdlabels that have been removed + rrdlabels_walkthrough_read(st->state->chart_labels, chart_label_store_to_sql_callback, st); +} + +// ---------------------------------------------------------------------------- +// rrdlabels unit test + +struct rrdlabels_unittest_add_a_pair { + const char *pair; + const char *expected_name; + const char *expected_value; + const char *name; + const char *value; + RRDLABEL_SRC ls; + int errors; +}; + +int rrdlabels_unittest_add_a_pair_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) { + struct rrdlabels_unittest_add_a_pair *t = (struct rrdlabels_unittest_add_a_pair *)data; + + t->name = name; + t->value = value; + t->ls = ls; + + if(strcmp(name, t->expected_name) != 0) { + fprintf(stderr, "name is wrong, found \"%s\", expected \"%s\"", name, t->expected_name); + t->errors++; + } + + if(value == NULL && t->expected_value == NULL) { + ; + } + else if(value == NULL || t->expected_value == NULL) { + fprintf(stderr, "value is wrong, found \"%s\", expected \"%s\"", value?value:"(null)", t->expected_value?t->expected_value:"(null)"); + t->errors++; + } + else if(strcmp(value, t->expected_value) != 0) { + fprintf(stderr, "values don't match, found \"%s\", expected \"%s\"", value, t->expected_value); + t->errors++; + } + + return 1; +} + +int rrdlabels_unittest_add_a_pair(const char *pair, const char *name, const char *value) { + DICTIONARY *labels = rrdlabels_create(); + int errors; + + fprintf(stderr, "rrdlabels_add_pair(labels, %s) ... ", pair); + + rrdlabels_add_pair(labels, pair, RRDLABEL_SRC_CONFIG); + + struct rrdlabels_unittest_add_a_pair tmp = { + .pair = pair, + .expected_name = name, + .expected_value = value, + .errors = 0 + }; + int ret = rrdlabels_walkthrough_read(labels, rrdlabels_unittest_add_a_pair_callback, &tmp); + errors = tmp.errors; + if(ret != 1) { + fprintf(stderr, "failed to get \"%s\" label", name); + errors++; } - return result; + + if(!errors) + fprintf(stderr, " OK, name='%s' and value='%s'\n", tmp.name, tmp.value?tmp.value:"(null)"); + else + fprintf(stderr, " FAILED\n"); + + rrdlabels_destroy(labels); + return errors; } +int rrdlabels_unittest_add_pairs() { + fprintf(stderr, "\n%s() tests\n", __FUNCTION__); + + int errors = 0; + + // basic test + errors += rrdlabels_unittest_add_a_pair("tag=value", "tag", "value"); + errors += rrdlabels_unittest_add_a_pair("tag:value", "tag", "value"); + + // test newlines + errors += rrdlabels_unittest_add_a_pair(" tag = \t value \r\n", "tag", "value"); + + // test : in values + errors += rrdlabels_unittest_add_a_pair("tag=:value", "tag", ":value"); + errors += rrdlabels_unittest_add_a_pair("tag::value", "tag", ":value"); + errors += rrdlabels_unittest_add_a_pair(" tag = :value ", "tag", ":value"); + errors += rrdlabels_unittest_add_a_pair(" tag : :value ", "tag", ":value"); + errors += rrdlabels_unittest_add_a_pair("tag:5", "tag", "5"); + errors += rrdlabels_unittest_add_a_pair("tag:55", "tag", "55"); + errors += rrdlabels_unittest_add_a_pair("tag:aa", "tag", "aa"); + errors += rrdlabels_unittest_add_a_pair("tag:a", "tag", "a"); + + // test empty values + errors += rrdlabels_unittest_add_a_pair("tag", "tag", "[none]"); + errors += rrdlabels_unittest_add_a_pair("tag:", "tag", "[none]"); + errors += rrdlabels_unittest_add_a_pair("tag:\"\"", "tag", "[none]"); + errors += rrdlabels_unittest_add_a_pair("tag:''", "tag", "[none]"); + errors += rrdlabels_unittest_add_a_pair("tag:\r\n", "tag", "[none]"); + errors += rrdlabels_unittest_add_a_pair("tag\r\n", "tag", "[none]"); + + // test UTF-8 in values + errors += rrdlabels_unittest_add_a_pair("tag: country:Ελλάδα", "tag", "country:Ελλάδα"); + errors += rrdlabels_unittest_add_a_pair("\"tag\": \"country:Ελλάδα\"", "tag", "country:Ελλάδα"); + errors += rrdlabels_unittest_add_a_pair("\"tag\": country:\"Ελλάδα\"", "tag", "country:Ελλάδα"); + errors += rrdlabels_unittest_add_a_pair("\"tag=1\": country:\"Gre\\\"ece\"", "tag_1", "country:Gre_ece"); + errors += rrdlabels_unittest_add_a_pair("\"tag=1\" = country:\"Gre\\\"ece\"", "tag_1", "country:Gre_ece"); + + errors += rrdlabels_unittest_add_a_pair("\t'LABE=L'\t=\t\"World\" peace", "labe_l", "World peace"); + errors += rrdlabels_unittest_add_a_pair("\t'LA\\'B:EL'\t=\tcountry:\"World\":\"Europe\":\"Greece\"", "la_b_el", "country:World:Europe:Greece"); + errors += rrdlabels_unittest_add_a_pair("\t'LA\\'B:EL'\t=\tcountry\\\"World\"\\\"Europe\"\\\"Greece\"", "la_b_el", "country/World/Europe/Greece"); + + errors += rrdlabels_unittest_add_a_pair("NAME=\"VALUE\"", "name", "VALUE"); + errors += rrdlabels_unittest_add_a_pair("\"NAME\" : \"VALUE\"", "name", "VALUE"); + errors += rrdlabels_unittest_add_a_pair("NAME: \"VALUE\"", "name", "VALUE"); + + return errors; +} + +int rrdlabels_unittest_check_simple_pattern(DICTIONARY *labels, const char *pattern, bool expected) { + fprintf(stderr, "rrdlabels_match_simple_pattern(labels, \"%s\") ... ", pattern); + + bool ret = rrdlabels_match_simple_pattern(labels, pattern); + fprintf(stderr, "%s, got %s expected %s\n", (ret == expected)?"OK":"FAILED", ret?"true":"false", expected?"true":"false"); + + return (ret == expected)?0:1; +} + +int rrdlabels_unittest_simple_pattern() { + fprintf(stderr, "\n%s() tests\n", __FUNCTION__); + + int errors = 0; + + DICTIONARY *labels = rrdlabels_create(); + rrdlabels_add(labels, "tag1", "value1", RRDLABEL_SRC_CONFIG); + rrdlabels_add(labels, "tag2", "value2", RRDLABEL_SRC_CONFIG); + rrdlabels_add(labels, "tag3", "value3", RRDLABEL_SRC_CONFIG); + + errors += rrdlabels_unittest_check_simple_pattern(labels, "*", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "tag", false); + errors += rrdlabels_unittest_check_simple_pattern(labels, "tag*", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "*1", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "value*", false); + errors += rrdlabels_unittest_check_simple_pattern(labels, "*=value*", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "*:value*", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "*2", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "*2 *3", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "!tag3 *2", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "tag1 tag2", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "tag1tag2", false); + errors += rrdlabels_unittest_check_simple_pattern(labels, "invalid1 invalid2 tag3", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "!tag1 tag4", false); + errors += rrdlabels_unittest_check_simple_pattern(labels, "tag1=value1", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "tag1=value2", false); + errors += rrdlabels_unittest_check_simple_pattern(labels, "tag*=value*", true); + errors += rrdlabels_unittest_check_simple_pattern(labels, "!tag*=value*", false); + errors += rrdlabels_unittest_check_simple_pattern(labels, "!tag2=something2 tag2=*2", true); + + rrdlabels_destroy(labels); + + return errors; +} + +int rrdlabels_unittest_sanitize_value(const char *src, const char *expected) { + char buf[RRDLABELS_MAX_VALUE_LENGTH + 1]; + size_t mblen = rrdlabels_sanitize_value(buf, src, RRDLABELS_MAX_VALUE_LENGTH); + + int err = 0; + if(strcmp(buf, expected) != 0) err = 1; + + fprintf(stderr, "%s(%s): %s, expected '%s', got '%s', mblen = %zu, bytes = %zu\n", __FUNCTION__, src, (err==1)?"FAILED":"OK", expected, buf, mblen, strlen(buf)); + return err; +} + +int rrdlabels_unittest_sanitization() { + int errors = 0; + + errors += rrdlabels_unittest_sanitize_value("", "[none]"); + errors += rrdlabels_unittest_sanitize_value("1", "1"); + errors += rrdlabels_unittest_sanitize_value(" hello world ", "hello world"); + + // 2-byte UTF-8 + errors += rrdlabels_unittest_sanitize_value(" Ελλάδα ", "Ελλάδα"); + errors += rrdlabels_unittest_sanitize_value("aŰbŲcŴ", "aŰbŲcŴ"); + errors += rrdlabels_unittest_sanitize_value("Ű b Ų c Ŵ", "Ű b Ų c Ŵ"); + + // 3-byte UTF-8 + errors += rrdlabels_unittest_sanitize_value("‱", "‱"); + errors += rrdlabels_unittest_sanitize_value("a‱b", "a‱b"); + errors += rrdlabels_unittest_sanitize_value("a ‱ b", "a ‱ b"); + + // 4-byte UTF-8 + errors += rrdlabels_unittest_sanitize_value("𩸽", "𩸽"); + errors += rrdlabels_unittest_sanitize_value("a𩸽b", "a𩸽b"); + errors += rrdlabels_unittest_sanitize_value("a 𩸽 b", "a 𩸽 b"); + + // mixed multi-byte + errors += rrdlabels_unittest_sanitize_value("Ű‱𩸽‱Ű", "Ű‱𩸽‱Ű"); + + return errors; +} + +int rrdlabels_unittest(void) { + int errors = 0; + + errors += rrdlabels_unittest_sanitization(); + errors += rrdlabels_unittest_add_pairs(); + errors += rrdlabels_unittest_simple_pattern(); + + fprintf(stderr, "%d errors found\n", errors); + return errors; +} diff --git a/database/rrdset.c b/database/rrdset.c index e7cb89df0..9693ee211 100644 --- a/database/rrdset.c +++ b/database/rrdset.c @@ -80,17 +80,9 @@ static inline RRDSET *rrdset_index_find_name(RRDHOST *host, const char *name, ui tmp.name = name; tmp.hash_name = (hash)?hash:simple_hash(tmp.name); - // fprintf(stderr, "SEARCHING: %s\n", name); result = avl_search_lock(&host->rrdset_root_index_name, (avl_t *) (&(tmp.avlname))); - if(result) { - RRDSET *st = rrdset_from_avlname(result); - if(strcmp(st->magic, RRDSET_MAGIC) != 0) - error("Search for RRDSET %s returned an invalid RRDSET %s (name %s)", name, st->id, st->name); + if(result) return rrdset_from_avlname(result); - // fprintf(stderr, "FOUND: %s\n", name); - return rrdset_from_avlname(result); - } - // fprintf(stderr, "NOT FOUND: %s\n", name); return NULL; } @@ -194,6 +186,7 @@ int rrdset_set_name(RRDSET *st, const char *name) { rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_IGNORE); rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED); + rrdcontext_updated_rrdset_name(st); return 2; } @@ -212,6 +205,7 @@ inline void rrdset_is_obsolete(RRDSET *st) { // the chart will not get more updates (data collection) // so, we have to push its definition now rrdset_push_chart_definition_now(st); + rrdcontext_updated_rrdset_flags(st); } } @@ -224,6 +218,7 @@ inline void rrdset_isnot_obsolete(RRDSET *st) { // the chart will be pushed upstream automatically // due to data collection + rrdcontext_updated_rrdset_flags(st); } } @@ -259,6 +254,7 @@ inline void rrdset_update_heterogeneous_flag(RRDSET *st) { } rrdset_flag_clear(st, RRDSET_FLAG_HETEROGENEOUS); + rrdcontext_updated_rrdset_flags(st); } // ---------------------------------------------------------------------------- @@ -281,12 +277,13 @@ void rrdset_reset(RRDSET *st) { rd->last_collected_time.tv_sec = 0; rd->last_collected_time.tv_usec = 0; rd->collections_counter = 0; - // memset(rd->values, 0, rd->entries * sizeof(storage_number)); -#ifdef ENABLE_DBENGINE - if (RRD_MEMORY_MODE_DBENGINE == st->rrd_memory_mode && !rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) { - rrdeng_store_metric_flush_current_page(rd); + + if(!rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) { + for(int tier = 0; tier < storage_tiers ;tier++) { + if(rd->tiers[tier]) + rd->tiers[tier]->collect_ops.flush(rd->tiers[tier]->db_collection_handle); + } } -#endif } } @@ -294,20 +291,27 @@ void rrdset_reset(RRDSET *st) { // RRDSET - helpers for rrdset_create() inline long align_entries_to_pagesize(RRD_MEMORY_MODE mode, long entries) { - if(unlikely(entries < 5)) entries = 5; - if(unlikely(entries > RRD_HISTORY_ENTRIES_MAX)) entries = RRD_HISTORY_ENTRIES_MAX; + if(mode == RRD_MEMORY_MODE_DBENGINE) return 0; + if(mode == RRD_MEMORY_MODE_NONE) return 5; - if(unlikely(mode == RRD_MEMORY_MODE_NONE || mode == RRD_MEMORY_MODE_ALLOC)) - return entries; + if(entries < 5) entries = 5; + if(entries > RRD_HISTORY_ENTRIES_MAX) entries = RRD_HISTORY_ENTRIES_MAX; - long page = (size_t)sysconf(_SC_PAGESIZE); - long size = sizeof(RRDDIM) + entries * sizeof(storage_number); - if(unlikely(size % page)) { - size -= (size % page); - size += page; + if(mode == RRD_MEMORY_MODE_MAP || mode == RRD_MEMORY_MODE_SAVE || mode == RRD_MEMORY_MODE_RAM) { + long header_size = 0; - long n = (size - sizeof(RRDDIM)) / sizeof(storage_number); - return n; + if(mode == RRD_MEMORY_MODE_MAP || mode == RRD_MEMORY_MODE_SAVE) + header_size = (long)rrddim_memory_file_header_size(); + + long page = (long)sysconf(_SC_PAGESIZE); + long size = (long)(header_size + entries * sizeof(storage_number)); + if (unlikely(size % page)) { + size -= (size % page); + size += page; + + long n = (long)((size - header_size) / sizeof(storage_number)); + return n; + } } return entries; @@ -383,11 +387,13 @@ void rrdset_free(RRDSET *st) { rrdset_unlock(st); + // this has to be after the dimensions are freed + rrdcontext_removed_rrdset(st); + // ------------------------------------------------------------------------ // free it netdata_rwlock_destroy(&st->rrdset_rwlock); - netdata_rwlock_destroy(&st->state->labels.labels_rwlock); // free directly allocated members freez((void *)st->name); @@ -402,77 +408,51 @@ void rrdset_free(RRDSET *st) { freez(st->state->old_title); freez(st->state->old_units); freez(st->state->old_context); - free_label_list(st->state->labels.head); + rrdlabels_destroy(st->state->chart_labels); freez(st->state); freez(st->chart_uuid); - switch(st->rrd_memory_mode) { - case RRD_MEMORY_MODE_SAVE: - case RRD_MEMORY_MODE_MAP: - case RRD_MEMORY_MODE_RAM: - debug(D_RRD_CALLS, "Unmapping stats '%s'.", st->name); - munmap(st, st->memsize); - break; - - case RRD_MEMORY_MODE_ALLOC: - case RRD_MEMORY_MODE_NONE: - case RRD_MEMORY_MODE_DBENGINE: - freez(st); - break; - } - + rrdset_memory_file_free(st); + freez(st); } void rrdset_save(RRDSET *st) { rrdset_check_rdlock(st); - // info("Saving chart '%s' ('%s')", st->id, st->name); - - if(st->rrd_memory_mode == RRD_MEMORY_MODE_SAVE) { - debug(D_RRD_STATS, "Saving stats '%s' to '%s'.", st->name, st->cache_filename); - memory_file_save(st->cache_filename, st, st->memsize); - } + rrdset_memory_file_save(st); RRDDIM *rd; - rrddim_foreach_read(rd, st) { - if(likely(rd->rrd_memory_mode == RRD_MEMORY_MODE_SAVE)) { - debug(D_RRD_STATS, "Saving dimension '%s' to '%s'.", rd->name, rd->cache_filename); - memory_file_save(rd->cache_filename, rd, rd->memsize); - } - } + rrddim_foreach_read(rd, st) + rrddim_memory_file_save(rd); } -void rrdset_delete_custom(RRDSET *st, int db_rotated) { +void rrdset_delete_files(RRDSET *st) { RRDDIM *rd; -#ifndef ENABLE_ACLK - UNUSED(db_rotated); -#endif rrdset_check_rdlock(st); info("Deleting chart '%s' ('%s') from disk...", st->id, st->name); if(st->rrd_memory_mode == RRD_MEMORY_MODE_SAVE || st->rrd_memory_mode == RRD_MEMORY_MODE_MAP) { - info("Deleting chart header file '%s'.", st->cache_filename); - if(unlikely(unlink(st->cache_filename) == -1)) - error("Cannot delete chart header file '%s'", st->cache_filename); + const char *cache_filename = rrdset_cache_filename(st); + if(cache_filename) { + info("Deleting chart header file '%s'.", cache_filename); + if (unlikely(unlink(cache_filename) == -1)) + error("Cannot delete chart header file '%s'", cache_filename); + } + else + error("Cannot find the cache filename of chart '%s'", st->id); } rrddim_foreach_read(rd, st) { - if(likely(rd->rrd_memory_mode == RRD_MEMORY_MODE_SAVE || rd->rrd_memory_mode == RRD_MEMORY_MODE_MAP)) { - info("Deleting dimension file '%s'.", rd->cache_filename); - if(unlikely(unlink(rd->cache_filename) == -1)) - error("Cannot delete dimension file '%s'", rd->cache_filename); - } - } + const char *cache_filename = rrddim_cache_filename(rd); + if(!cache_filename) continue; - recursively_delete_dir(st->cache_dir, "left-over chart"); -#ifdef ENABLE_ACLK - if ((netdata_cloud_setting) && (db_rotated || RRD_MEMORY_MODE_DBENGINE != st->rrd_memory_mode)) { - aclk_del_collector(st->rrdhost, st->plugin_name, st->module_name); - st->rrdhost->deleted_charts_count++; + info("Deleting dimension file '%s'.", cache_filename); + if(unlikely(unlink(cache_filename) == -1)) + error("Cannot delete dimension file '%s'", cache_filename); } -#endif + recursively_delete_dir(st->cache_dir, "left-over chart"); } void rrdset_delete_obsolete_dimensions(RRDSET *st) { @@ -484,11 +464,11 @@ void rrdset_delete_obsolete_dimensions(RRDSET *st) { rrddim_foreach_read(rd, st) { if(rrddim_flag_check(rd, RRDDIM_FLAG_OBSOLETE)) { - if(likely(rd->rrd_memory_mode == RRD_MEMORY_MODE_SAVE || rd->rrd_memory_mode == RRD_MEMORY_MODE_MAP)) { - info("Deleting dimension file '%s'.", rd->cache_filename); - if(unlikely(unlink(rd->cache_filename) == -1)) - error("Cannot delete dimension file '%s'", rd->cache_filename); - } + const char *cache_filename = rrddim_cache_filename(rd); + if(!cache_filename) continue; + info("Deleting dimension file '%s'.", cache_filename); + if(unlikely(unlink(cache_filename) == -1)) + error("Cannot delete dimension file '%s'", cache_filename); } } } @@ -507,6 +487,14 @@ static inline RRDSET *rrdset_find_on_create(RRDHOST *host, const char *fullid) { return NULL; } +static inline void rrdset_update_permanent_labels(RRDSET *st) { + if(!st->state || !st->state->chart_labels) return; + + rrdlabels_add(st->state->chart_labels, "_collect_plugin", st->plugin_name, RRDLABEL_SRC_AUTO| RRDLABEL_FLAG_PERMANENT); + rrdlabels_add(st->state->chart_labels, "_collect_module", st->module_name, RRDLABEL_SRC_AUTO| RRDLABEL_FLAG_PERMANENT); + rrdlabels_add(st->state->chart_labels, "_instance_family", st->family, RRDLABEL_SRC_AUTO| RRDLABEL_FLAG_PERMANENT); +} + RRDSET *rrdset_create_custom( RRDHOST *host , const char *type @@ -660,22 +648,7 @@ RRDSET *rrdset_create_custom( } if (mark_rebuild) { -#ifdef ENABLE_ACLK - if (netdata_cloud_setting) { - if (mark_rebuild & META_CHART_ACTIVATED) { - aclk_add_collector(host, st->plugin_name, st->module_name); - } - else { - if (mark_rebuild & (META_PLUGIN_UPDATED | META_MODULE_UPDATED)) { - aclk_del_collector( - host, mark_rebuild & META_PLUGIN_UPDATED ? old_plugin : st->plugin_name, - mark_rebuild & META_MODULE_UPDATED ? old_module : st->module_name); - aclk_add_collector(host, st->plugin_name, st->module_name); - } - } - rrdset_flag_clear(st, RRDSET_FLAG_ACLK); - } -#endif + rrdset_flag_clear(st, RRDSET_FLAG_ACLK); freez(old_plugin); freez(old_module); freez(old_title); @@ -701,8 +674,11 @@ RRDSET *rrdset_create_custom( } } /* Fall-through during switch from archived to active so that the host lock is taken and health is linked */ - if (!changed_from_archived_to_active) + if (!changed_from_archived_to_active) { + rrdset_update_permanent_labels(st); + rrdcontext_updated_rrdset(st); return st; + } } rrdhost_wrlock(host); @@ -722,11 +698,10 @@ RRDSET *rrdset_create_custom( rrdhost_unlock(host); rrdset_flag_set(st, RRDSET_FLAG_SYNC_CLOCK); rrdset_flag_clear(st, RRDSET_FLAG_UPSTREAM_EXPOSED); + rrdcontext_updated_rrdset(st); return st; } - char fullfilename[FILENAME_MAX + 1]; - // ------------------------------------------------------------------------ // get the options from the config, we need to create it @@ -734,126 +709,37 @@ RRDSET *rrdset_create_custom( if (memory_mode != RRD_MEMORY_MODE_DBENGINE) entries = align_entries_to_pagesize(memory_mode, history_entries); - unsigned long size = sizeof(RRDSET); char *cache_dir = rrdset_cache_dir(host, fullid); - time_t now = now_realtime_sec(); - // ------------------------------------------------------------------------ // load it or allocate it debug(D_RRD_CALLS, "Creating RRD_STATS for '%s.%s'.", type, id); - snprintfz(fullfilename, FILENAME_MAX, "%s/main.db", cache_dir); - if(memory_mode == RRD_MEMORY_MODE_SAVE || memory_mode == RRD_MEMORY_MODE_MAP || - memory_mode == RRD_MEMORY_MODE_RAM) { - st = (RRDSET *)netdata_mmap( - (memory_mode == RRD_MEMORY_MODE_RAM) ? NULL : fullfilename, - size, - ((memory_mode == RRD_MEMORY_MODE_MAP) ? MAP_SHARED : MAP_PRIVATE), - 0); - - if(st) { - memset(&st->avl, 0, sizeof(avl_t)); - memset(&st->avlname, 0, sizeof(avl_t)); - memset(&st->rrdvar_root_index, 0, sizeof(avl_tree_lock)); - memset(&st->dimensions_index, 0, sizeof(avl_tree_lock)); - memset(&st->rrdset_rwlock, 0, sizeof(netdata_rwlock_t)); - - st->name = NULL; - st->type = NULL; - st->family = NULL; - st->title = NULL; - st->units = NULL; - st->context = NULL; - st->cache_dir = NULL; - st->plugin_name = NULL; - st->module_name = NULL; - st->dimensions = NULL; - st->rrdfamily = NULL; - st->rrdhost = NULL; - st->next = NULL; - st->variables = NULL; - st->alarms = NULL; - st->flags = 0x00000000; - st->exporting_flags = NULL; - - if(memory_mode == RRD_MEMORY_MODE_RAM) { - memset(st, 0, size); - } - else { - if(strcmp(st->magic, RRDSET_MAGIC) != 0) { - info("Initializing file %s.", fullfilename); - memset(st, 0, size); - } - else if(strcmp(st->id, fullid) != 0) { - error("File %s contents are not for chart %s. Clearing it.", fullfilename, fullid); - // munmap(st, size); - // st = NULL; - memset(st, 0, size); - } - else if(st->memsize != size || st->entries != entries) { - error("File %s does not have the desired size. Clearing it.", fullfilename); - memset(st, 0, size); - } - else if(st->update_every != update_every) { - error("File %s does not have the desired update frequency. Clearing it.", fullfilename); - memset(st, 0, size); - } - else if((now - st->last_updated.tv_sec) > update_every * entries) { - info("File %s is too old. Clearing it.", fullfilename); - memset(st, 0, size); - } - else if(st->last_updated.tv_sec > now + update_every) { - error("File %s refers to the future by %zd secs. Resetting it to now.", fullfilename, (ssize_t)(st->last_updated.tv_sec - now)); - st->last_updated.tv_sec = now; - } - - // make sure the database is aligned - if(st->last_updated.tv_sec) { - st->update_every = update_every; - last_updated_time_align(st); - } - } - - // make sure we have the right memory mode - // even if we cleared the memory - st->rrd_memory_mode = memory_mode; - } - } - - if(unlikely(!st)) { - st = callocz(1, size); - if (memory_mode == RRD_MEMORY_MODE_DBENGINE) - st->rrd_memory_mode = RRD_MEMORY_MODE_DBENGINE; - else - st->rrd_memory_mode = (memory_mode == RRD_MEMORY_MODE_NONE) ? RRD_MEMORY_MODE_NONE : RRD_MEMORY_MODE_ALLOC; - } - - st->plugin_name = plugin?strdupz(plugin):NULL; - st->module_name = module?strdupz(module):NULL; - - st->rrdhost = host; - st->memsize = size; - st->entries = entries; - st->update_every = update_every; - - if(st->current_entry >= st->entries) st->current_entry = 0; - - strcpy(st->cache_filename, fullfilename); - strcpy(st->magic, RRDSET_MAGIC); + st = callocz(1, sizeof(RRDSET)); + st->state = callocz(1, sizeof(*st->state)); strcpy(st->id, fullid); st->hash = simple_hash(st->id); + st->rrdhost = host; st->cache_dir = cache_dir; + st->entries = entries; + st->update_every = update_every; - st->chart_type = chart_type; - st->type = strdupz(type); - - st->state = callocz(1, sizeof(*st->state)); + if(memory_mode == RRD_MEMORY_MODE_SAVE || memory_mode == RRD_MEMORY_MODE_MAP) { + if(!rrdset_memory_load_or_create_map_save(st, memory_mode)) { + info("Failed to use memory mode %s for chart '%s', falling back to ram", (memory_mode == RRD_MEMORY_MODE_MAP)?"map":"save", st->name); + memory_mode = RRD_MEMORY_MODE_RAM; + } + } + st->rrd_memory_mode = memory_mode; - st->family = family ? strdupz(family) : strdupz(st->type); + st->plugin_name = plugin?strdupz(plugin):NULL; + st->module_name = module?strdupz(module):NULL; + st->chart_type = chart_type; + st->type = strdupz(type); + st->family = family ? strdupz(family) : strdupz(st->type); json_fix_string(st->family); st->state->is_ar_chart = strcmp(st->id, ML_ANOMALY_RATES_CHART_ID) == 0; @@ -874,21 +760,14 @@ RRDSET *rrdset_create_custom( st->green = NAN; st->red = NAN; - st->last_collected_time.tv_sec = 0; - st->last_collected_time.tv_usec = 0; - st->counter_done = 0; - st->rrddim_page_alignment = 0; - st->gap_when_lost_iterations_above = (int) (gap_when_lost_iterations_above + 2); - st->last_accessed_time = 0; - st->upstream_resync_time = 0; - avl_init_lock(&st->dimensions_index, rrddim_compare); avl_init_lock(&st->rrdvar_root_index, rrdvar_compare); netdata_rwlock_init(&st->rrdset_rwlock); - netdata_rwlock_init(&st->state->labels.labels_rwlock); + st->state->chart_labels = rrdlabels_create(); + rrdset_update_permanent_labels(st); if(name && *name && rrdset_set_name(st, name)) // we did set the name @@ -930,11 +809,7 @@ RRDSET *rrdset_create_custom( compute_chart_hash(st); rrdhost_unlock(host); -#ifdef ENABLE_ACLK - if (netdata_cloud_setting) - aclk_add_collector(host, plugin, module); - rrdset_flag_clear(st, RRDSET_FLAG_ACLK); -#endif + rrdcontext_updated_rrdset(st); return(st); } @@ -994,7 +869,8 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) { if(unlikely(since_last_usec < 0)) { // oops! the database is in the future #ifdef NETDATA_INTERNAL_CHECKS - info("RRD database for chart '%s' on host '%s' is %0.5" LONG_DOUBLE_MODIFIER " secs in the future (counter #%zu, update #%zu). Adjusting it to current time.", st->id, st->rrdhost->hostname, (LONG_DOUBLE)-since_last_usec / USEC_PER_SEC, st->counter, st->counter_done); + info("RRD database for chart '%s' on host '%s' is %0.5" NETDATA_DOUBLE_MODIFIER + " secs in the future (counter #%zu, update #%zu). Adjusting it to current time.", st->id, st->rrdhost->hostname, (NETDATA_DOUBLE)-since_last_usec / USEC_PER_SEC, st->counter, st->counter_done); #endif st->last_collected_time.tv_sec = now.tv_sec - st->update_every; @@ -1013,7 +889,8 @@ inline void rrdset_next_usec(RRDSET *st, usec_t microseconds) { else if(unlikely((usec_t)since_last_usec > (usec_t)(st->update_every * 5 * USEC_PER_SEC))) { // oops! the database is too far behind #ifdef NETDATA_INTERNAL_CHECKS - info("RRD database for chart '%s' on host '%s' is %0.5" LONG_DOUBLE_MODIFIER " secs in the past (counter #%zu, update #%zu). Adjusting it to current time.", st->id, st->rrdhost->hostname, (LONG_DOUBLE)since_last_usec / USEC_PER_SEC, st->counter, st->counter_done); + info("RRD database for chart '%s' on host '%s' is %0.5" NETDATA_DOUBLE_MODIFIER + " secs in the past (counter #%zu, update #%zu). Adjusting it to current time.", st->id, st->rrdhost->hostname, (NETDATA_DOUBLE)since_last_usec / USEC_PER_SEC, st->counter, st->counter_done); #endif microseconds = (usec_t)since_last_usec; @@ -1070,7 +947,7 @@ static inline usec_t rrdset_init_last_collected_time(RRDSET *st) { usec_t last_collect_ut = st->last_collected_time.tv_sec * USEC_PER_SEC + st->last_collected_time.tv_usec; #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "initialized last collected time to %0.3" LONG_DOUBLE_MODIFIER, (LONG_DOUBLE)last_collect_ut / USEC_PER_SEC); + rrdset_debug(st, "initialized last collected time to %0.3" NETDATA_DOUBLE_MODIFIER, (NETDATA_DOUBLE)last_collect_ut / USEC_PER_SEC); #endif return last_collect_ut; @@ -1083,7 +960,7 @@ static inline usec_t rrdset_update_last_collected_time(RRDSET *st) { st->last_collected_time.tv_usec = (suseconds_t) (ut % USEC_PER_SEC); #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "updated last collected time to %0.3" LONG_DOUBLE_MODIFIER, (LONG_DOUBLE)last_collect_ut / USEC_PER_SEC); + rrdset_debug(st, "updated last collected time to %0.3" NETDATA_DOUBLE_MODIFIER, (NETDATA_DOUBLE)last_collect_ut / USEC_PER_SEC); #endif return last_collect_ut; @@ -1102,12 +979,110 @@ static inline usec_t rrdset_init_last_updated_time(RRDSET *st) { usec_t last_updated_ut = st->last_updated.tv_sec * USEC_PER_SEC + st->last_updated.tv_usec; #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "initialized last updated time to %0.3" LONG_DOUBLE_MODIFIER, (LONG_DOUBLE)last_updated_ut / USEC_PER_SEC); + rrdset_debug(st, "initialized last updated time to %0.3" NETDATA_DOUBLE_MODIFIER, (NETDATA_DOUBLE)last_updated_ut / USEC_PER_SEC); #endif return last_updated_ut; } +static inline time_t tier_next_point_time(RRDDIM *rd, struct rrddim_tier *t, time_t now) { + time_t loop = (time_t)rd->update_every * (time_t)t->tier_grouping; + return now + loop - ((now + loop) % loop); +} + +void store_metric_at_tier(RRDDIM *rd, struct rrddim_tier *t, STORAGE_POINT sp, usec_t now_ut) { + if (unlikely(!t->next_point_time)) + t->next_point_time = tier_next_point_time(rd, t, sp.end_time); + + // merge the dates into our virtual point + if (unlikely(sp.start_time < t->virtual_point.start_time)) + t->virtual_point.start_time = sp.start_time; + + if (likely(sp.end_time > t->virtual_point.end_time)) + t->virtual_point.end_time = sp.end_time; + + // merge the values into our virtual point + if (likely(!storage_point_is_empty(sp))) { + // we aggregate only non NULLs into higher tiers + + if (likely(!storage_point_is_unset(t->virtual_point))) { + // merge the collected point to our virtual one + t->virtual_point.sum += sp.sum; + t->virtual_point.min = MIN(t->virtual_point.min, sp.min); + t->virtual_point.max = MAX(t->virtual_point.max, sp.max); + t->virtual_point.count += sp.count; + t->virtual_point.anomaly_count += sp.anomaly_count; + t->virtual_point.flags |= sp.flags; + } + else { + // reset our virtual point to this one + t->virtual_point = sp; + } + } + + if(unlikely(sp.end_time >= t->next_point_time)) { + if (likely(!storage_point_is_unset(t->virtual_point))) { + + t->collect_ops.store_metric( + t->db_collection_handle, + now_ut, + t->virtual_point.sum, + t->virtual_point.min, + t->virtual_point.max, + t->virtual_point.count, + t->virtual_point.anomaly_count, + t->virtual_point.flags); + } + else { + t->collect_ops.store_metric( + t->db_collection_handle, + now_ut, + NAN, + NAN, + NAN, + 0, + 0, SN_FLAG_NONE); + } + + t->virtual_point.count = 0; + t->next_point_time = tier_next_point_time(rd, t, sp.end_time); + } +} + +static void store_metric(RRDDIM *rd, usec_t point_end_time_ut, NETDATA_DOUBLE n, SN_FLAGS flags) { + + // store the metric on tier 0 + rd->tiers[0]->collect_ops.store_metric(rd->tiers[0]->db_collection_handle, point_end_time_ut, n, 0, 0, 1, 0, flags); + + for(int tier = 1; tier < storage_tiers ;tier++) { + if(unlikely(!rd->tiers[tier])) continue; + + struct rrddim_tier *t = rd->tiers[tier]; + + time_t now = (time_t)(point_end_time_ut / USEC_PER_SEC); + + if(!t->last_collected_ut) { + // we have not collected this tier before + // let's fill any gap that may exist + rrdr_fill_tier_gap_from_smaller_tiers(rd, tier, now); + } + + STORAGE_POINT sp = { + .start_time = now - rd->update_every, + .end_time = now, + .min = n, + .max = n, + .sum = n, + .count = 1, + .anomaly_count = (flags & SN_FLAG_NOT_ANOMALOUS) ? 0 : 1, + .flags = flags + }; + + t->last_collected_ut = point_end_time_ut; + store_metric_at_tier(rd, t, sp, point_end_time_ut); + } +} + static inline size_t rrdset_done_interpolate( RRDSET *st , usec_t update_every_ut @@ -1131,17 +1106,17 @@ static inline size_t rrdset_done_interpolate( size_t counter = st->counter; long current_entry = st->current_entry; - uint32_t storage_flags = SN_DEFAULT_FLAGS; + SN_FLAGS storage_flags = SN_DEFAULT_FLAGS; if (has_reset_value) - storage_flags |= SN_EXISTS_RESET; + storage_flags |= SN_FLAG_RESET; for( ; next_store_ut <= now_collect_ut ; last_collect_ut = next_store_ut, next_store_ut += update_every_ut, iterations-- ) { #ifdef NETDATA_INTERNAL_CHECKS if(iterations < 0) { error("INTERNAL CHECK: %s: iterations calculation wrapped! first_ut = %llu, last_stored_ut = %llu, next_store_ut = %llu, now_collect_ut = %llu", st->name, first_ut, last_stored_ut, next_store_ut, now_collect_ut); } - rrdset_debug(st, "last_stored_ut = %0.3" LONG_DOUBLE_MODIFIER " (last updated time)", (LONG_DOUBLE)last_stored_ut/USEC_PER_SEC); - rrdset_debug(st, "next_store_ut = %0.3" LONG_DOUBLE_MODIFIER " (next interpolation point)", (LONG_DOUBLE)next_store_ut/USEC_PER_SEC); + rrdset_debug(st, "last_stored_ut = %0.3" NETDATA_DOUBLE_MODIFIER " (last updated time)", (NETDATA_DOUBLE)last_stored_ut/USEC_PER_SEC); + rrdset_debug(st, "next_store_ut = %0.3" NETDATA_DOUBLE_MODIFIER " (next interpolation point)", (NETDATA_DOUBLE)next_store_ut/USEC_PER_SEC); #endif last_ut = next_store_ut; @@ -1150,20 +1125,19 @@ static inline size_t rrdset_done_interpolate( if (rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) continue; - calculated_number new_value; + NETDATA_DOUBLE new_value; switch(rd->algorithm) { case RRD_ALGORITHM_INCREMENTAL: - new_value = (calculated_number) + new_value = (NETDATA_DOUBLE) ( rd->calculated_value - * (calculated_number)(next_store_ut - last_collect_ut) - / (calculated_number)(now_collect_ut - last_collect_ut) + * (NETDATA_DOUBLE)(next_store_ut - last_collect_ut) + / (NETDATA_DOUBLE)(now_collect_ut - last_collect_ut) ); #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: CALC2 INC " - CALCULATED_NUMBER_FORMAT " = " - CALCULATED_NUMBER_FORMAT + rrdset_debug(st, "%s: CALC2 INC " NETDATA_DOUBLE_FORMAT " = " + NETDATA_DOUBLE_FORMAT " * (%llu - %llu)" " / (%llu - %llu)" , rd->name @@ -1177,18 +1151,18 @@ static inline size_t rrdset_done_interpolate( rd->calculated_value -= new_value; new_value += rd->last_calculated_value; rd->last_calculated_value = 0; - new_value /= (calculated_number)st->update_every; + new_value /= (NETDATA_DOUBLE)st->update_every; if(unlikely(next_store_ut - last_stored_ut < update_every_ut)) { #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: COLLECTION POINT IS SHORT " CALCULATED_NUMBER_FORMAT " - EXTRAPOLATING", + rrdset_debug(st, "%s: COLLECTION POINT IS SHORT " NETDATA_DOUBLE_FORMAT " - EXTRAPOLATING", rd->name - , (calculated_number)(next_store_ut - last_stored_ut) + , (NETDATA_DOUBLE)(next_store_ut - last_stored_ut) ); #endif - new_value = new_value * (calculated_number)(st->update_every * USEC_PER_SEC) / (calculated_number)(next_store_ut - last_stored_ut); + new_value = new_value * (NETDATA_DOUBLE)(st->update_every * USEC_PER_SEC) / (NETDATA_DOUBLE)(next_store_ut - last_stored_ut); } break; @@ -1207,21 +1181,19 @@ static inline size_t rrdset_done_interpolate( // we have missed an update // interpolate in the middle values - new_value = (calculated_number) + new_value = (NETDATA_DOUBLE) ( ( (rd->calculated_value - rd->last_calculated_value) - * (calculated_number)(next_store_ut - last_collect_ut) - / (calculated_number)(now_collect_ut - last_collect_ut) + * (NETDATA_DOUBLE)(next_store_ut - last_collect_ut) + / (NETDATA_DOUBLE)(now_collect_ut - last_collect_ut) ) + rd->last_calculated_value ); #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: CALC2 DEF " - CALCULATED_NUMBER_FORMAT " = (((" - "(" CALCULATED_NUMBER_FORMAT " - " CALCULATED_NUMBER_FORMAT ")" + rrdset_debug(st, "%s: CALC2 DEF " NETDATA_DOUBLE_FORMAT " = (((" + "(" NETDATA_DOUBLE_FORMAT " - " NETDATA_DOUBLE_FORMAT ")" " * %llu" - " / %llu) + " CALCULATED_NUMBER_FORMAT - , rd->name + " / %llu) + " NETDATA_DOUBLE_FORMAT, rd->name , new_value , rd->calculated_value, rd->last_calculated_value , (next_store_ut - first_ut) @@ -1234,9 +1206,7 @@ static inline size_t rrdset_done_interpolate( if(unlikely(!store_this_entry)) { (void) ml_is_anomalous(rd, 0, false); - - rd->state->collect_ops.store_metric(rd, next_store_ut, SN_EMPTY_SLOT); -// rd->values[current_entry] = SN_EMPTY_SLOT; + store_metric(rd, next_store_ut, NAN, SN_FLAG_NONE); continue; } @@ -1245,69 +1215,26 @@ static inline size_t rrdset_done_interpolate( if (ml_is_anomalous(rd, new_value, true)) { // clear anomaly bit: 0 -> is anomalous, 1 -> not anomalous - dim_storage_flags &= ~ ((uint32_t) SN_ANOMALY_BIT); + dim_storage_flags &= ~((storage_number)SN_FLAG_NOT_ANOMALOUS); } - rd->state->collect_ops.store_metric(rd, next_store_ut, pack_storage_number(new_value, dim_storage_flags)); -// rd->values[current_entry] = pack_storage_number(new_value, storage_flags ); + store_metric(rd, next_store_ut, new_value, dim_storage_flags); rd->last_stored_value = new_value; - - #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: STORE[%ld] " - CALCULATED_NUMBER_FORMAT " = " CALCULATED_NUMBER_FORMAT - , rd->name - , current_entry - , unpack_storage_number(rd->values[current_entry]), new_value - ); - #endif } else { (void) ml_is_anomalous(rd, 0, false); #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: STORE[%ld] = NON EXISTING " - , rd->name - , current_entry - ); + rrdset_debug(st, "%s: STORE[%ld] = NON EXISTING ", rd->name, current_entry); #endif -// rd->values[current_entry] = SN_EMPTY_SLOT; - rd->state->collect_ops.store_metric(rd, next_store_ut, SN_EMPTY_SLOT); + store_metric(rd, next_store_ut, NAN, SN_FLAG_NONE); rd->last_stored_value = NAN; } stored_entries++; - - #ifdef NETDATA_INTERNAL_CHECKS - if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_DEBUG))) { - calculated_number t1 = new_value * (calculated_number)rd->multiplier / (calculated_number)rd->divisor; - calculated_number t2 = unpack_storage_number(rd->values[current_entry]); - - calculated_number accuracy = accuracy_loss(t1, t2); - debug(D_RRD_STATS, "%s/%s: UNPACK[%ld] = " CALCULATED_NUMBER_FORMAT " (original = " CALCULATED_NUMBER_FORMAT ", accuracy loss = " CALCULATED_NUMBER_FORMAT "%%%s)" - , st->id, rd->name - , current_entry - , t2 - , t1 - , accuracy - , (accuracy > ACCURACY_LOSS_ACCEPTED_PERCENT) ? " **TOO BIG** " : "" - ); - - rd->collected_volume += t1; - rd->stored_volume += t2; - - accuracy = accuracy_loss(rd->collected_volume, rd->stored_volume); - debug(D_RRD_STATS, "%s/%s: VOLUME[%ld] = " CALCULATED_NUMBER_FORMAT ", calculated = " CALCULATED_NUMBER_FORMAT ", accuracy loss = " CALCULATED_NUMBER_FORMAT "%%%s" - , st->id, rd->name - , current_entry - , rd->stored_volume - , rd->collected_volume - , accuracy - , (accuracy > ACCURACY_LOSS_ACCEPTED_PERCENT) ? " **TOO BIG** " : "" - ); - } - #endif } + // reset the storage flags for the next point, if any; storage_flags = SN_DEFAULT_FLAGS; @@ -1344,7 +1271,7 @@ static inline void rrdset_done_fill_the_gap(RRDSET *st) { long current_entry = st->current_entry; for(c = 0; c < entries && next_store_ut <= now_collect_ut ; next_store_ut += update_every_ut, c++) { - rd->values[current_entry] = SN_EMPTY_SLOT; + rd->db[current_entry] = pack_storage_number(NAN, SN_FLAG_NONE); current_entry = ((current_entry + 1) >= entries) ? 0 : current_entry + 1; #ifdef NETDATA_INTERNAL_CHECKS @@ -1368,6 +1295,7 @@ void rrdset_done(RRDSET *st) { if(unlikely(netdata_exit)) return; debug(D_RRD_CALLS, "rrdset_done() for chart %s", st->name); + rrdcontext_collected_rrdset(st); RRDDIM *rd; @@ -1405,7 +1333,8 @@ void rrdset_done(RRDSET *st) { // check if the chart has a long time to be updated if(unlikely(st->usec_since_last_update > st->entries * update_every_ut && st->rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE && st->rrd_memory_mode != RRD_MEMORY_MODE_NONE)) { - info("host '%s', chart %s: took too long to be updated (counter #%zu, update #%zu, %0.3" LONG_DOUBLE_MODIFIER " secs). Resetting it.", st->rrdhost->hostname, st->name, st->counter, st->counter_done, (LONG_DOUBLE)st->usec_since_last_update / USEC_PER_SEC); + info("host '%s', chart %s: took too long to be updated (counter #%zu, update #%zu, %0.3" NETDATA_DOUBLE_MODIFIER + " secs). Resetting it.", st->rrdhost->hostname, st->name, st->counter, st->counter_done, (NETDATA_DOUBLE)st->usec_since_last_update / USEC_PER_SEC); rrdset_reset(st); st->usec_since_last_update = update_every_ut; store_this_entry = 0; @@ -1504,6 +1433,7 @@ void rrdset_done(RRDSET *st) { // and we have collected metrics for this chart in the past (st->counter != 0) // fill the gap (the chart has been just loaded from disk) if(unlikely(st->counter) && st->rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE) { + // TODO this should be inside the storage engine rrdset_done_fill_the_gap(st); last_stored_ut = st->last_updated.tv_sec * USEC_PER_SEC + st->last_updated.tv_usec; next_store_ut = (st->last_updated.tv_sec + st->update_every) * USEC_PER_SEC; @@ -1531,6 +1461,7 @@ void rrdset_done(RRDSET *st) { #endif } } + after_first_database_work: st->counter_done++; @@ -1541,10 +1472,10 @@ after_first_database_work: } #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "last_collect_ut = %0.3" LONG_DOUBLE_MODIFIER " (last collection time)", (LONG_DOUBLE)last_collect_ut/USEC_PER_SEC); - rrdset_debug(st, "now_collect_ut = %0.3" LONG_DOUBLE_MODIFIER " (current collection time)", (LONG_DOUBLE)now_collect_ut/USEC_PER_SEC); - rrdset_debug(st, "last_stored_ut = %0.3" LONG_DOUBLE_MODIFIER " (last updated time)", (LONG_DOUBLE)last_stored_ut/USEC_PER_SEC); - rrdset_debug(st, "next_store_ut = %0.3" LONG_DOUBLE_MODIFIER " (next interpolation point)", (LONG_DOUBLE)next_store_ut/USEC_PER_SEC); + rrdset_debug(st, "last_collect_ut = %0.3" NETDATA_DOUBLE_MODIFIER " (last collection time)", (NETDATA_DOUBLE)last_collect_ut/USEC_PER_SEC); + rrdset_debug(st, "now_collect_ut = %0.3" NETDATA_DOUBLE_MODIFIER " (current collection time)", (NETDATA_DOUBLE)now_collect_ut/USEC_PER_SEC); + rrdset_debug(st, "last_stored_ut = %0.3" NETDATA_DOUBLE_MODIFIER " (last updated time)", (NETDATA_DOUBLE)last_stored_ut/USEC_PER_SEC); + rrdset_debug(st, "next_store_ut = %0.3" NETDATA_DOUBLE_MODIFIER " (next interpolation point)", (NETDATA_DOUBLE)next_store_ut/USEC_PER_SEC); #endif // calculate totals and count the dimensions @@ -1553,7 +1484,9 @@ after_first_database_work: rrddim_foreach_read(rd, st) { if (rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) continue; + dimensions++; + if(likely(rd->updated)) st->collected_total += rd->collected_value; } @@ -1581,9 +1514,8 @@ after_first_database_work: rrdset_debug(st, "%s: START " " last_collected_value = " COLLECTED_NUMBER_FORMAT " collected_value = " COLLECTED_NUMBER_FORMAT - " last_calculated_value = " CALCULATED_NUMBER_FORMAT - " calculated_value = " CALCULATED_NUMBER_FORMAT - , rd->name + " last_calculated_value = " NETDATA_DOUBLE_FORMAT + " calculated_value = " NETDATA_DOUBLE_FORMAT, rd->name , rd->last_collected_value , rd->collected_value , rd->last_calculated_value @@ -1593,21 +1525,19 @@ after_first_database_work: switch(rd->algorithm) { case RRD_ALGORITHM_ABSOLUTE: - rd->calculated_value = (calculated_number)rd->collected_value - * (calculated_number)rd->multiplier - / (calculated_number)rd->divisor; + rd->calculated_value = (NETDATA_DOUBLE)rd->collected_value + * (NETDATA_DOUBLE)rd->multiplier + / (NETDATA_DOUBLE)rd->divisor; #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: CALC ABS/ABS-NO-IN " - CALCULATED_NUMBER_FORMAT " = " + rrdset_debug(st, "%s: CALC ABS/ABS-NO-IN " NETDATA_DOUBLE_FORMAT " = " COLLECTED_NUMBER_FORMAT - " * " CALCULATED_NUMBER_FORMAT - " / " CALCULATED_NUMBER_FORMAT - , rd->name + " * " NETDATA_DOUBLE_FORMAT + " / " NETDATA_DOUBLE_FORMAT, rd->name , rd->calculated_value , rd->collected_value - , (calculated_number)rd->multiplier - , (calculated_number)rd->divisor + , (NETDATA_DOUBLE)rd->multiplier + , (NETDATA_DOUBLE)rd->divisor ); #endif @@ -1620,13 +1550,12 @@ after_first_database_work: // the percentage of the current value // over the total of all dimensions rd->calculated_value = - (calculated_number)100 - * (calculated_number)rd->collected_value - / (calculated_number)st->collected_total; + (NETDATA_DOUBLE)100 + * (NETDATA_DOUBLE)rd->collected_value + / (NETDATA_DOUBLE)st->collected_total; #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: CALC PCENT-ROW " - CALCULATED_NUMBER_FORMAT " = 100" + rrdset_debug(st, "%s: CALC PCENT-ROW " NETDATA_DOUBLE_FORMAT " = 100" " * " COLLECTED_NUMBER_FORMAT " / " COLLECTED_NUMBER_FORMAT , rd->name @@ -1677,34 +1606,32 @@ after_first_database_work: // TODO: remember recent history of rates and compare with current rate to reduce this chance. if (delta < max_acceptable_rate) { rd->calculated_value += - (calculated_number) delta - * (calculated_number) rd->multiplier - / (calculated_number) rd->divisor; + (NETDATA_DOUBLE) delta + * (NETDATA_DOUBLE) rd->multiplier + / (NETDATA_DOUBLE) rd->divisor; } else { // This is a reset. Any overflow with a rate greater than MAX_INCREMENTAL_PERCENT_RATE will also // be detected as a reset instead. - rd->calculated_value += (calculated_number)0; + rd->calculated_value += (NETDATA_DOUBLE)0; } } else { rd->calculated_value += - (calculated_number) (rd->collected_value - rd->last_collected_value) - * (calculated_number) rd->multiplier - / (calculated_number) rd->divisor; + (NETDATA_DOUBLE) (rd->collected_value - rd->last_collected_value) + * (NETDATA_DOUBLE) rd->multiplier + / (NETDATA_DOUBLE) rd->divisor; } #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: CALC INC PRE " - CALCULATED_NUMBER_FORMAT " = (" + rrdset_debug(st, "%s: CALC INC PRE " NETDATA_DOUBLE_FORMAT " = (" COLLECTED_NUMBER_FORMAT " - " COLLECTED_NUMBER_FORMAT ")" - " * " CALCULATED_NUMBER_FORMAT - " / " CALCULATED_NUMBER_FORMAT - , rd->name + " * " NETDATA_DOUBLE_FORMAT + " / " NETDATA_DOUBLE_FORMAT, rd->name , rd->calculated_value , rd->collected_value, rd->last_collected_value - , (calculated_number)rd->multiplier - , (calculated_number)rd->divisor + , (NETDATA_DOUBLE)rd->multiplier + , (NETDATA_DOUBLE)rd->divisor ); #endif @@ -1737,13 +1664,12 @@ after_first_database_work: rd->calculated_value = 0; else rd->calculated_value = - (calculated_number)100 - * (calculated_number)(rd->collected_value - rd->last_collected_value) - / (calculated_number)(st->collected_total - st->last_collected_total); + (NETDATA_DOUBLE)100 + * (NETDATA_DOUBLE)(rd->collected_value - rd->last_collected_value) + / (NETDATA_DOUBLE)(st->collected_total - st->last_collected_total); #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: CALC PCENT-DIFF " - CALCULATED_NUMBER_FORMAT " = 100" + rrdset_debug(st, "%s: CALC PCENT-DIFF " NETDATA_DOUBLE_FORMAT " = 100" " * (" COLLECTED_NUMBER_FORMAT " - " COLLECTED_NUMBER_FORMAT ")" " / (" COLLECTED_NUMBER_FORMAT " - " COLLECTED_NUMBER_FORMAT ")" , rd->name @@ -1761,8 +1687,7 @@ after_first_database_work: rd->calculated_value = 0; #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: CALC " - CALCULATED_NUMBER_FORMAT " = 0" + rrdset_debug(st, "%s: CALC " NETDATA_DOUBLE_FORMAT " = 0" , rd->name , rd->calculated_value ); @@ -1775,9 +1700,8 @@ after_first_database_work: rrdset_debug(st, "%s: PHASE2 " " last_collected_value = " COLLECTED_NUMBER_FORMAT " collected_value = " COLLECTED_NUMBER_FORMAT - " last_calculated_value = " CALCULATED_NUMBER_FORMAT - " calculated_value = " CALCULATED_NUMBER_FORMAT - , rd->name + " last_calculated_value = " NETDATA_DOUBLE_FORMAT + " calculated_value = " NETDATA_DOUBLE_FORMAT, rd->name , rd->last_collected_value , rd->collected_value , rd->last_calculated_value @@ -1791,10 +1715,10 @@ after_first_database_work: // it is now time to interpolate values on a second boundary #ifdef NETDATA_INTERNAL_CHECKS - if(unlikely(now_collect_ut < next_store_ut)) { + if(unlikely(now_collect_ut < next_store_ut && st->counter_done > 1)) { // this is collected in the same interpolation point rrdset_debug(st, "THIS IS IN THE SAME INTERPOLATION POINT"); - info("INTERNAL CHECK: host '%s', chart '%s' is collected in the same interpolation point: short by %llu microseconds", st->rrdhost->hostname, st->name, next_store_ut - now_collect_ut); + info("INTERNAL CHECK: host '%s', chart '%s' collection %zu is in the same interpolation point: short by %llu microseconds", st->rrdhost->hostname, st->name, st->counter_done, next_store_ut - now_collect_ut); } #endif @@ -1811,14 +1735,14 @@ after_first_database_work: after_second_database_work: st->last_collected_total = st->collected_total; -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK time_t mark = now_realtime_sec(); #endif rrddim_foreach_read(rd, st) { if (rrddim_flag_check(rd, RRDDIM_FLAG_ARCHIVED)) continue; -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK if (likely(!st->state->is_ar_chart)) { if (!rrddim_flag_check(rd, RRDDIM_FLAG_HIDDEN) && likely(rrdset_flag_check(st, RRDSET_FLAG_ACLK))) queue_dimension_to_aclk(rd, calc_dimension_liveness(rd, mark)); @@ -1837,7 +1761,8 @@ after_second_database_work: case RRD_ALGORITHM_INCREMENTAL: if(unlikely(!first_entry)) { #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: setting last_calculated_value (old: " CALCULATED_NUMBER_FORMAT ") to last_calculated_value (new: " CALCULATED_NUMBER_FORMAT ")", rd->name, rd->last_calculated_value + rd->calculated_value, rd->calculated_value); + rrdset_debug(st, "%s: setting last_calculated_value (old: " NETDATA_DOUBLE_FORMAT + ") to last_calculated_value (new: " NETDATA_DOUBLE_FORMAT ")", rd->name, rd->last_calculated_value + rd->calculated_value, rd->calculated_value); #endif rd->last_calculated_value += rd->calculated_value; @@ -1853,7 +1778,8 @@ after_second_database_work: case RRD_ALGORITHM_PCENT_OVER_ROW_TOTAL: case RRD_ALGORITHM_PCENT_OVER_DIFF_TOTAL: #ifdef NETDATA_INTERNAL_CHECKS - rrdset_debug(st, "%s: setting last_calculated_value (old: " CALCULATED_NUMBER_FORMAT ") to last_calculated_value (new: " CALCULATED_NUMBER_FORMAT ")", rd->name, rd->last_calculated_value, rd->calculated_value); + rrdset_debug(st, "%s: setting last_calculated_value (old: " NETDATA_DOUBLE_FORMAT + ") to last_calculated_value (new: " NETDATA_DOUBLE_FORMAT ")", rd->name, rd->last_calculated_value, rd->calculated_value); #endif rd->last_calculated_value = rd->calculated_value; @@ -1868,9 +1794,8 @@ after_second_database_work: rrdset_debug(st, "%s: END " " last_collected_value = " COLLECTED_NUMBER_FORMAT " collected_value = " COLLECTED_NUMBER_FORMAT - " last_calculated_value = " CALCULATED_NUMBER_FORMAT - " calculated_value = " CALCULATED_NUMBER_FORMAT - , rd->name + " last_calculated_value = " NETDATA_DOUBLE_FORMAT + " calculated_value = " NETDATA_DOUBLE_FORMAT, rd->name , rd->last_collected_value , rd->collected_value , rd->last_calculated_value @@ -1883,15 +1808,24 @@ after_second_database_work: // ALL DONE ABOUT THE DATA UPDATE // -------------------------------------------------------------------- - // find if there are any obsolete dimensions - time_t now = now_realtime_sec(); + if(unlikely(st->rrd_memory_mode == RRD_MEMORY_MODE_MAP)) { + // update the memory mapped files with the latest values + rrdset_memory_file_update(st); + rrddim_foreach_read(rd, st) { + rrddim_memory_file_update(rd); + } + } + + // find if there are any obsolete dimensions if(unlikely(rrdset_flag_check(st, RRDSET_FLAG_OBSOLETE_DIMENSIONS))) { rrddim_foreach_read(rd, st) if(unlikely(rrddim_flag_check(rd, RRDDIM_FLAG_OBSOLETE))) break; if(unlikely(rd)) { + time_t now = now_realtime_sec(); + RRDDIM *last; // there is a dimension to free // upgrade our read lock to a write lock @@ -1903,10 +1837,11 @@ after_second_database_work: && (rd->last_collected_time.tv_sec + rrdset_free_obsolete_time < now))) { info("Removing obsolete dimension '%s' (%s) of '%s' (%s).", rd->name, rd->id, st->name, st->id); - if(likely(rd->rrd_memory_mode == RRD_MEMORY_MODE_SAVE || rd->rrd_memory_mode == RRD_MEMORY_MODE_MAP)) { - info("Deleting dimension file '%s'.", rd->cache_filename); - if(unlikely(unlink(rd->cache_filename) == -1)) - error("Cannot delete dimension file '%s'", rd->cache_filename); + const char *cache_filename = rrddim_cache_filename(rd); + if(cache_filename) { + info("Deleting dimension file '%s'.", cache_filename); + if (unlikely(unlink(cache_filename) == -1)) + error("Cannot delete dimension file '%s'", cache_filename); } #ifdef ENABLE_DBENGINE @@ -1917,13 +1852,25 @@ after_second_database_work: rrddim_flag_clear(rd, RRDDIM_FLAG_OBSOLETE); /* only a collector can mark a chart as obsolete, so we must remove the reference */ - uint8_t can_delete_metric = rd->state->collect_ops.finalize(rd); - if (can_delete_metric) { + + size_t tiers_available = 0, tiers_said_yes = 0; + for(int tier = 0; tier < storage_tiers ;tier++) { + if(rd->tiers[tier]) { + tiers_available++; + + if(rd->tiers[tier]->collect_ops.finalize(rd->tiers[tier]->db_collection_handle)) + tiers_said_yes++; + + rd->tiers[tier]->db_collection_handle = NULL; + } + } + + if (tiers_available == tiers_said_yes && tiers_said_yes) { /* This metric has no data and no references */ - delete_dimension_uuid(&rd->state->metric_uuid); + delete_dimension_uuid(&rd->metric_uuid); } else { /* Do not delete this dimension */ -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK queue_dimension_to_aclk(rd, calc_dimension_liveness(rd, mark)); #endif last = rd; @@ -1958,102 +1905,208 @@ after_second_database_work: netdata_thread_enable_cancelability(); } -void rrdset_add_label_to_new_list(RRDSET *st, char *key, char *value, LABEL_SOURCE source) -{ - st->state->new_labels = add_label_to_list(st->state->new_labels, key, value, source); -} -void rrdset_finalize_labels(RRDSET *st) -{ - struct label *new_labels = st->state->new_labels; - struct label_index *labels = &st->state->labels; +// ---------------------------------------------------------------------------- +// compatibility layer for RRDSET files v019 + +#define RRDSET_MAGIC_V019 "NETDATA RRD SET FILE V019" +#define RRD_ID_LENGTH_MAX_V019 200 + +struct avl_element_v019 { + void *avl_link[2]; + signed char avl_balance; +}; +struct avl_tree_type_v019 { + void *root; + int (*compar)(void *a, void *b); +}; +struct avl_tree_lock_v019 { + struct avl_tree_type_v019 avl_tree; + pthread_rwlock_t rwlock; +}; +struct rrdset_map_save_v019 { + struct avl_element_v019 avl; // ignored + struct avl_element_v019 avlname; // ignored + char id[RRD_ID_LENGTH_MAX_V019 + 1]; // check to reset all - update on load + void *name; // ignored + void *unused_ptr; // ignored + void *type; // ignored + void *family; // ignored + void *title; // ignored + void *units; // ignored + void *context; // ignored + uint32_t hash_context; // ignored + uint32_t chart_type; // ignored + int update_every; // check to reset all - update on load + long entries; // check to reset all - update on load + long current_entry; // NEEDS TO BE UPDATED - FIXED ON LOAD + uint32_t flags; // ignored + void *exporting_flags; // ignored + int gap_when_lost_iterations_above; // ignored + long priority; // ignored + uint32_t rrd_memory_mode; // ignored + void *cache_dir; // ignored + char cache_filename[FILENAME_MAX+1]; // ignored - update on load + pthread_rwlock_t rrdset_rwlock; // ignored + size_t counter; // NEEDS TO BE UPDATED - maintained on load + size_t counter_done; // ignored + union { // + time_t last_accessed_time; // ignored + time_t last_entry_t; // ignored + }; // + time_t upstream_resync_time; // ignored + void *plugin_name; // ignored + void *module_name; // ignored + void *chart_uuid; // ignored + void *state; // ignored + size_t unused[3]; // ignored + size_t rrddim_page_alignment; // ignored + uint32_t hash; // ignored + uint32_t hash_name; // ignored + usec_t usec_since_last_update; // NEEDS TO BE UPDATED - maintained on load + struct timeval last_updated; // NEEDS TO BE UPDATED - check to reset all - fixed on load + struct timeval last_collected_time; // ignored + long long collected_total; // NEEDS TO BE UPDATED - maintained on load + long long last_collected_total; // NEEDS TO BE UPDATED - maintained on load + void *rrdfamily; // ignored + void *rrdhost; // ignored + void *next; // ignored + long double green; // ignored + long double red; // ignored + struct avl_tree_lock_v019 rrdvar_root_index; // ignored + void *variables; // ignored + void *alarms; // ignored + unsigned long memsize; // check to reset all - update on load + char magic[sizeof(RRDSET_MAGIC_V019) + 1]; // check to reset all - update on load + struct avl_tree_lock_v019 dimensions_index; // ignored + void *dimensions; // ignored +}; + +void rrdset_memory_file_update(RRDSET *st) { + if(!st->st_on_file) return; + struct rrdset_map_save_v019 *st_on_file = st->st_on_file; + + st_on_file->current_entry = st->current_entry; + st_on_file->counter = st->counter; + st_on_file->usec_since_last_update = st->usec_since_last_update; + st_on_file->last_updated.tv_sec = st->last_updated.tv_sec; + st_on_file->last_updated.tv_usec = st->last_updated.tv_usec; + st_on_file->collected_total = st->collected_total; + st_on_file->last_collected_total = st->last_collected_total; +} - if (!labels->head) { - labels->head = new_labels; - } else { - replace_label_list(labels, new_labels); - } +const char *rrdset_cache_filename(RRDSET *st) { + if(!st->st_on_file) return NULL; + struct rrdset_map_save_v019 *st_on_file = st->st_on_file; + return st_on_file->cache_filename; +} - netdata_rwlock_rdlock(&labels->labels_rwlock); - struct label *lbl = labels->head; - while (lbl) { - sql_store_chart_label(st->chart_uuid, (int)lbl->label_source, lbl->key, lbl->value); - lbl = lbl->next; - } - netdata_rwlock_unlock(&labels->labels_rwlock); +void rrdset_memory_file_free(RRDSET *st) { + if(!st->st_on_file) return; - st->state->new_labels = NULL; -} + // needed for memory mode map, to save the latest state + rrdset_memory_file_update(st); -void rrdset_update_labels(RRDSET *st, struct label *labels) -{ - if (!labels) - return; + struct rrdset_map_save_v019 *st_on_file = st->st_on_file; + munmap(st_on_file, st_on_file->memsize); - update_label_list(&st->state->new_labels, labels); - rrdset_finalize_labels(st); + // remove the pointers from the RRDDIM + st->st_on_file = NULL; } -int rrdset_contains_label_keylist(RRDSET *st, char *keylist) -{ - struct label_index *labels = &st->state->labels; - int ret; +void rrdset_memory_file_save(RRDSET *st) { + if(!st->st_on_file) return; - if (!labels->head) - return 0; + rrdset_memory_file_update(st); - netdata_rwlock_rdlock(&labels->labels_rwlock); - ret = label_list_contains_keylist(labels->head, keylist); - netdata_rwlock_unlock(&labels->labels_rwlock); + struct rrdset_map_save_v019 *st_on_file = st->st_on_file; + if(st_on_file->rrd_memory_mode != RRD_MEMORY_MODE_SAVE) return; - return ret; + memory_file_save(st_on_file->cache_filename, st->st_on_file, st_on_file->memsize); } -struct label *rrdset_lookup_label_key(RRDSET *st, char *key, uint32_t key_hash) -{ - struct label_index *labels = &st->state->labels; - struct label *ret = NULL; +bool rrdset_memory_load_or_create_map_save(RRDSET *st, RRD_MEMORY_MODE memory_mode) { + if(memory_mode != RRD_MEMORY_MODE_SAVE && memory_mode != RRD_MEMORY_MODE_MAP) + return false; - if (labels->head) { - netdata_rwlock_rdlock(&labels->labels_rwlock); - ret = label_list_lookup_key(labels->head, key, key_hash); - netdata_rwlock_unlock(&labels->labels_rwlock); - } - return ret; -} - -static inline int k8s_space(char c) { - switch(c) { - case ':': - case ',': - return 1; - default: - return 0; - } -} + char fullfilename[FILENAME_MAX + 1]; + snprintfz(fullfilename, FILENAME_MAX, "%s/main.db", st->cache_dir); -int rrdset_matches_label_keys(RRDSET *st, char *keylist, char *words[], uint32_t *hash_key_list, int *word_count, int size) -{ - struct label_index *labels = &st->state->labels; + unsigned long size = sizeof(struct rrdset_map_save_v019); + struct rrdset_map_save_v019 *st_on_file = (struct rrdset_map_save_v019 *)netdata_mmap( + fullfilename, size, + ((memory_mode == RRD_MEMORY_MODE_MAP) ? MAP_SHARED : MAP_PRIVATE), + 0); - if (!labels->head) - return 0; + if(!st_on_file) return false; - struct label *one_label; + time_t now = now_realtime_sec(); - if (!*word_count) { - *word_count = quoted_strings_splitter(keylist, words, size, k8s_space, NULL, NULL, 0); - for (int i = 0; i < *word_count - 1; i += 2) { - hash_key_list[i] = simple_hash(words[i]); - } + st_on_file->magic[sizeof(RRDSET_MAGIC_V019)] = '\0'; + if(strcmp(st_on_file->magic, RRDSET_MAGIC_V019) != 0) { + info("Initializing file '%s'.", fullfilename); + memset(st_on_file, 0, size); + } + else if(strncmp(st_on_file->id, st->id, RRD_ID_LENGTH_MAX_V019) != 0) { + error("File '%s' contents are not for chart '%s'. Clearing it.", fullfilename, st->id); + memset(st_on_file, 0, size); + } + else if(st_on_file->memsize != size || st_on_file->entries != st->entries) { + error("File '%s' does not have the desired size. Clearing it.", fullfilename); + memset(st_on_file, 0, size); + } + else if(st_on_file->update_every != st->update_every) { + error("File '%s' does not have the desired granularity. Clearing it.", fullfilename); + memset(st_on_file, 0, size); + } + else if((now - st_on_file->last_updated.tv_sec) > st->update_every * st->entries) { + info("File '%s' is too old. Clearing it.", fullfilename); + memset(st_on_file, 0, size); + } + else if(st_on_file->last_updated.tv_sec > now + st->update_every) { + error("File '%s' refers to the future by %zd secs. Resetting it to now.", fullfilename, (ssize_t)(st_on_file->last_updated.tv_sec - now)); + st_on_file->last_updated.tv_sec = now; } - int ret = 1; - netdata_rwlock_rdlock(&labels->labels_rwlock); - for (int i = 0; ret && i < *word_count - 1; i += 2) { - one_label = label_list_lookup_key(labels->head, words[i], hash_key_list[i]); - ret = (one_label && !strcmp(one_label->value, words[i + 1])); + if(st_on_file->current_entry >= st_on_file->entries) + st_on_file->current_entry = 0; + + // make sure the database is aligned + bool align_last_updated = false; + if(st_on_file->last_updated.tv_sec) { + st_on_file->update_every = st->update_every; + align_last_updated = true; } - netdata_rwlock_unlock(&labels->labels_rwlock); - return ret; + + // copy the useful values to st + st->current_entry = st_on_file->current_entry; + st->counter = st_on_file->counter; + st->usec_since_last_update = st_on_file->usec_since_last_update; + st->last_updated.tv_sec = st_on_file->last_updated.tv_sec; + st->last_updated.tv_usec = st_on_file->last_updated.tv_usec; + st->collected_total = st_on_file->collected_total; + st->last_collected_total = st_on_file->last_collected_total; + + // link it to st + st->st_on_file = st_on_file; + + // clear everything + memset(st_on_file, 0, size); + + // set the values we need + strncpyz(st_on_file->id, st->id, RRD_ID_LENGTH_MAX_V019 + 1); + strcpy(st_on_file->cache_filename, fullfilename); + strcpy(st_on_file->magic, RRDSET_MAGIC_V019); + st_on_file->memsize = size; + st_on_file->entries = st->entries; + st_on_file->update_every = st->update_every; + st_on_file->rrd_memory_mode = memory_mode; + + if(align_last_updated) + last_updated_time_align(st); + + // copy the useful values back to st_on_file + rrdset_memory_file_update(st); + + return true; } diff --git a/database/rrdsetvar.c b/database/rrdsetvar.c index 9da419304..e520764a2 100644 --- a/database/rrdsetvar.c +++ b/database/rrdsetvar.c @@ -163,7 +163,7 @@ RRDSETVAR *rrdsetvar_custom_chart_variable_create(RRDSET *st, const char *name) // not found, allocate one - calculated_number *v = mallocz(sizeof(calculated_number)); + NETDATA_DOUBLE *v = mallocz(sizeof(NETDATA_DOUBLE)); *v = NAN; rs = rrdsetvar_create(st, n, RRDVAR_TYPE_CALCULATED, v, RRDVAR_OPTION_ALLOCATED|RRDVAR_OPTION_CUSTOM_CHART_VAR); @@ -173,12 +173,13 @@ RRDSETVAR *rrdsetvar_custom_chart_variable_create(RRDSET *st, const char *name) return rs; } -void rrdsetvar_custom_chart_variable_set(RRDSETVAR *rs, calculated_number value) { +void rrdsetvar_custom_chart_variable_set(RRDSETVAR *rs, NETDATA_DOUBLE value) { if(rs->type != RRDVAR_TYPE_CALCULATED || !(rs->options & RRDVAR_OPTION_CUSTOM_CHART_VAR) || !(rs->options & RRDVAR_OPTION_ALLOCATED)) { - error("RRDSETVAR: requested to set variable '%s' of chart '%s' on host '%s' to value " CALCULATED_NUMBER_FORMAT " but the variable is not a custom chart one.", rs->variable, rs->rrdset->id, rs->rrdset->rrdhost->hostname, value); + error("RRDSETVAR: requested to set variable '%s' of chart '%s' on host '%s' to value " NETDATA_DOUBLE_FORMAT + " but the variable is not a custom chart one.", rs->variable, rs->rrdset->id, rs->rrdset->rrdhost->hostname, value); } else { - calculated_number *v = rs->value; + NETDATA_DOUBLE *v = rs->value; if(*v != value) { *v = value; diff --git a/database/rrdsetvar.h b/database/rrdsetvar.h index 34a26d2f0..37f4da959 100644 --- a/database/rrdsetvar.h +++ b/database/rrdsetvar.h @@ -35,7 +35,7 @@ struct rrdsetvar { }; extern RRDSETVAR *rrdsetvar_custom_chart_variable_create(RRDSET *st, const char *name); -extern void rrdsetvar_custom_chart_variable_set(RRDSETVAR *rv, calculated_number value); +extern void rrdsetvar_custom_chart_variable_set(RRDSETVAR *rv, NETDATA_DOUBLE value); extern void rrdsetvar_rename_all(RRDSET *st); extern RRDSETVAR *rrdsetvar_create(RRDSET *st, const char *variable, RRDVAR_TYPE type, void *value, RRDVAR_OPTIONS options); diff --git a/database/rrdvar.c b/database/rrdvar.c index 25b8ca69e..d4dda1079 100644 --- a/database/rrdvar.c +++ b/database/rrdvar.c @@ -133,7 +133,7 @@ inline int rrdvar_callback_for_all_host_variables(RRDHOST *host, int (*callback) } static RRDVAR *rrdvar_custom_variable_create(const char *scope, avl_tree_lock *tree_lock, const char *name) { - calculated_number *v = callocz(1, sizeof(calculated_number)); + NETDATA_DOUBLE *v = callocz(1, sizeof(NETDATA_DOUBLE)); *v = NAN; RRDVAR *rv = rrdvar_create_and_index(scope, tree_lock, name, RRDVAR_TYPE_CALCULATED, RRDVAR_OPTION_CUSTOM_HOST_VAR|RRDVAR_OPTION_ALLOCATED, v); @@ -158,11 +158,11 @@ RRDVAR *rrdvar_custom_host_variable_create(RRDHOST *host, const char *name) { return rrdvar_custom_variable_create("host", &host->rrdvar_root_index, name); } -void rrdvar_custom_host_variable_set(RRDHOST *host, RRDVAR *rv, calculated_number value) { +void rrdvar_custom_host_variable_set(RRDHOST *host, RRDVAR *rv, NETDATA_DOUBLE value) { if(rv->type != RRDVAR_TYPE_CALCULATED || !(rv->options & RRDVAR_OPTION_CUSTOM_HOST_VAR) || !(rv->options & RRDVAR_OPTION_ALLOCATED)) - error("requested to set variable '%s' to value " CALCULATED_NUMBER_FORMAT " but the variable is not a custom one.", rv->name, value); + error("requested to set variable '%s' to value " NETDATA_DOUBLE_FORMAT " but the variable is not a custom one.", rv->name, value); else { - calculated_number *v = rv->value; + NETDATA_DOUBLE *v = rv->value; if(*v != value) { *v = value; @@ -181,10 +181,10 @@ int foreach_host_variable_callback(RRDHOST *host, int (*callback)(RRDVAR * /*rv* // ---------------------------------------------------------------------------- // RRDVAR lookup -calculated_number rrdvar2number(RRDVAR *rv) { +NETDATA_DOUBLE rrdvar2number(RRDVAR *rv) { switch(rv->type) { case RRDVAR_TYPE_CALCULATED: { - calculated_number *n = (calculated_number *)rv->value; + NETDATA_DOUBLE *n = (NETDATA_DOUBLE *)rv->value; return *n; } @@ -209,12 +209,12 @@ calculated_number rrdvar2number(RRDVAR *rv) { } default: - error("I don't know how to convert RRDVAR type %u to calculated_number", rv->type); + error("I don't know how to convert RRDVAR type %u to NETDATA_DOUBLE", rv->type); return NAN; } } -int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, calculated_number *result) { +int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, NETDATA_DOUBLE *result) { RRDSET *st = rc->rrdset; if(!st) return 0; @@ -254,13 +254,13 @@ struct variable2json_helper { static int single_variable2json(void *entry, void *data) { struct variable2json_helper *helper = (struct variable2json_helper *)data; RRDVAR *rv = (RRDVAR *)entry; - calculated_number value = rrdvar2number(rv); + NETDATA_DOUBLE value = rrdvar2number(rv); if (helper->options == RRDVAR_OPTION_DEFAULT || rv->options & helper->options) { if(unlikely(isnan(value) || isinf(value))) buffer_sprintf(helper->buf, "%s\n\t\t\"%s\": null", helper->counter?",":"", rv->name); else - buffer_sprintf(helper->buf, "%s\n\t\t\"%s\": %0.5" LONG_DOUBLE_MODIFIER, helper->counter?",":"", rv->name, (LONG_DOUBLE)value); + buffer_sprintf(helper->buf, "%s\n\t\t\"%s\": %0.5" NETDATA_DOUBLE_MODIFIER, helper->counter?",":"", rv->name, (NETDATA_DOUBLE)value); helper->counter++; } diff --git a/database/rrdvar.h b/database/rrdvar.h index ec6e80a43..9074edcdb 100644 --- a/database/rrdvar.h +++ b/database/rrdvar.h @@ -52,13 +52,13 @@ extern int rrdvar_fix_name(char *variable); #include "rrd.h" extern RRDVAR *rrdvar_custom_host_variable_create(RRDHOST *host, const char *name); -extern void rrdvar_custom_host_variable_set(RRDHOST *host, RRDVAR *rv, calculated_number value); +extern void rrdvar_custom_host_variable_set(RRDHOST *host, RRDVAR *rv, NETDATA_DOUBLE value); extern int foreach_host_variable_callback(RRDHOST *host, int (*callback)(RRDVAR *rv, void *data), void *data); extern void rrdvar_free_remaining_variables(RRDHOST *host, avl_tree_lock *tree_lock); extern int rrdvar_callback_for_all_host_variables(RRDHOST *host, int (*callback)(void *rrdvar, void *data), void *data); -extern calculated_number rrdvar2number(RRDVAR *rv); +extern NETDATA_DOUBLE rrdvar2number(RRDVAR *rv); extern RRDVAR *rrdvar_create_and_index(const char *scope, avl_tree_lock *tree, const char *name, RRDVAR_TYPE type, RRDVAR_OPTIONS options, void *value); extern void rrdvar_free(RRDHOST *host, avl_tree_lock *tree, RRDVAR *rv); diff --git a/database/sqlite/sqlite3.c b/database/sqlite/sqlite3.c index 61a74f059..296de3e74 100644 --- a/database/sqlite/sqlite3.c +++ b/database/sqlite/sqlite3.c @@ -1,6 +1,6 @@ /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite -** version 3.36.0. By combining all the individual C code files into this +** version 3.38.5. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a single translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements @@ -24,795 +24,10 @@ # define SQLITE_PRIVATE static #endif #define SQLITE_UDL_CAPABLE_PARSER 1 -/************** Begin file ctime.c *******************************************/ -/* -** 2010 February 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file implements routines used to report what compile-time options -** SQLite was built with. -*/ #define SQLITE_ENABLE_UPDATE_DELETE_LIMIT 1 #define SQLITE_OMIT_LOAD_EXTENSION 1 #define SQLITE_ENABLE_DBSTAT_VTAB 1 -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */ - -/* -** Include the configuration header output by 'configure' if we're using the -** autoconf-based build -*/ -#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -#include "config.h" -#define SQLITECONFIG_H 1 -#endif - -/* These macros are provided to "stringify" the value of the define -** for those options in which the value is meaningful. */ -#define CTIMEOPT_VAL_(opt) #opt -#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) - -/* Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This -** option requires a separate macro because legal values contain a single -** comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE="100,100") */ -#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2 -#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt) -/* -** An array of names of all compile-time options. This array should -** be sorted A-Z. -** -** This array looks large, but in a typical installation actually uses -** only a handful of compile-time options, so most times this array is usually -** rather short and uses little memory space. -*/ -static const char * const sqlite3azCompileOpt[] = { - -/* -** BEGIN CODE GENERATED BY tool/mkctime.tcl -*/ -#if SQLITE_32BIT_ROWID - "32BIT_ROWID", -#endif -#if SQLITE_4_BYTE_ALIGNED_MALLOC - "4_BYTE_ALIGNED_MALLOC", -#endif -#if SQLITE_64BIT_STATS - "64BIT_STATS", -#endif -#ifdef SQLITE_ALLOW_COVERING_INDEX_SCAN -# if SQLITE_ALLOW_COVERING_INDEX_SCAN != 1 - "ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN), -# endif -#endif -#if SQLITE_ALLOW_URI_AUTHORITY - "ALLOW_URI_AUTHORITY", -#endif -#ifdef SQLITE_BITMASK_TYPE - "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE), -#endif -#if SQLITE_BUG_COMPATIBLE_20160819 - "BUG_COMPATIBLE_20160819", -#endif -#if SQLITE_CASE_SENSITIVE_LIKE - "CASE_SENSITIVE_LIKE", -#endif -#if SQLITE_CHECK_PAGES - "CHECK_PAGES", -#endif -#if defined(__clang__) && defined(__clang_major__) - "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." - CTIMEOPT_VAL(__clang_minor__) "." - CTIMEOPT_VAL(__clang_patchlevel__), -#elif defined(_MSC_VER) - "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), -#elif defined(__GNUC__) && defined(__VERSION__) - "COMPILER=gcc-" __VERSION__, -#endif -#if SQLITE_COVERAGE_TEST - "COVERAGE_TEST", -#endif -#if SQLITE_DEBUG - "DEBUG", -#endif -#if SQLITE_DEFAULT_AUTOMATIC_INDEX - "DEFAULT_AUTOMATIC_INDEX", -#endif -#if SQLITE_DEFAULT_AUTOVACUUM - "DEFAULT_AUTOVACUUM", -#endif -#ifdef SQLITE_DEFAULT_CACHE_SIZE - "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE), -#endif -#if SQLITE_DEFAULT_CKPTFULLFSYNC - "DEFAULT_CKPTFULLFSYNC", -#endif -#ifdef SQLITE_DEFAULT_FILE_FORMAT - "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT), -#endif -#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS - "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS), -#endif -#if SQLITE_DEFAULT_FOREIGN_KEYS - "DEFAULT_FOREIGN_KEYS", -#endif -#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT - "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT), -#endif -#ifdef SQLITE_DEFAULT_LOCKING_MODE - "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), -#endif -#ifdef SQLITE_DEFAULT_LOOKASIDE - "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL2(SQLITE_DEFAULT_LOOKASIDE), -#endif -#ifdef SQLITE_DEFAULT_MEMSTATUS -# if SQLITE_DEFAULT_MEMSTATUS != 1 - "DEFAULT_MEMSTATUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_MEMSTATUS), -# endif -#endif -#ifdef SQLITE_DEFAULT_MMAP_SIZE - "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), -#endif -#ifdef SQLITE_DEFAULT_PAGE_SIZE - "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE), -#endif -#ifdef SQLITE_DEFAULT_PCACHE_INITSZ - "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ), -#endif -#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS - "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS), -#endif -#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS - "DEFAULT_RECURSIVE_TRIGGERS", -#endif -#ifdef SQLITE_DEFAULT_ROWEST - "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST), -#endif -#ifdef SQLITE_DEFAULT_SECTOR_SIZE - "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE), -#endif -#ifdef SQLITE_DEFAULT_SYNCHRONOUS - "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS), -#endif -#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT - "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT), -#endif -#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS - "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS), -#endif -#ifdef SQLITE_DEFAULT_WORKER_THREADS - "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS), -#endif -#if SQLITE_DIRECT_OVERFLOW_READ - "DIRECT_OVERFLOW_READ", -#endif -#if SQLITE_DISABLE_DIRSYNC - "DISABLE_DIRSYNC", -#endif -#if SQLITE_DISABLE_FTS3_UNICODE - "DISABLE_FTS3_UNICODE", -#endif -#if SQLITE_DISABLE_FTS4_DEFERRED - "DISABLE_FTS4_DEFERRED", -#endif -#if SQLITE_DISABLE_INTRINSIC - "DISABLE_INTRINSIC", -#endif -#if SQLITE_DISABLE_LFS - "DISABLE_LFS", -#endif -#if SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS - "DISABLE_PAGECACHE_OVERFLOW_STATS", -#endif -#if SQLITE_DISABLE_SKIPAHEAD_DISTINCT - "DISABLE_SKIPAHEAD_DISTINCT", -#endif -#ifdef SQLITE_ENABLE_8_3_NAMES - "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), -#endif -#if SQLITE_ENABLE_API_ARMOR - "ENABLE_API_ARMOR", -#endif -#if SQLITE_ENABLE_ATOMIC_WRITE - "ENABLE_ATOMIC_WRITE", -#endif -#if SQLITE_ENABLE_BATCH_ATOMIC_WRITE - "ENABLE_BATCH_ATOMIC_WRITE", -#endif -#if SQLITE_ENABLE_BYTECODE_VTAB - "ENABLE_BYTECODE_VTAB", -#endif -#ifdef SQLITE_ENABLE_CEROD - "ENABLE_CEROD=" CTIMEOPT_VAL(SQLITE_ENABLE_CEROD), -#endif -#if SQLITE_ENABLE_COLUMN_METADATA - "ENABLE_COLUMN_METADATA", -#endif -#if SQLITE_ENABLE_COLUMN_USED_MASK - "ENABLE_COLUMN_USED_MASK", -#endif -#if SQLITE_ENABLE_COSTMULT - "ENABLE_COSTMULT", -#endif -#if SQLITE_ENABLE_CURSOR_HINTS - "ENABLE_CURSOR_HINTS", -#endif -#if SQLITE_ENABLE_DBPAGE_VTAB - "ENABLE_DBPAGE_VTAB", -#endif -#if SQLITE_ENABLE_DBSTAT_VTAB - "ENABLE_DBSTAT_VTAB", -#endif -#if SQLITE_ENABLE_EXPENSIVE_ASSERT - "ENABLE_EXPENSIVE_ASSERT", -#endif -#if SQLITE_ENABLE_EXPLAIN_COMMENTS - "ENABLE_EXPLAIN_COMMENTS", -#endif -#if SQLITE_ENABLE_FTS3 - "ENABLE_FTS3", -#endif -#if SQLITE_ENABLE_FTS3_PARENTHESIS - "ENABLE_FTS3_PARENTHESIS", -#endif -#if SQLITE_ENABLE_FTS3_TOKENIZER - "ENABLE_FTS3_TOKENIZER", -#endif -#if SQLITE_ENABLE_FTS4 - "ENABLE_FTS4", -#endif -#if SQLITE_ENABLE_FTS5 - "ENABLE_FTS5", -#endif -#if SQLITE_ENABLE_GEOPOLY - "ENABLE_GEOPOLY", -#endif -#if SQLITE_ENABLE_HIDDEN_COLUMNS - "ENABLE_HIDDEN_COLUMNS", -#endif -#if SQLITE_ENABLE_ICU - "ENABLE_ICU", -#endif -#if SQLITE_ENABLE_IOTRACE - "ENABLE_IOTRACE", -#endif -#if SQLITE_ENABLE_JSON1 - "ENABLE_JSON1", -#endif -#if SQLITE_ENABLE_LOAD_EXTENSION - "ENABLE_LOAD_EXTENSION", -#endif -#ifdef SQLITE_ENABLE_LOCKING_STYLE - "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), -#endif -#if SQLITE_ENABLE_MATH_FUNCTIONS - "ENABLE_MATH_FUNCTIONS", -#endif -#if SQLITE_ENABLE_MEMORY_MANAGEMENT - "ENABLE_MEMORY_MANAGEMENT", -#endif -#if SQLITE_ENABLE_MEMSYS3 - "ENABLE_MEMSYS3", -#endif -#if SQLITE_ENABLE_MEMSYS5 - "ENABLE_MEMSYS5", -#endif -#if SQLITE_ENABLE_MULTIPLEX - "ENABLE_MULTIPLEX", -#endif -#if SQLITE_ENABLE_NORMALIZE - "ENABLE_NORMALIZE", -#endif -#if SQLITE_ENABLE_NULL_TRIM - "ENABLE_NULL_TRIM", -#endif -#if SQLITE_ENABLE_OFFSET_SQL_FUNC - "ENABLE_OFFSET_SQL_FUNC", -#endif -#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK - "ENABLE_OVERSIZE_CELL_CHECK", -#endif -#if SQLITE_ENABLE_PREUPDATE_HOOK - "ENABLE_PREUPDATE_HOOK", -#endif -#if SQLITE_ENABLE_QPSG - "ENABLE_QPSG", -#endif -#if SQLITE_ENABLE_RBU - "ENABLE_RBU", -#endif -#if SQLITE_ENABLE_RTREE - "ENABLE_RTREE", -#endif -#if SQLITE_ENABLE_SELECTTRACE - "ENABLE_SELECTTRACE", -#endif -#if SQLITE_ENABLE_SESSION - "ENABLE_SESSION", -#endif -#if SQLITE_ENABLE_SNAPSHOT - "ENABLE_SNAPSHOT", -#endif -#if SQLITE_ENABLE_SORTER_REFERENCES - "ENABLE_SORTER_REFERENCES", -#endif -#if SQLITE_ENABLE_SQLLOG - "ENABLE_SQLLOG", -#endif -#if SQLITE_ENABLE_STAT4 - "ENABLE_STAT4", -#endif -#if SQLITE_ENABLE_STMTVTAB - "ENABLE_STMTVTAB", -#endif -#if SQLITE_ENABLE_STMT_SCANSTATUS - "ENABLE_STMT_SCANSTATUS", -#endif -#if SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION - "ENABLE_UNKNOWN_SQL_FUNCTION", -#endif -#if SQLITE_ENABLE_UNLOCK_NOTIFY - "ENABLE_UNLOCK_NOTIFY", -#endif -#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT - "ENABLE_UPDATE_DELETE_LIMIT", -#endif -#if SQLITE_ENABLE_URI_00_ERROR - "ENABLE_URI_00_ERROR", -#endif -#if SQLITE_ENABLE_VFSTRACE - "ENABLE_VFSTRACE", -#endif -#if SQLITE_ENABLE_WHERETRACE - "ENABLE_WHERETRACE", -#endif -#if SQLITE_ENABLE_ZIPVFS - "ENABLE_ZIPVFS", -#endif -#if SQLITE_EXPLAIN_ESTIMATED_ROWS - "EXPLAIN_ESTIMATED_ROWS", -#endif -#if SQLITE_EXTRA_IFNULLROW - "EXTRA_IFNULLROW", -#endif -#ifdef SQLITE_EXTRA_INIT - "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT), -#endif -#ifdef SQLITE_EXTRA_SHUTDOWN - "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN), -#endif -#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH - "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH), -#endif -#if SQLITE_FTS5_ENABLE_TEST_MI - "FTS5_ENABLE_TEST_MI", -#endif -#if SQLITE_FTS5_NO_WITHOUT_ROWID - "FTS5_NO_WITHOUT_ROWID", -#endif -#if HAVE_ISNAN || SQLITE_HAVE_ISNAN - "HAVE_ISNAN", -#endif -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX -# if SQLITE_HOMEGROWN_RECURSIVE_MUTEX != 1 - "HOMEGROWN_RECURSIVE_MUTEX=" CTIMEOPT_VAL(SQLITE_HOMEGROWN_RECURSIVE_MUTEX), -# endif -#endif -#if SQLITE_IGNORE_AFP_LOCK_ERRORS - "IGNORE_AFP_LOCK_ERRORS", -#endif -#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS - "IGNORE_FLOCK_LOCK_ERRORS", -#endif -#if SQLITE_INLINE_MEMCPY - "INLINE_MEMCPY", -#endif -#if SQLITE_INT64_TYPE - "INT64_TYPE", -#endif -#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX - "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX), -#endif -#if SQLITE_LIKE_DOESNT_MATCH_BLOBS - "LIKE_DOESNT_MATCH_BLOBS", -#endif -#if SQLITE_LOCK_TRACE - "LOCK_TRACE", -#endif -#if SQLITE_LOG_CACHE_SPILL - "LOG_CACHE_SPILL", -#endif -#ifdef SQLITE_MALLOC_SOFT_LIMIT - "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT), -#endif -#ifdef SQLITE_MAX_ATTACHED - "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED), -#endif -#ifdef SQLITE_MAX_COLUMN - "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN), -#endif -#ifdef SQLITE_MAX_COMPOUND_SELECT - "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT), -#endif -#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE - "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE), -#endif -#ifdef SQLITE_MAX_EXPR_DEPTH - "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH), -#endif -#ifdef SQLITE_MAX_FUNCTION_ARG - "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG), -#endif -#ifdef SQLITE_MAX_LENGTH - "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH), -#endif -#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH - "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH), -#endif -#ifdef SQLITE_MAX_MEMORY - "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY), -#endif -#ifdef SQLITE_MAX_MMAP_SIZE - "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE), -#endif -#ifdef SQLITE_MAX_MMAP_SIZE_ - "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_), -#endif -#ifdef SQLITE_MAX_PAGE_COUNT - "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT), -#endif -#ifdef SQLITE_MAX_PAGE_SIZE - "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE), -#endif -#ifdef SQLITE_MAX_SCHEMA_RETRY - "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), -#endif -#ifdef SQLITE_MAX_SQL_LENGTH - "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH), -#endif -#ifdef SQLITE_MAX_TRIGGER_DEPTH - "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH), -#endif -#ifdef SQLITE_MAX_VARIABLE_NUMBER - "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER), -#endif -#ifdef SQLITE_MAX_VDBE_OP - "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP), -#endif -#ifdef SQLITE_MAX_WORKER_THREADS - "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS), -#endif -#if SQLITE_MEMDEBUG - "MEMDEBUG", -#endif -#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT - "MIXED_ENDIAN_64BIT_FLOAT", -#endif -#if SQLITE_MMAP_READWRITE - "MMAP_READWRITE", -#endif -#if SQLITE_MUTEX_NOOP - "MUTEX_NOOP", -#endif -#if SQLITE_MUTEX_OMIT - "MUTEX_OMIT", -#endif -#if SQLITE_MUTEX_PTHREADS - "MUTEX_PTHREADS", -#endif -#if SQLITE_MUTEX_W32 - "MUTEX_W32", -#endif -#if SQLITE_NEED_ERR_NAME - "NEED_ERR_NAME", -#endif -#if SQLITE_NOINLINE - "NOINLINE", -#endif -#if SQLITE_NO_SYNC - "NO_SYNC", -#endif -#if SQLITE_OMIT_ALTERTABLE - "OMIT_ALTERTABLE", -#endif -#if SQLITE_OMIT_ANALYZE - "OMIT_ANALYZE", -#endif -#if SQLITE_OMIT_ATTACH - "OMIT_ATTACH", -#endif -#if SQLITE_OMIT_AUTHORIZATION - "OMIT_AUTHORIZATION", -#endif -#if SQLITE_OMIT_AUTOINCREMENT - "OMIT_AUTOINCREMENT", -#endif -#if SQLITE_OMIT_AUTOINIT - "OMIT_AUTOINIT", -#endif -#if SQLITE_OMIT_AUTOMATIC_INDEX - "OMIT_AUTOMATIC_INDEX", -#endif -#if SQLITE_OMIT_AUTORESET - "OMIT_AUTORESET", -#endif -#if SQLITE_OMIT_AUTOVACUUM - "OMIT_AUTOVACUUM", -#endif -#if SQLITE_OMIT_BETWEEN_OPTIMIZATION - "OMIT_BETWEEN_OPTIMIZATION", -#endif -#if SQLITE_OMIT_BLOB_LITERAL - "OMIT_BLOB_LITERAL", -#endif -#if SQLITE_OMIT_CAST - "OMIT_CAST", -#endif -#if SQLITE_OMIT_CHECK - "OMIT_CHECK", -#endif -#if SQLITE_OMIT_COMPLETE - "OMIT_COMPLETE", -#endif -#if SQLITE_OMIT_COMPOUND_SELECT - "OMIT_COMPOUND_SELECT", -#endif -#if SQLITE_OMIT_CONFLICT_CLAUSE - "OMIT_CONFLICT_CLAUSE", -#endif -#if SQLITE_OMIT_CTE - "OMIT_CTE", -#endif -#if defined(SQLITE_OMIT_DATETIME_FUNCS) || defined(SQLITE_OMIT_FLOATING_POINT) - "OMIT_DATETIME_FUNCS", -#endif -#if SQLITE_OMIT_DECLTYPE - "OMIT_DECLTYPE", -#endif -#if SQLITE_OMIT_DEPRECATED - "OMIT_DEPRECATED", -#endif -#if SQLITE_OMIT_DESERIALIZE - "OMIT_DESERIALIZE", -#endif -#if SQLITE_OMIT_DISKIO - "OMIT_DISKIO", -#endif -#if SQLITE_OMIT_EXPLAIN - "OMIT_EXPLAIN", -#endif -#if SQLITE_OMIT_FLAG_PRAGMAS - "OMIT_FLAG_PRAGMAS", -#endif -#if SQLITE_OMIT_FLOATING_POINT - "OMIT_FLOATING_POINT", -#endif -#if SQLITE_OMIT_FOREIGN_KEY - "OMIT_FOREIGN_KEY", -#endif -#if SQLITE_OMIT_GET_TABLE - "OMIT_GET_TABLE", -#endif -#if SQLITE_OMIT_HEX_INTEGER - "OMIT_HEX_INTEGER", -#endif -#if SQLITE_OMIT_INCRBLOB - "OMIT_INCRBLOB", -#endif -#if SQLITE_OMIT_INTEGRITY_CHECK - "OMIT_INTEGRITY_CHECK", -#endif -#if SQLITE_OMIT_INTROSPECTION_PRAGMAS - "OMIT_INTROSPECTION_PRAGMAS", -#endif -#if SQLITE_OMIT_LIKE_OPTIMIZATION - "OMIT_LIKE_OPTIMIZATION", -#endif -#if SQLITE_OMIT_LOAD_EXTENSION - "OMIT_LOAD_EXTENSION", -#endif -#if SQLITE_OMIT_LOCALTIME - "OMIT_LOCALTIME", -#endif -#if SQLITE_OMIT_LOOKASIDE - "OMIT_LOOKASIDE", -#endif -#if SQLITE_OMIT_MEMORYDB - "OMIT_MEMORYDB", -#endif -#if SQLITE_OMIT_OR_OPTIMIZATION - "OMIT_OR_OPTIMIZATION", -#endif -#if SQLITE_OMIT_PAGER_PRAGMAS - "OMIT_PAGER_PRAGMAS", -#endif -#if SQLITE_OMIT_PARSER_TRACE - "OMIT_PARSER_TRACE", -#endif -#if SQLITE_OMIT_POPEN - "OMIT_POPEN", -#endif -#if SQLITE_OMIT_PRAGMA - "OMIT_PRAGMA", -#endif -#if SQLITE_OMIT_PROGRESS_CALLBACK - "OMIT_PROGRESS_CALLBACK", -#endif -#if SQLITE_OMIT_QUICKBALANCE - "OMIT_QUICKBALANCE", -#endif -#if SQLITE_OMIT_REINDEX - "OMIT_REINDEX", -#endif -#if SQLITE_OMIT_SCHEMA_PRAGMAS - "OMIT_SCHEMA_PRAGMAS", -#endif -#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS - "OMIT_SCHEMA_VERSION_PRAGMAS", -#endif -#if SQLITE_OMIT_SHARED_CACHE - "OMIT_SHARED_CACHE", -#endif -#if SQLITE_OMIT_SHUTDOWN_DIRECTORIES - "OMIT_SHUTDOWN_DIRECTORIES", -#endif -#if SQLITE_OMIT_SUBQUERY - "OMIT_SUBQUERY", -#endif -#if SQLITE_OMIT_TCL_VARIABLE - "OMIT_TCL_VARIABLE", -#endif -#if SQLITE_OMIT_TEMPDB - "OMIT_TEMPDB", -#endif -#if SQLITE_OMIT_TEST_CONTROL - "OMIT_TEST_CONTROL", -#endif -#ifdef SQLITE_OMIT_TRACE -# if SQLITE_OMIT_TRACE != 1 - "OMIT_TRACE=" CTIMEOPT_VAL(SQLITE_OMIT_TRACE), -# endif -#endif -#if SQLITE_OMIT_TRIGGER - "OMIT_TRIGGER", -#endif -#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION - "OMIT_TRUNCATE_OPTIMIZATION", -#endif -#if SQLITE_OMIT_UTF16 - "OMIT_UTF16", -#endif -#if SQLITE_OMIT_VACUUM - "OMIT_VACUUM", -#endif -#if SQLITE_OMIT_VIEW - "OMIT_VIEW", -#endif -#if SQLITE_OMIT_VIRTUALTABLE - "OMIT_VIRTUALTABLE", -#endif -#if SQLITE_OMIT_WAL - "OMIT_WAL", -#endif -#if SQLITE_OMIT_WSD - "OMIT_WSD", -#endif -#if SQLITE_OMIT_XFER_OPT - "OMIT_XFER_OPT", -#endif -#if SQLITE_PCACHE_SEPARATE_HEADER - "PCACHE_SEPARATE_HEADER", -#endif -#if SQLITE_PERFORMANCE_TRACE - "PERFORMANCE_TRACE", -#endif -#ifdef SQLITE_POWERSAFE_OVERWRITE -# if SQLITE_POWERSAFE_OVERWRITE != 1 - "POWERSAFE_OVERWRITE=" CTIMEOPT_VAL(SQLITE_POWERSAFE_OVERWRITE), -# endif -#endif -#if SQLITE_PREFER_PROXY_LOCKING - "PREFER_PROXY_LOCKING", -#endif -#if SQLITE_PROXY_DEBUG - "PROXY_DEBUG", -#endif -#if SQLITE_REVERSE_UNORDERED_SELECTS - "REVERSE_UNORDERED_SELECTS", -#endif -#if SQLITE_RTREE_INT_ONLY - "RTREE_INT_ONLY", -#endif -#if SQLITE_SECURE_DELETE - "SECURE_DELETE", -#endif -#if SQLITE_SMALL_STACK - "SMALL_STACK", -#endif -#ifdef SQLITE_SORTER_PMASZ - "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ), -#endif -#if SQLITE_SOUNDEX - "SOUNDEX", -#endif -#ifdef SQLITE_STAT4_SAMPLES - "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES), -#endif -#ifdef SQLITE_STMTJRNL_SPILL - "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL), -#endif -#if SQLITE_SUBSTR_COMPATIBILITY - "SUBSTR_COMPATIBILITY", -#endif -#if (!defined(SQLITE_WIN32_MALLOC) \ - && !defined(SQLITE_ZERO_MALLOC) \ - && !defined(SQLITE_MEMDEBUG) \ - ) || defined(SQLITE_SYSTEM_MALLOC) - "SYSTEM_MALLOC", -#endif -#if SQLITE_TCL - "TCL", -#endif -#ifdef SQLITE_TEMP_STORE - "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), -#endif -#if SQLITE_TEST - "TEST", -#endif -#if defined(SQLITE_THREADSAFE) - "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), -#elif defined(THREADSAFE) - "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE), -#else - "THREADSAFE=1", -#endif -#if SQLITE_UNLINK_AFTER_CLOSE - "UNLINK_AFTER_CLOSE", -#endif -#if SQLITE_UNTESTABLE - "UNTESTABLE", -#endif -#if SQLITE_USER_AUTHENTICATION - "USER_AUTHENTICATION", -#endif -#if SQLITE_USE_ALLOCA - "USE_ALLOCA", -#endif -#if SQLITE_USE_FCNTL_TRACE - "USE_FCNTL_TRACE", -#endif -#if SQLITE_USE_URI - "USE_URI", -#endif -#if SQLITE_VDBE_COVERAGE - "VDBE_COVERAGE", -#endif -#if SQLITE_WIN32_MALLOC - "WIN32_MALLOC", -#endif -#if SQLITE_ZERO_MALLOC - "ZERO_MALLOC", -#endif -/* -** END CODE GENERATED BY tool/mkctime.tcl -*/ -}; - -SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){ - *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); - return (const char**)sqlite3azCompileOpt; -} - -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ - -/************** End of ctime.c ***********************************************/ /************** Begin file sqliteInt.h ***************************************/ /* ** 2001 September 15 @@ -1078,6 +293,17 @@ SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){ # define _USE_32BIT_TIME_T #endif +/* Optionally #include a user-defined header, whereby compilation options +** may be set prior to where they take effect, but after platform setup. +** If SQLITE_CUSTOM_INCLUDE=? is defined, its value names the #include +** file. +*/ +#ifdef SQLITE_CUSTOM_INCLUDE +# define INC_STRINGIFY_(f) #f +# define INC_STRINGIFY(f) INC_STRINGIFY_(f) +# include INC_STRINGIFY(SQLITE_CUSTOM_INCLUDE) +#endif + /* The public SQLite interface. The _FILE_OFFSET_BITS macro must appear ** first in QNX. Also, the _USE_32BIT_TIME_T macro must appear first for ** MinGW. @@ -1129,7 +355,30 @@ extern "C" { /* -** Provide the ability to override linkage features of the interface. +** Facilitate override of interface linkage and calling conventions. +** Be aware that these macros may not be used within this particular +** translation of the amalgamation and its associated header file. +** +** The SQLITE_EXTERN and SQLITE_API macros are used to instruct the +** compiler that the target identifier should have external linkage. +** +** The SQLITE_CDECL macro is used to set the calling convention for +** public functions that accept a variable number of arguments. +** +** The SQLITE_APICALL macro is used to set the calling convention for +** public functions that accept a fixed number of arguments. +** +** The SQLITE_STDCALL macro is no longer used and is now deprecated. +** +** The SQLITE_CALLBACK macro is used to set the calling convention for +** function pointers. +** +** The SQLITE_SYSAPI macro is used to set the calling convention for +** functions provided by the operating system. +** +** Currently, the SQLITE_CDECL, SQLITE_APICALL, SQLITE_CALLBACK, and +** SQLITE_SYSAPI macros are used only when building for environments +** that require non-default calling conventions. */ #ifndef SQLITE_EXTERN # define SQLITE_EXTERN extern @@ -1209,9 +458,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.36.0" -#define SQLITE_VERSION_NUMBER 3036000 -#define SQLITE_SOURCE_ID "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5" +#define SQLITE_VERSION "3.38.5" +#define SQLITE_VERSION_NUMBER 3038005 +#define SQLITE_SOURCE_ID "2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -1623,12 +872,13 @@ SQLITE_API int sqlite3_exec( #define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8)) #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) #define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11<<8)) +#define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8)) #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) -#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) +#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */ /* ** CAPI3REF: Flags For File Open Operations @@ -1636,6 +886,19 @@ SQLITE_API int sqlite3_exec( ** These bit values are intended for use in the ** 3rd parameter to the [sqlite3_open_v2()] interface and ** in the 4th parameter to the [sqlite3_vfs.xOpen] method. +** +** Only those flags marked as "Ok for sqlite3_open_v2()" may be +** used as the third argument to the [sqlite3_open_v2()] interface. +** The other flags have historically been ignored by sqlite3_open_v2(), +** though future versions of SQLite might change so that an error is +** raised if any of the disallowed bits are passed into sqlite3_open_v2(). +** Applications should not depend on the historical behavior. +** +** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into +** [sqlite3_open_v2()] does *not* cause the underlying database file +** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into +** [sqlite3_open_v2()] has historically be a no-op and might become an +** error in future versions of SQLite. */ #define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ @@ -1658,6 +921,7 @@ SQLITE_API int sqlite3_exec( #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ #define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_EXRESCODE 0x02000000 /* Extended result codes */ /* Reserved: 0x00F00000 */ /* Legacy compatibility: */ @@ -3550,11 +2814,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); ** CAPI3REF: Count The Number Of Rows Modified ** METHOD: sqlite3 ** -** ^This function returns the number of rows modified, inserted or +** ^These functions return the number of rows modified, inserted or ** deleted by the most recently completed INSERT, UPDATE or DELETE ** statement on the database connection specified by the only parameter. -** ^Executing any other type of SQL statement does not modify the value -** returned by this function. +** The two functions are identical except for the type of the return value +** and that if the number of rows modified by the most recent INSERT, UPDATE +** or DELETE is greater than the maximum value supported by type "int", then +** the return value of sqlite3_changes() is undefined. ^Executing any other +** type of SQL statement does not modify the value returned by these functions. ** ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers], @@ -3603,16 +2870,21 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); ** */ SQLITE_API int sqlite3_changes(sqlite3*); +SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3*); /* ** CAPI3REF: Total Number Of Rows Modified ** METHOD: sqlite3 ** -** ^This function returns the total number of rows inserted, modified or +** ^These functions return the total number of rows inserted, modified or ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed ** since the database connection was opened, including those executed as -** part of trigger programs. ^Executing any other type of SQL statement -** does not affect the value returned by sqlite3_total_changes(). +** part of trigger programs. The two functions are identical except for the +** type of the return value and that if the number of rows modified by the +** connection exceeds the maximum value supported by type "int", then +** the return value of sqlite3_total_changes() is undefined. ^Executing +** any other type of SQL statement does not affect the value returned by +** sqlite3_total_changes(). ** ** ^Changes made as part of [foreign key actions] are included in the ** count, but those made as part of REPLACE constraint resolution are @@ -3640,6 +2912,7 @@ SQLITE_API int sqlite3_changes(sqlite3*); ** */ SQLITE_API int sqlite3_total_changes(sqlite3*); +SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*); /* ** CAPI3REF: Interrupt A Long-Running Query @@ -4469,6 +3742,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** the default shared cache setting provided by ** [sqlite3_enable_shared_cache()].)^ ** +** [[OPEN_EXRESCODE]] ^(
[SQLITE_OPEN_EXRESCODE]
+**
The database connection comes up in "extended result code mode". +** In other words, the database behaves has if +** [sqlite3_extended_result_codes(db,1)] where called on the database +** connection as soon as the connection is created. In addition to setting +** the extended result code mode, this flag also causes [sqlite3_open_v2()] +** to return an extended result code.
+** ** [[OPEN_NOFOLLOW]] ^(
[SQLITE_OPEN_NOFOLLOW]
**
The database filename is not allowed to be a symbolic link
** )^ @@ -4476,7 +3757,15 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** If the 3rd parameter to sqlite3_open_v2() is not one of the ** required combinations shown above optionally combined with other ** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] -** then the behavior is undefined. +** then the behavior is undefined. Historic versions of SQLite +** have silently ignored surplus bits in the flags parameter to +** sqlite3_open_v2(), however that behavior might not be carried through +** into future versions of SQLite and so applications should not rely +** upon it. Note in particular that the SQLITE_OPEN_EXCLUSIVE flag is a no-op +** for sqlite3_open_v2(). The SQLITE_OPEN_EXCLUSIVE does *not* cause +** the open to fail if the database already exists. The SQLITE_OPEN_EXCLUSIVE +** flag is intended for use by the [sqlite3_vfs|VFS interface] only, and not +** by sqlite3_open_v2(). ** ** ^The fourth parameter to sqlite3_open_v2() is the name of the ** [sqlite3_vfs] object that defines the operating system interface that @@ -4847,13 +4136,14 @@ SQLITE_API void sqlite3_free_filename(char*); ** sqlite3_extended_errcode() might change with each API call. ** Except, there are some interfaces that are guaranteed to never ** change the value of the error code. The error-code preserving -** interfaces are: +** interfaces include the following: ** **
    **
  • sqlite3_errcode() **
  • sqlite3_extended_errcode() **
  • sqlite3_errmsg() **
  • sqlite3_errmsg16() +**
  • sqlite3_error_offset() **
** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language @@ -4868,6 +4158,13 @@ SQLITE_API void sqlite3_free_filename(char*); ** ^(Memory to hold the error message string is managed internally ** and must not be freed by the application)^. ** +** ^If the most recent error references a specific token in the input +** SQL, the sqlite3_error_offset() interface returns the byte offset +** of the start of that token. ^The byte offset returned by +** sqlite3_error_offset() assumes that the input SQL is UTF8. +** ^If the most recent error does not reference a specific token in the input +** SQL, then the sqlite3_error_offset() function returns -1. +** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. @@ -4887,6 +4184,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); SQLITE_API const char *sqlite3_errmsg(sqlite3*); SQLITE_API const void *sqlite3_errmsg16(sqlite3*); SQLITE_API const char *sqlite3_errstr(int); +SQLITE_API int sqlite3_error_offset(sqlite3 *db); /* ** CAPI3REF: Prepared Statement Object @@ -5244,12 +4542,17 @@ SQLITE_API int sqlite3_prepare16_v3( ** are managed by SQLite and are automatically freed when the prepared ** statement is finalized. ** ^The string returned by sqlite3_expanded_sql(P), on the other hand, -** is obtained from [sqlite3_malloc()] and must be free by the application +** is obtained from [sqlite3_malloc()] and must be freed by the application ** by passing it to [sqlite3_free()]. +** +** ^The sqlite3_normalized_sql() interface is only available if +** the [SQLITE_ENABLE_NORMALIZE] compile-time option is defined. */ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); +#ifdef SQLITE_ENABLE_NORMALIZE SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); +#endif /* ** CAPI3REF: Determine If An SQL Statement Writes The Database @@ -5293,6 +4596,10 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a ** read-only no-op if the table already exists, but ** sqlite3_stmt_readonly() still returns false for such a statement. +** +** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN] +** statement, then sqlite3_stmt_readonly(X) returns the same value as +** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted. */ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); @@ -5361,6 +4668,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); ** ** ^The sqlite3_value objects that are passed as parameters into the ** implementation of [application-defined SQL functions] are protected. +** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()] +** are protected. ** ^The sqlite3_value object returned by ** [sqlite3_column_value()] is unprotected. ** Unprotected sqlite3_value objects may only be used as arguments @@ -5982,6 +5291,10 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** even empty strings, are always zero-terminated. ^The return ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. ** +** ^Strings returned by sqlite3_column_text16() always have the endianness +** which is native to the platform, regardless of the text encoding set +** for the database. +** ** Warning: ^The object returned by [sqlite3_column_value()] is an ** [unprotected sqlite3_value] object. In a multithreaded environment, ** an unprotected sqlite3_value object may only be used safely with @@ -5995,7 +5308,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** [application-defined SQL functions] or [virtual tables], not within ** top-level application code. ** -** The these routines may attempt to convert the datatype of the result. +** These routines may attempt to convert the datatype of the result. ** ^For example, if the internal representation is FLOAT and a text result ** is requested, [sqlite3_snprintf()] is used internally to perform the ** conversion automatically. ^(The following table details the conversions @@ -6020,7 +5333,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** TEXT BLOB No change ** BLOB INTEGER [CAST] to INTEGER ** BLOB FLOAT [CAST] to REAL -** BLOB TEXT Add a zero terminator if needed +** BLOB TEXT [CAST] to TEXT, ensure zero terminator ** ** )^ ** @@ -7433,6 +6746,72 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); +/* +** CAPI3REF: Autovacuum Compaction Amount Callback +** METHOD: sqlite3 +** +** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback +** function C that is invoked prior to each autovacuum of the database +** file. ^The callback is passed a copy of the generic data pointer (P), +** the schema-name of the attached database that is being autovacuumed, +** the the size of the database file in pages, the number of free pages, +** and the number of bytes per page, respectively. The callback should +** return the number of free pages that should be removed by the +** autovacuum. ^If the callback returns zero, then no autovacuum happens. +** ^If the value returned is greater than or equal to the number of +** free pages, then a complete autovacuum happens. +** +**

^If there are multiple ATTACH-ed database files that are being +** modified as part of a transaction commit, then the autovacuum pages +** callback is invoked separately for each file. +** +**

The callback is not reentrant. The callback function should +** not attempt to invoke any other SQLite interface. If it does, bad +** things may happen, including segmentation faults and corrupt database +** files. The callback function should be a simple function that +** does some arithmetic on its input parameters and returns a result. +** +** ^The X parameter to sqlite3_autovacuum_pages(D,C,P,X) is an optional +** destructor for the P parameter. ^If X is not NULL, then X(P) is +** invoked whenever the database connection closes or when the callback +** is overwritten by another invocation of sqlite3_autovacuum_pages(). +** +**

^There is only one autovacuum pages callback per database connection. +** ^Each call to the sqlite3_autovacuum_pages() interface overrides all +** previous invocations for that database connection. ^If the callback +** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, +** then the autovacuum steps callback is cancelled. The return value +** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might +** be some other error code if something goes wrong. The current +** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other +** return codes might be added in future releases. +** +**

If no autovacuum pages callback is specified (the usual case) or +** a NULL pointer is provided for the callback, +** then the default behavior is to vacuum all free pages. So, in other +** words, the default behavior is the same as if the callback function +** were something like this: +** +**

+**     unsigned int demonstration_autovac_pages_callback(
+**       void *pClientData,
+**       const char *zSchema,
+**       unsigned int nDbPage,
+**       unsigned int nFreePage,
+**       unsigned int nBytePerPage
+**     ){
+**       return nFreePage;
+**     }
+** 
+*/ +SQLITE_API int sqlite3_autovacuum_pages( + sqlite3 *db, + unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int), + void*, + void(*)(void*) +); + + /* ** CAPI3REF: Data Change Notification Callbacks ** METHOD: sqlite3 @@ -8074,24 +7453,56 @@ struct sqlite3_index_info { ** ** These macros define the allowed values for the ** [sqlite3_index_info].aConstraint[].op field. Each value represents -** an operator that is part of a constraint term in the wHERE clause of +** an operator that is part of a constraint term in the WHERE clause of ** a query that uses a [virtual table]. -*/ -#define SQLITE_INDEX_CONSTRAINT_EQ 2 -#define SQLITE_INDEX_CONSTRAINT_GT 4 -#define SQLITE_INDEX_CONSTRAINT_LE 8 -#define SQLITE_INDEX_CONSTRAINT_LT 16 -#define SQLITE_INDEX_CONSTRAINT_GE 32 -#define SQLITE_INDEX_CONSTRAINT_MATCH 64 -#define SQLITE_INDEX_CONSTRAINT_LIKE 65 -#define SQLITE_INDEX_CONSTRAINT_GLOB 66 -#define SQLITE_INDEX_CONSTRAINT_REGEXP 67 -#define SQLITE_INDEX_CONSTRAINT_NE 68 -#define SQLITE_INDEX_CONSTRAINT_ISNOT 69 -#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 -#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 -#define SQLITE_INDEX_CONSTRAINT_IS 72 -#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 +** +** ^The left-hand operand of the operator is given by the corresponding +** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand +** operand is the rowid. +** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET +** operators have no left-hand operand, and so for those operators the +** corresponding aConstraint[].iColumn is meaningless and should not be +** used. +** +** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through +** value 255 are reserved to represent functions that are overloaded +** by the [xFindFunction|xFindFunction method] of the virtual table +** implementation. +** +** The right-hand operands for each constraint might be accessible using +** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand +** operand is only available if it appears as a single constant literal +** in the input SQL. If the right-hand operand is another column or an +** expression (even a constant expression) or a parameter, then the +** sqlite3_vtab_rhs_value() probably will not be able to extract it. +** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and +** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand +** and hence calls to sqlite3_vtab_rhs_value() for those operators will +** always return SQLITE_NOTFOUND. +** +** The collating sequence to be used for comparison can be found using +** the [sqlite3_vtab_collation()] interface. For most real-world virtual +** tables, the collating sequence of constraints does not matter (for example +** because the constraints are numeric) and so the sqlite3_vtab_collation() +** interface is no commonly needed. +*/ +#define SQLITE_INDEX_CONSTRAINT_EQ 2 +#define SQLITE_INDEX_CONSTRAINT_GT 4 +#define SQLITE_INDEX_CONSTRAINT_LE 8 +#define SQLITE_INDEX_CONSTRAINT_LT 16 +#define SQLITE_INDEX_CONSTRAINT_GE 32 +#define SQLITE_INDEX_CONSTRAINT_MATCH 64 +#define SQLITE_INDEX_CONSTRAINT_LIKE 65 +#define SQLITE_INDEX_CONSTRAINT_GLOB 66 +#define SQLITE_INDEX_CONSTRAINT_REGEXP 67 +#define SQLITE_INDEX_CONSTRAINT_NE 68 +#define SQLITE_INDEX_CONSTRAINT_ISNOT 69 +#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 +#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 +#define SQLITE_INDEX_CONSTRAINT_IS 72 +#define SQLITE_INDEX_CONSTRAINT_LIMIT 73 +#define SQLITE_INDEX_CONSTRAINT_OFFSET 74 +#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 /* ** CAPI3REF: Register A Virtual Table Implementation @@ -8120,7 +7531,7 @@ struct sqlite3_index_info { ** destructor. ** ** ^If the third parameter (the pointer to the sqlite3_module object) is -** NULL then no new module is create and any existing modules with the +** NULL then no new module is created and any existing modules with the ** same name are dropped. ** ** See also: [sqlite3_drop_modules()] @@ -8896,7 +8307,8 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_SEEK_COUNT 30 #define SQLITE_TESTCTRL_TRACEFLAGS 31 #define SQLITE_TESTCTRL_TUNE 32 -#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */ +#define SQLITE_TESTCTRL_LOGEST 33 +#define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking @@ -9419,6 +8831,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); ** The counter is incremented on the first [sqlite3_step()] call of each ** cycle. ** +** [[SQLITE_STMTSTATUS_FILTER_MISS]] +** [[SQLITE_STMTSTATUS_FILTER HIT]] +**
SQLITE_STMTSTATUS_FILTER_HIT
+** SQLITE_STMTSTATUS_FILTER_MISS
+**
^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join +** step was bypassed because a Bloom filter returned not-found. The +** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of +** times that the Bloom filter returned a find, and thus the join step +** had to be processed as normal. +** ** [[SQLITE_STMTSTATUS_MEMUSED]]
SQLITE_STMTSTATUS_MEMUSED
**
^This is the approximate number of bytes of heap memory ** used to store the prepared statement. ^This value is not actually @@ -9433,6 +8855,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); #define SQLITE_STMTSTATUS_VM_STEP 4 #define SQLITE_STMTSTATUS_REPREPARE 5 #define SQLITE_STMTSTATUS_RUN 6 +#define SQLITE_STMTSTATUS_FILTER_MISS 7 +#define SQLITE_STMTSTATUS_FILTER_HIT 8 #define SQLITE_STMTSTATUS_MEMUSED 99 /* @@ -10096,8 +9520,9 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); ** ** A single database handle may have at most a single write-ahead log callback ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any -** previously registered write-ahead log callback. ^Note that the -** [sqlite3_wal_autocheckpoint()] interface and the +** previously registered write-ahead log callback. ^The return value is +** a copy of the third parameter from the previous call, if any, or 0. +** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will ** overwrite any prior [sqlite3_wal_hook()] settings. */ @@ -10400,19 +9825,269 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); /* ** CAPI3REF: Determine The Collation For a Virtual Table Constraint +** METHOD: sqlite3_index_info ** ** This function may only be called from within a call to the [xBestIndex] -** method of a [virtual table]. +** method of a [virtual table]. This function returns a pointer to a string +** that is the name of the appropriate collation sequence to use for text +** comparisons on the constraint identified by its arguments. +** +** The first argument must be the pointer to the [sqlite3_index_info] object +** that is the first parameter to the xBestIndex() method. The second argument +** must be an index into the aConstraint[] array belonging to the +** sqlite3_index_info structure passed to xBestIndex. +** +** Important: +** The first parameter must be the same pointer that is passed into the +** xBestMethod() method. The first parameter may not be a pointer to a +** different [sqlite3_index_info] object, even an exact copy. ** -** The first argument must be the sqlite3_index_info object that is the -** first parameter to the xBestIndex() method. The second argument must be -** an index into the aConstraint[] array belonging to the sqlite3_index_info -** structure passed to xBestIndex. This function returns a pointer to a buffer -** containing the name of the collation sequence for the corresponding -** constraint. +** The return value is computed as follows: +** +**
    +**
  1. If the constraint comes from a WHERE clause expression that contains +** a [COLLATE operator], then the name of the collation specified by +** that COLLATE operator is returned. +**

  2. If there is no COLLATE operator, but the column that is the subject +** of the constraint specifies an alternative collating sequence via +** a [COLLATE clause] on the column definition within the CREATE TABLE +** statement that was passed into [sqlite3_declare_vtab()], then the +** name of that alternative collating sequence is returned. +**

  3. Otherwise, "BINARY" is returned. +**

*/ SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); +/* +** CAPI3REF: Determine if a virtual table query is DISTINCT +** METHOD: sqlite3_index_info +** +** This API may only be used from within an [xBestIndex|xBestIndex method] +** of a [virtual table] implementation. The result of calling this +** interface from outside of xBestIndex() is undefined and probably harmful. +** +** ^The sqlite3_vtab_distinct() interface returns an integer that is +** either 0, 1, or 2. The integer returned by sqlite3_vtab_distinct() +** gives the virtual table additional information about how the query +** planner wants the output to be ordered. As long as the virtual table +** can meet the ordering requirements of the query planner, it may set +** the "orderByConsumed" flag. +** +**
  1. +** ^If the sqlite3_vtab_distinct() interface returns 0, that means +** that the query planner needs the virtual table to return all rows in the +** sort order defined by the "nOrderBy" and "aOrderBy" fields of the +** [sqlite3_index_info] object. This is the default expectation. If the +** virtual table outputs all rows in sorted order, then it is always safe for +** the xBestIndex method to set the "orderByConsumed" flag, regardless of +** the return value from sqlite3_vtab_distinct(). +**

  2. +** ^(If the sqlite3_vtab_distinct() interface returns 1, that means +** that the query planner does not need the rows to be returned in sorted order +** as long as all rows with the same values in all columns identified by the +** "aOrderBy" field are adjacent.)^ This mode is used when the query planner +** is doing a GROUP BY. +**

  3. +** ^(If the sqlite3_vtab_distinct() interface returns 2, that means +** that the query planner does not need the rows returned in any particular +** order, as long as rows with the same values in all "aOrderBy" columns +** are adjacent.)^ ^(Furthermore, only a single row for each particular +** combination of values in the columns identified by the "aOrderBy" field +** needs to be returned.)^ ^It is always ok for two or more rows with the same +** values in all "aOrderBy" columns to be returned, as long as all such rows +** are adjacent. ^The virtual table may, if it chooses, omit extra rows +** that have the same value for all columns identified by "aOrderBy". +** ^However omitting the extra rows is optional. +** This mode is used for a DISTINCT query. +**

+** +** ^For the purposes of comparing virtual table output values to see if the +** values are same value for sorting purposes, two NULL values are considered +** to be the same. In other words, the comparison operator is "IS" +** (or "IS NOT DISTINCT FROM") and not "==". +** +** If a virtual table implementation is unable to meet the requirements +** specified above, then it must not set the "orderByConsumed" flag in the +** [sqlite3_index_info] object or an incorrect answer may result. +** +** ^A virtual table implementation is always free to return rows in any order +** it wants, as long as the "orderByConsumed" flag is not set. ^When the +** the "orderByConsumed" flag is unset, the query planner will add extra +** [bytecode] to ensure that the final results returned by the SQL query are +** ordered correctly. The use of the "orderByConsumed" flag and the +** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful +** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" +** flag might help queries against a virtual table to run faster. Being +** overly aggressive and setting the "orderByConsumed" flag when it is not +** valid to do so, on the other hand, might cause SQLite to return incorrect +** results. +*/ +SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*); + +/* +** CAPI3REF: Identify and handle IN constraints in xBestIndex +** +** This interface may only be used from within an +** [xBestIndex|xBestIndex() method] of a [virtual table] implementation. +** The result of invoking this interface from any other context is +** undefined and probably harmful. +** +** ^(A constraint on a virtual table of the form +** "[IN operator|column IN (...)]" is +** communicated to the xBestIndex method as a +** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use +** this constraint, it must set the corresponding +** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under +** the usual mode of handling IN operators, SQLite generates [bytecode] +** that invokes the [xFilter|xFilter() method] once for each value +** on the right-hand side of the IN operator.)^ Thus the virtual table +** only sees a single value from the right-hand side of the IN operator +** at a time. +** +** In some cases, however, it would be advantageous for the virtual +** table to see all values on the right-hand of the IN operator all at +** once. The sqlite3_vtab_in() interfaces facilitates this in two ways: +** +**
    +**
  1. +** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero) +** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint +** is an [IN operator] that can be processed all at once. ^In other words, +** sqlite3_vtab_in() with -1 in the third argument is a mechanism +** by which the virtual table can ask SQLite if all-at-once processing +** of the IN operator is even possible. +** +**

  2. +** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates +** to SQLite that the virtual table does or does not want to process +** the IN operator all-at-once, respectively. ^Thus when the third +** parameter (F) is non-negative, this interface is the mechanism by +** which the virtual table tells SQLite how it wants to process the +** IN operator. +**

+** +** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times +** within the same xBestIndex method call. ^For any given P,N pair, +** the return value from sqlite3_vtab_in(P,N,F) will always be the same +** within the same xBestIndex call. ^If the interface returns true +** (non-zero), that means that the constraint is an IN operator +** that can be processed all-at-once. ^If the constraint is not an IN +** operator or cannot be processed all-at-once, then the interface returns +** false. +** +** ^(All-at-once processing of the IN operator is selected if both of the +** following conditions are met: +** +**
    +**
  1. The P->aConstraintUsage[N].argvIndex value is set to a positive +** integer. This is how the virtual table tells SQLite that it wants to +** use the N-th constraint. +** +**

  2. The last call to sqlite3_vtab_in(P,N,F) for which F was +** non-negative had F>=1. +**

)^ +** +** ^If either or both of the conditions above are false, then SQLite uses +** the traditional one-at-a-time processing strategy for the IN constraint. +** ^If both conditions are true, then the argvIndex-th parameter to the +** xFilter method will be an [sqlite3_value] that appears to be NULL, +** but which can be passed to [sqlite3_vtab_in_first()] and +** [sqlite3_vtab_in_next()] to find all values on the right-hand side +** of the IN constraint. +*/ +SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle); + +/* +** CAPI3REF: Find all elements on the right-hand side of an IN constraint. +** +** These interfaces are only useful from within the +** [xFilter|xFilter() method] of a [virtual table] implementation. +** The result of invoking these interfaces from any other context +** is undefined and probably harmful. +** +** The X parameter in a call to sqlite3_vtab_in_first(X,P) or +** sqlite3_vtab_in_next(X,P) must be one of the parameters to the +** xFilter method which invokes these routines, and specifically +** a parameter that was previously selected for all-at-once IN constraint +** processing use the [sqlite3_vtab_in()] interface in the +** [xBestIndex|xBestIndex method]. ^(If the X parameter is not +** an xFilter argument that was selected for all-at-once IN constraint +** processing, then these routines return [SQLITE_MISUSE])^ or perhaps +** exhibit some other undefined or harmful behavior. +** +** ^(Use these routines to access all values on the right-hand side +** of the IN constraint using code like the following: +** +**
+**    for(rc=sqlite3_vtab_in_first(pList, &pVal);
+**        rc==SQLITE_OK && pVal
+**        rc=sqlite3_vtab_in_next(pList, &pVal)
+**    ){
+**      // do something with pVal
+**    }
+**    if( rc!=SQLITE_OK ){
+**      // an error has occurred
+**    }
+** 
)^ +** +** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P) +** routines return SQLITE_OK and set *P to point to the first or next value +** on the RHS of the IN constraint. ^If there are no more values on the +** right hand side of the IN constraint, then *P is set to NULL and these +** routines return [SQLITE_DONE]. ^The return value might be +** some other value, such as SQLITE_NOMEM, in the event of a malfunction. +** +** The *ppOut values returned by these routines are only valid until the +** next call to either of these routines or until the end of the xFilter +** method from which these routines were called. If the virtual table +** implementation needs to retain the *ppOut values for longer, it must make +** copies. The *ppOut values are [protected sqlite3_value|protected]. +*/ +SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut); +SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut); + +/* +** CAPI3REF: Constraint values in xBestIndex() +** METHOD: sqlite3_index_info +** +** This API may only be used from within the [xBestIndex|xBestIndex method] +** of a [virtual table] implementation. The result of calling this interface +** from outside of an xBestIndex method are undefined and probably harmful. +** +** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within +** the [xBestIndex] method of a [virtual table] implementation, with P being +** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and +** J being a 0-based index into P->aConstraint[], then this routine +** attempts to set *V to the value of the right-hand operand of +** that constraint if the right-hand operand is known. ^If the +** right-hand operand is not known, then *V is set to a NULL pointer. +** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if +** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) +** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th +** constraint is not available. ^The sqlite3_vtab_rhs_value() interface +** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if +** something goes wrong. +** +** The sqlite3_vtab_rhs_value() interface is usually only successful if +** the right-hand operand of a constraint is a literal value in the original +** SQL statement. If the right-hand operand is an expression or a reference +** to some other column or a [host parameter], then sqlite3_vtab_rhs_value() +** will probably return [SQLITE_NOTFOUND]. +** +** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and +** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such +** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^ +** +** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value +** and remains valid for the duration of the xBestIndex method call. +** ^When xBestIndex returns, the sqlite3_value object returned by +** sqlite3_vtab_rhs_value() is automatically deallocated. +** +** The "_rhs_" in the name of this routine is an abbreviation for +** "Right-Hand Side". +*/ +SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal); + /* ** CAPI3REF: Conflict resolution modes ** KEYWORDS: {conflict resolution mode} @@ -10964,6 +10639,10 @@ SQLITE_API unsigned char *sqlite3_serialize( ** database is currently in a read transaction or is involved in a backup ** operation. ** +** It is not possible to deserialized into the TEMP database. If the +** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the +** function returns SQLITE_ERROR. +** ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then ** [sqlite3_free()] is invoked on argument P prior to returning. @@ -13446,7 +13125,7 @@ struct fts5_api { ** autoconf-based build */ #if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) -/* #include "config.h" */ +#include "config.h" #define SQLITECONFIG_H 1 #endif @@ -13682,11 +13361,12 @@ struct fts5_api { #ifndef __has_extension # define __has_extension(x) 0 /* compatibility with non-clang compilers */ #endif -#if GCC_VERSION>=4007000 || \ - (__has_extension(c_atomic) && __has_extension(c_atomic_store_n)) +#if GCC_VERSION>=4007000 || __has_extension(c_atomic) +# define SQLITE_ATOMIC_INTRINSICS 1 # define AtomicLoad(PTR) __atomic_load_n((PTR),__ATOMIC_RELAXED) # define AtomicStore(PTR,VAL) __atomic_store_n((PTR),(VAL),__ATOMIC_RELAXED) #else +# define SQLITE_ATOMIC_INTRINSICS 0 # define AtomicLoad(PTR) (*(PTR)) # define AtomicStore(PTR,VAL) (*(PTR) = (VAL)) #endif @@ -13891,11 +13571,12 @@ struct fts5_api { ** is significant and used at least once. On switch statements ** where multiple cases go to the same block of code, testcase() ** can insure that all cases are evaluated. -** */ -#ifdef SQLITE_COVERAGE_TEST -SQLITE_PRIVATE void sqlite3Coverage(int); -# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); } +#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG) +# ifndef SQLITE_AMALGAMATION + extern unsigned int sqlite3CoverageCounter; +# endif +# define testcase(X) if( X ){ sqlite3CoverageCounter += (unsigned)__LINE__; } #else # define testcase(X) #endif @@ -13925,6 +13606,14 @@ SQLITE_PRIVATE void sqlite3Coverage(int); # define VVA_ONLY(X) #endif +/* +** Disable ALWAYS() and NEVER() (make them pass-throughs) for coverage +** and mutation testing +*/ +#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST) +# define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1 +#endif + /* ** The ALWAYS and NEVER macros surround boolean expressions which ** are intended to always be true or false, respectively. Such @@ -13940,7 +13629,7 @@ SQLITE_PRIVATE void sqlite3Coverage(int); ** be true and false so that the unreachable code they specify will ** not be counted as untested code. */ -#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST) +#if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS) # define ALWAYS(X) (1) # define NEVER(X) (0) #elif !defined(NDEBUG) @@ -13951,26 +13640,6 @@ SQLITE_PRIVATE void sqlite3Coverage(int); # define NEVER(X) (X) #endif -/* -** The harmless(X) macro indicates that expression X is usually false -** but can be true without causing any problems, but we don't know of -** any way to cause X to be true. -** -** In debugging and testing builds, this macro will abort if X is ever -** true. In this way, developers are alerted to a possible test case -** that causes X to be true. If a harmless macro ever fails, that is -** an opportunity to change the macro into a testcase() and add a new -** test case to the test suite. -** -** For normal production builds, harmless(X) is a no-op, since it does -** not matter whether expression X is true or false. -*/ -#ifdef SQLITE_DEBUG -# define harmless(X) assert(!(X)); -#else -# define harmless(X) -#endif - /* ** Some conditionals are optimizations only. In other words, if the ** conditionals are replaced with a constant 1 (true) or 0 (false) then @@ -14034,6 +13703,13 @@ SQLITE_PRIVATE void sqlite3Coverage(int); # undef SQLITE_ENABLE_EXPLAIN_COMMENTS #endif +/* +** SQLITE_OMIT_VIRTUALTABLE implies SQLITE_OMIT_ALTERTABLE +*/ +#if defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_ALTERTABLE) +# define SQLITE_OMIT_ALTERTABLE +#endif + /* ** Return true (non-zero) if the input is an integer that is too large ** to fit in 32-bits. This macro is used inside of various testcase() @@ -14146,7 +13822,7 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); /* ** Number of entries in a hash table */ -/* #define sqliteHashCount(H) ((H)->count) // NOT USED */ +#define sqliteHashCount(H) ((H)->count) #endif /* SQLITE_HASH_H */ @@ -14178,8 +13854,8 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_LP 22 #define TK_RP 23 #define TK_AS 24 -#define TK_WITHOUT 25 -#define TK_COMMA 26 +#define TK_COMMA 25 +#define TK_WITHOUT 26 #define TK_ABORT 27 #define TK_ACTION 28 #define TK_AFTER 29 @@ -14265,78 +13941,79 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); #define TK_SLASH 109 #define TK_REM 110 #define TK_CONCAT 111 -#define TK_COLLATE 112 -#define TK_BITNOT 113 -#define TK_ON 114 -#define TK_INDEXED 115 -#define TK_STRING 116 -#define TK_JOIN_KW 117 -#define TK_CONSTRAINT 118 -#define TK_DEFAULT 119 -#define TK_NULL 120 -#define TK_PRIMARY 121 -#define TK_UNIQUE 122 -#define TK_CHECK 123 -#define TK_REFERENCES 124 -#define TK_AUTOINCR 125 -#define TK_INSERT 126 -#define TK_DELETE 127 -#define TK_UPDATE 128 -#define TK_SET 129 -#define TK_DEFERRABLE 130 -#define TK_FOREIGN 131 -#define TK_DROP 132 -#define TK_UNION 133 -#define TK_ALL 134 -#define TK_EXCEPT 135 -#define TK_INTERSECT 136 -#define TK_SELECT 137 -#define TK_VALUES 138 -#define TK_DISTINCT 139 -#define TK_DOT 140 -#define TK_FROM 141 -#define TK_JOIN 142 -#define TK_USING 143 -#define TK_ORDER 144 -#define TK_GROUP 145 -#define TK_HAVING 146 -#define TK_LIMIT 147 -#define TK_WHERE 148 -#define TK_RETURNING 149 -#define TK_INTO 150 -#define TK_NOTHING 151 -#define TK_FLOAT 152 -#define TK_BLOB 153 -#define TK_INTEGER 154 -#define TK_VARIABLE 155 -#define TK_CASE 156 -#define TK_WHEN 157 -#define TK_THEN 158 -#define TK_ELSE 159 -#define TK_INDEX 160 -#define TK_ALTER 161 -#define TK_ADD 162 -#define TK_WINDOW 163 -#define TK_OVER 164 -#define TK_FILTER 165 -#define TK_COLUMN 166 -#define TK_AGG_FUNCTION 167 -#define TK_AGG_COLUMN 168 -#define TK_TRUEFALSE 169 -#define TK_ISNOT 170 -#define TK_FUNCTION 171 -#define TK_UMINUS 172 -#define TK_UPLUS 173 -#define TK_TRUTH 174 -#define TK_REGISTER 175 -#define TK_VECTOR 176 -#define TK_SELECT_COLUMN 177 -#define TK_IF_NULL_ROW 178 -#define TK_ASTERISK 179 -#define TK_SPAN 180 -#define TK_ERROR 181 -#define TK_SPACE 182 -#define TK_ILLEGAL 183 +#define TK_PTR 112 +#define TK_COLLATE 113 +#define TK_BITNOT 114 +#define TK_ON 115 +#define TK_INDEXED 116 +#define TK_STRING 117 +#define TK_JOIN_KW 118 +#define TK_CONSTRAINT 119 +#define TK_DEFAULT 120 +#define TK_NULL 121 +#define TK_PRIMARY 122 +#define TK_UNIQUE 123 +#define TK_CHECK 124 +#define TK_REFERENCES 125 +#define TK_AUTOINCR 126 +#define TK_INSERT 127 +#define TK_DELETE 128 +#define TK_UPDATE 129 +#define TK_SET 130 +#define TK_DEFERRABLE 131 +#define TK_FOREIGN 132 +#define TK_DROP 133 +#define TK_UNION 134 +#define TK_ALL 135 +#define TK_EXCEPT 136 +#define TK_INTERSECT 137 +#define TK_SELECT 138 +#define TK_VALUES 139 +#define TK_DISTINCT 140 +#define TK_DOT 141 +#define TK_FROM 142 +#define TK_JOIN 143 +#define TK_USING 144 +#define TK_ORDER 145 +#define TK_GROUP 146 +#define TK_HAVING 147 +#define TK_LIMIT 148 +#define TK_WHERE 149 +#define TK_RETURNING 150 +#define TK_INTO 151 +#define TK_NOTHING 152 +#define TK_FLOAT 153 +#define TK_BLOB 154 +#define TK_INTEGER 155 +#define TK_VARIABLE 156 +#define TK_CASE 157 +#define TK_WHEN 158 +#define TK_THEN 159 +#define TK_ELSE 160 +#define TK_INDEX 161 +#define TK_ALTER 162 +#define TK_ADD 163 +#define TK_WINDOW 164 +#define TK_OVER 165 +#define TK_FILTER 166 +#define TK_COLUMN 167 +#define TK_AGG_FUNCTION 168 +#define TK_AGG_COLUMN 169 +#define TK_TRUEFALSE 170 +#define TK_ISNOT 171 +#define TK_FUNCTION 172 +#define TK_UMINUS 173 +#define TK_UPLUS 174 +#define TK_TRUTH 175 +#define TK_REGISTER 176 +#define TK_VECTOR 177 +#define TK_SELECT_COLUMN 178 +#define TK_IF_NULL_ROW 179 +#define TK_ASTERISK 180 +#define TK_SPAN 181 +#define TK_ERROR 182 +#define TK_SPACE 183 +#define TK_ILLEGAL 184 /************** End of parse.h ***********************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ @@ -14442,7 +14119,7 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*); ** number of pages. A negative number N translations means that a buffer ** of -1024*N bytes is allocated and used for as many pages as it will hold. ** -** The default value of "20" was choosen to minimize the run-time of the +** The default value of "20" was chosen to minimize the run-time of the ** speedtest1 test program with options: --shrink-memory --reprepare */ #ifndef SQLITE_DEFAULT_PCACHE_INITSZ @@ -14604,6 +14281,7 @@ typedef INT16_TYPE LogEst; # define SQLITE_PTRSIZE __SIZEOF_POINTER__ # elif defined(i386) || defined(__i386__) || defined(_M_IX86) || \ defined(_M_ARM) || defined(__arm__) || defined(__x86) || \ + (defined(__APPLE__) && defined(__POWERPC__)) || \ (defined(__TOS_AIX__) && !defined(__64BIT__)) # define SQLITE_PTRSIZE 4 # else @@ -14798,11 +14476,25 @@ struct BusyHandler { /* ** Name of table that holds the database schema. +** +** The PREFERRED names are used whereever possible. But LEGACY is also +** used for backwards compatibility. +** +** 1. Queries can use either the PREFERRED or the LEGACY names +** 2. The sqlite3_set_authorizer() callback uses the LEGACY name +** 3. The PRAGMA table_list statement uses the PREFERRED name +** +** The LEGACY names are stored in the internal symbol hash table +** in support of (2). Names are translated using sqlite3PreferredTableName() +** for (3). The sqlite3FindTable() function takes care of translating +** names for (1). +** +** Note that "sqlite_temp_schema" can also be called "temp.sqlite_schema". */ -#define DFLT_SCHEMA_TABLE "sqlite_master" -#define DFLT_TEMP_SCHEMA_TABLE "sqlite_temp_master" -#define ALT_SCHEMA_TABLE "sqlite_schema" -#define ALT_TEMP_SCHEMA_TABLE "sqlite_temp_schema" +#define LEGACY_SCHEMA_TABLE "sqlite_master" +#define LEGACY_TEMP_SCHEMA_TABLE "sqlite_temp_master" +#define PREFERRED_SCHEMA_TABLE "sqlite_schema" +#define PREFERRED_TEMP_SCHEMA_TABLE "sqlite_temp_schema" /* @@ -14814,7 +14506,7 @@ struct BusyHandler { ** The name of the schema table. The name is different for TEMP. */ #define SCHEMA_TABLE(x) \ - ((!OMIT_TEMPDB)&&(x==1)?DFLT_TEMP_SCHEMA_TABLE:DFLT_SCHEMA_TABLE) + ((!OMIT_TEMPDB)&&(x==1)?LEGACY_TEMP_SCHEMA_TABLE:LEGACY_SCHEMA_TABLE) /* ** A convenience macro that returns the number of elements in @@ -14963,10 +14655,11 @@ typedef struct With With; /* ** A bit in a Bitmask */ -#define MASKBIT(n) (((Bitmask)1)<<(n)) -#define MASKBIT64(n) (((u64)1)<<(n)) -#define MASKBIT32(n) (((unsigned int)1)<<(n)) -#define ALLBITS ((Bitmask)-1) +#define MASKBIT(n) (((Bitmask)1)<<(n)) +#define MASKBIT64(n) (((u64)1)<<(n)) +#define MASKBIT32(n) (((unsigned int)1)<<(n)) +#define SMASKBIT32(n) ((n)<=31?((unsigned int)1)<<(n):0) +#define ALLBITS ((Bitmask)-1) /* A VList object records a mapping between parameters/variables/wildcards ** in the SQL statement (such as $abc, @pqr, or :xyz) and the integer @@ -15355,7 +15048,7 @@ SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *); #define BTREE_BLOBKEY 2 /* Table has keys only - no data */ SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*); -SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*); +SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, i64*); SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree*, int, int); @@ -15479,13 +15172,17 @@ SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor*, int, ...); #endif SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( +SQLITE_PRIVATE int sqlite3BtreeTableMoveto( BtCursor*, - UnpackedRecord *pUnKey, i64 intKey, int bias, int *pRes ); +SQLITE_PRIVATE int sqlite3BtreeIndexMoveto( + BtCursor*, + UnpackedRecord *pUnKey, + int *pRes +); SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor*); SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor*, int*); SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*, u8 flags); @@ -15836,35 +15533,35 @@ typedef struct VdbeOpList VdbeOpList; #define OP_If 18 /* jump */ #define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */ #define OP_IfNot 20 /* jump */ -#define OP_IfNullRow 21 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */ -#define OP_SeekLT 22 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekLE 23 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekGE 24 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekGT 25 /* jump, synopsis: key=r[P3@P4] */ -#define OP_IfNotOpen 26 /* jump, synopsis: if( !csr[P1] ) goto P2 */ -#define OP_IfNoHope 27 /* jump, synopsis: key=r[P3@P4] */ -#define OP_NoConflict 28 /* jump, synopsis: key=r[P3@P4] */ -#define OP_NotFound 29 /* jump, synopsis: key=r[P3@P4] */ -#define OP_Found 30 /* jump, synopsis: key=r[P3@P4] */ -#define OP_SeekRowid 31 /* jump, synopsis: intkey=r[P3] */ -#define OP_NotExists 32 /* jump, synopsis: intkey=r[P3] */ -#define OP_Last 33 /* jump */ -#define OP_IfSmaller 34 /* jump */ -#define OP_SorterSort 35 /* jump */ -#define OP_Sort 36 /* jump */ -#define OP_Rewind 37 /* jump */ -#define OP_IdxLE 38 /* jump, synopsis: key=r[P3@P4] */ -#define OP_IdxGT 39 /* jump, synopsis: key=r[P3@P4] */ -#define OP_IdxLT 40 /* jump, synopsis: key=r[P3@P4] */ -#define OP_IdxGE 41 /* jump, synopsis: key=r[P3@P4] */ -#define OP_RowSetRead 42 /* jump, synopsis: r[P3]=rowset(P1) */ +#define OP_IsNullOrType 21 /* jump, synopsis: if typeof(r[P1]) IN (P3,5) goto P2 */ +#define OP_IfNullRow 22 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */ +#define OP_SeekLT 23 /* jump, synopsis: key=r[P3@P4] */ +#define OP_SeekLE 24 /* jump, synopsis: key=r[P3@P4] */ +#define OP_SeekGE 25 /* jump, synopsis: key=r[P3@P4] */ +#define OP_SeekGT 26 /* jump, synopsis: key=r[P3@P4] */ +#define OP_IfNotOpen 27 /* jump, synopsis: if( !csr[P1] ) goto P2 */ +#define OP_IfNoHope 28 /* jump, synopsis: key=r[P3@P4] */ +#define OP_NoConflict 29 /* jump, synopsis: key=r[P3@P4] */ +#define OP_NotFound 30 /* jump, synopsis: key=r[P3@P4] */ +#define OP_Found 31 /* jump, synopsis: key=r[P3@P4] */ +#define OP_SeekRowid 32 /* jump, synopsis: intkey=r[P3] */ +#define OP_NotExists 33 /* jump, synopsis: intkey=r[P3] */ +#define OP_Last 34 /* jump */ +#define OP_IfSmaller 35 /* jump */ +#define OP_SorterSort 36 /* jump */ +#define OP_Sort 37 /* jump */ +#define OP_Rewind 38 /* jump */ +#define OP_IdxLE 39 /* jump, synopsis: key=r[P3@P4] */ +#define OP_IdxGT 40 /* jump, synopsis: key=r[P3@P4] */ +#define OP_IdxLT 41 /* jump, synopsis: key=r[P3@P4] */ +#define OP_IdxGE 42 /* jump, synopsis: key=r[P3@P4] */ #define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */ #define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */ -#define OP_RowSetTest 45 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */ -#define OP_Program 46 /* jump */ -#define OP_FkIfZero 47 /* jump, synopsis: if fkctr[P1]==0 goto P2 */ -#define OP_IfPos 48 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ -#define OP_IfNotZero 49 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */ +#define OP_RowSetRead 45 /* jump, synopsis: r[P3]=rowset(P1) */ +#define OP_RowSetTest 46 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */ +#define OP_Program 47 /* jump */ +#define OP_FkIfZero 48 /* jump, synopsis: if fkctr[P1]==0 goto P2 */ +#define OP_IfPos 49 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ #define OP_IsNull 50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ #define OP_NotNull 51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ #define OP_Ne 52 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */ @@ -15874,49 +15571,49 @@ typedef struct VdbeOpList VdbeOpList; #define OP_Lt 56 /* jump, same as TK_LT, synopsis: IF r[P3]=r[P1] */ #define OP_ElseEq 58 /* jump, same as TK_ESCAPE */ -#define OP_DecrJumpZero 59 /* jump, synopsis: if (--r[P1])==0 goto P2 */ -#define OP_IncrVacuum 60 /* jump */ -#define OP_VNext 61 /* jump */ -#define OP_Init 62 /* jump, synopsis: Start at P2 */ -#define OP_PureFunc 63 /* synopsis: r[P3]=func(r[P2@NP]) */ -#define OP_Function 64 /* synopsis: r[P3]=func(r[P2@NP]) */ -#define OP_Return 65 -#define OP_EndCoroutine 66 -#define OP_HaltIfNull 67 /* synopsis: if r[P3]=null halt */ -#define OP_Halt 68 -#define OP_Integer 69 /* synopsis: r[P2]=P1 */ -#define OP_Int64 70 /* synopsis: r[P2]=P4 */ -#define OP_String 71 /* synopsis: r[P2]='P4' (len=P1) */ -#define OP_Null 72 /* synopsis: r[P2..P3]=NULL */ -#define OP_SoftNull 73 /* synopsis: r[P1]=NULL */ -#define OP_Blob 74 /* synopsis: r[P2]=P4 (len=P1) */ -#define OP_Variable 75 /* synopsis: r[P2]=parameter(P1,P4) */ -#define OP_Move 76 /* synopsis: r[P2@P3]=r[P1@P3] */ -#define OP_Copy 77 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ -#define OP_SCopy 78 /* synopsis: r[P2]=r[P1] */ -#define OP_IntCopy 79 /* synopsis: r[P2]=r[P1] */ -#define OP_ChngCntRow 80 /* synopsis: output=r[P1] */ -#define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */ -#define OP_CollSeq 82 -#define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */ -#define OP_RealAffinity 84 -#define OP_Cast 85 /* synopsis: affinity(r[P1]) */ -#define OP_Permutation 86 -#define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */ -#define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ -#define OP_ZeroOrNull 89 /* synopsis: r[P2] = 0 OR NULL */ -#define OP_Offset 90 /* synopsis: r[P3] = sqlite_offset(P1) */ -#define OP_Column 91 /* synopsis: r[P3]=PX */ -#define OP_Affinity 92 /* synopsis: affinity(r[P1@P2]) */ -#define OP_MakeRecord 93 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ -#define OP_Count 94 /* synopsis: r[P2]=count() */ -#define OP_ReadCookie 95 -#define OP_SetCookie 96 -#define OP_ReopenIdx 97 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenRead 98 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenWrite 99 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenDup 100 -#define OP_OpenAutoindex 101 /* synopsis: nColumn=P2 */ +#define OP_IfNotZero 59 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */ +#define OP_DecrJumpZero 60 /* jump, synopsis: if (--r[P1])==0 goto P2 */ +#define OP_IncrVacuum 61 /* jump */ +#define OP_VNext 62 /* jump */ +#define OP_Filter 63 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */ +#define OP_Init 64 /* jump, synopsis: Start at P2 */ +#define OP_PureFunc 65 /* synopsis: r[P3]=func(r[P2@NP]) */ +#define OP_Function 66 /* synopsis: r[P3]=func(r[P2@NP]) */ +#define OP_Return 67 +#define OP_EndCoroutine 68 +#define OP_HaltIfNull 69 /* synopsis: if r[P3]=null halt */ +#define OP_Halt 70 +#define OP_Integer 71 /* synopsis: r[P2]=P1 */ +#define OP_Int64 72 /* synopsis: r[P2]=P4 */ +#define OP_String 73 /* synopsis: r[P2]='P4' (len=P1) */ +#define OP_Null 74 /* synopsis: r[P2..P3]=NULL */ +#define OP_SoftNull 75 /* synopsis: r[P1]=NULL */ +#define OP_Blob 76 /* synopsis: r[P2]=P4 (len=P1) */ +#define OP_Variable 77 /* synopsis: r[P2]=parameter(P1,P4) */ +#define OP_Move 78 /* synopsis: r[P2@P3]=r[P1@P3] */ +#define OP_Copy 79 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ +#define OP_SCopy 80 /* synopsis: r[P2]=r[P1] */ +#define OP_IntCopy 81 /* synopsis: r[P2]=r[P1] */ +#define OP_FkCheck 82 +#define OP_ResultRow 83 /* synopsis: output=r[P1@P2] */ +#define OP_CollSeq 84 +#define OP_AddImm 85 /* synopsis: r[P1]=r[P1]+P2 */ +#define OP_RealAffinity 86 +#define OP_Cast 87 /* synopsis: affinity(r[P1]) */ +#define OP_Permutation 88 +#define OP_Compare 89 /* synopsis: r[P1@P3] <-> r[P2@P3] */ +#define OP_IsTrue 90 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ +#define OP_ZeroOrNull 91 /* synopsis: r[P2] = 0 OR NULL */ +#define OP_Offset 92 /* synopsis: r[P3] = sqlite_offset(P1) */ +#define OP_Column 93 /* synopsis: r[P3]=PX */ +#define OP_TypeCheck 94 /* synopsis: typecheck(r[P1@P2]) */ +#define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */ +#define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ +#define OP_Count 97 /* synopsis: r[P2]=count() */ +#define OP_ReadCookie 98 +#define OP_SetCookie 99 +#define OP_ReopenIdx 100 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenRead 101 /* synopsis: root=P2 iDb=P3 */ #define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ #define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ #define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ -#define OP_AggInverse 157 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ -#define OP_AggStep 158 /* synopsis: accum=r[P3] step(r[P2@P5]) */ -#define OP_AggStep1 159 /* synopsis: accum=r[P3] step(r[P2@P5]) */ -#define OP_AggValue 160 /* synopsis: r[P3]=value N=P2 */ -#define OP_AggFinal 161 /* synopsis: accum=r[P1] N=P2 */ -#define OP_Expire 162 -#define OP_CursorLock 163 -#define OP_CursorUnlock 164 -#define OP_TableLock 165 /* synopsis: iDb=P1 root=P2 write=P3 */ -#define OP_VBegin 166 -#define OP_VCreate 167 -#define OP_VDestroy 168 -#define OP_VOpen 169 -#define OP_VColumn 170 /* synopsis: r[P3]=vcolumn(P2) */ -#define OP_VRename 171 -#define OP_Pagecount 172 -#define OP_MaxPgcnt 173 -#define OP_Trace 174 -#define OP_CursorHint 175 -#define OP_ReleaseReg 176 /* synopsis: release r[P1@P2] mask P3 */ -#define OP_Noop 177 -#define OP_Explain 178 -#define OP_Abortable 179 +#define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */ +#define OP_OpenDup 113 +#define OP_BitNot 114 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ +#define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */ +#define OP_OpenEphemeral 116 /* synopsis: nColumn=P2 */ +#define OP_String8 117 /* same as TK_STRING, synopsis: r[P2]='P4' */ +#define OP_SorterOpen 118 +#define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ +#define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */ +#define OP_Close 121 +#define OP_ColumnsUsed 122 +#define OP_SeekScan 123 /* synopsis: Scan-ahead up to P1 rows */ +#define OP_SeekHit 124 /* synopsis: set P2<=seekHit<=P3 */ +#define OP_Sequence 125 /* synopsis: r[P2]=cursor[P1].ctr++ */ +#define OP_NewRowid 126 /* synopsis: r[P2]=rowid */ +#define OP_Insert 127 /* synopsis: intkey=r[P3] data=r[P2] */ +#define OP_RowCell 128 +#define OP_Delete 129 +#define OP_ResetCount 130 +#define OP_SorterCompare 131 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ +#define OP_SorterData 132 /* synopsis: r[P2]=data */ +#define OP_RowData 133 /* synopsis: r[P2]=data */ +#define OP_Rowid 134 /* synopsis: r[P2]=rowid */ +#define OP_NullRow 135 +#define OP_SeekEnd 136 +#define OP_IdxInsert 137 /* synopsis: key=r[P2] */ +#define OP_SorterInsert 138 /* synopsis: key=r[P2] */ +#define OP_IdxDelete 139 /* synopsis: key=r[P2@P3] */ +#define OP_DeferredSeek 140 /* synopsis: Move P3 to P1.rowid if needed */ +#define OP_IdxRowid 141 /* synopsis: r[P2]=rowid */ +#define OP_FinishSeek 142 +#define OP_Destroy 143 +#define OP_Clear 144 +#define OP_ResetSorter 145 +#define OP_CreateBtree 146 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ +#define OP_SqlExec 147 +#define OP_ParseSchema 148 +#define OP_LoadAnalysis 149 +#define OP_DropTable 150 +#define OP_DropIndex 151 +#define OP_DropTrigger 152 +#define OP_Real 153 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ +#define OP_IntegrityCk 154 +#define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */ +#define OP_Param 156 +#define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */ +#define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */ +#define OP_OffsetLimit 159 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ +#define OP_AggInverse 160 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ +#define OP_AggStep 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */ +#define OP_AggStep1 162 /* synopsis: accum=r[P3] step(r[P2@P5]) */ +#define OP_AggValue 163 /* synopsis: r[P3]=value N=P2 */ +#define OP_AggFinal 164 /* synopsis: accum=r[P1] N=P2 */ +#define OP_Expire 165 +#define OP_CursorLock 166 +#define OP_CursorUnlock 167 +#define OP_TableLock 168 /* synopsis: iDb=P1 root=P2 write=P3 */ +#define OP_VBegin 169 +#define OP_VCreate 170 +#define OP_VDestroy 171 +#define OP_VOpen 172 +#define OP_VInitIn 173 /* synopsis: r[P2]=ValueList(P1,P3) */ +#define OP_VColumn 174 /* synopsis: r[P3]=vcolumn(P2) */ +#define OP_VRename 175 +#define OP_Pagecount 176 +#define OP_MaxPgcnt 177 +#define OP_FilterAdd 178 /* synopsis: filter(P1) += key(P3@P4) */ +#define OP_Trace 179 +#define OP_CursorHint 180 +#define OP_ReleaseReg 181 /* synopsis: release r[P1@P2] mask P3 */ +#define OP_Noop 182 +#define OP_Explain 183 +#define OP_Abortable 184 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c @@ -16009,27 +15711,28 @@ typedef struct VdbeOpList VdbeOpList; #define OPFLG_INITIALIZER {\ /* 0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x10,\ /* 8 */ 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x03,\ -/* 16 */ 0x01, 0x01, 0x03, 0x12, 0x03, 0x01, 0x09, 0x09,\ -/* 24 */ 0x09, 0x09, 0x01, 0x09, 0x09, 0x09, 0x09, 0x09,\ -/* 32 */ 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\ -/* 40 */ 0x01, 0x01, 0x23, 0x26, 0x26, 0x0b, 0x01, 0x01,\ -/* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ -/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x00,\ -/* 64 */ 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10,\ -/* 72 */ 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10,\ -/* 80 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\ -/* 88 */ 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00, 0x10, 0x10,\ -/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x26,\ +/* 16 */ 0x01, 0x01, 0x03, 0x12, 0x03, 0x03, 0x01, 0x09,\ +/* 24 */ 0x09, 0x09, 0x09, 0x01, 0x09, 0x09, 0x09, 0x09,\ +/* 32 */ 0x09, 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\ +/* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\ +/* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ +/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\ +/* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\ +/* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\ +/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\ +/* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\ +/* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\ /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\ -/* 112 */ 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\ -/* 120 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\ -/* 128 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x04,\ -/* 136 */ 0x00, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00, 0x10,\ -/* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,\ -/* 152 */ 0x10, 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00,\ +/* 112 */ 0x00, 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00,\ +/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ +/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\ +/* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\ +/* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ +/* 152 */ 0x00, 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\ /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ -/* 176 */ 0x00, 0x00, 0x00, 0x00,} +/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\ +/* 176 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ +/* 184 */ 0x00,} /* The resolve3P2Values() routine is able to run faster if it knows ** the value of the largest JUMP opcode. The smaller the maximum @@ -16037,7 +15740,7 @@ typedef struct VdbeOpList VdbeOpList; ** generated this include file strives to group all JUMP opcodes ** together near the beginning of the list. */ -#define SQLITE_MX_JUMP_OPCODE 62 /* Maximum JUMP opcode */ +#define SQLITE_MX_JUMP_OPCODE 64 /* Maximum JUMP opcode */ /************** End of opcodes.h *********************************************/ /************** Continuing where we left off in vdbe.h ***********************/ @@ -17098,6 +16801,7 @@ struct sqlite3 { u32 nSchemaLock; /* Do not reset the schema when non-zero */ unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ int errCode; /* Most recent error code (SQLITE_*) */ + int errByteOffset; /* Byte offset of error in SQL statement */ int errMask; /* & result codes with this before returning */ int iSysErrno; /* Errno value from last system error */ u32 dbOptFlags; /* Flags to enable/disable optimizations */ @@ -17114,10 +16818,10 @@ struct sqlite3 { u8 mTrace; /* zero or more SQLITE_TRACE flags */ u8 noSharedCache; /* True if no shared-cache backends */ u8 nSqlExec; /* Number of pending OP_SqlExec opcodes */ + u8 eOpenState; /* Current condition of the connection */ int nextPagesize; /* Pagesize after VACUUM if >0 */ - u32 magic; /* Magic number for detect library misuse */ - int nChange; /* Value returned by sqlite3_changes() */ - int nTotalChange; /* Value returned by sqlite3_total_changes() */ + i64 nChange; /* Value returned by sqlite3_changes() */ + i64 nTotalChange; /* Value returned by sqlite3_total_changes() */ int aLimit[SQLITE_N_LIMIT]; /* Limits */ int nMaxSorterMmap; /* Maximum size of regions mapped by sorter */ struct sqlite3InitInfo { /* Information used during initialization */ @@ -17127,7 +16831,7 @@ struct sqlite3 { unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */ unsigned imposterTable : 1; /* Building an imposter table */ unsigned reopenMemdb : 1; /* ATTACH is really a reopen using MemDB */ - char **azInit; /* "type", "name", and "tbl_name" columns */ + const char **azInit; /* "type", "name", and "tbl_name" columns */ } init; int nVdbeActive; /* Number of VDBEs currently running */ int nVdbeRead; /* Number of active VDBEs that read or write */ @@ -17137,10 +16841,10 @@ struct sqlite3 { int nExtension; /* Number of loaded extensions */ void **aExtension; /* Array of shared library handles */ union { - void (*xLegacy)(void*,const char*); /* Legacy trace function */ - int (*xV2)(u32,void*,void*,void*); /* V2 Trace function */ + void (*xLegacy)(void*,const char*); /* mTrace==SQLITE_TRACE_LEGACY */ + int (*xV2)(u32,void*,void*,void*); /* All other mTrace values */ } trace; - void *pTraceArg; /* Argument to the trace function */ + void *pTraceArg; /* Argument to the trace function */ #ifndef SQLITE_OMIT_DEPRECATED void (*xProfile)(void*,const char*,u64); /* Profiling function */ void *pProfileArg; /* Argument to profile function */ @@ -17151,6 +16855,9 @@ struct sqlite3 { void (*xRollbackCallback)(void*); /* Invoked at every commit. */ void *pUpdateArg; void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64); + void *pAutovacPagesArg; /* Client argument to autovac_pages */ + void (*xAutovacDestr)(void*); /* Destructor for pAutovacPAgesArg */ + unsigned int (*xAutovacPages)(void*,const char*,u32,u32,u32); Parse *pParse; /* Current parse */ #ifdef SQLITE_ENABLE_PREUPDATE_HOOK void *pPreUpdateArg; /* First argument to xPreUpdateCallback */ @@ -17280,6 +16987,7 @@ struct sqlite3 { #define SQLITE_CountRows HI(0x00001) /* Count rows changed by INSERT, */ /* DELETE, or UPDATE and return */ /* the count using a callback. */ +#define SQLITE_CorruptRdOnly HI(0x00002) /* Prohibit writes due to error */ /* Flags used only if debugging */ #ifdef SQLITE_DEBUG @@ -17326,6 +17034,11 @@ struct sqlite3 { #define SQLITE_PropagateConst 0x00008000 /* The constant propagation opt */ #define SQLITE_MinMaxOpt 0x00010000 /* The min/max optimization */ #define SQLITE_SeekScan 0x00020000 /* The OP_SeekScan optimization */ +#define SQLITE_OmitOrderBy 0x00040000 /* Omit pointless ORDER BY */ + /* TH3 expects this value ^^^^^^^^^^ to be 0x40000. Coordinate any change */ +#define SQLITE_BloomFilter 0x00080000 /* Use a Bloom filter on searches */ +#define SQLITE_BloomPulldown 0x00100000 /* Run Bloom filters early */ +#define SQLITE_BalancedMerge 0x00200000 /* Balance multi-way merges */ #define SQLITE_AllOpts 0xffffffff /* All optimizations */ /* @@ -17340,17 +17053,16 @@ struct sqlite3 { */ #define ConstFactorOk(P) ((P)->okConstFactor) -/* -** Possible values for the sqlite.magic field. -** The numbers are obtained at random and have no special meaning, other -** than being distinct from one another. +/* Possible values for the sqlite3.eOpenState field. +** The numbers are randomly selected such that a minimum of three bits must +** change to convert any number to another or to zero */ -#define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ -#define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */ -#define SQLITE_MAGIC_SICK 0x4b771290 /* Error and awaiting close */ -#define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */ -#define SQLITE_MAGIC_ERROR 0xb5357930 /* An SQLITE_MISUSE error occurred */ -#define SQLITE_MAGIC_ZOMBIE 0x64cffc7f /* Close with last statement close */ +#define SQLITE_STATE_OPEN 0x76 /* Database is open */ +#define SQLITE_STATE_CLOSED 0xce /* Database is closed */ +#define SQLITE_STATE_SICK 0xba /* Error and awaiting close */ +#define SQLITE_STATE_BUSY 0x6d /* Database currently in use */ +#define SQLITE_STATE_ERROR 0xd5 /* An SQLITE_MISUSE error occurred */ +#define SQLITE_STATE_ZOMBIE 0xa7 /* Close with last statement close */ /* ** Each SQL function is defined by an instance of the following @@ -17375,7 +17087,7 @@ struct FuncDef { union { FuncDef *pHash; /* Next with a different name but the same hash */ FuncDestructor *pDestructor; /* Reference counted destructor function */ - } u; + } u; /* pHash if SQLITE_FUNC_BUILTIN, pDestructor otherwise */ }; /* @@ -17405,12 +17117,13 @@ struct FuncDestructor { ** are assert() statements in the code to verify this. ** ** Value constraints (enforced via assert()): -** SQLITE_FUNC_MINMAX == NC_MinMaxAgg == SF_MinMaxAgg -** SQLITE_FUNC_LENGTH == OPFLAG_LENGTHARG -** SQLITE_FUNC_TYPEOF == OPFLAG_TYPEOFARG -** SQLITE_FUNC_CONSTANT == SQLITE_DETERMINISTIC from the API -** SQLITE_FUNC_DIRECT == SQLITE_DIRECTONLY from the API -** SQLITE_FUNC_UNSAFE == SQLITE_INNOCUOUS +** SQLITE_FUNC_MINMAX == NC_MinMaxAgg == SF_MinMaxAgg +** SQLITE_FUNC_ANYORDER == NC_OrderAgg == SF_OrderByReqd +** SQLITE_FUNC_LENGTH == OPFLAG_LENGTHARG +** SQLITE_FUNC_TYPEOF == OPFLAG_TYPEOFARG +** SQLITE_FUNC_CONSTANT == SQLITE_DETERMINISTIC from the API +** SQLITE_FUNC_DIRECT == SQLITE_DIRECTONLY from the API +** SQLITE_FUNC_UNSAFE == SQLITE_INNOCUOUS ** SQLITE_FUNC_ENCMASK depends on SQLITE_UTF* macros in the API */ #define SQLITE_FUNC_ENCMASK 0x0003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */ @@ -17435,6 +17148,8 @@ struct FuncDestructor { #define SQLITE_FUNC_SUBTYPE 0x00100000 /* Result likely to have sub-type */ #define SQLITE_FUNC_UNSAFE 0x00200000 /* Function has side effects */ #define SQLITE_FUNC_INLINE 0x00400000 /* Functions implemented in-line */ +#define SQLITE_FUNC_BUILTIN 0x00800000 /* This is a built-in function */ +#define SQLITE_FUNC_ANYORDER 0x08000000 /* count/min/max aggregate */ /* Identifier numbers for each in-line function */ #define INLINEFUNC_coalesce 0 @@ -17497,7 +17212,7 @@ struct FuncDestructor { ** are interpreted in the same way as the first 4 parameters to ** FUNCTION(). ** -** WFUNCTION(zName, nArg, iArg, xStep, xFinal, xValue, xInverse) +** WAGGREGATE(zName, nArg, iArg, xStep, xFinal, xValue, xInverse) ** Used to create an aggregate function definition implemented by ** the C functions xStep and xFinal. The first four parameters ** are interpreted in the same way as the first 4 parameters to @@ -17512,44 +17227,55 @@ struct FuncDestructor { ** parameter. */ #define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ + {nArg, SQLITE_FUNC_BUILTIN|\ + SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } #define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } #define SFUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_DIRECTONLY|SQLITE_FUNC_UNSAFE, \ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } #define MFUNCTION(zName, nArg, xPtr, xFunc) \ - {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ xPtr, 0, xFunc, 0, 0, 0, #zName, {0} } +#define JFUNCTION(zName, nArg, iArg, xFunc) \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS|\ + SQLITE_FUNC_CONSTANT|SQLITE_UTF8, \ + SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } #define INLINE_FUNC(zName, nArg, iArg, mFlags) \ - {nArg, SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \ + {nArg, SQLITE_FUNC_BUILTIN|\ + SQLITE_UTF8|SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \ SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} } #define TEST_FUNC(zName, nArg, iArg, mFlags) \ - {nArg, SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \ + {nArg, SQLITE_FUNC_BUILTIN|\ + SQLITE_UTF8|SQLITE_FUNC_INTERNAL|SQLITE_FUNC_TEST| \ SQLITE_FUNC_INLINE|SQLITE_FUNC_CONSTANT|(mFlags), \ SQLITE_INT_TO_PTR(iArg), 0, noopFunc, 0, 0, 0, #zName, {0} } #define DFUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8, \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_SLOCHNG|SQLITE_UTF8, \ 0, 0, xFunc, 0, 0, 0, #zName, {0} } #define PURE_DATE(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \ + {nArg, SQLITE_FUNC_BUILTIN|\ + SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \ (void*)&sqlite3Config, 0, xFunc, 0, 0, 0, #zName, {0} } #define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \ - {nArg,SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\ + {nArg, SQLITE_FUNC_BUILTIN|\ + SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\ SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, 0, #zName, {0} } #define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ - {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ + {nArg, SQLITE_FUNC_BUILTIN|\ + SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ pArg, 0, xFunc, 0, 0, 0, #zName, } #define LIKEFUNC(zName, nArg, arg, flags) \ - {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|flags, \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_FUNC_CONSTANT|SQLITE_UTF8|flags, \ (void *)arg, 0, likeFunc, 0, 0, 0, #zName, {0} } #define WAGGREGATE(zName, nArg, arg, nc, xStep, xFinal, xValue, xInverse, f) \ - {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|f, \ + {nArg, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|f, \ SQLITE_INT_TO_PTR(arg), 0, xStep,xFinal,xValue,xInverse,#zName, {0}} #define INTERNAL_FUNCTION(zName, nArg, xFunc) \ - {nArg, SQLITE_FUNC_INTERNAL|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \ + {nArg, SQLITE_FUNC_BUILTIN|\ + SQLITE_FUNC_INTERNAL|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \ 0, 0, xFunc, 0, 0, 0, #zName, {0} } @@ -17605,18 +17331,42 @@ struct Module { ** or equal to the table column index. It is ** equal if and only if there are no VIRTUAL ** columns to the left. +** +** Notes on zCnName: +** The zCnName field stores the name of the column, the datatype of the +** column, and the collating sequence for the column, in that order, all in +** a single allocation. Each string is 0x00 terminated. The datatype +** is only included if the COLFLAG_HASTYPE bit of colFlags is set and the +** collating sequence name is only included if the COLFLAG_HASCOLL bit is +** set. */ struct Column { - char *zName; /* Name of this column, \000, then the type */ - Expr *pDflt; /* Default value or GENERATED ALWAYS AS value */ - char *zColl; /* Collating sequence. If NULL, use the default */ - u8 notNull; /* An OE_ code for handling a NOT NULL constraint */ - char affinity; /* One of the SQLITE_AFF_... values */ - u8 szEst; /* Estimated size of value in this column. sizeof(INT)==1 */ - u8 hName; /* Column name hash for faster lookup */ - u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */ + char *zCnName; /* Name of this column */ + unsigned notNull :4; /* An OE_ code for handling a NOT NULL constraint */ + unsigned eCType :4; /* One of the standard types */ + char affinity; /* One of the SQLITE_AFF_... values */ + u8 szEst; /* Est size of value in this column. sizeof(INT)==1 */ + u8 hName; /* Column name hash for faster lookup */ + u16 iDflt; /* 1-based index of DEFAULT. 0 means "none" */ + u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */ }; +/* Allowed values for Column.eCType. +** +** Values must match entries in the global constant arrays +** sqlite3StdTypeLen[] and sqlite3StdType[]. Each value is one more +** than the offset into these arrays for the corresponding name. +** Adjust the SQLITE_N_STDTYPE value if adding or removing entries. +*/ +#define COLTYPE_CUSTOM 0 /* Type appended to zName */ +#define COLTYPE_ANY 1 +#define COLTYPE_BLOB 2 +#define COLTYPE_INT 3 +#define COLTYPE_INTEGER 4 +#define COLTYPE_REAL 5 +#define COLTYPE_TEXT 6 +#define SQLITE_N_STDTYPE 6 /* Number of standard types */ + /* Allowed values for Column.colFlags. ** ** Constraints: @@ -17633,6 +17383,7 @@ struct Column { #define COLFLAG_STORED 0x0040 /* GENERATED ALWAYS AS ... STORED */ #define COLFLAG_NOTAVAIL 0x0080 /* STORED column not yet calculated */ #define COLFLAG_BUSY 0x0100 /* Blocks recursion on GENERATED columns */ +#define COLFLAG_HASCOLL 0x0200 /* Has collating sequence name in zCnName */ #define COLFLAG_GENERATED 0x0060 /* Combo: _STORED, _VIRTUAL */ #define COLFLAG_NOINSERT 0x0062 /* Combo: _HIDDEN, _STORED, _VIRTUAL */ @@ -17762,15 +17513,13 @@ struct VTable { #define SQLITE_VTABRISK_High 2 /* -** The schema for each SQL table and view is represented in memory -** by an instance of the following structure. +** The schema for each SQL table, virtual table, and view is represented +** in memory by an instance of the following structure. */ struct Table { char *zName; /* Name of the table or view */ Column *aCol; /* Information about each column */ Index *pIndex; /* List of SQL indexes on this table. */ - Select *pSelect; /* NULL for tables. Points to definition if a view. */ - FKey *pFKey; /* Linked list of all foreign keys in this table */ char *zColAff; /* String defining the affinity of each column */ ExprList *pCheck; /* All CHECK constraints */ /* ... also used as column name list in a VIEW */ @@ -17786,15 +17535,24 @@ struct Table { LogEst costMult; /* Cost multiplier for using this table */ #endif u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ -#ifndef SQLITE_OMIT_ALTERTABLE - int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ -#endif -#ifndef SQLITE_OMIT_VIRTUALTABLE - int nModuleArg; /* Number of arguments to the module */ - char **azModuleArg; /* 0: module 1: schema 2: vtab name 3...: args */ - VTable *pVTable; /* List of VTable objects. */ -#endif - Trigger *pTrigger; /* List of triggers stored in pSchema */ + u8 eTabType; /* 0: normal, 1: virtual, 2: view */ + union { + struct { /* Used by ordinary tables: */ + int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ + FKey *pFKey; /* Linked list of all foreign keys in this table */ + ExprList *pDfltList; /* DEFAULT clauses on various columns. + ** Or the AS clause for generated columns. */ + } tab; + struct { /* Used by views: */ + Select *pSelect; /* View definition */ + } view; + struct { /* Used by virtual tables only: */ + int nArg; /* Number of arguments to the module */ + char **azArg; /* 0: module 1: schema 2: vtab name 3...: args */ + VTable *p; /* List of VTable objects. */ + } vtab; + } u; + Trigger *pTrigger; /* List of triggers on this object */ Schema *pSchema; /* Schema that contains this table */ }; @@ -17813,24 +17571,35 @@ struct Table { ** TF_HasStored == COLFLAG_STORED ** TF_HasHidden == COLFLAG_HIDDEN */ -#define TF_Readonly 0x0001 /* Read-only system table */ -#define TF_HasHidden 0x0002 /* Has one or more hidden columns */ -#define TF_HasPrimaryKey 0x0004 /* Table has a primary key */ -#define TF_Autoincrement 0x0008 /* Integer primary key is autoincrement */ -#define TF_HasStat1 0x0010 /* nRowLogEst set from sqlite_stat1 */ -#define TF_HasVirtual 0x0020 /* Has one or more VIRTUAL columns */ -#define TF_HasStored 0x0040 /* Has one or more STORED columns */ -#define TF_HasGenerated 0x0060 /* Combo: HasVirtual + HasStored */ -#define TF_WithoutRowid 0x0080 /* No rowid. PRIMARY KEY is the key */ -#define TF_StatsUsed 0x0100 /* Query planner decisions affected by +#define TF_Readonly 0x00000001 /* Read-only system table */ +#define TF_HasHidden 0x00000002 /* Has one or more hidden columns */ +#define TF_HasPrimaryKey 0x00000004 /* Table has a primary key */ +#define TF_Autoincrement 0x00000008 /* Integer primary key is autoincrement */ +#define TF_HasStat1 0x00000010 /* nRowLogEst set from sqlite_stat1 */ +#define TF_HasVirtual 0x00000020 /* Has one or more VIRTUAL columns */ +#define TF_HasStored 0x00000040 /* Has one or more STORED columns */ +#define TF_HasGenerated 0x00000060 /* Combo: HasVirtual + HasStored */ +#define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */ +#define TF_StatsUsed 0x00000100 /* Query planner decisions affected by ** Index.aiRowLogEst[] values */ -#define TF_NoVisibleRowid 0x0200 /* No user-visible "rowid" column */ -#define TF_OOOHidden 0x0400 /* Out-of-Order hidden columns */ -#define TF_HasNotNull 0x0800 /* Contains NOT NULL constraints */ -#define TF_Shadow 0x1000 /* True for a shadow table */ -#define TF_HasStat4 0x2000 /* STAT4 info available for this table */ -#define TF_Ephemeral 0x4000 /* An ephemeral table */ -#define TF_Eponymous 0x8000 /* An eponymous virtual table */ +#define TF_NoVisibleRowid 0x00000200 /* No user-visible "rowid" column */ +#define TF_OOOHidden 0x00000400 /* Out-of-Order hidden columns */ +#define TF_HasNotNull 0x00000800 /* Contains NOT NULL constraints */ +#define TF_Shadow 0x00001000 /* True for a shadow table */ +#define TF_HasStat4 0x00002000 /* STAT4 info available for this table */ +#define TF_Ephemeral 0x00004000 /* An ephemeral table */ +#define TF_Eponymous 0x00008000 /* An eponymous virtual table */ +#define TF_Strict 0x00010000 /* STRICT mode */ + +/* +** Allowed values for Table.eTabType +*/ +#define TABTYP_NORM 0 /* Ordinary table */ +#define TABTYP_VTAB 1 /* Virtual table */ +#define TABTYP_VIEW 2 /* A view */ + +#define IsView(X) ((X)->eTabType==TABTYP_VIEW) +#define IsOrdinaryTable(X) ((X)->eTabType==TABTYP_NORM) /* ** Test to see whether or not a table is a virtual table. This is @@ -17838,9 +17607,9 @@ struct Table { ** table support is omitted from the build. */ #ifndef SQLITE_OMIT_VIRTUALTABLE -# define IsVirtual(X) ((X)->nModuleArg) +# define IsVirtual(X) ((X)->eTabType==TABTYP_VTAB) # define ExprIsVtab(X) \ - ((X)->op==TK_COLUMN && (X)->y.pTab!=0 && (X)->y.pTab->nModuleArg) + ((X)->op==TK_COLUMN && (X)->y.pTab!=0 && (X)->y.pTab->eTabType==TABTYP_VTAB) #else # define IsVirtual(X) 0 # define ExprIsVtab(X) 0 @@ -18229,10 +17998,10 @@ typedef int ynVar; ** tree. ** ** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB, -** or TK_STRING), then Expr.token contains the text of the SQL literal. If -** the expression is a variable (TK_VARIABLE), then Expr.token contains the +** or TK_STRING), then Expr.u.zToken contains the text of the SQL literal. If +** the expression is a variable (TK_VARIABLE), then Expr.u.zToken contains the ** variable name. Finally, if the expression is an SQL function (TK_FUNCTION), -** then Expr.token contains the name of the function. +** then Expr.u.zToken contains the name of the function. ** ** Expr.pRight and Expr.pLeft are the left and right subexpressions of a ** binary operator. Either or both may be NULL. @@ -18272,7 +18041,7 @@ typedef int ynVar; ** help reduce memory requirements, sometimes an Expr object will be ** truncated. And to reduce the number of memory allocations, sometimes ** two or more Expr objects will be stored in a single memory allocation, -** together with Expr.zToken strings. +** together with Expr.u.zToken strings. ** ** If the EP_Reduced and EP_TokenOnly flags are set when ** an Expr object is truncated. When EP_Reduced is set, then all @@ -18328,7 +18097,10 @@ struct Expr { ** TK_VARIABLE: variable number (always >= 1). ** TK_SELECT_COLUMN: column of the result vector */ i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ - int iRightJoinTable; /* If EP_FromJoin, the right table of the join */ + union { + int iRightJoinTable; /* If EP_FromJoin, the right table of the join */ + int iOfst; /* else: start of token from start of statement */ + } w; AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ union { Table *pTab; /* TK_COLUMN: Table containing column. Can be NULL @@ -18341,8 +18113,7 @@ struct Expr { } y; }; -/* -** The following are the meanings of bits in the Expr.flags field. +/* The following are the meanings of bits in the Expr.flags field. ** Value restrictions: ** ** EP_Agg == NC_HasAgg == SF_HasAgg @@ -18381,14 +18152,12 @@ struct Expr { #define EP_FromDDL 0x40000000 /* Originates from sqlite_schema */ /* 0x80000000 // Available */ -/* -** The EP_Propagate mask is a set of properties that automatically propagate +/* The EP_Propagate mask is a set of properties that automatically propagate ** upwards into parent nodes. */ #define EP_Propagate (EP_Collate|EP_Subquery|EP_HasFunc) -/* -** These macros can be used to test, set, or clear bits in the +/* Macros can be used to test, set, or clear bits in the ** Expr.flags field. */ #define ExprHasProperty(E,P) (((E)->flags&(P))!=0) @@ -18398,6 +18167,16 @@ struct Expr { #define ExprAlwaysTrue(E) (((E)->flags&(EP_FromJoin|EP_IsTrue))==EP_IsTrue) #define ExprAlwaysFalse(E) (((E)->flags&(EP_FromJoin|EP_IsFalse))==EP_IsFalse) +/* Macros used to ensure that the correct members of unions are accessed +** in Expr. +*/ +#define ExprUseUToken(E) (((E)->flags&EP_IntValue)==0) +#define ExprUseUValue(E) (((E)->flags&EP_IntValue)!=0) +#define ExprUseXList(E) (((E)->flags&EP_xIsSelect)==0) +#define ExprUseXSelect(E) (((E)->flags&EP_xIsSelect)!=0) +#define ExprUseYTab(E) (((E)->flags&(EP_WinFunc|EP_Subrtn))==0) +#define ExprUseYWin(E) (((E)->flags&EP_WinFunc)!=0) +#define ExprUseYSub(E) (((E)->flags&EP_Subrtn)!=0) /* Flags for use with Expr.vvaFlags */ @@ -18480,11 +18259,12 @@ struct ExprList { unsigned bSorterRef :1; /* Defer evaluation until after sorting */ unsigned bNulls: 1; /* True if explicit "NULLS FIRST/LAST" */ union { - struct { + struct { /* Used by any ExprList other than Parse.pConsExpr */ u16 iOrderByCol; /* For ORDER BY, column number in result set */ u16 iAlias; /* Index into Parse.aAlias[] for zName */ } x; - int iConstExprReg; /* Register in which Expr value is cached */ + int iConstExprReg; /* Register in which Expr value is cached. Used only + ** by Parse.pConstExpr */ } u; } a[1]; /* One slot for each expression in the list */ }; @@ -18522,6 +18302,13 @@ struct IdList { /* ** The SrcItem object represents a single term in the FROM clause of a query. ** The SrcList object is mostly an array of SrcItems. +** +** Union member validity: +** +** u1.zIndexedBy fg.isIndexedBy && !fg.isTabFunc +** u1.pFuncArg fg.isTabFunc && !fg.isIndexedBy +** u2.pIBIndex fg.isIndexedBy && !fg.isCte +** u2.pCteUse fg.isCte && !fg.isIndexedBy */ struct SrcItem { Schema *pSchema; /* Schema to which this item is fixed */ @@ -18670,31 +18457,33 @@ struct NameContext { ** Allowed values for the NameContext, ncFlags field. ** ** Value constraints (all checked via assert()): -** NC_HasAgg == SF_HasAgg == EP_Agg -** NC_MinMaxAgg == SF_MinMaxAgg == SQLITE_FUNC_MINMAX +** NC_HasAgg == SF_HasAgg == EP_Agg +** NC_MinMaxAgg == SF_MinMaxAgg == SQLITE_FUNC_MINMAX +** NC_OrderAgg == SF_OrderByReqd == SQLITE_FUNC_ANYORDER ** NC_HasWin == EP_Win ** */ -#define NC_AllowAgg 0x00001 /* Aggregate functions are allowed here */ -#define NC_PartIdx 0x00002 /* True if resolving a partial index WHERE */ -#define NC_IsCheck 0x00004 /* True if resolving a CHECK constraint */ -#define NC_GenCol 0x00008 /* True for a GENERATED ALWAYS AS clause */ -#define NC_HasAgg 0x00010 /* One or more aggregate functions seen */ -#define NC_IdxExpr 0x00020 /* True if resolving columns of CREATE INDEX */ -#define NC_SelfRef 0x0002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */ -#define NC_VarSelect 0x00040 /* A correlated subquery has been seen */ -#define NC_UEList 0x00080 /* True if uNC.pEList is used */ -#define NC_UAggInfo 0x00100 /* True if uNC.pAggInfo is used */ -#define NC_UUpsert 0x00200 /* True if uNC.pUpsert is used */ -#define NC_UBaseReg 0x00400 /* True if uNC.iBaseReg is used */ -#define NC_MinMaxAgg 0x01000 /* min/max aggregates seen. See note above */ -#define NC_Complex 0x02000 /* True if a function or subquery seen */ -#define NC_AllowWin 0x04000 /* Window functions are allowed here */ -#define NC_HasWin 0x08000 /* One or more window functions seen */ -#define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */ -#define NC_InAggFunc 0x20000 /* True if analyzing arguments to an agg func */ -#define NC_FromDDL 0x40000 /* SQL text comes from sqlite_schema */ -#define NC_NoSelect 0x80000 /* Do not descend into sub-selects */ +#define NC_AllowAgg 0x000001 /* Aggregate functions are allowed here */ +#define NC_PartIdx 0x000002 /* True if resolving a partial index WHERE */ +#define NC_IsCheck 0x000004 /* True if resolving a CHECK constraint */ +#define NC_GenCol 0x000008 /* True for a GENERATED ALWAYS AS clause */ +#define NC_HasAgg 0x000010 /* One or more aggregate functions seen */ +#define NC_IdxExpr 0x000020 /* True if resolving columns of CREATE INDEX */ +#define NC_SelfRef 0x00002e /* Combo: PartIdx, isCheck, GenCol, and IdxExpr */ +#define NC_VarSelect 0x000040 /* A correlated subquery has been seen */ +#define NC_UEList 0x000080 /* True if uNC.pEList is used */ +#define NC_UAggInfo 0x000100 /* True if uNC.pAggInfo is used */ +#define NC_UUpsert 0x000200 /* True if uNC.pUpsert is used */ +#define NC_UBaseReg 0x000400 /* True if uNC.iBaseReg is used */ +#define NC_MinMaxAgg 0x001000 /* min/max aggregates seen. See note above */ +#define NC_Complex 0x002000 /* True if a function or subquery seen */ +#define NC_AllowWin 0x004000 /* Window functions are allowed here */ +#define NC_HasWin 0x008000 /* One or more window functions seen */ +#define NC_IsDDL 0x010000 /* Resolving names in a CREATE statement */ +#define NC_InAggFunc 0x020000 /* True if analyzing arguments to an agg func */ +#define NC_FromDDL 0x040000 /* SQL text comes from sqlite_schema */ +#define NC_NoSelect 0x080000 /* Do not descend into sub-selects */ +#define NC_OrderAgg 0x8000000 /* Has an aggregate other than count/min/max */ /* ** An instance of the following object describes a single ON CONFLICT @@ -18777,9 +18566,10 @@ struct Select { ** "Select Flag". ** ** Value constraints (all checked via assert()) -** SF_HasAgg == NC_HasAgg -** SF_MinMaxAgg == NC_MinMaxAgg == SQLITE_FUNC_MINMAX -** SF_FixedLimit == WHERE_USE_LIMIT +** SF_HasAgg == NC_HasAgg +** SF_MinMaxAgg == NC_MinMaxAgg == SQLITE_FUNC_MINMAX +** SF_OrderByReqd == NC_OrderAgg == SQLITE_FUNC_ANYORDER +** SF_FixedLimit == WHERE_USE_LIMIT */ #define SF_Distinct 0x0000001 /* Output should be DISTINCT */ #define SF_All 0x0000002 /* Includes the ALL keyword */ @@ -18804,10 +18594,11 @@ struct Select { #define SF_WinRewrite 0x0100000 /* Window function rewrite accomplished */ #define SF_View 0x0200000 /* SELECT statement is a view */ #define SF_NoopOrderBy 0x0400000 /* ORDER BY is ignored for this query */ -#define SF_UpdateFrom 0x0800000 /* Statement is an UPDATE...FROM */ +#define SF_UFSrcCheck 0x0800000 /* Check pSrc as required by UPDATE...FROM */ #define SF_PushDown 0x1000000 /* SELECT has be modified by push-down opt */ #define SF_MultiPart 0x2000000 /* Has multiple incompatible PARTITIONs */ #define SF_CopyCte 0x4000000 /* SELECT statement is a copy of a CTE */ +#define SF_OrderByReqd 0x8000000 /* The ORDER BY clause may not be omitted */ /* ** The results of a SELECT can be distributed in several ways, as defined @@ -19049,7 +18840,8 @@ struct Parse { AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ Parse *pToplevel; /* Parse structure for main program (or NULL) */ Table *pTriggerTab; /* Table triggers are being coded for */ - Parse *pParentParse; /* Parent parser if this parser is nested */ + TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ + ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */ union { int addrCrTab; /* Address of OP_CreateBtree on CREATE TABLE */ Returning *pReturning; /* The RETURNING clause */ @@ -19070,6 +18862,7 @@ struct Parse { **************************************************************************/ int aTempReg[8]; /* Holding area for temporary registers */ + Parse *pOuterParse; /* Outer Parse object when nested */ Token sNameToken; /* Token with unqualified schema object name */ /************************************************************************ @@ -19104,14 +18897,14 @@ struct Parse { Token sArg; /* Complete text of a module argument */ Table **apVtabLock; /* Pointer to virtual tables needing locking */ #endif - TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ With *pWith; /* Current WITH clause, or NULL */ - ParseCleanup *pCleanup; /* List of cleanup operations to run after parse */ #ifndef SQLITE_OMIT_ALTERTABLE RenameToken *pRename; /* Tokens subject to renaming by ALTER TABLE */ #endif }; +/* Allowed values for Parse.eParseMode +*/ #define PARSE_MODE_NORMAL 0 #define PARSE_MODE_DECLARE_VTAB 1 #define PARSE_MODE_RENAME 2 @@ -19120,7 +18913,8 @@ struct Parse { /* ** Sizes and pointers of various parts of the Parse object. */ -#define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/ +#define PARSE_HDR(X) (((char*)(X))+offsetof(Parse,zErrMsg)) +#define PARSE_HDR_SZ (offsetof(Parse,aTempReg)-offsetof(Parse,zErrMsg)) /* Recursive part w/o aColCache*/ #define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */ #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */ #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */ @@ -19333,8 +19127,10 @@ typedef struct { /* ** Allowed values for mInitFlags */ +#define INITFLAG_AlterMask 0x0003 /* Types of ALTER */ #define INITFLAG_AlterRename 0x0001 /* Reparse after a RENAME */ #define INITFLAG_AlterDrop 0x0002 /* Reparse after a DROP COLUMN */ +#define INITFLAG_AlterAdd 0x0003 /* Reparse after an ADD COLUMN */ /* Tuning parameters are set using SQLITE_TESTCTRL_TUNE and are controlled ** on debug-builds of the CLI using ".testctrl tune ID VALUE". Tuning @@ -19413,6 +19209,7 @@ struct Sqlite3Config { int (*xTestCallback)(int); /* Invoked by sqlite3FaultSim() */ #endif int bLocaltimeFault; /* True to fail localtime() calls */ + int (*xAltLocaltime)(const void*,void*); /* Alternative localtime() routine */ int iOnceResetThreshold; /* When to reset OP_Once counters */ u32 szSorterRef; /* Min size in bytes to use sorter-refs */ unsigned int iPrngSeed; /* Alternative fixed seed for the PRNG */ @@ -19455,8 +19252,8 @@ struct Walker { int n; /* A counter */ int iCur; /* A cursor number */ SrcList *pSrcList; /* FROM clause */ - struct SrcCount *pSrcCount; /* Counting column references */ struct CCurHint *pCCurHint; /* Used by codeCursorHint() */ + struct RefSrcList *pRefSrcList; /* sqlite3ReferencesSrcList() */ int *aiCol; /* array of column indexes */ struct IdxCover *pIdxCover; /* Check for index coverage */ struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */ @@ -19641,7 +19438,7 @@ SQLITE_PRIVATE void sqlite3WindowListDelete(sqlite3 *db, Window *p); SQLITE_PRIVATE Window *sqlite3WindowAlloc(Parse*, int, int, Expr*, int , Expr*, u8); SQLITE_PRIVATE void sqlite3WindowAttach(Parse*, Expr*, Window*); SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin); -SQLITE_PRIVATE int sqlite3WindowCompare(Parse*, Window*, Window*, int); +SQLITE_PRIVATE int sqlite3WindowCompare(const Parse*, const Window*, const Window*, int); SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse*, Select*); SQLITE_PRIVATE void sqlite3WindowCodeStep(Parse*, Select*, WhereInfo*, int, int); SQLITE_PRIVATE int sqlite3WindowRewrite(Parse*, Select*); @@ -19773,8 +19570,8 @@ SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *, void *, u64); SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *, void *, u64); SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*); SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3*, void*); -SQLITE_PRIVATE int sqlite3MallocSize(void*); -SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, void*); +SQLITE_PRIVATE int sqlite3MallocSize(const void*); +SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, const void*); SQLITE_PRIVATE void *sqlite3PageMalloc(int); SQLITE_PRIVATE void sqlite3PageFree(void*); SQLITE_PRIVATE void sqlite3MemSetDefault(void); @@ -19890,9 +19687,10 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse*, const char*, ...); SQLITE_PRIVATE int sqlite3ErrorToParser(sqlite3*,int); SQLITE_PRIVATE void sqlite3Dequote(char*); SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*); +SQLITE_PRIVATE void sqlite3DequoteToken(Token*); SQLITE_PRIVATE void sqlite3TokenInit(Token*,char*); SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); -SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **); +SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*); SQLITE_PRIVATE void sqlite3FinishCoding(Parse*); SQLITE_PRIVATE int sqlite3GetTempReg(Parse*); SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int); @@ -19909,16 +19707,17 @@ SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*); SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*); SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse*,Expr*, Expr*); SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr*); -SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int); -SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,Expr*,FuncDef*); +SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, const Token*, int); +SQLITE_PRIVATE void sqlite3ExprFunctionUsable(Parse*,const Expr*,const FuncDef*); SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*); SQLITE_PRIVATE void sqlite3ExprDeferredDelete(Parse*, Expr*); SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse*, Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); +SQLITE_PRIVATE Select *sqlite3ExprListToValues(Parse*, int, ExprList*); SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int,int); -SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); +SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,const Token*,int); SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*); @@ -19934,6 +19733,10 @@ SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3*); SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int); SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*); SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*); +SQLITE_PRIVATE void sqlite3ColumnSetExpr(Parse*,Table*,Column*,Expr*); +SQLITE_PRIVATE Expr *sqlite3ColumnExpr(Table*,Column*); +SQLITE_PRIVATE void sqlite3ColumnSetColl(sqlite3*,Column*,const char*zColl); +SQLITE_PRIVATE const char *sqlite3ColumnColl(Column*); SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3*,Table*); SQLITE_PRIVATE void sqlite3GenerateColumnNames(Parse *pParse, Select *pSelect); SQLITE_PRIVATE int sqlite3ColumnsFromExprList(Parse*,ExprList*,i16*,Column**); @@ -19955,14 +19758,14 @@ SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table*, Column*); #else # define sqlite3ColumnPropertiesFromName(T,C) /* no-op */ #endif -SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*,Token*); +SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token,Token); SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int); SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int); SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*, const char*, const char*); SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,Expr*,const char*,const char*); SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*); SQLITE_PRIVATE void sqlite3AddGenerated(Parse*,Expr*,Token*); -SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*); +SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u32,Select*); SQLITE_PRIVATE void sqlite3AddReturning(Parse*,ExprList*); SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*, sqlite3_vfs**,char**,char **); @@ -20048,10 +19851,12 @@ SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); #if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,char*); #endif +SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe*,int,const char*); SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*, ExprList*, Expr*); SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*,Expr*,int,ExprList*,Expr*, Upsert*); -SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); +SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*, + ExprList*,Select*,u16,int); SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); SQLITE_PRIVATE LogEst sqlite3WhereOutputRowCount(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); @@ -20072,7 +19877,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int); #ifndef SQLITE_OMIT_GENERATED_COLUMNS -SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn(Parse*, Column*, int); +SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn(Parse*, Table*, Column*, int); #endif SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int); SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int); @@ -20091,23 +19896,24 @@ SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*); #define LOCATE_VIEW 0x01 #define LOCATE_NOERR 0x02 SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,u32 flags,const char*, const char*); +SQLITE_PRIVATE const char *sqlite3PreferredTableName(const char*); SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,u32 flags,SrcItem *); SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*,Expr*); SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int, sqlite3_value*); -SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*); -SQLITE_PRIVATE int sqlite3ExprCompare(Parse*,Expr*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int); -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse*,Expr*, Expr*, int); +SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, const Token*); +SQLITE_PRIVATE int sqlite3ExprCompare(const Parse*,const Expr*,const Expr*, int); +SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*,Expr*,int); +SQLITE_PRIVATE int sqlite3ExprListCompare(const ExprList*,const ExprList*, int); +SQLITE_PRIVATE int sqlite3ExprImpliesExpr(const Parse*,const Expr*,const Expr*, int); SQLITE_PRIVATE int sqlite3ExprImpliesNonNullRow(Expr*,int); SQLITE_PRIVATE void sqlite3AggInfoPersistWalkerInit(Walker*,Parse*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx); -SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*); +SQLITE_PRIVATE int sqlite3ReferencesSrcList(Parse*, Expr*, SrcList*); SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); #ifndef SQLITE_UNTESTABLE SQLITE_PRIVATE void sqlite3PrngSaveState(void); @@ -20129,10 +19935,11 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*); SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*, u8); SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse*, Expr*, ExprList*); SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr*,int); +SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr*,const SrcItem*); #ifdef SQLITE_ENABLE_CURSOR_HINTS SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr*); #endif -SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*); +SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr*, int*); SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*); SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char); SQLITE_PRIVATE int sqlite3IsRowid(const char*); @@ -20157,17 +19964,22 @@ SQLITE_PRIVATE void sqlite3MayAbort(Parse*); SQLITE_PRIVATE void sqlite3HaltConstraint(Parse*, int, int, char*, i8, u8); SQLITE_PRIVATE void sqlite3UniqueConstraint(Parse*, int, Index*); SQLITE_PRIVATE void sqlite3RowidConstraint(Parse*, int, Table*); -SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,Expr*,int); -SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int); -SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int); -SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,IdList*); -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,Select*,int); +SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,const Expr*,int); +SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3*,const ExprList*,int); +SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3*,const SrcList*,int); +SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,const IdList*); +SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,const Select*,int); SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch(int,const char*); SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(FuncDef*,int); SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,u8,u8); +SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum*,sqlite3_value*); SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void); SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void); +SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void); SQLITE_PRIVATE void sqlite3RegisterPerConnectionBuiltinFunctions(sqlite3*); +#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) +SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3*); +#endif SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*); SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*); SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int); @@ -20257,14 +20069,8 @@ SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); SQLITE_PRIVATE LogEst sqlite3LogEst(u64); SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst); -#ifndef SQLITE_OMIT_VIRTUALTABLE SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double); -#endif -#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ - defined(SQLITE_ENABLE_STAT4) || \ - defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst); -#endif SQLITE_PRIVATE VList *sqlite3VListAdd(sqlite3*,VList*,const char*,int,int); SQLITE_PRIVATE const char *sqlite3VListNumToName(VList*,int); SQLITE_PRIVATE int sqlite3VListNameToNum(VList*,const char*,int); @@ -20299,7 +20105,7 @@ SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3*, Index*); SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe*, Table*, int); SQLITE_PRIVATE char sqlite3CompareAffinity(const Expr *pExpr, char aff2); SQLITE_PRIVATE int sqlite3IndexAffinityOk(const Expr *pExpr, char idx_affinity); -SQLITE_PRIVATE char sqlite3TableColumnAffinity(Table*,int); +SQLITE_PRIVATE char sqlite3TableColumnAffinity(const Table*,int); SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr); SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8); SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*); @@ -20328,14 +20134,14 @@ SQLITE_PRIVATE void sqlite3SetTextEncoding(sqlite3 *db, u8); SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr); SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, const Expr *pExpr); SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,const Expr*,const Expr*); -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int); -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*); +SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(const Parse *pParse, Expr*, const Token*, int); +SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(const Parse*,Expr*,const char*); SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr*); SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr*); SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *, CollSeq *); SQLITE_PRIVATE int sqlite3WritableSchema(sqlite3*); SQLITE_PRIVATE int sqlite3CheckObjectName(Parse*, const char*,const char*,const char*); -SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *, int); +SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *, i64); SQLITE_PRIVATE int sqlite3AddInt64(i64*,i64); SQLITE_PRIVATE int sqlite3SubInt64(i64*,i64); SQLITE_PRIVATE int sqlite3MulInt64(i64*,i64); @@ -20360,11 +20166,15 @@ SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *); #ifndef SQLITE_OMIT_UTF16 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); #endif -SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); +SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, const Expr *, u8, u8, sqlite3_value **); SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); #ifndef SQLITE_AMALGAMATION SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[]; SQLITE_PRIVATE const char sqlite3StrBINARY[]; +SQLITE_PRIVATE const unsigned char sqlite3StdTypeLen[]; +SQLITE_PRIVATE const char sqlite3StdTypeAffinity[]; +SQLITE_PRIVATE const char sqlite3StdTypeMap[]; +SQLITE_PRIVATE const char *sqlite3StdType[]; SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[]; SQLITE_PRIVATE const unsigned char *sqlite3aLTb; SQLITE_PRIVATE const unsigned char *sqlite3aEQb; @@ -20408,9 +20218,9 @@ SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); -SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse*, SrcList*, Token*); -SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse*, void*, Token*); -SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, void *pTo, void *pFrom); +SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse*, SrcList*, const Token*); +SQLITE_PRIVATE const void *sqlite3RenameTokenMap(Parse*, const void*, const Token*); +SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse*, const void *pTo, const void *pFrom); SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse*, Expr*); SQLITE_PRIVATE void sqlite3RenameExprlistUnmap(Parse*, ExprList*); SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); @@ -20447,15 +20257,20 @@ SQLITE_PRIVATE int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, FuncDestructor *pDestructor ); SQLITE_PRIVATE void sqlite3NoopDestructor(void*); -SQLITE_PRIVATE void sqlite3OomFault(sqlite3*); +SQLITE_PRIVATE void *sqlite3OomFault(sqlite3*); SQLITE_PRIVATE void sqlite3OomClear(sqlite3*); SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int); SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, sqlite3*, char*, int, int); +SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum*, int); SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); +SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum*, u8); +SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context*,StrAccum*); SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); +SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3*,const char*); +SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3*,const Expr*); SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); @@ -20506,7 +20321,7 @@ SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char*); #endif #ifdef SQLITE_OMIT_VIRTUALTABLE -# define sqlite3VtabClear(Y) +# define sqlite3VtabClear(D,T) # define sqlite3VtabSync(X,Y) SQLITE_OK # define sqlite3VtabRollback(X) # define sqlite3VtabCommit(X) @@ -20543,9 +20358,11 @@ SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db); #ifndef SQLITE_OMIT_VIRTUALTABLE SQLITE_PRIVATE int sqlite3ShadowTableName(sqlite3 *db, const char *zName); SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3*,Table*,const char*); +SQLITE_PRIVATE void sqlite3MarkAllShadowTablesOf(sqlite3*, Table*); #else # define sqlite3ShadowTableName(A,B) 0 # define sqlite3IsShadowTableOf(A,B,C) 0 +# define sqlite3MarkAllShadowTablesOf(A,B) #endif SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse*,Module*); SQLITE_PRIVATE void sqlite3VtabEponymousTableClear(sqlite3*,Module*); @@ -20558,11 +20375,17 @@ SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*); SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *); SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *); + SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); +#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \ + && !defined(SQLITE_OMIT_VIRTUALTABLE) +SQLITE_PRIVATE void sqlite3VtabWriteAll(sqlite3_index_info*); +#endif SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); -SQLITE_PRIVATE void sqlite3ParserReset(Parse*); +SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse*,sqlite3*); +SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse*); SQLITE_PRIVATE void *sqlite3ParserAddCleanup(Parse*,void(*)(sqlite3*,void*),void*); #ifdef SQLITE_ENABLE_NORMALIZE SQLITE_PRIVATE char *sqlite3Normalize(Vdbe*, const char*); @@ -20588,7 +20411,7 @@ SQLITE_PRIVATE With *sqlite3WithPush(Parse*, With*, u8); # define sqlite3CteDelete(D,C) # define sqlite3CteWithAdd(P,W,C) ((void*)0) # define sqlite3WithDelete(x,y) -# define sqlite3WithPush(x,y,z) +# define sqlite3WithPush(x,y,z) ((void*)0) #endif #ifndef SQLITE_OMIT_UPSERT SQLITE_PRIVATE Upsert *sqlite3UpsertNew(sqlite3*,ExprList*,Expr*,ExprList*,Expr*,Upsert*); @@ -20621,6 +20444,7 @@ SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int); SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*); SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *); +SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3*,int); #else #define sqlite3FkActions(a,b,c,d,e,f) #define sqlite3FkCheck(a,b,c,d,e,f) @@ -20628,6 +20452,7 @@ SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *); #define sqlite3FkOldmask(a,b) 0 #define sqlite3FkRequired(a,b,c,d) 0 #define sqlite3FkReferences(a) 0 + #define sqlite3FkClearTriggerCache(a,b) #endif #ifndef SQLITE_OMIT_FOREIGN_KEY SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*); @@ -20685,7 +20510,7 @@ SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *); SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p); #if SQLITE_MAX_EXPR_DEPTH>0 -SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *); +SQLITE_PRIVATE int sqlite3SelectExprHeight(const Select *); SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse*, int); #else #define sqlite3SelectExprHeight(x) 0 @@ -20756,8 +20581,8 @@ SQLITE_API SQLITE_EXTERN void (SQLITE_CDECL *sqlite3IoTrace)(const char*,...); */ #ifdef SQLITE_MEMDEBUG SQLITE_PRIVATE void sqlite3MemdebugSetType(void*,u8); -SQLITE_PRIVATE int sqlite3MemdebugHasType(void*,u8); -SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8); +SQLITE_PRIVATE int sqlite3MemdebugHasType(const void*,u8); +SQLITE_PRIVATE int sqlite3MemdebugNoType(const void*,u8); #else # define sqlite3MemdebugSetType(X,Y) /* no-op */ # define sqlite3MemdebugHasType(X,Y) 1 @@ -20782,10 +20607,10 @@ SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3*); SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*); #endif -SQLITE_PRIVATE int sqlite3ExprVectorSize(Expr *pExpr); -SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr); +SQLITE_PRIVATE int sqlite3ExprVectorSize(const Expr *pExpr); +SQLITE_PRIVATE int sqlite3ExprIsVector(const Expr *pExpr); SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int); -SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int); +SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int,int); SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*); #ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS @@ -20795,6 +20620,993 @@ SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt); #endif /* SQLITEINT_H */ /************** End of sqliteInt.h *******************************************/ +/************** Begin file os_common.h ***************************************/ +/* +** 2004 May 22 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains macros and a little bit of code that is common to +** all of the platform-specific files (os_*.c) and is #included into those +** files. +** +** This file should be #included by the os_*.c files only. It is not a +** general purpose header file. +*/ +#ifndef _OS_COMMON_H_ +#define _OS_COMMON_H_ + +/* +** At least two bugs have slipped in because we changed the MEMORY_DEBUG +** macro to SQLITE_DEBUG and some older makefiles have not yet made the +** switch. The following code should catch this problem at compile-time. +*/ +#ifdef MEMORY_DEBUG +# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead." +#endif + +/* +** Macros for performance tracing. Normally turned off. Only works +** on i486 hardware. +*/ +#ifdef SQLITE_PERFORMANCE_TRACE + +/* +** hwtime.h contains inline assembler code for implementing +** high-performance timing routines. +*/ +/************** Include hwtime.h in the middle of os_common.h ****************/ +/************** Begin file hwtime.h ******************************************/ +/* +** 2008 May 27 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +****************************************************************************** +** +** This file contains inline asm code for retrieving "high-performance" +** counters for x86 and x86_64 class CPUs. +*/ +#ifndef SQLITE_HWTIME_H +#define SQLITE_HWTIME_H + +/* +** The following routine only works on pentium-class (or newer) processors. +** It uses the RDTSC opcode to read the cycle count value out of the +** processor and returns that value. This can be used for high-res +** profiling. +*/ +#if !defined(__STRICT_ANSI__) && \ + (defined(__GNUC__) || defined(_MSC_VER)) && \ + (defined(i386) || defined(__i386__) || defined(_M_IX86)) + + #if defined(__GNUC__) + + __inline__ sqlite_uint64 sqlite3Hwtime(void){ + unsigned int lo, hi; + __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); + return (sqlite_uint64)hi << 32 | lo; + } + + #elif defined(_MSC_VER) + + __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ + __asm { + rdtsc + ret ; return value at EDX:EAX + } + } + + #endif + +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) + + __inline__ sqlite_uint64 sqlite3Hwtime(void){ + unsigned long val; + __asm__ __volatile__ ("rdtsc" : "=A" (val)); + return val; + } + +#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) + + __inline__ sqlite_uint64 sqlite3Hwtime(void){ + unsigned long long retval; + unsigned long junk; + __asm__ __volatile__ ("\n\ + 1: mftbu %1\n\ + mftb %L0\n\ + mftbu %0\n\ + cmpw %0,%1\n\ + bne 1b" + : "=r" (retval), "=r" (junk)); + return retval; + } + +#else + + /* + ** asm() is needed for hardware timing support. Without asm(), + ** disable the sqlite3Hwtime() routine. + ** + ** sqlite3Hwtime() is only used for some obscure debugging + ** and analysis configurations, not in any deliverable, so this + ** should not be a great loss. + */ +SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } + +#endif + +#endif /* !defined(SQLITE_HWTIME_H) */ + +/************** End of hwtime.h **********************************************/ +/************** Continuing where we left off in os_common.h ******************/ + +static sqlite_uint64 g_start; +static sqlite_uint64 g_elapsed; +#define TIMER_START g_start=sqlite3Hwtime() +#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start +#define TIMER_ELAPSED g_elapsed +#else +#define TIMER_START +#define TIMER_END +#define TIMER_ELAPSED ((sqlite_uint64)0) +#endif + +/* +** If we compile with the SQLITE_TEST macro set, then the following block +** of code will give us the ability to simulate a disk I/O error. This +** is used for testing the I/O recovery logic. +*/ +#if defined(SQLITE_TEST) +SQLITE_API extern int sqlite3_io_error_hit; +SQLITE_API extern int sqlite3_io_error_hardhit; +SQLITE_API extern int sqlite3_io_error_pending; +SQLITE_API extern int sqlite3_io_error_persist; +SQLITE_API extern int sqlite3_io_error_benign; +SQLITE_API extern int sqlite3_diskfull_pending; +SQLITE_API extern int sqlite3_diskfull; +#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) +#define SimulateIOError(CODE) \ + if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ + || sqlite3_io_error_pending-- == 1 ) \ + { local_ioerr(); CODE; } +static void local_ioerr(){ + IOTRACE(("IOERR\n")); + sqlite3_io_error_hit++; + if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; +} +#define SimulateDiskfullError(CODE) \ + if( sqlite3_diskfull_pending ){ \ + if( sqlite3_diskfull_pending == 1 ){ \ + local_ioerr(); \ + sqlite3_diskfull = 1; \ + sqlite3_io_error_hit = 1; \ + CODE; \ + }else{ \ + sqlite3_diskfull_pending--; \ + } \ + } +#else +#define SimulateIOErrorBenign(X) +#define SimulateIOError(A) +#define SimulateDiskfullError(A) +#endif /* defined(SQLITE_TEST) */ + +/* +** When testing, keep a count of the number of open files. +*/ +#if defined(SQLITE_TEST) +SQLITE_API extern int sqlite3_open_file_count; +#define OpenCounter(X) sqlite3_open_file_count+=(X) +#else +#define OpenCounter(X) +#endif /* defined(SQLITE_TEST) */ + +#endif /* !defined(_OS_COMMON_H_) */ + +/************** End of os_common.h *******************************************/ +/************** Begin file ctime.c *******************************************/ +/* DO NOT EDIT! +** This file is automatically generated by the script in the canonical +** SQLite source tree at tool/mkctimec.tcl. +** +** To modify this header, edit any of the various lists in that script +** which specify categories of generated conditionals in this file. +*/ + +/* +** 2010 February 23 +** +** The author disclaims copyright to this source code. In place of +** a legal notice, here is a blessing: +** +** May you do good and not evil. +** May you find forgiveness for yourself and forgive others. +** May you share freely, never taking more than you give. +** +************************************************************************* +** +** This file implements routines used to report what compile-time options +** SQLite was built with. +*/ +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS /* IMP: R-16824-07538 */ + +/* +** Include the configuration header output by 'configure' if we're using the +** autoconf-based build +*/ +#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) +/* #include "config.h" */ +#define SQLITECONFIG_H 1 +#endif + +/* These macros are provided to "stringify" the value of the define +** for those options in which the value is meaningful. */ +#define CTIMEOPT_VAL_(opt) #opt +#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) + +/* Like CTIMEOPT_VAL, but especially for SQLITE_DEFAULT_LOOKASIDE. This +** option requires a separate macro because legal values contain a single +** comma. e.g. (-DSQLITE_DEFAULT_LOOKASIDE="100,100") */ +#define CTIMEOPT_VAL2_(opt1,opt2) #opt1 "," #opt2 +#define CTIMEOPT_VAL2(opt) CTIMEOPT_VAL2_(opt) +/* #include "sqliteInt.h" */ + +/* +** An array of names of all compile-time options. This array should +** be sorted A-Z. +** +** This array looks large, but in a typical installation actually uses +** only a handful of compile-time options, so most times this array is usually +** rather short and uses little memory space. +*/ +static const char * const sqlite3azCompileOpt[] = { + +#ifdef SQLITE_32BIT_ROWID + "32BIT_ROWID", +#endif +#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC + "4_BYTE_ALIGNED_MALLOC", +#endif +#ifdef SQLITE_64BIT_STATS + "64BIT_STATS", +#endif +#ifdef SQLITE_ALLOW_COVERING_INDEX_SCAN +# if SQLITE_ALLOW_COVERING_INDEX_SCAN != 1 + "ALLOW_COVERING_INDEX_SCAN=" CTIMEOPT_VAL(SQLITE_ALLOW_COVERING_INDEX_SCAN), +# endif +#endif +#ifdef SQLITE_ALLOW_URI_AUTHORITY + "ALLOW_URI_AUTHORITY", +#endif +#ifdef SQLITE_ATOMIC_INTRINSICS + "ATOMIC_INTRINSICS=" CTIMEOPT_VAL(SQLITE_ATOMIC_INTRINSICS), +#endif +#ifdef SQLITE_BITMASK_TYPE + "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE), +#endif +#ifdef SQLITE_BUG_COMPATIBLE_20160819 + "BUG_COMPATIBLE_20160819", +#endif +#ifdef SQLITE_CASE_SENSITIVE_LIKE + "CASE_SENSITIVE_LIKE", +#endif +#ifdef SQLITE_CHECK_PAGES + "CHECK_PAGES", +#endif +#if defined(__clang__) && defined(__clang_major__) + "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." + CTIMEOPT_VAL(__clang_minor__) "." + CTIMEOPT_VAL(__clang_patchlevel__), +#elif defined(_MSC_VER) + "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), +#elif defined(__GNUC__) && defined(__VERSION__) + "COMPILER=gcc-" __VERSION__, +#endif +#ifdef SQLITE_COVERAGE_TEST + "COVERAGE_TEST", +#endif +#ifdef SQLITE_DEBUG + "DEBUG", +#endif +#ifdef SQLITE_DEFAULT_AUTOMATIC_INDEX + "DEFAULT_AUTOMATIC_INDEX", +#endif +#ifdef SQLITE_DEFAULT_AUTOVACUUM + "DEFAULT_AUTOVACUUM", +#endif +#ifdef SQLITE_DEFAULT_CACHE_SIZE + "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE), +#endif +#ifdef SQLITE_DEFAULT_CKPTFULLFSYNC + "DEFAULT_CKPTFULLFSYNC", +#endif +#ifdef SQLITE_DEFAULT_FILE_FORMAT + "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT), +#endif +#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS + "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS), +#endif +#ifdef SQLITE_DEFAULT_FOREIGN_KEYS + "DEFAULT_FOREIGN_KEYS", +#endif +#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT + "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT), +#endif +#ifdef SQLITE_DEFAULT_LOCKING_MODE + "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), +#endif +#ifdef SQLITE_DEFAULT_LOOKASIDE + "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL2(SQLITE_DEFAULT_LOOKASIDE), +#endif +#ifdef SQLITE_DEFAULT_MEMSTATUS +# if SQLITE_DEFAULT_MEMSTATUS != 1 + "DEFAULT_MEMSTATUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_MEMSTATUS), +# endif +#endif +#ifdef SQLITE_DEFAULT_MMAP_SIZE + "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), +#endif +#ifdef SQLITE_DEFAULT_PAGE_SIZE + "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE), +#endif +#ifdef SQLITE_DEFAULT_PCACHE_INITSZ + "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ), +#endif +#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS + "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS), +#endif +#ifdef SQLITE_DEFAULT_RECURSIVE_TRIGGERS + "DEFAULT_RECURSIVE_TRIGGERS", +#endif +#ifdef SQLITE_DEFAULT_ROWEST + "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST), +#endif +#ifdef SQLITE_DEFAULT_SECTOR_SIZE + "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE), +#endif +#ifdef SQLITE_DEFAULT_SYNCHRONOUS + "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS), +#endif +#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT + "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT), +#endif +#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS + "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS), +#endif +#ifdef SQLITE_DEFAULT_WORKER_THREADS + "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS), +#endif +#ifdef SQLITE_DIRECT_OVERFLOW_READ + "DIRECT_OVERFLOW_READ", +#endif +#ifdef SQLITE_DISABLE_DIRSYNC + "DISABLE_DIRSYNC", +#endif +#ifdef SQLITE_DISABLE_FTS3_UNICODE + "DISABLE_FTS3_UNICODE", +#endif +#ifdef SQLITE_DISABLE_FTS4_DEFERRED + "DISABLE_FTS4_DEFERRED", +#endif +#ifdef SQLITE_DISABLE_INTRINSIC + "DISABLE_INTRINSIC", +#endif +#ifdef SQLITE_DISABLE_LFS + "DISABLE_LFS", +#endif +#ifdef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS + "DISABLE_PAGECACHE_OVERFLOW_STATS", +#endif +#ifdef SQLITE_DISABLE_SKIPAHEAD_DISTINCT + "DISABLE_SKIPAHEAD_DISTINCT", +#endif +#ifdef SQLITE_ENABLE_8_3_NAMES + "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), +#endif +#ifdef SQLITE_ENABLE_API_ARMOR + "ENABLE_API_ARMOR", +#endif +#ifdef SQLITE_ENABLE_ATOMIC_WRITE + "ENABLE_ATOMIC_WRITE", +#endif +#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE + "ENABLE_BATCH_ATOMIC_WRITE", +#endif +#ifdef SQLITE_ENABLE_BYTECODE_VTAB + "ENABLE_BYTECODE_VTAB", +#endif +#ifdef SQLITE_ENABLE_CEROD + "ENABLE_CEROD=" CTIMEOPT_VAL(SQLITE_ENABLE_CEROD), +#endif +#ifdef SQLITE_ENABLE_COLUMN_METADATA + "ENABLE_COLUMN_METADATA", +#endif +#ifdef SQLITE_ENABLE_COLUMN_USED_MASK + "ENABLE_COLUMN_USED_MASK", +#endif +#ifdef SQLITE_ENABLE_COSTMULT + "ENABLE_COSTMULT", +#endif +#ifdef SQLITE_ENABLE_CURSOR_HINTS + "ENABLE_CURSOR_HINTS", +#endif +#ifdef SQLITE_ENABLE_DBPAGE_VTAB + "ENABLE_DBPAGE_VTAB", +#endif +#ifdef SQLITE_ENABLE_DBSTAT_VTAB + "ENABLE_DBSTAT_VTAB", +#endif +#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT + "ENABLE_EXPENSIVE_ASSERT", +#endif +#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS + "ENABLE_EXPLAIN_COMMENTS", +#endif +#ifdef SQLITE_ENABLE_FTS3 + "ENABLE_FTS3", +#endif +#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS + "ENABLE_FTS3_PARENTHESIS", +#endif +#ifdef SQLITE_ENABLE_FTS3_TOKENIZER + "ENABLE_FTS3_TOKENIZER", +#endif +#ifdef SQLITE_ENABLE_FTS4 + "ENABLE_FTS4", +#endif +#ifdef SQLITE_ENABLE_FTS5 + "ENABLE_FTS5", +#endif +#ifdef SQLITE_ENABLE_GEOPOLY + "ENABLE_GEOPOLY", +#endif +#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS + "ENABLE_HIDDEN_COLUMNS", +#endif +#ifdef SQLITE_ENABLE_ICU + "ENABLE_ICU", +#endif +#ifdef SQLITE_ENABLE_IOTRACE + "ENABLE_IOTRACE", +#endif +#ifdef SQLITE_ENABLE_LOAD_EXTENSION + "ENABLE_LOAD_EXTENSION", +#endif +#ifdef SQLITE_ENABLE_LOCKING_STYLE + "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), +#endif +#ifdef SQLITE_ENABLE_MATH_FUNCTIONS + "ENABLE_MATH_FUNCTIONS", +#endif +#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT + "ENABLE_MEMORY_MANAGEMENT", +#endif +#ifdef SQLITE_ENABLE_MEMSYS3 + "ENABLE_MEMSYS3", +#endif +#ifdef SQLITE_ENABLE_MEMSYS5 + "ENABLE_MEMSYS5", +#endif +#ifdef SQLITE_ENABLE_MULTIPLEX + "ENABLE_MULTIPLEX", +#endif +#ifdef SQLITE_ENABLE_NORMALIZE + "ENABLE_NORMALIZE", +#endif +#ifdef SQLITE_ENABLE_NULL_TRIM + "ENABLE_NULL_TRIM", +#endif +#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC + "ENABLE_OFFSET_SQL_FUNC", +#endif +#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK + "ENABLE_OVERSIZE_CELL_CHECK", +#endif +#ifdef SQLITE_ENABLE_PREUPDATE_HOOK + "ENABLE_PREUPDATE_HOOK", +#endif +#ifdef SQLITE_ENABLE_QPSG + "ENABLE_QPSG", +#endif +#ifdef SQLITE_ENABLE_RBU + "ENABLE_RBU", +#endif +#ifdef SQLITE_ENABLE_RTREE + "ENABLE_RTREE", +#endif +#ifdef SQLITE_ENABLE_SELECTTRACE + "ENABLE_SELECTTRACE", +#endif +#ifdef SQLITE_ENABLE_SESSION + "ENABLE_SESSION", +#endif +#ifdef SQLITE_ENABLE_SNAPSHOT + "ENABLE_SNAPSHOT", +#endif +#ifdef SQLITE_ENABLE_SORTER_REFERENCES + "ENABLE_SORTER_REFERENCES", +#endif +#ifdef SQLITE_ENABLE_SQLLOG + "ENABLE_SQLLOG", +#endif +#ifdef SQLITE_ENABLE_STAT4 + "ENABLE_STAT4", +#endif +#ifdef SQLITE_ENABLE_STMTVTAB + "ENABLE_STMTVTAB", +#endif +#ifdef SQLITE_ENABLE_STMT_SCANSTATUS + "ENABLE_STMT_SCANSTATUS", +#endif +#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION + "ENABLE_UNKNOWN_SQL_FUNCTION", +#endif +#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY + "ENABLE_UNLOCK_NOTIFY", +#endif +#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT + "ENABLE_UPDATE_DELETE_LIMIT", +#endif +#ifdef SQLITE_ENABLE_URI_00_ERROR + "ENABLE_URI_00_ERROR", +#endif +#ifdef SQLITE_ENABLE_VFSTRACE + "ENABLE_VFSTRACE", +#endif +#ifdef SQLITE_ENABLE_WHERETRACE + "ENABLE_WHERETRACE", +#endif +#ifdef SQLITE_ENABLE_ZIPVFS + "ENABLE_ZIPVFS", +#endif +#ifdef SQLITE_EXPLAIN_ESTIMATED_ROWS + "EXPLAIN_ESTIMATED_ROWS", +#endif +#ifdef SQLITE_EXTRA_IFNULLROW + "EXTRA_IFNULLROW", +#endif +#ifdef SQLITE_EXTRA_INIT + "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT), +#endif +#ifdef SQLITE_EXTRA_SHUTDOWN + "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN), +#endif +#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH + "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH), +#endif +#ifdef SQLITE_FTS5_ENABLE_TEST_MI + "FTS5_ENABLE_TEST_MI", +#endif +#ifdef SQLITE_FTS5_NO_WITHOUT_ROWID + "FTS5_NO_WITHOUT_ROWID", +#endif +#if HAVE_ISNAN || SQLITE_HAVE_ISNAN + "HAVE_ISNAN", +#endif +#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX +# if SQLITE_HOMEGROWN_RECURSIVE_MUTEX != 1 + "HOMEGROWN_RECURSIVE_MUTEX=" CTIMEOPT_VAL(SQLITE_HOMEGROWN_RECURSIVE_MUTEX), +# endif +#endif +#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS + "IGNORE_AFP_LOCK_ERRORS", +#endif +#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS + "IGNORE_FLOCK_LOCK_ERRORS", +#endif +#ifdef SQLITE_INLINE_MEMCPY + "INLINE_MEMCPY", +#endif +#ifdef SQLITE_INT64_TYPE + "INT64_TYPE", +#endif +#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX + "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX), +#endif +#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS + "LIKE_DOESNT_MATCH_BLOBS", +#endif +#ifdef SQLITE_LOCK_TRACE + "LOCK_TRACE", +#endif +#ifdef SQLITE_LOG_CACHE_SPILL + "LOG_CACHE_SPILL", +#endif +#ifdef SQLITE_MALLOC_SOFT_LIMIT + "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT), +#endif +#ifdef SQLITE_MAX_ATTACHED + "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED), +#endif +#ifdef SQLITE_MAX_COLUMN + "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN), +#endif +#ifdef SQLITE_MAX_COMPOUND_SELECT + "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT), +#endif +#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE + "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE), +#endif +#ifdef SQLITE_MAX_EXPR_DEPTH + "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH), +#endif +#ifdef SQLITE_MAX_FUNCTION_ARG + "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG), +#endif +#ifdef SQLITE_MAX_LENGTH + "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH), +#endif +#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH + "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH), +#endif +#ifdef SQLITE_MAX_MEMORY + "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY), +#endif +#ifdef SQLITE_MAX_MMAP_SIZE + "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE), +#endif +#ifdef SQLITE_MAX_MMAP_SIZE_ + "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_), +#endif +#ifdef SQLITE_MAX_PAGE_COUNT + "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT), +#endif +#ifdef SQLITE_MAX_PAGE_SIZE + "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE), +#endif +#ifdef SQLITE_MAX_SCHEMA_RETRY + "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), +#endif +#ifdef SQLITE_MAX_SQL_LENGTH + "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH), +#endif +#ifdef SQLITE_MAX_TRIGGER_DEPTH + "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH), +#endif +#ifdef SQLITE_MAX_VARIABLE_NUMBER + "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER), +#endif +#ifdef SQLITE_MAX_VDBE_OP + "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP), +#endif +#ifdef SQLITE_MAX_WORKER_THREADS + "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS), +#endif +#ifdef SQLITE_MEMDEBUG + "MEMDEBUG", +#endif +#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT + "MIXED_ENDIAN_64BIT_FLOAT", +#endif +#ifdef SQLITE_MMAP_READWRITE + "MMAP_READWRITE", +#endif +#ifdef SQLITE_MUTEX_NOOP + "MUTEX_NOOP", +#endif +#ifdef SQLITE_MUTEX_OMIT + "MUTEX_OMIT", +#endif +#ifdef SQLITE_MUTEX_PTHREADS + "MUTEX_PTHREADS", +#endif +#ifdef SQLITE_MUTEX_W32 + "MUTEX_W32", +#endif +#ifdef SQLITE_NEED_ERR_NAME + "NEED_ERR_NAME", +#endif +#ifdef SQLITE_NO_SYNC + "NO_SYNC", +#endif +#ifdef SQLITE_OMIT_ALTERTABLE + "OMIT_ALTERTABLE", +#endif +#ifdef SQLITE_OMIT_ANALYZE + "OMIT_ANALYZE", +#endif +#ifdef SQLITE_OMIT_ATTACH + "OMIT_ATTACH", +#endif +#ifdef SQLITE_OMIT_AUTHORIZATION + "OMIT_AUTHORIZATION", +#endif +#ifdef SQLITE_OMIT_AUTOINCREMENT + "OMIT_AUTOINCREMENT", +#endif +#ifdef SQLITE_OMIT_AUTOINIT + "OMIT_AUTOINIT", +#endif +#ifdef SQLITE_OMIT_AUTOMATIC_INDEX + "OMIT_AUTOMATIC_INDEX", +#endif +#ifdef SQLITE_OMIT_AUTORESET + "OMIT_AUTORESET", +#endif +#ifdef SQLITE_OMIT_AUTOVACUUM + "OMIT_AUTOVACUUM", +#endif +#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION + "OMIT_BETWEEN_OPTIMIZATION", +#endif +#ifdef SQLITE_OMIT_BLOB_LITERAL + "OMIT_BLOB_LITERAL", +#endif +#ifdef SQLITE_OMIT_CAST + "OMIT_CAST", +#endif +#ifdef SQLITE_OMIT_CHECK + "OMIT_CHECK", +#endif +#ifdef SQLITE_OMIT_COMPLETE + "OMIT_COMPLETE", +#endif +#ifdef SQLITE_OMIT_COMPOUND_SELECT + "OMIT_COMPOUND_SELECT", +#endif +#ifdef SQLITE_OMIT_CONFLICT_CLAUSE + "OMIT_CONFLICT_CLAUSE", +#endif +#ifdef SQLITE_OMIT_CTE + "OMIT_CTE", +#endif +#if defined(SQLITE_OMIT_DATETIME_FUNCS) || defined(SQLITE_OMIT_FLOATING_POINT) + "OMIT_DATETIME_FUNCS", +#endif +#ifdef SQLITE_OMIT_DECLTYPE + "OMIT_DECLTYPE", +#endif +#ifdef SQLITE_OMIT_DEPRECATED + "OMIT_DEPRECATED", +#endif +#ifdef SQLITE_OMIT_DESERIALIZE + "OMIT_DESERIALIZE", +#endif +#ifdef SQLITE_OMIT_DISKIO + "OMIT_DISKIO", +#endif +#ifdef SQLITE_OMIT_EXPLAIN + "OMIT_EXPLAIN", +#endif +#ifdef SQLITE_OMIT_FLAG_PRAGMAS + "OMIT_FLAG_PRAGMAS", +#endif +#ifdef SQLITE_OMIT_FLOATING_POINT + "OMIT_FLOATING_POINT", +#endif +#ifdef SQLITE_OMIT_FOREIGN_KEY + "OMIT_FOREIGN_KEY", +#endif +#ifdef SQLITE_OMIT_GET_TABLE + "OMIT_GET_TABLE", +#endif +#ifdef SQLITE_OMIT_HEX_INTEGER + "OMIT_HEX_INTEGER", +#endif +#ifdef SQLITE_OMIT_INCRBLOB + "OMIT_INCRBLOB", +#endif +#ifdef SQLITE_OMIT_INTEGRITY_CHECK + "OMIT_INTEGRITY_CHECK", +#endif +#ifdef SQLITE_OMIT_INTROSPECTION_PRAGMAS + "OMIT_INTROSPECTION_PRAGMAS", +#endif +#ifdef SQLITE_OMIT_JSON + "OMIT_JSON", +#endif +#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION + "OMIT_LIKE_OPTIMIZATION", +#endif +#ifdef SQLITE_OMIT_LOAD_EXTENSION + "OMIT_LOAD_EXTENSION", +#endif +#ifdef SQLITE_OMIT_LOCALTIME + "OMIT_LOCALTIME", +#endif +#ifdef SQLITE_OMIT_LOOKASIDE + "OMIT_LOOKASIDE", +#endif +#ifdef SQLITE_OMIT_MEMORYDB + "OMIT_MEMORYDB", +#endif +#ifdef SQLITE_OMIT_OR_OPTIMIZATION + "OMIT_OR_OPTIMIZATION", +#endif +#ifdef SQLITE_OMIT_PAGER_PRAGMAS + "OMIT_PAGER_PRAGMAS", +#endif +#ifdef SQLITE_OMIT_PARSER_TRACE + "OMIT_PARSER_TRACE", +#endif +#ifdef SQLITE_OMIT_POPEN + "OMIT_POPEN", +#endif +#ifdef SQLITE_OMIT_PRAGMA + "OMIT_PRAGMA", +#endif +#ifdef SQLITE_OMIT_PROGRESS_CALLBACK + "OMIT_PROGRESS_CALLBACK", +#endif +#ifdef SQLITE_OMIT_QUICKBALANCE + "OMIT_QUICKBALANCE", +#endif +#ifdef SQLITE_OMIT_REINDEX + "OMIT_REINDEX", +#endif +#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS + "OMIT_SCHEMA_PRAGMAS", +#endif +#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS + "OMIT_SCHEMA_VERSION_PRAGMAS", +#endif +#ifdef SQLITE_OMIT_SHARED_CACHE + "OMIT_SHARED_CACHE", +#endif +#ifdef SQLITE_OMIT_SHUTDOWN_DIRECTORIES + "OMIT_SHUTDOWN_DIRECTORIES", +#endif +#ifdef SQLITE_OMIT_SUBQUERY + "OMIT_SUBQUERY", +#endif +#ifdef SQLITE_OMIT_TCL_VARIABLE + "OMIT_TCL_VARIABLE", +#endif +#ifdef SQLITE_OMIT_TEMPDB + "OMIT_TEMPDB", +#endif +#ifdef SQLITE_OMIT_TEST_CONTROL + "OMIT_TEST_CONTROL", +#endif +#ifdef SQLITE_OMIT_TRACE +# if SQLITE_OMIT_TRACE != 1 + "OMIT_TRACE=" CTIMEOPT_VAL(SQLITE_OMIT_TRACE), +# endif +#endif +#ifdef SQLITE_OMIT_TRIGGER + "OMIT_TRIGGER", +#endif +#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION + "OMIT_TRUNCATE_OPTIMIZATION", +#endif +#ifdef SQLITE_OMIT_UTF16 + "OMIT_UTF16", +#endif +#ifdef SQLITE_OMIT_VACUUM + "OMIT_VACUUM", +#endif +#ifdef SQLITE_OMIT_VIEW + "OMIT_VIEW", +#endif +#ifdef SQLITE_OMIT_VIRTUALTABLE + "OMIT_VIRTUALTABLE", +#endif +#ifdef SQLITE_OMIT_WAL + "OMIT_WAL", +#endif +#ifdef SQLITE_OMIT_WSD + "OMIT_WSD", +#endif +#ifdef SQLITE_OMIT_XFER_OPT + "OMIT_XFER_OPT", +#endif +#ifdef SQLITE_PCACHE_SEPARATE_HEADER + "PCACHE_SEPARATE_HEADER", +#endif +#ifdef SQLITE_PERFORMANCE_TRACE + "PERFORMANCE_TRACE", +#endif +#ifdef SQLITE_POWERSAFE_OVERWRITE +# if SQLITE_POWERSAFE_OVERWRITE != 1 + "POWERSAFE_OVERWRITE=" CTIMEOPT_VAL(SQLITE_POWERSAFE_OVERWRITE), +# endif +#endif +#ifdef SQLITE_PREFER_PROXY_LOCKING + "PREFER_PROXY_LOCKING", +#endif +#ifdef SQLITE_PROXY_DEBUG + "PROXY_DEBUG", +#endif +#ifdef SQLITE_REVERSE_UNORDERED_SELECTS + "REVERSE_UNORDERED_SELECTS", +#endif +#ifdef SQLITE_RTREE_INT_ONLY + "RTREE_INT_ONLY", +#endif +#ifdef SQLITE_SECURE_DELETE + "SECURE_DELETE", +#endif +#ifdef SQLITE_SMALL_STACK + "SMALL_STACK", +#endif +#ifdef SQLITE_SORTER_PMASZ + "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ), +#endif +#ifdef SQLITE_SOUNDEX + "SOUNDEX", +#endif +#ifdef SQLITE_STAT4_SAMPLES + "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES), +#endif +#ifdef SQLITE_STMTJRNL_SPILL + "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL), +#endif +#ifdef SQLITE_SUBSTR_COMPATIBILITY + "SUBSTR_COMPATIBILITY", +#endif +#if (!defined(SQLITE_WIN32_MALLOC) \ + && !defined(SQLITE_ZERO_MALLOC) \ + && !defined(SQLITE_MEMDEBUG) \ + ) || defined(SQLITE_SYSTEM_MALLOC) + "SYSTEM_MALLOC", +#endif +#ifdef SQLITE_TCL + "TCL", +#endif +#ifdef SQLITE_TEMP_STORE + "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), +#endif +#ifdef SQLITE_TEST + "TEST", +#endif +#if defined(SQLITE_THREADSAFE) + "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), +#elif defined(THREADSAFE) + "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE), +#else + "THREADSAFE=1", +#endif +#ifdef SQLITE_UNLINK_AFTER_CLOSE + "UNLINK_AFTER_CLOSE", +#endif +#ifdef SQLITE_UNTESTABLE + "UNTESTABLE", +#endif +#ifdef SQLITE_USER_AUTHENTICATION + "USER_AUTHENTICATION", +#endif +#ifdef SQLITE_USE_ALLOCA + "USE_ALLOCA", +#endif +#ifdef SQLITE_USE_FCNTL_TRACE + "USE_FCNTL_TRACE", +#endif +#ifdef SQLITE_USE_URI + "USE_URI", +#endif +#ifdef SQLITE_VDBE_COVERAGE + "VDBE_COVERAGE", +#endif +#ifdef SQLITE_WIN32_MALLOC + "WIN32_MALLOC", +#endif +#ifdef SQLITE_ZERO_MALLOC + "ZERO_MALLOC", +#endif + +} ; + +SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){ + *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); + return (const char**)sqlite3azCompileOpt; +} + +#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ + +/************** End of ctime.c ***********************************************/ /************** Begin file global.c ******************************************/ /* ** 2008 June 13 @@ -21084,6 +21896,7 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { 0, /* xTestCallback */ #endif 0, /* bLocaltimeFault */ + 0, /* xAltLocaltime */ 0x7ffffffe, /* iOnceResetThreshold */ SQLITE_DEFAULT_SORTERREF_SIZE, /* szSorterRef */ 0, /* iPrngSeed */ @@ -21096,6 +21909,18 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { */ SQLITE_PRIVATE FuncDefHash sqlite3BuiltinFunctions; +#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG) +/* +** Counter used for coverage testing. Does not come into play for +** release builds. +** +** Access to this global variable is not mutex protected. This might +** result in TSAN warnings. But as the variable does not exist in +** release builds, that should not be a concern. +*/ +SQLITE_PRIVATE unsigned int sqlite3CoverageCounter; +#endif /* SQLITE_COVERAGE_TEST || SQLITE_DEBUG */ + #ifdef VDBE_PROFILE /* ** The following performance counter can be used in place of @@ -21146,6 +21971,48 @@ SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER; */ SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY"; +/* +** Standard typenames. These names must match the COLTYPE_* definitions. +** Adjust the SQLITE_N_STDTYPE value if adding or removing entries. +** +** sqlite3StdType[] The actual names of the datatypes. +** +** sqlite3StdTypeLen[] The length (in bytes) of each entry +** in sqlite3StdType[]. +** +** sqlite3StdTypeAffinity[] The affinity associated with each entry +** in sqlite3StdType[]. +** +** sqlite3StdTypeMap[] The type value (as returned from +** sqlite3_column_type() or sqlite3_value_type()) +** for each entry in sqlite3StdType[]. +*/ +SQLITE_PRIVATE const unsigned char sqlite3StdTypeLen[] = { 3, 4, 3, 7, 4, 4 }; +SQLITE_PRIVATE const char sqlite3StdTypeAffinity[] = { + SQLITE_AFF_NUMERIC, + SQLITE_AFF_BLOB, + SQLITE_AFF_INTEGER, + SQLITE_AFF_INTEGER, + SQLITE_AFF_REAL, + SQLITE_AFF_TEXT +}; +SQLITE_PRIVATE const char sqlite3StdTypeMap[] = { + 0, + SQLITE_BLOB, + SQLITE_INTEGER, + SQLITE_INTEGER, + SQLITE_FLOAT, + SQLITE_TEXT +}; +SQLITE_PRIVATE const char *sqlite3StdType[] = { + "ANY", + "BLOB", + "INT", + "INTEGER", + "REAL", + "TEXT" +}; + /************** End of global.c **********************************************/ /************** Begin file status.c ******************************************/ /* @@ -21243,7 +22110,7 @@ typedef struct AuxData AuxData; typedef struct VdbeCursor VdbeCursor; struct VdbeCursor { u8 eCurType; /* One of the CURTYPE_* values above */ - i8 iDb; /* Index of cursor database in db->aDb[] (or -1) */ + i8 iDb; /* Index of cursor database in db->aDb[] */ u8 nullRow; /* True if pointing to a row with no data */ u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */ u8 isTable; /* True for rowid tables. False for indexes */ @@ -21256,9 +22123,11 @@ struct VdbeCursor { Bool isOrdered:1; /* True if the table is not BTREE_UNORDERED */ Bool hasBeenDuped:1; /* This cursor was source or target of OP_OpenDup */ u16 seekHit; /* See the OP_SeekHit and OP_IfNoHope opcodes */ - Btree *pBtx; /* Separate file holding temporary table */ + union { /* pBtx for isEphermeral. pAltMap otherwise */ + Btree *pBtx; /* Separate file holding temporary table */ + u32 *aAltMap; /* Mapping from table to index column numbers */ + } ub; i64 seqCount; /* Sequence counter */ - u32 *aAltMap; /* Mapping from table to index column numbers */ /* Cached OP_Column parse information is only valid if cacheStatus matches ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of @@ -21348,8 +22217,8 @@ struct VdbeFrame { int nMem; /* Number of entries in aMem */ int nChildMem; /* Number of memory cells for child frame */ int nChildCsr; /* Number of cursors for child frame */ - int nChange; /* Statement changes (Vdbe.nChange) */ - int nDbChange; /* Value of db->nChange */ + i64 nChange; /* Statement changes (Vdbe.nChange) */ + i64 nDbChange; /* Value of db->nChange */ }; /* Magic number for sanity checking on VdbeFrame objects */ @@ -21556,7 +22425,7 @@ struct Vdbe { u32 cacheCtr; /* VdbeCursor row cache generation counter */ int pc; /* The program counter */ int rc; /* Value to return */ - int nChange; /* Number of db changes made since last reset */ + i64 nChange; /* Number of db changes made since last reset */ int iStatement; /* Statement number (or 0 if has no opened stmt) */ i64 iCurrentTime; /* Value of julianday('now') for this statement */ i64 nFkConstraint; /* Number of imm. FK constraints this VM */ @@ -21598,7 +22467,7 @@ struct Vdbe { bft bIsReader:1; /* True for statements that read */ yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ yDbMask lockMask; /* Subset of btreeMask that requires a lock */ - u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */ + u32 aCounter[9]; /* Counters used by sqlite3_stmt_status() */ char *zSql; /* Text of the SQL statement that generated this */ #ifdef SQLITE_ENABLE_NORMALIZE char *zNormSql; /* Normalization of the associated SQL statement */ @@ -21648,6 +22517,24 @@ struct PreUpdate { Index *pPk; /* PK index if pTab is WITHOUT ROWID */ }; +/* +** An instance of this object is used to pass an vector of values into +** OP_VFilter, the xFilter method of a virtual table. The vector is the +** set of values on the right-hand side of an IN constraint. +** +** The value as passed into xFilter is an sqlite3_value with a "pointer" +** type, such as is generated by sqlite3_result_pointer() and read by +** sqlite3_value_pointer. Such values have MEM_Term|MEM_Subtype|MEM_Null +** and a subtype of 'p'. The sqlite3_vtab_in_first() and _next() interfaces +** know how to use this object to step through all the values in the +** right operand of the IN constraint. +*/ +typedef struct ValueList ValueList; +struct ValueList { + BtCursor *pCsr; /* An ephemeral table holding all values */ + sqlite3_value *pOut; /* Register to hold each decoded output value */ +}; + /* ** Function prototypes */ @@ -21660,7 +22547,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor*); SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32); SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8); SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32); -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); +SQLITE_PRIVATE void sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3*, AuxData**, int, int); int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); @@ -21694,14 +22581,19 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem*, double); SQLITE_PRIVATE void sqlite3VdbeMemSetPointer(Mem*, void*, const char*, void(*)(void*)); SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem*,sqlite3*,u16); SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*); +#ifndef SQLITE_OMIT_INCRBLOB SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int); +#else +SQLITE_PRIVATE int sqlite3VdbeMemSetZeroBlob(Mem*,int); +#endif #ifdef SQLITE_DEBUG SQLITE_PRIVATE int sqlite3VdbeMemIsRowSet(const Mem*); #endif SQLITE_PRIVATE int sqlite3VdbeMemSetRowSet(Mem*); SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*); SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, u8, u8); -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*); +SQLITE_PRIVATE int sqlite3IntFloatCompare(i64,double); +SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem*); SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*); SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*); SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem*, int ifNull); @@ -22679,8 +23571,10 @@ static void clearYMD_HMS_TZ(DateTime *p){ ** is available. This routine returns 0 on success and ** non-zero on any kind of error. ** -** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this -** routine will always fail. +** If the sqlite3GlobalConfig.bLocaltimeFault variable is non-zero then this +** routine will always fail. If bLocaltimeFault is nonzero and +** sqlite3GlobalConfig.xAltLocaltime is not NULL, then xAltLocaltime() is +** invoked in place of the OS-defined localtime() function. ** ** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C ** library function localtime_r() is used to assist in the calculation of @@ -22696,14 +23590,30 @@ static int osLocaltime(time_t *t, struct tm *pTm){ sqlite3_mutex_enter(mutex); pX = localtime(t); #ifndef SQLITE_UNTESTABLE - if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0; + if( sqlite3GlobalConfig.bLocaltimeFault ){ + if( sqlite3GlobalConfig.xAltLocaltime!=0 + && 0==sqlite3GlobalConfig.xAltLocaltime((const void*)t,(void*)pTm) + ){ + pX = pTm; + }else{ + pX = 0; + } + } #endif if( pX ) *pTm = *pX; +#if SQLITE_THREADSAFE>0 sqlite3_mutex_leave(mutex); +#endif rc = pX==0; #else #ifndef SQLITE_UNTESTABLE - if( sqlite3GlobalConfig.bLocaltimeFault ) return 1; + if( sqlite3GlobalConfig.bLocaltimeFault ){ + if( sqlite3GlobalConfig.xAltLocaltime!=0 ){ + return sqlite3GlobalConfig.xAltLocaltime((const void*)t,(void*)pTm); + }else{ + return 1; + } + } #endif #if HAVE_LOCALTIME_R rc = localtime_r(t, pTm)==0; @@ -22718,67 +23628,56 @@ static int osLocaltime(time_t *t, struct tm *pTm){ #ifndef SQLITE_OMIT_LOCALTIME /* -** Compute the difference (in milliseconds) between localtime and UTC -** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs, -** return this value and set *pRc to SQLITE_OK. -** -** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value -** is undefined in this case. +** Assuming the input DateTime is UTC, move it to its localtime equivalent. */ -static sqlite3_int64 localtimeOffset( - DateTime *p, /* Date at which to calculate offset */ - sqlite3_context *pCtx, /* Write error here if one occurs */ - int *pRc /* OUT: Error code. SQLITE_OK or ERROR */ +static int toLocaltime( + DateTime *p, /* Date at which to calculate offset */ + sqlite3_context *pCtx /* Write error here if one occurs */ ){ - DateTime x, y; time_t t; struct tm sLocal; + int iYearDiff; /* Initialize the contents of sLocal to avoid a compiler warning. */ memset(&sLocal, 0, sizeof(sLocal)); - x = *p; - computeYMD_HMS(&x); - if( x.Y<1971 || x.Y>=2038 ){ + computeJD(p); + if( p->iJD<2108667600*(i64)100000 /* 1970-01-01 */ + || p->iJD>2130141456*(i64)100000 /* 2038-01-18 */ + ){ /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only ** works for years between 1970 and 2037. For dates outside this range, ** SQLite attempts to map the year into an equivalent year within this ** range, do the calculation, then map the year back. */ - x.Y = 2000; - x.M = 1; - x.D = 1; - x.h = 0; - x.m = 0; - x.s = 0.0; - } else { - int s = (int)(x.s + 0.5); - x.s = s; + DateTime x = *p; + computeYMD_HMS(&x); + iYearDiff = (2000 + x.Y%4) - x.Y; + x.Y += iYearDiff; + x.validJD = 0; + computeJD(&x); + t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); + }else{ + iYearDiff = 0; + t = (time_t)(p->iJD/1000 - 21086676*(i64)10000); } - x.tz = 0; - x.validJD = 0; - computeJD(&x); - t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); if( osLocaltime(&t, &sLocal) ){ sqlite3_result_error(pCtx, "local time unavailable", -1); - *pRc = SQLITE_ERROR; - return 0; + return SQLITE_ERROR; } - y.Y = sLocal.tm_year + 1900; - y.M = sLocal.tm_mon + 1; - y.D = sLocal.tm_mday; - y.h = sLocal.tm_hour; - y.m = sLocal.tm_min; - y.s = sLocal.tm_sec; - y.validYMD = 1; - y.validHMS = 1; - y.validJD = 0; - y.rawS = 0; - y.validTZ = 0; - y.isError = 0; - computeJD(&y); - *pRc = SQLITE_OK; - return y.iJD - x.iJD; + p->Y = sLocal.tm_year + 1900 - iYearDiff; + p->M = sLocal.tm_mon + 1; + p->D = sLocal.tm_mday; + p->h = sLocal.tm_hour; + p->m = sLocal.tm_min; + p->s = sLocal.tm_sec + (p->iJD%1000)*0.001; + p->validYMD = 1; + p->validHMS = 1; + p->validJD = 0; + p->rawS = 0; + p->validTZ = 0; + p->isError = 0; + return SQLITE_OK; } #endif /* SQLITE_OMIT_LOCALTIME */ @@ -22791,18 +23690,17 @@ static sqlite3_int64 localtimeOffset( ** of several units of time. */ static const struct { - u8 eType; /* Transformation type code */ - u8 nName; /* Length of th name */ - char *zName; /* Name of the transformation */ - double rLimit; /* Maximum NNN value for this transform */ - double rXform; /* Constant used for this transform */ + u8 nName; /* Length of the name */ + char zName[7]; /* Name of the transformation */ + float rLimit; /* Maximum NNN value for this transform */ + float rXform; /* Constant used for this transform */ } aXformType[] = { - { 0, 6, "second", 464269060800.0, 1000.0 }, - { 0, 6, "minute", 7737817680.0, 60000.0 }, - { 0, 4, "hour", 128963628.0, 3600000.0 }, - { 0, 3, "day", 5373485.0, 86400000.0 }, - { 1, 5, "month", 176546.0, 2592000000.0 }, - { 2, 4, "year", 14713.0, 31536000000.0 }, + { 6, "second", 4.6427e+14, 1.0 }, + { 6, "minute", 7.7379e+12, 60.0 }, + { 4, "hour", 1.2897e+11, 3600.0 }, + { 3, "day", 5373485.0, 86400.0 }, + { 5, "month", 176546.0, 2592000.0 }, + { 4, "year", 14713.0, 31536000.0 }, }; /* @@ -22833,11 +23731,55 @@ static int parseModifier( sqlite3_context *pCtx, /* Function context */ const char *z, /* The text of the modifier */ int n, /* Length of zMod in bytes */ - DateTime *p /* The date/time value to be modified */ + DateTime *p, /* The date/time value to be modified */ + int idx /* Parameter index of the modifier */ ){ int rc = 1; double r; switch(sqlite3UpperToLower[(u8)z[0]] ){ + case 'a': { + /* + ** auto + ** + ** If rawS is available, then interpret as a julian day number, or + ** a unix timestamp, depending on its magnitude. + */ + if( sqlite3_stricmp(z, "auto")==0 ){ + if( idx>1 ) return 1; /* IMP: R-33611-57934 */ + if( !p->rawS || p->validJD ){ + rc = 0; + p->rawS = 0; + }else if( p->s>=-21086676*(i64)10000 /* -4713-11-24 12:00:00 */ + && p->s<=(25340230*(i64)10000)+799 /* 9999-12-31 23:59:59 */ + ){ + r = p->s*1000.0 + 210866760000000.0; + clearYMD_HMS_TZ(p); + p->iJD = (sqlite3_int64)(r + 0.5); + p->validJD = 1; + p->rawS = 0; + rc = 0; + } + } + break; + } + case 'j': { + /* + ** julianday + ** + ** Always interpret the prior number as a julian-day value. If this + ** is not the first modifier, or if the prior argument is not a numeric + ** value in the allowed range of julian day numbers understood by + ** SQLite (0..5373484.5) then the result will be NULL. + */ + if( sqlite3_stricmp(z, "julianday")==0 ){ + if( idx>1 ) return 1; /* IMP: R-31176-64601 */ + if( p->validJD && p->rawS ){ + rc = 0; + p->rawS = 0; + } + } + break; + } #ifndef SQLITE_OMIT_LOCALTIME case 'l': { /* localtime @@ -22846,9 +23788,7 @@ static int parseModifier( ** show local time. */ if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){ - computeJD(p); - p->iJD += localtimeOffset(p, pCtx, &rc); - clearYMD_HMS_TZ(p); + rc = toLocaltime(p, pCtx); } break; } @@ -22861,6 +23801,7 @@ static int parseModifier( ** seconds since 1970. Convert to a real julian day number. */ if( sqlite3_stricmp(z, "unixepoch")==0 && p->rawS ){ + if( idx>1 ) return 1; /* IMP: R-49255-55373 */ r = p->s*1000.0 + 210866760000000.0; if( r>=0.0 && r<464269060800000.0 ){ clearYMD_HMS_TZ(p); @@ -22873,18 +23814,31 @@ static int parseModifier( #ifndef SQLITE_OMIT_LOCALTIME else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){ if( p->tzSet==0 ){ - sqlite3_int64 c1; + i64 iOrigJD; /* Original localtime */ + i64 iGuess; /* Guess at the corresponding utc time */ + int cnt = 0; /* Safety to prevent infinite loop */ + int iErr; /* Guess is off by this much */ + computeJD(p); - c1 = localtimeOffset(p, pCtx, &rc); - if( rc==SQLITE_OK ){ - p->iJD -= c1; - clearYMD_HMS_TZ(p); - p->iJD += c1 - localtimeOffset(p, pCtx, &rc); - } + iGuess = iOrigJD = p->iJD; + iErr = 0; + do{ + DateTime new; + memset(&new, 0, sizeof(new)); + iGuess -= iErr; + new.iJD = iGuess; + new.validJD = 1; + rc = toLocaltime(&new, pCtx); + if( rc ) return rc; + computeJD(&new); + iErr = new.iJD - iOrigJD; + }while( iErr && cnt++<3 ); + memset(p, 0, sizeof(*p)); + p->iJD = iGuess; + p->validJD = 1; p->tzSet = 1; - }else{ - rc = SQLITE_OK; } + rc = SQLITE_OK; } #endif break; @@ -23000,9 +23954,10 @@ static int parseModifier( && sqlite3_strnicmp(aXformType[i].zName, z, n)==0 && r>-aXformType[i].rLimit && rM += (int)r; x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; @@ -23012,8 +23967,9 @@ static int parseModifier( r -= (int)r; break; } - case 2: { /* Special processing to add years */ + case 5: { /* Special processing to add years */ int y = (int)r; + assert( strcmp(aXformType[i].zName,"year")==0 ); computeYMD_HMS(p); p->Y += y; p->validJD = 0; @@ -23022,7 +23978,7 @@ static int parseModifier( } } computeJD(p); - p->iJD += (sqlite3_int64)(r*aXformType[i].rXform + rRounder); + p->iJD += (sqlite3_int64)(r*1000.0*aXformType[i].rXform + rRounder); rc = 0; break; } @@ -23072,7 +24028,7 @@ static int isDate( for(i=1; iisError || !validJulianDay(p->iJD) ) return 1; @@ -23102,6 +24058,24 @@ static void juliandayFunc( } } +/* +** unixepoch( TIMESTRING, MOD, MOD, ...) +** +** Return the number of seconds (including fractional seconds) since +** the unix epoch of 1970-01-01 00:00:00 GMT. +*/ +static void unixepochFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + DateTime x; + if( isDate(context, argc, argv, &x)==0 ){ + computeJD(&x); + sqlite3_result_int64(context, x.iJD/1000 - 21086676*(i64)10000); + } +} + /* ** datetime( TIMESTRING, MOD, MOD, ...) ** @@ -23114,11 +24088,38 @@ static void datetimeFunc( ){ DateTime x; if( isDate(context, argc, argv, &x)==0 ){ - char zBuf[100]; + int Y, s; + char zBuf[24]; computeYMD_HMS(&x); - sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d %02d:%02d:%02d", - x.Y, x.M, x.D, x.h, x.m, (int)(x.s)); - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); + Y = x.Y; + if( Y<0 ) Y = -Y; + zBuf[1] = '0' + (Y/1000)%10; + zBuf[2] = '0' + (Y/100)%10; + zBuf[3] = '0' + (Y/10)%10; + zBuf[4] = '0' + (Y)%10; + zBuf[5] = '-'; + zBuf[6] = '0' + (x.M/10)%10; + zBuf[7] = '0' + (x.M)%10; + zBuf[8] = '-'; + zBuf[9] = '0' + (x.D/10)%10; + zBuf[10] = '0' + (x.D)%10; + zBuf[11] = ' '; + zBuf[12] = '0' + (x.h/10)%10; + zBuf[13] = '0' + (x.h)%10; + zBuf[14] = ':'; + zBuf[15] = '0' + (x.m/10)%10; + zBuf[16] = '0' + (x.m)%10; + zBuf[17] = ':'; + s = (int)x.s; + zBuf[18] = '0' + (s/10)%10; + zBuf[19] = '0' + (s)%10; + zBuf[20] = 0; + if( x.Y<0 ){ + zBuf[0] = '-'; + sqlite3_result_text(context, zBuf, 20, SQLITE_TRANSIENT); + }else{ + sqlite3_result_text(context, &zBuf[1], 19, SQLITE_TRANSIENT); + } } } @@ -23134,10 +24135,20 @@ static void timeFunc( ){ DateTime x; if( isDate(context, argc, argv, &x)==0 ){ - char zBuf[100]; + int s; + char zBuf[16]; computeHMS(&x); - sqlite3_snprintf(sizeof(zBuf), zBuf, "%02d:%02d:%02d", x.h, x.m, (int)x.s); - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); + zBuf[0] = '0' + (x.h/10)%10; + zBuf[1] = '0' + (x.h)%10; + zBuf[2] = ':'; + zBuf[3] = '0' + (x.m/10)%10; + zBuf[4] = '0' + (x.m)%10; + zBuf[5] = ':'; + s = (int)x.s; + zBuf[6] = '0' + (s/10)%10; + zBuf[7] = '0' + (s)%10; + zBuf[8] = 0; + sqlite3_result_text(context, zBuf, 8, SQLITE_TRANSIENT); } } @@ -23153,10 +24164,28 @@ static void dateFunc( ){ DateTime x; if( isDate(context, argc, argv, &x)==0 ){ - char zBuf[100]; + int Y; + char zBuf[16]; computeYMD(&x); - sqlite3_snprintf(sizeof(zBuf), zBuf, "%04d-%02d-%02d", x.Y, x.M, x.D); - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); + Y = x.Y; + if( Y<0 ) Y = -Y; + zBuf[1] = '0' + (Y/1000)%10; + zBuf[2] = '0' + (Y/100)%10; + zBuf[3] = '0' + (Y/10)%10; + zBuf[4] = '0' + (Y)%10; + zBuf[5] = '-'; + zBuf[6] = '0' + (x.M/10)%10; + zBuf[7] = '0' + (x.M)%10; + zBuf[8] = '-'; + zBuf[9] = '0' + (x.D/10)%10; + zBuf[10] = '0' + (x.D)%10; + zBuf[11] = 0; + if( x.Y<0 ){ + zBuf[0] = '-'; + sqlite3_result_text(context, zBuf, 11, SQLITE_TRANSIENT); + }else{ + sqlite3_result_text(context, &zBuf[1], 10, SQLITE_TRANSIENT); + } } } @@ -23185,131 +24214,100 @@ static void strftimeFunc( sqlite3_value **argv ){ DateTime x; - u64 n; size_t i,j; - char *z; sqlite3 *db; const char *zFmt; - char zBuf[100]; + sqlite3_str sRes; + + if( argc==0 ) return; zFmt = (const char*)sqlite3_value_text(argv[0]); if( zFmt==0 || isDate(context, argc-1, argv+1, &x) ) return; db = sqlite3_context_db_handle(context); - for(i=0, n=1; zFmt[i]; i++, n++){ - if( zFmt[i]=='%' ){ - switch( zFmt[i+1] ){ - case 'd': - case 'H': - case 'm': - case 'M': - case 'S': - case 'W': - n++; - /* fall thru */ - case 'w': - case '%': - break; - case 'f': - n += 8; - break; - case 'j': - n += 3; - break; - case 'Y': - n += 8; - break; - case 's': - case 'J': - n += 50; - break; - default: - return; /* ERROR. return a NULL */ - } - i++; - } - } - testcase( n==sizeof(zBuf)-1 ); - testcase( n==sizeof(zBuf) ); - testcase( n==(u64)db->aLimit[SQLITE_LIMIT_LENGTH]+1 ); - testcase( n==(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ); - if( n(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); - return; - }else{ - z = sqlite3DbMallocRawNN(db, (int)n); - if( z==0 ){ - sqlite3_result_error_nomem(context); - return; - } - } + sqlite3StrAccumInit(&sRes, 0, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]); + computeJD(&x); computeYMD_HMS(&x); for(i=j=0; zFmt[i]; i++){ - if( zFmt[i]!='%' ){ - z[j++] = zFmt[i]; - }else{ - i++; - switch( zFmt[i] ){ - case 'd': sqlite3_snprintf(3, &z[j],"%02d",x.D); j+=2; break; - case 'f': { - double s = x.s; - if( s>59.999 ) s = 59.999; - sqlite3_snprintf(7, &z[j],"%06.3f", s); - j += sqlite3Strlen30(&z[j]); - break; - } - case 'H': sqlite3_snprintf(3, &z[j],"%02d",x.h); j+=2; break; - case 'W': /* Fall thru */ - case 'j': { - int nDay; /* Number of days since 1st day of year */ - DateTime y = x; - y.validJD = 0; - y.M = 1; - y.D = 1; - computeJD(&y); - nDay = (int)((x.iJD-y.iJD+43200000)/86400000); - if( zFmt[i]=='W' ){ - int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ - wd = (int)(((x.iJD+43200000)/86400000)%7); - sqlite3_snprintf(3, &z[j],"%02d",(nDay+7-wd)/7); - j += 2; - }else{ - sqlite3_snprintf(4, &z[j],"%03d",nDay+1); - j += 3; - } - break; - } - case 'J': { - sqlite3_snprintf(20, &z[j],"%.16g",x.iJD/86400000.0); - j+=sqlite3Strlen30(&z[j]); - break; - } - case 'm': sqlite3_snprintf(3, &z[j],"%02d",x.M); j+=2; break; - case 'M': sqlite3_snprintf(3, &z[j],"%02d",x.m); j+=2; break; - case 's': { - i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000); - sqlite3Int64ToText(iS, &z[j]); - j += sqlite3Strlen30(&z[j]); - break; - } - case 'S': sqlite3_snprintf(3,&z[j],"%02d",(int)x.s); j+=2; break; - case 'w': { - z[j++] = (char)(((x.iJD+129600000)/86400000) % 7) + '0'; - break; - } - case 'Y': { - sqlite3_snprintf(5,&z[j],"%04d",x.Y); j+=sqlite3Strlen30(&z[j]); - break; + if( zFmt[i]!='%' ) continue; + if( j59.999 ) s = 59.999; + sqlite3_str_appendf(&sRes, "%06.3f", s); + break; + } + case 'H': { + sqlite3_str_appendf(&sRes, "%02d", x.h); + break; + } + case 'W': /* Fall thru */ + case 'j': { + int nDay; /* Number of days since 1st day of year */ + DateTime y = x; + y.validJD = 0; + y.M = 1; + y.D = 1; + computeJD(&y); + nDay = (int)((x.iJD-y.iJD+43200000)/86400000); + if( zFmt[i]=='W' ){ + int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ + wd = (int)(((x.iJD+43200000)/86400000)%7); + sqlite3_str_appendf(&sRes,"%02d",(nDay+7-wd)/7); + }else{ + sqlite3_str_appendf(&sRes,"%03d",nDay+1); } - default: z[j++] = '%'; break; + break; + } + case 'J': { + sqlite3_str_appendf(&sRes,"%.16g",x.iJD/86400000.0); + break; + } + case 'm': { + sqlite3_str_appendf(&sRes,"%02d",x.M); + break; + } + case 'M': { + sqlite3_str_appendf(&sRes,"%02d",x.m); + break; + } + case 's': { + i64 iS = (i64)(x.iJD/1000 - 21086676*(i64)10000); + sqlite3_str_appendf(&sRes,"%lld",iS); + break; + } + case 'S': { + sqlite3_str_appendf(&sRes,"%02d",(int)x.s); + break; + } + case 'w': { + sqlite3_str_appendchar(&sRes, 1, + (char)(((x.iJD+129600000)/86400000) % 7) + '0'); + break; + } + case 'Y': { + sqlite3_str_appendf(&sRes,"%04d",x.Y); + break; + } + case '%': { + sqlite3_str_appendchar(&sRes, 1, '%'); + break; + } + default: { + sqlite3_str_reset(&sRes); + return; } } } - z[j] = 0; - sqlite3_result_text(context, z, -1, - z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC); + if( jpMethods==0) ) return 0; return id->pMethods->xDeviceCharacteristics(id); } #ifndef SQLITE_OMIT_WAL @@ -23744,12 +24744,15 @@ SQLITE_PRIVATE int sqlite3OsOpenMalloc( rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags); if( rc!=SQLITE_OK ){ sqlite3_free(pFile); + *ppFile = 0; }else{ *ppFile = pFile; } }else{ + *ppFile = 0; rc = SQLITE_NOMEM_BKPT; } + assert( *ppFile!=0 || rc!=SQLITE_OK ); return rc; } SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *pFile){ @@ -24467,7 +25470,7 @@ static void adjustStats(int iSize, int increment){ ** This routine checks the guards at either end of the allocation and ** if they are incorrect it asserts. */ -static struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){ +static struct MemBlockHdr *sqlite3MemsysGetHeader(const void *pAllocation){ struct MemBlockHdr *p; int *pInt; u8 *pU8; @@ -24714,7 +25717,7 @@ SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){ ** ** assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); */ -SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){ +SQLITE_PRIVATE int sqlite3MemdebugHasType(const void *p, u8 eType){ int rc = 1; if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){ struct MemBlockHdr *pHdr; @@ -24736,7 +25739,7 @@ SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){ ** ** assert( sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) ); */ -SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){ +SQLITE_PRIVATE int sqlite3MemdebugNoType(const void *p, u8 eType){ int rc = 1; if( p && sqlite3GlobalConfig.m.xFree==sqlite3MemFree ){ struct MemBlockHdr *pHdr; @@ -27114,205 +28117,7 @@ SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ /* ** Include code that is common to all os_*.c files */ -/************** Include os_common.h in the middle of mutex_w32.c *************/ -/************** Begin file os_common.h ***************************************/ -/* -** 2004 May 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains macros and a little bit of code that is common to -** all of the platform-specific files (os_*.c) and is #included into those -** files. -** -** This file should be #included by the os_*.c files only. It is not a -** general purpose header file. -*/ -#ifndef _OS_COMMON_H_ -#define _OS_COMMON_H_ - -/* -** At least two bugs have slipped in because we changed the MEMORY_DEBUG -** macro to SQLITE_DEBUG and some older makefiles have not yet made the -** switch. The following code should catch this problem at compile-time. -*/ -#ifdef MEMORY_DEBUG -# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead." -#endif - -/* -** Macros for performance tracing. Normally turned off. Only works -** on i486 hardware. -*/ -#ifdef SQLITE_PERFORMANCE_TRACE - -/* -** hwtime.h contains inline assembler code for implementing -** high-performance timing routines. -*/ -/************** Include hwtime.h in the middle of os_common.h ****************/ -/************** Begin file hwtime.h ******************************************/ -/* -** 2008 May 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains inline asm code for retrieving "high-performance" -** counters for x86 and x86_64 class CPUs. -*/ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H - -/* -** The following routine only works on pentium-class (or newer) processors. -** It uses the RDTSC opcode to read the cycle count value out of the -** processor and returns that value. This can be used for high-res -** profiling. -*/ -#if !defined(__STRICT_ANSI__) && \ - (defined(__GNUC__) || defined(_MSC_VER)) && \ - (defined(i386) || defined(__i386__) || defined(_M_IX86)) - - #if defined(__GNUC__) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned int lo, hi; - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (sqlite_uint64)hi << 32 | lo; - } - - #elif defined(_MSC_VER) - - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ - __asm { - rdtsc - ret ; return value at EDX:EAX - } - } - - #endif - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long val; - __asm__ __volatile__ ("rdtsc" : "=A" (val)); - return val; - } - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long long retval; - unsigned long junk; - __asm__ __volatile__ ("\n\ - 1: mftbu %1\n\ - mftb %L0\n\ - mftbu %0\n\ - cmpw %0,%1\n\ - bne 1b" - : "=r" (retval), "=r" (junk)); - return retval; - } - -#else - - /* - ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. - ** - ** sqlite3Hwtime() is only used for some obscure debugging - ** and analysis configurations, not in any deliverable, so this - ** should not be a great loss. - */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } - -#endif - -#endif /* !defined(SQLITE_HWTIME_H) */ - -/************** End of hwtime.h **********************************************/ -/************** Continuing where we left off in os_common.h ******************/ - -static sqlite_uint64 g_start; -static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start -#define TIMER_ELAPSED g_elapsed -#else -#define TIMER_START -#define TIMER_END -#define TIMER_ELAPSED ((sqlite_uint64)0) -#endif - -/* -** If we compile with the SQLITE_TEST macro set, then the following block -** of code will give us the ability to simulate a disk I/O error. This -** is used for testing the I/O recovery logic. -*/ -#if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_io_error_hit; -SQLITE_API extern int sqlite3_io_error_hardhit; -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_persist; -SQLITE_API extern int sqlite3_io_error_benign; -SQLITE_API extern int sqlite3_diskfull_pending; -SQLITE_API extern int sqlite3_diskfull; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) -#define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ - { local_ioerr(); CODE; } -static void local_ioerr(){ - IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; -} -#define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ - local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ - CODE; \ - }else{ \ - sqlite3_diskfull_pending--; \ - } \ - } -#else -#define SimulateIOErrorBenign(X) -#define SimulateIOError(A) -#define SimulateDiskfullError(A) -#endif /* defined(SQLITE_TEST) */ - -/* -** When testing, keep a count of the number of open files. -*/ -#if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_open_file_count; -#define OpenCounter(X) sqlite3_open_file_count+=(X) -#else -#define OpenCounter(X) -#endif /* defined(SQLITE_TEST) */ - -#endif /* !defined(_OS_COMMON_H_) */ - -/************** End of os_common.h *******************************************/ -/************** Continuing where we left off in mutex_w32.c ******************/ +/* #include "os_common.h" */ /* ** Include the header file for the Windows VFS. @@ -28105,7 +28910,7 @@ SQLITE_API void *sqlite3_malloc64(sqlite3_uint64 n){ ** TRUE if p is a lookaside memory allocation from db */ #ifndef SQLITE_OMIT_LOOKASIDE -static int isLookaside(sqlite3 *db, void *p){ +static int isLookaside(sqlite3 *db, const void *p){ return SQLITE_WITHIN(p, db->lookaside.pStart, db->lookaside.pEnd); } #else @@ -28116,18 +28921,18 @@ static int isLookaside(sqlite3 *db, void *p){ ** Return the size of a memory allocation previously obtained from ** sqlite3Malloc() or sqlite3_malloc(). */ -SQLITE_PRIVATE int sqlite3MallocSize(void *p){ +SQLITE_PRIVATE int sqlite3MallocSize(const void *p){ assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); - return sqlite3GlobalConfig.m.xSize(p); + return sqlite3GlobalConfig.m.xSize((void*)p); } -static int lookasideMallocSize(sqlite3 *db, void *p){ +static int lookasideMallocSize(sqlite3 *db, const void *p){ #ifndef SQLITE_OMIT_TWOSIZE_LOOKASIDE return plookaside.pMiddle ? db->lookaside.szTrue : LOOKASIDE_SMALL; #else return db->lookaside.szTrue; #endif } -SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){ +SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, const void *p){ assert( p!=0 ); #ifdef SQLITE_DEBUG if( db==0 || !isLookaside(db,p) ){ @@ -28154,7 +28959,7 @@ SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){ } } } - return sqlite3GlobalConfig.m.xSize(p); + return sqlite3GlobalConfig.m.xSize((void*)p); } SQLITE_API sqlite3_uint64 sqlite3_msize(void *p){ assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_HEAP) ); @@ -28539,8 +29344,9 @@ SQLITE_PRIVATE char *sqlite3DbSpanDup(sqlite3 *db, const char *zStart, const cha ** Free any prior content in *pz and replace it with a copy of zNew. */ SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){ + char *z = sqlite3DbStrDup(db, zNew); sqlite3DbFree(db, *pz); - *pz = sqlite3DbStrDup(db, zNew); + *pz = z; } /* @@ -28548,8 +29354,15 @@ SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zNew){ ** has happened. This routine will set db->mallocFailed, and also ** temporarily disable the lookaside memory allocator and interrupt ** any running VDBEs. +** +** Always return a NULL pointer so that this routine can be invoked using +** +** return sqlite3OomFault(db); +** +** and thereby avoid unnecessary stack frame allocations for the overwhelmingly +** common case where no OOM occurs. */ -SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){ +SQLITE_PRIVATE void *sqlite3OomFault(sqlite3 *db){ if( db->mallocFailed==0 && db->bBenignMalloc==0 ){ db->mallocFailed = 1; if( db->nVdbeExec>0 ){ @@ -28557,9 +29370,11 @@ SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){ } DisableLookaside; if( db->pParse ){ + sqlite3ErrorMsg(db->pParse, "out of memory"); db->pParse->rc = SQLITE_NOMEM_BKPT; } } + return 0; } /* @@ -28764,7 +29579,7 @@ static char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){ /* ** Set the StrAccum object to an error mode. */ -static void setStrAccumError(StrAccum *p, u8 eError){ +SQLITE_PRIVATE void sqlite3StrAccumSetError(StrAccum *p, u8 eError){ assert( eError==SQLITE_NOMEM || eError==SQLITE_TOOBIG ); p->accError = eError; if( p->mxAlloc ) sqlite3_str_reset(p); @@ -28800,12 +29615,12 @@ static char *printfTempBuf(sqlite3_str *pAccum, sqlite3_int64 n){ char *z; if( pAccum->accError ) return 0; if( n>pAccum->nAlloc && n>pAccum->mxAlloc ){ - setStrAccumError(pAccum, SQLITE_TOOBIG); + sqlite3StrAccumSetError(pAccum, SQLITE_TOOBIG); return 0; } z = sqlite3DbMallocRaw(pAccum->db, n); if( z==0 ){ - setStrAccumError(pAccum, SQLITE_NOMEM); + sqlite3StrAccumSetError(pAccum, SQLITE_NOMEM); } return z; } @@ -29468,12 +30283,22 @@ SQLITE_API void sqlite3_str_vappendf( goto adjust_width_for_utf8; } case etTOKEN: { - Token *pToken; if( (pAccum->printfFlags & SQLITE_PRINTF_INTERNAL)==0 ) return; - pToken = va_arg(ap, Token*); - assert( bArgList==0 ); - if( pToken && pToken->n ){ - sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); + if( flag_alternateform ){ + /* %#T means an Expr pointer that uses Expr.u.zToken */ + Expr *pExpr = va_arg(ap,Expr*); + if( ALWAYS(pExpr) && ALWAYS(!ExprHasProperty(pExpr,EP_IntValue)) ){ + sqlite3_str_appendall(pAccum, (const char*)pExpr->u.zToken); + sqlite3RecordErrorOffsetOfExpr(pAccum->db, pExpr); + } + }else{ + /* %T means a Token pointer */ + Token *pToken = va_arg(ap, Token*); + assert( bArgList==0 ); + if( pToken && pToken->n ){ + sqlite3_str_append(pAccum, (const char*)pToken->z, pToken->n); + sqlite3RecordErrorByteOffset(pAccum->db, pToken->z); + } } length = width = 0; break; @@ -29528,6 +30353,42 @@ SQLITE_API void sqlite3_str_vappendf( }/* End for loop over the format string */ } /* End of function */ + +/* +** The z string points to the first character of a token that is +** associated with an error. If db does not already have an error +** byte offset recorded, try to compute the error byte offset for +** z and set the error byte offset in db. +*/ +SQLITE_PRIVATE void sqlite3RecordErrorByteOffset(sqlite3 *db, const char *z){ + const Parse *pParse; + const char *zText; + const char *zEnd; + assert( z!=0 ); + if( NEVER(db==0) ) return; + if( db->errByteOffset!=(-2) ) return; + pParse = db->pParse; + if( NEVER(pParse==0) ) return; + zText =pParse->zTail; + if( NEVER(zText==0) ) return; + zEnd = &zText[strlen(zText)]; + if( SQLITE_WITHIN(z,zText,zEnd) ){ + db->errByteOffset = (int)(z-zText); + } +} + +/* +** If pExpr has a byte offset for the start of a token, record that as +** as the error offset. +*/ +SQLITE_PRIVATE void sqlite3RecordErrorOffsetOfExpr(sqlite3 *db, const Expr *pExpr){ + while( pExpr && (ExprHasProperty(pExpr,EP_FromJoin) || pExpr->w.iOfst<=0) ){ + pExpr = pExpr->pLeft; + } + if( pExpr==0 ) return; + db->errByteOffset = pExpr->w.iOfst; +} + /* ** Enlarge the memory allocation on a StrAccum object so that it is ** able to accept at least N more bytes of text. @@ -29535,7 +30396,7 @@ SQLITE_API void sqlite3_str_vappendf( ** Return the number of bytes of text that StrAccum is able to accept ** after the attempted enlargement. The value returned might be zero. */ -static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ +SQLITE_PRIVATE int sqlite3StrAccumEnlarge(StrAccum *p, int N){ char *zNew; assert( p->nChar+(i64)N >= p->nAlloc ); /* Only called if really needed */ if( p->accError ){ @@ -29544,7 +30405,7 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ return 0; } if( p->mxAlloc==0 ){ - setStrAccumError(p, SQLITE_TOOBIG); + sqlite3StrAccumSetError(p, SQLITE_TOOBIG); return p->nAlloc - p->nChar - 1; }else{ char *zOld = isMalloced(p) ? p->zText : 0; @@ -29557,7 +30418,7 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ } if( szNew > p->mxAlloc ){ sqlite3_str_reset(p); - setStrAccumError(p, SQLITE_TOOBIG); + sqlite3StrAccumSetError(p, SQLITE_TOOBIG); return 0; }else{ p->nAlloc = (int)szNew; @@ -29575,7 +30436,7 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){ p->printfFlags |= SQLITE_PRINTF_MALLOCED; }else{ sqlite3_str_reset(p); - setStrAccumError(p, SQLITE_NOMEM); + sqlite3StrAccumSetError(p, SQLITE_NOMEM); return 0; } } @@ -29648,7 +30509,7 @@ static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){ memcpy(zText, p->zText, p->nChar+1); p->printfFlags |= SQLITE_PRINTF_MALLOCED; }else{ - setStrAccumError(p, SQLITE_NOMEM); + sqlite3StrAccumSetError(p, SQLITE_NOMEM); } p->zText = zText; return zText; @@ -29663,6 +30524,22 @@ SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){ return p->zText; } +/* +** Use the content of the StrAccum passed as the second argument +** as the result of an SQL function. +*/ +SQLITE_PRIVATE void sqlite3ResultStrAccum(sqlite3_context *pCtx, StrAccum *p){ + if( p->accError ){ + sqlite3_result_error_code(pCtx, p->accError); + sqlite3_str_reset(p); + }else if( isMalloced(p) ){ + sqlite3_result_text(pCtx, p->zText, p->nChar, SQLITE_DYNAMIC); + }else{ + sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); + sqlite3_str_reset(p); + } +} + /* ** This singleton is an sqlite3_str object that is returned if ** sqlite3_malloc() fails to provide space for a real one. This @@ -30083,6 +30960,8 @@ SQLITE_PRIVATE void sqlite3TreeViewSrcList(TreeView *pView, const SrcList *pSrc) } if( pItem->fg.jointype & JT_LEFT ){ sqlite3_str_appendf(&x, " LEFT-JOIN"); + }else if( pItem->fg.jointype & JT_CROSS ){ + sqlite3_str_appendf(&x, " CROSS-JOIN"); } if( pItem->fg.fromDDL ){ sqlite3_str_appendf(&x, " DDL"); @@ -30351,7 +31230,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m sqlite3_str_appendf(&x, " fg.af=%x.%c", pExpr->flags, pExpr->affExpr ? pExpr->affExpr : 'n'); if( ExprHasProperty(pExpr, EP_FromJoin) ){ - sqlite3_str_appendf(&x, " iRJT=%d", pExpr->iRightJoinTable); + sqlite3_str_appendf(&x, " iRJT=%d", pExpr->w.iRightJoinTable); } if( ExprHasProperty(pExpr, EP_FromDDL) ){ sqlite3_str_appendf(&x, " DDL"); @@ -30381,6 +31260,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m sqlite3TreeViewLine(pView, "COLUMN(%d)%s%s", pExpr->iColumn, zFlgs, zOp2); }else{ + assert( ExprUseYTab(pExpr) ); sqlite3TreeViewLine(pView, "{%d:%d} pTab=%p%s", pExpr->iTable, pExpr->iColumn, pExpr->y.pTab, zFlgs); @@ -30400,11 +31280,13 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m } #ifndef SQLITE_OMIT_FLOATING_POINT case TK_FLOAT: { + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); break; } #endif case TK_STRING: { + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView,"%Q", pExpr->u.zToken); break; } @@ -30413,17 +31295,19 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m break; } case TK_TRUEFALSE: { - sqlite3TreeViewLine(pView, - sqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE"); + sqlite3TreeViewLine(pView,"%s%s", + sqlite3ExprTruthValue(pExpr) ? "TRUE" : "FALSE", zFlgs); break; } #ifndef SQLITE_OMIT_BLOB_LITERAL case TK_BLOB: { + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView,"%s", pExpr->u.zToken); break; } #endif case TK_VARIABLE: { + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView,"VARIABLE(%s,%d)", pExpr->u.zToken, pExpr->iColumn); break; @@ -30433,12 +31317,14 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m break; } case TK_ID: { + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView,"ID \"%w\"", pExpr->u.zToken); break; } #ifndef SQLITE_OMIT_CAST case TK_CAST: { /* Expressions of the form: CAST(pLeft AS token) */ + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView,"CAST %Q", pExpr->u.zToken); sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); break; @@ -30488,6 +31374,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m } case TK_SPAN: { + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView, "SPAN %Q", pExpr->u.zToken); sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); break; @@ -30499,6 +31386,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m ** up in the treeview output as "SOFT-COLLATE". Explicit COLLATE ** operators that appear in the original SQL always have the ** EP_Collate bit set and appear in treeview output as just "COLLATE" */ + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView, "%sCOLLATE %Q%s", !ExprHasProperty(pExpr, EP_Collate) ? "SOFT-" : "", pExpr->u.zToken, zFlgs); @@ -30514,6 +31402,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m pFarg = 0; pWin = 0; }else{ + assert( ExprUseXList(pExpr) ); pFarg = pExpr->x.pList; #ifndef SQLITE_OMIT_WINDOWFUNC pWin = ExprHasProperty(pExpr, EP_WinFunc) ? pExpr->y.pWin : 0; @@ -30521,6 +31410,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m pWin = 0; #endif } + assert( !ExprHasProperty(pExpr, EP_IntValue) ); if( pExpr->op==TK_AGG_FUNCTION ){ sqlite3TreeViewLine(pView, "AGG_FUNCTION%d %Q%s agg=%d[%d]/%p", pExpr->op2, pExpr->u.zToken, zFlgs, @@ -30552,11 +31442,13 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m } #ifndef SQLITE_OMIT_SUBQUERY case TK_EXISTS: { + assert( ExprUseXSelect(pExpr) ); sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags); sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); break; } case TK_SELECT: { + assert( ExprUseXSelect(pExpr) ); sqlite3TreeViewLine(pView, "subquery-expr flags=0x%x", pExpr->flags); sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); break; @@ -30564,7 +31456,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m case TK_IN: { sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags); sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0); }else{ sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); @@ -30585,9 +31477,12 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m ** Z is stored in pExpr->pList->a[1].pExpr. */ case TK_BETWEEN: { - Expr *pX = pExpr->pLeft; - Expr *pY = pExpr->x.pList->a[0].pExpr; - Expr *pZ = pExpr->x.pList->a[1].pExpr; + const Expr *pX, *pY, *pZ; + pX = pExpr->pLeft; + assert( ExprUseXList(pExpr) ); + assert( pExpr->x.pList->nExpr==2 ); + pY = pExpr->x.pList->a[0].pExpr; + pZ = pExpr->x.pList->a[1].pExpr; sqlite3TreeViewLine(pView, "BETWEEN"); sqlite3TreeViewExpr(pView, pX, 1); sqlite3TreeViewExpr(pView, pY, 1); @@ -30609,6 +31504,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m case TK_CASE: { sqlite3TreeViewLine(pView, "CASE"); sqlite3TreeViewExpr(pView, pExpr->pLeft, 1); + assert( ExprUseXList(pExpr) ); sqlite3TreeViewExprList(pView, pExpr->x.pList, 0, 0); break; } @@ -30621,6 +31517,7 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m case OE_Fail: zType = "fail"; break; case OE_Ignore: zType = "ignore"; break; } + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3TreeViewLine(pView, "RAISE %s(%Q)", zType, pExpr->u.zToken); break; } @@ -30633,12 +31530,16 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m } case TK_VECTOR: { char *z = sqlite3_mprintf("VECTOR%s",zFlgs); + assert( ExprUseXList(pExpr) ); sqlite3TreeViewBareExprList(pView, pExpr->x.pList, z); sqlite3_free(z); break; } case TK_SELECT_COLUMN: { - sqlite3TreeViewLine(pView, "SELECT-COLUMN %d", pExpr->iColumn); + sqlite3TreeViewLine(pView, "SELECT-COLUMN %d of [0..%d]%s", + pExpr->iColumn, pExpr->iTable-1, + pExpr->pRight==pExpr->pLeft ? " (SELECT-owner)" : ""); + assert( ExprUseXSelect(pExpr->pLeft) ); sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0); break; } @@ -30655,6 +31556,15 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m sqlite3TreeViewExpr(pView, &tmp, 0); break; } + case TK_ROW: { + if( pExpr->iColumn<=0 ){ + sqlite3TreeViewLine(pView, "First FROM table rowid"); + }else{ + sqlite3TreeViewLine(pView, "First FROM table column %d", + pExpr->iColumn-1); + } + break; + } default: { sqlite3TreeViewLine(pView, "op=%d", pExpr->op); break; @@ -31706,16 +32616,6 @@ SQLITE_PRIVATE void sqlite3UtfSelfTest(void){ #include #endif -/* -** Routine needed to support the testcase() macro. -*/ -#ifdef SQLITE_COVERAGE_TEST -SQLITE_PRIVATE void sqlite3Coverage(int x){ - static unsigned dummy = 0; - dummy += (unsigned)x; -} -#endif - /* ** Calls to sqlite3FaultSim() are used to simulate a failure during testing, ** or to bypass normal error detection during testing in order to let @@ -31745,11 +32645,21 @@ SQLITE_PRIVATE int sqlite3FaultSim(int iTest){ #ifndef SQLITE_OMIT_FLOATING_POINT /* ** Return true if the floating point value is Not a Number (NaN). +** +** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN. +** Otherwise, we have our own implementation that works on most systems. */ SQLITE_PRIVATE int sqlite3IsNaN(double x){ + int rc; /* The value return */ +#if !SQLITE_HAVE_ISNAN && !HAVE_ISNAN u64 y; memcpy(&y,&x,sizeof(y)); - return IsNaN(y); + rc = IsNaN(y); +#else + rc = isnan(x); +#endif /* HAVE_ISNAN */ + testcase( rc ); + return rc; } #endif /* SQLITE_OMIT_FLOATING_POINT */ @@ -31774,8 +32684,14 @@ SQLITE_PRIVATE int sqlite3Strlen30(const char *z){ ** the column name if and only if the COLFLAG_HASTYPE flag is set. */ SQLITE_PRIVATE char *sqlite3ColumnType(Column *pCol, char *zDflt){ - if( (pCol->colFlags & COLFLAG_HASTYPE)==0 ) return zDflt; - return pCol->zName + strlen(pCol->zName) + 1; + if( pCol->colFlags & COLFLAG_HASTYPE ){ + return pCol->zCnName + strlen(pCol->zCnName) + 1; + }else if( pCol->eCType ){ + assert( pCol->eCType<=SQLITE_N_STDTYPE ); + return (char*)sqlite3StdType[pCol->eCType-1]; + }else{ + return zDflt; + } } /* @@ -31796,7 +32712,11 @@ static SQLITE_NOINLINE void sqlite3ErrorFinish(sqlite3 *db, int err_code){ SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){ assert( db!=0 ); db->errCode = err_code; - if( err_code || db->pErr ) sqlite3ErrorFinish(db, err_code); + if( err_code || db->pErr ){ + sqlite3ErrorFinish(db, err_code); + }else{ + db->errByteOffset = -1; + } } /* @@ -31806,6 +32726,7 @@ SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){ SQLITE_PRIVATE void sqlite3ErrorClear(sqlite3 *db){ assert( db!=0 ); db->errCode = SQLITE_OK; + db->errByteOffset = -1; if( db->pErr ) sqlite3ValueSetNull(db->pErr); } @@ -31826,17 +32747,8 @@ SQLITE_PRIVATE void sqlite3SystemError(sqlite3 *db, int rc){ ** handle "db". The error code is set to "err_code". ** ** If it is not NULL, string zFormat specifies the format of the -** error string in the style of the printf functions: The following -** format characters are allowed: -** -** %s Insert a string -** %z A string that should be freed after use -** %d Insert an integer -** %T Insert a token -** %S Insert the first element of a SrcList -** -** zFormat and any string tokens that follow it are assumed to be -** encoded in UTF-8. +** error string. zFormat and any string tokens that follow it are +** assumed to be encoded in UTF-8. ** ** To clear the most recent error for sqlite handle "db", sqlite3Error ** should be called with err_code set to SQLITE_OK and zFormat set @@ -31860,13 +32772,6 @@ SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const char *z /* ** Add an error message to pParse->zErrMsg and increment pParse->nErr. -** The following formatting characters are allowed: -** -** %s Insert a string -** %z A string that should be freed after use -** %d Insert an integer -** %T Insert a token -** %S Insert the first element of a SrcList ** ** This function should be used to report any error that occurs while ** compiling an SQL statement (i.e. within sqlite3_prepare()). The @@ -31879,11 +32784,19 @@ SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ char *zMsg; va_list ap; sqlite3 *db = pParse->db; + assert( db!=0 ); + assert( db->pParse==pParse ); + db->errByteOffset = -2; va_start(ap, zFormat); zMsg = sqlite3VMPrintf(db, zFormat, ap); va_end(ap); + if( db->errByteOffset<-1 ) db->errByteOffset = -1; if( db->suppressErr ){ sqlite3DbFree(db, zMsg); + if( db->mallocFailed ){ + pParse->nErr++; + pParse->rc = SQLITE_NOMEM; + } }else{ pParse->nErr++; sqlite3DbFree(db, pParse->zErrMsg); @@ -31946,11 +32859,34 @@ SQLITE_PRIVATE void sqlite3Dequote(char *z){ z[j] = 0; } SQLITE_PRIVATE void sqlite3DequoteExpr(Expr *p){ + assert( !ExprHasProperty(p, EP_IntValue) ); assert( sqlite3Isquote(p->u.zToken[0]) ); p->flags |= p->u.zToken[0]=='"' ? EP_Quoted|EP_DblQuoted : EP_Quoted; sqlite3Dequote(p->u.zToken); } +/* +** If the input token p is quoted, try to adjust the token to remove +** the quotes. This is not always possible: +** +** "abc" -> abc +** "ab""cd" -> (not possible because of the interior "") +** +** Remove the quotes if possible. This is a optimization. The overall +** system should still return the correct answer even if this routine +** is always a no-op. +*/ +SQLITE_PRIVATE void sqlite3DequoteToken(Token *p){ + unsigned int i; + if( p->n<2 ) return; + if( !sqlite3Isquote(p->z[0]) ) return; + for(i=1; in-1; i++){ + if( sqlite3Isquote(p->z[i]) ) return; + } + p->n -= 2; + p->z++; +} + /* ** Generate a Token object from a string */ @@ -33056,13 +33992,13 @@ static void logBadConnection(const char *zType){ ** used as an argument to sqlite3_errmsg() or sqlite3_close(). */ SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3 *db){ - u32 magic; + u8 eOpenState; if( db==0 ){ logBadConnection("NULL"); return 0; } - magic = db->magic; - if( magic!=SQLITE_MAGIC_OPEN ){ + eOpenState = db->eOpenState; + if( eOpenState!=SQLITE_STATE_OPEN ){ if( sqlite3SafetyCheckSickOrOk(db) ){ testcase( sqlite3GlobalConfig.xLog!=0 ); logBadConnection("unopened"); @@ -33073,11 +34009,11 @@ SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3 *db){ } } SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){ - u32 magic; - magic = db->magic; - if( magic!=SQLITE_MAGIC_SICK && - magic!=SQLITE_MAGIC_OPEN && - magic!=SQLITE_MAGIC_BUSY ){ + u8 eOpenState; + eOpenState = db->eOpenState; + if( eOpenState!=SQLITE_STATE_SICK && + eOpenState!=SQLITE_STATE_OPEN && + eOpenState!=SQLITE_STATE_BUSY ){ testcase( sqlite3GlobalConfig.xLog!=0 ); logBadConnection("invalid"); return 0; @@ -33242,7 +34178,6 @@ SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){ return a[x&7] + y - 10; } -#ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Convert a double into a LogEst ** In other words, compute an approximation for 10*log2(x). @@ -33257,16 +34192,9 @@ SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){ e = (a>>52) - 1022; return e*10; } -#endif /* SQLITE_OMIT_VIRTUALTABLE */ -#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ - defined(SQLITE_ENABLE_STAT4) || \ - defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) /* ** Convert a LogEst into an integer. -** -** Note that this routine is only used when one or more of various -** non-standard compile-time options is enabled. */ SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ u64 n; @@ -33274,17 +34202,9 @@ SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ x /= 10; if( n>=5 ) n -= 2; else if( n>=1 ) n -= 1; -#if defined(SQLITE_ENABLE_STMT_SCANSTATUS) || \ - defined(SQLITE_EXPLAIN_ESTIMATED_ROWS) if( x>60 ) return (u64)LARGEST_INT64; -#else - /* If only SQLITE_ENABLE_STAT4 is on, then the largest input - ** possible to this routine is 310, resulting in a maximum x of 31 */ - assert( x<=60 ); -#endif return x>=3 ? (n+8)<<(x-3) : (n+8)>>(3-x); } -#endif /* defined SCANSTAT or STAT4 or ESTIMATED_ROWS */ /* ** Add a new name/number pair to a VList. This might require that the @@ -33696,35 +34616,35 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 18 */ "If" OpHelp(""), /* 19 */ "Not" OpHelp("r[P2]= !r[P1]"), /* 20 */ "IfNot" OpHelp(""), - /* 21 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"), - /* 22 */ "SeekLT" OpHelp("key=r[P3@P4]"), - /* 23 */ "SeekLE" OpHelp("key=r[P3@P4]"), - /* 24 */ "SeekGE" OpHelp("key=r[P3@P4]"), - /* 25 */ "SeekGT" OpHelp("key=r[P3@P4]"), - /* 26 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"), - /* 27 */ "IfNoHope" OpHelp("key=r[P3@P4]"), - /* 28 */ "NoConflict" OpHelp("key=r[P3@P4]"), - /* 29 */ "NotFound" OpHelp("key=r[P3@P4]"), - /* 30 */ "Found" OpHelp("key=r[P3@P4]"), - /* 31 */ "SeekRowid" OpHelp("intkey=r[P3]"), - /* 32 */ "NotExists" OpHelp("intkey=r[P3]"), - /* 33 */ "Last" OpHelp(""), - /* 34 */ "IfSmaller" OpHelp(""), - /* 35 */ "SorterSort" OpHelp(""), - /* 36 */ "Sort" OpHelp(""), - /* 37 */ "Rewind" OpHelp(""), - /* 38 */ "IdxLE" OpHelp("key=r[P3@P4]"), - /* 39 */ "IdxGT" OpHelp("key=r[P3@P4]"), - /* 40 */ "IdxLT" OpHelp("key=r[P3@P4]"), - /* 41 */ "IdxGE" OpHelp("key=r[P3@P4]"), - /* 42 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), + /* 21 */ "IsNullOrType" OpHelp("if typeof(r[P1]) IN (P3,5) goto P2"), + /* 22 */ "IfNullRow" OpHelp("if P1.nullRow then r[P3]=NULL, goto P2"), + /* 23 */ "SeekLT" OpHelp("key=r[P3@P4]"), + /* 24 */ "SeekLE" OpHelp("key=r[P3@P4]"), + /* 25 */ "SeekGE" OpHelp("key=r[P3@P4]"), + /* 26 */ "SeekGT" OpHelp("key=r[P3@P4]"), + /* 27 */ "IfNotOpen" OpHelp("if( !csr[P1] ) goto P2"), + /* 28 */ "IfNoHope" OpHelp("key=r[P3@P4]"), + /* 29 */ "NoConflict" OpHelp("key=r[P3@P4]"), + /* 30 */ "NotFound" OpHelp("key=r[P3@P4]"), + /* 31 */ "Found" OpHelp("key=r[P3@P4]"), + /* 32 */ "SeekRowid" OpHelp("intkey=r[P3]"), + /* 33 */ "NotExists" OpHelp("intkey=r[P3]"), + /* 34 */ "Last" OpHelp(""), + /* 35 */ "IfSmaller" OpHelp(""), + /* 36 */ "SorterSort" OpHelp(""), + /* 37 */ "Sort" OpHelp(""), + /* 38 */ "Rewind" OpHelp(""), + /* 39 */ "IdxLE" OpHelp("key=r[P3@P4]"), + /* 40 */ "IdxGT" OpHelp("key=r[P3@P4]"), + /* 41 */ "IdxLT" OpHelp("key=r[P3@P4]"), + /* 42 */ "IdxGE" OpHelp("key=r[P3@P4]"), /* 43 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"), /* 44 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"), - /* 45 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), - /* 46 */ "Program" OpHelp(""), - /* 47 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), - /* 48 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), - /* 49 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"), + /* 45 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), + /* 46 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), + /* 47 */ "Program" OpHelp(""), + /* 48 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), + /* 49 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), /* 50 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"), /* 51 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"), /* 52 */ "Ne" OpHelp("IF r[P3]!=r[P1]"), @@ -33734,49 +34654,49 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ /* 56 */ "Lt" OpHelp("IF r[P3]=r[P1]"), /* 58 */ "ElseEq" OpHelp(""), - /* 59 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), - /* 60 */ "IncrVacuum" OpHelp(""), - /* 61 */ "VNext" OpHelp(""), - /* 62 */ "Init" OpHelp("Start at P2"), - /* 63 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"), - /* 64 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"), - /* 65 */ "Return" OpHelp(""), - /* 66 */ "EndCoroutine" OpHelp(""), - /* 67 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), - /* 68 */ "Halt" OpHelp(""), - /* 69 */ "Integer" OpHelp("r[P2]=P1"), - /* 70 */ "Int64" OpHelp("r[P2]=P4"), - /* 71 */ "String" OpHelp("r[P2]='P4' (len=P1)"), - /* 72 */ "Null" OpHelp("r[P2..P3]=NULL"), - /* 73 */ "SoftNull" OpHelp("r[P1]=NULL"), - /* 74 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), - /* 75 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), - /* 76 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), - /* 77 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), - /* 78 */ "SCopy" OpHelp("r[P2]=r[P1]"), - /* 79 */ "IntCopy" OpHelp("r[P2]=r[P1]"), - /* 80 */ "ChngCntRow" OpHelp("output=r[P1]"), - /* 81 */ "ResultRow" OpHelp("output=r[P1@P2]"), - /* 82 */ "CollSeq" OpHelp(""), - /* 83 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), - /* 84 */ "RealAffinity" OpHelp(""), - /* 85 */ "Cast" OpHelp("affinity(r[P1])"), - /* 86 */ "Permutation" OpHelp(""), - /* 87 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), - /* 88 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), - /* 89 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"), - /* 90 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), - /* 91 */ "Column" OpHelp("r[P3]=PX"), - /* 92 */ "Affinity" OpHelp("affinity(r[P1@P2])"), - /* 93 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), - /* 94 */ "Count" OpHelp("r[P2]=count()"), - /* 95 */ "ReadCookie" OpHelp(""), - /* 96 */ "SetCookie" OpHelp(""), - /* 97 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), - /* 98 */ "OpenRead" OpHelp("root=P2 iDb=P3"), - /* 99 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), - /* 100 */ "OpenDup" OpHelp(""), - /* 101 */ "OpenAutoindex" OpHelp("nColumn=P2"), + /* 59 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"), + /* 60 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), + /* 61 */ "IncrVacuum" OpHelp(""), + /* 62 */ "VNext" OpHelp(""), + /* 63 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"), + /* 64 */ "Init" OpHelp("Start at P2"), + /* 65 */ "PureFunc" OpHelp("r[P3]=func(r[P2@NP])"), + /* 66 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"), + /* 67 */ "Return" OpHelp(""), + /* 68 */ "EndCoroutine" OpHelp(""), + /* 69 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), + /* 70 */ "Halt" OpHelp(""), + /* 71 */ "Integer" OpHelp("r[P2]=P1"), + /* 72 */ "Int64" OpHelp("r[P2]=P4"), + /* 73 */ "String" OpHelp("r[P2]='P4' (len=P1)"), + /* 74 */ "Null" OpHelp("r[P2..P3]=NULL"), + /* 75 */ "SoftNull" OpHelp("r[P1]=NULL"), + /* 76 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), + /* 77 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), + /* 78 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), + /* 79 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), + /* 80 */ "SCopy" OpHelp("r[P2]=r[P1]"), + /* 81 */ "IntCopy" OpHelp("r[P2]=r[P1]"), + /* 82 */ "FkCheck" OpHelp(""), + /* 83 */ "ResultRow" OpHelp("output=r[P1@P2]"), + /* 84 */ "CollSeq" OpHelp(""), + /* 85 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), + /* 86 */ "RealAffinity" OpHelp(""), + /* 87 */ "Cast" OpHelp("affinity(r[P1])"), + /* 88 */ "Permutation" OpHelp(""), + /* 89 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), + /* 90 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), + /* 91 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"), + /* 92 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), + /* 93 */ "Column" OpHelp("r[P3]=PX"), + /* 94 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"), + /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"), + /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), + /* 97 */ "Count" OpHelp("r[P2]=count()"), + /* 98 */ "ReadCookie" OpHelp(""), + /* 99 */ "SetCookie" OpHelp(""), + /* 100 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), + /* 101 */ "OpenRead" OpHelp("root=P2 iDb=P3"), /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), - /* 157 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), - /* 158 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), - /* 159 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), - /* 160 */ "AggValue" OpHelp("r[P3]=value N=P2"), - /* 161 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), - /* 162 */ "Expire" OpHelp(""), - /* 163 */ "CursorLock" OpHelp(""), - /* 164 */ "CursorUnlock" OpHelp(""), - /* 165 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), - /* 166 */ "VBegin" OpHelp(""), - /* 167 */ "VCreate" OpHelp(""), - /* 168 */ "VDestroy" OpHelp(""), - /* 169 */ "VOpen" OpHelp(""), - /* 170 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), - /* 171 */ "VRename" OpHelp(""), - /* 172 */ "Pagecount" OpHelp(""), - /* 173 */ "MaxPgcnt" OpHelp(""), - /* 174 */ "Trace" OpHelp(""), - /* 175 */ "CursorHint" OpHelp(""), - /* 176 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), - /* 177 */ "Noop" OpHelp(""), - /* 178 */ "Explain" OpHelp(""), - /* 179 */ "Abortable" OpHelp(""), + /* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), + /* 113 */ "OpenDup" OpHelp(""), + /* 114 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), + /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"), + /* 116 */ "OpenEphemeral" OpHelp("nColumn=P2"), + /* 117 */ "String8" OpHelp("r[P2]='P4'"), + /* 118 */ "SorterOpen" OpHelp(""), + /* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), + /* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), + /* 121 */ "Close" OpHelp(""), + /* 122 */ "ColumnsUsed" OpHelp(""), + /* 123 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"), + /* 124 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"), + /* 125 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), + /* 126 */ "NewRowid" OpHelp("r[P2]=rowid"), + /* 127 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), + /* 128 */ "RowCell" OpHelp(""), + /* 129 */ "Delete" OpHelp(""), + /* 130 */ "ResetCount" OpHelp(""), + /* 131 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), + /* 132 */ "SorterData" OpHelp("r[P2]=data"), + /* 133 */ "RowData" OpHelp("r[P2]=data"), + /* 134 */ "Rowid" OpHelp("r[P2]=rowid"), + /* 135 */ "NullRow" OpHelp(""), + /* 136 */ "SeekEnd" OpHelp(""), + /* 137 */ "IdxInsert" OpHelp("key=r[P2]"), + /* 138 */ "SorterInsert" OpHelp("key=r[P2]"), + /* 139 */ "IdxDelete" OpHelp("key=r[P2@P3]"), + /* 140 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), + /* 141 */ "IdxRowid" OpHelp("r[P2]=rowid"), + /* 142 */ "FinishSeek" OpHelp(""), + /* 143 */ "Destroy" OpHelp(""), + /* 144 */ "Clear" OpHelp(""), + /* 145 */ "ResetSorter" OpHelp(""), + /* 146 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), + /* 147 */ "SqlExec" OpHelp(""), + /* 148 */ "ParseSchema" OpHelp(""), + /* 149 */ "LoadAnalysis" OpHelp(""), + /* 150 */ "DropTable" OpHelp(""), + /* 151 */ "DropIndex" OpHelp(""), + /* 152 */ "DropTrigger" OpHelp(""), + /* 153 */ "Real" OpHelp("r[P2]=P4"), + /* 154 */ "IntegrityCk" OpHelp(""), + /* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), + /* 156 */ "Param" OpHelp(""), + /* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), + /* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), + /* 159 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), + /* 160 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), + /* 161 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), + /* 162 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), + /* 163 */ "AggValue" OpHelp("r[P3]=value N=P2"), + /* 164 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), + /* 165 */ "Expire" OpHelp(""), + /* 166 */ "CursorLock" OpHelp(""), + /* 167 */ "CursorUnlock" OpHelp(""), + /* 168 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), + /* 169 */ "VBegin" OpHelp(""), + /* 170 */ "VCreate" OpHelp(""), + /* 171 */ "VDestroy" OpHelp(""), + /* 172 */ "VOpen" OpHelp(""), + /* 173 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"), + /* 174 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), + /* 175 */ "VRename" OpHelp(""), + /* 176 */ "Pagecount" OpHelp(""), + /* 177 */ "MaxPgcnt" OpHelp(""), + /* 178 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"), + /* 179 */ "Trace" OpHelp(""), + /* 180 */ "CursorHint" OpHelp(""), + /* 181 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), + /* 182 */ "Noop" OpHelp(""), + /* 183 */ "Explain" OpHelp(""), + /* 184 */ "Abortable" OpHelp(""), }; return azName[i]; } @@ -34161,205 +35086,7 @@ static pid_t randomnessPid = 0; /* ** Include code that is common to all os_*.c files */ -/************** Include os_common.h in the middle of os_unix.c ***************/ -/************** Begin file os_common.h ***************************************/ -/* -** 2004 May 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains macros and a little bit of code that is common to -** all of the platform-specific files (os_*.c) and is #included into those -** files. -** -** This file should be #included by the os_*.c files only. It is not a -** general purpose header file. -*/ -#ifndef _OS_COMMON_H_ -#define _OS_COMMON_H_ - -/* -** At least two bugs have slipped in because we changed the MEMORY_DEBUG -** macro to SQLITE_DEBUG and some older makefiles have not yet made the -** switch. The following code should catch this problem at compile-time. -*/ -#ifdef MEMORY_DEBUG -# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead." -#endif - -/* -** Macros for performance tracing. Normally turned off. Only works -** on i486 hardware. -*/ -#ifdef SQLITE_PERFORMANCE_TRACE - -/* -** hwtime.h contains inline assembler code for implementing -** high-performance timing routines. -*/ -/************** Include hwtime.h in the middle of os_common.h ****************/ -/************** Begin file hwtime.h ******************************************/ -/* -** 2008 May 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains inline asm code for retrieving "high-performance" -** counters for x86 and x86_64 class CPUs. -*/ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H - -/* -** The following routine only works on pentium-class (or newer) processors. -** It uses the RDTSC opcode to read the cycle count value out of the -** processor and returns that value. This can be used for high-res -** profiling. -*/ -#if !defined(__STRICT_ANSI__) && \ - (defined(__GNUC__) || defined(_MSC_VER)) && \ - (defined(i386) || defined(__i386__) || defined(_M_IX86)) - - #if defined(__GNUC__) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned int lo, hi; - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (sqlite_uint64)hi << 32 | lo; - } - - #elif defined(_MSC_VER) - - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ - __asm { - rdtsc - ret ; return value at EDX:EAX - } - } - - #endif - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long val; - __asm__ __volatile__ ("rdtsc" : "=A" (val)); - return val; - } - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long long retval; - unsigned long junk; - __asm__ __volatile__ ("\n\ - 1: mftbu %1\n\ - mftb %L0\n\ - mftbu %0\n\ - cmpw %0,%1\n\ - bne 1b" - : "=r" (retval), "=r" (junk)); - return retval; - } - -#else - - /* - ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. - ** - ** sqlite3Hwtime() is only used for some obscure debugging - ** and analysis configurations, not in any deliverable, so this - ** should not be a great loss. - */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } - -#endif - -#endif /* !defined(SQLITE_HWTIME_H) */ - -/************** End of hwtime.h **********************************************/ -/************** Continuing where we left off in os_common.h ******************/ - -static sqlite_uint64 g_start; -static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start -#define TIMER_ELAPSED g_elapsed -#else -#define TIMER_START -#define TIMER_END -#define TIMER_ELAPSED ((sqlite_uint64)0) -#endif - -/* -** If we compile with the SQLITE_TEST macro set, then the following block -** of code will give us the ability to simulate a disk I/O error. This -** is used for testing the I/O recovery logic. -*/ -#if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_io_error_hit; -SQLITE_API extern int sqlite3_io_error_hardhit; -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_persist; -SQLITE_API extern int sqlite3_io_error_benign; -SQLITE_API extern int sqlite3_diskfull_pending; -SQLITE_API extern int sqlite3_diskfull; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) -#define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ - { local_ioerr(); CODE; } -static void local_ioerr(){ - IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; -} -#define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ - local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ - CODE; \ - }else{ \ - sqlite3_diskfull_pending--; \ - } \ - } -#else -#define SimulateIOErrorBenign(X) -#define SimulateIOError(A) -#define SimulateDiskfullError(A) -#endif /* defined(SQLITE_TEST) */ - -/* -** When testing, keep a count of the number of open files. -*/ -#if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_open_file_count; -#define OpenCounter(X) sqlite3_open_file_count+=(X) -#else -#define OpenCounter(X) -#endif /* defined(SQLITE_TEST) */ - -#endif /* !defined(_OS_COMMON_H_) */ - -/************** End of os_common.h *******************************************/ -/************** Continuing where we left off in os_unix.c ********************/ +/* #include "os_common.h" */ /* ** Define various macros that are missing from some systems. @@ -38013,7 +38740,9 @@ static void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){ /* Forward declaration */ static int unixGetTempname(int nBuf, char *zBuf); -static int unixFcntlExternalReader(unixFile*, int*); +#ifndef SQLITE_OMIT_WAL + static int unixFcntlExternalReader(unixFile*, int*); +#endif /* ** Information and control of an open file handle. @@ -38132,7 +38861,12 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){ #endif /* SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) */ case SQLITE_FCNTL_EXTERNAL_READER: { +#ifndef SQLITE_OMIT_WAL return unixFcntlExternalReader((unixFile*)id, (int*)pArg); +#else + *(int*)pArg = 0; + return SQLITE_OK; +#endif } } return SQLITE_NOTFOUND; @@ -38965,11 +39699,17 @@ static int unixShmLock( int flags /* What to do with the lock */ ){ unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */ - unixShm *p = pDbFd->pShm; /* The shared memory being locked */ - unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */ + unixShm *p; /* The shared memory being locked */ + unixShmNode *pShmNode; /* The underlying file iNode */ int rc = SQLITE_OK; /* Result code */ u16 mask; /* Mask of locks to take or release */ - int *aLock = pShmNode->aLock; + int *aLock; + + p = pDbFd->pShm; + if( p==0 ) return SQLITE_IOERR_SHMLOCK; + pShmNode = p->pShmNode; + if( NEVER(pShmNode==0) ) return SQLITE_IOERR_SHMLOCK; + aLock = pShmNode->aLock; assert( pShmNode==pDbFd->pInode->pShmNode ); assert( pShmNode->pInode==pDbFd->pInode ); @@ -39853,25 +40593,35 @@ static int fillInUnixFile( return rc; } +/* +** Directories to consider for temp files. +*/ +static const char *azTempDirs[] = { + 0, + 0, + "/var/tmp", + "/usr/tmp", + "/tmp", + "." +}; + +/* +** Initialize first two members of azTempDirs[] array. +*/ +static void unixTempFileInit(void){ + azTempDirs[0] = getenv("SQLITE_TMPDIR"); + azTempDirs[1] = getenv("TMPDIR"); +} + /* ** Return the name of a directory in which to put temporary files. ** If no suitable temporary file directory can be found, return NULL. */ static const char *unixTempFileDir(void){ - static const char *azDirs[] = { - 0, - 0, - "/var/tmp", - "/usr/tmp", - "/tmp", - "." - }; unsigned int i = 0; struct stat buf; const char *zDir = sqlite3_temp_directory; - if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR"); - if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); while(1){ if( zDir!=0 && osStat(zDir, &buf)==0 @@ -39880,8 +40630,8 @@ static const char *unixTempFileDir(void){ ){ return zDir; } - if( i>=sizeof(azDirs)/sizeof(azDirs[0]) ) break; - zDir = azDirs[i++]; + if( i>=sizeof(azTempDirs)/sizeof(azTempDirs[0]) ) break; + zDir = azTempDirs[i++]; } return 0; } @@ -40187,6 +40937,11 @@ static int unixOpen( } memset(p, 0, sizeof(unixFile)); +#ifdef SQLITE_ASSERT_NO_FILES + /* Applications that never read or write a persistent disk files */ + assert( zName==0 ); +#endif + if( eType==SQLITE_OPEN_MAIN_DB ){ UnixUnusedFd *pUnused; pUnused = findReusableFd(zName, flags); @@ -42148,6 +42903,9 @@ SQLITE_API int sqlite3_os_init(void){ assert( UNIX_SHM_DMS==128 ); /* Byte offset of the deadman-switch */ #endif + /* Initialize temp file dir array. */ + unixTempFileInit(); + return SQLITE_OK; } @@ -42187,205 +42945,7 @@ SQLITE_API int sqlite3_os_end(void){ /* ** Include code that is common to all os_*.c files */ -/************** Include os_common.h in the middle of os_win.c ****************/ -/************** Begin file os_common.h ***************************************/ -/* -** 2004 May 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains macros and a little bit of code that is common to -** all of the platform-specific files (os_*.c) and is #included into those -** files. -** -** This file should be #included by the os_*.c files only. It is not a -** general purpose header file. -*/ -#ifndef _OS_COMMON_H_ -#define _OS_COMMON_H_ - -/* -** At least two bugs have slipped in because we changed the MEMORY_DEBUG -** macro to SQLITE_DEBUG and some older makefiles have not yet made the -** switch. The following code should catch this problem at compile-time. -*/ -#ifdef MEMORY_DEBUG -# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead." -#endif - -/* -** Macros for performance tracing. Normally turned off. Only works -** on i486 hardware. -*/ -#ifdef SQLITE_PERFORMANCE_TRACE - -/* -** hwtime.h contains inline assembler code for implementing -** high-performance timing routines. -*/ -/************** Include hwtime.h in the middle of os_common.h ****************/ -/************** Begin file hwtime.h ******************************************/ -/* -** 2008 May 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains inline asm code for retrieving "high-performance" -** counters for x86 and x86_64 class CPUs. -*/ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H - -/* -** The following routine only works on pentium-class (or newer) processors. -** It uses the RDTSC opcode to read the cycle count value out of the -** processor and returns that value. This can be used for high-res -** profiling. -*/ -#if !defined(__STRICT_ANSI__) && \ - (defined(__GNUC__) || defined(_MSC_VER)) && \ - (defined(i386) || defined(__i386__) || defined(_M_IX86)) - - #if defined(__GNUC__) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned int lo, hi; - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (sqlite_uint64)hi << 32 | lo; - } - - #elif defined(_MSC_VER) - - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ - __asm { - rdtsc - ret ; return value at EDX:EAX - } - } - - #endif - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long val; - __asm__ __volatile__ ("rdtsc" : "=A" (val)); - return val; - } - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long long retval; - unsigned long junk; - __asm__ __volatile__ ("\n\ - 1: mftbu %1\n\ - mftb %L0\n\ - mftbu %0\n\ - cmpw %0,%1\n\ - bne 1b" - : "=r" (retval), "=r" (junk)); - return retval; - } - -#else - - /* - ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. - ** - ** sqlite3Hwtime() is only used for some obscure debugging - ** and analysis configurations, not in any deliverable, so this - ** should not be a great loss. - */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } - -#endif - -#endif /* !defined(SQLITE_HWTIME_H) */ - -/************** End of hwtime.h **********************************************/ -/************** Continuing where we left off in os_common.h ******************/ - -static sqlite_uint64 g_start; -static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start -#define TIMER_ELAPSED g_elapsed -#else -#define TIMER_START -#define TIMER_END -#define TIMER_ELAPSED ((sqlite_uint64)0) -#endif - -/* -** If we compile with the SQLITE_TEST macro set, then the following block -** of code will give us the ability to simulate a disk I/O error. This -** is used for testing the I/O recovery logic. -*/ -#if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_io_error_hit; -SQLITE_API extern int sqlite3_io_error_hardhit; -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_persist; -SQLITE_API extern int sqlite3_io_error_benign; -SQLITE_API extern int sqlite3_diskfull_pending; -SQLITE_API extern int sqlite3_diskfull; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) -#define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ - { local_ioerr(); CODE; } -static void local_ioerr(){ - IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; -} -#define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ - local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ - CODE; \ - }else{ \ - sqlite3_diskfull_pending--; \ - } \ - } -#else -#define SimulateIOErrorBenign(X) -#define SimulateIOError(A) -#define SimulateDiskfullError(A) -#endif /* defined(SQLITE_TEST) */ - -/* -** When testing, keep a count of the number of open files. -*/ -#if defined(SQLITE_TEST) -SQLITE_API extern int sqlite3_open_file_count; -#define OpenCounter(X) sqlite3_open_file_count+=(X) -#else -#define OpenCounter(X) -#endif /* defined(SQLITE_TEST) */ - -#endif /* !defined(_OS_COMMON_H_) */ - -/************** End of os_common.h *******************************************/ -/************** Continuing where we left off in os_win.c *********************/ +/* #include "os_common.h" */ /* ** Include the header file for the Windows VFS. @@ -46437,10 +46997,14 @@ static int winShmLock( winFile *pDbFd = (winFile*)fd; /* Connection holding shared memory */ winShm *p = pDbFd->pShm; /* The shared memory being locked */ winShm *pX; /* For looping over all siblings */ - winShmNode *pShmNode = p->pShmNode; + winShmNode *pShmNode; int rc = SQLITE_OK; /* Result code */ u16 mask; /* Mask of locks to take or release */ + if( p==0 ) return SQLITE_IOERR_SHMLOCK; + pShmNode = p->pShmNode; + if( NEVER(pShmNode==0) ) return SQLITE_IOERR_SHMLOCK; + assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK ); assert( n>=1 ); assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED) @@ -48796,7 +49360,7 @@ static int memdbRead( */ static int memdbEnlarge(MemStore *p, sqlite3_int64 newSz){ unsigned char *pNew; - if( (p->mFlags & SQLITE_DESERIALIZE_RESIZEABLE)==0 || p->nMmap>0 ){ + if( (p->mFlags & SQLITE_DESERIALIZE_RESIZEABLE)==0 || NEVER(p->nMmap>0) ){ return SQLITE_FULL; } if( newSz>p->szMax ){ @@ -48855,8 +49419,9 @@ static int memdbTruncate(sqlite3_file *pFile, sqlite_int64 size){ MemStore *p = ((MemFile*)pFile)->pStore; int rc = SQLITE_OK; memdbEnter(p); - if( NEVER(size>p->sz) ){ - rc = SQLITE_FULL; + if( size>p->sz ){ + /* This can only happen with a corrupt wal mode db */ + rc = SQLITE_CORRUPT; }else{ p->sz = size; } @@ -48995,7 +49560,7 @@ static int memdbFetch( ){ MemStore *p = ((MemFile*)pFile)->pStore; memdbEnter(p); - if( iOfst+iAmt>p->sz ){ + if( iOfst+iAmt>p->sz || (p->mFlags & SQLITE_DESERIALIZE_RESIZEABLE)!=0 ){ *pp = 0; }else{ p->nMmap++; @@ -49029,10 +49594,9 @@ static int memdbOpen( MemFile *pFile = (MemFile*)pFd; MemStore *p = 0; int szName; - if( (flags & SQLITE_OPEN_MAIN_DB)==0 ){ - return ORIGVFS(pVfs)->xOpen(ORIGVFS(pVfs), zName, pFd, flags, pOutFlags); - } - memset(pFile, 0, sizeof(*p)); + UNUSED_PARAMETER(pVfs); + + memset(pFile, 0, sizeof(*pFile)); szName = sqlite3Strlen30(zName); if( szName>1 && zName[0]=='/' ){ int i; @@ -49091,8 +49655,9 @@ static int memdbOpen( p->szMax = sqlite3GlobalConfig.mxMemdbSize; } pFile->pStore = p; - assert( pOutFlags!=0 ); /* True because flags==SQLITE_OPEN_MAIN_DB */ - *pOutFlags = flags | SQLITE_OPEN_MEMORY; + if( pOutFlags!=0 ){ + *pOutFlags = flags | SQLITE_OPEN_MEMORY; + } pFd->pMethods = &memdb_io_methods; memdbLeave(p); return SQLITE_OK; @@ -49333,7 +49898,8 @@ SQLITE_API int sqlite3_deserialize( sqlite3_mutex_enter(db->mutex); if( zSchema==0 ) zSchema = db->aDb[0].zDbSName; iDb = sqlite3FindDbName(db, zSchema); - if( iDb<0 ){ + testcase( iDb==1 ); + if( iDb<2 && iDb!=0 ){ rc = SQLITE_ERROR; goto end_deserialize; } @@ -49756,7 +50322,7 @@ SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ sqlite3BitvecClear(0, 1, pTmpSpace); /* Run the program */ - pc = 0; + pc = i = 0; while( (op = aOp[pc])!=0 ){ switch( op ){ case 1: @@ -50060,11 +50626,14 @@ static int numberOfCachePages(PCache *p){ ** suggested cache size is set to N. */ return p->szCache; }else{ + i64 n; /* IMPLEMANTATION-OF: R-59858-46238 If the argument N is negative, then the ** number of cache pages is adjusted to be a number of pages that would ** use approximately abs(N*1024) bytes of memory based on the current ** page size. */ - return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra)); + n = ((-1024*(i64)p->szCache)/(p->szPage+p->szExtra)); + if( n>1000000000 ) n = 1000000000; + return (int)n; } } @@ -50365,7 +50934,8 @@ SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){ ** make it so. */ SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){ - assert( p->nRef>0 ); + assert( p->nRef>0 || p->pCache->bPurgeable==0 ); + testcase( p->nRef==0 ); assert( sqlite3PcachePageSanity(p) ); if( p->flags & (PGHDR_CLEAN|PGHDR_DONT_WRITE) ){ /*OPTIMIZATION-IF-FALSE*/ p->flags &= ~PGHDR_DONT_WRITE; @@ -51519,12 +52089,18 @@ static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ */ static void pcache1Cachesize(sqlite3_pcache *p, int nMax){ PCache1 *pCache = (PCache1 *)p; + u32 n; + assert( nMax>=0 ); if( pCache->bPurgeable ){ PGroup *pGroup = pCache->pGroup; pcache1EnterMutex(pGroup); - pGroup->nMaxPage += (nMax - pCache->nMax); + n = (u32)nMax; + if( n > 0x7fff0000 - pGroup->nMaxPage + pCache->nMax ){ + n = 0x7fff0000 - pGroup->nMaxPage + pCache->nMax; + } + pGroup->nMaxPage += (n - pCache->nMax); pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; - pCache->nMax = nMax; + pCache->nMax = n; pCache->n90pct = pCache->nMax*9/10; pcache1EnforceMaxPage(pCache); pcache1LeaveMutex(pGroup); @@ -51540,7 +52116,7 @@ static void pcache1Shrink(sqlite3_pcache *p){ PCache1 *pCache = (PCache1*)p; if( pCache->bPurgeable ){ PGroup *pGroup = pCache->pGroup; - int savedMaxPage; + unsigned int savedMaxPage; pcache1EnterMutex(pGroup); savedMaxPage = pGroup->nMaxPage; pGroup->nMaxPage = 0; @@ -53277,6 +53853,7 @@ struct Pager { u8 noLock; /* Do not lock (except in WAL mode) */ u8 readOnly; /* True for a read-only database */ u8 memDb; /* True to inhibit all file I/O */ + u8 memVfs; /* VFS-implemented memory database */ /************************************************************************** ** The following block contains those class members that change during @@ -53326,8 +53903,8 @@ struct Pager { i16 nReserve; /* Number of unused bytes at end of each page */ u32 vfsFlags; /* Flags for sqlite3_vfs.xOpen() */ u32 sectorSize; /* Assumed sector size during rollback */ - int pageSize; /* Number of bytes in a page */ Pgno mxPgno; /* Maximum allowed size of the database */ + i64 pageSize; /* Number of bytes in a page */ i64 journalSizeLimit; /* Size limit for persistent journal files */ char *zFilename; /* Name of the database file */ char *zJournal; /* Name of the journal file */ @@ -55490,6 +56067,9 @@ static int pager_playback(Pager *pPager, int isHot){ goto end_playback; } pPager->dbSize = mxPg; + if( pPager->mxPgnomxPgno = mxPg; + } } /* Copy original pages out of the journal and back into the @@ -55671,6 +56251,7 @@ static int readDbPage(PgHdr *pPg){ */ static void pager_write_changecounter(PgHdr *pPg){ u32 change_counter; + if( NEVER(pPg==0) ) return; /* Increment the value just read and write it back to byte 24. */ change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1; @@ -56545,8 +57126,7 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){ ** current database image, in pages, OR ** ** b) if the page content were written at this time, it would not -** be necessary to write the current content out to the sub-journal -** (as determined by function subjRequiresPage()). +** be necessary to write the current content out to the sub-journal. ** ** If the condition asserted by this function were not true, and the ** dirty page were to be discarded from the cache via the pagerStress() @@ -56561,8 +57141,16 @@ static int pager_wait_on_lock(Pager *pPager, int locktype){ */ #if defined(SQLITE_DEBUG) static void assertTruncateConstraintCb(PgHdr *pPg){ + Pager *pPager = pPg->pPager; assert( pPg->flags&PGHDR_DIRTY ); - assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize ); + if( pPg->pgno>pPager->dbSize ){ /* if (a) is false */ + Pgno pgno = pPg->pgno; + int i; + for(i=0; ipPager->nSavepoint; i++){ + PagerSavepoint *p = &pPager->aSavepoint[i]; + assert( p->nOrigpInSavepoint,pgno) ); + } + } } static void assertTruncateConstraint(Pager *pPager){ sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb); @@ -56584,7 +57172,6 @@ static void assertTruncateConstraint(Pager *pPager){ */ SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ assert( pPager->dbSize>=nPage || CORRUPT_DB ); - testcase( pPager->dbSizeeState>=PAGER_WRITER_CACHEMOD ); pPager->dbSize = nPage; @@ -57505,6 +58092,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( pPager->zWal = 0; } #endif + (void)pPtr; /* Suppress warning about unused pPtr value */ if( nPathname ) sqlite3DbFree(0, zPathname); pPager->pVfs = pVfs; @@ -57517,7 +58105,7 @@ SQLITE_PRIVATE int sqlite3PagerOpen( rc = sqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd, vfsFlags, &fout); assert( !memDb ); #ifndef SQLITE_OMIT_DESERIALIZE - memJM = (fout&SQLITE_OPEN_MEMORY)!=0; + pPager->memVfs = memJM = (fout&SQLITE_OPEN_MEMORY)!=0; #endif readOnly = (fout&SQLITE_OPEN_READONLY)!=0; @@ -57902,7 +58490,7 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ ** may mean that the pager was in the error-state when this ** function was called and the journal file does not exist. */ - if( !isOpen(pPager->jfd) ){ + if( !isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){ sqlite3_vfs * const pVfs = pPager->pVfs; int bExists; /* True if journal file exists */ rc = sqlite3OsAccess( @@ -58304,6 +58892,7 @@ SQLITE_PRIVATE int sqlite3PagerGet( DbPage **ppPage, /* Write a pointer to the page here */ int flags /* PAGER_GET_XXX flags */ ){ + /* printf("PAGE %u\n", pgno); fflush(stdout); */ return pPager->xGet(pPager, pgno, ppPage, flags); } @@ -59384,8 +59973,8 @@ SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){ ** used by the pager and its associated cache. */ SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){ - int perPageSize = pPager->pageSize + pPager->nExtra + sizeof(PgHdr) - + 5*sizeof(void*); + int perPageSize = pPager->pageSize + pPager->nExtra + + (int)(sizeof(PgHdr) + 5*sizeof(void*)); return perPageSize*sqlite3PcachePagecount(pPager->pPCache) + sqlite3MallocSize(pPager) + pPager->pageSize; @@ -59454,7 +60043,7 @@ SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, i ** Return true if this is an in-memory or temp-file backed pager. */ SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){ - return pPager->tempFile; + return pPager->tempFile || pPager->memVfs; } /* @@ -59579,14 +60168,14 @@ SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ } pPager->nSavepoint = nNew; - /* If this is a release of the outermost savepoint, truncate - ** the sub-journal to zero bytes in size. */ + /* Truncate the sub-journal so that it only includes the parts + ** that are still in use. */ if( op==SAVEPOINT_RELEASE ){ PagerSavepoint *pRel = &pPager->aSavepoint[nNew]; if( pRel->bTruncateOnRelease && isOpen(pPager->sjfd) ){ /* Only truncate if it is an in-memory sub-journal. */ if( sqlite3JournalIsInMemory(pPager->sjfd) ){ - i64 sz = (pPager->pageSize+4)*pRel->iSubRec; + i64 sz = (pPager->pageSize+4)*(i64)pRel->iSubRec; rc = sqlite3OsTruncate(pPager->sjfd, sz); assert( rc==SQLITE_OK ); } @@ -59774,7 +60363,7 @@ SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, i pPgOld = sqlite3PagerLookup(pPager, pgno); assert( !pPgOld || pPgOld->nRef==1 || CORRUPT_DB ); if( pPgOld ){ - if( pPgOld->nRef>1 ){ + if( NEVER(pPgOld->nRef>1) ){ sqlite3PagerUnrefNotNull(pPgOld); return SQLITE_CORRUPT_BKPT; } @@ -59909,12 +60498,12 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ u8 eOld = pPager->journalMode; /* Prior journalmode */ /* The eMode parameter is always valid */ - assert( eMode==PAGER_JOURNALMODE_DELETE - || eMode==PAGER_JOURNALMODE_TRUNCATE - || eMode==PAGER_JOURNALMODE_PERSIST - || eMode==PAGER_JOURNALMODE_OFF - || eMode==PAGER_JOURNALMODE_WAL - || eMode==PAGER_JOURNALMODE_MEMORY ); + assert( eMode==PAGER_JOURNALMODE_DELETE /* 0 */ + || eMode==PAGER_JOURNALMODE_PERSIST /* 1 */ + || eMode==PAGER_JOURNALMODE_OFF /* 2 */ + || eMode==PAGER_JOURNALMODE_TRUNCATE /* 3 */ + || eMode==PAGER_JOURNALMODE_MEMORY /* 4 */ + || eMode==PAGER_JOURNALMODE_WAL /* 5 */ ); /* This routine is only called from the OP_JournalMode opcode, and ** the logic there will never allow a temporary file to be changed @@ -59951,7 +60540,6 @@ SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ assert( isOpen(pPager->fd) || pPager->exclusiveMode ); if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){ - /* In this case we would like to delete the journal file. If it is ** not possible, then that is not a problem. Deleting the journal file ** here is an optimization only. @@ -60063,6 +60651,18 @@ SQLITE_PRIVATE int sqlite3PagerCheckpoint( int *pnCkpt /* OUT: Final number of checkpointed frames */ ){ int rc = SQLITE_OK; + if( pPager->pWal==0 && pPager->journalMode==PAGER_JOURNALMODE_WAL ){ + /* This only happens when a database file is zero bytes in size opened and + ** then "PRAGMA journal_mode=WAL" is run and then sqlite3_wal_checkpoint() + ** is invoked without any intervening transactions. We need to start + ** a transaction to initialize pWal. The PRAGMA table_list statement is + ** used for this since it starts transactions on every database file, + ** including all ATTACHed databases. This seems expensive for a single + ** sqlite3_wal_checkpoint() call, but it happens very rarely. + ** https://sqlite.org/forum/forumpost/fd0f19d229156939 + */ + sqlite3_exec(db, "PRAGMA table_list",0,0,0); + } if( pPager->pWal ){ rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode, (eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler), @@ -60520,7 +61120,10 @@ SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){ ** HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and ** HASHTABLE_NPAGE are selected so that together the wal-index header and ** first index block are the same size as all other index blocks in the -** wal-index. +** wal-index. The values are: +** +** HASHTABLE_NPAGE 4096 +** HASHTABLE_NPAGE_ONE 4062 ** ** Each index block contains two sections, a page-mapping that contains the ** database page number associated with each wal frame, and a hash-table @@ -60756,6 +61359,70 @@ struct WalCkptInfo { }; #define READMARK_NOT_USED 0xffffffff +/* +** This is a schematic view of the complete 136-byte header of the +** wal-index file (also known as the -shm file): +** +** +-----------------------------+ +** 0: | iVersion | \ +** +-----------------------------+ | +** 4: | (unused padding) | | +** +-----------------------------+ | +** 8: | iChange | | +** +-------+-------+-------------+ | +** 12: | bInit | bBig | szPage | | +** +-------+-------+-------------+ | +** 16: | mxFrame | | First copy of the +** +-----------------------------+ | WalIndexHdr object +** 20: | nPage | | +** +-----------------------------+ | +** 24: | aFrameCksum | | +** | | | +** +-----------------------------+ | +** 32: | aSalt | | +** | | | +** +-----------------------------+ | +** 40: | aCksum | | +** | | / +** +-----------------------------+ +** 48: | iVersion | \ +** +-----------------------------+ | +** 52: | (unused padding) | | +** +-----------------------------+ | +** 56: | iChange | | +** +-------+-------+-------------+ | +** 60: | bInit | bBig | szPage | | +** +-------+-------+-------------+ | Second copy of the +** 64: | mxFrame | | WalIndexHdr +** +-----------------------------+ | +** 68: | nPage | | +** +-----------------------------+ | +** 72: | aFrameCksum | | +** | | | +** +-----------------------------+ | +** 80: | aSalt | | +** | | | +** +-----------------------------+ | +** 88: | aCksum | | +** | | / +** +-----------------------------+ +** 96: | nBackfill | +** +-----------------------------+ +** 100: | 5 read marks | +** | | +** | | +** | | +** | | +** +-------+-------+------+------+ +** 120: | Write | Ckpt | Rcvr | Rd0 | \ +** +-------+-------+------+------+ ) 8 lock bytes +** | Read1 | Read2 | Rd3 | Rd4 | / +** +-------+-------+------+------+ +** 128: | nBackfillAttempted | +** +-----------------------------+ +** 132: | (unused padding) | +** +-----------------------------+ +*/ /* A block of WALINDEX_LOCK_RESERVED bytes beginning at ** WALINDEX_LOCK_OFFSET is reserved for locks. Since some systems @@ -60912,9 +61579,13 @@ struct WalIterator { ** so. It is safe to enlarge the wal-index if pWal->writeLock is true ** or pWal->exclusiveMode==WAL_HEAPMEMORY_MODE. ** -** If this call is successful, *ppPage is set to point to the wal-index -** page and SQLITE_OK is returned. If an error (an OOM or VFS error) occurs, -** then an SQLite error code is returned and *ppPage is set to 0. +** Three possible result scenarios: +** +** (1) rc==SQLITE_OK and *ppPage==Requested-Wal-Index-Page +** (2) rc>=SQLITE_ERROR and *ppPage==NULL +** (3) rc==SQLITE_OK and *ppPage==NULL // only if iPage==0 +** +** Scenario (3) can only occur when pWal->writeLock is false and iPage==0 */ static SQLITE_NOINLINE int walIndexPageRealloc( Wal *pWal, /* The WAL context */ @@ -60947,7 +61618,9 @@ static SQLITE_NOINLINE int walIndexPageRealloc( rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, pWal->writeLock, (void volatile **)&pWal->apWiData[iPage] ); - assert( pWal->apWiData[iPage]!=0 || rc!=SQLITE_OK || pWal->writeLock==0 ); + assert( pWal->apWiData[iPage]!=0 + || rc!=SQLITE_OK + || (pWal->writeLock==0 && iPage==0) ); testcase( pWal->apWiData[iPage]==0 && rc==SQLITE_OK ); if( rc==SQLITE_OK ){ if( iPage>0 && sqlite3FaultSim(600) ) rc = SQLITE_NOMEM; @@ -61286,8 +61959,8 @@ struct WalHashLoc { ** slot in the hash table is set to N, it refers to frame number ** (pLoc->iZero+N) in the log. ** -** Finally, set pLoc->aPgno so that pLoc->aPgno[1] is the page number of the -** first frame indexed by the hash table, frame (pLoc->iZero+1). +** Finally, set pLoc->aPgno so that pLoc->aPgno[0] is the page number of the +** first frame indexed by the hash table, frame (pLoc->iZero). */ static int walHashGet( Wal *pWal, /* WAL handle */ @@ -61299,7 +61972,7 @@ static int walHashGet( rc = walIndexPage(pWal, iHash, &pLoc->aPgno); assert( rc==SQLITE_OK || iHash>0 ); - if( rc==SQLITE_OK ){ + if( pLoc->aPgno ){ pLoc->aHash = (volatile ht_slot *)&pLoc->aPgno[HASHTABLE_NPAGE]; if( iHash==0 ){ pLoc->aPgno = &pLoc->aPgno[WALINDEX_HDR_SIZE/sizeof(u32)]; @@ -61307,7 +61980,8 @@ static int walHashGet( }else{ pLoc->iZero = HASHTABLE_NPAGE_ONE + (iHash-1)*HASHTABLE_NPAGE; } - pLoc->aPgno = &pLoc->aPgno[-1]; + }else if( NEVER(rc==SQLITE_OK) ){ + rc = SQLITE_ERROR; } return rc; } @@ -61389,8 +62063,9 @@ static void walCleanupHash(Wal *pWal){ /* Zero the entries in the aPgno array that correspond to frames with ** frame numbers greater than pWal->hdr.mxFrame. */ - nByte = (int)((char *)sLoc.aHash - (char *)&sLoc.aPgno[iLimit+1]); - memset((void *)&sLoc.aPgno[iLimit+1], 0, nByte); + nByte = (int)((char *)sLoc.aHash - (char *)&sLoc.aPgno[iLimit]); + assert( nByte>=0 ); + memset((void *)&sLoc.aPgno[iLimit], 0, nByte); #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT /* Verify that the every entry in the mapping region is still reachable @@ -61399,11 +62074,11 @@ static void walCleanupHash(Wal *pWal){ if( iLimit ){ int j; /* Loop counter */ int iKey; /* Hash key */ - for(j=1; j<=iLimit; j++){ + for(j=0; j=0 ); + memset((void*)sLoc.aPgno, 0, nByte); } /* If the entry in aPgno[] is already set, then the previous writer @@ -61446,9 +62121,9 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){ ** Remove the remnants of that writers uncommitted transaction from ** the hash-table before writing any new entries. */ - if( sLoc.aPgno[idx] ){ + if( sLoc.aPgno[idx-1] ){ walCleanupHash(pWal); - assert( !sLoc.aPgno[idx] ); + assert( !sLoc.aPgno[idx-1] ); } /* Write the aPgno[] array entry and the hash-table slot. */ @@ -61456,7 +62131,7 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){ for(iKey=walHash(iPage); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){ if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT; } - sLoc.aPgno[idx] = iPage; + sLoc.aPgno[idx-1] = iPage; AtomicStore(&sLoc.aHash[iKey], (ht_slot)idx); #ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT @@ -61477,19 +62152,18 @@ static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){ */ if( (idx&0x3ff)==0 ){ int i; /* Loop counter */ - for(i=1; i<=idx; i++){ + for(i=0; iapWiData[iPg] = aPrivate; for(iFrame=iFirst; iFrame<=iLast; iFrame++){ @@ -61769,14 +62444,43 @@ SQLITE_PRIVATE int sqlite3WalOpen( assert( zWalName && zWalName[0] ); assert( pDbFd ); + /* Verify the values of various constants. Any changes to the values + ** of these constants would result in an incompatible on-disk format + ** for the -shm file. Any change that causes one of these asserts to + ** fail is a backward compatibility problem, even if the change otherwise + ** works. + ** + ** This table also serves as a helpful cross-reference when trying to + ** interpret hex dumps of the -shm file. + */ + assert( 48 == sizeof(WalIndexHdr) ); + assert( 40 == sizeof(WalCkptInfo) ); + assert( 120 == WALINDEX_LOCK_OFFSET ); + assert( 136 == WALINDEX_HDR_SIZE ); + assert( 4096 == HASHTABLE_NPAGE ); + assert( 4062 == HASHTABLE_NPAGE_ONE ); + assert( 8192 == HASHTABLE_NSLOT ); + assert( 383 == HASHTABLE_HASH_1 ); + assert( 32768 == WALINDEX_PGSZ ); + assert( 8 == SQLITE_SHM_NLOCK ); + assert( 5 == WAL_NREADER ); + assert( 24 == WAL_FRAME_HDRSIZE ); + assert( 32 == WAL_HDRSIZE ); + assert( 120 == WALINDEX_LOCK_OFFSET + WAL_WRITE_LOCK ); + assert( 121 == WALINDEX_LOCK_OFFSET + WAL_CKPT_LOCK ); + assert( 122 == WALINDEX_LOCK_OFFSET + WAL_RECOVER_LOCK ); + assert( 123 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(0) ); + assert( 124 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(1) ); + assert( 125 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(2) ); + assert( 126 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(3) ); + assert( 127 == WALINDEX_LOCK_OFFSET + WAL_READ_LOCK(4) ); + /* In the amalgamation, the os_unix.c and os_win.c source files come before ** this source file. Verify that the #defines of the locking byte offsets ** in os_unix.c and os_win.c agree with the WALINDEX_LOCK_OFFSET value. ** For that matter, if the lock offset ever changes from its initial design ** value of 120, we need to know that so there is an assert() to check it. */ - assert( 120==WALINDEX_LOCK_OFFSET ); - assert( 136==WALINDEX_HDR_SIZE ); #ifdef WIN_SHM_BASE assert( WIN_SHM_BASE==WALINDEX_LOCK_OFFSET ); #endif @@ -62078,7 +62782,6 @@ static int walIteratorInit(Wal *pWal, u32 nBackfill, WalIterator **pp){ int nEntry; /* Number of entries in this segment */ ht_slot *aIndex; /* Sorted index for this segment */ - sLoc.aPgno++; if( (i+1)==nSegment ){ nEntry = (int)(iLast - sLoc.iZero); }else{ @@ -62859,7 +63562,9 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ } /* Allocate a buffer to read frames into */ - szFrame = pWal->hdr.szPage + WAL_FRAME_HDRSIZE; + assert( (pWal->szPage & (pWal->szPage-1))==0 ); + assert( pWal->szPage>=512 && pWal->szPage<=65536 ); + szFrame = pWal->szPage + WAL_FRAME_HDRSIZE; aFrame = (u8 *)sqlite3_malloc64(szFrame); if( aFrame==0 ){ rc = SQLITE_NOMEM_BKPT; @@ -62873,7 +63578,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){ ** the caller. */ aSaveCksum[0] = pWal->hdr.aFrameCksum[0]; aSaveCksum[1] = pWal->hdr.aFrameCksum[1]; - for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->hdr.szPage); + for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->szPage); iOffset+szFrame<=szWal; iOffset+=szFrame ){ @@ -63217,7 +63922,8 @@ SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal){ rc = walHashGet(pWal, walFramePage(i), &sLoc); if( rc!=SQLITE_OK ) break; - pgno = sLoc.aPgno[i-sLoc.iZero]; + assert( i - sLoc.iZero - 1 >=0 ); + pgno = sLoc.aPgno[i-sLoc.iZero-1]; iDbOff = (i64)(pgno-1) * szPage; if( iDbOff+szPage<=szDb ){ @@ -63450,7 +64156,7 @@ SQLITE_PRIVATE int sqlite3WalFindFrame( iKey = walHash(pgno); while( (iH = AtomicLoad(&sLoc.aHash[iKey]))!=0 ){ u32 iFrame = iH + sLoc.iZero; - if( iFrame<=iLast && iFrame>=pWal->minFrame && sLoc.aPgno[iH]==pgno ){ + if( iFrame<=iLast && iFrame>=pWal->minFrame && sLoc.aPgno[iH-1]==pgno ){ assert( iFrame>iRead || CORRUPT_DB ); iRead = iFrame; } @@ -64702,7 +65408,6 @@ typedef struct CellInfo CellInfo; */ struct MemPage { u8 isInit; /* True if previously initialized. MUST BE FIRST! */ - u8 bBusy; /* Prevent endless loops on corrupt database files */ u8 intKey; /* True if table b-trees. False for index b-trees */ u8 intKeyLeaf; /* True if the leaf of an intKey table */ Pgno pgno; /* Page number for this page */ @@ -64724,7 +65429,9 @@ struct MemPage { u8 *apOvfl[4]; /* Pointers to the body of overflow cells */ BtShared *pBt; /* Pointer to BtShared that this page is part of */ u8 *aData; /* Pointer to disk image of the page data */ - u8 *aDataEnd; /* One byte past the end of usable data */ + u8 *aDataEnd; /* One byte past the end of the entire page - not just + ** the usable space, the entire page. Used to prevent + ** corruption-induced of buffer overflow. */ u8 *aCellIdx; /* The cell index area */ u8 *aDataOfst; /* Same as aData for leaves. aData+4 for interior */ DbPage *pDbPage; /* Pager page handle */ @@ -66283,15 +66990,13 @@ static int btreeMoveto( sqlite3VdbeRecordUnpack(pKeyInfo, (int)nKey, pKey, pIdxKey); if( pIdxKey->nField==0 || pIdxKey->nField>pKeyInfo->nAllField ){ rc = SQLITE_CORRUPT_BKPT; - goto moveto_done; + }else{ + rc = sqlite3BtreeIndexMoveto(pCur, pIdxKey, pRes); } + sqlite3DbFree(pCur->pKeyInfo->db, pIdxKey); }else{ pIdxKey = 0; - } - rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes); -moveto_done: - if( pIdxKey ){ - sqlite3DbFree(pCur->pKeyInfo->db, pIdxKey); + rc = sqlite3BtreeTableMoveto(pCur, nKey, bias, pRes); } return rc; } @@ -66683,18 +67388,32 @@ static void btreeParseCellPtr( ** ** pIter += getVarint(pIter, (u64*)&pInfo->nKey); ** - ** The code is inlined to avoid a function call. + ** The code is inlined and the loop is unrolled for performance. + ** This routine is a high-runner. */ iKey = *pIter; if( iKey>=0x80 ){ - u8 *pEnd = &pIter[7]; - iKey &= 0x7f; - while(1){ - iKey = (iKey<<7) | (*++pIter & 0x7f); - if( (*pIter)<0x80 ) break; - if( pIter>=pEnd ){ - iKey = (iKey<<8) | *++pIter; - break; + u8 x; + iKey = ((iKey&0x7f)<<7) | ((x = *++pIter) & 0x7f); + if( x>=0x80 ){ + iKey = (iKey<<7) | ((x =*++pIter) & 0x7f); + if( x>=0x80 ){ + iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); + if( x>=0x80 ){ + iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); + if( x>=0x80 ){ + iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); + if( x>=0x80 ){ + iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); + if( x>=0x80 ){ + iKey = (iKey<<7) | ((x = *++pIter) & 0x7f); + if( x>=0x80 ){ + iKey = (iKey<<8) | (*++pIter); + } + } + } + } + } } } } @@ -66704,7 +67423,7 @@ static void btreeParseCellPtr( pInfo->nPayload = nPayload; pInfo->pPayload = pIter; testcase( nPayload==pPage->maxLocal ); - testcase( nPayload==pPage->maxLocal+1 ); + testcase( nPayload==(u32)pPage->maxLocal+1 ); if( nPayload<=pPage->maxLocal ){ /* This is the (easy) common case where the entire payload fits ** on the local page. No overflow is required. @@ -66741,7 +67460,7 @@ static void btreeParseCellPtrIndex( pInfo->nPayload = nPayload; pInfo->pPayload = pIter; testcase( nPayload==pPage->maxLocal ); - testcase( nPayload==pPage->maxLocal+1 ); + testcase( nPayload==(u32)pPage->maxLocal+1 ); if( nPayload<=pPage->maxLocal ){ /* This is the (easy) common case where the entire payload fits ** on the local page. No overflow is required. @@ -66804,7 +67523,7 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){ while( (*pIter++)&0x80 && pItermaxLocal ); - testcase( nSize==pPage->maxLocal+1 ); + testcase( nSize==(u32)pPage->maxLocal+1 ); if( nSize<=pPage->maxLocal ){ nSize += (u32)(pIter - pCell); if( nSize<4 ) nSize = 4; @@ -66812,7 +67531,7 @@ static u16 cellSizePtr(MemPage *pPage, u8 *pCell){ int minLocal = pPage->minLocal; nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4); testcase( nSize==pPage->maxLocal ); - testcase( nSize==pPage->maxLocal+1 ); + testcase( nSize==(u32)pPage->maxLocal+1 ); if( nSize>pPage->maxLocal ){ nSize = minLocal; } @@ -66946,7 +67665,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){ if( iFree2+sz2 > usableSize ) return SQLITE_CORRUPT_PAGE(pPage); memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz)); sz += sz2; - }else if( iFree+sz>usableSize ){ + }else if( NEVER(iFree+sz>usableSize) ){ return SQLITE_CORRUPT_PAGE(pPage); } @@ -67053,6 +67772,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){ ** fragmented bytes within the page. */ memcpy(&aData[iAddr], &aData[pc], 2); aData[hdr+7] += (u8)x; + testcase( pc+x>maxPC ); + return &aData[pc]; }else if( x+pc > maxPC ){ /* This slot extends off the end of the usable part of the page */ *pRc = SQLITE_CORRUPT_PAGE(pPg); @@ -67140,7 +67861,7 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){ int g2; assert( pSpace+nByte<=data+pPage->pBt->usableSize ); *pIdx = g2 = (int)(pSpace-data); - if( NEVER(g2<=gap) ){ + if( g2<=gap ){ return SQLITE_CORRUPT_PAGE(pPage); }else{ return SQLITE_OK; @@ -67226,7 +67947,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){ if( iFreeBlk>pPage->pBt->usableSize-4 ){ /* TH3: corrupt081.100 */ return SQLITE_CORRUPT_PAGE(pPage); } - assert( iFreeBlk>iPtr || iFreeBlk==0 ); + assert( iFreeBlk>iPtr || iFreeBlk==0 || CORRUPT_DB ); /* At this point: ** iFreeBlk: First freeblock after iStart, or zero if none @@ -67497,7 +68218,7 @@ static int btreeInitPage(MemPage *pPage){ pPage->nOverflow = 0; pPage->cellOffset = pPage->hdrOffset + 8 + pPage->childPtrSize; pPage->aCellIdx = data + pPage->childPtrSize + 8; - pPage->aDataEnd = pPage->aData + pBt->usableSize; + pPage->aDataEnd = pPage->aData + pBt->pageSize; pPage->aDataOfst = pPage->aData + pPage->childPtrSize; /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the ** number of cells on the page. */ @@ -67532,7 +68253,7 @@ static void zeroPage(MemPage *pPage, int flags){ u8 hdr = pPage->hdrOffset; u16 first; - assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno ); + assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno || CORRUPT_DB ); assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); assert( sqlite3PagerGetData(pPage->pDbPage) == data ); assert( sqlite3PagerIswriteable(pPage->pDbPage) ); @@ -67548,7 +68269,7 @@ static void zeroPage(MemPage *pPage, int flags){ pPage->nFree = (u16)(pBt->usableSize - first); decodeFlags(pPage, flags); pPage->cellOffset = first; - pPage->aDataEnd = &data[pBt->usableSize]; + pPage->aDataEnd = &data[pBt->pageSize]; pPage->aCellIdx = &data[first]; pPage->aDataOfst = &data[pPage->childPtrSize]; pPage->nOverflow = 0; @@ -67674,7 +68395,7 @@ static int getAndInitPage( goto getAndInitPage_error2; } } - assert( (*ppPage)->pgno==pgno ); + assert( (*ppPage)->pgno==pgno || CORRUPT_DB ); assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) ); /* If obtaining a child page for a cursor, we must verify that the page is @@ -68151,30 +68872,38 @@ static int removeFromSharingList(BtShared *pBt){ ** MX_CELL_SIZE(pBt) bytes with a 4-byte prefix for a left-child ** pointer. */ -static void allocateTempSpace(BtShared *pBt){ - if( !pBt->pTmpSpace ){ - pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); - - /* One of the uses of pBt->pTmpSpace is to format cells before - ** inserting them into a leaf page (function fillInCell()). If - ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes - ** by the various routines that manipulate binary cells. Which - ** can mean that fillInCell() only initializes the first 2 or 3 - ** bytes of pTmpSpace, but that the first 4 bytes are copied from - ** it into a database page. This is not actually a problem, but it - ** does cause a valgrind error when the 1 or 2 bytes of unitialized - ** data is passed to system call write(). So to avoid this error, - ** zero the first 4 bytes of temp space here. - ** - ** Also: Provide four bytes of initialized space before the - ** beginning of pTmpSpace as an area available to prepend the - ** left-child pointer to the beginning of a cell. - */ - if( pBt->pTmpSpace ){ - memset(pBt->pTmpSpace, 0, 8); - pBt->pTmpSpace += 4; - } +static SQLITE_NOINLINE int allocateTempSpace(BtShared *pBt){ + assert( pBt!=0 ); + assert( pBt->pTmpSpace==0 ); + /* This routine is called only by btreeCursor() when allocating the + ** first write cursor for the BtShared object */ + assert( pBt->pCursor!=0 && (pBt->pCursor->curFlags & BTCF_WriteFlag)!=0 ); + pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); + if( pBt->pTmpSpace==0 ){ + BtCursor *pCur = pBt->pCursor; + pBt->pCursor = pCur->pNext; /* Unlink the cursor */ + memset(pCur, 0, sizeof(*pCur)); + return SQLITE_NOMEM_BKPT; } + + /* One of the uses of pBt->pTmpSpace is to format cells before + ** inserting them into a leaf page (function fillInCell()). If + ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes + ** by the various routines that manipulate binary cells. Which + ** can mean that fillInCell() only initializes the first 2 or 3 + ** bytes of pTmpSpace, but that the first 4 bytes are copied from + ** it into a database page. This is not actually a problem, but it + ** does cause a valgrind error when the 1 or 2 bytes of unitialized + ** data is passed to system call write(). So to avoid this error, + ** zero the first 4 bytes of temp space here. + ** + ** Also: Provide four bytes of initialized space before the + ** beginning of pTmpSpace as an area available to prepend the + ** left-child pointer to the beginning of a cell. + */ + memset(pBt->pTmpSpace, 0, 8); + pBt->pTmpSpace += 4; + return SQLITE_OK; } /* @@ -68553,7 +69282,6 @@ static int lockBtree(BtShared *pBt){ MemPage *pPage1; /* Page 1 of the database file */ u32 nPage; /* Number of pages in the database */ u32 nPageFile = 0; /* Number of pages in the database file */ - u32 nPageHeader; /* Number of pages in the database according to hdr */ assert( sqlite3_mutex_held(pBt->mutex) ); assert( pBt->pPage1==0 ); @@ -68565,7 +69293,7 @@ static int lockBtree(BtShared *pBt){ /* Do some checking to help insure the file we opened really is ** a valid database file. */ - nPage = nPageHeader = get4byte(28+(u8*)pPage1->aData); + nPage = get4byte(28+(u8*)pPage1->aData); sqlite3PagerPagecount(pBt->pPager, (int*)&nPageFile); if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){ nPage = nPageFile; @@ -68600,7 +69328,7 @@ static int lockBtree(BtShared *pBt){ goto page1_init_failed; } - /* If the write version is set to 2, this database should be accessed + /* If the read version is set to 2, this database should be accessed ** in WAL mode. If the log is not already open, open it now. Then ** return SQLITE_OK and return without populating BtShared.pPage1. ** The caller detects this and calls this function again. This is @@ -68672,9 +69400,13 @@ static int lockBtree(BtShared *pBt){ pageSize-usableSize); return rc; } - if( sqlite3WritableSchema(pBt->db)==0 && nPage>nPageFile ){ - rc = SQLITE_CORRUPT_BKPT; - goto page1_init_failed; + if( nPage>nPageFile ){ + if( sqlite3WritableSchema(pBt->db)==0 ){ + rc = SQLITE_CORRUPT_BKPT; + goto page1_init_failed; + }else{ + nPage = nPageFile; + } } /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to ** be less than 480. In other words, if the page size is 512, then the @@ -69398,16 +70130,18 @@ SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){ /* ** This routine is called prior to sqlite3PagerCommit when a transaction ** is committed for an auto-vacuum database. -** -** If SQLITE_OK is returned, then *pnTrunc is set to the number of pages -** the database file should be truncated to during the commit process. -** i.e. the database has been reorganized so that only the first *pnTrunc -** pages are in use. */ -static int autoVacuumCommit(BtShared *pBt){ +static int autoVacuumCommit(Btree *p){ int rc = SQLITE_OK; - Pager *pPager = pBt->pPager; - VVA_ONLY( int nRef = sqlite3PagerRefcount(pPager); ) + Pager *pPager; + BtShared *pBt; + sqlite3 *db; + VVA_ONLY( int nRef ); + + assert( p!=0 ); + pBt = p->pBt; + pPager = pBt->pPager; + VVA_ONLY( nRef = sqlite3PagerRefcount(pPager); ) assert( sqlite3_mutex_held(pBt->mutex) ); invalidateAllOverflowCache(pBt); @@ -69415,6 +70149,7 @@ static int autoVacuumCommit(BtShared *pBt){ if( !pBt->incrVacuum ){ Pgno nFin; /* Number of pages in database after autovacuuming */ Pgno nFree; /* Number of pages on the freelist initially */ + Pgno nVac; /* Number of pages to vacuum */ Pgno iFree; /* The next page to be freed */ Pgno nOrig; /* Database size before freeing */ @@ -69428,18 +70163,42 @@ static int autoVacuumCommit(BtShared *pBt){ } nFree = get4byte(&pBt->pPage1->aData[36]); - nFin = finalDbSize(pBt, nOrig, nFree); + db = p->db; + if( db->xAutovacPages ){ + int iDb; + for(iDb=0; ALWAYS(iDbnDb); iDb++){ + if( db->aDb[iDb].pBt==p ) break; + } + nVac = db->xAutovacPages( + db->pAutovacPagesArg, + db->aDb[iDb].zDbSName, + nOrig, + nFree, + pBt->pageSize + ); + if( nVac>nFree ){ + nVac = nFree; + } + if( nVac==0 ){ + return SQLITE_OK; + } + }else{ + nVac = nFree; + } + nFin = finalDbSize(pBt, nOrig, nVac); if( nFin>nOrig ) return SQLITE_CORRUPT_BKPT; if( nFinnFin && rc==SQLITE_OK; iFree--){ - rc = incrVacuumStep(pBt, nFin, iFree, 1); + rc = incrVacuumStep(pBt, nFin, iFree, nVac==nFree); } if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){ rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); - put4byte(&pBt->pPage1->aData[32], 0); - put4byte(&pBt->pPage1->aData[36], 0); + if( nVac==nFree ){ + put4byte(&pBt->pPage1->aData[32], 0); + put4byte(&pBt->pPage1->aData[36], 0); + } put4byte(&pBt->pPage1->aData[28], nFin); pBt->bDoTruncate = 1; pBt->nPage = nFin; @@ -69490,7 +70249,7 @@ SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zSuperJrnl){ sqlite3BtreeEnter(p); #ifndef SQLITE_OMIT_AUTOVACUUM if( pBt->autoVacuum ){ - rc = autoVacuumCommit(pBt); + rc = autoVacuumCommit(p); if( rc!=SQLITE_OK ){ sqlite3BtreeLeave(p); return rc; @@ -69677,7 +70436,7 @@ static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){ int nPage = get4byte(&pPage1->aData[28]); testcase( nPage==0 ); if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); - testcase( pBt->nPage!=nPage ); + testcase( pBt->nPage!=(u32)nPage ); pBt->nPage = nPage; } @@ -69889,10 +70648,6 @@ static int btreeCursor( assert( pBt->pPage1 && pBt->pPage1->aData ); assert( wrFlag==0 || (pBt->btsFlags & BTS_READ_ONLY)==0 ); - if( wrFlag ){ - allocateTempSpace(pBt); - if( pBt->pTmpSpace==0 ) return SQLITE_NOMEM_BKPT; - } if( iTable<=1 ){ if( iTable<1 ){ return SQLITE_CORRUPT_BKPT; @@ -69909,19 +70664,25 @@ static int btreeCursor( pCur->pKeyInfo = pKeyInfo; pCur->pBtree = p; pCur->pBt = pBt; - pCur->curFlags = wrFlag ? BTCF_WriteFlag : 0; - pCur->curPagerFlags = wrFlag ? 0 : PAGER_GET_READONLY; + pCur->curFlags = 0; /* If there are two or more cursors on the same btree, then all such ** cursors *must* have the BTCF_Multiple flag set. */ for(pX=pBt->pCursor; pX; pX=pX->pNext){ if( pX->pgnoRoot==iTable ){ pX->curFlags |= BTCF_Multiple; - pCur->curFlags |= BTCF_Multiple; + pCur->curFlags = BTCF_Multiple; } } + pCur->eState = CURSOR_INVALID; pCur->pNext = pBt->pCursor; pBt->pCursor = pCur; - pCur->eState = CURSOR_INVALID; + if( wrFlag ){ + pCur->curFlags |= BTCF_WriteFlag; + pCur->curPagerFlags = 0; + if( pBt->pTmpSpace==0 ) return allocateTempSpace(pBt); + }else{ + pCur->curPagerFlags = PAGER_GET_READONLY; + } return SQLITE_OK; } static int btreeCursorWithLock( @@ -70295,7 +71056,9 @@ static int accessPayload( assert( pPage ); assert( eOp==0 || eOp==1 ); assert( pCur->eState==CURSOR_VALID ); - assert( pCur->ixnCell ); + if( pCur->ix>=pPage->nCell ){ + return SQLITE_CORRUPT_PAGE(pPage); + } assert( cursorHoldsMutex(pCur) ); getCellInfo(pCur); @@ -70482,7 +71245,6 @@ SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void assert( cursorHoldsMutex(pCur) ); assert( pCur->eState==CURSOR_VALID ); assert( pCur->iPage>=0 && pCur->pPage ); - assert( pCur->ixpPage->nCell ); return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0); } @@ -70544,7 +71306,7 @@ static const void *fetchPayload( assert( pCur->eState==CURSOR_VALID ); assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( cursorOwnsBtShared(pCur) ); - assert( pCur->ixpPage->nCell ); + assert( pCur->ixpPage->nCell || CORRUPT_DB ); assert( pCur->info.nSize>0 ); assert( pCur->info.pPayload>pCur->pPage->aData || CORRUPT_DB ); assert( pCur->info.pPayloadpPage->aDataEnd ||CORRUPT_DB); @@ -70695,7 +71457,7 @@ static int moveToRoot(BtCursor *pCur){ while( --pCur->iPage ){ releasePageNotNull(pCur->apPage[pCur->iPage]); } - pCur->pPage = pCur->apPage[0]; + pRoot = pCur->pPage = pCur->apPage[0]; goto skip_init; } }else if( pCur->pgnoRoot==0 ){ @@ -70720,7 +71482,7 @@ static int moveToRoot(BtCursor *pCur){ pCur->curIntKey = pCur->pPage->intKey; } pRoot = pCur->pPage; - assert( pRoot->pgno==pCur->pgnoRoot ); + assert( pRoot->pgno==pCur->pgnoRoot || CORRUPT_DB ); /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is @@ -70742,7 +71504,6 @@ skip_init: pCur->info.nSize = 0; pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl); - pRoot = pCur->pPage; if( pRoot->nCell>0 ){ pCur->eState = CURSOR_VALID; }else if( !pRoot->leaf ){ @@ -70877,12 +71638,8 @@ SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ return rc; } -/* Move the cursor so that it points to an entry near the key -** specified by pIdxKey or intKey. Return a success code. -** -** For INTKEY tables, the intKey parameter is used. pIdxKey -** must be NULL. For index tables, pIdxKey is used and intKey -** is ignored. +/* Move the cursor so that it points to an entry in a table (a.k.a INTKEY) +** table near the key intKey. Return a success code. ** ** If an exact match is not found, then the cursor is always ** left pointing at a leaf page which would hold the entry if it @@ -70895,39 +71652,32 @@ SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ ** *pRes is as follows: ** ** *pRes<0 The cursor is left pointing at an entry that -** is smaller than intKey/pIdxKey or if the table is empty +** is smaller than intKey or if the table is empty ** and the cursor is therefore left point to nothing. ** ** *pRes==0 The cursor is left pointing at an entry that -** exactly matches intKey/pIdxKey. +** exactly matches intKey. ** ** *pRes>0 The cursor is left pointing at an entry that -** is larger than intKey/pIdxKey. -** -** For index tables, the pIdxKey->eqSeen field is set to 1 if there -** exists an entry in the table that exactly matches pIdxKey. +** is larger than intKey. */ -SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( +SQLITE_PRIVATE int sqlite3BtreeTableMoveto( BtCursor *pCur, /* The cursor to be moved */ - UnpackedRecord *pIdxKey, /* Unpacked index key */ i64 intKey, /* The table key */ int biasRight, /* If true, bias the search to the high end */ int *pRes /* Write search results here */ ){ int rc; - RecordCompare xRecordCompare; assert( cursorOwnsBtShared(pCur) ); assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); assert( pRes ); - assert( (pIdxKey==0)==(pCur->pKeyInfo==0) ); - assert( pCur->eState!=CURSOR_VALID || (pIdxKey==0)==(pCur->curIntKey!=0) ); + assert( pCur->pKeyInfo==0 ); + assert( pCur->eState!=CURSOR_VALID || pCur->curIntKey!=0 ); /* If the cursor is already positioned at the point we are trying ** to move to, then just return without doing any work */ - if( pIdxKey==0 - && pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 - ){ + if( pCur->eState==CURSOR_VALID && (pCur->curFlags & BTCF_ValidNKey)!=0 ){ if( pCur->info.nKey==intKey ){ *pRes = 0; return SQLITE_OK; @@ -70949,9 +71699,7 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( if( pCur->info.nKey==intKey ){ return SQLITE_OK; } - }else if( rc==SQLITE_DONE ){ - rc = SQLITE_OK; - }else{ + }else if( rc!=SQLITE_DONE ){ return rc; } } @@ -70962,17 +71710,6 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( pCur->pBtree->nSeek++; /* Performance measurement during testing */ #endif - if( pIdxKey ){ - xRecordCompare = sqlite3VdbeFindCompare(pIdxKey); - pIdxKey->errCode = 0; - assert( pIdxKey->default_rc==1 - || pIdxKey->default_rc==0 - || pIdxKey->default_rc==-1 - ); - }else{ - xRecordCompare = 0; /* All keys are integers */ - } - rc = moveToRoot(pCur); if( rc ){ if( rc==SQLITE_EMPTY ){ @@ -70987,7 +71724,8 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( assert( pCur->eState==CURSOR_VALID ); assert( pCur->pPage->nCell > 0 ); assert( pCur->iPage==0 || pCur->apPage[0]->intKey==pCur->curIntKey ); - assert( pCur->curIntKey || pIdxKey ); + assert( pCur->curIntKey ); + for(;;){ int lwr, upr, idx, c; Pgno chldPg; @@ -71001,144 +71739,246 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( ** be the right kind (index or table) of b-tree page. Otherwise ** a moveToChild() or moveToRoot() call would have detected corruption. */ assert( pPage->nCell>0 ); - assert( pPage->intKey==(pIdxKey==0) ); + assert( pPage->intKey ); lwr = 0; upr = pPage->nCell-1; assert( biasRight==0 || biasRight==1 ); idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */ - pCur->ix = (u16)idx; - if( xRecordCompare==0 ){ - for(;;){ - i64 nCellKey; - pCell = findCellPastPtr(pPage, idx); - if( pPage->intKeyLeaf ){ - while( 0x80 <= *(pCell++) ){ - if( pCell>=pPage->aDataEnd ){ - return SQLITE_CORRUPT_PAGE(pPage); - } + for(;;){ + i64 nCellKey; + pCell = findCellPastPtr(pPage, idx); + if( pPage->intKeyLeaf ){ + while( 0x80 <= *(pCell++) ){ + if( pCell>=pPage->aDataEnd ){ + return SQLITE_CORRUPT_PAGE(pPage); } } - getVarint(pCell, (u64*)&nCellKey); - if( nCellKeyupr ){ c = -1; break; } - }else if( nCellKey>intKey ){ - upr = idx-1; - if( lwr>upr ){ c = +1; break; } + } + getVarint(pCell, (u64*)&nCellKey); + if( nCellKeyupr ){ c = -1; break; } + }else if( nCellKey>intKey ){ + upr = idx-1; + if( lwr>upr ){ c = +1; break; } + }else{ + assert( nCellKey==intKey ); + pCur->ix = (u16)idx; + if( !pPage->leaf ){ + lwr = idx; + goto moveto_table_next_layer; }else{ - assert( nCellKey==intKey ); - pCur->ix = (u16)idx; - if( !pPage->leaf ){ - lwr = idx; - goto moveto_next_layer; - }else{ - pCur->curFlags |= BTCF_ValidNKey; - pCur->info.nKey = nCellKey; - pCur->info.nSize = 0; - *pRes = 0; - return SQLITE_OK; - } + pCur->curFlags |= BTCF_ValidNKey; + pCur->info.nKey = nCellKey; + pCur->info.nSize = 0; + *pRes = 0; + return SQLITE_OK; } - assert( lwr+upr>=0 ); - idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2; */ } + assert( lwr+upr>=0 ); + idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2; */ + } + assert( lwr==upr+1 || !pPage->leaf ); + assert( pPage->isInit ); + if( pPage->leaf ){ + assert( pCur->ixpPage->nCell ); + pCur->ix = (u16)idx; + *pRes = c; + rc = SQLITE_OK; + goto moveto_table_finish; + } +moveto_table_next_layer: + if( lwr>=pPage->nCell ){ + chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]); }else{ - for(;;){ - int nCell; /* Size of the pCell cell in bytes */ - pCell = findCellPastPtr(pPage, idx); - - /* The maximum supported page-size is 65536 bytes. This means that - ** the maximum number of record bytes stored on an index B-Tree - ** page is less than 16384 bytes and may be stored as a 2-byte - ** varint. This information is used to attempt to avoid parsing - ** the entire cell by checking for the cases where the record is - ** stored entirely within the b-tree page by inspecting the first - ** 2 bytes of the cell. - */ - nCell = pCell[0]; - if( nCell<=pPage->max1bytePayload ){ - /* This branch runs if the record-size field of the cell is a - ** single byte varint and the record fits entirely on the main - ** b-tree page. */ - testcase( pCell+nCell+1==pPage->aDataEnd ); - c = xRecordCompare(nCell, (void*)&pCell[1], pIdxKey); - }else if( !(pCell[1] & 0x80) - && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal - ){ - /* The record-size field is a 2 byte varint and the record - ** fits entirely on the main b-tree page. */ - testcase( pCell+nCell+2==pPage->aDataEnd ); - c = xRecordCompare(nCell, (void*)&pCell[2], pIdxKey); - }else{ - /* The record flows over onto one or more overflow pages. In - ** this case the whole cell needs to be parsed, a buffer allocated - ** and accessPayload() used to retrieve the record into the - ** buffer before VdbeRecordCompare() can be called. - ** - ** If the record is corrupt, the xRecordCompare routine may read - ** up to two varints past the end of the buffer. An extra 18 - ** bytes of padding is allocated at the end of the buffer in - ** case this happens. */ - void *pCellKey; - u8 * const pCellBody = pCell - pPage->childPtrSize; - const int nOverrun = 18; /* Size of the overrun padding */ - pPage->xParseCell(pPage, pCellBody, &pCur->info); - nCell = (int)pCur->info.nKey; - testcase( nCell<0 ); /* True if key size is 2^32 or more */ - testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */ - testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */ - testcase( nCell==2 ); /* Minimum legal index key size */ - if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){ - rc = SQLITE_CORRUPT_PAGE(pPage); - goto moveto_finish; - } - pCellKey = sqlite3Malloc( nCell+nOverrun ); - if( pCellKey==0 ){ - rc = SQLITE_NOMEM_BKPT; - goto moveto_finish; - } - pCur->ix = (u16)idx; - rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0); - memset(((u8*)pCellKey)+nCell,0,nOverrun); /* Fix uninit warnings */ - pCur->curFlags &= ~BTCF_ValidOvfl; - if( rc ){ - sqlite3_free(pCellKey); - goto moveto_finish; - } - c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); - sqlite3_free(pCellKey); + chldPg = get4byte(findCell(pPage, lwr)); + } + pCur->ix = (u16)lwr; + rc = moveToChild(pCur, chldPg); + if( rc ) break; + } +moveto_table_finish: + pCur->info.nSize = 0; + assert( (pCur->curFlags & BTCF_ValidOvfl)==0 ); + return rc; +} + +/* Move the cursor so that it points to an entry in an index table +** near the key pIdxKey. Return a success code. +** +** If an exact match is not found, then the cursor is always +** left pointing at a leaf page which would hold the entry if it +** were present. The cursor might point to an entry that comes +** before or after the key. +** +** An integer is written into *pRes which is the result of +** comparing the key with the entry to which the cursor is +** pointing. The meaning of the integer written into +** *pRes is as follows: +** +** *pRes<0 The cursor is left pointing at an entry that +** is smaller than pIdxKey or if the table is empty +** and the cursor is therefore left point to nothing. +** +** *pRes==0 The cursor is left pointing at an entry that +** exactly matches pIdxKey. +** +** *pRes>0 The cursor is left pointing at an entry that +** is larger than pIdxKey. +** +** The pIdxKey->eqSeen field is set to 1 if there +** exists an entry in the table that exactly matches pIdxKey. +*/ +SQLITE_PRIVATE int sqlite3BtreeIndexMoveto( + BtCursor *pCur, /* The cursor to be moved */ + UnpackedRecord *pIdxKey, /* Unpacked index key */ + int *pRes /* Write search results here */ +){ + int rc; + RecordCompare xRecordCompare; + + assert( cursorOwnsBtShared(pCur) ); + assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); + assert( pRes ); + assert( pCur->pKeyInfo!=0 ); + +#ifdef SQLITE_DEBUG + pCur->pBtree->nSeek++; /* Performance measurement during testing */ +#endif + + xRecordCompare = sqlite3VdbeFindCompare(pIdxKey); + pIdxKey->errCode = 0; + assert( pIdxKey->default_rc==1 + || pIdxKey->default_rc==0 + || pIdxKey->default_rc==-1 + ); + + rc = moveToRoot(pCur); + if( rc ){ + if( rc==SQLITE_EMPTY ){ + assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 ); + *pRes = -1; + return SQLITE_OK; + } + return rc; + } + assert( pCur->pPage ); + assert( pCur->pPage->isInit ); + assert( pCur->eState==CURSOR_VALID ); + assert( pCur->pPage->nCell > 0 ); + assert( pCur->iPage==0 || pCur->apPage[0]->intKey==pCur->curIntKey ); + assert( pCur->curIntKey || pIdxKey ); + for(;;){ + int lwr, upr, idx, c; + Pgno chldPg; + MemPage *pPage = pCur->pPage; + u8 *pCell; /* Pointer to current cell in pPage */ + + /* pPage->nCell must be greater than zero. If this is the root-page + ** the cursor would have been INVALID above and this for(;;) loop + ** not run. If this is not the root-page, then the moveToChild() routine + ** would have already detected db corruption. Similarly, pPage must + ** be the right kind (index or table) of b-tree page. Otherwise + ** a moveToChild() or moveToRoot() call would have detected corruption. */ + assert( pPage->nCell>0 ); + assert( pPage->intKey==(pIdxKey==0) ); + lwr = 0; + upr = pPage->nCell-1; + idx = upr>>1; /* idx = (lwr+upr)/2; */ + for(;;){ + int nCell; /* Size of the pCell cell in bytes */ + pCell = findCellPastPtr(pPage, idx); + + /* The maximum supported page-size is 65536 bytes. This means that + ** the maximum number of record bytes stored on an index B-Tree + ** page is less than 16384 bytes and may be stored as a 2-byte + ** varint. This information is used to attempt to avoid parsing + ** the entire cell by checking for the cases where the record is + ** stored entirely within the b-tree page by inspecting the first + ** 2 bytes of the cell. + */ + nCell = pCell[0]; + if( nCell<=pPage->max1bytePayload ){ + /* This branch runs if the record-size field of the cell is a + ** single byte varint and the record fits entirely on the main + ** b-tree page. */ + testcase( pCell+nCell+1==pPage->aDataEnd ); + c = xRecordCompare(nCell, (void*)&pCell[1], pIdxKey); + }else if( !(pCell[1] & 0x80) + && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal + ){ + /* The record-size field is a 2 byte varint and the record + ** fits entirely on the main b-tree page. */ + testcase( pCell+nCell+2==pPage->aDataEnd ); + c = xRecordCompare(nCell, (void*)&pCell[2], pIdxKey); + }else{ + /* The record flows over onto one or more overflow pages. In + ** this case the whole cell needs to be parsed, a buffer allocated + ** and accessPayload() used to retrieve the record into the + ** buffer before VdbeRecordCompare() can be called. + ** + ** If the record is corrupt, the xRecordCompare routine may read + ** up to two varints past the end of the buffer. An extra 18 + ** bytes of padding is allocated at the end of the buffer in + ** case this happens. */ + void *pCellKey; + u8 * const pCellBody = pCell - pPage->childPtrSize; + const int nOverrun = 18; /* Size of the overrun padding */ + pPage->xParseCell(pPage, pCellBody, &pCur->info); + nCell = (int)pCur->info.nKey; + testcase( nCell<0 ); /* True if key size is 2^32 or more */ + testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */ + testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */ + testcase( nCell==2 ); /* Minimum legal index key size */ + if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){ + rc = SQLITE_CORRUPT_PAGE(pPage); + goto moveto_index_finish; + } + pCellKey = sqlite3Malloc( nCell+nOverrun ); + if( pCellKey==0 ){ + rc = SQLITE_NOMEM_BKPT; + goto moveto_index_finish; } - assert( - (pIdxKey->errCode!=SQLITE_CORRUPT || c==0) - && (pIdxKey->errCode!=SQLITE_NOMEM || pCur->pBtree->db->mallocFailed) - ); - if( c<0 ){ - lwr = idx+1; - }else if( c>0 ){ - upr = idx-1; - }else{ - assert( c==0 ); - *pRes = 0; - rc = SQLITE_OK; - pCur->ix = (u16)idx; - if( pIdxKey->errCode ) rc = SQLITE_CORRUPT_BKPT; - goto moveto_finish; + pCur->ix = (u16)idx; + rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0); + memset(((u8*)pCellKey)+nCell,0,nOverrun); /* Fix uninit warnings */ + pCur->curFlags &= ~BTCF_ValidOvfl; + if( rc ){ + sqlite3_free(pCellKey); + goto moveto_index_finish; } - if( lwr>upr ) break; - assert( lwr+upr>=0 ); - idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2 */ + c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); + sqlite3_free(pCellKey); } + assert( + (pIdxKey->errCode!=SQLITE_CORRUPT || c==0) + && (pIdxKey->errCode!=SQLITE_NOMEM || pCur->pBtree->db->mallocFailed) + ); + if( c<0 ){ + lwr = idx+1; + }else if( c>0 ){ + upr = idx-1; + }else{ + assert( c==0 ); + *pRes = 0; + rc = SQLITE_OK; + pCur->ix = (u16)idx; + if( pIdxKey->errCode ) rc = SQLITE_CORRUPT_BKPT; + goto moveto_index_finish; + } + if( lwr>upr ) break; + assert( lwr+upr>=0 ); + idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2 */ } assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) ); assert( pPage->isInit ); if( pPage->leaf ){ - assert( pCur->ixpPage->nCell ); + assert( pCur->ixpPage->nCell || CORRUPT_DB ); pCur->ix = (u16)idx; *pRes = c; rc = SQLITE_OK; - goto moveto_finish; + goto moveto_index_finish; } -moveto_next_layer: if( lwr>=pPage->nCell ){ chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]); }else{ @@ -71148,7 +71988,7 @@ moveto_next_layer: rc = moveToChild(pCur, chldPg); if( rc ) break; } -moveto_finish: +moveto_index_finish: pCur->info.nSize = 0; assert( (pCur->curFlags & BTCF_ValidOvfl)==0 ); return rc; @@ -71249,16 +72089,6 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){ return SQLITE_CORRUPT_BKPT; } - /* If the database file is corrupt, it is possible for the value of idx - ** to be invalid here. This can only occur if a second cursor modifies - ** the page while cursor pCur is holding a reference to it. Which can - ** only happen if the database is corrupt in such a way as to link the - ** page into more than one b-tree structure. - ** - ** Update 2019-12-23: appears to long longer be possible after the - ** addition of anotherValidCursor() condition on balance_deeper(). */ - harmless( idx>pPage->nCell ); - if( idx>=pPage->nCell ){ if( !pPage->leaf ){ rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8])); @@ -72170,16 +73000,24 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){ int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */ if( *pRC ) return; - assert( idx>=0 && idxnCell ); + assert( idx>=0 ); + assert( idxnCell ); assert( CORRUPT_DB || sz==cellSize(pPage, idx) ); assert( sqlite3PagerIswriteable(pPage->pDbPage) ); assert( sqlite3_mutex_held(pPage->pBt->mutex) ); assert( pPage->nFree>=0 ); data = pPage->aData; ptr = &pPage->aCellIdx[2*idx]; + assert( pPage->pBt->usableSize > (u32)(ptr-data) ); pc = get2byte(ptr); hdr = pPage->hdrOffset; - testcase( pc==get2byte(&data[hdr+5]) ); +#if 0 /* Not required. Omit for efficiency */ + if( pcnCell*2 ){ + *pRC = SQLITE_CORRUPT_BKPT; + return; + } +#endif + testcase( pc==(u32)get2byte(&data[hdr+5]) ); testcase( pc+sz==pPage->pBt->usableSize ); if( pc+sz > pPage->pBt->usableSize ){ *pRC = SQLITE_CORRUPT_BKPT; @@ -72471,7 +73309,7 @@ static int rebuildPage( assert( i(u32)usableSize) ){ j = 0; } + if( j>(u32)usableSize ){ j = 0; } memcpy(&pTmp[j], &aData[j], usableSize - j); for(k=0; pCArray->ixNx[k]<=i && ALWAYS(kpPg->aDataEnd ) goto editpage_fail; /* Add cells to the start of the page */ if( iNewpBt; assert( sqlite3_mutex_held(pBt->mutex) ); assert( sqlite3PagerIswriteable(pParent->pDbPage) ); @@ -73132,6 +73970,7 @@ static int balance_nonroot( goto balance_cleanup; } } + nMaxCells += apOld[i]->nCell + ArraySize(pParent->apOvfl); if( (i--)==0 ) break; if( pParent->nOverflow && i+nxDiv==pParent->aiOvfl[0] ){ @@ -73173,7 +74012,6 @@ static int balance_nonroot( /* Make nMaxCells a multiple of 4 in order to preserve 8-byte ** alignment */ - nMaxCells = nOld*(MX_CELL(pBt) + ArraySize(pParent->apOvfl)); nMaxCells = (nMaxCells + 3)&~3; /* @@ -73456,7 +74294,9 @@ static int balance_nonroot( apOld[i] = 0; rc = sqlite3PagerWrite(pNew->pDbPage); nNew++; - if( sqlite3PagerPageRefcount(pNew->pDbPage)!=1+(i==(iParentIdx-nxDiv)) ){ + if( sqlite3PagerPageRefcount(pNew->pDbPage)!=1+(i==(iParentIdx-nxDiv)) + && rc==SQLITE_OK + ){ rc = SQLITE_CORRUPT_BKPT; } if( rc ) goto balance_cleanup; @@ -73657,7 +74497,7 @@ static int balance_nonroot( iOvflSpace += sz; assert( sz<=pBt->maxLocal+23 ); assert( iOvflSpace <= (int)pBt->pageSize ); - for(k=0; b.ixNx[k]<=i && ALWAYS(kpDbPage)!=1 ){ + if( sqlite3PagerPageRefcount(pPage->pDbPage)!=1 || pPage->isInit ){ rc = SQLITE_CORRUPT_BKPT; }else{ if( iOffset+ovflPageSize<(u32)nTotal ){ @@ -74173,24 +75013,6 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( assert( (flags & (BTREE_SAVEPOSITION|BTREE_APPEND|BTREE_PREFORMAT))==flags ); assert( (flags & BTREE_PREFORMAT)==0 || seekResult || pCur->pKeyInfo==0 ); - if( pCur->eState==CURSOR_FAULT ){ - assert( pCur->skipNext!=SQLITE_OK ); - return pCur->skipNext; - } - - assert( cursorOwnsBtShared(pCur) ); - assert( (pCur->curFlags & BTCF_WriteFlag)!=0 - && pBt->inTransaction==TRANS_WRITE - && (pBt->btsFlags & BTS_READ_ONLY)==0 ); - assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); - - /* Assert that the caller has been consistent. If this cursor was opened - ** expecting an index b-tree, then the caller should be inserting blob - ** keys with no associated data. If the cursor was opened expecting an - ** intkey table, the caller should be inserting integer keys with a - ** blob of associated data. */ - assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) ); - /* Save the positions of any other cursors open on this table. ** ** In some cases, the call to btreeMoveto() below is a no-op. For @@ -74215,6 +75037,24 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( } } + if( pCur->eState>=CURSOR_REQUIRESEEK ){ + rc = moveToRoot(pCur); + if( rc && rc!=SQLITE_EMPTY ) return rc; + } + + assert( cursorOwnsBtShared(pCur) ); + assert( (pCur->curFlags & BTCF_WriteFlag)!=0 + && pBt->inTransaction==TRANS_WRITE + && (pBt->btsFlags & BTS_READ_ONLY)==0 ); + assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); + + /* Assert that the caller has been consistent. If this cursor was opened + ** expecting an index b-tree, then the caller should be inserting blob + ** keys with no associated data. If the cursor was opened expecting an + ** intkey table, the caller should be inserting integer keys with a + ** blob of associated data. */ + assert( (flags & BTREE_PREFORMAT) || (pX->pKey==0)==(pCur->pKeyInfo==0) ); + if( pCur->pKeyInfo==0 ){ assert( pX->pKey==0 ); /* If this is an insert into a table b-tree, invalidate any incrblob @@ -74254,7 +75094,8 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( ** to an adjacent cell. Move the cursor so that it is pointing either ** to the cell to be overwritten or an adjacent cell. */ - rc = sqlite3BtreeMovetoUnpacked(pCur, 0, pX->nKey, flags!=0, &loc); + rc = sqlite3BtreeTableMoveto(pCur, pX->nKey, + (flags & BTREE_APPEND)!=0, &loc); if( rc ) return rc; } }else{ @@ -74277,13 +75118,11 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( r.aMem = pX->aMem; r.nField = pX->nMem; r.default_rc = 0; - r.errCode = 0; - r.r1 = 0; - r.r2 = 0; r.eqSeen = 0; - rc = sqlite3BtreeMovetoUnpacked(pCur, &r, 0, flags!=0, &loc); + rc = sqlite3BtreeIndexMoveto(pCur, &r, &loc); }else{ - rc = btreeMoveto(pCur, pX->pKey, pX->nKey, flags!=0, &loc); + rc = btreeMoveto(pCur, pX->pKey, pX->nKey, + (flags & BTREE_APPEND)!=0, &loc); } if( rc ) return rc; } @@ -74304,14 +75143,13 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( } } assert( pCur->eState==CURSOR_VALID - || (pCur->eState==CURSOR_INVALID && loc) - || CORRUPT_DB ); + || (pCur->eState==CURSOR_INVALID && loc) ); pPage = pCur->pPage; assert( pPage->intKey || pX->nKey>=0 || (flags & BTREE_PREFORMAT) ); assert( pPage->leaf || !pPage->intKey ); if( pPage->nFree<0 ){ - if( NEVER(pCur->eState>CURSOR_INVALID) ){ + if( pCur->eState>CURSOR_INVALID ){ rc = SQLITE_CORRUPT_BKPT; }else{ rc = btreeComputeFreeSpace(pPage); @@ -74346,7 +75184,10 @@ SQLITE_PRIVATE int sqlite3BtreeInsert( idx = pCur->ix; if( loc==0 ){ CellInfo info; - assert( idxnCell ); + assert( idx>=0 ); + if( idx>=pPage->nCell ){ + return SQLITE_CORRUPT_BKPT; + } rc = sqlite3PagerWrite(pPage->pDbPage); if( rc ){ goto end_insert; @@ -74528,7 +75369,7 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 } }while( rc==SQLITE_OK && nOut>0 ); - if( rc==SQLITE_OK && nRem>0 ){ + if( rc==SQLITE_OK && nRem>0 && ALWAYS(pPgnoOut) ){ Pgno pgnoNew; MemPage *pNew = 0; rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0); @@ -74574,14 +75415,13 @@ SQLITE_PRIVATE int sqlite3BtreeTransferRow(BtCursor *pDest, BtCursor *pSrc, i64 SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ Btree *p = pCur->pBtree; BtShared *pBt = p->pBt; - int rc; /* Return code */ - MemPage *pPage; /* Page to delete cell from */ - unsigned char *pCell; /* Pointer to cell to delete */ - int iCellIdx; /* Index of cell to delete */ - int iCellDepth; /* Depth of node containing pCell */ - CellInfo info; /* Size of the cell being deleted */ - int bSkipnext = 0; /* Leaf cursor in SKIPNEXT state */ - u8 bPreserve = flags & BTREE_SAVEPOSITION; /* Keep cursor valid */ + int rc; /* Return code */ + MemPage *pPage; /* Page to delete cell from */ + unsigned char *pCell; /* Pointer to cell to delete */ + int iCellIdx; /* Index of cell to delete */ + int iCellDepth; /* Depth of node containing pCell */ + CellInfo info; /* Size of the cell being deleted */ + u8 bPreserve; /* Keep cursor valid. 2 for CURSOR_SKIPNEXT */ assert( cursorOwnsBtShared(pCur) ); assert( pBt->inTransaction==TRANS_WRITE ); @@ -74590,28 +75430,45 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); assert( !hasReadConflicts(p, pCur->pgnoRoot) ); assert( (flags & ~(BTREE_SAVEPOSITION | BTREE_AUXDELETE))==0 ); - if( pCur->eState==CURSOR_REQUIRESEEK ){ - rc = btreeRestoreCursorPosition(pCur); - assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID ); - if( rc || pCur->eState!=CURSOR_VALID ) return rc; + if( pCur->eState!=CURSOR_VALID ){ + if( pCur->eState>=CURSOR_REQUIRESEEK ){ + rc = btreeRestoreCursorPosition(pCur); + assert( rc!=SQLITE_OK || CORRUPT_DB || pCur->eState==CURSOR_VALID ); + if( rc || pCur->eState!=CURSOR_VALID ) return rc; + }else{ + return SQLITE_CORRUPT_BKPT; + } } - assert( CORRUPT_DB || pCur->eState==CURSOR_VALID ); + assert( pCur->eState==CURSOR_VALID ); iCellDepth = pCur->iPage; iCellIdx = pCur->ix; pPage = pCur->pPage; + if( pPage->nCell<=iCellIdx ){ + return SQLITE_CORRUPT_BKPT; + } pCell = findCell(pPage, iCellIdx); - if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ) return SQLITE_CORRUPT; + if( pPage->nFree<0 && btreeComputeFreeSpace(pPage) ){ + return SQLITE_CORRUPT_BKPT; + } - /* If the bPreserve flag is set to true, then the cursor position must + /* If the BTREE_SAVEPOSITION bit is on, then the cursor position must ** be preserved following this delete operation. If the current delete ** will cause a b-tree rebalance, then this is done by saving the cursor ** key and leaving the cursor in CURSOR_REQUIRESEEK state before ** returning. ** - ** Or, if the current delete will not cause a rebalance, then the cursor + ** If the current delete will not cause a rebalance, then the cursor ** will be left in CURSOR_SKIPNEXT state pointing to the entry immediately - ** before or after the deleted entry. In this case set bSkipnext to true. */ + ** before or after the deleted entry. + ** + ** The bPreserve value records which path is required: + ** + ** bPreserve==0 Not necessary to save the cursor position + ** bPreserve==1 Use CURSOR_REQUIRESEEK to save the cursor position + ** bPreserve==2 Cursor won't move. Set CURSOR_SKIPNEXT. + */ + bPreserve = (flags & BTREE_SAVEPOSITION)!=0; if( bPreserve ){ if( !pPage->leaf || (pPage->nFree+cellSizePtr(pPage,pCell)+2)>(int)(pBt->usableSize*2/3) @@ -74622,7 +75479,7 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ rc = saveCursorKey(pCur); if( rc ) return rc; }else{ - bSkipnext = 1; + bPreserve = 2; } } @@ -74722,8 +75579,8 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){ } if( rc==SQLITE_OK ){ - if( bSkipnext ){ - assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) ); + if( bPreserve>1 ){ + assert( (pCur->iPage==iCellDepth || CORRUPT_DB) ); assert( pPage==pCur->pPage || CORRUPT_DB ); assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell ); pCur->eState = CURSOR_SKIPNEXT; @@ -74917,7 +75774,7 @@ static int clearDatabasePage( BtShared *pBt, /* The BTree that contains the table */ Pgno pgno, /* Page number to clear */ int freePageFlag, /* Deallocate page if true */ - int *pnChange /* Add number of Cells freed to this counter */ + i64 *pnChange /* Add number of Cells freed to this counter */ ){ MemPage *pPage; int rc; @@ -74932,11 +75789,12 @@ static int clearDatabasePage( } rc = getAndInitPage(pBt, pgno, &pPage, 0, 0); if( rc ) return rc; - if( pPage->bBusy ){ + if( (pBt->openFlags & BTREE_SINGLE)==0 + && sqlite3PagerPageRefcount(pPage->pDbPage) != (1 + (pgno==1)) + ){ rc = SQLITE_CORRUPT_BKPT; goto cleardatabasepage_out; } - pPage->bBusy = 1; hdr = pPage->hdrOffset; for(i=0; inCell; i++){ pCell = findCell(pPage, i); @@ -74950,6 +75808,7 @@ static int clearDatabasePage( if( !pPage->leaf ){ rc = clearDatabasePage(pBt, get4byte(&pPage->aData[hdr+8]), 1, pnChange); if( rc ) goto cleardatabasepage_out; + if( pPage->intKey ) pnChange = 0; } if( pnChange ){ testcase( !pPage->intKey ); @@ -74962,7 +75821,6 @@ static int clearDatabasePage( } cleardatabasepage_out: - pPage->bBusy = 0; releasePage(pPage); return rc; } @@ -74979,7 +75837,7 @@ cleardatabasepage_out: ** If pnChange is not NULL, then the integer value pointed to by pnChange ** is incremented by the number of entries in the table. */ -SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ +SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, i64 *pnChange){ int rc; BtShared *pBt = p->pBt; sqlite3BtreeEnter(p); @@ -75041,10 +75899,10 @@ static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ return SQLITE_CORRUPT_BKPT; } - rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0); - if( rc ) return rc; rc = sqlite3BtreeClearTable(p, iTable, 0); - if( rc ){ + if( rc ) return rc; + rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0); + if( NEVER(rc) ){ releasePage(pPage); return rc; } @@ -76312,14 +77170,13 @@ static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){ if( i==1 ){ Parse sParse; int rc = 0; - memset(&sParse, 0, sizeof(sParse)); - sParse.db = pDb; + sqlite3ParseObjectInit(&sParse,pDb); if( sqlite3OpenTempDatabase(&sParse) ){ sqlite3ErrorWithMsg(pErrorDb, sParse.rc, "%s", sParse.zErrMsg); rc = SQLITE_ERROR; } sqlite3DbFree(pErrorDb, sParse.zErrMsg); - sqlite3ParserReset(&sParse); + sqlite3ParseObjectReset(&sParse); if( rc ){ return 0; } @@ -77201,10 +78058,15 @@ SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){ #ifndef SQLITE_OMIT_UTF16 int rc; #endif + assert( pMem!=0 ); assert( !sqlite3VdbeMemIsRowSet(pMem) ); assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE || desiredEnc==SQLITE_UTF16BE ); - if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){ + if( !(pMem->flags&MEM_Str) ){ + pMem->enc = desiredEnc; + return SQLITE_OK; + } + if( pMem->enc==desiredEnc ){ return SQLITE_OK; } assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); @@ -77333,6 +78195,7 @@ static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){ ** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails. */ SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){ + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( !sqlite3VdbeMemIsRowSet(pMem) ); if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){ @@ -77357,6 +78220,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){ #ifndef SQLITE_OMIT_INCRBLOB SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){ int nByte; + assert( pMem!=0 ); assert( pMem->flags & MEM_Zero ); assert( (pMem->flags&MEM_Blob)!=0 || MemNullNochng(pMem) ); testcase( sqlite3_value_nochange(pMem) ); @@ -77372,6 +78236,8 @@ SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){ if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){ return SQLITE_NOMEM_BKPT; } + assert( pMem->z!=0 ); + assert( sqlite3DbMallocSize(pMem->db,pMem->z) >= nByte ); memset(&pMem->z[pMem->n], 0, pMem->u.nZero); pMem->n += pMem->u.nZero; @@ -77384,6 +78250,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){ ** Make sure the given Mem is \u0000 terminated. */ SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); testcase( (pMem->flags & (MEM_Term|MEM_Str))==(MEM_Term|MEM_Str) ); testcase( (pMem->flags & (MEM_Term|MEM_Str))==0 ); @@ -77411,6 +78278,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){ const int nByte = 32; + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( !(pMem->flags&MEM_Zero) ); assert( !(pMem->flags&(MEM_Str|MEM_Blob)) ); @@ -77446,6 +78314,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){ sqlite3_context ctx; Mem t; assert( pFunc!=0 ); + assert( pMem!=0 ); assert( pFunc->xFinalize!=0 ); assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); @@ -77589,13 +78458,14 @@ static SQLITE_NOINLINE i64 doubleToInt64(double r){ ** ** If pMem represents a string value, its encoding might be changed. */ -static SQLITE_NOINLINE i64 memIntValue(Mem *pMem){ +static SQLITE_NOINLINE i64 memIntValue(const Mem *pMem){ i64 value = 0; sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc); return value; } -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){ +SQLITE_PRIVATE i64 sqlite3VdbeIntValue(const Mem *pMem){ int flags; + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); flags = pMem->flags; @@ -77624,6 +78494,7 @@ static SQLITE_NOINLINE double memRealValue(Mem *pMem){ return val; } SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){ + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); if( pMem->flags & MEM_Real ){ @@ -77656,6 +78527,7 @@ SQLITE_PRIVATE int sqlite3VdbeBooleanValue(Mem *pMem, int ifNull){ */ SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){ i64 ix; + assert( pMem!=0 ); assert( pMem->flags & MEM_Real ); assert( !sqlite3VdbeMemIsRowSet(pMem) ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); @@ -77683,6 +78555,7 @@ SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){ ** Convert pMem to type integer. Invalidate any prior representations. */ SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){ + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( !sqlite3VdbeMemIsRowSet(pMem) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); @@ -77697,6 +78570,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){ ** Invalidate any prior representations. */ SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){ + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); @@ -77730,6 +78604,7 @@ SQLITE_PRIVATE int sqlite3RealSameAsInt(double r1, sqlite3_int64 i){ ** as much of the string as we can and ignore the rest. */ SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){ + assert( pMem!=0 ); testcase( pMem->flags & MEM_Int ); testcase( pMem->flags & MEM_Real ); testcase( pMem->flags & MEM_IntReal ); @@ -77839,6 +78714,7 @@ SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ ** Delete any previous value and set the value to be a BLOB of length ** n containing all zeros. */ +#ifndef SQLITE_OMIT_INCRBLOB SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ sqlite3VdbeMemRelease(pMem); pMem->flags = MEM_Blob|MEM_Zero; @@ -77848,6 +78724,21 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ pMem->enc = SQLITE_UTF8; pMem->z = 0; } +#else +SQLITE_PRIVATE int sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ + int nByte = n>0?n:1; + if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){ + return SQLITE_NOMEM_BKPT; + } + assert( pMem->z!=0 ); + assert( sqlite3DbMallocSize(pMem->db, pMem->z)>=nByte ); + memset(pMem->z, 0, nByte); + pMem->n = n>0?n:0; + pMem->flags = MEM_Blob; + pMem->enc = SQLITE_UTF8; + return SQLITE_OK; +} +#endif /* ** The pMem is known to contain content that needs to be destroyed prior @@ -77887,6 +78778,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetPointer( void (*xDestructor)(void*) ){ assert( pMem->flags==MEM_Null ); + vdbeMemClear(pMem); pMem->u.zPType = zPType ? zPType : ""; pMem->z = pPtr; pMem->flags = MEM_Null|MEM_Dyn|MEM_Subtype|MEM_Term; @@ -78081,6 +78973,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr( int iLimit; /* Maximum allowed string or blob size */ u16 flags = 0; /* New value for pMem->flags */ + assert( pMem!=0 ); assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( !sqlite3VdbeMemIsRowSet(pMem) ); @@ -78389,7 +79282,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ #ifdef SQLITE_ENABLE_STAT4 static int valueFromFunction( sqlite3 *db, /* The database connection */ - Expr *p, /* The expression to evaluate */ + const Expr *p, /* The expression to evaluate */ u8 enc, /* Encoding to use */ u8 aff, /* Affinity to use */ sqlite3_value **ppVal, /* Write the new value here */ @@ -78406,8 +79299,10 @@ static int valueFromFunction( assert( pCtx!=0 ); assert( (p->flags & EP_TokenOnly)==0 ); + assert( ExprUseXList(p) ); pList = p->x.pList; if( pList ) nVal = pList->nExpr; + assert( !ExprHasProperty(p, EP_IntValue) ); pFunc = sqlite3FindFunction(db, p->u.zToken, nVal, enc, 0); assert( pFunc ); if( (pFunc->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_SLOCHNG))==0 @@ -78483,7 +79378,7 @@ static int valueFromFunction( */ static int valueFromExpr( sqlite3 *db, /* The database connection */ - Expr *pExpr, /* The expression to evaluate */ + const Expr *pExpr, /* The expression to evaluate */ u8 enc, /* Encoding to use */ u8 affinity, /* Affinity to use */ sqlite3_value **ppVal, /* Write the new value here */ @@ -78498,11 +79393,7 @@ static int valueFromExpr( assert( pExpr!=0 ); while( (op = pExpr->op)==TK_UPLUS || op==TK_SPAN ) pExpr = pExpr->pLeft; -#if defined(SQLITE_ENABLE_STAT4) if( op==TK_REGISTER ) op = pExpr->op2; -#else - if( NEVER(op==TK_REGISTER) ) op = pExpr->op2; -#endif /* Compressed expressions only appear when parsing the DEFAULT clause ** on a table column definition, and hence only when pCtx==0. This @@ -78511,7 +79402,9 @@ static int valueFromExpr( assert( (pExpr->flags & EP_TokenOnly)==0 || pCtx==0 ); if( op==TK_CAST ){ - u8 aff = sqlite3AffinityType(pExpr->u.zToken,0); + u8 aff; + assert( !ExprHasProperty(pExpr, EP_IntValue) ); + aff = sqlite3AffinityType(pExpr->u.zToken,0); rc = valueFromExpr(db, pExpr->pLeft, enc, aff, ppVal, pCtx); testcase( rc!=SQLITE_OK ); if( *ppVal ){ @@ -78584,6 +79477,7 @@ static int valueFromExpr( #ifndef SQLITE_OMIT_BLOB_LITERAL else if( op==TK_BLOB ){ int nVal; + assert( !ExprHasProperty(pExpr, EP_IntValue) ); assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' ); assert( pExpr->u.zToken[1]=='\'' ); pVal = valueNew(db, pCtx); @@ -78601,6 +79495,7 @@ static int valueFromExpr( } #endif else if( op==TK_TRUEFALSE ){ + assert( !ExprHasProperty(pExpr, EP_IntValue) ); pVal = valueNew(db, pCtx); if( pVal ){ pVal->flags = MEM_Int; @@ -78613,7 +79508,7 @@ static int valueFromExpr( no_mem: #ifdef SQLITE_ENABLE_STAT4 - if( pCtx==0 || pCtx->pParse->nErr==0 ) + if( pCtx==0 || NEVER(pCtx->pParse->nErr==0) ) #endif sqlite3OomFault(db); sqlite3DbFree(db, zVal); @@ -78638,7 +79533,7 @@ no_mem: */ SQLITE_PRIVATE int sqlite3ValueFromExpr( sqlite3 *db, /* The database connection */ - Expr *pExpr, /* The expression to evaluate */ + const Expr *pExpr, /* The expression to evaluate */ u8 enc, /* Encoding to use */ u8 affinity, /* Affinity to use */ sqlite3_value **ppVal /* Write the new value here */ @@ -79154,8 +80049,10 @@ SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){ if( p->nOpAlloc<=i ){ return growOp3(p, op, p1, p2, p3); } + assert( p->aOp!=0 ); p->nOp++; pOp = &p->aOp[i]; + assert( pOp!=0 ); pOp->opcode = (u8)op; pOp->p5 = 0; pOp->p1 = p1; @@ -80289,8 +81186,7 @@ SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){ */ static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){ assert( p->nOp>0 || p->aOp==0 ); - assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed - || p->pParse->nErr>0 ); + assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->pParse->nErr>0 ); if( p->nOp ){ assert( p->aOp ); sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment); @@ -80398,7 +81294,7 @@ SQLITE_PRIVATE char *sqlite3VdbeDisplayComment( if( zOpName[nOpName+1] ){ int seenCom = 0; char c; - zSynopsis = zOpName += nOpName + 1; + zSynopsis = zOpName + nOpName + 1; if( strncmp(zSynopsis,"IF ",3)==0 ){ sqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3); zSynopsis = zAlt; @@ -80471,6 +81367,7 @@ static void displayP4Expr(StrAccum *p, Expr *pExpr){ const char *zOp = 0; switch( pExpr->op ){ case TK_STRING: + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3_str_appendf(p, "%Q", pExpr->u.zToken); break; case TK_INTEGER: @@ -80573,7 +81470,7 @@ SQLITE_PRIVATE char *sqlite3VdbeDisplayP4(sqlite3 *db, Op *pOp){ case P4_COLLSEQ: { static const char *const encnames[] = {"?", "8", "16LE", "16BE"}; CollSeq *pColl = pOp->p4.pColl; - assert( pColl->enc>=0 && pColl->enc<4 ); + assert( pColl->enc<4 ); sqlite3_str_appendf(&x, "%.18s-%s", pColl->zName, encnames[pColl->enc]); break; @@ -80817,8 +81714,8 @@ static void releaseMemArray(Mem *p, int N){ */ testcase( p->flags & MEM_Agg ); testcase( p->flags & MEM_Dyn ); - testcase( p->xDel==sqlite3VdbeFrameMemDel ); if( p->flags&(MEM_Agg|MEM_Dyn) ){ + testcase( (p->flags & MEM_Dyn)!=0 && p->xDel==sqlite3VdbeFrameMemDel ); sqlite3VdbeMemRelease(p); }else if( p->szMalloc ){ sqlite3DbFreeNN(db, p->zMalloc); @@ -81380,8 +82277,6 @@ SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ if( pCx==0 ){ return; } - assert( pCx->pBtx==0 || pCx->eCurType==CURTYPE_BTREE ); - assert( pCx->pBtx==0 || pCx->isEphemeral ); switch( pCx->eCurType ){ case CURTYPE_SORTER: { sqlite3VdbeSorterClose(p->db, pCx); @@ -81918,9 +82813,9 @@ SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){ ** has made changes and is in autocommit mode, then commit those ** changes. If a rollback is needed, then do the rollback. ** -** This routine is the only way to move the state of a VM from -** SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT. It is harmless to -** call this on a VM that is in the SQLITE_MAGIC_HALT state. +** This routine is the only way to move the sqlite3eOpenState of a VM from +** SQLITE_STATE_RUN to SQLITE_STATE_HALT. It is harmless to +** call this on a VM that is in the SQLITE_STATE_HALT state. ** ** Return an error code. If the commit could not complete because of ** lock contention, return SQLITE_BUSY. If SQLITE_BUSY is returned, it @@ -81966,9 +82861,15 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ sqlite3VdbeEnter(p); /* Check for one of the special errors */ - mrc = p->rc & 0xff; - isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR - || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL; + if( p->rc ){ + mrc = p->rc & 0xff; + isSpecialError = mrc==SQLITE_NOMEM + || mrc==SQLITE_IOERR + || mrc==SQLITE_INTERRUPT + || mrc==SQLITE_FULL; + }else{ + mrc = isSpecialError = 0; + } if( isSpecialError ){ /* If the query was read-only and the error code is SQLITE_INTERRUPT, ** no rollback is necessary. Otherwise, at least a savepoint @@ -82020,6 +82921,9 @@ SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ return SQLITE_ERROR; } rc = SQLITE_CONSTRAINT_FOREIGNKEY; + }else if( db->flags & SQLITE_CorruptRdOnly ){ + rc = SQLITE_CORRUPT; + db->flags &= ~SQLITE_CorruptRdOnly; }else{ /* The auto-commit flag is true, the vdbe program was successful ** or hit an 'OR FAIL' constraint and there are no deferred foreign @@ -82153,6 +83057,7 @@ SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){ sqlite3ValueSetNull(db->pErr); } db->errCode = rc; + db->errByteOffset = -1; return rc; } @@ -82414,7 +83319,7 @@ SQLITE_PRIVATE int SQLITE_NOINLINE sqlite3VdbeFinishMoveto(VdbeCursor *p){ assert( p->deferredMoveto ); assert( p->isTable ); assert( p->eCurType==CURTYPE_BTREE ); - rc = sqlite3BtreeMovetoUnpacked(p->uc.pCursor, 0, p->movetoTarget, 0, &res); + rc = sqlite3BtreeTableMoveto(p->uc.pCursor, p->movetoTarget, 0, &res); if( rc ) return rc; if( res!=0 ) return SQLITE_CORRUPT_BKPT; #ifdef SQLITE_TEST @@ -82474,7 +83379,7 @@ SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, u32 *piCol){ if( p->deferredMoveto ){ u32 iMap; assert( !p->isEphemeral ); - if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){ + if( p->ub.aAltMap && (iMap = p->ub.aAltMap[1+*piCol])>0 && !p->nullRow ){ *pp = p->pAltCursor; *piCol = iMap - 1; return SQLITE_OK; @@ -82752,14 +83657,14 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){ /* ** Deserialize the data blob pointed to by buf as serial type serial_type -** and store the result in pMem. Return the number of bytes read. +** and store the result in pMem. ** ** This function is implemented as two separate routines for performance. ** The few cases that require local variables are broken out into a separate ** routine so that in most cases the overhead of moving the stack pointer ** is avoided. */ -static u32 serialGet( +static void serialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ Mem *pMem /* Memory cell to write value into */ @@ -82793,9 +83698,8 @@ static u32 serialGet( memcpy(&pMem->u.r, &x, sizeof(x)); pMem->flags = IsNaN(x) ? MEM_Null : MEM_Real; } - return 8; } -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( +SQLITE_PRIVATE void sqlite3VdbeSerialGet( const unsigned char *buf, /* Buffer to deserialize from */ u32 serial_type, /* Serial type to deserialize */ Mem *pMem /* Memory cell to write value into */ @@ -82806,13 +83710,13 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( pMem->flags = MEM_Null|MEM_Zero; pMem->n = 0; pMem->u.nZero = 0; - break; + return; } case 11: /* Reserved for future use */ case 0: { /* Null */ /* EVIDENCE-OF: R-24078-09375 Value is a NULL. */ pMem->flags = MEM_Null; - break; + return; } case 1: { /* EVIDENCE-OF: R-44885-25196 Value is an 8-bit twos-complement @@ -82820,7 +83724,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( pMem->u.i = ONE_BYTE_INT(buf); pMem->flags = MEM_Int; testcase( pMem->u.i<0 ); - return 1; + return; } case 2: { /* 2-byte signed integer */ /* EVIDENCE-OF: R-49794-35026 Value is a big-endian 16-bit @@ -82828,7 +83732,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( pMem->u.i = TWO_BYTE_INT(buf); pMem->flags = MEM_Int; testcase( pMem->u.i<0 ); - return 2; + return; } case 3: { /* 3-byte signed integer */ /* EVIDENCE-OF: R-37839-54301 Value is a big-endian 24-bit @@ -82836,7 +83740,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( pMem->u.i = THREE_BYTE_INT(buf); pMem->flags = MEM_Int; testcase( pMem->u.i<0 ); - return 3; + return; } case 4: { /* 4-byte signed integer */ /* EVIDENCE-OF: R-01849-26079 Value is a big-endian 32-bit @@ -82848,7 +83752,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( #endif pMem->flags = MEM_Int; testcase( pMem->u.i<0 ); - return 4; + return; } case 5: { /* 6-byte signed integer */ /* EVIDENCE-OF: R-50385-09674 Value is a big-endian 48-bit @@ -82856,13 +83760,14 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( pMem->u.i = FOUR_BYTE_UINT(buf+2) + (((i64)1)<<32)*TWO_BYTE_INT(buf); pMem->flags = MEM_Int; testcase( pMem->u.i<0 ); - return 6; + return; } case 6: /* 8-byte signed integer */ case 7: { /* IEEE floating point */ /* These use local variables, so do them in a separate routine ** to avoid having to move the frame pointer in the common case */ - return serialGet(buf,serial_type,pMem); + serialGet(buf,serial_type,pMem); + return; } case 8: /* Integer 0 */ case 9: { /* Integer 1 */ @@ -82870,7 +83775,7 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( /* EVIDENCE-OF: R-18143-12121 Value is the integer 1. */ pMem->u.i = serial_type-8; pMem->flags = MEM_Int; - return 0; + return; } default: { /* EVIDENCE-OF: R-14606-31564 Value is a BLOB that is (N-12)/2 bytes in @@ -82881,10 +83786,10 @@ SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( pMem->z = (char *)buf; pMem->n = (serial_type-12)/2; pMem->flags = aFlag[serial_type&1]; - return pMem->n; + return; } } - return 0; + return; } /* ** This routine is used to allocate sufficient space for an UnpackedRecord @@ -82947,7 +83852,8 @@ SQLITE_PRIVATE void sqlite3VdbeRecordUnpack( /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */ pMem->szMalloc = 0; pMem->z = 0; - d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem); + sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem); + d += sqlite3VdbeSerialTypeLen(serial_type); pMem++; if( (++u)>=p->nField ) break; } @@ -83031,7 +83937,8 @@ static int vdbeRecordCompareDebug( /* Extract the values to be compared. */ - d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1); + sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1); + d1 += sqlite3VdbeSerialTypeLen(serial_type1); /* Do the comparison */ @@ -83198,7 +84105,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem ** number. Return negative, zero, or positive if the first (i64) is less than, ** equal to, or greater than the second (double). */ -static int sqlite3IntFloatCompare(i64 i, double r){ +SQLITE_PRIVATE int sqlite3IntFloatCompare(i64 i, double r){ if( sizeof(LONGDOUBLE_TYPE)>8 ){ LONGDOUBLE_TYPE x = (LONGDOUBLE_TYPE)i; testcase( x0x7fffffff ); assert( m.n>=0 ); if( unlikely(szHdr<3 || szHdr>(unsigned)m.n) ){ @@ -83922,7 +84829,7 @@ SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare( ** This routine sets the value to be returned by subsequent calls to ** sqlite3_changes() on the database handle 'db'. */ -SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){ +SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *db, i64 nChange){ assert( sqlite3_mutex_held(db->mutex) ); db->nChange = nChange; db->nTotalChange += nChange; @@ -84124,6 +85031,8 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook( } } + assert( pCsr!=0 ); + assert( pCsr->eCurType==CURTYPE_BTREE ); assert( pCsr->nField==pTab->nCol || (pCsr->nField==pTab->nCol+1 && op==SQLITE_DELETE && iReg==-1) ); @@ -84523,8 +85432,8 @@ SQLITE_API void sqlite3_value_free(sqlite3_value *pOld){ ** the function result. ** ** The setStrOrError() function calls sqlite3VdbeMemSetStr() to store the -** result as a string or blob but if the string or blob is too large, it -** then sets the error code to SQLITE_TOOBIG +** result as a string or blob. Appropriate errors are set if the string/blob +** is too big or if an OOM occurs. ** ** The invokeValueDestructor(P,X) routine invokes destructor function X() ** on value P is not going to be used and need to be destroyed. @@ -84536,8 +85445,16 @@ static void setResultStrOrError( u8 enc, /* Encoding of z. 0 for BLOBs */ void (*xDel)(void*) /* Destructor function */ ){ - if( sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel)==SQLITE_TOOBIG ){ - sqlite3_result_error_toobig(pCtx); + int rc = sqlite3VdbeMemSetStr(pCtx->pOut, z, n, enc, xDel); + if( rc ){ + if( rc==SQLITE_TOOBIG ){ + sqlite3_result_error_toobig(pCtx); + }else{ + /* The only errors possible from sqlite3VdbeMemSetStr are + ** SQLITE_TOOBIG and SQLITE_NOMEM */ + assert( rc==SQLITE_NOMEM ); + sqlite3_result_error_nomem(pCtx); + } } } static int invokeValueDestructor( @@ -84694,8 +85611,12 @@ SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){ if( n>(u64)pOut->db->aLimit[SQLITE_LIMIT_LENGTH] ){ return SQLITE_TOOBIG; } +#ifndef SQLITE_OMIT_INCRBLOB sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n); return SQLITE_OK; +#else + return sqlite3VdbeMemSetZeroBlob(pCtx->pOut, (int)n); +#endif } SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){ pCtx->isError = errCode ? errCode : -1; @@ -84995,6 +85916,70 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context *p){ return sqlite3_value_nochange(p->pOut); } +/* +** Implementation of sqlite3_vtab_in_first() (if bNext==0) and +** sqlite3_vtab_in_next() (if bNext!=0). +*/ +static int valueFromValueList( + sqlite3_value *pVal, /* Pointer to the ValueList object */ + sqlite3_value **ppOut, /* Store the next value from the list here */ + int bNext /* 1 for _next(). 0 for _first() */ +){ + int rc; + ValueList *pRhs; + + *ppOut = 0; + if( pVal==0 ) return SQLITE_MISUSE; + pRhs = (ValueList*)sqlite3_value_pointer(pVal, "ValueList"); + if( pRhs==0 ) return SQLITE_MISUSE; + if( bNext ){ + rc = sqlite3BtreeNext(pRhs->pCsr, 0); + }else{ + int dummy = 0; + rc = sqlite3BtreeFirst(pRhs->pCsr, &dummy); + assert( rc==SQLITE_OK || sqlite3BtreeEof(pRhs->pCsr) ); + if( sqlite3BtreeEof(pRhs->pCsr) ) rc = SQLITE_DONE; + } + if( rc==SQLITE_OK ){ + u32 sz; /* Size of current row in bytes */ + Mem sMem; /* Raw content of current row */ + memset(&sMem, 0, sizeof(sMem)); + sz = sqlite3BtreePayloadSize(pRhs->pCsr); + rc = sqlite3VdbeMemFromBtreeZeroOffset(pRhs->pCsr,(int)sz,&sMem); + if( rc==SQLITE_OK ){ + u8 *zBuf = (u8*)sMem.z; + u32 iSerial; + sqlite3_value *pOut = pRhs->pOut; + int iOff = 1 + getVarint32(&zBuf[1], iSerial); + sqlite3VdbeSerialGet(&zBuf[iOff], iSerial, pOut); + pOut->enc = ENC(pOut->db); + if( (pOut->flags & MEM_Ephem)!=0 && sqlite3VdbeMemMakeWriteable(pOut) ){ + rc = SQLITE_NOMEM; + }else{ + *ppOut = pOut; + } + } + sqlite3VdbeMemRelease(&sMem); + } + return rc; +} + +/* +** Set the iterator value pVal to point to the first value in the set. +** Set (*ppOut) to point to this value before returning. +*/ +SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut){ + return valueFromValueList(pVal, ppOut, 0); +} + +/* +** Set the iterator value pVal to point to the next value in the set. +** Set (*ppOut) to point to this value before returning. +*/ +SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut){ + return valueFromValueList(pVal, ppOut, 1); +} + /* ** Return the current time for a statement. If the current time ** is requested more than once within the same run of a single prepared @@ -85679,7 +86664,10 @@ SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_valu break; } case SQLITE_FLOAT: { - rc = sqlite3_bind_double(pStmt, i, pValue->u.r); + assert( pValue->flags & (MEM_Real|MEM_IntReal) ); + rc = sqlite3_bind_double(pStmt, i, + (pValue->flags & MEM_Real) ? pValue->u.r : (double)pValue->u.i + ); break; } case SQLITE_BLOB: { @@ -85707,7 +86695,11 @@ SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){ Vdbe *p = (Vdbe *)pStmt; rc = vdbeUnbind(p, i); if( rc==SQLITE_OK ){ +#ifndef SQLITE_OMIT_INCRBLOB sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n); +#else + rc = sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n); +#endif sqlite3_mutex_leave(p->db->mutex); } return rc; @@ -85995,6 +86987,7 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa u32 nRec; u8 *aRec; + assert( p->pCsr->eCurType==CURTYPE_BTREE ); nRec = sqlite3BtreePayloadSize(p->pCsr->uc.pCursor); aRec = sqlite3DbMallocRaw(db, nRec); if( !aRec ) goto preupdate_old_out; @@ -86302,11 +87295,9 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql( #ifndef SQLITE_OMIT_UTF16 Mem utf8; /* Used to convert UTF16 into UTF8 for display */ #endif - char zBase[100]; /* Initial working space */ db = p->db; - sqlite3StrAccumInit(&out, 0, zBase, sizeof(zBase), - db->aLimit[SQLITE_LIMIT_LENGTH]); + sqlite3StrAccumInit(&out, 0, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]); if( db->nVdbeExec>1 ){ while( *zRawSql ){ const char *zStart = zRawSql; @@ -86656,7 +87647,6 @@ static VdbeCursor *allocateCursor( Vdbe *p, /* The virtual machine */ int iCur, /* Index of the new VdbeCursor */ int nField, /* Number of fields in the table or index */ - int iDb, /* Database the cursor belongs to, or -1 */ u8 eCurType /* Type of the new cursor */ ){ /* Find the memory cell that will be used to store the blob of memory @@ -86713,7 +87703,6 @@ static VdbeCursor *allocateCursor( p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->zMalloc; memset(pCx, 0, offsetof(VdbeCursor,pAltCursor)); pCx->eCurType = eCurType; - pCx->iDb = iDb; pCx->nField = nField; pCx->aOffset = &pCx->aType[nField]; if( eCurType==CURTYPE_BTREE ){ @@ -87039,96 +88028,7 @@ SQLITE_PRIVATE void sqlite3VdbeRegisterDump(Vdbe *v){ ** hwtime.h contains inline assembler code for implementing ** high-performance timing routines. */ -/************** Include hwtime.h in the middle of vdbe.c *********************/ -/************** Begin file hwtime.h ******************************************/ -/* -** 2008 May 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains inline asm code for retrieving "high-performance" -** counters for x86 and x86_64 class CPUs. -*/ -#ifndef SQLITE_HWTIME_H -#define SQLITE_HWTIME_H - -/* -** The following routine only works on pentium-class (or newer) processors. -** It uses the RDTSC opcode to read the cycle count value out of the -** processor and returns that value. This can be used for high-res -** profiling. -*/ -#if !defined(__STRICT_ANSI__) && \ - (defined(__GNUC__) || defined(_MSC_VER)) && \ - (defined(i386) || defined(__i386__) || defined(_M_IX86)) - - #if defined(__GNUC__) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned int lo, hi; - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (sqlite_uint64)hi << 32 | lo; - } - - #elif defined(_MSC_VER) - - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ - __asm { - rdtsc - ret ; return value at EDX:EAX - } - } - - #endif - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__x86_64__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long val; - __asm__ __volatile__ ("rdtsc" : "=A" (val)); - return val; - } - -#elif !defined(__STRICT_ANSI__) && (defined(__GNUC__) && defined(__ppc__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long long retval; - unsigned long junk; - __asm__ __volatile__ ("\n\ - 1: mftbu %1\n\ - mftb %L0\n\ - mftbu %0\n\ - cmpw %0,%1\n\ - bne 1b" - : "=r" (retval), "=r" (junk)); - return retval; - } - -#else - - /* - ** asm() is needed for hardware timing support. Without asm(), - ** disable the sqlite3Hwtime() routine. - ** - ** sqlite3Hwtime() is only used for some obscure debugging - ** and analysis configurations, not in any deliverable, so this - ** should not be a great loss. - */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } - -#endif - -#endif /* !defined(SQLITE_HWTIME_H) */ - -/************** End of hwtime.h **********************************************/ -/************** Continuing where we left off in vdbe.c ***********************/ +/* #include "hwtime.h" */ #endif @@ -87175,6 +88075,42 @@ static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){ } } +/* +** Compute a bloom filter hash using pOp->p4.i registers from aMem[] beginning +** with pOp->p3. Return the hash. +*/ +static u64 filterHash(const Mem *aMem, const Op *pOp){ + int i, mx; + u64 h = 0; + + assert( pOp->p4type==P4_INT32 ); + for(i=pOp->p3, mx=i+pOp->p4.i; iflags & (MEM_Int|MEM_IntReal) ){ + h += p->u.i; + }else if( p->flags & MEM_Real ){ + h += sqlite3VdbeIntValue(p); + }else if( p->flags & (MEM_Str|MEM_Blob) ){ + h += p->n; + if( p->flags & MEM_Zero ) h += p->u.nZero; + } + } + return h; +} + +/* +** Return the symbolic name for the data type of a pMem +*/ +static const char *vdbeMemTypeName(Mem *pMem){ + static const char *azTypes[] = { + /* SQLITE_INTEGER */ "INT", + /* SQLITE_FLOAT */ "REAL", + /* SQLITE_TEXT */ "TEXT", + /* SQLITE_BLOB */ "BLOB", + /* SQLITE_NULL */ "NULL" + }; + return azTypes[sqlite3_value_type(pMem)-1]; +} /* ** Execute as much of a VDBE program as we can. @@ -87457,6 +88393,8 @@ case OP_Gosub: { /* jump */ /* Most jump operations do a goto to this spot in order to update ** the pOp pointer. */ jump_to_p2: + assert( pOp->p2>0 ); /* There are never any jumps to instruction 0 */ + assert( pOp->p2nOp ); /* Jumps must be in range */ pOp = &aOp[pOp->p2 - 1]; break; } @@ -87816,12 +88754,18 @@ case OP_SoftNull: { ** Synopsis: r[P2]=P4 (len=P1) ** ** P4 points to a blob of data P1 bytes long. Store this -** blob in register P2. +** blob in register P2. If P4 is a NULL pointer, then construct +** a zero-filled blob that is P1 bytes long in P2. */ case OP_Blob: { /* out2 */ assert( pOp->p1 <= SQLITE_MAX_LENGTH ); pOut = out2Prerelease(p, pOp); - sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0); + if( pOp->p4.z==0 ){ + sqlite3VdbeMemSetZeroBlob(pOut, pOp->p1); + if( sqlite3VdbeMemExpandBlob(pOut) ) goto no_mem; + }else{ + sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0); + } pOut->enc = encoding; UPDATE_MAX_BLOBSIZE(pOut); break; @@ -87970,24 +88914,22 @@ case OP_IntCopy: { /* out2 */ break; } -/* Opcode: ChngCntRow P1 P2 * * * -** Synopsis: output=r[P1] +/* Opcode: FkCheck * * * * * ** -** Output value in register P1 as the chance count for a DML statement, -** due to the "PRAGMA count_changes=ON" setting. Or, if there was a -** foreign key error in the statement, trigger the error now. +** Halt with an SQLITE_CONSTRAINT error if there are any unresolved +** foreign key constraint violations. If there are no foreign key +** constraint violations, this is a no-op. ** -** This opcode is a variant of OP_ResultRow that checks the foreign key -** immediate constraint count and throws an error if the count is -** non-zero. The P2 opcode must be 1. +** FK constraint violations are also checked when the prepared statement +** exits. This opcode is used to raise foreign key constraint errors prior +** to returning results such as a row change count or the result of a +** RETURNING clause. */ -case OP_ChngCntRow: { - assert( pOp->p2==1 ); +case OP_FkCheck: { if( (rc = sqlite3VdbeCheckFk(p,0))!=SQLITE_OK ){ goto abort_due_to_error; } - /* Fall through to the next case, OP_ResultRow */ - /* no break */ deliberate_fall_through + break; } /* Opcode: ResultRow P1 P2 * * * @@ -88625,7 +89567,7 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ sqlite3VdbeMemStringify(pIn1, encoding, 1); testcase( (flags1&MEM_Dyn) != (pIn1->flags&MEM_Dyn) ); flags1 = (pIn1->flags & ~MEM_TypeMask) | (flags1 & MEM_TypeMask); - if( NEVER(pIn1==pIn3) ) flags3 = flags1 | MEM_Str; + if( pIn1==pIn3 ) flags3 = flags1 | MEM_Str; } if( (flags3 & MEM_Str)==0 && (flags3&(MEM_Int|MEM_Real|MEM_IntReal))!=0 ){ testcase( pIn3->flags & MEM_Int ); @@ -89006,6 +89948,22 @@ case OP_IsNull: { /* same as TK_ISNULL, jump, in1 */ break; } +/* Opcode: IsNullOrType P1 P2 P3 * * +** Synopsis: if typeof(r[P1]) IN (P3,5) goto P2 +** +** Jump to P2 if the value in register P1 is NULL or has a datatype P3. +** P3 is an integer which should be one of SQLITE_INTEGER, SQLITE_FLOAT, +** SQLITE_BLOB, SQLITE_NULL, or SQLITE_TEXT. +*/ +case OP_IsNullOrType: { /* jump, in1 */ + int doTheJump; + pIn1 = &aMem[pOp->p1]; + doTheJump = (pIn1->flags & MEM_Null)!=0 || sqlite3_value_type(pIn1)==pOp->p3; + VdbeBranchTaken( doTheJump, 2); + if( doTheJump ) goto jump_to_p2; + break; +} + /* Opcode: ZeroOrNull P1 P2 P3 * * ** Synopsis: r[P2] = 0 OR NULL ** @@ -89077,10 +90035,18 @@ case OP_Offset: { /* out3 */ assert( pOp->p1>=0 && pOp->p1nCursor ); pC = p->apCsr[pOp->p1]; pOut = &p->aMem[pOp->p3]; - if( NEVER(pC==0) || pC->eCurType!=CURTYPE_BTREE ){ + if( pC==0 || pC->eCurType!=CURTYPE_BTREE ){ sqlite3VdbeMemSetNull(pOut); }else{ - sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor)); + if( pC->deferredMoveto ){ + rc = sqlite3VdbeFinishMoveto(pC); + if( rc ) goto abort_due_to_error; + } + if( sqlite3BtreeEof(pC->uc.pCursor) ){ + sqlite3VdbeMemSetNull(pOut); + }else{ + sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor)); + } } break; } @@ -89139,6 +90105,7 @@ case OP_Column: { assert( pC!=0 ); assert( p2<(u32)pC->nField ); aOffset = pC->aOffset; + assert( aOffset==pC->aType+pC->nField ); assert( pC->eCurType!=CURTYPE_VTAB ); assert( pC->eCurType!=CURTYPE_PSEUDO || pC->nullRow ); assert( pC->eCurType!=CURTYPE_SORTER ); @@ -89374,6 +90341,110 @@ op_column_corrupt: } } +/* Opcode: TypeCheck P1 P2 P3 P4 * +** Synopsis: typecheck(r[P1@P2]) +** +** Apply affinities to the range of P2 registers beginning with P1. +** Take the affinities from the Table object in P4. If any value +** cannot be coerced into the correct type, then raise an error. +** +** This opcode is similar to OP_Affinity except that this opcode +** forces the register type to the Table column type. This is used +** to implement "strict affinity". +** +** GENERATED ALWAYS AS ... STATIC columns are only checked if P3 +** is zero. When P3 is non-zero, no type checking occurs for +** static generated columns. Virtual columns are computed at query time +** and so they are never checked. +** +** Preconditions: +** +**
    +**
  • P2 should be the number of non-virtual columns in the +** table of P4. +**
  • Table P4 should be a STRICT table. +**
+** +** If any precondition is false, an assertion fault occurs. +*/ +case OP_TypeCheck: { + Table *pTab; + Column *aCol; + int i; + + assert( pOp->p4type==P4_TABLE ); + pTab = pOp->p4.pTab; + assert( pTab->tabFlags & TF_Strict ); + assert( pTab->nNVCol==pOp->p2 ); + aCol = pTab->aCol; + pIn1 = &aMem[pOp->p1]; + for(i=0; inCol; i++){ + if( aCol[i].colFlags & COLFLAG_GENERATED ){ + if( aCol[i].colFlags & COLFLAG_VIRTUAL ) continue; + if( pOp->p3 ){ pIn1++; continue; } + } + assert( pIn1 < &aMem[pOp->p1+pOp->p2] ); + applyAffinity(pIn1, aCol[i].affinity, encoding); + if( (pIn1->flags & MEM_Null)==0 ){ + switch( aCol[i].eCType ){ + case COLTYPE_BLOB: { + if( (pIn1->flags & MEM_Blob)==0 ) goto vdbe_type_error; + break; + } + case COLTYPE_INTEGER: + case COLTYPE_INT: { + if( (pIn1->flags & MEM_Int)==0 ) goto vdbe_type_error; + break; + } + case COLTYPE_TEXT: { + if( (pIn1->flags & MEM_Str)==0 ) goto vdbe_type_error; + break; + } + case COLTYPE_REAL: { + testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_Real ); + testcase( (pIn1->flags & (MEM_Real|MEM_IntReal))==MEM_IntReal ); + if( pIn1->flags & MEM_Int ){ + /* When applying REAL affinity, if the result is still an MEM_Int + ** that will fit in 6 bytes, then change the type to MEM_IntReal + ** so that we keep the high-resolution integer value but know that + ** the type really wants to be REAL. */ + testcase( pIn1->u.i==140737488355328LL ); + testcase( pIn1->u.i==140737488355327LL ); + testcase( pIn1->u.i==-140737488355328LL ); + testcase( pIn1->u.i==-140737488355329LL ); + if( pIn1->u.i<=140737488355327LL && pIn1->u.i>=-140737488355328LL){ + pIn1->flags |= MEM_IntReal; + pIn1->flags &= ~MEM_Int; + }else{ + pIn1->u.r = (double)pIn1->u.i; + pIn1->flags |= MEM_Real; + pIn1->flags &= ~MEM_Int; + } + }else if( (pIn1->flags & (MEM_Real|MEM_IntReal))==0 ){ + goto vdbe_type_error; + } + break; + } + default: { + /* COLTYPE_ANY. Accept anything. */ + break; + } + } + } + REGISTER_TRACE((int)(pIn1-aMem), pIn1); + pIn1++; + } + assert( pIn1 == &aMem[pOp->p1+pOp->p2] ); + break; + +vdbe_type_error: + sqlite3VdbeError(p, "cannot store %s value in %s column %s.%s", + vdbeMemTypeName(pIn1), sqlite3StdType[aCol[i].eCType-1], + pTab->zName, aCol[i].zCnName); + rc = SQLITE_CONSTRAINT_DATATYPE; + goto abort_due_to_error; +} + /* Opcode: Affinity P1 P2 * P4 * ** Synopsis: affinity(r[P1@P2]) ** @@ -89588,7 +90659,7 @@ case OP_MakeRecord: { testcase( uu==127 ); testcase( uu==128 ); testcase( uu==32767 ); testcase( uu==32768 ); testcase( uu==8388607 ); testcase( uu==8388608 ); - testcase( uu==2147483647 ); testcase( uu==2147483648 ); + testcase( uu==2147483647 ); testcase( uu==2147483648LL ); testcase( uu==140737488355327LL ); testcase( uu==140737488355328LL ); if( uu<=127 ){ if( (i&1)==i && file_format>=4 ){ @@ -89716,7 +90787,7 @@ case OP_MakeRecord: { break; } -/* Opcode: Count P1 P2 p3 * * +/* Opcode: Count P1 P2 P3 * * ** Synopsis: r[P2]=count() ** ** Store the number of entries (an integer value) in the table or index @@ -90037,8 +91108,16 @@ case OP_Transaction: { assert( pOp->p2>=0 && pOp->p2<=2 ); assert( pOp->p1>=0 && pOp->p1nDb ); assert( DbMaskTest(p->btreeMask, pOp->p1) ); - if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){ - rc = SQLITE_READONLY; + assert( rc==SQLITE_OK ); + if( pOp->p2 && (db->flags & (SQLITE_QueryOnly|SQLITE_CorruptRdOnly))!=0 ){ + if( db->flags & SQLITE_QueryOnly ){ + /* Writes prohibited by the "PRAGMA query_only=TRUE" statement */ + rc = SQLITE_READONLY; + }else{ + /* Writes prohibited due to a prior SQLITE_CORRUPT in the current + ** transaction */ + rc = SQLITE_CORRUPT; + } goto abort_due_to_error; } pBt = db->aDb[pOp->p1].pBt; @@ -90080,7 +91159,8 @@ case OP_Transaction: { } } assert( pOp->p5==0 || pOp->p4type==P4_INT32 ); - if( pOp->p5 + if( rc==SQLITE_OK + && pOp->p5 && (iMeta!=pOp->p3 || db->aDb[pOp->p1].pSchema->iGeneration!=pOp->p4.i) ){ @@ -90177,6 +91257,7 @@ case OP_SetCookie: { /* When the schema cookie changes, record the new cookie internally */ pDb->pSchema->schema_cookie = pOp->p3 - pOp->p5; db->mDbFlags |= DBFLAG_SchemaChange; + sqlite3FkClearTriggerCache(db, pOp->p1); }else if( pOp->p2==BTREE_FILE_FORMAT ){ /* Record changes in the file format */ pDb->pSchema->file_format = pOp->p3; @@ -90290,6 +91371,8 @@ case OP_ReopenIdx: { pCur = p->apCsr[pOp->p1]; if( pCur && pCur->pgnoRoot==(u32)pOp->p2 ){ assert( pCur->iDb==pOp->p3 ); /* Guaranteed by the code generator */ + assert( pCur->eCurType==CURTYPE_BTREE ); + sqlite3BtreeClearCursor(pCur->uc.pCursor); goto open_cursor_set_hints; } /* If the cursor is not currently open or is open on a different @@ -90352,8 +91435,9 @@ case OP_OpenWrite: assert( pOp->p1>=0 ); assert( nField>=0 ); testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */ - pCur = allocateCursor(p, pOp->p1, nField, iDb, CURTYPE_BTREE); + pCur = allocateCursor(p, pOp->p1, nField, CURTYPE_BTREE); if( pCur==0 ) goto no_mem; + pCur->iDb = iDb; pCur->nullRow = 1; pCur->isOrdered = 1; pCur->pgnoRoot = p2; @@ -90395,7 +91479,7 @@ case OP_OpenDup: { assert( pOrig ); assert( pOrig->isEphemeral ); /* Only ephemeral cursors can be duplicated */ - pCx = allocateCursor(p, pOp->p1, pOrig->nField, -1, CURTYPE_BTREE); + pCx = allocateCursor(p, pOp->p1, pOrig->nField, CURTYPE_BTREE); if( pCx==0 ) goto no_mem; pCx->nullRow = 1; pCx->isEphemeral = 1; @@ -90403,10 +91487,10 @@ case OP_OpenDup: { pCx->isTable = pOrig->isTable; pCx->pgnoRoot = pOrig->pgnoRoot; pCx->isOrdered = pOrig->isOrdered; - pCx->pBtx = pOrig->pBtx; + pCx->ub.pBtx = pOrig->ub.pBtx; pCx->hasBeenDuped = 1; pOrig->hasBeenDuped = 1; - rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR, + rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR, pCx->pKeyInfo, pCx->uc.pCursor); /* The sqlite3BtreeCursor() routine can only fail for the first cursor ** opened for a database. Since there is already an open cursor when this @@ -90472,23 +91556,23 @@ case OP_OpenEphemeral: { aMem[pOp->p3].z = ""; } pCx = p->apCsr[pOp->p1]; - if( pCx && !pCx->hasBeenDuped ){ + if( pCx && !pCx->hasBeenDuped && ALWAYS(pOp->p2<=pCx->nField) ){ /* If the ephermeral table is already open and has no duplicates from ** OP_OpenDup, then erase all existing content so that the table is ** empty again, rather than creating a new table. */ assert( pCx->isEphemeral ); pCx->seqCount = 0; pCx->cacheStatus = CACHE_STALE; - rc = sqlite3BtreeClearTable(pCx->pBtx, pCx->pgnoRoot, 0); + rc = sqlite3BtreeClearTable(pCx->ub.pBtx, pCx->pgnoRoot, 0); }else{ - pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_BTREE); + pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_BTREE); if( pCx==0 ) goto no_mem; pCx->isEphemeral = 1; - rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBtx, + rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->ub.pBtx, BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, vfsFlags); if( rc==SQLITE_OK ){ - rc = sqlite3BtreeBeginTrans(pCx->pBtx, 1, 0); + rc = sqlite3BtreeBeginTrans(pCx->ub.pBtx, 1, 0); if( rc==SQLITE_OK ){ /* If a transient index is required, create it by calling ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before @@ -90497,26 +91581,26 @@ case OP_OpenEphemeral: { */ if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){ assert( pOp->p4type==P4_KEYINFO ); - rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot, + rc = sqlite3BtreeCreateTable(pCx->ub.pBtx, &pCx->pgnoRoot, BTREE_BLOBKEY | pOp->p5); if( rc==SQLITE_OK ){ assert( pCx->pgnoRoot==SCHEMA_ROOT+1 ); assert( pKeyInfo->db==db ); assert( pKeyInfo->enc==ENC(db) ); - rc = sqlite3BtreeCursor(pCx->pBtx, pCx->pgnoRoot, BTREE_WRCSR, + rc = sqlite3BtreeCursor(pCx->ub.pBtx, pCx->pgnoRoot, BTREE_WRCSR, pKeyInfo, pCx->uc.pCursor); } pCx->isTable = 0; }else{ pCx->pgnoRoot = SCHEMA_ROOT; - rc = sqlite3BtreeCursor(pCx->pBtx, SCHEMA_ROOT, BTREE_WRCSR, + rc = sqlite3BtreeCursor(pCx->ub.pBtx, SCHEMA_ROOT, BTREE_WRCSR, 0, pCx->uc.pCursor); pCx->isTable = 1; } } pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED); if( rc ){ - sqlite3BtreeClose(pCx->pBtx); + sqlite3BtreeClose(pCx->ub.pBtx); } } } @@ -90540,7 +91624,7 @@ case OP_SorterOpen: { assert( pOp->p1>=0 ); assert( pOp->p2>=0 ); - pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, CURTYPE_SORTER); + pCx = allocateCursor(p, pOp->p1, pOp->p2, CURTYPE_SORTER); if( pCx==0 ) goto no_mem; pCx->pKeyInfo = pOp->p4.pKeyInfo; assert( pCx->pKeyInfo->db==db ); @@ -90589,7 +91673,7 @@ case OP_OpenPseudo: { assert( pOp->p1>=0 ); assert( pOp->p3>=0 ); - pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO); + pCx = allocateCursor(p, pOp->p1, pOp->p3, CURTYPE_PSEUDO); if( pCx==0 ) goto no_mem; pCx->nullRow = 1; pCx->seekResult = pOp->p2; @@ -90777,6 +91861,7 @@ case OP_SeekGT: { /* jump, in3, group */ /* If the P3 value could not be converted into an integer without ** loss of information, then special processing is required... */ if( (newType & (MEM_Int|MEM_IntReal))==0 ){ + int c; if( (newType & MEM_Real)==0 ){ if( (newType & MEM_Null) || oc>=OP_SeekGE ){ VdbeBranchTaken(1,2); @@ -90786,7 +91871,8 @@ case OP_SeekGT: { /* jump, in3, group */ if( rc!=SQLITE_OK ) goto abort_due_to_error; goto seek_not_found; } - }else + } + c = sqlite3IntFloatCompare(iKey, pIn3->u.r); /* If the approximation iKey is larger than the actual real search ** term, substitute >= for > and < for <=. e.g. if the search term @@ -90795,7 +91881,7 @@ case OP_SeekGT: { /* jump, in3, group */ ** (x > 4.9) -> (x >= 5) ** (x <= 4.9) -> (x < 5) */ - if( pIn3->u.r<(double)iKey ){ + if( c>0 ){ assert( OP_SeekGE==(OP_SeekGT-1) ); assert( OP_SeekLT==(OP_SeekLE-1) ); assert( (OP_SeekLE & 0x0001)==(OP_SeekGT & 0x0001) ); @@ -90804,14 +91890,14 @@ case OP_SeekGT: { /* jump, in3, group */ /* If the approximation iKey is smaller than the actual real search ** term, substitute <= for < and > for >=. */ - else if( pIn3->u.r>(double)iKey ){ + else if( c<0 ){ assert( OP_SeekLE==(OP_SeekLT+1) ); assert( OP_SeekGT==(OP_SeekGE+1) ); assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) ); if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++; } } - rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)iKey, 0, &res); + rc = sqlite3BtreeTableMoveto(pC->uc.pCursor, (u64)iKey, 0, &res); pC->movetoTarget = iKey; /* Used by OP_Delete */ if( rc!=SQLITE_OK ){ goto abort_due_to_error; @@ -90858,7 +91944,7 @@ case OP_SeekGT: { /* jump, in3, group */ { int i; for(i=0; iuc.pCursor, &r, 0, 0, &res); + rc = sqlite3BtreeIndexMoveto(pC->uc.pCursor, &r, &res); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } @@ -91277,7 +92363,7 @@ case OP_Found: { /* jump, in3 */ } } } - rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, pIdxKey, 0, 0, &res); + rc = sqlite3BtreeIndexMoveto(pC->uc.pCursor, pIdxKey, &res); if( pFree ) sqlite3DbFreeNN(db, pFree); if( rc!=SQLITE_OK ){ goto abort_due_to_error; @@ -91386,7 +92472,7 @@ notExistsWithKey: pCrsr = pC->uc.pCursor; assert( pCrsr!=0 ); res = 0; - rc = sqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res); + rc = sqlite3BtreeTableMoveto(pCrsr, iKey, 0, &res); assert( rc==SQLITE_OK || res==0 ); pC->movetoTarget = iKey; /* Used by OP_Delete */ pC->nullRow = 0; @@ -91543,7 +92629,7 @@ case OP_NewRowid: { /* out2 */ do{ sqlite3_randomness(sizeof(v), &v); v &= (MAX_ROWID>>1); v++; /* Ensure that v is greater than zero */ - }while( ((rc = sqlite3BtreeMovetoUnpacked(pC->uc.pCursor, 0, (u64)v, + }while( ((rc = sqlite3BtreeTableMoveto(pC->uc.pCursor, (u64)v, 0, &res))==SQLITE_OK) && (res==0) && (++cnt<100)); @@ -91633,7 +92719,7 @@ case OP_Insert: { assert( (pOp->p5 & OPFLAG_ISNOOP) || HasRowid(pTab) ); }else{ pTab = 0; - zDb = 0; /* Not needed. Silence a compiler warning. */ + zDb = 0; } #ifdef SQLITE_ENABLE_PREUPDATE_HOOK @@ -91786,13 +92872,14 @@ case OP_Delete: { pC->movetoTarget = sqlite3BtreeIntegerKey(pC->uc.pCursor); } }else{ - zDb = 0; /* Not needed. Silence a compiler warning. */ - pTab = 0; /* Not needed. Silence a compiler warning. */ + zDb = 0; + pTab = 0; } #ifdef SQLITE_ENABLE_PREUPDATE_HOOK /* Invoke the pre-update-hook if required. */ - if( db->xPreUpdateCallback && pOp->p4.pTab ){ + assert( db->xPreUpdateCallback==0 || pTab==pOp->p4.pTab ); + if( db->xPreUpdateCallback && pTab ){ assert( !(opflags & OPFLAG_ISUPDATE) || HasRowid(pTab)==0 || (aMem[pOp->p3].flags & MEM_Int) @@ -91833,7 +92920,7 @@ case OP_Delete: { /* Invoke the update-hook if required. */ if( opflags & OPFLAG_NCHANGE ){ p->nChange++; - if( db->xUpdateCallback && HasRowid(pTab) ){ + if( db->xUpdateCallback && ALWAYS(pTab!=0) && HasRowid(pTab) ){ db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, zDb, pTab->zName, pC->movetoTarget); assert( pC->iDb>=0 ); @@ -92038,6 +93125,10 @@ case OP_Rowid: { /* out2 */ ** Move the cursor P1 to a null row. Any OP_Column operations ** that occur while the cursor is on the null row will always ** write a NULL. +** +** Or, if P1 is a Pseudo-Cursor (a cursor opened using OP_OpenPseudo) +** just reset the cache for that cursor. This causes the row of +** content held by the pseudo-cursor to be reparsed. */ case OP_NullRow: { VdbeCursor *pC; @@ -92420,7 +93511,8 @@ case OP_SorterInsert: { /* in2 */ ** an UPDATE or DELETE statement and the index entry to be updated ** or deleted is not found. For some uses of IdxDelete ** (example: the EXCEPT operator) it does not matter that no matching -** entry is found. For those cases, P5 is zero. +** entry is found. For those cases, P5 is zero. Also, do not raise +** this (self-correcting and non-critical) error if in writable_schema mode. */ case OP_IdxDelete: { VdbeCursor *pC; @@ -92441,12 +93533,12 @@ case OP_IdxDelete: { r.nField = (u16)pOp->p3; r.default_rc = 0; r.aMem = &aMem[pOp->p2]; - rc = sqlite3BtreeMovetoUnpacked(pCrsr, &r, 0, 0, &res); + rc = sqlite3BtreeIndexMoveto(pCrsr, &r, &res); if( rc ) goto abort_due_to_error; if( res==0 ){ rc = sqlite3BtreeDelete(pCrsr, BTREE_AUXDELETE); if( rc ) goto abort_due_to_error; - }else if( pOp->p5 ){ + }else if( pOp->p5 && !sqlite3WritableSchema(db) ){ rc = sqlite3ReportError(SQLITE_CORRUPT_INDEX, __LINE__, "index corruption"); goto abort_due_to_error; } @@ -92525,9 +93617,9 @@ case OP_IdxRowid: { /* out2 */ pTabCur->movetoTarget = rowid; pTabCur->deferredMoveto = 1; assert( pOp->p4type==P4_INTARRAY || pOp->p4.ai==0 ); - pTabCur->aAltMap = pOp->p4.ai; - assert( !pC->isEphemeral ); assert( !pTabCur->isEphemeral ); + pTabCur->ub.aAltMap = pOp->p4.ai; + assert( !pC->isEphemeral ); pTabCur->pAltCursor = pC; }else{ pOut = out2Prerelease(p, pOp); @@ -92754,7 +93846,7 @@ case OP_Destroy: { /* out2 */ ** See also: Destroy */ case OP_Clear: { - int nChange; + i64 nChange; sqlite3VdbeIncrWriteCounter(p, 0); nChange = 0; @@ -92880,7 +93972,7 @@ case OP_ParseSchema: { }else #endif { - zSchema = DFLT_SCHEMA_TABLE; + zSchema = LEGACY_SCHEMA_TABLE; initData.db = db; initData.iDb = iDb; initData.pzErrMsg = &p->zErrMsg; @@ -94049,7 +95141,7 @@ case OP_VOpen: { pVCur->pVtab = pVtab; /* Initialize vdbe cursor object */ - pCur = allocateCursor(p, pOp->p1, 0, -1, CURTYPE_VTAB); + pCur = allocateCursor(p, pOp->p1, 0, CURTYPE_VTAB); if( pCur ){ pCur->uc.pVCur = pVCur; pVtab->nRef++; @@ -94062,6 +95154,34 @@ case OP_VOpen: { } #endif /* SQLITE_OMIT_VIRTUALTABLE */ +#ifndef SQLITE_OMIT_VIRTUALTABLE +/* Opcode: VInitIn P1 P2 P3 * * +** Synopsis: r[P2]=ValueList(P1,P3) +** +** Set register P2 to be a pointer to a ValueList object for cursor P1 +** with cache register P3 and output register P3+1. This ValueList object +** can be used as the first argument to sqlite3_vtab_in_first() and +** sqlite3_vtab_in_next() to extract all of the values stored in the P1 +** cursor. Register P3 is used to hold the values returned by +** sqlite3_vtab_in_first() and sqlite3_vtab_in_next(). +*/ +case OP_VInitIn: { /* out2 */ + VdbeCursor *pC; /* The cursor containing the RHS values */ + ValueList *pRhs; /* New ValueList object to put in reg[P2] */ + + pC = p->apCsr[pOp->p1]; + pRhs = sqlite3_malloc64( sizeof(*pRhs) ); + if( pRhs==0 ) goto no_mem; + pRhs->pCsr = pC->uc.pCursor; + pRhs->pOut = &aMem[pOp->p3]; + pOut = out2Prerelease(p, pOp); + pOut->flags = MEM_Null; + sqlite3VdbeMemSetPointer(pOut, pRhs, "ValueList", sqlite3_free); + break; +} +#endif /* SQLITE_OMIT_VIRTUALTABLE */ + + #ifndef SQLITE_OMIT_VIRTUALTABLE /* Opcode: VFilter P1 P2 P3 P4 * ** Synopsis: iplan=r[P3] zplan='P4' @@ -94100,6 +95220,7 @@ case OP_VFilter: { /* jump */ pCur = p->apCsr[pOp->p1]; assert( memIsValid(pQuery) ); REGISTER_TRACE(pOp->p3, pQuery); + assert( pCur!=0 ); assert( pCur->eCurType==CURTYPE_VTAB ); pVCur = pCur->uc.pVCur; pVtab = pVCur->pVtab; @@ -94111,7 +95232,6 @@ case OP_VFilter: { /* jump */ iQuery = (int)pQuery->u.i; /* Invoke the xFilter method */ - res = 0; apArg = p->apArg; for(i = 0; iapCsr[pOp->p1]; + assert( pCur!=0 ); assert( pCur->eCurType==CURTYPE_VTAB ); assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); pDest = &aMem[pOp->p3]; @@ -94201,8 +95322,8 @@ case OP_VNext: { /* jump */ int res; VdbeCursor *pCur; - res = 0; pCur = p->apCsr[pOp->p1]; + assert( pCur!=0 ); assert( pCur->eCurType==CURTYPE_VTAB ); if( pCur->nullRow ){ break; @@ -94298,7 +95419,7 @@ case OP_VUpdate: { const sqlite3_module *pModule; int nArg; int i; - sqlite_int64 rowid; + sqlite_int64 rowid = 0; Mem **apArg; Mem *pX; @@ -94486,6 +95607,77 @@ case OP_Function: { /* group */ break; } +/* Opcode: FilterAdd P1 * P3 P4 * +** Synopsis: filter(P1) += key(P3@P4) +** +** Compute a hash on the P4 registers starting with r[P3] and +** add that hash to the bloom filter contained in r[P1]. +*/ +case OP_FilterAdd: { + u64 h; + + assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) ); + pIn1 = &aMem[pOp->p1]; + assert( pIn1->flags & MEM_Blob ); + assert( pIn1->n>0 ); + h = filterHash(aMem, pOp); +#ifdef SQLITE_DEBUG + if( db->flags&SQLITE_VdbeTrace ){ + int ii; + for(ii=pOp->p3; iip3+pOp->p4.i; ii++){ + registerTrace(ii, &aMem[ii]); + } + printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n)); + } +#endif + h %= pIn1->n; + pIn1->z[h/8] |= 1<<(h&7); + break; +} + +/* Opcode: Filter P1 P2 P3 P4 * +** Synopsis: if key(P3@P4) not in filter(P1) goto P2 +** +** Compute a hash on the key contained in the P4 registers starting +** with r[P3]. Check to see if that hash is found in the +** bloom filter hosted by register P1. If it is not present then +** maybe jump to P2. Otherwise fall through. +** +** False negatives are harmless. It is always safe to fall through, +** even if the value is in the bloom filter. A false negative causes +** more CPU cycles to be used, but it should still yield the correct +** answer. However, an incorrect answer may well arise from a +** false positive - if the jump is taken when it should fall through. +*/ +case OP_Filter: { /* jump */ + u64 h; + + assert( pOp->p1>0 && pOp->p1<=(p->nMem+1 - p->nCursor) ); + pIn1 = &aMem[pOp->p1]; + assert( (pIn1->flags & MEM_Blob)!=0 ); + assert( pIn1->n >= 1 ); + h = filterHash(aMem, pOp); +#ifdef SQLITE_DEBUG + if( db->flags&SQLITE_VdbeTrace ){ + int ii; + for(ii=pOp->p3; iip3+pOp->p4.i; ii++){ + registerTrace(ii, &aMem[ii]); + } + printf("hash: %llu modulo %d -> %u\n", h, pIn1->n, (int)(h%pIn1->n)); + } +#endif + h %= pIn1->n; + if( (pIn1->z[h/8] & (1<<(h&7)))==0 ){ + VdbeBranchTaken(1, 2); + p->aCounter[SQLITE_STMTSTATUS_FILTER_HIT]++; + goto jump_to_p2; + }else{ + p->aCounter[SQLITE_STMTSTATUS_FILTER_MISS]++; + VdbeBranchTaken(0, 2); + } + break; +} + /* Opcode: Trace P1 P2 * P4 * ** ** Write P4 on the statement trace output if statement tracing is @@ -94743,6 +95935,18 @@ abort_due_to_error: rc = SQLITE_CORRUPT_BKPT; } assert( rc ); +#ifdef SQLITE_DEBUG + if( db->flags & SQLITE_VdbeTrace ){ + const char *zTrace = p->zSql; + if( zTrace==0 ){ + if( aOp[0].opcode==OP_Trace ){ + zTrace = aOp[0].p4.z; + } + if( zTrace==0 ) zTrace = "???"; + } + printf("ABORT-due-to-error (rc=%d): %s\n", rc, zTrace); + } +#endif if( p->zErrMsg==0 && rc!=SQLITE_IOERR_NOMEM ){ sqlite3VdbeError(p, "%s", sqlite3ErrStr(rc)); } @@ -94753,6 +95957,9 @@ abort_due_to_error: (int)(pOp - aOp), p->zSql, p->zErrMsg); sqlite3VdbeHalt(p); if( rc==SQLITE_IOERR_NOMEM ) sqlite3OomFault(db); + if( rc==SQLITE_CORRUPT && db->autoCommit==0 ){ + db->flags |= SQLITE_CorruptRdOnly; + } rc = SQLITE_ERROR; if( resetSchemaOnFault>0 ){ sqlite3ResetOneSchema(db, resetSchemaOnFault-1); @@ -94884,7 +96091,10 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ } if( rc==SQLITE_ROW ){ VdbeCursor *pC = v->apCsr[0]; - u32 type = pC->nHdrParsed>p->iCol ? pC->aType[p->iCol] : 0; + u32 type; + assert( pC!=0 ); + assert( pC->eCurType==CURTYPE_BTREE ); + type = pC->nHdrParsed>p->iCol ? pC->aType[p->iCol] : 0; testcase( pC->nHdrParsed==p->iCol ); testcase( pC->nHdrParsed==p->iCol+1 ); if( type<12 ){ @@ -94958,10 +96168,9 @@ SQLITE_API int sqlite3_blob_open( sqlite3_mutex_enter(db->mutex); pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob)); - do { - memset(&sParse, 0, sizeof(Parse)); + while(1){ + sqlite3ParseObjectInit(&sParse,db); if( !pBlob ) goto blob_open_out; - sParse.db = db; sqlite3DbFree(db, zErr); zErr = 0; @@ -94976,7 +96185,7 @@ SQLITE_API int sqlite3_blob_open( sqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable); } #ifndef SQLITE_OMIT_VIEW - if( pTab && pTab->pSelect ){ + if( pTab && IsView(pTab) ){ pTab = 0; sqlite3ErrorMsg(&sParse, "cannot open view: %s", zTable); } @@ -94996,7 +96205,7 @@ SQLITE_API int sqlite3_blob_open( /* Now search pTab for the exact column. */ for(iCol=0; iColnCol; iCol++) { - if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){ + if( sqlite3StrICmp(pTab->aCol[iCol].zCnName, zColumn)==0 ){ break; } } @@ -95021,7 +96230,8 @@ SQLITE_API int sqlite3_blob_open( ** key columns must be indexed. The check below will pick up this ** case. */ FKey *pFKey; - for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ + assert( IsOrdinaryTable(pTab) ); + for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){ int j; for(j=0; jnCol; j++){ if( pFKey->aCol[j].iFrom==iCol ){ @@ -95137,7 +96347,9 @@ SQLITE_API int sqlite3_blob_open( goto blob_open_out; } rc = blobSeekToRow(pBlob, iRow, &zErr); - } while( (++nAttempt)=SQLITE_MAX_SCHEMA_RETRY || rc!=SQLITE_SCHEMA ) break; + sqlite3ParseObjectReset(&sParse); + } blob_open_out: if( rc==SQLITE_OK && db->mallocFailed==0 ){ @@ -95148,7 +96360,7 @@ blob_open_out: } sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr); sqlite3DbFree(db, zErr); - sqlite3ParserReset(&sParse); + sqlite3ParseObjectReset(&sParse); rc = sqlite3ApiExit(db, rc); sqlite3_mutex_leave(db->mutex); return rc; @@ -95228,6 +96440,8 @@ static int blobReadWrite( */ sqlite3_int64 iKey; iKey = sqlite3BtreeIntegerKey(p->pCsr); + assert( v->apCsr[0]!=0 ); + assert( v->apCsr[0]->eCurType==CURTYPE_BTREE ); sqlite3VdbePreUpdateHook( v, v->apCsr[0], SQLITE_DELETE, p->zDb, p->pTab, iKey, -1, p->iCol ); @@ -96281,7 +97495,8 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit( } #endif - assert( pCsr->pKeyInfo && pCsr->pBtx==0 ); + assert( pCsr->pKeyInfo ); + assert( !pCsr->isEphemeral ); assert( pCsr->eCurType==CURTYPE_SORTER ); szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*); sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask); @@ -96610,7 +97825,7 @@ static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nByte){ sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_CHUNK_SIZE, &chunksize); sqlite3OsFileControlHint(pFd, SQLITE_FCNTL_SIZE_HINT, &nByte); sqlite3OsFetch(pFd, 0, (int)nByte, &p); - sqlite3OsUnfetch(pFd, 0, p); + if( p ) sqlite3OsUnfetch(pFd, 0, p); } } #else @@ -97328,6 +98543,7 @@ static int vdbeIncrMergerNew( vdbeMergeEngineFree(pMerger); rc = SQLITE_NOMEM_BKPT; } + assert( *ppOut!=0 || rc!=SQLITE_OK ); return rc; } @@ -98693,6 +99909,9 @@ static int memjrnlCreateFile(MemJournal *p){ } +/* Forward reference */ +static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size); + /* ** Write data to the file. */ @@ -98723,22 +99942,20 @@ static int memjrnlWrite( ** the in-memory journal is being used by a connection using the ** atomic-write optimization. In this case the first 28 bytes of the ** journal file may be written as part of committing the transaction. */ - assert( iOfst==p->endpoint.iOffset || iOfst==0 ); -#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \ - || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE) + assert( iOfst<=p->endpoint.iOffset ); + if( iOfst>0 && iOfst!=p->endpoint.iOffset ){ + memjrnlTruncate(pJfd, iOfst); + } if( iOfst==0 && p->pFirst ){ assert( p->nChunkSize>iAmt ); memcpy((u8*)p->pFirst->zChunk, zBuf, iAmt); - }else -#else - assert( iOfst>0 || p->pFirst==0 ); -#endif - { + }else{ while( nWrite>0 ){ FileChunk *pChunk = p->endpoint.pChunk; int iChunkOffset = (int)(p->endpoint.iOffset%p->nChunkSize); int iSpace = MIN(nWrite, p->nChunkSize - iChunkOffset); + assert( pChunk!=0 || iChunkOffset==0 ); if( iChunkOffset==0 ){ /* New chunk is required to extend the file. */ FileChunk *pNew = sqlite3_malloc(fileChunkSize(p->nChunkSize)); @@ -98753,10 +99970,11 @@ static int memjrnlWrite( assert( !p->pFirst ); p->pFirst = pNew; } - p->endpoint.pChunk = pNew; + pChunk = p->endpoint.pChunk = pNew; } - memcpy((u8*)p->endpoint.pChunk->zChunk + iChunkOffset, zWrite, iSpace); + assert( pChunk!=0 ); + memcpy((u8*)pChunk->zChunk + iChunkOffset, zWrite, iSpace); zWrite += iSpace; nWrite -= iSpace; p->endpoint.iOffset += iSpace; @@ -98780,7 +99998,7 @@ static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ p->pFirst = 0; }else{ i64 iOff = p->nChunkSize; - for(pIter=p->pFirst; ALWAYS(pIter) && iOff<=size; pIter=pIter->pNext){ + for(pIter=p->pFirst; ALWAYS(pIter) && iOffpNext){ iOff += p->nChunkSize; } if( ALWAYS(pIter) ){ @@ -99029,7 +100247,7 @@ static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){ assert( !ExprHasProperty(pExpr, EP_WinFunc) ); pExpr = pExpr->pRight; continue; - }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + }else if( ExprUseXSelect(pExpr) ){ assert( !ExprHasProperty(pExpr, EP_WinFunc) ); if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort; }else{ @@ -99301,6 +100519,7 @@ static void resolveAlias( }else{ incrAggFunctionDepth(pDup, nSubquery); if( pExpr->op==TK_COLLATE ){ + assert( !ExprHasProperty(pExpr, EP_IntValue) ); pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken); } @@ -99404,6 +100623,7 @@ SQLITE_PRIVATE Bitmask sqlite3ExprColUsed(Expr *pExpr){ Table *pExTab; n = pExpr->iColumn; + assert( ExprUseYTab(pExpr) ); pExTab = pExpr->y.pTab; assert( pExTab!=0 ); if( (pExTab->tabFlags & TF_HasGenerated)!=0 @@ -99517,7 +100737,7 @@ static int lookupName( u8 hCol; pTab = pItem->pTab; assert( pTab!=0 && pTab->zName!=0 ); - assert( pTab->nCol>0 ); + assert( pTab->nCol>0 || pParse->nErr ); if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){ int hit = 0; pEList = pItem->pSelect->pEList; @@ -99532,8 +100752,9 @@ static int lookupName( } if( hit || zTab==0 ) continue; } - if( zDb && pTab->pSchema!=pSchema ){ - continue; + if( zDb ){ + if( pTab->pSchema!=pSchema ) continue; + if( pSchema==0 && strcmp(zDb,"*")!=0 ) continue; } if( zTab ){ const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; @@ -99541,16 +100762,16 @@ static int lookupName( if( sqlite3StrICmp(zTabName, zTab)!=0 ){ continue; } + assert( ExprUseYTab(pExpr) ); if( IN_RENAME_OBJECT && pItem->zAlias ){ sqlite3RenameTokenRemap(pParse, 0, (void*)&pExpr->y.pTab); } } - if( 0==(cntTab++) ){ - pMatch = pItem; - } hCol = sqlite3StrIHash(zCol); for(j=0, pCol=pTab->aCol; jnCol; j++, pCol++){ - if( pCol->hName==hCol && sqlite3StrICmp(pCol->zName, zCol)==0 ){ + if( pCol->hName==hCol + && sqlite3StrICmp(pCol->zCnName, zCol)==0 + ){ /* If there has been exactly one prior match and this match ** is for the right-hand table of a NATURAL JOIN or is in a ** USING clause, then skip this match. @@ -99566,9 +100787,14 @@ static int lookupName( break; } } + if( 0==cnt && VisibleRowid(pTab) ){ + cntTab++; + pMatch = pItem; + } } if( pMatch ){ pExpr->iTable = pMatch->iCursor; + assert( ExprUseYTab(pExpr) ); pExpr->y.pTab = pMatch->pTab; /* RIGHT JOIN not (yet) supported */ assert( (pMatch->fg.jointype & JT_RIGHT)==0 ); @@ -99623,7 +100849,9 @@ static int lookupName( pSchema = pTab->pSchema; cntTab++; for(iCol=0, pCol=pTab->aCol; iColnCol; iCol++, pCol++){ - if( pCol->hName==hCol && sqlite3StrICmp(pCol->zName, zCol)==0 ){ + if( pCol->hName==hCol + && sqlite3StrICmp(pCol->zCnName, zCol)==0 + ){ if( iCol==pTab->iPKey ){ iCol = -1; } @@ -99640,6 +100868,7 @@ static int lookupName( #ifndef SQLITE_OMIT_UPSERT if( pExpr->iTable==EXCLUDED_TABLE_NUMBER ){ testcase( iCol==(-1) ); + assert( ExprUseYTab(pExpr) ); if( IN_RENAME_OBJECT ){ pExpr->iColumn = iCol; pExpr->y.pTab = pTab; @@ -99652,9 +100881,11 @@ static int lookupName( }else #endif /* SQLITE_OMIT_UPSERT */ { + assert( ExprUseYTab(pExpr) ); pExpr->y.pTab = pTab; if( pParse->bReturning ){ eNewExprOp = TK_REGISTER; + pExpr->op2 = TK_COLUMN; pExpr->iTable = pNC->uNC.iBaseReg + (pTab->nCol+1)*pExpr->iTable + sqlite3TableColumnToStorage(pTab, iCol) + 1; }else{ @@ -99688,7 +100919,7 @@ static int lookupName( && pMatch && (pNC->ncFlags & (NC_IdxExpr|NC_GenCol))==0 && sqlite3IsRowid(zCol) - && VisibleRowid(pMatch->pTab) + && ALWAYS(VisibleRowid(pMatch->pTab)) ){ cnt = 1; pExpr->iColumn = -1; @@ -99726,8 +100957,8 @@ static int lookupName( ){ Expr *pOrig; assert( pExpr->pLeft==0 && pExpr->pRight==0 ); - assert( pExpr->x.pList==0 ); - assert( pExpr->x.pSelect==0 ); + assert( ExprUseXList(pExpr)==0 || pExpr->x.pList==0 ); + assert( ExprUseXSelect(pExpr)==0 || pExpr->x.pSelect==0 ); pOrig = pEList->a[j].pExpr; if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){ sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs); @@ -99799,7 +101030,7 @@ static int lookupName( sqlite3VdbeAddDblquoteStr(db, pParse->pVdbe, zCol); #endif pExpr->op = TK_STRING; - pExpr->y.pTab = 0; + memset(&pExpr->y, 0, sizeof(pExpr->y)); return WRC_Prune; } if( sqlite3ExprIdToTrueFalse(pExpr) ){ @@ -99821,6 +101052,7 @@ static int lookupName( }else{ sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); } + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); pParse->checkSchema = 1; pTopNC->nNcErr++; } @@ -99885,7 +101117,9 @@ SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSr Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0); if( p ){ SrcItem *pItem = &pSrc->a[iSrc]; - Table *pTab = p->y.pTab = pItem->pTab; + Table *pTab; + assert( ExprUseYTab(p) ); + pTab = p->y.pTab = pItem->pTab; p->iTable = pItem->iCursor; if( p->y.pTab->iPKey==iCol ){ p->iColumn = -1; @@ -99927,7 +101161,8 @@ static void notValidImpl( Parse *pParse, /* Leave error message here */ NameContext *pNC, /* The name context */ const char *zMsg, /* Type of error */ - Expr *pExpr /* Invalidate this expression on error */ + Expr *pExpr, /* Invalidate this expression on error */ + Expr *pError /* Associate error with this expression */ ){ const char *zIn = "partial index WHERE clauses"; if( pNC->ncFlags & NC_IdxExpr ) zIn = "index expressions"; @@ -99939,10 +101174,11 @@ static void notValidImpl( #endif sqlite3ErrorMsg(pParse, "%s prohibited in %s", zMsg, zIn); if( pExpr ) pExpr->op = TK_NULL; + sqlite3RecordErrorOffsetOfExpr(pParse->db, pError); } -#define sqlite3ResolveNotValid(P,N,M,X,E) \ +#define sqlite3ResolveNotValid(P,N,M,X,E,R) \ assert( ((X)&~(NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol))==0 ); \ - if( ((N)->ncFlags & (X))!=0 ) notValidImpl(P,N,M,E); + if( ((N)->ncFlags & (X))!=0 ) notValidImpl(P,N,M,E,R); /* ** Expression p should encode a floating point value between 1.0 and 0.0. @@ -99952,6 +101188,7 @@ static void notValidImpl( static int exprProbability(Expr *p){ double r = -1.0; if( p->op!=TK_FLOAT ) return -1; + assert( !ExprHasProperty(p, EP_IntValue) ); sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8); assert( r>=0.0 ); if( r>1.0 ) return -1; @@ -100000,6 +101237,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ assert( pSrcList && pSrcList->nSrc>=1 ); pItem = pSrcList->a; pExpr->op = TK_COLUMN; + assert( ExprUseYTab(pExpr) ); pExpr->y.pTab = pItem->pTab; pExpr->iTable = pItem->iCursor; pExpr->iColumn--; @@ -100031,6 +101269,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ } sqlite3WalkExpr(pWalker, pExpr->pLeft); if( 0==sqlite3ExprCanBeNull(pExpr->pLeft) && !IN_RENAME_OBJECT ){ + testcase( ExprHasProperty(pExpr, EP_FromJoin) ); + assert( !ExprHasProperty(pExpr, EP_IntValue) ); if( pExpr->op==TK_NOTNULL ){ pExpr->u.zToken = "true"; ExprSetProperty(pExpr, EP_IsTrue); @@ -100066,24 +101306,28 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ if( pExpr->op==TK_ID ){ zDb = 0; zTable = 0; + assert( !ExprHasProperty(pExpr, EP_IntValue) ); zColumn = pExpr->u.zToken; }else{ Expr *pLeft = pExpr->pLeft; testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); sqlite3ResolveNotValid(pParse, pNC, "the \".\" operator", - NC_IdxExpr|NC_GenCol, 0); + NC_IdxExpr|NC_GenCol, 0, pExpr); pRight = pExpr->pRight; if( pRight->op==TK_ID ){ zDb = 0; }else{ assert( pRight->op==TK_DOT ); + assert( !ExprHasProperty(pRight, EP_IntValue) ); zDb = pLeft->u.zToken; pLeft = pRight->pLeft; pRight = pRight->pRight; } + assert( ExprUseUToken(pLeft) && ExprUseUToken(pRight) ); zTable = pLeft->u.zToken; zColumn = pRight->u.zToken; + assert( ExprUseYTab(pExpr) ); if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, (void*)pExpr, (void*)pRight); sqlite3RenameTokenRemap(pParse, (void*)&pExpr->y.pTab, (void*)pLeft); @@ -100100,7 +101344,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ int no_such_func = 0; /* True if no such function exists */ int wrong_num_args = 0; /* True if wrong number of arguments */ int is_agg = 0; /* True if is an aggregate function */ - int nId; /* Number of characters in function name */ const char *zId; /* The function name. */ FuncDef *pDef; /* Information about the function */ u8 enc = ENC(pParse->db); /* The database encoding */ @@ -100108,9 +101351,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #ifndef SQLITE_OMIT_WINDOWFUNC Window *pWin = (IsWindowFunc(pExpr) ? pExpr->y.pWin : 0); #endif - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); + assert( !ExprHasProperty(pExpr, EP_xIsSelect|EP_IntValue) ); zId = pExpr->u.zToken; - nId = sqlite3Strlen30(zId); pDef = sqlite3FindFunction(pParse->db, zId, n, enc, 0); if( pDef==0 ){ pDef = sqlite3FindFunction(pParse->db, zId, -2, enc, 0); @@ -100127,8 +101369,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ pExpr->iTable = exprProbability(pList->a[1].pExpr); if( pExpr->iTable<0 ){ sqlite3ErrorMsg(pParse, - "second argument to likelihood() must be a " - "constant between 0.0 and 1.0"); + "second argument to %#T() must be a " + "constant between 0.0 and 1.0", pExpr); pNC->nNcErr++; } }else{ @@ -100149,8 +101391,8 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ int auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0,pDef->zName,0); if( auth!=SQLITE_OK ){ if( auth==SQLITE_DENY ){ - sqlite3ErrorMsg(pParse, "not authorized to use function: %s", - pDef->zName); + sqlite3ErrorMsg(pParse, "not authorized to use function: %#T", + pExpr); pNC->nNcErr++; } pExpr->op = TK_NULL; @@ -100173,7 +101415,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ ** in a CHECK constraint. SQLServer, MySQL, and PostgreSQL all ** all this. */ sqlite3ResolveNotValid(pParse, pNC, "non-deterministic functions", - NC_IdxExpr|NC_PartIdx|NC_GenCol, 0); + NC_IdxExpr|NC_PartIdx|NC_GenCol, 0, pExpr); }else{ assert( (NC_SelfRef & 0xff)==NC_SelfRef ); /* Must fit in 8 bits */ pExpr->op2 = pNC->ncFlags & NC_SelfRef; @@ -100186,7 +101428,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ /* Internal-use-only functions are disallowed unless the ** SQL is being compiled using sqlite3NestedParse() or ** the SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test-control has be - ** used to activate internal functionsn for testing purposes */ + ** used to activate internal functions for testing purposes */ no_such_func = 1; pDef = 0; }else @@ -100205,7 +101447,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ ); if( pDef && pDef->xValue==0 && pWin ){ sqlite3ErrorMsg(pParse, - "%.*s() may not be used as a window function", nId, zId + "%#T() may not be used as a window function", pExpr ); pNC->nNcErr++; }else if( @@ -100219,13 +101461,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ }else{ zType = "aggregate"; } - sqlite3ErrorMsg(pParse, "misuse of %s function %.*s()",zType,nId,zId); + sqlite3ErrorMsg(pParse, "misuse of %s function %#T()",zType,pExpr); pNC->nNcErr++; is_agg = 0; } #else if( (is_agg && (pNC->ncFlags & NC_AllowAgg)==0) ){ - sqlite3ErrorMsg(pParse,"misuse of aggregate function %.*s()",nId,zId); + sqlite3ErrorMsg(pParse,"misuse of aggregate function %#T()",pExpr); pNC->nNcErr++; is_agg = 0; } @@ -100235,18 +101477,18 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ && pParse->explain==0 #endif ){ - sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); + sqlite3ErrorMsg(pParse, "no such function: %#T", pExpr); pNC->nNcErr++; }else if( wrong_num_args ){ - sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", - nId, zId); + sqlite3ErrorMsg(pParse,"wrong number of arguments to function %#T()", + pExpr); pNC->nNcErr++; } #ifndef SQLITE_OMIT_WINDOWFUNC else if( is_agg==0 && ExprHasProperty(pExpr, EP_WinFunc) ){ sqlite3ErrorMsg(pParse, - "FILTER may not be used with non-aggregate %.*s()", - nId, zId + "FILTER may not be used with non-aggregate %#T()", + pExpr ); pNC->nNcErr++; } @@ -100272,7 +101514,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #ifndef SQLITE_OMIT_WINDOWFUNC if( pWin ){ Select *pSel = pNC->pWinSelect; - assert( pWin==pExpr->y.pWin ); + assert( pWin==0 || (ExprUseYWin(pExpr) && pWin==pExpr->y.pWin) ); if( IN_RENAME_OBJECT==0 ){ sqlite3WindowUpdate(pParse, pSel ? pSel->pWinDefn : 0, pWin, pDef); if( pParse->db->mallocFailed ) break; @@ -100285,7 +101527,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ }else #endif /* SQLITE_OMIT_WINDOWFUNC */ { - NameContext *pNC2 = pNC; + NameContext *pNC2; /* For looping up thru outer contexts */ pExpr->op = TK_AGG_FUNCTION; pExpr->op2 = 0; #ifndef SQLITE_OMIT_WINDOWFUNC @@ -100293,16 +101535,22 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ sqlite3WalkExpr(pWalker, pExpr->y.pWin->pFilter); } #endif - while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){ + pNC2 = pNC; + while( pNC2 + && sqlite3ReferencesSrcList(pParse, pExpr, pNC2->pSrcList)==0 + ){ pExpr->op2++; pNC2 = pNC2->pNext; } assert( pDef!=0 || IN_RENAME_OBJECT ); if( pNC2 && pDef ){ assert( SQLITE_FUNC_MINMAX==NC_MinMaxAgg ); + assert( SQLITE_FUNC_ANYORDER==NC_OrderAgg ); testcase( (pDef->funcFlags & SQLITE_FUNC_MINMAX)!=0 ); - pNC2->ncFlags |= NC_HasAgg | (pDef->funcFlags & SQLITE_FUNC_MINMAX); - + testcase( (pDef->funcFlags & SQLITE_FUNC_ANYORDER)!=0 ); + pNC2->ncFlags |= NC_HasAgg + | ((pDef->funcFlags^SQLITE_FUNC_ANYORDER) + & (SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER)); } } pNC->ncFlags |= savedAllowFlags; @@ -100318,15 +101566,17 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ #endif case TK_IN: { testcase( pExpr->op==TK_IN ); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ int nRef = pNC->nRef; testcase( pNC->ncFlags & NC_IsCheck ); testcase( pNC->ncFlags & NC_PartIdx ); testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); - sqlite3ResolveNotValid(pParse, pNC, "subqueries", - NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr); - sqlite3WalkSelect(pWalker, pExpr->x.pSelect); + if( pNC->ncFlags & NC_SelfRef ){ + notValidImpl(pParse, pNC, "subqueries", pExpr, pExpr); + }else{ + sqlite3WalkSelect(pWalker, pExpr->x.pSelect); + } assert( pNC->nRef>=nRef ); if( nRef!=pNC->nRef ){ ExprSetProperty(pExpr, EP_VarSelect); @@ -100341,7 +101591,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ testcase( pNC->ncFlags & NC_IdxExpr ); testcase( pNC->ncFlags & NC_GenCol ); sqlite3ResolveNotValid(pParse, pNC, "parameters", - NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr); + NC_IsCheck|NC_PartIdx|NC_IdxExpr|NC_GenCol, pExpr, pExpr); break; } case TK_IS: @@ -100373,6 +101623,7 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ assert( pExpr->pLeft!=0 ); nLeft = sqlite3ExprVectorSize(pExpr->pLeft); if( pExpr->op==TK_BETWEEN ){ + assert( ExprUseXList(pExpr) ); nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[0].pExpr); if( nRight==nLeft ){ nRight = sqlite3ExprVectorSize(pExpr->x.pList->a[1].pExpr); @@ -100392,11 +101643,13 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){ testcase( pExpr->op==TK_ISNOT ); testcase( pExpr->op==TK_BETWEEN ); sqlite3ErrorMsg(pParse, "row value misused"); + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); } break; } } - return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue; + assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 ); + return pParse->nErr ? WRC_Abort : WRC_Continue; } /* @@ -100421,7 +101674,9 @@ static int resolveAsName( UNUSED_PARAMETER(pParse); if( pE->op==TK_ID ){ - char *zCol = pE->u.zToken; + const char *zCol; + assert( !ExprHasProperty(pE, EP_IntValue) ); + zCol = pE->u.zToken; for(i=0; inExpr; i++){ if( pEList->a[i].eEName==ENAME_NAME && sqlite3_stricmp(pEList->a[i].zEName, zCol)==0 @@ -100502,11 +101757,13 @@ static void resolveOutOfRangeError( Parse *pParse, /* The error context into which to write the error */ const char *zType, /* "ORDER" or "GROUP" */ int i, /* The index (1-based) of the term out of range */ - int mx /* Largest permissible value of i */ + int mx, /* Largest permissible value of i */ + Expr *pError /* Associate the error with the expression */ ){ sqlite3ErrorMsg(pParse, "%r %s BY term out of range - should be " "between 1 and %d", i, zType, mx); + sqlite3RecordErrorOffsetOfExpr(pParse->db, pError); } /* @@ -100562,7 +101819,7 @@ static int resolveCompoundOrderBy( if( NEVER(pE==0) ) continue; if( sqlite3ExprIsInteger(pE, &iCol) ){ if( iCol<=0 || iCol>pEList->nExpr ){ - resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr); + resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr, pE); return 1; } }else{ @@ -100658,7 +101915,7 @@ SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy( for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){ if( pItem->u.x.iOrderByCol ){ if( pItem->u.x.iOrderByCol>pEList->nExpr ){ - resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr); + resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr, 0); return 1; } resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr,0); @@ -100750,7 +102007,7 @@ static int resolveOrderGroupBy( ** number so that sqlite3ResolveOrderGroupBy() will convert the ** order-by term to a copy of the result-set expression */ if( iCol<1 || iCol>0xffff ){ - resolveOutOfRangeError(pParse, zType, i+1, nResult); + resolveOutOfRangeError(pParse, zType, i+1, nResult, pE2); return 1; } pItem->u.x.iOrderByCol = (u16)iCol; @@ -100808,7 +102065,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ */ if( (p->selFlags & SF_Expanded)==0 ){ sqlite3SelectPrep(pParse, p, pOuterNC); - return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune; + return pParse->nErr ? WRC_Abort : WRC_Prune; } isCompound = p->pPrior!=0; @@ -100845,7 +102102,7 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ p->pOrderBy = 0; } - /* Recursively resolve names in all subqueries + /* Recursively resolve names in all subqueries in the FROM clause */ for(i=0; ipSrc->nSrc; i++){ SrcItem *pItem = &p->pSrc->a[i]; @@ -100856,7 +102113,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ if( pItem->zName ) pParse->zAuthContext = pItem->zName; sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC); pParse->zAuthContext = zSavedContext; - if( pParse->nErr || db->mallocFailed ) return WRC_Abort; + if( pParse->nErr ) return WRC_Abort; + assert( db->mallocFailed==0 ); /* If the number of references to the outer context changed when ** expressions in the sub-select were resolved, the sub-select @@ -100889,7 +102147,8 @@ static int resolveSelectStep(Walker *pWalker, Select *p){ pGroupBy = p->pGroupBy; if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){ assert( NC_MinMaxAgg==SF_MinMaxAgg ); - p->selFlags |= SF_Aggregate | (sNC.ncFlags&NC_MinMaxAgg); + assert( NC_OrderAgg==SF_OrderByReqd ); + p->selFlags |= SF_Aggregate | (sNC.ncFlags&(NC_MinMaxAgg|NC_OrderAgg)); }else{ sNC.ncFlags &= ~NC_AllowAgg; } @@ -101072,8 +102331,8 @@ SQLITE_PRIVATE int sqlite3ResolveExprNames( Walker w; if( pExpr==0 ) return SQLITE_OK; - savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin); - pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin); + savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); + pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); w.pParse = pNC->pParse; w.xExprCallback = resolveExprStep; w.xSelectCallback = (pNC->ncFlags & NC_NoSelect) ? 0 : resolveSelectStep; @@ -101116,8 +102375,8 @@ SQLITE_PRIVATE int sqlite3ResolveExprListNames( w.xSelectCallback = resolveSelectStep; w.xSelectCallback2 = 0; w.u.pNC = pNC; - savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin); - pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin); + savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); + pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); for(i=0; inExpr; i++){ Expr *pExpr = pList->a[i].pExpr; if( pExpr==0 ) continue; @@ -101135,10 +102394,11 @@ SQLITE_PRIVATE int sqlite3ResolveExprListNames( assert( EP_Win==NC_HasWin ); testcase( pNC->ncFlags & NC_HasAgg ); testcase( pNC->ncFlags & NC_HasWin ); - if( pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin) ){ + if( pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg) ){ ExprSetProperty(pExpr, pNC->ncFlags & (NC_HasAgg|NC_HasWin) ); - savedHasAgg |= pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg|NC_HasWin); - pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin); + savedHasAgg |= pNC->ncFlags & + (NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); + pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg|NC_HasWin|NC_OrderAgg); } if( w.pParse->nErr>0 ) return WRC_Abort; } @@ -101252,9 +102512,9 @@ static int exprCodeVector(Parse *pParse, Expr *p, int *piToFree); /* ** Return the affinity character for a single column of a table. */ -SQLITE_PRIVATE char sqlite3TableColumnAffinity(Table *pTab, int iCol){ - assert( iColnCol ); - return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER; +SQLITE_PRIVATE char sqlite3TableColumnAffinity(const Table *pTab, int iCol){ + if( iCol<0 || NEVER(iCol>=pTab->nCol) ) return SQLITE_AFF_INTEGER; + return pTab->aCol[iCol].affinity; } /* @@ -101284,11 +102544,14 @@ SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr){ } op = pExpr->op; if( op==TK_REGISTER ) op = pExpr->op2; - if( (op==TK_COLUMN || op==TK_AGG_COLUMN) && pExpr->y.pTab ){ - return sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); + if( op==TK_COLUMN || op==TK_AGG_COLUMN ){ + assert( ExprUseYTab(pExpr) ); + if( pExpr->y.pTab ){ + return sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); + } } if( op==TK_SELECT ){ - assert( pExpr->flags&EP_xIsSelect ); + assert( ExprUseXSelect(pExpr) ); assert( pExpr->x.pSelect!=0 ); assert( pExpr->x.pSelect->pEList!=0 ); assert( pExpr->x.pSelect->pEList->a[0].pExpr!=0 ); @@ -101301,12 +102564,15 @@ SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr){ } #endif if( op==TK_SELECT_COLUMN ){ - assert( pExpr->pLeft->flags&EP_xIsSelect ); + assert( pExpr->pLeft!=0 && ExprUseXSelect(pExpr->pLeft) ); + assert( pExpr->iColumn < pExpr->iTable ); + assert( pExpr->iTable==pExpr->pLeft->x.pSelect->pEList->nExpr ); return sqlite3ExprAffinity( pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr ); } if( op==TK_VECTOR ){ + assert( ExprUseXList(pExpr) ); return sqlite3ExprAffinity(pExpr->x.pList->a[0].pExpr); } return pExpr->affExpr; @@ -101321,7 +102587,7 @@ SQLITE_PRIVATE char sqlite3ExprAffinity(const Expr *pExpr){ ** and the pExpr parameter is returned unchanged. */ SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken( - Parse *pParse, /* Parsing context */ + const Parse *pParse, /* Parsing context */ Expr *pExpr, /* Add the "COLLATE" clause to this expression */ const Token *pCollName, /* Name of collating sequence */ int dequote /* True to dequote pCollName */ @@ -101336,7 +102602,11 @@ SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken( } return pExpr; } -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){ +SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString( + const Parse *pParse, /* Parsing context */ + Expr *pExpr, /* Add the "COLLATE" clause to this expression */ + const char *zC /* The collating sequence name */ +){ Token s; assert( zC!=0 ); sqlite3TokenInit(&s, (char*)zC); @@ -101362,7 +102632,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollateAndLikely(Expr *pExpr){ while( pExpr && ExprHasProperty(pExpr, EP_Skip|EP_Unlikely) ){ if( ExprHasProperty(pExpr, EP_Unlikely) ){ - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); + assert( ExprUseXList(pExpr) ); assert( pExpr->x.pList->nExpr>0 ); assert( pExpr->op==TK_FUNCTION ); pExpr = pExpr->x.pList->a[0].pExpr; @@ -101395,27 +102665,30 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr){ while( p ){ int op = p->op; if( op==TK_REGISTER ) op = p->op2; - if( (op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_TRIGGER) - && p->y.pTab!=0 - ){ - /* op==TK_REGISTER && p->y.pTab!=0 happens when pExpr was originally - ** a TK_COLUMN but was previously evaluated and cached in a register */ - int j = p->iColumn; - if( j>=0 ){ - const char *zColl = p->y.pTab->aCol[j].zColl; - pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0); + if( op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_TRIGGER ){ + assert( ExprUseYTab(p) ); + if( p->y.pTab!=0 ){ + /* op==TK_REGISTER && p->y.pTab!=0 happens when pExpr was originally + ** a TK_COLUMN but was previously evaluated and cached in a register */ + int j = p->iColumn; + if( j>=0 ){ + const char *zColl = sqlite3ColumnColl(&p->y.pTab->aCol[j]); + pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0); + } + break; } - break; } if( op==TK_CAST || op==TK_UPLUS ){ p = p->pLeft; continue; } if( op==TK_VECTOR ){ + assert( ExprUseXList(p) ); p = p->x.pList->a[0].pExpr; continue; } if( op==TK_COLLATE ){ + assert( !ExprHasProperty(p, EP_IntValue) ); pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); break; } @@ -101425,11 +102698,9 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, const Expr *pExpr){ }else{ Expr *pNext = p->pRight; /* The Expr.x union is never used at the same time as Expr.pRight */ + assert( ExprUseXList(p) ); assert( p->x.pList==0 || p->pRight==0 ); - if( p->x.pList!=0 - && !db->mallocFailed - && ALWAYS(!ExprHasProperty(p, EP_xIsSelect)) - ){ + if( p->x.pList!=0 && !db->mallocFailed ){ int i; for(i=0; ALWAYS(ix.pList->nExpr); i++){ if( ExprHasProperty(p->x.pList->a[i].pExpr, EP_Collate) ){ @@ -101512,7 +102783,7 @@ static char comparisonAffinity(const Expr *pExpr){ aff = sqlite3ExprAffinity(pExpr->pLeft); if( pExpr->pRight ){ aff = sqlite3CompareAffinity(pExpr->pRight, aff); - }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + }else if( ExprUseXSelect(pExpr) ){ aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff); }else if( aff==0 ){ aff = SQLITE_AFF_BLOB; @@ -101638,7 +102909,7 @@ static int codeCompare( ** But a TK_SELECT might be either a vector or a scalar. It is only ** considered a vector if it has two or more result columns. */ -SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr){ +SQLITE_PRIVATE int sqlite3ExprIsVector(const Expr *pExpr){ return sqlite3ExprVectorSize(pExpr)>1; } @@ -101648,12 +102919,14 @@ SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr){ ** is a sub-select, return the number of columns in the sub-select. For ** any other type of expression, return 1. */ -SQLITE_PRIVATE int sqlite3ExprVectorSize(Expr *pExpr){ +SQLITE_PRIVATE int sqlite3ExprVectorSize(const Expr *pExpr){ u8 op = pExpr->op; if( op==TK_REGISTER ) op = pExpr->op2; if( op==TK_VECTOR ){ + assert( ExprUseXList(pExpr) ); return pExpr->x.pList->nExpr; }else if( op==TK_SELECT ){ + assert( ExprUseXSelect(pExpr) ); return pExpr->x.pSelect->pEList->nExpr; }else{ return 1; @@ -101680,8 +102953,10 @@ SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){ if( sqlite3ExprIsVector(pVector) ){ assert( pVector->op2==0 || pVector->op==TK_REGISTER ); if( pVector->op==TK_SELECT || pVector->op2==TK_SELECT ){ + assert( ExprUseXSelect(pVector) ); return pVector->x.pSelect->pEList->a[i].pExpr; }else{ + assert( ExprUseXList(pVector) ); return pVector->x.pList->a[i].pExpr; } } @@ -101712,11 +102987,12 @@ SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){ SQLITE_PRIVATE Expr *sqlite3ExprForVectorField( Parse *pParse, /* Parsing context */ Expr *pVector, /* The vector. List of expressions or a sub-SELECT */ - int iField /* Which column of the vector to return */ + int iField, /* Which column of the vector to return */ + int nField /* Total number of columns in the vector */ ){ Expr *pRet; if( pVector->op==TK_SELECT ){ - assert( pVector->flags & EP_xIsSelect ); + assert( ExprUseXSelect(pVector) ); /* The TK_SELECT_COLUMN Expr node: ** ** pLeft: pVector containing TK_SELECT. Not deleted. @@ -101735,14 +103011,23 @@ SQLITE_PRIVATE Expr *sqlite3ExprForVectorField( */ pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0); if( pRet ){ + pRet->iTable = nField; pRet->iColumn = iField; pRet->pLeft = pVector; } - assert( pRet==0 || pRet->iTable==0 ); }else{ - if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr; + if( pVector->op==TK_VECTOR ){ + Expr **ppVector; + assert( ExprUseXList(pVector) ); + ppVector = &pVector->x.pList->a[iField].pExpr; + pVector = *ppVector; + if( IN_RENAME_OBJECT ){ + /* This must be a vector UPDATE inside a trigger */ + *ppVector = 0; + return pVector; + } + } pRet = sqlite3ExprDup(pParse->db, pVector, 0); - sqlite3RenameTokenRemap(pParse, pRet, pVector); } return pRet; } @@ -101798,10 +103083,12 @@ static int exprVectorRegister( return pVector->iTable+iField; } if( op==TK_SELECT ){ + assert( ExprUseXSelect(pVector) ); *ppExpr = pVector->x.pSelect->pEList->a[iField].pExpr; return regSelect+iField; } if( op==TK_VECTOR ){ + assert( ExprUseXList(pVector) ); *ppExpr = pVector->x.pList->a[iField].pExpr; return sqlite3ExprCodeTemp(pParse, *ppExpr, pRegFree); } @@ -101935,14 +103222,14 @@ SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse *pParse, int nHeight){ ** to by pnHeight, the second parameter, then set *pnHeight to that ** value. */ -static void heightOfExpr(Expr *p, int *pnHeight){ +static void heightOfExpr(const Expr *p, int *pnHeight){ if( p ){ if( p->nHeight>*pnHeight ){ *pnHeight = p->nHeight; } } } -static void heightOfExprList(ExprList *p, int *pnHeight){ +static void heightOfExprList(const ExprList *p, int *pnHeight){ if( p ){ int i; for(i=0; inExpr; i++){ @@ -101950,8 +103237,8 @@ static void heightOfExprList(ExprList *p, int *pnHeight){ } } } -static void heightOfSelect(Select *pSelect, int *pnHeight){ - Select *p; +static void heightOfSelect(const Select *pSelect, int *pnHeight){ + const Select *p; for(p=pSelect; p; p=p->pPrior){ heightOfExpr(p->pWhere, pnHeight); heightOfExpr(p->pHaving, pnHeight); @@ -101973,10 +103260,9 @@ static void heightOfSelect(Select *pSelect, int *pnHeight){ ** if appropriate. */ static void exprSetHeight(Expr *p){ - int nHeight = 0; - heightOfExpr(p->pLeft, &nHeight); - heightOfExpr(p->pRight, &nHeight); - if( ExprHasProperty(p, EP_xIsSelect) ){ + int nHeight = p->pLeft ? p->pLeft->nHeight : 0; + if( p->pRight && p->pRight->nHeight>nHeight ) nHeight = p->pRight->nHeight; + if( ExprUseXSelect(p) ){ heightOfSelect(p->x.pSelect, &nHeight); }else if( p->x.pList ){ heightOfExprList(p->x.pList, &nHeight); @@ -102003,7 +103289,7 @@ SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ ** Return the maximum height of any expression tree referenced ** by the select statement passed as an argument. */ -SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *p){ +SQLITE_PRIVATE int sqlite3SelectExprHeight(const Select *p){ int nHeight = 0; heightOfSelect(p, &nHeight); return nHeight; @@ -102015,7 +103301,7 @@ SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *p){ */ SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){ if( pParse->nErr ) return; - if( p && p->x.pList && !ExprHasProperty(p, EP_xIsSelect) ){ + if( p && ExprUseXList(p) && p->x.pList ){ p->flags |= EP_Propagate & sqlite3ExprListFlags(p->x.pList); } } @@ -102173,6 +103459,63 @@ SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Select *pS } } +/* +** Expression list pEList is a list of vector values. This function +** converts the contents of pEList to a VALUES(...) Select statement +** returning 1 row for each element of the list. For example, the +** expression list: +** +** ( (1,2), (3,4) (5,6) ) +** +** is translated to the equivalent of: +** +** VALUES(1,2), (3,4), (5,6) +** +** Each of the vector values in pEList must contain exactly nElem terms. +** If a list element that is not a vector or does not contain nElem terms, +** an error message is left in pParse. +** +** This is used as part of processing IN(...) expressions with a list +** of vectors on the RHS. e.g. "... IN ((1,2), (3,4), (5,6))". +*/ +SQLITE_PRIVATE Select *sqlite3ExprListToValues(Parse *pParse, int nElem, ExprList *pEList){ + int ii; + Select *pRet = 0; + assert( nElem>1 ); + for(ii=0; iinExpr; ii++){ + Select *pSel; + Expr *pExpr = pEList->a[ii].pExpr; + int nExprElem; + if( pExpr->op==TK_VECTOR ){ + assert( ExprUseXList(pExpr) ); + nExprElem = pExpr->x.pList->nExpr; + }else{ + nExprElem = 1; + } + if( nExprElem!=nElem ){ + sqlite3ErrorMsg(pParse, "IN(...) element has %d term%s - expected %d", + nExprElem, nExprElem>1?"s":"", nElem + ); + break; + } + assert( ExprUseXList(pExpr) ); + pSel = sqlite3SelectNew(pParse, pExpr->x.pList, 0, 0, 0, 0, 0, SF_Values,0); + pExpr->x.pList = 0; + if( pSel ){ + if( pRet ){ + pSel->op = TK_ALL; + pSel->pPrior = pRet; + } + pRet = pSel; + } + } + + if( pRet && pRet->pPrior ){ + pRet->selFlags |= SF_MultiValue; + } + sqlite3ExprListDelete(pParse->db, pEList); + return pRet; +} /* ** Join two expressions using an AND operator. If either expression is @@ -102206,7 +103549,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprAnd(Parse *pParse, Expr *pLeft, Expr *pRight){ SQLITE_PRIVATE Expr *sqlite3ExprFunction( Parse *pParse, /* Parsing context */ ExprList *pList, /* Argument list */ - Token *pToken, /* Name of the function */ + const Token *pToken, /* Name of the function */ int eDistinct /* SF_Distinct or SF_ALL or 0 */ ){ Expr *pNew; @@ -102217,12 +103560,16 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction( sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ return 0; } - if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ + pNew->w.iOfst = (int)(pToken->z - pParse->zTail); + if( pList + && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] + && !pParse->nested + ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken); } pNew->x.pList = pList; ExprSetProperty(pNew, EP_HasFunc); - assert( !ExprHasProperty(pNew, EP_xIsSelect) ); + assert( ExprUseXList(pNew) ); sqlite3ExprSetHeightAndFlags(pParse, pNew); if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct); return pNew; @@ -102241,8 +103588,8 @@ SQLITE_PRIVATE Expr *sqlite3ExprFunction( */ SQLITE_PRIVATE void sqlite3ExprFunctionUsable( Parse *pParse, /* Parsing and code generating context */ - Expr *pExpr, /* The function invocation */ - FuncDef *pDef /* The function being invoked */ + const Expr *pExpr, /* The function invocation */ + const FuncDef *pDef /* The function being invoked */ ){ assert( !IN_RENAME_OBJECT ); assert( (pDef->funcFlags & (SQLITE_FUNC_DIRECT|SQLITE_FUNC_UNSAFE))!=0 ); @@ -102257,7 +103604,7 @@ SQLITE_PRIVATE void sqlite3ExprFunctionUsable( ** SQLITE_DBCONFIG_TRUSTED_SCHEMA is off (meaning ** that the schema is possibly tainted). */ - sqlite3ErrorMsg(pParse, "unsafe use of %s()", pDef->zName); + sqlite3ErrorMsg(pParse, "unsafe use of %#T()", pExpr); } } } @@ -102313,6 +103660,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d", db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]); + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); return; } x = (ynVar)i; @@ -102340,6 +103688,7 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n pExpr->iColumn = x; if( x>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ sqlite3ErrorMsg(pParse, "too many SQL variables"); + sqlite3RecordErrorOffsetOfExpr(pParse->db, pExpr); } } @@ -102348,27 +103697,26 @@ SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr, u32 n */ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ assert( p!=0 ); - /* Sanity check: Assert that the IntValue is non-negative if it exists */ - assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 ); - - assert( !ExprHasProperty(p, EP_WinFunc) || p->y.pWin!=0 || db->mallocFailed ); - assert( p->op!=TK_FUNCTION || ExprHasProperty(p, EP_TokenOnly|EP_Reduced) - || p->y.pWin==0 || ExprHasProperty(p, EP_WinFunc) ); + assert( !ExprUseUValue(p) || p->u.iValue>=0 ); + assert( !ExprUseYWin(p) || !ExprUseYSub(p) ); + assert( !ExprUseYWin(p) || p->y.pWin!=0 || db->mallocFailed ); + assert( p->op!=TK_FUNCTION || !ExprUseYSub(p) ); #ifdef SQLITE_DEBUG if( ExprHasProperty(p, EP_Leaf) && !ExprHasProperty(p, EP_TokenOnly) ){ assert( p->pLeft==0 ); assert( p->pRight==0 ); - assert( p->x.pSelect==0 ); + assert( !ExprUseXSelect(p) || p->x.pSelect==0 ); + assert( !ExprUseXList(p) || p->x.pList==0 ); } #endif if( !ExprHasProperty(p, (EP_TokenOnly|EP_Leaf)) ){ /* The Expr.x union is never used at the same time as Expr.pRight */ - assert( p->x.pList==0 || p->pRight==0 ); + assert( (ExprUseXList(p) && p->x.pList==0) || p->pRight==0 ); if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft); if( p->pRight ){ assert( !ExprHasProperty(p, EP_WinFunc) ); sqlite3ExprDeleteNN(db, p->pRight); - }else if( ExprHasProperty(p, EP_xIsSelect) ){ + }else if( ExprUseXSelect(p) ){ assert( !ExprHasProperty(p, EP_WinFunc) ); sqlite3SelectDelete(db, p->x.pSelect); }else{ @@ -102380,7 +103728,10 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){ #endif } } - if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken); + if( ExprHasProperty(p, EP_MemToken) ){ + assert( !ExprHasProperty(p, EP_IntValue) ); + sqlite3DbFree(db, p->u.zToken); + } if( !ExprHasProperty(p, EP_Static) ){ sqlite3DbFreeNN(db, p); } @@ -102422,7 +103773,7 @@ SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){ ** passed as the first argument. This is always one of EXPR_FULLSIZE, ** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE. */ -static int exprStructSize(Expr *p){ +static int exprStructSize(const Expr *p){ if( ExprHasProperty(p, EP_TokenOnly) ) return EXPR_TOKENONLYSIZE; if( ExprHasProperty(p, EP_Reduced) ) return EXPR_REDUCEDSIZE; return EXPR_FULLSIZE; @@ -102462,7 +103813,7 @@ static int exprStructSize(Expr *p){ ** of dupedExprStructSize() contain multiple assert() statements that attempt ** to enforce this constraint. */ -static int dupedExprStructSize(Expr *p, int flags){ +static int dupedExprStructSize(const Expr *p, int flags){ int nSize; assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */ assert( EXPR_FULLSIZE<=0xfff ); @@ -102493,7 +103844,7 @@ static int dupedExprStructSize(Expr *p, int flags){ ** of the Expr structure and a copy of the Expr.u.zToken string (if that ** string is defined.) */ -static int dupedExprNodeSize(Expr *p, int flags){ +static int dupedExprNodeSize(const Expr *p, int flags){ int nByte = dupedExprStructSize(p, flags) & 0xfff; if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ nByte += sqlite3Strlen30NN(p->u.zToken)+1; @@ -102514,7 +103865,7 @@ static int dupedExprNodeSize(Expr *p, int flags){ ** and Expr.pRight variables (but not for any structures pointed to or ** descended from the Expr.x.pList or Expr.x.pSelect variables). */ -static int dupedExprSize(Expr *p, int flags){ +static int dupedExprSize(const Expr *p, int flags){ int nByte = 0; if( p ){ nByte = dupedExprNodeSize(p, flags); @@ -102533,7 +103884,7 @@ static int dupedExprSize(Expr *p, int flags){ ** if any. Before returning, *pzBuffer is set to the first byte past the ** portion of the buffer copied into by this function. */ -static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ +static Expr *exprDup(sqlite3 *db, const Expr *p, int dupFlags, u8 **pzBuffer){ Expr *pNew; /* Value to return */ u8 *zAlloc; /* Memory space from which to build Expr object */ u32 staticFlag; /* EP_Static if space not obtained from malloc */ @@ -102596,7 +103947,7 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ if( 0==((p->flags|pNew->flags) & (EP_TokenOnly|EP_Leaf)) ){ /* Fill in the pNew->x.pSelect or pNew->x.pList member. */ - if( ExprHasProperty(p, EP_xIsSelect) ){ + if( ExprUseXSelect(p) ){ pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, dupFlags); }else{ pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, dupFlags); @@ -102625,7 +103976,6 @@ static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){ if( !ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ if( pNew->op==TK_SELECT_COLUMN ){ pNew->pLeft = p->pLeft; - assert( p->iColumn==0 || p->pRight==0 ); assert( p->pRight==0 || p->pRight==p->pLeft || ExprHasProperty(p->pLeft, EP_Subquery) ); }else{ @@ -102715,15 +104065,17 @@ static void gatherSelectWindows(Select *p){ ** truncated version of the usual Expr structure that will be stored as ** part of the in-memory representation of the database schema. */ -SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){ +SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, const Expr *p, int flags){ assert( flags==0 || flags==EXPRDUP_REDUCE ); return p ? exprDup(db, p, flags, 0) : 0; } -SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){ +SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, const ExprList *p, int flags){ ExprList *pNew; - struct ExprList_item *pItem, *pOldItem; + struct ExprList_item *pItem; + const struct ExprList_item *pOldItem; int i; - Expr *pPriorSelectCol = 0; + Expr *pPriorSelectColOld = 0; + Expr *pPriorSelectColNew = 0; assert( db!=0 ); if( p==0 ) return 0; pNew = sqlite3DbMallocRawNN(db, sqlite3DbMallocSize(db, p)); @@ -102740,17 +104092,17 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags) && pOldExpr->op==TK_SELECT_COLUMN && (pNewExpr = pItem->pExpr)!=0 ){ - assert( pNewExpr->iColumn==0 || i>0 ); - if( pNewExpr->iColumn==0 ){ - assert( pOldExpr->pLeft==pOldExpr->pRight - || ExprHasProperty(pOldExpr->pLeft, EP_Subquery) ); - pPriorSelectCol = pNewExpr->pLeft = pNewExpr->pRight; + if( pNewExpr->pRight ){ + pPriorSelectColOld = pOldExpr->pRight; + pPriorSelectColNew = pNewExpr->pRight; + pNewExpr->pLeft = pNewExpr->pRight; }else{ - assert( i>0 ); - assert( pItem[-1].pExpr!=0 ); - assert( pNewExpr->iColumn==pItem[-1].pExpr->iColumn+1 ); - assert( pPriorSelectCol==pItem[-1].pExpr->pLeft ); - pNewExpr->pLeft = pPriorSelectCol; + if( pOldExpr->pLeft!=pPriorSelectColOld ){ + pPriorSelectColOld = pOldExpr->pLeft; + pPriorSelectColNew = sqlite3ExprDup(db, pPriorSelectColOld, flags); + pNewExpr->pRight = pPriorSelectColNew; + } + pNewExpr->pLeft = pPriorSelectColNew; } } pItem->zEName = sqlite3DbStrDup(db, pOldItem->zEName); @@ -102772,7 +104124,7 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags) */ #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \ || !defined(SQLITE_OMIT_SUBQUERY) -SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){ +SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, const SrcList *p, int flags){ SrcList *pNew; int i; int nByte; @@ -102784,7 +104136,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){ pNew->nSrc = pNew->nAlloc = p->nSrc; for(i=0; inSrc; i++){ SrcItem *pNewItem = &pNew->a[i]; - SrcItem *pOldItem = &p->a[i]; + const SrcItem *pOldItem = &p->a[i]; Table *pTab; pNewItem->pSchema = pOldItem->pSchema; pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase); @@ -102816,7 +104168,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){ } return pNew; } -SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){ +SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, const IdList *p){ IdList *pNew; int i; assert( db!=0 ); @@ -102840,11 +104192,11 @@ SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){ } return pNew; } -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){ +SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, const Select *pDup, int flags){ Select *pRet = 0; Select *pNext = 0; Select **pp = &pRet; - Select *p; + const Select *p; assert( db!=0 ); for(p=pDup; p; p=p->pPrior){ @@ -102889,7 +104241,7 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *pDup, int flags){ return pRet; } #else -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){ +SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, const Select *p, int flags){ assert( p==0 ); return 0; } @@ -103009,11 +104361,9 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector( } for(i=0; inId; i++){ - Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i); + Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i, pColumns->nId); assert( pSubExpr!=0 || db->mallocFailed ); - assert( pSubExpr==0 || pSubExpr->iTable==0 ); if( pSubExpr==0 ) continue; - pSubExpr->iTable = pColumns->nId; pList = sqlite3ExprListAppend(pParse, pList, pSubExpr); if( pList ){ assert( pList->nExpr==iFirst+i+1 ); @@ -103087,7 +104437,7 @@ SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder, int SQLITE_PRIVATE void sqlite3ExprListSetName( Parse *pParse, /* Parsing context */ ExprList *pList, /* List to which to add the span. */ - Token *pName, /* Name to be added */ + const Token *pName, /* Name to be added */ int dequote /* True to cause the name to be dequoted */ ){ assert( pList!=0 || pParse->db->mallocFailed!=0 ); @@ -103105,7 +104455,7 @@ SQLITE_PRIVATE void sqlite3ExprListSetName( ** to the token-map. */ sqlite3Dequote(pItem->zEName); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)pItem->zEName, pName); + sqlite3RenameTokenMap(pParse, (const void*)pItem->zEName, pName); } } } @@ -103224,7 +104574,7 @@ SQLITE_PRIVATE u32 sqlite3IsTrueOrFalse(const char *zIn){ SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){ u32 v; assert( pExpr->op==TK_ID || pExpr->op==TK_STRING ); - if( !ExprHasProperty(pExpr, EP_Quoted) + if( !ExprHasProperty(pExpr, EP_Quoted|EP_IntValue) && (v = sqlite3IsTrueOrFalse(pExpr->u.zToken))!=0 ){ pExpr->op = TK_TRUEFALSE; @@ -103241,6 +104591,7 @@ SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){ SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr *pExpr){ pExpr = sqlite3ExprSkipCollate((Expr*)pExpr); assert( pExpr->op==TK_TRUEFALSE ); + assert( !ExprHasProperty(pExpr, EP_IntValue) ); assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0 || sqlite3StrICmp(pExpr->u.zToken,"false")==0 ); return pExpr->u.zToken[4]==0; @@ -103424,6 +104775,38 @@ SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){ return exprIsConst(p, 3, iCur); } +/* +** Check pExpr to see if it is an invariant constraint on data source pSrc. +** This is an optimization. False negatives will perhaps cause slower +** queries, but false positives will yield incorrect answers. So when in +** double, return 0. +** +** To be an invariant constraint, the following must be true: +** +** (1) pExpr cannot refer to any table other than pSrc->iCursor. +** +** (2) pExpr cannot use subqueries or non-deterministic functions. +** +** (*) ** Not applicable to this branch ** +** +** (4) If pSrc is the right operand of a LEFT JOIN, then... +** (4a) pExpr must come from an ON clause.. +** (4b) and specifically the ON clause associated with the LEFT JOIN. +** +** (5) If pSrc is not the right operand of a LEFT JOIN or the left +** operand of a RIGHT JOIN, then pExpr must be from the WHERE +** clause, not an ON clause. +*/ +SQLITE_PRIVATE int sqlite3ExprIsTableConstraint(Expr *pExpr, const SrcItem *pSrc){ + if( pSrc->fg.jointype & JT_LEFT ){ + if( !ExprHasProperty(pExpr, EP_FromJoin) ) return 0; /* rule (4a) */ + if( pExpr->w.iRightJoinTable!=pSrc->iCursor ) return 0; /* rule (4b) */ + }else{ + if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0; /* rule (5) */ + } + return sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor); /* rules (1), (2) */ +} + /* ** sqlite3WalkExpr() callback used by sqlite3ExprIsConstantOrGroupBy(). @@ -103445,7 +104828,7 @@ static int exprNodeIsConstantOrGroupBy(Walker *pWalker, Expr *pExpr){ } /* Check if pExpr is a sub-select. If so, consider it variable. */ - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ pWalker->eCode = 0; return WRC_Abort; } @@ -103533,7 +104916,7 @@ SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr *p){ ** in *pValue. If the expression is not an integer or if it is too big ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged. */ -SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){ +SQLITE_PRIVATE int sqlite3ExprIsInteger(const Expr *p, int *pValue){ int rc = 0; if( NEVER(p==0) ) return 0; /* Used to only happen following on OOM */ @@ -103552,9 +104935,9 @@ SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){ break; } case TK_UMINUS: { - int v; + int v = 0; if( sqlite3ExprIsInteger(p->pLeft, &v) ){ - assert( v!=(-2147483647-1) ); + assert( ((unsigned int)v)!=0x80000000 ); *pValue = -v; rc = 1; } @@ -103595,10 +104978,11 @@ SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){ case TK_BLOB: return 0; case TK_COLUMN: + assert( ExprUseYTab(p) ); return ExprHasProperty(p, EP_CanBeNull) || p->y.pTab==0 || /* Reference to column of index on expression */ (p->iColumn>=0 - && ALWAYS(p->y.pTab->aCol!=0) /* Defense against OOM problems */ + && p->y.pTab->aCol!=0 /* Possible due to prior error */ && p->y.pTab->aCol[p->iColumn].notNull==0); default: return 1; @@ -103666,13 +105050,13 @@ SQLITE_PRIVATE int sqlite3IsRowid(const char *z){ ** table, then return NULL. */ #ifndef SQLITE_OMIT_SUBQUERY -static Select *isCandidateForInOpt(Expr *pX){ +static Select *isCandidateForInOpt(const Expr *pX){ Select *p; SrcList *pSrc; ExprList *pEList; Table *pTab; int i; - if( !ExprHasProperty(pX, EP_xIsSelect) ) return 0; /* Not a subquery */ + if( !ExprUseXSelect(pX) ) return 0; /* Not a subquery */ if( ExprHasProperty(pX, EP_VarSelect) ) return 0; /* Correlated subq */ p = pX->x.pSelect; if( p->pPrior ) return 0; /* Not a compound SELECT */ @@ -103690,7 +105074,7 @@ static Select *isCandidateForInOpt(Expr *pX){ if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */ pTab = pSrc->a[0].pTab; assert( pTab!=0 ); - assert( pTab->pSelect==0 ); /* FROM clause is not a view */ + assert( !IsView(pTab) ); /* FROM clause is not a view */ if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */ pEList = p->pEList; assert( pEList!=0 ); @@ -103843,7 +105227,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( ** or not NULL is actually possible (it may not be, for example, due ** to NOT NULL constraints in the schema). If no NULL values are possible, ** set prRhsHasNull to 0 before continuing. */ - if( prRhsHasNull && (pX->flags & EP_xIsSelect) ){ + if( prRhsHasNull && ExprUseXSelect(pX) ){ int i; ExprList *pEList = pX->x.pSelect->pEList; for(i=0; inExpr; i++){ @@ -103999,7 +105383,7 @@ SQLITE_PRIVATE int sqlite3FindInIndex( */ if( eType==0 && (inFlags & IN_INDEX_NOOP_OK) - && !ExprHasProperty(pX, EP_xIsSelect) + && ExprUseXList(pX) && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2) ){ eType = IN_INDEX_NOOP; @@ -104044,10 +105428,10 @@ SQLITE_PRIVATE int sqlite3FindInIndex( ** It is the responsibility of the caller to ensure that the returned ** string is eventually freed using sqlite3DbFree(). */ -static char *exprINAffinity(Parse *pParse, Expr *pExpr){ +static char *exprINAffinity(Parse *pParse, const Expr *pExpr){ Expr *pLeft = pExpr->pLeft; int nVal = sqlite3ExprVectorSize(pLeft); - Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0; + Select *pSelect = ExprUseXSelect(pExpr) ? pExpr->x.pSelect : 0; char *zRet; assert( pExpr->op==TK_IN ); @@ -104097,7 +105481,7 @@ SQLITE_PRIVATE void sqlite3SubselectError(Parse *pParse, int nActual, int nExpec */ SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse *pParse, Expr *pExpr){ #ifndef SQLITE_OMIT_SUBQUERY - if( pExpr->flags & EP_xIsSelect ){ + if( ExprUseXSelect(pExpr) ){ sqlite3SubselectError(pParse, pExpr->x.pSelect->pEList->nExpr, 1); }else #endif @@ -104161,10 +105545,11 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( */ if( ExprHasProperty(pExpr, EP_Subrtn) ){ addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ ExplainQueryPlan((pParse, 0, "REUSE LIST SUBQUERY %d", pExpr->x.pSelect->selId)); } + assert( ExprUseYSub(pExpr) ); sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn, pExpr->y.sub.iAddr); sqlite3VdbeAddOp2(v, OP_OpenDup, iTab, pExpr->iTable); @@ -104173,6 +105558,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( } /* Begin coding the subroutine */ + assert( !ExprUseYWin(pExpr) ); ExprSetProperty(pExpr, EP_Subrtn); assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); pExpr->y.sub.regReturn = ++pParse->nMem; @@ -104193,7 +105579,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( pExpr->iTable = iTab; addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, nVal); #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ VdbeComment((v, "Result of SELECT %u", pExpr->x.pSelect->selId)); }else{ VdbeComment((v, "RHS of IN operator")); @@ -104201,7 +105587,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( #endif pKeyInfo = sqlite3KeyInfoAlloc(pParse->db, nVal, 1); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ /* Case 1: expr IN (SELECT ...) ** ** Generate code to write the results of the select into the temporary @@ -104299,6 +105685,7 @@ SQLITE_PRIVATE void sqlite3CodeRhsOfIN( if( addrOnce ){ sqlite3VdbeJumpHere(v, addrOnce); /* Subroutine return */ + assert( ExprUseYSub(pExpr) ); sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1); sqlite3ClearTempRegCache(pParse); @@ -104335,19 +105722,22 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ testcase( pExpr->op==TK_EXISTS ); testcase( pExpr->op==TK_SELECT ); assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT ); - assert( ExprHasProperty(pExpr, EP_xIsSelect) ); + assert( ExprUseXSelect(pExpr) ); pSel = pExpr->x.pSelect; /* If this routine has already been coded, then invoke it as a ** subroutine. */ if( ExprHasProperty(pExpr, EP_Subrtn) ){ ExplainQueryPlan((pParse, 0, "REUSE SUBQUERY %d", pSel->selId)); + assert( ExprUseYSub(pExpr) ); sqlite3VdbeAddOp2(v, OP_Gosub, pExpr->y.sub.regReturn, pExpr->y.sub.iAddr); return pExpr->iTable; } /* Begin coding the subroutine */ + assert( !ExprUseYWin(pExpr) ); + assert( !ExprHasProperty(pExpr, EP_Reduced|EP_TokenOnly) ); ExprSetProperty(pExpr, EP_Subrtn); pExpr->y.sub.regReturn = ++pParse->nMem; pExpr->y.sub.iAddr = @@ -104414,10 +105804,8 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ } pSel->iLimit = 0; if( sqlite3Select(pParse, pSel, &dest) ){ - if( pParse->nErr ){ - pExpr->op2 = pExpr->op; - pExpr->op = TK_ERROR; - } + pExpr->op2 = pExpr->op; + pExpr->op = TK_ERROR; return 0; } pExpr->iTable = rReg = dest.iSDParm; @@ -104427,6 +105815,7 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ } /* Subroutine return */ + assert( ExprUseYSub(pExpr) ); sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1); sqlite3ClearTempRegCache(pParse); @@ -104443,7 +105832,7 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){ */ SQLITE_PRIVATE int sqlite3ExprCheckIN(Parse *pParse, Expr *pIn){ int nVector = sqlite3ExprVectorSize(pIn->pLeft); - if( (pIn->flags & EP_xIsSelect)!=0 && !pParse->db->mallocFailed ){ + if( ExprUseXSelect(pIn) && !pParse->db->mallocFailed ){ if( nVector!=pIn->x.pSelect->pEList->nExpr ){ sqlite3SubselectError(pParse, pIn->x.pSelect->pEList->nExpr, nVector); return 1; @@ -104577,13 +105966,15 @@ static void sqlite3ExprCodeIN( ** This is step (1) in the in-operator.md optimized algorithm. */ if( eType==IN_INDEX_NOOP ){ - ExprList *pList = pExpr->x.pList; - CollSeq *pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft); + ExprList *pList; + CollSeq *pColl; int labelOk = sqlite3VdbeMakeLabel(pParse); int r2, regToFree; int regCkNull = 0; int ii; - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); + assert( ExprUseXList(pExpr) ); + pList = pExpr->x.pList; + pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft); if( destIfNull!=destIfFalse ){ regCkNull = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_BitAnd, rLhs, rLhs, regCkNull); @@ -104631,10 +106022,9 @@ static void sqlite3ExprCodeIN( }else{ destStep2 = destStep6 = sqlite3VdbeMakeLabel(pParse); } - if( pParse->nErr ) goto sqlite3ExprCodeIN_finished; for(i=0; ipLeft, i); - if( pParse->db->mallocFailed ) goto sqlite3ExprCodeIN_oom_error; + if( pParse->nErr ) goto sqlite3ExprCodeIN_oom_error; if( sqlite3ExprCanBeNull(p) ){ sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2); VdbeCoverage(v); @@ -104772,11 +106162,12 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){ c = sqlite3DecOrHexToI64(z, &value); if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){ #ifdef SQLITE_OMIT_FLOATING_POINT - sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z); + sqlite3ErrorMsg(pParse, "oversized integer: %s%#T", negFlag?"-":"",pExpr); #else #ifndef SQLITE_OMIT_HEX_INTEGER if( sqlite3_strnicmp(z,"0x",2)==0 ){ - sqlite3ErrorMsg(pParse, "hex literal too big: %s%s", negFlag?"-":"",z); + sqlite3ErrorMsg(pParse, "hex literal too big: %s%#T", + negFlag?"-":"",pExpr); }else #endif { @@ -104820,9 +106211,10 @@ SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn( ** and store the result in register regOut */ SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn( - Parse *pParse, - Column *pCol, - int regOut + Parse *pParse, /* Parsing context */ + Table *pTab, /* Table containing the generated column */ + Column *pCol, /* The generated column */ + int regOut /* Put the result in this register */ ){ int iAddr; Vdbe *v = pParse->pVdbe; @@ -104833,7 +106225,7 @@ SQLITE_PRIVATE void sqlite3ExprCodeGeneratedColumn( }else{ iAddr = 0; } - sqlite3ExprCodeCopy(pParse, pCol->pDflt, regOut); + sqlite3ExprCodeCopy(pParse, sqlite3ColumnExpr(pTab,pCol), regOut); if( pCol->affinity>=SQLITE_AFF_TEXT ){ sqlite3VdbeAddOp4(v, OP_Affinity, regOut, 1, 0, &pCol->affinity, 1); } @@ -104869,12 +106261,13 @@ SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( }else if( (pCol = &pTab->aCol[iCol])->colFlags & COLFLAG_VIRTUAL ){ Parse *pParse = sqlite3VdbeParser(v); if( pCol->colFlags & COLFLAG_BUSY ){ - sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pCol->zName); + sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", + pCol->zCnName); }else{ int savedSelfTab = pParse->iSelfTab; pCol->colFlags |= COLFLAG_BUSY; pParse->iSelfTab = iTabCur+1; - sqlite3ExprCodeGeneratedColumn(pParse, pCol, regOut); + sqlite3ExprCodeGeneratedColumn(pParse, pTab, pCol, regOut); pParse->iSelfTab = savedSelfTab; pCol->colFlags &= ~COLFLAG_BUSY; } @@ -104967,6 +106360,7 @@ static int exprCodeVector(Parse *pParse, Expr *p, int *piFreeable){ int i; iResult = pParse->nMem+1; pParse->nMem += nResult; + assert( ExprUseXList(p) ); for(i=0; ix.pList->a[i].pExpr, i+iResult); } @@ -105041,6 +106435,7 @@ static int exprCodeInlineFunction( ** Test-only SQL functions that are only usable if enabled ** via SQLITE_TESTCTRL_INTERNAL_FUNCTIONS */ +#if !defined(SQLITE_UNTESTABLE) case INLINEFUNC_expr_compare: { /* Compare two expressions using sqlite3ExprCompare() */ assert( nFarg==2 ); @@ -105074,7 +106469,6 @@ static int exprCodeInlineFunction( break; } -#ifdef SQLITE_DEBUG case INLINEFUNC_affinity: { /* The AFFINITY() function evaluates to a string that describes ** the type affinity of the argument. This is used for testing of @@ -105088,7 +106482,7 @@ static int exprCodeInlineFunction( (aff<=SQLITE_AFF_NONE) ? "none" : azAff[aff-SQLITE_AFF_BLOB]); break; } -#endif +#endif /* !defined(SQLITE_UNTESTABLE) */ } return target; } @@ -105142,7 +106536,8 @@ expr_code_doover: if( pCol->iColumn<0 ){ VdbeComment((v,"%s.rowid",pTab->zName)); }else{ - VdbeComment((v,"%s.%s",pTab->zName,pTab->aCol[pCol->iColumn].zName)); + VdbeComment((v,"%s.%s", + pTab->zName, pTab->aCol[pCol->iColumn].zCnName)); if( pTab->aCol[pCol->iColumn].affinity==SQLITE_AFF_REAL ){ sqlite3VdbeAddOp1(v, OP_RealAffinity, target); } @@ -105164,6 +106559,7 @@ expr_code_doover: */ int aff; iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target); + assert( ExprUseYTab(pExpr) ); if( pExpr->y.pTab ){ aff = sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn); }else{ @@ -105187,9 +106583,11 @@ expr_code_doover: ** immediately prior to the first column. */ Column *pCol; - Table *pTab = pExpr->y.pTab; + Table *pTab; int iSrc; int iCol = pExpr->iColumn; + assert( ExprUseYTab(pExpr) ); + pTab = pExpr->y.pTab; assert( pTab!=0 ); assert( iCol>=XN_ROWID ); assert( iColnCol ); @@ -105203,12 +106601,12 @@ expr_code_doover: if( pCol->colFlags & COLFLAG_GENERATED ){ if( pCol->colFlags & COLFLAG_BUSY ){ sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", - pCol->zName); + pCol->zCnName); return 0; } pCol->colFlags |= COLFLAG_BUSY; if( pCol->colFlags & COLFLAG_NOTAVAIL ){ - sqlite3ExprCodeGeneratedColumn(pParse, pCol, iSrc); + sqlite3ExprCodeGeneratedColumn(pParse, pTab, pCol, iSrc); } pCol->colFlags &= ~(COLFLAG_BUSY|COLFLAG_NOTAVAIL); return iSrc; @@ -105227,6 +106625,7 @@ expr_code_doover: iTab = pParse->iSelfTab - 1; } } + assert( ExprUseYTab(pExpr) ); iReg = sqlite3ExprCodeGetColumn(pParse, pExpr->y.pTab, pExpr->iColumn, iTab, target, pExpr->op2); @@ -105304,6 +106703,7 @@ expr_code_doover: sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); inReg = target; } + assert( !ExprHasProperty(pExpr, EP_IntValue) ); sqlite3VdbeAddOp2(v, OP_Cast, target, sqlite3AffinityType(pExpr->u.zToken, 0)); return inReg; @@ -105443,7 +106843,7 @@ expr_code_doover: || NEVER(pExpr->iAgg>=pInfo->nFunc) ){ assert( !ExprHasProperty(pExpr, EP_IntValue) ); - sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); + sqlite3ErrorMsg(pParse, "misuse of aggregate: %#T()", pExpr); }else{ return pInfo->aFunc[pExpr->iAgg].iMem; } @@ -105471,8 +106871,8 @@ expr_code_doover: ** multiple times if we know they always give the same result */ return sqlite3ExprCodeRunJustOnce(pParse, pExpr, -1); } - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); assert( !ExprHasProperty(pExpr, EP_TokenOnly) ); + assert( ExprUseXList(pExpr) ); pFarg = pExpr->x.pList; nFarg = pFarg ? pFarg->nExpr : 0; assert( !ExprHasProperty(pExpr, EP_IntValue) ); @@ -105484,7 +106884,7 @@ expr_code_doover: } #endif if( pDef==0 || pDef->xFinalize!=0 ){ - sqlite3ErrorMsg(pParse, "unknown function: %s()", zId); + sqlite3ErrorMsg(pParse, "unknown function: %#T()", pExpr); break; } if( pDef->funcFlags & SQLITE_FUNC_INLINE ){ @@ -105561,7 +106961,7 @@ expr_code_doover: sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); } #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC - if( pDef->funcFlags & SQLITE_FUNC_OFFSET ){ + if( (pDef->funcFlags & SQLITE_FUNC_OFFSET)!=0 && ALWAYS(pFarg!=0) ){ Expr *pArg = pFarg->a[0].pExpr; if( pArg->op==TK_COLUMN ){ sqlite3VdbeAddOp3(v, OP_Offset, pArg->iTable, pArg->iColumn, target); @@ -105591,7 +106991,10 @@ expr_code_doover: testcase( op==TK_SELECT ); if( pParse->db->mallocFailed ){ return 0; - }else if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){ + }else if( op==TK_SELECT + && ALWAYS( ExprUseXSelect(pExpr) ) + && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 + ){ sqlite3SubselectError(pParse, nCol, 1); }else{ return sqlite3CodeSubselect(pParse, pExpr); @@ -105603,11 +107006,9 @@ expr_code_doover: if( pExpr->pLeft->iTable==0 ){ pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft); } - assert( pExpr->iTable==0 || pExpr->pLeft->op==TK_SELECT - || pExpr->pLeft->op==TK_ERROR ); - if( pExpr->iTable!=0 - && pExpr->iTable!=(n = sqlite3ExprVectorSize(pExpr->pLeft)) - ){ + assert( pExpr->pLeft->op==TK_SELECT || pExpr->pLeft->op==TK_ERROR ); + n = sqlite3ExprVectorSize(pExpr->pLeft); + if( pExpr->iTable!=n ){ sqlite3ErrorMsg(pParse, "%d columns assigned %d values", pExpr->iTable, n); } @@ -105675,9 +107076,14 @@ expr_code_doover: ** p1==1 -> old.a p1==4 -> new.a ** p1==2 -> old.b p1==5 -> new.b */ - Table *pTab = pExpr->y.pTab; - int iCol = pExpr->iColumn; - int p1 = pExpr->iTable * (pTab->nCol+1) + 1 + Table *pTab; + int iCol; + int p1; + + assert( ExprUseYTab(pExpr) ); + pTab = pExpr->y.pTab; + iCol = pExpr->iColumn; + p1 = pExpr->iTable * (pTab->nCol+1) + 1 + sqlite3TableColumnToStorage(pTab, iCol); assert( pExpr->iTable==0 || pExpr->iTable==1 ); @@ -105688,7 +107094,7 @@ expr_code_doover: sqlite3VdbeAddOp2(v, OP_Param, p1, target); VdbeComment((v, "r[%d]=%s.%s", target, (pExpr->iTable ? "new" : "old"), - (pExpr->iColumn<0 ? "rowid" : pExpr->y.pTab->aCol[iCol].zName) + (pExpr->iColumn<0 ? "rowid" : pExpr->y.pTab->aCol[iCol].zCnName) )); #ifndef SQLITE_OMIT_FLOATING_POINT @@ -105765,7 +107171,7 @@ expr_code_doover: Expr *pDel = 0; sqlite3 *db = pParse->db; - assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList ); + assert( ExprUseXList(pExpr) && pExpr->x.pList!=0 ); assert(pExpr->x.pList->nExpr > 0); pEList = pExpr->x.pList; aListelem = pEList->a; @@ -105962,7 +107368,7 @@ SQLITE_PRIVATE void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); if( inReg!=target ){ u8 op; - if( ExprHasProperty(pExpr,EP_Subquery) ){ + if( ALWAYS(pExpr) && ExprHasProperty(pExpr,EP_Subquery) ){ op = OP_Copy; }else{ op = OP_SCopy; @@ -106110,7 +107516,7 @@ static void exprCodeBetween( memset(&compRight, 0, sizeof(Expr)); memset(&exprAnd, 0, sizeof(Expr)); - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); + assert( ExprUseXList(pExpr) ); pDel = sqlite3ExprDup(db, pExpr->pLeft, 0); if( db->mallocFailed==0 ){ exprAnd.op = TK_AND; @@ -106500,7 +107906,11 @@ SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,i ** Otherwise, if the values are not the same or if pExpr is not a simple ** SQL value, zero is returned. */ -static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){ +static int exprCompareVariable( + const Parse *pParse, + const Expr *pVar, + const Expr *pExpr +){ int res = 0; int iVar; sqlite3_value *pL, *pR = 0; @@ -106552,7 +107962,12 @@ static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){ ** Argument pParse should normally be NULL. If it is not NULL and pA or ** pB causes a return value of 2. */ -SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){ +SQLITE_PRIVATE int sqlite3ExprCompare( + const Parse *pParse, + const Expr *pA, + const Expr *pB, + int iTab +){ u32 combinedFlags; if( pA==0 || pB==0 ){ return pB==pA ? 0 : 2; @@ -106576,7 +107991,9 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTa } return 2; } - if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){ + assert( !ExprHasProperty(pA, EP_IntValue) ); + assert( !ExprHasProperty(pB, EP_IntValue) ); + if( pA->u.zToken ){ if( pA->op==TK_FUNCTION || pA->op==TK_AGG_FUNCTION ){ if( sqlite3StrICmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; #ifndef SQLITE_OMIT_WINDOWFUNC @@ -106594,7 +108011,12 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTa return 0; }else if( pA->op==TK_COLLATE ){ if( sqlite3_stricmp(pA->u.zToken,pB->u.zToken)!=0 ) return 2; - }else if( ALWAYS(pB->u.zToken!=0) && strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ + }else + if( pB->u.zToken!=0 + && pA->op!=TK_COLUMN + && pA->op!=TK_AGG_COLUMN + && strcmp(pA->u.zToken,pB->u.zToken)!=0 + ){ return 2; } } @@ -106636,7 +108058,7 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTa ** Two NULL pointers are considered to be the same. But a NULL pointer ** always differs from a non-NULL pointer. */ -SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){ +SQLITE_PRIVATE int sqlite3ExprListCompare(const ExprList *pA, const ExprList *pB, int iTab){ int i; if( pA==0 && pB==0 ) return 0; if( pA==0 || pB==0 ) return 1; @@ -106655,7 +108077,7 @@ SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){ ** Like sqlite3ExprCompare() except COLLATE operators at the top-level ** are ignored. */ -SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){ +SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA,Expr *pB, int iTab){ return sqlite3ExprCompare(0, sqlite3ExprSkipCollateAndLikely(pA), sqlite3ExprSkipCollateAndLikely(pB), @@ -106669,9 +108091,9 @@ SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){ ** non-NULL if pNN is not NULL */ static int exprImpliesNotNull( - Parse *pParse, /* Parsing context */ - Expr *p, /* The expression to be checked */ - Expr *pNN, /* The expression that is NOT NULL */ + const Parse *pParse,/* Parsing context */ + const Expr *p, /* The expression to be checked */ + const Expr *pNN, /* The expression that is NOT NULL */ int iTab, /* Table being evaluated */ int seenNot /* Return true only if p can be any non-NULL value */ ){ @@ -106683,12 +108105,13 @@ static int exprImpliesNotNull( switch( p->op ){ case TK_IN: { if( seenNot && ExprHasProperty(p, EP_xIsSelect) ) return 0; - assert( ExprHasProperty(p,EP_xIsSelect) - || (p->x.pList!=0 && p->x.pList->nExpr>0) ); + assert( ExprUseXSelect(p) || (p->x.pList!=0 && p->x.pList->nExpr>0) ); return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, 1); } case TK_BETWEEN: { - ExprList *pList = p->x.pList; + ExprList *pList; + assert( ExprUseXList(p) ); + pList = p->x.pList; assert( pList!=0 ); assert( pList->nExpr==2 ); if( seenNot ) return 0; @@ -106764,7 +108187,12 @@ static int exprImpliesNotNull( ** improvement. Returning false might cause a performance reduction, but ** it will always give the correct answer and is hence always safe. */ -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){ +SQLITE_PRIVATE int sqlite3ExprImpliesExpr( + const Parse *pParse, + const Expr *pE1, + const Expr *pE2, + int iTab +){ if( sqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){ return 1; } @@ -106860,10 +108288,14 @@ static int impliesNotNullRow(Walker *pWalker, Expr *pExpr){ testcase( pExpr->op==TK_GE ); /* The y.pTab=0 assignment in wherecode.c always happens after the ** impliesNotNullRow() test */ - if( (pLeft->op==TK_COLUMN && ALWAYS(pLeft->y.pTab!=0) - && IsVirtual(pLeft->y.pTab)) - || (pRight->op==TK_COLUMN && ALWAYS(pRight->y.pTab!=0) - && IsVirtual(pRight->y.pTab)) + assert( pLeft->op!=TK_COLUMN || ExprUseYTab(pLeft) ); + assert( pRight->op!=TK_COLUMN || ExprUseYTab(pRight) ); + if( (pLeft->op==TK_COLUMN + && pLeft->y.pTab!=0 + && IsVirtual(pLeft->y.pTab)) + || (pRight->op==TK_COLUMN + && pRight->y.pTab!=0 + && IsVirtual(pRight->y.pTab)) ){ return WRC_Prune; } @@ -106972,88 +108404,125 @@ SQLITE_PRIVATE int sqlite3ExprCoveredByIndex( } -/* -** An instance of the following structure is used by the tree walker -** to count references to table columns in the arguments of an -** aggregate function, in order to implement the -** sqlite3FunctionThisSrc() routine. -*/ -struct SrcCount { - SrcList *pSrc; /* One particular FROM clause in a nested query */ - int iSrcInner; /* Smallest cursor number in this context */ - int nThis; /* Number of references to columns in pSrcList */ - int nOther; /* Number of references to columns in other FROM clauses */ +/* Structure used to pass information throught the Walker in order to +** implement sqlite3ReferencesSrcList(). +*/ +struct RefSrcList { + sqlite3 *db; /* Database connection used for sqlite3DbRealloc() */ + SrcList *pRef; /* Looking for references to these tables */ + i64 nExclude; /* Number of tables to exclude from the search */ + int *aiExclude; /* Cursor IDs for tables to exclude from the search */ }; /* -** xSelect callback for sqlite3FunctionUsesThisSrc(). If this is the first -** SELECT with a FROM clause encountered during this iteration, set -** SrcCount.iSrcInner to the cursor number of the leftmost object in -** the FROM cause. +** Walker SELECT callbacks for sqlite3ReferencesSrcList(). +** +** When entering a new subquery on the pExpr argument, add all FROM clause +** entries for that subquery to the exclude list. +** +** When leaving the subquery, remove those entries from the exclude list. */ -static int selectSrcCount(Walker *pWalker, Select *pSel){ - struct SrcCount *p = pWalker->u.pSrcCount; - if( p->iSrcInner==0x7FFFFFFF && ALWAYS(pSel->pSrc) && pSel->pSrc->nSrc ){ - pWalker->u.pSrcCount->iSrcInner = pSel->pSrc->a[0].iCursor; +static int selectRefEnter(Walker *pWalker, Select *pSelect){ + struct RefSrcList *p = pWalker->u.pRefSrcList; + SrcList *pSrc = pSelect->pSrc; + i64 i, j; + int *piNew; + if( pSrc->nSrc==0 ) return WRC_Continue; + j = p->nExclude; + p->nExclude += pSrc->nSrc; + piNew = sqlite3DbRealloc(p->db, p->aiExclude, p->nExclude*sizeof(int)); + if( piNew==0 ){ + p->nExclude = 0; + return WRC_Abort; + }else{ + p->aiExclude = piNew; + } + for(i=0; inSrc; i++, j++){ + p->aiExclude[j] = pSrc->a[i].iCursor; } return WRC_Continue; } +static void selectRefLeave(Walker *pWalker, Select *pSelect){ + struct RefSrcList *p = pWalker->u.pRefSrcList; + SrcList *pSrc = pSelect->pSrc; + if( p->nExclude ){ + assert( p->nExclude>=pSrc->nSrc ); + p->nExclude -= pSrc->nSrc; + } +} -/* -** Count the number of references to columns. +/* This is the Walker EXPR callback for sqlite3ReferencesSrcList(). +** +** Set the 0x01 bit of pWalker->eCode if there is a reference to any +** of the tables shown in RefSrcList.pRef. +** +** Set the 0x02 bit of pWalker->eCode if there is a reference to a +** table is in neither RefSrcList.pRef nor RefSrcList.aiExclude. */ -static int exprSrcCount(Walker *pWalker, Expr *pExpr){ - /* There was once a NEVER() on the second term on the grounds that - ** sqlite3FunctionUsesThisSrc() was always called before - ** sqlite3ExprAnalyzeAggregates() and so the TK_COLUMNs have not yet - ** been converted into TK_AGG_COLUMN. But this is no longer true due - ** to window functions - sqlite3WindowRewrite() may now indirectly call - ** FunctionUsesThisSrc() when creating a new sub-select. */ - if( pExpr->op==TK_COLUMN || pExpr->op==TK_AGG_COLUMN ){ +static int exprRefToSrcList(Walker *pWalker, Expr *pExpr){ + if( pExpr->op==TK_COLUMN + || pExpr->op==TK_AGG_COLUMN + ){ int i; - struct SrcCount *p = pWalker->u.pSrcCount; - SrcList *pSrc = p->pSrc; + struct RefSrcList *p = pWalker->u.pRefSrcList; + SrcList *pSrc = p->pRef; int nSrc = pSrc ? pSrc->nSrc : 0; for(i=0; iiTable==pSrc->a[i].iCursor ) break; + if( pExpr->iTable==pSrc->a[i].iCursor ){ + pWalker->eCode |= 1; + return WRC_Continue; + } } - if( inThis++; - }else if( pExpr->iTableiSrcInner ){ - /* In a well-formed parse tree (no name resolution errors), - ** TK_COLUMN nodes with smaller Expr.iTable values are in an - ** outer context. Those are the only ones to count as "other" */ - p->nOther++; + for(i=0; inExclude && p->aiExclude[i]!=pExpr->iTable; i++){} + if( i>=p->nExclude ){ + pWalker->eCode |= 2; } } return WRC_Continue; } /* -** Determine if any of the arguments to the pExpr Function reference -** pSrcList. Return true if they do. Also return true if the function -** has no arguments or has only constant arguments. Return false if pExpr -** references columns but not columns of tables found in pSrcList. +** Check to see if pExpr references any tables in pSrcList. +** Possible return values: +** +** 1 pExpr does references a table in pSrcList. +** +** 0 pExpr references some table that is not defined in either +** pSrcList or in subqueries of pExpr itself. +** +** -1 pExpr only references no tables at all, or it only +** references tables defined in subqueries of pExpr itself. +** +** As currently used, pExpr is always an aggregate function call. That +** fact is exploited for efficiency. */ -SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){ +SQLITE_PRIVATE int sqlite3ReferencesSrcList(Parse *pParse, Expr *pExpr, SrcList *pSrcList){ Walker w; - struct SrcCount cnt; - assert( pExpr->op==TK_AGG_FUNCTION ); + struct RefSrcList x; memset(&w, 0, sizeof(w)); - w.xExprCallback = exprSrcCount; - w.xSelectCallback = selectSrcCount; - w.u.pSrcCount = &cnt; - cnt.pSrc = pSrcList; - cnt.iSrcInner = (pSrcList&&pSrcList->nSrc)?pSrcList->a[0].iCursor:0x7FFFFFFF; - cnt.nThis = 0; - cnt.nOther = 0; + memset(&x, 0, sizeof(x)); + w.xExprCallback = exprRefToSrcList; + w.xSelectCallback = selectRefEnter; + w.xSelectCallback2 = selectRefLeave; + w.u.pRefSrcList = &x; + x.db = pParse->db; + x.pRef = pSrcList; + assert( pExpr->op==TK_AGG_FUNCTION ); + assert( ExprUseXList(pExpr) ); sqlite3WalkExprList(&w, pExpr->x.pList); #ifndef SQLITE_OMIT_WINDOWFUNC if( ExprHasProperty(pExpr, EP_WinFunc) ){ sqlite3WalkExpr(&w, pExpr->y.pWin->pFilter); } #endif - return cnt.nThis>0 || cnt.nOther==0; + sqlite3DbFree(pParse->db, x.aiExclude); + if( w.eCode & 0x01 ){ + return 1; + }else if( w.eCode ){ + return 0; + }else{ + return -1; + } } /* @@ -107188,6 +108657,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ && (k = addAggInfoColumn(pParse->db, pAggInfo))>=0 ){ pCol = &pAggInfo->aCol[k]; + assert( ExprUseYTab(pExpr) ); pCol->pTab = pExpr->y.pTab; pCol->iTable = pExpr->iTable; pCol->iColumn = pExpr->iColumn; @@ -107251,7 +108721,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ pItem = &pAggInfo->aFunc[i]; pItem->pFExpr = pExpr; pItem->iMem = ++pParse->nMem; - assert( !ExprHasProperty(pExpr, EP_IntValue) ); + assert( ExprUseUToken(pExpr) ); pItem->pFunc = sqlite3FindFunction(pParse->db, pExpr->u.zToken, pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0); @@ -107466,7 +108936,7 @@ static void renameTestSchema( pParse->colNamesSet = 1; sqlite3NestedParse(pParse, "SELECT 1 " - "FROM \"%w\"." DFLT_SCHEMA_TABLE " " + "FROM \"%w\"." LEGACY_SCHEMA_TABLE " " "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'" " AND sql NOT LIKE 'create virtual%%'" " AND sqlite_rename_test(%Q, sql, type, name, %d, %Q, %d)=NULL ", @@ -107477,7 +108947,7 @@ static void renameTestSchema( if( bTemp==0 ){ sqlite3NestedParse(pParse, "SELECT 1 " - "FROM temp." DFLT_SCHEMA_TABLE " " + "FROM temp." LEGACY_SCHEMA_TABLE " " "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'" " AND sql NOT LIKE 'create virtual%%'" " AND sqlite_rename_test(%Q, sql, type, name, 1, %Q, %d)=NULL ", @@ -107495,14 +108965,14 @@ static void renameTestSchema( */ static void renameFixQuotes(Parse *pParse, const char *zDb, int bTemp){ sqlite3NestedParse(pParse, - "UPDATE \"%w\"." DFLT_SCHEMA_TABLE + "UPDATE \"%w\"." LEGACY_SCHEMA_TABLE " SET sql = sqlite_rename_quotefix(%Q, sql)" "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'" " AND sql NOT LIKE 'create virtual%%'" , zDb, zDb ); if( bTemp==0 ){ sqlite3NestedParse(pParse, - "UPDATE temp." DFLT_SCHEMA_TABLE + "UPDATE temp." LEGACY_SCHEMA_TABLE " SET sql = sqlite_rename_quotefix('temp', sql)" "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X'" " AND sql NOT LIKE 'create virtual%%'" @@ -107541,9 +109011,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( const char *zTabName; /* Original name of the table */ Vdbe *v; VTable *pVTab = 0; /* Non-zero if this is a v-tab with an xRename() */ - u32 savedDbFlags; /* Saved value of db->mDbFlags */ - savedDbFlags = db->mDbFlags; if( NEVER(db->mallocFailed) ) goto exit_rename_table; assert( pSrc->nSrc==1 ); assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); @@ -107552,7 +109020,6 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( if( !pTab ) goto exit_rename_table; iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); zDb = db->aDb[iDb].zDbSName; - db->mDbFlags |= DBFLAG_PreferBuiltin; /* Get a NULL terminated version of the new table name. */ zName = sqlite3NameFromToken(db, pName); @@ -107581,7 +109048,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( } #ifndef SQLITE_OMIT_VIEW - if( pTab->pSelect ){ + if( IsView(pTab) ){ sqlite3ErrorMsg(pParse, "view %s may not be altered", pTab->zName); goto exit_rename_table; } @@ -107623,7 +109090,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ sqlite3NestedParse(pParse, - "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET " + "UPDATE \"%w\"." LEGACY_SCHEMA_TABLE " SET " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) " "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)" "AND name NOT LIKE 'sqliteX_%%' ESCAPE 'X'" @@ -107633,7 +109100,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( /* Update the tbl_name and name columns of the sqlite_schema table ** as required. */ sqlite3NestedParse(pParse, - "UPDATE %Q." DFLT_SCHEMA_TABLE " SET " + "UPDATE %Q." LEGACY_SCHEMA_TABLE " SET " "tbl_name = %Q, " "name = CASE " "WHEN type='table' THEN %Q " @@ -107693,7 +109160,6 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable( exit_rename_table: sqlite3SrcListDelete(db, pSrc); sqlite3DbFree(db, zName); - db->mDbFlags = savedDbFlags; } /* @@ -107734,7 +109200,9 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ int r1; /* Temporary registers */ db = pParse->db; - if( pParse->nErr || db->mallocFailed ) return; + assert( db->pParse==pParse ); + if( pParse->nErr ) return; + assert( db->mallocFailed==0 ); pNew = pParse->pNewTable; assert( pNew ); @@ -107743,7 +109211,7 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ zDb = db->aDb[iDb].zDbSName; zTab = &pNew->zName[16]; /* Skip the "sqlite_altertab_" prefix on the name */ pCol = &pNew->aCol[pNew->nCol-1]; - pDflt = pCol->pDflt; + pDflt = sqlite3ColumnExpr(pNew, pCol); pTab = sqlite3FindTable(db, zTab, zDb); assert( pTab ); @@ -107777,7 +109245,8 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ if( pDflt && pDflt->pLeft->op==TK_NULL ){ pDflt = 0; } - if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){ + assert( IsOrdinaryTable(pNew) ); + if( (db->flags&SQLITE_ForeignKeys) && pNew->u.tab.pFKey && pDflt ){ sqlite3ErrorIfNotEmpty(pParse, zDb, zTab, "Cannot add a REFERENCES column with non-NULL default value"); } @@ -107814,31 +109283,30 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n); if( zCol ){ char *zEnd = &zCol[pColDef->n-1]; - u32 savedDbFlags = db->mDbFlags; while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){ *zEnd-- = '\0'; } - db->mDbFlags |= DBFLAG_PreferBuiltin; /* substr() operations on characters, but addColOffset is in bytes. So we ** have to use printf() to translate between these units: */ + assert( IsOrdinaryTable(pTab) ); + assert( IsOrdinaryTable(pNew) ); sqlite3NestedParse(pParse, - "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET " + "UPDATE \"%w\"." LEGACY_SCHEMA_TABLE " SET " "sql = printf('%%.%ds, ',sql) || %Q" " || substr(sql,1+length(printf('%%.%ds',sql))) " "WHERE type = 'table' AND name = %Q", - zDb, pNew->addColOffset, zCol, pNew->addColOffset, + zDb, pNew->u.tab.addColOffset, zCol, pNew->u.tab.addColOffset, zTab ); sqlite3DbFree(db, zCol); - db->mDbFlags = savedDbFlags; } - /* Make sure the schema version is at least 3. But do not upgrade - ** from less than 3 to 4, as that will corrupt any preexisting DESC - ** index. - */ v = sqlite3GetVdbe(pParse); if( v ){ + /* Make sure the schema version is at least 3. But do not upgrade + ** from less than 3 to 4, as that will corrupt any preexisting DESC + ** index. + */ r1 = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); sqlite3VdbeUsesBtree(v, iDb); @@ -107847,10 +109315,25 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, 3); sqlite3ReleaseTempReg(pParse, r1); - } - /* Reload the table definition */ - renameReloadSchema(pParse, iDb, INITFLAG_AlterRename); + /* Reload the table definition */ + renameReloadSchema(pParse, iDb, INITFLAG_AlterAdd); + + /* Verify that constraints are still satisfied */ + if( pNew->pCheck!=0 + || (pCol->notNull && (pCol->colFlags & COLFLAG_GENERATED)!=0) + ){ + sqlite3NestedParse(pParse, + "SELECT CASE WHEN quick_check GLOB 'CHECK*'" + " THEN raise(ABORT,'CHECK constraint failed')" + " ELSE raise(ABORT,'NOT NULL constraint failed')" + " END" + " FROM pragma_quick_check(%Q,%Q)" + " WHERE quick_check GLOB 'CHECK*' OR quick_check GLOB 'NULL*'", + zTab, zDb + ); + } + } } /* @@ -107891,7 +109374,7 @@ SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ #endif /* Make sure this is not an attempt to ALTER a view. */ - if( pTab->pSelect ){ + if( IsView(pTab) ){ sqlite3ErrorMsg(pParse, "Cannot add a column to a view"); goto exit_begin_add_column; } @@ -107900,7 +109383,8 @@ SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ } sqlite3MayAbort(pParse); - assert( pTab->addColOffset>0 ); + assert( IsOrdinaryTable(pTab) ); + assert( pTab->u.tab.addColOffset>0 ); iDb = sqlite3SchemaToIndex(db, pTab->pSchema); /* Put a copy of the Table struct in Parse.pNewTable for the @@ -107927,13 +109411,13 @@ SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol); for(i=0; inCol; i++){ Column *pCol = &pNew->aCol[i]; - pCol->zName = sqlite3DbStrDup(db, pCol->zName); - pCol->hName = sqlite3StrIHash(pCol->zName); - pCol->zColl = 0; - pCol->pDflt = 0; + pCol->zCnName = sqlite3DbStrDup(db, pCol->zCnName); + pCol->hName = sqlite3StrIHash(pCol->zCnName); } + assert( IsOrdinaryTable(pNew) ); + pNew->u.tab.pDfltList = sqlite3ExprListDup(db, pTab->u.tab.pDfltList, 0); pNew->pSchema = db->aDb[iDb].pSchema; - pNew->addColOffset = pTab->addColOffset; + pNew->u.tab.addColOffset = pTab->u.tab.addColOffset; pNew->nTabRef = 1; exit_begin_add_column: @@ -107953,7 +109437,7 @@ exit_begin_add_column: static int isRealTable(Parse *pParse, Table *pTab, int bDrop){ const char *zType = 0; #ifndef SQLITE_OMIT_VIEW - if( pTab->pSelect ){ + if( IsView(pTab) ){ zType = "view"; } #endif @@ -108020,10 +109504,10 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( zOld = sqlite3NameFromToken(db, pOld); if( !zOld ) goto exit_rename_column; for(iCol=0; iColnCol; iCol++){ - if( 0==sqlite3StrICmp(pTab->aCol[iCol].zName, zOld) ) break; + if( 0==sqlite3StrICmp(pTab->aCol[iCol].zCnName, zOld) ) break; } if( iCol==pTab->nCol ){ - sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zOld); + sqlite3ErrorMsg(pParse, "no such column: \"%T\"", pOld); goto exit_rename_column; } @@ -108041,18 +109525,17 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( assert( pNew->n>0 ); bQuote = sqlite3Isquote(pNew->z[0]); sqlite3NestedParse(pParse, - "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET " + "UPDATE \"%w\"." LEGACY_SCHEMA_TABLE " SET " "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) " "WHERE name NOT LIKE 'sqliteX_%%' ESCAPE 'X' " - " AND (type != 'index' OR tbl_name = %Q)" - " AND sql NOT LIKE 'create virtual%%'", + " AND (type != 'index' OR tbl_name = %Q)", zDb, zDb, pTab->zName, iCol, zNew, bQuote, iSchema==1, pTab->zName ); sqlite3NestedParse(pParse, - "UPDATE temp." DFLT_SCHEMA_TABLE " SET " + "UPDATE temp." LEGACY_SCHEMA_TABLE " SET " "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, 1) " "WHERE type IN ('trigger', 'view')", zDb, pTab->zName, iCol, zNew, bQuote @@ -108087,7 +109570,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameColumn( ** the parse tree. */ struct RenameToken { - void *p; /* Parse tree element created by token t */ + const void *p; /* Parse tree element created by token t */ Token t; /* The token that created parse tree element p */ RenameToken *pNext; /* Next is a list of all RenameToken objects */ }; @@ -108129,9 +109612,11 @@ struct RenameCtx { ** Technically, as x no longer points into a valid object or to the byte ** following a valid object, it may not be used in comparison operations. */ -static void renameTokenCheckAll(Parse *pParse, void *pPtr){ - if( pParse->nErr==0 && pParse->db->mallocFailed==0 ){ - RenameToken *p; +static void renameTokenCheckAll(Parse *pParse, const void *pPtr){ + assert( pParse==pParse->db->pParse ); + assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 ); + if( pParse->nErr==0 ){ + const RenameToken *p; u8 i = 0; for(p=pParse->pRename; p; p=p->pNext){ if( p->p ){ @@ -108157,7 +109642,11 @@ static void renameTokenCheckAll(Parse *pParse, void *pPtr){ ** with tail recursion in tokenExpr() routine, for a small performance ** improvement. */ -SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pToken){ +SQLITE_PRIVATE const void *sqlite3RenameTokenMap( + Parse *pParse, + const void *pPtr, + const Token *pToken +){ RenameToken *pNew; assert( pPtr || pParse->db->mallocFailed ); renameTokenCheckAll(pParse, pPtr); @@ -108179,7 +109668,7 @@ SQLITE_PRIVATE void *sqlite3RenameTokenMap(Parse *pParse, void *pPtr, Token *pTo ** with parse tree element pFrom. This function remaps the associated token ** to parse tree element pTo. */ -SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFrom){ +SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse *pParse, const void *pTo, const void *pFrom){ RenameToken *p; renameTokenCheckAll(pParse, pTo); for(p=pParse->pRename; p; p=p->pNext){ @@ -108195,7 +109684,10 @@ SQLITE_PRIVATE void sqlite3RenameTokenRemap(Parse *pParse, void *pTo, void *pFro */ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ Parse *pParse = pWalker->pParse; - sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); + sqlite3RenameTokenRemap(pParse, 0, (const void*)pExpr); + if( ExprUseYTab(pExpr) ){ + sqlite3RenameTokenRemap(pParse, 0, (const void*)&pExpr->y.pTab); + } return WRC_Continue; } @@ -108225,6 +109717,7 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){ memset(&sNC, 0, sizeof(sNC)); sNC.pParse = pParse; if( pCopy ) sqlite3SelectPrep(sNC.pParse, p, &sNC); + if( sNC.pParse->db->mallocFailed ) return; sqlite3WalkSelect(pWalker, p); sqlite3RenameExprlistUnmap(pParse, pWith->a[i].pCols); } @@ -108239,12 +109732,12 @@ static void renameWalkWith(Walker *pWalker, Select *pSelect){ */ static void unmapColumnIdlistNames( Parse *pParse, - IdList *pIdList + const IdList *pIdList ){ if( pIdList ){ int ii; for(ii=0; iinId; ii++){ - sqlite3RenameTokenRemap(pParse, 0, (void*)pIdList->a[ii].zName); + sqlite3RenameTokenRemap(pParse, 0, (const void*)pIdList->a[ii].zName); } } } @@ -108256,9 +109749,9 @@ static int renameUnmapSelectCb(Walker *pWalker, Select *p){ Parse *pParse = pWalker->pParse; int i; if( pParse->nErr ) return WRC_Abort; + testcase( p->selFlags & SF_View ); + testcase( p->selFlags & SF_CopyCte ); if( p->selFlags & (SF_View|SF_CopyCte) ){ - testcase( p->selFlags & SF_View ); - testcase( p->selFlags & SF_CopyCte ); return WRC_Prune; } if( ALWAYS(p->pEList) ){ @@ -108273,7 +109766,7 @@ static int renameUnmapSelectCb(Walker *pWalker, Select *p){ SrcList *pSrc = p->pSrc; for(i=0; inSrc; i++){ sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName); - if( sqlite3WalkExpr(pWalker, pSrc->a[i].pOn) ) return WRC_Abort; + sqlite3WalkExpr(pWalker, pSrc->a[i].pOn); unmapColumnIdlistNames(pParse, pSrc->a[i].pUsing); } } @@ -108341,7 +109834,7 @@ static void renameTokenFree(sqlite3 *db, RenameToken *pToken){ static RenameToken *renameTokenFind( Parse *pParse, struct RenameCtx *pCtx, - void *pPtr + const void *pPtr ){ RenameToken **pp; if( NEVER(pPtr==0) ){ @@ -108395,6 +109888,7 @@ static int renameColumnExprCb(Walker *pWalker, Expr *pExpr){ renameTokenFind(pWalker->pParse, p, (void*)pExpr); }else if( pExpr->op==TK_COLUMN && pExpr->iColumn==p->iCol + && ALWAYS(ExprUseYTab(pExpr)) && p->pTab==pExpr->y.pTab ){ renameTokenFind(pWalker->pParse, p, (void*)pExpr); @@ -108443,12 +109937,12 @@ static void renameColumnParseError( const char *zN = (const char*)sqlite3_value_text(pObject); char *zErr; - zErr = sqlite3_mprintf("error in %s %s%s%s: %s", + zErr = sqlite3MPrintf(pParse->db, "error in %s %s%s%s: %s", zT, zN, (zWhen[0] ? " " : ""), zWhen, pParse->zErrMsg ); sqlite3_result_error(pCtx, zErr, -1); - sqlite3_free(zErr); + sqlite3DbFree(pParse->db, zErr); } /* @@ -108460,18 +109954,18 @@ static void renameColumnParseError( static void renameColumnElistNames( Parse *pParse, RenameCtx *pCtx, - ExprList *pEList, + const ExprList *pEList, const char *zOld ){ if( pEList ){ int i; for(i=0; inExpr; i++){ - char *zName = pEList->a[i].zEName; + const char *zName = pEList->a[i].zEName; if( ALWAYS(pEList->a[i].eEName==ENAME_NAME) && ALWAYS(zName!=0) && 0==sqlite3_stricmp(zName, zOld) ){ - renameTokenFind(pParse, pCtx, (void*)zName); + renameTokenFind(pParse, pCtx, (const void*)zName); } } } @@ -108485,15 +109979,15 @@ static void renameColumnElistNames( static void renameColumnIdlistNames( Parse *pParse, RenameCtx *pCtx, - IdList *pIdList, + const IdList *pIdList, const char *zOld ){ if( pIdList ){ int i; for(i=0; inId; i++){ - char *zName = pIdList->a[i].zName; + const char *zName = pIdList->a[i].zName; if( 0==sqlite3_stricmp(zName, zOld) ){ - renameTokenFind(pParse, pCtx, (void*)zName); + renameTokenFind(pParse, pCtx, (const void*)zName); } } } @@ -108512,24 +110006,22 @@ static int renameParseSql( int bTemp /* True if SQL is from temp schema */ ){ int rc; - char *zErr = 0; + sqlite3ParseObjectInit(p, db); + if( zSql==0 ){ + return SQLITE_NOMEM; + } + if( sqlite3StrNICmp(zSql,"CREATE ",7)!=0 ){ + return SQLITE_CORRUPT_BKPT; + } db->init.iDb = bTemp ? 1 : sqlite3FindDbName(db, zDb); - - /* Parse the SQL statement passed as the first argument. If no error - ** occurs and the parse does not result in a new table, index or - ** trigger object, the database must be corrupt. */ - memset(p, 0, sizeof(Parse)); p->eParseMode = PARSE_MODE_RENAME; p->db = db; p->nQueryLoop = 1; - rc = zSql ? sqlite3RunParser(p, zSql, &zErr) : SQLITE_NOMEM; - assert( p->zErrMsg==0 ); - assert( rc!=SQLITE_OK || zErr==0 ); - p->zErrMsg = zErr; + rc = sqlite3RunParser(p, zSql); if( db->mallocFailed ) rc = SQLITE_NOMEM; if( rc==SQLITE_OK - && p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0 + && NEVER(p->pNewTable==0 && p->pNewIndex==0 && p->pNewTrigger==0) ){ rc = SQLITE_CORRUPT_BKPT; } @@ -108719,6 +110211,9 @@ static int renameResolveTrigger(Parse *pParse){ } } } + if( rc==SQLITE_OK && db->mallocFailed ){ + rc = SQLITE_NOMEM; + } sNC.pSrcList = pSrc; if( rc==SQLITE_OK && pStep->pWhere ){ rc = sqlite3ResolveExprNames(&sNC, pStep->pWhere); @@ -108804,13 +110299,13 @@ static void renameParseCleanup(Parse *pParse){ sqlite3DeleteTrigger(db, pParse->pNewTrigger); sqlite3DbFree(db, pParse->zErrMsg); renameTokenFree(db, pParse->pRename); - sqlite3ParserReset(pParse); + sqlite3ParseObjectReset(pParse); } /* ** SQL function: ** -** sqlite_rename_column(zSql, iCol, bQuote, zNew, zTable, zOld) +** sqlite_rename_column(SQL,TYPE,OBJ,DB,TABLE,COL,NEWNAME,QUOTE,TEMP) ** ** 0. zSql: SQL statement to rewrite ** 1. type: Type of object ("table", "view" etc.) @@ -108828,7 +110323,8 @@ static void renameParseCleanup(Parse *pParse){ ** ** This function is used internally by the ALTER TABLE RENAME COLUMN command. ** It is only accessible to SQL created using sqlite3NestedParse(). It is -** not reachable from ordinary SQL passed into sqlite3_prepare(). +** not reachable from ordinary SQL passed into sqlite3_prepare() unless the +** SQLITE_TESTCTRL_INTERNAL_FUNCTIONS test setting is enabled. */ static void renameColumnFunc( sqlite3_context *context, @@ -108866,7 +110362,7 @@ static void renameColumnFunc( sqlite3BtreeLeaveAll(db); return; } - zOld = pTab->aCol[iCol].zName; + zOld = pTab->aCol[iCol].zCnName; memset(&sCtx, 0, sizeof(sCtx)); sCtx.iCol = ((iCol==pTab->iPKey) ? -1 : iCol); @@ -108885,8 +110381,8 @@ static void renameColumnFunc( sCtx.pTab = pTab; if( rc!=SQLITE_OK ) goto renameColumnFunc_done; if( sParse.pNewTable ){ - Select *pSelect = sParse.pNewTable->pSelect; - if( pSelect ){ + if( IsView(sParse.pNewTable) ){ + Select *pSelect = sParse.pNewTable->u.view.pSelect; pSelect->selFlags &= ~SF_View; sParse.rc = SQLITE_OK; sqlite3SelectPrep(&sParse, pSelect, 0); @@ -108895,16 +110391,15 @@ static void renameColumnFunc( sqlite3WalkSelect(&sWalker, pSelect); } if( rc!=SQLITE_OK ) goto renameColumnFunc_done; - }else{ + }else if( IsOrdinaryTable(sParse.pNewTable) ){ /* A regular table */ int bFKOnly = sqlite3_stricmp(zTable, sParse.pNewTable->zName); FKey *pFKey; - assert( sParse.pNewTable->pSelect==0 ); sCtx.pTab = sParse.pNewTable; if( bFKOnly==0 ){ if( iColnCol ){ renameTokenFind( - &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zName + &sParse, &sCtx, (void*)sParse.pNewTable->aCol[iCol].zCnName ); } if( sCtx.iCol<0 ){ @@ -108919,12 +110414,15 @@ static void renameColumnFunc( } #ifndef SQLITE_OMIT_GENERATED_COLUMNS for(i=0; inCol; i++){ - sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt); + Expr *pExpr = sqlite3ColumnExpr(sParse.pNewTable, + &sParse.pNewTable->aCol[i]); + sqlite3WalkExpr(&sWalker, pExpr); } #endif } - for(pFKey=sParse.pNewTable->pFKey; pFKey; pFKey=pFKey->pNextFrom){ + assert( IsOrdinaryTable(sParse.pNewTable) ); + for(pFKey=sParse.pNewTable->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){ for(i=0; inCol; i++){ if( bFKOnly==0 && pFKey->aCol[i].iFrom==iCol ){ renameTokenFind(&sParse, &sCtx, (void*)&pFKey->aCol[i]); @@ -108975,7 +110473,9 @@ static void renameColumnFunc( renameColumnFunc_done: if( rc!=SQLITE_OK ){ - if( sParse.zErrMsg ){ + if( rc==SQLITE_ERROR && sqlite3WritableSchema(db) ){ + sqlite3_result_value(context, argv[0]); + }else if( sParse.zErrMsg ){ renameColumnParseError(context, "", argv[1], argv[2], &sParse); }else{ sqlite3_result_error_code(context, rc); @@ -108995,7 +110495,10 @@ renameColumnFunc_done: */ static int renameTableExprCb(Walker *pWalker, Expr *pExpr){ RenameCtx *p = pWalker->u.pRename; - if( pExpr->op==TK_COLUMN && p->pTab==pExpr->y.pTab ){ + if( pExpr->op==TK_COLUMN + && ALWAYS(ExprUseYTab(pExpr)) + && p->pTab==pExpr->y.pTab + ){ renameTokenFind(pWalker->pParse, p, (void*)&pExpr->y.pTab); } return WRC_Continue; @@ -109090,28 +110593,31 @@ static void renameTableFunc( if( sParse.pNewTable ){ Table *pTab = sParse.pNewTable; - if( pTab->pSelect ){ + if( IsView(pTab) ){ if( isLegacy==0 ){ - Select *pSelect = pTab->pSelect; + Select *pSelect = pTab->u.view.pSelect; NameContext sNC; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = &sParse; assert( pSelect->selFlags & SF_View ); pSelect->selFlags &= ~SF_View; - sqlite3SelectPrep(&sParse, pTab->pSelect, &sNC); + sqlite3SelectPrep(&sParse, pTab->u.view.pSelect, &sNC); if( sParse.nErr ){ rc = sParse.rc; }else{ - sqlite3WalkSelect(&sWalker, pTab->pSelect); + sqlite3WalkSelect(&sWalker, pTab->u.view.pSelect); } } }else{ /* Modify any FK definitions to point to the new table. */ #ifndef SQLITE_OMIT_FOREIGN_KEY - if( isLegacy==0 || (db->flags & SQLITE_ForeignKeys) ){ + if( (isLegacy==0 || (db->flags & SQLITE_ForeignKeys)) + && !IsVirtual(pTab) + ){ FKey *pFKey; - for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ + assert( IsOrdinaryTable(pTab) ); + for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){ if( sqlite3_stricmp(pFKey->zTo, zOld)==0 ){ renameTokenFind(&sParse, &sCtx, (void*)pFKey->zTo); } @@ -109168,7 +110674,9 @@ static void renameTableFunc( rc = renameEditSql(context, &sCtx, zInput, zNew, bQuote); } if( rc!=SQLITE_OK ){ - if( sParse.zErrMsg ){ + if( rc==SQLITE_ERROR && sqlite3WritableSchema(db) ){ + sqlite3_result_value(context, argv[3]); + }else if( sParse.zErrMsg ){ renameColumnParseError(context, "", argv[1], argv[2], &sParse); }else{ sqlite3_result_error_code(context, rc); @@ -109188,15 +110696,15 @@ static void renameTableFunc( static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){ if( pExpr->op==TK_STRING && (pExpr->flags & EP_DblQuoted) ){ - renameTokenFind(pWalker->pParse, pWalker->u.pRename, (void*)pExpr); + renameTokenFind(pWalker->pParse, pWalker->u.pRename, (const void*)pExpr); } return WRC_Continue; } -/* -** The implementation of an SQL scalar function that rewrites DDL statements -** so that any string literals that use double-quotes are modified so that -** they use single quotes. +/* SQL function: sqlite_rename_quotefix(DB,SQL) +** +** Rewrite the DDL statement "SQL" so that any string literals that use +** double-quotes use single quotes instead. ** ** Two arguments must be passed: ** @@ -109215,6 +110723,10 @@ static int renameQuotefixExprCb(Walker *pWalker, Expr *pExpr){ ** returns the string: ** ** CREATE VIEW v1 AS SELECT "a", 'string' FROM t1 +** +** If there is a error in the input SQL, then raise an error, except +** if PRAGMA writable_schema=ON, then just return the input string +** unmodified following an error. */ static void renameQuotefixFunc( sqlite3_context *context, @@ -109251,8 +110763,8 @@ static void renameQuotefixFunc( sWalker.u.pRename = &sCtx; if( sParse.pNewTable ){ - Select *pSelect = sParse.pNewTable->pSelect; - if( pSelect ){ + if( IsView(sParse.pNewTable) ){ + Select *pSelect = sParse.pNewTable->u.view.pSelect; pSelect->selFlags &= ~SF_View; sParse.rc = SQLITE_OK; sqlite3SelectPrep(&sParse, pSelect, 0); @@ -109265,7 +110777,9 @@ static void renameQuotefixFunc( sqlite3WalkExprList(&sWalker, sParse.pNewTable->pCheck); #ifndef SQLITE_OMIT_GENERATED_COLUMNS for(i=0; inCol; i++){ - sqlite3WalkExpr(&sWalker, sParse.pNewTable->aCol[i].pDflt); + sqlite3WalkExpr(&sWalker, + sqlite3ColumnExpr(sParse.pNewTable, + &sParse.pNewTable->aCol[i])); } #endif /* SQLITE_OMIT_GENERATED_COLUMNS */ } @@ -109287,7 +110801,11 @@ static void renameQuotefixFunc( renameTokenFree(db, sCtx.pList); } if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(context, rc); + if( sqlite3WritableSchema(db) && rc==SQLITE_ERROR ){ + sqlite3_result_value(context, argv[1]); + }else{ + sqlite3_result_error_code(context, rc); + } } renameParseCleanup(&sParse); } @@ -109299,7 +110817,8 @@ static void renameQuotefixFunc( sqlite3BtreeLeaveAll(db); } -/* +/* Function: sqlite_rename_test(DB,SQL,TYPE,NAME,ISTEMP,WHEN,DQS) +** ** An SQL user function that checks that there are no parse or symbol ** resolution problems in a CREATE TRIGGER|TABLE|VIEW|INDEX statement. ** After an ALTER TABLE .. RENAME operation is performed and the schema @@ -109314,11 +110833,13 @@ static void renameQuotefixFunc( ** 5: "when" part of error message. ** 6: True to disable the DQS quirk when parsing SQL. ** -** Unless it finds an error, this function normally returns NULL. However, it -** returns integer value 1 if: +** The return value is computed as follows: ** -** * the SQL argument creates a trigger, and -** * the table that the trigger is attached to is in database zDb. +** A. If an error is seen and not in PRAGMA writable_schema=ON mode, +** then raise the error. +** B. Else if a trigger is created and the the table that the trigger is +** attached to is in database zDb, then return 1. +** C. Otherwise return NULL. */ static void renameTableTest( sqlite3_context *context, @@ -109348,11 +110869,11 @@ static void renameTableTest( rc = renameParseSql(&sParse, zDb, db, zInput, bTemp); db->flags |= (flags & (SQLITE_DqsDML|SQLITE_DqsDDL)); if( rc==SQLITE_OK ){ - if( isLegacy==0 && sParse.pNewTable && sParse.pNewTable->pSelect ){ + if( isLegacy==0 && sParse.pNewTable && IsView(sParse.pNewTable) ){ NameContext sNC; memset(&sNC, 0, sizeof(sNC)); sNC.pParse = &sParse; - sqlite3SelectPrep(&sParse, sParse.pNewTable->pSelect, &sNC); + sqlite3SelectPrep(&sParse, sParse.pNewTable->u.view.pSelect, &sNC); if( sParse.nErr ) rc = sParse.rc; } @@ -109363,12 +110884,16 @@ static void renameTableTest( if( rc==SQLITE_OK ){ int i1 = sqlite3SchemaToIndex(db, sParse.pNewTrigger->pTabSchema); int i2 = sqlite3FindDbName(db, zDb); - if( i1==i2 ) sqlite3_result_int(context, 1); + if( i1==i2 ){ + /* Handle output case B */ + sqlite3_result_int(context, 1); + } } } } - if( rc!=SQLITE_OK && zWhen ){ + if( rc!=SQLITE_OK && zWhen && !sqlite3WritableSchema(db) ){ + /* Output case A */ renameColumnParseError(context, zWhen, argv[2], argv[3],&sParse); } renameParseCleanup(&sParse); @@ -109423,13 +110948,14 @@ static void dropColumnFunc( goto drop_column_done; } - pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zName); + pCol = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol].zCnName); if( iColnCol-1 ){ RenameToken *pEnd; - pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zName); + pEnd = renameTokenFind(&sParse, 0, (void*)pTab->aCol[iCol+1].zCnName); zEnd = (const char*)pEnd->t.z; }else{ - zEnd = (const char*)&zSql[pTab->addColOffset]; + assert( IsOrdinaryTable(pTab) ); + zEnd = (const char*)&zSql[pTab->u.tab.addColOffset]; while( ALWAYS(pCol->t.z[0]!=0) && pCol->t.z[0]!=',' ) pCol->t.z--; } @@ -109455,7 +110981,7 @@ drop_column_done: ** statement. Argument pSrc contains the possibly qualified name of the ** table being edited, and token pName the name of the column to drop. */ -SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token *pName){ +SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, const Token *pName){ sqlite3 *db = pParse->db; /* Database handle */ Table *pTab; /* Table to modify */ int iDb; /* Index of db containing pTab in aDb[] */ @@ -109483,7 +111009,7 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token * } iCol = sqlite3ColumnIndex(pTab, zCol); if( iCol<0 ){ - sqlite3ErrorMsg(pParse, "no such column: \"%s\"", zCol); + sqlite3ErrorMsg(pParse, "no such column: \"%T\"", pName); goto exit_drop_column; } @@ -109507,10 +111033,16 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token * iDb = sqlite3SchemaToIndex(db, pTab->pSchema); assert( iDb>=0 ); zDb = db->aDb[iDb].zDbSName; +#ifndef SQLITE_OMIT_AUTHORIZATION + /* Invoke the authorization callback. */ + if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, zCol) ){ + goto exit_drop_column; + } +#endif renameTestSchema(pParse, zDb, iDb==1, "", 0); renameFixQuotes(pParse, zDb, iDb==1); sqlite3NestedParse(pParse, - "UPDATE \"%w\"." DFLT_SCHEMA_TABLE " SET " + "UPDATE \"%w\"." LEGACY_SCHEMA_TABLE " SET " "sql = sqlite_drop_column(%d, sql, %d) " "WHERE (type=='table' AND tbl_name=%Q COLLATE nocase)" , zDb, iDb, iCol, pTab->zName @@ -109565,6 +111097,12 @@ SQLITE_PRIVATE void sqlite3AlterDropColumn(Parse *pParse, SrcList *pSrc, Token * nField++; } } + if( nField==0 ){ + /* dbsqlfuzz 5f09e7bcc78b4954d06bf9f2400d7715f48d1fef */ + pParse->nMem++; + sqlite3VdbeAddOp2(v, OP_Null, 0, reg+1); + nField = 1; + } sqlite3VdbeAddOp3(v, OP_MakeRecord, reg+1, nField, regRec); if( pPk ){ sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iCur, regRec, reg+1, pPk->nKeyCol); @@ -110034,7 +111572,6 @@ static void statInit( + sizeof(tRowcnt)*3*nColUp*(nCol+mxSample); } #endif - db = sqlite3_context_db_handle(context); p = sqlite3DbMallocZero(db, n); if( p==0 ){ sqlite3_result_error_nomem(context); @@ -110453,28 +111990,19 @@ static void statGet( ** ** I = (K+D-1)/D */ - char *z; - int i; - - char *zRet = sqlite3MallocZero( (p->nKeyCol+1)*25 ); - if( zRet==0 ){ - sqlite3_result_error_nomem(context); - return; - } + sqlite3_str sStat; /* Text of the constructed "stat" line */ + int i; /* Loop counter */ - sqlite3_snprintf(24, zRet, "%llu", + sqlite3StrAccumInit(&sStat, 0, 0, 0, (p->nKeyCol+1)*100); + sqlite3_str_appendf(&sStat, "%llu", p->nSkipAhead ? (u64)p->nEst : (u64)p->nRow); - z = zRet + sqlite3Strlen30(zRet); for(i=0; inKeyCol; i++){ u64 nDistinct = p->current.anDLt[i] + 1; u64 iVal = (p->nRow + nDistinct - 1) / nDistinct; - sqlite3_snprintf(24, z, " %llu", iVal); - z += sqlite3Strlen30(z); + sqlite3_str_appendf(&sStat, " %llu", iVal); assert( p->current.anEq[i] ); } - assert( z[0]=='\0' && z>zRet ); - - sqlite3_result_text(context, zRet, -1, sqlite3_free); + sqlite3ResultStrAccum(context, &sStat); } #ifdef SQLITE_ENABLE_STAT4 else if( eCall==STAT_GET_ROWID ){ @@ -110493,6 +112021,8 @@ static void statGet( } }else{ tRowcnt *aCnt = 0; + sqlite3_str sStat; + int i; assert( p->iGetnSample ); switch( eCall ){ @@ -110504,23 +112034,12 @@ static void statGet( break; } } - - { - char *zRet = sqlite3MallocZero(p->nCol * 25); - if( zRet==0 ){ - sqlite3_result_error_nomem(context); - }else{ - int i; - char *z = zRet; - for(i=0; inCol; i++){ - sqlite3_snprintf(24, z, "%llu ", (u64)aCnt[i]); - z += sqlite3Strlen30(z); - } - assert( z[0]=='\0' && z>zRet ); - z[-1] = '\0'; - sqlite3_result_text(context, zRet, -1, sqlite3_free); - } + sqlite3StrAccumInit(&sStat, 0, 0, 0, p->nCol*100); + for(i=0; inCol; i++){ + sqlite3_str_appendf(&sStat, "%llu ", (u64)aCnt[i]); } + if( sStat.nChar ) sStat.nChar--; + sqlite3ResultStrAccum(context, &sStat); } #endif /* SQLITE_ENABLE_STAT4 */ #ifndef SQLITE_DEBUG @@ -110569,7 +112088,7 @@ static void analyzeVdbeCommentIndexWithColumnName( }else if( i==XN_EXPR ){ VdbeComment((v,"%s.expr(%d)",pIdx->zName, k)); }else{ - VdbeComment((v,"%s.%s", pIdx->zName, pIdx->pTable->aCol[i].zName)); + VdbeComment((v,"%s.%s", pIdx->zName, pIdx->pTable->aCol[i].zCnName)); } } #else @@ -110616,7 +112135,7 @@ static void analyzeOneTable( if( v==0 || NEVER(pTab==0) ){ return; } - if( pTab->tnum==0 ){ + if( !IsOrdinaryTable(pTab) ){ /* Do not gather statistics on views or virtual tables */ return; } @@ -111441,9 +112960,12 @@ static int loadStatTbl( */ static int loadStat4(sqlite3 *db, const char *zDb){ int rc = SQLITE_OK; /* Result codes from subroutines */ + const Table *pStat4; assert( db->lookaside.bDisable ); - if( sqlite3FindTable(db, "sqlite_stat4", zDb) ){ + if( (pStat4 = sqlite3FindTable(db, "sqlite_stat4", zDb))!=0 + && IsOrdinaryTable(pStat4) + ){ rc = loadStatTbl(db, "SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx", "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4", @@ -111480,6 +113002,7 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ char *zSql; int rc = SQLITE_OK; Schema *pSchema = db->aDb[iDb].pSchema; + const Table *pStat1; assert( iDb>=0 && iDbnDb ); assert( db->aDb[iDb].pBt!=0 ); @@ -111502,7 +113025,9 @@ SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ /* Load new statistics out of the sqlite_stat1 table */ sInfo.db = db; sInfo.zDatabase = db->aDb[iDb].zDbSName; - if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)!=0 ){ + if( (pStat1 = sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)) + && IsOrdinaryTable(pStat1) + ){ zSql = sqlite3MPrintf(db, "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase); if( zSql==0 ){ @@ -111893,17 +113418,18 @@ static void codeAttach( sName.pParse = pParse; if( - SQLITE_OK!=(rc = resolveAttachExpr(&sName, pFilename)) || - SQLITE_OK!=(rc = resolveAttachExpr(&sName, pDbname)) || - SQLITE_OK!=(rc = resolveAttachExpr(&sName, pKey)) + SQLITE_OK!=resolveAttachExpr(&sName, pFilename) || + SQLITE_OK!=resolveAttachExpr(&sName, pDbname) || + SQLITE_OK!=resolveAttachExpr(&sName, pKey) ){ goto attach_end; } #ifndef SQLITE_OMIT_AUTHORIZATION - if( pAuthArg ){ + if( ALWAYS(pAuthArg) ){ char *zAuthArg; if( pAuthArg->op==TK_STRING ){ + assert( !ExprHasProperty(pAuthArg, EP_IntValue) ); zAuthArg = pAuthArg->u.zToken; }else{ zAuthArg = 0; @@ -112322,10 +113848,10 @@ SQLITE_PRIVATE void sqlite3AuthRead( if( iCol>=0 ){ assert( iColnCol ); - zCol = pTab->aCol[iCol].zName; + zCol = pTab->aCol[iCol].zCnName; }else if( pTab->iPKey>=0 ){ assert( pTab->iPKeynCol ); - zCol = pTab->aCol[pTab->iPKey].zName; + zCol = pTab->aCol[pTab->iPKey].zCnName; }else{ zCol = "ROWID"; } @@ -112561,11 +114087,13 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ assert( pParse->pToplevel==0 ); db = pParse->db; + assert( db->pParse==pParse ); if( pParse->nested ) return; - if( db->mallocFailed || pParse->nErr ){ - if( pParse->rc==SQLITE_OK ) pParse->rc = SQLITE_ERROR; + if( pParse->nErr ){ + if( db->mallocFailed ) pParse->rc = SQLITE_NOMEM; return; } + assert( db->mallocFailed==0 ); /* Begin by generating some termination code at the end of the ** vdbe program @@ -112588,17 +114116,22 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ int i; int reg; - addrRewind = - sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur); - VdbeCoverage(v); - reg = pReturning->iRetReg; - for(i=0; inRetCol; i++){ - sqlite3VdbeAddOp3(v, OP_Column, pReturning->iRetCur, i, reg+i); + if( NEVER(pReturning->nRetCol==0) ){ + assert( CORRUPT_DB ); + }else{ + sqlite3VdbeAddOp0(v, OP_FkCheck); + addrRewind = + sqlite3VdbeAddOp1(v, OP_Rewind, pReturning->iRetCur); + VdbeCoverage(v); + reg = pReturning->iRetReg; + for(i=0; inRetCol; i++){ + sqlite3VdbeAddOp3(v, OP_Column, pReturning->iRetCur, i, reg+i); + } + sqlite3VdbeAddOp2(v, OP_ResultRow, reg, i); + sqlite3VdbeAddOp2(v, OP_Next, pReturning->iRetCur, addrRewind+1); + VdbeCoverage(v); + sqlite3VdbeJumpHere(v, addrRewind); } - sqlite3VdbeAddOp2(v, OP_ResultRow, reg, i); - sqlite3VdbeAddOp2(v, OP_Next, pReturning->iRetCur, addrRewind+1); - VdbeCoverage(v); - sqlite3VdbeJumpHere(v, addrRewind); } sqlite3VdbeAddOp0(v, OP_Halt); @@ -112679,7 +114212,11 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ if( pParse->bReturning ){ Returning *pRet = pParse->u1.pReturning; - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); + if( NEVER(pRet->nRetCol==0) ){ + assert( CORRUPT_DB ); + }else{ + sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pRet->iRetCur, pRet->nRetCol); + } } /* Finally, jump back to the beginning of the executable code. */ @@ -112689,7 +114226,9 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ /* Get the VDBE program ready for execution */ - if( v && pParse->nErr==0 && !db->mallocFailed ){ + assert( v!=0 || pParse->nErr ); + assert( db->mallocFailed==0 || pParse->nErr ); + if( pParse->nErr==0 ){ /* A minimum of one cursor is required if autoincrement is used * See ticket [a696379c1f08866] */ assert( pParse->pAinc==0 || pParse->nTab>0 ); @@ -112703,20 +114242,21 @@ SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ /* ** Run the parser and code generator recursively in order to generate ** code for the SQL statement given onto the end of the pParse context -** currently under construction. When the parser is run recursively -** this way, the final OP_Halt is not appended and other initialization -** and finalization steps are omitted because those are handling by the -** outermost parser. +** currently under construction. Notes: ** -** Not everything is nestable. This facility is designed to permit -** INSERT, UPDATE, and DELETE operations against the schema table. Use -** care if you decide to try to use this routine for some other purposes. +** * The final OP_Halt is not appended and other initialization +** and finalization steps are omitted because those are handling by the +** outermost parser. +** +** * Built-in SQL functions always take precedence over application-defined +** SQL functions. In other words, it is not possible to override a +** built-in function. */ SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ va_list ap; char *zSql; - char *zErrMsg = 0; sqlite3 *db = pParse->db; + u32 savedDbFlags = db->mDbFlags; char saveBuf[PARSE_TAIL_SZ]; if( pParse->nErr ) return; @@ -112735,8 +114275,11 @@ SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ pParse->nested++; memcpy(saveBuf, PARSE_TAIL(pParse), PARSE_TAIL_SZ); memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); - sqlite3RunParser(pParse, zSql, &zErrMsg); - sqlite3DbFree(db, zErrMsg); + db->mDbFlags |= DBFLAG_PreferBuiltin; + sqlite3RunParser(pParse, zSql); + sqlite3DbFree(db, pParse->zErrMsg); + pParse->zErrMsg = 0; + db->mDbFlags = savedDbFlags; sqlite3DbFree(db, zSql); memcpy(PARSE_TAIL(pParse), saveBuf, PARSE_TAIL_SZ); pParse->nested--; @@ -112793,17 +114336,17 @@ SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const cha p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, zName); if( p==0 && sqlite3StrNICmp(zName, "sqlite_", 7)==0 ){ if( i==1 ){ - if( sqlite3StrICmp(zName+7, &ALT_TEMP_SCHEMA_TABLE[7])==0 - || sqlite3StrICmp(zName+7, &ALT_SCHEMA_TABLE[7])==0 - || sqlite3StrICmp(zName+7, &DFLT_SCHEMA_TABLE[7])==0 + if( sqlite3StrICmp(zName+7, &PREFERRED_TEMP_SCHEMA_TABLE[7])==0 + || sqlite3StrICmp(zName+7, &PREFERRED_SCHEMA_TABLE[7])==0 + || sqlite3StrICmp(zName+7, &LEGACY_SCHEMA_TABLE[7])==0 ){ p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, - DFLT_TEMP_SCHEMA_TABLE); + LEGACY_TEMP_SCHEMA_TABLE); } }else{ - if( sqlite3StrICmp(zName+7, &ALT_SCHEMA_TABLE[7])==0 ){ + if( sqlite3StrICmp(zName+7, &PREFERRED_SCHEMA_TABLE[7])==0 ){ p = sqlite3HashFind(&db->aDb[i].pSchema->tblHash, - DFLT_SCHEMA_TABLE); + LEGACY_SCHEMA_TABLE); } } } @@ -112821,11 +114364,11 @@ SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const cha if( p ) break; } if( p==0 && sqlite3StrNICmp(zName, "sqlite_", 7)==0 ){ - if( sqlite3StrICmp(zName+7, &ALT_SCHEMA_TABLE[7])==0 ){ - p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, DFLT_SCHEMA_TABLE); - }else if( sqlite3StrICmp(zName+7, &ALT_TEMP_SCHEMA_TABLE[7])==0 ){ + if( sqlite3StrICmp(zName+7, &PREFERRED_SCHEMA_TABLE[7])==0 ){ + p = sqlite3HashFind(&db->aDb[0].pSchema->tblHash, LEGACY_SCHEMA_TABLE); + }else if( sqlite3StrICmp(zName+7, &PREFERRED_TEMP_SCHEMA_TABLE[7])==0 ){ p = sqlite3HashFind(&db->aDb[1].pSchema->tblHash, - DFLT_TEMP_SCHEMA_TABLE); + LEGACY_TEMP_SCHEMA_TABLE); } } } @@ -112871,6 +114414,7 @@ SQLITE_PRIVATE Table *sqlite3LocateTable( pMod = sqlite3PragmaVtabRegister(db, zName); } if( pMod && sqlite3VtabEponymousTableInit(pParse, pMod) ){ + testcase( pMod->pEpoTab==0 ); return pMod->pEpoTab; } } @@ -112920,6 +114464,22 @@ SQLITE_PRIVATE Table *sqlite3LocateTableItem( return sqlite3LocateTable(pParse, flags, p->zName, zDb); } +/* +** Return the preferred table name for system tables. Translate legacy +** names into the new preferred names, as appropriate. +*/ +SQLITE_PRIVATE const char *sqlite3PreferredTableName(const char *zName){ + if( sqlite3StrNICmp(zName, "sqlite_", 7)==0 ){ + if( sqlite3StrICmp(zName+7, &LEGACY_SCHEMA_TABLE[7])==0 ){ + return PREFERRED_SCHEMA_TABLE; + } + if( sqlite3StrICmp(zName+7, &LEGACY_TEMP_SCHEMA_TABLE[7])==0 ){ + return PREFERRED_TEMP_SCHEMA_TABLE; + } + } + return zName; +} + /* ** Locate the in-memory structure that describes ** a particular index given the name of that index @@ -113084,6 +114644,84 @@ SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){ db->mDbFlags &= ~DBFLAG_SchemaChange; } +/* +** Set the expression associated with a column. This is usually +** the DEFAULT value, but might also be the expression that computes +** the value for a generated column. +*/ +SQLITE_PRIVATE void sqlite3ColumnSetExpr( + Parse *pParse, /* Parsing context */ + Table *pTab, /* The table containing the column */ + Column *pCol, /* The column to receive the new DEFAULT expression */ + Expr *pExpr /* The new default expression */ +){ + ExprList *pList; + assert( IsOrdinaryTable(pTab) ); + pList = pTab->u.tab.pDfltList; + if( pCol->iDflt==0 + || NEVER(pList==0) + || NEVER(pList->nExpriDflt) + ){ + pCol->iDflt = pList==0 ? 1 : pList->nExpr+1; + pTab->u.tab.pDfltList = sqlite3ExprListAppend(pParse, pList, pExpr); + }else{ + sqlite3ExprDelete(pParse->db, pList->a[pCol->iDflt-1].pExpr); + pList->a[pCol->iDflt-1].pExpr = pExpr; + } +} + +/* +** Return the expression associated with a column. The expression might be +** the DEFAULT clause or the AS clause of a generated column. +** Return NULL if the column has no associated expression. +*/ +SQLITE_PRIVATE Expr *sqlite3ColumnExpr(Table *pTab, Column *pCol){ + if( pCol->iDflt==0 ) return 0; + if( NEVER(!IsOrdinaryTable(pTab)) ) return 0; + if( NEVER(pTab->u.tab.pDfltList==0) ) return 0; + if( NEVER(pTab->u.tab.pDfltList->nExpriDflt) ) return 0; + return pTab->u.tab.pDfltList->a[pCol->iDflt-1].pExpr; +} + +/* +** Set the collating sequence name for a column. +*/ +SQLITE_PRIVATE void sqlite3ColumnSetColl( + sqlite3 *db, + Column *pCol, + const char *zColl +){ + i64 nColl; + i64 n; + char *zNew; + assert( zColl!=0 ); + n = sqlite3Strlen30(pCol->zCnName) + 1; + if( pCol->colFlags & COLFLAG_HASTYPE ){ + n += sqlite3Strlen30(pCol->zCnName+n) + 1; + } + nColl = sqlite3Strlen30(zColl) + 1; + zNew = sqlite3DbRealloc(db, pCol->zCnName, nColl+n); + if( zNew ){ + pCol->zCnName = zNew; + memcpy(pCol->zCnName + n, zColl, nColl); + pCol->colFlags |= COLFLAG_HASCOLL; + } +} + +/* +** Return the collating squence name for a column +*/ +SQLITE_PRIVATE const char *sqlite3ColumnColl(Column *pCol){ + const char *z; + if( (pCol->colFlags & COLFLAG_HASCOLL)==0 ) return 0; + z = pCol->zCnName; + while( *z ){ z++; } + if( pCol->colFlags & COLFLAG_HASTYPE ){ + do{ z++; }while( *z ); + } + return z+1; +} + /* ** Delete memory allocated for the column names of a table or view (the ** Table.aCol[] array). @@ -113094,12 +114732,20 @@ SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){ assert( pTable!=0 ); if( (pCol = pTable->aCol)!=0 ){ for(i=0; inCol; i++, pCol++){ - assert( pCol->zName==0 || pCol->hName==sqlite3StrIHash(pCol->zName) ); - sqlite3DbFree(db, pCol->zName); - sqlite3ExprDelete(db, pCol->pDflt); - sqlite3DbFree(db, pCol->zColl); + assert( pCol->zCnName==0 || pCol->hName==sqlite3StrIHash(pCol->zCnName) ); + sqlite3DbFree(db, pCol->zCnName); } sqlite3DbFree(db, pTable->aCol); + if( IsOrdinaryTable(pTable) ){ + sqlite3ExprListDelete(db, pTable->u.tab.pDfltList); + } + if( db==0 || db->pnBytesFreed==0 ){ + pTable->aCol = 0; + pTable->nCol = 0; + if( IsOrdinaryTable(pTable) ){ + pTable->u.tab.pDfltList = 0; + } + } } } @@ -113151,19 +114797,25 @@ static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ sqlite3FreeIndex(db, pIndex); } - /* Delete any foreign keys attached to this table. */ - sqlite3FkDelete(db, pTable); + if( IsOrdinaryTable(pTable) ){ + sqlite3FkDelete(db, pTable); + } +#ifndef SQLITE_OMIT_VIRTUAL_TABLE + else if( IsVirtual(pTable) ){ + sqlite3VtabClear(db, pTable); + } +#endif + else{ + assert( IsView(pTable) ); + sqlite3SelectDelete(db, pTable->u.view.pSelect); + } /* Delete the Table structure itself. */ sqlite3DeleteColumnNames(db, pTable); sqlite3DbFree(db, pTable->zName); sqlite3DbFree(db, pTable->zColAff); - sqlite3SelectDelete(db, pTable->pSelect); sqlite3ExprListDelete(db, pTable->pCheck); -#ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3VtabClear(db, pTable); -#endif sqlite3DbFree(db, pTable); /* Verify that no lookaside memory was used by schema tables */ @@ -113209,10 +114861,10 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char ** are not \000 terminated and are not persistent. The returned string ** is \000 terminated and is persistent. */ -SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, Token *pName){ +SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, const Token *pName){ char *zName; if( pName ){ - zName = sqlite3DbStrNDup(db, (char*)pName->z, pName->n); + zName = sqlite3DbStrNDup(db, (const char*)pName->z, pName->n); sqlite3Dequote(zName); }else{ zName = 0; @@ -113226,7 +114878,7 @@ SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, Token *pName){ */ SQLITE_PRIVATE void sqlite3OpenSchemaTable(Parse *p, int iDb){ Vdbe *v = sqlite3GetVdbe(p); - sqlite3TableLock(p, iDb, SCHEMA_ROOT, 1, DFLT_SCHEMA_TABLE); + sqlite3TableLock(p, iDb, SCHEMA_ROOT, 1, LEGACY_SCHEMA_TABLE); sqlite3VdbeAddOp4Int(v, OP_OpenWrite, 0, SCHEMA_ROOT, iDb, 5); if( p->nTab==0 ){ p->nTab = 1; @@ -113587,7 +115239,8 @@ SQLITE_PRIVATE void sqlite3StartTable( pTable = sqlite3FindTable(db, zName, zDb); if( pTable ){ if( !noErr ){ - sqlite3ErrorMsg(pParse, "table %T already exists", pName); + sqlite3ErrorMsg(pParse, "%s %T already exists", + (IsView(pTable)? "view" : "table"), pName); }else{ assert( !db->init.busy || CORRUPT_DB ); sqlite3CodeVerifySchema(pParse, iDb); @@ -113689,6 +115342,7 @@ SQLITE_PRIVATE void sqlite3StartTable( /* If an error occurs, we jump here */ begin_table_error: + pParse->checkSchema = 1; sqlite3DbFree(db, zName); return; } @@ -113698,7 +115352,7 @@ begin_table_error: */ #if SQLITE_ENABLE_HIDDEN_COLUMNS SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column *pCol){ - if( sqlite3_strnicmp(pCol->zName, "__hidden__", 10)==0 ){ + if( sqlite3_strnicmp(pCol->zCnName, "__hidden__", 10)==0 ){ pCol->colFlags |= COLFLAG_HIDDEN; if( pTab ) pTab->tabFlags |= TF_HasHidden; }else if( pTab && pCol!=pTab->aCol && (pCol[-1].colFlags & COLFLAG_HIDDEN) ){ @@ -113789,7 +115443,7 @@ SQLITE_PRIVATE void sqlite3AddReturning(Parse *pParse, ExprList *pList){ ** first to get things going. Then this routine is called for each ** column. */ -SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ +SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token sName, Token sType){ Table *p; int i; char *z; @@ -113797,55 +115451,96 @@ SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){ Column *pCol; sqlite3 *db = pParse->db; u8 hName; + Column *aNew; + u8 eType = COLTYPE_CUSTOM; + u8 szEst = 1; + char affinity = SQLITE_AFF_BLOB; if( (p = pParse->pNewTable)==0 ) return; if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){ sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName); return; } - z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2); + if( !IN_RENAME_OBJECT ) sqlite3DequoteToken(&sName); + + /* Because keywords GENERATE ALWAYS can be converted into indentifiers + ** by the parser, we can sometimes end up with a typename that ends + ** with "generated always". Check for this case and omit the surplus + ** text. */ + if( sType.n>=16 + && sqlite3_strnicmp(sType.z+(sType.n-6),"always",6)==0 + ){ + sType.n -= 6; + while( ALWAYS(sType.n>0) && sqlite3Isspace(sType.z[sType.n-1]) ) sType.n--; + if( sType.n>=9 + && sqlite3_strnicmp(sType.z+(sType.n-9),"generated",9)==0 + ){ + sType.n -= 9; + while( sType.n>0 && sqlite3Isspace(sType.z[sType.n-1]) ) sType.n--; + } + } + + /* Check for standard typenames. For standard typenames we will + ** set the Column.eType field rather than storing the typename after + ** the column name, in order to save space. */ + if( sType.n>=3 ){ + sqlite3DequoteToken(&sType); + for(i=0; i0) ); if( z==0 ) return; - if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, pName); - memcpy(z, pName->z, pName->n); - z[pName->n] = 0; + if( IN_RENAME_OBJECT ) sqlite3RenameTokenMap(pParse, (void*)z, &sName); + memcpy(z, sName.z, sName.n); + z[sName.n] = 0; sqlite3Dequote(z); hName = sqlite3StrIHash(z); for(i=0; inCol; i++){ - if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zName)==0 ){ + if( p->aCol[i].hName==hName && sqlite3StrICmp(z, p->aCol[i].zCnName)==0 ){ sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); sqlite3DbFree(db, z); return; } } - if( (p->nCol & 0x7)==0 ){ - Column *aNew; - aNew = sqlite3DbRealloc(db,p->aCol,(p->nCol+8)*sizeof(p->aCol[0])); - if( aNew==0 ){ - sqlite3DbFree(db, z); - return; - } - p->aCol = aNew; + aNew = sqlite3DbRealloc(db,p->aCol,((i64)p->nCol+1)*sizeof(p->aCol[0])); + if( aNew==0 ){ + sqlite3DbFree(db, z); + return; } + p->aCol = aNew; pCol = &p->aCol[p->nCol]; memset(pCol, 0, sizeof(p->aCol[0])); - pCol->zName = z; + pCol->zCnName = z; pCol->hName = hName; sqlite3ColumnPropertiesFromName(p, pCol); - if( pType->n==0 ){ + if( sType.n==0 ){ /* If there is no type specified, columns have the default affinity ** 'BLOB' with a default size of 4 bytes. */ - pCol->affinity = SQLITE_AFF_BLOB; - pCol->szEst = 1; + pCol->affinity = affinity; + pCol->eCType = eType; + pCol->szEst = szEst; #ifdef SQLITE_ENABLE_SORTER_REFERENCES - if( 4>=sqlite3GlobalConfig.szSorterRef ){ - pCol->colFlags |= COLFLAG_SORTERREF; + if( affinity==SQLITE_AFF_BLOB ){ + if( 4>=sqlite3GlobalConfig.szSorterRef ){ + pCol->colFlags |= COLFLAG_SORTERREF; + } } #endif }else{ zType = z + sqlite3Strlen30(z) + 1; - memcpy(zType, pType->z, pType->n); - zType[pType->n] = 0; + memcpy(zType, sType.z, sType.n); + zType[sType.n] = 0; sqlite3Dequote(zType); pCol->affinity = sqlite3AffinityType(zType, pCol); pCol->colFlags |= COLFLAG_HASTYPE; @@ -114000,7 +115695,7 @@ SQLITE_PRIVATE void sqlite3AddDefaultValue( pCol = &(p->aCol[p->nCol-1]); if( !sqlite3ExprIsConstantOrFunction(pExpr, isInit) ){ sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", - pCol->zName); + pCol->zCnName); #ifndef SQLITE_OMIT_GENERATED_COLUMNS }else if( pCol->colFlags & COLFLAG_GENERATED ){ testcase( pCol->colFlags & COLFLAG_VIRTUAL ); @@ -114011,15 +115706,15 @@ SQLITE_PRIVATE void sqlite3AddDefaultValue( /* A copy of pExpr is used instead of the original, as pExpr contains ** tokens that point to volatile memory. */ - Expr x; - sqlite3ExprDelete(db, pCol->pDflt); + Expr x, *pDfltExpr; memset(&x, 0, sizeof(x)); x.op = TK_SPAN; x.u.zToken = sqlite3DbSpanDup(db, zStart, zEnd); x.pLeft = pExpr; x.flags = EP_Skip; - pCol->pDflt = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE); + pDfltExpr = sqlite3ExprDup(db, &x, EXPRDUP_REDUCE); sqlite3DbFree(db, x.u.zToken); + sqlite3ColumnSetExpr(pParse, p, pCol, pDfltExpr); } } if( IN_RENAME_OBJECT ){ @@ -114115,9 +115810,11 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey( assert( pCExpr!=0 ); sqlite3StringToId(pCExpr); if( pCExpr->op==TK_ID ){ - const char *zCName = pCExpr->u.zToken; + const char *zCName; + assert( !ExprHasProperty(pCExpr, EP_IntValue) ); + zCName = pCExpr->u.zToken; for(iCol=0; iColnCol; iCol++){ - if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zName)==0 ){ + if( sqlite3StrICmp(zCName, pTab->aCol[iCol].zCnName)==0 ){ pCol = &pTab->aCol[iCol]; makeColumnPartOfPrimaryKey(pParse, pCol); break; @@ -114128,7 +115825,7 @@ SQLITE_PRIVATE void sqlite3AddPrimaryKey( } if( nTerm==1 && pCol - && sqlite3StrICmp(sqlite3ColumnType(pCol,""), "INTEGER")==0 + && pCol->eCType==COLTYPE_INTEGER && sortOrder!=SQLITE_SO_DESC ){ if( IN_RENAME_OBJECT && pList ){ @@ -114208,8 +115905,7 @@ SQLITE_PRIVATE void sqlite3AddCollateType(Parse *pParse, Token *pToken){ if( sqlite3LocateCollSeq(pParse, zColl) ){ Index *pIdx; - sqlite3DbFree(db, p->aCol[i].zColl); - p->aCol[i].zColl = zColl; + sqlite3ColumnSetColl(db, &p->aCol[i], zColl); /* If the column is declared as " PRIMARY KEY COLLATE ", ** then an index may have been created on this column before the @@ -114218,12 +115914,11 @@ SQLITE_PRIVATE void sqlite3AddCollateType(Parse *pParse, Token *pToken){ for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){ assert( pIdx->nKeyCol==1 ); if( pIdx->aiColumn[0]==i ){ - pIdx->azColl[0] = p->aCol[i].zColl; + pIdx->azColl[0] = sqlite3ColumnColl(&p->aCol[i]); } } - }else{ - sqlite3DbFree(db, zColl); } + sqlite3DbFree(db, zColl); } /* Change the most recently parsed column to be a GENERATED ALWAYS AS @@ -114243,7 +115938,7 @@ SQLITE_PRIVATE void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType sqlite3ErrorMsg(pParse, "virtual tables cannot use computed columns"); goto generated_done; } - if( pCol->pDflt ) goto generated_error; + if( pCol->iDflt>0 ) goto generated_error; if( pType ){ if( pType->n==7 && sqlite3StrNICmp("virtual",pType->z,7)==0 ){ /* no-op */ @@ -114261,13 +115956,13 @@ SQLITE_PRIVATE void sqlite3AddGenerated(Parse *pParse, Expr *pExpr, Token *pType if( pCol->colFlags & COLFLAG_PRIMKEY ){ makeColumnPartOfPrimaryKey(pParse, pCol); /* For the error message */ } - pCol->pDflt = pExpr; + sqlite3ColumnSetExpr(pParse, pTab, pCol, pExpr); pExpr = 0; goto generated_done; generated_error: sqlite3ErrorMsg(pParse, "error in generated column \"%s\"", - pCol->zName); + pCol->zCnName); generated_done: sqlite3ExprDelete(pParse->db, pExpr); #else @@ -114369,7 +116064,7 @@ static char *createTableStmt(sqlite3 *db, Table *p){ Column *pCol; n = 0; for(pCol = p->aCol, i=0; inCol; i++, pCol++){ - n += identLength(pCol->zName) + 5; + n += identLength(pCol->zCnName) + 5; } n += identLength(p->zName); if( n<50 ){ @@ -114405,7 +116100,7 @@ static char *createTableStmt(sqlite3 *db, Table *p){ sqlite3_snprintf(n-k, &zStmt[k], zSep); k += sqlite3Strlen30(&zStmt[k]); zSep = zSep2; - identPut(zStmt, &k, pCol->zName); + identPut(zStmt, &k, pCol->zCnName); assert( pCol->affinity-SQLITE_AFF_BLOB >= 0 ); assert( pCol->affinity-SQLITE_AFF_BLOB < ArraySize(azType) ); testcase( pCol->affinity==SQLITE_AFF_BLOB ); @@ -114489,7 +116184,6 @@ static void estimateIndexWidth(Index *pIdx){ */ static int hasColumn(const i16 *aiCol, int nCol, int x){ while( nCol-- > 0 ){ - assert( aiCol[0]>=0 ); if( x==*(aiCol++) ){ return 1; } @@ -114602,7 +116296,9 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ */ if( !db->init.imposterTable ){ for(i=0; inCol; i++){ - if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ + if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 + && (pTab->aCol[i].notNull==OE_None) + ){ pTab->aCol[i].notNull = OE_Abort; } } @@ -114624,7 +116320,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; - sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); + sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zCnName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ){ @@ -114639,10 +116335,11 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ pTab->iPKey = -1; sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); - if( db->mallocFailed || pParse->nErr ){ + if( pParse->nErr ){ pTab->tabFlags &= ~TF_WithoutRowid; return; } + assert( db->mallocFailed==0 ); pPk = sqlite3PrimaryKeyIndex(pTab); assert( pPk->nKeyCol==1 ); }else{ @@ -114754,7 +116451,7 @@ SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3 *db, Table *pTab, const char * nName = sqlite3Strlen30(pTab->zName); if( sqlite3_strnicmp(zName, pTab->zName, nName)!=0 ) return 0; if( zName[nName]!='_' ) return 0; - pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->azModuleArg[0]); + pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->u.vtab.azArg[0]); if( pMod==0 ) return 0; if( pMod->pModule->iVersion<3 ) return 0; if( pMod->pModule->xShadowName==0 ) return 0; @@ -114762,6 +116459,41 @@ SQLITE_PRIVATE int sqlite3IsShadowTableOf(sqlite3 *db, Table *pTab, const char * } #endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ +#ifndef SQLITE_OMIT_VIRTUALTABLE +/* +** Table pTab is a virtual table. If it the virtual table implementation +** exists and has an xShadowName method, then loop over all other ordinary +** tables within the same schema looking for shadow tables of pTab, and mark +** any shadow tables seen using the TF_Shadow flag. +*/ +SQLITE_PRIVATE void sqlite3MarkAllShadowTablesOf(sqlite3 *db, Table *pTab){ + int nName; /* Length of pTab->zName */ + Module *pMod; /* Module for the virtual table */ + HashElem *k; /* For looping through the symbol table */ + + assert( IsVirtual(pTab) ); + pMod = (Module*)sqlite3HashFind(&db->aModule, pTab->u.vtab.azArg[0]); + if( pMod==0 ) return; + if( NEVER(pMod->pModule==0) ) return; + if( pMod->pModule->iVersion<3 ) return; + if( pMod->pModule->xShadowName==0 ) return; + assert( pTab->zName!=0 ); + nName = sqlite3Strlen30(pTab->zName); + for(k=sqliteHashFirst(&pTab->pSchema->tblHash); k; k=sqliteHashNext(k)){ + Table *pOther = sqliteHashData(k); + assert( pOther->zName!=0 ); + if( !IsOrdinaryTable(pOther) ) continue; + if( pOther->tabFlags & TF_Shadow ) continue; + if( sqlite3StrNICmp(pOther->zName, pTab->zName, nName)==0 + && pOther->zName[nName]=='_' + && pMod->pModule->xShadowName(pOther->zName+nName+1) + ){ + pOther->tabFlags |= TF_Shadow; + } + } +} +#endif /* ifndef SQLITE_OMIT_VIRTUALTABLE */ + #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Return true if zName is a shadow table name in the current database @@ -114835,7 +116567,7 @@ SQLITE_PRIVATE void sqlite3EndTable( Parse *pParse, /* Parse context */ Token *pCons, /* The ',' token after the last column defn. */ Token *pEnd, /* The ')' before options in the CREATE TABLE */ - u8 tabOpts, /* Extra table options. Usually 0. */ + u32 tabOpts, /* Extra table options. Usually 0. */ Select *pSelect /* Select from a "CREATE ... AS SELECT" */ ){ Table *p; /* The new table */ @@ -114863,7 +116595,7 @@ SQLITE_PRIVATE void sqlite3EndTable( ** table itself. So mark it read-only. */ if( db->init.busy ){ - if( pSelect ){ + if( pSelect || (!IsOrdinaryTable(p) && db->init.newTnum) ){ sqlite3ErrorMsg(pParse, ""); return; } @@ -114871,6 +116603,44 @@ SQLITE_PRIVATE void sqlite3EndTable( if( p->tnum==1 ) p->tabFlags |= TF_Readonly; } + /* Special processing for tables that include the STRICT keyword: + ** + ** * Do not allow custom column datatypes. Every column must have + ** a datatype that is one of INT, INTEGER, REAL, TEXT, or BLOB. + ** + ** * If a PRIMARY KEY is defined, other than the INTEGER PRIMARY KEY, + ** then all columns of the PRIMARY KEY must have a NOT NULL + ** constraint. + */ + if( tabOpts & TF_Strict ){ + int ii; + p->tabFlags |= TF_Strict; + for(ii=0; iinCol; ii++){ + Column *pCol = &p->aCol[ii]; + if( pCol->eCType==COLTYPE_CUSTOM ){ + if( pCol->colFlags & COLFLAG_HASTYPE ){ + sqlite3ErrorMsg(pParse, + "unknown datatype for %s.%s: \"%s\"", + p->zName, pCol->zCnName, sqlite3ColumnType(pCol, "") + ); + }else{ + sqlite3ErrorMsg(pParse, "missing datatype for %s.%s", + p->zName, pCol->zCnName); + } + return; + }else if( pCol->eCType==COLTYPE_ANY ){ + pCol->affinity = SQLITE_AFF_BLOB; + } + if( (pCol->colFlags & COLFLAG_PRIMKEY)!=0 + && p->iPKey!=ii + && pCol->notNull == OE_None + ){ + pCol->notNull = OE_Abort; + p->tabFlags |= TF_HasNotNull; + } + } + } + assert( (p->tabFlags & TF_HasPrimaryKey)==0 || p->iPKey>=0 || sqlite3PrimaryKeyIndex(p)!=0 ); assert( (p->tabFlags & TF_HasPrimaryKey)!=0 @@ -114915,7 +116685,7 @@ SQLITE_PRIVATE void sqlite3EndTable( for(ii=0; iinCol; ii++){ u32 colFlags = p->aCol[ii].colFlags; if( (colFlags & COLFLAG_GENERATED)!=0 ){ - Expr *pX = p->aCol[ii].pDflt; + Expr *pX = sqlite3ColumnExpr(p, &p->aCol[ii]); testcase( colFlags & COLFLAG_VIRTUAL ); testcase( colFlags & COLFLAG_STORED ); if( sqlite3ResolveSelfReference(pParse, p, NC_GenCol, pX, 0) ){ @@ -114925,8 +116695,8 @@ SQLITE_PRIVATE void sqlite3EndTable( ** tree that have been allocated from lookaside memory, which is ** illegal in a schema and will lead to errors or heap corruption ** when the database connection closes. */ - sqlite3ExprDelete(db, pX); - p->aCol[ii].pDflt = sqlite3ExprAlloc(db, TK_NULL, 0, 0); + sqlite3ColumnSetExpr(pParse, p, &p->aCol[ii], + sqlite3ExprAlloc(db, TK_NULL, 0, 0)); } }else{ nNG++; @@ -114966,7 +116736,7 @@ SQLITE_PRIVATE void sqlite3EndTable( /* ** Initialize zType for the new view or table. */ - if( p->pSelect==0 ){ + if( IsOrdinaryTable(p) ){ /* A regular table */ zType = "table"; zType2 = "TABLE"; @@ -115000,6 +116770,11 @@ SQLITE_PRIVATE void sqlite3EndTable( int addrInsLoop; /* Top of the loop for inserting rows */ Table *pSelTab; /* A table that describes the SELECT results */ + if( IN_SPECIAL_PARSE ){ + pParse->rc = SQLITE_ERROR; + pParse->nErr++; + return; + } regYield = ++pParse->nMem; regRec = ++pParse->nMem; regRowid = ++pParse->nMem; @@ -115052,7 +116827,7 @@ SQLITE_PRIVATE void sqlite3EndTable( ** the information we've collected. */ sqlite3NestedParse(pParse, - "UPDATE %Q." DFLT_SCHEMA_TABLE + "UPDATE %Q." LEGACY_SCHEMA_TABLE " SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q" " WHERE rowid=#%d", db->aDb[iDb].zDbSName, @@ -115116,12 +116891,12 @@ SQLITE_PRIVATE void sqlite3EndTable( } #ifndef SQLITE_OMIT_ALTERTABLE - if( !pSelect && !p->pSelect ){ + if( !pSelect && IsOrdinaryTable(p) ){ assert( pCons && pEnd ); if( pCons->z==0 ){ pCons = pEnd; } - p->addColOffset = 13 + (int)(pCons->z - pParse->sNameToken.z); + p->u.tab.addColOffset = 13 + (int)(pCons->z - pParse->sNameToken.z); } #endif } @@ -115178,12 +116953,13 @@ SQLITE_PRIVATE void sqlite3CreateView( */ pSelect->selFlags |= SF_View; if( IN_RENAME_OBJECT ){ - p->pSelect = pSelect; + p->u.view.pSelect = pSelect; pSelect = 0; }else{ - p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); + p->u.view.pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); } p->pCheck = sqlite3ExprListDup(db, pCNames, EXPRDUP_REDUCE); + p->eTabType = TABTYP_VIEW; if( db->mallocFailed ) goto create_view_fail; /* Locate the end of the CREATE VIEW statement. Make sEnd point to @@ -115237,13 +117013,12 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ assert( pTable ); #ifndef SQLITE_OMIT_VIRTUALTABLE - db->nSchemaLock++; - rc = sqlite3VtabCallConnect(pParse, pTable); - db->nSchemaLock--; - if( rc ){ - return 1; + if( IsVirtual(pTable) ){ + db->nSchemaLock++; + rc = sqlite3VtabCallConnect(pParse, pTable); + db->nSchemaLock--; + return rc; } - if( IsVirtual(pTable) ) return 0; #endif #ifndef SQLITE_OMIT_VIEW @@ -115280,8 +117055,8 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ ** to be permanent. So the computation is done on a copy of the SELECT ** statement that defines the view. */ - assert( pTable->pSelect ); - pSel = sqlite3SelectDup(db, pTable->pSelect, 0); + assert( IsView(pTable) ); + pSel = sqlite3SelectDup(db, pTable->u.view.pSelect, 0); if( pSel ){ u8 eParseMode = pParse->eParseMode; pParse->eParseMode = PARSE_MODE_NORMAL; @@ -115310,10 +117085,10 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ */ sqlite3ColumnsFromExprList(pParse, pTable->pCheck, &pTable->nCol, &pTable->aCol); - if( db->mallocFailed==0 - && pParse->nErr==0 + if( pParse->nErr==0 && pTable->nCol==pSel->pEList->nExpr ){ + assert( db->mallocFailed==0 ); sqlite3SelectAddColumnTypeAndCollation(pParse, pTable, pSel, SQLITE_AFF_NONE); } @@ -115340,8 +117115,6 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ pTable->pSchema->schemaFlags |= DB_UnresetViews; if( db->mallocFailed ){ sqlite3DeleteColumnNames(db, pTable); - pTable->aCol = 0; - pTable->nCol = 0; } #endif /* SQLITE_OMIT_VIEW */ return nErr; @@ -115358,10 +117131,8 @@ static void sqliteViewResetAll(sqlite3 *db, int idx){ if( !DbHasProperty(db, idx, DB_UnresetViews) ) return; for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){ Table *pTab = sqliteHashData(i); - if( pTab->pSelect ){ + if( IsView(pTab) ){ sqlite3DeleteColumnNames(db, pTab); - pTab->aCol = 0; - pTab->nCol = 0; } } DbClearProperty(db, idx, DB_UnresetViews); @@ -115435,7 +117206,7 @@ static void destroyRootPage(Parse *pParse, int iTable, int iDb){ ** token for additional information. */ sqlite3NestedParse(pParse, - "UPDATE %Q." DFLT_SCHEMA_TABLE + "UPDATE %Q." LEGACY_SCHEMA_TABLE " SET rootpage=%d WHERE #%d AND rootpage=#%d", pParse->db->aDb[iDb].zDbSName, iTable, r1, r1); #endif @@ -115570,7 +117341,7 @@ SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, in ** database. */ sqlite3NestedParse(pParse, - "DELETE FROM %Q." DFLT_SCHEMA_TABLE + "DELETE FROM %Q." LEGACY_SCHEMA_TABLE " WHERE tbl_name=%Q and type!='trigger'", pDb->zDbSName, pTab->zName); if( !isView && !IsVirtual(pTab) ){ @@ -115598,6 +117369,7 @@ SQLITE_PRIVATE int sqlite3ReadOnlyShadowTables(sqlite3 *db){ if( (db->flags & SQLITE_Defensive)!=0 && db->pVtabCtx==0 && db->nVdbeExec==0 + && !sqlite3VtabInSync(db) ){ return 1; } @@ -115617,6 +117389,9 @@ static int tableMayNotBeDropped(sqlite3 *db, Table *pTab){ if( (pTab->tabFlags & TF_Shadow)!=0 && sqlite3ReadOnlyShadowTables(db) ){ return 1; } + if( pTab->tabFlags & TF_Eponymous ){ + return 1; + } return 0; } @@ -115701,11 +117476,11 @@ SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used ** on a table. */ - if( isView && pTab->pSelect==0 ){ + if( isView && !IsView(pTab) ){ sqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName); goto exit_drop_table; } - if( !isView && pTab->pSelect ){ + if( !isView && IsView(pTab) ){ sqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName); goto exit_drop_table; } @@ -115756,7 +117531,7 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( FKey *pFKey = 0; FKey *pNextTo; Table *p = pParse->pNewTable; - int nByte; + i64 nByte; int i; int nCol; char *z; @@ -115769,7 +117544,7 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( if( pToCol && pToCol->nExpr!=1 ){ sqlite3ErrorMsg(pParse, "foreign key on %s" " should reference only one column of table %T", - p->aCol[iCol].zName, pTo); + p->aCol[iCol].zCnName, pTo); goto fk_end; } nCol = 1; @@ -115792,7 +117567,8 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( goto fk_end; } pFKey->pFrom = p; - pFKey->pNextFrom = p->pFKey; + assert( IsOrdinaryTable(p) ); + pFKey->pNextFrom = p->u.tab.pFKey; z = (char*)&pFKey->aCol[nCol]; pFKey->zTo = z; if( IN_RENAME_OBJECT ){ @@ -115809,7 +117585,7 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( for(i=0; inCol; j++){ - if( sqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zEName)==0 ){ + if( sqlite3StrICmp(p->aCol[j].zCnName, pFromCol->a[i].zEName)==0 ){ pFKey->aCol[i].iFrom = j; break; } @@ -115857,7 +117633,8 @@ SQLITE_PRIVATE void sqlite3CreateForeignKey( /* Link the foreign key to the table as the last step. */ - p->pFKey = pFKey; + assert( IsOrdinaryTable(p) ); + p->u.tab.pFKey = pFKey; pFKey = 0; fk_end: @@ -115878,7 +117655,9 @@ SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){ #ifndef SQLITE_OMIT_FOREIGN_KEY Table *pTab; FKey *pFKey; - if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return; + if( (pTab = pParse->pNewTable)==0 ) return; + if( NEVER(!IsOrdinaryTable(pTab)) ) return; + if( (pFKey = pTab->u.tab.pFKey)==0 ) return; assert( isDeferred==0 || isDeferred==1 ); /* EV: R-30323-21917 */ pFKey->isDeferred = (u8)isDeferred; #endif @@ -115928,7 +117707,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ tnum = pIndex->tnum; } pKey = sqlite3KeyInfoOfIndex(pParse, pIndex); - assert( pKey!=0 || db->mallocFailed || pParse->nErr ); + assert( pKey!=0 || pParse->nErr ); /* Open the sorter cursor if we are to use one. */ iSorter = pParse->nTab++; @@ -116092,9 +117871,11 @@ SQLITE_PRIVATE void sqlite3CreateIndex( char *zExtra = 0; /* Extra space after the Index object */ Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */ - if( db->mallocFailed || pParse->nErr>0 ){ + assert( db->pParse==pParse ); + if( pParse->nErr ){ goto exit_create_index; } + assert( db->mallocFailed==0 ); if( IN_DECLARE_VTAB && idxType!=SQLITE_IDXTYPE_PRIMARYKEY ){ goto exit_create_index; } @@ -116158,7 +117939,6 @@ SQLITE_PRIVATE void sqlite3CreateIndex( pDb = &db->aDb[iDb]; assert( pTab!=0 ); - assert( pParse->nErr==0 ); if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 && db->init.busy==0 && pTblName!=0 @@ -116170,7 +117950,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( goto exit_create_index; } #ifndef SQLITE_OMIT_VIEW - if( pTab->pSelect ){ + if( IsView(pTab) ){ sqlite3ErrorMsg(pParse, "views may not be indexed"); goto exit_create_index; } @@ -116261,7 +118041,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( Token prevCol; Column *pCol = &pTab->aCol[pTab->nCol-1]; pCol->colFlags |= COLFLAG_UNIQUE; - sqlite3TokenInit(&prevCol, pCol->zName); + sqlite3TokenInit(&prevCol, pCol->zCnName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &prevCol, 0)); if( pList==0 ) goto exit_create_index; @@ -116279,6 +118059,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( Expr *pExpr = pList->a[i].pExpr; assert( pExpr!=0 ); if( pExpr->op==TK_COLLATE ){ + assert( !ExprHasProperty(pExpr, EP_IntValue) ); nExtra += (1 + sqlite3Strlen30(pExpr->u.zToken)); } } @@ -116374,6 +118155,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( zColl = 0; if( pListItem->pExpr->op==TK_COLLATE ){ int nColl; + assert( !ExprHasProperty(pListItem->pExpr, EP_IntValue) ); zColl = pListItem->pExpr->u.zToken; nColl = sqlite3Strlen30(zColl) + 1; assert( nExtra>=nColl ); @@ -116382,7 +118164,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex( zExtra += nColl; nExtra -= nColl; }else if( j>=0 ){ - zColl = pTab->aCol[j].zColl; + zColl = sqlite3ColumnColl(&pTab->aCol[j]); } if( !zColl ) zColl = sqlite3StrBINARY; if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){ @@ -116580,13 +118362,13 @@ SQLITE_PRIVATE void sqlite3CreateIndex( /* Add an entry in sqlite_schema for this index */ sqlite3NestedParse(pParse, - "INSERT INTO %Q." DFLT_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);", - db->aDb[iDb].zDbSName, - pIndex->zName, - pTab->zName, - iMem, - zStmt - ); + "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('index',%Q,%Q,#%d,%Q);", + db->aDb[iDb].zDbSName, + pIndex->zName, + pTab->zName, + iMem, + zStmt + ); sqlite3DbFree(db, zStmt); /* Fill the index with data and reparse the schema. Code an OP_Expire @@ -116622,7 +118404,7 @@ exit_create_index: ** The list was already ordered when this routine was entered, so at this ** point at most a single index (the newly added index) will be out of ** order. So we have to reorder at most one index. */ - Index **ppFrom = &pTab->pIndex; + Index **ppFrom; Index *pThis; for(ppFrom=&pTab->pIndex; (pThis = *ppFrom)!=0; ppFrom=&pThis->pNext){ Index *pNext; @@ -116720,10 +118502,10 @@ SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists sqlite3 *db = pParse->db; int iDb; - assert( pParse->nErr==0 ); /* Never called with prior errors */ if( db->mallocFailed ){ goto exit_drop_index; } + assert( pParse->nErr==0 ); /* Never called with prior non-OOM errors */ assert( pName->nSrc==1 ); if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ goto exit_drop_index; @@ -116766,7 +118548,7 @@ SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists if( v ){ sqlite3BeginWriteOperation(pParse, 1, iDb); sqlite3NestedParse(pParse, - "DELETE FROM %Q." DFLT_SCHEMA_TABLE " WHERE name=%Q AND type='index'", + "DELETE FROM %Q." LEGACY_SCHEMA_TABLE " WHERE name=%Q AND type='index'", db->aDb[iDb].zDbSName, pIndex->zName ); sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName); @@ -117134,7 +118916,7 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( pItem->pUsing = pUsing; return p; - append_from_error: +append_from_error: assert( p==0 ); sqlite3ExprDelete(db, pOn); sqlite3IdListDelete(db, pUsing); @@ -117162,6 +118944,7 @@ SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pI }else{ pItem->u1.zIndexedBy = sqlite3NameFromToken(pParse->db, pIndexedBy); pItem->fg.isIndexedBy = 1; + assert( pItem->fg.isCte==0 ); /* No collision on union u2 */ } } } @@ -117474,7 +119257,7 @@ SQLITE_PRIVATE void sqlite3UniqueConstraint( for(j=0; jnKeyCol; j++){ char *zCol; assert( pIdx->aiColumn[j]>=0 ); - zCol = pTab->aCol[pIdx->aiColumn[j]].zName; + zCol = pTab->aCol[pIdx->aiColumn[j]].zCnName; if( j ) sqlite3_str_append(&errMsg, ", ", 2); sqlite3_str_appendall(&errMsg, pTab->zName); sqlite3_str_append(&errMsg, ".", 1); @@ -117501,7 +119284,7 @@ SQLITE_PRIVATE void sqlite3RowidConstraint( int rc; if( pTab->iPKey>=0 ){ zMsg = sqlite3MPrintf(pParse->db, "%s.%s", pTab->zName, - pTab->aCol[pTab->iPKey].zName); + pTab->aCol[pTab->iPKey].zCnName); rc = SQLITE_CONSTRAINT_PRIMARYKEY; }else{ zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName); @@ -118142,6 +119925,7 @@ SQLITE_PRIVATE FuncDef *sqlite3FunctionSearch( ){ FuncDef *p; for(p=sqlite3BuiltinFunctions.a[h]; p; p=p->u.pHash){ + assert( p->funcFlags & SQLITE_FUNC_BUILTIN ); if( sqlite3StrICmp(p->zName, zFunc)==0 ){ return p; } @@ -118162,7 +119946,7 @@ SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs( const char *zName = aDef[i].zName; int nName = sqlite3Strlen30(zName); int h = SQLITE_FUNC_HASH(zName[0], nName); - assert( zName[0]>='a' && zName[0]<='z' ); + assert( aDef[i].funcFlags & SQLITE_FUNC_BUILTIN ); pOther = sqlite3FunctionSearch(h, zName); if( pOther ){ assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] ); @@ -118388,6 +120172,16 @@ SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ return pTab; } +/* Generate byte-code that will report the number of rows modified +** by a DELETE, INSERT, or UPDATE statement. +*/ +SQLITE_PRIVATE void sqlite3CodeChangeCount(Vdbe *v, int regCounter, const char *zColName){ + sqlite3VdbeAddOp0(v, OP_FkCheck); + sqlite3VdbeAddOp2(v, OP_ResultRow, regCounter, 1); + sqlite3VdbeSetNumCols(v, 1); + sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zColName, SQLITE_STATIC); +} + /* Return true if table pTab is read-only. ** ** A table is read-only if any of the following are true: @@ -118428,7 +120222,7 @@ SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ return 1; } #ifndef SQLITE_OMIT_VIEW - if( !viewOk && pTab->pSelect ){ + if( !viewOk && IsView(pTab) ){ sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName); return 1; } @@ -118532,13 +120326,13 @@ SQLITE_PRIVATE Expr *sqlite3LimitWhere( }else{ Index *pPk = sqlite3PrimaryKeyIndex(pTab); if( pPk->nKeyCol==1 ){ - const char *zName = pTab->aCol[pPk->aiColumn[0]].zName; + const char *zName = pTab->aCol[pPk->aiColumn[0]].zCnName; pLhs = sqlite3Expr(db, TK_ID, zName); pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, zName)); }else{ int i; for(i=0; inKeyCol; i++){ - Expr *p = sqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zName); + Expr *p = sqlite3Expr(db, TK_ID, pTab->aCol[pPk->aiColumn[i]].zCnName); pEList = sqlite3ExprListAppend(pParse, pEList, p); } pLhs = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); @@ -118554,6 +120348,7 @@ SQLITE_PRIVATE Expr *sqlite3LimitWhere( pSelectSrc = sqlite3SrcListDup(db, pSrc, 0); pSrc->a[0].pTab = pTab; if( pSrc->a[0].fg.isIndexedBy ){ + assert( pSrc->a[0].fg.isCte==0 ); pSrc->a[0].u2.pIBIndex = 0; pSrc->a[0].fg.isIndexedBy = 0; sqlite3DbFree(db, pSrc->a[0].u1.zIndexedBy); @@ -118626,9 +120421,11 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( memset(&sContext, 0, sizeof(sContext)); db = pParse->db; - if( pParse->nErr || db->mallocFailed ){ + assert( db->pParse==pParse ); + if( pParse->nErr ){ goto delete_from_cleanup; } + assert( db->mallocFailed==0 ); assert( pTabList->nSrc==1 ); @@ -118645,7 +120442,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( */ #ifndef SQLITE_OMIT_TRIGGER pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); - isView = pTab->pSelect!=0; + isView = IsView(pTab); #else # define pTrigger 0 # define isView 0 @@ -118809,7 +120606,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( ** ONEPASS_SINGLE: One-pass approach - at most one row deleted. ** ONEPASS_MULTI: One-pass approach - any number of rows may be deleted. */ - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, wcf, iTabCur+1); + pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0,0,wcf,iTabCur+1); if( pWInfo==0 ) goto delete_from_cleanup; eOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); assert( IsVirtual(pTab)==0 || eOnePass!=ONEPASS_MULTI ); @@ -118895,7 +120692,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( if( eOnePass!=ONEPASS_OFF ){ assert( nKey==nPk ); /* OP_Found will use an unpacked key */ if( !IsVirtual(pTab) && aToOpen[iDataCur-iTabCur] ){ - assert( pPk!=0 || pTab->pSelect!=0 ); + assert( pPk!=0 || IsView(pTab) ); sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey); VdbeCoverage(v); } @@ -118962,9 +120759,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom( ** invoke the callback function. */ if( memCnt ){ - sqlite3VdbeAddOp2(v, OP_ChngCntRow, memCnt, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC); + sqlite3CodeChangeCount(v, memCnt, "rows deleted"); } delete_from_cleanup: @@ -119129,7 +120924,7 @@ SQLITE_PRIVATE void sqlite3GenerateRowDelete( ** the update-hook is not invoked for rows removed by REPLACE, but the ** pre-update-hook is. */ - if( pTab->pSelect==0 ){ + if( !IsView(pTab) ){ u8 p5 = 0; sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur,0,iIdxNoSeek); sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, (count?OPFLAG_NCHANGE:0)); @@ -119415,6 +121210,18 @@ static void typeofFunc( sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC); } +/* subtype(X) +** +** Return the subtype of X +*/ +static void subtypeFunc( + sqlite3_context *context, + int argc, + sqlite3_value **argv +){ + UNUSED_PARAMETER(argc); + sqlite3_result_int(context, sqlite3_value_subtype(argv[0])); +} /* ** Implementation of the length() function @@ -119576,7 +121383,7 @@ endInstrOOM: } /* -** Implementation of the printf() function. +** Implementation of the printf() (a.k.a. format()) SQL function. */ static void printfFunc( sqlite3_context *context, @@ -119889,9 +121696,9 @@ static void last_insert_rowid( /* ** Implementation of the changes() SQL function. ** -** IMP: R-62073-11209 The changes() SQL function is a wrapper -** around the sqlite3_changes() C/C++ function and hence follows the same -** rules for counting changes. +** IMP: R-32760-32347 The changes() SQL function is a wrapper +** around the sqlite3_changes64() C/C++ function and hence follows the +** same rules for counting changes. */ static void changes( sqlite3_context *context, @@ -119900,12 +121707,12 @@ static void changes( ){ sqlite3 *db = sqlite3_context_db_handle(context); UNUSED_PARAMETER2(NotUsed, NotUsed2); - sqlite3_result_int(context, sqlite3_changes(db)); + sqlite3_result_int64(context, sqlite3_changes64(db)); } /* ** Implementation of the total_changes() SQL function. The return value is -** the same as the sqlite3_total_changes() API function. +** the same as the sqlite3_total_changes64() API function. */ static void total_changes( sqlite3_context *context, @@ -119914,9 +121721,9 @@ static void total_changes( ){ sqlite3 *db = sqlite3_context_db_handle(context); UNUSED_PARAMETER2(NotUsed, NotUsed2); - /* IMP: R-52756-41993 This function is a wrapper around the - ** sqlite3_total_changes() C/C++ interface. */ - sqlite3_result_int(context, sqlite3_total_changes(db)); + /* IMP: R-11217-42568 This function is a wrapper around the + ** sqlite3_total_changes64() C/C++ interface. */ + sqlite3_result_int64(context, sqlite3_total_changes64(db)); } /* @@ -120345,39 +122152,42 @@ static const char hexdigits[] = { }; /* -** Implementation of the QUOTE() function. This function takes a single -** argument. If the argument is numeric, the return value is the same as -** the argument. If the argument is NULL, the return value is the string -** "NULL". Otherwise, the argument is enclosed in single quotes with -** single-quote escapes. +** Append to pStr text that is the SQL literal representation of the +** value contained in pValue. */ -static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ - assert( argc==1 ); - UNUSED_PARAMETER(argc); - switch( sqlite3_value_type(argv[0]) ){ +SQLITE_PRIVATE void sqlite3QuoteValue(StrAccum *pStr, sqlite3_value *pValue){ + /* As currently implemented, the string must be initially empty. + ** we might relax this requirement in the future, but that will + ** require enhancements to the implementation. */ + assert( pStr!=0 && pStr->nChar==0 ); + + switch( sqlite3_value_type(pValue) ){ case SQLITE_FLOAT: { double r1, r2; - char zBuf[50]; - r1 = sqlite3_value_double(argv[0]); - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); - sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8); - if( r1!=r2 ){ - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1); + const char *zVal; + r1 = sqlite3_value_double(pValue); + sqlite3_str_appendf(pStr, "%!.15g", r1); + zVal = sqlite3_str_value(pStr); + if( zVal ){ + sqlite3AtoF(zVal, &r2, pStr->nChar, SQLITE_UTF8); + if( r1!=r2 ){ + sqlite3_str_reset(pStr); + sqlite3_str_appendf(pStr, "%!.20e", r1); + } } - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); break; } case SQLITE_INTEGER: { - sqlite3_result_value(context, argv[0]); + sqlite3_str_appendf(pStr, "%lld", sqlite3_value_int64(pValue)); break; } case SQLITE_BLOB: { - char *zText = 0; - char const *zBlob = sqlite3_value_blob(argv[0]); - int nBlob = sqlite3_value_bytes(argv[0]); - assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */ - zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4); - if( zText ){ + char const *zBlob = sqlite3_value_blob(pValue); + int nBlob = sqlite3_value_bytes(pValue); + assert( zBlob==sqlite3_value_blob(pValue) ); /* No encoding change */ + sqlite3StrAccumEnlarge(pStr, nBlob*2 + 4); + if( pStr->accError==0 ){ + char *zText = pStr->zText; int i; for(i=0; i>4)&0x0F]; @@ -120387,42 +122197,48 @@ static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ zText[(nBlob*2)+3] = '\0'; zText[0] = 'X'; zText[1] = '\''; - sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); - sqlite3_free(zText); + pStr->nChar = nBlob*2 + 3; } break; } case SQLITE_TEXT: { - int i,j; - u64 n; - const unsigned char *zArg = sqlite3_value_text(argv[0]); - char *z; - - if( zArg==0 ) return; - for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; } - z = contextMalloc(context, ((i64)i)+((i64)n)+3); - if( z ){ - z[0] = '\''; - for(i=0, j=1; zArg[i]; i++){ - z[j++] = zArg[i]; - if( zArg[i]=='\'' ){ - z[j++] = '\''; - } - } - z[j++] = '\''; - z[j] = 0; - sqlite3_result_text(context, z, j, sqlite3_free); - } + const unsigned char *zArg = sqlite3_value_text(pValue); + sqlite3_str_appendf(pStr, "%Q", zArg); break; } default: { - assert( sqlite3_value_type(argv[0])==SQLITE_NULL ); - sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC); + assert( sqlite3_value_type(pValue)==SQLITE_NULL ); + sqlite3_str_append(pStr, "NULL", 4); break; } } } +/* +** Implementation of the QUOTE() function. +** +** The quote(X) function returns the text of an SQL literal which is the +** value of its argument suitable for inclusion into an SQL statement. +** Strings are surrounded by single-quotes with escapes on interior quotes +** as needed. BLOBs are encoded as hexadecimal literals. Strings with +** embedded NUL characters cannot be represented as string literals in SQL +** and hence the returned string literal is truncated prior to the first NUL. +*/ +static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ + sqlite3_str str; + sqlite3 *db = sqlite3_context_db_handle(context); + assert( argc==1 ); + UNUSED_PARAMETER(argc); + sqlite3StrAccumInit(&str, db, 0, 0, db->aLimit[SQLITE_LIMIT_LENGTH]); + sqlite3QuoteValue(&str,argv[0]); + sqlite3_result_text(context, sqlite3StrAccumFinish(&str), str.nChar, + SQLITE_DYNAMIC); + if( str.accError!=SQLITE_OK ){ + sqlite3_result_null(context); + sqlite3_result_error_code(context, str.accError); + } +} + /* ** The unicode() function. Return the integer unicode code-point value ** for the first character of the input string. @@ -121033,97 +122849,167 @@ static void minMaxFinalize(sqlite3_context *context){ /* ** group_concat(EXPR, ?SEPARATOR?) +** +** The SEPARATOR goes before the EXPR string. This is tragic. The +** groupConcatInverse() implementation would have been easier if the +** SEPARATOR were appended after EXPR. And the order is undocumented, +** so we could change it, in theory. But the old behavior has been +** around for so long that we dare not, for fear of breaking something. */ +typedef struct { + StrAccum str; /* The accumulated concatenation */ +#ifndef SQLITE_OMIT_WINDOWFUNC + int nAccum; /* Number of strings presently concatenated */ + int nFirstSepLength; /* Used to detect separator length change */ + /* If pnSepLengths!=0, refs an array of inter-string separator lengths, + ** stored as actually incorporated into presently accumulated result. + ** (Hence, its slots in use number nAccum-1 between method calls.) + ** If pnSepLengths==0, nFirstSepLength is the length used throughout. + */ + int *pnSepLengths; +#endif +} GroupConcatCtx; + static void groupConcatStep( sqlite3_context *context, int argc, sqlite3_value **argv ){ const char *zVal; - StrAccum *pAccum; + GroupConcatCtx *pGCC; const char *zSep; int nVal, nSep; assert( argc==1 || argc==2 ); if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum)); - - if( pAccum ){ + pGCC = (GroupConcatCtx*)sqlite3_aggregate_context(context, sizeof(*pGCC)); + if( pGCC ){ sqlite3 *db = sqlite3_context_db_handle(context); - int firstTerm = pAccum->mxAlloc==0; - pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH]; - if( !firstTerm ){ - if( argc==2 ){ - zSep = (char*)sqlite3_value_text(argv[1]); - nSep = sqlite3_value_bytes(argv[1]); - }else{ - zSep = ","; - nSep = 1; + int firstTerm = pGCC->str.mxAlloc==0; + pGCC->str.mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH]; + if( argc==1 ){ + if( !firstTerm ){ + sqlite3_str_appendchar(&pGCC->str, 1, ','); + } +#ifndef SQLITE_OMIT_WINDOWFUNC + else{ + pGCC->nFirstSepLength = 1; + } +#endif + }else if( !firstTerm ){ + zSep = (char*)sqlite3_value_text(argv[1]); + nSep = sqlite3_value_bytes(argv[1]); + if( zSep ){ + sqlite3_str_append(&pGCC->str, zSep, nSep); + } +#ifndef SQLITE_OMIT_WINDOWFUNC + else{ + nSep = 0; + } + if( nSep != pGCC->nFirstSepLength || pGCC->pnSepLengths != 0 ){ + int *pnsl = pGCC->pnSepLengths; + if( pnsl == 0 ){ + /* First separator length variation seen, start tracking them. */ + pnsl = (int*)sqlite3_malloc64((pGCC->nAccum+1) * sizeof(int)); + if( pnsl!=0 ){ + int i = 0, nA = pGCC->nAccum-1; + while( inFirstSepLength; + } + }else{ + pnsl = (int*)sqlite3_realloc64(pnsl, pGCC->nAccum * sizeof(int)); + } + if( pnsl!=0 ){ + if( ALWAYS(pGCC->nAccum>0) ){ + pnsl[pGCC->nAccum-1] = nSep; + } + pGCC->pnSepLengths = pnsl; + }else{ + sqlite3StrAccumSetError(&pGCC->str, SQLITE_NOMEM); + } } - if( zSep ) sqlite3_str_append(pAccum, zSep, nSep); +#endif } +#ifndef SQLITE_OMIT_WINDOWFUNC + else{ + pGCC->nFirstSepLength = sqlite3_value_bytes(argv[1]); + } + pGCC->nAccum += 1; +#endif zVal = (char*)sqlite3_value_text(argv[0]); nVal = sqlite3_value_bytes(argv[0]); - if( zVal ) sqlite3_str_append(pAccum, zVal, nVal); + if( zVal ) sqlite3_str_append(&pGCC->str, zVal, nVal); } } + #ifndef SQLITE_OMIT_WINDOWFUNC static void groupConcatInverse( sqlite3_context *context, int argc, sqlite3_value **argv ){ - int n; - StrAccum *pAccum; + GroupConcatCtx *pGCC; assert( argc==1 || argc==2 ); + (void)argc; /* Suppress unused parameter warning */ if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum)); - /* pAccum is always non-NULL since groupConcatStep() will have always + pGCC = (GroupConcatCtx*)sqlite3_aggregate_context(context, sizeof(*pGCC)); + /* pGCC is always non-NULL since groupConcatStep() will have always ** run frist to initialize it */ - if( ALWAYS(pAccum) ){ - n = sqlite3_value_bytes(argv[0]); - if( argc==2 ){ - n += sqlite3_value_bytes(argv[1]); + if( ALWAYS(pGCC) ){ + int nVS; + /* Must call sqlite3_value_text() to convert the argument into text prior + ** to invoking sqlite3_value_bytes(), in case the text encoding is UTF16 */ + (void)sqlite3_value_text(argv[0]); + nVS = sqlite3_value_bytes(argv[0]); + pGCC->nAccum -= 1; + if( pGCC->pnSepLengths!=0 ){ + assert(pGCC->nAccum >= 0); + if( pGCC->nAccum>0 ){ + nVS += *pGCC->pnSepLengths; + memmove(pGCC->pnSepLengths, pGCC->pnSepLengths+1, + (pGCC->nAccum-1)*sizeof(int)); + } }else{ - n++; + /* If removing single accumulated string, harmlessly over-do. */ + nVS += pGCC->nFirstSepLength; } - if( n>=(int)pAccum->nChar ){ - pAccum->nChar = 0; + if( nVS>=(int)pGCC->str.nChar ){ + pGCC->str.nChar = 0; }else{ - pAccum->nChar -= n; - memmove(pAccum->zText, &pAccum->zText[n], pAccum->nChar); + pGCC->str.nChar -= nVS; + memmove(pGCC->str.zText, &pGCC->str.zText[nVS], pGCC->str.nChar); + } + if( pGCC->str.nChar==0 ){ + pGCC->str.mxAlloc = 0; + sqlite3_free(pGCC->pnSepLengths); + pGCC->pnSepLengths = 0; } - if( pAccum->nChar==0 ) pAccum->mxAlloc = 0; } } #else # define groupConcatInverse 0 #endif /* SQLITE_OMIT_WINDOWFUNC */ static void groupConcatFinalize(sqlite3_context *context){ - StrAccum *pAccum; - pAccum = sqlite3_aggregate_context(context, 0); - if( pAccum ){ - if( pAccum->accError==SQLITE_TOOBIG ){ - sqlite3_result_error_toobig(context); - }else if( pAccum->accError==SQLITE_NOMEM ){ - sqlite3_result_error_nomem(context); - }else{ - sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, - sqlite3_free); - } + GroupConcatCtx *pGCC + = (GroupConcatCtx*)sqlite3_aggregate_context(context, 0); + if( pGCC ){ + sqlite3ResultStrAccum(context, &pGCC->str); +#ifndef SQLITE_OMIT_WINDOWFUNC + sqlite3_free(pGCC->pnSepLengths); +#endif } } #ifndef SQLITE_OMIT_WINDOWFUNC static void groupConcatValue(sqlite3_context *context){ - sqlite3_str *pAccum; - pAccum = (sqlite3_str*)sqlite3_aggregate_context(context, 0); - if( pAccum ){ + GroupConcatCtx *pGCC + = (GroupConcatCtx*)sqlite3_aggregate_context(context, 0); + if( pGCC ){ + StrAccum *pAccum = &pGCC->str; if( pAccum->accError==SQLITE_TOOBIG ){ sqlite3_result_error_toobig(context); }else if( pAccum->accError==SQLITE_NOMEM ){ sqlite3_result_error_nomem(context); }else{ const char *zText = sqlite3_str_value(pAccum); - sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); + sqlite3_result_text(context, zText, pAccum->nChar, SQLITE_TRANSIENT); } } } @@ -121187,11 +123073,12 @@ SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocas int nExpr; assert( pExpr!=0 ); assert( pExpr->op==TK_FUNCTION ); + assert( ExprUseXList(pExpr) ); if( !pExpr->x.pList ){ return 0; } - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); nExpr = pExpr->x.pList->nExpr; + assert( !ExprHasProperty(pExpr, EP_IntValue) ); pDef = sqlite3FindFunction(db, pExpr->u.zToken, nExpr, SQLITE_UTF8, 0); #ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION if( pDef==0 ) return 0; @@ -121215,6 +123102,7 @@ SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocas Expr *pEscape = pExpr->x.pList->a[2].pExpr; char *zEscape; if( pEscape->op!=TK_STRING ) return 0; + assert( !ExprHasProperty(pEscape, EP_IntValue) ); zEscape = pEscape->u.zToken; if( zEscape[0]==0 || zEscape[1]!=0 ) return 0; if( zEscape[0]==aWc[0] ) return 0; @@ -121441,12 +123329,12 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ */ static FuncDef aBuiltinFunc[] = { /***** Functions only available with SQLITE_TESTCTRL_INTERNAL_FUNCTIONS *****/ +#if !defined(SQLITE_UNTESTABLE) TEST_FUNC(implies_nonnull_row, 2, INLINEFUNC_implies_nonnull_row, 0), TEST_FUNC(expr_compare, 2, INLINEFUNC_expr_compare, 0), TEST_FUNC(expr_implies_expr, 2, INLINEFUNC_expr_implies_expr, 0), -#ifdef SQLITE_DEBUG - TEST_FUNC(affinity, 1, INLINEFUNC_affinity, 0), -#endif + TEST_FUNC(affinity, 1, INLINEFUNC_affinity, 0), +#endif /* !defined(SQLITE_UNTESTABLE) */ /***** Regular functions *****/ #ifdef SQLITE_SOUNDEX FUNCTION(soundex, 1, 0, 0, soundexFunc ), @@ -121466,8 +123354,8 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ INLINE_FUNC(likelihood, 2, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), INLINE_FUNC(likely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC - FUNCTION2(sqlite_offset, 1, 0, 0, noopFunc, SQLITE_FUNC_OFFSET| - SQLITE_FUNC_TYPEOF), + {1, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_OFFSET|SQLITE_FUNC_TYPEOF, + 0, 0, noopFunc, 0, 0, 0, "sqlite_offset", {0} }, #endif FUNCTION(ltrim, 1, 1, 0, trimFunc ), FUNCTION(ltrim, 2, 1, 0, trimFunc ), @@ -121478,15 +123366,17 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ FUNCTION(min, -1, 0, 1, minmaxFunc ), FUNCTION(min, 0, 0, 1, 0 ), WAGGREGATE(min, 1, 0, 1, minmaxStep, minMaxFinalize, minMaxValue, 0, - SQLITE_FUNC_MINMAX ), + SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ), FUNCTION(max, -1, 1, 1, minmaxFunc ), FUNCTION(max, 0, 1, 1, 0 ), WAGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize, minMaxValue, 0, - SQLITE_FUNC_MINMAX ), + SQLITE_FUNC_MINMAX|SQLITE_FUNC_ANYORDER ), FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), + FUNCTION2(subtype, 1, 0, 0, subtypeFunc, SQLITE_FUNC_TYPEOF), FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), FUNCTION(instr, 2, 0, 0, instrFunc ), FUNCTION(printf, -1, 0, 0, printfFunc ), + FUNCTION(format, -1, 0, 0, printfFunc ), FUNCTION(unicode, 1, 0, 0, unicodeFunc ), FUNCTION(char, -1, 0, 0, charFunc ), FUNCTION(abs, 1, 0, 0, absFunc ), @@ -121518,9 +123408,10 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ WAGGREGATE(total, 1,0,0, sumStep,totalFinalize,totalFinalize,sumInverse, 0), WAGGREGATE(avg, 1,0,0, sumStep, avgFinalize, avgFinalize, sumInverse, 0), WAGGREGATE(count, 0,0,0, countStep, - countFinalize, countFinalize, countInverse, SQLITE_FUNC_COUNT ), + countFinalize, countFinalize, countInverse, + SQLITE_FUNC_COUNT|SQLITE_FUNC_ANYORDER ), WAGGREGATE(count, 1,0,0, countStep, - countFinalize, countFinalize, countInverse, 0 ), + countFinalize, countFinalize, countInverse, SQLITE_FUNC_ANYORDER ), WAGGREGATE(group_concat, 1, 0, 0, groupConcatStep, groupConcatFinalize, groupConcatValue, groupConcatInverse, 0), WAGGREGATE(group_concat, 2, 0, 0, groupConcatStep, @@ -121584,6 +123475,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ #endif sqlite3WindowFunctions(); sqlite3RegisterDateTimeFunctions(); + sqlite3RegisterJsonFunctions(); sqlite3InsertBuiltinFuncs(aBuiltinFunc, ArraySize(aBuiltinFunc)); #if 0 /* Enable to print out how the built-in functions are hashed */ @@ -121595,6 +123487,7 @@ SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(void){ for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash){ int n = sqlite3Strlen30(p->zName); int h = p->zName[0] + n; + assert( p->funcFlags & SQLITE_FUNC_BUILTIN ); printf(" %s(%d)", p->zName, h); } printf("\n"); @@ -121822,7 +123715,9 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex( */ if( pParent->iPKey>=0 ){ if( !zKey ) return 0; - if( !sqlite3StrICmp(pParent->aCol[pParent->iPKey].zName, zKey) ) return 0; + if( !sqlite3StrICmp(pParent->aCol[pParent->iPKey].zCnName, zKey) ){ + return 0; + } } }else if( paiCol ){ assert( nCol>1 ); @@ -121864,11 +123759,11 @@ SQLITE_PRIVATE int sqlite3FkLocateIndex( /* If the index uses a collation sequence that is different from ** the default collation sequence for the column, this index is ** unusable. Bail out early in this case. */ - zDfltColl = pParent->aCol[iCol].zColl; + zDfltColl = sqlite3ColumnColl(&pParent->aCol[iCol]); if( !zDfltColl ) zDfltColl = sqlite3StrBINARY; if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break; - zIdxCol = pParent->aCol[iCol].zName; + zIdxCol = pParent->aCol[iCol].zCnName; for(j=0; jaCol[j].zCol, zIdxCol)==0 ){ if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom; @@ -122092,7 +123987,7 @@ static Expr *exprTableRegister( pCol = &pTab->aCol[iCol]; pExpr->iTable = regBase + sqlite3TableColumnToStorage(pTab,iCol) + 1; pExpr->affExpr = pCol->affinity; - zColl = pCol->zColl; + zColl = sqlite3ColumnColl(pCol); if( zColl==0 ) zColl = db->pDfltColl->zName; pExpr = sqlite3ExprAddCollateString(pParse, pExpr, zColl); }else{ @@ -122115,6 +124010,7 @@ static Expr *exprTableColumn( ){ Expr *pExpr = sqlite3Expr(db, TK_COLUMN, 0); if( pExpr ){ + assert( ExprUseYTab(pExpr) ); pExpr->y.pTab = pTab; pExpr->iTable = iCursor; pExpr->iColumn = iCol; @@ -122201,7 +124097,7 @@ static void fkScanChildren( pLeft = exprTableRegister(pParse, pTab, regData, iCol); iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom; assert( iCol>=0 ); - zCol = pFKey->pFrom->aCol[iCol].zName; + zCol = pFKey->pFrom->aCol[iCol].zCnName; pRight = sqlite3Expr(db, TK_ID, zCol); pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight); pWhere = sqlite3ExprAnd(pParse, pWhere, pEq); @@ -122236,7 +124132,7 @@ static void fkScanChildren( i16 iCol = pIdx->aiColumn[i]; assert( iCol>=0 ); pLeft = exprTableRegister(pParse, pTab, regData, iCol); - pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName); + pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zCnName); pEq = sqlite3PExpr(pParse, TK_IS, pLeft, pRight); pAll = sqlite3ExprAnd(pParse, pAll, pEq); } @@ -122255,7 +124151,7 @@ static void fkScanChildren( ** clause. For each row found, increment either the deferred or immediate ** foreign key constraint counter. */ if( pParse->nErr==0 ){ - pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); + pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0, 0); sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); if( pWInfo ){ sqlite3WhereEnd(pWInfo); @@ -122306,6 +124202,25 @@ static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){ } } +/* +** Clear the apTrigger[] cache of CASCADE triggers for all foreign keys +** in a particular database. This needs to happen when the schema +** changes. +*/ +SQLITE_PRIVATE void sqlite3FkClearTriggerCache(sqlite3 *db, int iDb){ + HashElem *k; + Hash *pHash = &db->aDb[iDb].pSchema->tblHash; + for(k=sqliteHashFirst(pHash); k; k=sqliteHashNext(k)){ + Table *pTab = sqliteHashData(k); + FKey *pFKey; + if( !IsOrdinaryTable(pTab) ) continue; + for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){ + fkTriggerDelete(db, pFKey->apTrigger[0]); pFKey->apTrigger[0] = 0; + fkTriggerDelete(db, pFKey->apTrigger[1]); pFKey->apTrigger[1] = 0; + } + } +} + /* ** This function is called to generate code that runs when table pTab is ** being dropped from the database. The SrcList passed as the second argument @@ -122325,12 +124240,12 @@ static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){ */ SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){ sqlite3 *db = pParse->db; - if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) ){ + if( (db->flags&SQLITE_ForeignKeys) && IsOrdinaryTable(pTab) ){ int iSkip = 0; Vdbe *v = sqlite3GetVdbe(pParse); assert( v ); /* VDBE has already been allocated */ - assert( pTab->pSelect==0 ); /* Not a view */ + assert( IsOrdinaryTable(pTab) ); if( sqlite3FkReferences(pTab)==0 ){ /* Search for a deferred foreign key constraint for which this table ** is the child table. If one cannot be found, return without @@ -122338,7 +124253,7 @@ SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTa ** the entire DELETE if there are no outstanding deferred constraints ** when this statement is run. */ FKey *p; - for(p=pTab->pFKey; p; p=p->pNextFrom){ + for(p=pTab->u.tab.pFKey; p; p=p->pNextFrom){ if( p->isDeferred || (db->flags & SQLITE_DeferFKs) ) break; } if( !p ) return; @@ -122427,7 +124342,7 @@ static int fkParentIsModified( if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){ Column *pCol = &pTab->aCol[iKey]; if( zKey ){ - if( 0==sqlite3StrICmp(pCol->zName, zKey) ) return 1; + if( 0==sqlite3StrICmp(pCol->zCnName, zKey) ) return 1; }else if( pCol->colFlags & COLFLAG_PRIMKEY ){ return 1; } @@ -122494,13 +124409,14 @@ SQLITE_PRIVATE void sqlite3FkCheck( /* If foreign-keys are disabled, this function is a no-op. */ if( (db->flags&SQLITE_ForeignKeys)==0 ) return; + if( !IsOrdinaryTable(pTab) ) return; iDb = sqlite3SchemaToIndex(db, pTab->pSchema); zDb = db->aDb[iDb].zDbSName; /* Loop through all the foreign key constraints for which pTab is the ** child table (the table that the foreign key definition is part of). */ - for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ + for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pFKey->pNextFrom){ Table *pTo; /* Parent table of foreign key pFKey */ Index *pIdx = 0; /* Index on key columns in pTo */ int *aiFree = 0; @@ -122567,7 +124483,7 @@ SQLITE_PRIVATE void sqlite3FkCheck( ** values read from the parent table are NULL. */ if( db->xAuth ){ int rcauth; - char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zName; + char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zCnName; rcauth = sqlite3AuthReadCol(pParse, pTo->zName, zCol, iDb); bIgnore = (rcauth==SQLITE_IGNORE); } @@ -122682,10 +124598,10 @@ SQLITE_PRIVATE u32 sqlite3FkOldmask( Table *pTab /* Table being modified */ ){ u32 mask = 0; - if( pParse->db->flags&SQLITE_ForeignKeys ){ + if( pParse->db->flags&SQLITE_ForeignKeys && IsOrdinaryTable(pTab) ){ FKey *p; int i; - for(p=pTab->pFKey; p; p=p->pNextFrom){ + for(p=pTab->u.tab.pFKey; p; p=p->pNextFrom){ for(i=0; inCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom); } for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ @@ -122735,19 +124651,19 @@ SQLITE_PRIVATE int sqlite3FkRequired( ){ int eRet = 1; /* Value to return if bHaveFK is true */ int bHaveFK = 0; /* If FK processing is required */ - if( pParse->db->flags&SQLITE_ForeignKeys ){ + if( pParse->db->flags&SQLITE_ForeignKeys && IsOrdinaryTable(pTab) ){ if( !aChange ){ /* A DELETE operation. Foreign key processing is required if the ** table in question is either the child or parent table for any ** foreign key constraint. */ - bHaveFK = (sqlite3FkReferences(pTab) || pTab->pFKey); + bHaveFK = (sqlite3FkReferences(pTab) || pTab->u.tab.pFKey); }else{ /* This is an UPDATE. Foreign key processing is only required if the ** operation modifies one or more child or parent key columns. */ FKey *p; /* Check if any child key columns are being modified. */ - for(p=pTab->pFKey; p; p=p->pNextFrom){ + for(p=pTab->u.tab.pFKey; p; p=p->pNextFrom){ if( fkChildIsModified(pTab, p, aChange, chngRowid) ){ if( 0==sqlite3_stricmp(pTab->zName, p->zTo) ) eRet = 2; bHaveFK = 1; @@ -122840,8 +124756,8 @@ static Trigger *fkActionTrigger( assert( pIdx!=0 || (pTab->iPKey>=0 && pTab->iPKeynCol) ); assert( pIdx==0 || pIdx->aiColumn[i]>=0 ); sqlite3TokenInit(&tToCol, - pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zName); - sqlite3TokenInit(&tFromCol, pFKey->pFrom->aCol[iFromCol].zName); + pTab->aCol[pIdx ? pIdx->aiColumn[i] : pTab->iPKey].zCnName); + sqlite3TokenInit(&tFromCol, pFKey->pFrom->aCol[iFromCol].zCnName); /* Create the expression "OLD.zToCol = zFromCol". It is important ** that the "OLD.zToCol" term is on the LHS of the = operator, so @@ -122886,7 +124802,7 @@ static Trigger *fkActionTrigger( testcase( pCol->colFlags & COLFLAG_STORED ); pDflt = 0; }else{ - pDflt = pCol->pDflt; + pDflt = sqlite3ColumnExpr(pFKey->pFrom, pCol); } if( pDflt ){ pNew = sqlite3ExprDup(db, pDflt, 0); @@ -123023,9 +124939,9 @@ SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ FKey *pFKey; /* Iterator variable */ FKey *pNext; /* Copy of pFKey->pNextFrom */ - assert( db==0 || IsVirtual(pTab) - || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); - for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){ + assert( IsOrdinaryTable(pTab) ); + for(pFKey=pTab->u.tab.pFKey; pFKey; pFKey=pNext){ + assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); /* Remove the FK from the fkeyHash hash table. */ if( !db || db->pnBytesFreed==0 ){ @@ -123105,7 +125021,7 @@ SQLITE_PRIVATE void sqlite3OpenTable( }else{ Index *pPk = sqlite3PrimaryKeyIndex(pTab); assert( pPk!=0 ); - assert( pPk->tnum==pTab->tnum ); + assert( pPk->tnum==pTab->tnum || CORRUPT_DB ); sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb); sqlite3VdbeSetP4KeyInfo(pParse, pPk); VdbeComment((v, "%s", pTab->zName)); @@ -123172,28 +125088,68 @@ SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3 *db, Index *pIdx){ } /* +** Make changes to the evolving bytecode to do affinity transformations +** of values that are about to be gathered into a row for table pTab. +** +** For ordinary (legacy, non-strict) tables: +** ----------------------------------------- +** ** Compute the affinity string for table pTab, if it has not already been ** computed. As an optimization, omit trailing SQLITE_AFF_BLOB affinities. ** -** If the affinity exists (if it is no entirely SQLITE_AFF_BLOB values) and -** if iReg>0 then code an OP_Affinity opcode that will set the affinities -** for register iReg and following. Or if affinities exists and iReg==0, +** If the affinity string is empty (because it was all SQLITE_AFF_BLOB entries +** which were then optimized out) then this routine becomes a no-op. +** +** Otherwise if iReg>0 then code an OP_Affinity opcode that will set the +** affinities for register iReg and following. Or if iReg==0, ** then just set the P4 operand of the previous opcode (which should be ** an OP_MakeRecord) to the affinity string. ** ** A column affinity string has one character per column: ** -** Character Column affinity -** ------------------------------ -** 'A' BLOB -** 'B' TEXT -** 'C' NUMERIC -** 'D' INTEGER -** 'E' REAL +** Character Column affinity +** --------- --------------- +** 'A' BLOB +** 'B' TEXT +** 'C' NUMERIC +** 'D' INTEGER +** 'E' REAL +** +** For STRICT tables: +** ------------------ +** +** Generate an appropropriate OP_TypeCheck opcode that will verify the +** datatypes against the column definitions in pTab. If iReg==0, that +** means an OP_MakeRecord opcode has already been generated and should be +** the last opcode generated. The new OP_TypeCheck needs to be inserted +** before the OP_MakeRecord. The new OP_TypeCheck should use the same +** register set as the OP_MakeRecord. If iReg>0 then register iReg is +** the first of a series of registers that will form the new record. +** Apply the type checking to that array of registers. */ SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ int i, j; - char *zColAff = pTab->zColAff; + char *zColAff; + if( pTab->tabFlags & TF_Strict ){ + if( iReg==0 ){ + /* Move the previous opcode (which should be OP_MakeRecord) forward + ** by one slot and insert a new OP_TypeCheck where the current + ** OP_MakeRecord is found */ + VdbeOp *pPrev; + sqlite3VdbeAppendP4(v, pTab, P4_TABLE); + pPrev = sqlite3VdbeGetOp(v, -1); + assert( pPrev!=0 ); + assert( pPrev->opcode==OP_MakeRecord || sqlite3VdbeDb(v)->mallocFailed ); + pPrev->opcode = OP_TypeCheck; + sqlite3VdbeAddOp3(v, OP_MakeRecord, pPrev->p1, pPrev->p2, pPrev->p3); + }else{ + /* Insert an isolated OP_Typecheck */ + sqlite3VdbeAddOp2(v, OP_TypeCheck, iReg, pTab->nNVCol); + sqlite3VdbeAppendP4(v, pTab, P4_TABLE); + } + return; + } + zColAff = pTab->zColAff; if( zColAff==0 ){ sqlite3 *db = sqlite3VdbeDb(v); zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1); @@ -123203,7 +125159,7 @@ SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ } for(i=j=0; inCol; i++){ - assert( pTab->aCol[i].affinity!=0 ); + assert( pTab->aCol[i].affinity!=0 || sqlite3VdbeParser(v)->nErr>0 ); if( (pTab->aCol[i].colFlags & COLFLAG_VIRTUAL)==0 ){ zColAff[j++] = pTab->aCol[i].affinity; } @@ -123219,6 +125175,8 @@ SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe *v, Table *pTab, int iReg){ if( iReg ){ sqlite3VdbeAddOp4(v, OP_Affinity, iReg, i, 0, zColAff, i); }else{ + assert( sqlite3VdbeGetOp(v, -1)->opcode==OP_MakeRecord + || sqlite3VdbeDb(v)->mallocFailed ); sqlite3VdbeChangeP4(v, -1, zColAff, i); } } @@ -123302,24 +125260,30 @@ SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( ** that appropriate affinity has been applied to the regular columns */ sqlite3TableAffinity(pParse->pVdbe, pTab, iRegStore); - if( (pTab->tabFlags & TF_HasStored)!=0 - && (pOp = sqlite3VdbeGetOp(pParse->pVdbe,-1))->opcode==OP_Affinity - ){ - /* Change the OP_Affinity argument to '@' (NONE) for all stored - ** columns. '@' is the no-op affinity and those columns have not - ** yet been computed. */ - int ii, jj; - char *zP4 = pOp->p4.z; - assert( zP4!=0 ); - assert( pOp->p4type==P4_DYNAMIC ); - for(ii=jj=0; zP4[jj]; ii++){ - if( pTab->aCol[ii].colFlags & COLFLAG_VIRTUAL ){ - continue; - } - if( pTab->aCol[ii].colFlags & COLFLAG_STORED ){ - zP4[jj] = SQLITE_AFF_NONE; + if( (pTab->tabFlags & TF_HasStored)!=0 ){ + pOp = sqlite3VdbeGetOp(pParse->pVdbe,-1); + if( pOp->opcode==OP_Affinity ){ + /* Change the OP_Affinity argument to '@' (NONE) for all stored + ** columns. '@' is the no-op affinity and those columns have not + ** yet been computed. */ + int ii, jj; + char *zP4 = pOp->p4.z; + assert( zP4!=0 ); + assert( pOp->p4type==P4_DYNAMIC ); + for(ii=jj=0; zP4[jj]; ii++){ + if( pTab->aCol[ii].colFlags & COLFLAG_VIRTUAL ){ + continue; + } + if( pTab->aCol[ii].colFlags & COLFLAG_STORED ){ + zP4[jj] = SQLITE_AFF_NONE; + } + jj++; } - jj++; + }else if( pOp->opcode==OP_TypeCheck ){ + /* If an OP_TypeCheck was generated because the table is STRICT, + ** then set the P3 operand to indicate that generated columns should + ** not be checked */ + pOp->p3 = 1; } } @@ -123355,7 +125319,7 @@ SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( int x; pCol->colFlags |= COLFLAG_BUSY; w.eCode = 0; - sqlite3WalkExpr(&w, pCol->pDflt); + sqlite3WalkExpr(&w, sqlite3ColumnExpr(pTab, pCol)); pCol->colFlags &= ~COLFLAG_BUSY; if( w.eCode & COLFLAG_NOTAVAIL ){ pRedo = pCol; @@ -123364,13 +125328,13 @@ SQLITE_PRIVATE void sqlite3ComputeGeneratedColumns( eProgress = 1; assert( pCol->colFlags & COLFLAG_GENERATED ); x = sqlite3TableColumnToStorage(pTab, i) + iRegStore; - sqlite3ExprCodeGeneratedColumn(pParse, pCol, x); + sqlite3ExprCodeGeneratedColumn(pParse, pTab, pCol, x); pCol->colFlags &= ~COLFLAG_NOTAVAIL; } } }while( pRedo && eProgress ); if( pRedo ){ - sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pRedo->zName); + sqlite3ErrorMsg(pParse, "generated column loop on \"%s\"", pRedo->zCnName); } pParse->iSelfTab = 0; } @@ -123729,9 +125693,11 @@ SQLITE_PRIVATE void sqlite3Insert( #endif db = pParse->db; - if( pParse->nErr || db->mallocFailed ){ + assert( db->pParse==pParse ); + if( pParse->nErr ){ goto insert_cleanup; } + assert( db->mallocFailed==0 ); dest.iSDParm = 0; /* Suppress a harmless compiler warning */ /* If the Select object is really just a simple VALUES() list with a @@ -123765,7 +125731,7 @@ SQLITE_PRIVATE void sqlite3Insert( */ #ifndef SQLITE_OMIT_TRIGGER pTrigger = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask); - isView = pTab->pSelect!=0; + isView = IsView(pTab); #else # define pTrigger 0 # define tmask 0 @@ -123807,7 +125773,11 @@ SQLITE_PRIVATE void sqlite3Insert( ** ** This is the 2nd template. */ - if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){ + if( pColumn==0 + && pSelect!=0 + && pTrigger==0 + && xferOptimization(pParse, pTab, pSelect, onError, iDb) + ){ assert( !pTrigger ); assert( pList==0 ); goto insert_end; @@ -123856,7 +125826,7 @@ SQLITE_PRIVATE void sqlite3Insert( } for(i=0; inId; i++){ for(j=0; jnCol; j++){ - if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){ + if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zCnName)==0 ){ pColumn->a[i].idx = j; if( i!=j ) bIdListInOrder = 0; if( j==pTab->iPKey ){ @@ -123866,7 +125836,7 @@ SQLITE_PRIVATE void sqlite3Insert( if( pTab->aCol[j].colFlags & (COLFLAG_STORED|COLFLAG_VIRTUAL) ){ sqlite3ErrorMsg(pParse, "cannot INSERT into generated column \"%s\"", - pTab->aCol[j].zName); + pTab->aCol[j].zCnName); goto insert_cleanup; } #endif @@ -123907,7 +125877,9 @@ SQLITE_PRIVATE void sqlite3Insert( dest.nSdst = pTab->nCol; rc = sqlite3Select(pParse, pSelect, &dest); regFromSelect = dest.iSdst; - if( rc || db->mallocFailed || pParse->nErr ) goto insert_cleanup; + assert( db->pParse==pParse ); + if( rc || pParse->nErr ) goto insert_cleanup; + assert( db->mallocFailed==0 ); sqlite3VdbeEndCoroutine(v, regYield); sqlite3VdbeJumpHere(v, addrTop - 1); /* label B: */ assert( pSelect->pEList ); @@ -124051,7 +126023,7 @@ SQLITE_PRIVATE void sqlite3Insert( pTab->zName); goto insert_cleanup; } - if( pTab->pSelect ){ + if( IsView(pTab) ){ sqlite3ErrorMsg(pParse, "cannot UPSERT a view"); goto insert_cleanup; } @@ -124150,7 +126122,9 @@ SQLITE_PRIVATE void sqlite3Insert( }else if( pColumn==0 ){ /* Hidden columns that are not explicitly named in the INSERT ** get there default value */ - sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); + sqlite3ExprCodeFactorable(pParse, + sqlite3ColumnExpr(pTab, &pTab->aCol[i]), + iRegStore); continue; } } @@ -124159,13 +126133,17 @@ SQLITE_PRIVATE void sqlite3Insert( if( j>=pColumn->nId ){ /* A column not named in the insert column list gets its ** default value */ - sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); + sqlite3ExprCodeFactorable(pParse, + sqlite3ColumnExpr(pTab, &pTab->aCol[i]), + iRegStore); continue; } k = j; }else if( nColumn==0 ){ /* This is INSERT INTO ... DEFAULT VALUES. Load the default value. */ - sqlite3ExprCodeFactorable(pParse, pTab->aCol[i].pDflt, iRegStore); + sqlite3ExprCodeFactorable(pParse, + sqlite3ColumnExpr(pTab, &pTab->aCol[i]), + iRegStore); continue; }else{ k = i - nHidden; @@ -124390,9 +126368,7 @@ insert_end: ** invoke the callback function. */ if( regRowCount ){ - sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC); + sqlite3CodeChangeCount(v, regRowCount, "rows inserted"); } insert_cleanup: @@ -124427,7 +126403,7 @@ insert_cleanup: /* This is the Walker callback from sqlite3ExprReferencesUpdatedColumn(). * Set bit 0x01 of pWalker->eCode if pWalker->eCode to 0 and if this ** expression node references any of the -** columns that are being modified by an UPDATE statement. +** columns that are being modifed by an UPDATE statement. */ static int checkConstraintExprNode(Walker *pWalker, Expr *pExpr){ if( pExpr->op==TK_COLUMN ){ @@ -124680,7 +126656,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( db = pParse->db; v = pParse->pVdbe; assert( v!=0 ); - assert( pTab->pSelect==0 ); /* This table is not a VIEW */ + assert( !IsView(pTab) ); /* This table is not a VIEW */ nCol = pTab->nCol; /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for @@ -124731,7 +126707,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( } if( onError==OE_Replace ){ if( b2ndPass /* REPLACE becomes ABORT on the 2nd pass */ - || pCol->pDflt==0 /* REPLACE is ABORT if no DEFAULT value */ + || pCol->iDflt==0 /* REPLACE is ABORT if no DEFAULT value */ ){ testcase( pCol->colFlags & COLFLAG_VIRTUAL ); testcase( pCol->colFlags & COLFLAG_STORED ); @@ -124753,7 +126729,8 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( VdbeCoverage(v); assert( (pCol->colFlags & COLFLAG_GENERATED)==0 ); nSeenReplace++; - sqlite3ExprCodeCopy(pParse, pCol->pDflt, iReg); + sqlite3ExprCodeCopy(pParse, + sqlite3ColumnExpr(pTab, pCol), iReg); sqlite3VdbeJumpHere(v, addr1); break; } @@ -124763,7 +126740,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( case OE_Rollback: case OE_Fail: { char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName, - pCol->zName); + pCol->zCnName); sqlite3VdbeAddOp3(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, onError, iReg); sqlite3VdbeAppendP4(v, zMsg, P4_DYNAMIC); @@ -125016,6 +126993,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( if( onError==OE_Replace /* IPK rule is REPLACE */ && onError!=overrideError /* Rules for other constraints are different */ && pTab->pIndex /* There exist other constraints */ + && !upsertIpkDelay /* IPK check already deferred by UPSERT */ ){ ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1; VdbeComment((v, "defer IPK REPLACE until last")); @@ -125181,7 +127159,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( testcase( sqlite3TableColumnToStorage(pTab, iField)!=iField ); x = sqlite3TableColumnToStorage(pTab, iField) + regNewData + 1; sqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i); - VdbeComment((v, "%s", pTab->aCol[iField].zName)); + VdbeComment((v, "%s", pTab->aCol[iField].zCnName)); } } sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); @@ -125233,6 +127211,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( ** This is not possible for ENABLE_PREUPDATE_HOOK builds, as the row ** must be explicitly deleted in order to ensure any pre-update hook ** is invoked. */ + assert( IsOrdinaryTable(pTab) ); #ifndef SQLITE_ENABLE_PREUPDATE_HOOK if( (ix==0 && pIdx->pNext==0) /* Condition 3 */ && pPk==pIdx /* Condition 2 */ @@ -125240,7 +127219,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( && ( 0==(db->flags&SQLITE_RecTriggers) || /* Condition 4 */ 0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0)) && ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */ - (0==pTab->pFKey && 0==sqlite3FkReferences(pTab))) + (0==pTab->u.tab.pFKey && 0==sqlite3FkReferences(pTab))) ){ sqlite3VdbeResolveLabel(v, addrUniqueOk); continue; @@ -125275,7 +127254,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( x = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i); VdbeComment((v, "%s.%s", pTab->zName, - pTab->aCol[pPk->aiColumn[i]].zName)); + pTab->aCol[pPk->aiColumn[i]].zCnName)); } } if( isUpdate ){ @@ -125339,7 +127318,8 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( assert( onError==OE_Replace ); nConflictCk = sqlite3VdbeCurrentAddr(v) - addrConflictCk; - assert( nConflictCk>0 ); + assert( nConflictCk>0 || db->mallocFailed ); + testcase( nConflictCk<=0 ); testcase( nConflictCk>1 ); if( regTrigCnt ){ sqlite3MultiWrite(pParse); @@ -125422,6 +127402,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( if( ipkTop ){ sqlite3VdbeGoto(v, ipkTop); VdbeComment((v, "Do IPK REPLACE")); + assert( ipkBottom>0 ); sqlite3VdbeJumpHere(v, ipkBottom); } @@ -125474,7 +127455,7 @@ SQLITE_PRIVATE void sqlite3SetMakeRecordP5(Vdbe *v, Table *pTab){ if( pTab->pSchema->file_format<2 ) return; for(i=pTab->nCol-1; i>0; i--){ - if( pTab->aCol[i].pDflt!=0 ) break; + if( pTab->aCol[i].iDflt!=0 ) break; if( pTab->aCol[i].colFlags & COLFLAG_PRIMKEY ) break; } sqlite3VdbeChangeP5(v, i+1); @@ -125539,7 +127520,7 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( v = pParse->pVdbe; assert( v!=0 ); - assert( pTab->pSelect==0 ); /* This table is not a VIEW */ + assert( !IsView(pTab) ); /* This table is not a VIEW */ for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ /* All REPLACE indexes are at the end of the list */ assert( pIdx->onError!=OE_Replace @@ -125552,7 +127533,6 @@ SQLITE_PRIVATE void sqlite3CompleteInsertion( } pik_flags = (useSeekResult ? OPFLAG_USESEEKRESULT : 0); if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ - assert( pParse->nested==0 ); pik_flags |= OPFLAG_NCHANGE; pik_flags |= (update_flags & OPFLAG_SAVEPOSITION); if( update_flags==0 ){ @@ -125625,8 +127605,9 @@ SQLITE_PRIVATE int sqlite3OpenTableAndIndices( assert( op==OP_OpenWrite || p5==0 ); if( IsVirtual(pTab) ){ /* This routine is a no-op for virtual tables. Leave the output - ** variables *piDataCur and *piIdxCur uninitialized so that valgrind - ** can detect if they are used by mistake in the caller. */ + ** variables *piDataCur and *piIdxCur set to illegal cursor numbers + ** for improved error detection. */ + *piDataCur = *piIdxCur = -999; return 0; } iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); @@ -125767,18 +127748,13 @@ static int xferOptimization( int destHasUniqueIdx = 0; /* True if pDest has a UNIQUE index */ int regData, regRowid; /* Registers holding data and rowid */ - if( pSelect==0 ){ - return 0; /* Must be of the form INSERT INTO ... SELECT ... */ - } + assert( pSelect!=0 ); if( pParse->pWith || pSelect->pWith ){ /* Do not attempt to process this query if there are an WITH clauses ** attached to it. Proceeding may generate a false "no such table: xxx" ** error if pSelect reads from a CTE named "xxx". */ return 0; } - if( sqlite3TriggerList(pParse, pDest) ){ - return 0; /* tab1 must not have triggers */ - } #ifndef SQLITE_OMIT_VIRTUALTABLE if( IsVirtual(pDest) ){ return 0; /* tab1 must not be a virtual table */ @@ -125841,13 +127817,8 @@ static int xferOptimization( if( HasRowid(pDest)!=HasRowid(pSrc) ){ return 0; /* source and destination must both be WITHOUT ROWID or not */ } -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( IsVirtual(pSrc) ){ - return 0; /* tab2 must not be a virtual table */ - } -#endif - if( pSrc->pSelect ){ - return 0; /* tab2 may not be a view */ + if( !IsOrdinaryTable(pSrc) ){ + return 0; /* tab2 may not be a view or virtual table */ } if( pDest->nCol!=pSrc->nCol ){ return 0; /* Number of columns must be the same in tab1 and tab2 */ @@ -125855,6 +127826,9 @@ static int xferOptimization( if( pDest->iPKey!=pSrc->iPKey ){ return 0; /* Both tables must have the same INTEGER PRIMARY KEY */ } + if( (pDest->tabFlags & TF_Strict)!=0 && (pSrc->tabFlags & TF_Strict)==0 ){ + return 0; /* Cannot feed from a non-strict into a strict table */ + } for(i=0; inCol; i++){ Column *pDestCol = &pDest->aCol[i]; Column *pSrcCol = &pSrc->aCol[i]; @@ -125891,7 +127865,9 @@ static int xferOptimization( ** This requirement could be relaxed for VIRTUAL columns, I suppose. */ if( (pDestCol->colFlags & COLFLAG_GENERATED)!=0 ){ - if( sqlite3ExprCompare(0, pSrcCol->pDflt, pDestCol->pDflt, -1)!=0 ){ + if( sqlite3ExprCompare(0, + sqlite3ColumnExpr(pSrc, pSrcCol), + sqlite3ColumnExpr(pDest, pDestCol), -1)!=0 ){ testcase( pDestCol->colFlags & COLFLAG_VIRTUAL ); testcase( pDestCol->colFlags & COLFLAG_STORED ); return 0; /* Different generator expressions */ @@ -125901,7 +127877,8 @@ static int xferOptimization( if( pDestCol->affinity!=pSrcCol->affinity ){ return 0; /* Affinity must be the same on all columns */ } - if( sqlite3_stricmp(pDestCol->zColl, pSrcCol->zColl)!=0 ){ + if( sqlite3_stricmp(sqlite3ColumnColl(pDestCol), + sqlite3ColumnColl(pSrcCol))!=0 ){ return 0; /* Collating sequence must be the same on all columns */ } if( pDestCol->notNull && !pSrcCol->notNull ){ @@ -125909,11 +127886,15 @@ static int xferOptimization( } /* Default values for second and subsequent columns need to match. */ if( (pDestCol->colFlags & COLFLAG_GENERATED)==0 && i>0 ){ - assert( pDestCol->pDflt==0 || pDestCol->pDflt->op==TK_SPAN ); - assert( pSrcCol->pDflt==0 || pSrcCol->pDflt->op==TK_SPAN ); - if( (pDestCol->pDflt==0)!=(pSrcCol->pDflt==0) - || (pDestCol->pDflt && strcmp(pDestCol->pDflt->u.zToken, - pSrcCol->pDflt->u.zToken)!=0) + Expr *pDestExpr = sqlite3ColumnExpr(pDest, pDestCol); + Expr *pSrcExpr = sqlite3ColumnExpr(pSrc, pSrcCol); + assert( pDestExpr==0 || pDestExpr->op==TK_SPAN ); + assert( pDestExpr==0 || !ExprHasProperty(pDestExpr, EP_IntValue) ); + assert( pSrcExpr==0 || pSrcExpr->op==TK_SPAN ); + assert( pSrcExpr==0 || !ExprHasProperty(pSrcExpr, EP_IntValue) ); + if( (pDestExpr==0)!=(pSrcExpr==0) + || (pDestExpr!=0 && strcmp(pDestExpr->u.zToken, + pSrcExpr->u.zToken)!=0) ){ return 0; /* Default values must be the same for all columns */ } @@ -125950,7 +127931,8 @@ static int xferOptimization( ** the extra complication to make this rule less restrictive is probably ** not worth the effort. Ticket [6284df89debdfa61db8073e062908af0c9b6118e] */ - if( (db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){ + assert( IsOrdinaryTable(pDest) ); + if( (db->flags & SQLITE_ForeignKeys)!=0 && pDest->u.tab.pFKey!=0 ){ return 0; } #endif @@ -126628,6 +128610,20 @@ struct sqlite3_api_routines { sqlite3_file *(*database_file_object)(const char*); /* Version 3.34.0 and later */ int (*txn_state)(sqlite3*,const char*); + /* Version 3.36.1 and later */ + sqlite3_int64 (*changes64)(sqlite3*); + sqlite3_int64 (*total_changes64)(sqlite3*); + /* Version 3.37.0 and later */ + int (*autovacuum_pages)(sqlite3*, + unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int), + void*, void(*)(void*)); + /* Version 3.38.0 and later */ + int (*error_offset)(sqlite3*); + int (*vtab_rhs_value)(sqlite3_index_info*,int,sqlite3_value**); + int (*vtab_distinct)(sqlite3_index_info*); + int (*vtab_in)(sqlite3_index_info*,int,int); + int (*vtab_in_first)(sqlite3_value*,sqlite3_value**); + int (*vtab_in_next)(sqlite3_value*,sqlite3_value**); }; /* @@ -126934,6 +128930,18 @@ typedef int (*sqlite3_loadext_entry)( #define sqlite3_database_file_object sqlite3_api->database_file_object /* Version 3.34.0 and later */ #define sqlite3_txn_state sqlite3_api->txn_state +/* Version 3.36.1 and later */ +#define sqlite3_changes64 sqlite3_api->changes64 +#define sqlite3_total_changes64 sqlite3_api->total_changes64 +/* Version 3.37.0 and later */ +#define sqlite3_autovacuum_pages sqlite3_api->autovacuum_pages +/* Version 3.38.0 and later */ +#define sqlite3_error_offset sqlite3_api->error_offset +#define sqlite3_vtab_rhs_value sqlite3_api->vtab_rhs_value +#define sqlite3_vtab_distinct sqlite3_api->vtab_distinct +#define sqlite3_vtab_in sqlite3_api->vtab_in +#define sqlite3_vtab_in_first sqlite3_api->vtab_in_first +#define sqlite3_vtab_in_next sqlite3_api->vtab_in_next #endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */ #if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) @@ -127418,6 +129426,18 @@ static const sqlite3_api_routines sqlite3Apis = { sqlite3_database_file_object, /* Version 3.34.0 and later */ sqlite3_txn_state, + /* Version 3.36.1 and later */ + sqlite3_changes64, + sqlite3_total_changes64, + /* Version 3.37.0 and later */ + sqlite3_autovacuum_pages, + /* Version 3.38.0 and later */ + sqlite3_error_offset, + sqlite3_vtab_rhs_value, + sqlite3_vtab_distinct, + sqlite3_vtab_in, + sqlite3_vtab_in_first, + sqlite3_vtab_in_next }; /* True if x is the directory separator character @@ -127880,13 +129900,14 @@ SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){ #define PragTyp_SOFT_HEAP_LIMIT 35 #define PragTyp_SYNCHRONOUS 36 #define PragTyp_TABLE_INFO 37 -#define PragTyp_TEMP_STORE 38 -#define PragTyp_TEMP_STORE_DIRECTORY 39 -#define PragTyp_THREADS 40 -#define PragTyp_WAL_AUTOCHECKPOINT 41 -#define PragTyp_WAL_CHECKPOINT 42 -#define PragTyp_LOCK_STATUS 43 -#define PragTyp_STATS 44 +#define PragTyp_TABLE_LIST 38 +#define PragTyp_TEMP_STORE 39 +#define PragTyp_TEMP_STORE_DIRECTORY 40 +#define PragTyp_THREADS 41 +#define PragTyp_WAL_AUTOCHECKPOINT 42 +#define PragTyp_WAL_CHECKPOINT 43 +#define PragTyp_LOCK_STATUS 44 +#define PragTyp_STATS 45 /* Property flags associated with various pragma. */ #define PragFlg_NeedSchema 0x01 /* Force schema load before running */ @@ -127919,45 +129940,51 @@ static const char *const pragCName[] = { /* 13 */ "pk", /* 14 */ "hidden", /* table_info reuses 8 */ - /* 15 */ "seqno", /* Used by: index_xinfo */ - /* 16 */ "cid", - /* 17 */ "name", - /* 18 */ "desc", - /* 19 */ "coll", - /* 20 */ "key", - /* 21 */ "name", /* Used by: function_list */ - /* 22 */ "builtin", - /* 23 */ "type", - /* 24 */ "enc", - /* 25 */ "narg", - /* 26 */ "flags", - /* 27 */ "tbl", /* Used by: stats */ - /* 28 */ "idx", - /* 29 */ "wdth", - /* 30 */ "hght", - /* 31 */ "flgs", - /* 32 */ "seq", /* Used by: index_list */ - /* 33 */ "name", - /* 34 */ "unique", - /* 35 */ "origin", - /* 36 */ "partial", - /* 37 */ "table", /* Used by: foreign_key_check */ - /* 38 */ "rowid", - /* 39 */ "parent", - /* 40 */ "fkid", - /* index_info reuses 15 */ - /* 41 */ "seq", /* Used by: database_list */ - /* 42 */ "name", - /* 43 */ "file", - /* 44 */ "busy", /* Used by: wal_checkpoint */ - /* 45 */ "log", - /* 46 */ "checkpointed", - /* collation_list reuses 32 */ - /* 47 */ "database", /* Used by: lock_status */ - /* 48 */ "status", - /* 49 */ "cache_size", /* Used by: default_cache_size */ + /* 15 */ "schema", /* Used by: table_list */ + /* 16 */ "name", + /* 17 */ "type", + /* 18 */ "ncol", + /* 19 */ "wr", + /* 20 */ "strict", + /* 21 */ "seqno", /* Used by: index_xinfo */ + /* 22 */ "cid", + /* 23 */ "name", + /* 24 */ "desc", + /* 25 */ "coll", + /* 26 */ "key", + /* 27 */ "name", /* Used by: function_list */ + /* 28 */ "builtin", + /* 29 */ "type", + /* 30 */ "enc", + /* 31 */ "narg", + /* 32 */ "flags", + /* 33 */ "tbl", /* Used by: stats */ + /* 34 */ "idx", + /* 35 */ "wdth", + /* 36 */ "hght", + /* 37 */ "flgs", + /* 38 */ "seq", /* Used by: index_list */ + /* 39 */ "name", + /* 40 */ "unique", + /* 41 */ "origin", + /* 42 */ "partial", + /* 43 */ "table", /* Used by: foreign_key_check */ + /* 44 */ "rowid", + /* 45 */ "parent", + /* 46 */ "fkid", + /* index_info reuses 21 */ + /* 47 */ "seq", /* Used by: database_list */ + /* 48 */ "name", + /* 49 */ "file", + /* 50 */ "busy", /* Used by: wal_checkpoint */ + /* 51 */ "log", + /* 52 */ "checkpointed", + /* collation_list reuses 38 */ + /* 53 */ "database", /* Used by: lock_status */ + /* 54 */ "status", + /* 55 */ "cache_size", /* Used by: default_cache_size */ /* module_list pragma_list reuses 9 */ - /* 50 */ "timeout", /* Used by: busy_timeout */ + /* 56 */ "timeout", /* Used by: busy_timeout */ }; /* Definitions of all built-in pragmas */ @@ -128008,7 +130035,7 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "busy_timeout", /* ePragTyp: */ PragTyp_BUSY_TIMEOUT, /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 50, 1, + /* ColNames: */ 56, 1, /* iArg: */ 0 }, #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) {/* zName: */ "cache_size", @@ -128047,7 +130074,7 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "collation_list", /* ePragTyp: */ PragTyp_COLLATION_LIST, /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 32, 2, + /* ColNames: */ 38, 2, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS) @@ -128082,14 +130109,14 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "database_list", /* ePragTyp: */ PragTyp_DATABASE_LIST, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0, - /* ColNames: */ 41, 3, + /* ColNames: */ 47, 3, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED) {/* zName: */ "default_cache_size", /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, - /* ColNames: */ 49, 1, + /* ColNames: */ 55, 1, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) @@ -128119,7 +130146,7 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "foreign_key_check", /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 37, 4, + /* ColNames: */ 43, 4, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_FOREIGN_KEY) @@ -128162,7 +130189,7 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "function_list", /* ePragTyp: */ PragTyp_FUNCTION_LIST, /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 21, 6, + /* ColNames: */ 27, 6, /* iArg: */ 0 }, #endif #endif @@ -128191,23 +130218,23 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "index_info", /* ePragTyp: */ PragTyp_INDEX_INFO, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 15, 3, + /* ColNames: */ 21, 3, /* iArg: */ 0 }, {/* zName: */ "index_list", /* ePragTyp: */ PragTyp_INDEX_LIST, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 32, 5, + /* ColNames: */ 38, 5, /* iArg: */ 0 }, {/* zName: */ "index_xinfo", /* ePragTyp: */ PragTyp_INDEX_INFO, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, - /* ColNames: */ 15, 6, + /* ColNames: */ 21, 6, /* iArg: */ 1 }, #endif #if !defined(SQLITE_OMIT_INTEGRITY_CHECK) {/* zName: */ "integrity_check", /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1, + /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, /* ColNames: */ 0, 0, /* iArg: */ 0 }, #endif @@ -128241,7 +130268,7 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "lock_status", /* ePragTyp: */ PragTyp_LOCK_STATUS, /* ePragFlg: */ PragFlg_Result0, - /* ColNames: */ 47, 2, + /* ColNames: */ 53, 2, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) @@ -128315,7 +130342,7 @@ static const PragmaName aPragmaName[] = { #if !defined(SQLITE_OMIT_INTEGRITY_CHECK) {/* zName: */ "quick_check", /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1, + /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1|PragFlg_SchemaOpt, /* ColNames: */ 0, 0, /* iArg: */ 0 }, #endif @@ -128380,7 +130407,7 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "stats", /* ePragTyp: */ PragTyp_STATS, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_SchemaReq, - /* ColNames: */ 27, 5, + /* ColNames: */ 33, 5, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) @@ -128396,6 +130423,11 @@ static const PragmaName aPragmaName[] = { /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, /* ColNames: */ 8, 6, /* iArg: */ 0 }, + {/* zName: */ "table_list", + /* ePragTyp: */ PragTyp_TABLE_LIST, + /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1, + /* ColNames: */ 15, 6, + /* iArg: */ 0 }, {/* zName: */ "table_xinfo", /* ePragTyp: */ PragTyp_TABLE_INFO, /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt, @@ -128471,7 +130503,7 @@ static const PragmaName aPragmaName[] = { {/* zName: */ "wal_checkpoint", /* ePragTyp: */ PragTyp_WAL_CHECKPOINT, /* ePragFlg: */ PragFlg_NeedSchema, - /* ColNames: */ 44, 3, + /* ColNames: */ 50, 3, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) @@ -128482,7 +130514,7 @@ static const PragmaName aPragmaName[] = { /* iArg: */ SQLITE_WriteSchema|SQLITE_NoSchemaError }, #endif }; -/* Number of pragmas: 67 on by default, 77 total. */ +/* Number of pragmas: 68 on by default, 78 total. */ /************** End of pragma.h **********************************************/ /************** Continuing where we left off in pragma.c *********************/ @@ -128924,7 +130956,11 @@ SQLITE_PRIVATE void sqlite3Pragma( /* Locate the pragma in the lookup table */ pPragma = pragmaLocate(zLeft); - if( pPragma==0 ) goto pragma_out; + if( pPragma==0 ){ + /* IMP: R-43042-22504 No error messages are generated if an + ** unknown pragma is issued. */ + goto pragma_out; + } /* Make sure the database schema is loaded if the pragma requires that */ if( (pPragma->mPragFlg & PragFlg_NeedSchema)!=0 ){ @@ -129574,6 +131610,14 @@ SQLITE_PRIVATE void sqlite3Pragma( }else{ db->flags &= ~mask; if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; + if( (mask & SQLITE_WriteSchema)!=0 + && sqlite3_stricmp(zRight, "reset")==0 + ){ + /* IMP: R-60817-01178 If the argument is "RESET" then schema + ** writing is disabled (as with "PRAGMA writable_schema=OFF") and, + ** in addition, the schema is reloaded. */ + sqlite3ResetAllSchemasOfConnection(db); + } } /* Many of the flag-pragmas modify the code generated by the SQL @@ -129614,6 +131658,7 @@ SQLITE_PRIVATE void sqlite3Pragma( sqlite3ViewGetColumnNames(pParse, pTab); for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ int isHidden = 0; + const Expr *pColExpr; if( pCol->colFlags & COLFLAG_NOINSERT ){ if( pPragma->iArg==0 ){ nHidden++; @@ -129634,13 +131679,16 @@ SQLITE_PRIVATE void sqlite3Pragma( }else{ for(k=1; k<=pTab->nCol && pPk->aiColumn[k-1]!=i; k++){} } - assert( pCol->pDflt==0 || pCol->pDflt->op==TK_SPAN || isHidden>=2 ); + pColExpr = sqlite3ColumnExpr(pTab,pCol); + assert( pColExpr==0 || pColExpr->op==TK_SPAN || isHidden>=2 ); + assert( pColExpr==0 || !ExprHasProperty(pColExpr, EP_IntValue) + || isHidden>=2 ); sqlite3VdbeMultiLoad(v, 1, pPragma->iArg ? "issisii" : "issisi", i-nHidden, - pCol->zName, + pCol->zCnName, sqlite3ColumnType(pCol,""), pCol->notNull ? 1 : 0, - pCol->pDflt && isHidden<2 ? pCol->pDflt->u.zToken : 0, + (isHidden>=2 || pColExpr==0) ? 0 : pColExpr->u.zToken, k, isHidden); } @@ -129648,6 +131696,85 @@ SQLITE_PRIVATE void sqlite3Pragma( } break; + /* + ** PRAGMA table_list + ** + ** Return a single row for each table, virtual table, or view in the + ** entire schema. + ** + ** schema: Name of attached database hold this table + ** name: Name of the table itself + ** type: "table", "view", "virtual", "shadow" + ** ncol: Number of columns + ** wr: True for a WITHOUT ROWID table + ** strict: True for a STRICT table + */ + case PragTyp_TABLE_LIST: { + int ii; + pParse->nMem = 6; + sqlite3CodeVerifyNamedSchema(pParse, zDb); + for(ii=0; iinDb; ii++){ + HashElem *k; + Hash *pHash; + int initNCol; + if( zDb && sqlite3_stricmp(zDb, db->aDb[ii].zDbSName)!=0 ) continue; + + /* Ensure that the Table.nCol field is initialized for all views + ** and virtual tables. Each time we initialize a Table.nCol value + ** for a table, that can potentially disrupt the hash table, so restart + ** the initialization scan. + */ + pHash = &db->aDb[ii].pSchema->tblHash; + initNCol = sqliteHashCount(pHash); + while( initNCol-- ){ + for(k=sqliteHashFirst(pHash); 1; k=sqliteHashNext(k) ){ + Table *pTab; + if( k==0 ){ initNCol = 0; break; } + pTab = sqliteHashData(k); + if( pTab->nCol==0 ){ + char *zSql = sqlite3MPrintf(db, "SELECT*FROM\"%w\"", pTab->zName); + if( zSql ){ + sqlite3_stmt *pDummy = 0; + (void)sqlite3_prepare(db, zSql, -1, &pDummy, 0); + (void)sqlite3_finalize(pDummy); + sqlite3DbFree(db, zSql); + } + if( db->mallocFailed ){ + sqlite3ErrorMsg(db->pParse, "out of memory"); + db->pParse->rc = SQLITE_NOMEM_BKPT; + } + pHash = &db->aDb[ii].pSchema->tblHash; + break; + } + } + } + + for(k=sqliteHashFirst(pHash); k; k=sqliteHashNext(k) ){ + Table *pTab = sqliteHashData(k); + const char *zType; + if( zRight && sqlite3_stricmp(zRight, pTab->zName)!=0 ) continue; + if( IsView(pTab) ){ + zType = "view"; + }else if( IsVirtual(pTab) ){ + zType = "virtual"; + }else if( pTab->tabFlags & TF_Shadow ){ + zType = "shadow"; + }else{ + zType = "table"; + } + sqlite3VdbeMultiLoad(v, 1, "sssiii", + db->aDb[ii].zDbSName, + sqlite3PreferredTableName(pTab->zName), + zType, + pTab->nCol, + (pTab->tabFlags & TF_WithoutRowid)!=0, + (pTab->tabFlags & TF_Strict)!=0 + ); + } + } + } + break; + #ifdef SQLITE_DEBUG case PragTyp_STATS: { Index *pIdx; @@ -129657,7 +131784,7 @@ SQLITE_PRIVATE void sqlite3Pragma( for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){ Table *pTab = sqliteHashData(i); sqlite3VdbeMultiLoad(v, 1, "ssiii", - pTab->zName, + sqlite3PreferredTableName(pTab->zName), 0, pTab->szTabRow, pTab->nRowLogEst, @@ -129707,7 +131834,7 @@ SQLITE_PRIVATE void sqlite3Pragma( for(i=0; iaiColumn[i]; sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum, - cnum<0 ? 0 : pTab->aCol[cnum].zName); + cnum<0 ? 0 : pTab->aCol[cnum].zCnName); if( pPragma->iArg ){ sqlite3VdbeMultiLoad(v, 4, "isiX", pIdx->aSortOrder[i], @@ -129776,11 +131903,13 @@ SQLITE_PRIVATE void sqlite3Pragma( pParse->nMem = 6; for(i=0; iu.pHash ){ + assert( p->funcFlags & SQLITE_FUNC_BUILTIN ); pragmaFunclistLine(v, p, 1, showInternFunc); } } for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){ p = (FuncDef*)sqliteHashData(j); + assert( (p->funcFlags & SQLITE_FUNC_BUILTIN)==0 ); pragmaFunclistLine(v, p, 0, showInternFunc); } } @@ -129814,8 +131943,8 @@ SQLITE_PRIVATE void sqlite3Pragma( FKey *pFK; Table *pTab; pTab = sqlite3FindTable(db, zRight, zDb); - if( pTab ){ - pFK = pTab->pFKey; + if( pTab && IsOrdinaryTable(pTab) ){ + pFK = pTab->u.tab.pFKey; if( pFK ){ int iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); int i = 0; @@ -129828,7 +131957,7 @@ SQLITE_PRIVATE void sqlite3Pragma( i, j, pFK->zTo, - pTab->aCol[pFK->aCol[j].iFrom].zName, + pTab->aCol[pFK->aCol[j].iFrom].zCnName, pFK->aCol[j].zCol, actionName(pFK->aAction[1]), /* ON UPDATE */ actionName(pFK->aAction[0]), /* ON DELETE */ @@ -129874,7 +132003,7 @@ SQLITE_PRIVATE void sqlite3Pragma( pTab = (Table*)sqliteHashData(k); k = sqliteHashNext(k); } - if( pTab==0 || pTab->pFKey==0 ) continue; + if( pTab==0 || !IsOrdinaryTable(pTab) || pTab->u.tab.pFKey==0 ) continue; iDb = sqlite3SchemaToIndex(db, pTab->pSchema); zDb = db->aDb[iDb].zDbSName; sqlite3CodeVerifySchema(pParse, iDb); @@ -129882,7 +132011,8 @@ SQLITE_PRIVATE void sqlite3Pragma( if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow; sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead); sqlite3VdbeLoadString(v, regResult, pTab->zName); - for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){ + assert( IsOrdinaryTable(pTab) ); + for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){ pParent = sqlite3FindTable(db, pFK->zTo, zDb); if( pParent==0 ) continue; pIdx = 0; @@ -129904,7 +132034,8 @@ SQLITE_PRIVATE void sqlite3Pragma( if( pFK ) break; if( pParse->nTabnTab = i; addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, 0); VdbeCoverage(v); - for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){ + assert( IsOrdinaryTable(pTab) ); + for(i=1, pFK=pTab->u.tab.pFKey; pFK; i++, pFK=pFK->pNextFrom){ pParent = sqlite3FindTable(db, pFK->zTo, zDb); pIdx = 0; aiCols = 0; @@ -129918,6 +132049,7 @@ SQLITE_PRIVATE void sqlite3Pragma( ** regRow..regRow+n. If any of the child key values are NULL, this ** row cannot cause an FK violation. Jump directly to addrOk in ** this case. */ + if( regRow+pFK->nCol>pParse->nMem ) pParse->nMem = regRow+pFK->nCol; for(j=0; jnCol; j++){ int iCol = aiCols ? aiCols[j] : pFK->aCol[j].iFrom; sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, iCol, regRow+j); @@ -130104,8 +132236,9 @@ SQLITE_PRIVATE void sqlite3Pragma( int loopTop; int iDataCur, iIdxCur; int r1 = -1; + int bStrict; - if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */ + if( !IsOrdinaryTable(pTab) ) continue; if( pObjTab && pObjTab!=pTab ) continue; pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0, @@ -130125,23 +132258,48 @@ SQLITE_PRIVATE void sqlite3Pragma( /* Sanity check on record header decoding */ sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nNVCol-1,3); sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); + VdbeComment((v, "(right-most column)")); } - /* Verify that all NOT NULL columns really are NOT NULL */ + /* Verify that all NOT NULL columns really are NOT NULL. At the + ** same time verify the type of the content of STRICT tables */ + bStrict = (pTab->tabFlags & TF_Strict)!=0; for(j=0; jnCol; j++){ char *zErr; - int jmp2; + Column *pCol = pTab->aCol + j; + int doError, jmp2; if( j==pTab->iPKey ) continue; - if( pTab->aCol[j].notNull==0 ) continue; + if( pCol->notNull==0 && !bStrict ) continue; + doError = bStrict ? sqlite3VdbeMakeLabel(pParse) : 0; sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, j, 3); if( sqlite3VdbeGetOp(v,-1)->opcode==OP_Column ){ sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); } - jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v); - zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, - pTab->aCol[j].zName); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); - integrityCheckResultRow(v); - sqlite3VdbeJumpHere(v, jmp2); + if( pCol->notNull ){ + jmp2 = sqlite3VdbeAddOp1(v, OP_NotNull, 3); VdbeCoverage(v); + zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName, + pCol->zCnName); + sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); + if( bStrict && pCol->eCType!=COLTYPE_ANY ){ + sqlite3VdbeGoto(v, doError); + }else{ + integrityCheckResultRow(v); + } + sqlite3VdbeJumpHere(v, jmp2); + } + if( (pTab->tabFlags & TF_Strict)!=0 + && pCol->eCType!=COLTYPE_ANY + ){ + jmp2 = sqlite3VdbeAddOp3(v, OP_IsNullOrType, 3, 0, + sqlite3StdTypeMap[pCol->eCType-1]); + VdbeCoverage(v); + zErr = sqlite3MPrintf(db, "non-%s value in %s.%s", + sqlite3StdType[pCol->eCType-1], + pTab->zName, pTab->aCol[j].zCnName); + sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); + sqlite3VdbeResolveLabel(v, doError); + integrityCheckResultRow(v); + sqlite3VdbeJumpHere(v, jmp2); + } } /* Verify CHECK constraints */ if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){ @@ -130675,12 +132833,12 @@ SQLITE_PRIVATE void sqlite3Pragma( case PragTyp_ANALYSIS_LIMIT: { sqlite3_int64 N; if( zRight - && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK + && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK /* IMP: R-40975-20399 */ && N>=0 ){ db->nAnalysisLimit = (int)(N&0x7fffffff); } - returnSingleInt(v, db->nAnalysisLimit); + returnSingleInt(v, db->nAnalysisLimit); /* IMP: R-57594-65522 */ break; } @@ -131082,10 +133240,15 @@ static void corruptSchema( pData->rc = SQLITE_NOMEM_BKPT; }else if( pData->pzErrMsg[0]!=0 ){ /* A error message has already been generated. Do not overwrite it */ - }else if( pData->mInitFlags & (INITFLAG_AlterRename|INITFLAG_AlterDrop) ){ + }else if( pData->mInitFlags & (INITFLAG_AlterMask) ){ + static const char *azAlterType[] = { + "rename", + "drop column", + "add column" + }; *pData->pzErrMsg = sqlite3MPrintf(db, "error in %s %s after %s: %s", azObj[0], azObj[1], - (pData->mInitFlags & INITFLAG_AlterRename) ? "rename" : "drop column", + azAlterType[(pData->mInitFlags&INITFLAG_AlterMask)-1], zExtra ); pData->rc = SQLITE_ERROR; @@ -131187,7 +133350,7 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char } } db->init.orphanTrigger = 0; - db->init.azInit = argv; + db->init.azInit = (const char**)argv; pStmt = 0; TESTONLY(rcp = ) sqlite3Prepare(db, argv[4], -1, 0, 0, &pStmt, 0); rc = db->errCode; @@ -131206,6 +133369,7 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char } } } + db->init.azInit = sqlite3StdType; /* Any array of string ptrs will do */ sqlite3_finalize(pStmt); }else if( argv[1]==0 || (argv[4]!=0 && argv[4][0]!=0) ){ corruptSchema(pData, argv, 0); @@ -131436,7 +133600,7 @@ SQLITE_PRIVATE int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFl sqlite3ResetAllSchemasOfConnection(db); pDb = &db->aDb[iDb]; }else - if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){ + if( rc==SQLITE_OK || ((db->flags&SQLITE_NoSchemaError) && rc!=SQLITE_NOMEM)){ /* Hack: If the SQLITE_NoSchemaError flag is set, then consider ** the schema loaded, even if errors (other than OOM) occurred. In ** this situation the current sqlite3_prepare() operation will fail, @@ -131615,8 +133779,14 @@ SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){ /* ** Free all memory allocations in the pParse object */ -SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ +SQLITE_PRIVATE void sqlite3ParseObjectReset(Parse *pParse){ sqlite3 *db = pParse->db; + assert( db!=0 ); + assert( db->pParse==pParse ); + assert( pParse->nested==0 ); +#ifndef SQLITE_OMIT_SHARED_CACHE + sqlite3DbFree(db, pParse->aTableLock); +#endif while( pParse->pCleanup ){ ParseCleanup *pCleanup = pParse->pCleanup; pParse->pCleanup = pCleanup->pNext; @@ -131627,11 +133797,12 @@ SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ if( pParse->pConstExpr ){ sqlite3ExprListDelete(db, pParse->pConstExpr); } - if( db ){ - assert( db->lookaside.bDisable >= pParse->disableLookaside ); - db->lookaside.bDisable -= pParse->disableLookaside; - db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue; - } + assert( db->lookaside.bDisable >= pParse->disableLookaside ); + db->lookaside.bDisable -= pParse->disableLookaside; + db->lookaside.sz = db->lookaside.bDisable ? 0 : db->lookaside.szTrue; + assert( pParse->db->pParse==pParse ); + db->pParse = pParse->pOuterParse; + pParse->db = 0; pParse->disableLookaside = 0; } @@ -131644,7 +133815,7 @@ SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ ** cost for this mechansim (an extra malloc), so it should not be used ** for common cleanups that happen on most calls. But for less ** common cleanups, we save a single NULL-pointer comparison in -** sqlite3ParserReset(), which reduces the total CPU cycle count. +** sqlite3ParseObjectReset(), which reduces the total CPU cycle count. ** ** If a memory allocation error occurs, then the cleanup happens immediately. ** When either SQLITE_DEBUG or SQLITE_COVERAGE_TEST are defined, the @@ -131684,6 +133855,33 @@ SQLITE_PRIVATE void *sqlite3ParserAddCleanup( return pPtr; } +/* +** Turn bulk memory into a valid Parse object and link that Parse object +** into database connection db. +** +** Call sqlite3ParseObjectReset() to undo this operation. +** +** Caution: Do not confuse this routine with sqlite3ParseObjectInit() which +** is generated by Lemon. +*/ +SQLITE_PRIVATE void sqlite3ParseObjectInit(Parse *pParse, sqlite3 *db){ + memset(PARSE_HDR(pParse), 0, PARSE_HDR_SZ); + memset(PARSE_TAIL(pParse), 0, PARSE_TAIL_SZ); + assert( db->pParse!=pParse ); + pParse->pOuterParse = db->pParse; + db->pParse = pParse; + pParse->db = db; + if( db->mallocFailed ) sqlite3ErrorMsg(pParse, "out of memory"); +} + +/* +** Maximum number of times that we will try again to prepare a statement +** that returns SQLITE_ERROR_RETRY. +*/ +#ifndef SQLITE_MAX_PREPARE_RETRY +# define SQLITE_MAX_PREPARE_RETRY 25 +#endif + /* ** Compile the UTF-8 encoded SQL statement zSql into a statement handle. */ @@ -131696,16 +133894,19 @@ static int sqlite3Prepare( sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ const char **pzTail /* OUT: End of parsed string */ ){ - char *zErrMsg = 0; /* Error message */ int rc = SQLITE_OK; /* Result code */ int i; /* Loop counter */ Parse sParse; /* Parsing context */ - memset(&sParse, 0, PARSE_HDR_SZ); + /* sqlite3ParseObjectInit(&sParse, db); // inlined for performance */ + memset(PARSE_HDR(&sParse), 0, PARSE_HDR_SZ); memset(PARSE_TAIL(&sParse), 0, PARSE_TAIL_SZ); + sParse.pOuterParse = db->pParse; + db->pParse = &sParse; + sParse.db = db; sParse.pReprepare = pReprepare; assert( ppStmt && *ppStmt==0 ); - /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */ + if( db->mallocFailed ) sqlite3ErrorMsg(&sParse, "out of memory"); assert( sqlite3_mutex_held(db->mutex) ); /* For a long-term use prepared statement avoid the use of @@ -131758,7 +133959,6 @@ static int sqlite3Prepare( sqlite3VtabUnlockList(db); - sParse.db = db; if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){ char *zSqlCopy; int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; @@ -131771,14 +133971,14 @@ static int sqlite3Prepare( } zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes); if( zSqlCopy ){ - sqlite3RunParser(&sParse, zSqlCopy, &zErrMsg); + sqlite3RunParser(&sParse, zSqlCopy); sParse.zTail = &zSql[sParse.zTail-zSqlCopy]; sqlite3DbFree(db, zSqlCopy); }else{ sParse.zTail = &zSql[nBytes]; } }else{ - sqlite3RunParser(&sParse, zSql, &zErrMsg); + sqlite3RunParser(&sParse, zSql); } assert( 0==sParse.nQueryLoop ); @@ -131794,7 +133994,7 @@ static int sqlite3Prepare( sParse.checkSchema = 0; } if( sParse.rc!=SQLITE_OK && sParse.rc!=SQLITE_DONE ){ - if( sParse.checkSchema ){ + if( sParse.checkSchema && db->init.busy==0 ){ schemaIsValid(&sParse); } if( sParse.pVdbe ){ @@ -131802,14 +134002,14 @@ static int sqlite3Prepare( } assert( 0==(*ppStmt) ); rc = sParse.rc; - if( zErrMsg ){ - sqlite3ErrorWithMsg(db, rc, "%s", zErrMsg); - sqlite3DbFree(db, zErrMsg); + if( sParse.zErrMsg ){ + sqlite3ErrorWithMsg(db, rc, "%s", sParse.zErrMsg); + sqlite3DbFree(db, sParse.zErrMsg); }else{ sqlite3Error(db, rc); } }else{ - assert( zErrMsg==0 ); + assert( sParse.zErrMsg==0 ); *ppStmt = (sqlite3_stmt*)sParse.pVdbe; rc = SQLITE_OK; sqlite3ErrorClear(db); @@ -131825,7 +134025,7 @@ static int sqlite3Prepare( end_prepare: - sqlite3ParserReset(&sParse); + sqlite3ParseObjectReset(&sParse); return rc; } static int sqlite3LockAndPrepare( @@ -131855,7 +134055,8 @@ static int sqlite3LockAndPrepare( ** reset is considered a permanent error. */ rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); assert( rc==SQLITE_OK || *ppStmt==0 ); - }while( rc==SQLITE_ERROR_RETRY + if( rc==SQLITE_OK || db->mallocFailed ) break; + }while( (rc==SQLITE_ERROR_RETRY && (cnt++)aCol, i=0; inCol; pCol++, i++){ - if( pCol->hName==h && sqlite3StrICmp(pCol->zName, zCol)==0 ) return i; + if( pCol->hName==h && sqlite3StrICmp(pCol->zCnName, zCol)==0 ) return i; } return -1; } @@ -132422,18 +134623,21 @@ static void addWhereTerm( pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight); pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2); + assert( pE2!=0 || pEq==0 ); /* Due to db->mallocFailed test + ** in sqlite3DbMallocRawNN() called from + ** sqlite3PExpr(). */ if( pEq && isOuterJoin ){ ExprSetProperty(pEq, EP_FromJoin); assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(pEq, EP_NoReduce); - pEq->iRightJoinTable = pE2->iTable; + pEq->w.iRightJoinTable = pE2->iTable; } *ppWhere = sqlite3ExprAnd(pParse, *ppWhere, pEq); } /* ** Set the EP_FromJoin property on all terms of the given expression. -** And set the Expr.iRightJoinTable to iTable for every term in the +** And set the Expr.w.iRightJoinTable to iTable for every term in the ** expression. ** ** The EP_FromJoin property is used on terms of an expression to tell @@ -132443,8 +134647,8 @@ static void addWhereTerm( ** WHERE clause during join processing but we need to remember that they ** originated in the ON or USING clause. ** -** The Expr.iRightJoinTable tells the WHERE clause processing that the -** expression depends on table iRightJoinTable even if that table is not +** The Expr.w.iRightJoinTable tells the WHERE clause processing that the +** expression depends on table w.iRightJoinTable even if that table is not ** explicitly mentioned in the expression. That information is needed ** for cases like this: ** @@ -132462,11 +134666,14 @@ SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ ExprSetProperty(p, EP_FromJoin); assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(p, EP_NoReduce); - p->iRightJoinTable = iTable; - if( p->op==TK_FUNCTION && p->x.pList ){ - int i; - for(i=0; ix.pList->nExpr; i++){ - sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable); + p->w.iRightJoinTable = iTable; + if( p->op==TK_FUNCTION ){ + assert( ExprUseXList(p) ); + if( p->x.pList ){ + int i; + for(i=0; ix.pList->nExpr; i++){ + sqlite3SetJoinExpr(p->x.pList->a[i].pExpr, iTable); + } } } sqlite3SetJoinExpr(p->pLeft, iTable); @@ -132475,7 +134682,7 @@ SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ } /* Undo the work of sqlite3SetJoinExpr(). In the expression p, convert every -** term that is marked with EP_FromJoin and iRightJoinTable==iTable into +** term that is marked with EP_FromJoin and w.iRightJoinTable==iTable into ** an ordinary term that omits the EP_FromJoin mark. ** ** This happens when a LEFT JOIN is simplified into an ordinary JOIN. @@ -132483,16 +134690,19 @@ SQLITE_PRIVATE void sqlite3SetJoinExpr(Expr *p, int iTable){ static void unsetJoinExpr(Expr *p, int iTable){ while( p ){ if( ExprHasProperty(p, EP_FromJoin) - && (iTable<0 || p->iRightJoinTable==iTable) ){ + && (iTable<0 || p->w.iRightJoinTable==iTable) ){ ExprClearProperty(p, EP_FromJoin); } if( p->op==TK_COLUMN && p->iTable==iTable ){ ExprClearProperty(p, EP_CanBeNull); } - if( p->op==TK_FUNCTION && p->x.pList ){ - int i; - for(i=0; ix.pList->nExpr; i++){ - unsetJoinExpr(p->x.pList->a[i].pExpr, iTable); + if( p->op==TK_FUNCTION ){ + assert( ExprUseXList(p) ); + if( p->x.pList ){ + int i; + for(i=0; ix.pList->nExpr; i++){ + unsetJoinExpr(p->x.pList->a[i].pExpr, iTable); + } } } unsetJoinExpr(p->pLeft, iTable); @@ -132545,7 +134755,7 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){ int iLeftCol; /* Matching column in the left table */ if( IsHiddenColumn(&pRightTab->aCol[j]) ) continue; - zName = pRightTab->aCol[j].zName; + zName = pRightTab->aCol[j].zCnName; if( tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol, 1) ){ addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, j, isOuter, &p->pWhere); @@ -132948,7 +135158,9 @@ static void fixDistinctOpenEph( int iVal, /* Value returned by codeDistinct() */ int iOpenEphAddr /* Address of OP_OpenEphemeral instruction for iTab */ ){ - if( eTnctType==WHERE_DISTINCT_UNIQUE || eTnctType==WHERE_DISTINCT_ORDERED ){ + if( pParse->nErr==0 + && (eTnctType==WHERE_DISTINCT_UNIQUE || eTnctType==WHERE_DISTINCT_ORDERED) + ){ Vdbe *v = pParse->pVdbe; sqlite3VdbeChangeToNoop(v, iOpenEphAddr); if( sqlite3VdbeGetOp(v, iOpenEphAddr+1)->opcode==OP_Explain ){ @@ -133005,9 +135217,13 @@ static void selectExprDefer( struct ExprList_item *pItem = &pEList->a[i]; if( pItem->u.x.iOrderByCol==0 ){ Expr *pExpr = pItem->pExpr; - Table *pTab = pExpr->y.pTab; - if( pExpr->op==TK_COLUMN && pExpr->iColumn>=0 && pTab && !IsVirtual(pTab) - && (pTab->aCol[pExpr->iColumn].colFlags & COLFLAG_SORTERREF) + Table *pTab; + if( pExpr->op==TK_COLUMN + && pExpr->iColumn>=0 + && ALWAYS( ExprUseYTab(pExpr) ) + && (pTab = pExpr->y.pTab)!=0 + && IsOrdinaryTable(pTab) + && (pTab->aCol[pExpr->iColumn].colFlags & COLFLAG_SORTERREF)!=0 ){ int j; for(j=0; jiTable = pExpr->iTable; + assert( ExprUseYTab(pNew) ); pNew->y.pTab = pExpr->y.pTab; pNew->iColumn = pPk ? pPk->aiColumn[k] : -1; pExtra = sqlite3ExprListAppend(pParse, pExtra, pNew); @@ -133463,7 +135680,7 @@ SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ p->nRef = 1; memset(&p[1], 0, nExtra); }else{ - sqlite3OomFault(db); + return (KeyInfo*)sqlite3OomFault(db); } return p; } @@ -133634,6 +135851,9 @@ static void generateSortTail( iTab = pSort->iECursor; if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){ + if( eDest==SRT_Mem && p->iOffset ){ + sqlite3VdbeAddOp2(v, OP_Null, 0, pDest->iSdst); + } regRowid = 0; regRow = pDest->iSdst; }else{ @@ -133876,7 +136096,7 @@ static const char *columnTypeImpl( break; } - assert( pTab && pExpr->y.pTab==pTab ); + assert( pTab && ExprUseYTab(pExpr) && pExpr->y.pTab==pTab ); if( pS ){ /* The "table" is actually a sub-select or a view in the FROM clause ** of the SELECT statement. Return the declaration type and origin @@ -133910,7 +136130,7 @@ static const char *columnTypeImpl( zType = "INTEGER"; zOrigCol = "rowid"; }else{ - zOrigCol = pTab->aCol[iCol].zName; + zOrigCol = pTab->aCol[iCol].zCnName; zType = sqlite3ColumnType(&pTab->aCol[iCol],0); } zOrigTab = pTab->zName; @@ -133936,9 +136156,11 @@ static const char *columnTypeImpl( ** statement. */ NameContext sNC; - Select *pS = pExpr->x.pSelect; - Expr *p = pS->pEList->a[0].pExpr; - assert( ExprHasProperty(pExpr, EP_xIsSelect) ); + Select *pS; + Expr *p; + assert( ExprUseXSelect(pExpr) ); + pS = pExpr->x.pSelect; + p = pS->pEList->a[0].pExpr; sNC.pSrcList = pS->pSrc; sNC.pNext = pNC; sNC.pParse = pNC->pParse; @@ -134067,7 +136289,8 @@ SQLITE_PRIVATE void sqlite3GenerateColumnNames( assert( p!=0 ); assert( p->op!=TK_AGG_COLUMN ); /* Agg processing has not run yet */ - assert( p->op!=TK_COLUMN || p->y.pTab!=0 ); /* Covering idx not yet coded */ + assert( p->op!=TK_COLUMN + || (ExprUseYTab(p) && p->y.pTab!=0) ); /* Covering idx not yet coded */ if( pEList->a[i].zEName && pEList->a[i].eEName==ENAME_NAME ){ /* An AS clause always takes first priority */ char *zName = pEList->a[i].zEName; @@ -134082,7 +136305,7 @@ SQLITE_PRIVATE void sqlite3GenerateColumnNames( if( iCol<0 ){ zCol = "rowid"; }else{ - zCol = pTab->aCol[iCol].zName; + zCol = pTab->aCol[iCol].zCnName; } if( fullName ){ char *zName = 0; @@ -134163,11 +136386,14 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList( pColExpr = pColExpr->pRight; assert( pColExpr!=0 ); } - if( pColExpr->op==TK_COLUMN && (pTab = pColExpr->y.pTab)!=0 ){ + if( pColExpr->op==TK_COLUMN + && ALWAYS( ExprUseYTab(pColExpr) ) + && (pTab = pColExpr->y.pTab)!=0 + ){ /* For columns use the column name name */ int iCol = pColExpr->iColumn; if( iCol<0 ) iCol = pTab->iPKey; - zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid"; + zName = iCol>=0 ? pTab->aCol[iCol].zCnName : "rowid"; }else if( pColExpr->op==TK_ID ){ assert( !ExprHasProperty(pColExpr, EP_IntValue) ); zName = pColExpr->u.zToken; @@ -134195,7 +136421,7 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList( zName = sqlite3MPrintf(db, "%.*z:%u", nName, zName, ++cnt); if( cnt>3 ) sqlite3_randomness(sizeof(cnt), &cnt); } - pCol->zName = zName; + pCol->zCnName = zName; pCol->hName = sqlite3StrIHash(zName); sqlite3ColumnPropertiesFromName(0, pCol); if( zName && sqlite3HashInsert(&ht, zName, pCol)==pCol ){ @@ -134205,7 +136431,7 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList( sqlite3HashClear(&ht); if( db->mallocFailed ){ for(j=0; jpEList->a; for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ const char *zType; - int n, m; + i64 n, m; pTab->tabFlags |= (pCol->colFlags & COLFLAG_NOINSERT); p = a[i].pExpr; zType = columnType(&sNC, p, 0, 0, 0); @@ -134257,17 +136483,21 @@ SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation( pCol->affinity = sqlite3ExprAffinity(p); if( zType ){ m = sqlite3Strlen30(zType); - n = sqlite3Strlen30(pCol->zName); - pCol->zName = sqlite3DbReallocOrFree(db, pCol->zName, n+m+2); - if( pCol->zName ){ - memcpy(&pCol->zName[n+1], zType, m+1); + n = sqlite3Strlen30(pCol->zCnName); + pCol->zCnName = sqlite3DbReallocOrFree(db, pCol->zCnName, n+m+2); + if( pCol->zCnName ){ + memcpy(&pCol->zCnName[n+1], zType, m+1); pCol->colFlags |= COLFLAG_HASTYPE; + }else{ + testcase( pCol->colFlags & COLFLAG_HASTYPE ); + pCol->colFlags &= ~(COLFLAG_HASTYPE|COLFLAG_HASCOLL); } } if( pCol->affinity<=SQLITE_AFF_NONE ) pCol->affinity = aff; pColl = sqlite3ExprCollSeq(pParse, p); - if( pColl && pCol->zColl==0 ){ - pCol->zColl = sqlite3DbStrDup(db, pColl->zName); + if( pColl ){ + assert( pTab->pIndex==0 ); + sqlite3ColumnSetColl(db, pCol, pColl->zName); } } pTab->szTabRow = 1; /* Any non-zero value works */ @@ -134431,7 +136661,7 @@ static CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){ */ static KeyInfo *multiSelectOrderByKeyInfo(Parse *pParse, Select *p, int nExtra){ ExprList *pOrderBy = p->pOrderBy; - int nOrderBy = p->pOrderBy->nExpr; + int nOrderBy = ALWAYS(pOrderBy!=0) ? pOrderBy->nExpr : 0; sqlite3 *db = pParse->db; KeyInfo *pRet = sqlite3KeyInfoAlloc(db, nOrderBy+nExtra, 1); if( pRet ){ @@ -134503,7 +136733,7 @@ static void generateWithRecursiveQuery( SrcList *pSrc = p->pSrc; /* The FROM clause of the recursive query */ int nCol = p->pEList->nExpr; /* Number of columns in the recursive table */ Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ - Select *pSetup = p->pPrior; /* The setup query */ + Select *pSetup; /* The setup query */ Select *pFirstRec; /* Left-most recursive term */ int addrTop; /* Top of the loop */ int addrCont, addrBreak; /* CONTINUE and BREAK addresses */ @@ -134587,7 +136817,6 @@ static void generateWithRecursiveQuery( ** iDistinct table. pFirstRec is left pointing to the left-most ** recursive term of the CTE. */ - pFirstRec = p; for(pFirstRec=p; ALWAYS(pFirstRec!=0); pFirstRec=pFirstRec->pPrior){ if( pFirstRec->selFlags & SF_Aggregate ){ sqlite3ErrorMsg(pParse, "recursive aggregate queries not supported"); @@ -135053,6 +137282,7 @@ static int multiSelect( int nCol; /* Number of columns in result set */ assert( p->pNext==0 ); + assert( p->pEList!=0 ); nCol = p->pEList->nExpr; pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1); if( !pKeyInfo ){ @@ -135087,7 +137317,11 @@ static int multiSelect( multi_select_end: pDest->iSdst = dest.iSdst; pDest->nSdst = dest.nSdst; - sqlite3SelectDelete(db, pDelete); + if( pDelete ){ + sqlite3ParserAddCleanup(pParse, + (void(*)(sqlite3*,void*))sqlite3SelectDelete, + pDelete); + } return rc; } #endif /* SQLITE_OMIT_COMPOUND_SELECT */ @@ -135341,6 +137575,8 @@ static int multiSelectOrderBy( ){ int i, j; /* Loop counters */ Select *pPrior; /* Another SELECT immediately to our left */ + Select *pSplit; /* Left-most SELECT in the right-hand group */ + int nSelect; /* Number of SELECT statements in the compound */ Vdbe *v; /* Generate code to this VDBE */ SelectDest destA; /* Destination for coroutine A */ SelectDest destB; /* Destination for coroutine B */ @@ -135386,8 +137622,7 @@ static int multiSelectOrderBy( /* Patch up the ORDER BY clause */ op = p->op; - pPrior = p->pPrior; - assert( pPrior->pOrderBy==0 ); + assert( p->pPrior->pOrderBy==0 ); pOrderBy = p->pOrderBy; assert( pOrderBy ); nOrderBy = pOrderBy->nExpr; @@ -135400,6 +137635,7 @@ static int multiSelectOrderBy( for(i=1; db->mallocFailed==0 && i<=p->pEList->nExpr; i++){ struct ExprList_item *pItem; for(j=0, pItem=pOrderBy->a; ju.x.iOrderByCol>0 ); if( pItem->u.x.iOrderByCol==i ) break; } @@ -135426,6 +137662,7 @@ static int multiSelectOrderBy( struct ExprList_item *pItem; aPermute[0] = nOrderBy; for(i=1, pItem=pOrderBy->a; i<=nOrderBy; i++, pItem++){ + assert( pItem!=0 ); assert( pItem->u.x.iOrderByCol>0 ); assert( pItem->u.x.iOrderByCol<=p->pEList->nExpr ); aPermute[i] = pItem->u.x.iOrderByCol - 1; @@ -135435,11 +137672,6 @@ static int multiSelectOrderBy( pKeyMerge = 0; } - /* Reattach the ORDER BY clause to the query. - */ - p->pOrderBy = pOrderBy; - pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0); - /* Allocate a range of temporary registers and the KeyInfo needed ** for the logic that removes duplicate result rows when the ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL). @@ -135464,12 +137696,30 @@ static int multiSelectOrderBy( /* Separate the left and the right query from one another */ - p->pPrior = 0; + nSelect = 1; + if( (op==TK_ALL || op==TK_UNION) + && OptimizationEnabled(db, SQLITE_BalancedMerge) + ){ + for(pSplit=p; pSplit->pPrior!=0 && pSplit->op==op; pSplit=pSplit->pPrior){ + nSelect++; + assert( pSplit->pPrior->pNext==pSplit ); + } + } + if( nSelect<=3 ){ + pSplit = p; + }else{ + pSplit = p; + for(i=2; ipPrior; } + } + pPrior = pSplit->pPrior; + assert( pPrior!=0 ); + pSplit->pPrior = 0; pPrior->pNext = 0; + assert( p->pOrderBy == pOrderBy ); + assert( pOrderBy!=0 || db->mallocFailed ); + pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0); sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER"); - if( pPrior->pPrior==0 ){ - sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER"); - } + sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER"); /* Compute the limit registers */ computeLimitRegisters(pParse, p, labelEnd); @@ -135620,12 +137870,11 @@ static int multiSelectOrderBy( /* Reassembly the compound query so that it will be freed correctly ** by the calling function */ - if( p->pPrior ){ - sqlite3SelectDelete(db, p->pPrior); + if( pSplit->pPrior ){ + sqlite3SelectDelete(db, pSplit->pPrior); } - p->pPrior = pPrior; - pPrior->pNext = p; - + pSplit->pPrior = pPrior; + pPrior->pNext = pSplit; sqlite3ExprListDelete(db, pPrior->pOrderBy); pPrior->pOrderBy = 0; @@ -135675,9 +137924,9 @@ static Expr *substExpr( ){ if( pExpr==0 ) return 0; if( ExprHasProperty(pExpr, EP_FromJoin) - && pExpr->iRightJoinTable==pSubst->iTable + && pExpr->w.iRightJoinTable==pSubst->iTable ){ - pExpr->iRightJoinTable = pSubst->iNewTable; + pExpr->w.iRightJoinTable = pSubst->iNewTable; } if( pExpr->op==TK_COLUMN && pExpr->iTable==pSubst->iTable @@ -135716,7 +137965,7 @@ static Expr *substExpr( ExprSetProperty(pNew, EP_CanBeNull); } if( ExprHasProperty(pExpr,EP_FromJoin) ){ - sqlite3SetJoinExpr(pNew, pExpr->iRightJoinTable); + sqlite3SetJoinExpr(pNew, pExpr->w.iRightJoinTable); } sqlite3ExprDelete(db, pExpr); pExpr = pNew; @@ -135738,7 +137987,7 @@ static Expr *substExpr( } pExpr->pLeft = substExpr(pSubst, pExpr->pLeft); pExpr->pRight = substExpr(pSubst, pExpr->pRight); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ substSelect(pSubst, pExpr->x.pSelect, 1); }else{ substExprList(pSubst, pExpr->x.pList); @@ -135829,10 +138078,10 @@ static void recomputeColumnsUsed( ** new cursor number assigned, set an entry in the aCsrMap[] array ** to map the old cursor number to the new: ** -** aCsrMap[iOld] = iNew; +** aCsrMap[iOld+1] = iNew; ** ** The array is guaranteed by the caller to be large enough for all -** existing cursor numbers in pSrc. +** existing cursor numbers in pSrc. aCsrMap[0] is the array size. ** ** If pSrc contains any sub-selects, call this routine recursively ** on the FROM clause of each such sub-select, with iExcept set to -1. @@ -135848,10 +138097,11 @@ static void srclistRenumberCursors( for(i=0, pItem=pSrc->a; inSrc; i++, pItem++){ if( i!=iExcept ){ Select *p; - if( !pItem->fg.isRecursive || aCsrMap[pItem->iCursor]==0 ){ - aCsrMap[pItem->iCursor] = pParse->nTab++; + assert( pItem->iCursor < aCsrMap[0] ); + if( !pItem->fg.isRecursive || aCsrMap[pItem->iCursor+1]==0 ){ + aCsrMap[pItem->iCursor+1] = pParse->nTab++; } - pItem->iCursor = aCsrMap[pItem->iCursor]; + pItem->iCursor = aCsrMap[pItem->iCursor+1]; for(p=pItem->pSelect; p; p=p->pPrior){ srclistRenumberCursors(pParse, aCsrMap, p->pSrc, -1); } @@ -135859,18 +138109,28 @@ static void srclistRenumberCursors( } } +/* +** *piCursor is a cursor number. Change it if it needs to be mapped. +*/ +static void renumberCursorDoMapping(Walker *pWalker, int *piCursor){ + int *aCsrMap = pWalker->u.aiCol; + int iCsr = *piCursor; + if( iCsr < aCsrMap[0] && aCsrMap[iCsr+1]>0 ){ + *piCursor = aCsrMap[iCsr+1]; + } +} + /* ** Expression walker callback used by renumberCursors() to update ** Expr objects to match newly assigned cursor numbers. */ static int renumberCursorsCb(Walker *pWalker, Expr *pExpr){ - int *aCsrMap = pWalker->u.aiCol; int op = pExpr->op; - if( (op==TK_COLUMN || op==TK_IF_NULL_ROW) && aCsrMap[pExpr->iTable] ){ - pExpr->iTable = aCsrMap[pExpr->iTable]; + if( op==TK_COLUMN || op==TK_IF_NULL_ROW ){ + renumberCursorDoMapping(pWalker, &pExpr->iTable); } - if( ExprHasProperty(pExpr, EP_FromJoin) && aCsrMap[pExpr->iRightJoinTable] ){ - pExpr->iRightJoinTable = aCsrMap[pExpr->iRightJoinTable]; + if( ExprHasProperty(pExpr, EP_FromJoin) ){ + renumberCursorDoMapping(pWalker, &pExpr->w.iRightJoinTable); } return WRC_Continue; } @@ -136214,7 +138474,8 @@ static int flattenSubquery( if( pSrc->nSrc>1 ){ if( pParse->nSelect>500 ) return 0; - aCsrMap = sqlite3DbMallocZero(db, pParse->nTab*sizeof(int)); + aCsrMap = sqlite3DbMallocZero(db, ((i64)pParse->nTab+1)*sizeof(int)); + if( aCsrMap ) aCsrMap[0] = pParse->nTab; } } @@ -136837,8 +139098,7 @@ static int pushDownWhereTerms( Parse *pParse, /* Parse context (for malloc() and error reporting) */ Select *pSubq, /* The subquery whose WHERE clause is to be augmented */ Expr *pWhere, /* The WHERE clause of the outer query */ - int iCursor, /* Cursor number of the subquery */ - int isLeftJoin /* True if pSubq is the right term of a LEFT JOIN */ + SrcItem *pSrc /* The subquery term of the outer FROM clause */ ){ Expr *pNew; int nChng = 0; @@ -136873,20 +139133,25 @@ static int pushDownWhereTerms( return 0; /* restriction (3) */ } while( pWhere->op==TK_AND ){ - nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, - iCursor, isLeftJoin); + nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, pSrc); pWhere = pWhere->pLeft; } + +#if 0 /* Legacy code. Checks now done by sqlite3ExprIsTableConstraint() */ if( isLeftJoin && (ExprHasProperty(pWhere,EP_FromJoin)==0 - || pWhere->iRightJoinTable!=iCursor) + || pWhere->w.iRightJoinTable!=iCursor) ){ return 0; /* restriction (4) */ } - if( ExprHasProperty(pWhere,EP_FromJoin) && pWhere->iRightJoinTable!=iCursor ){ + if( ExprHasProperty(pWhere,EP_FromJoin) + && pWhere->w.iRightJoinTable!=iCursor + ){ return 0; /* restriction (5) */ } - if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){ +#endif + + if( sqlite3ExprIsTableConstraint(pWhere, pSrc) ){ nChng++; pSubq->selFlags |= SF_PushDown; while( pSubq ){ @@ -136894,8 +139159,8 @@ static int pushDownWhereTerms( pNew = sqlite3ExprDup(pParse->db, pWhere, 0); unsetJoinExpr(pNew, -1); x.pParse = pParse; - x.iTable = iCursor; - x.iNewTable = iCursor; + x.iTable = pSrc->iCursor; + x.iNewTable = pSrc->iCursor; x.isLeftJoin = 0; x.pEList = pSubq->pEList; pNew = substExpr(&x, pNew); @@ -136937,7 +139202,7 @@ static int pushDownWhereTerms( */ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){ int eRet = WHERE_ORDERBY_NORMAL; /* Return value */ - ExprList *pEList = pFunc->x.pList; /* Arguments to agg function */ + ExprList *pEList; /* Arguments to agg function */ const char *zFunc; /* Name of aggregate function pFunc */ ExprList *pOrderBy; u8 sortFlags = 0; @@ -136945,6 +139210,8 @@ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){ assert( *ppMinMax==0 ); assert( pFunc->op==TK_AGG_FUNCTION ); assert( !IsWindowFunc(pFunc) ); + assert( ExprUseXList(pFunc) ); + pEList = pFunc->x.pList; if( pEList==0 || pEList->nExpr!=1 || ExprHasProperty(pFunc, EP_WinFunc) @@ -136952,6 +139219,7 @@ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){ ){ return eRet; } + assert( !ExprHasProperty(pFunc, EP_IntValue) ); zFunc = pFunc->u.zToken; if( sqlite3StrICmp(zFunc, "min")==0 ){ eRet = WHERE_ORDERBY_MIN; @@ -136979,7 +139247,13 @@ static u8 minMaxQuery(sqlite3 *db, Expr *pFunc, ExprList **ppMinMax){ ** ** where table is a database table, not a sub-select or view. If the query ** does match this pattern, then a pointer to the Table object representing -** is returned. Otherwise, 0 is returned. +** is returned. Otherwise, NULL is returned. +** +** This routine checks to see if it is safe to use the count optimization. +** A correct answer is still obtained (though perhaps more slowly) if +** this routine returns NULL when it could have returned a table pointer. +** But returning the pointer when NULL should have been returned can +** result in incorrect answers and/or crashes. So, when in doubt, return NULL. */ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){ Table *pTab; @@ -136987,19 +139261,26 @@ static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){ assert( !p->pGroupBy ); - if( p->pWhere || p->pEList->nExpr!=1 - || p->pSrc->nSrc!=1 || p->pSrc->a[0].pSelect + if( p->pWhere + || p->pEList->nExpr!=1 + || p->pSrc->nSrc!=1 + || p->pSrc->a[0].pSelect + || pAggInfo->nFunc!=1 ){ return 0; } pTab = p->pSrc->a[0].pTab; + assert( pTab!=0 ); + assert( !IsView(pTab) ); + if( !IsOrdinaryTable(pTab) ) return 0; pExpr = p->pEList->a[0].pExpr; - assert( pTab && !pTab->pSelect && pExpr ); - - if( IsVirtual(pTab) ) return 0; + assert( pExpr!=0 ); if( pExpr->op!=TK_AGG_FUNCTION ) return 0; - if( NEVER(pAggInfo->nFunc==0) ) return 0; + if( pExpr->pAggInfo!=pAggInfo ) return 0; if( (pAggInfo->aFunc[0].pFunc->funcFlags&SQLITE_FUNC_COUNT)==0 ) return 0; + assert( pAggInfo->aFunc[0].pFExpr==pExpr ); + testcase( ExprHasProperty(pExpr, EP_Distinct) ); + testcase( ExprHasProperty(pExpr, EP_WinFunc) ); if( ExprHasProperty(pExpr, EP_Distinct|EP_WinFunc) ) return 0; return pTab; @@ -137028,6 +139309,7 @@ SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, SrcItem *pFrom){ pParse->checkSchema = 1; return SQLITE_ERROR; } + assert( pFrom->fg.isCte==0 ); pFrom->u2.pIBIndex = pIdx; return SQLITE_OK; } @@ -137285,6 +139567,10 @@ static int resolveFromTermToCte( if( db->mallocFailed ) return 2; pFrom->pSelect->selFlags |= SF_CopyCte; assert( pFrom->pSelect ); + if( pFrom->fg.isIndexedBy ){ + sqlite3ErrorMsg(pParse, "no such index: \"%s\"", pFrom->u1.zIndexedBy); + return 2; + } pFrom->fg.isCte = 1; pFrom->u2.pCteUse = pCteUse; pCteUse->nUse++; @@ -137539,30 +139825,31 @@ static int selectExpander(Walker *pWalker, Select *p){ return WRC_Abort; } #if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) - if( IsVirtual(pTab) || pTab->pSelect ){ + if( !IsOrdinaryTable(pTab) ){ i16 nCol; u8 eCodeOrig = pWalker->eCode; if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; assert( pFrom->pSelect==0 ); - if( pTab->pSelect - && (db->flags & SQLITE_EnableView)==0 - && pTab->pSchema!=db->aDb[1].pSchema - ){ - sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited", - pTab->zName); + if( IsView(pTab) ){ + if( (db->flags & SQLITE_EnableView)==0 + && pTab->pSchema!=db->aDb[1].pSchema + ){ + sqlite3ErrorMsg(pParse, "access to view \"%s\" prohibited", + pTab->zName); + } + pFrom->pSelect = sqlite3SelectDup(db, pTab->u.view.pSelect, 0); } #ifndef SQLITE_OMIT_VIRTUALTABLE - assert( SQLITE_VTABRISK_Normal==1 && SQLITE_VTABRISK_High==2 ); - if( IsVirtual(pTab) + else if( ALWAYS(IsVirtual(pTab)) && pFrom->fg.fromDDL - && ALWAYS(pTab->pVTable!=0) - && pTab->pVTable->eVtabRisk > ((db->flags & SQLITE_TrustedSchema)!=0) + && ALWAYS(pTab->u.vtab.p!=0) + && pTab->u.vtab.p->eVtabRisk > ((db->flags & SQLITE_TrustedSchema)!=0) ){ sqlite3ErrorMsg(pParse, "unsafe use of virtual table \"%s\"", pTab->zName); } + assert( SQLITE_VTABRISK_Normal==1 && SQLITE_VTABRISK_High==2 ); #endif - pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); nCol = pTab->nCol; pTab->nCol = -1; pWalker->eCode = 1; /* Turn on Select.selId renumbering */ @@ -137581,7 +139868,8 @@ static int selectExpander(Walker *pWalker, Select *p){ /* Process NATURAL keywords, and ON and USING clauses of joins. */ - if( pParse->nErr || db->mallocFailed || sqliteProcessJoin(pParse, p) ){ + assert( db->mallocFailed==0 || pParse->nErr!=0 ); + if( pParse->nErr || sqliteProcessJoin(pParse, p) ){ return WRC_Abort; } @@ -137662,7 +139950,7 @@ static int selectExpander(Walker *pWalker, Select *p){ zSchemaName = iDb>=0 ? db->aDb[iDb].zDbSName : "*"; } for(j=0; jnCol; j++){ - char *zName = pTab->aCol[j].zName; + char *zName = pTab->aCol[j].zCnName; char *zColname; /* The computed column name */ char *zToFree; /* Malloced string that needs to be freed */ Token sColname; /* Computed column name as a token */ @@ -137878,12 +140166,13 @@ SQLITE_PRIVATE void sqlite3SelectPrep( NameContext *pOuterNC /* Name context for container */ ){ assert( p!=0 || pParse->db->mallocFailed ); + assert( pParse->db->pParse==pParse ); if( pParse->db->mallocFailed ) return; if( p->selFlags & SF_HasTypeInfo ) return; sqlite3SelectExpand(pParse, p); - if( pParse->nErr || pParse->db->mallocFailed ) return; + if( pParse->nErr ) return; sqlite3ResolveSelectNames(pParse, p, pOuterNC); - if( pParse->nErr || pParse->db->mallocFailed ) return; + if( pParse->nErr ) return; sqlite3SelectAddTypeInfo(pParse, p); } @@ -137900,8 +140189,10 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ int i; struct AggInfo_func *pFunc; int nReg = pAggInfo->nFunc + pAggInfo->nColumn; + assert( pParse->db->pParse==pParse ); + assert( pParse->db->mallocFailed==0 || pParse->nErr!=0 ); if( nReg==0 ) return; - if( pParse->nErr || pParse->db->mallocFailed ) return; + if( pParse->nErr ) return; #ifdef SQLITE_DEBUG /* Verify that all AggInfo registers are within the range specified by ** AggInfo.mnReg..AggInfo.mxReg */ @@ -137919,7 +140210,7 @@ static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ for(pFunc=pAggInfo->aFunc, i=0; inFunc; i++, pFunc++){ if( pFunc->iDistinct>=0 ){ Expr *pE = pFunc->pFExpr; - assert( !ExprHasProperty(pE, EP_xIsSelect) ); + assert( ExprUseXList(pE) ); if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){ sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one " "argument"); @@ -137944,8 +140235,9 @@ static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ int i; struct AggInfo_func *pF; for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){ - ExprList *pList = pF->pFExpr->x.pList; - assert( !ExprHasProperty(pF->pFExpr, EP_xIsSelect) ); + ExprList *pList; + assert( ExprUseXList(pF->pFExpr) ); + pList = pF->pFExpr->x.pList; sqlite3VdbeAddOp2(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0); sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); } @@ -137979,9 +140271,10 @@ static void updateAccumulator( int nArg; int addrNext = 0; int regAgg; - ExprList *pList = pF->pFExpr->x.pList; - assert( !ExprHasProperty(pF->pFExpr, EP_xIsSelect) ); + ExprList *pList; + assert( ExprUseXList(pF->pFExpr) ); assert( !IsWindowFunc(pF->pFExpr) ); + pList = pF->pFExpr->x.pList; if( ExprHasProperty(pF->pFExpr, EP_WinFunc) ){ Expr *pFilter = pF->pFExpr->y.pWin->pFilter; if( pAggInfo->nAccumulator @@ -138094,8 +140387,16 @@ static void explainSimpleCount( static int havingToWhereExprCb(Walker *pWalker, Expr *pExpr){ if( pExpr->op!=TK_AND ){ Select *pS = pWalker->u.pSelect; + /* This routine is called before the HAVING clause of the current + ** SELECT is analyzed for aggregates. So if pExpr->pAggInfo is set + ** here, it indicates that the expression is a correlated reference to a + ** column from an outer aggregate query, or an aggregate function that + ** belongs to an outer query. Do not move the expression to the WHERE + ** clause in this obscure case, as doing so may corrupt the outer Select + ** statements AggInfo structure. */ if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) && ExprAlwaysFalse(pExpr)==0 + && pExpr->pAggInfo==0 ){ sqlite3 *db = pWalker->pParse->db; Expr *pNew = sqlite3Expr(db, TK_INTEGER, "1"); @@ -138219,7 +140520,9 @@ static int countOfViewOptimization(Parse *pParse, Select *p){ if( p->pGroupBy ) return 0; pExpr = p->pEList->a[0].pExpr; if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */ + assert( ExprUseUToken(pExpr) ); if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */ + assert( ExprUseXList(pExpr) ); if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */ if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */ pSub = p->pSrc->a[0].pSelect; @@ -138312,10 +140615,12 @@ SQLITE_PRIVATE int sqlite3Select( u8 minMaxFlag; /* Flag for min/max queries */ db = pParse->db; + assert( pParse==db->pParse ); v = sqlite3GetVdbe(pParse); - if( p==0 || db->mallocFailed || pParse->nErr ){ + if( p==0 || pParse->nErr ){ return 1; } + assert( db->mallocFailed==0 ); if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; #if SELECTTRACE_ENABLED SELECTTRACE(1,pParse,p, ("begin processing:\n", pParse->addrExplain)); @@ -138350,9 +140655,10 @@ SQLITE_PRIVATE int sqlite3Select( p->selFlags |= SF_NoopOrderBy; } sqlite3SelectPrep(pParse, p, 0); - if( pParse->nErr || db->mallocFailed ){ + if( pParse->nErr ){ goto select_end; } + assert( db->mallocFailed==0 ); assert( p->pEList!=0 ); #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x104 ){ @@ -138361,11 +140667,16 @@ SQLITE_PRIVATE int sqlite3Select( } #endif - /* If the SF_UpdateFrom flag is set, then this function is being called + /* If the SF_UFSrcCheck flag is set, then this function is being called ** as part of populating the temp table for an UPDATE...FROM statement. ** In this case, it is an error if the target object (pSrc->a[0]) name - ** or alias is duplicated within FROM clause (pSrc->a[1..n]). */ - if( p->selFlags & SF_UpdateFrom ){ + ** or alias is duplicated within FROM clause (pSrc->a[1..n]). + ** + ** Postgres disallows this case too. The reason is that some other + ** systems handle this case differently, and not all the same way, + ** which is just confusing. To avoid this, we follow PG's lead and + ** disallow it altogether. */ + if( p->selFlags & SF_UFSrcCheck ){ SrcItem *p0 = &p->pSrc->a[0]; for(i=1; ipSrc->nSrc; i++){ SrcItem *p1 = &p->pSrc->a[i]; @@ -138377,6 +140688,12 @@ SQLITE_PRIVATE int sqlite3Select( goto select_end; } } + + /* Clear the SF_UFSrcCheck flag. The check has already been performed, + ** and leaving this flag set can cause errors if a compound sub-query + ** in p->pSrc is flattened into this query and this function called + ** again as part of compound SELECT processing. */ + p->selFlags &= ~SF_UFSrcCheck; } if( pDest->eDest==SRT_Output ){ @@ -138385,7 +140702,7 @@ SQLITE_PRIVATE int sqlite3Select( #ifndef SQLITE_OMIT_WINDOWFUNC if( sqlite3WindowRewrite(pParse, p) ){ - assert( db->mallocFailed || pParse->nErr>0 ); + assert( pParse->nErr ); goto select_end; } #if SELECTTRACE_ENABLED @@ -138448,6 +140765,39 @@ SQLITE_PRIVATE int sqlite3Select( if( (pSub->selFlags & SF_Aggregate)!=0 ) continue; assert( pSub->pGroupBy==0 ); + /* If a FROM-clause subquery has an ORDER BY clause that is not + ** really doing anything, then delete it now so that it does not + ** interfere with query flattening. See the discussion at + ** https://sqlite.org/forum/forumpost/2d76f2bcf65d256a + ** + ** Beware of these cases where the ORDER BY clause may not be safely + ** omitted: + ** + ** (1) There is also a LIMIT clause + ** (2) The subquery was added to help with window-function + ** processing + ** (3) The subquery is in the FROM clause of an UPDATE + ** (4) The outer query uses an aggregate function other than + ** the built-in count(), min(), or max(). + ** (5) The ORDER BY isn't going to accomplish anything because + ** one of: + ** (a) The outer query has a different ORDER BY clause + ** (b) The subquery is part of a join + ** See forum post 062d576715d277c8 + */ + if( pSub->pOrderBy!=0 + && (p->pOrderBy!=0 || pTabList->nSrc>1) /* Condition (5) */ + && pSub->pLimit==0 /* Condition (1) */ + && (pSub->selFlags & SF_OrderByReqd)==0 /* Condition (2) */ + && (p->selFlags & SF_OrderByReqd)==0 /* Condition (3) and (4) */ + && OptimizationEnabled(db, SQLITE_OmitOrderBy) + ){ + SELECTTRACE(0x100,pParse,p, + ("omit superfluous ORDER BY on %r FROM-clause subquery\n",i+1)); + sqlite3ExprListDelete(db, pSub->pOrderBy); + pSub->pOrderBy = 0; + } + /* If the outer query contains a "complex" result set (that is, ** if the result set of the outer query uses functions or subqueries) ** and if the subquery contains an ORDER BY clause and if @@ -138590,9 +140940,9 @@ SQLITE_PRIVATE int sqlite3Select( ** inside the subquery. This can help the subquery to run more efficiently. */ if( OptimizationEnabled(db, SQLITE_PushDown) - && (pItem->fg.isCte==0 || pItem->u2.pCteUse->eM10d!=M10d_Yes) - && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor, - (pItem->fg.jointype & JT_OUTER)!=0) + && (pItem->fg.isCte==0 + || (pItem->u2.pCteUse->eM10d!=M10d_Yes && pItem->u2.pCteUse->nUse<2)) + && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem) ){ #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x100 ){ @@ -138651,6 +141001,7 @@ SQLITE_PRIVATE int sqlite3Select( sqlite3VdbeAddOp2(v, OP_Gosub, pCteUse->regRtn, pCteUse->addrM9e); if( pItem->iCursor!=pCteUse->iCur ){ sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pCteUse->iCur); + VdbeComment((v, "%!S", pItem)); } pSub->nSelectRow = pCteUse->nRowEst; }else if( (pPrior = isSelfJoinView(pTabList, pItem))!=0 ){ @@ -138826,7 +141177,7 @@ SQLITE_PRIVATE int sqlite3Select( /* Begin the database scan. */ SELECTTRACE(1,pParse,p,("WhereBegin\n")); pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, sSort.pOrderBy, - p->pEList, wctrlFlags, p->nSelectRow); + p->pEList, p, wctrlFlags, p->nSelectRow); if( pWInfo==0 ) goto select_end; if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){ p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo); @@ -138988,7 +141339,7 @@ SQLITE_PRIVATE int sqlite3Select( } for(i=0; inFunc; i++){ Expr *pExpr = pAggInfo->aFunc[i].pFExpr; - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); + assert( ExprUseXList(pExpr) ); sNC.ncFlags |= NC_InAggFunc; sqlite3ExprAnalyzeAggList(&sNC, pExpr->x.pList); #ifndef SQLITE_OMIT_WINDOWFUNC @@ -139043,7 +141394,9 @@ SQLITE_PRIVATE int sqlite3Select( if( pAggInfo->nFunc==1 && pAggInfo->aFunc[0].iDistinct>=0 - && pAggInfo->aFunc[0].pFExpr->x.pList + && ALWAYS(pAggInfo->aFunc[0].pFExpr!=0) + && ALWAYS(ExprUseXList(pAggInfo->aFunc[0].pFExpr)) + && pAggInfo->aFunc[0].pFExpr->x.pList!=0 ){ Expr *pExpr = pAggInfo->aFunc[0].pFExpr->x.pList->a[0].pExpr; pExpr = sqlite3ExprDup(db, pExpr, 0); @@ -139088,7 +141441,7 @@ SQLITE_PRIVATE int sqlite3Select( sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); SELECTTRACE(1,pParse,p,("WhereBegin\n")); pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, pDistinct, - WHERE_GROUPBY | (orderByGrp ? WHERE_SORTBYGROUP : 0) | distFlag, 0 + 0, (WHERE_GROUPBY|(orderByGrp ? WHERE_SORTBYGROUP : 0)|distFlag), 0 ); if( pWInfo==0 ){ sqlite3ExprListDelete(db, pDistinct); @@ -139364,6 +141717,7 @@ SQLITE_PRIVATE int sqlite3Select( sqlite3VdbeAddOp2(v, OP_Integer, 0, regAcc); } }else if( pAggInfo->nFunc==1 && pAggInfo->aFunc[0].iDistinct>=0 ){ + assert( ExprUseXList(pAggInfo->aFunc[0].pFExpr) ); pDistinct = pAggInfo->aFunc[0].pFExpr->x.pList; distFlag = pDistinct ? (WHERE_WANT_DISTINCT|WHERE_AGG_DISTINCT) : 0; } @@ -139385,7 +141739,7 @@ SQLITE_PRIVATE int sqlite3Select( SELECTTRACE(1,pParse,p,("WhereBegin\n")); pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMaxOrderBy, - pDistinct, minMaxFlag|distFlag, 0); + pDistinct, 0, minMaxFlag|distFlag, 0); if( pWInfo==0 ){ goto select_end; } @@ -139442,7 +141796,7 @@ SQLITE_PRIVATE int sqlite3Select( */ select_end: assert( db->mallocFailed==0 || db->mallocFailed==1 ); - pParse->nErr += db->mallocFailed; + assert( db->mallocFailed==0 || pParse->nErr!=0 ); sqlite3ExprListDelete(db, pMinMaxOrderBy); #ifdef SQLITE_DEBUG if( pAggInfo && !db->mallocFailed ){ @@ -139895,12 +142249,12 @@ SQLITE_PRIVATE void sqlite3BeginTrigger( /* INSTEAD of triggers are only for views and views only support INSTEAD ** of triggers. */ - if( pTab->pSelect && tr_tm!=TK_INSTEAD ){ + if( IsView(pTab) && tr_tm!=TK_INSTEAD ){ sqlite3ErrorMsg(pParse, "cannot create %s trigger on view: %S", (tr_tm == TK_BEFORE)?"BEFORE":"AFTER", pTableName->a); goto trigger_orphan_error; } - if( !pTab->pSelect && tr_tm==TK_INSTEAD ){ + if( !IsView(pTab) && tr_tm==TK_INSTEAD ){ sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF" " trigger on table: %S", pTableName->a); goto trigger_orphan_error; @@ -140037,7 +142391,7 @@ SQLITE_PRIVATE void sqlite3FinishTrigger( z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n); testcase( z==0 ); sqlite3NestedParse(pParse, - "INSERT INTO %Q." DFLT_SCHEMA_TABLE + "INSERT INTO %Q." LEGACY_SCHEMA_TABLE " VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')", db->aDb[iDb].zDbSName, zName, pTrig->table, z); @@ -140122,6 +142476,7 @@ static TriggerStep *triggerStepAllocate( sqlite3 *db = pParse->db; TriggerStep *pTriggerStep; + if( pParse->nErr ) return 0; pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1); if( pTriggerStep ){ char *z = (char*)&pTriggerStep[1]; @@ -140351,7 +142706,7 @@ SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ */ if( (v = sqlite3GetVdbe(pParse))!=0 ){ sqlite3NestedParse(pParse, - "DELETE FROM %Q." DFLT_SCHEMA_TABLE " WHERE name=%Q AND type='trigger'", + "DELETE FROM %Q." LEGACY_SCHEMA_TABLE " WHERE name=%Q AND type='trigger'", db->aDb[iDb].zDbSName, pTrigger->zName ); sqlite3ChangeCookie(pParse, iDb); @@ -140553,11 +142908,11 @@ static ExprList *sqlite3ExpandReturning( for(jj=0; jjnCol; jj++){ Expr *pNewExpr; if( IsHiddenColumn(pTab->aCol+jj) ) continue; - pNewExpr = sqlite3Expr(db, TK_ID, pTab->aCol[jj].zName); + pNewExpr = sqlite3Expr(db, TK_ID, pTab->aCol[jj].zCnName); pNew = sqlite3ExprListAppend(pParse, pNew, pNewExpr); if( !db->mallocFailed ){ struct ExprList_item *pItem = &pNew->a[pNew->nExpr-1]; - pItem->zEName = sqlite3DbStrDup(db, pTab->aCol[jj].zName); + pItem->zEName = sqlite3DbStrDup(db, pTab->aCol[jj].zCnName); pItem->eEName = ENAME_NAME; } } @@ -140594,6 +142949,7 @@ static void codeReturningTrigger( assert( v!=0 ); assert( pParse->bReturning ); + assert( db->pParse==pParse ); pReturning = pParse->u1.pReturning; assert( pTrigger == &(pReturning->retTrig) ); memset(&sSelect, 0, sizeof(sSelect)); @@ -140602,13 +142958,15 @@ static void codeReturningTrigger( sSelect.pSrc = &sFrom; sFrom.nSrc = 1; sFrom.a[0].pTab = pTab; + sFrom.a[0].iCursor = -1; sqlite3SelectPrep(pParse, &sSelect, 0); - if( db->mallocFailed==0 && pParse->nErr==0 ){ + if( pParse->nErr==0 ){ + assert( db->mallocFailed==0 ); sqlite3GenerateColumnNames(pParse, &sSelect); } sqlite3ExprListDelete(db, sSelect.pEList); pNew = sqlite3ExpandReturning(pParse, pReturning->pReturnEL, pTab); - if( pNew ){ + if( !db->mallocFailed ){ NameContext sNC; memset(&sNC, 0, sizeof(sNC)); if( pReturning->nRetCol==0 ){ @@ -140620,7 +142978,9 @@ static void codeReturningTrigger( sNC.ncFlags = NC_UBaseReg; pParse->eTriggerOp = pTrigger->op; pParse->pTriggerTab = pTab; - if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK ){ + if( sqlite3ResolveExprListNames(&sNC, pNew)==SQLITE_OK + && ALWAYS(!db->mallocFailed) + ){ int i; int nCol = pNew->nExpr; int reg = pParse->nMem+1; @@ -140628,16 +142988,20 @@ static void codeReturningTrigger( pReturning->iRetReg = reg; for(i=0; ia[i].pExpr; + assert( pCol!=0 ); /* Due to !db->mallocFailed ~9 lines above */ sqlite3ExprCodeFactorable(pParse, pCol, reg+i); + if( sqlite3ExprAffinity(pCol)==SQLITE_AFF_REAL ){ + sqlite3VdbeAddOp1(v, OP_RealAffinity, reg+i); + } } sqlite3VdbeAddOp3(v, OP_MakeRecord, reg, i, reg+i); sqlite3VdbeAddOp2(v, OP_NewRowid, pReturning->iRetCur, reg+i+1); sqlite3VdbeAddOp3(v, OP_Insert, pReturning->iRetCur, reg+i, reg+i+1); } - sqlite3ExprListDelete(db, pNew); - pParse->eTriggerOp = 0; - pParse->pTriggerTab = 0; } + sqlite3ExprListDelete(db, pNew); + pParse->eTriggerOp = 0; + pParse->pTriggerTab = 0; } @@ -140779,8 +143143,8 @@ static TriggerPrg *codeRowTrigger( Vdbe *v; /* Temporary VM */ NameContext sNC; /* Name context for sub-vdbe */ SubProgram *pProgram = 0; /* Sub-vdbe for trigger program */ - Parse *pSubParse; /* Parse context for sub-vdbe */ int iEndTrigger = 0; /* Label to jump to if WHEN is false */ + Parse sSubParse; /* Parse context for sub-vdbe */ assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) ); assert( pTop->pVdbe ); @@ -140802,19 +143166,17 @@ static TriggerPrg *codeRowTrigger( /* Allocate and populate a new Parse context to use for coding the ** trigger sub-program. */ - pSubParse = sqlite3StackAllocZero(db, sizeof(Parse)); - if( !pSubParse ) return 0; + sqlite3ParseObjectInit(&sSubParse, db); memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pSubParse; - pSubParse->db = db; - pSubParse->pTriggerTab = pTab; - pSubParse->pToplevel = pTop; - pSubParse->zAuthContext = pTrigger->zName; - pSubParse->eTriggerOp = pTrigger->op; - pSubParse->nQueryLoop = pParse->nQueryLoop; - pSubParse->disableVtab = pParse->disableVtab; - - v = sqlite3GetVdbe(pSubParse); + sNC.pParse = &sSubParse; + sSubParse.pTriggerTab = pTab; + sSubParse.pToplevel = pTop; + sSubParse.zAuthContext = pTrigger->zName; + sSubParse.eTriggerOp = pTrigger->op; + sSubParse.nQueryLoop = pParse->nQueryLoop; + sSubParse.disableVtab = pParse->disableVtab; + + v = sqlite3GetVdbe(&sSubParse); if( v ){ VdbeComment((v, "Start: %s.%s (%s %s%s%s ON %s)", pTrigger->zName, onErrorText(orconf), @@ -140840,14 +143202,14 @@ static TriggerPrg *codeRowTrigger( if( db->mallocFailed==0 && SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen) ){ - iEndTrigger = sqlite3VdbeMakeLabel(pSubParse); - sqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL); + iEndTrigger = sqlite3VdbeMakeLabel(&sSubParse); + sqlite3ExprIfFalse(&sSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL); } sqlite3ExprDelete(db, pWhen); } /* Code the trigger program into the sub-vdbe. */ - codeTriggerProgram(pSubParse, pTrigger->step_list, orconf); + codeTriggerProgram(&sSubParse, pTrigger->step_list, orconf); /* Insert an OP_Halt at the end of the sub-program. */ if( iEndTrigger ){ @@ -140855,23 +143217,24 @@ static TriggerPrg *codeRowTrigger( } sqlite3VdbeAddOp0(v, OP_Halt); VdbeComment((v, "End: %s.%s", pTrigger->zName, onErrorText(orconf))); + transferParseError(pParse, &sSubParse); - transferParseError(pParse, pSubParse); - if( db->mallocFailed==0 && pParse->nErr==0 ){ + if( pParse->nErr==0 ){ + assert( db->mallocFailed==0 ); pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg); } - pProgram->nMem = pSubParse->nMem; - pProgram->nCsr = pSubParse->nTab; + pProgram->nMem = sSubParse.nMem; + pProgram->nCsr = sSubParse.nTab; pProgram->token = (void *)pTrigger; - pPrg->aColmask[0] = pSubParse->oldmask; - pPrg->aColmask[1] = pSubParse->newmask; + pPrg->aColmask[0] = sSubParse.oldmask; + pPrg->aColmask[1] = sSubParse.newmask; sqlite3VdbeDelete(v); + }else{ + transferParseError(pParse, &sSubParse); } - assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg ); - sqlite3ParserReset(pSubParse); - sqlite3StackFree(db, pSubParse); - + assert( !sSubParse.pTriggerPrg && !sSubParse.nMaxArg ); + sqlite3ParseObjectReset(&sSubParse); return pPrg; } @@ -140904,6 +143267,7 @@ static TriggerPrg *getRowTrigger( /* If an existing TriggerPrg could not be located, create a new one. */ if( !pPrg ){ pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf); + pParse->db->errByteOffset = -1; } return pPrg; @@ -140926,7 +143290,7 @@ SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */ TriggerPrg *pPrg; pPrg = getRowTrigger(pParse, p, pTab, orconf); - assert( pPrg || pParse->nErr || pParse->db->mallocFailed ); + assert( pPrg || pParse->nErr ); /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program ** is a pointer to the sub-vdbe containing the trigger program. */ @@ -141157,13 +143521,14 @@ static void updateVirtualTable( */ SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){ assert( pTab!=0 ); - if( !pTab->pSelect ){ + if( !IsView(pTab) ){ sqlite3_value *pValue = 0; u8 enc = ENC(sqlite3VdbeDb(v)); Column *pCol = &pTab->aCol[i]; - VdbeComment((v, "%s.%s", pTab->zName, pCol->zName)); + VdbeComment((v, "%s.%s", pTab->zName, pCol->zCnName)); assert( inCol ); - sqlite3ValueFromExpr(sqlite3VdbeDb(v), pCol->pDflt, enc, + sqlite3ValueFromExpr(sqlite3VdbeDb(v), + sqlite3ColumnExpr(pTab,pCol), enc, pCol->affinity, &pValue); if( pValue ){ sqlite3VdbeAppendP4(v, pValue, P4_MEM); @@ -141333,7 +143698,7 @@ static void updateFromSelect( pList = sqlite3ExprListAppend(pParse, pList, pNew); } eDest = IsVirtual(pTab) ? SRT_Table : SRT_Upfrom; - }else if( pTab->pSelect ){ + }else if( IsView(pTab) ){ for(i=0; inCol; i++){ pList = sqlite3ExprListAppend(pParse, pList, exprRowColumn(pParse, i)); } @@ -141356,8 +143721,9 @@ static void updateFromSelect( } } pSelect = sqlite3SelectNew(pParse, pList, - pSrc, pWhere2, pGrp, 0, pOrderBy2, SF_UpdateFrom|SF_IncludeHidden, pLimit2 + pSrc, pWhere2, pGrp, 0, pOrderBy2, SF_UFSrcCheck|SF_IncludeHidden, pLimit2 ); + if( pSelect ) pSelect->selFlags |= SF_OrderByReqd; sqlite3SelectDestInit(&dest, eDest, iEph); dest.iSDParm2 = (pPk ? pPk->nKeyCol : -1); sqlite3Select(pParse, pSelect, &dest); @@ -141442,9 +143808,11 @@ SQLITE_PRIVATE void sqlite3Update( memset(&sContext, 0, sizeof(sContext)); db = pParse->db; - if( pParse->nErr || db->mallocFailed ){ + assert( db->pParse==pParse ); + if( pParse->nErr ){ goto update_cleanup; } + assert( db->mallocFailed==0 ); /* Locate the table which we want to update. */ @@ -141457,7 +143825,7 @@ SQLITE_PRIVATE void sqlite3Update( */ #ifndef SQLITE_OMIT_TRIGGER pTrigger = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask); - isView = pTab->pSelect!=0; + isView = IsView(pTab); assert( pTrigger || tmask==0 ); #else # define pTrigger 0 @@ -141546,13 +143914,16 @@ SQLITE_PRIVATE void sqlite3Update( */ chngRowid = chngPk = 0; for(i=0; inExpr; i++){ + u8 hCol = sqlite3StrIHash(pChanges->a[i].zEName); /* If this is an UPDATE with a FROM clause, do not resolve expressions ** here. The call to sqlite3Select() below will do that. */ if( nChangeFrom==0 && sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ goto update_cleanup; } for(j=0; jnCol; j++){ - if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zEName)==0 ){ + if( pTab->aCol[j].hName==hCol + && sqlite3StrICmp(pTab->aCol[j].zCnName, pChanges->a[i].zEName)==0 + ){ if( j==pTab->iPKey ){ chngRowid = 1; pRowidExpr = pChanges->a[i].pExpr; @@ -141566,7 +143937,7 @@ SQLITE_PRIVATE void sqlite3Update( testcase( pTab->aCol[j].colFlags & COLFLAG_STORED ); sqlite3ErrorMsg(pParse, "cannot UPDATE generated column \"%s\"", - pTab->aCol[j].zName); + pTab->aCol[j].zCnName); goto update_cleanup; } #endif @@ -141590,7 +143961,7 @@ SQLITE_PRIVATE void sqlite3Update( { int rc; rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName, - j<0 ? "ROWID" : pTab->aCol[j].zName, + j<0 ? "ROWID" : pTab->aCol[j].zCnName, db->aDb[iDb].zDbSName); if( rc==SQLITE_DENY ){ goto update_cleanup; @@ -141622,8 +143993,10 @@ SQLITE_PRIVATE void sqlite3Update( for(i=0; inCol; i++){ if( aXRef[i]>=0 ) continue; if( (pTab->aCol[i].colFlags & COLFLAG_GENERATED)==0 ) continue; - if( sqlite3ExprReferencesUpdatedColumn(pTab->aCol[i].pDflt, - aXRef, chngRowid) ){ + if( sqlite3ExprReferencesUpdatedColumn( + sqlite3ColumnExpr(pTab, &pTab->aCol[i]), + aXRef, chngRowid) + ){ aXRef[i] = 99999; bProgress = 1; } @@ -141811,7 +144184,7 @@ SQLITE_PRIVATE void sqlite3Update( if( !pParse->nested && !pTrigger && !hasFK && !chngKey && !bReplace ){ flags |= WHERE_ONEPASS_MULTIROW; } - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, flags,iIdxCur); + pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere,0,0,0,flags,iIdxCur); if( pWInfo==0 ) goto update_cleanup; /* A one-pass strategy that might update more than one row may not @@ -142211,9 +144584,7 @@ SQLITE_PRIVATE void sqlite3Update( ** that information. */ if( regRowCount ){ - sqlite3VdbeAddOp2(v, OP_ChngCntRow, regRowCount, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC); + sqlite3CodeChangeCount(v, regRowCount, "rows updated"); } update_cleanup: @@ -142335,7 +144706,9 @@ static void updateVirtualTable( regRowid = ++pParse->nMem; /* Start scanning the virtual table */ - pWInfo = sqlite3WhereBegin(pParse, pSrc,pWhere,0,0,WHERE_ONEPASS_DESIRED,0); + pWInfo = sqlite3WhereBegin( + pParse, pSrc, pWhere, 0, 0, 0, WHERE_ONEPASS_DESIRED, 0 + ); if( pWInfo==0 ) return; /* Populate the argument registers. */ @@ -142715,7 +145088,7 @@ SQLITE_PRIVATE void sqlite3UpsertDoUpdate( k = sqlite3TableColumnToIndex(pIdx, pPk->aiColumn[i]); sqlite3VdbeAddOp3(v, OP_Column, iCur, k, iPk+i); VdbeComment((v, "%s.%s", pIdx->zName, - pTab->aCol[pPk->aiColumn[i]].zName)); + pTab->aCol[pPk->aiColumn[i]].zCnName)); } sqlite3VdbeVerifyAbortable(v, OE_Abort); i = sqlite3VdbeAddOp4Int(v, OP_Found, iDataCur, 0, iPk, nPk); @@ -142897,8 +145270,8 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( Btree *pTemp; /* The temporary database we vacuum into */ u32 saved_mDbFlags; /* Saved value of db->mDbFlags */ u64 saved_flags; /* Saved value of db->flags */ - int saved_nChange; /* Saved value of db->nChange */ - int saved_nTotalChange; /* Saved value of db->nTotalChange */ + i64 saved_nChange; /* Saved value of db->nChange */ + i64 saved_nTotalChange; /* Saved value of db->nTotalChange */ u32 saved_openFlags; /* Saved value of db->openFlags */ u8 saved_mTrace; /* Saved trace settings */ Db *pDb = 0; /* Database to detach at end of vacuum */ @@ -142996,7 +145369,9 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3RunVacuum( /* Do not attempt to change the page size for a WAL database */ if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain)) - ==PAGER_JOURNALMODE_WAL ){ + ==PAGER_JOURNALMODE_WAL + && pOut==0 + ){ db->nextPagesize = 0; } @@ -143345,7 +145720,7 @@ SQLITE_PRIVATE void sqlite3VtabLock(VTable *pVTab){ SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){ VTable *pVtab; assert( IsVirtual(pTab) ); - for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext); + for(pVtab=pTab->u.vtab.p; pVtab && pVtab->db!=db; pVtab=pVtab->pNext); return pVtab; } @@ -143358,7 +145733,8 @@ SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){ assert( db ); assert( pVTab->nRef>0 ); - assert( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ZOMBIE ); + assert( db->eOpenState==SQLITE_STATE_OPEN + || db->eOpenState==SQLITE_STATE_ZOMBIE ); pVTab->nRef--; if( pVTab->nRef==0 ){ @@ -143373,21 +145749,24 @@ SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){ /* ** Table p is a virtual table. This function moves all elements in the -** p->pVTable list to the sqlite3.pDisconnect lists of their associated +** p->u.vtab.p list to the sqlite3.pDisconnect lists of their associated ** database connections to be disconnected at the next opportunity. ** Except, if argument db is not NULL, then the entry associated with -** connection db is left in the p->pVTable list. +** connection db is left in the p->u.vtab.p list. */ static VTable *vtabDisconnectAll(sqlite3 *db, Table *p){ VTable *pRet = 0; - VTable *pVTable = p->pVTable; - p->pVTable = 0; + VTable *pVTable; + + assert( IsVirtual(p) ); + pVTable = p->u.vtab.p; + p->u.vtab.p = 0; /* Assert that the mutex (if any) associated with the BtShared database ** that contains table p is held by the caller. See header comments ** above function sqlite3VtabUnlockList() for an explanation of why ** this makes it safe to access the sqlite3.pDisconnect list of any - ** database connection that may have an entry in the p->pVTable list. + ** database connection that may have an entry in the p->u.vtab.p list. */ assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) ); @@ -143397,7 +145776,7 @@ static VTable *vtabDisconnectAll(sqlite3 *db, Table *p){ assert( db2 ); if( db2==db ){ pRet = pVTable; - p->pVTable = pRet; + p->u.vtab.p = pRet; pRet->pNext = 0; }else{ pVTable->pNext = db2->pDisconnect; @@ -143425,7 +145804,7 @@ SQLITE_PRIVATE void sqlite3VtabDisconnect(sqlite3 *db, Table *p){ assert( sqlite3BtreeHoldsAllMutexes(db) ); assert( sqlite3_mutex_held(db->mutex) ); - for(ppVTab=&p->pVTable; *ppVTab; ppVTab=&(*ppVTab)->pNext){ + for(ppVTab=&p->u.vtab.p; *ppVTab; ppVTab=&(*ppVTab)->pNext){ if( (*ppVTab)->db==db ){ VTable *pVTab = *ppVTab; *ppVTab = pVTab->pNext; @@ -143488,37 +145867,41 @@ SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3 *db){ ** database connection. */ SQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table *p){ + assert( IsVirtual(p) ); if( !db || db->pnBytesFreed==0 ) vtabDisconnectAll(0, p); - if( p->azModuleArg ){ + if( p->u.vtab.azArg ){ int i; - for(i=0; inModuleArg; i++){ - if( i!=1 ) sqlite3DbFree(db, p->azModuleArg[i]); + for(i=0; iu.vtab.nArg; i++){ + if( i!=1 ) sqlite3DbFree(db, p->u.vtab.azArg[i]); } - sqlite3DbFree(db, p->azModuleArg); + sqlite3DbFree(db, p->u.vtab.azArg); } } /* -** Add a new module argument to pTable->azModuleArg[]. +** Add a new module argument to pTable->u.vtab.azArg[]. ** The string is not copied - the pointer is stored. The ** string will be freed automatically when the table is ** deleted. */ static void addModuleArgument(Parse *pParse, Table *pTable, char *zArg){ - sqlite3_int64 nBytes = sizeof(char *)*(2+pTable->nModuleArg); + sqlite3_int64 nBytes; char **azModuleArg; sqlite3 *db = pParse->db; - if( pTable->nModuleArg+3>=db->aLimit[SQLITE_LIMIT_COLUMN] ){ + + assert( IsVirtual(pTable) ); + nBytes = sizeof(char *)*(2+pTable->u.vtab.nArg); + if( pTable->u.vtab.nArg+3>=db->aLimit[SQLITE_LIMIT_COLUMN] ){ sqlite3ErrorMsg(pParse, "too many columns on %s", pTable->zName); } - azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes); + azModuleArg = sqlite3DbRealloc(db, pTable->u.vtab.azArg, nBytes); if( azModuleArg==0 ){ sqlite3DbFree(db, zArg); }else{ - int i = pTable->nModuleArg++; + int i = pTable->u.vtab.nArg++; azModuleArg[i] = zArg; azModuleArg[i+1] = 0; - pTable->azModuleArg = azModuleArg; + pTable->u.vtab.azArg = azModuleArg; } } @@ -143541,10 +145924,11 @@ SQLITE_PRIVATE void sqlite3VtabBeginParse( pTable = pParse->pNewTable; if( pTable==0 ) return; assert( 0==pTable->pIndex ); + pTable->eTabType = TABTYP_VTAB; db = pParse->db; - assert( pTable->nModuleArg==0 ); + assert( pTable->u.vtab.nArg==0 ); addModuleArgument(pParse, pTable, sqlite3NameFromToken(db, pModuleName)); addModuleArgument(pParse, pTable, 0); addModuleArgument(pParse, pTable, sqlite3DbStrDup(db, pTable->zName)); @@ -143561,11 +145945,11 @@ SQLITE_PRIVATE void sqlite3VtabBeginParse( ** sqlite_schema table, has already been made by sqlite3StartTable(). ** The second call, to obtain permission to create the table, is made now. */ - if( pTable->azModuleArg ){ + if( pTable->u.vtab.azArg ){ int iDb = sqlite3SchemaToIndex(db, pTable->pSchema); assert( iDb>=0 ); /* The database the table is being created in */ sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, - pTable->azModuleArg[0], pParse->db->aDb[iDb].zDbSName); + pTable->u.vtab.azArg[0], pParse->db->aDb[iDb].zDbSName); } #endif } @@ -143593,9 +145977,10 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ sqlite3 *db = pParse->db; /* The database connection */ if( pTab==0 ) return; + assert( IsVirtual(pTab) ); addArgumentToVtab(pParse); pParse->sArg.z = 0; - if( pTab->nModuleArg<1 ) return; + if( pTab->u.vtab.nArg<1 ) return; /* If the CREATE VIRTUAL TABLE statement is being entered for the ** first time (in other words if the virtual table is actually being @@ -143628,7 +146013,7 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ */ iDb = sqlite3SchemaToIndex(db, pTab->pSchema); sqlite3NestedParse(pParse, - "UPDATE %Q." DFLT_SCHEMA_TABLE " " + "UPDATE %Q." LEGACY_SCHEMA_TABLE " " "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q " "WHERE rowid=#%d", db->aDb[iDb].zDbSName, @@ -143648,18 +146033,14 @@ SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ iReg = ++pParse->nMem; sqlite3VdbeLoadString(v, iReg, pTab->zName); sqlite3VdbeAddOp2(v, OP_VCreate, iDb, iReg); - } - - /* If we are rereading the sqlite_schema table create the in-memory - ** record of the table. The xConnect() method is not called until - ** the first time the virtual table is used in an SQL statement. This - ** allows a schema that contains virtual tables to be loaded before - ** the required virtual table implementations are registered. */ - else { + }else{ + /* If we are rereading the sqlite_schema table create the in-memory + ** record of the table. */ Table *pOld; Schema *pSchema = pTab->pSchema; const char *zName = pTab->zName; - assert( sqlite3SchemaMutexHeld(db, 0, pSchema) ); + assert( zName!=0 ); + sqlite3MarkAllShadowTablesOf(db, pTab); pOld = sqlite3HashInsert(&pSchema->tblHash, zName, pTab); if( pOld ){ sqlite3OomFault(db); @@ -143710,13 +146091,16 @@ static int vtabCallConstructor( VtabCtx sCtx; VTable *pVTable; int rc; - const char *const*azArg = (const char *const*)pTab->azModuleArg; - int nArg = pTab->nModuleArg; + const char *const*azArg; + int nArg = pTab->u.vtab.nArg; char *zErr = 0; char *zModuleName; int iDb; VtabCtx *pCtx; + assert( IsVirtual(pTab) ); + azArg = (const char *const*)pTab->u.vtab.azArg; + /* Check that the virtual-table is not already being initialized */ for(pCtx=db->pVtabCtx; pCtx; pCtx=pCtx->pPrior){ if( pCtx->pTab==pTab ){ @@ -143743,7 +146127,7 @@ static int vtabCallConstructor( pVTable->eVtabRisk = SQLITE_VTABRISK_Normal; iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - pTab->azModuleArg[1] = db->aDb[iDb].zDbSName; + pTab->u.vtab.azArg[1] = db->aDb[iDb].zDbSName; /* Invoke the virtual table constructor */ assert( &db->pVtabCtx ); @@ -143782,12 +146166,12 @@ static int vtabCallConstructor( int iCol; u16 oooHidden = 0; /* If everything went according to plan, link the new VTable structure - ** into the linked list headed by pTab->pVTable. Then loop through the + ** into the linked list headed by pTab->u.vtab.p. Then loop through the ** columns of the table to see if any of them contain the token "hidden". ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from ** the type string. */ - pVTable->pNext = pTab->pVTable; - pTab->pVTable = pVTable; + pVTable->pNext = pTab->u.vtab.p; + pTab->u.vtab.p = pVTable; for(iCol=0; iColnCol; iCol++){ char *zType = sqlite3ColumnType(&pTab->aCol[iCol], ""); @@ -143840,16 +146224,17 @@ SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){ int rc; assert( pTab ); - if( !IsVirtual(pTab) || sqlite3GetVTable(db, pTab) ){ + assert( IsVirtual(pTab) ); + if( sqlite3GetVTable(db, pTab) ){ return SQLITE_OK; } /* Locate the required virtual table module */ - zMod = pTab->azModuleArg[0]; + zMod = pTab->u.vtab.azArg[0]; pMod = (Module*)sqlite3HashFind(&db->aModule, zMod); if( !pMod ){ - const char *zModule = pTab->azModuleArg[0]; + const char *zModule = pTab->u.vtab.azArg[0]; sqlite3ErrorMsg(pParse, "no such module: %s", zModule); rc = SQLITE_ERROR; }else{ @@ -143912,10 +146297,10 @@ SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, const char *zMod; pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName); - assert( pTab && IsVirtual(pTab) && !pTab->pVTable ); + assert( pTab && IsVirtual(pTab) && !pTab->u.vtab.p ); /* Locate the required virtual table module */ - zMod = pTab->azModuleArg[0]; + zMod = pTab->u.vtab.azArg[0]; pMod = (Module*)sqlite3HashFind(&db->aModule, zMod); /* If the module has been registered and includes a Create method, @@ -143950,8 +146335,8 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ VtabCtx *pCtx; int rc = SQLITE_OK; Table *pTab; - char *zErr = 0; Parse sParse; + int initBusy; #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){ @@ -143968,20 +146353,27 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ pTab = pCtx->pTab; assert( IsVirtual(pTab) ); - memset(&sParse, 0, sizeof(sParse)); + sqlite3ParseObjectInit(&sParse, db); sParse.eParseMode = PARSE_MODE_DECLARE_VTAB; - sParse.db = db; + sParse.disableTriggers = 1; + /* We should never be able to reach this point while loading the + ** schema. Nevertheless, defend against that (turn off db->init.busy) + ** in case a bug arises. */ + assert( db->init.busy==0 ); + initBusy = db->init.busy; + db->init.busy = 0; sParse.nQueryLoop = 1; - if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr) - && sParse.pNewTable - && !db->mallocFailed - && !sParse.pNewTable->pSelect - && !IsVirtual(sParse.pNewTable) + if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable) + && ALWAYS(sParse.pNewTable!=0) + && ALWAYS(!db->mallocFailed) + && IsOrdinaryTable(sParse.pNewTable) ){ + assert( sParse.zErrMsg==0 ); if( !pTab->aCol ){ Table *pNew = sParse.pNewTable; Index *pIdx; pTab->aCol = pNew->aCol; + sqlite3ExprListDelete(db, pNew->u.tab.pDfltList); pTab->nNVCol = pTab->nCol = pNew->nCol; pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid); pNew->nCol = 0; @@ -144006,8 +146398,9 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ } pCtx->bDeclared = 1; }else{ - sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); - sqlite3DbFree(db, zErr); + sqlite3ErrorWithMsg(db, SQLITE_ERROR, + (sParse.zErrMsg ? "%s" : 0), sParse.zErrMsg); + sqlite3DbFree(db, sParse.zErrMsg); rc = SQLITE_ERROR; } sParse.eParseMode = PARSE_MODE_NORMAL; @@ -144016,7 +146409,8 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ sqlite3VdbeFinalize(sParse.pVdbe); } sqlite3DeleteTable(db, sParse.pNewTable); - sqlite3ParserReset(&sParse); + sqlite3ParseObjectReset(&sParse); + db->init.busy = initBusy; assert( (rc&0xff)==rc ); rc = sqlite3ApiExit(db, rc); @@ -144036,10 +146430,13 @@ SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab Table *pTab; pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zDbSName); - if( pTab!=0 && ALWAYS(pTab->pVTable!=0) ){ + if( ALWAYS(pTab!=0) + && ALWAYS(IsVirtual(pTab)) + && ALWAYS(pTab->u.vtab.p!=0) + ){ VTable *p; int (*xDestroy)(sqlite3_vtab *); - for(p=pTab->pVTable; p; p=p->pNext){ + for(p=pTab->u.vtab.p; p; p=p->pNext){ assert( p->pVtab ); if( p->pVtab->nRef>0 ){ return SQLITE_LOCKED; @@ -144053,9 +146450,9 @@ SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab rc = xDestroy(p->pVtab); /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */ if( rc==SQLITE_OK ){ - assert( pTab->pVTable==p && p->pNext==0 ); + assert( pTab->u.vtab.p==p && p->pNext==0 ); p->pVtab = 0; - pTab->pVTable = 0; + pTab->u.vtab.p = 0; sqlite3VtabUnlock(p); } sqlite3DeleteTable(db, pTab); @@ -144269,6 +146666,7 @@ SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction( /* Check to see the left operand is a column in a virtual table */ if( NEVER(pExpr==0) ) return pDef; if( pExpr->op!=TK_COLUMN ) return pDef; + assert( ExprUseYTab(pExpr) ); pTab = pExpr->y.pTab; if( pTab==0 ) return pDef; if( !IsVirtual(pTab) ) return pDef; @@ -144343,8 +146741,9 @@ SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ /* ** Check to see if virtual table module pMod can be have an eponymous ** virtual table instance. If it can, create one if one does not already -** exist. Return non-zero if the eponymous virtual table instance exists -** when this routine returns, and return zero if it does not exist. +** exist. Return non-zero if either the eponymous virtual table instance +** exists when this routine returns or if an attempt to create it failed +** and an error message was left in pParse. ** ** An eponymous virtual table instance is one that is named after its ** module, and more importantly, does not require a CREATE VIRTUAL TABLE @@ -144371,8 +146770,9 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ } pMod->pEpoTab = pTab; pTab->nTabRef = 1; + pTab->eTabType = TABTYP_VTAB; pTab->pSchema = db->aDb[0].pSchema; - assert( pTab->nModuleArg==0 ); + assert( pTab->u.vtab.nArg==0 ); pTab->iPKey = -1; pTab->tabFlags |= TF_Eponymous; addModuleArgument(pParse, pTab, sqlite3DbStrDup(db, pTab->zName)); @@ -144383,7 +146783,6 @@ SQLITE_PRIVATE int sqlite3VtabEponymousTableInit(Parse *pParse, Module *pMod){ sqlite3ErrorMsg(pParse, "%s", zErr); sqlite3DbFree(db, zErr); sqlite3VtabEponymousTableClear(db, pMod); - return 0; } return 1; } @@ -144562,6 +146961,7 @@ struct WhereLevel { u32 iLikeRepCntr; /* LIKE range processing counter register (times 2) */ int addrLikeRep; /* LIKE range processing address */ #endif + int regFilter; /* Bloom filter */ u8 iFrom; /* Which entry in the FROM clause */ u8 op, p3, p5; /* Opcode, P3 & P5 of the opcode that ends the loop */ int p1, p2; /* Operands of the opcode used to end the loop */ @@ -144576,7 +146976,7 @@ struct WhereLevel { u8 eEndLoopOp; /* IN Loop terminator. OP_Next or OP_Prev */ } *aInLoop; /* Information about each nested IN operator */ } in; /* Used when pWLoop->wsFlags&WHERE_IN_ABLE */ - Index *pCovidx; /* Possible covering index for WHERE_MULTI_OR */ + Index *pCoveringIdx; /* Possible covering index for WHERE_MULTI_OR */ } u; struct WhereLoop *pWLoop; /* The selected WhereLoop object */ Bitmask notReady; /* FROM entries not usable at this level */ @@ -144620,10 +147020,12 @@ struct WhereLoop { } btree; struct { /* Information for virtual tables */ int idxNum; /* Index number */ - u8 needFree; /* True if sqlite3_free(idxStr) is needed */ + u32 needFree : 1; /* True if sqlite3_free(idxStr) is needed */ + u32 bOmitOffset : 1; /* True to let virtual table handle offset */ i8 isOrdered; /* True if satisfies ORDER BY */ u16 omitMask; /* Terms that may be omitted */ char *idxStr; /* Index identifier string */ + u32 mHandleIn; /* Terms to handle as IN(...) instead of == */ } vtab; } u; u32 wsFlags; /* WHERE_* flags describing the plan */ @@ -144767,7 +147169,7 @@ struct WhereTerm { #define TERM_COPIED 0x0008 /* Has a child */ #define TERM_ORINFO 0x0010 /* Need to free the WhereTerm.u.pOrInfo object */ #define TERM_ANDINFO 0x0020 /* Need to free the WhereTerm.u.pAndInfo obj */ -#define TERM_OR_OK 0x0040 /* Used during OR-clause processing */ +#define TERM_OK 0x0040 /* Used during OR-clause processing */ #define TERM_VNULL 0x0080 /* Manufactured x>NULL or x<=NULL term */ #define TERM_LIKEOPT 0x0100 /* Virtual terms from the LIKE optimization */ #define TERM_LIKECOND 0x0200 /* Conditionally this LIKE operator term */ @@ -144780,6 +147182,7 @@ struct WhereTerm { #else # define TERM_HIGHTRUTH 0 /* Only used with STAT4 */ #endif +#define TERM_SLICE 0x8000 /* One slice of a row-value/vector comparison */ /* ** An instance of the WhereScan object is used as an iterator for locating @@ -144790,11 +147193,11 @@ struct WhereScan { WhereClause *pWC; /* WhereClause currently being scanned */ const char *zCollName; /* Required collating sequence, if not NULL */ Expr *pIdxExpr; /* Search for this index expression */ + int k; /* Resume scanning at this->pWC->a[this->k] */ + u32 opMask; /* Acceptable operators */ char idxaff; /* Must match this affinity, if zCollName!=NULL */ + unsigned char iEquiv; /* Current slot in aiCur[] and aiColumn[] */ unsigned char nEquiv; /* Number of entries in aiCur[] and aiColumn[] */ - unsigned char iEquiv; /* Next unused slot in aiCur[] and aiColumn[] */ - u32 opMask; /* Acceptable operators */ - int k; /* Resume scanning at this->pWC->a[this->k] */ int aiCur[11]; /* Cursors in the equivalence class */ i16 aiColumn[11]; /* Corresponding column number in the eq-class */ }; @@ -144818,6 +147221,7 @@ struct WhereClause { u8 hasOr; /* True if any a[].eOperator is WO_OR */ int nTerm; /* Number of terms */ int nSlot; /* Number of entries in a[] */ + int nBase; /* Number of terms through the last non-Virtual */ WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */ #if defined(SQLITE_SMALL_STACK) WhereTerm aStatic[1]; /* Initial static space for a[] */ @@ -144875,11 +147279,6 @@ struct WhereMaskSet { int ix[BMS]; /* Cursor assigned to each bit */ }; -/* -** Initialize a WhereMaskSet object -*/ -#define initMaskSet(P) (P)->n=0 - /* ** This object is a convenience wrapper holding all information needed ** to construct WhereLoop objects for a particular query. @@ -144887,7 +147286,6 @@ struct WhereMaskSet { struct WhereLoopBuilder { WhereInfo *pWInfo; /* Information about this WHERE */ WhereClause *pWC; /* WHERE clause terms */ - ExprList *pOrderBy; /* ORDER BY clause */ WhereLoop *pNew; /* Template WhereLoop */ WhereOrSet *pOrSet; /* Record best loops here, if not NULL */ #ifdef SQLITE_ENABLE_STAT4 @@ -144955,6 +147353,9 @@ struct WhereInfo { ExprList *pOrderBy; /* The ORDER BY clause or NULL */ ExprList *pResultSet; /* Result set of the query */ Expr *pWhere; /* The complete WHERE clause */ +#ifndef SQLITE_OMIT_VIRTUALTABLE + Select *pLimit; /* Used to access LIMIT expr/registers for vtabs */ +#endif int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */ int iContinue; /* Jump here to continue with next record */ int iBreak; /* Jump here to break out of the loop */ @@ -145008,8 +147409,14 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ ); +SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter( + const Parse *pParse, /* Parse context */ + const WhereInfo *pWInfo, /* WHERE clause */ + const WhereLevel *pLevel /* Bloom filter on this level */ +); #else # define sqlite3WhereExplainOneScan(u,v,w,x) 0 +# define sqlite3WhereExplainBloomFilter(u,v,w) 0 #endif /* SQLITE_OMIT_EXPLAIN */ #ifdef SQLITE_ENABLE_STMT_SCANSTATUS SQLITE_PRIVATE void sqlite3WhereAddScanStatus( @@ -145034,6 +147441,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( SQLITE_PRIVATE void sqlite3WhereClauseInit(WhereClause*,WhereInfo*); SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause*); SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause*,Expr*,u8); +SQLITE_PRIVATE void sqlite3WhereAddLimit(WhereClause*, Select*); SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet*, Expr*); SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet*, Expr*); SQLITE_PRIVATE Bitmask sqlite3WhereExprListUsage(WhereMaskSet*, ExprList*); @@ -145102,6 +147510,9 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, SrcItem*, WhereClause*); #define WHERE_BIGNULL_SORT 0x00080000 /* Column nEq of index is BIGNULL */ #define WHERE_IN_SEEKSCAN 0x00100000 /* Seek-scan optimization for IN */ #define WHERE_TRANSCONS 0x00200000 /* Uses a transitive constraint */ +#define WHERE_BLOOMFILTER 0x00400000 /* Consider using a Bloom-filter */ +#define WHERE_SELFCULL 0x00800000 /* nOut reduced by extra WHERE terms */ +#define WHERE_OMIT_OFFSET 0x01000000 /* Set offset counter to zero */ #endif /* !defined(SQLITE_WHEREINT_H) */ @@ -145117,7 +147528,7 @@ static const char *explainIndexColumnName(Index *pIdx, int i){ i = pIdx->aiColumn[i]; if( i==XN_EXPR ) return ""; if( i==XN_ROWID ) return "rowid"; - return pIdx->pTable->aCol[i].zName; + return pIdx->pTable->aCol[i].zCnName; } /* @@ -145264,19 +147675,27 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( explainIndexRange(&str, pLoop); } }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){ - const char *zRangeOp; + char cRangeOp; +#if 0 /* Better output, but breaks many tests */ + const Table *pTab = pItem->pTab; + const char *zRowid = pTab->iPKey>=0 ? pTab->aCol[pTab->iPKey].zCnName: + "rowid"; +#else + const char *zRowid = "rowid"; +#endif + sqlite3_str_appendf(&str, " USING INTEGER PRIMARY KEY (%s", zRowid); if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){ - zRangeOp = "="; + cRangeOp = '='; }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){ - zRangeOp = ">? AND rowid<"; + sqlite3_str_appendf(&str, ">? AND %s", zRowid); + cRangeOp = '<'; }else if( flags&WHERE_BTM_LIMIT ){ - zRangeOp = ">"; + cRangeOp = '>'; }else{ assert( flags&WHERE_TOP_LIMIT); - zRangeOp = "<"; + cRangeOp = '<'; } - sqlite3_str_appendf(&str, - " USING INTEGER PRIMARY KEY (rowid%s?)",zRangeOp); + sqlite3_str_appendf(&str, "%c?)", cRangeOp); } #ifndef SQLITE_OMIT_VIRTUALTABLE else if( (flags & WHERE_VIRTUALTABLE)!=0 ){ @@ -145299,6 +147718,56 @@ SQLITE_PRIVATE int sqlite3WhereExplainOneScan( } return ret; } + +/* +** Add a single OP_Explain opcode that describes a Bloom filter. +** +** Or if not processing EXPLAIN QUERY PLAN and not in a SQLITE_DEBUG and/or +** SQLITE_ENABLE_STMT_SCANSTATUS build, then OP_Explain opcodes are not +** required and this routine is a no-op. +** +** If an OP_Explain opcode is added to the VM, its address is returned. +** Otherwise, if no OP_Explain is coded, zero is returned. +*/ +SQLITE_PRIVATE int sqlite3WhereExplainBloomFilter( + const Parse *pParse, /* Parse context */ + const WhereInfo *pWInfo, /* WHERE clause */ + const WhereLevel *pLevel /* Bloom filter on this level */ +){ + int ret = 0; + SrcItem *pItem = &pWInfo->pTabList->a[pLevel->iFrom]; + Vdbe *v = pParse->pVdbe; /* VM being constructed */ + sqlite3 *db = pParse->db; /* Database handle */ + char *zMsg; /* Text to add to EQP output */ + int i; /* Loop counter */ + WhereLoop *pLoop; /* The where loop */ + StrAccum str; /* EQP output string */ + char zBuf[100]; /* Initial space for EQP output string */ + + sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH); + str.printfFlags = SQLITE_PRINTF_INTERNAL; + sqlite3_str_appendf(&str, "BLOOM FILTER ON %S (", pItem); + pLoop = pLevel->pWLoop; + if( pLoop->wsFlags & WHERE_IPK ){ + const Table *pTab = pItem->pTab; + if( pTab->iPKey>=0 ){ + sqlite3_str_appendf(&str, "%s=?", pTab->aCol[pTab->iPKey].zCnName); + }else{ + sqlite3_str_appendf(&str, "rowid=?"); + } + }else{ + for(i=pLoop->nSkip; iu.btree.nEq; i++){ + const char *z = explainIndexColumnName(pLoop->u.btree.pIndex, i); + if( i>pLoop->nSkip ) sqlite3_str_append(&str, " AND ", 5); + sqlite3_str_appendf(&str, "%s=?", z); + } + } + sqlite3_str_append(&str, ")", 1); + zMsg = sqlite3StrAccumFinish(&str); + ret = sqlite3VdbeAddOp4(v, OP_Explain, sqlite3VdbeCurrentAddr(v), + pParse->addrExplain, 0, zMsg,P4_DYNAMIC); + return ret; +} #endif /* SQLITE_OMIT_EXPLAIN */ #ifdef SQLITE_ENABLE_STMT_SCANSTATUS @@ -145504,16 +147973,23 @@ static Expr *removeUnindexableInClauseTerms( Expr *pNew; pNew = sqlite3ExprDup(db, pX, 0); if( db->mallocFailed==0 ){ - ExprList *pOrigRhs = pNew->x.pSelect->pEList; /* Original unmodified RHS */ - ExprList *pOrigLhs = pNew->pLeft->x.pList; /* Original unmodified LHS */ + ExprList *pOrigRhs; /* Original unmodified RHS */ + ExprList *pOrigLhs; /* Original unmodified LHS */ ExprList *pRhs = 0; /* New RHS after modifications */ ExprList *pLhs = 0; /* New LHS after mods */ int i; /* Loop counter */ Select *pSelect; /* Pointer to the SELECT on the RHS */ + assert( ExprUseXSelect(pNew) ); + pOrigRhs = pNew->x.pSelect->pEList; + assert( pNew->pLeft!=0 ); + assert( ExprUseXList(pNew->pLeft) ); + pOrigLhs = pNew->pLeft->x.pList; for(i=iEq; inLTerm; i++){ if( pLoop->aLTerm[i]->pExpr==pX ){ - int iField = pLoop->aLTerm[i]->u.x.iField - 1; + int iField; + assert( (pLoop->aLTerm[i]->eOperator & (WO_OR|WO_AND))==0 ); + iField = pLoop->aLTerm[i]->u.x.iField - 1; if( pOrigRhs->a[iField].pExpr==0 ) continue; /* Duplicate PK column */ pRhs = sqlite3ExprListAppend(pParse, pRhs, pOrigRhs->a[iField].pExpr); pOrigRhs->a[iField].pExpr = 0; @@ -145628,7 +148104,7 @@ static int codeEqualityTerm( } iTab = 0; - if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ + if( !ExprUseXSelect(pX) || pX->x.pSelect->pEList->nExpr==1 ){ eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0, &iTab); }else{ sqlite3 *db = pParse->db; @@ -145650,8 +148126,8 @@ static int codeEqualityTerm( sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); VdbeCoverageIf(v, bRev); VdbeCoverageIf(v, !bRev); - assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); + assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); pLoop->wsFlags |= WHERE_IN_ABLE; if( pLevel->u.in.nIn==0 ){ pLevel->addrNxt = sqlite3VdbeMakeLabel(pParse); @@ -145815,6 +148291,7 @@ static int codeAllEqualityTerms( VdbeCoverageIf(v, bRev!=0); VdbeComment((v, "begin skip-scan on %s", pIdx->zName)); j = sqlite3VdbeAddOp0(v, OP_Goto); + assert( pLevel->addrSkip==0 ); pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT), iIdxCur, 0, regBase, nSkip); VdbeCoverageIf(v, bRev==0); @@ -145847,6 +148324,9 @@ static int codeAllEqualityTerms( sqlite3VdbeAddOp2(v, OP_Copy, r1, regBase+j); } } + } + for(j=nSkip; jaLTerm[j]; if( pTerm->eOperator & WO_IN ){ if( pTerm->pExpr->flags & EP_xIsSelect ){ /* No affinity ever needs to be (or should be) applied to a value @@ -145861,7 +148341,8 @@ static int codeAllEqualityTerms( sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk); VdbeCoverage(v); } - if( pParse->db->mallocFailed==0 && pParse->nErr==0 ){ + if( pParse->nErr==0 ){ + assert( pParse->db->mallocFailed==0 ); if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_BLOB ){ zAff[j] = SQLITE_AFF_BLOB; } @@ -146051,7 +148532,7 @@ static void codeCursorHint( sWalker.pParse = pParse; sWalker.u.pCCurHint = &sHint; pWC = &pWInfo->sWC; - for(i=0; inTerm; i++){ + for(i=0; inBase; i++){ pTerm = &pWC->a[i]; if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; if( pTerm->prereqAll & pLevel->notReady ) continue; @@ -146081,7 +148562,7 @@ static void codeCursorHint( if( pTabItem->fg.jointype & JT_LEFT ){ Expr *pExpr = pTerm->pExpr; if( !ExprHasProperty(pExpr, EP_FromJoin) - || pExpr->iRightJoinTable!=pTabItem->iCursor + || pExpr->w.iRightJoinTable!=pTabItem->iCursor ){ sWalker.eCode = 0; sWalker.xExprCallback = codeCursorHintIsOrFunction; @@ -146193,7 +148674,7 @@ static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){ assert( nReg>0 ); if( p && sqlite3ExprIsVector(p) ){ #ifndef SQLITE_OMIT_SUBQUERY - if( (p->flags & EP_xIsSelect) ){ + if( ExprUseXSelect(p) ){ Vdbe *v = pParse->pVdbe; int iSelect; assert( p->op==TK_SELECT ); @@ -146203,7 +148684,9 @@ static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){ #endif { int i; - ExprList *pList = p->x.pList; + const ExprList *pList; + assert( ExprUseXList(p) ); + pList = p->x.pList; assert( nReg<=pList->nExpr ); for(i=0; ia[i].pExpr, iReg+i); @@ -146251,15 +148734,16 @@ static void preserveExpr(IdxExprTrans *pTrans, Expr *pExpr){ static int whereIndexExprTransNode(Walker *p, Expr *pExpr){ IdxExprTrans *pX = p->u.pIdxTrans; if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ + pExpr = sqlite3ExprSkipCollate(pExpr); preserveExpr(pX, pExpr); pExpr->affExpr = sqlite3ExprAffinity(pExpr); pExpr->op = TK_COLUMN; pExpr->iTable = pX->iIdxCur; pExpr->iColumn = pX->iIdxCol; - pExpr->y.pTab = 0; testcase( ExprHasProperty(pExpr, EP_Skip) ); testcase( ExprHasProperty(pExpr, EP_Unlikely) ); - ExprClearProperty(pExpr, EP_Skip|EP_Unlikely); + ExprClearProperty(pExpr, EP_Skip|EP_Unlikely|EP_WinFunc|EP_Subrtn); + pExpr->y.pTab = 0; return WRC_Prune; }else{ return WRC_Continue; @@ -146274,7 +148758,7 @@ static int whereIndexExprTransColumn(Walker *p, Expr *pExpr){ if( pExpr->op==TK_COLUMN ){ IdxExprTrans *pX = p->u.pIdxTrans; if( pExpr->iTable==pX->iTabCur && pExpr->iColumn==pX->iTabCol ){ - assert( pExpr->y.pTab!=0 ); + assert( ExprUseYTab(pExpr) && pExpr->y.pTab!=0 ); preserveExpr(pX, pExpr); pExpr->affExpr = sqlite3TableColumnAffinity(pExpr->y.pTab,pExpr->iColumn); pExpr->iTable = pX->iIdxCur; @@ -146322,15 +148806,16 @@ static void whereIndexExprTrans( for(iIdxCol=0; iIdxColnColumn; iIdxCol++){ i16 iRef = pIdx->aiColumn[iIdxCol]; if( iRef==XN_EXPR ){ - assert( aColExpr->a[iIdxCol].pExpr!=0 ); + assert( aColExpr!=0 && aColExpr->a[iIdxCol].pExpr!=0 ); x.pIdxExpr = aColExpr->a[iIdxCol].pExpr; if( sqlite3ExprIsConstant(x.pIdxExpr) ) continue; w.xExprCallback = whereIndexExprTransNode; #ifndef SQLITE_OMIT_GENERATED_COLUMNS }else if( iRef>=0 && (pTab->aCol[iRef].colFlags & COLFLAG_VIRTUAL)!=0 - && (pTab->aCol[iRef].zColl==0 - || sqlite3StrICmp(pTab->aCol[iRef].zColl, sqlite3StrBINARY)==0) + && ((pTab->aCol[iRef].colFlags & COLFLAG_HASCOLL)==0 + || sqlite3StrICmp(sqlite3ColumnColl(&pTab->aCol[iRef]), + sqlite3StrBINARY)==0) ){ /* Check to see if there are direct references to generated columns ** that are contained in the index. Pulling the generated column @@ -146379,6 +148864,68 @@ static void whereApplyPartialIndexConstraints( } } +/* +** This routine is called right after An OP_Filter has been generated and +** before the corresponding index search has been performed. This routine +** checks to see if there are additional Bloom filters in inner loops that +** can be checked prior to doing the index lookup. If there are available +** inner-loop Bloom filters, then evaluate those filters now, before the +** index lookup. The idea is that a Bloom filter check is way faster than +** an index lookup, and the Bloom filter might return false, meaning that +** the index lookup can be skipped. +** +** We know that an inner loop uses a Bloom filter because it has the +** WhereLevel.regFilter set. If an inner-loop Bloom filter is checked, +** then clear the WhereLevel.regFilter value to prevent the Bloom filter +** from being checked a second time when the inner loop is evaluated. +*/ +static SQLITE_NOINLINE void filterPullDown( + Parse *pParse, /* Parsing context */ + WhereInfo *pWInfo, /* Complete information about the WHERE clause */ + int iLevel, /* Which level of pWInfo->a[] should be coded */ + int addrNxt, /* Jump here to bypass inner loops */ + Bitmask notReady /* Loops that are not ready */ +){ + while( ++iLevel < pWInfo->nLevel ){ + WhereLevel *pLevel = &pWInfo->a[iLevel]; + WhereLoop *pLoop = pLevel->pWLoop; + if( pLevel->regFilter==0 ) continue; + if( pLevel->pWLoop->nSkip ) continue; + /* ,--- Because sqlite3ConstructBloomFilter() has will not have set + ** vvvvv--' pLevel->regFilter if this were true. */ + if( NEVER(pLoop->prereq & notReady) ) continue; + assert( pLevel->addrBrk==0 ); + pLevel->addrBrk = addrNxt; + if( pLoop->wsFlags & WHERE_IPK ){ + WhereTerm *pTerm = pLoop->aLTerm[0]; + int regRowid; + assert( pTerm!=0 ); + assert( pTerm->pExpr!=0 ); + testcase( pTerm->wtFlags & TERM_VIRTUAL ); + regRowid = sqlite3GetTempReg(pParse); + regRowid = codeEqualityTerm(pParse, pTerm, pLevel, 0, 0, regRowid); + sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter, + addrNxt, regRowid, 1); + VdbeCoverage(pParse->pVdbe); + }else{ + u16 nEq = pLoop->u.btree.nEq; + int r1; + char *zStartAff; + + assert( pLoop->wsFlags & WHERE_INDEXED ); + assert( (pLoop->wsFlags & WHERE_COLUMN_IN)==0 ); + r1 = codeAllEqualityTerms(pParse,pLevel,0,0,&zStartAff); + codeApplyAffinity(pParse, r1, nEq, zStartAff); + sqlite3DbFree(pParse->db, zStartAff); + sqlite3VdbeAddOp4Int(pParse->pVdbe, OP_Filter, pLevel->regFilter, + addrNxt, r1, nEq); + VdbeCoverage(pParse->pVdbe); + } + pLevel->regFilter = 0; + pLevel->addrBrk = 0; + } +} + /* ** Generate code for the start of the iLevel-th loop in the WHERE clause ** implementation described by pWInfo. @@ -146481,7 +149028,6 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( int iReg; /* P3 Value for OP_VFilter */ int addrNotFound; int nConstraint = pLoop->nLTerm; - int iIn; /* Counter for IN constraints */ iReg = sqlite3GetTempRange(pParse, nConstraint+2); addrNotFound = pLevel->addrBrk; @@ -146490,11 +149036,27 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( pTerm = pLoop->aLTerm[j]; if( NEVER(pTerm==0) ) continue; if( pTerm->eOperator & WO_IN ){ - codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); - addrNotFound = pLevel->addrNxt; + if( SMASKBIT32(j) & pLoop->u.vtab.mHandleIn ){ + int iTab = pParse->nTab++; + int iCache = ++pParse->nMem; + sqlite3CodeRhsOfIN(pParse, pTerm->pExpr, iTab); + sqlite3VdbeAddOp3(v, OP_VInitIn, iTab, iTarget, iCache); + }else{ + codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); + addrNotFound = pLevel->addrNxt; + } }else{ Expr *pRight = pTerm->pExpr->pRight; codeExprOrVector(pParse, pRight, iTarget, 1); + if( pTerm->eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET + && pLoop->u.vtab.bOmitOffset + ){ + assert( pTerm->eOperator==WO_AUX ); + assert( pWInfo->pLimit!=0 ); + assert( pWInfo->pLimit->iOffset>0 ); + sqlite3VdbeAddOp2(v, OP_Integer, 0, pWInfo->pLimit->iOffset); + VdbeComment((v,"Zero OFFSET counter")); + } } } sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); @@ -146510,40 +149072,55 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( pLevel->p1 = iCur; pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext; pLevel->p2 = sqlite3VdbeCurrentAddr(v); - iIn = pLevel->u.in.nIn; - for(j=nConstraint-1; j>=0; j--){ + assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); + + for(j=0; jaLTerm[j]; - if( (pTerm->eOperator & WO_IN)!=0 ) iIn--; if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ disableTerm(pLevel, pTerm); - }else if( (pTerm->eOperator & WO_IN)!=0 - && sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1 + continue; + } + if( (pTerm->eOperator & WO_IN)!=0 + && (SMASKBIT32(j) & pLoop->u.vtab.mHandleIn)==0 + && !db->mallocFailed ){ Expr *pCompare; /* The comparison operator */ Expr *pRight; /* RHS of the comparison */ VdbeOp *pOp; /* Opcode to access the value of the IN constraint */ + int iIn; /* IN loop corresponding to the j-th constraint */ /* Reload the constraint value into reg[iReg+j+2]. The same value ** was loaded into the same register prior to the OP_VFilter, but ** the xFilter implementation might have changed the datatype or - ** encoding of the value in the register, so it *must* be reloaded. */ - assert( pLevel->u.in.aInLoop!=0 || db->mallocFailed ); - if( !db->mallocFailed ){ - assert( iIn>=0 && iInu.in.nIn ); + ** encoding of the value in the register, so it *must* be reloaded. + */ + for(iIn=0; ALWAYS(iInu.in.nIn); iIn++){ pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[iIn].addrInTop); - assert( pOp->opcode==OP_Column || pOp->opcode==OP_Rowid ); - assert( pOp->opcode!=OP_Column || pOp->p3==iReg+j+2 ); - assert( pOp->opcode!=OP_Rowid || pOp->p2==iReg+j+2 ); - testcase( pOp->opcode==OP_Rowid ); - sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); + if( (pOp->opcode==OP_Column && pOp->p3==iReg+j+2) + || (pOp->opcode==OP_Rowid && pOp->p2==iReg+j+2) + ){ + testcase( pOp->opcode==OP_Rowid ); + sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); + break; + } } /* Generate code that will continue to the next row if - ** the IN constraint is not satisfied */ + ** the IN constraint is not satisfied + */ pCompare = sqlite3PExpr(pParse, TK_EQ, 0, 0); - assert( pCompare!=0 || db->mallocFailed ); - if( pCompare ){ - pCompare->pLeft = pTerm->pExpr->pLeft; + if( !db->mallocFailed ){ + int iFld = pTerm->u.x.iField; + Expr *pLeft = pTerm->pExpr->pLeft; + assert( pLeft!=0 ); + if( iFld>0 ){ + assert( pLeft->op==TK_VECTOR ); + assert( ExprUseXList(pLeft) ); + assert( iFld<=pLeft->x.pList->nExpr ); + pCompare->pLeft = pLeft->x.pList->a[iFld-1].pExpr; + }else{ + pCompare->pLeft = pLeft; + } pCompare->pRight = pRight = sqlite3Expr(db, TK_REGISTER, 0); if( pRight ){ pRight->iTable = iReg+j+2; @@ -146552,11 +149129,11 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ); } pCompare->pLeft = 0; - sqlite3ExprDelete(db, pCompare); } + sqlite3ExprDelete(db, pCompare); } } - assert( iIn==0 || db->mallocFailed ); + /* These registers need to be preserved in case there is an IN operator ** loop. So we could deallocate the registers here (and potentially ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems @@ -146584,12 +149161,15 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; + if( pLevel->regFilter ){ + sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt, + iRowidReg, 1); + VdbeCoverage(v); + filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady); + } sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); VdbeCoverage(v); pLevel->op = OP_Noop; - if( (pTerm->prereqAll & pLevel->notReady)==0 ){ - pTerm->wtFlags |= TERM_CODED; - } }else if( (pLoop->wsFlags & WHERE_IPK)!=0 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0 ){ @@ -146912,6 +149492,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( sqlite3VdbeAddOp2(v, OP_Integer, 1, regBignull); VdbeComment((v, "NULL-scan pass ctr")); } + if( pLevel->regFilter ){ + sqlite3VdbeAddOp4Int(v, OP_Filter, pLevel->regFilter, addrNxt, + regBase, nEq); + VdbeCoverage(v); + filterPullDown(pParse, pWInfo, iLevel, addrNxt, notReady); + } op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; assert( op!=0 ); @@ -146960,8 +149546,19 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** range (if any). */ nConstraint = nEq; + assert( pLevel->p2==0 ); if( pRangeEnd ){ Expr *pRight = pRangeEnd->pExpr->pRight; + if( addrSeekScan ){ + /* For a seek-scan that has a range on the lowest term of the index, + ** we have to make the top of the loop be code that sets the end + ** condition of the range. Otherwise, the OP_SeekScan might jump + ** over that initialization, leaving the range-end value set to the + ** range-start value, resulting in a wrong answer. + ** See ticket 5981a8c041a3c2f3 (2021-11-02). + */ + pLevel->p2 = sqlite3VdbeCurrentAddr(v); + } codeExprOrVector(pParse, pRight, regBase+nEq, nTop); whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd); if( (pRangeEnd->wtFlags & TERM_VNULL)==0 @@ -146995,7 +149592,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( sqlite3DbFree(db, zEndAff); /* Top of the loop body */ - pLevel->p2 = sqlite3VdbeCurrentAddr(v); + if( pLevel->p2==0 ) pLevel->p2 = sqlite3VdbeCurrentAddr(v); /* Check if the index cursor is past the end of the range. */ if( nConstraint ){ @@ -147228,7 +149825,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( iRetInit = sqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn); /* If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y - ** Then for every term xN, evaluate as the subexpression: xN AND z + ** Then for every term xN, evaluate as the subexpression: xN AND y ** That way, terms in y that are factored into the disjunction will ** be picked up by the recursive calls to sqlite3WhereBegin() below. ** @@ -147240,6 +149837,20 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** This optimization also only applies if the (x1 OR x2 OR ...) term ** is not contained in the ON clause of a LEFT JOIN. ** See ticket http://www.sqlite.org/src/info/f2369304e4 + ** + ** 2022-02-04: Do not push down slices of a row-value comparison. + ** In other words, "w" or "y" may not be a slice of a vector. Otherwise, + ** the initialization of the right-hand operand of the vector comparison + ** might not occur, or might occur only in an OR branch that is not + ** taken. dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1. + ** + ** 2022-03-03: Do not push down expressions that involve subqueries. + ** The subquery might get coded as a subroutine. Any table-references + ** in the subquery might be resolved to index-references for the index on + ** the OR branch in which the subroutine is coded. But if the subroutine + ** is invoked from a different OR branch that uses a different index, such + ** index-references will not work. tag-20220303a + ** https://sqlite.org/forum/forumpost/36937b197273d403 */ if( pWC->nTerm>1 ){ int iTerm; @@ -147248,9 +149859,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( if( &pWC->a[iTerm] == pTerm ) continue; testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL ); testcase( pWC->a[iTerm].wtFlags & TERM_CODED ); - if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue; + testcase( pWC->a[iTerm].wtFlags & TERM_SLICE ); + if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED|TERM_SLICE))!=0 ){ + continue; + } if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; - testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); + if( ExprHasProperty(pExpr, EP_Subquery) ) continue; /* tag-20220303a */ pExpr = sqlite3ExprDup(db, pExpr, 0); pAndExpr = sqlite3ExprAnd(pParse, pAndExpr, pExpr); } @@ -147291,9 +149905,9 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( /* Loop through table entries that match term pOrTerm. */ ExplainQueryPlan((pParse, 1, "INDEX %d", ii+1)); WHERETRACE(0xffff, ("Subplan for OR-clause:\n")); - pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, + pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, 0, WHERE_OR_SUBCLAUSE, iCovCur); - assert( pSubWInfo || pParse->nErr || db->mallocFailed ); + assert( pSubWInfo || pParse->nErr ); if( pSubWInfo ){ WhereLoop *pSubLoop; int addrExplain = sqlite3WhereExplainOneScan( @@ -147402,7 +150016,10 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( } } ExplainQueryPlanPop(pParse); - pLevel->u.pCovidx = pCov; + assert( pLevel->pWLoop==pLoop ); + assert( (pLoop->wsFlags & WHERE_MULTI_OR)!=0 ); + assert( (pLoop->wsFlags & WHERE_IN_ABLE)==0 ); + pLevel->u.pCoveringIdx = pCov; if( pCov ) pLevel->iIdxCur = iCovCur; if( pAndExpr ){ pAndExpr->pLeft = 0; @@ -147529,7 +150146,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( ** then we cannot use the "t1.a=t2.b" constraint, but we can code ** the implied "t1.a=123" constraint. */ - for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ + for(pTerm=pWC->a, j=pWC->nBase; j>0; j--, pTerm++){ Expr *pE, sEAlt; WhereTerm *pAlt; if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; @@ -147546,12 +150163,13 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( #endif assert( !ExprHasProperty(pE, EP_FromJoin) ); assert( (pTerm->prereqRight & pLevel->notReady)!=0 ); + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); pAlt = sqlite3WhereFindTerm(pWC, iCur, pTerm->u.x.leftColumn, notReady, WO_EQ|WO_IN|WO_IS, 0); if( pAlt==0 ) continue; if( pAlt->wtFlags & (TERM_CODED) ) continue; if( (pAlt->eOperator & WO_IN) - && (pAlt->pExpr->flags & EP_xIsSelect) + && ExprUseXSelect(pAlt->pExpr) && (pAlt->pExpr->x.pSelect->pEList->nExpr>1) ){ continue; @@ -147573,7 +150191,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart( pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); VdbeComment((v, "record LEFT JOIN hit")); - for(pTerm=pWC->a, j=0; jnTerm; j++, pTerm++){ + for(pTerm=pWC->a, j=0; jnBase; j++, pTerm++){ testcase( pTerm->wtFlags & TERM_VIRTUAL ); testcase( pTerm->wtFlags & TERM_CODED ); if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; @@ -147684,6 +150302,7 @@ static int whereClauseInsert(WhereClause *pWC, Expr *p, u16 wtFlags){ pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]); } pTerm = &pWC->a[idx = pWC->nTerm++]; + if( (wtFlags & TERM_VIRTUAL)==0 ) pWC->nBase = pWC->nTerm; if( p && ExprHasProperty(p, EP_Unlikely) ){ pTerm->truthProb = sqlite3LogEst(p->iTable) - 270; }else{ @@ -147800,6 +150419,7 @@ static int isLikeOrGlob( #ifdef SQLITE_EBCDIC if( *pnoCase ) return 0; #endif + assert( ExprUseXList(pExpr) ); pList = pExpr->x.pList; pLeft = pList->a[1].pExpr; @@ -147815,7 +150435,8 @@ static int isLikeOrGlob( sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); }else if( op==TK_STRING ){ - z = (u8*)pRight->u.zToken; + assert( !ExprHasProperty(pRight, EP_IntValue) ); + z = (u8*)pRight->u.zToken; } if( z ){ @@ -147844,7 +150465,9 @@ static int isLikeOrGlob( pPrefix = sqlite3Expr(db, TK_STRING, (char*)z); if( pPrefix ){ int iFrom, iTo; - char *zNew = pPrefix->u.zToken; + char *zNew; + assert( !ExprHasProperty(pPrefix, EP_IntValue) ); + zNew = pPrefix->u.zToken; zNew[cnt] = 0; for(iFrom=iTo=0; iFromop!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT - || IsVirtual(pLeft->y.pTab) /* Value might be numeric */ + || (ALWAYS( ExprUseYTab(pLeft) ) + && pLeft->y.pTab + && IsVirtual(pLeft->y.pTab)) /* Might be numeric */ ){ int isNum; double rDummy; @@ -147896,6 +150521,7 @@ static int isLikeOrGlob( if( op==TK_VARIABLE ){ Vdbe *v = pParse->pVdbe; sqlite3VdbeSetVarmask(v, pRight->iColumn); + assert( !ExprHasProperty(pRight, EP_IntValue) ); if( *pisComplete && pRight->u.zToken[1] ){ /* If the rhs of the LIKE expression is a variable, and the current ** value of the variable means there is no need to invoke the LIKE @@ -147969,6 +150595,7 @@ static int isAuxiliaryVtabOperator( Expr *pCol; /* Column reference */ int i; + assert( ExprUseXList(pExpr) ); pList = pExpr->x.pList; if( pList==0 || pList->nExpr!=2 ){ return 0; @@ -147982,9 +150609,11 @@ static int isAuxiliaryVtabOperator( ** MATCH(expression,vtab_column) */ pCol = pList->a[1].pExpr; + assert( pCol->op!=TK_COLUMN || ExprUseYTab(pCol) ); testcase( pCol->op==TK_COLUMN && pCol->y.pTab==0 ); if( ExprIsVtab(pCol) ){ for(i=0; iu.zToken, aOp[i].zOp)==0 ){ *peOp2 = aOp[i].eOp2; *ppRight = pList->a[0].pExpr; @@ -148005,6 +150634,7 @@ static int isAuxiliaryVtabOperator( ** with function names in an arbitrary case. */ pCol = pList->a[0].pExpr; + assert( pCol->op!=TK_COLUMN || ExprUseYTab(pCol) ); testcase( pCol->op==TK_COLUMN && pCol->y.pTab==0 ); if( ExprIsVtab(pCol) ){ sqlite3_vtab *pVtab; @@ -148014,6 +150644,7 @@ static int isAuxiliaryVtabOperator( pVtab = sqlite3GetVTable(db, pCol->y.pTab)->pVtab; assert( pVtab!=0 ); assert( pVtab->pModule!=0 ); + assert( !ExprHasProperty(pExpr, EP_IntValue) ); pMod = (sqlite3_module *)pVtab->pModule; if( pMod->xFindFunction!=0 ){ i = pMod->xFindFunction(pVtab,2, pExpr->u.zToken, &xNotUsed, &pNotUsed); @@ -148029,10 +150660,12 @@ static int isAuxiliaryVtabOperator( int res = 0; Expr *pLeft = pExpr->pLeft; Expr *pRight = pExpr->pRight; + assert( pLeft->op!=TK_COLUMN || ExprUseYTab(pLeft) ); testcase( pLeft->op==TK_COLUMN && pLeft->y.pTab==0 ); if( ExprIsVtab(pLeft) ){ res++; } + assert( pRight==0 || pRight->op!=TK_COLUMN || ExprUseYTab(pRight) ); testcase( pRight && pRight->op==TK_COLUMN && pRight->y.pTab==0 ); if( pRight && ExprIsVtab(pRight) ){ res++; @@ -148056,7 +150689,7 @@ static int isAuxiliaryVtabOperator( static void transferJoinMarkings(Expr *pDerived, Expr *pBase){ if( pDerived ){ pDerived->flags |= pBase->flags & EP_FromJoin; - pDerived->iRightJoinTable = pBase->iRightJoinTable; + pDerived->w.iRightJoinTable = pBase->w.iRightJoinTable; } } @@ -148285,6 +150918,7 @@ static void exprAnalyzeOrTerm( pOrTerm->u.pAndInfo = pAndInfo; pOrTerm->wtFlags |= TERM_ANDINFO; pOrTerm->eOperator = WO_AND; + pOrTerm->leftCursor = -1; pAndWC = &pAndInfo->wc; memset(pAndWC->aStatic, 0, sizeof(pAndWC->aStatic)); sqlite3WhereClauseInit(pAndWC, pWC->pWInfo); @@ -148327,11 +150961,10 @@ static void exprAnalyzeOrTerm( ** empty. */ pOrInfo->indexable = indexable; + pTerm->eOperator = WO_OR; + pTerm->leftCursor = -1; if( indexable ){ - pTerm->eOperator = WO_OR; pWC->hasOr = 1; - }else{ - pTerm->eOperator = WO_OR; } /* For a two-way OR, attempt to implementation case 2. @@ -148386,7 +151019,7 @@ static void exprAnalyzeOrTerm( pOrTerm = pOrWc->a; for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){ assert( pOrTerm->eOperator & WO_EQ ); - pOrTerm->wtFlags &= ~TERM_OR_OK; + pOrTerm->wtFlags &= ~TERM_OK; if( pOrTerm->leftCursor==iCursor ){ /* This is the 2-bit case and we are on the second iteration and ** current term is from the first iteration. So skip this term. */ @@ -148404,6 +151037,7 @@ static void exprAnalyzeOrTerm( assert( pOrTerm->wtFlags & (TERM_COPIED|TERM_VIRTUAL) ); continue; } + assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 ); iColumn = pOrTerm->u.x.leftColumn; iCursor = pOrTerm->leftCursor; pLeft = pOrTerm->pExpr->pLeft; @@ -148424,8 +151058,9 @@ static void exprAnalyzeOrTerm( okToChngToIN = 1; for(; i>=0 && okToChngToIN; i--, pOrTerm++){ assert( pOrTerm->eOperator & WO_EQ ); + assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 ); if( pOrTerm->leftCursor!=iCursor ){ - pOrTerm->wtFlags &= ~TERM_OR_OK; + pOrTerm->wtFlags &= ~TERM_OK; }else if( pOrTerm->u.x.leftColumn!=iColumn || (iColumn==XN_EXPR && sqlite3ExprCompare(pParse, pOrTerm->pExpr->pLeft, pLeft, -1) )){ @@ -148441,7 +151076,7 @@ static void exprAnalyzeOrTerm( if( affRight!=0 && affRight!=affLeft ){ okToChngToIN = 0; }else{ - pOrTerm->wtFlags |= TERM_OR_OK; + pOrTerm->wtFlags |= TERM_OK; } } } @@ -148458,8 +151093,9 @@ static void exprAnalyzeOrTerm( Expr *pNew; /* The complete IN operator */ for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){ - if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue; + if( (pOrTerm->wtFlags & TERM_OK)==0 ) continue; assert( pOrTerm->eOperator & WO_EQ ); + assert( (pOrTerm->eOperator & (WO_OR|WO_AND))==0 ); assert( pOrTerm->leftCursor==iCursor ); assert( pOrTerm->u.x.leftColumn==iColumn ); pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0); @@ -148472,7 +151108,7 @@ static void exprAnalyzeOrTerm( if( pNew ){ int idxNew; transferJoinMarkings(pNew, pExpr); - assert( !ExprHasProperty(pNew, EP_xIsSelect) ); + assert( ExprUseXList(pNew) ); pNew->x.pList = pList; idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew==0 ); @@ -148600,6 +151236,7 @@ static int exprMightBeIndexed( assert( TK_ISop==TK_VECTOR && (op>=TK_GT && ALWAYS(op<=TK_GE)) ){ + assert( ExprUseXList(pExpr) ); pExpr = pExpr->x.pList->a[0].pExpr; } @@ -148657,30 +151294,47 @@ static void exprAnalyze( if( db->mallocFailed ){ return; } + assert( pWC->nTerm > idxTerm ); pTerm = &pWC->a[idxTerm]; pMaskSet = &pWInfo->sMaskSet; pExpr = pTerm->pExpr; + assert( pExpr!=0 ); /* Because malloc() has not failed */ assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE ); + pMaskSet->bVarSelect = 0; prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft); op = pExpr->op; if( op==TK_IN ){ assert( pExpr->pRight==0 ); if( sqlite3ExprCheckIN(pParse, pExpr) ) return; - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ pTerm->prereqRight = exprSelectUsage(pMaskSet, pExpr->x.pSelect); }else{ pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList); } - }else if( op==TK_ISNULL ){ - pTerm->prereqRight = 0; + prereqAll = prereqLeft | pTerm->prereqRight; }else{ pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight); + if( pExpr->pLeft==0 + || ExprHasProperty(pExpr, EP_xIsSelect|EP_IfNullRow) + || pExpr->x.pList!=0 + ){ + prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr); + }else{ + prereqAll = prereqLeft | pTerm->prereqRight; + } } - pMaskSet->bVarSelect = 0; - prereqAll = sqlite3WhereExprUsageNN(pMaskSet, pExpr); if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT; + +#ifdef SQLITE_DEBUG + if( prereqAll!=sqlite3WhereExprUsageNN(pMaskSet, pExpr) ){ + printf("\n*** Incorrect prereqAll computed for:\n"); + sqlite3TreeViewExpr(0,pExpr,0); + abort(); + } +#endif + if( ExprHasProperty(pExpr, EP_FromJoin) ){ - Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable); + Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->w.iRightJoinTable); prereqAll |= x; extraRight = x-1; /* ON clause terms may not be used with an index ** on left table of a LEFT JOIN. Ticket #3015 */ @@ -148702,11 +151356,13 @@ static void exprAnalyze( if( pTerm->u.x.iField>0 ){ assert( op==TK_IN ); assert( pLeft->op==TK_VECTOR ); + assert( ExprUseXList(pLeft) ); pLeft = pLeft->x.pList->a[pTerm->u.x.iField-1].pExpr; } if( exprMightBeIndexed(pSrc, prereqLeft, aiCurCol, pLeft, op) ){ pTerm->leftCursor = aiCurCol[0]; + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); pTerm->u.x.leftColumn = aiCurCol[1]; pTerm->eOperator = operatorMask(op) & opMask; } @@ -148744,12 +151400,18 @@ static void exprAnalyze( } pNew->wtFlags |= exprCommute(pParse, pDup); pNew->leftCursor = aiCurCol[0]; + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); pNew->u.x.leftColumn = aiCurCol[1]; testcase( (prereqLeft | extraRight) != prereqLeft ); pNew->prereqRight = prereqLeft | extraRight; pNew->prereqAll = prereqAll; pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask; - }else if( op==TK_ISNULL && 0==sqlite3ExprCanBeNull(pLeft) ){ + }else + if( op==TK_ISNULL + && !ExprHasProperty(pExpr,EP_FromJoin) + && 0==sqlite3ExprCanBeNull(pLeft) + ){ + assert( !ExprHasProperty(pExpr, EP_IntValue) ); pExpr->op = TK_TRUEFALSE; pExpr->u.zToken = "false"; ExprSetProperty(pExpr, EP_IsFalse); @@ -148775,9 +151437,11 @@ static void exprAnalyze( ** BETWEEN term is skipped. */ else if( pExpr->op==TK_BETWEEN && pWC->op==TK_AND ){ - ExprList *pList = pExpr->x.pList; + ExprList *pList; int i; static const u8 ops[] = {TK_GE, TK_LE}; + assert( ExprUseXList(pExpr) ); + pList = pExpr->x.pList; assert( pList!=0 ); assert( pList->nExpr==2 ); for(i=0; i<2; i++){ @@ -148870,8 +151534,12 @@ static void exprAnalyze( const char *zCollSeqName; /* Name of collating sequence */ const u16 wtFlags = TERM_LIKEOPT | TERM_VIRTUAL | TERM_DYNAMIC; + assert( ExprUseXList(pExpr) ); pLeft = pExpr->x.pList->a[1].pExpr; pStr2 = sqlite3ExprDup(db, pStr1, 0); + assert( pStr1==0 || !ExprHasProperty(pStr1, EP_IntValue) ); + assert( pStr2==0 || !ExprHasProperty(pStr2, EP_IntValue) ); + /* Convert the lower bound to upper-case and the upper bound to ** lower-case (upper-case is less than lower-case in ASCII) so that @@ -148934,7 +151602,10 @@ static void exprAnalyze( ** no longer used. ** ** This is only required if at least one side of the comparison operation - ** is not a sub-select. */ + ** is not a sub-select. + ** + ** tag-20220128a + */ if( (pExpr->op==TK_EQ || pExpr->op==TK_IS) && (nLeft = sqlite3ExprVectorSize(pExpr->pLeft))>1 && sqlite3ExprVectorSize(pExpr->pRight)==nLeft @@ -148946,12 +151617,12 @@ static void exprAnalyze( for(i=0; ipLeft, i); - Expr *pRight = sqlite3ExprForVectorField(pParse, pExpr->pRight, i); + Expr *pLeft = sqlite3ExprForVectorField(pParse, pExpr->pLeft, i, nLeft); + Expr *pRight = sqlite3ExprForVectorField(pParse, pExpr->pRight, i, nLeft); pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight); transferJoinMarkings(pNew, pExpr); - idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC); + idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_SLICE); exprAnalyze(pSrc, pWC, idxNew); } pTerm = &pWC->a[idxTerm]; @@ -148971,6 +151642,7 @@ static void exprAnalyze( else if( pExpr->op==TK_IN && pTerm->u.x.iField==0 && pExpr->pLeft->op==TK_VECTOR + && ALWAYS( ExprUseXSelect(pExpr) ) && pExpr->x.pSelect->pPrior==0 #ifndef SQLITE_OMIT_WINDOWFUNC && pExpr->x.pSelect->pWin==0 @@ -148980,7 +151652,7 @@ static void exprAnalyze( int i; for(i=0; ipLeft); i++){ int idxNew; - idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL); + idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL|TERM_SLICE); pWC->a[idxNew].u.x.iField = i+1; exprAnalyze(pSrc, pWC, idxNew); markTermAsChild(pWC, idxNew, idxTerm); @@ -149013,7 +151685,7 @@ static void exprAnalyze( 0, sqlite3ExprDup(db, pRight, 0)); if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){ ExprSetProperty(pNewExpr, EP_FromJoin); - pNewExpr->iRightJoinTable = pExpr->iRightJoinTable; + pNewExpr->w.iRightJoinTable = pExpr->w.iRightJoinTable; } idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); testcase( idxNew==0 ); @@ -149076,6 +151748,113 @@ SQLITE_PRIVATE void sqlite3WhereSplit(WhereClause *pWC, Expr *pExpr, u8 op){ } } +/* +** Add either a LIMIT (if eMatchOp==SQLITE_INDEX_CONSTRAINT_LIMIT) or +** OFFSET (if eMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET) term to the +** where-clause passed as the first argument. The value for the term +** is found in register iReg. +** +** In the common case where the value is a simple integer +** (example: "LIMIT 5 OFFSET 10") then the expression codes as a +** TK_INTEGER so that it will be available to sqlite3_vtab_rhs_value(). +** If not, then it codes as a TK_REGISTER expression. +*/ +static void whereAddLimitExpr( + WhereClause *pWC, /* Add the constraint to this WHERE clause */ + int iReg, /* Register that will hold value of the limit/offset */ + Expr *pExpr, /* Expression that defines the limit/offset */ + int iCsr, /* Cursor to which the constraint applies */ + int eMatchOp /* SQLITE_INDEX_CONSTRAINT_LIMIT or _OFFSET */ +){ + Parse *pParse = pWC->pWInfo->pParse; + sqlite3 *db = pParse->db; + Expr *pNew; + int iVal = 0; + + if( sqlite3ExprIsInteger(pExpr, &iVal) && iVal>=0 ){ + Expr *pVal = sqlite3Expr(db, TK_INTEGER, 0); + if( pVal==0 ) return; + ExprSetProperty(pVal, EP_IntValue); + pVal->u.iValue = iVal; + pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal); + }else{ + Expr *pVal = sqlite3Expr(db, TK_REGISTER, 0); + if( pVal==0 ) return; + pVal->iTable = iReg; + pNew = sqlite3PExpr(pParse, TK_MATCH, 0, pVal); + } + if( pNew ){ + WhereTerm *pTerm; + int idx; + idx = whereClauseInsert(pWC, pNew, TERM_DYNAMIC|TERM_VIRTUAL); + pTerm = &pWC->a[idx]; + pTerm->leftCursor = iCsr; + pTerm->eOperator = WO_AUX; + pTerm->eMatchOp = eMatchOp; + } +} + +/* +** Possibly add terms corresponding to the LIMIT and OFFSET clauses of the +** SELECT statement passed as the second argument. These terms are only +** added if: +** +** 1. The SELECT statement has a LIMIT clause, and +** 2. The SELECT statement is not an aggregate or DISTINCT query, and +** 3. The SELECT statement has exactly one object in its from clause, and +** that object is a virtual table, and +** 4. There are no terms in the WHERE clause that will not be passed +** to the virtual table xBestIndex method. +** 5. The ORDER BY clause, if any, will be made available to the xBestIndex +** method. +** +** LIMIT and OFFSET terms are ignored by most of the planner code. They +** exist only so that they may be passed to the xBestIndex method of the +** single virtual table in the FROM clause of the SELECT. +*/ +SQLITE_PRIVATE void sqlite3WhereAddLimit(WhereClause *pWC, Select *p){ + assert( p==0 || (p->pGroupBy==0 && (p->selFlags & SF_Aggregate)==0) ); + if( (p && p->pLimit) /* 1 */ + && (p->selFlags & (SF_Distinct|SF_Aggregate))==0 /* 2 */ + && (p->pSrc->nSrc==1 && IsVirtual(p->pSrc->a[0].pTab)) /* 3 */ + ){ + ExprList *pOrderBy = p->pOrderBy; + int iCsr = p->pSrc->a[0].iCursor; + int ii; + + /* Check condition (4). Return early if it is not met. */ + for(ii=0; iinTerm; ii++){ + if( pWC->a[ii].wtFlags & TERM_CODED ){ + /* This term is a vector operation that has been decomposed into + ** other, subsequent terms. It can be ignored. See tag-20220128a */ + assert( pWC->a[ii].wtFlags & TERM_VIRTUAL ); + assert( pWC->a[ii].eOperator==0 ); + continue; + } + if( pWC->a[ii].leftCursor!=iCsr ) return; + } + + /* Check condition (5). Return early if it is not met. */ + if( pOrderBy ){ + for(ii=0; iinExpr; ii++){ + Expr *pExpr = pOrderBy->a[ii].pExpr; + if( pExpr->op!=TK_COLUMN ) return; + if( pExpr->iTable!=iCsr ) return; + if( pOrderBy->a[ii].sortFlags & KEYINFO_ORDER_BIGNULL ) return; + } + } + + /* All conditions are met. Add the terms to the where-clause object. */ + assert( p->pLimit->op==TK_LIMIT ); + whereAddLimitExpr(pWC, p->iLimit, p->pLimit->pLeft, + iCsr, SQLITE_INDEX_CONSTRAINT_LIMIT); + if( p->iOffset>0 ){ + whereAddLimitExpr(pWC, p->iOffset, p->pLimit->pRight, + iCsr, SQLITE_INDEX_CONSTRAINT_OFFSET); + } + } +} + /* ** Initialize a preallocated WhereClause structure. */ @@ -149087,6 +151866,7 @@ SQLITE_PRIVATE void sqlite3WhereClauseInit( pWC->hasOr = 0; pWC->pOuter = 0; pWC->nTerm = 0; + pWC->nBase = 0; pWC->nSlot = ArraySize(pWC->aStatic); pWC->a = pWC->aStatic; } @@ -149097,17 +151877,34 @@ SQLITE_PRIVATE void sqlite3WhereClauseInit( ** sqlite3WhereClauseInit(). */ SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ - int i; - WhereTerm *a; sqlite3 *db = pWC->pWInfo->pParse->db; - for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){ - if( a->wtFlags & TERM_DYNAMIC ){ - sqlite3ExprDelete(db, a->pExpr); + assert( pWC->nTerm>=pWC->nBase ); + if( pWC->nTerm>0 ){ + WhereTerm *a = pWC->a; + WhereTerm *aLast = &pWC->a[pWC->nTerm-1]; +#ifdef SQLITE_DEBUG + int i; + /* Verify that every term past pWC->nBase is virtual */ + for(i=pWC->nBase; inTerm; i++){ + assert( (pWC->a[i].wtFlags & TERM_VIRTUAL)!=0 ); } - if( a->wtFlags & TERM_ORINFO ){ - whereOrInfoDelete(db, a->u.pOrInfo); - }else if( a->wtFlags & TERM_ANDINFO ){ - whereAndInfoDelete(db, a->u.pAndInfo); +#endif + while(1){ + assert( a->eMatchOp==0 || a->eOperator==WO_AUX ); + if( a->wtFlags & TERM_DYNAMIC ){ + sqlite3ExprDelete(db, a->pExpr); + } + if( a->wtFlags & (TERM_ORINFO|TERM_ANDINFO) ){ + if( a->wtFlags & TERM_ORINFO ){ + assert( (a->wtFlags & TERM_ANDINFO)==0 ); + whereOrInfoDelete(db, a->u.pOrInfo); + }else{ + assert( (a->wtFlags & TERM_ANDINFO)!=0 ); + whereAndInfoDelete(db, a->u.pAndInfo); + } + } + if( a==aLast ) break; + a++; } } if( pWC->a!=pWC->aStatic ){ @@ -149120,28 +151917,52 @@ SQLITE_PRIVATE void sqlite3WhereClauseClear(WhereClause *pWC){ ** These routines walk (recursively) an expression tree and generate ** a bitmask indicating which tables are used in that expression ** tree. +** +** sqlite3WhereExprUsage(MaskSet, Expr) -> +** +** Return a Bitmask of all tables referenced by Expr. Expr can be +** be NULL, in which case 0 is returned. +** +** sqlite3WhereExprUsageNN(MaskSet, Expr) -> +** +** Same as sqlite3WhereExprUsage() except that Expr must not be +** NULL. The "NN" suffix on the name stands for "Not Null". +** +** sqlite3WhereExprListUsage(MaskSet, ExprList) -> +** +** Return a Bitmask of all tables referenced by every expression +** in the expression list ExprList. ExprList can be NULL, in which +** case 0 is returned. +** +** sqlite3WhereExprUsageFull(MaskSet, ExprList) -> +** +** Internal use only. Called only by sqlite3WhereExprUsageNN() for +** complex expressions that require pushing register values onto +** the stack. Many calls to sqlite3WhereExprUsageNN() do not need +** the more complex analysis done by this routine. Hence, the +** computations done by this routine are broken out into a separate +** "no-inline" function to avoid the stack push overhead in the +** common case where it is not needed. */ -SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ +static SQLITE_NOINLINE Bitmask sqlite3WhereExprUsageFull( + WhereMaskSet *pMaskSet, + Expr *p +){ Bitmask mask; - if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){ - return sqlite3WhereGetMask(pMaskSet, p->iTable); - }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ - assert( p->op!=TK_IF_NULL_ROW ); - return 0; - } mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0; if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft); if( p->pRight ){ mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pRight); assert( p->x.pList==0 ); - }else if( ExprHasProperty(p, EP_xIsSelect) ){ + }else if( ExprUseXSelect(p) ){ if( ExprHasProperty(p, EP_VarSelect) ) pMaskSet->bVarSelect = 1; mask |= exprSelectUsage(pMaskSet, p->x.pSelect); }else if( p->x.pList ){ mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList); } #ifndef SQLITE_OMIT_WINDOWFUNC - if( (p->op==TK_FUNCTION || p->op==TK_AGG_FUNCTION) && p->y.pWin ){ + if( (p->op==TK_FUNCTION || p->op==TK_AGG_FUNCTION) && ExprUseYWin(p) ){ + assert( p->y.pWin!=0 ); mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pPartition); mask |= sqlite3WhereExprListUsage(pMaskSet, p->y.pWin->pOrderBy); mask |= sqlite3WhereExprUsage(pMaskSet, p->y.pWin->pFilter); @@ -149149,6 +151970,15 @@ SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ #endif return mask; } +SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ + if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){ + return sqlite3WhereGetMask(pMaskSet, p->iTable); + }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ + assert( p->op!=TK_IF_NULL_ROW ); + return 0; + } + return sqlite3WhereExprUsageFull(pMaskSet, p); +} SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){ return p ? sqlite3WhereExprUsageNN(pMaskSet,p) : 0; } @@ -149216,7 +152046,9 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( if( pColRef==0 ) return; pColRef->iTable = pItem->iCursor; pColRef->iColumn = k++; + assert( ExprUseYTab(pColRef) ); pColRef->y.pTab = pTab; + pItem->colUsed |= sqlite3ExprColUsed(pColRef); pRhs = sqlite3PExpr(pParse, TK_UPLUS, sqlite3ExprDup(pParse->db, pArgs->a[j].pExpr, 0), 0); pTerm = sqlite3PExpr(pParse, TK_EQ, pColRef, pRhs); @@ -149261,8 +152093,14 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs( */ typedef struct HiddenIndexInfo HiddenIndexInfo; struct HiddenIndexInfo { - WhereClause *pWC; /* The Where clause being analyzed */ - Parse *pParse; /* The parsing context */ + WhereClause *pWC; /* The Where clause being analyzed */ + Parse *pParse; /* The parsing context */ + int eDistinct; /* Value to return from sqlite3_vtab_distinct() */ + u32 mIn; /* Mask of terms that are IN (...) */ + u32 mHandleIn; /* Terms that vtab will handle as IN (...) */ + sqlite3_value *aRhs[1]; /* RHS values for constraints. MUST BE LAST + ** because extra space is allocated to hold up + ** to nTerm such values */ }; /* Forward declaration of methods */ @@ -149465,7 +152303,12 @@ whereOrInsert_done: SQLITE_PRIVATE Bitmask sqlite3WhereGetMask(WhereMaskSet *pMaskSet, int iCursor){ int i; assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 ); - for(i=0; in; i++){ + assert( pMaskSet->n>0 || pMaskSet->ix[0]<0 ); + assert( iCursor>=-1 ); + if( pMaskSet->ix[0]==iCursor ){ + return 1; + } + for(i=1; in; i++){ if( pMaskSet->ix[i]==iCursor ){ return MASKBIT(i); } @@ -149517,8 +152360,10 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ iColumn = pScan->aiColumn[pScan->iEquiv-1]; iCur = pScan->aiCur[pScan->iEquiv-1]; assert( pWC!=0 ); + assert( iCur>=0 ); do{ for(pTerm=pWC->a+k; knTerm; k++, pTerm++){ + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 || pTerm->leftCursor<0 ); if( pTerm->leftCursor==iCur && pTerm->u.x.leftColumn==iColumn && (iColumn!=XN_EXPR @@ -149560,7 +152405,8 @@ static WhereTerm *whereScanNext(WhereScan *pScan){ } } if( (pTerm->eOperator & (WO_EQ|WO_IS))!=0 - && (pX = pTerm->pExpr->pRight)->op==TK_COLUMN + && (pX = pTerm->pExpr->pRight, ALWAYS(pX!=0)) + && pX->op==TK_COLUMN && pX->iTable==pScan->aiCur[0] && pX->iColumn==pScan->aiColumn[0] ){ @@ -149647,16 +152493,16 @@ static WhereTerm *whereScanInit( if( pIdx ){ int j = iColumn; iColumn = pIdx->aiColumn[j]; - if( iColumn==XN_EXPR ){ - pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr; - pScan->zCollName = pIdx->azColl[j]; - pScan->aiColumn[0] = XN_EXPR; - return whereScanInitIndexExpr(pScan); - }else if( iColumn==pIdx->pTable->iPKey ){ + if( iColumn==pIdx->pTable->iPKey ){ iColumn = XN_ROWID; }else if( iColumn>=0 ){ pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity; pScan->zCollName = pIdx->azColl[j]; + }else if( iColumn==XN_EXPR ){ + pScan->pIdxExpr = pIdx->aColExpr->a[j].pExpr; + pScan->zCollName = pIdx->azColl[j]; + pScan->aiColumn[0] = XN_EXPR; + return whereScanInitIndexExpr(pScan); } }else if( iColumn==XN_EXPR ){ return 0; @@ -149899,12 +152745,14 @@ static void whereTraceIndexInfoInputs(sqlite3_index_info *p){ int i; if( !sqlite3WhereTrace ) return; for(i=0; inConstraint; i++){ - sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n", + sqlite3DebugPrintf( + " constraint[%d]: col=%d termid=%d op=%d usabled=%d collseq=%s\n", i, p->aConstraint[i].iColumn, p->aConstraint[i].iTermOffset, p->aConstraint[i].op, - p->aConstraint[i].usable); + p->aConstraint[i].usable, + sqlite3_vtab_collation(p,i)); } for(i=0; inOrderBy; i++){ sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n", @@ -149940,9 +152788,9 @@ static void whereTraceIndexInfoOutputs(sqlite3_index_info *p){ ** index existed. */ static int termCanDriveIndex( - WhereTerm *pTerm, /* WHERE clause term to check */ - SrcItem *pSrc, /* Table we are trying to access */ - Bitmask notReady /* Tables in outer loops of the join */ + const WhereTerm *pTerm, /* WHERE clause term to check */ + const SrcItem *pSrc, /* Table we are trying to access */ + const Bitmask notReady /* Tables in outer loops of the join */ ){ char aff; if( pTerm->leftCursor!=pSrc->iCursor ) return 0; @@ -149957,6 +152805,7 @@ static int termCanDriveIndex( return 0; } if( (pTerm->prereqRight & notReady)!=0 ) return 0; + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); if( pTerm->u.x.leftColumn<0 ) return 0; aff = pSrc->pTab->aCol[pTerm->u.x.leftColumn].affinity; if( !sqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0; @@ -149972,11 +152821,11 @@ static int termCanDriveIndex( ** and to set up the WhereLevel object pLevel so that the code generator ** makes use of the automatic index. */ -static void constructAutomaticIndex( +static SQLITE_NOINLINE void constructAutomaticIndex( Parse *pParse, /* The parsing context */ - WhereClause *pWC, /* The WHERE clause */ - SrcItem *pSrc, /* The FROM clause term to get the next index */ - Bitmask notReady, /* Mask of cursors that are not available */ + const WhereClause *pWC, /* The WHERE clause */ + const SrcItem *pSrc, /* The FROM clause term to get the next index */ + const Bitmask notReady, /* Mask of cursors that are not available */ WhereLevel *pLevel /* Write new index here */ ){ int nKeyCol; /* Number of columns in the constructed index */ @@ -150018,25 +152867,27 @@ static void constructAutomaticIndex( idxCols = 0; for(pTerm=pWC->a; pTermpExpr; - assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */ - || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */ - || pLoop->prereq!=0 ); /* table of a LEFT JOIN */ - if( pLoop->prereq==0 - && (pTerm->wtFlags & TERM_VIRTUAL)==0 - && !ExprHasProperty(pExpr, EP_FromJoin) - && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ + /* Make the automatic index a partial index if there are terms in the + ** WHERE clause (or the ON clause of a LEFT join) that constrain which + ** rows of the target table (pSrc) that can be used. */ + if( (pTerm->wtFlags & TERM_VIRTUAL)==0 + && sqlite3ExprIsTableConstraint(pExpr, pSrc) + ){ pPartial = sqlite3ExprAnd(pParse, pPartial, sqlite3ExprDup(pParse->db, pExpr, 0)); } if( termCanDriveIndex(pTerm, pSrc, notReady) ){ - int iCol = pTerm->u.x.leftColumn; - Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); + int iCol; + Bitmask cMask; + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); + iCol = pTerm->u.x.leftColumn; + cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS ); testcase( iCol==BMS-1 ); if( !sentWarning ){ sqlite3_log(SQLITE_WARNING_AUTOINDEX, "automatic index on %s(%s)", pTable->zName, - pTable->aCol[iCol].zName); + pTable->aCol[iCol].zCnName); sentWarning = 1; } if( (idxCols & cMask)==0 ){ @@ -150082,8 +152933,11 @@ static void constructAutomaticIndex( idxCols = 0; for(pTerm=pWC->a; pTermu.x.leftColumn; - Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); + int iCol; + Bitmask cMask; + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); + iCol = pTerm->u.x.leftColumn; + cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); testcase( iCol==BMS-1 ); testcase( iCol==BMS ); if( (idxCols & cMask)==0 ){ @@ -150125,6 +152979,10 @@ static void constructAutomaticIndex( sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "for %s", pTable->zName)); + if( OptimizationEnabled(pParse->db, SQLITE_BloomFilter) ){ + pLevel->regFilter = ++pParse->nMem; + sqlite3VdbeAddOp2(v, OP_Blob, 10000, pLevel->regFilter); + } /* Fill the automatic index with content */ pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; @@ -150147,6 +153005,10 @@ static void constructAutomaticIndex( regBase = sqlite3GenerateIndexKey( pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0 ); + if( pLevel->regFilter ){ + sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, + regBase, pLoop->u.btree.nEq); + } sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); @@ -150173,22 +153035,149 @@ end_auto_index_create: } #endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ +/* +** Generate bytecode that will initialize a Bloom filter that is appropriate +** for pLevel. +** +** If there are inner loops within pLevel that have the WHERE_BLOOMFILTER +** flag set, initialize a Bloomfilter for them as well. Except don't do +** this recursive initialization if the SQLITE_BloomPulldown optimization has +** been turned off. +** +** When the Bloom filter is initialized, the WHERE_BLOOMFILTER flag is cleared +** from the loop, but the regFilter value is set to a register that implements +** the Bloom filter. When regFilter is positive, the +** sqlite3WhereCodeOneLoopStart() will generate code to test the Bloom filter +** and skip the subsequence B-Tree seek if the Bloom filter indicates that +** no matching rows exist. +** +** This routine may only be called if it has previously been determined that +** the loop would benefit from a Bloom filter, and the WHERE_BLOOMFILTER bit +** is set. +*/ +static SQLITE_NOINLINE void sqlite3ConstructBloomFilter( + WhereInfo *pWInfo, /* The WHERE clause */ + int iLevel, /* Index in pWInfo->a[] that is pLevel */ + WhereLevel *pLevel, /* Make a Bloom filter for this FROM term */ + Bitmask notReady /* Loops that are not ready */ +){ + int addrOnce; /* Address of opening OP_Once */ + int addrTop; /* Address of OP_Rewind */ + int addrCont; /* Jump here to skip a row */ + const WhereTerm *pTerm; /* For looping over WHERE clause terms */ + const WhereTerm *pWCEnd; /* Last WHERE clause term */ + Parse *pParse = pWInfo->pParse; /* Parsing context */ + Vdbe *v = pParse->pVdbe; /* VDBE under construction */ + WhereLoop *pLoop = pLevel->pWLoop; /* The loop being coded */ + int iCur; /* Cursor for table getting the filter */ + + assert( pLoop!=0 ); + assert( v!=0 ); + assert( pLoop->wsFlags & WHERE_BLOOMFILTER ); + + addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); + do{ + const SrcItem *pItem; + const Table *pTab; + u64 sz; + sqlite3WhereExplainBloomFilter(pParse, pWInfo, pLevel); + addrCont = sqlite3VdbeMakeLabel(pParse); + iCur = pLevel->iTabCur; + pLevel->regFilter = ++pParse->nMem; + + /* The Bloom filter is a Blob held in a register. Initialize it + ** to zero-filled blob of at least 80K bits, but maybe more if the + ** estimated size of the table is larger. We could actually + ** measure the size of the table at run-time using OP_Count with + ** P3==1 and use that value to initialize the blob. But that makes + ** testing complicated. By basing the blob size on the value in the + ** sqlite_stat1 table, testing is much easier. + */ + pItem = &pWInfo->pTabList->a[pLevel->iFrom]; + assert( pItem!=0 ); + pTab = pItem->pTab; + assert( pTab!=0 ); + sz = sqlite3LogEstToInt(pTab->nRowLogEst); + if( sz<10000 ){ + sz = 10000; + }else if( sz>10000000 ){ + sz = 10000000; + } + sqlite3VdbeAddOp2(v, OP_Blob, (int)sz, pLevel->regFilter); + + addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, iCur); VdbeCoverage(v); + pWCEnd = &pWInfo->sWC.a[pWInfo->sWC.nTerm]; + for(pTerm=pWInfo->sWC.a; pTermpExpr; + if( (pTerm->wtFlags & TERM_VIRTUAL)==0 + && sqlite3ExprIsTableConstraint(pExpr, pItem) + ){ + sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); + } + } + if( pLoop->wsFlags & WHERE_IPK ){ + int r1 = sqlite3GetTempReg(pParse); + sqlite3VdbeAddOp2(v, OP_Rowid, iCur, r1); + sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, 1); + sqlite3ReleaseTempReg(pParse, r1); + }else{ + Index *pIdx = pLoop->u.btree.pIndex; + int n = pLoop->u.btree.nEq; + int r1 = sqlite3GetTempRange(pParse, n); + int jj; + for(jj=0; jjaiColumn[jj]; + assert( pIdx->pTable==pItem->pTab ); + sqlite3ExprCodeGetColumnOfTable(v, pIdx->pTable, iCur, iCol,r1+jj); + } + sqlite3VdbeAddOp4Int(v, OP_FilterAdd, pLevel->regFilter, 0, r1, n); + sqlite3ReleaseTempRange(pParse, r1, n); + } + sqlite3VdbeResolveLabel(v, addrCont); + sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); + VdbeCoverage(v); + sqlite3VdbeJumpHere(v, addrTop); + pLoop->wsFlags &= ~WHERE_BLOOMFILTER; + if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break; + while( ++iLevel < pWInfo->nLevel ){ + const SrcItem *pTabItem; + pLevel = &pWInfo->a[iLevel]; + pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; + if( pTabItem->fg.jointype & JT_LEFT ) continue; + pLoop = pLevel->pWLoop; + if( NEVER(pLoop==0) ) continue; + if( pLoop->prereq & notReady ) continue; + if( (pLoop->wsFlags & (WHERE_BLOOMFILTER|WHERE_COLUMN_IN)) + ==WHERE_BLOOMFILTER + ){ + /* This is a candidate for bloom-filter pull-down (early evaluation). + ** The test that WHERE_COLUMN_IN is omitted is important, as we are + ** not able to do early evaluation of bloom filters that make use of + ** the IN operator */ + break; + } + } + }while( iLevel < pWInfo->nLevel ); + sqlite3VdbeJumpHere(v, addrOnce); +} + + #ifndef SQLITE_OMIT_VIRTUALTABLE /* ** Allocate and populate an sqlite3_index_info structure. It is the ** responsibility of the caller to eventually release the structure -** by passing the pointer returned by this function to sqlite3_free(). +** by passing the pointer returned by this function to freeIndexInfo(). */ static sqlite3_index_info *allocateIndexInfo( - Parse *pParse, /* The parsing context */ + WhereInfo *pWInfo, /* The WHERE clause */ WhereClause *pWC, /* The WHERE clause being analyzed */ Bitmask mUnusable, /* Ignore terms with these prereqs */ SrcItem *pSrc, /* The FROM clause term that is the vtab */ - ExprList *pOrderBy, /* The ORDER BY clause */ u16 *pmNoOmit /* Mask of terms not to omit */ ){ int i, j; int nTerm; + Parse *pParse = pWInfo->pParse; struct sqlite3_index_constraint *pIdxCons; struct sqlite3_index_orderby *pIdxOrderBy; struct sqlite3_index_constraint_usage *pUsage; @@ -150197,10 +153186,21 @@ static sqlite3_index_info *allocateIndexInfo( int nOrderBy; sqlite3_index_info *pIdxInfo; u16 mNoOmit = 0; + const Table *pTab; + int eDistinct = 0; + ExprList *pOrderBy = pWInfo->pOrderBy; - /* Count the number of possible WHERE clause constraints referring - ** to this virtual table */ + assert( pSrc!=0 ); + pTab = pSrc->pTab; + assert( pTab!=0 ); + assert( IsVirtual(pTab) ); + + /* Find all WHERE clause constraints referring to this virtual table. + ** Mark each term with the TERM_OK flag. Set nTerm to the number of + ** terms found. + */ for(i=nTerm=0, pTerm=pWC->a; inTerm; i++, pTerm++){ + pTerm->wtFlags &= ~TERM_OK; if( pTerm->leftCursor != pSrc->iCursor ) continue; if( pTerm->prereqRight & mUnusable ) continue; assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); @@ -150210,8 +153210,21 @@ static sqlite3_index_info *allocateIndexInfo( testcase( pTerm->eOperator & WO_ALL ); if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue; if( pTerm->wtFlags & TERM_VNULL ) continue; - assert( pTerm->u.x.leftColumn>=(-1) ); + + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); + assert( pTerm->u.x.leftColumn>=XN_ROWID ); + assert( pTerm->u.x.leftColumnnCol ); + + /* tag-20191211-002: WHERE-clause constraints are not useful to the + ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the + ** equivalent restriction for ordinary tables. */ + if( (pSrc->fg.jointype & JT_LEFT)!=0 + && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) + ){ + continue; + } nTerm++; + pTerm->wtFlags |= TERM_OK; } /* If the ORDER BY clause contains only columns in the current @@ -150223,11 +153236,47 @@ static sqlite3_index_info *allocateIndexInfo( int n = pOrderBy->nExpr; for(i=0; ia[i].pExpr; - if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break; + Expr *pE2; + + /* Skip over constant terms in the ORDER BY clause */ + if( sqlite3ExprIsConstant(pExpr) ){ + continue; + } + + /* Virtual tables are unable to deal with NULLS FIRST */ if( pOrderBy->a[i].sortFlags & KEYINFO_ORDER_BIGNULL ) break; + + /* First case - a direct column references without a COLLATE operator */ + if( pExpr->op==TK_COLUMN && pExpr->iTable==pSrc->iCursor ){ + assert( pExpr->iColumn>=XN_ROWID && pExpr->iColumnnCol ); + continue; + } + + /* 2nd case - a column reference with a COLLATE operator. Only match + ** of the COLLATE operator matches the collation of the column. */ + if( pExpr->op==TK_COLLATE + && (pE2 = pExpr->pLeft)->op==TK_COLUMN + && pE2->iTable==pSrc->iCursor + ){ + const char *zColl; /* The collating sequence name */ + assert( !ExprHasProperty(pExpr, EP_IntValue) ); + assert( pExpr->u.zToken!=0 ); + assert( pE2->iColumn>=XN_ROWID && pE2->iColumnnCol ); + pExpr->iColumn = pE2->iColumn; + if( pE2->iColumn<0 ) continue; /* Collseq does not matter for rowid */ + zColl = sqlite3ColumnColl(&pTab->aCol[pE2->iColumn]); + if( zColl==0 ) zColl = sqlite3StrBINARY; + if( sqlite3_stricmp(pExpr->u.zToken, zColl)==0 ) continue; + } + + /* No matches cause a break out of the loop */ + break; } - if( i==n){ + if( i==n ){ nOrderBy = n; + if( (pWInfo->wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY)) ){ + eDistinct = 1 + ((pWInfo->wctrlFlags & WHERE_DISTINCTBY)!=0); + } } } @@ -150235,46 +153284,35 @@ static sqlite3_index_info *allocateIndexInfo( */ pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo) + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm - + sizeof(*pIdxOrderBy)*nOrderBy + sizeof(*pHidden) ); + + sizeof(*pIdxOrderBy)*nOrderBy + sizeof(*pHidden) + + sizeof(sqlite3_value*)*nTerm ); if( pIdxInfo==0 ){ sqlite3ErrorMsg(pParse, "out of memory"); return 0; } pHidden = (struct HiddenIndexInfo*)&pIdxInfo[1]; - pIdxCons = (struct sqlite3_index_constraint*)&pHidden[1]; + pIdxCons = (struct sqlite3_index_constraint*)&pHidden->aRhs[nTerm]; pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm]; pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy]; - pIdxInfo->nOrderBy = nOrderBy; pIdxInfo->aConstraint = pIdxCons; pIdxInfo->aOrderBy = pIdxOrderBy; pIdxInfo->aConstraintUsage = pUsage; pHidden->pWC = pWC; pHidden->pParse = pParse; + pHidden->eDistinct = eDistinct; + pHidden->mIn = 0; for(i=j=0, pTerm=pWC->a; inTerm; i++, pTerm++){ u16 op; - if( pTerm->leftCursor != pSrc->iCursor ) continue; - if( pTerm->prereqRight & mUnusable ) continue; - assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); - testcase( pTerm->eOperator & WO_IN ); - testcase( pTerm->eOperator & WO_IS ); - testcase( pTerm->eOperator & WO_ISNULL ); - testcase( pTerm->eOperator & WO_ALL ); - if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue; - if( pTerm->wtFlags & TERM_VNULL ) continue; - - /* tag-20191211-002: WHERE-clause constraints are not useful to the - ** right-hand table of a LEFT JOIN. See tag-20191211-001 for the - ** equivalent restriction for ordinary tables. */ - if( (pSrc->fg.jointype & JT_LEFT)!=0 - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) - ){ - continue; - } - assert( pTerm->u.x.leftColumn>=(-1) ); + if( (pTerm->wtFlags & TERM_OK)==0 ) continue; pIdxCons[j].iColumn = pTerm->u.x.leftColumn; pIdxCons[j].iTermOffset = i; op = pTerm->eOperator & WO_ALL; - if( op==WO_IN ) op = WO_EQ; + if( op==WO_IN ){ + if( (pTerm->wtFlags & TERM_SLICE)==0 ){ + pHidden->mIn |= SMASKBIT32(j); + } + op = WO_EQ; + } if( op==WO_AUX ){ pIdxCons[j].op = pTerm->eMatchOp; }else if( op & (WO_ISNULL|WO_IS) ){ @@ -150307,17 +153345,42 @@ static sqlite3_index_info *allocateIndexInfo( j++; } + assert( j==nTerm ); pIdxInfo->nConstraint = j; - for(i=0; ia[i].pExpr; - pIdxOrderBy[i].iColumn = pExpr->iColumn; - pIdxOrderBy[i].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC; + if( sqlite3ExprIsConstant(pExpr) ) continue; + assert( pExpr->op==TK_COLUMN + || (pExpr->op==TK_COLLATE && pExpr->pLeft->op==TK_COLUMN + && pExpr->iColumn==pExpr->pLeft->iColumn) ); + pIdxOrderBy[j].iColumn = pExpr->iColumn; + pIdxOrderBy[j].desc = pOrderBy->a[i].sortFlags & KEYINFO_ORDER_DESC; + j++; } + pIdxInfo->nOrderBy = j; *pmNoOmit = mNoOmit; return pIdxInfo; } +/* +** Free an sqlite3_index_info structure allocated by allocateIndexInfo() +** and possibly modified by xBestIndex methods. +*/ +static void freeIndexInfo(sqlite3 *db, sqlite3_index_info *pIdxInfo){ + HiddenIndexInfo *pHidden; + int i; + assert( pIdxInfo!=0 ); + pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; + assert( pHidden->pParse!=0 ); + assert( pHidden->pParse->db==db ); + for(i=0; inConstraint; i++){ + sqlite3ValueFree(pHidden->aRhs[i]); /* IMP: R-14553-25174 */ + pHidden->aRhs[i] = 0; + } + sqlite3DbFree(db, pIdxInfo); +} + /* ** The table object reference passed as the second argument to this function ** must represent a virtual table. This function invokes the xBestIndex() @@ -150339,7 +153402,9 @@ static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ int rc; whereTraceIndexInfoInputs(p); + pParse->db->nSchemaLock++; rc = pVtab->pModule->xBestIndex(pVtab, p); + pParse->db->nSchemaLock--; whereTraceIndexInfoOutputs(p); if( rc!=SQLITE_OK && rc!=SQLITE_CONSTRAINT ){ @@ -151033,6 +154098,7 @@ SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){ if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L'; if( pTerm->wtFlags & TERM_CODED ) zType[3] = 'C'; if( pTerm->eOperator & WO_SINGLE ){ + assert( (pTerm->eOperator & (WO_OR|WO_AND))==0 ); sqlite3_snprintf(sizeof(zLeft),zLeft,"left={%d:%d}", pTerm->leftCursor, pTerm->u.x.leftColumn); }else if( (pTerm->eOperator & WO_OR)!=0 && pTerm->u.pOrInfo!=0 ){ @@ -151050,7 +154116,7 @@ SQLITE_PRIVATE void sqlite3WhereTermPrint(WhereTerm *pTerm, int iTerm){ sqlite3DebugPrintf(" prob=%-3d prereq=%llx,%llx", pTerm->truthProb, (u64)pTerm->prereqAll, (u64)pTerm->prereqRight); } - if( pTerm->u.x.iField ){ + if( (pTerm->eOperator & (WO_OR|WO_AND))==0 && pTerm->u.x.iField ){ sqlite3DebugPrintf(" iField=%d", pTerm->u.x.iField); } if( pTerm->iParent>=0 ){ @@ -151112,9 +154178,9 @@ SQLITE_PRIVATE void sqlite3WhereLoopPrint(WhereLoop *p, WhereClause *pWC){ sqlite3_free(z); } if( p->wsFlags & WHERE_SKIPSCAN ){ - sqlite3DebugPrintf(" f %05x %d-%d", p->wsFlags, p->nLTerm,p->nSkip); + sqlite3DebugPrintf(" f %06x %d-%d", p->wsFlags, p->nLTerm,p->nSkip); }else{ - sqlite3DebugPrintf(" f %05x N %d", p->wsFlags, p->nLTerm); + sqlite3DebugPrintf(" f %06x N %d", p->wsFlags, p->nLTerm); } sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ @@ -151214,7 +154280,8 @@ static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){ assert( pWInfo!=0 ); for(i=0; inLevel; i++){ WhereLevel *pLevel = &pWInfo->a[i]; - if( pLevel->pWLoop && (pLevel->pWLoop->wsFlags & WHERE_IN_ABLE) ){ + if( pLevel->pWLoop && (pLevel->pWLoop->wsFlags & WHERE_IN_ABLE)!=0 ){ + assert( (pLevel->pWLoop->wsFlags & WHERE_MULTI_OR)==0 ); sqlite3DbFree(db, pLevel->u.in.aInLoop); } } @@ -151242,7 +154309,8 @@ static void whereUndoExprMods(WhereInfo *pWInfo){ /* ** Return TRUE if all of the following are true: ** -** (1) X has the same or lower cost that Y +** (1) X has the same or lower cost, or returns the same or fewer rows, +** than Y. ** (2) X uses fewer WHERE clause terms than Y ** (3) Every WHERE clause term used by X is also used by Y ** (4) X skips at least as many columns as Y @@ -151265,11 +154333,8 @@ static int whereLoopCheaperProperSubset( if( pX->nLTerm-pX->nSkip >= pY->nLTerm-pY->nSkip ){ return 0; /* X is not a subset of Y */ } + if( pX->rRun>pY->rRun && pX->nOut>pY->nOut ) return 0; if( pY->nSkip > pX->nSkip ) return 0; - if( pX->rRun >= pY->rRun ){ - if( pX->rRun > pY->rRun ) return 0; /* X costs more than Y */ - if( pX->nOut > pY->nOut ) return 0; /* X costs more than Y */ - } for(i=pX->nLTerm-1; i>=0; i--){ if( pX->aLTerm[i]==0 ) continue; for(j=pY->nLTerm-1; j>=0; j--){ @@ -151285,8 +154350,8 @@ static int whereLoopCheaperProperSubset( } /* -** Try to adjust the cost of WhereLoop pTemplate upwards or downwards so -** that: +** Try to adjust the cost and number of output rows of WhereLoop pTemplate +** upwards or downwards so that: ** ** (1) pTemplate costs less than any other WhereLoops that are a proper ** subset of pTemplate @@ -151307,16 +154372,20 @@ static void whereLoopAdjustCost(const WhereLoop *p, WhereLoop *pTemplate){ /* Adjust pTemplate cost downward so that it is cheaper than its ** subset p. */ WHERETRACE(0x80,("subset cost adjustment %d,%d to %d,%d\n", - pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut-1)); - pTemplate->rRun = p->rRun; - pTemplate->nOut = p->nOut - 1; + pTemplate->rRun, pTemplate->nOut, + MIN(p->rRun, pTemplate->rRun), + MIN(p->nOut - 1, pTemplate->nOut))); + pTemplate->rRun = MIN(p->rRun, pTemplate->rRun); + pTemplate->nOut = MIN(p->nOut - 1, pTemplate->nOut); }else if( whereLoopCheaperProperSubset(pTemplate, p) ){ /* Adjust pTemplate cost upward so that it is costlier than p since ** pTemplate is a proper subset of p */ WHERETRACE(0x80,("subset cost adjustment %d,%d to %d,%d\n", - pTemplate->rRun, pTemplate->nOut, p->rRun, p->nOut+1)); - pTemplate->rRun = p->rRun; - pTemplate->nOut = p->nOut + 1; + pTemplate->rRun, pTemplate->nOut, + MAX(p->rRun, pTemplate->rRun), + MAX(p->nOut + 1, pTemplate->nOut))); + pTemplate->rRun = MAX(p->rRun, pTemplate->rRun); + pTemplate->nOut = MAX(p->nOut + 1, pTemplate->nOut); } } } @@ -151571,11 +154640,11 @@ static void whereLoopOutputAdjust( LogEst iReduce = 0; /* pLoop->nOut should not exceed nRow-iReduce */ assert( (pLoop->wsFlags & WHERE_AUTO_INDEX)==0 ); - for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){ + for(i=pWC->nBase, pTerm=pWC->a; i>0; i--, pTerm++){ assert( pTerm!=0 ); - if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break; - if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue; if( (pTerm->prereqAll & notAllowed)!=0 ) continue; + if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue; + if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) continue; for(j=pLoop->nLTerm-1; j>=0; j--){ pX = pLoop->aLTerm[j]; if( pX==0 ) continue; @@ -151583,6 +154652,22 @@ static void whereLoopOutputAdjust( if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break; } if( j<0 ){ + if( pLoop->maskSelf==pTerm->prereqAll ){ + /* If there are extra terms in the WHERE clause not used by an index + ** that depend only on the table being scanned, and that will tend to + ** cause many rows to be omitted, then mark that table as + ** "self-culling". + ** + ** 2022-03-24: Self-culling only applies if either the extra terms + ** are straight comparison operators that are non-true with NULL + ** operand, or if the loop is not a LEFT JOIN. + */ + if( (pTerm->eOperator & 0x3f)!=0 + || (pWC->pWInfo->pTabList->a[pLoop->iTab].fg.jointype & JT_LEFT)==0 + ){ + pLoop->wsFlags |= WHERE_SELFCULL; + } + } if( pTerm->truthProb<=0 ){ /* If a truth probability is specified using the likelihood() hints, ** then use the probability provided by the application. */ @@ -151610,7 +154695,9 @@ static void whereLoopOutputAdjust( } } } - if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce; + if( pLoop->nOut > nRow-iReduce ){ + pLoop->nOut = nRow - iReduce; + } } /* @@ -151647,9 +154734,12 @@ static int whereRangeVectorLen( char aff; /* Comparison affinity */ char idxaff = 0; /* Indexed columns affinity */ CollSeq *pColl; /* Comparison collation sequence */ - Expr *pLhs = pTerm->pExpr->pLeft->x.pList->a[i].pExpr; - Expr *pRhs = pTerm->pExpr->pRight; - if( pRhs->flags & EP_xIsSelect ){ + Expr *pLhs, *pRhs; + + assert( ExprUseXList(pTerm->pExpr->pLeft) ); + pLhs = pTerm->pExpr->pLeft->x.pList->a[i].pExpr; + pRhs = pTerm->pExpr->pRight; + if( ExprUseXSelect(pRhs) ){ pRhs = pRhs->x.pSelect->pEList->a[i].pExpr; }else{ pRhs = pRhs->x.pList->a[i].pExpr; @@ -151810,7 +154900,7 @@ static int whereLoopAddBtreeIndex( if( eOp & WO_IN ){ Expr *pExpr = pTerm->pExpr; - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ + if( ExprUseXSelect(pExpr) ){ /* "x IN (SELECT ...)": TUNING: the SELECT returns 25 rows */ int i; nIn = 46; assert( 46==sqlite3LogEst(25) ); @@ -151951,7 +155041,7 @@ static int whereLoopAddBtreeIndex( if( nInMul==0 && pProbe->nSample && ALWAYS(pNew->u.btree.nEq<=pProbe->nSampleCol) - && ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect)) + && ((eOp & WO_IN)==0 || ExprUseXList(pTerm->pExpr)) && OptimizationEnabled(db, SQLITE_Stat4) ){ Expr *pExpr = pTerm->pExpr; @@ -152152,7 +155242,7 @@ static int whereUsablePartialIndex( for(i=0, pTerm=pWC->a; inTerm; i++, pTerm++){ Expr *pExpr; pExpr = pTerm->pExpr; - if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) + if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->w.iRightJoinTable==iTab) && (isLeft==0 || ExprHasProperty(pExpr, EP_FromJoin)) && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) && (pTerm->wtFlags & TERM_VNULL)==0 @@ -152215,7 +155305,6 @@ static int whereLoopAddBtree( int iSortIdx = 1; /* Index number */ int b; /* A boolean value */ LogEst rSize; /* number of rows in the table */ - LogEst rLogSize; /* Logarithm of the number of rows in the table */ WhereClause *pWC; /* The parsed WHERE clause */ Table *pTab; /* Table being queried */ @@ -152228,6 +155317,7 @@ static int whereLoopAddBtree( assert( !IsVirtual(pSrc->pTab) ); if( pSrc->fg.isIndexedBy ){ + assert( pSrc->fg.isCte==0 ); /* An INDEXED BY clause specifies a particular index to use */ pProbe = pSrc->u2.pIBIndex; }else if( !HasRowid(pTab) ){ @@ -152258,7 +155348,6 @@ static int whereLoopAddBtree( pProbe = &sPk; } rSize = pTab->nRowLogEst; - rLogSize = estLog(rSize); #ifndef SQLITE_OMIT_AUTOMATIC_INDEX /* Automatic indexes */ @@ -152272,8 +155361,10 @@ static int whereLoopAddBtree( && !pSrc->fg.isRecursive /* Not a recursive common table expression. */ ){ /* Generate auto-index WhereLoops */ + LogEst rLogSize; /* Logarithm of the number of rows in the table */ WhereTerm *pTerm; WhereTerm *pWCEnd = pWC->a + pWC->nTerm; + rLogSize = estLog(rSize); for(pTerm=pWC->a; rc==SQLITE_OK && pTermprereqRight & pNew->maskSelf ) continue; if( termCanDriveIndex(pTerm, pSrc, 0) ){ @@ -152291,7 +155382,7 @@ static int whereLoopAddBtree( ** those objects, since there is no opportunity to add schema ** indexes on subqueries and views. */ pNew->rSetup = rLogSize + rSize; - if( pTab->pSelect==0 && (pTab->tabFlags & TF_Ephemeral)==0 ){ + if( !IsView(pTab) && (pTab->tabFlags & TF_Ephemeral)==0 ){ pNew->rSetup += 28; }else{ pNew->rSetup -= 10; @@ -152453,6 +155544,15 @@ static int whereLoopAddBtree( #ifndef SQLITE_OMIT_VIRTUALTABLE +/* +** Return true if pTerm is a virtual table LIMIT or OFFSET term. +*/ +static int isLimitTerm(WhereTerm *pTerm){ + assert( pTerm->eOperator==WO_AUX || pTerm->eMatchOp==0 ); + return pTerm->eMatchOp>=SQLITE_INDEX_CONSTRAINT_LIMIT + && pTerm->eMatchOp<=SQLITE_INDEX_CONSTRAINT_OFFSET; +} + /* ** Argument pIdxInfo is already populated with all constraints that may ** be used by the virtual table identified by pBuilder->pNew->iTab. This @@ -152480,9 +155580,11 @@ static int whereLoopAddVirtualOne( u16 mExclude, /* Exclude terms using these operators */ sqlite3_index_info *pIdxInfo, /* Populated object for xBestIndex */ u16 mNoOmit, /* Do not omit these constraints */ - int *pbIn /* OUT: True if plan uses an IN(...) op */ + int *pbIn, /* OUT: True if plan uses an IN(...) op */ + int *pbRetryLimit /* OUT: Retry without LIMIT/OFFSET */ ){ WhereClause *pWC = pBuilder->pWC; + HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; struct sqlite3_index_constraint *pIdxCons; struct sqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage; int i; @@ -152505,6 +155607,7 @@ static int whereLoopAddVirtualOne( pIdxCons->usable = 0; if( (pTerm->prereqRight & mUsable)==pTerm->prereqRight && (pTerm->eOperator & mExclude)==0 + && (pbRetryLimit || !isLimitTerm(pTerm)) ){ pIdxCons->usable = 1; } @@ -152520,6 +155623,7 @@ static int whereLoopAddVirtualOne( pIdxInfo->estimatedRows = 25; pIdxInfo->idxFlags = 0; pIdxInfo->colUsed = (sqlite3_int64)pSrc->colUsed; + pHidden->mHandleIn = 0; /* Invoke the virtual table xBestIndex() method */ rc = vtabBestIndex(pParse, pSrc->pTab, pIdxInfo); @@ -152537,8 +155641,8 @@ static int whereLoopAddVirtualOne( mxTerm = -1; assert( pNew->nLSlot>=nConstraint ); - for(i=0; iaLTerm[i] = 0; - pNew->u.vtab.omitMask = 0; + memset(pNew->aLTerm, 0, sizeof(pNew->aLTerm[0])*nConstraint ); + memset(&pNew->u.vtab, 0, sizeof(pNew->u.vtab)); pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; for(i=0; ieMatchOp==SQLITE_INDEX_CONSTRAINT_OFFSET ){ + pNew->u.vtab.bOmitOffset = 1; + } } - if( (pTerm->eOperator & WO_IN)!=0 ){ + if( SMASKBIT32(i) & pHidden->mHandleIn ){ + pNew->u.vtab.mHandleIn |= MASKBIT32(iTerm); + }else if( (pTerm->eOperator & WO_IN)!=0 ){ /* A virtual table that is constrained by an IN clause may not ** consume the ORDER BY clause because (1) the order of IN terms ** is not necessarily related to the order of output terms and @@ -152583,6 +155692,21 @@ static int whereLoopAddVirtualOne( pIdxInfo->idxFlags &= ~SQLITE_INDEX_SCAN_UNIQUE; *pbIn = 1; assert( (mExclude & WO_IN)==0 ); } + + if( isLimitTerm(pTerm) && *pbIn ){ + /* If there is an IN(...) term handled as an == (separate call to + ** xFilter for each value on the RHS of the IN) and a LIMIT or + ** OFFSET term handled as well, the plan is unusable. Set output + ** variable *pbRetryLimit to true to tell the caller to retry with + ** LIMIT and OFFSET disabled. */ + if( pIdxInfo->needToFreeIdxStr ){ + sqlite3_free(pIdxInfo->idxStr); + pIdxInfo->idxStr = 0; + pIdxInfo->needToFreeIdxStr = 0; + } + *pbRetryLimit = 1; + return SQLITE_OK; + } } } @@ -152627,11 +155751,19 @@ static int whereLoopAddVirtualOne( } /* -** If this function is invoked from within an xBestIndex() callback, it -** returns a pointer to a buffer containing the name of the collation -** sequence associated with element iCons of the sqlite3_index_info.aConstraint -** array. Or, if iCons is out of range or there is no active xBestIndex -** call, return NULL. +** Return the collating sequence for a constraint passed into xBestIndex. +** +** pIdxInfo must be an sqlite3_index_info structure passed into xBestIndex. +** This routine depends on there being a HiddenIndexInfo structure immediately +** following the sqlite3_index_info structure. +** +** Return a pointer to the collation name: +** +** 1. If there is an explicit COLLATE operator on the constaint, return it. +** +** 2. Else, if the column has an alternative collation, return that. +** +** 3. Otherwise, return "BINARY". */ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int iCons){ HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; @@ -152648,6 +155780,88 @@ SQLITE_API const char *sqlite3_vtab_collation(sqlite3_index_info *pIdxInfo, int return zRet; } +/* +** Return true if constraint iCons is really an IN(...) constraint, or +** false otherwise. If iCons is an IN(...) constraint, set (if bHandle!=0) +** or clear (if bHandle==0) the flag to handle it using an iterator. +*/ +SQLITE_API int sqlite3_vtab_in(sqlite3_index_info *pIdxInfo, int iCons, int bHandle){ + HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; + u32 m = SMASKBIT32(iCons); + if( m & pHidden->mIn ){ + if( bHandle==0 ){ + pHidden->mHandleIn &= ~m; + }else if( bHandle>0 ){ + pHidden->mHandleIn |= m; + } + return 1; + } + return 0; +} + +/* +** This interface is callable from within the xBestIndex callback only. +** +** If possible, set (*ppVal) to point to an object containing the value +** on the right-hand-side of constraint iCons. +*/ +SQLITE_API int sqlite3_vtab_rhs_value( + sqlite3_index_info *pIdxInfo, /* Copy of first argument to xBestIndex */ + int iCons, /* Constraint for which RHS is wanted */ + sqlite3_value **ppVal /* Write value extracted here */ +){ + HiddenIndexInfo *pH = (HiddenIndexInfo*)&pIdxInfo[1]; + sqlite3_value *pVal = 0; + int rc = SQLITE_OK; + if( iCons<0 || iCons>=pIdxInfo->nConstraint ){ + rc = SQLITE_MISUSE; /* EV: R-30545-25046 */ + }else{ + if( pH->aRhs[iCons]==0 ){ + WhereTerm *pTerm = &pH->pWC->a[pIdxInfo->aConstraint[iCons].iTermOffset]; + rc = sqlite3ValueFromExpr( + pH->pParse->db, pTerm->pExpr->pRight, ENC(pH->pParse->db), + SQLITE_AFF_BLOB, &pH->aRhs[iCons] + ); + testcase( rc!=SQLITE_OK ); + } + pVal = pH->aRhs[iCons]; + } + *ppVal = pVal; + + if( rc==SQLITE_OK && pVal==0 ){ /* IMP: R-19933-32160 */ + rc = SQLITE_NOTFOUND; /* IMP: R-36424-56542 */ + } + + return rc; +} + +/* +** Return true if ORDER BY clause may be handled as DISTINCT. +*/ +SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info *pIdxInfo){ + HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; + assert( pHidden->eDistinct==0 + || pHidden->eDistinct==1 + || pHidden->eDistinct==2 ); + return pHidden->eDistinct; +} + +#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \ + && !defined(SQLITE_OMIT_VIRTUALTABLE) +/* +** Cause the prepared statement that is associated with a call to +** xBestIndex to open write transactions on all attached schemas. +** This is used by the (built-in) sqlite_dbpage virtual table. +*/ +SQLITE_PRIVATE void sqlite3VtabWriteAll(sqlite3_index_info *pIdxInfo){ + HiddenIndexInfo *pHidden = (HiddenIndexInfo*)&pIdxInfo[1]; + Parse *pParse = pHidden->pParse; + int nDb = pParse->db->nDb; + int i; + for(i=0; ipNew->iTab. That table is guaranteed to be a virtual table. @@ -152689,6 +155903,7 @@ static int whereLoopAddVirtual( WhereLoop *pNew; Bitmask mBest; /* Tables used by best possible plan */ u16 mNoOmit; + int bRetry = 0; /* True to retry with LIMIT/OFFSET disabled */ assert( (mPrereq & mUnusable)==0 ); pWInfo = pBuilder->pWInfo; @@ -152697,8 +155912,7 @@ static int whereLoopAddVirtual( pNew = pBuilder->pNew; pSrc = &pWInfo->pTabList->a[pNew->iTab]; assert( IsVirtual(pSrc->pTab) ); - p = allocateIndexInfo(pParse, pWC, mUnusable, pSrc, pBuilder->pOrderBy, - &mNoOmit); + p = allocateIndexInfo(pWInfo, pWC, mUnusable, pSrc, &mNoOmit); if( p==0 ) return SQLITE_NOMEM_BKPT; pNew->rSetup = 0; pNew->wsFlags = WHERE_VIRTUALTABLE; @@ -152706,14 +155920,22 @@ static int whereLoopAddVirtual( pNew->u.vtab.needFree = 0; nConstraint = p->nConstraint; if( whereLoopResize(pParse->db, pNew, nConstraint) ){ - sqlite3DbFree(pParse->db, p); + freeIndexInfo(pParse->db, p); return SQLITE_NOMEM_BKPT; } /* First call xBestIndex() with all constraints usable. */ WHERETRACE(0x800, ("BEGIN %s.addVirtual()\n", pSrc->pTab->zName)); WHERETRACE(0x40, (" VirtualOne: all usable\n")); - rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn); + rc = whereLoopAddVirtualOne( + pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn, &bRetry + ); + if( bRetry ){ + assert( rc==SQLITE_OK ); + rc = whereLoopAddVirtualOne( + pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn, 0 + ); + } /* If the call to xBestIndex() with all terms enabled produced a plan ** that does not require any source tables (IOW: a plan with mBest==0) @@ -152731,7 +155953,7 @@ static int whereLoopAddVirtual( if( bIn ){ WHERETRACE(0x40, (" VirtualOne: all usable w/o IN\n")); rc = whereLoopAddVirtualOne( - pBuilder, mPrereq, ALLBITS, WO_IN, p, mNoOmit, &bIn); + pBuilder, mPrereq, ALLBITS, WO_IN, p, mNoOmit, &bIn, 0); assert( bIn==0 ); mBestNoIn = pNew->prereq & ~mPrereq; if( mBestNoIn==0 ){ @@ -152758,7 +155980,7 @@ static int whereLoopAddVirtual( WHERETRACE(0x40, (" VirtualOne: mPrev=%04llx mNext=%04llx\n", (sqlite3_uint64)mPrev, (sqlite3_uint64)mNext)); rc = whereLoopAddVirtualOne( - pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn); + pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn, 0); if( pNew->prereq==mPrereq ){ seenZero = 1; if( bIn==0 ) seenZeroNoIN = 1; @@ -152771,7 +155993,7 @@ static int whereLoopAddVirtual( if( rc==SQLITE_OK && seenZero==0 ){ WHERETRACE(0x40, (" VirtualOne: all disabled\n")); rc = whereLoopAddVirtualOne( - pBuilder, mPrereq, mPrereq, 0, p, mNoOmit, &bIn); + pBuilder, mPrereq, mPrereq, 0, p, mNoOmit, &bIn, 0); if( bIn==0 ) seenZeroNoIN = 1; } @@ -152781,12 +156003,12 @@ static int whereLoopAddVirtual( if( rc==SQLITE_OK && seenZeroNoIN==0 ){ WHERETRACE(0x40, (" VirtualOne: all disabled and w/o IN\n")); rc = whereLoopAddVirtualOne( - pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn); + pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn, 0); } } if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr); - sqlite3DbFreeNN(pParse->db, p); + freeIndexInfo(pParse->db, p); WHERETRACE(0x800, ("END %s.addVirtual(), rc=%d\n", pSrc->pTab->zName, rc)); return rc; } @@ -152830,7 +156052,6 @@ static int whereLoopAddOr( int i, j; sSubBuild = *pBuilder; - sSubBuild.pOrderBy = 0; sSubBuild.pOrSet = &sCur; WHERETRACE(0x200, ("Begin processing OR-clause %p\n", pTerm)); @@ -152842,6 +156063,7 @@ static int whereLoopAddOr( tempWC.pOuter = pWC; tempWC.op = TK_AND; tempWC.nTerm = 1; + tempWC.nBase = 1; tempWC.a = pOrTerm; sSubBuild.pWC = &tempWC; }else{ @@ -153313,7 +156535,7 @@ static i8 wherePathSatisfiesOrderBy( if( obSat==obDone ) return (i8)nOrderBy; if( !isOrderDistinct ){ for(i=nOrderBy-1; i>0; i--){ - Bitmask m = MASKBIT(i) - 1; + Bitmask m = ALWAYS(ipWInfo; if( pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE ) return 0; @@ -153836,7 +157059,8 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ pLoop = pBuilder->pNew; pLoop->wsFlags = 0; pLoop->nSkip = 0; - pTerm = sqlite3WhereFindTerm(pWC, iCur, -1, 0, WO_EQ|WO_IS, 0); + pTerm = whereScanInit(&scan, pWC, iCur, -1, WO_EQ|WO_IS, 0); + while( pTerm && pTerm->prereqRight ) pTerm = whereScanNext(&scan); if( pTerm ){ testcase( pTerm->eOperator & WO_IS ); pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW; @@ -153855,7 +157079,8 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ ) continue; opMask = pIdx->uniqNotNull ? (WO_EQ|WO_IS) : WO_EQ; for(j=0; jnKeyCol; j++){ - pTerm = sqlite3WhereFindTerm(pWC, iCur, j, 0, opMask, pIdx); + pTerm = whereScanInit(&scan, pWC, iCur, j, opMask, pIdx); + while( pTerm && pTerm->prereqRight ) pTerm = whereScanNext(&scan); if( pTerm==0 ) break; testcase( pTerm->eOperator & WO_IS ); pLoop->aLTerm[j] = pTerm; @@ -153884,8 +157109,14 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){ if( pWInfo->wctrlFlags & WHERE_WANT_DISTINCT ){ pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; } + if( scan.iEquiv>1 ) pLoop->wsFlags |= WHERE_TRANSCONS; #ifdef SQLITE_DEBUG pLoop->cId = '0'; +#endif +#ifdef WHERETRACE_ENABLED + if( sqlite3WhereTrace ){ + sqlite3DebugPrintf("whereShortCut() used to compute solution\n"); + } #endif return 1; } @@ -153940,6 +157171,150 @@ static void showAllWhereLoops(WhereInfo *pWInfo, WhereClause *pWC){ # define WHERETRACE_ALL_LOOPS(W,C) #endif +/* Attempt to omit tables from a join that do not affect the result. +** For a table to not affect the result, the following must be true: +** +** 1) The query must not be an aggregate. +** 2) The table must be the RHS of a LEFT JOIN. +** 3) Either the query must be DISTINCT, or else the ON or USING clause +** must contain a constraint that limits the scan of the table to +** at most a single row. +** 4) The table must not be referenced by any part of the query apart +** from its own USING or ON clause. +** +** For example, given: +** +** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1); +** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2); +** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3); +** +** then table t2 can be omitted from the following: +** +** SELECT v1, v3 FROM t1 +** LEFT JOIN t2 ON (t1.ipk=t2.ipk) +** LEFT JOIN t3 ON (t1.ipk=t3.ipk) +** +** or from: +** +** SELECT DISTINCT v1, v3 FROM t1 +** LEFT JOIN t2 +** LEFT JOIN t3 ON (t1.ipk=t3.ipk) +*/ +static SQLITE_NOINLINE Bitmask whereOmitNoopJoin( + WhereInfo *pWInfo, + Bitmask notReady +){ + int i; + Bitmask tabUsed; + + /* Preconditions checked by the caller */ + assert( pWInfo->nLevel>=2 ); + assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_OmitNoopJoin) ); + + /* These two preconditions checked by the caller combine to guarantee + ** condition (1) of the header comment */ + assert( pWInfo->pResultSet!=0 ); + assert( 0==(pWInfo->wctrlFlags & WHERE_AGG_DISTINCT) ); + + tabUsed = sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pResultSet); + if( pWInfo->pOrderBy ){ + tabUsed |= sqlite3WhereExprListUsage(&pWInfo->sMaskSet, pWInfo->pOrderBy); + } + for(i=pWInfo->nLevel-1; i>=1; i--){ + WhereTerm *pTerm, *pEnd; + SrcItem *pItem; + WhereLoop *pLoop; + pLoop = pWInfo->a[i].pWLoop; + pItem = &pWInfo->pTabList->a[pLoop->iTab]; + if( (pItem->fg.jointype & JT_LEFT)==0 ) continue; + if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)==0 + && (pLoop->wsFlags & WHERE_ONEROW)==0 + ){ + continue; + } + if( (tabUsed & pLoop->maskSelf)!=0 ) continue; + pEnd = pWInfo->sWC.a + pWInfo->sWC.nTerm; + for(pTerm=pWInfo->sWC.a; pTermprereqAll & pLoop->maskSelf)!=0 ){ + if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin) + || pTerm->pExpr->w.iRightJoinTable!=pItem->iCursor + ){ + break; + } + } + } + if( pTerm drop loop %c not used\n", pLoop->cId)); + notReady &= ~pLoop->maskSelf; + for(pTerm=pWInfo->sWC.a; pTermprereqAll & pLoop->maskSelf)!=0 ){ + pTerm->wtFlags |= TERM_CODED; + } + } + if( i!=pWInfo->nLevel-1 ){ + int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel); + memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte); + } + pWInfo->nLevel--; + assert( pWInfo->nLevel>0 ); + } + return notReady; +} + +/* +** Check to see if there are any SEARCH loops that might benefit from +** using a Bloom filter. Consider a Bloom filter if: +** +** (1) The SEARCH happens more than N times where N is the number +** of rows in the table that is being considered for the Bloom +** filter. +** (2) Some searches are expected to find zero rows. (This is determined +** by the WHERE_SELFCULL flag on the term.) +** (3) Bloom-filter processing is not disabled. (Checked by the +** caller.) +** (4) The size of the table being searched is known by ANALYZE. +** +** This block of code merely checks to see if a Bloom filter would be +** appropriate, and if so sets the WHERE_BLOOMFILTER flag on the +** WhereLoop. The implementation of the Bloom filter comes further +** down where the code for each WhereLoop is generated. +*/ +static SQLITE_NOINLINE void whereCheckIfBloomFilterIsUseful( + const WhereInfo *pWInfo +){ + int i; + LogEst nSearch; + + assert( pWInfo->nLevel>=2 ); + assert( OptimizationEnabled(pWInfo->pParse->db, SQLITE_BloomFilter) ); + nSearch = pWInfo->a[0].pWLoop->nOut; + for(i=1; inLevel; i++){ + WhereLoop *pLoop = pWInfo->a[i].pWLoop; + const unsigned int reqFlags = (WHERE_SELFCULL|WHERE_COLUMN_EQ); + if( (pLoop->wsFlags & reqFlags)==reqFlags + /* vvvvvv--- Always the case if WHERE_COLUMN_EQ is defined */ + && ALWAYS((pLoop->wsFlags & (WHERE_IPK|WHERE_INDEXED))!=0) + ){ + SrcItem *pItem = &pWInfo->pTabList->a[pLoop->iTab]; + Table *pTab = pItem->pTab; + pTab->tabFlags |= TF_StatsUsed; + if( nSearch > pTab->nRowLogEst + && (pTab->tabFlags & TF_HasStat1)!=0 + ){ + testcase( pItem->fg.jointype & JT_LEFT ); + pLoop->wsFlags |= WHERE_BLOOMFILTER; + pLoop->wsFlags &= ~WHERE_IDX_ONLY; + WHERETRACE(0xffff, ( + "-> use Bloom-filter on loop %c because there are ~%.1e " + "lookups into %s which has only ~%.1e rows\n", + pLoop->cId, (double)sqlite3LogEstToInt(nSearch), pTab->zName, + (double)sqlite3LogEstToInt(pTab->nRowLogEst))); + } + } + nSearch += pLoop->nOut; + } +} + /* ** Generate the beginning of the loop used for WHERE clause processing. ** The return value is a pointer to an opaque structure that contains @@ -154034,6 +157409,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( Expr *pWhere, /* The WHERE clause */ ExprList *pOrderBy, /* An ORDER BY (or GROUP BY) clause, or NULL */ ExprList *pResultSet, /* Query result set. Req'd for DISTINCT */ + Select *pLimit, /* Use this LIMIT/OFFSET clause, if any */ u16 wctrlFlags, /* The WHERE_* flags defined in sqliteInt.h */ int iAuxArg /* If WHERE_OR_SUBCLAUSE is set, index cursor number ** If WHERE_USE_LIMIT, then the limit amount */ @@ -154068,13 +157444,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( /* An ORDER/GROUP BY clause of more than 63 terms cannot be optimized */ testcase( pOrderBy && pOrderBy->nExpr==BMS-1 ); if( pOrderBy && pOrderBy->nExpr>=BMS ) pOrderBy = 0; - sWLB.pOrderBy = pOrderBy; - - /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via - ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ - if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){ - wctrlFlags &= ~WHERE_WANT_DISTINCT; - } /* The number of tables in the FROM clause is limited by the number of ** bits in a Bitmask @@ -154117,11 +157486,18 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( pWInfo->wctrlFlags = wctrlFlags; pWInfo->iLimit = iAuxArg; pWInfo->savedNQueryLoop = pParse->nQueryLoop; +#ifndef SQLITE_OMIT_VIRTUALTABLE + pWInfo->pLimit = pLimit; +#endif memset(&pWInfo->nOBSat, 0, offsetof(WhereInfo,sWC) - offsetof(WhereInfo,nOBSat)); memset(&pWInfo->a[0], 0, sizeof(WhereLoop)+nTabList*sizeof(WhereLevel)); assert( pWInfo->eOnePass==ONEPASS_OFF ); /* ONEPASS defaults to OFF */ pMaskSet = &pWInfo->sMaskSet; + pMaskSet->n = 0; + pMaskSet->ix[0] = -99; /* Initialize ix[0] to a value that can never be + ** a valid cursor number, to avoid an initial + ** test for pMaskSet->n==0 in sqlite3WhereGetMask() */ sWLB.pWInfo = pWInfo; sWLB.pWC = &pWInfo->sWC; sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo); @@ -154134,7 +157510,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( /* Split the WHERE clause into separate subexpressions where each ** subexpression is separated by an AND operator. */ - initMaskSet(pMaskSet); sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo); sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND); @@ -154142,7 +157517,9 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( */ if( nTabList==0 ){ if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr; - if( wctrlFlags & WHERE_WANT_DISTINCT ){ + if( (wctrlFlags & WHERE_WANT_DISTINCT)!=0 + && OptimizationEnabled(db, SQLITE_DistinctOpt) + ){ pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; } ExplainQueryPlan((pParse, 0, "SCAN CONSTANT ROW")); @@ -154180,6 +157557,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( /* Analyze all of the subexpressions. */ sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC); + sqlite3WhereAddLimit(&pWInfo->sWC, pLimit); if( db->mallocFailed ) goto whereBeginError; /* Special case: WHERE terms that do not refer to any tables in the join @@ -154193,7 +157571,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( ** FROM ... WHERE random()>0; -- eval random() once per row ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall */ - for(ii=0; iinTerm; ii++){ + for(ii=0; iinBase; ii++){ WhereTerm *pT = &sWLB.pWC->a[ii]; if( pT->wtFlags & TERM_VIRTUAL ) continue; if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){ @@ -154203,7 +157581,12 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( } if( wctrlFlags & WHERE_WANT_DISTINCT ){ - if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){ + if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){ + /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via + ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ + wctrlFlags &= ~WHERE_WANT_DISTINCT; + pWInfo->wctrlFlags &= ~WHERE_WANT_DISTINCT; + }else if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){ /* The DISTINCT marking is pointless. Ignore it. */ pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; }else if( pOrderBy==0 ){ @@ -154274,9 +157657,10 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){ pWInfo->revMask = ALLBITS; } - if( pParse->nErr || db->mallocFailed ){ + if( pParse->nErr ){ goto whereBeginError; } + assert( db->mallocFailed==0 ); #ifdef WHERETRACE_ENABLED if( sqlite3WhereTrace ){ sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); @@ -154304,34 +157688,15 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( } #endif - /* Attempt to omit tables from the join that do not affect the result. - ** For a table to not affect the result, the following must be true: - ** - ** 1) The query must not be an aggregate. - ** 2) The table must be the RHS of a LEFT JOIN. - ** 3) Either the query must be DISTINCT, or else the ON or USING clause - ** must contain a constraint that limits the scan of the table to - ** at most a single row. - ** 4) The table must not be referenced by any part of the query apart - ** from its own USING or ON clause. - ** - ** For example, given: - ** - ** CREATE TABLE t1(ipk INTEGER PRIMARY KEY, v1); - ** CREATE TABLE t2(ipk INTEGER PRIMARY KEY, v2); - ** CREATE TABLE t3(ipk INTEGER PRIMARY KEY, v3); + /* Attempt to omit tables from a join that do not affect the result. + ** See the comment on whereOmitNoopJoin() for further information. ** - ** then table t2 can be omitted from the following: - ** - ** SELECT v1, v3 FROM t1 - ** LEFT JOIN t2 ON (t1.ipk=t2.ipk) - ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) - ** - ** or from: - ** - ** SELECT DISTINCT v1, v3 FROM t1 - ** LEFT JOIN t2 - ** LEFT JOIN t3 ON (t1.ipk=t3.ipk) + ** This query optimization is factored out into a separate "no-inline" + ** procedure to keep the sqlite3WhereBegin() procedure from becoming + ** too large. If sqlite3WhereBegin() becomes too large, that prevents + ** some C-compiler optimizers from in-lining the + ** sqlite3WhereCodeOneLoopStart() procedure, and it is important to + ** in-line sqlite3WhereCodeOneLoopStart() for performance reasons. */ notReady = ~(Bitmask)0; if( pWInfo->nLevel>=2 @@ -154339,49 +157704,20 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( && 0==(wctrlFlags & WHERE_AGG_DISTINCT) /* condition (1) above */ && OptimizationEnabled(db, SQLITE_OmitNoopJoin) ){ - int i; - Bitmask tabUsed = sqlite3WhereExprListUsage(pMaskSet, pResultSet); - if( sWLB.pOrderBy ){ - tabUsed |= sqlite3WhereExprListUsage(pMaskSet, sWLB.pOrderBy); - } - for(i=pWInfo->nLevel-1; i>=1; i--){ - WhereTerm *pTerm, *pEnd; - SrcItem *pItem; - pLoop = pWInfo->a[i].pWLoop; - pItem = &pWInfo->pTabList->a[pLoop->iTab]; - if( (pItem->fg.jointype & JT_LEFT)==0 ) continue; - if( (wctrlFlags & WHERE_WANT_DISTINCT)==0 - && (pLoop->wsFlags & WHERE_ONEROW)==0 - ){ - continue; - } - if( (tabUsed & pLoop->maskSelf)!=0 ) continue; - pEnd = sWLB.pWC->a + sWLB.pWC->nTerm; - for(pTerm=sWLB.pWC->a; pTermprereqAll & pLoop->maskSelf)!=0 ){ - if( !ExprHasProperty(pTerm->pExpr, EP_FromJoin) - || pTerm->pExpr->iRightJoinTable!=pItem->iCursor - ){ - break; - } - } - } - if( pTerm drop loop %c not used\n", pLoop->cId)); - notReady &= ~pLoop->maskSelf; - for(pTerm=sWLB.pWC->a; pTermprereqAll & pLoop->maskSelf)!=0 ){ - pTerm->wtFlags |= TERM_CODED; - } - } - if( i!=pWInfo->nLevel-1 ){ - int nByte = (pWInfo->nLevel-1-i) * sizeof(WhereLevel); - memmove(&pWInfo->a[i], &pWInfo->a[i+1], nByte); - } - pWInfo->nLevel--; - nTabList--; - } + notReady = whereOmitNoopJoin(pWInfo, notReady); + nTabList = pWInfo->nLevel; + assert( nTabList>0 ); + } + + /* Check to see if there are any SEARCH loops that might benefit from + ** using a Bloom filter. + */ + if( pWInfo->nLevel>=2 + && OptimizationEnabled(db, SQLITE_BloomFilter) + ){ + whereCheckIfBloomFilterIsUseful(pWInfo); } + #if defined(WHERETRACE_ENABLED) if( sqlite3WhereTrace & 0x100 ){ /* Display all terms of the WHERE clause */ sqlite3DebugPrintf("---- WHERE clause at end of analysis:\n"); @@ -154442,7 +157778,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( pTab = pTabItem->pTab; iDb = sqlite3SchemaToIndex(db, pTab->pSchema); pLoop = pLevel->pWLoop; - if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){ + if( (pTab->tabFlags & TF_Ephemeral)!=0 || IsView(pTab) ){ /* Do nothing */ }else #ifndef SQLITE_OMIT_VIRTUALTABLE @@ -154468,6 +157804,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( if( pWInfo->eOnePass==ONEPASS_OFF && pTab->nColtabFlags & (TF_HasGenerated|TF_WithoutRowid))==0 + && (pLoop->wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))==0 ){ /* If we know that only a prefix of the record will be used, ** it is advantageous to reduce the "column count" field in @@ -154567,15 +157904,20 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( for(ii=0; iinErr ) goto whereBeginError; pLevel = &pWInfo->a[ii]; wsFlags = pLevel->pWLoop->wsFlags; + if( (wsFlags & (WHERE_AUTO_INDEX|WHERE_BLOOMFILTER))!=0 ){ + if( (wsFlags & WHERE_AUTO_INDEX)!=0 ){ #ifndef SQLITE_OMIT_AUTOMATIC_INDEX - if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){ - constructAutomaticIndex(pParse, &pWInfo->sWC, - &pTabList->a[pLevel->iFrom], notReady, pLevel); + constructAutomaticIndex(pParse, &pWInfo->sWC, + &pTabList->a[pLevel->iFrom], notReady, pLevel); +#endif + }else{ + sqlite3ConstructBloomFilter(pWInfo, ii, pLevel, notReady); + } if( db->mallocFailed ) goto whereBeginError; } -#endif addrExplain = sqlite3WhereExplainOneScan( pParse, pTabList, pLevel, wctrlFlags ); @@ -154623,6 +157965,26 @@ whereBeginError: } #endif +#ifdef SQLITE_DEBUG +/* +** Return true if cursor iCur is opened by instruction k of the +** bytecode. Used inside of assert() only. +*/ +static int cursorIsOpen(Vdbe *v, int iCur, int k){ + while( k>=0 ){ + VdbeOp *pOp = sqlite3VdbeGetOp(v,k--); + if( pOp->p1!=iCur ) continue; + if( pOp->opcode==OP_Close ) return 0; + if( pOp->opcode==OP_OpenRead ) return 1; + if( pOp->opcode==OP_OpenWrite ) return 1; + if( pOp->opcode==OP_OpenDup ) return 1; + if( pOp->opcode==OP_OpenAutoindex ) return 1; + if( pOp->opcode==OP_OpenEphemeral ) return 1; + } + return 0; +} +#endif /* SQLITE_DEBUG */ + /* ** Generate the end of the WHERE loop. See comments on ** sqlite3WhereBegin() for additional information. @@ -154688,7 +158050,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ }else{ sqlite3VdbeResolveLabel(v, pLevel->addrCont); } - if( pLoop->wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){ + if( (pLoop->wsFlags & WHERE_IN_ABLE)!=0 && pLevel->u.in.nIn>0 ){ struct InLoop *pIn; int j; sqlite3VdbeResolveLabel(v, pLevel->addrNxt); @@ -154757,8 +158119,14 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iTabCur); } if( (ws & WHERE_INDEXED) - || ((ws & WHERE_MULTI_OR) && pLevel->u.pCovidx) + || ((ws & WHERE_MULTI_OR) && pLevel->u.pCoveringIdx) ){ + if( ws & WHERE_MULTI_OR ){ + Index *pIx = pLevel->u.pCoveringIdx; + int iDb = sqlite3SchemaToIndex(db, pIx->pSchema); + sqlite3VdbeAddOp3(v, OP_ReopenIdx, pLevel->iIdxCur, pIx->tnum, iDb); + sqlite3VdbeSetP4KeyInfo(pParse, pIx); + } sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur); } if( pLevel->op==OP_Return ){ @@ -154805,7 +158173,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ** created for the ONEPASS optimization. */ if( (pTab->tabFlags & TF_Ephemeral)==0 - && pTab->pSelect==0 + && !IsView(pTab) && (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)==0 ){ int ws = pLoop->wsFlags; @@ -154835,7 +158203,7 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){ pIdx = pLoop->u.btree.pIndex; }else if( pLoop->wsFlags & WHERE_MULTI_OR ){ - pIdx = pLevel->u.pCovidx; + pIdx = pLevel->u.pCoveringIdx; } if( pIdx && !db->mallocFailed @@ -154869,6 +158237,11 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ ){ int x = pOp->p2; assert( pIdx->pTable==pTab ); +#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC + if( pOp->opcode==OP_Offset ){ + /* Do not need to translate the column number */ + }else +#endif if( !HasRowid(pTab) ){ Index *pPk = sqlite3PrimaryKeyIndex(pTab); x = pPk->aiColumn[x]; @@ -154882,9 +158255,22 @@ SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ pOp->p2 = x; pOp->p1 = pLevel->iIdxCur; OpcodeRewriteTrace(db, k, pOp); + }else{ + /* Unable to translate the table reference into an index + ** reference. Verify that this is harmless - that the + ** table being referenced really is open. + */ +#ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC + assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 + || cursorIsOpen(v,pOp->p1,k) + || pOp->opcode==OP_Offset + ); +#else + assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 + || cursorIsOpen(v,pOp->p1,k) + ); +#endif } - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 || x>=0 - || pWInfo->eOnePass ); }else if( pOp->opcode==OP_Rowid ){ pOp->p1 = pLevel->iIdxCur; pOp->opcode = OP_IdxRowid; @@ -155496,7 +158882,7 @@ static void noopValueFunc(sqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ } /* Window functions that use all window interfaces: xStep, xFinal, ** xValue, and xInverse */ #define WINDOWFUNCALL(name,nArg,extra) { \ - nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ + nArg, (SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ name ## StepFunc, name ## FinalizeFunc, name ## ValueFunc, \ name ## InvFunc, name ## Name, {0} \ } @@ -155504,7 +158890,7 @@ static void noopValueFunc(sqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ } /* Window functions that are implemented using bytecode and thus have ** no-op routines for their methods */ #define WINDOWFUNCNOOP(name,nArg,extra) { \ - nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ + nArg, (SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ noopStepFunc, noopValueFunc, noopValueFunc, \ noopStepFunc, name ## Name, {0} \ } @@ -155513,7 +158899,7 @@ static void noopValueFunc(sqlite3_context *p){ UNUSED_PARAMETER(p); /*no-op*/ } ** same routine for xFinalize and xValue and which never call ** xInverse. */ #define WINDOWFUNCX(name,nArg,extra) { \ - nArg, (SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ + nArg, (SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_WINDOW|extra), 0, 0, \ name ## StepFunc, name ## ValueFunc, name ## ValueFunc, \ noopStepFunc, name ## Name, {0} \ } @@ -155823,9 +159209,7 @@ static ExprList *exprListAppendList( if( bIntToNull ){ int iDummy; Expr *pSub; - for(pSub=pDup; ExprHasProperty(pSub, EP_Skip); pSub=pSub->pLeft){ - assert( pSub ); - } + pSub = sqlite3ExprSkipCollateAndLikely(pDup); if( sqlite3ExprIsInteger(pSub, &iDummy) ){ pSub->op = TK_NULL; pSub->flags &= ~(EP_IntValue|EP_IsTrue|EP_IsFalse); @@ -155858,7 +159242,8 @@ static int sqlite3WindowExtraAggFuncDepth(Walker *pWalker, Expr *pExpr){ static int disallowAggregatesInOrderByCb(Walker *pWalker, Expr *pExpr){ if( pExpr->op==TK_AGG_FUNCTION && pExpr->pAggInfo==0 ){ - sqlite3ErrorMsg(pWalker->pParse, + assert( !ExprHasProperty(pExpr, EP_IntValue) ); + sqlite3ErrorMsg(pWalker->pParse, "misuse of aggregate: %s()", pExpr->u.zToken); } return WRC_Continue; @@ -155873,7 +159258,11 @@ static int disallowAggregatesInOrderByCb(Walker *pWalker, Expr *pExpr){ */ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ int rc = SQLITE_OK; - if( p->pWin && p->pPrior==0 && ALWAYS((p->selFlags & SF_WinRewrite)==0) ){ + if( p->pWin + && p->pPrior==0 + && ALWAYS((p->selFlags & SF_WinRewrite)==0) + && ALWAYS(!IN_RENAME_OBJECT) + ){ Vdbe *v = sqlite3GetVdbe(pParse); sqlite3 *db = pParse->db; Select *pSub = 0; /* The subquery */ @@ -155946,7 +159335,10 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ ** window function - one for the accumulator, another for interim ** results. */ for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ - ExprList *pArgs = pWin->pOwner->x.pList; + ExprList *pArgs; + assert( ExprUseXList(pWin->pOwner) ); + assert( pWin->pFunc!=0 ); + pArgs = pWin->pOwner->x.pList; if( pWin->pFunc->funcFlags & SQLITE_FUNC_SUBTYPE ){ selectWindowRewriteEList(pParse, pMWin, pSrc, pArgs, pTab, &pSublist); pWin->iArgCol = (pSublist ? pSublist->nExpr : 0); @@ -155983,11 +159375,14 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ ("New window-function subquery in FROM clause of (%u/%p)\n", p->selId, p)); p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); + assert( pSub!=0 || p->pSrc==0 ); /* Due to db->mallocFailed test inside + ** of sqlite3DbMallocRawNN() called from + ** sqlite3SrcListAppend() */ if( p->pSrc ){ Table *pTab2; p->pSrc->a[0].pSelect = pSub; sqlite3SrcListAssignCursors(pParse, p->pSrc); - pSub->selFlags |= SF_Expanded; + pSub->selFlags |= SF_Expanded|SF_OrderByReqd; pTab2 = sqlite3ResultSetOfSelect(pParse, pSub, SQLITE_AFF_NONE); pSub->selFlags |= (selFlags & SF_Aggregate); if( pTab2==0 ){ @@ -156010,15 +159405,14 @@ SQLITE_PRIVATE int sqlite3WindowRewrite(Parse *pParse, Select *p){ sqlite3SelectDelete(db, pSub); } if( db->mallocFailed ) rc = SQLITE_NOMEM; - sqlite3DbFree(db, pTab); - } - if( rc ){ - if( pParse->nErr==0 ){ - assert( pParse->db->mallocFailed ); - sqlite3ErrorToParser(pParse->db, SQLITE_NOMEM); - } + /* Defer deleting the temporary table pTab because if an error occurred, + ** there could still be references to that table embedded in the + ** result-set or ORDER BY clause of the SELECT statement p. */ + sqlite3ParserAddCleanup(pParse, sqlite3DbFree, pTab); } + + assert( rc==SQLITE_OK || pParse->nErr!=0 ); return rc; } @@ -156259,7 +159653,12 @@ SQLITE_PRIVATE void sqlite3WindowLink(Select *pSel, Window *pWin){ ** different, or 2 if it cannot be determined if the objects are identical ** or not. Identical window objects can be processed in a single scan. */ -SQLITE_PRIVATE int sqlite3WindowCompare(Parse *pParse, Window *p1, Window *p2, int bFilter){ +SQLITE_PRIVATE int sqlite3WindowCompare( + const Parse *pParse, + const Window *p1, + const Window *p2, + int bFilter +){ int res; if( NEVER(p1==0) || NEVER(p2==0) ) return 1; if( p1->eFrmType!=p2->eFrmType ) return 1; @@ -156331,8 +159730,11 @@ SQLITE_PRIVATE void sqlite3WindowCodeInit(Parse *pParse, Select *pSelect){ ** regApp+1: integer value used to ensure keys are unique ** regApp+2: output of MakeRecord */ - ExprList *pList = pWin->pOwner->x.pList; - KeyInfo *pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pList, 0, 0); + ExprList *pList; + KeyInfo *pKeyInfo; + assert( ExprUseXList(pWin->pOwner) ); + pList = pWin->pOwner->x.pList; + pKeyInfo = sqlite3KeyInfoFromExprList(pParse, pList, 0, 0); pWin->csrApp = pParse->nTab++; pWin->regApp = pParse->nMem+1; pParse->nMem += 3; @@ -156420,7 +159822,9 @@ static void windowCheckValue(Parse *pParse, int reg, int eCond){ ** with the object passed as the only argument to this function. */ static int windowArgCount(Window *pWin){ - ExprList *pList = pWin->pOwner->x.pList; + const ExprList *pList; + assert( ExprUseXList(pWin->pOwner) ); + pList = pWin->pOwner->x.pList; return (pList ? pList->nExpr : 0); } @@ -156605,6 +160009,7 @@ static void windowAggStep( int addrIf = 0; if( pWin->pFilter ){ int regTmp; + assert( ExprUseXList(pWin->pOwner) ); assert( pWin->bExprArgs || !nArg ||nArg==pWin->pOwner->x.pList->nExpr ); assert( pWin->bExprArgs || nArg ||pWin->pOwner->x.pList==0 ); regTmp = sqlite3GetTempReg(pParse); @@ -156618,13 +160023,14 @@ static void windowAggStep( int iOp = sqlite3VdbeCurrentAddr(v); int iEnd; + assert( ExprUseXList(pWin->pOwner) ); nArg = pWin->pOwner->x.pList->nExpr; regArg = sqlite3GetTempRange(pParse, nArg); sqlite3ExprCodeExprList(pParse, pWin->pOwner->x.pList, regArg, 0, 0); for(iEnd=sqlite3VdbeCurrentAddr(v); iOpopcode==OP_Column && pOp->p1==pWin->iEphCsr ){ + if( pOp->opcode==OP_Column && pOp->p1==pMWin->iEphCsr ){ pOp->p1 = csr; } } @@ -156632,6 +160038,7 @@ static void windowAggStep( if( pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ CollSeq *pColl; assert( nArg>0 ); + assert( ExprUseXList(pWin->pOwner) ); pColl = sqlite3ExprNNCollSeq(pParse, pWin->pOwner->x.pList->a[0].pExpr); sqlite3VdbeAddOp4(v, OP_CollSeq, 0,0,0, (const char*)pColl, P4_COLLSEQ); } @@ -156817,6 +160224,7 @@ static void windowReturnOneRow(WindowCodeArg *p){ for(pWin=pMWin; pWin; pWin=pWin->pNextWin){ FuncDef *pFunc = pWin->pFunc; + assert( ExprUseXList(pWin->pOwner) ); if( pFunc->zName==nth_valueName || pFunc->zName==first_valueName ){ @@ -158152,10 +161560,7 @@ static void updateDeleteLimitError( } - /* Construct a new Expr object from a single identifier. Use the - ** new Expr to populate pOut. Set the span of pOut to be the identifier - ** that created the expression. - */ + /* Construct a new Expr object from a single token */ static Expr *tokenExpr(Parse *pParse, int op, Token t){ Expr *p = sqlite3DbMallocRawNN(pParse->db, sizeof(Expr)+t.n+1); if( p ){ @@ -158166,15 +161571,16 @@ static void updateDeleteLimitError( ExprClearVVAProperties(p); p->iAgg = -1; p->pLeft = p->pRight = 0; - p->x.pList = 0; p->pAggInfo = 0; - p->y.pTab = 0; + memset(&p->x, 0, sizeof(p->x)); + memset(&p->y, 0, sizeof(p->y)); p->op2 = 0; p->iTable = 0; p->iColumn = 0; p->u.zToken = (char*)&p[1]; memcpy(p->u.zToken, t.z, t.n); p->u.zToken[t.n] = 0; + p->w.iOfst = (int)(t.z - pParse->zTail); if( sqlite3Isquote(p->u.zToken[0]) ){ sqlite3DequoteExpr(p); } @@ -158254,8 +161660,8 @@ static void updateDeleteLimitError( #define TK_LP 22 #define TK_RP 23 #define TK_AS 24 -#define TK_WITHOUT 25 -#define TK_COMMA 26 +#define TK_COMMA 25 +#define TK_WITHOUT 26 #define TK_ABORT 27 #define TK_ACTION 28 #define TK_AFTER 29 @@ -158341,78 +161747,79 @@ static void updateDeleteLimitError( #define TK_SLASH 109 #define TK_REM 110 #define TK_CONCAT 111 -#define TK_COLLATE 112 -#define TK_BITNOT 113 -#define TK_ON 114 -#define TK_INDEXED 115 -#define TK_STRING 116 -#define TK_JOIN_KW 117 -#define TK_CONSTRAINT 118 -#define TK_DEFAULT 119 -#define TK_NULL 120 -#define TK_PRIMARY 121 -#define TK_UNIQUE 122 -#define TK_CHECK 123 -#define TK_REFERENCES 124 -#define TK_AUTOINCR 125 -#define TK_INSERT 126 -#define TK_DELETE 127 -#define TK_UPDATE 128 -#define TK_SET 129 -#define TK_DEFERRABLE 130 -#define TK_FOREIGN 131 -#define TK_DROP 132 -#define TK_UNION 133 -#define TK_ALL 134 -#define TK_EXCEPT 135 -#define TK_INTERSECT 136 -#define TK_SELECT 137 -#define TK_VALUES 138 -#define TK_DISTINCT 139 -#define TK_DOT 140 -#define TK_FROM 141 -#define TK_JOIN 142 -#define TK_USING 143 -#define TK_ORDER 144 -#define TK_GROUP 145 -#define TK_HAVING 146 -#define TK_LIMIT 147 -#define TK_WHERE 148 -#define TK_RETURNING 149 -#define TK_INTO 150 -#define TK_NOTHING 151 -#define TK_FLOAT 152 -#define TK_BLOB 153 -#define TK_INTEGER 154 -#define TK_VARIABLE 155 -#define TK_CASE 156 -#define TK_WHEN 157 -#define TK_THEN 158 -#define TK_ELSE 159 -#define TK_INDEX 160 -#define TK_ALTER 161 -#define TK_ADD 162 -#define TK_WINDOW 163 -#define TK_OVER 164 -#define TK_FILTER 165 -#define TK_COLUMN 166 -#define TK_AGG_FUNCTION 167 -#define TK_AGG_COLUMN 168 -#define TK_TRUEFALSE 169 -#define TK_ISNOT 170 -#define TK_FUNCTION 171 -#define TK_UMINUS 172 -#define TK_UPLUS 173 -#define TK_TRUTH 174 -#define TK_REGISTER 175 -#define TK_VECTOR 176 -#define TK_SELECT_COLUMN 177 -#define TK_IF_NULL_ROW 178 -#define TK_ASTERISK 179 -#define TK_SPAN 180 -#define TK_ERROR 181 -#define TK_SPACE 182 -#define TK_ILLEGAL 183 +#define TK_PTR 112 +#define TK_COLLATE 113 +#define TK_BITNOT 114 +#define TK_ON 115 +#define TK_INDEXED 116 +#define TK_STRING 117 +#define TK_JOIN_KW 118 +#define TK_CONSTRAINT 119 +#define TK_DEFAULT 120 +#define TK_NULL 121 +#define TK_PRIMARY 122 +#define TK_UNIQUE 123 +#define TK_CHECK 124 +#define TK_REFERENCES 125 +#define TK_AUTOINCR 126 +#define TK_INSERT 127 +#define TK_DELETE 128 +#define TK_UPDATE 129 +#define TK_SET 130 +#define TK_DEFERRABLE 131 +#define TK_FOREIGN 132 +#define TK_DROP 133 +#define TK_UNION 134 +#define TK_ALL 135 +#define TK_EXCEPT 136 +#define TK_INTERSECT 137 +#define TK_SELECT 138 +#define TK_VALUES 139 +#define TK_DISTINCT 140 +#define TK_DOT 141 +#define TK_FROM 142 +#define TK_JOIN 143 +#define TK_USING 144 +#define TK_ORDER 145 +#define TK_GROUP 146 +#define TK_HAVING 147 +#define TK_LIMIT 148 +#define TK_WHERE 149 +#define TK_RETURNING 150 +#define TK_INTO 151 +#define TK_NOTHING 152 +#define TK_FLOAT 153 +#define TK_BLOB 154 +#define TK_INTEGER 155 +#define TK_VARIABLE 156 +#define TK_CASE 157 +#define TK_WHEN 158 +#define TK_THEN 159 +#define TK_ELSE 160 +#define TK_INDEX 161 +#define TK_ALTER 162 +#define TK_ADD 163 +#define TK_WINDOW 164 +#define TK_OVER 165 +#define TK_FILTER 166 +#define TK_COLUMN 167 +#define TK_AGG_FUNCTION 168 +#define TK_AGG_COLUMN 169 +#define TK_TRUEFALSE 170 +#define TK_ISNOT 171 +#define TK_FUNCTION 172 +#define TK_UMINUS 173 +#define TK_UPLUS 174 +#define TK_TRUTH 175 +#define TK_REGISTER 176 +#define TK_VECTOR 177 +#define TK_SELECT_COLUMN 178 +#define TK_IF_NULL_ROW 179 +#define TK_ASTERISK 180 +#define TK_SPAN 181 +#define TK_ERROR 182 +#define TK_SPACE 183 +#define TK_ILLEGAL 184 #endif /**************** End token definitions ***************************************/ @@ -158472,29 +161879,30 @@ static void updateDeleteLimitError( #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int -#define YYNOCODE 317 +#define YYNOCODE 319 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 101 #define sqlite3ParserTOKENTYPE Token typedef union { int yyinit; sqlite3ParserTOKENTYPE yy0; - Window* yy49; - ExprList* yy70; - Select* yy81; - With* yy103; - struct FrameBound yy117; - struct {int value; int mask;} yy139; - SrcList* yy153; - TriggerStep* yy157; - Upsert* yy190; - struct TrigEvent yy262; - Cte* yy329; - int yy376; - Expr* yy404; - IdList* yy436; - const char* yy504; - u8 yy552; + TriggerStep* yy33; + Window* yy41; + Select* yy47; + SrcList* yy131; + struct TrigEvent yy180; + struct {int value; int mask;} yy231; + IdList* yy254; + u32 yy285; + ExprList* yy322; + Cte* yy385; + int yy394; + Upsert* yy444; + u8 yy516; + With* yy521; + const char* yy522; + Expr* yy528; + struct FrameBound yy595; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 @@ -158510,18 +161918,18 @@ typedef union { #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 -#define YYNSTATE 574 -#define YYNRULE 398 -#define YYNRULE_WITH_ACTION 337 -#define YYNTOKEN 184 -#define YY_MAX_SHIFT 573 -#define YY_MIN_SHIFTREDUCE 829 -#define YY_MAX_SHIFTREDUCE 1226 -#define YY_ERROR_ACTION 1227 -#define YY_ACCEPT_ACTION 1228 -#define YY_NO_ACTION 1229 -#define YY_MIN_REDUCE 1230 -#define YY_MAX_REDUCE 1627 +#define YYNSTATE 578 +#define YYNRULE 402 +#define YYNRULE_WITH_ACTION 340 +#define YYNTOKEN 185 +#define YY_MAX_SHIFT 577 +#define YY_MIN_SHIFTREDUCE 835 +#define YY_MAX_SHIFTREDUCE 1236 +#define YY_ERROR_ACTION 1237 +#define YY_ACCEPT_ACTION 1238 +#define YY_NO_ACTION 1239 +#define YY_MIN_REDUCE 1240 +#define YY_MAX_REDUCE 1641 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) @@ -158588,603 +161996,614 @@ typedef union { ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ -#define YY_ACTTAB_COUNT (2025) +#define YY_ACTTAB_COUNT (2071) static const YYACTIONTYPE yy_action[] = { - /* 0 */ 567, 1299, 567, 1278, 168, 1261, 115, 112, 218, 377, - /* 10 */ 567, 1299, 378, 567, 492, 567, 115, 112, 218, 410, - /* 20 */ 1304, 1304, 41, 41, 41, 41, 518, 1508, 524, 1302, - /* 30 */ 1302, 963, 41, 41, 1264, 71, 71, 51, 51, 964, - /* 40 */ 561, 561, 561, 122, 123, 113, 1204, 1204, 1039, 1042, - /* 50 */ 1032, 1032, 120, 120, 121, 121, 121, 121, 418, 410, - /* 60 */ 273, 273, 273, 273, 115, 112, 218, 115, 112, 218, - /* 70 */ 197, 268, 549, 564, 519, 564, 211, 567, 389, 248, - /* 80 */ 215, 525, 403, 122, 123, 113, 1204, 1204, 1039, 1042, - /* 90 */ 1032, 1032, 120, 120, 121, 121, 121, 121, 544, 13, - /* 100 */ 13, 1263, 119, 119, 119, 119, 118, 118, 117, 117, - /* 110 */ 117, 116, 445, 1180, 423, 197, 450, 324, 516, 1543, - /* 120 */ 1549, 376, 1551, 6, 375, 1180, 1152, 398, 1152, 410, - /* 130 */ 1549, 538, 115, 112, 218, 1419, 99, 30, 121, 121, - /* 140 */ 121, 121, 119, 119, 119, 119, 118, 118, 117, 117, - /* 150 */ 117, 116, 445, 122, 123, 113, 1204, 1204, 1039, 1042, - /* 160 */ 1032, 1032, 120, 120, 121, 121, 121, 121, 31, 1180, - /* 170 */ 1181, 1182, 241, 361, 1562, 505, 502, 501, 321, 124, - /* 180 */ 323, 1180, 1181, 1182, 1180, 500, 119, 119, 119, 119, - /* 190 */ 118, 118, 117, 117, 117, 116, 445, 139, 96, 410, - /* 200 */ 121, 121, 121, 121, 114, 117, 117, 117, 116, 445, - /* 210 */ 545, 1536, 119, 119, 119, 119, 118, 118, 117, 117, - /* 220 */ 117, 116, 445, 122, 123, 113, 1204, 1204, 1039, 1042, - /* 230 */ 1032, 1032, 120, 120, 121, 121, 121, 121, 410, 445, - /* 240 */ 1180, 1181, 1182, 81, 443, 443, 443, 80, 119, 119, - /* 250 */ 119, 119, 118, 118, 117, 117, 117, 116, 445, 492, - /* 260 */ 1180, 322, 122, 123, 113, 1204, 1204, 1039, 1042, 1032, - /* 270 */ 1032, 120, 120, 121, 121, 121, 121, 497, 1029, 1029, - /* 280 */ 1040, 1043, 119, 119, 119, 119, 118, 118, 117, 117, - /* 290 */ 117, 116, 445, 1588, 999, 1228, 1, 1, 573, 2, - /* 300 */ 1232, 1271, 137, 1507, 245, 305, 477, 140, 410, 864, - /* 310 */ 565, 1180, 918, 918, 1312, 363, 1180, 1181, 1182, 466, - /* 320 */ 334, 119, 119, 119, 119, 118, 118, 117, 117, 117, - /* 330 */ 116, 445, 122, 123, 113, 1204, 1204, 1039, 1042, 1032, - /* 340 */ 1032, 120, 120, 121, 121, 121, 121, 332, 273, 273, - /* 350 */ 1019, 83, 1033, 429, 1568, 573, 2, 1232, 304, 558, - /* 360 */ 929, 564, 305, 948, 140, 864, 1010, 1180, 1181, 1182, - /* 370 */ 1009, 1312, 415, 213, 515, 229, 119, 119, 119, 119, - /* 380 */ 118, 118, 117, 117, 117, 116, 445, 523, 351, 116, - /* 390 */ 445, 119, 119, 119, 119, 118, 118, 117, 117, 117, - /* 400 */ 116, 445, 1009, 1009, 1011, 273, 273, 449, 567, 16, - /* 410 */ 16, 1594, 567, 1544, 567, 410, 1180, 6, 564, 348, - /* 420 */ 182, 118, 118, 117, 117, 117, 116, 445, 420, 142, - /* 430 */ 71, 71, 229, 567, 71, 71, 55, 55, 203, 122, - /* 440 */ 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, 120, - /* 450 */ 121, 121, 121, 121, 217, 13, 13, 1180, 410, 572, - /* 460 */ 1404, 1232, 506, 137, 449, 168, 305, 549, 140, 1184, - /* 470 */ 428, 549, 1180, 1181, 1182, 1312, 548, 442, 441, 948, - /* 480 */ 517, 456, 122, 123, 113, 1204, 1204, 1039, 1042, 1032, - /* 490 */ 1032, 120, 120, 121, 121, 121, 121, 315, 119, 119, - /* 500 */ 119, 119, 118, 118, 117, 117, 117, 116, 445, 273, - /* 510 */ 273, 1147, 420, 1180, 1181, 1182, 547, 567, 1147, 304, - /* 520 */ 558, 1565, 564, 1211, 1147, 1211, 1184, 1147, 410, 534, - /* 530 */ 425, 1147, 868, 183, 1147, 143, 229, 566, 32, 71, - /* 540 */ 71, 119, 119, 119, 119, 118, 118, 117, 117, 117, - /* 550 */ 116, 445, 122, 123, 113, 1204, 1204, 1039, 1042, 1032, - /* 560 */ 1032, 120, 120, 121, 121, 121, 121, 410, 449, 241, - /* 570 */ 1180, 861, 505, 502, 501, 1180, 530, 189, 245, 542, - /* 580 */ 1543, 282, 500, 374, 6, 567, 533, 481, 5, 279, - /* 590 */ 1019, 122, 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, - /* 600 */ 120, 120, 121, 121, 121, 121, 1010, 13, 13, 1418, - /* 610 */ 1009, 119, 119, 119, 119, 118, 118, 117, 117, 117, - /* 620 */ 116, 445, 430, 273, 273, 1180, 1180, 1181, 1182, 1623, - /* 630 */ 396, 1180, 1181, 1182, 1180, 346, 564, 410, 529, 365, - /* 640 */ 434, 1165, 1009, 1009, 1011, 352, 415, 361, 1562, 492, - /* 650 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116, - /* 660 */ 445, 122, 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, - /* 670 */ 120, 120, 121, 121, 121, 121, 410, 834, 835, 836, - /* 680 */ 1020, 1180, 1181, 1182, 400, 285, 148, 1316, 304, 558, - /* 690 */ 1180, 1181, 1182, 1471, 216, 3, 341, 137, 344, 564, - /* 700 */ 122, 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, - /* 710 */ 120, 121, 121, 121, 121, 567, 508, 950, 273, 273, - /* 720 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116, - /* 730 */ 445, 564, 1180, 431, 567, 455, 98, 13, 13, 259, - /* 740 */ 276, 360, 511, 355, 510, 246, 410, 365, 473, 1534, - /* 750 */ 1004, 351, 293, 304, 558, 1593, 71, 71, 893, 119, - /* 760 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 445, - /* 770 */ 122, 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, - /* 780 */ 120, 121, 121, 121, 121, 410, 1147, 1082, 1180, 1181, - /* 790 */ 1182, 420, 1084, 300, 150, 999, 1084, 365, 365, 1147, - /* 800 */ 365, 382, 1147, 481, 567, 244, 243, 242, 1282, 122, - /* 810 */ 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, 120, - /* 820 */ 121, 121, 121, 121, 567, 884, 13, 13, 487, 119, - /* 830 */ 119, 119, 119, 118, 118, 117, 117, 117, 116, 445, - /* 840 */ 1180, 191, 544, 567, 147, 149, 13, 13, 332, 461, - /* 850 */ 318, 1087, 1087, 489, 1541, 410, 509, 1534, 6, 1518, - /* 860 */ 284, 192, 1281, 145, 885, 71, 71, 492, 119, 119, - /* 870 */ 119, 119, 118, 118, 117, 117, 117, 116, 445, 122, - /* 880 */ 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, 120, - /* 890 */ 121, 121, 121, 121, 567, 475, 1180, 1181, 1182, 410, - /* 900 */ 856, 331, 301, 466, 334, 1520, 270, 1534, 1534, 948, - /* 910 */ 1535, 1311, 313, 9, 846, 251, 71, 71, 481, 432, - /* 920 */ 146, 492, 38, 949, 101, 113, 1204, 1204, 1039, 1042, - /* 930 */ 1032, 1032, 120, 120, 121, 121, 121, 121, 119, 119, - /* 940 */ 119, 119, 118, 118, 117, 117, 117, 116, 445, 567, - /* 950 */ 1201, 1103, 567, 440, 567, 1537, 567, 856, 1126, 1621, - /* 960 */ 458, 290, 1621, 550, 251, 1307, 1104, 267, 267, 281, - /* 970 */ 408, 70, 70, 464, 71, 71, 71, 71, 13, 13, - /* 980 */ 564, 1105, 119, 119, 119, 119, 118, 118, 117, 117, - /* 990 */ 117, 116, 445, 546, 104, 273, 273, 273, 273, 1201, - /* 1000 */ 217, 1472, 904, 475, 454, 567, 1477, 1201, 564, 451, - /* 1010 */ 564, 549, 905, 444, 410, 1062, 292, 274, 274, 198, - /* 1020 */ 551, 454, 453, 1477, 1479, 948, 459, 56, 56, 414, - /* 1030 */ 564, 1126, 1622, 383, 410, 1622, 408, 1124, 122, 123, - /* 1040 */ 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, 120, 121, - /* 1050 */ 121, 121, 121, 1464, 410, 12, 1201, 1516, 122, 123, - /* 1060 */ 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, 120, 121, - /* 1070 */ 121, 121, 121, 308, 475, 126, 363, 286, 122, 111, - /* 1080 */ 113, 1204, 1204, 1039, 1042, 1032, 1032, 120, 120, 121, - /* 1090 */ 121, 121, 121, 309, 454, 475, 1477, 119, 119, 119, - /* 1100 */ 119, 118, 118, 117, 117, 117, 116, 445, 1180, 567, - /* 1110 */ 1124, 486, 567, 312, 437, 483, 197, 119, 119, 119, - /* 1120 */ 119, 118, 118, 117, 117, 117, 116, 445, 409, 12, - /* 1130 */ 540, 15, 15, 482, 43, 43, 513, 119, 119, 119, - /* 1140 */ 119, 118, 118, 117, 117, 117, 116, 445, 289, 539, - /* 1150 */ 294, 567, 294, 395, 1224, 442, 441, 410, 1158, 407, - /* 1160 */ 406, 1404, 924, 1208, 1180, 1181, 1182, 923, 1210, 291, - /* 1170 */ 1310, 1253, 416, 57, 57, 492, 1209, 567, 560, 416, - /* 1180 */ 1180, 1348, 123, 113, 1204, 1204, 1039, 1042, 1032, 1032, - /* 1190 */ 120, 120, 121, 121, 121, 121, 1404, 1147, 567, 44, - /* 1200 */ 44, 1211, 194, 1211, 273, 273, 1404, 465, 541, 1158, - /* 1210 */ 1147, 108, 559, 1147, 4, 395, 1125, 564, 1542, 339, - /* 1220 */ 58, 58, 6, 1250, 1103, 384, 1404, 380, 562, 1540, - /* 1230 */ 567, 426, 1225, 6, 304, 558, 1180, 1181, 1182, 1104, - /* 1240 */ 119, 119, 119, 119, 118, 118, 117, 117, 117, 116, - /* 1250 */ 445, 446, 59, 59, 1105, 520, 1539, 273, 273, 567, - /* 1260 */ 6, 567, 110, 556, 567, 532, 427, 417, 169, 552, - /* 1270 */ 564, 108, 559, 137, 4, 555, 488, 272, 215, 222, - /* 1280 */ 211, 60, 60, 61, 61, 98, 62, 62, 562, 273, - /* 1290 */ 273, 567, 1019, 471, 1225, 567, 438, 567, 106, 106, - /* 1300 */ 8, 924, 564, 273, 273, 107, 923, 446, 569, 568, - /* 1310 */ 567, 446, 1009, 45, 45, 468, 564, 46, 46, 47, - /* 1320 */ 47, 84, 202, 556, 1219, 408, 472, 567, 205, 304, - /* 1330 */ 558, 567, 49, 49, 567, 526, 408, 536, 567, 871, - /* 1340 */ 567, 105, 535, 103, 1009, 1009, 1011, 1012, 27, 50, - /* 1350 */ 50, 567, 1019, 63, 63, 479, 64, 64, 106, 106, - /* 1360 */ 65, 65, 14, 14, 17, 107, 567, 446, 569, 568, - /* 1370 */ 567, 303, 1009, 66, 66, 567, 226, 567, 963, 567, - /* 1380 */ 547, 408, 1200, 1347, 875, 278, 964, 460, 128, 128, - /* 1390 */ 567, 1069, 67, 67, 567, 206, 871, 52, 52, 68, - /* 1400 */ 68, 69, 69, 421, 1009, 1009, 1011, 1012, 27, 1567, - /* 1410 */ 1169, 448, 53, 53, 277, 1523, 156, 156, 307, 393, - /* 1420 */ 393, 392, 262, 390, 1169, 448, 843, 325, 277, 108, - /* 1430 */ 559, 527, 4, 393, 393, 392, 262, 390, 567, 223, - /* 1440 */ 843, 311, 330, 1496, 1121, 98, 562, 397, 1069, 310, - /* 1450 */ 567, 480, 567, 223, 567, 311, 883, 882, 1013, 277, - /* 1460 */ 157, 157, 467, 310, 393, 393, 392, 262, 390, 446, - /* 1470 */ 522, 843, 76, 76, 54, 54, 72, 72, 359, 225, - /* 1480 */ 567, 556, 275, 567, 223, 329, 311, 161, 358, 469, - /* 1490 */ 135, 567, 228, 225, 310, 536, 567, 206, 890, 891, - /* 1500 */ 537, 161, 129, 129, 135, 73, 73, 224, 966, 967, - /* 1510 */ 1019, 567, 287, 130, 130, 1013, 106, 106, 131, 131, - /* 1520 */ 567, 224, 567, 107, 225, 446, 569, 568, 1001, 1280, - /* 1530 */ 1009, 250, 161, 127, 127, 135, 108, 559, 1081, 4, - /* 1540 */ 1081, 411, 155, 155, 154, 154, 304, 558, 1130, 567, - /* 1550 */ 1335, 567, 224, 562, 474, 411, 567, 250, 567, 1495, - /* 1560 */ 304, 558, 1009, 1009, 1011, 1012, 27, 567, 484, 336, - /* 1570 */ 452, 136, 136, 134, 134, 1344, 446, 340, 132, 132, - /* 1580 */ 133, 133, 567, 1080, 452, 1080, 411, 567, 556, 75, - /* 1590 */ 75, 304, 558, 343, 345, 347, 108, 559, 567, 4, - /* 1600 */ 1581, 299, 536, 567, 77, 77, 1295, 535, 476, 74, - /* 1610 */ 74, 250, 1279, 562, 354, 452, 335, 1019, 364, 98, - /* 1620 */ 42, 42, 1356, 106, 106, 48, 48, 1403, 498, 1331, - /* 1630 */ 107, 247, 446, 569, 568, 349, 446, 1009, 98, 1065, - /* 1640 */ 957, 921, 247, 250, 110, 1556, 554, 854, 556, 922, - /* 1650 */ 144, 1342, 110, 553, 1409, 1260, 1252, 1241, 1240, 1242, - /* 1660 */ 1575, 1328, 208, 394, 493, 265, 367, 200, 369, 1009, - /* 1670 */ 1009, 1011, 1012, 27, 11, 280, 221, 1019, 327, 478, - /* 1680 */ 1278, 371, 212, 106, 106, 928, 1390, 328, 288, 317, - /* 1690 */ 107, 457, 446, 569, 568, 283, 333, 1009, 1395, 503, - /* 1700 */ 357, 320, 1468, 108, 559, 1467, 4, 1578, 1394, 401, - /* 1710 */ 1219, 171, 254, 373, 387, 207, 195, 196, 1515, 557, - /* 1720 */ 562, 1513, 419, 1216, 100, 559, 83, 4, 204, 1009, - /* 1730 */ 1009, 1011, 1012, 27, 180, 125, 547, 219, 79, 82, - /* 1740 */ 1385, 562, 316, 446, 35, 1391, 166, 173, 1378, 319, - /* 1750 */ 462, 175, 463, 1473, 496, 556, 176, 231, 96, 177, - /* 1760 */ 178, 1399, 399, 1397, 446, 36, 1396, 184, 485, 235, - /* 1770 */ 470, 402, 1462, 491, 1484, 188, 556, 89, 512, 266, - /* 1780 */ 237, 338, 494, 342, 1019, 238, 404, 433, 1243, 239, - /* 1790 */ 106, 106, 91, 1289, 1298, 1592, 1591, 107, 875, 446, - /* 1800 */ 569, 568, 1297, 213, 1009, 1019, 1296, 435, 1288, 1561, - /* 1810 */ 521, 106, 106, 405, 1268, 1267, 356, 1266, 107, 1590, - /* 1820 */ 446, 569, 568, 297, 298, 1009, 436, 362, 366, 528, - /* 1830 */ 95, 252, 253, 439, 1339, 1547, 1009, 1009, 1011, 1012, - /* 1840 */ 27, 10, 381, 302, 1363, 1546, 102, 1321, 97, 531, - /* 1850 */ 260, 1249, 34, 570, 1340, 1338, 1175, 1009, 1009, 1011, - /* 1860 */ 1012, 27, 368, 1320, 370, 1362, 1337, 372, 379, 199, - /* 1870 */ 385, 386, 261, 263, 264, 158, 1500, 1501, 571, 1238, - /* 1880 */ 1499, 1233, 1498, 159, 209, 78, 1448, 141, 295, 210, - /* 1890 */ 830, 447, 201, 306, 220, 1079, 160, 138, 1077, 314, - /* 1900 */ 172, 162, 1200, 174, 227, 907, 230, 326, 1093, 179, - /* 1910 */ 163, 164, 422, 85, 412, 413, 181, 170, 86, 424, - /* 1920 */ 87, 165, 88, 1096, 232, 233, 1092, 151, 18, 234, - /* 1930 */ 1085, 337, 185, 1213, 250, 490, 236, 186, 37, 845, - /* 1940 */ 495, 358, 240, 350, 499, 187, 90, 167, 19, 20, - /* 1950 */ 504, 873, 353, 507, 92, 93, 296, 886, 152, 514, - /* 1960 */ 94, 1163, 153, 1045, 1132, 39, 190, 214, 1131, 269, - /* 1970 */ 271, 956, 951, 1153, 110, 1149, 249, 7, 1157, 21, - /* 1980 */ 1137, 1151, 33, 22, 23, 24, 1156, 25, 543, 193, - /* 1990 */ 26, 98, 1060, 1046, 1044, 1048, 1102, 1049, 1101, 256, - /* 2000 */ 255, 28, 40, 257, 1014, 855, 109, 29, 917, 563, - /* 2010 */ 388, 391, 1171, 258, 1170, 1229, 1229, 1229, 1583, 1229, - /* 2020 */ 1229, 1229, 1229, 1229, 1582, + /* 0 */ 570, 1311, 570, 1290, 201, 201, 570, 116, 112, 222, + /* 10 */ 570, 1311, 381, 570, 116, 112, 222, 401, 412, 413, + /* 20 */ 1264, 382, 1273, 41, 41, 41, 41, 1416, 1521, 71, + /* 30 */ 71, 971, 1262, 41, 41, 495, 71, 71, 272, 972, + /* 40 */ 298, 480, 298, 123, 124, 114, 1214, 1214, 1048, 1051, + /* 50 */ 1040, 1040, 121, 121, 122, 122, 122, 122, 547, 413, + /* 60 */ 1238, 1, 1, 577, 2, 1242, 552, 116, 112, 222, + /* 70 */ 309, 484, 142, 552, 1276, 528, 116, 112, 222, 1324, + /* 80 */ 421, 527, 551, 123, 124, 114, 1214, 1214, 1048, 1051, + /* 90 */ 1040, 1040, 121, 121, 122, 122, 122, 122, 428, 116, + /* 100 */ 112, 222, 120, 120, 120, 120, 119, 119, 118, 118, + /* 110 */ 118, 117, 113, 448, 277, 277, 277, 277, 564, 564, + /* 120 */ 564, 1562, 380, 1564, 1190, 379, 1161, 567, 1161, 567, + /* 130 */ 413, 1562, 541, 252, 219, 1557, 99, 141, 453, 6, + /* 140 */ 369, 233, 120, 120, 120, 120, 119, 119, 118, 118, + /* 150 */ 118, 117, 113, 448, 123, 124, 114, 1214, 1214, 1048, + /* 160 */ 1051, 1040, 1040, 121, 121, 122, 122, 122, 122, 138, + /* 170 */ 289, 1190, 1550, 452, 118, 118, 118, 117, 113, 448, + /* 180 */ 125, 1190, 1191, 1192, 144, 469, 338, 570, 150, 127, + /* 190 */ 448, 122, 122, 122, 122, 115, 120, 120, 120, 120, + /* 200 */ 119, 119, 118, 118, 118, 117, 113, 448, 458, 423, + /* 210 */ 13, 13, 215, 120, 120, 120, 120, 119, 119, 118, + /* 220 */ 118, 118, 117, 113, 448, 426, 308, 561, 1190, 1191, + /* 230 */ 1192, 445, 444, 413, 1275, 122, 122, 122, 122, 120, + /* 240 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113, + /* 250 */ 448, 1547, 98, 1037, 1037, 1049, 1052, 123, 124, 114, + /* 260 */ 1214, 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, + /* 270 */ 122, 122, 570, 410, 409, 1190, 570, 413, 1221, 319, + /* 280 */ 1221, 80, 81, 120, 120, 120, 120, 119, 119, 118, + /* 290 */ 118, 118, 117, 113, 448, 70, 70, 1190, 1608, 71, + /* 300 */ 71, 123, 124, 114, 1214, 1214, 1048, 1051, 1040, 1040, + /* 310 */ 121, 121, 122, 122, 122, 122, 120, 120, 120, 120, + /* 320 */ 119, 119, 118, 118, 118, 117, 113, 448, 1041, 210, + /* 330 */ 1190, 369, 1190, 1191, 1192, 245, 552, 403, 508, 505, + /* 340 */ 504, 108, 562, 138, 4, 520, 937, 437, 503, 217, + /* 350 */ 518, 526, 356, 883, 1190, 1191, 1192, 387, 565, 570, + /* 360 */ 120, 120, 120, 120, 119, 119, 118, 118, 118, 117, + /* 370 */ 113, 448, 277, 277, 16, 16, 1602, 445, 444, 153, + /* 380 */ 413, 449, 13, 13, 1283, 567, 1218, 1190, 1191, 1192, + /* 390 */ 1007, 1220, 264, 559, 1578, 186, 570, 431, 138, 1219, + /* 400 */ 308, 561, 476, 138, 123, 124, 114, 1214, 1214, 1048, + /* 410 */ 1051, 1040, 1040, 121, 121, 122, 122, 122, 122, 55, + /* 420 */ 55, 417, 1027, 511, 1221, 1190, 1221, 478, 106, 106, + /* 430 */ 1316, 1316, 1190, 171, 570, 388, 107, 384, 449, 572, + /* 440 */ 571, 434, 1547, 1017, 336, 553, 569, 263, 280, 364, + /* 450 */ 514, 359, 513, 250, 495, 308, 561, 71, 71, 355, + /* 460 */ 308, 561, 378, 120, 120, 120, 120, 119, 119, 118, + /* 470 */ 118, 118, 117, 113, 448, 1017, 1017, 1019, 1020, 27, + /* 480 */ 277, 277, 1190, 1191, 1192, 1156, 570, 532, 413, 1190, + /* 490 */ 1191, 1192, 352, 567, 552, 1264, 537, 521, 1156, 1520, + /* 500 */ 317, 1156, 285, 554, 489, 573, 570, 573, 486, 51, + /* 510 */ 51, 207, 123, 124, 114, 1214, 1214, 1048, 1051, 1040, + /* 520 */ 1040, 121, 121, 122, 122, 122, 122, 171, 1416, 13, + /* 530 */ 13, 413, 277, 277, 1190, 509, 119, 119, 118, 118, + /* 540 */ 118, 117, 113, 448, 433, 567, 522, 220, 519, 1556, + /* 550 */ 369, 550, 1190, 6, 536, 123, 124, 114, 1214, 1214, + /* 560 */ 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, 122, + /* 570 */ 145, 120, 120, 120, 120, 119, 119, 118, 118, 118, + /* 580 */ 117, 113, 448, 245, 570, 478, 508, 505, 504, 570, + /* 590 */ 1485, 1190, 1191, 1192, 1314, 1314, 503, 1190, 149, 429, + /* 600 */ 1190, 484, 413, 274, 369, 956, 876, 56, 56, 1190, + /* 610 */ 1191, 1192, 71, 71, 120, 120, 120, 120, 119, 119, + /* 620 */ 118, 118, 118, 117, 113, 448, 123, 124, 114, 1214, + /* 630 */ 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, + /* 640 */ 122, 413, 545, 1556, 83, 869, 98, 6, 932, 533, + /* 650 */ 852, 547, 151, 931, 1190, 1191, 1192, 1190, 1191, 1192, + /* 660 */ 290, 1547, 187, 1637, 399, 123, 124, 114, 1214, 1214, + /* 670 */ 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, 122, + /* 680 */ 570, 958, 570, 457, 957, 120, 120, 120, 120, 119, + /* 690 */ 119, 118, 118, 118, 117, 113, 448, 1156, 221, 1190, + /* 700 */ 335, 457, 456, 13, 13, 13, 13, 1007, 369, 467, + /* 710 */ 1156, 193, 413, 1156, 386, 1547, 1174, 32, 297, 478, + /* 720 */ 195, 1531, 5, 956, 120, 120, 120, 120, 119, 119, + /* 730 */ 118, 118, 118, 117, 113, 448, 123, 124, 114, 1214, + /* 740 */ 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, + /* 750 */ 122, 413, 1071, 423, 1190, 1028, 1190, 1191, 1192, 1190, + /* 760 */ 423, 336, 464, 322, 548, 1549, 446, 446, 446, 570, + /* 770 */ 3, 117, 113, 448, 457, 123, 124, 114, 1214, 1214, + /* 780 */ 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, 122, + /* 790 */ 1477, 570, 15, 15, 293, 120, 120, 120, 120, 119, + /* 800 */ 119, 118, 118, 118, 117, 113, 448, 1190, 570, 1490, + /* 810 */ 1416, 1190, 1191, 1192, 13, 13, 1190, 1191, 1192, 1548, + /* 820 */ 271, 271, 413, 286, 308, 561, 1012, 1490, 1492, 196, + /* 830 */ 288, 71, 71, 567, 120, 120, 120, 120, 119, 119, + /* 840 */ 118, 118, 118, 117, 113, 448, 123, 124, 114, 1214, + /* 850 */ 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, + /* 860 */ 122, 413, 201, 1091, 1190, 1191, 1192, 1328, 304, 1533, + /* 870 */ 392, 278, 278, 454, 568, 406, 926, 926, 570, 567, + /* 880 */ 570, 430, 495, 484, 567, 123, 124, 114, 1214, 1214, + /* 890 */ 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, 122, + /* 900 */ 1490, 71, 71, 13, 13, 120, 120, 120, 120, 119, + /* 910 */ 119, 118, 118, 118, 117, 113, 448, 570, 549, 570, + /* 920 */ 1581, 577, 2, 1242, 1096, 1096, 492, 1484, 309, 1529, + /* 930 */ 142, 328, 413, 840, 841, 842, 312, 1324, 305, 367, + /* 940 */ 43, 43, 57, 57, 120, 120, 120, 120, 119, 119, + /* 950 */ 118, 118, 118, 117, 113, 448, 123, 124, 114, 1214, + /* 960 */ 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, + /* 970 */ 122, 12, 277, 277, 570, 1156, 413, 576, 432, 1242, + /* 980 */ 469, 338, 296, 478, 309, 567, 142, 249, 1156, 308, + /* 990 */ 561, 1156, 325, 1324, 327, 495, 459, 71, 71, 233, + /* 1000 */ 283, 101, 114, 1214, 1214, 1048, 1051, 1040, 1040, 121, + /* 1010 */ 121, 122, 122, 122, 122, 120, 120, 120, 120, 119, + /* 1020 */ 119, 118, 118, 118, 117, 113, 448, 1112, 277, 277, + /* 1030 */ 1416, 452, 398, 1234, 443, 277, 277, 248, 247, 246, + /* 1040 */ 1323, 567, 1113, 313, 198, 294, 495, 1322, 567, 468, + /* 1050 */ 570, 1431, 398, 1134, 1027, 233, 418, 1114, 295, 120, + /* 1060 */ 120, 120, 120, 119, 119, 118, 118, 118, 117, 113, + /* 1070 */ 448, 1018, 104, 71, 71, 1017, 326, 500, 912, 570, + /* 1080 */ 277, 277, 277, 277, 1112, 1265, 419, 452, 913, 365, + /* 1090 */ 1575, 1319, 413, 567, 956, 567, 9, 202, 255, 1113, + /* 1100 */ 316, 491, 44, 44, 249, 563, 419, 1017, 1017, 1019, + /* 1110 */ 447, 1235, 413, 1607, 1114, 901, 123, 124, 114, 1214, + /* 1120 */ 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, + /* 1130 */ 122, 1235, 413, 1211, 215, 558, 123, 124, 114, 1214, + /* 1140 */ 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, + /* 1150 */ 122, 1135, 1635, 474, 1635, 255, 123, 111, 114, 1214, + /* 1160 */ 1214, 1048, 1051, 1040, 1040, 121, 121, 122, 122, 122, + /* 1170 */ 122, 1135, 1636, 418, 1636, 120, 120, 120, 120, 119, + /* 1180 */ 119, 118, 118, 118, 117, 113, 448, 221, 209, 355, + /* 1190 */ 1211, 1211, 147, 1430, 495, 120, 120, 120, 120, 119, + /* 1200 */ 119, 118, 118, 118, 117, 113, 448, 1260, 543, 523, + /* 1210 */ 892, 555, 956, 12, 570, 120, 120, 120, 120, 119, + /* 1220 */ 119, 118, 118, 118, 117, 113, 448, 542, 570, 864, + /* 1230 */ 1133, 365, 1575, 350, 1360, 413, 1167, 58, 58, 343, + /* 1240 */ 1359, 512, 277, 277, 277, 277, 277, 277, 1211, 893, + /* 1250 */ 1133, 59, 59, 463, 367, 567, 570, 567, 96, 567, + /* 1260 */ 124, 114, 1214, 1214, 1048, 1051, 1040, 1040, 121, 121, + /* 1270 */ 122, 122, 122, 122, 570, 1416, 570, 281, 1190, 60, + /* 1280 */ 60, 110, 396, 396, 395, 266, 393, 864, 1167, 849, + /* 1290 */ 570, 485, 570, 440, 345, 1156, 348, 61, 61, 62, + /* 1300 */ 62, 971, 227, 1554, 315, 435, 544, 6, 1156, 972, + /* 1310 */ 570, 1156, 314, 45, 45, 46, 46, 516, 120, 120, + /* 1320 */ 120, 120, 119, 119, 118, 118, 118, 117, 113, 448, + /* 1330 */ 420, 173, 1536, 47, 47, 1190, 1191, 1192, 108, 562, + /* 1340 */ 329, 4, 229, 1555, 932, 570, 441, 6, 570, 931, + /* 1350 */ 164, 570, 1294, 137, 1194, 565, 570, 1553, 570, 1093, + /* 1360 */ 570, 6, 570, 1093, 535, 570, 872, 8, 49, 49, + /* 1370 */ 228, 50, 50, 570, 63, 63, 570, 461, 449, 64, + /* 1380 */ 64, 65, 65, 14, 14, 66, 66, 411, 129, 129, + /* 1390 */ 559, 570, 462, 570, 1509, 490, 67, 67, 570, 52, + /* 1400 */ 52, 550, 411, 471, 539, 414, 226, 1027, 570, 538, + /* 1410 */ 308, 561, 1194, 411, 68, 68, 69, 69, 570, 1027, + /* 1420 */ 570, 53, 53, 872, 1018, 106, 106, 529, 1017, 570, + /* 1430 */ 1508, 159, 159, 107, 455, 449, 572, 571, 475, 307, + /* 1440 */ 1017, 160, 160, 76, 76, 570, 1552, 470, 411, 411, + /* 1450 */ 6, 1229, 54, 54, 482, 276, 219, 570, 891, 890, + /* 1460 */ 1017, 1017, 1019, 84, 206, 1210, 230, 282, 72, 72, + /* 1470 */ 333, 487, 1017, 1017, 1019, 1020, 27, 1580, 1178, 451, + /* 1480 */ 130, 130, 281, 148, 105, 38, 103, 396, 396, 395, + /* 1490 */ 266, 393, 570, 1130, 849, 400, 570, 108, 562, 570, + /* 1500 */ 4, 311, 570, 30, 17, 570, 279, 227, 570, 315, + /* 1510 */ 108, 562, 472, 4, 565, 73, 73, 314, 570, 157, + /* 1520 */ 157, 570, 131, 131, 530, 132, 132, 565, 128, 128, + /* 1530 */ 570, 158, 158, 570, 31, 291, 570, 449, 334, 525, + /* 1540 */ 98, 152, 152, 424, 136, 136, 1009, 229, 254, 559, + /* 1550 */ 449, 483, 340, 135, 135, 164, 133, 133, 137, 134, + /* 1560 */ 134, 879, 559, 539, 570, 477, 570, 254, 540, 479, + /* 1570 */ 339, 254, 98, 898, 899, 228, 539, 570, 1027, 570, + /* 1580 */ 1078, 538, 210, 232, 106, 106, 1356, 75, 75, 77, + /* 1590 */ 77, 1027, 107, 344, 449, 572, 571, 106, 106, 1017, + /* 1600 */ 74, 74, 42, 42, 570, 107, 347, 449, 572, 571, + /* 1610 */ 414, 501, 1017, 251, 363, 308, 561, 1139, 353, 879, + /* 1620 */ 98, 1074, 349, 251, 362, 1595, 351, 48, 48, 1021, + /* 1630 */ 1307, 1017, 1017, 1019, 1020, 27, 1293, 1291, 1078, 455, + /* 1640 */ 965, 929, 254, 110, 1017, 1017, 1019, 1020, 27, 1178, + /* 1650 */ 451, 974, 975, 281, 108, 562, 1292, 4, 396, 396, + /* 1660 */ 395, 266, 393, 1347, 1090, 849, 1090, 1089, 862, 1089, + /* 1670 */ 146, 565, 930, 358, 110, 303, 368, 557, 227, 1368, + /* 1680 */ 315, 108, 562, 1415, 4, 1343, 496, 1021, 314, 1354, + /* 1690 */ 1569, 556, 1421, 1272, 449, 204, 1263, 1251, 565, 1250, + /* 1700 */ 1252, 1588, 269, 1340, 371, 373, 559, 375, 11, 212, + /* 1710 */ 397, 225, 321, 284, 1402, 460, 287, 331, 229, 332, + /* 1720 */ 292, 449, 324, 216, 337, 1407, 164, 481, 377, 137, + /* 1730 */ 1406, 404, 506, 559, 1290, 1027, 361, 1481, 199, 1591, + /* 1740 */ 211, 106, 106, 936, 1480, 1229, 228, 560, 175, 107, + /* 1750 */ 200, 449, 572, 571, 258, 391, 1017, 1528, 1526, 223, + /* 1760 */ 1226, 422, 1027, 83, 208, 79, 82, 184, 106, 106, + /* 1770 */ 1486, 126, 1397, 550, 169, 320, 107, 1403, 449, 572, + /* 1780 */ 571, 414, 177, 1017, 1390, 323, 308, 561, 1017, 1017, + /* 1790 */ 1019, 1020, 27, 465, 35, 235, 100, 562, 499, 4, + /* 1800 */ 179, 180, 181, 466, 182, 96, 402, 1409, 473, 1408, + /* 1810 */ 455, 36, 1411, 565, 188, 1017, 1017, 1019, 1020, 27, + /* 1820 */ 405, 1475, 488, 239, 89, 494, 270, 192, 1497, 342, + /* 1830 */ 241, 497, 346, 242, 515, 243, 449, 1253, 1310, 1309, + /* 1840 */ 407, 91, 436, 1308, 883, 217, 438, 439, 559, 524, + /* 1850 */ 531, 408, 1351, 1606, 1301, 301, 1280, 1605, 360, 1279, + /* 1860 */ 1278, 1604, 1574, 302, 95, 366, 370, 372, 1300, 1352, + /* 1870 */ 1350, 374, 256, 257, 442, 10, 1349, 1027, 1461, 385, + /* 1880 */ 97, 1375, 102, 106, 106, 534, 1560, 34, 1559, 574, + /* 1890 */ 1184, 107, 265, 449, 572, 571, 267, 268, 1017, 203, + /* 1900 */ 1333, 383, 389, 1332, 390, 575, 376, 1248, 1243, 1513, + /* 1910 */ 161, 143, 1374, 1514, 1512, 162, 299, 1511, 163, 213, + /* 1920 */ 836, 214, 78, 450, 205, 310, 224, 1088, 140, 1086, + /* 1930 */ 1017, 1017, 1019, 1020, 27, 318, 306, 176, 165, 1210, + /* 1940 */ 178, 231, 915, 234, 330, 1102, 183, 166, 167, 425, + /* 1950 */ 427, 185, 85, 86, 87, 168, 88, 415, 1105, 236, + /* 1960 */ 174, 237, 416, 1101, 154, 18, 238, 341, 1223, 240, + /* 1970 */ 254, 493, 190, 1094, 37, 189, 851, 498, 362, 244, + /* 1980 */ 354, 510, 191, 90, 170, 502, 19, 20, 507, 93, + /* 1990 */ 881, 357, 92, 300, 894, 155, 517, 218, 1172, 156, + /* 2000 */ 1054, 959, 1141, 94, 39, 1140, 273, 275, 964, 194, + /* 2010 */ 110, 1158, 1162, 1160, 253, 21, 1166, 7, 1146, 33, + /* 2020 */ 22, 197, 23, 24, 25, 1165, 546, 26, 98, 1069, + /* 2030 */ 1055, 1053, 1057, 1111, 1058, 1110, 259, 260, 28, 40, + /* 2040 */ 1180, 1022, 863, 109, 29, 566, 394, 1179, 139, 172, + /* 2050 */ 925, 261, 1239, 1239, 1239, 1239, 1239, 1239, 1239, 1239, + /* 2060 */ 262, 1239, 1239, 1239, 1239, 1597, 1239, 1239, 1239, 1239, + /* 2070 */ 1596, }; static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 192, 221, 192, 223, 192, 214, 272, 273, 274, 217, - /* 10 */ 192, 231, 217, 192, 192, 192, 272, 273, 274, 19, - /* 20 */ 233, 234, 214, 215, 214, 215, 203, 293, 203, 233, - /* 30 */ 234, 31, 214, 215, 214, 214, 215, 214, 215, 39, - /* 40 */ 208, 209, 210, 43, 44, 45, 46, 47, 48, 49, - /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 236, 19, - /* 60 */ 237, 238, 237, 238, 272, 273, 274, 272, 273, 274, - /* 70 */ 192, 211, 251, 250, 251, 250, 26, 192, 200, 254, - /* 80 */ 255, 260, 204, 43, 44, 45, 46, 47, 48, 49, - /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 192, 214, - /* 100 */ 215, 214, 102, 103, 104, 105, 106, 107, 108, 109, - /* 110 */ 110, 111, 112, 59, 229, 192, 294, 16, 306, 307, - /* 120 */ 312, 313, 312, 311, 314, 59, 86, 204, 88, 19, - /* 130 */ 312, 313, 272, 273, 274, 271, 26, 22, 54, 55, - /* 140 */ 56, 57, 102, 103, 104, 105, 106, 107, 108, 109, - /* 150 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49, - /* 160 */ 50, 51, 52, 53, 54, 55, 56, 57, 53, 115, - /* 170 */ 116, 117, 118, 309, 310, 121, 122, 123, 77, 69, - /* 180 */ 79, 115, 116, 117, 59, 131, 102, 103, 104, 105, - /* 190 */ 106, 107, 108, 109, 110, 111, 112, 72, 148, 19, - /* 200 */ 54, 55, 56, 57, 58, 108, 109, 110, 111, 112, - /* 210 */ 304, 305, 102, 103, 104, 105, 106, 107, 108, 109, - /* 220 */ 110, 111, 112, 43, 44, 45, 46, 47, 48, 49, - /* 230 */ 50, 51, 52, 53, 54, 55, 56, 57, 19, 112, - /* 240 */ 115, 116, 117, 24, 208, 209, 210, 67, 102, 103, - /* 250 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 192, - /* 260 */ 59, 160, 43, 44, 45, 46, 47, 48, 49, 50, - /* 270 */ 51, 52, 53, 54, 55, 56, 57, 19, 46, 47, - /* 280 */ 48, 49, 102, 103, 104, 105, 106, 107, 108, 109, - /* 290 */ 110, 111, 112, 213, 73, 184, 185, 186, 187, 188, - /* 300 */ 189, 221, 81, 236, 46, 194, 192, 196, 19, 59, - /* 310 */ 133, 59, 135, 136, 203, 192, 115, 116, 117, 127, - /* 320 */ 128, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 330 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50, - /* 340 */ 51, 52, 53, 54, 55, 56, 57, 126, 237, 238, - /* 350 */ 100, 150, 120, 230, 186, 187, 188, 189, 137, 138, - /* 360 */ 108, 250, 194, 26, 196, 115, 116, 115, 116, 117, - /* 370 */ 120, 203, 114, 164, 165, 264, 102, 103, 104, 105, - /* 380 */ 106, 107, 108, 109, 110, 111, 112, 192, 130, 111, - /* 390 */ 112, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 400 */ 111, 112, 152, 153, 154, 237, 238, 296, 192, 214, - /* 410 */ 215, 228, 192, 307, 192, 19, 59, 311, 250, 23, - /* 420 */ 22, 106, 107, 108, 109, 110, 111, 112, 192, 72, - /* 430 */ 214, 215, 264, 192, 214, 215, 214, 215, 149, 43, - /* 440 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 450 */ 54, 55, 56, 57, 117, 214, 215, 59, 19, 187, - /* 460 */ 192, 189, 23, 81, 296, 192, 194, 251, 196, 59, - /* 470 */ 229, 251, 115, 116, 117, 203, 260, 106, 107, 142, - /* 480 */ 260, 267, 43, 44, 45, 46, 47, 48, 49, 50, - /* 490 */ 51, 52, 53, 54, 55, 56, 57, 261, 102, 103, - /* 500 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 237, - /* 510 */ 238, 76, 192, 115, 116, 117, 144, 192, 76, 137, - /* 520 */ 138, 192, 250, 152, 89, 154, 116, 92, 19, 87, - /* 530 */ 262, 89, 23, 22, 92, 163, 264, 192, 22, 214, - /* 540 */ 215, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 550 */ 111, 112, 43, 44, 45, 46, 47, 48, 49, 50, - /* 560 */ 51, 52, 53, 54, 55, 56, 57, 19, 296, 118, - /* 570 */ 59, 23, 121, 122, 123, 59, 251, 26, 46, 306, - /* 580 */ 307, 261, 131, 192, 311, 192, 144, 192, 22, 203, - /* 590 */ 100, 43, 44, 45, 46, 47, 48, 49, 50, 51, - /* 600 */ 52, 53, 54, 55, 56, 57, 116, 214, 215, 271, - /* 610 */ 120, 102, 103, 104, 105, 106, 107, 108, 109, 110, - /* 620 */ 111, 112, 229, 237, 238, 59, 115, 116, 117, 299, - /* 630 */ 300, 115, 116, 117, 59, 16, 250, 19, 192, 192, - /* 640 */ 19, 23, 152, 153, 154, 24, 114, 309, 310, 192, - /* 650 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - /* 660 */ 112, 43, 44, 45, 46, 47, 48, 49, 50, 51, - /* 670 */ 52, 53, 54, 55, 56, 57, 19, 7, 8, 9, - /* 680 */ 23, 115, 116, 117, 203, 290, 239, 238, 137, 138, - /* 690 */ 115, 116, 117, 236, 192, 22, 77, 81, 79, 250, - /* 700 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 710 */ 53, 54, 55, 56, 57, 192, 95, 142, 237, 238, - /* 720 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - /* 730 */ 112, 250, 59, 112, 192, 119, 26, 214, 215, 118, - /* 740 */ 119, 120, 121, 122, 123, 124, 19, 192, 267, 302, - /* 750 */ 23, 130, 229, 137, 138, 23, 214, 215, 26, 102, - /* 760 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - /* 770 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - /* 780 */ 53, 54, 55, 56, 57, 19, 76, 11, 115, 116, - /* 790 */ 117, 192, 29, 251, 239, 73, 33, 192, 192, 89, - /* 800 */ 192, 192, 92, 192, 192, 126, 127, 128, 224, 43, - /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 820 */ 54, 55, 56, 57, 192, 35, 214, 215, 65, 102, - /* 830 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - /* 840 */ 59, 229, 192, 192, 239, 239, 214, 215, 126, 127, - /* 850 */ 128, 126, 127, 128, 307, 19, 66, 302, 311, 192, - /* 860 */ 261, 229, 224, 22, 74, 214, 215, 192, 102, 103, - /* 870 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 43, - /* 880 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - /* 890 */ 54, 55, 56, 57, 192, 192, 115, 116, 117, 19, - /* 900 */ 59, 290, 251, 127, 128, 192, 23, 302, 302, 26, - /* 910 */ 302, 236, 192, 22, 21, 24, 214, 215, 192, 129, - /* 920 */ 22, 192, 24, 142, 158, 45, 46, 47, 48, 49, - /* 930 */ 50, 51, 52, 53, 54, 55, 56, 57, 102, 103, - /* 940 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 192, - /* 950 */ 59, 12, 192, 251, 192, 305, 192, 116, 22, 23, - /* 960 */ 242, 203, 26, 203, 24, 236, 27, 237, 238, 266, - /* 970 */ 252, 214, 215, 80, 214, 215, 214, 215, 214, 215, - /* 980 */ 250, 42, 102, 103, 104, 105, 106, 107, 108, 109, - /* 990 */ 110, 111, 112, 229, 158, 237, 238, 237, 238, 59, - /* 1000 */ 117, 281, 63, 192, 192, 192, 192, 116, 250, 192, - /* 1010 */ 250, 251, 73, 251, 19, 122, 290, 237, 238, 24, - /* 1020 */ 260, 209, 210, 209, 210, 142, 242, 214, 215, 197, - /* 1030 */ 250, 22, 23, 276, 19, 26, 252, 101, 43, 44, - /* 1040 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - /* 1050 */ 55, 56, 57, 160, 19, 211, 116, 192, 43, 44, - /* 1060 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - /* 1070 */ 55, 56, 57, 192, 192, 22, 192, 266, 43, 44, - /* 1080 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - /* 1090 */ 55, 56, 57, 192, 282, 192, 282, 102, 103, 104, - /* 1100 */ 105, 106, 107, 108, 109, 110, 111, 112, 59, 192, - /* 1110 */ 101, 279, 192, 192, 230, 283, 192, 102, 103, 104, - /* 1120 */ 105, 106, 107, 108, 109, 110, 111, 112, 204, 211, - /* 1130 */ 66, 214, 215, 289, 214, 215, 108, 102, 103, 104, - /* 1140 */ 105, 106, 107, 108, 109, 110, 111, 112, 266, 85, - /* 1150 */ 226, 192, 228, 22, 23, 106, 107, 19, 94, 106, - /* 1160 */ 107, 192, 134, 114, 115, 116, 117, 139, 119, 266, - /* 1170 */ 203, 206, 207, 214, 215, 192, 127, 192, 206, 207, - /* 1180 */ 59, 192, 44, 45, 46, 47, 48, 49, 50, 51, - /* 1190 */ 52, 53, 54, 55, 56, 57, 192, 76, 192, 214, - /* 1200 */ 215, 152, 284, 154, 237, 238, 192, 289, 87, 145, - /* 1210 */ 89, 19, 20, 92, 22, 22, 23, 250, 307, 236, - /* 1220 */ 214, 215, 311, 203, 12, 247, 192, 249, 36, 307, - /* 1230 */ 192, 262, 101, 311, 137, 138, 115, 116, 117, 27, - /* 1240 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - /* 1250 */ 112, 59, 214, 215, 42, 203, 307, 237, 238, 192, - /* 1260 */ 311, 192, 26, 71, 192, 144, 262, 297, 298, 203, - /* 1270 */ 250, 19, 20, 81, 22, 63, 262, 254, 255, 15, - /* 1280 */ 26, 214, 215, 214, 215, 26, 214, 215, 36, 237, - /* 1290 */ 238, 192, 100, 114, 101, 192, 262, 192, 106, 107, - /* 1300 */ 48, 134, 250, 237, 238, 113, 139, 115, 116, 117, - /* 1310 */ 192, 59, 120, 214, 215, 242, 250, 214, 215, 214, - /* 1320 */ 215, 148, 149, 71, 60, 252, 242, 192, 149, 137, - /* 1330 */ 138, 192, 214, 215, 192, 19, 252, 85, 192, 59, - /* 1340 */ 192, 157, 90, 159, 152, 153, 154, 155, 156, 214, - /* 1350 */ 215, 192, 100, 214, 215, 19, 214, 215, 106, 107, - /* 1360 */ 214, 215, 214, 215, 22, 113, 192, 115, 116, 117, - /* 1370 */ 192, 242, 120, 214, 215, 192, 24, 192, 31, 192, - /* 1380 */ 144, 252, 26, 192, 125, 99, 39, 192, 214, 215, - /* 1390 */ 192, 59, 214, 215, 192, 141, 116, 214, 215, 214, - /* 1400 */ 215, 214, 215, 61, 152, 153, 154, 155, 156, 0, - /* 1410 */ 1, 2, 214, 215, 5, 192, 214, 215, 132, 10, - /* 1420 */ 11, 12, 13, 14, 1, 2, 17, 192, 5, 19, - /* 1430 */ 20, 115, 22, 10, 11, 12, 13, 14, 192, 30, - /* 1440 */ 17, 32, 23, 192, 23, 26, 36, 26, 116, 40, - /* 1450 */ 192, 115, 192, 30, 192, 32, 119, 120, 59, 5, - /* 1460 */ 214, 215, 128, 40, 10, 11, 12, 13, 14, 59, - /* 1470 */ 19, 17, 214, 215, 214, 215, 214, 215, 120, 70, - /* 1480 */ 192, 71, 22, 192, 30, 151, 32, 78, 130, 128, - /* 1490 */ 81, 192, 140, 70, 40, 85, 192, 141, 7, 8, - /* 1500 */ 90, 78, 214, 215, 81, 214, 215, 98, 83, 84, - /* 1510 */ 100, 192, 151, 214, 215, 116, 106, 107, 214, 215, - /* 1520 */ 192, 98, 192, 113, 70, 115, 116, 117, 23, 224, - /* 1530 */ 120, 26, 78, 214, 215, 81, 19, 20, 152, 22, - /* 1540 */ 154, 132, 214, 215, 214, 215, 137, 138, 97, 192, - /* 1550 */ 256, 192, 98, 36, 23, 132, 192, 26, 192, 192, - /* 1560 */ 137, 138, 152, 153, 154, 155, 156, 192, 192, 192, - /* 1570 */ 161, 214, 215, 214, 215, 192, 59, 192, 214, 215, - /* 1580 */ 214, 215, 192, 152, 161, 154, 132, 192, 71, 214, - /* 1590 */ 215, 137, 138, 192, 192, 192, 19, 20, 192, 22, - /* 1600 */ 140, 253, 85, 192, 214, 215, 192, 90, 23, 214, - /* 1610 */ 215, 26, 192, 36, 192, 161, 23, 100, 192, 26, - /* 1620 */ 214, 215, 192, 106, 107, 214, 215, 192, 23, 192, - /* 1630 */ 113, 26, 115, 116, 117, 23, 59, 120, 26, 23, - /* 1640 */ 23, 23, 26, 26, 26, 316, 234, 23, 71, 23, - /* 1650 */ 26, 192, 26, 192, 192, 192, 192, 192, 192, 192, - /* 1660 */ 192, 253, 212, 190, 286, 285, 253, 240, 253, 152, - /* 1670 */ 153, 154, 155, 156, 241, 243, 295, 100, 291, 291, - /* 1680 */ 223, 253, 227, 106, 107, 108, 269, 244, 244, 265, - /* 1690 */ 113, 257, 115, 116, 117, 257, 243, 120, 269, 218, - /* 1700 */ 217, 265, 217, 19, 20, 217, 22, 195, 269, 269, - /* 1710 */ 60, 295, 140, 257, 243, 241, 247, 247, 199, 278, - /* 1720 */ 36, 199, 199, 38, 19, 20, 150, 22, 149, 152, - /* 1730 */ 153, 154, 155, 156, 22, 147, 144, 295, 292, 292, - /* 1740 */ 248, 36, 247, 59, 268, 270, 43, 232, 248, 247, - /* 1750 */ 18, 235, 199, 281, 18, 71, 235, 198, 148, 235, - /* 1760 */ 235, 232, 244, 270, 59, 268, 270, 232, 199, 198, - /* 1770 */ 244, 244, 244, 62, 288, 22, 71, 157, 114, 199, - /* 1780 */ 198, 287, 219, 199, 100, 198, 219, 64, 199, 198, - /* 1790 */ 106, 107, 22, 225, 216, 222, 222, 113, 125, 115, - /* 1800 */ 116, 117, 216, 164, 120, 100, 216, 24, 225, 310, - /* 1810 */ 303, 106, 107, 219, 216, 218, 216, 216, 113, 216, - /* 1820 */ 115, 116, 117, 280, 280, 120, 112, 219, 258, 143, - /* 1830 */ 114, 199, 91, 82, 259, 315, 152, 153, 154, 155, - /* 1840 */ 156, 22, 199, 277, 263, 315, 157, 248, 146, 145, - /* 1850 */ 25, 202, 26, 201, 259, 259, 13, 152, 153, 154, - /* 1860 */ 155, 156, 258, 248, 258, 263, 259, 258, 247, 246, - /* 1870 */ 245, 244, 193, 193, 6, 205, 211, 211, 191, 191, - /* 1880 */ 211, 191, 211, 205, 212, 211, 275, 220, 220, 212, - /* 1890 */ 4, 3, 22, 162, 15, 23, 205, 16, 23, 138, - /* 1900 */ 150, 129, 26, 141, 24, 20, 143, 16, 1, 141, - /* 1910 */ 129, 129, 61, 53, 301, 301, 150, 298, 53, 37, - /* 1920 */ 53, 129, 53, 115, 34, 140, 1, 5, 22, 114, - /* 1930 */ 68, 160, 68, 75, 26, 41, 140, 114, 24, 20, - /* 1940 */ 19, 130, 124, 23, 67, 22, 22, 37, 22, 22, - /* 1950 */ 67, 59, 24, 96, 22, 148, 67, 28, 23, 22, - /* 1960 */ 26, 23, 23, 23, 23, 22, 22, 140, 97, 23, - /* 1970 */ 23, 115, 142, 75, 26, 88, 34, 44, 75, 34, - /* 1980 */ 23, 86, 22, 34, 34, 34, 93, 34, 24, 26, - /* 1990 */ 34, 26, 23, 23, 23, 23, 23, 11, 23, 22, - /* 2000 */ 26, 22, 22, 140, 23, 23, 22, 22, 134, 26, - /* 2010 */ 23, 15, 1, 140, 1, 317, 317, 317, 140, 317, - /* 2020 */ 317, 317, 317, 317, 140, 317, 317, 317, 317, 317, - /* 2030 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2040 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2050 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2060 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2070 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2080 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2090 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2100 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2110 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2120 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2130 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2140 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2150 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2160 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2170 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2180 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2190 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, - /* 2200 */ 317, 317, 317, 317, 317, 317, 317, 317, 317, + /* 0 */ 193, 223, 193, 225, 193, 193, 193, 274, 275, 276, + /* 10 */ 193, 233, 219, 193, 274, 275, 276, 206, 206, 19, + /* 20 */ 193, 219, 216, 216, 217, 216, 217, 193, 295, 216, + /* 30 */ 217, 31, 205, 216, 217, 193, 216, 217, 213, 39, + /* 40 */ 228, 193, 230, 43, 44, 45, 46, 47, 48, 49, + /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 193, 19, + /* 60 */ 185, 186, 187, 188, 189, 190, 253, 274, 275, 276, + /* 70 */ 195, 193, 197, 253, 216, 262, 274, 275, 276, 204, + /* 80 */ 238, 204, 262, 43, 44, 45, 46, 47, 48, 49, + /* 90 */ 50, 51, 52, 53, 54, 55, 56, 57, 264, 274, + /* 100 */ 275, 276, 102, 103, 104, 105, 106, 107, 108, 109, + /* 110 */ 110, 111, 112, 113, 239, 240, 239, 240, 210, 211, + /* 120 */ 212, 314, 315, 314, 59, 316, 86, 252, 88, 252, + /* 130 */ 19, 314, 315, 256, 257, 309, 25, 72, 296, 313, + /* 140 */ 193, 266, 102, 103, 104, 105, 106, 107, 108, 109, + /* 150 */ 110, 111, 112, 113, 43, 44, 45, 46, 47, 48, + /* 160 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 81, + /* 170 */ 292, 59, 307, 298, 108, 109, 110, 111, 112, 113, + /* 180 */ 69, 116, 117, 118, 72, 128, 129, 193, 241, 22, + /* 190 */ 113, 54, 55, 56, 57, 58, 102, 103, 104, 105, + /* 200 */ 106, 107, 108, 109, 110, 111, 112, 113, 120, 193, + /* 210 */ 216, 217, 25, 102, 103, 104, 105, 106, 107, 108, + /* 220 */ 109, 110, 111, 112, 113, 231, 138, 139, 116, 117, + /* 230 */ 118, 106, 107, 19, 216, 54, 55, 56, 57, 102, + /* 240 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + /* 250 */ 113, 304, 25, 46, 47, 48, 49, 43, 44, 45, + /* 260 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, + /* 270 */ 56, 57, 193, 106, 107, 59, 193, 19, 153, 263, + /* 280 */ 155, 67, 24, 102, 103, 104, 105, 106, 107, 108, + /* 290 */ 109, 110, 111, 112, 113, 216, 217, 59, 230, 216, + /* 300 */ 217, 43, 44, 45, 46, 47, 48, 49, 50, 51, + /* 310 */ 52, 53, 54, 55, 56, 57, 102, 103, 104, 105, + /* 320 */ 106, 107, 108, 109, 110, 111, 112, 113, 121, 142, + /* 330 */ 59, 193, 116, 117, 118, 119, 253, 204, 122, 123, + /* 340 */ 124, 19, 20, 81, 22, 262, 108, 19, 132, 165, + /* 350 */ 166, 193, 24, 126, 116, 117, 118, 278, 36, 193, + /* 360 */ 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + /* 370 */ 112, 113, 239, 240, 216, 217, 215, 106, 107, 241, + /* 380 */ 19, 59, 216, 217, 223, 252, 115, 116, 117, 118, + /* 390 */ 73, 120, 26, 71, 193, 22, 193, 231, 81, 128, + /* 400 */ 138, 139, 269, 81, 43, 44, 45, 46, 47, 48, + /* 410 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 216, + /* 420 */ 217, 198, 100, 95, 153, 59, 155, 193, 106, 107, + /* 430 */ 235, 236, 59, 193, 193, 249, 114, 251, 116, 117, + /* 440 */ 118, 113, 304, 121, 127, 204, 193, 119, 120, 121, + /* 450 */ 122, 123, 124, 125, 193, 138, 139, 216, 217, 131, + /* 460 */ 138, 139, 193, 102, 103, 104, 105, 106, 107, 108, + /* 470 */ 109, 110, 111, 112, 113, 153, 154, 155, 156, 157, + /* 480 */ 239, 240, 116, 117, 118, 76, 193, 193, 19, 116, + /* 490 */ 117, 118, 23, 252, 253, 193, 87, 204, 89, 238, + /* 500 */ 193, 92, 268, 262, 281, 203, 193, 205, 285, 216, + /* 510 */ 217, 150, 43, 44, 45, 46, 47, 48, 49, 50, + /* 520 */ 51, 52, 53, 54, 55, 56, 57, 193, 193, 216, + /* 530 */ 217, 19, 239, 240, 59, 23, 106, 107, 108, 109, + /* 540 */ 110, 111, 112, 113, 231, 252, 253, 193, 308, 309, + /* 550 */ 193, 145, 59, 313, 145, 43, 44, 45, 46, 47, + /* 560 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + /* 570 */ 164, 102, 103, 104, 105, 106, 107, 108, 109, 110, + /* 580 */ 111, 112, 113, 119, 193, 193, 122, 123, 124, 193, + /* 590 */ 283, 116, 117, 118, 235, 236, 132, 59, 241, 264, + /* 600 */ 59, 193, 19, 23, 193, 25, 23, 216, 217, 116, + /* 610 */ 117, 118, 216, 217, 102, 103, 104, 105, 106, 107, + /* 620 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, + /* 630 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + /* 640 */ 57, 19, 308, 309, 151, 23, 25, 313, 135, 253, + /* 650 */ 21, 193, 241, 140, 116, 117, 118, 116, 117, 118, + /* 660 */ 268, 304, 22, 301, 302, 43, 44, 45, 46, 47, + /* 670 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + /* 680 */ 193, 143, 193, 193, 143, 102, 103, 104, 105, 106, + /* 690 */ 107, 108, 109, 110, 111, 112, 113, 76, 118, 59, + /* 700 */ 292, 211, 212, 216, 217, 216, 217, 73, 193, 80, + /* 710 */ 89, 25, 19, 92, 193, 304, 23, 22, 231, 193, + /* 720 */ 231, 193, 22, 143, 102, 103, 104, 105, 106, 107, + /* 730 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, + /* 740 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + /* 750 */ 57, 19, 123, 193, 59, 23, 116, 117, 118, 59, + /* 760 */ 193, 127, 128, 129, 306, 307, 210, 211, 212, 193, + /* 770 */ 22, 111, 112, 113, 284, 43, 44, 45, 46, 47, + /* 780 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + /* 790 */ 161, 193, 216, 217, 268, 102, 103, 104, 105, 106, + /* 800 */ 107, 108, 109, 110, 111, 112, 113, 59, 193, 193, + /* 810 */ 193, 116, 117, 118, 216, 217, 116, 117, 118, 304, + /* 820 */ 239, 240, 19, 263, 138, 139, 23, 211, 212, 231, + /* 830 */ 263, 216, 217, 252, 102, 103, 104, 105, 106, 107, + /* 840 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, + /* 850 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + /* 860 */ 57, 19, 193, 11, 116, 117, 118, 240, 253, 193, + /* 870 */ 201, 239, 240, 193, 134, 206, 136, 137, 193, 252, + /* 880 */ 193, 264, 193, 193, 252, 43, 44, 45, 46, 47, + /* 890 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + /* 900 */ 284, 216, 217, 216, 217, 102, 103, 104, 105, 106, + /* 910 */ 107, 108, 109, 110, 111, 112, 113, 193, 231, 193, + /* 920 */ 187, 188, 189, 190, 127, 128, 129, 238, 195, 193, + /* 930 */ 197, 16, 19, 7, 8, 9, 193, 204, 253, 193, + /* 940 */ 216, 217, 216, 217, 102, 103, 104, 105, 106, 107, + /* 950 */ 108, 109, 110, 111, 112, 113, 43, 44, 45, 46, + /* 960 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + /* 970 */ 57, 213, 239, 240, 193, 76, 19, 188, 232, 190, + /* 980 */ 128, 129, 292, 193, 195, 252, 197, 46, 89, 138, + /* 990 */ 139, 92, 77, 204, 79, 193, 269, 216, 217, 266, + /* 1000 */ 204, 159, 45, 46, 47, 48, 49, 50, 51, 52, + /* 1010 */ 53, 54, 55, 56, 57, 102, 103, 104, 105, 106, + /* 1020 */ 107, 108, 109, 110, 111, 112, 113, 12, 239, 240, + /* 1030 */ 193, 298, 22, 23, 253, 239, 240, 127, 128, 129, + /* 1040 */ 238, 252, 27, 193, 286, 204, 193, 204, 252, 291, + /* 1050 */ 193, 273, 22, 23, 100, 266, 115, 42, 268, 102, + /* 1060 */ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + /* 1070 */ 113, 117, 159, 216, 217, 121, 161, 19, 63, 193, + /* 1080 */ 239, 240, 239, 240, 12, 208, 209, 298, 73, 311, + /* 1090 */ 312, 238, 19, 252, 25, 252, 22, 24, 24, 27, + /* 1100 */ 193, 264, 216, 217, 46, 208, 209, 153, 154, 155, + /* 1110 */ 253, 101, 19, 23, 42, 25, 43, 44, 45, 46, + /* 1120 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + /* 1130 */ 57, 101, 19, 59, 25, 63, 43, 44, 45, 46, + /* 1140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + /* 1150 */ 57, 22, 23, 115, 25, 24, 43, 44, 45, 46, + /* 1160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + /* 1170 */ 57, 22, 23, 115, 25, 102, 103, 104, 105, 106, + /* 1180 */ 107, 108, 109, 110, 111, 112, 113, 118, 150, 131, + /* 1190 */ 59, 117, 22, 273, 193, 102, 103, 104, 105, 106, + /* 1200 */ 107, 108, 109, 110, 111, 112, 113, 204, 66, 204, + /* 1210 */ 35, 204, 143, 213, 193, 102, 103, 104, 105, 106, + /* 1220 */ 107, 108, 109, 110, 111, 112, 113, 85, 193, 59, + /* 1230 */ 101, 311, 312, 16, 193, 19, 94, 216, 217, 238, + /* 1240 */ 193, 66, 239, 240, 239, 240, 239, 240, 117, 74, + /* 1250 */ 101, 216, 217, 193, 193, 252, 193, 252, 149, 252, + /* 1260 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, + /* 1270 */ 54, 55, 56, 57, 193, 193, 193, 5, 59, 216, + /* 1280 */ 217, 25, 10, 11, 12, 13, 14, 117, 146, 17, + /* 1290 */ 193, 291, 193, 232, 77, 76, 79, 216, 217, 216, + /* 1300 */ 217, 31, 30, 309, 32, 130, 87, 313, 89, 39, + /* 1310 */ 193, 92, 40, 216, 217, 216, 217, 108, 102, 103, + /* 1320 */ 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + /* 1330 */ 299, 300, 193, 216, 217, 116, 117, 118, 19, 20, + /* 1340 */ 193, 22, 70, 309, 135, 193, 264, 313, 193, 140, + /* 1350 */ 78, 193, 226, 81, 59, 36, 193, 309, 193, 29, + /* 1360 */ 193, 313, 193, 33, 145, 193, 59, 48, 216, 217, + /* 1370 */ 98, 216, 217, 193, 216, 217, 193, 244, 59, 216, + /* 1380 */ 217, 216, 217, 216, 217, 216, 217, 254, 216, 217, + /* 1390 */ 71, 193, 244, 193, 193, 65, 216, 217, 193, 216, + /* 1400 */ 217, 145, 254, 244, 85, 133, 15, 100, 193, 90, + /* 1410 */ 138, 139, 117, 254, 216, 217, 216, 217, 193, 100, + /* 1420 */ 193, 216, 217, 116, 117, 106, 107, 19, 121, 193, + /* 1430 */ 193, 216, 217, 114, 162, 116, 117, 118, 244, 244, + /* 1440 */ 121, 216, 217, 216, 217, 193, 309, 129, 254, 254, + /* 1450 */ 313, 60, 216, 217, 19, 256, 257, 193, 120, 121, + /* 1460 */ 153, 154, 155, 149, 150, 25, 24, 99, 216, 217, + /* 1470 */ 152, 193, 153, 154, 155, 156, 157, 0, 1, 2, + /* 1480 */ 216, 217, 5, 22, 158, 24, 160, 10, 11, 12, + /* 1490 */ 13, 14, 193, 23, 17, 25, 193, 19, 20, 193, + /* 1500 */ 22, 133, 193, 22, 22, 193, 22, 30, 193, 32, + /* 1510 */ 19, 20, 129, 22, 36, 216, 217, 40, 193, 216, + /* 1520 */ 217, 193, 216, 217, 116, 216, 217, 36, 216, 217, + /* 1530 */ 193, 216, 217, 193, 53, 152, 193, 59, 23, 19, + /* 1540 */ 25, 216, 217, 61, 216, 217, 23, 70, 25, 71, + /* 1550 */ 59, 116, 193, 216, 217, 78, 216, 217, 81, 216, + /* 1560 */ 217, 59, 71, 85, 193, 23, 193, 25, 90, 23, + /* 1570 */ 23, 25, 25, 7, 8, 98, 85, 193, 100, 193, + /* 1580 */ 59, 90, 142, 141, 106, 107, 193, 216, 217, 216, + /* 1590 */ 217, 100, 114, 193, 116, 117, 118, 106, 107, 121, + /* 1600 */ 216, 217, 216, 217, 193, 114, 193, 116, 117, 118, + /* 1610 */ 133, 23, 121, 25, 121, 138, 139, 97, 23, 117, + /* 1620 */ 25, 23, 193, 25, 131, 141, 193, 216, 217, 59, + /* 1630 */ 193, 153, 154, 155, 156, 157, 226, 193, 117, 162, + /* 1640 */ 23, 23, 25, 25, 153, 154, 155, 156, 157, 1, + /* 1650 */ 2, 83, 84, 5, 19, 20, 226, 22, 10, 11, + /* 1660 */ 12, 13, 14, 258, 153, 17, 155, 153, 23, 155, + /* 1670 */ 25, 36, 23, 193, 25, 255, 193, 236, 30, 193, + /* 1680 */ 32, 19, 20, 193, 22, 193, 288, 117, 40, 193, + /* 1690 */ 318, 193, 193, 193, 59, 242, 193, 193, 36, 193, + /* 1700 */ 193, 193, 287, 255, 255, 255, 71, 255, 243, 214, + /* 1710 */ 191, 297, 267, 245, 271, 259, 259, 293, 70, 246, + /* 1720 */ 246, 59, 267, 229, 245, 271, 78, 293, 259, 81, + /* 1730 */ 271, 271, 220, 71, 225, 100, 219, 219, 249, 196, + /* 1740 */ 243, 106, 107, 108, 219, 60, 98, 280, 297, 114, + /* 1750 */ 249, 116, 117, 118, 141, 245, 121, 200, 200, 297, + /* 1760 */ 38, 200, 100, 151, 150, 294, 294, 22, 106, 107, + /* 1770 */ 283, 148, 250, 145, 43, 249, 114, 272, 116, 117, + /* 1780 */ 118, 133, 234, 121, 250, 249, 138, 139, 153, 154, + /* 1790 */ 155, 156, 157, 18, 270, 199, 19, 20, 18, 22, + /* 1800 */ 237, 237, 237, 200, 237, 149, 246, 272, 246, 272, + /* 1810 */ 162, 270, 234, 36, 234, 153, 154, 155, 156, 157, + /* 1820 */ 246, 246, 200, 199, 158, 62, 200, 22, 290, 289, + /* 1830 */ 199, 221, 200, 199, 115, 199, 59, 200, 218, 218, + /* 1840 */ 221, 22, 64, 218, 126, 165, 24, 113, 71, 305, + /* 1850 */ 144, 221, 261, 224, 227, 282, 218, 224, 218, 220, + /* 1860 */ 218, 218, 312, 282, 115, 221, 260, 260, 227, 261, + /* 1870 */ 261, 260, 200, 91, 82, 22, 261, 100, 277, 200, + /* 1880 */ 147, 265, 158, 106, 107, 146, 317, 25, 317, 202, + /* 1890 */ 13, 114, 194, 116, 117, 118, 194, 6, 121, 248, + /* 1900 */ 250, 249, 247, 250, 246, 192, 260, 192, 192, 213, + /* 1910 */ 207, 222, 265, 213, 213, 207, 222, 213, 207, 214, + /* 1920 */ 4, 214, 213, 3, 22, 163, 15, 23, 16, 23, + /* 1930 */ 153, 154, 155, 156, 157, 139, 279, 151, 130, 25, + /* 1940 */ 142, 24, 20, 144, 16, 1, 142, 130, 130, 61, + /* 1950 */ 37, 151, 53, 53, 53, 130, 53, 303, 116, 34, + /* 1960 */ 300, 141, 303, 1, 5, 22, 115, 161, 75, 141, + /* 1970 */ 25, 41, 115, 68, 24, 68, 20, 19, 131, 125, + /* 1980 */ 23, 96, 22, 22, 37, 67, 22, 22, 67, 149, + /* 1990 */ 59, 24, 22, 67, 28, 23, 22, 141, 23, 23, + /* 2000 */ 23, 143, 23, 25, 22, 97, 23, 23, 116, 22, + /* 2010 */ 25, 88, 75, 86, 34, 34, 75, 44, 23, 22, + /* 2020 */ 34, 25, 34, 34, 34, 93, 24, 34, 25, 23, + /* 2030 */ 23, 23, 23, 23, 11, 23, 25, 22, 22, 22, + /* 2040 */ 1, 23, 23, 22, 22, 25, 15, 1, 23, 25, + /* 2050 */ 135, 141, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2060 */ 141, 319, 319, 319, 319, 141, 319, 319, 319, 319, + /* 2070 */ 141, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2080 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2090 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2100 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2110 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2120 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2130 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2140 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2150 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2160 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2170 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2180 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2190 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2200 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2210 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2220 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2230 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2240 */ 319, 319, 319, 319, 319, 319, 319, 319, 319, 319, + /* 2250 */ 319, 319, 319, 319, 319, 319, }; -#define YY_SHIFT_COUNT (573) +#define YY_SHIFT_COUNT (577) #define YY_SHIFT_MIN (0) -#define YY_SHIFT_MAX (2013) +#define YY_SHIFT_MAX (2046) static const unsigned short int yy_shift_ofst[] = { - /* 0 */ 1423, 1409, 1454, 1192, 1192, 382, 1252, 1410, 1517, 1684, - /* 10 */ 1684, 1684, 221, 0, 0, 180, 1015, 1684, 1684, 1684, - /* 20 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, - /* 30 */ 1049, 1049, 1121, 1121, 54, 616, 382, 382, 382, 382, - /* 40 */ 382, 40, 110, 219, 289, 396, 439, 509, 548, 618, - /* 50 */ 657, 727, 766, 836, 995, 1015, 1015, 1015, 1015, 1015, - /* 60 */ 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, 1015, - /* 70 */ 1015, 1015, 1015, 1035, 1015, 1138, 880, 880, 1577, 1684, - /* 80 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, - /* 90 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, - /* 100 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, 1684, - /* 110 */ 1684, 1684, 1684, 1705, 1684, 1684, 1684, 1684, 1684, 1684, - /* 120 */ 1684, 1684, 1684, 1684, 1684, 1684, 1684, 146, 84, 84, - /* 130 */ 84, 84, 84, 274, 315, 125, 97, 357, 66, 66, - /* 140 */ 893, 258, 66, 66, 371, 371, 66, 551, 551, 551, - /* 150 */ 551, 192, 209, 209, 278, 127, 2025, 2025, 621, 621, - /* 160 */ 621, 201, 398, 398, 398, 398, 939, 939, 442, 936, - /* 170 */ 1009, 66, 66, 66, 66, 66, 66, 66, 66, 66, - /* 180 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - /* 190 */ 66, 710, 710, 66, 776, 435, 435, 410, 410, 372, - /* 200 */ 1097, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 250, 490, - /* 210 */ 490, 511, 451, 516, 252, 566, 575, 781, 673, 66, - /* 220 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 722, - /* 230 */ 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - /* 240 */ 66, 66, 790, 790, 790, 66, 66, 66, 883, 66, - /* 250 */ 66, 66, 891, 1064, 66, 66, 1212, 66, 66, 66, - /* 260 */ 66, 66, 66, 66, 66, 725, 763, 177, 940, 940, - /* 270 */ 940, 940, 337, 177, 177, 1028, 1053, 670, 1264, 1179, - /* 280 */ 1173, 1254, 1316, 1173, 1316, 1336, 50, 1179, 1179, 50, - /* 290 */ 1179, 1254, 1336, 1259, 732, 532, 1347, 1347, 1347, 1316, - /* 300 */ 1236, 1236, 1184, 1356, 1167, 898, 1650, 1650, 1572, 1572, - /* 310 */ 1685, 1685, 1572, 1576, 1579, 1712, 1588, 1592, 1703, 1588, - /* 320 */ 1592, 1732, 1732, 1732, 1732, 1572, 1736, 1610, 1579, 1579, - /* 330 */ 1610, 1712, 1703, 1610, 1703, 1610, 1572, 1736, 1620, 1711, - /* 340 */ 1572, 1736, 1753, 1572, 1736, 1572, 1736, 1753, 1664, 1664, - /* 350 */ 1664, 1723, 1770, 1770, 1753, 1664, 1673, 1664, 1723, 1664, - /* 360 */ 1664, 1639, 1783, 1714, 1714, 1753, 1686, 1716, 1686, 1716, - /* 370 */ 1686, 1716, 1686, 1716, 1572, 1741, 1741, 1751, 1751, 1588, - /* 380 */ 1592, 1819, 1572, 1689, 1588, 1702, 1704, 1610, 1825, 1826, - /* 390 */ 1843, 1843, 1868, 1868, 1868, 2025, 2025, 2025, 2025, 2025, - /* 400 */ 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, 2025, - /* 410 */ 232, 101, 1131, 1193, 619, 679, 841, 1421, 1286, 115, - /* 420 */ 1352, 1334, 1361, 1419, 1342, 1505, 1531, 1585, 1593, 1605, - /* 430 */ 1612, 1280, 1337, 1491, 1358, 1451, 1332, 1616, 1617, 1425, - /* 440 */ 1618, 1386, 1431, 1624, 1626, 1399, 1460, 1886, 1888, 1870, - /* 450 */ 1731, 1879, 1881, 1872, 1875, 1761, 1750, 1772, 1876, 1876, - /* 460 */ 1880, 1762, 1885, 1763, 1891, 1907, 1768, 1781, 1876, 1782, - /* 470 */ 1851, 1882, 1876, 1766, 1860, 1865, 1867, 1869, 1792, 1808, - /* 480 */ 1890, 1785, 1925, 1922, 1906, 1815, 1771, 1862, 1908, 1864, - /* 490 */ 1858, 1894, 1796, 1823, 1914, 1919, 1921, 1811, 1818, 1923, - /* 500 */ 1877, 1924, 1926, 1920, 1927, 1883, 1892, 1928, 1857, 1929, - /* 510 */ 1932, 1889, 1910, 1935, 1807, 1937, 1938, 1939, 1940, 1934, - /* 520 */ 1941, 1943, 1871, 1827, 1946, 1947, 1856, 1942, 1944, 1830, - /* 530 */ 1948, 1945, 1949, 1950, 1951, 1887, 1898, 1895, 1933, 1903, - /* 540 */ 1893, 1953, 1957, 1960, 1964, 1963, 1965, 1956, 1969, 1948, - /* 550 */ 1970, 1971, 1972, 1973, 1974, 1975, 1977, 1986, 1979, 1980, - /* 560 */ 1981, 1982, 1984, 1985, 1983, 1874, 1863, 1873, 1878, 1884, - /* 570 */ 1987, 1996, 2011, 2013, + /* 0 */ 1648, 1477, 1272, 322, 322, 262, 1319, 1478, 1491, 1662, + /* 10 */ 1662, 1662, 317, 0, 0, 214, 1093, 1662, 1662, 1662, + /* 20 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, + /* 30 */ 271, 271, 1219, 1219, 216, 88, 262, 262, 262, 262, + /* 40 */ 262, 40, 111, 258, 361, 469, 512, 583, 622, 693, + /* 50 */ 732, 803, 842, 913, 1073, 1093, 1093, 1093, 1093, 1093, + /* 60 */ 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, 1093, + /* 70 */ 1093, 1093, 1093, 1113, 1093, 1216, 957, 957, 1635, 1662, + /* 80 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, + /* 90 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, + /* 100 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, + /* 110 */ 1662, 1662, 1662, 1662, 1777, 1662, 1662, 1662, 1662, 1662, + /* 120 */ 1662, 1662, 1662, 1662, 1662, 1662, 1662, 1662, 137, 181, + /* 130 */ 181, 181, 181, 181, 94, 430, 66, 65, 112, 366, + /* 140 */ 475, 475, 629, 1058, 475, 475, 125, 125, 475, 686, + /* 150 */ 686, 686, 660, 686, 57, 184, 184, 77, 77, 2071, + /* 160 */ 2071, 328, 328, 328, 493, 373, 373, 373, 373, 1015, + /* 170 */ 1015, 409, 366, 1129, 1149, 475, 475, 475, 475, 475, + /* 180 */ 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, + /* 190 */ 475, 475, 475, 475, 475, 621, 621, 475, 852, 899, + /* 200 */ 899, 1295, 1295, 406, 851, 2071, 2071, 2071, 2071, 2071, + /* 210 */ 2071, 2071, 1307, 954, 954, 640, 464, 695, 238, 700, + /* 220 */ 538, 541, 748, 475, 475, 475, 475, 475, 475, 475, + /* 230 */ 475, 475, 475, 634, 475, 475, 475, 475, 475, 475, + /* 240 */ 475, 475, 475, 475, 475, 475, 1175, 1175, 1175, 475, + /* 250 */ 475, 475, 580, 475, 475, 475, 1074, 1142, 475, 475, + /* 260 */ 1072, 475, 475, 475, 475, 475, 475, 475, 475, 797, + /* 270 */ 1330, 740, 1131, 1131, 1131, 1131, 1069, 740, 740, 1209, + /* 280 */ 167, 926, 1391, 1038, 1314, 187, 1408, 1314, 1408, 1435, + /* 290 */ 1109, 1038, 1038, 1109, 1038, 187, 1435, 227, 1090, 941, + /* 300 */ 1270, 1270, 1270, 1408, 1256, 1256, 1326, 1440, 513, 1461, + /* 310 */ 1685, 1685, 1613, 1613, 1722, 1722, 1613, 1612, 1614, 1745, + /* 320 */ 1623, 1628, 1731, 1623, 1628, 1775, 1775, 1775, 1775, 1613, + /* 330 */ 1780, 1656, 1614, 1614, 1656, 1745, 1731, 1656, 1731, 1656, + /* 340 */ 1613, 1780, 1666, 1763, 1613, 1780, 1805, 1613, 1780, 1613, + /* 350 */ 1780, 1805, 1719, 1719, 1719, 1778, 1819, 1819, 1805, 1719, + /* 360 */ 1718, 1719, 1778, 1719, 1719, 1680, 1822, 1734, 1734, 1805, + /* 370 */ 1706, 1749, 1706, 1749, 1706, 1749, 1706, 1749, 1613, 1782, + /* 380 */ 1782, 1792, 1792, 1623, 1628, 1853, 1613, 1724, 1623, 1733, + /* 390 */ 1739, 1656, 1862, 1877, 1877, 1891, 1891, 1891, 2071, 2071, + /* 400 */ 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, 2071, + /* 410 */ 2071, 2071, 2071, 207, 915, 1010, 1030, 1217, 910, 1170, + /* 420 */ 1470, 1368, 1481, 1442, 1318, 1383, 1515, 1482, 1523, 1542, + /* 430 */ 1546, 1547, 1588, 1595, 1502, 1338, 1566, 1493, 1520, 1521, + /* 440 */ 1598, 1617, 1568, 1618, 1511, 1514, 1645, 1649, 1570, 1484, + /* 450 */ 1916, 1920, 1902, 1762, 1911, 1912, 1904, 1906, 1796, 1786, + /* 460 */ 1808, 1914, 1914, 1917, 1798, 1922, 1799, 1928, 1944, 1804, + /* 470 */ 1817, 1914, 1818, 1888, 1913, 1914, 1800, 1899, 1900, 1901, + /* 480 */ 1903, 1825, 1842, 1925, 1820, 1962, 1959, 1943, 1851, 1806, + /* 490 */ 1905, 1945, 1907, 1893, 1930, 1828, 1857, 1950, 1956, 1958, + /* 500 */ 1847, 1854, 1960, 1918, 1961, 1964, 1957, 1965, 1921, 1931, + /* 510 */ 1967, 1885, 1966, 1970, 1926, 1947, 1972, 1840, 1974, 1975, + /* 520 */ 1976, 1977, 1978, 1979, 1982, 1908, 1856, 1983, 1984, 1892, + /* 530 */ 1980, 1987, 1858, 1985, 1981, 1986, 1988, 1989, 1923, 1937, + /* 540 */ 1927, 1973, 1941, 1932, 1990, 1995, 1997, 2002, 1996, 2003, + /* 550 */ 1993, 2006, 1985, 2007, 2008, 2009, 2010, 2011, 2012, 2015, + /* 560 */ 2023, 2016, 2017, 2018, 2019, 2021, 2022, 2020, 1915, 1910, + /* 570 */ 1919, 1924, 1929, 2024, 2025, 2031, 2039, 2046, }; -#define YY_REDUCE_COUNT (409) -#define YY_REDUCE_MIN (-266) -#define YY_REDUCE_MAX (1691) +#define YY_REDUCE_COUNT (412) +#define YY_REDUCE_MIN (-267) +#define YY_REDUCE_MAX (1716) static const short yy_reduce_ofst[] = { - /* 0 */ 111, 168, 272, 760, -177, -175, -192, -190, -182, -179, - /* 10 */ 216, 220, 481, -208, -205, -266, -140, -115, 241, 393, - /* 20 */ 523, 325, 612, 632, 542, 651, 764, 757, 702, 762, - /* 30 */ 812, 814, -188, 273, 924, 386, 758, 967, 1020, 1052, - /* 40 */ 1066, -256, -256, -256, -256, -256, -256, -256, -256, -256, - /* 50 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, - /* 60 */ -256, -256, -256, -256, -256, -256, -256, -256, -256, -256, - /* 70 */ -256, -256, -256, -256, -256, -256, -256, -256, 195, 222, - /* 80 */ 813, 917, 920, 959, 985, 1006, 1038, 1067, 1069, 1072, - /* 90 */ 1099, 1103, 1105, 1118, 1135, 1139, 1142, 1146, 1148, 1159, - /* 100 */ 1174, 1178, 1183, 1185, 1187, 1198, 1202, 1246, 1258, 1260, - /* 110 */ 1262, 1288, 1291, 1299, 1304, 1319, 1328, 1330, 1357, 1359, - /* 120 */ 1364, 1366, 1375, 1390, 1395, 1406, 1411, -256, -256, -256, - /* 130 */ -256, -256, -256, -256, -256, 447, -256, 555, -178, 605, - /* 140 */ 832, -220, 606, -94, -168, 36, -122, 730, 780, 730, - /* 150 */ 780, 918, -136, 338, -256, -256, -256, -256, 80, 80, - /* 160 */ 80, 720, 703, 811, 882, 903, -213, -204, 106, 330, - /* 170 */ 330, -77, 236, 320, 599, 67, 457, 675, 729, 395, - /* 180 */ 268, 611, 969, 1004, 726, 1014, 983, 123, 884, 608, - /* 190 */ 1034, 547, 911, 650, 844, 922, 949, 965, 972, 978, - /* 200 */ 449, 970, 718, 784, 1073, 1084, 1023, 1129, -209, -180, - /* 210 */ -113, 114, 183, 329, 345, 391, 446, 502, 609, 667, - /* 220 */ 713, 817, 865, 881, 901, 921, 989, 1191, 1195, 214, - /* 230 */ 1223, 1235, 1251, 1367, 1376, 1377, 1383, 1385, 1401, 1402, - /* 240 */ 1403, 1414, 584, 638, 1305, 1420, 1422, 1426, 1294, 1430, - /* 250 */ 1435, 1437, 1348, 1329, 1459, 1461, 1412, 1462, 345, 1463, - /* 260 */ 1464, 1465, 1466, 1467, 1468, 1378, 1380, 1427, 1408, 1413, - /* 270 */ 1415, 1428, 1294, 1427, 1427, 1433, 1450, 1473, 1381, 1417, - /* 280 */ 1424, 1432, 1434, 1436, 1438, 1387, 1443, 1429, 1439, 1444, - /* 290 */ 1440, 1453, 1388, 1481, 1455, 1457, 1483, 1485, 1488, 1456, - /* 300 */ 1469, 1470, 1441, 1471, 1474, 1512, 1416, 1442, 1519, 1522, - /* 310 */ 1446, 1447, 1523, 1472, 1475, 1476, 1492, 1495, 1515, 1500, - /* 320 */ 1502, 1516, 1521, 1524, 1525, 1553, 1559, 1518, 1493, 1496, - /* 330 */ 1526, 1497, 1529, 1527, 1535, 1528, 1569, 1571, 1486, 1494, - /* 340 */ 1580, 1582, 1563, 1584, 1587, 1589, 1591, 1567, 1578, 1586, - /* 350 */ 1590, 1568, 1573, 1574, 1594, 1598, 1597, 1600, 1583, 1601, - /* 360 */ 1603, 1499, 1507, 1543, 1544, 1608, 1575, 1570, 1595, 1604, - /* 370 */ 1596, 1606, 1607, 1609, 1632, 1520, 1530, 1581, 1602, 1599, - /* 380 */ 1621, 1611, 1643, 1566, 1615, 1623, 1625, 1627, 1649, 1652, - /* 390 */ 1679, 1680, 1687, 1688, 1690, 1613, 1614, 1619, 1670, 1665, - /* 400 */ 1666, 1669, 1671, 1678, 1667, 1668, 1672, 1677, 1674, 1691, + /* 0 */ -125, 733, 789, 241, 293, -123, -193, -191, -183, -187, + /* 10 */ -180, 83, 133, -207, -198, -267, -175, -6, 166, 313, + /* 20 */ 487, 396, 489, 598, 615, 685, 687, 79, 781, 857, + /* 30 */ 490, 616, 240, 334, -188, 796, 841, 843, 1003, 1005, + /* 40 */ 1007, -260, -260, -260, -260, -260, -260, -260, -260, -260, + /* 50 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, + /* 60 */ -260, -260, -260, -260, -260, -260, -260, -260, -260, -260, + /* 70 */ -260, -260, -260, -260, -260, -260, -260, -260, 158, 203, + /* 80 */ 391, 576, 724, 726, 886, 1021, 1035, 1063, 1081, 1083, + /* 90 */ 1097, 1099, 1117, 1152, 1155, 1158, 1163, 1165, 1167, 1169, + /* 100 */ 1172, 1180, 1183, 1198, 1200, 1205, 1215, 1225, 1227, 1236, + /* 110 */ 1252, 1264, 1299, 1303, 1306, 1309, 1312, 1315, 1325, 1328, + /* 120 */ 1337, 1340, 1343, 1371, 1373, 1384, 1386, 1411, -260, -260, + /* 130 */ -260, -260, -260, -260, -260, -260, -260, -53, 138, 302, + /* 140 */ -158, 357, 223, -222, 411, 458, -92, 556, 669, 581, + /* 150 */ 632, 581, -260, 632, 758, 778, 920, -260, -260, -260, + /* 160 */ -260, 161, 161, 161, 307, 234, 392, 526, 790, 195, + /* 170 */ 359, -174, -173, 362, 362, -189, 16, 560, 567, 261, + /* 180 */ 689, 802, 853, -122, -166, 408, 335, 617, 690, 837, + /* 190 */ 1001, 746, 1061, 515, 1082, 994, 1034, -135, 1000, 1048, + /* 200 */ 1137, 877, 897, 186, 627, 1031, 1133, 1148, 1159, 1194, + /* 210 */ 1199, 1195, -194, -142, 18, -152, 68, 201, 253, 269, + /* 220 */ 294, 354, 521, 528, 676, 680, 736, 743, 850, 907, + /* 230 */ 1041, 1047, 1060, 727, 1139, 1147, 1201, 1237, 1278, 1359, + /* 240 */ 1393, 1400, 1413, 1429, 1433, 1437, 1126, 1410, 1430, 1444, + /* 250 */ 1480, 1483, 1405, 1486, 1490, 1492, 1420, 1372, 1496, 1498, + /* 260 */ 1441, 1499, 253, 1500, 1503, 1504, 1506, 1507, 1508, 1398, + /* 270 */ 1415, 1453, 1448, 1449, 1450, 1452, 1405, 1453, 1453, 1465, + /* 280 */ 1495, 1519, 1414, 1443, 1445, 1468, 1456, 1455, 1457, 1424, + /* 290 */ 1473, 1454, 1459, 1474, 1460, 1479, 1434, 1512, 1494, 1509, + /* 300 */ 1517, 1518, 1525, 1469, 1489, 1501, 1467, 1510, 1497, 1543, + /* 310 */ 1451, 1462, 1557, 1558, 1471, 1472, 1561, 1487, 1505, 1524, + /* 320 */ 1522, 1526, 1548, 1534, 1536, 1563, 1564, 1565, 1567, 1603, + /* 330 */ 1596, 1560, 1535, 1537, 1562, 1541, 1578, 1574, 1580, 1575, + /* 340 */ 1622, 1624, 1538, 1540, 1626, 1631, 1610, 1632, 1634, 1637, + /* 350 */ 1636, 1619, 1620, 1621, 1625, 1627, 1629, 1633, 1630, 1638, + /* 360 */ 1639, 1640, 1641, 1642, 1643, 1550, 1544, 1573, 1581, 1644, + /* 370 */ 1591, 1606, 1608, 1607, 1609, 1611, 1615, 1646, 1672, 1569, + /* 380 */ 1571, 1616, 1647, 1650, 1652, 1601, 1679, 1657, 1653, 1651, + /* 390 */ 1655, 1658, 1687, 1698, 1702, 1713, 1715, 1716, 1654, 1659, + /* 400 */ 1660, 1703, 1696, 1700, 1701, 1704, 1708, 1689, 1694, 1705, + /* 410 */ 1707, 1709, 1711, }; static const YYACTIONTYPE yy_default[] = { - /* 0 */ 1627, 1627, 1627, 1457, 1227, 1336, 1227, 1227, 1227, 1457, - /* 10 */ 1457, 1457, 1227, 1366, 1366, 1510, 1258, 1227, 1227, 1227, - /* 20 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1456, 1227, 1227, - /* 30 */ 1227, 1227, 1545, 1545, 1227, 1227, 1227, 1227, 1227, 1227, - /* 40 */ 1227, 1227, 1375, 1227, 1382, 1227, 1227, 1227, 1227, 1227, - /* 50 */ 1458, 1459, 1227, 1227, 1227, 1509, 1511, 1474, 1389, 1388, - /* 60 */ 1387, 1386, 1492, 1353, 1380, 1373, 1377, 1452, 1453, 1451, - /* 70 */ 1455, 1459, 1458, 1227, 1376, 1423, 1437, 1422, 1227, 1227, - /* 80 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 90 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 100 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 110 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 120 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1431, 1436, 1442, - /* 130 */ 1435, 1432, 1425, 1424, 1426, 1227, 1427, 1227, 1227, 1227, - /* 140 */ 1248, 1300, 1227, 1227, 1227, 1227, 1227, 1529, 1528, 1227, - /* 150 */ 1227, 1258, 1417, 1416, 1428, 1429, 1439, 1438, 1517, 1580, - /* 160 */ 1579, 1475, 1227, 1227, 1227, 1227, 1227, 1227, 1545, 1227, - /* 170 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 180 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 190 */ 1227, 1545, 1545, 1227, 1258, 1545, 1545, 1254, 1254, 1360, - /* 200 */ 1227, 1524, 1327, 1327, 1327, 1327, 1336, 1327, 1227, 1227, - /* 210 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 220 */ 1227, 1227, 1227, 1514, 1512, 1227, 1227, 1227, 1227, 1227, - /* 230 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 240 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 250 */ 1227, 1227, 1332, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 260 */ 1227, 1227, 1227, 1227, 1574, 1227, 1487, 1314, 1332, 1332, - /* 270 */ 1332, 1332, 1334, 1315, 1313, 1326, 1259, 1234, 1619, 1392, - /* 280 */ 1381, 1333, 1355, 1381, 1355, 1616, 1379, 1392, 1392, 1379, - /* 290 */ 1392, 1333, 1616, 1275, 1596, 1270, 1366, 1366, 1366, 1355, - /* 300 */ 1360, 1360, 1454, 1333, 1326, 1227, 1619, 1619, 1341, 1341, - /* 310 */ 1618, 1618, 1341, 1475, 1603, 1401, 1374, 1360, 1303, 1374, - /* 320 */ 1360, 1309, 1309, 1309, 1309, 1341, 1245, 1379, 1603, 1603, - /* 330 */ 1379, 1401, 1303, 1379, 1303, 1379, 1341, 1245, 1491, 1613, - /* 340 */ 1341, 1245, 1465, 1341, 1245, 1341, 1245, 1465, 1301, 1301, - /* 350 */ 1301, 1290, 1227, 1227, 1465, 1301, 1275, 1301, 1290, 1301, - /* 360 */ 1301, 1563, 1227, 1469, 1469, 1465, 1359, 1354, 1359, 1354, - /* 370 */ 1359, 1354, 1359, 1354, 1341, 1555, 1555, 1369, 1369, 1374, - /* 380 */ 1360, 1460, 1341, 1227, 1374, 1372, 1370, 1379, 1251, 1293, - /* 390 */ 1577, 1577, 1573, 1573, 1573, 1624, 1624, 1524, 1589, 1258, - /* 400 */ 1258, 1258, 1258, 1589, 1277, 1277, 1259, 1259, 1258, 1589, - /* 410 */ 1227, 1227, 1227, 1227, 1227, 1227, 1584, 1227, 1519, 1476, - /* 420 */ 1345, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 430 */ 1227, 1227, 1227, 1227, 1227, 1530, 1227, 1227, 1227, 1227, - /* 440 */ 1227, 1227, 1227, 1227, 1227, 1227, 1406, 1227, 1230, 1521, - /* 450 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1383, 1384, - /* 460 */ 1346, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1398, 1227, - /* 470 */ 1227, 1227, 1393, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 480 */ 1227, 1615, 1227, 1227, 1227, 1227, 1227, 1227, 1490, 1489, - /* 490 */ 1227, 1227, 1343, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 500 */ 1227, 1227, 1227, 1227, 1227, 1227, 1273, 1227, 1227, 1227, - /* 510 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 520 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 530 */ 1371, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 540 */ 1227, 1227, 1227, 1227, 1227, 1560, 1361, 1227, 1227, 1606, - /* 550 */ 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, 1227, - /* 560 */ 1227, 1227, 1227, 1227, 1600, 1317, 1408, 1227, 1407, 1411, - /* 570 */ 1227, 1239, 1227, 1227, + /* 0 */ 1641, 1641, 1641, 1470, 1237, 1348, 1237, 1237, 1237, 1470, + /* 10 */ 1470, 1470, 1237, 1378, 1378, 1523, 1270, 1237, 1237, 1237, + /* 20 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1469, 1237, 1237, + /* 30 */ 1237, 1237, 1558, 1558, 1237, 1237, 1237, 1237, 1237, 1237, + /* 40 */ 1237, 1237, 1387, 1237, 1394, 1237, 1237, 1237, 1237, 1237, + /* 50 */ 1471, 1472, 1237, 1237, 1237, 1522, 1524, 1487, 1401, 1400, + /* 60 */ 1399, 1398, 1505, 1365, 1392, 1385, 1389, 1465, 1466, 1464, + /* 70 */ 1468, 1472, 1471, 1237, 1388, 1435, 1449, 1434, 1237, 1237, + /* 80 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 90 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 100 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 110 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 120 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1443, 1448, + /* 130 */ 1455, 1447, 1444, 1437, 1436, 1438, 1439, 1237, 1237, 1261, + /* 140 */ 1237, 1237, 1258, 1312, 1237, 1237, 1237, 1237, 1237, 1542, + /* 150 */ 1541, 1237, 1440, 1237, 1270, 1429, 1428, 1452, 1441, 1451, + /* 160 */ 1450, 1530, 1594, 1593, 1488, 1237, 1237, 1237, 1237, 1237, + /* 170 */ 1237, 1558, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 180 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 190 */ 1237, 1237, 1237, 1237, 1237, 1558, 1558, 1237, 1270, 1558, + /* 200 */ 1558, 1266, 1266, 1372, 1237, 1537, 1339, 1339, 1339, 1339, + /* 210 */ 1348, 1339, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 220 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1527, 1525, 1237, + /* 230 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 240 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 250 */ 1237, 1237, 1237, 1237, 1237, 1237, 1344, 1237, 1237, 1237, + /* 260 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1587, 1237, + /* 270 */ 1500, 1326, 1344, 1344, 1344, 1344, 1346, 1327, 1325, 1338, + /* 280 */ 1271, 1244, 1633, 1404, 1393, 1345, 1367, 1393, 1367, 1630, + /* 290 */ 1391, 1404, 1404, 1391, 1404, 1345, 1630, 1287, 1610, 1282, + /* 300 */ 1378, 1378, 1378, 1367, 1372, 1372, 1467, 1345, 1338, 1237, + /* 310 */ 1633, 1633, 1353, 1353, 1632, 1632, 1353, 1488, 1617, 1413, + /* 320 */ 1386, 1372, 1315, 1386, 1372, 1321, 1321, 1321, 1321, 1353, + /* 330 */ 1255, 1391, 1617, 1617, 1391, 1413, 1315, 1391, 1315, 1391, + /* 340 */ 1353, 1255, 1504, 1627, 1353, 1255, 1478, 1353, 1255, 1353, + /* 350 */ 1255, 1478, 1313, 1313, 1313, 1302, 1237, 1237, 1478, 1313, + /* 360 */ 1287, 1313, 1302, 1313, 1313, 1576, 1237, 1482, 1482, 1478, + /* 370 */ 1371, 1366, 1371, 1366, 1371, 1366, 1371, 1366, 1353, 1568, + /* 380 */ 1568, 1381, 1381, 1386, 1372, 1473, 1353, 1237, 1386, 1384, + /* 390 */ 1382, 1391, 1305, 1590, 1590, 1586, 1586, 1586, 1638, 1638, + /* 400 */ 1537, 1603, 1270, 1270, 1270, 1270, 1603, 1289, 1289, 1271, + /* 410 */ 1271, 1270, 1603, 1237, 1237, 1237, 1237, 1237, 1237, 1598, + /* 420 */ 1237, 1532, 1489, 1357, 1237, 1237, 1237, 1237, 1237, 1237, + /* 430 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1543, 1237, + /* 440 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1418, + /* 450 */ 1237, 1240, 1534, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 460 */ 1237, 1395, 1396, 1358, 1237, 1237, 1237, 1237, 1237, 1237, + /* 470 */ 1237, 1410, 1237, 1237, 1237, 1405, 1237, 1237, 1237, 1237, + /* 480 */ 1237, 1237, 1237, 1237, 1629, 1237, 1237, 1237, 1237, 1237, + /* 490 */ 1237, 1503, 1502, 1237, 1237, 1355, 1237, 1237, 1237, 1237, + /* 500 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1285, + /* 510 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 520 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 530 */ 1237, 1237, 1237, 1383, 1237, 1237, 1237, 1237, 1237, 1237, + /* 540 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1573, 1373, + /* 550 */ 1237, 1237, 1620, 1237, 1237, 1237, 1237, 1237, 1237, 1237, + /* 560 */ 1237, 1237, 1237, 1237, 1237, 1237, 1237, 1614, 1329, 1420, + /* 570 */ 1237, 1419, 1423, 1259, 1237, 1249, 1237, 1237, }; /********** End of lemon-generated parsing tables *****************************/ @@ -159229,8 +162648,8 @@ static const YYCODETYPE yyFallback[] = { 0, /* LP => nothing */ 0, /* RP => nothing */ 0, /* AS => nothing */ - 59, /* WITHOUT => ID */ 0, /* COMMA => nothing */ + 59, /* WITHOUT => ID */ 59, /* ABORT => ID */ 59, /* ACTION => ID */ 59, /* AFTER => ID */ @@ -159316,6 +162735,7 @@ static const YYCODETYPE yyFallback[] = { 0, /* SLASH => nothing */ 0, /* REM => nothing */ 0, /* CONCAT => nothing */ + 0, /* PTR => nothing */ 0, /* COLLATE => nothing */ 0, /* BITNOT => nothing */ 0, /* ON => nothing */ @@ -159439,9 +162859,9 @@ struct yyParser { }; typedef struct yyParser yyParser; +/* #include */ #ifndef NDEBUG /* #include */ -/* #include */ static FILE *yyTraceFILE = 0; static char *yyTracePrompt = 0; #endif /* NDEBUG */ @@ -159501,8 +162921,8 @@ static const char *const yyTokenName[] = { /* 22 */ "LP", /* 23 */ "RP", /* 24 */ "AS", - /* 25 */ "WITHOUT", - /* 26 */ "COMMA", + /* 25 */ "COMMA", + /* 26 */ "WITHOUT", /* 27 */ "ABORT", /* 28 */ "ACTION", /* 29 */ "AFTER", @@ -159588,211 +163008,213 @@ static const char *const yyTokenName[] = { /* 109 */ "SLASH", /* 110 */ "REM", /* 111 */ "CONCAT", - /* 112 */ "COLLATE", - /* 113 */ "BITNOT", - /* 114 */ "ON", - /* 115 */ "INDEXED", - /* 116 */ "STRING", - /* 117 */ "JOIN_KW", - /* 118 */ "CONSTRAINT", - /* 119 */ "DEFAULT", - /* 120 */ "NULL", - /* 121 */ "PRIMARY", - /* 122 */ "UNIQUE", - /* 123 */ "CHECK", - /* 124 */ "REFERENCES", - /* 125 */ "AUTOINCR", - /* 126 */ "INSERT", - /* 127 */ "DELETE", - /* 128 */ "UPDATE", - /* 129 */ "SET", - /* 130 */ "DEFERRABLE", - /* 131 */ "FOREIGN", - /* 132 */ "DROP", - /* 133 */ "UNION", - /* 134 */ "ALL", - /* 135 */ "EXCEPT", - /* 136 */ "INTERSECT", - /* 137 */ "SELECT", - /* 138 */ "VALUES", - /* 139 */ "DISTINCT", - /* 140 */ "DOT", - /* 141 */ "FROM", - /* 142 */ "JOIN", - /* 143 */ "USING", - /* 144 */ "ORDER", - /* 145 */ "GROUP", - /* 146 */ "HAVING", - /* 147 */ "LIMIT", - /* 148 */ "WHERE", - /* 149 */ "RETURNING", - /* 150 */ "INTO", - /* 151 */ "NOTHING", - /* 152 */ "FLOAT", - /* 153 */ "BLOB", - /* 154 */ "INTEGER", - /* 155 */ "VARIABLE", - /* 156 */ "CASE", - /* 157 */ "WHEN", - /* 158 */ "THEN", - /* 159 */ "ELSE", - /* 160 */ "INDEX", - /* 161 */ "ALTER", - /* 162 */ "ADD", - /* 163 */ "WINDOW", - /* 164 */ "OVER", - /* 165 */ "FILTER", - /* 166 */ "COLUMN", - /* 167 */ "AGG_FUNCTION", - /* 168 */ "AGG_COLUMN", - /* 169 */ "TRUEFALSE", - /* 170 */ "ISNOT", - /* 171 */ "FUNCTION", - /* 172 */ "UMINUS", - /* 173 */ "UPLUS", - /* 174 */ "TRUTH", - /* 175 */ "REGISTER", - /* 176 */ "VECTOR", - /* 177 */ "SELECT_COLUMN", - /* 178 */ "IF_NULL_ROW", - /* 179 */ "ASTERISK", - /* 180 */ "SPAN", - /* 181 */ "ERROR", - /* 182 */ "SPACE", - /* 183 */ "ILLEGAL", - /* 184 */ "input", - /* 185 */ "cmdlist", - /* 186 */ "ecmd", - /* 187 */ "cmdx", - /* 188 */ "explain", - /* 189 */ "cmd", - /* 190 */ "transtype", - /* 191 */ "trans_opt", - /* 192 */ "nm", - /* 193 */ "savepoint_opt", - /* 194 */ "create_table", - /* 195 */ "create_table_args", - /* 196 */ "createkw", - /* 197 */ "temp", - /* 198 */ "ifnotexists", - /* 199 */ "dbnm", - /* 200 */ "columnlist", - /* 201 */ "conslist_opt", - /* 202 */ "table_options", - /* 203 */ "select", - /* 204 */ "columnname", - /* 205 */ "carglist", - /* 206 */ "typetoken", - /* 207 */ "typename", - /* 208 */ "signed", - /* 209 */ "plus_num", - /* 210 */ "minus_num", - /* 211 */ "scanpt", - /* 212 */ "scantok", - /* 213 */ "ccons", - /* 214 */ "term", - /* 215 */ "expr", - /* 216 */ "onconf", - /* 217 */ "sortorder", - /* 218 */ "autoinc", - /* 219 */ "eidlist_opt", - /* 220 */ "refargs", - /* 221 */ "defer_subclause", - /* 222 */ "generated", - /* 223 */ "refarg", - /* 224 */ "refact", - /* 225 */ "init_deferred_pred_opt", - /* 226 */ "conslist", - /* 227 */ "tconscomma", - /* 228 */ "tcons", - /* 229 */ "sortlist", - /* 230 */ "eidlist", - /* 231 */ "defer_subclause_opt", - /* 232 */ "orconf", - /* 233 */ "resolvetype", - /* 234 */ "raisetype", - /* 235 */ "ifexists", - /* 236 */ "fullname", - /* 237 */ "selectnowith", - /* 238 */ "oneselect", - /* 239 */ "wqlist", - /* 240 */ "multiselect_op", - /* 241 */ "distinct", - /* 242 */ "selcollist", - /* 243 */ "from", - /* 244 */ "where_opt", - /* 245 */ "groupby_opt", - /* 246 */ "having_opt", - /* 247 */ "orderby_opt", - /* 248 */ "limit_opt", - /* 249 */ "window_clause", - /* 250 */ "values", - /* 251 */ "nexprlist", - /* 252 */ "sclp", - /* 253 */ "as", - /* 254 */ "seltablist", - /* 255 */ "stl_prefix", - /* 256 */ "joinop", - /* 257 */ "indexed_opt", - /* 258 */ "on_opt", - /* 259 */ "using_opt", - /* 260 */ "exprlist", - /* 261 */ "xfullname", - /* 262 */ "idlist", - /* 263 */ "nulls", - /* 264 */ "with", - /* 265 */ "where_opt_ret", - /* 266 */ "setlist", - /* 267 */ "insert_cmd", - /* 268 */ "idlist_opt", - /* 269 */ "upsert", - /* 270 */ "returning", - /* 271 */ "filter_over", - /* 272 */ "likeop", - /* 273 */ "between_op", - /* 274 */ "in_op", - /* 275 */ "paren_exprlist", - /* 276 */ "case_operand", - /* 277 */ "case_exprlist", - /* 278 */ "case_else", - /* 279 */ "uniqueflag", - /* 280 */ "collate", - /* 281 */ "vinto", - /* 282 */ "nmnum", - /* 283 */ "trigger_decl", - /* 284 */ "trigger_cmd_list", - /* 285 */ "trigger_time", - /* 286 */ "trigger_event", - /* 287 */ "foreach_clause", - /* 288 */ "when_clause", - /* 289 */ "trigger_cmd", - /* 290 */ "trnm", - /* 291 */ "tridxby", - /* 292 */ "database_kw_opt", - /* 293 */ "key_opt", - /* 294 */ "add_column_fullname", - /* 295 */ "kwcolumn_opt", - /* 296 */ "create_vtab", - /* 297 */ "vtabarglist", - /* 298 */ "vtabarg", - /* 299 */ "vtabargtoken", - /* 300 */ "lp", - /* 301 */ "anylist", - /* 302 */ "wqitem", - /* 303 */ "wqas", - /* 304 */ "windowdefn_list", - /* 305 */ "windowdefn", - /* 306 */ "window", - /* 307 */ "frame_opt", - /* 308 */ "part_opt", - /* 309 */ "filter_clause", - /* 310 */ "over_clause", - /* 311 */ "range_or_rows", - /* 312 */ "frame_bound", - /* 313 */ "frame_bound_s", - /* 314 */ "frame_bound_e", - /* 315 */ "frame_exclude_opt", - /* 316 */ "frame_exclude", + /* 112 */ "PTR", + /* 113 */ "COLLATE", + /* 114 */ "BITNOT", + /* 115 */ "ON", + /* 116 */ "INDEXED", + /* 117 */ "STRING", + /* 118 */ "JOIN_KW", + /* 119 */ "CONSTRAINT", + /* 120 */ "DEFAULT", + /* 121 */ "NULL", + /* 122 */ "PRIMARY", + /* 123 */ "UNIQUE", + /* 124 */ "CHECK", + /* 125 */ "REFERENCES", + /* 126 */ "AUTOINCR", + /* 127 */ "INSERT", + /* 128 */ "DELETE", + /* 129 */ "UPDATE", + /* 130 */ "SET", + /* 131 */ "DEFERRABLE", + /* 132 */ "FOREIGN", + /* 133 */ "DROP", + /* 134 */ "UNION", + /* 135 */ "ALL", + /* 136 */ "EXCEPT", + /* 137 */ "INTERSECT", + /* 138 */ "SELECT", + /* 139 */ "VALUES", + /* 140 */ "DISTINCT", + /* 141 */ "DOT", + /* 142 */ "FROM", + /* 143 */ "JOIN", + /* 144 */ "USING", + /* 145 */ "ORDER", + /* 146 */ "GROUP", + /* 147 */ "HAVING", + /* 148 */ "LIMIT", + /* 149 */ "WHERE", + /* 150 */ "RETURNING", + /* 151 */ "INTO", + /* 152 */ "NOTHING", + /* 153 */ "FLOAT", + /* 154 */ "BLOB", + /* 155 */ "INTEGER", + /* 156 */ "VARIABLE", + /* 157 */ "CASE", + /* 158 */ "WHEN", + /* 159 */ "THEN", + /* 160 */ "ELSE", + /* 161 */ "INDEX", + /* 162 */ "ALTER", + /* 163 */ "ADD", + /* 164 */ "WINDOW", + /* 165 */ "OVER", + /* 166 */ "FILTER", + /* 167 */ "COLUMN", + /* 168 */ "AGG_FUNCTION", + /* 169 */ "AGG_COLUMN", + /* 170 */ "TRUEFALSE", + /* 171 */ "ISNOT", + /* 172 */ "FUNCTION", + /* 173 */ "UMINUS", + /* 174 */ "UPLUS", + /* 175 */ "TRUTH", + /* 176 */ "REGISTER", + /* 177 */ "VECTOR", + /* 178 */ "SELECT_COLUMN", + /* 179 */ "IF_NULL_ROW", + /* 180 */ "ASTERISK", + /* 181 */ "SPAN", + /* 182 */ "ERROR", + /* 183 */ "SPACE", + /* 184 */ "ILLEGAL", + /* 185 */ "input", + /* 186 */ "cmdlist", + /* 187 */ "ecmd", + /* 188 */ "cmdx", + /* 189 */ "explain", + /* 190 */ "cmd", + /* 191 */ "transtype", + /* 192 */ "trans_opt", + /* 193 */ "nm", + /* 194 */ "savepoint_opt", + /* 195 */ "create_table", + /* 196 */ "create_table_args", + /* 197 */ "createkw", + /* 198 */ "temp", + /* 199 */ "ifnotexists", + /* 200 */ "dbnm", + /* 201 */ "columnlist", + /* 202 */ "conslist_opt", + /* 203 */ "table_option_set", + /* 204 */ "select", + /* 205 */ "table_option", + /* 206 */ "columnname", + /* 207 */ "carglist", + /* 208 */ "typetoken", + /* 209 */ "typename", + /* 210 */ "signed", + /* 211 */ "plus_num", + /* 212 */ "minus_num", + /* 213 */ "scanpt", + /* 214 */ "scantok", + /* 215 */ "ccons", + /* 216 */ "term", + /* 217 */ "expr", + /* 218 */ "onconf", + /* 219 */ "sortorder", + /* 220 */ "autoinc", + /* 221 */ "eidlist_opt", + /* 222 */ "refargs", + /* 223 */ "defer_subclause", + /* 224 */ "generated", + /* 225 */ "refarg", + /* 226 */ "refact", + /* 227 */ "init_deferred_pred_opt", + /* 228 */ "conslist", + /* 229 */ "tconscomma", + /* 230 */ "tcons", + /* 231 */ "sortlist", + /* 232 */ "eidlist", + /* 233 */ "defer_subclause_opt", + /* 234 */ "orconf", + /* 235 */ "resolvetype", + /* 236 */ "raisetype", + /* 237 */ "ifexists", + /* 238 */ "fullname", + /* 239 */ "selectnowith", + /* 240 */ "oneselect", + /* 241 */ "wqlist", + /* 242 */ "multiselect_op", + /* 243 */ "distinct", + /* 244 */ "selcollist", + /* 245 */ "from", + /* 246 */ "where_opt", + /* 247 */ "groupby_opt", + /* 248 */ "having_opt", + /* 249 */ "orderby_opt", + /* 250 */ "limit_opt", + /* 251 */ "window_clause", + /* 252 */ "values", + /* 253 */ "nexprlist", + /* 254 */ "sclp", + /* 255 */ "as", + /* 256 */ "seltablist", + /* 257 */ "stl_prefix", + /* 258 */ "joinop", + /* 259 */ "indexed_opt", + /* 260 */ "on_opt", + /* 261 */ "using_opt", + /* 262 */ "exprlist", + /* 263 */ "xfullname", + /* 264 */ "idlist", + /* 265 */ "nulls", + /* 266 */ "with", + /* 267 */ "where_opt_ret", + /* 268 */ "setlist", + /* 269 */ "insert_cmd", + /* 270 */ "idlist_opt", + /* 271 */ "upsert", + /* 272 */ "returning", + /* 273 */ "filter_over", + /* 274 */ "likeop", + /* 275 */ "between_op", + /* 276 */ "in_op", + /* 277 */ "paren_exprlist", + /* 278 */ "case_operand", + /* 279 */ "case_exprlist", + /* 280 */ "case_else", + /* 281 */ "uniqueflag", + /* 282 */ "collate", + /* 283 */ "vinto", + /* 284 */ "nmnum", + /* 285 */ "trigger_decl", + /* 286 */ "trigger_cmd_list", + /* 287 */ "trigger_time", + /* 288 */ "trigger_event", + /* 289 */ "foreach_clause", + /* 290 */ "when_clause", + /* 291 */ "trigger_cmd", + /* 292 */ "trnm", + /* 293 */ "tridxby", + /* 294 */ "database_kw_opt", + /* 295 */ "key_opt", + /* 296 */ "add_column_fullname", + /* 297 */ "kwcolumn_opt", + /* 298 */ "create_vtab", + /* 299 */ "vtabarglist", + /* 300 */ "vtabarg", + /* 301 */ "vtabargtoken", + /* 302 */ "lp", + /* 303 */ "anylist", + /* 304 */ "wqitem", + /* 305 */ "wqas", + /* 306 */ "windowdefn_list", + /* 307 */ "windowdefn", + /* 308 */ "window", + /* 309 */ "frame_opt", + /* 310 */ "part_opt", + /* 311 */ "filter_clause", + /* 312 */ "over_clause", + /* 313 */ "range_or_rows", + /* 314 */ "frame_bound", + /* 315 */ "frame_bound_s", + /* 316 */ "frame_bound_e", + /* 317 */ "frame_exclude_opt", + /* 318 */ "frame_exclude", }; #endif /* defined(YYCOVERAGE) || !defined(NDEBUG) */ @@ -159819,385 +163241,389 @@ static const char *const yyRuleName[] = { /* 16 */ "ifnotexists ::= IF NOT EXISTS", /* 17 */ "temp ::= TEMP", /* 18 */ "temp ::=", - /* 19 */ "create_table_args ::= LP columnlist conslist_opt RP table_options", + /* 19 */ "create_table_args ::= LP columnlist conslist_opt RP table_option_set", /* 20 */ "create_table_args ::= AS select", - /* 21 */ "table_options ::=", - /* 22 */ "table_options ::= WITHOUT nm", - /* 23 */ "columnname ::= nm typetoken", - /* 24 */ "typetoken ::=", - /* 25 */ "typetoken ::= typename LP signed RP", - /* 26 */ "typetoken ::= typename LP signed COMMA signed RP", - /* 27 */ "typename ::= typename ID|STRING", - /* 28 */ "scanpt ::=", - /* 29 */ "scantok ::=", - /* 30 */ "ccons ::= CONSTRAINT nm", - /* 31 */ "ccons ::= DEFAULT scantok term", - /* 32 */ "ccons ::= DEFAULT LP expr RP", - /* 33 */ "ccons ::= DEFAULT PLUS scantok term", - /* 34 */ "ccons ::= DEFAULT MINUS scantok term", - /* 35 */ "ccons ::= DEFAULT scantok ID|INDEXED", - /* 36 */ "ccons ::= NOT NULL onconf", - /* 37 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", - /* 38 */ "ccons ::= UNIQUE onconf", - /* 39 */ "ccons ::= CHECK LP expr RP", - /* 40 */ "ccons ::= REFERENCES nm eidlist_opt refargs", - /* 41 */ "ccons ::= defer_subclause", - /* 42 */ "ccons ::= COLLATE ID|STRING", - /* 43 */ "generated ::= LP expr RP", - /* 44 */ "generated ::= LP expr RP ID", - /* 45 */ "autoinc ::=", - /* 46 */ "autoinc ::= AUTOINCR", - /* 47 */ "refargs ::=", - /* 48 */ "refargs ::= refargs refarg", - /* 49 */ "refarg ::= MATCH nm", - /* 50 */ "refarg ::= ON INSERT refact", - /* 51 */ "refarg ::= ON DELETE refact", - /* 52 */ "refarg ::= ON UPDATE refact", - /* 53 */ "refact ::= SET NULL", - /* 54 */ "refact ::= SET DEFAULT", - /* 55 */ "refact ::= CASCADE", - /* 56 */ "refact ::= RESTRICT", - /* 57 */ "refact ::= NO ACTION", - /* 58 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", - /* 59 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", - /* 60 */ "init_deferred_pred_opt ::=", - /* 61 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", - /* 62 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", - /* 63 */ "conslist_opt ::=", - /* 64 */ "tconscomma ::= COMMA", - /* 65 */ "tcons ::= CONSTRAINT nm", - /* 66 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf", - /* 67 */ "tcons ::= UNIQUE LP sortlist RP onconf", - /* 68 */ "tcons ::= CHECK LP expr RP onconf", - /* 69 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt", - /* 70 */ "defer_subclause_opt ::=", - /* 71 */ "onconf ::=", - /* 72 */ "onconf ::= ON CONFLICT resolvetype", - /* 73 */ "orconf ::=", - /* 74 */ "orconf ::= OR resolvetype", - /* 75 */ "resolvetype ::= IGNORE", - /* 76 */ "resolvetype ::= REPLACE", - /* 77 */ "cmd ::= DROP TABLE ifexists fullname", - /* 78 */ "ifexists ::= IF EXISTS", - /* 79 */ "ifexists ::=", - /* 80 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select", - /* 81 */ "cmd ::= DROP VIEW ifexists fullname", - /* 82 */ "cmd ::= select", - /* 83 */ "select ::= WITH wqlist selectnowith", - /* 84 */ "select ::= WITH RECURSIVE wqlist selectnowith", - /* 85 */ "select ::= selectnowith", - /* 86 */ "selectnowith ::= selectnowith multiselect_op oneselect", - /* 87 */ "multiselect_op ::= UNION", - /* 88 */ "multiselect_op ::= UNION ALL", - /* 89 */ "multiselect_op ::= EXCEPT|INTERSECT", - /* 90 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", - /* 91 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", - /* 92 */ "values ::= VALUES LP nexprlist RP", - /* 93 */ "values ::= values COMMA LP nexprlist RP", - /* 94 */ "distinct ::= DISTINCT", - /* 95 */ "distinct ::= ALL", - /* 96 */ "distinct ::=", - /* 97 */ "sclp ::=", - /* 98 */ "selcollist ::= sclp scanpt expr scanpt as", - /* 99 */ "selcollist ::= sclp scanpt STAR", - /* 100 */ "selcollist ::= sclp scanpt nm DOT STAR", - /* 101 */ "as ::= AS nm", - /* 102 */ "as ::=", - /* 103 */ "from ::=", - /* 104 */ "from ::= FROM seltablist", - /* 105 */ "stl_prefix ::= seltablist joinop", - /* 106 */ "stl_prefix ::=", - /* 107 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", - /* 108 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt", - /* 109 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", - /* 110 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", - /* 111 */ "dbnm ::=", - /* 112 */ "dbnm ::= DOT nm", - /* 113 */ "fullname ::= nm", - /* 114 */ "fullname ::= nm DOT nm", - /* 115 */ "xfullname ::= nm", - /* 116 */ "xfullname ::= nm DOT nm", - /* 117 */ "xfullname ::= nm DOT nm AS nm", - /* 118 */ "xfullname ::= nm AS nm", - /* 119 */ "joinop ::= COMMA|JOIN", - /* 120 */ "joinop ::= JOIN_KW JOIN", - /* 121 */ "joinop ::= JOIN_KW nm JOIN", - /* 122 */ "joinop ::= JOIN_KW nm nm JOIN", - /* 123 */ "on_opt ::= ON expr", - /* 124 */ "on_opt ::=", - /* 125 */ "indexed_opt ::=", - /* 126 */ "indexed_opt ::= INDEXED BY nm", - /* 127 */ "indexed_opt ::= NOT INDEXED", - /* 128 */ "using_opt ::= USING LP idlist RP", - /* 129 */ "using_opt ::=", - /* 130 */ "orderby_opt ::=", - /* 131 */ "orderby_opt ::= ORDER BY sortlist", - /* 132 */ "sortlist ::= sortlist COMMA expr sortorder nulls", - /* 133 */ "sortlist ::= expr sortorder nulls", - /* 134 */ "sortorder ::= ASC", - /* 135 */ "sortorder ::= DESC", - /* 136 */ "sortorder ::=", - /* 137 */ "nulls ::= NULLS FIRST", - /* 138 */ "nulls ::= NULLS LAST", - /* 139 */ "nulls ::=", - /* 140 */ "groupby_opt ::=", - /* 141 */ "groupby_opt ::= GROUP BY nexprlist", - /* 142 */ "having_opt ::=", - /* 143 */ "having_opt ::= HAVING expr", - /* 144 */ "limit_opt ::=", - /* 145 */ "limit_opt ::= LIMIT expr", - /* 146 */ "limit_opt ::= LIMIT expr OFFSET expr", - /* 147 */ "limit_opt ::= LIMIT expr COMMA expr", - /* 148 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt", - /* 149 */ "where_opt ::=", - /* 150 */ "where_opt ::= WHERE expr", - /* 151 */ "where_opt_ret ::=", - /* 152 */ "where_opt_ret ::= WHERE expr", - /* 153 */ "where_opt_ret ::= RETURNING selcollist", - /* 154 */ "where_opt_ret ::= WHERE expr RETURNING selcollist", - /* 155 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt", - /* 156 */ "setlist ::= setlist COMMA nm EQ expr", - /* 157 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", - /* 158 */ "setlist ::= nm EQ expr", - /* 159 */ "setlist ::= LP idlist RP EQ expr", - /* 160 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", - /* 161 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning", - /* 162 */ "upsert ::=", - /* 163 */ "upsert ::= RETURNING selcollist", - /* 164 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert", - /* 165 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert", - /* 166 */ "upsert ::= ON CONFLICT DO NOTHING returning", - /* 167 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning", - /* 168 */ "returning ::= RETURNING selcollist", - /* 169 */ "insert_cmd ::= INSERT orconf", - /* 170 */ "insert_cmd ::= REPLACE", - /* 171 */ "idlist_opt ::=", - /* 172 */ "idlist_opt ::= LP idlist RP", - /* 173 */ "idlist ::= idlist COMMA nm", - /* 174 */ "idlist ::= nm", - /* 175 */ "expr ::= LP expr RP", - /* 176 */ "expr ::= ID|INDEXED", - /* 177 */ "expr ::= JOIN_KW", - /* 178 */ "expr ::= nm DOT nm", - /* 179 */ "expr ::= nm DOT nm DOT nm", - /* 180 */ "term ::= NULL|FLOAT|BLOB", - /* 181 */ "term ::= STRING", - /* 182 */ "term ::= INTEGER", - /* 183 */ "expr ::= VARIABLE", - /* 184 */ "expr ::= expr COLLATE ID|STRING", - /* 185 */ "expr ::= CAST LP expr AS typetoken RP", - /* 186 */ "expr ::= ID|INDEXED LP distinct exprlist RP", - /* 187 */ "expr ::= ID|INDEXED LP STAR RP", - /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over", - /* 189 */ "expr ::= ID|INDEXED LP STAR RP filter_over", - /* 190 */ "term ::= CTIME_KW", - /* 191 */ "expr ::= LP nexprlist COMMA expr RP", - /* 192 */ "expr ::= expr AND expr", - /* 193 */ "expr ::= expr OR expr", - /* 194 */ "expr ::= expr LT|GT|GE|LE expr", - /* 195 */ "expr ::= expr EQ|NE expr", - /* 196 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", - /* 197 */ "expr ::= expr PLUS|MINUS expr", - /* 198 */ "expr ::= expr STAR|SLASH|REM expr", - /* 199 */ "expr ::= expr CONCAT expr", - /* 200 */ "likeop ::= NOT LIKE_KW|MATCH", - /* 201 */ "expr ::= expr likeop expr", - /* 202 */ "expr ::= expr likeop expr ESCAPE expr", - /* 203 */ "expr ::= expr ISNULL|NOTNULL", - /* 204 */ "expr ::= expr NOT NULL", - /* 205 */ "expr ::= expr IS expr", - /* 206 */ "expr ::= expr IS NOT expr", - /* 207 */ "expr ::= NOT expr", - /* 208 */ "expr ::= BITNOT expr", - /* 209 */ "expr ::= PLUS|MINUS expr", - /* 210 */ "between_op ::= BETWEEN", - /* 211 */ "between_op ::= NOT BETWEEN", - /* 212 */ "expr ::= expr between_op expr AND expr", - /* 213 */ "in_op ::= IN", - /* 214 */ "in_op ::= NOT IN", - /* 215 */ "expr ::= expr in_op LP exprlist RP", - /* 216 */ "expr ::= LP select RP", - /* 217 */ "expr ::= expr in_op LP select RP", - /* 218 */ "expr ::= expr in_op nm dbnm paren_exprlist", - /* 219 */ "expr ::= EXISTS LP select RP", - /* 220 */ "expr ::= CASE case_operand case_exprlist case_else END", - /* 221 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", - /* 222 */ "case_exprlist ::= WHEN expr THEN expr", - /* 223 */ "case_else ::= ELSE expr", - /* 224 */ "case_else ::=", - /* 225 */ "case_operand ::= expr", - /* 226 */ "case_operand ::=", - /* 227 */ "exprlist ::=", - /* 228 */ "nexprlist ::= nexprlist COMMA expr", - /* 229 */ "nexprlist ::= expr", - /* 230 */ "paren_exprlist ::=", - /* 231 */ "paren_exprlist ::= LP exprlist RP", - /* 232 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", - /* 233 */ "uniqueflag ::= UNIQUE", - /* 234 */ "uniqueflag ::=", - /* 235 */ "eidlist_opt ::=", - /* 236 */ "eidlist_opt ::= LP eidlist RP", - /* 237 */ "eidlist ::= eidlist COMMA nm collate sortorder", - /* 238 */ "eidlist ::= nm collate sortorder", - /* 239 */ "collate ::=", - /* 240 */ "collate ::= COLLATE ID|STRING", - /* 241 */ "cmd ::= DROP INDEX ifexists fullname", - /* 242 */ "cmd ::= VACUUM vinto", - /* 243 */ "cmd ::= VACUUM nm vinto", - /* 244 */ "vinto ::= INTO expr", - /* 245 */ "vinto ::=", - /* 246 */ "cmd ::= PRAGMA nm dbnm", - /* 247 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", - /* 248 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", - /* 249 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 250 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", - /* 251 */ "plus_num ::= PLUS INTEGER|FLOAT", - /* 252 */ "minus_num ::= MINUS INTEGER|FLOAT", - /* 253 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", - /* 254 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", - /* 255 */ "trigger_time ::= BEFORE|AFTER", - /* 256 */ "trigger_time ::= INSTEAD OF", - /* 257 */ "trigger_time ::=", - /* 258 */ "trigger_event ::= DELETE|INSERT", - /* 259 */ "trigger_event ::= UPDATE", - /* 260 */ "trigger_event ::= UPDATE OF idlist", - /* 261 */ "when_clause ::=", - /* 262 */ "when_clause ::= WHEN expr", - /* 263 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 264 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 265 */ "trnm ::= nm DOT nm", - /* 266 */ "tridxby ::= INDEXED BY nm", - /* 267 */ "tridxby ::= NOT INDEXED", - /* 268 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", - /* 269 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", - /* 270 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", - /* 271 */ "trigger_cmd ::= scanpt select scanpt", - /* 272 */ "expr ::= RAISE LP IGNORE RP", - /* 273 */ "expr ::= RAISE LP raisetype COMMA nm RP", - /* 274 */ "raisetype ::= ROLLBACK", - /* 275 */ "raisetype ::= ABORT", - /* 276 */ "raisetype ::= FAIL", - /* 277 */ "cmd ::= DROP TRIGGER ifexists fullname", - /* 278 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", - /* 279 */ "cmd ::= DETACH database_kw_opt expr", - /* 280 */ "key_opt ::=", - /* 281 */ "key_opt ::= KEY expr", - /* 282 */ "cmd ::= REINDEX", - /* 283 */ "cmd ::= REINDEX nm dbnm", - /* 284 */ "cmd ::= ANALYZE", - /* 285 */ "cmd ::= ANALYZE nm dbnm", - /* 286 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 287 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", - /* 288 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", - /* 289 */ "add_column_fullname ::= fullname", - /* 290 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", - /* 291 */ "cmd ::= create_vtab", - /* 292 */ "cmd ::= create_vtab LP vtabarglist RP", - /* 293 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", - /* 294 */ "vtabarg ::=", - /* 295 */ "vtabargtoken ::= ANY", - /* 296 */ "vtabargtoken ::= lp anylist RP", - /* 297 */ "lp ::= LP", - /* 298 */ "with ::= WITH wqlist", - /* 299 */ "with ::= WITH RECURSIVE wqlist", - /* 300 */ "wqas ::= AS", - /* 301 */ "wqas ::= AS MATERIALIZED", - /* 302 */ "wqas ::= AS NOT MATERIALIZED", - /* 303 */ "wqitem ::= nm eidlist_opt wqas LP select RP", - /* 304 */ "wqlist ::= wqitem", - /* 305 */ "wqlist ::= wqlist COMMA wqitem", - /* 306 */ "windowdefn_list ::= windowdefn", - /* 307 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", - /* 308 */ "windowdefn ::= nm AS LP window RP", - /* 309 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", - /* 310 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", - /* 311 */ "window ::= ORDER BY sortlist frame_opt", - /* 312 */ "window ::= nm ORDER BY sortlist frame_opt", - /* 313 */ "window ::= frame_opt", - /* 314 */ "window ::= nm frame_opt", - /* 315 */ "frame_opt ::=", - /* 316 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", - /* 317 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", - /* 318 */ "range_or_rows ::= RANGE|ROWS|GROUPS", - /* 319 */ "frame_bound_s ::= frame_bound", - /* 320 */ "frame_bound_s ::= UNBOUNDED PRECEDING", - /* 321 */ "frame_bound_e ::= frame_bound", - /* 322 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", - /* 323 */ "frame_bound ::= expr PRECEDING|FOLLOWING", - /* 324 */ "frame_bound ::= CURRENT ROW", - /* 325 */ "frame_exclude_opt ::=", - /* 326 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", - /* 327 */ "frame_exclude ::= NO OTHERS", - /* 328 */ "frame_exclude ::= CURRENT ROW", - /* 329 */ "frame_exclude ::= GROUP|TIES", - /* 330 */ "window_clause ::= WINDOW windowdefn_list", - /* 331 */ "filter_over ::= filter_clause over_clause", - /* 332 */ "filter_over ::= over_clause", - /* 333 */ "filter_over ::= filter_clause", - /* 334 */ "over_clause ::= OVER LP window RP", - /* 335 */ "over_clause ::= OVER nm", - /* 336 */ "filter_clause ::= FILTER LP WHERE expr RP", - /* 337 */ "input ::= cmdlist", - /* 338 */ "cmdlist ::= cmdlist ecmd", - /* 339 */ "cmdlist ::= ecmd", - /* 340 */ "ecmd ::= SEMI", - /* 341 */ "ecmd ::= cmdx SEMI", - /* 342 */ "ecmd ::= explain cmdx SEMI", - /* 343 */ "trans_opt ::=", - /* 344 */ "trans_opt ::= TRANSACTION", - /* 345 */ "trans_opt ::= TRANSACTION nm", - /* 346 */ "savepoint_opt ::= SAVEPOINT", - /* 347 */ "savepoint_opt ::=", - /* 348 */ "cmd ::= create_table create_table_args", - /* 349 */ "columnlist ::= columnlist COMMA columnname carglist", - /* 350 */ "columnlist ::= columnname carglist", - /* 351 */ "nm ::= ID|INDEXED", - /* 352 */ "nm ::= STRING", - /* 353 */ "nm ::= JOIN_KW", - /* 354 */ "typetoken ::= typename", - /* 355 */ "typename ::= ID|STRING", - /* 356 */ "signed ::= plus_num", - /* 357 */ "signed ::= minus_num", - /* 358 */ "carglist ::= carglist ccons", - /* 359 */ "carglist ::=", - /* 360 */ "ccons ::= NULL onconf", - /* 361 */ "ccons ::= GENERATED ALWAYS AS generated", - /* 362 */ "ccons ::= AS generated", - /* 363 */ "conslist_opt ::= COMMA conslist", - /* 364 */ "conslist ::= conslist tconscomma tcons", - /* 365 */ "conslist ::= tcons", - /* 366 */ "tconscomma ::=", - /* 367 */ "defer_subclause_opt ::= defer_subclause", - /* 368 */ "resolvetype ::= raisetype", - /* 369 */ "selectnowith ::= oneselect", - /* 370 */ "oneselect ::= values", - /* 371 */ "sclp ::= selcollist COMMA", - /* 372 */ "as ::= ID|STRING", - /* 373 */ "returning ::=", - /* 374 */ "expr ::= term", - /* 375 */ "likeop ::= LIKE_KW|MATCH", - /* 376 */ "exprlist ::= nexprlist", - /* 377 */ "nmnum ::= plus_num", - /* 378 */ "nmnum ::= nm", - /* 379 */ "nmnum ::= ON", - /* 380 */ "nmnum ::= DELETE", - /* 381 */ "nmnum ::= DEFAULT", - /* 382 */ "plus_num ::= INTEGER|FLOAT", - /* 383 */ "foreach_clause ::=", - /* 384 */ "foreach_clause ::= FOR EACH ROW", - /* 385 */ "trnm ::= nm", - /* 386 */ "tridxby ::=", - /* 387 */ "database_kw_opt ::= DATABASE", - /* 388 */ "database_kw_opt ::=", - /* 389 */ "kwcolumn_opt ::=", - /* 390 */ "kwcolumn_opt ::= COLUMNKW", - /* 391 */ "vtabarglist ::= vtabarg", - /* 392 */ "vtabarglist ::= vtabarglist COMMA vtabarg", - /* 393 */ "vtabarg ::= vtabarg vtabargtoken", - /* 394 */ "anylist ::=", - /* 395 */ "anylist ::= anylist LP anylist RP", - /* 396 */ "anylist ::= anylist ANY", - /* 397 */ "with ::=", + /* 21 */ "table_option_set ::=", + /* 22 */ "table_option_set ::= table_option_set COMMA table_option", + /* 23 */ "table_option ::= WITHOUT nm", + /* 24 */ "table_option ::= nm", + /* 25 */ "columnname ::= nm typetoken", + /* 26 */ "typetoken ::=", + /* 27 */ "typetoken ::= typename LP signed RP", + /* 28 */ "typetoken ::= typename LP signed COMMA signed RP", + /* 29 */ "typename ::= typename ID|STRING", + /* 30 */ "scanpt ::=", + /* 31 */ "scantok ::=", + /* 32 */ "ccons ::= CONSTRAINT nm", + /* 33 */ "ccons ::= DEFAULT scantok term", + /* 34 */ "ccons ::= DEFAULT LP expr RP", + /* 35 */ "ccons ::= DEFAULT PLUS scantok term", + /* 36 */ "ccons ::= DEFAULT MINUS scantok term", + /* 37 */ "ccons ::= DEFAULT scantok ID|INDEXED", + /* 38 */ "ccons ::= NOT NULL onconf", + /* 39 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", + /* 40 */ "ccons ::= UNIQUE onconf", + /* 41 */ "ccons ::= CHECK LP expr RP", + /* 42 */ "ccons ::= REFERENCES nm eidlist_opt refargs", + /* 43 */ "ccons ::= defer_subclause", + /* 44 */ "ccons ::= COLLATE ID|STRING", + /* 45 */ "generated ::= LP expr RP", + /* 46 */ "generated ::= LP expr RP ID", + /* 47 */ "autoinc ::=", + /* 48 */ "autoinc ::= AUTOINCR", + /* 49 */ "refargs ::=", + /* 50 */ "refargs ::= refargs refarg", + /* 51 */ "refarg ::= MATCH nm", + /* 52 */ "refarg ::= ON INSERT refact", + /* 53 */ "refarg ::= ON DELETE refact", + /* 54 */ "refarg ::= ON UPDATE refact", + /* 55 */ "refact ::= SET NULL", + /* 56 */ "refact ::= SET DEFAULT", + /* 57 */ "refact ::= CASCADE", + /* 58 */ "refact ::= RESTRICT", + /* 59 */ "refact ::= NO ACTION", + /* 60 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", + /* 61 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", + /* 62 */ "init_deferred_pred_opt ::=", + /* 63 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", + /* 64 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", + /* 65 */ "conslist_opt ::=", + /* 66 */ "tconscomma ::= COMMA", + /* 67 */ "tcons ::= CONSTRAINT nm", + /* 68 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf", + /* 69 */ "tcons ::= UNIQUE LP sortlist RP onconf", + /* 70 */ "tcons ::= CHECK LP expr RP onconf", + /* 71 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt", + /* 72 */ "defer_subclause_opt ::=", + /* 73 */ "onconf ::=", + /* 74 */ "onconf ::= ON CONFLICT resolvetype", + /* 75 */ "orconf ::=", + /* 76 */ "orconf ::= OR resolvetype", + /* 77 */ "resolvetype ::= IGNORE", + /* 78 */ "resolvetype ::= REPLACE", + /* 79 */ "cmd ::= DROP TABLE ifexists fullname", + /* 80 */ "ifexists ::= IF EXISTS", + /* 81 */ "ifexists ::=", + /* 82 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select", + /* 83 */ "cmd ::= DROP VIEW ifexists fullname", + /* 84 */ "cmd ::= select", + /* 85 */ "select ::= WITH wqlist selectnowith", + /* 86 */ "select ::= WITH RECURSIVE wqlist selectnowith", + /* 87 */ "select ::= selectnowith", + /* 88 */ "selectnowith ::= selectnowith multiselect_op oneselect", + /* 89 */ "multiselect_op ::= UNION", + /* 90 */ "multiselect_op ::= UNION ALL", + /* 91 */ "multiselect_op ::= EXCEPT|INTERSECT", + /* 92 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", + /* 93 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", + /* 94 */ "values ::= VALUES LP nexprlist RP", + /* 95 */ "values ::= values COMMA LP nexprlist RP", + /* 96 */ "distinct ::= DISTINCT", + /* 97 */ "distinct ::= ALL", + /* 98 */ "distinct ::=", + /* 99 */ "sclp ::=", + /* 100 */ "selcollist ::= sclp scanpt expr scanpt as", + /* 101 */ "selcollist ::= sclp scanpt STAR", + /* 102 */ "selcollist ::= sclp scanpt nm DOT STAR", + /* 103 */ "as ::= AS nm", + /* 104 */ "as ::=", + /* 105 */ "from ::=", + /* 106 */ "from ::= FROM seltablist", + /* 107 */ "stl_prefix ::= seltablist joinop", + /* 108 */ "stl_prefix ::=", + /* 109 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", + /* 110 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt", + /* 111 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", + /* 112 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", + /* 113 */ "dbnm ::=", + /* 114 */ "dbnm ::= DOT nm", + /* 115 */ "fullname ::= nm", + /* 116 */ "fullname ::= nm DOT nm", + /* 117 */ "xfullname ::= nm", + /* 118 */ "xfullname ::= nm DOT nm", + /* 119 */ "xfullname ::= nm DOT nm AS nm", + /* 120 */ "xfullname ::= nm AS nm", + /* 121 */ "joinop ::= COMMA|JOIN", + /* 122 */ "joinop ::= JOIN_KW JOIN", + /* 123 */ "joinop ::= JOIN_KW nm JOIN", + /* 124 */ "joinop ::= JOIN_KW nm nm JOIN", + /* 125 */ "on_opt ::= ON expr", + /* 126 */ "on_opt ::=", + /* 127 */ "indexed_opt ::=", + /* 128 */ "indexed_opt ::= INDEXED BY nm", + /* 129 */ "indexed_opt ::= NOT INDEXED", + /* 130 */ "using_opt ::= USING LP idlist RP", + /* 131 */ "using_opt ::=", + /* 132 */ "orderby_opt ::=", + /* 133 */ "orderby_opt ::= ORDER BY sortlist", + /* 134 */ "sortlist ::= sortlist COMMA expr sortorder nulls", + /* 135 */ "sortlist ::= expr sortorder nulls", + /* 136 */ "sortorder ::= ASC", + /* 137 */ "sortorder ::= DESC", + /* 138 */ "sortorder ::=", + /* 139 */ "nulls ::= NULLS FIRST", + /* 140 */ "nulls ::= NULLS LAST", + /* 141 */ "nulls ::=", + /* 142 */ "groupby_opt ::=", + /* 143 */ "groupby_opt ::= GROUP BY nexprlist", + /* 144 */ "having_opt ::=", + /* 145 */ "having_opt ::= HAVING expr", + /* 146 */ "limit_opt ::=", + /* 147 */ "limit_opt ::= LIMIT expr", + /* 148 */ "limit_opt ::= LIMIT expr OFFSET expr", + /* 149 */ "limit_opt ::= LIMIT expr COMMA expr", + /* 150 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt", + /* 151 */ "where_opt ::=", + /* 152 */ "where_opt ::= WHERE expr", + /* 153 */ "where_opt_ret ::=", + /* 154 */ "where_opt_ret ::= WHERE expr", + /* 155 */ "where_opt_ret ::= RETURNING selcollist", + /* 156 */ "where_opt_ret ::= WHERE expr RETURNING selcollist", + /* 157 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt", + /* 158 */ "setlist ::= setlist COMMA nm EQ expr", + /* 159 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", + /* 160 */ "setlist ::= nm EQ expr", + /* 161 */ "setlist ::= LP idlist RP EQ expr", + /* 162 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", + /* 163 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning", + /* 164 */ "upsert ::=", + /* 165 */ "upsert ::= RETURNING selcollist", + /* 166 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert", + /* 167 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert", + /* 168 */ "upsert ::= ON CONFLICT DO NOTHING returning", + /* 169 */ "upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning", + /* 170 */ "returning ::= RETURNING selcollist", + /* 171 */ "insert_cmd ::= INSERT orconf", + /* 172 */ "insert_cmd ::= REPLACE", + /* 173 */ "idlist_opt ::=", + /* 174 */ "idlist_opt ::= LP idlist RP", + /* 175 */ "idlist ::= idlist COMMA nm", + /* 176 */ "idlist ::= nm", + /* 177 */ "expr ::= LP expr RP", + /* 178 */ "expr ::= ID|INDEXED", + /* 179 */ "expr ::= JOIN_KW", + /* 180 */ "expr ::= nm DOT nm", + /* 181 */ "expr ::= nm DOT nm DOT nm", + /* 182 */ "term ::= NULL|FLOAT|BLOB", + /* 183 */ "term ::= STRING", + /* 184 */ "term ::= INTEGER", + /* 185 */ "expr ::= VARIABLE", + /* 186 */ "expr ::= expr COLLATE ID|STRING", + /* 187 */ "expr ::= CAST LP expr AS typetoken RP", + /* 188 */ "expr ::= ID|INDEXED LP distinct exprlist RP", + /* 189 */ "expr ::= ID|INDEXED LP STAR RP", + /* 190 */ "expr ::= ID|INDEXED LP distinct exprlist RP filter_over", + /* 191 */ "expr ::= ID|INDEXED LP STAR RP filter_over", + /* 192 */ "term ::= CTIME_KW", + /* 193 */ "expr ::= LP nexprlist COMMA expr RP", + /* 194 */ "expr ::= expr AND expr", + /* 195 */ "expr ::= expr OR expr", + /* 196 */ "expr ::= expr LT|GT|GE|LE expr", + /* 197 */ "expr ::= expr EQ|NE expr", + /* 198 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", + /* 199 */ "expr ::= expr PLUS|MINUS expr", + /* 200 */ "expr ::= expr STAR|SLASH|REM expr", + /* 201 */ "expr ::= expr CONCAT expr", + /* 202 */ "likeop ::= NOT LIKE_KW|MATCH", + /* 203 */ "expr ::= expr likeop expr", + /* 204 */ "expr ::= expr likeop expr ESCAPE expr", + /* 205 */ "expr ::= expr ISNULL|NOTNULL", + /* 206 */ "expr ::= expr NOT NULL", + /* 207 */ "expr ::= expr IS expr", + /* 208 */ "expr ::= expr IS NOT expr", + /* 209 */ "expr ::= NOT expr", + /* 210 */ "expr ::= BITNOT expr", + /* 211 */ "expr ::= PLUS|MINUS expr", + /* 212 */ "expr ::= expr PTR expr", + /* 213 */ "between_op ::= BETWEEN", + /* 214 */ "between_op ::= NOT BETWEEN", + /* 215 */ "expr ::= expr between_op expr AND expr", + /* 216 */ "in_op ::= IN", + /* 217 */ "in_op ::= NOT IN", + /* 218 */ "expr ::= expr in_op LP exprlist RP", + /* 219 */ "expr ::= LP select RP", + /* 220 */ "expr ::= expr in_op LP select RP", + /* 221 */ "expr ::= expr in_op nm dbnm paren_exprlist", + /* 222 */ "expr ::= EXISTS LP select RP", + /* 223 */ "expr ::= CASE case_operand case_exprlist case_else END", + /* 224 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", + /* 225 */ "case_exprlist ::= WHEN expr THEN expr", + /* 226 */ "case_else ::= ELSE expr", + /* 227 */ "case_else ::=", + /* 228 */ "case_operand ::= expr", + /* 229 */ "case_operand ::=", + /* 230 */ "exprlist ::=", + /* 231 */ "nexprlist ::= nexprlist COMMA expr", + /* 232 */ "nexprlist ::= expr", + /* 233 */ "paren_exprlist ::=", + /* 234 */ "paren_exprlist ::= LP exprlist RP", + /* 235 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", + /* 236 */ "uniqueflag ::= UNIQUE", + /* 237 */ "uniqueflag ::=", + /* 238 */ "eidlist_opt ::=", + /* 239 */ "eidlist_opt ::= LP eidlist RP", + /* 240 */ "eidlist ::= eidlist COMMA nm collate sortorder", + /* 241 */ "eidlist ::= nm collate sortorder", + /* 242 */ "collate ::=", + /* 243 */ "collate ::= COLLATE ID|STRING", + /* 244 */ "cmd ::= DROP INDEX ifexists fullname", + /* 245 */ "cmd ::= VACUUM vinto", + /* 246 */ "cmd ::= VACUUM nm vinto", + /* 247 */ "vinto ::= INTO expr", + /* 248 */ "vinto ::=", + /* 249 */ "cmd ::= PRAGMA nm dbnm", + /* 250 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", + /* 251 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", + /* 252 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", + /* 253 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", + /* 254 */ "plus_num ::= PLUS INTEGER|FLOAT", + /* 255 */ "minus_num ::= MINUS INTEGER|FLOAT", + /* 256 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", + /* 257 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", + /* 258 */ "trigger_time ::= BEFORE|AFTER", + /* 259 */ "trigger_time ::= INSTEAD OF", + /* 260 */ "trigger_time ::=", + /* 261 */ "trigger_event ::= DELETE|INSERT", + /* 262 */ "trigger_event ::= UPDATE", + /* 263 */ "trigger_event ::= UPDATE OF idlist", + /* 264 */ "when_clause ::=", + /* 265 */ "when_clause ::= WHEN expr", + /* 266 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", + /* 267 */ "trigger_cmd_list ::= trigger_cmd SEMI", + /* 268 */ "trnm ::= nm DOT nm", + /* 269 */ "tridxby ::= INDEXED BY nm", + /* 270 */ "tridxby ::= NOT INDEXED", + /* 271 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt", + /* 272 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", + /* 273 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", + /* 274 */ "trigger_cmd ::= scanpt select scanpt", + /* 275 */ "expr ::= RAISE LP IGNORE RP", + /* 276 */ "expr ::= RAISE LP raisetype COMMA nm RP", + /* 277 */ "raisetype ::= ROLLBACK", + /* 278 */ "raisetype ::= ABORT", + /* 279 */ "raisetype ::= FAIL", + /* 280 */ "cmd ::= DROP TRIGGER ifexists fullname", + /* 281 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", + /* 282 */ "cmd ::= DETACH database_kw_opt expr", + /* 283 */ "key_opt ::=", + /* 284 */ "key_opt ::= KEY expr", + /* 285 */ "cmd ::= REINDEX", + /* 286 */ "cmd ::= REINDEX nm dbnm", + /* 287 */ "cmd ::= ANALYZE", + /* 288 */ "cmd ::= ANALYZE nm dbnm", + /* 289 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", + /* 290 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", + /* 291 */ "cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm", + /* 292 */ "add_column_fullname ::= fullname", + /* 293 */ "cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm", + /* 294 */ "cmd ::= create_vtab", + /* 295 */ "cmd ::= create_vtab LP vtabarglist RP", + /* 296 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", + /* 297 */ "vtabarg ::=", + /* 298 */ "vtabargtoken ::= ANY", + /* 299 */ "vtabargtoken ::= lp anylist RP", + /* 300 */ "lp ::= LP", + /* 301 */ "with ::= WITH wqlist", + /* 302 */ "with ::= WITH RECURSIVE wqlist", + /* 303 */ "wqas ::= AS", + /* 304 */ "wqas ::= AS MATERIALIZED", + /* 305 */ "wqas ::= AS NOT MATERIALIZED", + /* 306 */ "wqitem ::= nm eidlist_opt wqas LP select RP", + /* 307 */ "wqlist ::= wqitem", + /* 308 */ "wqlist ::= wqlist COMMA wqitem", + /* 309 */ "windowdefn_list ::= windowdefn", + /* 310 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", + /* 311 */ "windowdefn ::= nm AS LP window RP", + /* 312 */ "window ::= PARTITION BY nexprlist orderby_opt frame_opt", + /* 313 */ "window ::= nm PARTITION BY nexprlist orderby_opt frame_opt", + /* 314 */ "window ::= ORDER BY sortlist frame_opt", + /* 315 */ "window ::= nm ORDER BY sortlist frame_opt", + /* 316 */ "window ::= frame_opt", + /* 317 */ "window ::= nm frame_opt", + /* 318 */ "frame_opt ::=", + /* 319 */ "frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt", + /* 320 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt", + /* 321 */ "range_or_rows ::= RANGE|ROWS|GROUPS", + /* 322 */ "frame_bound_s ::= frame_bound", + /* 323 */ "frame_bound_s ::= UNBOUNDED PRECEDING", + /* 324 */ "frame_bound_e ::= frame_bound", + /* 325 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", + /* 326 */ "frame_bound ::= expr PRECEDING|FOLLOWING", + /* 327 */ "frame_bound ::= CURRENT ROW", + /* 328 */ "frame_exclude_opt ::=", + /* 329 */ "frame_exclude_opt ::= EXCLUDE frame_exclude", + /* 330 */ "frame_exclude ::= NO OTHERS", + /* 331 */ "frame_exclude ::= CURRENT ROW", + /* 332 */ "frame_exclude ::= GROUP|TIES", + /* 333 */ "window_clause ::= WINDOW windowdefn_list", + /* 334 */ "filter_over ::= filter_clause over_clause", + /* 335 */ "filter_over ::= over_clause", + /* 336 */ "filter_over ::= filter_clause", + /* 337 */ "over_clause ::= OVER LP window RP", + /* 338 */ "over_clause ::= OVER nm", + /* 339 */ "filter_clause ::= FILTER LP WHERE expr RP", + /* 340 */ "input ::= cmdlist", + /* 341 */ "cmdlist ::= cmdlist ecmd", + /* 342 */ "cmdlist ::= ecmd", + /* 343 */ "ecmd ::= SEMI", + /* 344 */ "ecmd ::= cmdx SEMI", + /* 345 */ "ecmd ::= explain cmdx SEMI", + /* 346 */ "trans_opt ::=", + /* 347 */ "trans_opt ::= TRANSACTION", + /* 348 */ "trans_opt ::= TRANSACTION nm", + /* 349 */ "savepoint_opt ::= SAVEPOINT", + /* 350 */ "savepoint_opt ::=", + /* 351 */ "cmd ::= create_table create_table_args", + /* 352 */ "table_option_set ::= table_option", + /* 353 */ "columnlist ::= columnlist COMMA columnname carglist", + /* 354 */ "columnlist ::= columnname carglist", + /* 355 */ "nm ::= ID|INDEXED", + /* 356 */ "nm ::= STRING", + /* 357 */ "nm ::= JOIN_KW", + /* 358 */ "typetoken ::= typename", + /* 359 */ "typename ::= ID|STRING", + /* 360 */ "signed ::= plus_num", + /* 361 */ "signed ::= minus_num", + /* 362 */ "carglist ::= carglist ccons", + /* 363 */ "carglist ::=", + /* 364 */ "ccons ::= NULL onconf", + /* 365 */ "ccons ::= GENERATED ALWAYS AS generated", + /* 366 */ "ccons ::= AS generated", + /* 367 */ "conslist_opt ::= COMMA conslist", + /* 368 */ "conslist ::= conslist tconscomma tcons", + /* 369 */ "conslist ::= tcons", + /* 370 */ "tconscomma ::=", + /* 371 */ "defer_subclause_opt ::= defer_subclause", + /* 372 */ "resolvetype ::= raisetype", + /* 373 */ "selectnowith ::= oneselect", + /* 374 */ "oneselect ::= values", + /* 375 */ "sclp ::= selcollist COMMA", + /* 376 */ "as ::= ID|STRING", + /* 377 */ "returning ::=", + /* 378 */ "expr ::= term", + /* 379 */ "likeop ::= LIKE_KW|MATCH", + /* 380 */ "exprlist ::= nexprlist", + /* 381 */ "nmnum ::= plus_num", + /* 382 */ "nmnum ::= nm", + /* 383 */ "nmnum ::= ON", + /* 384 */ "nmnum ::= DELETE", + /* 385 */ "nmnum ::= DEFAULT", + /* 386 */ "plus_num ::= INTEGER|FLOAT", + /* 387 */ "foreach_clause ::=", + /* 388 */ "foreach_clause ::= FOR EACH ROW", + /* 389 */ "trnm ::= nm", + /* 390 */ "tridxby ::=", + /* 391 */ "database_kw_opt ::= DATABASE", + /* 392 */ "database_kw_opt ::=", + /* 393 */ "kwcolumn_opt ::=", + /* 394 */ "kwcolumn_opt ::= COLUMNKW", + /* 395 */ "vtabarglist ::= vtabarg", + /* 396 */ "vtabarglist ::= vtabarglist COMMA vtabarg", + /* 397 */ "vtabarg ::= vtabarg vtabargtoken", + /* 398 */ "anylist ::=", + /* 399 */ "anylist ::= anylist LP anylist RP", + /* 400 */ "anylist ::= anylist ANY", + /* 401 */ "with ::=", }; #endif /* NDEBUG */ @@ -160323,99 +163749,99 @@ static void yy_destructor( ** inside the C code. */ /********* Begin destructor definitions ***************************************/ - case 203: /* select */ - case 237: /* selectnowith */ - case 238: /* oneselect */ - case 250: /* values */ + case 204: /* select */ + case 239: /* selectnowith */ + case 240: /* oneselect */ + case 252: /* values */ { -sqlite3SelectDelete(pParse->db, (yypminor->yy81)); -} - break; - case 214: /* term */ - case 215: /* expr */ - case 244: /* where_opt */ - case 246: /* having_opt */ - case 258: /* on_opt */ - case 265: /* where_opt_ret */ - case 276: /* case_operand */ - case 278: /* case_else */ - case 281: /* vinto */ - case 288: /* when_clause */ - case 293: /* key_opt */ - case 309: /* filter_clause */ +sqlite3SelectDelete(pParse->db, (yypminor->yy47)); +} + break; + case 216: /* term */ + case 217: /* expr */ + case 246: /* where_opt */ + case 248: /* having_opt */ + case 260: /* on_opt */ + case 267: /* where_opt_ret */ + case 278: /* case_operand */ + case 280: /* case_else */ + case 283: /* vinto */ + case 290: /* when_clause */ + case 295: /* key_opt */ + case 311: /* filter_clause */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy404)); -} - break; - case 219: /* eidlist_opt */ - case 229: /* sortlist */ - case 230: /* eidlist */ - case 242: /* selcollist */ - case 245: /* groupby_opt */ - case 247: /* orderby_opt */ - case 251: /* nexprlist */ - case 252: /* sclp */ - case 260: /* exprlist */ - case 266: /* setlist */ - case 275: /* paren_exprlist */ - case 277: /* case_exprlist */ - case 308: /* part_opt */ +sqlite3ExprDelete(pParse->db, (yypminor->yy528)); +} + break; + case 221: /* eidlist_opt */ + case 231: /* sortlist */ + case 232: /* eidlist */ + case 244: /* selcollist */ + case 247: /* groupby_opt */ + case 249: /* orderby_opt */ + case 253: /* nexprlist */ + case 254: /* sclp */ + case 262: /* exprlist */ + case 268: /* setlist */ + case 277: /* paren_exprlist */ + case 279: /* case_exprlist */ + case 310: /* part_opt */ { -sqlite3ExprListDelete(pParse->db, (yypminor->yy70)); +sqlite3ExprListDelete(pParse->db, (yypminor->yy322)); } break; - case 236: /* fullname */ - case 243: /* from */ - case 254: /* seltablist */ - case 255: /* stl_prefix */ - case 261: /* xfullname */ + case 238: /* fullname */ + case 245: /* from */ + case 256: /* seltablist */ + case 257: /* stl_prefix */ + case 263: /* xfullname */ { -sqlite3SrcListDelete(pParse->db, (yypminor->yy153)); +sqlite3SrcListDelete(pParse->db, (yypminor->yy131)); } break; - case 239: /* wqlist */ + case 241: /* wqlist */ { -sqlite3WithDelete(pParse->db, (yypminor->yy103)); +sqlite3WithDelete(pParse->db, (yypminor->yy521)); } break; - case 249: /* window_clause */ - case 304: /* windowdefn_list */ + case 251: /* window_clause */ + case 306: /* windowdefn_list */ { -sqlite3WindowListDelete(pParse->db, (yypminor->yy49)); +sqlite3WindowListDelete(pParse->db, (yypminor->yy41)); } break; - case 259: /* using_opt */ - case 262: /* idlist */ - case 268: /* idlist_opt */ + case 261: /* using_opt */ + case 264: /* idlist */ + case 270: /* idlist_opt */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy436)); +sqlite3IdListDelete(pParse->db, (yypminor->yy254)); } break; - case 271: /* filter_over */ - case 305: /* windowdefn */ - case 306: /* window */ - case 307: /* frame_opt */ - case 310: /* over_clause */ + case 273: /* filter_over */ + case 307: /* windowdefn */ + case 308: /* window */ + case 309: /* frame_opt */ + case 312: /* over_clause */ { -sqlite3WindowDelete(pParse->db, (yypminor->yy49)); +sqlite3WindowDelete(pParse->db, (yypminor->yy41)); } break; - case 284: /* trigger_cmd_list */ - case 289: /* trigger_cmd */ + case 286: /* trigger_cmd_list */ + case 291: /* trigger_cmd */ { -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy157)); +sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy33)); } break; - case 286: /* trigger_event */ + case 288: /* trigger_event */ { -sqlite3IdListDelete(pParse->db, (yypminor->yy262).b); +sqlite3IdListDelete(pParse->db, (yypminor->yy180).b); } break; - case 312: /* frame_bound */ - case 313: /* frame_bound_s */ - case 314: /* frame_bound_e */ + case 314: /* frame_bound */ + case 315: /* frame_bound_s */ + case 316: /* frame_bound_e */ { -sqlite3ExprDelete(pParse->db, (yypminor->yy117).pExpr); +sqlite3ExprDelete(pParse->db, (yypminor->yy595).pExpr); } break; /********* End destructor definitions *****************************************/ @@ -160706,404 +164132,408 @@ static void yy_shift( /* For rule J, yyRuleInfoLhs[J] contains the symbol on the left-hand side ** of that rule */ static const YYCODETYPE yyRuleInfoLhs[] = { - 188, /* (0) explain ::= EXPLAIN */ - 188, /* (1) explain ::= EXPLAIN QUERY PLAN */ - 187, /* (2) cmdx ::= cmd */ - 189, /* (3) cmd ::= BEGIN transtype trans_opt */ - 190, /* (4) transtype ::= */ - 190, /* (5) transtype ::= DEFERRED */ - 190, /* (6) transtype ::= IMMEDIATE */ - 190, /* (7) transtype ::= EXCLUSIVE */ - 189, /* (8) cmd ::= COMMIT|END trans_opt */ - 189, /* (9) cmd ::= ROLLBACK trans_opt */ - 189, /* (10) cmd ::= SAVEPOINT nm */ - 189, /* (11) cmd ::= RELEASE savepoint_opt nm */ - 189, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ - 194, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ - 196, /* (14) createkw ::= CREATE */ - 198, /* (15) ifnotexists ::= */ - 198, /* (16) ifnotexists ::= IF NOT EXISTS */ - 197, /* (17) temp ::= TEMP */ - 197, /* (18) temp ::= */ - 195, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */ - 195, /* (20) create_table_args ::= AS select */ - 202, /* (21) table_options ::= */ - 202, /* (22) table_options ::= WITHOUT nm */ - 204, /* (23) columnname ::= nm typetoken */ - 206, /* (24) typetoken ::= */ - 206, /* (25) typetoken ::= typename LP signed RP */ - 206, /* (26) typetoken ::= typename LP signed COMMA signed RP */ - 207, /* (27) typename ::= typename ID|STRING */ - 211, /* (28) scanpt ::= */ - 212, /* (29) scantok ::= */ - 213, /* (30) ccons ::= CONSTRAINT nm */ - 213, /* (31) ccons ::= DEFAULT scantok term */ - 213, /* (32) ccons ::= DEFAULT LP expr RP */ - 213, /* (33) ccons ::= DEFAULT PLUS scantok term */ - 213, /* (34) ccons ::= DEFAULT MINUS scantok term */ - 213, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */ - 213, /* (36) ccons ::= NOT NULL onconf */ - 213, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */ - 213, /* (38) ccons ::= UNIQUE onconf */ - 213, /* (39) ccons ::= CHECK LP expr RP */ - 213, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */ - 213, /* (41) ccons ::= defer_subclause */ - 213, /* (42) ccons ::= COLLATE ID|STRING */ - 222, /* (43) generated ::= LP expr RP */ - 222, /* (44) generated ::= LP expr RP ID */ - 218, /* (45) autoinc ::= */ - 218, /* (46) autoinc ::= AUTOINCR */ - 220, /* (47) refargs ::= */ - 220, /* (48) refargs ::= refargs refarg */ - 223, /* (49) refarg ::= MATCH nm */ - 223, /* (50) refarg ::= ON INSERT refact */ - 223, /* (51) refarg ::= ON DELETE refact */ - 223, /* (52) refarg ::= ON UPDATE refact */ - 224, /* (53) refact ::= SET NULL */ - 224, /* (54) refact ::= SET DEFAULT */ - 224, /* (55) refact ::= CASCADE */ - 224, /* (56) refact ::= RESTRICT */ - 224, /* (57) refact ::= NO ACTION */ - 221, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ - 221, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ - 225, /* (60) init_deferred_pred_opt ::= */ - 225, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */ - 225, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ - 201, /* (63) conslist_opt ::= */ - 227, /* (64) tconscomma ::= COMMA */ - 228, /* (65) tcons ::= CONSTRAINT nm */ - 228, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ - 228, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */ - 228, /* (68) tcons ::= CHECK LP expr RP onconf */ - 228, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ - 231, /* (70) defer_subclause_opt ::= */ - 216, /* (71) onconf ::= */ - 216, /* (72) onconf ::= ON CONFLICT resolvetype */ - 232, /* (73) orconf ::= */ - 232, /* (74) orconf ::= OR resolvetype */ - 233, /* (75) resolvetype ::= IGNORE */ - 233, /* (76) resolvetype ::= REPLACE */ - 189, /* (77) cmd ::= DROP TABLE ifexists fullname */ - 235, /* (78) ifexists ::= IF EXISTS */ - 235, /* (79) ifexists ::= */ - 189, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ - 189, /* (81) cmd ::= DROP VIEW ifexists fullname */ - 189, /* (82) cmd ::= select */ - 203, /* (83) select ::= WITH wqlist selectnowith */ - 203, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */ - 203, /* (85) select ::= selectnowith */ - 237, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */ - 240, /* (87) multiselect_op ::= UNION */ - 240, /* (88) multiselect_op ::= UNION ALL */ - 240, /* (89) multiselect_op ::= EXCEPT|INTERSECT */ - 238, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ - 238, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ - 250, /* (92) values ::= VALUES LP nexprlist RP */ - 250, /* (93) values ::= values COMMA LP nexprlist RP */ - 241, /* (94) distinct ::= DISTINCT */ - 241, /* (95) distinct ::= ALL */ - 241, /* (96) distinct ::= */ - 252, /* (97) sclp ::= */ - 242, /* (98) selcollist ::= sclp scanpt expr scanpt as */ - 242, /* (99) selcollist ::= sclp scanpt STAR */ - 242, /* (100) selcollist ::= sclp scanpt nm DOT STAR */ - 253, /* (101) as ::= AS nm */ - 253, /* (102) as ::= */ - 243, /* (103) from ::= */ - 243, /* (104) from ::= FROM seltablist */ - 255, /* (105) stl_prefix ::= seltablist joinop */ - 255, /* (106) stl_prefix ::= */ - 254, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ - 254, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ - 254, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ - 254, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ - 199, /* (111) dbnm ::= */ - 199, /* (112) dbnm ::= DOT nm */ - 236, /* (113) fullname ::= nm */ - 236, /* (114) fullname ::= nm DOT nm */ - 261, /* (115) xfullname ::= nm */ - 261, /* (116) xfullname ::= nm DOT nm */ - 261, /* (117) xfullname ::= nm DOT nm AS nm */ - 261, /* (118) xfullname ::= nm AS nm */ - 256, /* (119) joinop ::= COMMA|JOIN */ - 256, /* (120) joinop ::= JOIN_KW JOIN */ - 256, /* (121) joinop ::= JOIN_KW nm JOIN */ - 256, /* (122) joinop ::= JOIN_KW nm nm JOIN */ - 258, /* (123) on_opt ::= ON expr */ - 258, /* (124) on_opt ::= */ - 257, /* (125) indexed_opt ::= */ - 257, /* (126) indexed_opt ::= INDEXED BY nm */ - 257, /* (127) indexed_opt ::= NOT INDEXED */ - 259, /* (128) using_opt ::= USING LP idlist RP */ - 259, /* (129) using_opt ::= */ - 247, /* (130) orderby_opt ::= */ - 247, /* (131) orderby_opt ::= ORDER BY sortlist */ - 229, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */ - 229, /* (133) sortlist ::= expr sortorder nulls */ - 217, /* (134) sortorder ::= ASC */ - 217, /* (135) sortorder ::= DESC */ - 217, /* (136) sortorder ::= */ - 263, /* (137) nulls ::= NULLS FIRST */ - 263, /* (138) nulls ::= NULLS LAST */ - 263, /* (139) nulls ::= */ - 245, /* (140) groupby_opt ::= */ - 245, /* (141) groupby_opt ::= GROUP BY nexprlist */ - 246, /* (142) having_opt ::= */ - 246, /* (143) having_opt ::= HAVING expr */ - 248, /* (144) limit_opt ::= */ - 248, /* (145) limit_opt ::= LIMIT expr */ - 248, /* (146) limit_opt ::= LIMIT expr OFFSET expr */ - 248, /* (147) limit_opt ::= LIMIT expr COMMA expr */ - 189, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */ - 244, /* (149) where_opt ::= */ - 244, /* (150) where_opt ::= WHERE expr */ - 265, /* (151) where_opt_ret ::= */ - 265, /* (152) where_opt_ret ::= WHERE expr */ - 265, /* (153) where_opt_ret ::= RETURNING selcollist */ - 265, /* (154) where_opt_ret ::= WHERE expr RETURNING selcollist */ - 189, /* (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */ - 266, /* (156) setlist ::= setlist COMMA nm EQ expr */ - 266, /* (157) setlist ::= setlist COMMA LP idlist RP EQ expr */ - 266, /* (158) setlist ::= nm EQ expr */ - 266, /* (159) setlist ::= LP idlist RP EQ expr */ - 189, /* (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ - 189, /* (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ - 269, /* (162) upsert ::= */ - 269, /* (163) upsert ::= RETURNING selcollist */ - 269, /* (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ - 269, /* (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ - 269, /* (166) upsert ::= ON CONFLICT DO NOTHING returning */ - 269, /* (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ - 270, /* (168) returning ::= RETURNING selcollist */ - 267, /* (169) insert_cmd ::= INSERT orconf */ - 267, /* (170) insert_cmd ::= REPLACE */ - 268, /* (171) idlist_opt ::= */ - 268, /* (172) idlist_opt ::= LP idlist RP */ - 262, /* (173) idlist ::= idlist COMMA nm */ - 262, /* (174) idlist ::= nm */ - 215, /* (175) expr ::= LP expr RP */ - 215, /* (176) expr ::= ID|INDEXED */ - 215, /* (177) expr ::= JOIN_KW */ - 215, /* (178) expr ::= nm DOT nm */ - 215, /* (179) expr ::= nm DOT nm DOT nm */ - 214, /* (180) term ::= NULL|FLOAT|BLOB */ - 214, /* (181) term ::= STRING */ - 214, /* (182) term ::= INTEGER */ - 215, /* (183) expr ::= VARIABLE */ - 215, /* (184) expr ::= expr COLLATE ID|STRING */ - 215, /* (185) expr ::= CAST LP expr AS typetoken RP */ - 215, /* (186) expr ::= ID|INDEXED LP distinct exprlist RP */ - 215, /* (187) expr ::= ID|INDEXED LP STAR RP */ - 215, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ - 215, /* (189) expr ::= ID|INDEXED LP STAR RP filter_over */ - 214, /* (190) term ::= CTIME_KW */ - 215, /* (191) expr ::= LP nexprlist COMMA expr RP */ - 215, /* (192) expr ::= expr AND expr */ - 215, /* (193) expr ::= expr OR expr */ - 215, /* (194) expr ::= expr LT|GT|GE|LE expr */ - 215, /* (195) expr ::= expr EQ|NE expr */ - 215, /* (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ - 215, /* (197) expr ::= expr PLUS|MINUS expr */ - 215, /* (198) expr ::= expr STAR|SLASH|REM expr */ - 215, /* (199) expr ::= expr CONCAT expr */ - 272, /* (200) likeop ::= NOT LIKE_KW|MATCH */ - 215, /* (201) expr ::= expr likeop expr */ - 215, /* (202) expr ::= expr likeop expr ESCAPE expr */ - 215, /* (203) expr ::= expr ISNULL|NOTNULL */ - 215, /* (204) expr ::= expr NOT NULL */ - 215, /* (205) expr ::= expr IS expr */ - 215, /* (206) expr ::= expr IS NOT expr */ - 215, /* (207) expr ::= NOT expr */ - 215, /* (208) expr ::= BITNOT expr */ - 215, /* (209) expr ::= PLUS|MINUS expr */ - 273, /* (210) between_op ::= BETWEEN */ - 273, /* (211) between_op ::= NOT BETWEEN */ - 215, /* (212) expr ::= expr between_op expr AND expr */ - 274, /* (213) in_op ::= IN */ - 274, /* (214) in_op ::= NOT IN */ - 215, /* (215) expr ::= expr in_op LP exprlist RP */ - 215, /* (216) expr ::= LP select RP */ - 215, /* (217) expr ::= expr in_op LP select RP */ - 215, /* (218) expr ::= expr in_op nm dbnm paren_exprlist */ - 215, /* (219) expr ::= EXISTS LP select RP */ - 215, /* (220) expr ::= CASE case_operand case_exprlist case_else END */ - 277, /* (221) case_exprlist ::= case_exprlist WHEN expr THEN expr */ - 277, /* (222) case_exprlist ::= WHEN expr THEN expr */ - 278, /* (223) case_else ::= ELSE expr */ - 278, /* (224) case_else ::= */ - 276, /* (225) case_operand ::= expr */ - 276, /* (226) case_operand ::= */ - 260, /* (227) exprlist ::= */ - 251, /* (228) nexprlist ::= nexprlist COMMA expr */ - 251, /* (229) nexprlist ::= expr */ - 275, /* (230) paren_exprlist ::= */ - 275, /* (231) paren_exprlist ::= LP exprlist RP */ - 189, /* (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ - 279, /* (233) uniqueflag ::= UNIQUE */ - 279, /* (234) uniqueflag ::= */ - 219, /* (235) eidlist_opt ::= */ - 219, /* (236) eidlist_opt ::= LP eidlist RP */ - 230, /* (237) eidlist ::= eidlist COMMA nm collate sortorder */ - 230, /* (238) eidlist ::= nm collate sortorder */ - 280, /* (239) collate ::= */ - 280, /* (240) collate ::= COLLATE ID|STRING */ - 189, /* (241) cmd ::= DROP INDEX ifexists fullname */ - 189, /* (242) cmd ::= VACUUM vinto */ - 189, /* (243) cmd ::= VACUUM nm vinto */ - 281, /* (244) vinto ::= INTO expr */ - 281, /* (245) vinto ::= */ - 189, /* (246) cmd ::= PRAGMA nm dbnm */ - 189, /* (247) cmd ::= PRAGMA nm dbnm EQ nmnum */ - 189, /* (248) cmd ::= PRAGMA nm dbnm LP nmnum RP */ - 189, /* (249) cmd ::= PRAGMA nm dbnm EQ minus_num */ - 189, /* (250) cmd ::= PRAGMA nm dbnm LP minus_num RP */ - 209, /* (251) plus_num ::= PLUS INTEGER|FLOAT */ - 210, /* (252) minus_num ::= MINUS INTEGER|FLOAT */ - 189, /* (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ - 283, /* (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ - 285, /* (255) trigger_time ::= BEFORE|AFTER */ - 285, /* (256) trigger_time ::= INSTEAD OF */ - 285, /* (257) trigger_time ::= */ - 286, /* (258) trigger_event ::= DELETE|INSERT */ - 286, /* (259) trigger_event ::= UPDATE */ - 286, /* (260) trigger_event ::= UPDATE OF idlist */ - 288, /* (261) when_clause ::= */ - 288, /* (262) when_clause ::= WHEN expr */ - 284, /* (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ - 284, /* (264) trigger_cmd_list ::= trigger_cmd SEMI */ - 290, /* (265) trnm ::= nm DOT nm */ - 291, /* (266) tridxby ::= INDEXED BY nm */ - 291, /* (267) tridxby ::= NOT INDEXED */ - 289, /* (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ - 289, /* (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ - 289, /* (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ - 289, /* (271) trigger_cmd ::= scanpt select scanpt */ - 215, /* (272) expr ::= RAISE LP IGNORE RP */ - 215, /* (273) expr ::= RAISE LP raisetype COMMA nm RP */ - 234, /* (274) raisetype ::= ROLLBACK */ - 234, /* (275) raisetype ::= ABORT */ - 234, /* (276) raisetype ::= FAIL */ - 189, /* (277) cmd ::= DROP TRIGGER ifexists fullname */ - 189, /* (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ - 189, /* (279) cmd ::= DETACH database_kw_opt expr */ - 293, /* (280) key_opt ::= */ - 293, /* (281) key_opt ::= KEY expr */ - 189, /* (282) cmd ::= REINDEX */ - 189, /* (283) cmd ::= REINDEX nm dbnm */ - 189, /* (284) cmd ::= ANALYZE */ - 189, /* (285) cmd ::= ANALYZE nm dbnm */ - 189, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */ - 189, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ - 189, /* (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ - 294, /* (289) add_column_fullname ::= fullname */ - 189, /* (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ - 189, /* (291) cmd ::= create_vtab */ - 189, /* (292) cmd ::= create_vtab LP vtabarglist RP */ - 296, /* (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ - 298, /* (294) vtabarg ::= */ - 299, /* (295) vtabargtoken ::= ANY */ - 299, /* (296) vtabargtoken ::= lp anylist RP */ - 300, /* (297) lp ::= LP */ - 264, /* (298) with ::= WITH wqlist */ - 264, /* (299) with ::= WITH RECURSIVE wqlist */ - 303, /* (300) wqas ::= AS */ - 303, /* (301) wqas ::= AS MATERIALIZED */ - 303, /* (302) wqas ::= AS NOT MATERIALIZED */ - 302, /* (303) wqitem ::= nm eidlist_opt wqas LP select RP */ - 239, /* (304) wqlist ::= wqitem */ - 239, /* (305) wqlist ::= wqlist COMMA wqitem */ - 304, /* (306) windowdefn_list ::= windowdefn */ - 304, /* (307) windowdefn_list ::= windowdefn_list COMMA windowdefn */ - 305, /* (308) windowdefn ::= nm AS LP window RP */ - 306, /* (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ - 306, /* (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ - 306, /* (311) window ::= ORDER BY sortlist frame_opt */ - 306, /* (312) window ::= nm ORDER BY sortlist frame_opt */ - 306, /* (313) window ::= frame_opt */ - 306, /* (314) window ::= nm frame_opt */ - 307, /* (315) frame_opt ::= */ - 307, /* (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ - 307, /* (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ - 311, /* (318) range_or_rows ::= RANGE|ROWS|GROUPS */ - 313, /* (319) frame_bound_s ::= frame_bound */ - 313, /* (320) frame_bound_s ::= UNBOUNDED PRECEDING */ - 314, /* (321) frame_bound_e ::= frame_bound */ - 314, /* (322) frame_bound_e ::= UNBOUNDED FOLLOWING */ - 312, /* (323) frame_bound ::= expr PRECEDING|FOLLOWING */ - 312, /* (324) frame_bound ::= CURRENT ROW */ - 315, /* (325) frame_exclude_opt ::= */ - 315, /* (326) frame_exclude_opt ::= EXCLUDE frame_exclude */ - 316, /* (327) frame_exclude ::= NO OTHERS */ - 316, /* (328) frame_exclude ::= CURRENT ROW */ - 316, /* (329) frame_exclude ::= GROUP|TIES */ - 249, /* (330) window_clause ::= WINDOW windowdefn_list */ - 271, /* (331) filter_over ::= filter_clause over_clause */ - 271, /* (332) filter_over ::= over_clause */ - 271, /* (333) filter_over ::= filter_clause */ - 310, /* (334) over_clause ::= OVER LP window RP */ - 310, /* (335) over_clause ::= OVER nm */ - 309, /* (336) filter_clause ::= FILTER LP WHERE expr RP */ - 184, /* (337) input ::= cmdlist */ - 185, /* (338) cmdlist ::= cmdlist ecmd */ - 185, /* (339) cmdlist ::= ecmd */ - 186, /* (340) ecmd ::= SEMI */ - 186, /* (341) ecmd ::= cmdx SEMI */ - 186, /* (342) ecmd ::= explain cmdx SEMI */ - 191, /* (343) trans_opt ::= */ - 191, /* (344) trans_opt ::= TRANSACTION */ - 191, /* (345) trans_opt ::= TRANSACTION nm */ - 193, /* (346) savepoint_opt ::= SAVEPOINT */ - 193, /* (347) savepoint_opt ::= */ - 189, /* (348) cmd ::= create_table create_table_args */ - 200, /* (349) columnlist ::= columnlist COMMA columnname carglist */ - 200, /* (350) columnlist ::= columnname carglist */ - 192, /* (351) nm ::= ID|INDEXED */ - 192, /* (352) nm ::= STRING */ - 192, /* (353) nm ::= JOIN_KW */ - 206, /* (354) typetoken ::= typename */ - 207, /* (355) typename ::= ID|STRING */ - 208, /* (356) signed ::= plus_num */ - 208, /* (357) signed ::= minus_num */ - 205, /* (358) carglist ::= carglist ccons */ - 205, /* (359) carglist ::= */ - 213, /* (360) ccons ::= NULL onconf */ - 213, /* (361) ccons ::= GENERATED ALWAYS AS generated */ - 213, /* (362) ccons ::= AS generated */ - 201, /* (363) conslist_opt ::= COMMA conslist */ - 226, /* (364) conslist ::= conslist tconscomma tcons */ - 226, /* (365) conslist ::= tcons */ - 227, /* (366) tconscomma ::= */ - 231, /* (367) defer_subclause_opt ::= defer_subclause */ - 233, /* (368) resolvetype ::= raisetype */ - 237, /* (369) selectnowith ::= oneselect */ - 238, /* (370) oneselect ::= values */ - 252, /* (371) sclp ::= selcollist COMMA */ - 253, /* (372) as ::= ID|STRING */ - 270, /* (373) returning ::= */ - 215, /* (374) expr ::= term */ - 272, /* (375) likeop ::= LIKE_KW|MATCH */ - 260, /* (376) exprlist ::= nexprlist */ - 282, /* (377) nmnum ::= plus_num */ - 282, /* (378) nmnum ::= nm */ - 282, /* (379) nmnum ::= ON */ - 282, /* (380) nmnum ::= DELETE */ - 282, /* (381) nmnum ::= DEFAULT */ - 209, /* (382) plus_num ::= INTEGER|FLOAT */ - 287, /* (383) foreach_clause ::= */ - 287, /* (384) foreach_clause ::= FOR EACH ROW */ - 290, /* (385) trnm ::= nm */ - 291, /* (386) tridxby ::= */ - 292, /* (387) database_kw_opt ::= DATABASE */ - 292, /* (388) database_kw_opt ::= */ - 295, /* (389) kwcolumn_opt ::= */ - 295, /* (390) kwcolumn_opt ::= COLUMNKW */ - 297, /* (391) vtabarglist ::= vtabarg */ - 297, /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */ - 298, /* (393) vtabarg ::= vtabarg vtabargtoken */ - 301, /* (394) anylist ::= */ - 301, /* (395) anylist ::= anylist LP anylist RP */ - 301, /* (396) anylist ::= anylist ANY */ - 264, /* (397) with ::= */ + 189, /* (0) explain ::= EXPLAIN */ + 189, /* (1) explain ::= EXPLAIN QUERY PLAN */ + 188, /* (2) cmdx ::= cmd */ + 190, /* (3) cmd ::= BEGIN transtype trans_opt */ + 191, /* (4) transtype ::= */ + 191, /* (5) transtype ::= DEFERRED */ + 191, /* (6) transtype ::= IMMEDIATE */ + 191, /* (7) transtype ::= EXCLUSIVE */ + 190, /* (8) cmd ::= COMMIT|END trans_opt */ + 190, /* (9) cmd ::= ROLLBACK trans_opt */ + 190, /* (10) cmd ::= SAVEPOINT nm */ + 190, /* (11) cmd ::= RELEASE savepoint_opt nm */ + 190, /* (12) cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ + 195, /* (13) create_table ::= createkw temp TABLE ifnotexists nm dbnm */ + 197, /* (14) createkw ::= CREATE */ + 199, /* (15) ifnotexists ::= */ + 199, /* (16) ifnotexists ::= IF NOT EXISTS */ + 198, /* (17) temp ::= TEMP */ + 198, /* (18) temp ::= */ + 196, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ + 196, /* (20) create_table_args ::= AS select */ + 203, /* (21) table_option_set ::= */ + 203, /* (22) table_option_set ::= table_option_set COMMA table_option */ + 205, /* (23) table_option ::= WITHOUT nm */ + 205, /* (24) table_option ::= nm */ + 206, /* (25) columnname ::= nm typetoken */ + 208, /* (26) typetoken ::= */ + 208, /* (27) typetoken ::= typename LP signed RP */ + 208, /* (28) typetoken ::= typename LP signed COMMA signed RP */ + 209, /* (29) typename ::= typename ID|STRING */ + 213, /* (30) scanpt ::= */ + 214, /* (31) scantok ::= */ + 215, /* (32) ccons ::= CONSTRAINT nm */ + 215, /* (33) ccons ::= DEFAULT scantok term */ + 215, /* (34) ccons ::= DEFAULT LP expr RP */ + 215, /* (35) ccons ::= DEFAULT PLUS scantok term */ + 215, /* (36) ccons ::= DEFAULT MINUS scantok term */ + 215, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ + 215, /* (38) ccons ::= NOT NULL onconf */ + 215, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ + 215, /* (40) ccons ::= UNIQUE onconf */ + 215, /* (41) ccons ::= CHECK LP expr RP */ + 215, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ + 215, /* (43) ccons ::= defer_subclause */ + 215, /* (44) ccons ::= COLLATE ID|STRING */ + 224, /* (45) generated ::= LP expr RP */ + 224, /* (46) generated ::= LP expr RP ID */ + 220, /* (47) autoinc ::= */ + 220, /* (48) autoinc ::= AUTOINCR */ + 222, /* (49) refargs ::= */ + 222, /* (50) refargs ::= refargs refarg */ + 225, /* (51) refarg ::= MATCH nm */ + 225, /* (52) refarg ::= ON INSERT refact */ + 225, /* (53) refarg ::= ON DELETE refact */ + 225, /* (54) refarg ::= ON UPDATE refact */ + 226, /* (55) refact ::= SET NULL */ + 226, /* (56) refact ::= SET DEFAULT */ + 226, /* (57) refact ::= CASCADE */ + 226, /* (58) refact ::= RESTRICT */ + 226, /* (59) refact ::= NO ACTION */ + 223, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ + 223, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ + 227, /* (62) init_deferred_pred_opt ::= */ + 227, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ + 227, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ + 202, /* (65) conslist_opt ::= */ + 229, /* (66) tconscomma ::= COMMA */ + 230, /* (67) tcons ::= CONSTRAINT nm */ + 230, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ + 230, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ + 230, /* (70) tcons ::= CHECK LP expr RP onconf */ + 230, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ + 233, /* (72) defer_subclause_opt ::= */ + 218, /* (73) onconf ::= */ + 218, /* (74) onconf ::= ON CONFLICT resolvetype */ + 234, /* (75) orconf ::= */ + 234, /* (76) orconf ::= OR resolvetype */ + 235, /* (77) resolvetype ::= IGNORE */ + 235, /* (78) resolvetype ::= REPLACE */ + 190, /* (79) cmd ::= DROP TABLE ifexists fullname */ + 237, /* (80) ifexists ::= IF EXISTS */ + 237, /* (81) ifexists ::= */ + 190, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ + 190, /* (83) cmd ::= DROP VIEW ifexists fullname */ + 190, /* (84) cmd ::= select */ + 204, /* (85) select ::= WITH wqlist selectnowith */ + 204, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ + 204, /* (87) select ::= selectnowith */ + 239, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ + 242, /* (89) multiselect_op ::= UNION */ + 242, /* (90) multiselect_op ::= UNION ALL */ + 242, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ + 240, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + 240, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ + 252, /* (94) values ::= VALUES LP nexprlist RP */ + 252, /* (95) values ::= values COMMA LP nexprlist RP */ + 243, /* (96) distinct ::= DISTINCT */ + 243, /* (97) distinct ::= ALL */ + 243, /* (98) distinct ::= */ + 254, /* (99) sclp ::= */ + 244, /* (100) selcollist ::= sclp scanpt expr scanpt as */ + 244, /* (101) selcollist ::= sclp scanpt STAR */ + 244, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ + 255, /* (103) as ::= AS nm */ + 255, /* (104) as ::= */ + 245, /* (105) from ::= */ + 245, /* (106) from ::= FROM seltablist */ + 257, /* (107) stl_prefix ::= seltablist joinop */ + 257, /* (108) stl_prefix ::= */ + 256, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ + 256, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ + 256, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ + 256, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ + 200, /* (113) dbnm ::= */ + 200, /* (114) dbnm ::= DOT nm */ + 238, /* (115) fullname ::= nm */ + 238, /* (116) fullname ::= nm DOT nm */ + 263, /* (117) xfullname ::= nm */ + 263, /* (118) xfullname ::= nm DOT nm */ + 263, /* (119) xfullname ::= nm DOT nm AS nm */ + 263, /* (120) xfullname ::= nm AS nm */ + 258, /* (121) joinop ::= COMMA|JOIN */ + 258, /* (122) joinop ::= JOIN_KW JOIN */ + 258, /* (123) joinop ::= JOIN_KW nm JOIN */ + 258, /* (124) joinop ::= JOIN_KW nm nm JOIN */ + 260, /* (125) on_opt ::= ON expr */ + 260, /* (126) on_opt ::= */ + 259, /* (127) indexed_opt ::= */ + 259, /* (128) indexed_opt ::= INDEXED BY nm */ + 259, /* (129) indexed_opt ::= NOT INDEXED */ + 261, /* (130) using_opt ::= USING LP idlist RP */ + 261, /* (131) using_opt ::= */ + 249, /* (132) orderby_opt ::= */ + 249, /* (133) orderby_opt ::= ORDER BY sortlist */ + 231, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ + 231, /* (135) sortlist ::= expr sortorder nulls */ + 219, /* (136) sortorder ::= ASC */ + 219, /* (137) sortorder ::= DESC */ + 219, /* (138) sortorder ::= */ + 265, /* (139) nulls ::= NULLS FIRST */ + 265, /* (140) nulls ::= NULLS LAST */ + 265, /* (141) nulls ::= */ + 247, /* (142) groupby_opt ::= */ + 247, /* (143) groupby_opt ::= GROUP BY nexprlist */ + 248, /* (144) having_opt ::= */ + 248, /* (145) having_opt ::= HAVING expr */ + 250, /* (146) limit_opt ::= */ + 250, /* (147) limit_opt ::= LIMIT expr */ + 250, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ + 250, /* (149) limit_opt ::= LIMIT expr COMMA expr */ + 190, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */ + 246, /* (151) where_opt ::= */ + 246, /* (152) where_opt ::= WHERE expr */ + 267, /* (153) where_opt_ret ::= */ + 267, /* (154) where_opt_ret ::= WHERE expr */ + 267, /* (155) where_opt_ret ::= RETURNING selcollist */ + 267, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ + 190, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */ + 268, /* (158) setlist ::= setlist COMMA nm EQ expr */ + 268, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ + 268, /* (160) setlist ::= nm EQ expr */ + 268, /* (161) setlist ::= LP idlist RP EQ expr */ + 190, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + 190, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + 271, /* (164) upsert ::= */ + 271, /* (165) upsert ::= RETURNING selcollist */ + 271, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + 271, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + 271, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ + 271, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + 272, /* (170) returning ::= RETURNING selcollist */ + 269, /* (171) insert_cmd ::= INSERT orconf */ + 269, /* (172) insert_cmd ::= REPLACE */ + 270, /* (173) idlist_opt ::= */ + 270, /* (174) idlist_opt ::= LP idlist RP */ + 264, /* (175) idlist ::= idlist COMMA nm */ + 264, /* (176) idlist ::= nm */ + 217, /* (177) expr ::= LP expr RP */ + 217, /* (178) expr ::= ID|INDEXED */ + 217, /* (179) expr ::= JOIN_KW */ + 217, /* (180) expr ::= nm DOT nm */ + 217, /* (181) expr ::= nm DOT nm DOT nm */ + 216, /* (182) term ::= NULL|FLOAT|BLOB */ + 216, /* (183) term ::= STRING */ + 216, /* (184) term ::= INTEGER */ + 217, /* (185) expr ::= VARIABLE */ + 217, /* (186) expr ::= expr COLLATE ID|STRING */ + 217, /* (187) expr ::= CAST LP expr AS typetoken RP */ + 217, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */ + 217, /* (189) expr ::= ID|INDEXED LP STAR RP */ + 217, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ + 217, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */ + 216, /* (192) term ::= CTIME_KW */ + 217, /* (193) expr ::= LP nexprlist COMMA expr RP */ + 217, /* (194) expr ::= expr AND expr */ + 217, /* (195) expr ::= expr OR expr */ + 217, /* (196) expr ::= expr LT|GT|GE|LE expr */ + 217, /* (197) expr ::= expr EQ|NE expr */ + 217, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ + 217, /* (199) expr ::= expr PLUS|MINUS expr */ + 217, /* (200) expr ::= expr STAR|SLASH|REM expr */ + 217, /* (201) expr ::= expr CONCAT expr */ + 274, /* (202) likeop ::= NOT LIKE_KW|MATCH */ + 217, /* (203) expr ::= expr likeop expr */ + 217, /* (204) expr ::= expr likeop expr ESCAPE expr */ + 217, /* (205) expr ::= expr ISNULL|NOTNULL */ + 217, /* (206) expr ::= expr NOT NULL */ + 217, /* (207) expr ::= expr IS expr */ + 217, /* (208) expr ::= expr IS NOT expr */ + 217, /* (209) expr ::= NOT expr */ + 217, /* (210) expr ::= BITNOT expr */ + 217, /* (211) expr ::= PLUS|MINUS expr */ + 217, /* (212) expr ::= expr PTR expr */ + 275, /* (213) between_op ::= BETWEEN */ + 275, /* (214) between_op ::= NOT BETWEEN */ + 217, /* (215) expr ::= expr between_op expr AND expr */ + 276, /* (216) in_op ::= IN */ + 276, /* (217) in_op ::= NOT IN */ + 217, /* (218) expr ::= expr in_op LP exprlist RP */ + 217, /* (219) expr ::= LP select RP */ + 217, /* (220) expr ::= expr in_op LP select RP */ + 217, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */ + 217, /* (222) expr ::= EXISTS LP select RP */ + 217, /* (223) expr ::= CASE case_operand case_exprlist case_else END */ + 279, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */ + 279, /* (225) case_exprlist ::= WHEN expr THEN expr */ + 280, /* (226) case_else ::= ELSE expr */ + 280, /* (227) case_else ::= */ + 278, /* (228) case_operand ::= expr */ + 278, /* (229) case_operand ::= */ + 262, /* (230) exprlist ::= */ + 253, /* (231) nexprlist ::= nexprlist COMMA expr */ + 253, /* (232) nexprlist ::= expr */ + 277, /* (233) paren_exprlist ::= */ + 277, /* (234) paren_exprlist ::= LP exprlist RP */ + 190, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + 281, /* (236) uniqueflag ::= UNIQUE */ + 281, /* (237) uniqueflag ::= */ + 221, /* (238) eidlist_opt ::= */ + 221, /* (239) eidlist_opt ::= LP eidlist RP */ + 232, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ + 232, /* (241) eidlist ::= nm collate sortorder */ + 282, /* (242) collate ::= */ + 282, /* (243) collate ::= COLLATE ID|STRING */ + 190, /* (244) cmd ::= DROP INDEX ifexists fullname */ + 190, /* (245) cmd ::= VACUUM vinto */ + 190, /* (246) cmd ::= VACUUM nm vinto */ + 283, /* (247) vinto ::= INTO expr */ + 283, /* (248) vinto ::= */ + 190, /* (249) cmd ::= PRAGMA nm dbnm */ + 190, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ + 190, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ + 190, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ + 190, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ + 211, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ + 212, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ + 190, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + 285, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + 287, /* (258) trigger_time ::= BEFORE|AFTER */ + 287, /* (259) trigger_time ::= INSTEAD OF */ + 287, /* (260) trigger_time ::= */ + 288, /* (261) trigger_event ::= DELETE|INSERT */ + 288, /* (262) trigger_event ::= UPDATE */ + 288, /* (263) trigger_event ::= UPDATE OF idlist */ + 290, /* (264) when_clause ::= */ + 290, /* (265) when_clause ::= WHEN expr */ + 286, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + 286, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ + 292, /* (268) trnm ::= nm DOT nm */ + 293, /* (269) tridxby ::= INDEXED BY nm */ + 293, /* (270) tridxby ::= NOT INDEXED */ + 291, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + 291, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + 291, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + 291, /* (274) trigger_cmd ::= scanpt select scanpt */ + 217, /* (275) expr ::= RAISE LP IGNORE RP */ + 217, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ + 236, /* (277) raisetype ::= ROLLBACK */ + 236, /* (278) raisetype ::= ABORT */ + 236, /* (279) raisetype ::= FAIL */ + 190, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ + 190, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + 190, /* (282) cmd ::= DETACH database_kw_opt expr */ + 295, /* (283) key_opt ::= */ + 295, /* (284) key_opt ::= KEY expr */ + 190, /* (285) cmd ::= REINDEX */ + 190, /* (286) cmd ::= REINDEX nm dbnm */ + 190, /* (287) cmd ::= ANALYZE */ + 190, /* (288) cmd ::= ANALYZE nm dbnm */ + 190, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ + 190, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + 190, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + 296, /* (292) add_column_fullname ::= fullname */ + 190, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + 190, /* (294) cmd ::= create_vtab */ + 190, /* (295) cmd ::= create_vtab LP vtabarglist RP */ + 298, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + 300, /* (297) vtabarg ::= */ + 301, /* (298) vtabargtoken ::= ANY */ + 301, /* (299) vtabargtoken ::= lp anylist RP */ + 302, /* (300) lp ::= LP */ + 266, /* (301) with ::= WITH wqlist */ + 266, /* (302) with ::= WITH RECURSIVE wqlist */ + 305, /* (303) wqas ::= AS */ + 305, /* (304) wqas ::= AS MATERIALIZED */ + 305, /* (305) wqas ::= AS NOT MATERIALIZED */ + 304, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ + 241, /* (307) wqlist ::= wqitem */ + 241, /* (308) wqlist ::= wqlist COMMA wqitem */ + 306, /* (309) windowdefn_list ::= windowdefn */ + 306, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */ + 307, /* (311) windowdefn ::= nm AS LP window RP */ + 308, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + 308, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + 308, /* (314) window ::= ORDER BY sortlist frame_opt */ + 308, /* (315) window ::= nm ORDER BY sortlist frame_opt */ + 308, /* (316) window ::= frame_opt */ + 308, /* (317) window ::= nm frame_opt */ + 309, /* (318) frame_opt ::= */ + 309, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + 309, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + 313, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ + 315, /* (322) frame_bound_s ::= frame_bound */ + 315, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ + 316, /* (324) frame_bound_e ::= frame_bound */ + 316, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ + 314, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ + 314, /* (327) frame_bound ::= CURRENT ROW */ + 317, /* (328) frame_exclude_opt ::= */ + 317, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ + 318, /* (330) frame_exclude ::= NO OTHERS */ + 318, /* (331) frame_exclude ::= CURRENT ROW */ + 318, /* (332) frame_exclude ::= GROUP|TIES */ + 251, /* (333) window_clause ::= WINDOW windowdefn_list */ + 273, /* (334) filter_over ::= filter_clause over_clause */ + 273, /* (335) filter_over ::= over_clause */ + 273, /* (336) filter_over ::= filter_clause */ + 312, /* (337) over_clause ::= OVER LP window RP */ + 312, /* (338) over_clause ::= OVER nm */ + 311, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ + 185, /* (340) input ::= cmdlist */ + 186, /* (341) cmdlist ::= cmdlist ecmd */ + 186, /* (342) cmdlist ::= ecmd */ + 187, /* (343) ecmd ::= SEMI */ + 187, /* (344) ecmd ::= cmdx SEMI */ + 187, /* (345) ecmd ::= explain cmdx SEMI */ + 192, /* (346) trans_opt ::= */ + 192, /* (347) trans_opt ::= TRANSACTION */ + 192, /* (348) trans_opt ::= TRANSACTION nm */ + 194, /* (349) savepoint_opt ::= SAVEPOINT */ + 194, /* (350) savepoint_opt ::= */ + 190, /* (351) cmd ::= create_table create_table_args */ + 203, /* (352) table_option_set ::= table_option */ + 201, /* (353) columnlist ::= columnlist COMMA columnname carglist */ + 201, /* (354) columnlist ::= columnname carglist */ + 193, /* (355) nm ::= ID|INDEXED */ + 193, /* (356) nm ::= STRING */ + 193, /* (357) nm ::= JOIN_KW */ + 208, /* (358) typetoken ::= typename */ + 209, /* (359) typename ::= ID|STRING */ + 210, /* (360) signed ::= plus_num */ + 210, /* (361) signed ::= minus_num */ + 207, /* (362) carglist ::= carglist ccons */ + 207, /* (363) carglist ::= */ + 215, /* (364) ccons ::= NULL onconf */ + 215, /* (365) ccons ::= GENERATED ALWAYS AS generated */ + 215, /* (366) ccons ::= AS generated */ + 202, /* (367) conslist_opt ::= COMMA conslist */ + 228, /* (368) conslist ::= conslist tconscomma tcons */ + 228, /* (369) conslist ::= tcons */ + 229, /* (370) tconscomma ::= */ + 233, /* (371) defer_subclause_opt ::= defer_subclause */ + 235, /* (372) resolvetype ::= raisetype */ + 239, /* (373) selectnowith ::= oneselect */ + 240, /* (374) oneselect ::= values */ + 254, /* (375) sclp ::= selcollist COMMA */ + 255, /* (376) as ::= ID|STRING */ + 272, /* (377) returning ::= */ + 217, /* (378) expr ::= term */ + 274, /* (379) likeop ::= LIKE_KW|MATCH */ + 262, /* (380) exprlist ::= nexprlist */ + 284, /* (381) nmnum ::= plus_num */ + 284, /* (382) nmnum ::= nm */ + 284, /* (383) nmnum ::= ON */ + 284, /* (384) nmnum ::= DELETE */ + 284, /* (385) nmnum ::= DEFAULT */ + 211, /* (386) plus_num ::= INTEGER|FLOAT */ + 289, /* (387) foreach_clause ::= */ + 289, /* (388) foreach_clause ::= FOR EACH ROW */ + 292, /* (389) trnm ::= nm */ + 293, /* (390) tridxby ::= */ + 294, /* (391) database_kw_opt ::= DATABASE */ + 294, /* (392) database_kw_opt ::= */ + 297, /* (393) kwcolumn_opt ::= */ + 297, /* (394) kwcolumn_opt ::= COLUMNKW */ + 299, /* (395) vtabarglist ::= vtabarg */ + 299, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ + 300, /* (397) vtabarg ::= vtabarg vtabargtoken */ + 303, /* (398) anylist ::= */ + 303, /* (399) anylist ::= anylist LP anylist RP */ + 303, /* (400) anylist ::= anylist ANY */ + 266, /* (401) with ::= */ }; /* For rule J, yyRuleInfoNRhs[J] contains the negative of the number @@ -161128,385 +164558,389 @@ static const signed char yyRuleInfoNRhs[] = { -3, /* (16) ifnotexists ::= IF NOT EXISTS */ -1, /* (17) temp ::= TEMP */ 0, /* (18) temp ::= */ - -5, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_options */ + -5, /* (19) create_table_args ::= LP columnlist conslist_opt RP table_option_set */ -2, /* (20) create_table_args ::= AS select */ - 0, /* (21) table_options ::= */ - -2, /* (22) table_options ::= WITHOUT nm */ - -2, /* (23) columnname ::= nm typetoken */ - 0, /* (24) typetoken ::= */ - -4, /* (25) typetoken ::= typename LP signed RP */ - -6, /* (26) typetoken ::= typename LP signed COMMA signed RP */ - -2, /* (27) typename ::= typename ID|STRING */ - 0, /* (28) scanpt ::= */ - 0, /* (29) scantok ::= */ - -2, /* (30) ccons ::= CONSTRAINT nm */ - -3, /* (31) ccons ::= DEFAULT scantok term */ - -4, /* (32) ccons ::= DEFAULT LP expr RP */ - -4, /* (33) ccons ::= DEFAULT PLUS scantok term */ - -4, /* (34) ccons ::= DEFAULT MINUS scantok term */ - -3, /* (35) ccons ::= DEFAULT scantok ID|INDEXED */ - -3, /* (36) ccons ::= NOT NULL onconf */ - -5, /* (37) ccons ::= PRIMARY KEY sortorder onconf autoinc */ - -2, /* (38) ccons ::= UNIQUE onconf */ - -4, /* (39) ccons ::= CHECK LP expr RP */ - -4, /* (40) ccons ::= REFERENCES nm eidlist_opt refargs */ - -1, /* (41) ccons ::= defer_subclause */ - -2, /* (42) ccons ::= COLLATE ID|STRING */ - -3, /* (43) generated ::= LP expr RP */ - -4, /* (44) generated ::= LP expr RP ID */ - 0, /* (45) autoinc ::= */ - -1, /* (46) autoinc ::= AUTOINCR */ - 0, /* (47) refargs ::= */ - -2, /* (48) refargs ::= refargs refarg */ - -2, /* (49) refarg ::= MATCH nm */ - -3, /* (50) refarg ::= ON INSERT refact */ - -3, /* (51) refarg ::= ON DELETE refact */ - -3, /* (52) refarg ::= ON UPDATE refact */ - -2, /* (53) refact ::= SET NULL */ - -2, /* (54) refact ::= SET DEFAULT */ - -1, /* (55) refact ::= CASCADE */ - -1, /* (56) refact ::= RESTRICT */ - -2, /* (57) refact ::= NO ACTION */ - -3, /* (58) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ - -2, /* (59) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ - 0, /* (60) init_deferred_pred_opt ::= */ - -2, /* (61) init_deferred_pred_opt ::= INITIALLY DEFERRED */ - -2, /* (62) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ - 0, /* (63) conslist_opt ::= */ - -1, /* (64) tconscomma ::= COMMA */ - -2, /* (65) tcons ::= CONSTRAINT nm */ - -7, /* (66) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ - -5, /* (67) tcons ::= UNIQUE LP sortlist RP onconf */ - -5, /* (68) tcons ::= CHECK LP expr RP onconf */ - -10, /* (69) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ - 0, /* (70) defer_subclause_opt ::= */ - 0, /* (71) onconf ::= */ - -3, /* (72) onconf ::= ON CONFLICT resolvetype */ - 0, /* (73) orconf ::= */ - -2, /* (74) orconf ::= OR resolvetype */ - -1, /* (75) resolvetype ::= IGNORE */ - -1, /* (76) resolvetype ::= REPLACE */ - -4, /* (77) cmd ::= DROP TABLE ifexists fullname */ - -2, /* (78) ifexists ::= IF EXISTS */ - 0, /* (79) ifexists ::= */ - -9, /* (80) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ - -4, /* (81) cmd ::= DROP VIEW ifexists fullname */ - -1, /* (82) cmd ::= select */ - -3, /* (83) select ::= WITH wqlist selectnowith */ - -4, /* (84) select ::= WITH RECURSIVE wqlist selectnowith */ - -1, /* (85) select ::= selectnowith */ - -3, /* (86) selectnowith ::= selectnowith multiselect_op oneselect */ - -1, /* (87) multiselect_op ::= UNION */ - -2, /* (88) multiselect_op ::= UNION ALL */ - -1, /* (89) multiselect_op ::= EXCEPT|INTERSECT */ - -9, /* (90) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ - -10, /* (91) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ - -4, /* (92) values ::= VALUES LP nexprlist RP */ - -5, /* (93) values ::= values COMMA LP nexprlist RP */ - -1, /* (94) distinct ::= DISTINCT */ - -1, /* (95) distinct ::= ALL */ - 0, /* (96) distinct ::= */ - 0, /* (97) sclp ::= */ - -5, /* (98) selcollist ::= sclp scanpt expr scanpt as */ - -3, /* (99) selcollist ::= sclp scanpt STAR */ - -5, /* (100) selcollist ::= sclp scanpt nm DOT STAR */ - -2, /* (101) as ::= AS nm */ - 0, /* (102) as ::= */ - 0, /* (103) from ::= */ - -2, /* (104) from ::= FROM seltablist */ - -2, /* (105) stl_prefix ::= seltablist joinop */ - 0, /* (106) stl_prefix ::= */ - -7, /* (107) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ - -9, /* (108) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ - -7, /* (109) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ - -7, /* (110) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ - 0, /* (111) dbnm ::= */ - -2, /* (112) dbnm ::= DOT nm */ - -1, /* (113) fullname ::= nm */ - -3, /* (114) fullname ::= nm DOT nm */ - -1, /* (115) xfullname ::= nm */ - -3, /* (116) xfullname ::= nm DOT nm */ - -5, /* (117) xfullname ::= nm DOT nm AS nm */ - -3, /* (118) xfullname ::= nm AS nm */ - -1, /* (119) joinop ::= COMMA|JOIN */ - -2, /* (120) joinop ::= JOIN_KW JOIN */ - -3, /* (121) joinop ::= JOIN_KW nm JOIN */ - -4, /* (122) joinop ::= JOIN_KW nm nm JOIN */ - -2, /* (123) on_opt ::= ON expr */ - 0, /* (124) on_opt ::= */ - 0, /* (125) indexed_opt ::= */ - -3, /* (126) indexed_opt ::= INDEXED BY nm */ - -2, /* (127) indexed_opt ::= NOT INDEXED */ - -4, /* (128) using_opt ::= USING LP idlist RP */ - 0, /* (129) using_opt ::= */ - 0, /* (130) orderby_opt ::= */ - -3, /* (131) orderby_opt ::= ORDER BY sortlist */ - -5, /* (132) sortlist ::= sortlist COMMA expr sortorder nulls */ - -3, /* (133) sortlist ::= expr sortorder nulls */ - -1, /* (134) sortorder ::= ASC */ - -1, /* (135) sortorder ::= DESC */ - 0, /* (136) sortorder ::= */ - -2, /* (137) nulls ::= NULLS FIRST */ - -2, /* (138) nulls ::= NULLS LAST */ - 0, /* (139) nulls ::= */ - 0, /* (140) groupby_opt ::= */ - -3, /* (141) groupby_opt ::= GROUP BY nexprlist */ - 0, /* (142) having_opt ::= */ - -2, /* (143) having_opt ::= HAVING expr */ - 0, /* (144) limit_opt ::= */ - -2, /* (145) limit_opt ::= LIMIT expr */ - -4, /* (146) limit_opt ::= LIMIT expr OFFSET expr */ - -4, /* (147) limit_opt ::= LIMIT expr COMMA expr */ - -8, /* (148) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */ - 0, /* (149) where_opt ::= */ - -2, /* (150) where_opt ::= WHERE expr */ - 0, /* (151) where_opt_ret ::= */ - -2, /* (152) where_opt_ret ::= WHERE expr */ - -2, /* (153) where_opt_ret ::= RETURNING selcollist */ - -4, /* (154) where_opt_ret ::= WHERE expr RETURNING selcollist */ - -11, /* (155) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */ - -5, /* (156) setlist ::= setlist COMMA nm EQ expr */ - -7, /* (157) setlist ::= setlist COMMA LP idlist RP EQ expr */ - -3, /* (158) setlist ::= nm EQ expr */ - -5, /* (159) setlist ::= LP idlist RP EQ expr */ - -7, /* (160) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ - -8, /* (161) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ - 0, /* (162) upsert ::= */ - -2, /* (163) upsert ::= RETURNING selcollist */ - -12, /* (164) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ - -9, /* (165) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ - -5, /* (166) upsert ::= ON CONFLICT DO NOTHING returning */ - -8, /* (167) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ - -2, /* (168) returning ::= RETURNING selcollist */ - -2, /* (169) insert_cmd ::= INSERT orconf */ - -1, /* (170) insert_cmd ::= REPLACE */ - 0, /* (171) idlist_opt ::= */ - -3, /* (172) idlist_opt ::= LP idlist RP */ - -3, /* (173) idlist ::= idlist COMMA nm */ - -1, /* (174) idlist ::= nm */ - -3, /* (175) expr ::= LP expr RP */ - -1, /* (176) expr ::= ID|INDEXED */ - -1, /* (177) expr ::= JOIN_KW */ - -3, /* (178) expr ::= nm DOT nm */ - -5, /* (179) expr ::= nm DOT nm DOT nm */ - -1, /* (180) term ::= NULL|FLOAT|BLOB */ - -1, /* (181) term ::= STRING */ - -1, /* (182) term ::= INTEGER */ - -1, /* (183) expr ::= VARIABLE */ - -3, /* (184) expr ::= expr COLLATE ID|STRING */ - -6, /* (185) expr ::= CAST LP expr AS typetoken RP */ - -5, /* (186) expr ::= ID|INDEXED LP distinct exprlist RP */ - -4, /* (187) expr ::= ID|INDEXED LP STAR RP */ - -6, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ - -5, /* (189) expr ::= ID|INDEXED LP STAR RP filter_over */ - -1, /* (190) term ::= CTIME_KW */ - -5, /* (191) expr ::= LP nexprlist COMMA expr RP */ - -3, /* (192) expr ::= expr AND expr */ - -3, /* (193) expr ::= expr OR expr */ - -3, /* (194) expr ::= expr LT|GT|GE|LE expr */ - -3, /* (195) expr ::= expr EQ|NE expr */ - -3, /* (196) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ - -3, /* (197) expr ::= expr PLUS|MINUS expr */ - -3, /* (198) expr ::= expr STAR|SLASH|REM expr */ - -3, /* (199) expr ::= expr CONCAT expr */ - -2, /* (200) likeop ::= NOT LIKE_KW|MATCH */ - -3, /* (201) expr ::= expr likeop expr */ - -5, /* (202) expr ::= expr likeop expr ESCAPE expr */ - -2, /* (203) expr ::= expr ISNULL|NOTNULL */ - -3, /* (204) expr ::= expr NOT NULL */ - -3, /* (205) expr ::= expr IS expr */ - -4, /* (206) expr ::= expr IS NOT expr */ - -2, /* (207) expr ::= NOT expr */ - -2, /* (208) expr ::= BITNOT expr */ - -2, /* (209) expr ::= PLUS|MINUS expr */ - -1, /* (210) between_op ::= BETWEEN */ - -2, /* (211) between_op ::= NOT BETWEEN */ - -5, /* (212) expr ::= expr between_op expr AND expr */ - -1, /* (213) in_op ::= IN */ - -2, /* (214) in_op ::= NOT IN */ - -5, /* (215) expr ::= expr in_op LP exprlist RP */ - -3, /* (216) expr ::= LP select RP */ - -5, /* (217) expr ::= expr in_op LP select RP */ - -5, /* (218) expr ::= expr in_op nm dbnm paren_exprlist */ - -4, /* (219) expr ::= EXISTS LP select RP */ - -5, /* (220) expr ::= CASE case_operand case_exprlist case_else END */ - -5, /* (221) case_exprlist ::= case_exprlist WHEN expr THEN expr */ - -4, /* (222) case_exprlist ::= WHEN expr THEN expr */ - -2, /* (223) case_else ::= ELSE expr */ - 0, /* (224) case_else ::= */ - -1, /* (225) case_operand ::= expr */ - 0, /* (226) case_operand ::= */ - 0, /* (227) exprlist ::= */ - -3, /* (228) nexprlist ::= nexprlist COMMA expr */ - -1, /* (229) nexprlist ::= expr */ - 0, /* (230) paren_exprlist ::= */ - -3, /* (231) paren_exprlist ::= LP exprlist RP */ - -12, /* (232) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ - -1, /* (233) uniqueflag ::= UNIQUE */ - 0, /* (234) uniqueflag ::= */ - 0, /* (235) eidlist_opt ::= */ - -3, /* (236) eidlist_opt ::= LP eidlist RP */ - -5, /* (237) eidlist ::= eidlist COMMA nm collate sortorder */ - -3, /* (238) eidlist ::= nm collate sortorder */ - 0, /* (239) collate ::= */ - -2, /* (240) collate ::= COLLATE ID|STRING */ - -4, /* (241) cmd ::= DROP INDEX ifexists fullname */ - -2, /* (242) cmd ::= VACUUM vinto */ - -3, /* (243) cmd ::= VACUUM nm vinto */ - -2, /* (244) vinto ::= INTO expr */ - 0, /* (245) vinto ::= */ - -3, /* (246) cmd ::= PRAGMA nm dbnm */ - -5, /* (247) cmd ::= PRAGMA nm dbnm EQ nmnum */ - -6, /* (248) cmd ::= PRAGMA nm dbnm LP nmnum RP */ - -5, /* (249) cmd ::= PRAGMA nm dbnm EQ minus_num */ - -6, /* (250) cmd ::= PRAGMA nm dbnm LP minus_num RP */ - -2, /* (251) plus_num ::= PLUS INTEGER|FLOAT */ - -2, /* (252) minus_num ::= MINUS INTEGER|FLOAT */ - -5, /* (253) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ - -11, /* (254) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ - -1, /* (255) trigger_time ::= BEFORE|AFTER */ - -2, /* (256) trigger_time ::= INSTEAD OF */ - 0, /* (257) trigger_time ::= */ - -1, /* (258) trigger_event ::= DELETE|INSERT */ - -1, /* (259) trigger_event ::= UPDATE */ - -3, /* (260) trigger_event ::= UPDATE OF idlist */ - 0, /* (261) when_clause ::= */ - -2, /* (262) when_clause ::= WHEN expr */ - -3, /* (263) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ - -2, /* (264) trigger_cmd_list ::= trigger_cmd SEMI */ - -3, /* (265) trnm ::= nm DOT nm */ - -3, /* (266) tridxby ::= INDEXED BY nm */ - -2, /* (267) tridxby ::= NOT INDEXED */ - -9, /* (268) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ - -8, /* (269) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ - -6, /* (270) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ - -3, /* (271) trigger_cmd ::= scanpt select scanpt */ - -4, /* (272) expr ::= RAISE LP IGNORE RP */ - -6, /* (273) expr ::= RAISE LP raisetype COMMA nm RP */ - -1, /* (274) raisetype ::= ROLLBACK */ - -1, /* (275) raisetype ::= ABORT */ - -1, /* (276) raisetype ::= FAIL */ - -4, /* (277) cmd ::= DROP TRIGGER ifexists fullname */ - -6, /* (278) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ - -3, /* (279) cmd ::= DETACH database_kw_opt expr */ - 0, /* (280) key_opt ::= */ - -2, /* (281) key_opt ::= KEY expr */ - -1, /* (282) cmd ::= REINDEX */ - -3, /* (283) cmd ::= REINDEX nm dbnm */ - -1, /* (284) cmd ::= ANALYZE */ - -3, /* (285) cmd ::= ANALYZE nm dbnm */ - -6, /* (286) cmd ::= ALTER TABLE fullname RENAME TO nm */ - -7, /* (287) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ - -6, /* (288) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ - -1, /* (289) add_column_fullname ::= fullname */ - -8, /* (290) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ - -1, /* (291) cmd ::= create_vtab */ - -4, /* (292) cmd ::= create_vtab LP vtabarglist RP */ - -8, /* (293) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ - 0, /* (294) vtabarg ::= */ - -1, /* (295) vtabargtoken ::= ANY */ - -3, /* (296) vtabargtoken ::= lp anylist RP */ - -1, /* (297) lp ::= LP */ - -2, /* (298) with ::= WITH wqlist */ - -3, /* (299) with ::= WITH RECURSIVE wqlist */ - -1, /* (300) wqas ::= AS */ - -2, /* (301) wqas ::= AS MATERIALIZED */ - -3, /* (302) wqas ::= AS NOT MATERIALIZED */ - -6, /* (303) wqitem ::= nm eidlist_opt wqas LP select RP */ - -1, /* (304) wqlist ::= wqitem */ - -3, /* (305) wqlist ::= wqlist COMMA wqitem */ - -1, /* (306) windowdefn_list ::= windowdefn */ - -3, /* (307) windowdefn_list ::= windowdefn_list COMMA windowdefn */ - -5, /* (308) windowdefn ::= nm AS LP window RP */ - -5, /* (309) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ - -6, /* (310) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ - -4, /* (311) window ::= ORDER BY sortlist frame_opt */ - -5, /* (312) window ::= nm ORDER BY sortlist frame_opt */ - -1, /* (313) window ::= frame_opt */ - -2, /* (314) window ::= nm frame_opt */ - 0, /* (315) frame_opt ::= */ - -3, /* (316) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ - -6, /* (317) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ - -1, /* (318) range_or_rows ::= RANGE|ROWS|GROUPS */ - -1, /* (319) frame_bound_s ::= frame_bound */ - -2, /* (320) frame_bound_s ::= UNBOUNDED PRECEDING */ - -1, /* (321) frame_bound_e ::= frame_bound */ - -2, /* (322) frame_bound_e ::= UNBOUNDED FOLLOWING */ - -2, /* (323) frame_bound ::= expr PRECEDING|FOLLOWING */ - -2, /* (324) frame_bound ::= CURRENT ROW */ - 0, /* (325) frame_exclude_opt ::= */ - -2, /* (326) frame_exclude_opt ::= EXCLUDE frame_exclude */ - -2, /* (327) frame_exclude ::= NO OTHERS */ - -2, /* (328) frame_exclude ::= CURRENT ROW */ - -1, /* (329) frame_exclude ::= GROUP|TIES */ - -2, /* (330) window_clause ::= WINDOW windowdefn_list */ - -2, /* (331) filter_over ::= filter_clause over_clause */ - -1, /* (332) filter_over ::= over_clause */ - -1, /* (333) filter_over ::= filter_clause */ - -4, /* (334) over_clause ::= OVER LP window RP */ - -2, /* (335) over_clause ::= OVER nm */ - -5, /* (336) filter_clause ::= FILTER LP WHERE expr RP */ - -1, /* (337) input ::= cmdlist */ - -2, /* (338) cmdlist ::= cmdlist ecmd */ - -1, /* (339) cmdlist ::= ecmd */ - -1, /* (340) ecmd ::= SEMI */ - -2, /* (341) ecmd ::= cmdx SEMI */ - -3, /* (342) ecmd ::= explain cmdx SEMI */ - 0, /* (343) trans_opt ::= */ - -1, /* (344) trans_opt ::= TRANSACTION */ - -2, /* (345) trans_opt ::= TRANSACTION nm */ - -1, /* (346) savepoint_opt ::= SAVEPOINT */ - 0, /* (347) savepoint_opt ::= */ - -2, /* (348) cmd ::= create_table create_table_args */ - -4, /* (349) columnlist ::= columnlist COMMA columnname carglist */ - -2, /* (350) columnlist ::= columnname carglist */ - -1, /* (351) nm ::= ID|INDEXED */ - -1, /* (352) nm ::= STRING */ - -1, /* (353) nm ::= JOIN_KW */ - -1, /* (354) typetoken ::= typename */ - -1, /* (355) typename ::= ID|STRING */ - -1, /* (356) signed ::= plus_num */ - -1, /* (357) signed ::= minus_num */ - -2, /* (358) carglist ::= carglist ccons */ - 0, /* (359) carglist ::= */ - -2, /* (360) ccons ::= NULL onconf */ - -4, /* (361) ccons ::= GENERATED ALWAYS AS generated */ - -2, /* (362) ccons ::= AS generated */ - -2, /* (363) conslist_opt ::= COMMA conslist */ - -3, /* (364) conslist ::= conslist tconscomma tcons */ - -1, /* (365) conslist ::= tcons */ - 0, /* (366) tconscomma ::= */ - -1, /* (367) defer_subclause_opt ::= defer_subclause */ - -1, /* (368) resolvetype ::= raisetype */ - -1, /* (369) selectnowith ::= oneselect */ - -1, /* (370) oneselect ::= values */ - -2, /* (371) sclp ::= selcollist COMMA */ - -1, /* (372) as ::= ID|STRING */ - 0, /* (373) returning ::= */ - -1, /* (374) expr ::= term */ - -1, /* (375) likeop ::= LIKE_KW|MATCH */ - -1, /* (376) exprlist ::= nexprlist */ - -1, /* (377) nmnum ::= plus_num */ - -1, /* (378) nmnum ::= nm */ - -1, /* (379) nmnum ::= ON */ - -1, /* (380) nmnum ::= DELETE */ - -1, /* (381) nmnum ::= DEFAULT */ - -1, /* (382) plus_num ::= INTEGER|FLOAT */ - 0, /* (383) foreach_clause ::= */ - -3, /* (384) foreach_clause ::= FOR EACH ROW */ - -1, /* (385) trnm ::= nm */ - 0, /* (386) tridxby ::= */ - -1, /* (387) database_kw_opt ::= DATABASE */ - 0, /* (388) database_kw_opt ::= */ - 0, /* (389) kwcolumn_opt ::= */ - -1, /* (390) kwcolumn_opt ::= COLUMNKW */ - -1, /* (391) vtabarglist ::= vtabarg */ - -3, /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */ - -2, /* (393) vtabarg ::= vtabarg vtabargtoken */ - 0, /* (394) anylist ::= */ - -4, /* (395) anylist ::= anylist LP anylist RP */ - -2, /* (396) anylist ::= anylist ANY */ - 0, /* (397) with ::= */ + 0, /* (21) table_option_set ::= */ + -3, /* (22) table_option_set ::= table_option_set COMMA table_option */ + -2, /* (23) table_option ::= WITHOUT nm */ + -1, /* (24) table_option ::= nm */ + -2, /* (25) columnname ::= nm typetoken */ + 0, /* (26) typetoken ::= */ + -4, /* (27) typetoken ::= typename LP signed RP */ + -6, /* (28) typetoken ::= typename LP signed COMMA signed RP */ + -2, /* (29) typename ::= typename ID|STRING */ + 0, /* (30) scanpt ::= */ + 0, /* (31) scantok ::= */ + -2, /* (32) ccons ::= CONSTRAINT nm */ + -3, /* (33) ccons ::= DEFAULT scantok term */ + -4, /* (34) ccons ::= DEFAULT LP expr RP */ + -4, /* (35) ccons ::= DEFAULT PLUS scantok term */ + -4, /* (36) ccons ::= DEFAULT MINUS scantok term */ + -3, /* (37) ccons ::= DEFAULT scantok ID|INDEXED */ + -3, /* (38) ccons ::= NOT NULL onconf */ + -5, /* (39) ccons ::= PRIMARY KEY sortorder onconf autoinc */ + -2, /* (40) ccons ::= UNIQUE onconf */ + -4, /* (41) ccons ::= CHECK LP expr RP */ + -4, /* (42) ccons ::= REFERENCES nm eidlist_opt refargs */ + -1, /* (43) ccons ::= defer_subclause */ + -2, /* (44) ccons ::= COLLATE ID|STRING */ + -3, /* (45) generated ::= LP expr RP */ + -4, /* (46) generated ::= LP expr RP ID */ + 0, /* (47) autoinc ::= */ + -1, /* (48) autoinc ::= AUTOINCR */ + 0, /* (49) refargs ::= */ + -2, /* (50) refargs ::= refargs refarg */ + -2, /* (51) refarg ::= MATCH nm */ + -3, /* (52) refarg ::= ON INSERT refact */ + -3, /* (53) refarg ::= ON DELETE refact */ + -3, /* (54) refarg ::= ON UPDATE refact */ + -2, /* (55) refact ::= SET NULL */ + -2, /* (56) refact ::= SET DEFAULT */ + -1, /* (57) refact ::= CASCADE */ + -1, /* (58) refact ::= RESTRICT */ + -2, /* (59) refact ::= NO ACTION */ + -3, /* (60) defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ + -2, /* (61) defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ + 0, /* (62) init_deferred_pred_opt ::= */ + -2, /* (63) init_deferred_pred_opt ::= INITIALLY DEFERRED */ + -2, /* (64) init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ + 0, /* (65) conslist_opt ::= */ + -1, /* (66) tconscomma ::= COMMA */ + -2, /* (67) tcons ::= CONSTRAINT nm */ + -7, /* (68) tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ + -5, /* (69) tcons ::= UNIQUE LP sortlist RP onconf */ + -5, /* (70) tcons ::= CHECK LP expr RP onconf */ + -10, /* (71) tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ + 0, /* (72) defer_subclause_opt ::= */ + 0, /* (73) onconf ::= */ + -3, /* (74) onconf ::= ON CONFLICT resolvetype */ + 0, /* (75) orconf ::= */ + -2, /* (76) orconf ::= OR resolvetype */ + -1, /* (77) resolvetype ::= IGNORE */ + -1, /* (78) resolvetype ::= REPLACE */ + -4, /* (79) cmd ::= DROP TABLE ifexists fullname */ + -2, /* (80) ifexists ::= IF EXISTS */ + 0, /* (81) ifexists ::= */ + -9, /* (82) cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ + -4, /* (83) cmd ::= DROP VIEW ifexists fullname */ + -1, /* (84) cmd ::= select */ + -3, /* (85) select ::= WITH wqlist selectnowith */ + -4, /* (86) select ::= WITH RECURSIVE wqlist selectnowith */ + -1, /* (87) select ::= selectnowith */ + -3, /* (88) selectnowith ::= selectnowith multiselect_op oneselect */ + -1, /* (89) multiselect_op ::= UNION */ + -2, /* (90) multiselect_op ::= UNION ALL */ + -1, /* (91) multiselect_op ::= EXCEPT|INTERSECT */ + -9, /* (92) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + -10, /* (93) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ + -4, /* (94) values ::= VALUES LP nexprlist RP */ + -5, /* (95) values ::= values COMMA LP nexprlist RP */ + -1, /* (96) distinct ::= DISTINCT */ + -1, /* (97) distinct ::= ALL */ + 0, /* (98) distinct ::= */ + 0, /* (99) sclp ::= */ + -5, /* (100) selcollist ::= sclp scanpt expr scanpt as */ + -3, /* (101) selcollist ::= sclp scanpt STAR */ + -5, /* (102) selcollist ::= sclp scanpt nm DOT STAR */ + -2, /* (103) as ::= AS nm */ + 0, /* (104) as ::= */ + 0, /* (105) from ::= */ + -2, /* (106) from ::= FROM seltablist */ + -2, /* (107) stl_prefix ::= seltablist joinop */ + 0, /* (108) stl_prefix ::= */ + -7, /* (109) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ + -9, /* (110) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ + -7, /* (111) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ + -7, /* (112) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ + 0, /* (113) dbnm ::= */ + -2, /* (114) dbnm ::= DOT nm */ + -1, /* (115) fullname ::= nm */ + -3, /* (116) fullname ::= nm DOT nm */ + -1, /* (117) xfullname ::= nm */ + -3, /* (118) xfullname ::= nm DOT nm */ + -5, /* (119) xfullname ::= nm DOT nm AS nm */ + -3, /* (120) xfullname ::= nm AS nm */ + -1, /* (121) joinop ::= COMMA|JOIN */ + -2, /* (122) joinop ::= JOIN_KW JOIN */ + -3, /* (123) joinop ::= JOIN_KW nm JOIN */ + -4, /* (124) joinop ::= JOIN_KW nm nm JOIN */ + -2, /* (125) on_opt ::= ON expr */ + 0, /* (126) on_opt ::= */ + 0, /* (127) indexed_opt ::= */ + -3, /* (128) indexed_opt ::= INDEXED BY nm */ + -2, /* (129) indexed_opt ::= NOT INDEXED */ + -4, /* (130) using_opt ::= USING LP idlist RP */ + 0, /* (131) using_opt ::= */ + 0, /* (132) orderby_opt ::= */ + -3, /* (133) orderby_opt ::= ORDER BY sortlist */ + -5, /* (134) sortlist ::= sortlist COMMA expr sortorder nulls */ + -3, /* (135) sortlist ::= expr sortorder nulls */ + -1, /* (136) sortorder ::= ASC */ + -1, /* (137) sortorder ::= DESC */ + 0, /* (138) sortorder ::= */ + -2, /* (139) nulls ::= NULLS FIRST */ + -2, /* (140) nulls ::= NULLS LAST */ + 0, /* (141) nulls ::= */ + 0, /* (142) groupby_opt ::= */ + -3, /* (143) groupby_opt ::= GROUP BY nexprlist */ + 0, /* (144) having_opt ::= */ + -2, /* (145) having_opt ::= HAVING expr */ + 0, /* (146) limit_opt ::= */ + -2, /* (147) limit_opt ::= LIMIT expr */ + -4, /* (148) limit_opt ::= LIMIT expr OFFSET expr */ + -4, /* (149) limit_opt ::= LIMIT expr COMMA expr */ + -8, /* (150) cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */ + 0, /* (151) where_opt ::= */ + -2, /* (152) where_opt ::= WHERE expr */ + 0, /* (153) where_opt_ret ::= */ + -2, /* (154) where_opt_ret ::= WHERE expr */ + -2, /* (155) where_opt_ret ::= RETURNING selcollist */ + -4, /* (156) where_opt_ret ::= WHERE expr RETURNING selcollist */ + -11, /* (157) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */ + -5, /* (158) setlist ::= setlist COMMA nm EQ expr */ + -7, /* (159) setlist ::= setlist COMMA LP idlist RP EQ expr */ + -3, /* (160) setlist ::= nm EQ expr */ + -5, /* (161) setlist ::= LP idlist RP EQ expr */ + -7, /* (162) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + -8, /* (163) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + 0, /* (164) upsert ::= */ + -2, /* (165) upsert ::= RETURNING selcollist */ + -12, /* (166) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ + -9, /* (167) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ + -5, /* (168) upsert ::= ON CONFLICT DO NOTHING returning */ + -8, /* (169) upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ + -2, /* (170) returning ::= RETURNING selcollist */ + -2, /* (171) insert_cmd ::= INSERT orconf */ + -1, /* (172) insert_cmd ::= REPLACE */ + 0, /* (173) idlist_opt ::= */ + -3, /* (174) idlist_opt ::= LP idlist RP */ + -3, /* (175) idlist ::= idlist COMMA nm */ + -1, /* (176) idlist ::= nm */ + -3, /* (177) expr ::= LP expr RP */ + -1, /* (178) expr ::= ID|INDEXED */ + -1, /* (179) expr ::= JOIN_KW */ + -3, /* (180) expr ::= nm DOT nm */ + -5, /* (181) expr ::= nm DOT nm DOT nm */ + -1, /* (182) term ::= NULL|FLOAT|BLOB */ + -1, /* (183) term ::= STRING */ + -1, /* (184) term ::= INTEGER */ + -1, /* (185) expr ::= VARIABLE */ + -3, /* (186) expr ::= expr COLLATE ID|STRING */ + -6, /* (187) expr ::= CAST LP expr AS typetoken RP */ + -5, /* (188) expr ::= ID|INDEXED LP distinct exprlist RP */ + -4, /* (189) expr ::= ID|INDEXED LP STAR RP */ + -6, /* (190) expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ + -5, /* (191) expr ::= ID|INDEXED LP STAR RP filter_over */ + -1, /* (192) term ::= CTIME_KW */ + -5, /* (193) expr ::= LP nexprlist COMMA expr RP */ + -3, /* (194) expr ::= expr AND expr */ + -3, /* (195) expr ::= expr OR expr */ + -3, /* (196) expr ::= expr LT|GT|GE|LE expr */ + -3, /* (197) expr ::= expr EQ|NE expr */ + -3, /* (198) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ + -3, /* (199) expr ::= expr PLUS|MINUS expr */ + -3, /* (200) expr ::= expr STAR|SLASH|REM expr */ + -3, /* (201) expr ::= expr CONCAT expr */ + -2, /* (202) likeop ::= NOT LIKE_KW|MATCH */ + -3, /* (203) expr ::= expr likeop expr */ + -5, /* (204) expr ::= expr likeop expr ESCAPE expr */ + -2, /* (205) expr ::= expr ISNULL|NOTNULL */ + -3, /* (206) expr ::= expr NOT NULL */ + -3, /* (207) expr ::= expr IS expr */ + -4, /* (208) expr ::= expr IS NOT expr */ + -2, /* (209) expr ::= NOT expr */ + -2, /* (210) expr ::= BITNOT expr */ + -2, /* (211) expr ::= PLUS|MINUS expr */ + -3, /* (212) expr ::= expr PTR expr */ + -1, /* (213) between_op ::= BETWEEN */ + -2, /* (214) between_op ::= NOT BETWEEN */ + -5, /* (215) expr ::= expr between_op expr AND expr */ + -1, /* (216) in_op ::= IN */ + -2, /* (217) in_op ::= NOT IN */ + -5, /* (218) expr ::= expr in_op LP exprlist RP */ + -3, /* (219) expr ::= LP select RP */ + -5, /* (220) expr ::= expr in_op LP select RP */ + -5, /* (221) expr ::= expr in_op nm dbnm paren_exprlist */ + -4, /* (222) expr ::= EXISTS LP select RP */ + -5, /* (223) expr ::= CASE case_operand case_exprlist case_else END */ + -5, /* (224) case_exprlist ::= case_exprlist WHEN expr THEN expr */ + -4, /* (225) case_exprlist ::= WHEN expr THEN expr */ + -2, /* (226) case_else ::= ELSE expr */ + 0, /* (227) case_else ::= */ + -1, /* (228) case_operand ::= expr */ + 0, /* (229) case_operand ::= */ + 0, /* (230) exprlist ::= */ + -3, /* (231) nexprlist ::= nexprlist COMMA expr */ + -1, /* (232) nexprlist ::= expr */ + 0, /* (233) paren_exprlist ::= */ + -3, /* (234) paren_exprlist ::= LP exprlist RP */ + -12, /* (235) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + -1, /* (236) uniqueflag ::= UNIQUE */ + 0, /* (237) uniqueflag ::= */ + 0, /* (238) eidlist_opt ::= */ + -3, /* (239) eidlist_opt ::= LP eidlist RP */ + -5, /* (240) eidlist ::= eidlist COMMA nm collate sortorder */ + -3, /* (241) eidlist ::= nm collate sortorder */ + 0, /* (242) collate ::= */ + -2, /* (243) collate ::= COLLATE ID|STRING */ + -4, /* (244) cmd ::= DROP INDEX ifexists fullname */ + -2, /* (245) cmd ::= VACUUM vinto */ + -3, /* (246) cmd ::= VACUUM nm vinto */ + -2, /* (247) vinto ::= INTO expr */ + 0, /* (248) vinto ::= */ + -3, /* (249) cmd ::= PRAGMA nm dbnm */ + -5, /* (250) cmd ::= PRAGMA nm dbnm EQ nmnum */ + -6, /* (251) cmd ::= PRAGMA nm dbnm LP nmnum RP */ + -5, /* (252) cmd ::= PRAGMA nm dbnm EQ minus_num */ + -6, /* (253) cmd ::= PRAGMA nm dbnm LP minus_num RP */ + -2, /* (254) plus_num ::= PLUS INTEGER|FLOAT */ + -2, /* (255) minus_num ::= MINUS INTEGER|FLOAT */ + -5, /* (256) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + -11, /* (257) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + -1, /* (258) trigger_time ::= BEFORE|AFTER */ + -2, /* (259) trigger_time ::= INSTEAD OF */ + 0, /* (260) trigger_time ::= */ + -1, /* (261) trigger_event ::= DELETE|INSERT */ + -1, /* (262) trigger_event ::= UPDATE */ + -3, /* (263) trigger_event ::= UPDATE OF idlist */ + 0, /* (264) when_clause ::= */ + -2, /* (265) when_clause ::= WHEN expr */ + -3, /* (266) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + -2, /* (267) trigger_cmd_list ::= trigger_cmd SEMI */ + -3, /* (268) trnm ::= nm DOT nm */ + -3, /* (269) tridxby ::= INDEXED BY nm */ + -2, /* (270) tridxby ::= NOT INDEXED */ + -9, /* (271) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ + -8, /* (272) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + -6, /* (273) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ + -3, /* (274) trigger_cmd ::= scanpt select scanpt */ + -4, /* (275) expr ::= RAISE LP IGNORE RP */ + -6, /* (276) expr ::= RAISE LP raisetype COMMA nm RP */ + -1, /* (277) raisetype ::= ROLLBACK */ + -1, /* (278) raisetype ::= ABORT */ + -1, /* (279) raisetype ::= FAIL */ + -4, /* (280) cmd ::= DROP TRIGGER ifexists fullname */ + -6, /* (281) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + -3, /* (282) cmd ::= DETACH database_kw_opt expr */ + 0, /* (283) key_opt ::= */ + -2, /* (284) key_opt ::= KEY expr */ + -1, /* (285) cmd ::= REINDEX */ + -3, /* (286) cmd ::= REINDEX nm dbnm */ + -1, /* (287) cmd ::= ANALYZE */ + -3, /* (288) cmd ::= ANALYZE nm dbnm */ + -6, /* (289) cmd ::= ALTER TABLE fullname RENAME TO nm */ + -7, /* (290) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + -6, /* (291) cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + -1, /* (292) add_column_fullname ::= fullname */ + -8, /* (293) cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + -1, /* (294) cmd ::= create_vtab */ + -4, /* (295) cmd ::= create_vtab LP vtabarglist RP */ + -8, /* (296) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + 0, /* (297) vtabarg ::= */ + -1, /* (298) vtabargtoken ::= ANY */ + -3, /* (299) vtabargtoken ::= lp anylist RP */ + -1, /* (300) lp ::= LP */ + -2, /* (301) with ::= WITH wqlist */ + -3, /* (302) with ::= WITH RECURSIVE wqlist */ + -1, /* (303) wqas ::= AS */ + -2, /* (304) wqas ::= AS MATERIALIZED */ + -3, /* (305) wqas ::= AS NOT MATERIALIZED */ + -6, /* (306) wqitem ::= nm eidlist_opt wqas LP select RP */ + -1, /* (307) wqlist ::= wqitem */ + -3, /* (308) wqlist ::= wqlist COMMA wqitem */ + -1, /* (309) windowdefn_list ::= windowdefn */ + -3, /* (310) windowdefn_list ::= windowdefn_list COMMA windowdefn */ + -5, /* (311) windowdefn ::= nm AS LP window RP */ + -5, /* (312) window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + -6, /* (313) window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + -4, /* (314) window ::= ORDER BY sortlist frame_opt */ + -5, /* (315) window ::= nm ORDER BY sortlist frame_opt */ + -1, /* (316) window ::= frame_opt */ + -2, /* (317) window ::= nm frame_opt */ + 0, /* (318) frame_opt ::= */ + -3, /* (319) frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + -6, /* (320) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + -1, /* (321) range_or_rows ::= RANGE|ROWS|GROUPS */ + -1, /* (322) frame_bound_s ::= frame_bound */ + -2, /* (323) frame_bound_s ::= UNBOUNDED PRECEDING */ + -1, /* (324) frame_bound_e ::= frame_bound */ + -2, /* (325) frame_bound_e ::= UNBOUNDED FOLLOWING */ + -2, /* (326) frame_bound ::= expr PRECEDING|FOLLOWING */ + -2, /* (327) frame_bound ::= CURRENT ROW */ + 0, /* (328) frame_exclude_opt ::= */ + -2, /* (329) frame_exclude_opt ::= EXCLUDE frame_exclude */ + -2, /* (330) frame_exclude ::= NO OTHERS */ + -2, /* (331) frame_exclude ::= CURRENT ROW */ + -1, /* (332) frame_exclude ::= GROUP|TIES */ + -2, /* (333) window_clause ::= WINDOW windowdefn_list */ + -2, /* (334) filter_over ::= filter_clause over_clause */ + -1, /* (335) filter_over ::= over_clause */ + -1, /* (336) filter_over ::= filter_clause */ + -4, /* (337) over_clause ::= OVER LP window RP */ + -2, /* (338) over_clause ::= OVER nm */ + -5, /* (339) filter_clause ::= FILTER LP WHERE expr RP */ + -1, /* (340) input ::= cmdlist */ + -2, /* (341) cmdlist ::= cmdlist ecmd */ + -1, /* (342) cmdlist ::= ecmd */ + -1, /* (343) ecmd ::= SEMI */ + -2, /* (344) ecmd ::= cmdx SEMI */ + -3, /* (345) ecmd ::= explain cmdx SEMI */ + 0, /* (346) trans_opt ::= */ + -1, /* (347) trans_opt ::= TRANSACTION */ + -2, /* (348) trans_opt ::= TRANSACTION nm */ + -1, /* (349) savepoint_opt ::= SAVEPOINT */ + 0, /* (350) savepoint_opt ::= */ + -2, /* (351) cmd ::= create_table create_table_args */ + -1, /* (352) table_option_set ::= table_option */ + -4, /* (353) columnlist ::= columnlist COMMA columnname carglist */ + -2, /* (354) columnlist ::= columnname carglist */ + -1, /* (355) nm ::= ID|INDEXED */ + -1, /* (356) nm ::= STRING */ + -1, /* (357) nm ::= JOIN_KW */ + -1, /* (358) typetoken ::= typename */ + -1, /* (359) typename ::= ID|STRING */ + -1, /* (360) signed ::= plus_num */ + -1, /* (361) signed ::= minus_num */ + -2, /* (362) carglist ::= carglist ccons */ + 0, /* (363) carglist ::= */ + -2, /* (364) ccons ::= NULL onconf */ + -4, /* (365) ccons ::= GENERATED ALWAYS AS generated */ + -2, /* (366) ccons ::= AS generated */ + -2, /* (367) conslist_opt ::= COMMA conslist */ + -3, /* (368) conslist ::= conslist tconscomma tcons */ + -1, /* (369) conslist ::= tcons */ + 0, /* (370) tconscomma ::= */ + -1, /* (371) defer_subclause_opt ::= defer_subclause */ + -1, /* (372) resolvetype ::= raisetype */ + -1, /* (373) selectnowith ::= oneselect */ + -1, /* (374) oneselect ::= values */ + -2, /* (375) sclp ::= selcollist COMMA */ + -1, /* (376) as ::= ID|STRING */ + 0, /* (377) returning ::= */ + -1, /* (378) expr ::= term */ + -1, /* (379) likeop ::= LIKE_KW|MATCH */ + -1, /* (380) exprlist ::= nexprlist */ + -1, /* (381) nmnum ::= plus_num */ + -1, /* (382) nmnum ::= nm */ + -1, /* (383) nmnum ::= ON */ + -1, /* (384) nmnum ::= DELETE */ + -1, /* (385) nmnum ::= DEFAULT */ + -1, /* (386) plus_num ::= INTEGER|FLOAT */ + 0, /* (387) foreach_clause ::= */ + -3, /* (388) foreach_clause ::= FOR EACH ROW */ + -1, /* (389) trnm ::= nm */ + 0, /* (390) tridxby ::= */ + -1, /* (391) database_kw_opt ::= DATABASE */ + 0, /* (392) database_kw_opt ::= */ + 0, /* (393) kwcolumn_opt ::= */ + -1, /* (394) kwcolumn_opt ::= COLUMNKW */ + -1, /* (395) vtabarglist ::= vtabarg */ + -3, /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ + -2, /* (397) vtabarg ::= vtabarg vtabargtoken */ + 0, /* (398) anylist ::= */ + -4, /* (399) anylist ::= anylist LP anylist RP */ + -2, /* (400) anylist ::= anylist ANY */ + 0, /* (401) with ::= */ }; static void yy_accept(yyParser*); /* Forward Declaration */ @@ -161558,16 +164992,16 @@ static YYACTIONTYPE yy_reduce( { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy376);} +{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy394);} break; case 4: /* transtype ::= */ -{yymsp[1].minor.yy376 = TK_DEFERRED;} +{yymsp[1].minor.yy394 = TK_DEFERRED;} break; case 5: /* transtype ::= DEFERRED */ case 6: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==6); case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7); - case 318: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==318); -{yymsp[0].minor.yy376 = yymsp[0].major; /*A-overwrites-X*/} + case 321: /* range_or_rows ::= RANGE|ROWS|GROUPS */ yytestcase(yyruleno==321); +{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/} break; case 8: /* cmd ::= COMMIT|END trans_opt */ case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9); @@ -161590,7 +165024,7 @@ static YYACTIONTYPE yy_reduce( break; case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy376,0,0,yymsp[-2].minor.yy376); + sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy394,0,0,yymsp[-2].minor.yy394); } break; case 14: /* createkw ::= CREATE */ @@ -161598,95 +165032,112 @@ static YYACTIONTYPE yy_reduce( break; case 15: /* ifnotexists ::= */ case 18: /* temp ::= */ yytestcase(yyruleno==18); - case 21: /* table_options ::= */ yytestcase(yyruleno==21); - case 45: /* autoinc ::= */ yytestcase(yyruleno==45); - case 60: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==60); - case 70: /* defer_subclause_opt ::= */ yytestcase(yyruleno==70); - case 79: /* ifexists ::= */ yytestcase(yyruleno==79); - case 96: /* distinct ::= */ yytestcase(yyruleno==96); - case 239: /* collate ::= */ yytestcase(yyruleno==239); -{yymsp[1].minor.yy376 = 0;} + case 47: /* autoinc ::= */ yytestcase(yyruleno==47); + case 62: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==62); + case 72: /* defer_subclause_opt ::= */ yytestcase(yyruleno==72); + case 81: /* ifexists ::= */ yytestcase(yyruleno==81); + case 98: /* distinct ::= */ yytestcase(yyruleno==98); + case 242: /* collate ::= */ yytestcase(yyruleno==242); +{yymsp[1].minor.yy394 = 0;} break; case 16: /* ifnotexists ::= IF NOT EXISTS */ -{yymsp[-2].minor.yy376 = 1;} +{yymsp[-2].minor.yy394 = 1;} break; case 17: /* temp ::= TEMP */ -{yymsp[0].minor.yy376 = pParse->db->init.busy==0;} +{yymsp[0].minor.yy394 = pParse->db->init.busy==0;} break; - case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ + case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_option_set */ { - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy376,0); + sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy285,0); } break; case 20: /* create_table_args ::= AS select */ { - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy81); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy81); + sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy47); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); } break; - case 22: /* table_options ::= WITHOUT nm */ + case 21: /* table_option_set ::= */ +{yymsp[1].minor.yy285 = 0;} + break; + case 22: /* table_option_set ::= table_option_set COMMA table_option */ +{yylhsminor.yy285 = yymsp[-2].minor.yy285|yymsp[0].minor.yy285;} + yymsp[-2].minor.yy285 = yylhsminor.yy285; + break; + case 23: /* table_option ::= WITHOUT nm */ { if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ - yymsp[-1].minor.yy376 = TF_WithoutRowid | TF_NoVisibleRowid; + yymsp[-1].minor.yy285 = TF_WithoutRowid | TF_NoVisibleRowid; + }else{ + yymsp[-1].minor.yy285 = 0; + sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); + } +} + break; + case 24: /* table_option ::= nm */ +{ + if( yymsp[0].minor.yy0.n==6 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"strict",6)==0 ){ + yylhsminor.yy285 = TF_Strict; }else{ - yymsp[-1].minor.yy376 = 0; + yylhsminor.yy285 = 0; sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); } } + yymsp[0].minor.yy285 = yylhsminor.yy285; break; - case 23: /* columnname ::= nm typetoken */ -{sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} + case 25: /* columnname ::= nm typetoken */ +{sqlite3AddColumn(pParse,yymsp[-1].minor.yy0,yymsp[0].minor.yy0);} break; - case 24: /* typetoken ::= */ - case 63: /* conslist_opt ::= */ yytestcase(yyruleno==63); - case 102: /* as ::= */ yytestcase(yyruleno==102); + case 26: /* typetoken ::= */ + case 65: /* conslist_opt ::= */ yytestcase(yyruleno==65); + case 104: /* as ::= */ yytestcase(yyruleno==104); {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;} break; - case 25: /* typetoken ::= typename LP signed RP */ + case 27: /* typetoken ::= typename LP signed RP */ { yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z); } break; - case 26: /* typetoken ::= typename LP signed COMMA signed RP */ + case 28: /* typetoken ::= typename LP signed COMMA signed RP */ { yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z); } break; - case 27: /* typename ::= typename ID|STRING */ + case 29: /* typename ::= typename ID|STRING */ {yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);} break; - case 28: /* scanpt ::= */ + case 30: /* scanpt ::= */ { assert( yyLookahead!=YYNOCODE ); - yymsp[1].minor.yy504 = yyLookaheadToken.z; + yymsp[1].minor.yy522 = yyLookaheadToken.z; } break; - case 29: /* scantok ::= */ + case 31: /* scantok ::= */ { assert( yyLookahead!=YYNOCODE ); yymsp[1].minor.yy0 = yyLookaheadToken; } break; - case 30: /* ccons ::= CONSTRAINT nm */ - case 65: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==65); + case 32: /* ccons ::= CONSTRAINT nm */ + case 67: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==67); {pParse->constraintName = yymsp[0].minor.yy0;} break; - case 31: /* ccons ::= DEFAULT scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy404,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} + case 33: /* ccons ::= DEFAULT scantok term */ +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-1].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; - case 32: /* ccons ::= DEFAULT LP expr RP */ -{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy404,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} + case 34: /* ccons ::= DEFAULT LP expr RP */ +{sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z+1,yymsp[0].minor.yy0.z);} break; - case 33: /* ccons ::= DEFAULT PLUS scantok term */ -{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy404,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} + case 35: /* ccons ::= DEFAULT PLUS scantok term */ +{sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy528,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]);} break; - case 34: /* ccons ::= DEFAULT MINUS scantok term */ + case 36: /* ccons ::= DEFAULT MINUS scantok term */ { - Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy404, 0); + Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy528, 0); sqlite3AddDefaultValue(pParse,p,yymsp[-2].minor.yy0.z,&yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]); } break; - case 35: /* ccons ::= DEFAULT scantok ID|INDEXED */ + case 37: /* ccons ::= DEFAULT scantok ID|INDEXED */ { Expr *p = tokenExpr(pParse, TK_STRING, yymsp[0].minor.yy0); if( p ){ @@ -161696,162 +165147,162 @@ static YYACTIONTYPE yy_reduce( sqlite3AddDefaultValue(pParse,p,yymsp[0].minor.yy0.z,yymsp[0].minor.yy0.z+yymsp[0].minor.yy0.n); } break; - case 36: /* ccons ::= NOT NULL onconf */ -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy376);} + case 38: /* ccons ::= NOT NULL onconf */ +{sqlite3AddNotNull(pParse, yymsp[0].minor.yy394);} break; - case 37: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy376,yymsp[0].minor.yy376,yymsp[-2].minor.yy376);} + case 39: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ +{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy394,yymsp[0].minor.yy394,yymsp[-2].minor.yy394);} break; - case 38: /* ccons ::= UNIQUE onconf */ -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy376,0,0,0,0, + case 40: /* ccons ::= UNIQUE onconf */ +{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy394,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; - case 39: /* ccons ::= CHECK LP expr RP */ -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy404,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} + case 41: /* ccons ::= CHECK LP expr RP */ +{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy528,yymsp[-2].minor.yy0.z,yymsp[0].minor.yy0.z);} break; - case 40: /* ccons ::= REFERENCES nm eidlist_opt refargs */ -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy70,yymsp[0].minor.yy376);} + case 42: /* ccons ::= REFERENCES nm eidlist_opt refargs */ +{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy322,yymsp[0].minor.yy394);} break; - case 41: /* ccons ::= defer_subclause */ -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy376);} + case 43: /* ccons ::= defer_subclause */ +{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy394);} break; - case 42: /* ccons ::= COLLATE ID|STRING */ + case 44: /* ccons ::= COLLATE ID|STRING */ {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; - case 43: /* generated ::= LP expr RP */ -{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy404,0);} + case 45: /* generated ::= LP expr RP */ +{sqlite3AddGenerated(pParse,yymsp[-1].minor.yy528,0);} break; - case 44: /* generated ::= LP expr RP ID */ -{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy404,&yymsp[0].minor.yy0);} + case 46: /* generated ::= LP expr RP ID */ +{sqlite3AddGenerated(pParse,yymsp[-2].minor.yy528,&yymsp[0].minor.yy0);} break; - case 46: /* autoinc ::= AUTOINCR */ -{yymsp[0].minor.yy376 = 1;} + case 48: /* autoinc ::= AUTOINCR */ +{yymsp[0].minor.yy394 = 1;} break; - case 47: /* refargs ::= */ -{ yymsp[1].minor.yy376 = OE_None*0x0101; /* EV: R-19803-45884 */} + case 49: /* refargs ::= */ +{ yymsp[1].minor.yy394 = OE_None*0x0101; /* EV: R-19803-45884 */} break; - case 48: /* refargs ::= refargs refarg */ -{ yymsp[-1].minor.yy376 = (yymsp[-1].minor.yy376 & ~yymsp[0].minor.yy139.mask) | yymsp[0].minor.yy139.value; } + case 50: /* refargs ::= refargs refarg */ +{ yymsp[-1].minor.yy394 = (yymsp[-1].minor.yy394 & ~yymsp[0].minor.yy231.mask) | yymsp[0].minor.yy231.value; } break; - case 49: /* refarg ::= MATCH nm */ -{ yymsp[-1].minor.yy139.value = 0; yymsp[-1].minor.yy139.mask = 0x000000; } + case 51: /* refarg ::= MATCH nm */ +{ yymsp[-1].minor.yy231.value = 0; yymsp[-1].minor.yy231.mask = 0x000000; } break; - case 50: /* refarg ::= ON INSERT refact */ -{ yymsp[-2].minor.yy139.value = 0; yymsp[-2].minor.yy139.mask = 0x000000; } + case 52: /* refarg ::= ON INSERT refact */ +{ yymsp[-2].minor.yy231.value = 0; yymsp[-2].minor.yy231.mask = 0x000000; } break; - case 51: /* refarg ::= ON DELETE refact */ -{ yymsp[-2].minor.yy139.value = yymsp[0].minor.yy376; yymsp[-2].minor.yy139.mask = 0x0000ff; } + case 53: /* refarg ::= ON DELETE refact */ +{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394; yymsp[-2].minor.yy231.mask = 0x0000ff; } break; - case 52: /* refarg ::= ON UPDATE refact */ -{ yymsp[-2].minor.yy139.value = yymsp[0].minor.yy376<<8; yymsp[-2].minor.yy139.mask = 0x00ff00; } + case 54: /* refarg ::= ON UPDATE refact */ +{ yymsp[-2].minor.yy231.value = yymsp[0].minor.yy394<<8; yymsp[-2].minor.yy231.mask = 0x00ff00; } break; - case 53: /* refact ::= SET NULL */ -{ yymsp[-1].minor.yy376 = OE_SetNull; /* EV: R-33326-45252 */} + case 55: /* refact ::= SET NULL */ +{ yymsp[-1].minor.yy394 = OE_SetNull; /* EV: R-33326-45252 */} break; - case 54: /* refact ::= SET DEFAULT */ -{ yymsp[-1].minor.yy376 = OE_SetDflt; /* EV: R-33326-45252 */} + case 56: /* refact ::= SET DEFAULT */ +{ yymsp[-1].minor.yy394 = OE_SetDflt; /* EV: R-33326-45252 */} break; - case 55: /* refact ::= CASCADE */ -{ yymsp[0].minor.yy376 = OE_Cascade; /* EV: R-33326-45252 */} + case 57: /* refact ::= CASCADE */ +{ yymsp[0].minor.yy394 = OE_Cascade; /* EV: R-33326-45252 */} break; - case 56: /* refact ::= RESTRICT */ -{ yymsp[0].minor.yy376 = OE_Restrict; /* EV: R-33326-45252 */} + case 58: /* refact ::= RESTRICT */ +{ yymsp[0].minor.yy394 = OE_Restrict; /* EV: R-33326-45252 */} break; - case 57: /* refact ::= NO ACTION */ -{ yymsp[-1].minor.yy376 = OE_None; /* EV: R-33326-45252 */} + case 59: /* refact ::= NO ACTION */ +{ yymsp[-1].minor.yy394 = OE_None; /* EV: R-33326-45252 */} break; - case 58: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ -{yymsp[-2].minor.yy376 = 0;} + case 60: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ +{yymsp[-2].minor.yy394 = 0;} break; - case 59: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ - case 74: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==74); - case 169: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==169); -{yymsp[-1].minor.yy376 = yymsp[0].minor.yy376;} + case 61: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ + case 76: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==76); + case 171: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==171); +{yymsp[-1].minor.yy394 = yymsp[0].minor.yy394;} break; - case 61: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ - case 78: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==78); - case 211: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==211); - case 214: /* in_op ::= NOT IN */ yytestcase(yyruleno==214); - case 240: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==240); -{yymsp[-1].minor.yy376 = 1;} + case 63: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ + case 80: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==80); + case 214: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==214); + case 217: /* in_op ::= NOT IN */ yytestcase(yyruleno==217); + case 243: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==243); +{yymsp[-1].minor.yy394 = 1;} break; - case 62: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ -{yymsp[-1].minor.yy376 = 0;} + case 64: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ +{yymsp[-1].minor.yy394 = 0;} break; - case 64: /* tconscomma ::= COMMA */ + case 66: /* tconscomma ::= COMMA */ {pParse->constraintName.n = 0;} break; - case 66: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy70,yymsp[0].minor.yy376,yymsp[-2].minor.yy376,0);} + case 68: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */ +{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy322,yymsp[0].minor.yy394,yymsp[-2].minor.yy394,0);} break; - case 67: /* tcons ::= UNIQUE LP sortlist RP onconf */ -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy70,yymsp[0].minor.yy376,0,0,0,0, + case 69: /* tcons ::= UNIQUE LP sortlist RP onconf */ +{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy322,yymsp[0].minor.yy394,0,0,0,0, SQLITE_IDXTYPE_UNIQUE);} break; - case 68: /* tcons ::= CHECK LP expr RP onconf */ -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy404,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} + case 70: /* tcons ::= CHECK LP expr RP onconf */ +{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy528,yymsp[-3].minor.yy0.z,yymsp[-1].minor.yy0.z);} break; - case 69: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ + case 71: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */ { - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy70, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy70, yymsp[-1].minor.yy376); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy376); + sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy322, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[-1].minor.yy394); + sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy394); } break; - case 71: /* onconf ::= */ - case 73: /* orconf ::= */ yytestcase(yyruleno==73); -{yymsp[1].minor.yy376 = OE_Default;} + case 73: /* onconf ::= */ + case 75: /* orconf ::= */ yytestcase(yyruleno==75); +{yymsp[1].minor.yy394 = OE_Default;} break; - case 72: /* onconf ::= ON CONFLICT resolvetype */ -{yymsp[-2].minor.yy376 = yymsp[0].minor.yy376;} + case 74: /* onconf ::= ON CONFLICT resolvetype */ +{yymsp[-2].minor.yy394 = yymsp[0].minor.yy394;} break; - case 75: /* resolvetype ::= IGNORE */ -{yymsp[0].minor.yy376 = OE_Ignore;} + case 77: /* resolvetype ::= IGNORE */ +{yymsp[0].minor.yy394 = OE_Ignore;} break; - case 76: /* resolvetype ::= REPLACE */ - case 170: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==170); -{yymsp[0].minor.yy376 = OE_Replace;} + case 78: /* resolvetype ::= REPLACE */ + case 172: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==172); +{yymsp[0].minor.yy394 = OE_Replace;} break; - case 77: /* cmd ::= DROP TABLE ifexists fullname */ + case 79: /* cmd ::= DROP TABLE ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy153, 0, yymsp[-1].minor.yy376); + sqlite3DropTable(pParse, yymsp[0].minor.yy131, 0, yymsp[-1].minor.yy394); } break; - case 80: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ + case 82: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */ { - sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy70, yymsp[0].minor.yy81, yymsp[-7].minor.yy376, yymsp[-5].minor.yy376); + sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy322, yymsp[0].minor.yy47, yymsp[-7].minor.yy394, yymsp[-5].minor.yy394); } break; - case 81: /* cmd ::= DROP VIEW ifexists fullname */ + case 83: /* cmd ::= DROP VIEW ifexists fullname */ { - sqlite3DropTable(pParse, yymsp[0].minor.yy153, 1, yymsp[-1].minor.yy376); + sqlite3DropTable(pParse, yymsp[0].minor.yy131, 1, yymsp[-1].minor.yy394); } break; - case 82: /* cmd ::= select */ + case 84: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0, 0}; - sqlite3Select(pParse, yymsp[0].minor.yy81, &dest); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy81); + sqlite3Select(pParse, yymsp[0].minor.yy47, &dest); + sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy47); } break; - case 83: /* select ::= WITH wqlist selectnowith */ -{yymsp[-2].minor.yy81 = attachWithToSelect(pParse,yymsp[0].minor.yy81,yymsp[-1].minor.yy103);} + case 85: /* select ::= WITH wqlist selectnowith */ +{yymsp[-2].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} break; - case 84: /* select ::= WITH RECURSIVE wqlist selectnowith */ -{yymsp[-3].minor.yy81 = attachWithToSelect(pParse,yymsp[0].minor.yy81,yymsp[-1].minor.yy103);} + case 86: /* select ::= WITH RECURSIVE wqlist selectnowith */ +{yymsp[-3].minor.yy47 = attachWithToSelect(pParse,yymsp[0].minor.yy47,yymsp[-1].minor.yy521);} break; - case 85: /* select ::= selectnowith */ + case 87: /* select ::= selectnowith */ { - Select *p = yymsp[0].minor.yy81; + Select *p = yymsp[0].minor.yy47; if( p ){ parserDoubleLinkSelect(pParse, p); } - yymsp[0].minor.yy81 = p; /*A-overwrites-X*/ + yymsp[0].minor.yy47 = p; /*A-overwrites-X*/ } break; - case 86: /* selectnowith ::= selectnowith multiselect_op oneselect */ + case 88: /* selectnowith ::= selectnowith multiselect_op oneselect */ { - Select *pRhs = yymsp[0].minor.yy81; - Select *pLhs = yymsp[-2].minor.yy81; + Select *pRhs = yymsp[0].minor.yy47; + Select *pLhs = yymsp[-2].minor.yy47; if( pRhs && pRhs->pPrior ){ SrcList *pFrom; Token x; @@ -161861,140 +165312,140 @@ static YYACTIONTYPE yy_reduce( pRhs = sqlite3SelectNew(pParse,0,pFrom,0,0,0,0,0,0); } if( pRhs ){ - pRhs->op = (u8)yymsp[-1].minor.yy376; + pRhs->op = (u8)yymsp[-1].minor.yy394; pRhs->pPrior = pLhs; if( ALWAYS(pLhs) ) pLhs->selFlags &= ~SF_MultiValue; pRhs->selFlags &= ~SF_MultiValue; - if( yymsp[-1].minor.yy376!=TK_ALL ) pParse->hasCompound = 1; + if( yymsp[-1].minor.yy394!=TK_ALL ) pParse->hasCompound = 1; }else{ sqlite3SelectDelete(pParse->db, pLhs); } - yymsp[-2].minor.yy81 = pRhs; + yymsp[-2].minor.yy47 = pRhs; } break; - case 87: /* multiselect_op ::= UNION */ - case 89: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==89); -{yymsp[0].minor.yy376 = yymsp[0].major; /*A-overwrites-OP*/} + case 89: /* multiselect_op ::= UNION */ + case 91: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==91); +{yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-OP*/} break; - case 88: /* multiselect_op ::= UNION ALL */ -{yymsp[-1].minor.yy376 = TK_ALL;} + case 90: /* multiselect_op ::= UNION ALL */ +{yymsp[-1].minor.yy394 = TK_ALL;} break; - case 90: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ + case 92: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { - yymsp[-8].minor.yy81 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy70,yymsp[-5].minor.yy153,yymsp[-4].minor.yy404,yymsp[-3].minor.yy70,yymsp[-2].minor.yy404,yymsp[-1].minor.yy70,yymsp[-7].minor.yy376,yymsp[0].minor.yy404); + yymsp[-8].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy322,yymsp[-5].minor.yy131,yymsp[-4].minor.yy528,yymsp[-3].minor.yy322,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[-7].minor.yy394,yymsp[0].minor.yy528); } break; - case 91: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ + case 93: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ { - yymsp[-9].minor.yy81 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy70,yymsp[-6].minor.yy153,yymsp[-5].minor.yy404,yymsp[-4].minor.yy70,yymsp[-3].minor.yy404,yymsp[-1].minor.yy70,yymsp[-8].minor.yy376,yymsp[0].minor.yy404); - if( yymsp[-9].minor.yy81 ){ - yymsp[-9].minor.yy81->pWinDefn = yymsp[-2].minor.yy49; + yymsp[-9].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy322,yymsp[-6].minor.yy131,yymsp[-5].minor.yy528,yymsp[-4].minor.yy322,yymsp[-3].minor.yy528,yymsp[-1].minor.yy322,yymsp[-8].minor.yy394,yymsp[0].minor.yy528); + if( yymsp[-9].minor.yy47 ){ + yymsp[-9].minor.yy47->pWinDefn = yymsp[-2].minor.yy41; }else{ - sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy49); + sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy41); } } break; - case 92: /* values ::= VALUES LP nexprlist RP */ + case 94: /* values ::= VALUES LP nexprlist RP */ { - yymsp[-3].minor.yy81 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy70,0,0,0,0,0,SF_Values,0); + yymsp[-3].minor.yy47 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values,0); } break; - case 93: /* values ::= values COMMA LP nexprlist RP */ + case 95: /* values ::= values COMMA LP nexprlist RP */ { - Select *pRight, *pLeft = yymsp[-4].minor.yy81; - pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy70,0,0,0,0,0,SF_Values|SF_MultiValue,0); + Select *pRight, *pLeft = yymsp[-4].minor.yy47; + pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy322,0,0,0,0,0,SF_Values|SF_MultiValue,0); if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; if( pRight ){ pRight->op = TK_ALL; pRight->pPrior = pLeft; - yymsp[-4].minor.yy81 = pRight; + yymsp[-4].minor.yy47 = pRight; }else{ - yymsp[-4].minor.yy81 = pLeft; + yymsp[-4].minor.yy47 = pLeft; } } break; - case 94: /* distinct ::= DISTINCT */ -{yymsp[0].minor.yy376 = SF_Distinct;} + case 96: /* distinct ::= DISTINCT */ +{yymsp[0].minor.yy394 = SF_Distinct;} break; - case 95: /* distinct ::= ALL */ -{yymsp[0].minor.yy376 = SF_All;} + case 97: /* distinct ::= ALL */ +{yymsp[0].minor.yy394 = SF_All;} break; - case 97: /* sclp ::= */ - case 130: /* orderby_opt ::= */ yytestcase(yyruleno==130); - case 140: /* groupby_opt ::= */ yytestcase(yyruleno==140); - case 227: /* exprlist ::= */ yytestcase(yyruleno==227); - case 230: /* paren_exprlist ::= */ yytestcase(yyruleno==230); - case 235: /* eidlist_opt ::= */ yytestcase(yyruleno==235); -{yymsp[1].minor.yy70 = 0;} + case 99: /* sclp ::= */ + case 132: /* orderby_opt ::= */ yytestcase(yyruleno==132); + case 142: /* groupby_opt ::= */ yytestcase(yyruleno==142); + case 230: /* exprlist ::= */ yytestcase(yyruleno==230); + case 233: /* paren_exprlist ::= */ yytestcase(yyruleno==233); + case 238: /* eidlist_opt ::= */ yytestcase(yyruleno==238); +{yymsp[1].minor.yy322 = 0;} break; - case 98: /* selcollist ::= sclp scanpt expr scanpt as */ + case 100: /* selcollist ::= sclp scanpt expr scanpt as */ { - yymsp[-4].minor.yy70 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy70, yymsp[-2].minor.yy404); - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy70, &yymsp[0].minor.yy0, 1); - sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy70,yymsp[-3].minor.yy504,yymsp[-1].minor.yy504); + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); + if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[0].minor.yy0, 1); + sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy322,yymsp[-3].minor.yy522,yymsp[-1].minor.yy522); } break; - case 99: /* selcollist ::= sclp scanpt STAR */ + case 101: /* selcollist ::= sclp scanpt STAR */ { Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); - yymsp[-2].minor.yy70 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy70, p); + yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy322, p); } break; - case 100: /* selcollist ::= sclp scanpt nm DOT STAR */ + case 102: /* selcollist ::= sclp scanpt nm DOT STAR */ { Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); - Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); + Expr *pLeft = tokenExpr(pParse, TK_ID, yymsp[-2].minor.yy0); Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); - yymsp[-4].minor.yy70 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy70, pDot); + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, pDot); } break; - case 101: /* as ::= AS nm */ - case 112: /* dbnm ::= DOT nm */ yytestcase(yyruleno==112); - case 251: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==251); - case 252: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==252); + case 103: /* as ::= AS nm */ + case 114: /* dbnm ::= DOT nm */ yytestcase(yyruleno==114); + case 254: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==254); + case 255: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==255); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; - case 103: /* from ::= */ - case 106: /* stl_prefix ::= */ yytestcase(yyruleno==106); -{yymsp[1].minor.yy153 = 0;} + case 105: /* from ::= */ + case 108: /* stl_prefix ::= */ yytestcase(yyruleno==108); +{yymsp[1].minor.yy131 = 0;} break; - case 104: /* from ::= FROM seltablist */ + case 106: /* from ::= FROM seltablist */ { - yymsp[-1].minor.yy153 = yymsp[0].minor.yy153; - sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy153); + yymsp[-1].minor.yy131 = yymsp[0].minor.yy131; + sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy131); } break; - case 105: /* stl_prefix ::= seltablist joinop */ + case 107: /* stl_prefix ::= seltablist joinop */ { - if( ALWAYS(yymsp[-1].minor.yy153 && yymsp[-1].minor.yy153->nSrc>0) ) yymsp[-1].minor.yy153->a[yymsp[-1].minor.yy153->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy376; + if( ALWAYS(yymsp[-1].minor.yy131 && yymsp[-1].minor.yy131->nSrc>0) ) yymsp[-1].minor.yy131->a[yymsp[-1].minor.yy131->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy394; } break; - case 107: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ + case 109: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { - yymsp[-6].minor.yy153 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy153,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy404,yymsp[0].minor.yy436); - sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy153, &yymsp[-2].minor.yy0); + yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); + sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy131, &yymsp[-2].minor.yy0); } break; - case 108: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ + case 110: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { - yymsp[-8].minor.yy153 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy153,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy404,yymsp[0].minor.yy436); - sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy153, yymsp[-4].minor.yy70); + yymsp[-8].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy131,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); + sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy131, yymsp[-4].minor.yy322); } break; - case 109: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ + case 111: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { - yymsp[-6].minor.yy153 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy153,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy81,yymsp[-1].minor.yy404,yymsp[0].minor.yy436); + yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy47,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); } break; - case 110: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ + case 112: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { - if( yymsp[-6].minor.yy153==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy404==0 && yymsp[0].minor.yy436==0 ){ - yymsp[-6].minor.yy153 = yymsp[-4].minor.yy153; - }else if( yymsp[-4].minor.yy153->nSrc==1 ){ - yymsp[-6].minor.yy153 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy153,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy404,yymsp[0].minor.yy436); - if( yymsp[-6].minor.yy153 ){ - SrcItem *pNew = &yymsp[-6].minor.yy153->a[yymsp[-6].minor.yy153->nSrc-1]; - SrcItem *pOld = yymsp[-4].minor.yy153->a; + if( yymsp[-6].minor.yy131==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy528==0 && yymsp[0].minor.yy254==0 ){ + yymsp[-6].minor.yy131 = yymsp[-4].minor.yy131; + }else if( yymsp[-4].minor.yy131->nSrc==1 ){ + yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); + if( yymsp[-6].minor.yy131 ){ + SrcItem *pNew = &yymsp[-6].minor.yy131->a[yymsp[-6].minor.yy131->nSrc-1]; + SrcItem *pOld = yymsp[-4].minor.yy131->a; pNew->zName = pOld->zName; pNew->zDatabase = pOld->zDatabase; pNew->pSelect = pOld->pSelect; @@ -162007,281 +165458,277 @@ static YYACTIONTYPE yy_reduce( pOld->zName = pOld->zDatabase = 0; pOld->pSelect = 0; } - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy153); + sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy131); }else{ Select *pSubquery; - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy153); - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy153,0,0,0,0,SF_NestedFrom,0); - yymsp[-6].minor.yy153 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy153,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy404,yymsp[0].minor.yy436); + sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy131); + pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy131,0,0,0,0,SF_NestedFrom,0); + yymsp[-6].minor.yy131 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy131,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy528,yymsp[0].minor.yy254); } } break; - case 111: /* dbnm ::= */ - case 125: /* indexed_opt ::= */ yytestcase(yyruleno==125); + case 113: /* dbnm ::= */ + case 127: /* indexed_opt ::= */ yytestcase(yyruleno==127); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; - case 113: /* fullname ::= nm */ + case 115: /* fullname ::= nm */ { - yylhsminor.yy153 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); - if( IN_RENAME_OBJECT && yylhsminor.yy153 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy153->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); + if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); } - yymsp[0].minor.yy153 = yylhsminor.yy153; + yymsp[0].minor.yy131 = yylhsminor.yy131; break; - case 114: /* fullname ::= nm DOT nm */ + case 116: /* fullname ::= nm DOT nm */ { - yylhsminor.yy153 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); - if( IN_RENAME_OBJECT && yylhsminor.yy153 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy153->a[0].zName, &yymsp[0].minor.yy0); + yylhsminor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); + if( IN_RENAME_OBJECT && yylhsminor.yy131 ) sqlite3RenameTokenMap(pParse, yylhsminor.yy131->a[0].zName, &yymsp[0].minor.yy0); } - yymsp[-2].minor.yy153 = yylhsminor.yy153; + yymsp[-2].minor.yy131 = yylhsminor.yy131; break; - case 115: /* xfullname ::= nm */ -{yymsp[0].minor.yy153 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} + case 117: /* xfullname ::= nm */ +{yymsp[0].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} break; - case 116: /* xfullname ::= nm DOT nm */ -{yymsp[-2].minor.yy153 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 118: /* xfullname ::= nm DOT nm */ +{yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 117: /* xfullname ::= nm DOT nm AS nm */ + case 119: /* xfullname ::= nm DOT nm AS nm */ { - yymsp[-4].minor.yy153 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ - if( yymsp[-4].minor.yy153 ) yymsp[-4].minor.yy153->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-4].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ + if( yymsp[-4].minor.yy131 ) yymsp[-4].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; - case 118: /* xfullname ::= nm AS nm */ + case 120: /* xfullname ::= nm AS nm */ { - yymsp[-2].minor.yy153 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ - if( yymsp[-2].minor.yy153 ) yymsp[-2].minor.yy153->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); + yymsp[-2].minor.yy131 = sqlite3SrcListAppend(pParse,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ + if( yymsp[-2].minor.yy131 ) yymsp[-2].minor.yy131->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; - case 119: /* joinop ::= COMMA|JOIN */ -{ yymsp[0].minor.yy376 = JT_INNER; } + case 121: /* joinop ::= COMMA|JOIN */ +{ yymsp[0].minor.yy394 = JT_INNER; } break; - case 120: /* joinop ::= JOIN_KW JOIN */ -{yymsp[-1].minor.yy376 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} + case 122: /* joinop ::= JOIN_KW JOIN */ +{yymsp[-1].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; - case 121: /* joinop ::= JOIN_KW nm JOIN */ -{yymsp[-2].minor.yy376 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} + case 123: /* joinop ::= JOIN_KW nm JOIN */ +{yymsp[-2].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; - case 122: /* joinop ::= JOIN_KW nm nm JOIN */ -{yymsp[-3].minor.yy376 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} + case 124: /* joinop ::= JOIN_KW nm nm JOIN */ +{yymsp[-3].minor.yy394 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; - case 123: /* on_opt ::= ON expr */ - case 143: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==143); - case 150: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==150); - case 152: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==152); - case 223: /* case_else ::= ELSE expr */ yytestcase(yyruleno==223); - case 244: /* vinto ::= INTO expr */ yytestcase(yyruleno==244); -{yymsp[-1].minor.yy404 = yymsp[0].minor.yy404;} + case 125: /* on_opt ::= ON expr */ + case 145: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==145); + case 152: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==152); + case 154: /* where_opt_ret ::= WHERE expr */ yytestcase(yyruleno==154); + case 226: /* case_else ::= ELSE expr */ yytestcase(yyruleno==226); + case 247: /* vinto ::= INTO expr */ yytestcase(yyruleno==247); +{yymsp[-1].minor.yy528 = yymsp[0].minor.yy528;} break; - case 124: /* on_opt ::= */ - case 142: /* having_opt ::= */ yytestcase(yyruleno==142); - case 144: /* limit_opt ::= */ yytestcase(yyruleno==144); - case 149: /* where_opt ::= */ yytestcase(yyruleno==149); - case 151: /* where_opt_ret ::= */ yytestcase(yyruleno==151); - case 224: /* case_else ::= */ yytestcase(yyruleno==224); - case 226: /* case_operand ::= */ yytestcase(yyruleno==226); - case 245: /* vinto ::= */ yytestcase(yyruleno==245); -{yymsp[1].minor.yy404 = 0;} + case 126: /* on_opt ::= */ + case 144: /* having_opt ::= */ yytestcase(yyruleno==144); + case 146: /* limit_opt ::= */ yytestcase(yyruleno==146); + case 151: /* where_opt ::= */ yytestcase(yyruleno==151); + case 153: /* where_opt_ret ::= */ yytestcase(yyruleno==153); + case 227: /* case_else ::= */ yytestcase(yyruleno==227); + case 229: /* case_operand ::= */ yytestcase(yyruleno==229); + case 248: /* vinto ::= */ yytestcase(yyruleno==248); +{yymsp[1].minor.yy528 = 0;} break; - case 126: /* indexed_opt ::= INDEXED BY nm */ + case 128: /* indexed_opt ::= INDEXED BY nm */ {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} break; - case 127: /* indexed_opt ::= NOT INDEXED */ + case 129: /* indexed_opt ::= NOT INDEXED */ {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} break; - case 128: /* using_opt ::= USING LP idlist RP */ -{yymsp[-3].minor.yy436 = yymsp[-1].minor.yy436;} + case 130: /* using_opt ::= USING LP idlist RP */ +{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;} break; - case 129: /* using_opt ::= */ - case 171: /* idlist_opt ::= */ yytestcase(yyruleno==171); -{yymsp[1].minor.yy436 = 0;} + case 131: /* using_opt ::= */ + case 173: /* idlist_opt ::= */ yytestcase(yyruleno==173); +{yymsp[1].minor.yy254 = 0;} break; - case 131: /* orderby_opt ::= ORDER BY sortlist */ - case 141: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==141); -{yymsp[-2].minor.yy70 = yymsp[0].minor.yy70;} + case 133: /* orderby_opt ::= ORDER BY sortlist */ + case 143: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==143); +{yymsp[-2].minor.yy322 = yymsp[0].minor.yy322;} break; - case 132: /* sortlist ::= sortlist COMMA expr sortorder nulls */ + case 134: /* sortlist ::= sortlist COMMA expr sortorder nulls */ { - yymsp[-4].minor.yy70 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy70,yymsp[-2].minor.yy404); - sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy70,yymsp[-1].minor.yy376,yymsp[0].minor.yy376); + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528); + sqlite3ExprListSetSortOrder(yymsp[-4].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); } break; - case 133: /* sortlist ::= expr sortorder nulls */ + case 135: /* sortlist ::= expr sortorder nulls */ { - yymsp[-2].minor.yy70 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy404); /*A-overwrites-Y*/ - sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy70,yymsp[-1].minor.yy376,yymsp[0].minor.yy376); + yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[-2].minor.yy528); /*A-overwrites-Y*/ + sqlite3ExprListSetSortOrder(yymsp[-2].minor.yy322,yymsp[-1].minor.yy394,yymsp[0].minor.yy394); } break; - case 134: /* sortorder ::= ASC */ -{yymsp[0].minor.yy376 = SQLITE_SO_ASC;} + case 136: /* sortorder ::= ASC */ +{yymsp[0].minor.yy394 = SQLITE_SO_ASC;} break; - case 135: /* sortorder ::= DESC */ -{yymsp[0].minor.yy376 = SQLITE_SO_DESC;} + case 137: /* sortorder ::= DESC */ +{yymsp[0].minor.yy394 = SQLITE_SO_DESC;} break; - case 136: /* sortorder ::= */ - case 139: /* nulls ::= */ yytestcase(yyruleno==139); -{yymsp[1].minor.yy376 = SQLITE_SO_UNDEFINED;} + case 138: /* sortorder ::= */ + case 141: /* nulls ::= */ yytestcase(yyruleno==141); +{yymsp[1].minor.yy394 = SQLITE_SO_UNDEFINED;} break; - case 137: /* nulls ::= NULLS FIRST */ -{yymsp[-1].minor.yy376 = SQLITE_SO_ASC;} + case 139: /* nulls ::= NULLS FIRST */ +{yymsp[-1].minor.yy394 = SQLITE_SO_ASC;} break; - case 138: /* nulls ::= NULLS LAST */ -{yymsp[-1].minor.yy376 = SQLITE_SO_DESC;} + case 140: /* nulls ::= NULLS LAST */ +{yymsp[-1].minor.yy394 = SQLITE_SO_DESC;} break; - case 145: /* limit_opt ::= LIMIT expr */ -{yymsp[-1].minor.yy404 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy404,0);} + case 147: /* limit_opt ::= LIMIT expr */ +{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,0);} break; - case 146: /* limit_opt ::= LIMIT expr OFFSET expr */ -{yymsp[-3].minor.yy404 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy404,yymsp[0].minor.yy404);} + case 148: /* limit_opt ::= LIMIT expr OFFSET expr */ +{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} break; - case 147: /* limit_opt ::= LIMIT expr COMMA expr */ -{yymsp[-3].minor.yy404 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy404,yymsp[-2].minor.yy404);} + case 149: /* limit_opt ::= LIMIT expr COMMA expr */ +{yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy528,yymsp[-2].minor.yy528);} break; - case 148: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */ + case 150: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt_ret orderby_opt limit_opt */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy153, &yymsp[-3].minor.yy0); + sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy131, &yymsp[-3].minor.yy0); #ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT - if( yymsp[-1].minor.yy70 || yymsp[0].minor.yy404 ){ - updateDeleteLimitError(pParse,yymsp[-1].minor.yy70,yymsp[0].minor.yy404); - yymsp[-1].minor.yy70 = 0; - yymsp[0].minor.yy404 = 0; + if( yymsp[-1].minor.yy322 || yymsp[0].minor.yy528 ){ + updateDeleteLimitError(pParse,yymsp[-1].minor.yy322,yymsp[0].minor.yy528); + yymsp[-1].minor.yy322 = 0; + yymsp[0].minor.yy528 = 0; } #endif - sqlite3DeleteFrom(pParse,yymsp[-4].minor.yy153,yymsp[-2].minor.yy404,yymsp[-1].minor.yy70,yymsp[0].minor.yy404); + sqlite3DeleteFrom(pParse,yymsp[-4].minor.yy131,yymsp[-2].minor.yy528,yymsp[-1].minor.yy322,yymsp[0].minor.yy528); } break; - case 153: /* where_opt_ret ::= RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy70); yymsp[-1].minor.yy404 = 0;} + case 155: /* where_opt_ret ::= RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-1].minor.yy528 = 0;} break; - case 154: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy70); yymsp[-3].minor.yy404 = yymsp[-2].minor.yy404;} + case 156: /* where_opt_ret ::= WHERE expr RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy322); yymsp[-3].minor.yy528 = yymsp[-2].minor.yy528;} break; - case 155: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */ + case 157: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist from where_opt_ret orderby_opt limit_opt */ { - sqlite3SrcListIndexedBy(pParse, yymsp[-7].minor.yy153, &yymsp[-6].minor.yy0); - yymsp[-7].minor.yy153 = sqlite3SrcListAppendList(pParse, yymsp[-7].minor.yy153, yymsp[-3].minor.yy153); - sqlite3ExprListCheckLength(pParse,yymsp[-4].minor.yy70,"set list"); + sqlite3SrcListIndexedBy(pParse, yymsp[-7].minor.yy131, &yymsp[-6].minor.yy0); + yymsp[-7].minor.yy131 = sqlite3SrcListAppendList(pParse, yymsp[-7].minor.yy131, yymsp[-3].minor.yy131); + sqlite3ExprListCheckLength(pParse,yymsp[-4].minor.yy322,"set list"); #ifndef SQLITE_ENABLE_UPDATE_DELETE_LIMIT - if( yymsp[-1].minor.yy70 || yymsp[0].minor.yy404 ){ - updateDeleteLimitError(pParse,yymsp[-1].minor.yy70,yymsp[0].minor.yy404); - yymsp[-1].minor.yy70 = 0; - yymsp[0].minor.yy404 = 0; + if( yymsp[-1].minor.yy322 || yymsp[0].minor.yy528 ){ + updateDeleteLimitError(pParse,yymsp[-1].minor.yy322,yymsp[0].minor.yy528); + yymsp[-1].minor.yy322 = 0; + yymsp[0].minor.yy528 = 0; } #endif - sqlite3Update(pParse,yymsp[-7].minor.yy153,yymsp[-4].minor.yy70,yymsp[-2].minor.yy404,yymsp[-8].minor.yy376,yymsp[-1].minor.yy70,yymsp[0].minor.yy404,0); + sqlite3Update(pParse,yymsp[-7].minor.yy131,yymsp[-4].minor.yy322,yymsp[-2].minor.yy528,yymsp[-8].minor.yy394,yymsp[-1].minor.yy322,yymsp[0].minor.yy528,0); } break; - case 156: /* setlist ::= setlist COMMA nm EQ expr */ + case 158: /* setlist ::= setlist COMMA nm EQ expr */ { - yymsp[-4].minor.yy70 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy70, yymsp[0].minor.yy404); - sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy70, &yymsp[-2].minor.yy0, 1); + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy322, yymsp[0].minor.yy528); + sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, 1); } break; - case 157: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ + case 159: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ { - yymsp[-6].minor.yy70 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy70, yymsp[-3].minor.yy436, yymsp[0].minor.yy404); + yymsp[-6].minor.yy322 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy322, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); } break; - case 158: /* setlist ::= nm EQ expr */ + case 160: /* setlist ::= nm EQ expr */ { - yylhsminor.yy70 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy404); - sqlite3ExprListSetName(pParse, yylhsminor.yy70, &yymsp[-2].minor.yy0, 1); + yylhsminor.yy322 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy528); + sqlite3ExprListSetName(pParse, yylhsminor.yy322, &yymsp[-2].minor.yy0, 1); } - yymsp[-2].minor.yy70 = yylhsminor.yy70; + yymsp[-2].minor.yy322 = yylhsminor.yy322; break; - case 159: /* setlist ::= LP idlist RP EQ expr */ + case 161: /* setlist ::= LP idlist RP EQ expr */ { - yymsp[-4].minor.yy70 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy436, yymsp[0].minor.yy404); + yymsp[-4].minor.yy322 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy528); } break; - case 160: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ + case 162: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { - sqlite3Insert(pParse, yymsp[-3].minor.yy153, yymsp[-1].minor.yy81, yymsp[-2].minor.yy436, yymsp[-5].minor.yy376, yymsp[0].minor.yy190); + sqlite3Insert(pParse, yymsp[-3].minor.yy131, yymsp[-1].minor.yy47, yymsp[-2].minor.yy254, yymsp[-5].minor.yy394, yymsp[0].minor.yy444); } break; - case 161: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ + case 163: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES returning */ { - sqlite3Insert(pParse, yymsp[-4].minor.yy153, 0, yymsp[-3].minor.yy436, yymsp[-6].minor.yy376, 0); + sqlite3Insert(pParse, yymsp[-4].minor.yy131, 0, yymsp[-3].minor.yy254, yymsp[-6].minor.yy394, 0); } break; - case 162: /* upsert ::= */ -{ yymsp[1].minor.yy190 = 0; } + case 164: /* upsert ::= */ +{ yymsp[1].minor.yy444 = 0; } break; - case 163: /* upsert ::= RETURNING selcollist */ -{ yymsp[-1].minor.yy190 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy70); } + case 165: /* upsert ::= RETURNING selcollist */ +{ yymsp[-1].minor.yy444 = 0; sqlite3AddReturning(pParse,yymsp[0].minor.yy322); } break; - case 164: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ -{ yymsp[-11].minor.yy190 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy70,yymsp[-6].minor.yy404,yymsp[-2].minor.yy70,yymsp[-1].minor.yy404,yymsp[0].minor.yy190);} + case 166: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt upsert */ +{ yymsp[-11].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-8].minor.yy322,yymsp[-6].minor.yy528,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,yymsp[0].minor.yy444);} break; - case 165: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ -{ yymsp[-8].minor.yy190 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy70,yymsp[-3].minor.yy404,0,0,yymsp[0].minor.yy190); } + case 167: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING upsert */ +{ yymsp[-8].minor.yy444 = sqlite3UpsertNew(pParse->db,yymsp[-5].minor.yy322,yymsp[-3].minor.yy528,0,0,yymsp[0].minor.yy444); } break; - case 166: /* upsert ::= ON CONFLICT DO NOTHING returning */ -{ yymsp[-4].minor.yy190 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } + case 168: /* upsert ::= ON CONFLICT DO NOTHING returning */ +{ yymsp[-4].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,0,0,0); } break; - case 167: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ -{ yymsp[-7].minor.yy190 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy70,yymsp[-1].minor.yy404,0);} + case 169: /* upsert ::= ON CONFLICT DO UPDATE SET setlist where_opt returning */ +{ yymsp[-7].minor.yy444 = sqlite3UpsertNew(pParse->db,0,0,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528,0);} break; - case 168: /* returning ::= RETURNING selcollist */ -{sqlite3AddReturning(pParse,yymsp[0].minor.yy70);} + case 170: /* returning ::= RETURNING selcollist */ +{sqlite3AddReturning(pParse,yymsp[0].minor.yy322);} break; - case 172: /* idlist_opt ::= LP idlist RP */ -{yymsp[-2].minor.yy436 = yymsp[-1].minor.yy436;} + case 174: /* idlist_opt ::= LP idlist RP */ +{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} break; - case 173: /* idlist ::= idlist COMMA nm */ -{yymsp[-2].minor.yy436 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy436,&yymsp[0].minor.yy0);} + case 175: /* idlist ::= idlist COMMA nm */ +{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} break; - case 174: /* idlist ::= nm */ -{yymsp[0].minor.yy436 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} + case 176: /* idlist ::= nm */ +{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; - case 175: /* expr ::= LP expr RP */ -{yymsp[-2].minor.yy404 = yymsp[-1].minor.yy404;} + case 177: /* expr ::= LP expr RP */ +{yymsp[-2].minor.yy528 = yymsp[-1].minor.yy528;} break; - case 176: /* expr ::= ID|INDEXED */ - case 177: /* expr ::= JOIN_KW */ yytestcase(yyruleno==177); -{yymsp[0].minor.yy404=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 178: /* expr ::= ID|INDEXED */ + case 179: /* expr ::= JOIN_KW */ yytestcase(yyruleno==179); +{yymsp[0].minor.yy528=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 178: /* expr ::= nm DOT nm */ + case 180: /* expr ::= nm DOT nm */ { - Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); - Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); - if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[0].minor.yy0); - sqlite3RenameTokenMap(pParse, (void*)temp1, &yymsp[-2].minor.yy0); - } - yylhsminor.yy404 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); + Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); + Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); + yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); } - yymsp[-2].minor.yy404 = yylhsminor.yy404; + yymsp[-2].minor.yy528 = yylhsminor.yy528; break; - case 179: /* expr ::= nm DOT nm DOT nm */ + case 181: /* expr ::= nm DOT nm DOT nm */ { - Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); - Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); - Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); + Expr *temp1 = tokenExpr(pParse,TK_ID,yymsp[-4].minor.yy0); + Expr *temp2 = tokenExpr(pParse,TK_ID,yymsp[-2].minor.yy0); + Expr *temp3 = tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); if( IN_RENAME_OBJECT ){ - sqlite3RenameTokenMap(pParse, (void*)temp3, &yymsp[0].minor.yy0); - sqlite3RenameTokenMap(pParse, (void*)temp2, &yymsp[-2].minor.yy0); + sqlite3RenameTokenRemap(pParse, 0, temp1); } - yylhsminor.yy404 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); + yylhsminor.yy528 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); } - yymsp[-4].minor.yy404 = yylhsminor.yy404; + yymsp[-4].minor.yy528 = yylhsminor.yy528; break; - case 180: /* term ::= NULL|FLOAT|BLOB */ - case 181: /* term ::= STRING */ yytestcase(yyruleno==181); -{yymsp[0].minor.yy404=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} + case 182: /* term ::= NULL|FLOAT|BLOB */ + case 183: /* term ::= STRING */ yytestcase(yyruleno==183); +{yymsp[0].minor.yy528=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; - case 182: /* term ::= INTEGER */ + case 184: /* term ::= INTEGER */ { - yylhsminor.yy404 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); + yylhsminor.yy528 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); + if( yylhsminor.yy528 ) yylhsminor.yy528->w.iOfst = (int)(yymsp[0].minor.yy0.z - pParse->zTail); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + yymsp[0].minor.yy528 = yylhsminor.yy528; break; - case 183: /* expr ::= VARIABLE */ + case 185: /* expr ::= VARIABLE */ { if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ u32 n = yymsp[0].minor.yy0.n; - yymsp[0].minor.yy404 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); - sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy404, n); + yymsp[0].minor.yy528 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); + sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy528, n); }else{ /* When doing a nested parse, one can include terms in an expression ** that look like this: #1 #2 ... These terms refer to registers @@ -162290,159 +165737,167 @@ static YYACTIONTYPE yy_reduce( assert( t.n>=2 ); if( pParse->nested==0 ){ sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &t); - yymsp[0].minor.yy404 = 0; + yymsp[0].minor.yy528 = 0; }else{ - yymsp[0].minor.yy404 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); - if( yymsp[0].minor.yy404 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy404->iTable); + yymsp[0].minor.yy528 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); + if( yymsp[0].minor.yy528 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy528->iTable); } } } break; - case 184: /* expr ::= expr COLLATE ID|STRING */ + case 186: /* expr ::= expr COLLATE ID|STRING */ { - yymsp[-2].minor.yy404 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy404, &yymsp[0].minor.yy0, 1); + yymsp[-2].minor.yy528 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy528, &yymsp[0].minor.yy0, 1); } break; - case 185: /* expr ::= CAST LP expr AS typetoken RP */ + case 187: /* expr ::= CAST LP expr AS typetoken RP */ { - yymsp[-5].minor.yy404 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); - sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy404, yymsp[-3].minor.yy404, 0); + yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); + sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy528, yymsp[-3].minor.yy528, 0); } break; - case 186: /* expr ::= ID|INDEXED LP distinct exprlist RP */ + case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP */ { - yylhsminor.yy404 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy70, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy376); + yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy394); } - yymsp[-4].minor.yy404 = yylhsminor.yy404; + yymsp[-4].minor.yy528 = yylhsminor.yy528; break; - case 187: /* expr ::= ID|INDEXED LP STAR RP */ + case 189: /* expr ::= ID|INDEXED LP STAR RP */ { - yylhsminor.yy404 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); + yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); } - yymsp[-3].minor.yy404 = yylhsminor.yy404; + yymsp[-3].minor.yy528 = yylhsminor.yy528; break; - case 188: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ + case 190: /* expr ::= ID|INDEXED LP distinct exprlist RP filter_over */ { - yylhsminor.yy404 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy70, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy376); - sqlite3WindowAttach(pParse, yylhsminor.yy404, yymsp[0].minor.yy49); + yylhsminor.yy528 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy322, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy394); + sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); } - yymsp[-5].minor.yy404 = yylhsminor.yy404; + yymsp[-5].minor.yy528 = yylhsminor.yy528; break; - case 189: /* expr ::= ID|INDEXED LP STAR RP filter_over */ + case 191: /* expr ::= ID|INDEXED LP STAR RP filter_over */ { - yylhsminor.yy404 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); - sqlite3WindowAttach(pParse, yylhsminor.yy404, yymsp[0].minor.yy49); + yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); + sqlite3WindowAttach(pParse, yylhsminor.yy528, yymsp[0].minor.yy41); } - yymsp[-4].minor.yy404 = yylhsminor.yy404; + yymsp[-4].minor.yy528 = yylhsminor.yy528; break; - case 190: /* term ::= CTIME_KW */ + case 192: /* term ::= CTIME_KW */ { - yylhsminor.yy404 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); + yylhsminor.yy528 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); } - yymsp[0].minor.yy404 = yylhsminor.yy404; + yymsp[0].minor.yy528 = yylhsminor.yy528; break; - case 191: /* expr ::= LP nexprlist COMMA expr RP */ + case 193: /* expr ::= LP nexprlist COMMA expr RP */ { - ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy70, yymsp[-1].minor.yy404); - yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); - if( yymsp[-4].minor.yy404 ){ - yymsp[-4].minor.yy404->x.pList = pList; + ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528); + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); + if( yymsp[-4].minor.yy528 ){ + yymsp[-4].minor.yy528->x.pList = pList; if( ALWAYS(pList->nExpr) ){ - yymsp[-4].minor.yy404->flags |= pList->a[0].pExpr->flags & EP_Propagate; + yymsp[-4].minor.yy528->flags |= pList->a[0].pExpr->flags & EP_Propagate; } }else{ sqlite3ExprListDelete(pParse->db, pList); } } break; - case 192: /* expr ::= expr AND expr */ -{yymsp[-2].minor.yy404=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy404,yymsp[0].minor.yy404);} + case 194: /* expr ::= expr AND expr */ +{yymsp[-2].minor.yy528=sqlite3ExprAnd(pParse,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} break; - case 193: /* expr ::= expr OR expr */ - case 194: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==194); - case 195: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==195); - case 196: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==196); - case 197: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==197); - case 198: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==198); - case 199: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==199); -{yymsp[-2].minor.yy404=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy404,yymsp[0].minor.yy404);} + case 195: /* expr ::= expr OR expr */ + case 196: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==196); + case 197: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==197); + case 198: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==198); + case 199: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==199); + case 200: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==200); + case 201: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==201); +{yymsp[-2].minor.yy528=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy528,yymsp[0].minor.yy528);} break; - case 200: /* likeop ::= NOT LIKE_KW|MATCH */ + case 202: /* likeop ::= NOT LIKE_KW|MATCH */ {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} break; - case 201: /* expr ::= expr likeop expr */ + case 203: /* expr ::= expr likeop expr */ { ExprList *pList; int bNot = yymsp[-1].minor.yy0.n & 0x80000000; yymsp[-1].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy404); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy404); - yymsp[-2].minor.yy404 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); - if( bNot ) yymsp[-2].minor.yy404 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy404, 0); - if( yymsp[-2].minor.yy404 ) yymsp[-2].minor.yy404->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy528); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy528); + yymsp[-2].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); + if( bNot ) yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy528, 0); + if( yymsp[-2].minor.yy528 ) yymsp[-2].minor.yy528->flags |= EP_InfixFunc; } break; - case 202: /* expr ::= expr likeop expr ESCAPE expr */ + case 204: /* expr ::= expr likeop expr ESCAPE expr */ { ExprList *pList; int bNot = yymsp[-3].minor.yy0.n & 0x80000000; yymsp[-3].minor.yy0.n &= 0x7fffffff; - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy404); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy404); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy404); - yymsp[-4].minor.yy404 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); - if( bNot ) yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy404, 0); - if( yymsp[-4].minor.yy404 ) yymsp[-4].minor.yy404->flags |= EP_InfixFunc; + pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy528); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); + yymsp[-4].minor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); + if( bNot ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); + if( yymsp[-4].minor.yy528 ) yymsp[-4].minor.yy528->flags |= EP_InfixFunc; } break; - case 203: /* expr ::= expr ISNULL|NOTNULL */ -{yymsp[-1].minor.yy404 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy404,0);} + case 205: /* expr ::= expr ISNULL|NOTNULL */ +{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy528,0);} break; - case 204: /* expr ::= expr NOT NULL */ -{yymsp[-2].minor.yy404 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy404,0);} + case 206: /* expr ::= expr NOT NULL */ +{yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy528,0);} break; - case 205: /* expr ::= expr IS expr */ + case 207: /* expr ::= expr IS expr */ { - yymsp[-2].minor.yy404 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy404,yymsp[0].minor.yy404); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy404, yymsp[-2].minor.yy404, TK_ISNULL); + yymsp[-2].minor.yy528 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy528,yymsp[0].minor.yy528); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-2].minor.yy528, TK_ISNULL); } break; - case 206: /* expr ::= expr IS NOT expr */ + case 208: /* expr ::= expr IS NOT expr */ { - yymsp[-3].minor.yy404 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy404,yymsp[0].minor.yy404); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy404, yymsp[-3].minor.yy404, TK_NOTNULL); + yymsp[-3].minor.yy528 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy528,yymsp[0].minor.yy528); + binaryToUnaryIfNull(pParse, yymsp[0].minor.yy528, yymsp[-3].minor.yy528, TK_NOTNULL); } break; - case 207: /* expr ::= NOT expr */ - case 208: /* expr ::= BITNOT expr */ yytestcase(yyruleno==208); -{yymsp[-1].minor.yy404 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy404, 0);/*A-overwrites-B*/} + case 209: /* expr ::= NOT expr */ + case 210: /* expr ::= BITNOT expr */ yytestcase(yyruleno==210); +{yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy528, 0);/*A-overwrites-B*/} break; - case 209: /* expr ::= PLUS|MINUS expr */ + case 211: /* expr ::= PLUS|MINUS expr */ { - yymsp[-1].minor.yy404 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy404, 0); + yymsp[-1].minor.yy528 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy528, 0); /*A-overwrites-B*/ } break; - case 210: /* between_op ::= BETWEEN */ - case 213: /* in_op ::= IN */ yytestcase(yyruleno==213); -{yymsp[0].minor.yy376 = 0;} + case 212: /* expr ::= expr PTR expr */ +{ + ExprList *pList = sqlite3ExprListAppend(pParse, 0, yymsp[-2].minor.yy528); + pList = sqlite3ExprListAppend(pParse, pList, yymsp[0].minor.yy528); + yylhsminor.yy528 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); +} + yymsp[-2].minor.yy528 = yylhsminor.yy528; + break; + case 213: /* between_op ::= BETWEEN */ + case 216: /* in_op ::= IN */ yytestcase(yyruleno==216); +{yymsp[0].minor.yy394 = 0;} break; - case 212: /* expr ::= expr between_op expr AND expr */ + case 215: /* expr ::= expr between_op expr AND expr */ { - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy404); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy404); - yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy404, 0); - if( yymsp[-4].minor.yy404 ){ - yymsp[-4].minor.yy404->x.pList = pList; + ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); + pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy528); + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy528, 0); + if( yymsp[-4].minor.yy528 ){ + yymsp[-4].minor.yy528->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } - if( yymsp[-3].minor.yy376 ) yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy404, 0); + if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); } break; - case 215: /* expr ::= expr in_op LP exprlist RP */ + case 218: /* expr ::= expr in_op LP exprlist RP */ { - if( yymsp[-1].minor.yy70==0 ){ + if( yymsp[-1].minor.yy322==0 ){ /* Expressions of the form ** ** expr1 IN () @@ -162451,197 +165906,205 @@ static YYACTIONTYPE yy_reduce( ** simplify to constants 0 (false) and 1 (true), respectively, ** regardless of the value of expr1. */ - sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy404); - yymsp[-4].minor.yy404 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy376 ? "1" : "0"); - }else if( yymsp[-1].minor.yy70->nExpr==1 && sqlite3ExprIsConstant(yymsp[-1].minor.yy70->a[0].pExpr) ){ - Expr *pRHS = yymsp[-1].minor.yy70->a[0].pExpr; - yymsp[-1].minor.yy70->a[0].pExpr = 0; - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy70); - pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0); - yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy404, pRHS); - if( yymsp[-3].minor.yy376 ) yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy404, 0); - }else{ - yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy404, 0); - if( yymsp[-4].minor.yy404 ){ - yymsp[-4].minor.yy404->x.pList = yymsp[-1].minor.yy70; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy404); + sqlite3ExprUnmapAndDelete(pParse, yymsp[-4].minor.yy528); + yymsp[-4].minor.yy528 = sqlite3Expr(pParse->db, TK_INTEGER, yymsp[-3].minor.yy394 ? "1" : "0"); + }else{ + Expr *pRHS = yymsp[-1].minor.yy322->a[0].pExpr; + if( yymsp[-1].minor.yy322->nExpr==1 && sqlite3ExprIsConstant(pRHS) && yymsp[-4].minor.yy528->op!=TK_VECTOR ){ + yymsp[-1].minor.yy322->a[0].pExpr = 0; + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); + pRHS = sqlite3PExpr(pParse, TK_UPLUS, pRHS, 0); + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_EQ, yymsp[-4].minor.yy528, pRHS); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy70); + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); + if( yymsp[-4].minor.yy528==0 ){ + sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy322); + }else if( yymsp[-4].minor.yy528->pLeft->op==TK_VECTOR ){ + int nExpr = yymsp[-4].minor.yy528->pLeft->x.pList->nExpr; + Select *pSelectRHS = sqlite3ExprListToValues(pParse, nExpr, yymsp[-1].minor.yy322); + if( pSelectRHS ){ + parserDoubleLinkSelect(pParse, pSelectRHS); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelectRHS); + } + }else{ + yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy322; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); + } } - if( yymsp[-3].minor.yy376 ) yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy404, 0); + if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); } } break; - case 216: /* expr ::= LP select RP */ + case 219: /* expr ::= LP select RP */ { - yymsp[-2].minor.yy404 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); - sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy404, yymsp[-1].minor.yy81); + yymsp[-2].minor.yy528 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); + sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy528, yymsp[-1].minor.yy47); } break; - case 217: /* expr ::= expr in_op LP select RP */ + case 220: /* expr ::= expr in_op LP select RP */ { - yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy404, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy404, yymsp[-1].minor.yy81); - if( yymsp[-3].minor.yy376 ) yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy404, 0); + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, yymsp[-1].minor.yy47); + if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); } break; - case 218: /* expr ::= expr in_op nm dbnm paren_exprlist */ + case 221: /* expr ::= expr in_op nm dbnm paren_exprlist */ { SrcList *pSrc = sqlite3SrcListAppend(pParse, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); - if( yymsp[0].minor.yy70 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy70); - yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy404, 0); - sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy404, pSelect); - if( yymsp[-3].minor.yy376 ) yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy404, 0); + if( yymsp[0].minor.yy322 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy322); + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy528, 0); + sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy528, pSelect); + if( yymsp[-3].minor.yy394 ) yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy528, 0); } break; - case 219: /* expr ::= EXISTS LP select RP */ + case 222: /* expr ::= EXISTS LP select RP */ { Expr *p; - p = yymsp[-3].minor.yy404 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); - sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy81); + p = yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); + sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy47); } break; - case 220: /* expr ::= CASE case_operand case_exprlist case_else END */ + case 223: /* expr ::= CASE case_operand case_exprlist case_else END */ { - yymsp[-4].minor.yy404 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy404, 0); - if( yymsp[-4].minor.yy404 ){ - yymsp[-4].minor.yy404->x.pList = yymsp[-1].minor.yy404 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy70,yymsp[-1].minor.yy404) : yymsp[-2].minor.yy70; - sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy404); + yymsp[-4].minor.yy528 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy528, 0); + if( yymsp[-4].minor.yy528 ){ + yymsp[-4].minor.yy528->x.pList = yymsp[-1].minor.yy528 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[-1].minor.yy528) : yymsp[-2].minor.yy322; + sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy528); }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy70); - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy404); + sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy322); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); } } break; - case 221: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ + case 224: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { - yymsp[-4].minor.yy70 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy70, yymsp[-2].minor.yy404); - yymsp[-4].minor.yy70 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy70, yymsp[0].minor.yy404); + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[-2].minor.yy528); + yymsp[-4].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy322, yymsp[0].minor.yy528); } break; - case 222: /* case_exprlist ::= WHEN expr THEN expr */ + case 225: /* case_exprlist ::= WHEN expr THEN expr */ { - yymsp[-3].minor.yy70 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy404); - yymsp[-3].minor.yy70 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy70, yymsp[0].minor.yy404); + yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy528); + yymsp[-3].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy322, yymsp[0].minor.yy528); } break; - case 225: /* case_operand ::= expr */ -{yymsp[0].minor.yy404 = yymsp[0].minor.yy404; /*A-overwrites-X*/} + case 228: /* case_operand ::= expr */ +{yymsp[0].minor.yy528 = yymsp[0].minor.yy528; /*A-overwrites-X*/} break; - case 228: /* nexprlist ::= nexprlist COMMA expr */ -{yymsp[-2].minor.yy70 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy70,yymsp[0].minor.yy404);} + case 231: /* nexprlist ::= nexprlist COMMA expr */ +{yymsp[-2].minor.yy322 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy322,yymsp[0].minor.yy528);} break; - case 229: /* nexprlist ::= expr */ -{yymsp[0].minor.yy70 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy404); /*A-overwrites-Y*/} + case 232: /* nexprlist ::= expr */ +{yymsp[0].minor.yy322 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy528); /*A-overwrites-Y*/} break; - case 231: /* paren_exprlist ::= LP exprlist RP */ - case 236: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==236); -{yymsp[-2].minor.yy70 = yymsp[-1].minor.yy70;} + case 234: /* paren_exprlist ::= LP exprlist RP */ + case 239: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==239); +{yymsp[-2].minor.yy322 = yymsp[-1].minor.yy322;} break; - case 232: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ + case 235: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, - sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy70, yymsp[-10].minor.yy376, - &yymsp[-11].minor.yy0, yymsp[0].minor.yy404, SQLITE_SO_ASC, yymsp[-8].minor.yy376, SQLITE_IDXTYPE_APPDEF); + sqlite3SrcListAppend(pParse,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy322, yymsp[-10].minor.yy394, + &yymsp[-11].minor.yy0, yymsp[0].minor.yy528, SQLITE_SO_ASC, yymsp[-8].minor.yy394, SQLITE_IDXTYPE_APPDEF); if( IN_RENAME_OBJECT && pParse->pNewIndex ){ sqlite3RenameTokenMap(pParse, pParse->pNewIndex->zName, &yymsp[-4].minor.yy0); } } break; - case 233: /* uniqueflag ::= UNIQUE */ - case 275: /* raisetype ::= ABORT */ yytestcase(yyruleno==275); -{yymsp[0].minor.yy376 = OE_Abort;} + case 236: /* uniqueflag ::= UNIQUE */ + case 278: /* raisetype ::= ABORT */ yytestcase(yyruleno==278); +{yymsp[0].minor.yy394 = OE_Abort;} break; - case 234: /* uniqueflag ::= */ -{yymsp[1].minor.yy376 = OE_None;} + case 237: /* uniqueflag ::= */ +{yymsp[1].minor.yy394 = OE_None;} break; - case 237: /* eidlist ::= eidlist COMMA nm collate sortorder */ + case 240: /* eidlist ::= eidlist COMMA nm collate sortorder */ { - yymsp[-4].minor.yy70 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy70, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy376, yymsp[0].minor.yy376); + yymsp[-4].minor.yy322 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy322, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); } break; - case 238: /* eidlist ::= nm collate sortorder */ + case 241: /* eidlist ::= nm collate sortorder */ { - yymsp[-2].minor.yy70 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy376, yymsp[0].minor.yy376); /*A-overwrites-Y*/ + yymsp[-2].minor.yy322 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy394, yymsp[0].minor.yy394); /*A-overwrites-Y*/ } break; - case 241: /* cmd ::= DROP INDEX ifexists fullname */ -{sqlite3DropIndex(pParse, yymsp[0].minor.yy153, yymsp[-1].minor.yy376);} + case 244: /* cmd ::= DROP INDEX ifexists fullname */ +{sqlite3DropIndex(pParse, yymsp[0].minor.yy131, yymsp[-1].minor.yy394);} break; - case 242: /* cmd ::= VACUUM vinto */ -{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy404);} + case 245: /* cmd ::= VACUUM vinto */ +{sqlite3Vacuum(pParse,0,yymsp[0].minor.yy528);} break; - case 243: /* cmd ::= VACUUM nm vinto */ -{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy404);} + case 246: /* cmd ::= VACUUM nm vinto */ +{sqlite3Vacuum(pParse,&yymsp[-1].minor.yy0,yymsp[0].minor.yy528);} break; - case 246: /* cmd ::= PRAGMA nm dbnm */ + case 249: /* cmd ::= PRAGMA nm dbnm */ {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; - case 247: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ + case 250: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; - case 248: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ + case 251: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; - case 249: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ + case 252: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; - case 250: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ + case 253: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} break; - case 253: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ + case 256: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { Token all; all.z = yymsp[-3].minor.yy0.z; all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy157, &all); + sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy33, &all); } break; - case 254: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ + case 257: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy376, yymsp[-4].minor.yy262.a, yymsp[-4].minor.yy262.b, yymsp[-2].minor.yy153, yymsp[0].minor.yy404, yymsp[-10].minor.yy376, yymsp[-8].minor.yy376); + sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy394, yymsp[-4].minor.yy180.a, yymsp[-4].minor.yy180.b, yymsp[-2].minor.yy131, yymsp[0].minor.yy528, yymsp[-10].minor.yy394, yymsp[-8].minor.yy394); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; - case 255: /* trigger_time ::= BEFORE|AFTER */ -{ yymsp[0].minor.yy376 = yymsp[0].major; /*A-overwrites-X*/ } + case 258: /* trigger_time ::= BEFORE|AFTER */ +{ yymsp[0].minor.yy394 = yymsp[0].major; /*A-overwrites-X*/ } break; - case 256: /* trigger_time ::= INSTEAD OF */ -{ yymsp[-1].minor.yy376 = TK_INSTEAD;} + case 259: /* trigger_time ::= INSTEAD OF */ +{ yymsp[-1].minor.yy394 = TK_INSTEAD;} break; - case 257: /* trigger_time ::= */ -{ yymsp[1].minor.yy376 = TK_BEFORE; } + case 260: /* trigger_time ::= */ +{ yymsp[1].minor.yy394 = TK_BEFORE; } break; - case 258: /* trigger_event ::= DELETE|INSERT */ - case 259: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==259); -{yymsp[0].minor.yy262.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy262.b = 0;} + case 261: /* trigger_event ::= DELETE|INSERT */ + case 262: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==262); +{yymsp[0].minor.yy180.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy180.b = 0;} break; - case 260: /* trigger_event ::= UPDATE OF idlist */ -{yymsp[-2].minor.yy262.a = TK_UPDATE; yymsp[-2].minor.yy262.b = yymsp[0].minor.yy436;} + case 263: /* trigger_event ::= UPDATE OF idlist */ +{yymsp[-2].minor.yy180.a = TK_UPDATE; yymsp[-2].minor.yy180.b = yymsp[0].minor.yy254;} break; - case 261: /* when_clause ::= */ - case 280: /* key_opt ::= */ yytestcase(yyruleno==280); -{ yymsp[1].minor.yy404 = 0; } + case 264: /* when_clause ::= */ + case 283: /* key_opt ::= */ yytestcase(yyruleno==283); +{ yymsp[1].minor.yy528 = 0; } break; - case 262: /* when_clause ::= WHEN expr */ - case 281: /* key_opt ::= KEY expr */ yytestcase(yyruleno==281); -{ yymsp[-1].minor.yy404 = yymsp[0].minor.yy404; } + case 265: /* when_clause ::= WHEN expr */ + case 284: /* key_opt ::= KEY expr */ yytestcase(yyruleno==284); +{ yymsp[-1].minor.yy528 = yymsp[0].minor.yy528; } break; - case 263: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ + case 266: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { - assert( yymsp[-2].minor.yy157!=0 ); - yymsp[-2].minor.yy157->pLast->pNext = yymsp[-1].minor.yy157; - yymsp[-2].minor.yy157->pLast = yymsp[-1].minor.yy157; + assert( yymsp[-2].minor.yy33!=0 ); + yymsp[-2].minor.yy33->pLast->pNext = yymsp[-1].minor.yy33; + yymsp[-2].minor.yy33->pLast = yymsp[-1].minor.yy33; } break; - case 264: /* trigger_cmd_list ::= trigger_cmd SEMI */ + case 267: /* trigger_cmd_list ::= trigger_cmd SEMI */ { - assert( yymsp[-1].minor.yy157!=0 ); - yymsp[-1].minor.yy157->pLast = yymsp[-1].minor.yy157; + assert( yymsp[-1].minor.yy33!=0 ); + yymsp[-1].minor.yy33->pLast = yymsp[-1].minor.yy33; } break; - case 265: /* trnm ::= nm DOT nm */ + case 268: /* trnm ::= nm DOT nm */ { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; sqlite3ErrorMsg(pParse, @@ -162649,368 +166112,369 @@ static YYACTIONTYPE yy_reduce( "statements within triggers"); } break; - case 266: /* tridxby ::= INDEXED BY nm */ + case 269: /* tridxby ::= INDEXED BY nm */ { sqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 267: /* tridxby ::= NOT INDEXED */ + case 270: /* tridxby ::= NOT INDEXED */ { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; - case 268: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ -{yylhsminor.yy157 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy153, yymsp[-3].minor.yy70, yymsp[-1].minor.yy404, yymsp[-7].minor.yy376, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy504);} - yymsp[-8].minor.yy157 = yylhsminor.yy157; + case 271: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist from where_opt scanpt */ +{yylhsminor.yy33 = sqlite3TriggerUpdateStep(pParse, &yymsp[-6].minor.yy0, yymsp[-2].minor.yy131, yymsp[-3].minor.yy322, yymsp[-1].minor.yy528, yymsp[-7].minor.yy394, yymsp[-8].minor.yy0.z, yymsp[0].minor.yy522);} + yymsp[-8].minor.yy33 = yylhsminor.yy33; break; - case 269: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ + case 272: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { - yylhsminor.yy157 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy436,yymsp[-2].minor.yy81,yymsp[-6].minor.yy376,yymsp[-1].minor.yy190,yymsp[-7].minor.yy504,yymsp[0].minor.yy504);/*yylhsminor.yy157-overwrites-yymsp[-6].minor.yy376*/ + yylhsminor.yy33 = sqlite3TriggerInsertStep(pParse,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy254,yymsp[-2].minor.yy47,yymsp[-6].minor.yy394,yymsp[-1].minor.yy444,yymsp[-7].minor.yy522,yymsp[0].minor.yy522);/*yylhsminor.yy33-overwrites-yymsp[-6].minor.yy394*/ } - yymsp[-7].minor.yy157 = yylhsminor.yy157; + yymsp[-7].minor.yy33 = yylhsminor.yy33; break; - case 270: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ -{yylhsminor.yy157 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy404, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy504);} - yymsp[-5].minor.yy157 = yylhsminor.yy157; + case 273: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ +{yylhsminor.yy33 = sqlite3TriggerDeleteStep(pParse, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy528, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy522);} + yymsp[-5].minor.yy33 = yylhsminor.yy33; break; - case 271: /* trigger_cmd ::= scanpt select scanpt */ -{yylhsminor.yy157 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy81, yymsp[-2].minor.yy504, yymsp[0].minor.yy504); /*yylhsminor.yy157-overwrites-yymsp[-1].minor.yy81*/} - yymsp[-2].minor.yy157 = yylhsminor.yy157; + case 274: /* trigger_cmd ::= scanpt select scanpt */ +{yylhsminor.yy33 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy47, yymsp[-2].minor.yy522, yymsp[0].minor.yy522); /*yylhsminor.yy33-overwrites-yymsp[-1].minor.yy47*/} + yymsp[-2].minor.yy33 = yylhsminor.yy33; break; - case 272: /* expr ::= RAISE LP IGNORE RP */ + case 275: /* expr ::= RAISE LP IGNORE RP */ { - yymsp[-3].minor.yy404 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); - if( yymsp[-3].minor.yy404 ){ - yymsp[-3].minor.yy404->affExpr = OE_Ignore; + yymsp[-3].minor.yy528 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); + if( yymsp[-3].minor.yy528 ){ + yymsp[-3].minor.yy528->affExpr = OE_Ignore; } } break; - case 273: /* expr ::= RAISE LP raisetype COMMA nm RP */ + case 276: /* expr ::= RAISE LP raisetype COMMA nm RP */ { - yymsp[-5].minor.yy404 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); - if( yymsp[-5].minor.yy404 ) { - yymsp[-5].minor.yy404->affExpr = (char)yymsp[-3].minor.yy376; + yymsp[-5].minor.yy528 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); + if( yymsp[-5].minor.yy528 ) { + yymsp[-5].minor.yy528->affExpr = (char)yymsp[-3].minor.yy394; } } break; - case 274: /* raisetype ::= ROLLBACK */ -{yymsp[0].minor.yy376 = OE_Rollback;} + case 277: /* raisetype ::= ROLLBACK */ +{yymsp[0].minor.yy394 = OE_Rollback;} break; - case 276: /* raisetype ::= FAIL */ -{yymsp[0].minor.yy376 = OE_Fail;} + case 279: /* raisetype ::= FAIL */ +{yymsp[0].minor.yy394 = OE_Fail;} break; - case 277: /* cmd ::= DROP TRIGGER ifexists fullname */ + case 280: /* cmd ::= DROP TRIGGER ifexists fullname */ { - sqlite3DropTrigger(pParse,yymsp[0].minor.yy153,yymsp[-1].minor.yy376); + sqlite3DropTrigger(pParse,yymsp[0].minor.yy131,yymsp[-1].minor.yy394); } break; - case 278: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ + case 281: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { - sqlite3Attach(pParse, yymsp[-3].minor.yy404, yymsp[-1].minor.yy404, yymsp[0].minor.yy404); + sqlite3Attach(pParse, yymsp[-3].minor.yy528, yymsp[-1].minor.yy528, yymsp[0].minor.yy528); } break; - case 279: /* cmd ::= DETACH database_kw_opt expr */ + case 282: /* cmd ::= DETACH database_kw_opt expr */ { - sqlite3Detach(pParse, yymsp[0].minor.yy404); + sqlite3Detach(pParse, yymsp[0].minor.yy528); } break; - case 282: /* cmd ::= REINDEX */ + case 285: /* cmd ::= REINDEX */ {sqlite3Reindex(pParse, 0, 0);} break; - case 283: /* cmd ::= REINDEX nm dbnm */ + case 286: /* cmd ::= REINDEX nm dbnm */ {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 284: /* cmd ::= ANALYZE */ + case 287: /* cmd ::= ANALYZE */ {sqlite3Analyze(pParse, 0, 0);} break; - case 285: /* cmd ::= ANALYZE nm dbnm */ + case 288: /* cmd ::= ANALYZE nm dbnm */ {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; - case 286: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ + case 289: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy153,&yymsp[0].minor.yy0); + sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy131,&yymsp[0].minor.yy0); } break; - case 287: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ + case 290: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); } break; - case 288: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ + case 291: /* cmd ::= ALTER TABLE fullname DROP kwcolumn_opt nm */ { - sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy153, &yymsp[0].minor.yy0); + sqlite3AlterDropColumn(pParse, yymsp[-3].minor.yy131, &yymsp[0].minor.yy0); } break; - case 289: /* add_column_fullname ::= fullname */ + case 292: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy153); + sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy131); } break; - case 290: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ + case 293: /* cmd ::= ALTER TABLE fullname RENAME kwcolumn_opt nm TO nm */ { - sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy153, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); + sqlite3AlterRenameColumn(pParse, yymsp[-5].minor.yy131, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0); } break; - case 291: /* cmd ::= create_vtab */ + case 294: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; - case 292: /* cmd ::= create_vtab LP vtabarglist RP */ + case 295: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; - case 293: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ + case 296: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy376); + sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy394); } break; - case 294: /* vtabarg ::= */ + case 297: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; - case 295: /* vtabargtoken ::= ANY */ - case 296: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==296); - case 297: /* lp ::= LP */ yytestcase(yyruleno==297); + case 298: /* vtabargtoken ::= ANY */ + case 299: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==299); + case 300: /* lp ::= LP */ yytestcase(yyruleno==300); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; - case 298: /* with ::= WITH wqlist */ - case 299: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==299); -{ sqlite3WithPush(pParse, yymsp[0].minor.yy103, 1); } + case 301: /* with ::= WITH wqlist */ + case 302: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==302); +{ sqlite3WithPush(pParse, yymsp[0].minor.yy521, 1); } break; - case 300: /* wqas ::= AS */ -{yymsp[0].minor.yy552 = M10d_Any;} + case 303: /* wqas ::= AS */ +{yymsp[0].minor.yy516 = M10d_Any;} break; - case 301: /* wqas ::= AS MATERIALIZED */ -{yymsp[-1].minor.yy552 = M10d_Yes;} + case 304: /* wqas ::= AS MATERIALIZED */ +{yymsp[-1].minor.yy516 = M10d_Yes;} break; - case 302: /* wqas ::= AS NOT MATERIALIZED */ -{yymsp[-2].minor.yy552 = M10d_No;} + case 305: /* wqas ::= AS NOT MATERIALIZED */ +{yymsp[-2].minor.yy516 = M10d_No;} break; - case 303: /* wqitem ::= nm eidlist_opt wqas LP select RP */ + case 306: /* wqitem ::= nm eidlist_opt wqas LP select RP */ { - yymsp[-5].minor.yy329 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy70, yymsp[-1].minor.yy81, yymsp[-3].minor.yy552); /*A-overwrites-X*/ + yymsp[-5].minor.yy385 = sqlite3CteNew(pParse, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy322, yymsp[-1].minor.yy47, yymsp[-3].minor.yy516); /*A-overwrites-X*/ } break; - case 304: /* wqlist ::= wqitem */ + case 307: /* wqlist ::= wqitem */ { - yymsp[0].minor.yy103 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy329); /*A-overwrites-X*/ + yymsp[0].minor.yy521 = sqlite3WithAdd(pParse, 0, yymsp[0].minor.yy385); /*A-overwrites-X*/ } break; - case 305: /* wqlist ::= wqlist COMMA wqitem */ + case 308: /* wqlist ::= wqlist COMMA wqitem */ { - yymsp[-2].minor.yy103 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy103, yymsp[0].minor.yy329); + yymsp[-2].minor.yy521 = sqlite3WithAdd(pParse, yymsp[-2].minor.yy521, yymsp[0].minor.yy385); } break; - case 306: /* windowdefn_list ::= windowdefn */ -{ yylhsminor.yy49 = yymsp[0].minor.yy49; } - yymsp[0].minor.yy49 = yylhsminor.yy49; + case 309: /* windowdefn_list ::= windowdefn */ +{ yylhsminor.yy41 = yymsp[0].minor.yy41; } + yymsp[0].minor.yy41 = yylhsminor.yy41; break; - case 307: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ + case 310: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ { - assert( yymsp[0].minor.yy49!=0 ); - sqlite3WindowChain(pParse, yymsp[0].minor.yy49, yymsp[-2].minor.yy49); - yymsp[0].minor.yy49->pNextWin = yymsp[-2].minor.yy49; - yylhsminor.yy49 = yymsp[0].minor.yy49; + assert( yymsp[0].minor.yy41!=0 ); + sqlite3WindowChain(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy41); + yymsp[0].minor.yy41->pNextWin = yymsp[-2].minor.yy41; + yylhsminor.yy41 = yymsp[0].minor.yy41; } - yymsp[-2].minor.yy49 = yylhsminor.yy49; + yymsp[-2].minor.yy41 = yylhsminor.yy41; break; - case 308: /* windowdefn ::= nm AS LP window RP */ + case 311: /* windowdefn ::= nm AS LP window RP */ { - if( ALWAYS(yymsp[-1].minor.yy49) ){ - yymsp[-1].minor.yy49->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); + if( ALWAYS(yymsp[-1].minor.yy41) ){ + yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[-4].minor.yy0.z, yymsp[-4].minor.yy0.n); } - yylhsminor.yy49 = yymsp[-1].minor.yy49; + yylhsminor.yy41 = yymsp[-1].minor.yy41; } - yymsp[-4].minor.yy49 = yylhsminor.yy49; + yymsp[-4].minor.yy41 = yylhsminor.yy41; break; - case 309: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ + case 312: /* window ::= PARTITION BY nexprlist orderby_opt frame_opt */ { - yymsp[-4].minor.yy49 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy49, yymsp[-2].minor.yy70, yymsp[-1].minor.yy70, 0); + yymsp[-4].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, 0); } break; - case 310: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ + case 313: /* window ::= nm PARTITION BY nexprlist orderby_opt frame_opt */ { - yylhsminor.yy49 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy49, yymsp[-2].minor.yy70, yymsp[-1].minor.yy70, &yymsp[-5].minor.yy0); + yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, yymsp[-2].minor.yy322, yymsp[-1].minor.yy322, &yymsp[-5].minor.yy0); } - yymsp[-5].minor.yy49 = yylhsminor.yy49; + yymsp[-5].minor.yy41 = yylhsminor.yy41; break; - case 311: /* window ::= ORDER BY sortlist frame_opt */ + case 314: /* window ::= ORDER BY sortlist frame_opt */ { - yymsp[-3].minor.yy49 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy49, 0, yymsp[-1].minor.yy70, 0); + yymsp[-3].minor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, 0); } break; - case 312: /* window ::= nm ORDER BY sortlist frame_opt */ + case 315: /* window ::= nm ORDER BY sortlist frame_opt */ { - yylhsminor.yy49 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy49, 0, yymsp[-1].minor.yy70, &yymsp[-4].minor.yy0); + yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, yymsp[-1].minor.yy322, &yymsp[-4].minor.yy0); } - yymsp[-4].minor.yy49 = yylhsminor.yy49; + yymsp[-4].minor.yy41 = yylhsminor.yy41; break; - case 313: /* window ::= frame_opt */ - case 332: /* filter_over ::= over_clause */ yytestcase(yyruleno==332); + case 316: /* window ::= frame_opt */ + case 335: /* filter_over ::= over_clause */ yytestcase(yyruleno==335); { - yylhsminor.yy49 = yymsp[0].minor.yy49; + yylhsminor.yy41 = yymsp[0].minor.yy41; } - yymsp[0].minor.yy49 = yylhsminor.yy49; + yymsp[0].minor.yy41 = yylhsminor.yy41; break; - case 314: /* window ::= nm frame_opt */ + case 317: /* window ::= nm frame_opt */ { - yylhsminor.yy49 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy49, 0, 0, &yymsp[-1].minor.yy0); + yylhsminor.yy41 = sqlite3WindowAssemble(pParse, yymsp[0].minor.yy41, 0, 0, &yymsp[-1].minor.yy0); } - yymsp[-1].minor.yy49 = yylhsminor.yy49; + yymsp[-1].minor.yy41 = yylhsminor.yy41; break; - case 315: /* frame_opt ::= */ + case 318: /* frame_opt ::= */ { - yymsp[1].minor.yy49 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); + yymsp[1].minor.yy41 = sqlite3WindowAlloc(pParse, 0, TK_UNBOUNDED, 0, TK_CURRENT, 0, 0); } break; - case 316: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ + case 319: /* frame_opt ::= range_or_rows frame_bound_s frame_exclude_opt */ { - yylhsminor.yy49 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy376, yymsp[-1].minor.yy117.eType, yymsp[-1].minor.yy117.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy552); + yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-2].minor.yy394, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, TK_CURRENT, 0, yymsp[0].minor.yy516); } - yymsp[-2].minor.yy49 = yylhsminor.yy49; + yymsp[-2].minor.yy41 = yylhsminor.yy41; break; - case 317: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ + case 320: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e frame_exclude_opt */ { - yylhsminor.yy49 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy376, yymsp[-3].minor.yy117.eType, yymsp[-3].minor.yy117.pExpr, yymsp[-1].minor.yy117.eType, yymsp[-1].minor.yy117.pExpr, yymsp[0].minor.yy552); + yylhsminor.yy41 = sqlite3WindowAlloc(pParse, yymsp[-5].minor.yy394, yymsp[-3].minor.yy595.eType, yymsp[-3].minor.yy595.pExpr, yymsp[-1].minor.yy595.eType, yymsp[-1].minor.yy595.pExpr, yymsp[0].minor.yy516); } - yymsp[-5].minor.yy49 = yylhsminor.yy49; + yymsp[-5].minor.yy41 = yylhsminor.yy41; break; - case 319: /* frame_bound_s ::= frame_bound */ - case 321: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==321); -{yylhsminor.yy117 = yymsp[0].minor.yy117;} - yymsp[0].minor.yy117 = yylhsminor.yy117; + case 322: /* frame_bound_s ::= frame_bound */ + case 324: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==324); +{yylhsminor.yy595 = yymsp[0].minor.yy595;} + yymsp[0].minor.yy595 = yylhsminor.yy595; break; - case 320: /* frame_bound_s ::= UNBOUNDED PRECEDING */ - case 322: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==322); - case 324: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==324); -{yylhsminor.yy117.eType = yymsp[-1].major; yylhsminor.yy117.pExpr = 0;} - yymsp[-1].minor.yy117 = yylhsminor.yy117; + case 323: /* frame_bound_s ::= UNBOUNDED PRECEDING */ + case 325: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==325); + case 327: /* frame_bound ::= CURRENT ROW */ yytestcase(yyruleno==327); +{yylhsminor.yy595.eType = yymsp[-1].major; yylhsminor.yy595.pExpr = 0;} + yymsp[-1].minor.yy595 = yylhsminor.yy595; break; - case 323: /* frame_bound ::= expr PRECEDING|FOLLOWING */ -{yylhsminor.yy117.eType = yymsp[0].major; yylhsminor.yy117.pExpr = yymsp[-1].minor.yy404;} - yymsp[-1].minor.yy117 = yylhsminor.yy117; + case 326: /* frame_bound ::= expr PRECEDING|FOLLOWING */ +{yylhsminor.yy595.eType = yymsp[0].major; yylhsminor.yy595.pExpr = yymsp[-1].minor.yy528;} + yymsp[-1].minor.yy595 = yylhsminor.yy595; break; - case 325: /* frame_exclude_opt ::= */ -{yymsp[1].minor.yy552 = 0;} + case 328: /* frame_exclude_opt ::= */ +{yymsp[1].minor.yy516 = 0;} break; - case 326: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ -{yymsp[-1].minor.yy552 = yymsp[0].minor.yy552;} + case 329: /* frame_exclude_opt ::= EXCLUDE frame_exclude */ +{yymsp[-1].minor.yy516 = yymsp[0].minor.yy516;} break; - case 327: /* frame_exclude ::= NO OTHERS */ - case 328: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==328); -{yymsp[-1].minor.yy552 = yymsp[-1].major; /*A-overwrites-X*/} + case 330: /* frame_exclude ::= NO OTHERS */ + case 331: /* frame_exclude ::= CURRENT ROW */ yytestcase(yyruleno==331); +{yymsp[-1].minor.yy516 = yymsp[-1].major; /*A-overwrites-X*/} break; - case 329: /* frame_exclude ::= GROUP|TIES */ -{yymsp[0].minor.yy552 = yymsp[0].major; /*A-overwrites-X*/} + case 332: /* frame_exclude ::= GROUP|TIES */ +{yymsp[0].minor.yy516 = yymsp[0].major; /*A-overwrites-X*/} break; - case 330: /* window_clause ::= WINDOW windowdefn_list */ -{ yymsp[-1].minor.yy49 = yymsp[0].minor.yy49; } + case 333: /* window_clause ::= WINDOW windowdefn_list */ +{ yymsp[-1].minor.yy41 = yymsp[0].minor.yy41; } break; - case 331: /* filter_over ::= filter_clause over_clause */ + case 334: /* filter_over ::= filter_clause over_clause */ { - if( yymsp[0].minor.yy49 ){ - yymsp[0].minor.yy49->pFilter = yymsp[-1].minor.yy404; + if( yymsp[0].minor.yy41 ){ + yymsp[0].minor.yy41->pFilter = yymsp[-1].minor.yy528; }else{ - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy404); + sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy528); } - yylhsminor.yy49 = yymsp[0].minor.yy49; + yylhsminor.yy41 = yymsp[0].minor.yy41; } - yymsp[-1].minor.yy49 = yylhsminor.yy49; + yymsp[-1].minor.yy41 = yylhsminor.yy41; break; - case 333: /* filter_over ::= filter_clause */ + case 336: /* filter_over ::= filter_clause */ { - yylhsminor.yy49 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); - if( yylhsminor.yy49 ){ - yylhsminor.yy49->eFrmType = TK_FILTER; - yylhsminor.yy49->pFilter = yymsp[0].minor.yy404; + yylhsminor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + if( yylhsminor.yy41 ){ + yylhsminor.yy41->eFrmType = TK_FILTER; + yylhsminor.yy41->pFilter = yymsp[0].minor.yy528; }else{ - sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy404); + sqlite3ExprDelete(pParse->db, yymsp[0].minor.yy528); } } - yymsp[0].minor.yy49 = yylhsminor.yy49; + yymsp[0].minor.yy41 = yylhsminor.yy41; break; - case 334: /* over_clause ::= OVER LP window RP */ + case 337: /* over_clause ::= OVER LP window RP */ { - yymsp[-3].minor.yy49 = yymsp[-1].minor.yy49; - assert( yymsp[-3].minor.yy49!=0 ); + yymsp[-3].minor.yy41 = yymsp[-1].minor.yy41; + assert( yymsp[-3].minor.yy41!=0 ); } break; - case 335: /* over_clause ::= OVER nm */ + case 338: /* over_clause ::= OVER nm */ { - yymsp[-1].minor.yy49 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); - if( yymsp[-1].minor.yy49 ){ - yymsp[-1].minor.yy49->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); + yymsp[-1].minor.yy41 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); + if( yymsp[-1].minor.yy41 ){ + yymsp[-1].minor.yy41->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); } } break; - case 336: /* filter_clause ::= FILTER LP WHERE expr RP */ -{ yymsp[-4].minor.yy404 = yymsp[-1].minor.yy404; } + case 339: /* filter_clause ::= FILTER LP WHERE expr RP */ +{ yymsp[-4].minor.yy528 = yymsp[-1].minor.yy528; } break; default: - /* (337) input ::= cmdlist */ yytestcase(yyruleno==337); - /* (338) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==338); - /* (339) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=339); - /* (340) ecmd ::= SEMI */ yytestcase(yyruleno==340); - /* (341) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==341); - /* (342) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=342); - /* (343) trans_opt ::= */ yytestcase(yyruleno==343); - /* (344) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==344); - /* (345) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==345); - /* (346) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==346); - /* (347) savepoint_opt ::= */ yytestcase(yyruleno==347); - /* (348) cmd ::= create_table create_table_args */ yytestcase(yyruleno==348); - /* (349) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==349); - /* (350) columnlist ::= columnname carglist */ yytestcase(yyruleno==350); - /* (351) nm ::= ID|INDEXED */ yytestcase(yyruleno==351); - /* (352) nm ::= STRING */ yytestcase(yyruleno==352); - /* (353) nm ::= JOIN_KW */ yytestcase(yyruleno==353); - /* (354) typetoken ::= typename */ yytestcase(yyruleno==354); - /* (355) typename ::= ID|STRING */ yytestcase(yyruleno==355); - /* (356) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=356); - /* (357) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=357); - /* (358) carglist ::= carglist ccons */ yytestcase(yyruleno==358); - /* (359) carglist ::= */ yytestcase(yyruleno==359); - /* (360) ccons ::= NULL onconf */ yytestcase(yyruleno==360); - /* (361) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==361); - /* (362) ccons ::= AS generated */ yytestcase(yyruleno==362); - /* (363) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==363); - /* (364) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==364); - /* (365) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=365); - /* (366) tconscomma ::= */ yytestcase(yyruleno==366); - /* (367) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=367); - /* (368) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=368); - /* (369) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=369); - /* (370) oneselect ::= values */ yytestcase(yyruleno==370); - /* (371) sclp ::= selcollist COMMA */ yytestcase(yyruleno==371); - /* (372) as ::= ID|STRING */ yytestcase(yyruleno==372); - /* (373) returning ::= */ yytestcase(yyruleno==373); - /* (374) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=374); - /* (375) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==375); - /* (376) exprlist ::= nexprlist */ yytestcase(yyruleno==376); - /* (377) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=377); - /* (378) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=378); - /* (379) nmnum ::= ON */ yytestcase(yyruleno==379); - /* (380) nmnum ::= DELETE */ yytestcase(yyruleno==380); - /* (381) nmnum ::= DEFAULT */ yytestcase(yyruleno==381); - /* (382) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==382); - /* (383) foreach_clause ::= */ yytestcase(yyruleno==383); - /* (384) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==384); - /* (385) trnm ::= nm */ yytestcase(yyruleno==385); - /* (386) tridxby ::= */ yytestcase(yyruleno==386); - /* (387) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==387); - /* (388) database_kw_opt ::= */ yytestcase(yyruleno==388); - /* (389) kwcolumn_opt ::= */ yytestcase(yyruleno==389); - /* (390) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==390); - /* (391) vtabarglist ::= vtabarg */ yytestcase(yyruleno==391); - /* (392) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==392); - /* (393) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==393); - /* (394) anylist ::= */ yytestcase(yyruleno==394); - /* (395) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==395); - /* (396) anylist ::= anylist ANY */ yytestcase(yyruleno==396); - /* (397) with ::= */ yytestcase(yyruleno==397); + /* (340) input ::= cmdlist */ yytestcase(yyruleno==340); + /* (341) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==341); + /* (342) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=342); + /* (343) ecmd ::= SEMI */ yytestcase(yyruleno==343); + /* (344) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==344); + /* (345) ecmd ::= explain cmdx SEMI (NEVER REDUCES) */ assert(yyruleno!=345); + /* (346) trans_opt ::= */ yytestcase(yyruleno==346); + /* (347) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==347); + /* (348) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==348); + /* (349) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==349); + /* (350) savepoint_opt ::= */ yytestcase(yyruleno==350); + /* (351) cmd ::= create_table create_table_args */ yytestcase(yyruleno==351); + /* (352) table_option_set ::= table_option (OPTIMIZED OUT) */ assert(yyruleno!=352); + /* (353) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==353); + /* (354) columnlist ::= columnname carglist */ yytestcase(yyruleno==354); + /* (355) nm ::= ID|INDEXED */ yytestcase(yyruleno==355); + /* (356) nm ::= STRING */ yytestcase(yyruleno==356); + /* (357) nm ::= JOIN_KW */ yytestcase(yyruleno==357); + /* (358) typetoken ::= typename */ yytestcase(yyruleno==358); + /* (359) typename ::= ID|STRING */ yytestcase(yyruleno==359); + /* (360) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=360); + /* (361) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=361); + /* (362) carglist ::= carglist ccons */ yytestcase(yyruleno==362); + /* (363) carglist ::= */ yytestcase(yyruleno==363); + /* (364) ccons ::= NULL onconf */ yytestcase(yyruleno==364); + /* (365) ccons ::= GENERATED ALWAYS AS generated */ yytestcase(yyruleno==365); + /* (366) ccons ::= AS generated */ yytestcase(yyruleno==366); + /* (367) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==367); + /* (368) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==368); + /* (369) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=369); + /* (370) tconscomma ::= */ yytestcase(yyruleno==370); + /* (371) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=371); + /* (372) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=372); + /* (373) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=373); + /* (374) oneselect ::= values */ yytestcase(yyruleno==374); + /* (375) sclp ::= selcollist COMMA */ yytestcase(yyruleno==375); + /* (376) as ::= ID|STRING */ yytestcase(yyruleno==376); + /* (377) returning ::= */ yytestcase(yyruleno==377); + /* (378) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=378); + /* (379) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==379); + /* (380) exprlist ::= nexprlist */ yytestcase(yyruleno==380); + /* (381) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=381); + /* (382) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=382); + /* (383) nmnum ::= ON */ yytestcase(yyruleno==383); + /* (384) nmnum ::= DELETE */ yytestcase(yyruleno==384); + /* (385) nmnum ::= DEFAULT */ yytestcase(yyruleno==385); + /* (386) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==386); + /* (387) foreach_clause ::= */ yytestcase(yyruleno==387); + /* (388) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==388); + /* (389) trnm ::= nm */ yytestcase(yyruleno==389); + /* (390) tridxby ::= */ yytestcase(yyruleno==390); + /* (391) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==391); + /* (392) database_kw_opt ::= */ yytestcase(yyruleno==392); + /* (393) kwcolumn_opt ::= */ yytestcase(yyruleno==393); + /* (394) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==394); + /* (395) vtabarglist ::= vtabarg */ yytestcase(yyruleno==395); + /* (396) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==396); + /* (397) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==397); + /* (398) anylist ::= */ yytestcase(yyruleno==398); + /* (399) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==399); + /* (400) anylist ::= anylist ANY */ yytestcase(yyruleno==400); + /* (401) with ::= */ yytestcase(yyruleno==401); break; /********** End reduce actions ************************************************/ }; @@ -163168,8 +166632,8 @@ SQLITE_PRIVATE void sqlite3Parser( yyact = yy_find_shift_action((YYCODETYPE)yymajor,yyact); if( yyact >= YY_MIN_REDUCE ){ unsigned int yyruleno = yyact - YY_MIN_REDUCE; /* Reduce by this rule */ - assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); #ifndef NDEBUG + assert( yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ); if( yyTraceFILE ){ int yysize = yyRuleInfoNRhs[yyruleno]; if( yysize ){ @@ -163267,14 +166731,13 @@ SQLITE_PRIVATE void sqlite3Parser( yy_destructor(yypParser, (YYCODETYPE)yymajor, &yyminorunion); yymajor = YYNOCODE; }else{ - while( yypParser->yytos >= yypParser->yystack - && (yyact = yy_find_reduce_action( - yypParser->yytos->stateno, - YYERRORSYMBOL)) > YY_MAX_SHIFTREDUCE - ){ + while( yypParser->yytos > yypParser->yystack ){ + yyact = yy_find_reduce_action(yypParser->yytos->stateno, + YYERRORSYMBOL); + if( yyact<=YY_MAX_SHIFTREDUCE ) break; yy_pop_parser_stack(yypParser); } - if( yypParser->yytos < yypParser->yystack || yymajor==0 ){ + if( yypParser->yytos <= yypParser->yystack || yymajor==0 ){ yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); yy_parse_failed(yypParser); #ifndef YYNOERRORRECOVERY @@ -164134,6 +167597,9 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ for(i=2; (c=z[i])!=0 && c!='\n'; i++){} *tokenType = TK_SPACE; /* IMP: R-22934-25134 */ return i; + }else if( z[1]=='>' ){ + *tokenType = TK_PTR; + return 2 + (z[2]=='>'); } *tokenType = TK_MINUS; return 1; @@ -164403,13 +167869,9 @@ SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ } /* -** Run the parser on the given SQL string. The parser structure is -** passed in. An SQLITE_ status code is returned. If an error occurs -** then an and attempt is made to write an error message into -** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that -** error message. +** Run the parser on the given SQL string. */ -SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ +SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql){ int nErr = 0; /* Number of errors encountered */ void *pEngine; /* The LEMON-generated LALR(1) parser */ int n = 0; /* Length of the next token token */ @@ -164417,6 +167879,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr int lastTokenParsed = -1; /* type of the previous token */ sqlite3 *db = pParse->db; /* The database connection */ int mxSqlLen; /* Max length of an SQL string */ + Parse *pParentParse = 0; /* Outer parse context, if any */ #ifdef sqlite3Parser_ENGINEALWAYSONSTACK yyParser sEngine; /* Space to hold the Lemon-generated Parser object */ #endif @@ -164429,7 +167892,6 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr } pParse->rc = SQLITE_OK; pParse->zTail = zSql; - assert( pzErrMsg!=0 ); #ifdef SQLITE_DEBUG if( db->flags & SQLITE_ParserTrace ){ printf("parser: [[[%s]]]\n", zSql); @@ -164452,7 +167914,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr assert( pParse->pNewTrigger==0 ); assert( pParse->nVar==0 ); assert( pParse->pVList==0 ); - pParse->pParentParse = db->pParse; + pParentParse = db->pParse; db->pParse = pParse; while( 1 ){ n = sqlite3GetToken((u8*)zSql, &tokenType); @@ -164472,6 +167934,7 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr #endif /* SQLITE_OMIT_WINDOWFUNC */ if( AtomicLoad(&db->u1.isInterrupted) ){ pParse->rc = SQLITE_INTERRUPT; + pParse->nErr++; break; } if( tokenType==TK_SPACE ){ @@ -164501,7 +167964,10 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr tokenType = analyzeFilterKeyword((const u8*)&zSql[6], lastTokenParsed); #endif /* SQLITE_OMIT_WINDOWFUNC */ }else{ - sqlite3ErrorMsg(pParse, "unrecognized token: \"%.*s\"", n, zSql); + Token x; + x.z = zSql; + x.n = n; + sqlite3ErrorMsg(pParse, "unrecognized token: \"%T\"", &x); break; } } @@ -164529,46 +167995,30 @@ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzEr if( db->mallocFailed ){ pParse->rc = SQLITE_NOMEM_BKPT; } - if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ - pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc)); - } - assert( pzErrMsg!=0 ); - if( pParse->zErrMsg ){ - *pzErrMsg = pParse->zErrMsg; - sqlite3_log(pParse->rc, "%s in \"%s\"", - *pzErrMsg, pParse->zTail); - pParse->zErrMsg = 0; + if( pParse->zErrMsg || (pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE) ){ + if( pParse->zErrMsg==0 ){ + pParse->zErrMsg = sqlite3MPrintf(db, "%s", sqlite3ErrStr(pParse->rc)); + } + sqlite3_log(pParse->rc, "%s in \"%s\"", pParse->zErrMsg, pParse->zTail); nErr++; } pParse->zTail = zSql; - if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){ - sqlite3VdbeDelete(pParse->pVdbe); - pParse->pVdbe = 0; - } -#ifndef SQLITE_OMIT_SHARED_CACHE - if( pParse->nested==0 ){ - sqlite3DbFree(db, pParse->aTableLock); - pParse->aTableLock = 0; - pParse->nTableLock = 0; - } -#endif #ifndef SQLITE_OMIT_VIRTUALTABLE sqlite3_free(pParse->apVtabLock); #endif - if( !IN_SPECIAL_PARSE ){ + if( pParse->pNewTable && !IN_SPECIAL_PARSE ){ /* If the pParse->declareVtab flag is set, do not delete any table ** structure built up in pParse->pNewTable. The calling code (see vtab.c) ** will take responsibility for freeing the Table structure. */ sqlite3DeleteTable(db, pParse->pNewTable); } - if( !IN_RENAME_OBJECT ){ + if( pParse->pNewTrigger && !IN_RENAME_OBJECT ){ sqlite3DeleteTrigger(db, pParse->pNewTrigger); } sqlite3DbFree(db, pParse->pVList); - db->pParse = pParse->pParentParse; - pParse->pParentParse = 0; + db->pParse = pParentParse; assert( nErr==0 || pParse->rc!=SQLITE_OK ); return nErr; } @@ -165149,9 +168599,6 @@ SQLITE_PRIVATE int sqlite3Fts2Init(sqlite3*); #ifdef SQLITE_ENABLE_FTS5 SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*); #endif -#ifdef SQLITE_ENABLE_JSON1 -SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*); -#endif #ifdef SQLITE_ENABLE_STMTVTAB SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*); #endif @@ -165186,8 +168633,8 @@ static int (*const sqlite3BuiltinExtensions[])(sqlite3*) = { sqlite3DbstatRegister, #endif sqlite3TestExtInit, -#ifdef SQLITE_ENABLE_JSON1 - sqlite3Json1Init, +#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) + sqlite3JsonTableFunctions, #endif #ifdef SQLITE_ENABLE_STMTVTAB sqlite3StmtVtabInit, @@ -166185,7 +169632,7 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3 *db, sqlite3_int64 iRowid) /* ** Return the number of changes in the most recent call to sqlite3_exec(). */ -SQLITE_API int sqlite3_changes(sqlite3 *db){ +SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; @@ -166194,11 +169641,14 @@ SQLITE_API int sqlite3_changes(sqlite3 *db){ #endif return db->nChange; } +SQLITE_API int sqlite3_changes(sqlite3 *db){ + return (int)sqlite3_changes64(db); +} /* ** Return the number of changes since the database handle was opened. */ -SQLITE_API int sqlite3_total_changes(sqlite3 *db){ +SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR if( !sqlite3SafetyCheckOk(db) ){ (void)SQLITE_MISUSE_BKPT; @@ -166207,6 +169657,9 @@ SQLITE_API int sqlite3_total_changes(sqlite3 *db){ #endif return db->nTotalChange; } +SQLITE_API int sqlite3_total_changes(sqlite3 *db){ + return (int)sqlite3_total_changes64(db); +} /* ** Close all open savepoints. This function only manipulates fields of the @@ -166231,7 +169684,9 @@ SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *db){ ** with SQLITE_ANY as the encoding. */ static void functionDestroy(sqlite3 *db, FuncDef *p){ - FuncDestructor *pDestructor = p->u.pDestructor; + FuncDestructor *pDestructor; + assert( (p->funcFlags & SQLITE_FUNC_BUILTIN)==0 ); + pDestructor = p->u.pDestructor; if( pDestructor ){ pDestructor->nRef--; if( pDestructor->nRef==0 ){ @@ -166335,7 +169790,7 @@ static int sqlite3Close(sqlite3 *db, int forceZombie){ /* Convert the connection into a zombie and then close it. */ - db->magic = SQLITE_MAGIC_ZOMBIE; + db->eOpenState = SQLITE_STATE_ZOMBIE; sqlite3LeaveMutexAndCloseZombie(db); return SQLITE_OK; } @@ -166399,7 +169854,7 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ ** or if the connection has not yet been closed by sqlite3_close_v2(), ** then just leave the mutex and return. */ - if( db->magic!=SQLITE_MAGIC_ZOMBIE || connectionIsBusy(db) ){ + if( db->eOpenState!=SQLITE_STATE_ZOMBIE || connectionIsBusy(db) ){ sqlite3_mutex_leave(db->mutex); return; } @@ -166485,7 +169940,7 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ sqlite3_free(db->auth.zAuthPW); #endif - db->magic = SQLITE_MAGIC_ERROR; + db->eOpenState = SQLITE_STATE_ERROR; /* The temp-database schema is allocated differently from the other schema ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()). @@ -166494,8 +169949,11 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ ** structure? */ sqlite3DbFree(db, db->aDb[1].pSchema); + if( db->xAutovacDestr ){ + db->xAutovacDestr(db->pAutovacPagesArg); + } sqlite3_mutex_leave(db->mutex); - db->magic = SQLITE_MAGIC_CLOSED; + db->eOpenState = SQLITE_STATE_CLOSED; sqlite3_mutex_free(db->mutex); assert( sqlite3LookasideUsed(db,0)==0 ); if( db->lookaside.bMalloced ){ @@ -166548,7 +170006,7 @@ SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){ /* Any deferred constraint violations have now been resolved. */ db->nDeferredCons = 0; db->nDeferredImmCons = 0; - db->flags &= ~(u64)SQLITE_DeferFKs; + db->flags &= ~(u64)(SQLITE_DeferFKs|SQLITE_CorruptRdOnly); /* If one has been configured, invoke the rollback-hook callback */ if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){ @@ -166883,7 +170341,7 @@ SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){ */ SQLITE_API void sqlite3_interrupt(sqlite3 *db){ #ifdef SQLITE_ENABLE_API_ARMOR - if( !sqlite3SafetyCheckOk(db) && (db==0 || db->magic!=SQLITE_MAGIC_ZOMBIE) ){ + if( !sqlite3SafetyCheckOk(db) && (db==0 || db->eOpenState!=SQLITE_STATE_ZOMBIE) ){ (void)SQLITE_MISUSE_BKPT; return; } @@ -166912,7 +170370,6 @@ SQLITE_PRIVATE int sqlite3CreateFunc( FuncDestructor *pDestructor ){ FuncDef *p; - int nName; int extraFlags; assert( sqlite3_mutex_held(db->mutex) ); @@ -166922,7 +170379,7 @@ SQLITE_PRIVATE int sqlite3CreateFunc( || ((xFinal==0)!=(xStep==0)) /* Both or neither of xFinal and xStep */ || ((xValue==0)!=(xInverse==0)) /* Both or neither of xValue, xInverse */ || (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) - || (255<(nName = sqlite3Strlen30( zFunctionName))) + || (255nRef==0 ){ - assert( rc!=SQLITE_OK ); + assert( rc!=SQLITE_OK || (xStep==0 && xFinal==0) ); xDestroy(p); sqlite3_free(pArg); } @@ -167385,6 +170853,34 @@ SQLITE_API void *sqlite3_preupdate_hook( } #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ +/* +** Register a function to be invoked prior to each autovacuum that +** determines the number of pages to vacuum. +*/ +SQLITE_API int sqlite3_autovacuum_pages( + sqlite3 *db, /* Attach the hook to this database */ + unsigned int (*xCallback)(void*,const char*,u32,u32,u32), + void *pArg, /* Argument to the function */ + void (*xDestructor)(void*) /* Destructor for pArg */ +){ +#ifdef SQLITE_ENABLE_API_ARMOR + if( !sqlite3SafetyCheckOk(db) ){ + if( xDestructor ) xDestructor(pArg); + return SQLITE_MISUSE_BKPT; + } +#endif + sqlite3_mutex_enter(db->mutex); + if( db->xAutovacDestr ){ + db->xAutovacDestr(db->pAutovacPagesArg); + } + db->xAutovacPages = xCallback; + db->pAutovacPagesArg = pArg; + db->xAutovacDestr = xDestructor; + sqlite3_mutex_leave(db->mutex); + return SQLITE_OK; +} + + #ifndef SQLITE_OMIT_WAL /* ** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint(). @@ -167647,6 +171143,19 @@ SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){ return z; } +/* +** Return the byte offset of the most recent error +*/ +SQLITE_API int sqlite3_error_offset(sqlite3 *db){ + int iOffset = -1; + if( db && sqlite3SafetyCheckSickOrOk(db) && db->errCode ){ + sqlite3_mutex_enter(db->mutex); + iOffset = db->errByteOffset; + sqlite3_mutex_leave(db->mutex); + } + return iOffset; +} + #ifndef SQLITE_OMIT_UTF16 /* ** Return UTF-16 encoded English language explanation of the most recent @@ -167907,6 +171416,8 @@ SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){ if( newLimit>=0 ){ /* IMP: R-52476-28732 */ if( newLimit>aHardLimit[limitId] ){ newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */ + }else if( newLimit<1 && limitId==SQLITE_LIMIT_LENGTH ){ + newLimit = 1; } db->aLimit[limitId] = newLimit; } @@ -168178,7 +171689,7 @@ SQLITE_PRIVATE int sqlite3ParseUri( */ static const char *uriParameter(const char *zFilename, const char *zParam){ zFilename += sqlite3Strlen30(zFilename) + 1; - while( zFilename[0] ){ + while( ALWAYS(zFilename!=0) && zFilename[0] ){ int x = strcmp(zFilename, zParam); zFilename += sqlite3Strlen30(zFilename) + 1; if( x==0 ) return zFilename; @@ -168238,8 +171749,8 @@ static int openDatabase( ** dealt with in the previous code block. Besides these, the only ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY, ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE, - ** SQLITE_OPEN_PRIVATECACHE, and some reserved bits. Silently mask - ** off all other flags. + ** SQLITE_OPEN_PRIVATECACHE, SQLITE_OPEN_EXRESCODE, and some reserved + ** bits. Silently mask off all other flags. */ flags &= ~( SQLITE_OPEN_DELETEONCLOSE | SQLITE_OPEN_EXCLUSIVE | @@ -168274,9 +171785,9 @@ static int openDatabase( } } sqlite3_mutex_enter(db->mutex); - db->errMask = 0xff; + db->errMask = (flags & SQLITE_OPEN_EXRESCODE)!=0 ? 0xffffffff : 0xff; db->nDb = 2; - db->magic = SQLITE_MAGIC_BUSY; + db->eOpenState = SQLITE_STATE_BUSY; db->aDb = db->aDbStatic; db->lookaside.bDisable = 1; db->lookaside.sz = 0; @@ -168288,7 +171799,15 @@ static int openDatabase( db->nextAutovac = -1; db->szMmap = sqlite3GlobalConfig.szMmap; db->nextPagesize = 0; + db->init.azInit = sqlite3StdType; /* Any array of string ptrs will do */ +#ifdef SQLITE_ENABLE_SORTER_MMAP + /* Beginning with version 3.37.0, using the VFS xFetch() API to memory-map + ** the temporary files used to do external sorts (see code in vdbesort.c) + ** is disabled. It can still be used either by defining + ** SQLITE_ENABLE_SORTER_MMAP at compile time or by using the + ** SQLITE_TESTCTRL_SORTER_MMAP test-control at runtime. */ db->nMaxSorterMmap = 0x7FFFFFFF; +#endif db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger | SQLITE_EnableView @@ -168436,7 +171955,7 @@ static int openDatabase( db->aDb[1].zDbSName = "temp"; db->aDb[1].safety_level = PAGER_SYNCHRONOUS_OFF; - db->magic = SQLITE_MAGIC_OPEN; + db->eOpenState = SQLITE_STATE_OPEN; if( db->mallocFailed ){ goto opendb_out; } @@ -168498,12 +172017,12 @@ opendb_out: sqlite3_mutex_leave(db->mutex); } rc = sqlite3_errcode(db); - assert( db!=0 || rc==SQLITE_NOMEM ); - if( rc==SQLITE_NOMEM ){ + assert( db!=0 || (rc&0xff)==SQLITE_NOMEM ); + if( (rc&0xff)==SQLITE_NOMEM ){ sqlite3_close(db); db = 0; }else if( rc!=SQLITE_OK ){ - db->magic = SQLITE_MAGIC_SICK; + db->eOpenState = SQLITE_STATE_SICK; } *ppDb = db; #ifdef SQLITE_ENABLE_SQLLOG @@ -168514,7 +172033,7 @@ opendb_out: } #endif sqlite3_free_filename(zOpen); - return rc & 0xff; + return rc; } @@ -168814,7 +172333,7 @@ SQLITE_API int sqlite3_table_column_metadata( /* Locate the table in question */ pTab = sqlite3FindTable(db, zTableName, zDbName); - if( !pTab || pTab->pSelect ){ + if( !pTab || IsView(pTab) ){ pTab = 0; goto error_out; } @@ -168825,7 +172344,7 @@ SQLITE_API int sqlite3_table_column_metadata( }else{ for(iCol=0; iColnCol; iCol++){ pCol = &pTab->aCol[iCol]; - if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){ + if( 0==sqlite3StrICmp(pCol->zCnName, zColumnName) ){ break; } } @@ -168852,7 +172371,7 @@ SQLITE_API int sqlite3_table_column_metadata( */ if( pCol ){ zDataType = sqlite3ColumnType(pCol,0); - zCollSeq = pCol->zColl; + zCollSeq = sqlite3ColumnColl(pCol); notnull = pCol->notNull!=0; primarykey = (pCol->colFlags & COLFLAG_PRIMKEY)!=0; autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0; @@ -169059,12 +172578,16 @@ SQLITE_API int sqlite3_test_control(int op, ...){ ** sqlite3_test_control(). */ case SQLITE_TESTCTRL_FAULT_INSTALL: { - /* MSVC is picky about pulling func ptrs from va lists. - ** http://support.microsoft.com/kb/47961 + /* A bug in MSVC prevents it from understanding pointers to functions + ** types in the second argument to va_arg(). Work around the problem + ** using a typedef. + ** http://support.microsoft.com/kb/47961 <-- dead hyperlink + ** Search at http://web.archive.org/ to find the 2015-03-16 archive + ** of the link above to see the original text. ** sqlite3GlobalConfig.xTestCallback = va_arg(ap, int(*)(int)); */ - typedef int(*TESTCALLBACKFUNC_t)(int); - sqlite3GlobalConfig.xTestCallback = va_arg(ap, TESTCALLBACKFUNC_t); + typedef int(*sqlite3FaultFuncType)(int); + sqlite3GlobalConfig.xTestCallback = va_arg(ap, sqlite3FaultFuncType); rc = sqlite3FaultSim(0); break; } @@ -169191,13 +172714,27 @@ SQLITE_API int sqlite3_test_control(int op, ...){ break; } - /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff); + /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, onoff, xAlt); ** - ** If parameter onoff is non-zero, subsequent calls to localtime() - ** and its variants fail. If onoff is zero, undo this setting. + ** If parameter onoff is 1, subsequent calls to localtime() fail. + ** If 2, then invoke xAlt() instead of localtime(). If 0, normal + ** processing. + ** + ** xAlt arguments are void pointers, but they really want to be: + ** + ** int xAlt(const time_t*, struct tm*); + ** + ** xAlt should write results in to struct tm object of its 2nd argument + ** and return zero on success, or return non-zero on failure. */ case SQLITE_TESTCTRL_LOCALTIME_FAULT: { sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int); + if( sqlite3GlobalConfig.bLocaltimeFault==2 ){ + typedef int(*sqlite3LocaltimeType)(const void*,void*); + sqlite3GlobalConfig.xAltLocaltime = va_arg(ap, sqlite3LocaltimeType); + }else{ + sqlite3GlobalConfig.xAltLocaltime = 0; + } break; } @@ -169302,12 +172839,16 @@ SQLITE_API int sqlite3_test_control(int op, ...){ */ case SQLITE_TESTCTRL_IMPOSTER: { sqlite3 *db = va_arg(ap, sqlite3*); + int iDb; sqlite3_mutex_enter(db->mutex); - db->init.iDb = sqlite3FindDbName(db, va_arg(ap,const char*)); - db->init.busy = db->init.imposterTable = va_arg(ap,int); - db->init.newTnum = va_arg(ap,int); - if( db->init.busy==0 && db->init.newTnum>0 ){ - sqlite3ResetAllSchemasOfConnection(db); + iDb = sqlite3FindDbName(db, va_arg(ap,const char*)); + if( iDb>=0 ){ + db->init.iDb = iDb; + db->init.busy = db->init.imposterTable = va_arg(ap,int); + db->init.newTnum = va_arg(ap,int); + if( db->init.busy==0 && db->init.newTnum>0 ){ + sqlite3ResetAllSchemasOfConnection(db); + } } sqlite3_mutex_leave(db->mutex); break; @@ -169383,6 +172924,26 @@ SQLITE_API int sqlite3_test_control(int op, ...){ break; } + /* sqlite3_test_control(SQLITE_TESTCTRL_LOGEST, + ** double fIn, // Input value + ** int *pLogEst, // sqlite3LogEstFromDouble(fIn) + ** u64 *pInt, // sqlite3LogEstToInt(*pLogEst) + ** int *pLogEst2 // sqlite3LogEst(*pInt) + ** ); + ** + ** Test access for the LogEst conversion routines. + */ + case SQLITE_TESTCTRL_LOGEST: { + double rIn = va_arg(ap, double); + LogEst rLogEst = sqlite3LogEstFromDouble(rIn); + u64 iInt = sqlite3LogEstToInt(rLogEst); + va_arg(ap, int*)[0] = rLogEst; + va_arg(ap, u64*)[0] = iInt; + va_arg(ap, int*)[0] = sqlite3LogEst(iInt); + break; + } + + #if defined(SQLITE_DEBUG) && !defined(SQLITE_OMIT_WSD) /* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue) ** @@ -169519,7 +173080,7 @@ SQLITE_API const char *sqlite3_uri_key(const char *zFilename, int N){ if( zFilename==0 || N<0 ) return 0; zFilename = databaseName(zFilename); zFilename += sqlite3Strlen30(zFilename) + 1; - while( zFilename[0] && (N--)>0 ){ + while( ALWAYS(zFilename) && zFilename[0] && (N--)>0 ){ zFilename += sqlite3Strlen30(zFilename) + 1; zFilename += sqlite3Strlen30(zFilename) + 1; } @@ -169562,12 +173123,14 @@ SQLITE_API sqlite3_int64 sqlite3_uri_int64( ** corruption. */ SQLITE_API const char *sqlite3_filename_database(const char *zFilename){ + if( zFilename==0 ) return 0; return databaseName(zFilename); } SQLITE_API const char *sqlite3_filename_journal(const char *zFilename){ + if( zFilename==0 ) return 0; zFilename = databaseName(zFilename); zFilename += sqlite3Strlen30(zFilename) + 1; - while( zFilename[0] ){ + while( ALWAYS(zFilename) && zFilename[0] ){ zFilename += sqlite3Strlen30(zFilename) + 1; zFilename += sqlite3Strlen30(zFilename) + 1; } @@ -169578,7 +173141,7 @@ SQLITE_API const char *sqlite3_filename_wal(const char *zFilename){ return 0; #else zFilename = sqlite3_filename_journal(zFilename); - zFilename += sqlite3Strlen30(zFilename) + 1; + if( zFilename ) zFilename += sqlite3Strlen30(zFilename) + 1; return zFilename; #endif } @@ -170871,17 +174434,18 @@ SQLITE_API extern int sqlite3_fts3_may_be_corrupt; ** Macros indicating that conditional expressions are always true or ** false. */ -#ifdef SQLITE_COVERAGE_TEST -# define ALWAYS(x) (1) -# define NEVER(X) (0) -#elif defined(SQLITE_DEBUG) -# define ALWAYS(x) sqlite3Fts3Always((x)!=0) -# define NEVER(x) sqlite3Fts3Never((x)!=0) -SQLITE_PRIVATE int sqlite3Fts3Always(int b); -SQLITE_PRIVATE int sqlite3Fts3Never(int b); +#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST) +# define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1 +#endif +#if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS) +# define ALWAYS(X) (1) +# define NEVER(X) (0) +#elif !defined(NDEBUG) +# define ALWAYS(X) ((X)?1:(assert(0),0)) +# define NEVER(X) ((X)?(assert(0),1):0) #else -# define ALWAYS(x) (x) -# define NEVER(x) (x) +# define ALWAYS(X) (X) +# define NEVER(X) (X) #endif /* @@ -171340,6 +174904,7 @@ SQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *); SQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3 *db, Fts3Hash*); SQLITE_PRIVATE int sqlite3Fts3InitTerm(sqlite3 *db); #endif +SQLITE_PRIVATE void *sqlite3Fts3MallocZero(i64 nByte); SQLITE_PRIVATE int sqlite3Fts3OpenTokenizer(sqlite3_tokenizer *, int, const char *, int, sqlite3_tokenizer_cursor ** @@ -171359,7 +174924,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *) SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); /* fts3_tokenize_vtab.c */ -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *); +SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *, void(*xDestroy)(void*)); /* fts3_unicode2.c (functions generated by parsing unicode text files) */ #ifndef SQLITE_DISABLE_FTS3_UNICODE @@ -171392,18 +174957,17 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int); SQLITE_EXTENSION_INIT1 #endif +typedef struct Fts3HashWrapper Fts3HashWrapper; +struct Fts3HashWrapper { + Fts3Hash hash; /* Hash table */ + int nRef; /* Number of pointers to this object */ +}; + static int fts3EvalNext(Fts3Cursor *pCsr); static int fts3EvalStart(Fts3Cursor *pCsr); static int fts3TermSegReaderCursor( Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **); -#ifndef SQLITE_AMALGAMATION -# if defined(SQLITE_DEBUG) -SQLITE_PRIVATE int sqlite3Fts3Always(int b) { assert( b ); return b; } -SQLITE_PRIVATE int sqlite3Fts3Never(int b) { assert( !b ); return b; } -# endif -#endif - /* ** This variable is set to false when running tests for which the on disk ** structures should not be corrupt. Otherwise, true. If it is false, extra @@ -172263,7 +175827,7 @@ static int fts3InitVtab( sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ char **pzErr /* Write any error message here */ ){ - Fts3Hash *pHash = (Fts3Hash *)pAux; + Fts3Hash *pHash = &((Fts3HashWrapper*)pAux)->hash; Fts3Table *p = 0; /* Pointer to allocated vtab */ int rc = SQLITE_OK; /* Return code */ int i; /* Iterator variable */ @@ -175098,9 +178662,12 @@ static const sqlite3_module fts3Module = { ** allocated for the tokenizer hash table. */ static void hashDestroy(void *p){ - Fts3Hash *pHash = (Fts3Hash *)p; - sqlite3Fts3HashClear(pHash); - sqlite3_free(pHash); + Fts3HashWrapper *pHash = (Fts3HashWrapper *)p; + pHash->nRef--; + if( pHash->nRef<=0 ){ + sqlite3Fts3HashClear(&pHash->hash); + sqlite3_free(pHash); + } } /* @@ -175130,7 +178697,7 @@ SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const */ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ int rc = SQLITE_OK; - Fts3Hash *pHash = 0; + Fts3HashWrapper *pHash = 0; const sqlite3_tokenizer_module *pSimple = 0; const sqlite3_tokenizer_module *pPorter = 0; #ifndef SQLITE_DISABLE_FTS3_UNICODE @@ -175158,23 +178725,24 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ sqlite3Fts3PorterTokenizerModule(&pPorter); /* Allocate and initialize the hash-table used to store tokenizers. */ - pHash = sqlite3_malloc(sizeof(Fts3Hash)); + pHash = sqlite3_malloc(sizeof(Fts3HashWrapper)); if( !pHash ){ rc = SQLITE_NOMEM; }else{ - sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1); + sqlite3Fts3HashInit(&pHash->hash, FTS3_HASH_STRING, 1); + pHash->nRef = 0; } /* Load the built-in tokenizers into the hash table */ if( rc==SQLITE_OK ){ - if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple) - || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter) + if( sqlite3Fts3HashInsert(&pHash->hash, "simple", 7, (void *)pSimple) + || sqlite3Fts3HashInsert(&pHash->hash, "porter", 7, (void *)pPorter) #ifndef SQLITE_DISABLE_FTS3_UNICODE - || sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode) + || sqlite3Fts3HashInsert(&pHash->hash, "unicode61", 10, (void *)pUnicode) #endif #ifdef SQLITE_ENABLE_ICU - || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu)) + || (pIcu && sqlite3Fts3HashInsert(&pHash->hash, "icu", 4, (void *)pIcu)) #endif ){ rc = SQLITE_NOMEM; @@ -175183,7 +178751,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ #ifdef SQLITE_TEST if( rc==SQLITE_OK ){ - rc = sqlite3Fts3ExprInitTestInterface(db, pHash); + rc = sqlite3Fts3ExprInitTestInterface(db, &pHash->hash); } #endif @@ -175192,23 +178760,26 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ ** module with sqlite. */ if( SQLITE_OK==rc - && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) + && SQLITE_OK==(rc=sqlite3Fts3InitHashTable(db,&pHash->hash,"fts3_tokenizer")) && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2)) && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) ){ + pHash->nRef++; rc = sqlite3_create_module_v2( db, "fts3", &fts3Module, (void *)pHash, hashDestroy ); if( rc==SQLITE_OK ){ + pHash->nRef++; rc = sqlite3_create_module_v2( - db, "fts4", &fts3Module, (void *)pHash, 0 + db, "fts4", &fts3Module, (void *)pHash, hashDestroy ); } if( rc==SQLITE_OK ){ - rc = sqlite3Fts3InitTok(db, (void *)pHash); + pHash->nRef++; + rc = sqlite3Fts3InitTok(db, (void *)pHash, hashDestroy); } return rc; } @@ -175217,7 +178788,7 @@ SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ /* An error has occurred. Delete the hash table and return the error code. */ assert( rc!=SQLITE_OK ); if( pHash ){ - sqlite3Fts3HashClear(pHash); + sqlite3Fts3HashClear(&pHash->hash); sqlite3_free(pHash); } return rc; @@ -175564,7 +179135,7 @@ SQLITE_PRIVATE void sqlite3Fts3DoclistPrev( assert( nDoclist>0 ); assert( *pbEof==0 ); - assert( p || *piDocid==0 ); + assert_fts3_nc( p || *piDocid==0 ); assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) ); if( p==0 ){ @@ -176428,8 +179999,8 @@ static void fts3EvalNextRow( Fts3Expr *pRight = pExpr->pRight; sqlite3_int64 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid); - assert( pLeft->bStart || pLeft->iDocid==pRight->iDocid ); - assert( pRight->bStart || pLeft->iDocid==pRight->iDocid ); + assert_fts3_nc( pLeft->bStart || pLeft->iDocid==pRight->iDocid ); + assert_fts3_nc( pRight->bStart || pLeft->iDocid==pRight->iDocid ); if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){ fts3EvalNextRow(pCsr, pLeft, pRc); @@ -177067,6 +180638,9 @@ SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist( if( bEofSave==0 && pNear->iDocid==iDocid ) break; } assert( rc!=SQLITE_OK || pPhrase->bIncr==0 ); + if( rc==SQLITE_OK && pNear->bEof!=bEofSave ){ + rc = FTS_CORRUPT_VTAB; + } } if( bTreeEof ){ while( rc==SQLITE_OK && !pNear->bEof ){ @@ -177489,6 +181063,7 @@ static int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){ if( fts3auxGrowStatArray(pCsr, 2) ) return SQLITE_NOMEM; memset(pCsr->aStat, 0, sizeof(struct Fts3auxColstats) * pCsr->nStat); iCol = 0; + rc = SQLITE_OK; while( iaStat[iCol+1].nDoc++; eState = 2; @@ -177540,7 +181119,6 @@ static int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){ } pCsr->iCol = 0; - rc = SQLITE_OK; }else{ pCsr->isEof = 1; } @@ -177869,7 +181447,7 @@ static int fts3isspace(char c){ ** zero the memory before returning a pointer to it. If unsuccessful, ** return NULL. */ -static void *fts3MallocZero(sqlite3_int64 nByte){ +SQLITE_PRIVATE void *sqlite3Fts3MallocZero(sqlite3_int64 nByte){ void *pRet = sqlite3_malloc64(nByte); if( pRet ) memset(pRet, 0, nByte); return pRet; @@ -177950,7 +181528,7 @@ static int getNextToken( rc = pModule->xNext(pCursor, &zToken, &nToken, &iStart, &iEnd, &iPosition); if( rc==SQLITE_OK ){ nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase) + nToken; - pRet = (Fts3Expr *)fts3MallocZero(nByte); + pRet = (Fts3Expr *)sqlite3Fts3MallocZero(nByte); if( !pRet ){ rc = SQLITE_NOMEM; }else{ @@ -178205,7 +181783,7 @@ static int getNextNode( if( fts3isspace(cNext) || cNext=='"' || cNext=='(' || cNext==')' || cNext==0 ){ - pRet = (Fts3Expr *)fts3MallocZero(sizeof(Fts3Expr)); + pRet = (Fts3Expr *)sqlite3Fts3MallocZero(sizeof(Fts3Expr)); if( !pRet ){ return SQLITE_NOMEM; } @@ -178384,7 +181962,7 @@ static int fts3ExprParse( && p->eType==FTSQUERY_PHRASE && pParse->isNot ){ /* Create an implicit NOT operator. */ - Fts3Expr *pNot = fts3MallocZero(sizeof(Fts3Expr)); + Fts3Expr *pNot = sqlite3Fts3MallocZero(sizeof(Fts3Expr)); if( !pNot ){ sqlite3Fts3ExprFree(p); rc = SQLITE_NOMEM; @@ -178418,7 +181996,7 @@ static int fts3ExprParse( /* Insert an implicit AND operator. */ Fts3Expr *pAnd; assert( pRet && pPrev ); - pAnd = fts3MallocZero(sizeof(Fts3Expr)); + pAnd = sqlite3Fts3MallocZero(sizeof(Fts3Expr)); if( !pAnd ){ sqlite3Fts3ExprFree(p); rc = SQLITE_NOMEM; @@ -181274,7 +184852,7 @@ static int fts3tokRowidMethod( ** Register the fts3tok module with database connection db. Return SQLITE_OK ** if successful or an error code if sqlite3_create_module() fails. */ -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){ +SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash, void(*xDestroy)(void*)){ static const sqlite3_module fts3tok_module = { 0, /* iVersion */ fts3tokConnectMethod, /* xCreate */ @@ -181303,7 +184881,9 @@ SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){ }; int rc; /* Return code */ - rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash); + rc = sqlite3_create_module_v2( + db, "fts3tokenize", &fts3tok_module, (void*)pHash, xDestroy + ); return rc; } @@ -182648,8 +186228,18 @@ static int fts3SegReaderNext( char *aCopy; PendingList *pList = (PendingList *)fts3HashData(pElem); int nCopy = pList->nData+1; - pReader->zTerm = (char *)fts3HashKey(pElem); - pReader->nTerm = fts3HashKeysize(pElem); + + int nTerm = fts3HashKeysize(pElem); + if( (nTerm+1)>pReader->nTermAlloc ){ + sqlite3_free(pReader->zTerm); + pReader->zTerm = (char*)sqlite3_malloc((nTerm+1)*2); + if( !pReader->zTerm ) return SQLITE_NOMEM; + pReader->nTermAlloc = (nTerm+1)*2; + } + memcpy(pReader->zTerm, fts3HashKey(pElem), nTerm); + pReader->zTerm[nTerm] = '\0'; + pReader->nTerm = nTerm; + aCopy = (char*)sqlite3_malloc(nCopy); if( !aCopy ) return SQLITE_NOMEM; memcpy(aCopy, pList->aData, nCopy); @@ -182902,9 +186492,7 @@ SQLITE_PRIVATE int sqlite3Fts3MsrOvfl( */ SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *pReader){ if( pReader ){ - if( !fts3SegReaderIsPending(pReader) ){ - sqlite3_free(pReader->zTerm); - } + sqlite3_free(pReader->zTerm); if( !fts3SegReaderIsRootOnly(pReader) ){ sqlite3_free(pReader->aNode); } @@ -185096,7 +188684,7 @@ static int nodeReaderNext(NodeReader *p){ return FTS_CORRUPT_VTAB; } blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc); - if( rc==SQLITE_OK ){ + if( rc==SQLITE_OK && ALWAYS(p->term.a!=0) ){ memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix); p->term.n = nPrefix+nSuffix; p->iOff += nSuffix; @@ -185490,7 +189078,11 @@ static int fts3TermCmp( int nCmp = MIN(nLhs, nRhs); int res; - res = (nCmp ? memcmp(zLhs, zRhs, nCmp) : 0); + if( nCmp && ALWAYS(zLhs) && ALWAYS(zRhs) ){ + res = memcmp(zLhs, zRhs, nCmp); + }else{ + res = 0; + } if( res==0 ) res = nLhs - nRhs; return res; @@ -186134,7 +189726,7 @@ static int fts3IncrmergeHintLoad(Fts3Table *p, Blob *pHint){ if( aHint ){ blobGrowBuffer(pHint, nHint, &rc); if( rc==SQLITE_OK ){ - memcpy(pHint->a, aHint, nHint); + if( ALWAYS(pHint->a!=0) ) memcpy(pHint->a, aHint, nHint); pHint->n = nHint; } } @@ -187251,9 +190843,8 @@ static MatchinfoBuffer *fts3MIBufferNew(size_t nElem, const char *zMatchinfo){ + sizeof(MatchinfoBuffer); sqlite3_int64 nStr = strlen(zMatchinfo); - pRet = sqlite3_malloc64(nByte + nStr+1); + pRet = sqlite3Fts3MallocZero(nByte + nStr+1); if( pRet ){ - memset(pRet, 0, nByte); pRet->aMatchinfo[0] = (u8*)(&pRet->aMatchinfo[1]) - (u8*)pRet; pRet->aMatchinfo[1+nElem] = pRet->aMatchinfo[0] + sizeof(u32)*((int)nElem+1); @@ -187657,11 +191248,10 @@ static int fts3BestSnippet( ** the required space using malloc(). */ nByte = sizeof(SnippetPhrase) * nList; - sIter.aPhrase = (SnippetPhrase *)sqlite3_malloc64(nByte); + sIter.aPhrase = (SnippetPhrase *)sqlite3Fts3MallocZero(nByte); if( !sIter.aPhrase ){ return SQLITE_NOMEM; } - memset(sIter.aPhrase, 0, nByte); /* Initialize the contents of the SnippetIter object. Then iterate through ** the set of phrases in the expression to populate the aPhrase[] array. @@ -188225,10 +191815,12 @@ static int fts3MatchinfoLcsCb( ** position list for the next column. */ static int fts3LcsIteratorAdvance(LcsIterator *pIter){ - char *pRead = pIter->pRead; + char *pRead; sqlite3_int64 iRead; int rc = 0; + if( NEVER(pIter==0) ) return 1; + pRead = pIter->pRead; pRead += sqlite3Fts3GetVarint(pRead, &iRead); if( iRead==0 || iRead==1 ){ pRead = 0; @@ -188262,9 +191854,8 @@ static int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){ /* Allocate and populate the array of LcsIterator objects. The array ** contains one element for each matchable phrase in the query. **/ - aIter = sqlite3_malloc64(sizeof(LcsIterator) * pCsr->nPhrase); + aIter = sqlite3Fts3MallocZero(sizeof(LcsIterator) * pCsr->nPhrase); if( !aIter ) return SQLITE_NOMEM; - memset(aIter, 0, sizeof(LcsIterator) * pCsr->nPhrase); (void)fts3ExprIterate(pCsr->pExpr, fts3MatchinfoLcsCb, (void*)aIter); for(i=0; inPhrase; i++){ @@ -188725,7 +192316,7 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( if( rc!=SQLITE_OK ) goto offsets_out; /* Allocate the array of TermOffset iterators. */ - sCtx.aTerm = (TermOffset *)sqlite3_malloc64(sizeof(TermOffset)*nToken); + sCtx.aTerm = (TermOffset *)sqlite3Fts3MallocZero(sizeof(TermOffset)*nToken); if( 0==sCtx.aTerm ){ rc = SQLITE_NOMEM; goto offsets_out; @@ -188746,13 +192337,13 @@ SQLITE_PRIVATE void sqlite3Fts3Offsets( const char *zDoc; int nDoc; - /* Initialize the contents of sCtx.aTerm[] for column iCol. There is - ** no way that this operation can fail, so the return code from - ** fts3ExprIterate() can be discarded. + /* Initialize the contents of sCtx.aTerm[] for column iCol. This + ** operation may fail if the database contains corrupt records. */ sCtx.iCol = iCol; sCtx.iTerm = 0; - (void)fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void*)&sCtx); + rc = fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void*)&sCtx); + if( rc!=SQLITE_OK ) goto offsets_out; /* Retreive the text stored in column iCol. If an SQL NULL is stored ** in column iCol, jump immediately to the next iteration of the loop. @@ -189651,7 +193242,7 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ #endif /* !defined(SQLITE_DISABLE_FTS3_UNICODE) */ /************** End of fts3_unicode2.c ***************************************/ -/************** Begin file json1.c *******************************************/ +/************** Begin file json.c ********************************************/ /* ** 2015-08-12 ** @@ -189664,10 +193255,10 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ ** ****************************************************************************** ** -** This SQLite extension implements JSON functions. The interface is -** modeled after MySQL JSON functions: +** This SQLite JSON functions. ** -** https://dev.mysql.com/doc/refman/5.7/en/json.html +** This file began as an extension in ext/misc/json1.c in 2015. That +** extension proved so useful that it has now been moved into the core. ** ** For the time being, all JSON is stored as pure text. (We might add ** a JSONB type in the future which stores a binary encoding of JSON in @@ -189675,48 +193266,8 @@ SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int eRemoveDiacritic){ ** This implementation parses JSON text at 250 MB/s, so it is hard to see ** how JSONB might improve on that.) */ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_JSON1) -#if !defined(SQLITEINT_H) -/* #include "sqlite3ext.h" */ -#endif -SQLITE_EXTENSION_INIT1 -/* #include */ -/* #include */ -/* #include */ -/* #include */ - -/* Mark a function parameter as unused, to suppress nuisance compiler -** warnings. */ -#ifndef UNUSED_PARAM -# define UNUSED_PARAM(X) (void)(X) -#endif - -#ifndef LARGEST_INT64 -# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32)) -# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64) -#endif - -#ifndef deliberate_fall_through -# define deliberate_fall_through -#endif - -/* -** Versions of isspace(), isalnum() and isdigit() to which it is safe -** to pass signed char values. -*/ -#ifdef sqlite3Isdigit - /* Use the SQLite core versions if this routine is part of the - ** SQLite amalgamation */ -# define safe_isdigit(x) sqlite3Isdigit(x) -# define safe_isalnum(x) sqlite3Isalnum(x) -# define safe_isxdigit(x) sqlite3Isxdigit(x) -#else - /* Use the standard library for separate compilation */ -#include /* amalgamator: keep */ -# define safe_isdigit(x) isdigit((unsigned char)(x)) -# define safe_isalnum(x) isalnum((unsigned char)(x)) -# define safe_isxdigit(x) isxdigit((unsigned char)(x)) -#endif +#ifndef SQLITE_OMIT_JSON +/* #include "sqliteInt.h" */ /* ** Growing our own isspace() routine this way is twice as fast as @@ -189741,15 +193292,12 @@ static const char jsonIsSpace[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -#define safe_isspace(x) (jsonIsSpace[(unsigned char)x]) +#define fast_isspace(x) (jsonIsSpace[(unsigned char)x]) -#ifndef SQLITE_AMALGAMATION - /* Unsigned integer types. These are already defined in the sqliteInt.h, - ** but the definitions need to be repeated for separate compilation. */ - typedef sqlite3_uint64 u64; - typedef unsigned int u32; - typedef unsigned short int u16; - typedef unsigned char u8; +#if !defined(SQLITE_DEBUG) && !defined(SQLITE_COVERAGE_TEST) +# define VVA(X) +#else +# define VVA(X) X #endif /* Objects */ @@ -189808,13 +193356,14 @@ static const char * const jsonType[] = { struct JsonNode { u8 eType; /* One of the JSON_ type values */ u8 jnFlags; /* JNODE flags */ + u8 eU; /* Which union element to use */ u32 n; /* Bytes of content, or number of sub-nodes */ union { - const char *zJContent; /* Content for INT, REAL, and STRING */ - u32 iAppend; /* More terms for ARRAY and OBJECT */ - u32 iKey; /* Key for ARRAY objects in json_tree() */ - u32 iReplace; /* Replacement content for JNODE_REPLACE */ - JsonNode *pPatch; /* Node chain of patch for JNODE_PATCH */ + const char *zJContent; /* 1: Content for INT, REAL, and STRING */ + u32 iAppend; /* 2: More terms for ARRAY and OBJECT */ + u32 iKey; /* 3: Key for ARRAY objects in json_tree() */ + u32 iReplace; /* 4: Replacement content for JNODE_REPLACE */ + JsonNode *pPatch; /* 5: Node chain of patch for JNODE_PATCH */ } u; }; @@ -190092,11 +193641,14 @@ static void jsonRenderNode( JsonString *pOut, /* Write JSON here */ sqlite3_value **aReplace /* Replacement values */ ){ + assert( pNode!=0 ); if( pNode->jnFlags & (JNODE_REPLACE|JNODE_PATCH) ){ - if( pNode->jnFlags & JNODE_REPLACE ){ + if( (pNode->jnFlags & JNODE_REPLACE)!=0 && ALWAYS(aReplace!=0) ){ + assert( pNode->eU==4 ); jsonAppendValue(pOut, aReplace[pNode->u.iReplace]); return; } + assert( pNode->eU==5 ); pNode = pNode->u.pPatch; } switch( pNode->eType ){ @@ -190115,6 +193667,7 @@ static void jsonRenderNode( } case JSON_STRING: { if( pNode->jnFlags & JNODE_RAW ){ + assert( pNode->eU==1 ); jsonAppendString(pOut, pNode->u.zJContent, pNode->n); break; } @@ -190122,6 +193675,7 @@ static void jsonRenderNode( } case JSON_REAL: case JSON_INT: { + assert( pNode->eU==1 ); jsonAppendRaw(pOut, pNode->u.zJContent, pNode->n); break; } @@ -190137,6 +193691,7 @@ static void jsonRenderNode( j += jsonNodeSize(&pNode[j]); } if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; + assert( pNode->eU==2 ); pNode = &pNode[pNode->u.iAppend]; j = 1; } @@ -190157,6 +193712,7 @@ static void jsonRenderNode( j += 1 + jsonNodeSize(&pNode[j+1]); } if( (pNode->jnFlags & JNODE_APPEND)==0 ) break; + assert( pNode->eU==2 ); pNode = &pNode[pNode->u.iAppend]; j = 1; } @@ -190201,10 +193757,10 @@ static u8 jsonHexToInt(int h){ */ static u32 jsonHexToInt4(const char *z){ u32 v; - assert( safe_isxdigit(z[0]) ); - assert( safe_isxdigit(z[1]) ); - assert( safe_isxdigit(z[2]) ); - assert( safe_isxdigit(z[3]) ); + assert( sqlite3Isxdigit(z[0]) ); + assert( sqlite3Isxdigit(z[1]) ); + assert( sqlite3Isxdigit(z[2]) ); + assert( sqlite3Isxdigit(z[3]) ); v = (jsonHexToInt(z[0])<<12) + (jsonHexToInt(z[1])<<8) + (jsonHexToInt(z[2])<<4) @@ -190236,7 +193792,9 @@ static void jsonReturn( } case JSON_INT: { sqlite3_int64 i = 0; - const char *z = pNode->u.zJContent; + const char *z; + assert( pNode->eU==1 ); + z = pNode->u.zJContent; if( z[0]=='-' ){ z++; } while( z[0]>='0' && z[0]<='9' ){ unsigned v = *(z++) - '0'; @@ -190259,14 +193817,17 @@ static void jsonReturn( sqlite3_result_int64(pCtx, i); int_done: break; - int_as_real: i=0; /* no break */ deliberate_fall_through + int_as_real: ; /* no break */ deliberate_fall_through } case JSON_REAL: { double r; #ifdef SQLITE_AMALGAMATION - const char *z = pNode->u.zJContent; + const char *z; + assert( pNode->eU==1 ); + z = pNode->u.zJContent; sqlite3AtoF(z, &r, sqlite3Strlen30(z), SQLITE_UTF8); #else + assert( pNode->eU==1 ); r = strtod(pNode->u.zJContent, 0); #endif sqlite3_result_double(pCtx, r); @@ -190277,6 +193838,7 @@ static void jsonReturn( ** json_insert() and json_replace() and those routines do not ** call jsonReturn() */ if( pNode->jnFlags & JNODE_RAW ){ + assert( pNode->eU==1 ); sqlite3_result_text(pCtx, pNode->u.zJContent, pNode->n, SQLITE_TRANSIENT); }else @@ -190284,15 +193846,18 @@ static void jsonReturn( assert( (pNode->jnFlags & JNODE_RAW)==0 ); if( (pNode->jnFlags & JNODE_ESCAPE)==0 ){ /* JSON formatted without any backslash-escapes */ + assert( pNode->eU==1 ); sqlite3_result_text(pCtx, pNode->u.zJContent+1, pNode->n-2, SQLITE_TRANSIENT); }else{ /* Translate JSON formatted string into raw text */ u32 i; u32 n = pNode->n; - const char *z = pNode->u.zJContent; + const char *z; char *zOut; u32 j; + assert( pNode->eU==1 ); + z = pNode->u.zJContent; zOut = sqlite3_malloc( n+1 ); if( zOut==0 ){ sqlite3_result_error_nomem(pCtx); @@ -190413,12 +193978,13 @@ static int jsonParseAddNode( const char *zContent /* Content */ ){ JsonNode *p; - if( pParse->nNode>=pParse->nAlloc ){ + if( pParse->aNode==0 || pParse->nNode>=pParse->nAlloc ){ return jsonParseAddNodeExpand(pParse, eType, n, zContent); } p = &pParse->aNode[pParse->nNode]; p->eType = (u8)eType; p->jnFlags = 0; + VVA( p->eU = zContent ? 1 : 0 ); p->n = n; p->u.zJContent = zContent; return pParse->nNode++; @@ -190429,7 +193995,7 @@ static int jsonParseAddNode( */ static int jsonIs4Hex(const char *z){ int i; - for(i=0; i<4; i++) if( !safe_isxdigit(z[i]) ) return 0; + for(i=0; i<4; i++) if( !sqlite3Isxdigit(z[i]) ) return 0; return 1; } @@ -190448,13 +194014,13 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ int x; JsonNode *pNode; const char *z = pParse->zJson; - while( safe_isspace(z[i]) ){ i++; } + while( fast_isspace(z[i]) ){ i++; } if( (c = z[i])=='{' ){ /* Parse object */ iThis = jsonParseAddNode(pParse, JSON_OBJECT, 0, 0); if( iThis<0 ) return -1; for(j=i+1;;j++){ - while( safe_isspace(z[j]) ){ j++; } + while( fast_isspace(z[j]) ){ j++; } if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1; x = jsonParseValue(pParse, j); if( x<0 ){ @@ -190467,14 +194033,14 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ if( pNode->eType!=JSON_STRING ) return -1; pNode->jnFlags |= JNODE_LABEL; j = x; - while( safe_isspace(z[j]) ){ j++; } + while( fast_isspace(z[j]) ){ j++; } if( z[j]!=':' ) return -1; j++; x = jsonParseValue(pParse, j); pParse->iDepth--; if( x<0 ) return -1; j = x; - while( safe_isspace(z[j]) ){ j++; } + while( fast_isspace(z[j]) ){ j++; } c = z[j]; if( c==',' ) continue; if( c!='}' ) return -1; @@ -190486,8 +194052,9 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ /* Parse array */ iThis = jsonParseAddNode(pParse, JSON_ARRAY, 0, 0); if( iThis<0 ) return -1; + memset(&pParse->aNode[iThis].u, 0, sizeof(pParse->aNode[iThis].u)); for(j=i+1;;j++){ - while( safe_isspace(z[j]) ){ j++; } + while( fast_isspace(z[j]) ){ j++; } if( ++pParse->iDepth > JSON_MAX_DEPTH ) return -1; x = jsonParseValue(pParse, j); pParse->iDepth--; @@ -190496,7 +194063,7 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ return -1; } j = x; - while( safe_isspace(z[j]) ){ j++; } + while( fast_isspace(z[j]) ){ j++; } c = z[j]; if( c==',' ) continue; if( c!=']' ) return -1; @@ -190533,17 +194100,17 @@ static int jsonParseValue(JsonParse *pParse, u32 i){ return j+1; }else if( c=='n' && strncmp(z+i,"null",4)==0 - && !safe_isalnum(z[i+4]) ){ + && !sqlite3Isalnum(z[i+4]) ){ jsonParseAddNode(pParse, JSON_NULL, 0, 0); return i+4; }else if( c=='t' && strncmp(z+i,"true",4)==0 - && !safe_isalnum(z[i+4]) ){ + && !sqlite3Isalnum(z[i+4]) ){ jsonParseAddNode(pParse, JSON_TRUE, 0, 0); return i+4; }else if( c=='f' && strncmp(z+i,"false",5)==0 - && !safe_isalnum(z[i+5]) ){ + && !sqlite3Isalnum(z[i+5]) ){ jsonParseAddNode(pParse, JSON_FALSE, 0, 0); return i+5; }else if( c=='-' || (c>='0' && c<='9') ){ @@ -190614,7 +194181,7 @@ static int jsonParse( if( pParse->oom ) i = -1; if( i>0 ){ assert( pParse->iDepth==0 ); - while( safe_isspace(zJson[i]) ) i++; + while( fast_isspace(zJson[i]) ) i++; if( zJson[i] ) i = -1; } if( i<=0 ){ @@ -190750,6 +194317,7 @@ static JsonParse *jsonParseCached( ** a match. */ static int jsonLabelCompare(JsonNode *pNode, const char *zKey, u32 nKey){ + assert( pNode->eU==1 ); if( pNode->jnFlags & JNODE_RAW ){ if( pNode->n!=nKey ) return 0; return strncmp(pNode->u.zJContent, zKey, nKey)==0; @@ -190796,14 +194364,15 @@ static JsonNode *jsonLookupStep( *pzErr = zPath; return 0; } + testcase( nKey==0 ); }else{ zKey = zPath; for(i=0; zPath[i] && zPath[i]!='.' && zPath[i]!='['; i++){} nKey = i; - } - if( nKey==0 ){ - *pzErr = zPath; - return 0; + if( nKey==0 ){ + *pzErr = zPath; + return 0; + } } j = 1; for(;;){ @@ -190815,6 +194384,7 @@ static JsonNode *jsonLookupStep( j += jsonNodeSize(&pRoot[j]); } if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break; + assert( pRoot->eU==2 ); iRoot += pRoot->u.iAppend; pRoot = &pParse->aNode[iRoot]; j = 1; @@ -190829,8 +194399,10 @@ static JsonNode *jsonLookupStep( if( pParse->oom ) return 0; if( pNode ){ pRoot = &pParse->aNode[iRoot]; + assert( pRoot->eU==0 ); pRoot->u.iAppend = iStart - iRoot; pRoot->jnFlags |= JNODE_APPEND; + VVA( pRoot->eU = 2 ); pParse->aNode[iLabel].jnFlags |= JNODE_RAW; } return pNode; @@ -190838,7 +194410,7 @@ static JsonNode *jsonLookupStep( }else if( zPath[0]=='[' ){ i = 0; j = 1; - while( safe_isdigit(zPath[j]) ){ + while( sqlite3Isdigit(zPath[j]) ){ i = i*10 + zPath[j] - '0'; j++; } @@ -190853,18 +194425,19 @@ static JsonNode *jsonLookupStep( j += jsonNodeSize(&pBase[j]); } if( (pBase->jnFlags & JNODE_APPEND)==0 ) break; + assert( pBase->eU==2 ); iBase += pBase->u.iAppend; pBase = &pParse->aNode[iBase]; j = 1; } j = 2; - if( zPath[2]=='-' && safe_isdigit(zPath[3]) ){ + if( zPath[2]=='-' && sqlite3Isdigit(zPath[3]) ){ unsigned int x = 0; j = 3; do{ x = x*10 + zPath[j] - '0'; j++; - }while( safe_isdigit(zPath[j]) ); + }while( sqlite3Isdigit(zPath[j]) ); if( x>i ) return 0; i -= x; } @@ -190886,6 +194459,7 @@ static JsonNode *jsonLookupStep( j += jsonNodeSize(&pRoot[j]); } if( (pRoot->jnFlags & JNODE_APPEND)==0 ) break; + assert( pRoot->eU==2 ); iRoot += pRoot->u.iAppend; pRoot = &pParse->aNode[iRoot]; j = 1; @@ -190901,8 +194475,10 @@ static JsonNode *jsonLookupStep( if( pParse->oom ) return 0; if( pNode ){ pRoot = &pParse->aNode[iRoot]; + assert( pRoot->eU==0 ); pRoot->u.iAppend = iStart - iRoot; pRoot->jnFlags |= JNODE_APPEND; + VVA( pRoot->eU = 2 ); } return pNode; } @@ -191056,9 +194632,13 @@ static void jsonParseFunc( } jsonPrintf(100, &s,"node %3u: %7s n=%-4d up=%-4d", i, zType, x.aNode[i].n, x.aUp[i]); + assert( x.aNode[i].eU==0 || x.aNode[i].eU==1 ); if( x.aNode[i].u.zJContent!=0 ){ + assert( x.aNode[i].eU==1 ); jsonAppendRaw(&s, " ", 1); jsonAppendRaw(&s, x.aNode[i].u.zJContent, x.aNode[i].n); + }else{ + assert( x.aNode[i].eU==0 ); } jsonAppendRaw(&s, "\n", 1); } @@ -191076,7 +194656,7 @@ static void jsonTest1Func( int argc, sqlite3_value **argv ){ - UNUSED_PARAM(argc); + UNUSED_PARAMETER(argc); sqlite3_result_int(ctx, sqlite3_value_subtype(argv[0])==JSON_SUBTYPE); } #endif /* SQLITE_DEBUG */ @@ -191097,7 +194677,7 @@ static void jsonQuoteFunc( sqlite3_value **argv ){ JsonString jx; - UNUSED_PARAM(argc); + UNUSED_PARAMETER(argc); jsonInit(&jx, ctx); jsonAppendValue(&jx, argv[0]); @@ -191168,13 +194748,34 @@ static void jsonArrayLengthFunc( sqlite3_result_int64(ctx, n); } +/* +** Bit values for the flags passed into jsonExtractFunc() or +** jsonSetFunc() via the user-data value. +*/ +#define JSON_JSON 0x01 /* Result is always JSON */ +#define JSON_SQL 0x02 /* Result is always SQL */ +#define JSON_ABPATH 0x03 /* Allow abbreviated JSON path specs */ +#define JSON_ISSET 0x04 /* json_set(), not json_insert() */ + /* ** json_extract(JSON, PATH, ...) +** "->"(JSON,PATH) +** "->>"(JSON,PATH) +** +** Return the element described by PATH. Return NULL if that PATH element +** is not found. +** +** If JSON_JSON is set or if more that one PATH argument is supplied then +** always return a JSON representation of the result. If JSON_SQL is set, +** then always return an SQL representation of the result. If neither flag +** is present and argc==2, then return JSON for objects and arrays and SQL +** for all other values. +** +** When multiple PATH arguments are supplied, the result is a JSON array +** containing the result of each PATH. ** -** Return the element described by PATH. Return NULL if there is no -** PATH element. If there are multiple PATHs, then return a JSON array -** with the result from each path. Throw an error if the JSON or any PATH -** is malformed. +** Abbreviated JSON path expressions are allows if JSON_ABPATH, for +** compatibility with PG. */ static void jsonExtractFunc( sqlite3_context *ctx, @@ -191184,35 +194785,77 @@ static void jsonExtractFunc( JsonParse *p; /* The parse */ JsonNode *pNode; const char *zPath; + int flags = SQLITE_PTR_TO_INT(sqlite3_user_data(ctx)); JsonString jx; - int i; if( argc<2 ) return; p = jsonParseCached(ctx, argv, ctx); if( p==0 ) return; - jsonInit(&jx, ctx); - jsonAppendChar(&jx, '['); - for(i=1; inErr ) break; - if( argc>2 ){ + if( argc==2 ){ + /* With a single PATH argument */ + zPath = (const char*)sqlite3_value_text(argv[1]); + if( zPath==0 ) return; + if( flags & JSON_ABPATH ){ + if( zPath[0]!='$' ){ + /* The -> and ->> operators accept abbreviated PATH arguments. This + ** is mostly for compatibility with PostgreSQL, but also for + ** convenience. + ** + ** NUMBER ==> $[NUMBER] // PG compatible + ** LABEL ==> $.LABEL // PG compatible + ** [NUMBER] ==> $[NUMBER] // Not PG. Purely for convenience + */ + jsonInit(&jx, ctx); + if( sqlite3Isdigit(zPath[0]) ){ + jsonAppendRaw(&jx, "$[", 2); + jsonAppendRaw(&jx, zPath, (int)strlen(zPath)); + jsonAppendRaw(&jx, "]", 2); + }else{ + jsonAppendRaw(&jx, "$.", 1 + (zPath[0]!='[')); + jsonAppendRaw(&jx, zPath, (int)strlen(zPath)); + jsonAppendChar(&jx, 0); + } + pNode = jx.bErr ? 0 : jsonLookup(p, jx.zBuf, 0, ctx); + jsonReset(&jx); + }else{ + pNode = jsonLookup(p, zPath, 0, ctx); + } + if( pNode ){ + if( flags & JSON_JSON ){ + jsonReturnJson(pNode, ctx, 0); + }else{ + jsonReturn(pNode, ctx, 0); + sqlite3_result_subtype(ctx, 0); + } + } + }else{ + pNode = jsonLookup(p, zPath, 0, ctx); + if( p->nErr==0 && pNode ) jsonReturn(pNode, ctx, 0); + } + }else{ + /* Two or more PATH arguments results in a JSON array with each + ** element of the array being the value selected by one of the PATHs */ + int i; + jsonInit(&jx, ctx); + jsonAppendChar(&jx, '['); + for(i=1; inErr ) break; jsonAppendSeparator(&jx); if( pNode ){ jsonRenderNode(pNode, &jx, 0); }else{ jsonAppendRaw(&jx, "null", 4); } - }else if( pNode ){ - jsonReturn(pNode, ctx, 0); } + if( i==argc ){ + jsonAppendChar(&jx, ']'); + jsonResult(&jx); + sqlite3_result_subtype(ctx, JSON_SUBTYPE); + } + jsonReset(&jx); } - if( argc>2 && i==argc ){ - jsonAppendChar(&jx, ']'); - jsonResult(&jx); - sqlite3_result_subtype(ctx, JSON_SUBTYPE); - } - jsonReset(&jx); } /* This is the RFC 7396 MergePatch algorithm. @@ -191241,6 +194884,7 @@ static JsonNode *jsonMergePatch( const char *zKey; assert( pPatch[i].eType==JSON_STRING ); assert( pPatch[i].jnFlags & JNODE_LABEL ); + assert( pPatch[i].eU==1 ); nKey = pPatch[i].n; zKey = pPatch[i].u.zJContent; assert( (pPatch[i].jnFlags & JNODE_RAW)==0 ); @@ -191257,6 +194901,12 @@ static JsonNode *jsonMergePatch( if( pNew==0 ) return 0; pTarget = &pParse->aNode[iTarget]; if( pNew!=&pTarget[j+1] ){ + assert( pTarget[j+1].eU==0 + || pTarget[j+1].eU==1 + || pTarget[j+1].eU==2 ); + testcase( pTarget[j+1].eU==1 ); + testcase( pTarget[j+1].eU==2 ); + VVA( pTarget[j+1].eU = 5 ); pTarget[j+1].u.pPatch = pNew; pTarget[j+1].jnFlags |= JNODE_PATCH; } @@ -191272,9 +194922,14 @@ static JsonNode *jsonMergePatch( if( pParse->oom ) return 0; jsonRemoveAllNulls(pPatch); pTarget = &pParse->aNode[iTarget]; + assert( pParse->aNode[iRoot].eU==0 || pParse->aNode[iRoot].eU==2 ); + testcase( pParse->aNode[iRoot].eU==2 ); pParse->aNode[iRoot].jnFlags |= JNODE_APPEND; + VVA( pParse->aNode[iRoot].eU = 2 ); pParse->aNode[iRoot].u.iAppend = iStart - iRoot; iRoot = iStart; + assert( pParse->aNode[iPatch].eU==0 ); + VVA( pParse->aNode[iPatch].eU = 5 ); pParse->aNode[iPatch].jnFlags |= JNODE_PATCH; pParse->aNode[iPatch].u.pPatch = &pPatch[i+1]; } @@ -191296,7 +194951,7 @@ static void jsonPatchFunc( JsonParse y; /* The patch */ JsonNode *pResult; /* The result of the merge */ - UNUSED_PARAM(argc); + UNUSED_PARAMETER(argc); if( jsonParse(&x, ctx, (const char*)sqlite3_value_text(argv[0])) ) return; if( jsonParse(&y, ctx, (const char*)sqlite3_value_text(argv[1])) ){ jsonParseReset(&x); @@ -191416,11 +195071,15 @@ static void jsonReplaceFunc( pNode = jsonLookup(&x, zPath, 0, ctx); if( x.nErr ) goto replace_err; if( pNode ){ + assert( pNode->eU==0 || pNode->eU==1 || pNode->eU==4 ); + testcase( pNode->eU!=0 && pNode->eU!=1 ); pNode->jnFlags |= (u8)JNODE_REPLACE; + VVA( pNode->eU = 4 ); pNode->u.iReplace = i + 1; } } if( x.aNode[0].jnFlags & JNODE_REPLACE ){ + assert( x.aNode[0].eU==4 ); sqlite3_result_value(ctx, argv[x.aNode[0].u.iReplace]); }else{ jsonReturnJson(x.aNode, ctx, argv); @@ -191429,6 +195088,7 @@ replace_err: jsonParseReset(&x); } + /* ** json_set(JSON, PATH, VALUE, ...) ** @@ -191451,7 +195111,7 @@ static void jsonSetFunc( const char *zPath; u32 i; int bApnd; - int bIsSet = *(int*)sqlite3_user_data(ctx); + int bIsSet = sqlite3_user_data(ctx)!=0; if( argc<1 ) return; if( (argc&1)==0 ) { @@ -191470,11 +195130,15 @@ static void jsonSetFunc( }else if( x.nErr ){ goto jsonSetDone; }else if( pNode && (bApnd || bIsSet) ){ + testcase( pNode->eU!=0 && pNode->eU!=1 ); + assert( pNode->eU!=3 && pNode->eU!=5 ); + VVA( pNode->eU = 4 ); pNode->jnFlags |= (u8)JNODE_REPLACE; pNode->u.iReplace = i + 1; } } if( x.aNode[0].jnFlags & JNODE_REPLACE ){ + assert( x.aNode[0].eU==4 ); sqlite3_result_value(ctx, argv[x.aNode[0].u.iReplace]); }else{ jsonReturnJson(x.aNode, ctx, argv); @@ -191487,8 +195151,8 @@ jsonSetDone: ** json_type(JSON) ** json_type(JSON, PATH) ** -** Return the top-level "type" of a JSON string. Throw an error if -** either the JSON or PATH inputs are not well-formed. +** Return the top-level "type" of a JSON string. json_type() raises an +** error if either the JSON or PATH inputs are not well-formed. */ static void jsonTypeFunc( sqlite3_context *ctx, @@ -191524,7 +195188,7 @@ static void jsonValidFunc( sqlite3_value **argv ){ JsonParse *p; /* The parse */ - UNUSED_PARAM(argc); + UNUSED_PARAMETER(argc); p = jsonParseCached(ctx, argv, 0); sqlite3_result_int(ctx, p!=0); } @@ -191544,7 +195208,7 @@ static void jsonArrayStep( sqlite3_value **argv ){ JsonString *pStr; - UNUSED_PARAM(argc); + UNUSED_PARAMETER(argc); pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); if( pStr ){ if( pStr->zBuf==0 ){ @@ -191604,8 +195268,8 @@ static void jsonGroupInverse( char *z; char c; JsonString *pStr; - UNUSED_PARAM(argc); - UNUSED_PARAM(argv); + UNUSED_PARAMETER(argc); + UNUSED_PARAMETER(argv); pStr = (JsonString*)sqlite3_aggregate_context(ctx, 0); #ifdef NEVER /* pStr is always non-NULL since jsonArrayStep() or jsonObjectStep() will @@ -191649,7 +195313,7 @@ static void jsonObjectStep( JsonString *pStr; const char *z; u32 n; - UNUSED_PARAM(argc); + UNUSED_PARAMETER(argc); pStr = (JsonString*)sqlite3_aggregate_context(ctx, sizeof(*pStr)); if( pStr ){ if( pStr->zBuf==0 ){ @@ -191740,10 +195404,10 @@ static int jsonEachConnect( #define JEACH_JSON 8 #define JEACH_ROOT 9 - UNUSED_PARAM(pzErr); - UNUSED_PARAM(argv); - UNUSED_PARAM(argc); - UNUSED_PARAM(pAux); + UNUSED_PARAMETER(pzErr); + UNUSED_PARAMETER(argv); + UNUSED_PARAMETER(argc); + UNUSED_PARAMETER(pAux); rc = sqlite3_declare_vtab(db, "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path," "json HIDDEN,root HIDDEN)"); @@ -191766,7 +195430,7 @@ static int jsonEachDisconnect(sqlite3_vtab *pVtab){ static int jsonEachOpenEach(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ JsonEachCursor *pCur; - UNUSED_PARAM(p); + UNUSED_PARAMETER(p); pCur = sqlite3_malloc( sizeof(*pCur) ); if( pCur==0 ) return SQLITE_NOMEM; memset(pCur, 0, sizeof(*pCur)); @@ -191825,6 +195489,9 @@ static int jsonEachNext(sqlite3_vtab_cursor *cur){ JsonNode *pUp = &p->sParse.aNode[iUp]; p->eType = pUp->eType; if( pUp->eType==JSON_ARRAY ){ + assert( pUp->eU==0 || pUp->eU==3 ); + testcase( pUp->eU==3 ); + VVA( pUp->eU = 3 ); if( iUp==p->i-1 ){ pUp->u.iKey = 0; }else{ @@ -191853,6 +195520,33 @@ static int jsonEachNext(sqlite3_vtab_cursor *cur){ return SQLITE_OK; } +/* Append an object label to the JSON Path being constructed +** in pStr. +*/ +static void jsonAppendObjectPathElement( + JsonString *pStr, + JsonNode *pNode +){ + int jj, nn; + const char *z; + assert( pNode->eType==JSON_STRING ); + assert( pNode->jnFlags & JNODE_LABEL ); + assert( pNode->eU==1 ); + z = pNode->u.zJContent; + nn = pNode->n; + assert( nn>=2 ); + assert( z[0]=='"' ); + assert( z[nn-1]=='"' ); + if( nn>2 && sqlite3Isalpha(z[1]) ){ + for(jj=2; jjsParse.aNode[i]; pUp = &p->sParse.aNode[iUp]; if( pUp->eType==JSON_ARRAY ){ + assert( pUp->eU==3 || (pUp->eU==0 && pUp->u.iKey==0) ); + testcase( pUp->eU==0 ); jsonPrintf(30, pStr, "[%d]", pUp->u.iKey); }else{ assert( pUp->eType==JSON_OBJECT ); if( (pNode->jnFlags & JNODE_LABEL)==0 ) pNode--; - assert( pNode->eType==JSON_STRING ); - assert( pNode->jnFlags & JNODE_LABEL ); - jsonPrintf(pNode->n+1, pStr, ".%.*s", pNode->n-2, pNode->u.zJContent+1); + jsonAppendObjectPathElement(pStr, pNode); } } @@ -191898,6 +195592,7 @@ static int jsonEachColumn( u32 iKey; if( p->bRecursive ){ if( p->iRowid==0 ) break; + assert( p->sParse.aNode[p->sParse.aUp[p->i]].eU==3 ); iKey = p->sParse.aNode[p->sParse.aUp[p->i]].u.iKey; }else{ iKey = p->iRowid; @@ -191947,7 +195642,7 @@ static int jsonEachColumn( if( p->eType==JSON_ARRAY ){ jsonPrintf(30, &x, "[%d]", p->iRowid); }else if( p->eType==JSON_OBJECT ){ - jsonPrintf(pThis->n, &x, ".%.*s", pThis->n-2, pThis->u.zJContent+1); + jsonAppendObjectPathElement(&x, pThis); } } jsonResult(&x); @@ -192005,7 +195700,7 @@ static int jsonEachBestIndex( /* This implementation assumes that JSON and ROOT are the last two ** columns in the table */ assert( JEACH_ROOT == JEACH_JSON+1 ); - UNUSED_PARAM(tab); + UNUSED_PARAMETER(tab); aIdx[0] = aIdx[1] = -1; pConstraint = pIdxInfo->aConstraint; for(i=0; inConstraint; i++, pConstraint++){ @@ -192014,6 +195709,7 @@ static int jsonEachBestIndex( if( pConstraint->iColumn < JEACH_JSON ) continue; iCol = pConstraint->iColumn - JEACH_JSON; assert( iCol==0 || iCol==1 ); + testcase( iCol==0 ); iMask = 1 << iCol; if( pConstraint->usable==0 ){ unusableMask |= iMask; @@ -192060,8 +195756,8 @@ static int jsonEachFilter( const char *zRoot = 0; sqlite3_int64 n; - UNUSED_PARAM(idxStr); - UNUSED_PARAM(argc); + UNUSED_PARAMETER(idxStr); + UNUSED_PARAMETER(argc); jsonEachCursorReset(p); if( idxNum==0 ) return SQLITE_OK; z = (const char*)sqlite3_value_text(argv[0]); @@ -192111,6 +195807,8 @@ static int jsonEachFilter( p->iBegin = p->i = (int)(pNode - p->sParse.aNode); p->eType = pNode->eType; if( p->eType>=JSON_ARRAY ){ + assert( pNode->eU==0 ); + VVA( pNode->eU = 3 ); pNode->u.iKey = 0; p->iEnd = p->i + pNode->n + 1; if( p->bRecursive ){ @@ -192184,108 +195882,68 @@ static sqlite3_module jsonTreeModule = { 0 /* xShadowName */ }; #endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/**************************************************************************** -** The following routines are the only publically visible identifiers in this -** file. Call the following routines in order to register the various SQL -** functions and the virtual table implemented by this file. -****************************************************************************/ - -SQLITE_PRIVATE int sqlite3Json1Init(sqlite3 *db){ - int rc = SQLITE_OK; - unsigned int i; - static const struct { - const char *zName; - int nArg; - int flag; - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); - } aFunc[] = { - { "json", 1, 0, jsonRemoveFunc }, - { "json_array", -1, 0, jsonArrayFunc }, - { "json_array_length", 1, 0, jsonArrayLengthFunc }, - { "json_array_length", 2, 0, jsonArrayLengthFunc }, - { "json_extract", -1, 0, jsonExtractFunc }, - { "json_insert", -1, 0, jsonSetFunc }, - { "json_object", -1, 0, jsonObjectFunc }, - { "json_patch", 2, 0, jsonPatchFunc }, - { "json_quote", 1, 0, jsonQuoteFunc }, - { "json_remove", -1, 0, jsonRemoveFunc }, - { "json_replace", -1, 0, jsonReplaceFunc }, - { "json_set", -1, 1, jsonSetFunc }, - { "json_type", 1, 0, jsonTypeFunc }, - { "json_type", 2, 0, jsonTypeFunc }, - { "json_valid", 1, 0, jsonValidFunc }, - +#endif /* !defined(SQLITE_OMIT_JSON) */ + +/* +** Register JSON functions. +*/ +SQLITE_PRIVATE void sqlite3RegisterJsonFunctions(void){ +#ifndef SQLITE_OMIT_JSON + static FuncDef aJsonFunc[] = { + JFUNCTION(json, 1, 0, jsonRemoveFunc), + JFUNCTION(json_array, -1, 0, jsonArrayFunc), + JFUNCTION(json_array_length, 1, 0, jsonArrayLengthFunc), + JFUNCTION(json_array_length, 2, 0, jsonArrayLengthFunc), + JFUNCTION(json_extract, -1, 0, jsonExtractFunc), + JFUNCTION(->, 2, JSON_JSON, jsonExtractFunc), + JFUNCTION(->>, 2, JSON_SQL, jsonExtractFunc), + JFUNCTION(json_insert, -1, 0, jsonSetFunc), + JFUNCTION(json_object, -1, 0, jsonObjectFunc), + JFUNCTION(json_patch, 2, 0, jsonPatchFunc), + JFUNCTION(json_quote, 1, 0, jsonQuoteFunc), + JFUNCTION(json_remove, -1, 0, jsonRemoveFunc), + JFUNCTION(json_replace, -1, 0, jsonReplaceFunc), + JFUNCTION(json_set, -1, JSON_ISSET, jsonSetFunc), + JFUNCTION(json_type, 1, 0, jsonTypeFunc), + JFUNCTION(json_type, 2, 0, jsonTypeFunc), + JFUNCTION(json_valid, 1, 0, jsonValidFunc), #if SQLITE_DEBUG - /* DEBUG and TESTING functions */ - { "json_parse", 1, 0, jsonParseFunc }, - { "json_test1", 1, 0, jsonTest1Func }, -#endif + JFUNCTION(json_parse, 1, 0, jsonParseFunc), + JFUNCTION(json_test1, 1, 0, jsonTest1Func), +#endif + WAGGREGATE(json_group_array, 1, 0, 0, + jsonArrayStep, jsonArrayFinal, jsonArrayValue, jsonGroupInverse, + SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS), + WAGGREGATE(json_group_object, 2, 0, 0, + jsonObjectStep, jsonObjectFinal, jsonObjectValue, jsonGroupInverse, + SQLITE_SUBTYPE|SQLITE_UTF8|SQLITE_DETERMINISTIC|SQLITE_INNOCUOUS) }; + sqlite3InsertBuiltinFuncs(aJsonFunc, ArraySize(aJsonFunc)); +#endif +} + +#if !defined(SQLITE_OMIT_VIRTUALTABLE) && !defined(SQLITE_OMIT_JSON) +/* +** Register the JSON table-valued functions +*/ +SQLITE_PRIVATE int sqlite3JsonTableFunctions(sqlite3 *db){ + int rc = SQLITE_OK; static const struct { - const char *zName; - int nArg; - void (*xStep)(sqlite3_context*,int,sqlite3_value**); - void (*xFinal)(sqlite3_context*); - void (*xValue)(sqlite3_context*); - } aAgg[] = { - { "json_group_array", 1, - jsonArrayStep, jsonArrayFinal, jsonArrayValue }, - { "json_group_object", 2, - jsonObjectStep, jsonObjectFinal, jsonObjectValue }, - }; -#ifndef SQLITE_OMIT_VIRTUALTABLE - static const struct { - const char *zName; - sqlite3_module *pModule; + const char *zName; + sqlite3_module *pModule; } aMod[] = { { "json_each", &jsonEachModule }, { "json_tree", &jsonTreeModule }, }; -#endif - static const int enc = - SQLITE_UTF8 | - SQLITE_DETERMINISTIC | - SQLITE_INNOCUOUS; - for(i=0; i */ /* #include */ @@ -192424,7 +196099,9 @@ struct Rtree { u8 nBytesPerCell; /* Bytes consumed per cell */ u8 inWrTrans; /* True if inside write transaction */ u8 nAux; /* # of auxiliary columns in %_rowid */ +#ifdef SQLITE_ENABLE_GEOPOLY u8 nAuxNotNull; /* Number of initial not-null aux columns */ +#endif #ifdef SQLITE_DEBUG u8 bCorrupt; /* Shadow table corruption detected */ #endif @@ -192706,7 +196383,12 @@ struct RtreeMatchArg { ** it is not, make it a no-op. */ #ifndef SQLITE_AMALGAMATION -# define testcase(X) +# if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_DEBUG) + unsigned int sqlite3RtreeTestcase = 0; +# define testcase(X) if( X ){ sqlite3RtreeTestcase += __LINE__; } +# else +# define testcase(X) +# endif #endif /* @@ -192955,18 +196637,6 @@ static void nodeBlobReset(Rtree *pRtree){ } } -/* -** Check to see if pNode is the same as pParent or any of the parents -** of pParent. -*/ -static int nodeInParentChain(const RtreeNode *pNode, const RtreeNode *pParent){ - do{ - if( pNode==pParent ) return 1; - pParent = pParent->pParent; - }while( pParent ); - return 0; -} - /* ** Obtain a reference to an r-tree node. */ @@ -192983,14 +196653,7 @@ static int nodeAcquire( ** increase its reference count and return it. */ if( (pNode = nodeHashLookup(pRtree, iNode))!=0 ){ - if( pParent && !pNode->pParent ){ - if( nodeInParentChain(pNode, pParent) ){ - RTREE_IS_CORRUPT(pRtree); - return SQLITE_CORRUPT_VTAB; - } - pParent->nRef++; - pNode->pParent = pParent; - }else if( pParent && pNode->pParent && pParent!=pNode->pParent ){ + if( pParent && pParent!=pNode->pParent ){ RTREE_IS_CORRUPT(pRtree); return SQLITE_CORRUPT_VTAB; } @@ -193048,7 +196711,7 @@ static int nodeAcquire( ** are the leaves, and so on. If the depth as specified on the root node ** is greater than RTREE_MAX_DEPTH, the r-tree structure must be corrupt. */ - if( pNode && rc==SQLITE_OK && iNode==1 ){ + if( rc==SQLITE_OK && pNode && iNode==1 ){ pRtree->iDepth = readInt16(pNode->zData); if( pRtree->iDepth>RTREE_MAX_DEPTH ){ rc = SQLITE_CORRUPT_VTAB; @@ -193571,20 +197234,29 @@ static void rtreeNonleafConstraint( switch( p->op ){ case RTREE_TRUE: return; /* Always satisfied */ case RTREE_FALSE: break; /* Never satisfied */ + case RTREE_EQ: + RTREE_DECODE_COORD(eInt, pCellData, val); + /* val now holds the lower bound of the coordinate pair */ + if( p->u.rValue>=val ){ + pCellData += 4; + RTREE_DECODE_COORD(eInt, pCellData, val); + /* val now holds the upper bound of the coordinate pair */ + if( p->u.rValue<=val ) return; + } + break; case RTREE_LE: case RTREE_LT: - case RTREE_EQ: RTREE_DECODE_COORD(eInt, pCellData, val); /* val now holds the lower bound of the coordinate pair */ if( p->u.rValue>=val ) return; - if( p->op!=RTREE_EQ ) break; /* RTREE_LE and RTREE_LT end here */ - /* Fall through for the RTREE_EQ case */ + break; - default: /* RTREE_GT or RTREE_GE, or fallthrough of RTREE_EQ */ + default: pCellData += 4; RTREE_DECODE_COORD(eInt, pCellData, val); /* val now holds the upper bound of the coordinate pair */ if( p->u.rValue<=val ) return; + break; } *peWithin = NOT_WITHIN; } @@ -193654,11 +197326,12 @@ static int nodeRowidIndex( */ static int nodeParentIndex(Rtree *pRtree, RtreeNode *pNode, int *piIndex){ RtreeNode *pParent = pNode->pParent; - if( pParent ){ + if( ALWAYS(pParent) ){ return nodeRowidIndex(pRtree, pParent, pNode->iNode, piIndex); + }else{ + *piIndex = -1; + return SQLITE_OK; } - *piIndex = -1; - return SQLITE_OK; } /* @@ -193781,7 +197454,8 @@ static RtreeSearchPoint *rtreeSearchPointNew( pNew = rtreeEnqueue(pCur, rScore, iLevel); if( pNew==0 ) return 0; ii = (int)(pNew - pCur->aPoint) + 1; - if( iiaNode[ii]==0 ); pCur->aNode[ii] = pCur->aNode[0]; }else{ @@ -193842,7 +197516,7 @@ static void rtreeSearchPointPop(RtreeCursor *p){ if( p->bPoint ){ p->anQueue[p->sPoint.iLevel]--; p->bPoint = 0; - }else if( p->nPoint ){ + }else if( ALWAYS(p->nPoint) ){ p->anQueue[p->aPoint[0].iLevel]--; n = --p->nPoint; p->aPoint[0] = p->aPoint[n]; @@ -193983,7 +197657,7 @@ static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ RtreeSearchPoint *p = rtreeSearchPointFirst(pCsr); int rc = SQLITE_OK; RtreeNode *pNode = rtreeNodeOfFirstSearchPoint(pCsr, &rc); - if( rc==SQLITE_OK && p ){ + if( rc==SQLITE_OK && ALWAYS(p) ){ *pRowid = nodeGetRowid(RTREE_OF_CURSOR(pCsr), pNode, p->iCell); } return rc; @@ -194001,7 +197675,7 @@ static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ RtreeNode *pNode = rtreeNodeOfFirstSearchPoint(pCsr, &rc); if( rc ) return rc; - if( p==0 ) return SQLITE_OK; + if( NEVER(p==0) ) return SQLITE_OK; if( i==0 ){ sqlite3_result_int64(ctx, nodeGetRowid(pRtree, pNode, p->iCell)); }else if( i<=pRtree->nDim2 ){ @@ -194200,8 +197874,11 @@ static int rtreeFilter( } if( rc==SQLITE_OK ){ RtreeSearchPoint *pNew; + assert( pCsr->bPoint==0 ); /* Due to the resetCursor() call above */ pNew = rtreeSearchPointNew(pCsr, RTREE_ZERO, (u8)(pRtree->iDepth+1)); - if( pNew==0 ) return SQLITE_NOMEM; + if( NEVER(pNew==0) ){ /* Because pCsr->bPoint was FALSE */ + return SQLITE_NOMEM; + } pNew->id = 1; pNew->iCell = 0; pNew->eWithin = PARTLY_WITHIN; @@ -194278,7 +197955,7 @@ static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; if( bMatch==0 && p->usable - && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ + && p->iColumn<=0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ /* We have an equality constraint on the rowid. Use strategy 1. */ int jj; @@ -194484,7 +198161,7 @@ static int ChooseLeaf( int nCell = NCELL(pNode); RtreeCell cell; - RtreeNode *pChild; + RtreeNode *pChild = 0; RtreeCell *aCell = 0; @@ -194531,12 +198208,19 @@ static int AdjustTree( ){ RtreeNode *p = pNode; int cnt = 0; + int rc; while( p->pParent ){ RtreeNode *pParent = p->pParent; RtreeCell cell; int iCell; - if( (++cnt)>1000 || nodeParentIndex(pRtree, p, &iCell) ){ + cnt++; + if( NEVER(cnt>100) ){ + RTREE_IS_CORRUPT(pRtree); + return SQLITE_CORRUPT_VTAB; + } + rc = nodeParentIndex(pRtree, p, &iCell); + if( NEVER(rc!=SQLITE_OK) ){ RTREE_IS_CORRUPT(pRtree); return SQLITE_CORRUPT_VTAB; } @@ -194825,12 +198509,17 @@ static int updateMapping( xSetMapping = ((iHeight==0)?rowidWrite:parentWrite); if( iHeight>0 ){ RtreeNode *pChild = nodeHashLookup(pRtree, iRowid); + RtreeNode *p; + for(p=pNode; p; p=p->pParent){ + if( p==pChild ) return SQLITE_CORRUPT_VTAB; + } if( pChild ){ nodeRelease(pRtree, pChild->pParent); nodeReference(pNode); pChild->pParent = pNode; } } + if( NEVER(pNode==0) ) return SQLITE_ERROR; return xSetMapping(pRtree, iRowid, pNode->iNode); } @@ -194920,11 +198609,12 @@ static int SplitNode( RtreeNode *pParent = pLeft->pParent; int iCell; rc = nodeParentIndex(pRtree, pLeft, &iCell); - if( rc==SQLITE_OK ){ + if( ALWAYS(rc==SQLITE_OK) ){ nodeOverwriteCell(pRtree, pParent, &leftbbox, iCell); rc = AdjustTree(pRtree, pParent, &leftbbox); + assert( rc==SQLITE_OK ); } - if( rc!=SQLITE_OK ){ + if( NEVER(rc!=SQLITE_OK) ){ goto splitnode_out; } } @@ -194999,7 +198689,7 @@ static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){ */ iNode = sqlite3_column_int64(pRtree->pReadParent, 0); for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent); - if( !pTest ){ + if( pTest==0 ){ rc2 = nodeAcquire(pRtree, iNode, 0, &pChild->pParent); } } @@ -195030,6 +198720,7 @@ static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){ pParent = pNode->pParent; pNode->pParent = 0; rc = deleteCell(pRtree, pParent, iCell, iHeight+1); + testcase( rc!=SQLITE_OK ); } rc2 = nodeRelease(pRtree, pParent); if( rc==SQLITE_OK ){ @@ -195252,7 +198943,7 @@ static int rtreeInsertCell( } }else{ rc = AdjustTree(pRtree, pNode, pCell); - if( rc==SQLITE_OK ){ + if( ALWAYS(rc==SQLITE_OK) ){ if( iHeight==0 ){ rc = rowidWrite(pRtree, pCell->iRowid, pNode->iNode); }else{ @@ -195358,7 +199049,7 @@ static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ int rc2; RtreeNode *pChild = 0; i64 iChild = nodeGetRowid(pRtree, pRoot, 0); - rc = nodeAcquire(pRtree, iChild, pRoot, &pChild); + rc = nodeAcquire(pRtree, iChild, pRoot, &pChild); /* tag-20210916a */ if( rc==SQLITE_OK ){ rc = removeNode(pRtree, pChild, pRtree->iDepth-1); } @@ -195693,7 +199384,7 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ char *zSql; sqlite3_stmt *p; int rc; - i64 nRow = 0; + i64 nRow = RTREE_MIN_ROWEST; rc = sqlite3_table_column_metadata( db, pRtree->zDb, "sqlite_stat1",0,0,0,0,0,0 @@ -195710,20 +199401,10 @@ static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ if( rc==SQLITE_OK ){ if( sqlite3_step(p)==SQLITE_ROW ) nRow = sqlite3_column_int64(p, 0); rc = sqlite3_finalize(p); - }else if( rc!=SQLITE_NOMEM ){ - rc = SQLITE_OK; - } - - if( rc==SQLITE_OK ){ - if( nRow==0 ){ - pRtree->nRowEst = RTREE_DEFAULT_ROWEST; - }else{ - pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST); - } } sqlite3_free(zSql); } - + pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST); return rc; } @@ -195873,9 +199554,12 @@ static int rtreeSqlInit( sqlite3_str_appendf(p, "UPDATE \"%w\".\"%w_rowid\"SET ", zDb, zPrefix); for(ii=0; iinAux; ii++){ if( ii ) sqlite3_str_append(p, ",", 1); +#ifdef SQLITE_ENABLE_GEOPOLY if( iinAuxNotNull ){ sqlite3_str_appendf(p,"a%d=coalesce(?%d,a%d)",ii,ii+2,ii); - }else{ + }else +#endif + { sqlite3_str_appendf(p,"a%d=?%d",ii,ii+2); } } @@ -196140,6 +199824,7 @@ static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){ tree.nDim2 = tree.nDim*2; tree.nBytesPerCell = 8 + 8 * tree.nDim; node.zData = (u8 *)sqlite3_value_blob(apArg[1]); + if( node.zData==0 ) return; nData = sqlite3_value_bytes(apArg[1]); if( nData<4 ) return; if( nDataz[0]) ) p->z++; + while( fast_isspace(p->z[0]) ) p->z++; return p->z[0]; } @@ -196969,13 +200653,14 @@ static GeoPoly *geopolyFuncParam( ){ GeoPoly *p = 0; int nByte; + testcase( pCtx==0 ); if( sqlite3_value_type(pVal)==SQLITE_BLOB && (nByte = sqlite3_value_bytes(pVal))>=(4+6*sizeof(GeoCoord)) ){ const unsigned char *a = sqlite3_value_blob(pVal); int nVertex; if( a==0 ){ - sqlite3_result_error_nomem(pCtx); + if( pCtx ) sqlite3_result_error_nomem(pCtx); return 0; } nVertex = (a[1]<<16) + (a[2]<<8) + a[3]; @@ -197802,11 +201487,11 @@ static int geopolyOverlap(GeoPoly *p1, GeoPoly *p2){ }else{ /* Remove a segment */ if( pActive==pThisEvent->pSeg ){ - pActive = pActive->pNext; + pActive = ALWAYS(pActive) ? pActive->pNext : 0; }else{ for(pSeg=pActive; pSeg; pSeg=pSeg->pNext){ if( pSeg->pNext==pThisEvent->pSeg ){ - pSeg->pNext = pSeg->pNext->pNext; + pSeg->pNext = ALWAYS(pSeg->pNext) ? pSeg->pNext->pNext : 0; break; } } @@ -198050,6 +201735,7 @@ static int geopolyFilter( RtreeCoord bbox[4]; RtreeConstraint *p; assert( argc==1 ); + assert( argv[0]!=0 ); geopolyBBox(0, argv[0], bbox, &rc); if( rc ){ goto geopoly_filter_end; @@ -198277,6 +201963,7 @@ static int geopolyUpdate( || !sqlite3_value_nochange(aData[2]) /* UPDATE _shape */ || oldRowid!=newRowid) /* Rowid change */ ){ + assert( aData[2]!=0 ); geopolyBBox(0, aData[2], cell.aCoord, &rc); if( rc ){ if( rc==SQLITE_ERROR ){ @@ -198630,7 +202317,10 @@ SQLITE_API int sqlite3_rtree_query_callback( /* Allocate and populate the context object. */ pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback)); - if( !pGeomCtx ) return SQLITE_NOMEM; + if( !pGeomCtx ){ + if( xDestructor ) xDestructor(pContext); + return SQLITE_NOMEM; + } pGeomCtx->xGeom = 0; pGeomCtx->xQueryFunc = xQueryFunc; pGeomCtx->xDestructor = xDestructor; @@ -200201,6 +203891,13 @@ SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName); # define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;} #endif +/* +** Name of the URI option that causes RBU to take an exclusive lock as +** part of the incremental checkpoint operation. +*/ +#define RBU_EXCLUSIVE_CHECKPOINT "rbu_exclusive_checkpoint" + + /* ** The rbu_state table is used to save the state of a partially applied ** update so that it can be resumed later. The table consists of integer @@ -201285,7 +204982,9 @@ static void rbuTableType( assert( p->rc==SQLITE_OK ); p->rc = prepareFreeAndCollectError(p->dbMain, &aStmt[0], &p->zErrmsg, sqlite3_mprintf( - "SELECT (sql LIKE 'create virtual%%'), rootpage" + "SELECT " + " (sql COLLATE nocase BETWEEN 'CREATE VIRTUAL' AND 'CREATE VIRTUAM')," + " rootpage" " FROM sqlite_schema" " WHERE name=%Q", zTab )); @@ -201645,7 +205344,7 @@ static char *rbuVacuumTableStart( ** the caller has to use an OFFSET clause to extract only the required ** rows from the sourct table, just as it does for an RBU update operation. */ -char *rbuVacuumIndexStart( +static char *rbuVacuumIndexStart( sqlite3rbu *p, /* RBU handle */ RbuObjIter *pIter /* RBU iterator object */ ){ @@ -202818,7 +206517,7 @@ static RbuState *rbuLoadState(sqlite3rbu *p){ break; case RBU_STATE_OALSZ: - pRet->iOalSz = (u32)sqlite3_column_int64(pStmt, 1); + pRet->iOalSz = sqlite3_column_int64(pStmt, 1); break; case RBU_STATE_PHASEONESTEP: @@ -202845,13 +206544,19 @@ static RbuState *rbuLoadState(sqlite3rbu *p){ /* ** Open the database handle and attach the RBU database as "rbu". If an ** error occurs, leave an error code and message in the RBU handle. +** +** If argument dbMain is not NULL, then it is a database handle already +** open on the target database. Use this handle instead of opening a new +** one. */ -static void rbuOpenDatabase(sqlite3rbu *p, int *pbRetry){ +static void rbuOpenDatabase(sqlite3rbu *p, sqlite3 *dbMain, int *pbRetry){ assert( p->rc || (p->dbMain==0 && p->dbRbu==0) ); assert( p->rc || rbuIsVacuum(p) || p->zTarget!=0 ); + assert( dbMain==0 || rbuIsVacuum(p)==0 ); /* Open the RBU database */ p->dbRbu = rbuOpenDbhandle(p, p->zRbu, 1); + p->dbMain = dbMain; if( p->rc==SQLITE_OK && rbuIsVacuum(p) ){ sqlite3_file_control(p->dbRbu, "main", SQLITE_FCNTL_RBUCNT, (void*)p); @@ -203217,15 +206922,31 @@ static void rbuCheckpointFrame(sqlite3rbu *p, RbuFrame *pFrame){ /* -** Take an EXCLUSIVE lock on the database file. +** Take an EXCLUSIVE lock on the database file. Return SQLITE_OK if +** successful, or an SQLite error code otherwise. */ -static void rbuLockDatabase(sqlite3rbu *p){ - sqlite3_file *pReal = p->pTargetFd->pReal; - assert( p->rc==SQLITE_OK ); - p->rc = pReal->pMethods->xLock(pReal, SQLITE_LOCK_SHARED); - if( p->rc==SQLITE_OK ){ - p->rc = pReal->pMethods->xLock(pReal, SQLITE_LOCK_EXCLUSIVE); +static int rbuLockDatabase(sqlite3 *db){ + int rc = SQLITE_OK; + sqlite3_file *fd = 0; + sqlite3_file_control(db, "main", SQLITE_FCNTL_FILE_POINTER, &fd); + + if( fd->pMethods ){ + rc = fd->pMethods->xLock(fd, SQLITE_LOCK_SHARED); + if( rc==SQLITE_OK ){ + rc = fd->pMethods->xLock(fd, SQLITE_LOCK_EXCLUSIVE); + } } + return rc; +} + +/* +** Return true if the database handle passed as the only argument +** was opened with the rbu_exclusive_checkpoint=1 URI parameter +** specified. Or false otherwise. +*/ +static int rbuExclusiveCheckpoint(sqlite3 *db){ + const char *zUri = sqlite3_db_filename(db, 0); + return sqlite3_uri_boolean(zUri, RBU_EXCLUSIVE_CHECKPOINT, 0); } #if defined(_WIN32_WCE) @@ -203283,18 +207004,24 @@ static void rbuMoveOalFile(sqlite3rbu *p){ ** In order to ensure that there are no database readers, an EXCLUSIVE ** lock is obtained here before the *-oal is moved to *-wal. */ - rbuLockDatabase(p); - if( p->rc==SQLITE_OK ){ - rbuFileSuffix3(zBase, zWal); - rbuFileSuffix3(zBase, zOal); + sqlite3 *dbMain = 0; + rbuFileSuffix3(zBase, zWal); + rbuFileSuffix3(zBase, zOal); - /* Re-open the databases. */ - rbuObjIterFinalize(&p->objiter); - sqlite3_close(p->dbRbu); - sqlite3_close(p->dbMain); - p->dbMain = 0; - p->dbRbu = 0; + /* Re-open the databases. */ + rbuObjIterFinalize(&p->objiter); + sqlite3_close(p->dbRbu); + sqlite3_close(p->dbMain); + p->dbMain = 0; + p->dbRbu = 0; + + dbMain = rbuOpenDbhandle(p, p->zTarget, 1); + if( dbMain ){ + assert( p->rc==SQLITE_OK ); + p->rc = rbuLockDatabase(dbMain); + } + if( p->rc==SQLITE_OK ){ #if defined(_WIN32_WCE) { LPWSTR zWideOal; @@ -203321,11 +207048,19 @@ static void rbuMoveOalFile(sqlite3rbu *p){ #else p->rc = rename(zOal, zWal) ? SQLITE_IOERR : SQLITE_OK; #endif + } - if( p->rc==SQLITE_OK ){ - rbuOpenDatabase(p, 0); - rbuSetupCheckpoint(p, 0); - } + if( p->rc!=SQLITE_OK + || rbuIsVacuum(p) + || rbuExclusiveCheckpoint(dbMain)==0 + ){ + sqlite3_close(dbMain); + dbMain = 0; + } + + if( p->rc==SQLITE_OK ){ + rbuOpenDatabase(p, dbMain, 0); + rbuSetupCheckpoint(p, 0); } } @@ -204076,9 +207811,9 @@ static sqlite3rbu *openRbuHandle( ** If this is the case, it will have been checkpointed and deleted ** when the handle was closed and a second attempt to open the ** database may succeed. */ - rbuOpenDatabase(p, &bRetry); + rbuOpenDatabase(p, 0, &bRetry); if( bRetry ){ - rbuOpenDatabase(p, 0); + rbuOpenDatabase(p, 0, 0); } } @@ -204173,6 +207908,14 @@ static sqlite3rbu *openRbuHandle( }else if( p->eStage==RBU_STAGE_MOVE ){ /* no-op */ }else if( p->eStage==RBU_STAGE_CKPT ){ + if( !rbuIsVacuum(p) && rbuExclusiveCheckpoint(p->dbMain) ){ + /* If the rbu_exclusive_checkpoint=1 URI parameter was specified + ** and an incremental checkpoint is being resumed, attempt an + ** exclusive lock on the db file. If this fails, so be it. */ + p->eStage = RBU_STAGE_DONE; + rbuLockDatabase(p->dbMain); + p->eStage = RBU_STAGE_CKPT; + } rbuSetupCheckpoint(p, pState); }else if( p->eStage==RBU_STAGE_DONE ){ p->rc = SQLITE_DONE; @@ -204210,7 +207953,6 @@ SQLITE_API sqlite3rbu *sqlite3rbu_open( const char *zState ){ if( zTarget==0 || zRbu==0 ){ return rbuMisuseError(); } - /* TODO: Check that zTarget and zRbu are non-NULL */ return openRbuHandle(zTarget, zRbu, zState); } @@ -205413,6 +209155,15 @@ SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu *pRbu){ #if (defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)) \ && !defined(SQLITE_OMIT_VIRTUALTABLE) +/* +** The pager and btree modules arrange objects in memory so that there are +** always approximately 200 bytes of addressable memory following each page +** buffer. This way small buffer overreads caused by corrupt database pages +** do not cause undefined behaviour. This module pads each page buffer +** by the following number of bytes for the same purpose. +*/ +#define DBSTAT_PAGE_PADDING_BYTES 256 + /* ** Page paths: ** @@ -205480,9 +209231,8 @@ struct StatCell { /* Size information for a single btree page */ struct StatPage { u32 iPgno; /* Page number */ - DbPage *pPg; /* Page content */ + u8 *aPg; /* Page buffer from sqlite3_malloc() */ int iCell; /* Current cell */ - char *zPath; /* Path to this page */ /* Variables populated by statDecodePage(): */ @@ -205694,18 +209444,25 @@ static void statClearCells(StatPage *p){ } static void statClearPage(StatPage *p){ + u8 *aPg = p->aPg; statClearCells(p); - sqlite3PagerUnref(p->pPg); sqlite3_free(p->zPath); memset(p, 0, sizeof(StatPage)); + p->aPg = aPg; } static void statResetCsr(StatCursor *pCsr){ int i; - sqlite3_reset(pCsr->pStmt); + /* In some circumstances, specifically if an OOM has occurred, the call + ** to sqlite3_reset() may cause the pager to be reset (emptied). It is + ** important that statClearPage() is called to free any page refs before + ** this happens. dbsqlfuzz 9ed3e4e3816219d3509d711636c38542bf3f40b1. */ for(i=0; iaPage); i++){ statClearPage(&pCsr->aPage[i]); + sqlite3_free(pCsr->aPage[i].aPg); + pCsr->aPage[i].aPg = 0; } + sqlite3_reset(pCsr->pStmt); pCsr->iPage = 0; sqlite3_free(pCsr->zPath); pCsr->zPath = 0; @@ -205770,7 +209527,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ int isLeaf; int szPage; - u8 *aData = sqlite3PagerGetData(p->pPg); + u8 *aData = p->aPg; u8 *aHdr = &aData[p->iPgno==1 ? 100 : 0]; p->flags = aHdr[0]; @@ -205841,7 +209598,7 @@ static int statDecodePage(Btree *pBt, StatPage *p){ if( nPayload>(u32)nLocal ){ int j; int nOvfl = ((nPayload - nLocal) + nUsable-4 - 1) / (nUsable - 4); - if( iOff+nLocal>nUsable || nPayload>0x7fffffff ){ + if( iOff+nLocal+4>nUsable || nPayload>0x7fffffff ){ goto statPageIsCorrupt; } pCell->nLastOvfl = (nPayload-nLocal) - (nOvfl-1) * (nUsable-4); @@ -205900,6 +209657,38 @@ static void statSizeAndOffset(StatCursor *pCsr){ } } +/* +** Load a copy of the page data for page iPg into the buffer belonging +** to page object pPg. Allocate the buffer if necessary. Return SQLITE_OK +** if successful, or an SQLite error code otherwise. +*/ +static int statGetPage( + Btree *pBt, /* Load page from this b-tree */ + u32 iPg, /* Page number to load */ + StatPage *pPg /* Load page into this object */ +){ + int pgsz = sqlite3BtreeGetPageSize(pBt); + DbPage *pDbPage = 0; + int rc; + + if( pPg->aPg==0 ){ + pPg->aPg = (u8*)sqlite3_malloc(pgsz + DBSTAT_PAGE_PADDING_BYTES); + if( pPg->aPg==0 ){ + return SQLITE_NOMEM_BKPT; + } + memset(&pPg->aPg[pgsz], 0, DBSTAT_PAGE_PADDING_BYTES); + } + + rc = sqlite3PagerGet(sqlite3BtreePager(pBt), iPg, &pDbPage, 0); + if( rc==SQLITE_OK ){ + const u8 *a = sqlite3PagerGetData(pDbPage); + memcpy(pPg->aPg, a, pgsz); + sqlite3PagerUnref(pDbPage); + } + + return rc; +} + /* ** Move a DBSTAT cursor to the next entry. Normally, the next ** entry will be the next page, but in aggregated mode (pCsr->isAgg!=0), @@ -205918,7 +209707,7 @@ static int statNext(sqlite3_vtab_cursor *pCursor){ pCsr->zPath = 0; statNextRestart: - if( pCsr->aPage[0].pPg==0 ){ + if( pCsr->iPage<0 ){ /* Start measuring space on the next btree */ statResetCounts(pCsr); rc = sqlite3_step(pCsr->pStmt); @@ -205930,7 +209719,7 @@ statNextRestart: pCsr->isEof = 1; return sqlite3_reset(pCsr->pStmt); } - rc = sqlite3PagerGet(pPager, iRoot, &pCsr->aPage[0].pPg, 0); + rc = statGetPage(pBt, iRoot, &pCsr->aPage[0]); pCsr->aPage[0].iPgno = iRoot; pCsr->aPage[0].iCell = 0; if( !pCsr->isAgg ){ @@ -205981,9 +209770,8 @@ statNextRestart: if( !p->iRightChildPg || p->iCell>p->nCell ){ statClearPage(p); - if( pCsr->iPage>0 ){ - pCsr->iPage--; - }else if( pCsr->isAgg ){ + pCsr->iPage--; + if( pCsr->isAgg && pCsr->iPage<0 ){ /* label-statNext-done: When computing aggregate space usage over ** an entire btree, this is the exit point from this function */ return SQLITE_OK; @@ -206002,7 +209790,7 @@ statNextRestart: }else{ p[1].iPgno = p->aCell[p->iCell].iChildPg; } - rc = sqlite3PagerGet(pPager, p[1].iPgno, &p[1].pPg, 0); + rc = statGetPage(pBt, p[1].iPgno, &p[1]); pCsr->nPage++; p[1].iCell = 0; if( !pCsr->isAgg ){ @@ -206132,6 +209920,7 @@ static int statFilter( } if( rc==SQLITE_OK ){ + pCsr->iPage = -1; rc = statNext(pCursor); } return rc; @@ -206400,6 +210189,7 @@ static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ ){ pIdxInfo->orderByConsumed = 1; } + sqlite3VtabWriteAll(pIdxInfo); return SQLITE_OK; } @@ -207083,7 +210873,7 @@ static int sessionSerializeValue( if( aBuf ){ sessionVarintPut(&aBuf[1], n); - if( n ) memcpy(&aBuf[nVarint + 1], z, n); + if( n>0 ) memcpy(&aBuf[nVarint + 1], z, n); } nByte = 1 + nVarint + n; @@ -207688,16 +211478,32 @@ static int sessionTableInfo( }else if( rc==SQLITE_ERROR ){ zPragma = sqlite3_mprintf(""); }else{ + *pazCol = 0; + *pabPK = 0; + *pnCol = 0; + if( pzTab ) *pzTab = 0; return rc; } }else{ zPragma = sqlite3_mprintf("PRAGMA '%q'.table_info('%q')", zDb, zThis); } - if( !zPragma ) return SQLITE_NOMEM; + if( !zPragma ){ + *pazCol = 0; + *pabPK = 0; + *pnCol = 0; + if( pzTab ) *pzTab = 0; + return SQLITE_NOMEM; + } rc = sqlite3_prepare_v2(db, zPragma, -1, &pStmt, 0); sqlite3_free(zPragma); - if( rc!=SQLITE_OK ) return rc; + if( rc!=SQLITE_OK ){ + *pazCol = 0; + *pabPK = 0; + *pnCol = 0; + if( pzTab ) *pzTab = 0; + return rc; + } nByte = nThis + 1; while( SQLITE_ROW==sqlite3_step(pStmt) ){ @@ -208115,7 +211921,11 @@ static int sessionFindTable( ){ rc = sqlite3session_attach(pSession, zName); if( rc==SQLITE_OK ){ - for(pRet=pSession->pTable; pRet->pNext; pRet=pRet->pNext); + pRet = pSession->pTable; + while( ALWAYS(pRet) && pRet->pNext ){ + pRet = pRet->pNext; + } + assert( pRet!=0 ); assert( 0==sqlite3_strnicmp(pRet->zName, zName, nName+1) ); } } @@ -208888,6 +212698,7 @@ static int sessionAppendUpdate( int i; /* Used to iterate through columns */ u8 *pCsr = p->aRecord; /* Used to iterate through old.* values */ + assert( abPK!=0 ); sessionAppendByte(pBuf, SQLITE_UPDATE, &rc); sessionAppendByte(pBuf, p->bIndirect, &rc); for(i=0; ipTable; rc==SQLITE_OK && pTab; pTab=pTab->pNext){ if( pTab->nEntry ){ const char *zName = pTab->zName; - int nCol; /* Number of columns in table */ - u8 *abPK; /* Primary key array */ + int nCol = 0; /* Number of columns in table */ + u8 *abPK = 0; /* Primary key array */ const char **azCol = 0; /* Table columns */ int i; /* Used to iterate through hash buckets */ sqlite3_stmt *pSel = 0; /* SELECT statement to query table pTab */ @@ -209250,6 +213063,7 @@ static int sessionGenerateChangeset( sessionAppendCol(&buf, pSel, iCol, &rc); } }else{ + assert( abPK!=0 ); /* Because sessionSelectStmt() returned ok */ rc = sessionAppendUpdate(&buf, bPatchset, pSel, p, abPK); } }else if( p->op!=SQLITE_INSERT ){ @@ -209310,7 +213124,10 @@ SQLITE_API int sqlite3session_changeset( int *pnChangeset, /* OUT: Size of buffer at *ppChangeset */ void **ppChangeset /* OUT: Buffer containing changeset */ ){ - int rc = sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset,ppChangeset); + int rc; + + if( pnChangeset==0 || ppChangeset==0 ) return SQLITE_MISUSE; + rc = sessionGenerateChangeset(pSession, 0, 0, 0, pnChangeset,ppChangeset); assert( rc || pnChangeset==0 || pSession->bEnableSize==0 || *pnChangeset<=pSession->nMaxChangesetSize ); @@ -209325,6 +213142,7 @@ SQLITE_API int sqlite3session_changeset_strm( int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ){ + if( xOutput==0 ) return SQLITE_MISUSE; return sessionGenerateChangeset(pSession, 0, xOutput, pOut, 0, 0); } @@ -209336,6 +213154,7 @@ SQLITE_API int sqlite3session_patchset_strm( int (*xOutput)(void *pOut, const void *pData, int nData), void *pOut ){ + if( xOutput==0 ) return SQLITE_MISUSE; return sessionGenerateChangeset(pSession, 1, xOutput, pOut, 0, 0); } @@ -209351,6 +213170,7 @@ SQLITE_API int sqlite3session_patchset( int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */ void **ppPatchset /* OUT: Buffer containing changeset */ ){ + if( pnPatchset==0 || ppPatchset==0 ) return SQLITE_MISUSE; return sessionGenerateChangeset(pSession, 1, 0, 0, pnPatchset, ppPatchset); } @@ -210314,11 +214134,11 @@ static int sessionChangesetInvert( } assert( rc==SQLITE_OK ); - if( pnInverted ){ + if( pnInverted && ALWAYS(ppInverted) ){ *pnInverted = sOut.nBuf; *ppInverted = sOut.aBuf; sOut.aBuf = 0; - }else if( sOut.nBuf>0 ){ + }else if( sOut.nBuf>0 && ALWAYS(xOutput!=0) ){ rc = xOutput(pOut, sOut.aBuf, sOut.nBuf); } @@ -210774,7 +214594,7 @@ static int sessionBindRow( for(i=0; rc==SQLITE_OK && i0 ) rc = xOutput(pOut, buf.aBuf, buf.nBuf); - }else{ + }else if( ppOut ){ *ppOut = buf.aBuf; - *pnOut = buf.nBuf; + if( pnOut ) *pnOut = buf.nBuf; buf.aBuf = 0; } } @@ -212319,7 +216139,7 @@ static int sessionRebase( if( sOut.nBuf>0 ){ rc = xOutput(pOut, sOut.aBuf, sOut.nBuf); } - }else{ + }else if( ppOut ){ *ppOut = (void*)sOut.aBuf; *pnOut = sOut.nBuf; sOut.aBuf = 0; @@ -213062,8 +216882,20 @@ typedef sqlite3_uint64 u64; #endif #define testcase(x) -#define ALWAYS(x) 1 -#define NEVER(x) 0 + +#if defined(SQLITE_COVERAGE_TEST) || defined(SQLITE_MUTATION_TEST) +# define SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS 1 +#endif +#if defined(SQLITE_OMIT_AUXILIARY_SAFETY_CHECKS) +# define ALWAYS(X) (1) +# define NEVER(X) (0) +#elif !defined(NDEBUG) +# define ALWAYS(X) ((X)?1:(assert(0),0)) +# define NEVER(X) ((X)?(assert(0),1):0) +#else +# define ALWAYS(X) (X) +# define NEVER(X) (X) +#endif #define MIN(x,y) (((x) < (y)) ? (x) : (y)) #define MAX(x,y) (((x) > (y)) ? (x) : (y)) @@ -213123,7 +216955,7 @@ SQLITE_API extern int sqlite3_fts5_may_be_corrupt; ** A version of memcmp() that does not cause asan errors if one of the pointer ** parameters is NULL and the number of bytes to compare is zero. */ -#define fts5Memcmp(s1, s2, n) ((n)==0 ? 0 : memcmp((s1), (s2), (n))) +#define fts5Memcmp(s1, s2, n) ((n)<=0 ? 0 : memcmp((s1), (s2), (n))) /* Mark a function parameter as unused, to suppress nuisance compiler ** warnings. */ @@ -213462,6 +217294,9 @@ static void sqlite3Fts5IndexCloseReader(Fts5Index*); */ static const char *sqlite3Fts5IterTerm(Fts5IndexIter*, int*); static int sqlite3Fts5IterNextScan(Fts5IndexIter*); +static void *sqlite3Fts5StructureRef(Fts5Index*); +static void sqlite3Fts5StructureRelease(void*); +static int sqlite3Fts5StructureTest(Fts5Index*, void*); /* @@ -214239,9 +218074,9 @@ struct fts5yyParser { }; typedef struct fts5yyParser fts5yyParser; +/* #include */ #ifndef NDEBUG /* #include */ -/* #include */ static FILE *fts5yyTraceFILE = 0; static char *fts5yyTracePrompt = 0; #endif /* NDEBUG */ @@ -215178,8 +219013,8 @@ static void sqlite3Fts5Parser( fts5yyact = fts5yy_find_shift_action((fts5YYCODETYPE)fts5yymajor,fts5yyact); if( fts5yyact >= fts5YY_MIN_REDUCE ){ unsigned int fts5yyruleno = fts5yyact - fts5YY_MIN_REDUCE; /* Reduce by this rule */ - assert( fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ); #ifndef NDEBUG + assert( fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ); if( fts5yyTraceFILE ){ int fts5yysize = fts5yyRuleInfoNRhs[fts5yyruleno]; if( fts5yysize ){ @@ -215277,14 +219112,13 @@ static void sqlite3Fts5Parser( fts5yy_destructor(fts5yypParser, (fts5YYCODETYPE)fts5yymajor, &fts5yyminorunion); fts5yymajor = fts5YYNOCODE; }else{ - while( fts5yypParser->fts5yytos >= fts5yypParser->fts5yystack - && (fts5yyact = fts5yy_find_reduce_action( - fts5yypParser->fts5yytos->stateno, - fts5YYERRORSYMBOL)) > fts5YY_MAX_SHIFTREDUCE - ){ + while( fts5yypParser->fts5yytos > fts5yypParser->fts5yystack ){ + fts5yyact = fts5yy_find_reduce_action(fts5yypParser->fts5yytos->stateno, + fts5YYERRORSYMBOL); + if( fts5yyact<=fts5YY_MAX_SHIFTREDUCE ) break; fts5yy_pop_parser_stack(fts5yypParser); } - if( fts5yypParser->fts5yytos < fts5yypParser->fts5yystack || fts5yymajor==0 ){ + if( fts5yypParser->fts5yytos <= fts5yypParser->fts5yystack || fts5yymajor==0 ){ fts5yy_destructor(fts5yypParser,(fts5YYCODETYPE)fts5yymajor,&fts5yyminorunion); fts5yy_parse_failed(fts5yypParser); #ifndef fts5YYNOERRORRECOVERY @@ -216147,7 +219981,6 @@ static void sqlite3Fts5BufferAppendBlob( u32 nData, const u8 *pData ){ - assert_nc( *pRc || nData>=0 ); if( nData ){ if( fts5BufferGrow(pRc, pBuf, nData) ) return; memcpy(&pBuf->p[pBuf->n], pData, nData); @@ -216257,9 +220090,8 @@ static int sqlite3Fts5PoslistNext64( return 1; }else{ i64 iOff = *piOff; - int iVal; + u32 iVal; fts5FastGetVarint32(a, i, iVal); - assert( iVal>=0 ); if( iVal<=1 ){ if( iVal==0 ){ *pi = i; @@ -216267,6 +220099,7 @@ static int sqlite3Fts5PoslistNext64( } fts5FastGetVarint32(a, i, iVal); iOff = ((i64)iVal) << 32; + assert( iOff>=0 ); fts5FastGetVarint32(a, i, iVal); if( iVal<2 ){ /* This is a corrupt record. So stop parsing it here. */ @@ -216278,7 +220111,7 @@ static int sqlite3Fts5PoslistNext64( *piOff = (iOff & (i64)0x7FFFFFFF<<32)+((iOff + (iVal-2)) & 0x7FFFFFFF); } *pi = i; - assert( *piOff>=iOff ); + assert_nc( *piOff>=iOff ); return 0; } } @@ -217053,6 +220886,7 @@ static int sqlite3Fts5ConfigParse( z = fts5ConfigSkipWhitespace(z); if( z && *z=='=' ){ bOption = 1; + assert( zOne!=0 ); z++; if( bMustBeCol ) z = 0; } @@ -217069,7 +220903,11 @@ static int sqlite3Fts5ConfigParse( rc = SQLITE_ERROR; }else{ if( bOption ){ - rc = fts5ConfigParseSpecial(pGlobal, pRet, zOne, zTwo?zTwo:"", pzErr); + rc = fts5ConfigParseSpecial(pGlobal, pRet, + ALWAYS(zOne)?zOne:"", + zTwo?zTwo:"", + pzErr + ); }else{ rc = fts5ConfigParseColumn(pRet, zOne, zTwo, pzErr); zOne = 0; @@ -217587,6 +221425,7 @@ static void sqlite3Fts5ParseError(Fts5Parse *pParse, const char *zFmt, ...){ va_list ap; va_start(ap, zFmt); if( pParse->rc==SQLITE_OK ){ + assert( pParse->zErr==0 ); pParse->zErr = sqlite3_vmprintf(zFmt, ap); pParse->rc = SQLITE_ERROR; } @@ -217885,6 +221724,7 @@ static i64 fts5ExprSynonymRowid(Fts5ExprTerm *pTerm, int bDesc, int *pbEof){ int bRetValid = 0; Fts5ExprTerm *p; + assert( pTerm ); assert( pTerm->pSynonym ); assert( bDesc==0 || bDesc==1 ); for(p=pTerm; p; p=p->pSynonym){ @@ -219325,7 +223165,7 @@ static int sqlite3Fts5ExprClonePhrase( sCtx.pPhrase = sqlite3Fts5MallocZero(&rc, sizeof(Fts5ExprPhrase)); } - if( rc==SQLITE_OK ){ + if( rc==SQLITE_OK && ALWAYS(sCtx.pPhrase) ){ /* All the allocations succeeded. Put the expression object together. */ pNew->pIndex = pExpr->pIndex; pNew->pConfig = pExpr->pConfig; @@ -219596,9 +223436,8 @@ static void sqlite3Fts5ParseSetColset( ){ Fts5Colset *pFree = pColset; if( pParse->pConfig->eDetail==FTS5_DETAIL_NONE ){ - pParse->rc = SQLITE_ERROR; - pParse->zErr = sqlite3_mprintf( - "fts5: column queries are not supported (detail=none)" + sqlite3Fts5ParseError(pParse, + "fts5: column queries are not supported (detail=none)" ); }else{ fts5ParseSetColset(pParse, pExpr, pColset, &pFree); @@ -219772,13 +223611,10 @@ static Fts5ExprNode *sqlite3Fts5ParseNode( || pPhrase->nTerm>1 || (pPhrase->nTerm>0 && pPhrase->aTerm[0].bFirst) ){ - assert( pParse->rc==SQLITE_OK ); - pParse->rc = SQLITE_ERROR; - assert( pParse->zErr==0 ); - pParse->zErr = sqlite3_mprintf( + sqlite3Fts5ParseError(pParse, "fts5: %s queries are not supported (detail!=full)", pNear->nPhrase==1 ? "phrase": "NEAR" - ); + ); sqlite3_free(pRet); pRet = 0; } @@ -220310,6 +224146,15 @@ struct Fts5PoslistPopulator { int bMiss; }; +/* +** Clear the position lists associated with all phrases in the expression +** passed as the first argument. Argument bLive is true if the expression +** might be pointing to a real entry, otherwise it has just been reset. +** +** At present this function is only used for detail=col and detail=none +** fts5 tables. This implies that all phrases must be at most 1 token +** in size, as phrase matches are not supported without detail=full. +*/ static Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr *pExpr, int bLive){ Fts5PoslistPopulator *pRet; pRet = sqlite3_malloc64(sizeof(Fts5PoslistPopulator)*pExpr->nPhrase); @@ -220319,7 +224164,7 @@ static Fts5PoslistPopulator *sqlite3Fts5ExprClearPoslists(Fts5Expr *pExpr, int b for(i=0; inPhrase; i++){ Fts5Buffer *pBuf = &pExpr->apExprPhrase[i]->poslist; Fts5ExprNode *pNode = pExpr->apExprPhrase[i]->pNode; - assert( pExpr->apExprPhrase[i]->nTerm==1 ); + assert( pExpr->apExprPhrase[i]->nTerm<=1 ); if( bLive && (pBuf->n==0 || pNode->iRowid!=pExpr->pRoot->iRowid || pNode->bEof) ){ @@ -220870,7 +224715,7 @@ static int sqlite3Fts5HashWrite( p->bContent = 1; }else{ /* Append a new column value, if necessary */ - assert( iCol>=p->iCol ); + assert_nc( iCol>=p->iCol ); if( iCol!=p->iCol ){ if( pHash->eDetail==FTS5_DETAIL_FULL ){ pPtr[p->nData++] = 0x01; @@ -221675,8 +225520,11 @@ static int fts5BufferCompareBlob( ** res = *pLeft - *pRight */ static int fts5BufferCompare(Fts5Buffer *pLeft, Fts5Buffer *pRight){ - int nCmp = MIN(pLeft->n, pRight->n); - int res = fts5Memcmp(pLeft->p, pRight->p, nCmp); + int nCmp, res; + nCmp = MIN(pLeft->n, pRight->n); + assert( nCmp<=0 || pLeft->p!=0 ); + assert( nCmp<=0 || pRight->p!=0 ); + res = fts5Memcmp(pLeft->p, pRight->p, nCmp); return (res==0 ? (pLeft->n - pRight->n) : res); } @@ -221772,6 +225620,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){ return pRet; } + /* ** Release a reference to data record returned by an earlier call to ** fts5DataRead(). @@ -221896,6 +225745,58 @@ static void fts5StructureRef(Fts5Structure *pStruct){ pStruct->nRef++; } +static void *sqlite3Fts5StructureRef(Fts5Index *p){ + fts5StructureRef(p->pStruct); + return (void*)p->pStruct; +} +static void sqlite3Fts5StructureRelease(void *p){ + if( p ){ + fts5StructureRelease((Fts5Structure*)p); + } +} +static int sqlite3Fts5StructureTest(Fts5Index *p, void *pStruct){ + if( p->pStruct!=(Fts5Structure*)pStruct ){ + return SQLITE_ABORT; + } + return SQLITE_OK; +} + +/* +** Ensure that structure object (*pp) is writable. +** +** This function is a no-op if (*pRc) is not SQLITE_OK when it is called. If +** an error occurs, (*pRc) is set to an SQLite error code before returning. +*/ +static void fts5StructureMakeWritable(int *pRc, Fts5Structure **pp){ + Fts5Structure *p = *pp; + if( *pRc==SQLITE_OK && p->nRef>1 ){ + i64 nByte = sizeof(Fts5Structure)+(p->nLevel-1)*sizeof(Fts5StructureLevel); + Fts5Structure *pNew; + pNew = (Fts5Structure*)sqlite3Fts5MallocZero(pRc, nByte); + if( pNew ){ + int i; + memcpy(pNew, p, nByte); + for(i=0; inLevel; i++) pNew->aLevel[i].aSeg = 0; + for(i=0; inLevel; i++){ + Fts5StructureLevel *pLvl = &pNew->aLevel[i]; + nByte = sizeof(Fts5StructureSegment) * pNew->aLevel[i].nSeg; + pLvl->aSeg = (Fts5StructureSegment*)sqlite3Fts5MallocZero(pRc, nByte); + if( pLvl->aSeg==0 ){ + for(i=0; inLevel; i++){ + sqlite3_free(pNew->aLevel[i].aSeg); + } + sqlite3_free(pNew); + return; + } + memcpy(pLvl->aSeg, p->aLevel[i].aSeg, nByte); + } + p->nRef--; + pNew->nRef = 1; + } + *pp = pNew; + } +} + /* ** Deserialize and return the structure record currently stored in serialized ** form within buffer pData/nData. @@ -221997,9 +225898,11 @@ static int fts5StructureDecode( } /* -** +** Add a level to the Fts5Structure.aLevel[] array of structure object +** (*ppStruct). */ static void fts5StructureAddLevel(int *pRc, Fts5Structure **ppStruct){ + fts5StructureMakeWritable(pRc, ppStruct); if( *pRc==SQLITE_OK ){ Fts5Structure *pStruct = *ppStruct; int nLevel = pStruct->nLevel; @@ -222793,6 +226696,7 @@ static void fts5SegIterInit( if( p->rc==SQLITE_OK ){ pIter->iLeafOffset = 4; + assert( pIter->pLeaf!=0 ); assert_nc( pIter->pLeaf->nn>4 ); assert_nc( fts5LeafFirstTermOff(pIter->pLeaf)==4 ); pIter->iPgidxOff = pIter->pLeaf->szLeaf+1; @@ -222895,8 +226799,12 @@ static void fts5SegIterReverseNewPage(Fts5Index *p, Fts5SegIter *pIter){ int iRowidOff; iRowidOff = fts5LeafFirstRowidOff(pNew); if( iRowidOff ){ - pIter->pLeaf = pNew; - pIter->iLeafOffset = iRowidOff; + if( iRowidOff>=pNew->szLeaf ){ + p->rc = FTS5_CORRUPT; + }else{ + pIter->pLeaf = pNew; + pIter->iLeafOffset = iRowidOff; + } } } @@ -223176,7 +227084,7 @@ static void fts5SegIterReverse(Fts5Index *p, Fts5SegIter *pIter){ if( pDlidx ){ int iSegid = pIter->pSeg->iSegid; pgnoLast = fts5DlidxIterPgno(pDlidx); - pLast = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, pgnoLast)); + pLast = fts5LeafRead(p, FTS5_SEGMENT_ROWID(iSegid, pgnoLast)); }else{ Fts5Data *pLeaf = pIter->pLeaf; /* Current leaf data */ @@ -223203,7 +227111,7 @@ static void fts5SegIterReverse(Fts5Index *p, Fts5SegIter *pIter){ ** forward to find the page containing the last rowid. */ for(pgno=pIter->iLeafPgno+1; !p->rc && pgno<=pSeg->pgnoLast; pgno++){ i64 iAbs = FTS5_SEGMENT_ROWID(pSeg->iSegid, pgno); - Fts5Data *pNew = fts5DataRead(p, iAbs); + Fts5Data *pNew = fts5LeafRead(p, iAbs); if( pNew ){ int iRowid, bTermless; iRowid = fts5LeafFirstRowidOff(pNew); @@ -223234,6 +227142,10 @@ static void fts5SegIterReverse(Fts5Index *p, Fts5SegIter *pIter){ pIter->pLeaf = pLast; pIter->iLeafPgno = pgnoLast; iOff = fts5LeafFirstRowidOff(pLast); + if( iOff>pLast->szLeaf ){ + p->rc = FTS5_CORRUPT; + return; + } iOff += fts5GetVarint(&pLast->p[iOff], (u64*)&pIter->iRowid); pIter->iLeafOffset = iOff; @@ -223242,7 +227154,6 @@ static void fts5SegIterReverse(Fts5Index *p, Fts5SegIter *pIter){ }else{ pIter->iEndofDoclist = fts5LeafFirstTermOff(pLast); } - } fts5SegIterReverseInitPage(p, pIter); @@ -223294,21 +227205,20 @@ static void fts5LeafSeek( Fts5SegIter *pIter, /* Iterator to seek */ const u8 *pTerm, int nTerm /* Term to search for */ ){ - int iOff; + u32 iOff; const u8 *a = pIter->pLeaf->p; - int szLeaf = pIter->pLeaf->szLeaf; - int n = pIter->pLeaf->nn; + u32 n = (u32)pIter->pLeaf->nn; u32 nMatch = 0; u32 nKeep = 0; u32 nNew = 0; u32 iTermOff; - int iPgidx; /* Current offset in pgidx */ + u32 iPgidx; /* Current offset in pgidx */ int bEndOfPage = 0; assert( p->rc==SQLITE_OK ); - iPgidx = szLeaf; + iPgidx = (u32)pIter->pLeaf->szLeaf; iPgidx += fts5GetVarint32(&a[iPgidx], iTermOff); iOff = iTermOff; if( iOff>n ){ @@ -223374,15 +227284,15 @@ static void fts5LeafSeek( if( pIter->pLeaf==0 ) return; a = pIter->pLeaf->p; if( fts5LeafIsTermless(pIter->pLeaf)==0 ){ - iPgidx = pIter->pLeaf->szLeaf; + iPgidx = (u32)pIter->pLeaf->szLeaf; iPgidx += fts5GetVarint32(&pIter->pLeaf->p[iPgidx], iOff); - if( iOff<4 || iOff>=pIter->pLeaf->szLeaf ){ + if( iOff<4 || (i64)iOff>=pIter->pLeaf->szLeaf ){ p->rc = FTS5_CORRUPT; return; }else{ nKeep = 0; iTermOff = iOff; - n = pIter->pLeaf->nn; + n = (u32)pIter->pLeaf->nn; iOff += fts5GetVarint32(&a[iOff], nNew); break; } @@ -223750,7 +227660,7 @@ static void fts5SegIterGotoPage( fts5SegIterNextPage(p, pIter); assert( p->rc!=SQLITE_OK || pIter->iLeafPgno==iLeafPgno ); - if( p->rc==SQLITE_OK ){ + if( p->rc==SQLITE_OK && ALWAYS(pIter->pLeaf!=0) ){ int iOff; u8 *a = pIter->pLeaf->p; int n = pIter->pLeaf->szLeaf; @@ -224182,7 +228092,11 @@ static void fts5SegiterPoslist( Fts5Colset *pColset, Fts5Buffer *pBuf ){ + assert( pBuf!=0 ); + assert( pSeg!=0 ); if( 0==fts5BufferGrow(&p->rc, pBuf, pSeg->nPos+FTS5_DATA_ZERO_PADDING) ){ + assert( pBuf->p!=0 ); + assert( pBuf->nSpace >= pBuf->n+pSeg->nPos+FTS5_DATA_ZERO_PADDING ); memset(&pBuf->p[pBuf->n+pSeg->nPos], 0, FTS5_DATA_ZERO_PADDING); if( pColset==0 ){ fts5ChunkIterate(p, pSeg, (void*)pBuf, fts5PoslistCallback); @@ -224406,6 +228320,7 @@ static void fts5IterSetOutputs_Full(Fts5Iter *pIter, Fts5SegIter *pSeg){ } static void fts5IterSetOutputCb(int *pRc, Fts5Iter *pIter){ + assert( pIter!=0 || (*pRc)!=SQLITE_OK ); if( *pRc==SQLITE_OK ){ Fts5Config *pConfig = pIter->pIndex->pConfig; if( pConfig->eDetail==FTS5_DETAIL_NONE ){ @@ -224477,7 +228392,10 @@ static void fts5MultiIterNew( } } *ppOut = pNew = fts5MultiIterAlloc(p, nSeg); - if( pNew==0 ) return; + if( pNew==0 ){ + assert( p->rc!=SQLITE_OK ); + goto fts5MultiIterNew_post_check; + } pNew->bRev = (0!=(flags & FTS5INDEX_QUERY_DESC)); pNew->bSkipEmpty = (0!=(flags & FTS5INDEX_QUERY_SKIPEMPTY)); pNew->pColset = pColset; @@ -224541,6 +228459,10 @@ static void fts5MultiIterNew( fts5MultiIterFree(pNew); *ppOut = 0; } + +fts5MultiIterNew_post_check: + assert( (*ppOut)!=0 || p->rc!=SQLITE_OK ); + return; } /* @@ -224588,7 +228510,8 @@ static void fts5MultiIterNew2( ** False otherwise. */ static int fts5MultiIterEof(Fts5Index *p, Fts5Iter *pIter){ - assert( p->rc + assert( pIter!=0 || p->rc!=SQLITE_OK ); + assert( p->rc!=SQLITE_OK || (pIter->aSeg[ pIter->aFirst[1].iFirst ].pLeaf==0)==pIter->base.bEof ); return (p->rc || pIter->base.bEof); @@ -225392,6 +229315,7 @@ static void fts5IndexMergeLevel( ** and last leaf page number at the same time. */ fts5WriteFinish(p, &writer, &pSeg->pgnoLast); + assert( pIter!=0 || p->rc!=SQLITE_OK ); if( fts5MultiIterEof(p, pIter) ){ int i; @@ -225492,7 +229416,7 @@ static void fts5IndexAutomerge( Fts5Structure **ppStruct, /* IN/OUT: Current structure of index */ int nLeaf /* Number of output leaves just written */ ){ - if( p->rc==SQLITE_OK && p->pConfig->nAutomerge>0 ){ + if( p->rc==SQLITE_OK && p->pConfig->nAutomerge>0 && ALWAYS((*ppStruct)!=0) ){ Fts5Structure *pStruct = *ppStruct; u64 nWrite; /* Initial value of write-counter */ int nWork; /* Number of work-quanta to perform */ @@ -226561,7 +230485,7 @@ static int sqlite3Fts5IndexQuery( if( sqlite3Fts5BufferSize(&p->rc, &buf, nToken+1)==0 ){ int iIdx = 0; /* Index to search */ int iPrefixIdx = 0; /* +1 prefix index */ - if( nToken ) memcpy(&buf.p[1], pToken, nToken); + if( nToken>0 ) memcpy(&buf.p[1], pToken, nToken); /* Figure out which index to search and set iIdx accordingly. If this ** is a prefix query for which there is no prefix index, set iIdx to @@ -226602,11 +230526,15 @@ static int sqlite3Fts5IndexQuery( /* Scan multiple terms in the main index */ int bDesc = (flags & FTS5INDEX_QUERY_DESC)!=0; fts5SetupPrefixIter(p, bDesc, iPrefixIdx, buf.p, nToken+1, pColset,&pRet); - assert( p->rc!=SQLITE_OK || pRet->pColset==0 ); - fts5IterSetOutputCb(&p->rc, pRet); - if( p->rc==SQLITE_OK ){ - Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst]; - if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg); + if( pRet==0 ){ + assert( p->rc!=SQLITE_OK ); + }else{ + assert( pRet->pColset==0 ); + fts5IterSetOutputCb(&p->rc, pRet); + if( p->rc==SQLITE_OK ){ + Fts5SegIter *pSeg = &pRet->aSeg[pRet->aFirst[1].iFirst]; + if( pSeg->pLeaf ) pRet->xSetOutputs(pRet, pSeg); + } } } @@ -226854,7 +230782,7 @@ static int fts5QueryCksum( Fts5IndexIter *pIter = 0; int rc = sqlite3Fts5IndexQuery(p, z, n, flags, 0, &pIter); - while( rc==SQLITE_OK && 0==sqlite3Fts5IterEof(pIter) ){ + while( rc==SQLITE_OK && ALWAYS(pIter!=0) && 0==sqlite3Fts5IterEof(pIter) ){ i64 rowid = pIter->iRowid; if( eDetail==FTS5_DETAIL_NONE ){ @@ -227219,6 +231147,7 @@ static int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum, int bUseCksum Fts5Buffer poslist = {0,0,0}; /* Buffer used to hold a poslist */ Fts5Iter *pIter; /* Used to iterate through entire index */ Fts5Structure *pStruct; /* Index structure */ + int iLvl, iSeg; #ifdef SQLITE_DEBUG /* Used by extra internal tests only run if NDEBUG is not defined */ @@ -227229,15 +231158,16 @@ static int sqlite3Fts5IndexIntegrityCheck(Fts5Index *p, u64 cksum, int bUseCksum /* Load the FTS index structure */ pStruct = fts5StructureRead(p); + if( pStruct==0 ){ + assert( p->rc!=SQLITE_OK ); + return fts5IndexReturn(p); + } /* Check that the internal nodes of each segment match the leaves */ - if( pStruct ){ - int iLvl, iSeg; - for(iLvl=0; iLvlnLevel; iLvl++){ - for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){ - Fts5StructureSegment *pSeg = &pStruct->aLevel[iLvl].aSeg[iSeg]; - fts5IndexIntegrityCheckSegment(p, pSeg); - } + for(iLvl=0; iLvlnLevel; iLvl++){ + for(iSeg=0; iSegaLevel[iLvl].nSeg; iSeg++){ + Fts5StructureSegment *pSeg = &pStruct->aLevel[iLvl].aSeg[iSeg]; + fts5IndexIntegrityCheckSegment(p, pSeg); } } @@ -228614,7 +232544,7 @@ static int fts5SorterNext(Fts5Cursor *pCsr){ rc = sqlite3_step(pSorter->pStmt); if( rc==SQLITE_DONE ){ rc = SQLITE_OK; - CsrFlagSet(pCsr, FTS5CSR_EOF); + CsrFlagSet(pCsr, FTS5CSR_EOF|FTS5CSR_REQUIRE_CONTENT); }else if( rc==SQLITE_ROW ){ const u8 *a; const u8 *aBlob; @@ -229184,7 +233114,8 @@ static int fts5FilterMethod( pTab->pStorage, fts5StmtType(pCsr), &pCsr->pStmt, &pTab->p.base.zErrMsg ); if( rc==SQLITE_OK ){ - if( pCsr->ePlan==FTS5_PLAN_ROWID ){ + if( pRowidEq!=0 ){ + assert( pCsr->ePlan==FTS5_PLAN_ROWID ); sqlite3_bind_value(pCsr->pStmt, 1, pRowidEq); }else{ sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iFirstRowid); @@ -230602,7 +234533,7 @@ static void fts5SourceIdFunc( ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); - sqlite3_result_text(pCtx, "fts5: 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5", -1, SQLITE_TRANSIENT); + sqlite3_result_text(pCtx, "fts5: 2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe", -1, SQLITE_TRANSIENT); } /* @@ -231153,12 +235084,16 @@ static int fts5StorageDeleteFromIndex( if( pConfig->abUnindexed[iCol-1]==0 ){ const char *zText; int nText; + assert( pSeek==0 || apVal==0 ); + assert( pSeek!=0 || apVal!=0 ); if( pSeek ){ zText = (const char*)sqlite3_column_text(pSeek, iCol); nText = sqlite3_column_bytes(pSeek, iCol); - }else{ + }else if( ALWAYS(apVal) ){ zText = (const char*)sqlite3_value_text(apVal[iCol-1]); nText = sqlite3_value_bytes(apVal[iCol-1]); + }else{ + continue; } ctx.szCol = 0; rc = sqlite3Fts5Tokenize(pConfig, FTS5_TOKENIZE_DOCUMENT, @@ -231794,8 +235729,9 @@ static int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol){ assert( p->pConfig->bColumnsize ); rc = fts5StorageGetStmt(p, FTS5_STMT_LOOKUP_DOCSIZE, &pLookup, 0); - if( rc==SQLITE_OK ){ + if( pLookup ){ int bCorrupt = 1; + assert( rc==SQLITE_OK ); sqlite3_bind_int64(pLookup, 1, iRowid); if( SQLITE_ROW==sqlite3_step(pLookup) ){ const u8 *aBlob = sqlite3_column_blob(pLookup, 0); @@ -231808,6 +235744,8 @@ static int sqlite3Fts5StorageDocsize(Fts5Storage *p, i64 iRowid, int *aCol){ if( bCorrupt && rc==SQLITE_OK ){ rc = FTS5_CORRUPT; } + }else{ + assert( rc!=SQLITE_OK ); } return rc; @@ -234498,6 +238436,7 @@ struct Fts5VocabCursor { int bEof; /* True if this cursor is at EOF */ Fts5IndexIter *pIter; /* Term/rowid iterator object */ + void *pStruct; /* From sqlite3Fts5StructureRef() */ int nLeTerm; /* Size of zLeTerm in bytes */ char *zLeTerm; /* (term <= $zLeTerm) paramater, or NULL */ @@ -234811,7 +238750,7 @@ static int fts5VocabOpenMethod( } if( rc==SQLITE_OK ){ - int nByte = pFts5->pConfig->nCol * sizeof(i64)*2 + sizeof(Fts5VocabCursor); + i64 nByte = pFts5->pConfig->nCol * sizeof(i64)*2 + sizeof(Fts5VocabCursor); pCsr = (Fts5VocabCursor*)sqlite3Fts5MallocZero(&rc, nByte); } @@ -234831,6 +238770,8 @@ static int fts5VocabOpenMethod( static void fts5VocabResetCursor(Fts5VocabCursor *pCsr){ pCsr->rowid = 0; sqlite3Fts5IterClose(pCsr->pIter); + sqlite3Fts5StructureRelease(pCsr->pStruct); + pCsr->pStruct = 0; pCsr->pIter = 0; sqlite3_free(pCsr->zLeTerm); pCsr->nLeTerm = -1; @@ -234908,9 +238849,11 @@ static int fts5VocabInstanceNext(Fts5VocabCursor *pCsr){ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){ Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor; Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab; - int rc = SQLITE_OK; int nCol = pCsr->pFts5->pConfig->nCol; + int rc; + rc = sqlite3Fts5StructureTest(pCsr->pFts5->pIndex, pCsr->pStruct); + if( rc!=SQLITE_OK ) return rc; pCsr->rowid++; if( pTab->eType==FTS5_VOCAB_INSTANCE ){ @@ -235084,6 +239027,9 @@ static int fts5VocabFilterMethod( if( rc==SQLITE_OK ){ Fts5Index *pIndex = pCsr->pFts5->pIndex; rc = sqlite3Fts5IndexQuery(pIndex, zTerm, nTerm, f, 0, &pCsr->pIter); + if( rc==SQLITE_OK ){ + pCsr->pStruct = sqlite3Fts5StructureRef(pIndex); + } } if( rc==SQLITE_OK && eType==FTS5_VOCAB_INSTANCE ){ rc = fts5VocabInstanceNewTerm(pCsr); @@ -235528,10 +239474,6 @@ SQLITE_API int sqlite3_stmt_init( #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ -#if __LINE__!=235528 -#undef SQLITE_SOURCE_ID -#define SQLITE_SOURCE_ID "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafaalt2" -#endif /* Return the source-id for this library */ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } /************************** End of sqlite3.c ******************************/ diff --git a/database/sqlite/sqlite3.h b/database/sqlite/sqlite3.h index 3274bbe07..de393da9d 100644 --- a/database/sqlite/sqlite3.h +++ b/database/sqlite/sqlite3.h @@ -43,7 +43,30 @@ extern "C" { /* -** Provide the ability to override linkage features of the interface. +** Facilitate override of interface linkage and calling conventions. +** Be aware that these macros may not be used within this particular +** translation of the amalgamation and its associated header file. +** +** The SQLITE_EXTERN and SQLITE_API macros are used to instruct the +** compiler that the target identifier should have external linkage. +** +** The SQLITE_CDECL macro is used to set the calling convention for +** public functions that accept a variable number of arguments. +** +** The SQLITE_APICALL macro is used to set the calling convention for +** public functions that accept a fixed number of arguments. +** +** The SQLITE_STDCALL macro is no longer used and is now deprecated. +** +** The SQLITE_CALLBACK macro is used to set the calling convention for +** function pointers. +** +** The SQLITE_SYSAPI macro is used to set the calling convention for +** functions provided by the operating system. +** +** Currently, the SQLITE_CDECL, SQLITE_APICALL, SQLITE_CALLBACK, and +** SQLITE_SYSAPI macros are used only when building for environments +** that require non-default calling conventions. */ #ifndef SQLITE_EXTERN # define SQLITE_EXTERN extern @@ -123,9 +146,9 @@ extern "C" { ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ -#define SQLITE_VERSION "3.36.0" -#define SQLITE_VERSION_NUMBER 3036000 -#define SQLITE_SOURCE_ID "2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5" +#define SQLITE_VERSION "3.38.5" +#define SQLITE_VERSION_NUMBER 3038005 +#define SQLITE_SOURCE_ID "2022-05-06 15:25:27 78d9c993d404cdfaa7fdd2973fa1052e3da9f66215cff9c5540ebe55c407d9fe" /* ** CAPI3REF: Run-Time Library Version Numbers @@ -537,12 +560,13 @@ SQLITE_API int sqlite3_exec( #define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8)) #define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) #define SQLITE_CONSTRAINT_PINNED (SQLITE_CONSTRAINT |(11<<8)) +#define SQLITE_CONSTRAINT_DATATYPE (SQLITE_CONSTRAINT |(12<<8)) #define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) #define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) #define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) #define SQLITE_AUTH_USER (SQLITE_AUTH | (1<<8)) #define SQLITE_OK_LOAD_PERMANENTLY (SQLITE_OK | (1<<8)) -#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) +#define SQLITE_OK_SYMLINK (SQLITE_OK | (2<<8)) /* internal use only */ /* ** CAPI3REF: Flags For File Open Operations @@ -550,6 +574,19 @@ SQLITE_API int sqlite3_exec( ** These bit values are intended for use in the ** 3rd parameter to the [sqlite3_open_v2()] interface and ** in the 4th parameter to the [sqlite3_vfs.xOpen] method. +** +** Only those flags marked as "Ok for sqlite3_open_v2()" may be +** used as the third argument to the [sqlite3_open_v2()] interface. +** The other flags have historically been ignored by sqlite3_open_v2(), +** though future versions of SQLite might change so that an error is +** raised if any of the disallowed bits are passed into sqlite3_open_v2(). +** Applications should not depend on the historical behavior. +** +** Note in particular that passing the SQLITE_OPEN_EXCLUSIVE flag into +** [sqlite3_open_v2()] does *not* cause the underlying database file +** to be opened using O_EXCL. Passing SQLITE_OPEN_EXCLUSIVE into +** [sqlite3_open_v2()] has historically be a no-op and might become an +** error in future versions of SQLite. */ #define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ @@ -572,6 +609,7 @@ SQLITE_API int sqlite3_exec( #define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ #define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ #define SQLITE_OPEN_NOFOLLOW 0x01000000 /* Ok for sqlite3_open_v2() */ +#define SQLITE_OPEN_EXRESCODE 0x02000000 /* Extended result codes */ /* Reserved: 0x00F00000 */ /* Legacy compatibility: */ @@ -2464,11 +2502,14 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); ** CAPI3REF: Count The Number Of Rows Modified ** METHOD: sqlite3 ** -** ^This function returns the number of rows modified, inserted or +** ^These functions return the number of rows modified, inserted or ** deleted by the most recently completed INSERT, UPDATE or DELETE ** statement on the database connection specified by the only parameter. -** ^Executing any other type of SQL statement does not modify the value -** returned by this function. +** The two functions are identical except for the type of the return value +** and that if the number of rows modified by the most recent INSERT, UPDATE +** or DELETE is greater than the maximum value supported by type "int", then +** the return value of sqlite3_changes() is undefined. ^Executing any other +** type of SQL statement does not modify the value returned by these functions. ** ** ^Only changes made directly by the INSERT, UPDATE or DELETE statement are ** considered - auxiliary changes caused by [CREATE TRIGGER | triggers], @@ -2517,16 +2558,21 @@ SQLITE_API void sqlite3_set_last_insert_rowid(sqlite3*,sqlite3_int64); ** */ SQLITE_API int sqlite3_changes(sqlite3*); +SQLITE_API sqlite3_int64 sqlite3_changes64(sqlite3*); /* ** CAPI3REF: Total Number Of Rows Modified ** METHOD: sqlite3 ** -** ^This function returns the total number of rows inserted, modified or +** ^These functions return the total number of rows inserted, modified or ** deleted by all [INSERT], [UPDATE] or [DELETE] statements completed ** since the database connection was opened, including those executed as -** part of trigger programs. ^Executing any other type of SQL statement -** does not affect the value returned by sqlite3_total_changes(). +** part of trigger programs. The two functions are identical except for the +** type of the return value and that if the number of rows modified by the +** connection exceeds the maximum value supported by type "int", then +** the return value of sqlite3_total_changes() is undefined. ^Executing +** any other type of SQL statement does not affect the value returned by +** sqlite3_total_changes(). ** ** ^Changes made as part of [foreign key actions] are included in the ** count, but those made as part of REPLACE constraint resolution are @@ -2554,6 +2600,7 @@ SQLITE_API int sqlite3_changes(sqlite3*); ** */ SQLITE_API int sqlite3_total_changes(sqlite3*); +SQLITE_API sqlite3_int64 sqlite3_total_changes64(sqlite3*); /* ** CAPI3REF: Interrupt A Long-Running Query @@ -3383,6 +3430,14 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** the default shared cache setting provided by ** [sqlite3_enable_shared_cache()].)^ ** +** [[OPEN_EXRESCODE]] ^(
[SQLITE_OPEN_EXRESCODE]
+**
The database connection comes up in "extended result code mode". +** In other words, the database behaves has if +** [sqlite3_extended_result_codes(db,1)] where called on the database +** connection as soon as the connection is created. In addition to setting +** the extended result code mode, this flag also causes [sqlite3_open_v2()] +** to return an extended result code.
+** ** [[OPEN_NOFOLLOW]] ^(
[SQLITE_OPEN_NOFOLLOW]
**
The database filename is not allowed to be a symbolic link
** )^ @@ -3390,7 +3445,15 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); ** If the 3rd parameter to sqlite3_open_v2() is not one of the ** required combinations shown above optionally combined with other ** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] -** then the behavior is undefined. +** then the behavior is undefined. Historic versions of SQLite +** have silently ignored surplus bits in the flags parameter to +** sqlite3_open_v2(), however that behavior might not be carried through +** into future versions of SQLite and so applications should not rely +** upon it. Note in particular that the SQLITE_OPEN_EXCLUSIVE flag is a no-op +** for sqlite3_open_v2(). The SQLITE_OPEN_EXCLUSIVE does *not* cause +** the open to fail if the database already exists. The SQLITE_OPEN_EXCLUSIVE +** flag is intended for use by the [sqlite3_vfs|VFS interface] only, and not +** by sqlite3_open_v2(). ** ** ^The fourth parameter to sqlite3_open_v2() is the name of the ** [sqlite3_vfs] object that defines the operating system interface that @@ -3761,13 +3824,14 @@ SQLITE_API void sqlite3_free_filename(char*); ** sqlite3_extended_errcode() might change with each API call. ** Except, there are some interfaces that are guaranteed to never ** change the value of the error code. The error-code preserving -** interfaces are: +** interfaces include the following: ** **
    **
  • sqlite3_errcode() **
  • sqlite3_extended_errcode() **
  • sqlite3_errmsg() **
  • sqlite3_errmsg16() +**
  • sqlite3_error_offset() **
** ** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language @@ -3782,6 +3846,13 @@ SQLITE_API void sqlite3_free_filename(char*); ** ^(Memory to hold the error message string is managed internally ** and must not be freed by the application)^. ** +** ^If the most recent error references a specific token in the input +** SQL, the sqlite3_error_offset() interface returns the byte offset +** of the start of that token. ^The byte offset returned by +** sqlite3_error_offset() assumes that the input SQL is UTF8. +** ^If the most recent error does not reference a specific token in the input +** SQL, then the sqlite3_error_offset() function returns -1. +** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. @@ -3801,6 +3872,7 @@ SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); SQLITE_API const char *sqlite3_errmsg(sqlite3*); SQLITE_API const void *sqlite3_errmsg16(sqlite3*); SQLITE_API const char *sqlite3_errstr(int); +SQLITE_API int sqlite3_error_offset(sqlite3 *db); /* ** CAPI3REF: Prepared Statement Object @@ -4158,12 +4230,17 @@ SQLITE_API int sqlite3_prepare16_v3( ** are managed by SQLite and are automatically freed when the prepared ** statement is finalized. ** ^The string returned by sqlite3_expanded_sql(P), on the other hand, -** is obtained from [sqlite3_malloc()] and must be free by the application +** is obtained from [sqlite3_malloc()] and must be freed by the application ** by passing it to [sqlite3_free()]. +** +** ^The sqlite3_normalized_sql() interface is only available if +** the [SQLITE_ENABLE_NORMALIZE] compile-time option is defined. */ SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); SQLITE_API char *sqlite3_expanded_sql(sqlite3_stmt *pStmt); +#ifdef SQLITE_ENABLE_NORMALIZE SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); +#endif /* ** CAPI3REF: Determine If An SQL Statement Writes The Database @@ -4207,6 +4284,10 @@ SQLITE_API const char *sqlite3_normalized_sql(sqlite3_stmt *pStmt); ** be false. ^Similarly, a CREATE TABLE IF NOT EXISTS statement is a ** read-only no-op if the table already exists, but ** sqlite3_stmt_readonly() still returns false for such a statement. +** +** ^If prepared statement X is an [EXPLAIN] or [EXPLAIN QUERY PLAN] +** statement, then sqlite3_stmt_readonly(X) returns the same value as +** if the EXPLAIN or EXPLAIN QUERY PLAN prefix were omitted. */ SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); @@ -4275,6 +4356,8 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); ** ** ^The sqlite3_value objects that are passed as parameters into the ** implementation of [application-defined SQL functions] are protected. +** ^The sqlite3_value objects returned by [sqlite3_vtab_rhs_value()] +** are protected. ** ^The sqlite3_value object returned by ** [sqlite3_column_value()] is unprotected. ** Unprotected sqlite3_value objects may only be used as arguments @@ -4896,6 +4979,10 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** even empty strings, are always zero-terminated. ^The return ** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. ** +** ^Strings returned by sqlite3_column_text16() always have the endianness +** which is native to the platform, regardless of the text encoding set +** for the database. +** ** Warning: ^The object returned by [sqlite3_column_value()] is an ** [unprotected sqlite3_value] object. In a multithreaded environment, ** an unprotected sqlite3_value object may only be used safely with @@ -4909,7 +4996,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** [application-defined SQL functions] or [virtual tables], not within ** top-level application code. ** -** The these routines may attempt to convert the datatype of the result. +** These routines may attempt to convert the datatype of the result. ** ^For example, if the internal representation is FLOAT and a text result ** is requested, [sqlite3_snprintf()] is used internally to perform the ** conversion automatically. ^(The following table details the conversions @@ -4934,7 +5021,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); ** TEXT BLOB No change ** BLOB INTEGER [CAST] to INTEGER ** BLOB FLOAT [CAST] to REAL -** BLOB TEXT Add a zero terminator if needed +** BLOB TEXT [CAST] to TEXT, ensure zero terminator ** ** )^ ** @@ -6347,6 +6434,72 @@ SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); +/* +** CAPI3REF: Autovacuum Compaction Amount Callback +** METHOD: sqlite3 +** +** ^The sqlite3_autovacuum_pages(D,C,P,X) interface registers a callback +** function C that is invoked prior to each autovacuum of the database +** file. ^The callback is passed a copy of the generic data pointer (P), +** the schema-name of the attached database that is being autovacuumed, +** the the size of the database file in pages, the number of free pages, +** and the number of bytes per page, respectively. The callback should +** return the number of free pages that should be removed by the +** autovacuum. ^If the callback returns zero, then no autovacuum happens. +** ^If the value returned is greater than or equal to the number of +** free pages, then a complete autovacuum happens. +** +**

^If there are multiple ATTACH-ed database files that are being +** modified as part of a transaction commit, then the autovacuum pages +** callback is invoked separately for each file. +** +**

The callback is not reentrant. The callback function should +** not attempt to invoke any other SQLite interface. If it does, bad +** things may happen, including segmentation faults and corrupt database +** files. The callback function should be a simple function that +** does some arithmetic on its input parameters and returns a result. +** +** ^The X parameter to sqlite3_autovacuum_pages(D,C,P,X) is an optional +** destructor for the P parameter. ^If X is not NULL, then X(P) is +** invoked whenever the database connection closes or when the callback +** is overwritten by another invocation of sqlite3_autovacuum_pages(). +** +**

^There is only one autovacuum pages callback per database connection. +** ^Each call to the sqlite3_autovacuum_pages() interface overrides all +** previous invocations for that database connection. ^If the callback +** argument (C) to sqlite3_autovacuum_pages(D,C,P,X) is a NULL pointer, +** then the autovacuum steps callback is cancelled. The return value +** from sqlite3_autovacuum_pages() is normally SQLITE_OK, but might +** be some other error code if something goes wrong. The current +** implementation will only return SQLITE_OK or SQLITE_MISUSE, but other +** return codes might be added in future releases. +** +**

If no autovacuum pages callback is specified (the usual case) or +** a NULL pointer is provided for the callback, +** then the default behavior is to vacuum all free pages. So, in other +** words, the default behavior is the same as if the callback function +** were something like this: +** +**

+**     unsigned int demonstration_autovac_pages_callback(
+**       void *pClientData,
+**       const char *zSchema,
+**       unsigned int nDbPage,
+**       unsigned int nFreePage,
+**       unsigned int nBytePerPage
+**     ){
+**       return nFreePage;
+**     }
+** 
+*/ +SQLITE_API int sqlite3_autovacuum_pages( + sqlite3 *db, + unsigned int(*)(void*,const char*,unsigned int,unsigned int,unsigned int), + void*, + void(*)(void*) +); + + /* ** CAPI3REF: Data Change Notification Callbacks ** METHOD: sqlite3 @@ -6988,24 +7141,56 @@ struct sqlite3_index_info { ** ** These macros define the allowed values for the ** [sqlite3_index_info].aConstraint[].op field. Each value represents -** an operator that is part of a constraint term in the wHERE clause of +** an operator that is part of a constraint term in the WHERE clause of ** a query that uses a [virtual table]. -*/ -#define SQLITE_INDEX_CONSTRAINT_EQ 2 -#define SQLITE_INDEX_CONSTRAINT_GT 4 -#define SQLITE_INDEX_CONSTRAINT_LE 8 -#define SQLITE_INDEX_CONSTRAINT_LT 16 -#define SQLITE_INDEX_CONSTRAINT_GE 32 -#define SQLITE_INDEX_CONSTRAINT_MATCH 64 -#define SQLITE_INDEX_CONSTRAINT_LIKE 65 -#define SQLITE_INDEX_CONSTRAINT_GLOB 66 -#define SQLITE_INDEX_CONSTRAINT_REGEXP 67 -#define SQLITE_INDEX_CONSTRAINT_NE 68 -#define SQLITE_INDEX_CONSTRAINT_ISNOT 69 -#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 -#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 -#define SQLITE_INDEX_CONSTRAINT_IS 72 -#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 +** +** ^The left-hand operand of the operator is given by the corresponding +** aConstraint[].iColumn field. ^An iColumn of -1 indicates the left-hand +** operand is the rowid. +** The SQLITE_INDEX_CONSTRAINT_LIMIT and SQLITE_INDEX_CONSTRAINT_OFFSET +** operators have no left-hand operand, and so for those operators the +** corresponding aConstraint[].iColumn is meaningless and should not be +** used. +** +** All operator values from SQLITE_INDEX_CONSTRAINT_FUNCTION through +** value 255 are reserved to represent functions that are overloaded +** by the [xFindFunction|xFindFunction method] of the virtual table +** implementation. +** +** The right-hand operands for each constraint might be accessible using +** the [sqlite3_vtab_rhs_value()] interface. Usually the right-hand +** operand is only available if it appears as a single constant literal +** in the input SQL. If the right-hand operand is another column or an +** expression (even a constant expression) or a parameter, then the +** sqlite3_vtab_rhs_value() probably will not be able to extract it. +** ^The SQLITE_INDEX_CONSTRAINT_ISNULL and +** SQLITE_INDEX_CONSTRAINT_ISNOTNULL operators have no right-hand operand +** and hence calls to sqlite3_vtab_rhs_value() for those operators will +** always return SQLITE_NOTFOUND. +** +** The collating sequence to be used for comparison can be found using +** the [sqlite3_vtab_collation()] interface. For most real-world virtual +** tables, the collating sequence of constraints does not matter (for example +** because the constraints are numeric) and so the sqlite3_vtab_collation() +** interface is no commonly needed. +*/ +#define SQLITE_INDEX_CONSTRAINT_EQ 2 +#define SQLITE_INDEX_CONSTRAINT_GT 4 +#define SQLITE_INDEX_CONSTRAINT_LE 8 +#define SQLITE_INDEX_CONSTRAINT_LT 16 +#define SQLITE_INDEX_CONSTRAINT_GE 32 +#define SQLITE_INDEX_CONSTRAINT_MATCH 64 +#define SQLITE_INDEX_CONSTRAINT_LIKE 65 +#define SQLITE_INDEX_CONSTRAINT_GLOB 66 +#define SQLITE_INDEX_CONSTRAINT_REGEXP 67 +#define SQLITE_INDEX_CONSTRAINT_NE 68 +#define SQLITE_INDEX_CONSTRAINT_ISNOT 69 +#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70 +#define SQLITE_INDEX_CONSTRAINT_ISNULL 71 +#define SQLITE_INDEX_CONSTRAINT_IS 72 +#define SQLITE_INDEX_CONSTRAINT_LIMIT 73 +#define SQLITE_INDEX_CONSTRAINT_OFFSET 74 +#define SQLITE_INDEX_CONSTRAINT_FUNCTION 150 /* ** CAPI3REF: Register A Virtual Table Implementation @@ -7034,7 +7219,7 @@ struct sqlite3_index_info { ** destructor. ** ** ^If the third parameter (the pointer to the sqlite3_module object) is -** NULL then no new module is create and any existing modules with the +** NULL then no new module is created and any existing modules with the ** same name are dropped. ** ** See also: [sqlite3_drop_modules()] @@ -7810,7 +7995,8 @@ SQLITE_API int sqlite3_test_control(int op, ...); #define SQLITE_TESTCTRL_SEEK_COUNT 30 #define SQLITE_TESTCTRL_TRACEFLAGS 31 #define SQLITE_TESTCTRL_TUNE 32 -#define SQLITE_TESTCTRL_LAST 32 /* Largest TESTCTRL */ +#define SQLITE_TESTCTRL_LOGEST 33 +#define SQLITE_TESTCTRL_LAST 33 /* Largest TESTCTRL */ /* ** CAPI3REF: SQL Keyword Checking @@ -8333,6 +8519,16 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); ** The counter is incremented on the first [sqlite3_step()] call of each ** cycle. ** +** [[SQLITE_STMTSTATUS_FILTER_MISS]] +** [[SQLITE_STMTSTATUS_FILTER HIT]] +**
SQLITE_STMTSTATUS_FILTER_HIT
+** SQLITE_STMTSTATUS_FILTER_MISS
+**
^SQLITE_STMTSTATUS_FILTER_HIT is the number of times that a join +** step was bypassed because a Bloom filter returned not-found. The +** corresponding SQLITE_STMTSTATUS_FILTER_MISS value is the number of +** times that the Bloom filter returned a find, and thus the join step +** had to be processed as normal. +** ** [[SQLITE_STMTSTATUS_MEMUSED]]
SQLITE_STMTSTATUS_MEMUSED
**
^This is the approximate number of bytes of heap memory ** used to store the prepared statement. ^This value is not actually @@ -8347,6 +8543,8 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); #define SQLITE_STMTSTATUS_VM_STEP 4 #define SQLITE_STMTSTATUS_REPREPARE 5 #define SQLITE_STMTSTATUS_RUN 6 +#define SQLITE_STMTSTATUS_FILTER_MISS 7 +#define SQLITE_STMTSTATUS_FILTER_HIT 8 #define SQLITE_STMTSTATUS_MEMUSED 99 /* @@ -9010,8 +9208,9 @@ SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); ** ** A single database handle may have at most a single write-ahead log callback ** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any -** previously registered write-ahead log callback. ^Note that the -** [sqlite3_wal_autocheckpoint()] interface and the +** previously registered write-ahead log callback. ^The return value is +** a copy of the third parameter from the previous call, if any, or 0. +** ^Note that the [sqlite3_wal_autocheckpoint()] interface and the ** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will ** overwrite any prior [sqlite3_wal_hook()] settings. */ @@ -9314,19 +9513,269 @@ SQLITE_API int sqlite3_vtab_nochange(sqlite3_context*); /* ** CAPI3REF: Determine The Collation For a Virtual Table Constraint +** METHOD: sqlite3_index_info ** ** This function may only be called from within a call to the [xBestIndex] -** method of a [virtual table]. +** method of a [virtual table]. This function returns a pointer to a string +** that is the name of the appropriate collation sequence to use for text +** comparisons on the constraint identified by its arguments. ** -** The first argument must be the sqlite3_index_info object that is the -** first parameter to the xBestIndex() method. The second argument must be -** an index into the aConstraint[] array belonging to the sqlite3_index_info -** structure passed to xBestIndex. This function returns a pointer to a buffer -** containing the name of the collation sequence for the corresponding -** constraint. +** The first argument must be the pointer to the [sqlite3_index_info] object +** that is the first parameter to the xBestIndex() method. The second argument +** must be an index into the aConstraint[] array belonging to the +** sqlite3_index_info structure passed to xBestIndex. +** +** Important: +** The first parameter must be the same pointer that is passed into the +** xBestMethod() method. The first parameter may not be a pointer to a +** different [sqlite3_index_info] object, even an exact copy. +** +** The return value is computed as follows: +** +**
    +**
  1. If the constraint comes from a WHERE clause expression that contains +** a [COLLATE operator], then the name of the collation specified by +** that COLLATE operator is returned. +**

  2. If there is no COLLATE operator, but the column that is the subject +** of the constraint specifies an alternative collating sequence via +** a [COLLATE clause] on the column definition within the CREATE TABLE +** statement that was passed into [sqlite3_declare_vtab()], then the +** name of that alternative collating sequence is returned. +**

  3. Otherwise, "BINARY" is returned. +**

*/ SQLITE_API SQLITE_EXPERIMENTAL const char *sqlite3_vtab_collation(sqlite3_index_info*,int); +/* +** CAPI3REF: Determine if a virtual table query is DISTINCT +** METHOD: sqlite3_index_info +** +** This API may only be used from within an [xBestIndex|xBestIndex method] +** of a [virtual table] implementation. The result of calling this +** interface from outside of xBestIndex() is undefined and probably harmful. +** +** ^The sqlite3_vtab_distinct() interface returns an integer that is +** either 0, 1, or 2. The integer returned by sqlite3_vtab_distinct() +** gives the virtual table additional information about how the query +** planner wants the output to be ordered. As long as the virtual table +** can meet the ordering requirements of the query planner, it may set +** the "orderByConsumed" flag. +** +**
  1. +** ^If the sqlite3_vtab_distinct() interface returns 0, that means +** that the query planner needs the virtual table to return all rows in the +** sort order defined by the "nOrderBy" and "aOrderBy" fields of the +** [sqlite3_index_info] object. This is the default expectation. If the +** virtual table outputs all rows in sorted order, then it is always safe for +** the xBestIndex method to set the "orderByConsumed" flag, regardless of +** the return value from sqlite3_vtab_distinct(). +**

  2. +** ^(If the sqlite3_vtab_distinct() interface returns 1, that means +** that the query planner does not need the rows to be returned in sorted order +** as long as all rows with the same values in all columns identified by the +** "aOrderBy" field are adjacent.)^ This mode is used when the query planner +** is doing a GROUP BY. +**

  3. +** ^(If the sqlite3_vtab_distinct() interface returns 2, that means +** that the query planner does not need the rows returned in any particular +** order, as long as rows with the same values in all "aOrderBy" columns +** are adjacent.)^ ^(Furthermore, only a single row for each particular +** combination of values in the columns identified by the "aOrderBy" field +** needs to be returned.)^ ^It is always ok for two or more rows with the same +** values in all "aOrderBy" columns to be returned, as long as all such rows +** are adjacent. ^The virtual table may, if it chooses, omit extra rows +** that have the same value for all columns identified by "aOrderBy". +** ^However omitting the extra rows is optional. +** This mode is used for a DISTINCT query. +**

+** +** ^For the purposes of comparing virtual table output values to see if the +** values are same value for sorting purposes, two NULL values are considered +** to be the same. In other words, the comparison operator is "IS" +** (or "IS NOT DISTINCT FROM") and not "==". +** +** If a virtual table implementation is unable to meet the requirements +** specified above, then it must not set the "orderByConsumed" flag in the +** [sqlite3_index_info] object or an incorrect answer may result. +** +** ^A virtual table implementation is always free to return rows in any order +** it wants, as long as the "orderByConsumed" flag is not set. ^When the +** the "orderByConsumed" flag is unset, the query planner will add extra +** [bytecode] to ensure that the final results returned by the SQL query are +** ordered correctly. The use of the "orderByConsumed" flag and the +** sqlite3_vtab_distinct() interface is merely an optimization. ^Careful +** use of the sqlite3_vtab_distinct() interface and the "orderByConsumed" +** flag might help queries against a virtual table to run faster. Being +** overly aggressive and setting the "orderByConsumed" flag when it is not +** valid to do so, on the other hand, might cause SQLite to return incorrect +** results. +*/ +SQLITE_API int sqlite3_vtab_distinct(sqlite3_index_info*); + +/* +** CAPI3REF: Identify and handle IN constraints in xBestIndex +** +** This interface may only be used from within an +** [xBestIndex|xBestIndex() method] of a [virtual table] implementation. +** The result of invoking this interface from any other context is +** undefined and probably harmful. +** +** ^(A constraint on a virtual table of the form +** "[IN operator|column IN (...)]" is +** communicated to the xBestIndex method as a +** [SQLITE_INDEX_CONSTRAINT_EQ] constraint.)^ If xBestIndex wants to use +** this constraint, it must set the corresponding +** aConstraintUsage[].argvIndex to a postive integer. ^(Then, under +** the usual mode of handling IN operators, SQLite generates [bytecode] +** that invokes the [xFilter|xFilter() method] once for each value +** on the right-hand side of the IN operator.)^ Thus the virtual table +** only sees a single value from the right-hand side of the IN operator +** at a time. +** +** In some cases, however, it would be advantageous for the virtual +** table to see all values on the right-hand of the IN operator all at +** once. The sqlite3_vtab_in() interfaces facilitates this in two ways: +** +**
    +**
  1. +** ^A call to sqlite3_vtab_in(P,N,-1) will return true (non-zero) +** if and only if the [sqlite3_index_info|P->aConstraint][N] constraint +** is an [IN operator] that can be processed all at once. ^In other words, +** sqlite3_vtab_in() with -1 in the third argument is a mechanism +** by which the virtual table can ask SQLite if all-at-once processing +** of the IN operator is even possible. +** +**

  2. +** ^A call to sqlite3_vtab_in(P,N,F) with F==1 or F==0 indicates +** to SQLite that the virtual table does or does not want to process +** the IN operator all-at-once, respectively. ^Thus when the third +** parameter (F) is non-negative, this interface is the mechanism by +** which the virtual table tells SQLite how it wants to process the +** IN operator. +**

+** +** ^The sqlite3_vtab_in(P,N,F) interface can be invoked multiple times +** within the same xBestIndex method call. ^For any given P,N pair, +** the return value from sqlite3_vtab_in(P,N,F) will always be the same +** within the same xBestIndex call. ^If the interface returns true +** (non-zero), that means that the constraint is an IN operator +** that can be processed all-at-once. ^If the constraint is not an IN +** operator or cannot be processed all-at-once, then the interface returns +** false. +** +** ^(All-at-once processing of the IN operator is selected if both of the +** following conditions are met: +** +**
    +**
  1. The P->aConstraintUsage[N].argvIndex value is set to a positive +** integer. This is how the virtual table tells SQLite that it wants to +** use the N-th constraint. +** +**

  2. The last call to sqlite3_vtab_in(P,N,F) for which F was +** non-negative had F>=1. +**

)^ +** +** ^If either or both of the conditions above are false, then SQLite uses +** the traditional one-at-a-time processing strategy for the IN constraint. +** ^If both conditions are true, then the argvIndex-th parameter to the +** xFilter method will be an [sqlite3_value] that appears to be NULL, +** but which can be passed to [sqlite3_vtab_in_first()] and +** [sqlite3_vtab_in_next()] to find all values on the right-hand side +** of the IN constraint. +*/ +SQLITE_API int sqlite3_vtab_in(sqlite3_index_info*, int iCons, int bHandle); + +/* +** CAPI3REF: Find all elements on the right-hand side of an IN constraint. +** +** These interfaces are only useful from within the +** [xFilter|xFilter() method] of a [virtual table] implementation. +** The result of invoking these interfaces from any other context +** is undefined and probably harmful. +** +** The X parameter in a call to sqlite3_vtab_in_first(X,P) or +** sqlite3_vtab_in_next(X,P) must be one of the parameters to the +** xFilter method which invokes these routines, and specifically +** a parameter that was previously selected for all-at-once IN constraint +** processing use the [sqlite3_vtab_in()] interface in the +** [xBestIndex|xBestIndex method]. ^(If the X parameter is not +** an xFilter argument that was selected for all-at-once IN constraint +** processing, then these routines return [SQLITE_MISUSE])^ or perhaps +** exhibit some other undefined or harmful behavior. +** +** ^(Use these routines to access all values on the right-hand side +** of the IN constraint using code like the following: +** +**
+**    for(rc=sqlite3_vtab_in_first(pList, &pVal);
+**        rc==SQLITE_OK && pVal
+**        rc=sqlite3_vtab_in_next(pList, &pVal)
+**    ){
+**      // do something with pVal
+**    }
+**    if( rc!=SQLITE_OK ){
+**      // an error has occurred
+**    }
+** 
)^ +** +** ^On success, the sqlite3_vtab_in_first(X,P) and sqlite3_vtab_in_next(X,P) +** routines return SQLITE_OK and set *P to point to the first or next value +** on the RHS of the IN constraint. ^If there are no more values on the +** right hand side of the IN constraint, then *P is set to NULL and these +** routines return [SQLITE_DONE]. ^The return value might be +** some other value, such as SQLITE_NOMEM, in the event of a malfunction. +** +** The *ppOut values returned by these routines are only valid until the +** next call to either of these routines or until the end of the xFilter +** method from which these routines were called. If the virtual table +** implementation needs to retain the *ppOut values for longer, it must make +** copies. The *ppOut values are [protected sqlite3_value|protected]. +*/ +SQLITE_API int sqlite3_vtab_in_first(sqlite3_value *pVal, sqlite3_value **ppOut); +SQLITE_API int sqlite3_vtab_in_next(sqlite3_value *pVal, sqlite3_value **ppOut); + +/* +** CAPI3REF: Constraint values in xBestIndex() +** METHOD: sqlite3_index_info +** +** This API may only be used from within the [xBestIndex|xBestIndex method] +** of a [virtual table] implementation. The result of calling this interface +** from outside of an xBestIndex method are undefined and probably harmful. +** +** ^When the sqlite3_vtab_rhs_value(P,J,V) interface is invoked from within +** the [xBestIndex] method of a [virtual table] implementation, with P being +** a copy of the [sqlite3_index_info] object pointer passed into xBestIndex and +** J being a 0-based index into P->aConstraint[], then this routine +** attempts to set *V to the value of the right-hand operand of +** that constraint if the right-hand operand is known. ^If the +** right-hand operand is not known, then *V is set to a NULL pointer. +** ^The sqlite3_vtab_rhs_value(P,J,V) interface returns SQLITE_OK if +** and only if *V is set to a value. ^The sqlite3_vtab_rhs_value(P,J,V) +** inteface returns SQLITE_NOTFOUND if the right-hand side of the J-th +** constraint is not available. ^The sqlite3_vtab_rhs_value() interface +** can return an result code other than SQLITE_OK or SQLITE_NOTFOUND if +** something goes wrong. +** +** The sqlite3_vtab_rhs_value() interface is usually only successful if +** the right-hand operand of a constraint is a literal value in the original +** SQL statement. If the right-hand operand is an expression or a reference +** to some other column or a [host parameter], then sqlite3_vtab_rhs_value() +** will probably return [SQLITE_NOTFOUND]. +** +** ^(Some constraints, such as [SQLITE_INDEX_CONSTRAINT_ISNULL] and +** [SQLITE_INDEX_CONSTRAINT_ISNOTNULL], have no right-hand operand. For such +** constraints, sqlite3_vtab_rhs_value() always returns SQLITE_NOTFOUND.)^ +** +** ^The [sqlite3_value] object returned in *V is a protected sqlite3_value +** and remains valid for the duration of the xBestIndex method call. +** ^When xBestIndex returns, the sqlite3_value object returned by +** sqlite3_vtab_rhs_value() is automatically deallocated. +** +** The "_rhs_" in the name of this routine is an abbreviation for +** "Right-Hand Side". +*/ +SQLITE_API int sqlite3_vtab_rhs_value(sqlite3_index_info*, int, sqlite3_value **ppVal); + /* ** CAPI3REF: Conflict resolution modes ** KEYWORDS: {conflict resolution mode} @@ -9878,6 +10327,10 @@ SQLITE_API unsigned char *sqlite3_serialize( ** database is currently in a read transaction or is involved in a backup ** operation. ** +** It is not possible to deserialized into the TEMP database. If the +** S argument to sqlite3_deserialize(D,S,P,N,M,F) is "temp" then the +** function returns SQLITE_ERROR. +** ** If sqlite3_deserialize(D,S,P,N,M,F) fails for any reason and if the ** SQLITE_DESERIALIZE_FREEONCLOSE bit is set in argument F, then ** [sqlite3_free()] is invoked on argument P prior to returning. diff --git a/database/sqlite/sqlite_aclk.c b/database/sqlite/sqlite_aclk.c index 950856d9a..43b341097 100644 --- a/database/sqlite/sqlite_aclk.c +++ b/database/sqlite/sqlite_aclk.c @@ -6,7 +6,7 @@ #include "sqlite_aclk_chart.h" #include "sqlite_aclk_node.h" -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK #include "../../aclk/aclk.h" #endif @@ -23,11 +23,11 @@ const char *aclk_sync_config[] = { "CREATE TRIGGER IF NOT EXISTS tr_dim_del AFTER DELETE ON dimension BEGIN INSERT INTO dimension_delete " "(dimension_id, dimension_name, chart_type_id, dim_id, chart_id, host_id, date_created)" - " select old.id, old.name, c.type||\".\"||c.id, old.dim_id, old.chart_id, c.host_id, strftime('%s') FROM" + " select old.id, old.name, c.type||\".\"||c.id, old.dim_id, old.chart_id, c.host_id, unixepoch() FROM" " chart c WHERE c.chart_id = old.chart_id; END;", "DELETE FROM dimension_delete WHERE host_id NOT IN" - " (SELECT host_id FROM host) OR strftime('%s') - date_created > 604800;", + " (SELECT host_id FROM host) OR unixepoch() - date_created > 604800;", NULL, }; @@ -36,7 +36,7 @@ uv_mutex_t aclk_async_lock; struct aclk_database_worker_config *aclk_thread_head = NULL; int retention_running = 0; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK static void stop_retention_run() { uv_mutex_lock(&aclk_async_lock); @@ -258,6 +258,74 @@ void aclk_sync_exit_all() uv_mutex_unlock(&aclk_async_lock); } +#ifdef ENABLE_ACLK +enum { + IDX_HOST_ID, + IDX_HOSTNAME, + IDX_REGISTRY, + IDX_UPDATE_EVERY, + IDX_OS, + IDX_TIMEZONE, + IDX_TAGS, + IDX_HOPS, + IDX_MEMORY_MODE, + IDX_ABBREV_TIMEZONE, + IDX_UTC_OFFSET, + IDX_PROGRAM_NAME, + IDX_PROGRAM_VERSION, + IDX_ENTRIES, + IDX_HEALTH_ENABLED, +}; + +static int create_host_callback(void *data, int argc, char **argv, char **column) +{ + UNUSED(data); + UNUSED(argc); + UNUSED(column); + + char guid[UUID_STR_LEN]; + uuid_unparse_lower(*(uuid_t *)argv[IDX_HOST_ID], guid); + + struct rrdhost_system_info *system_info = callocz(1, sizeof(struct rrdhost_system_info)); + system_info->hops = str2i((const char *) argv[IDX_HOPS]); + + sql_build_host_system_info((uuid_t *)argv[IDX_HOST_ID], system_info); + + RRDHOST *host = rrdhost_find_or_create( + (const char *) argv[IDX_HOSTNAME] + , (const char *) argv[IDX_REGISTRY] + , guid + , (const char *) argv[IDX_OS] + , (const char *) argv[IDX_TIMEZONE] + , (const char *) argv[IDX_ABBREV_TIMEZONE] + , argv[IDX_UTC_OFFSET] ? str2uint32_t(argv[IDX_UTC_OFFSET]) : 0 + , (const char *) argv[IDX_TAGS] + , (const char *) (argv[IDX_PROGRAM_NAME] ? argv[IDX_PROGRAM_NAME] : "unknown") + , (const char *) (argv[IDX_PROGRAM_VERSION] ? argv[IDX_PROGRAM_VERSION] : "unknown") + , argv[3] ? str2i(argv[IDX_UPDATE_EVERY]) : 1 + , argv[13] ? str2i(argv[IDX_ENTRIES]) : 0 + , RRD_MEMORY_MODE_DBENGINE + , 0 // health + , 0 // rrdpush enabled + , NULL //destination + , NULL // api key + , NULL // send charts matching + , system_info + , 1 + ); + if (likely(host)) + host->host_labels = sql_load_host_labels((uuid_t *)argv[IDX_HOST_ID]); + +#ifdef NETDATA_INTERNAL_CHECKS + char node_str[UUID_STR_LEN] = ""; + if (likely(host->node_id)) + uuid_unparse_lower(*host->node_id, node_str); + internal_error(true, "Adding archived host \"%s\" with GUID \"%s\" node id = \"%s\"", host->hostname, host->machine_guid, node_str); +#endif + return 0; +} +#endif + int aclk_start_sync_thread(void *data, int argc, char **argv, char **column) { char uuid_str[GUID_LEN + 1]; @@ -267,16 +335,17 @@ int aclk_start_sync_thread(void *data, int argc, char **argv, char **column) uuid_unparse_lower(*((uuid_t *) argv[0]), uuid_str); - if (rrdhost_find_by_guid(uuid_str, 0) == localhost) + RRDHOST *host = rrdhost_find_by_guid(uuid_str, 0); + if (host == localhost) return 0; - sql_create_aclk_table(NULL, (uuid_t *) argv[0], (uuid_t *) argv[1]); + sql_create_aclk_table(host, (uuid_t *) argv[0], (uuid_t *) argv[1]); return 0; } void sql_aclk_sync_init(void) { -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK char *err_msg = NULL; int rc; @@ -303,8 +372,23 @@ void sql_aclk_sync_init(void) info("SQLite aclk sync initialization completed"); fatal_assert(0 == uv_mutex_init(&aclk_async_lock)); + if (likely(rrdcontext_enabled == CONFIG_BOOLEAN_YES)) { + rc = sqlite3_exec(db_meta, "SELECT host_id, hostname, registry_hostname, update_every, os, " + "timezone, tags, hops, memory_mode, abbrev_timezone, utc_offset, program_name, " + "program_version, entries, health_enabled FROM host WHERE hops >0;", + create_host_callback, NULL, &err_msg); + if (rc != SQLITE_OK) { + error_report("SQLite error when loading archived hosts, rc = %d (%s)", rc, err_msg); + sqlite3_free(err_msg); + } + } + rc = sqlite3_exec(db_meta, "SELECT ni.host_id, ni.node_id FROM host h, node_instance ni WHERE " - "h.host_id = ni.host_id AND ni.node_id IS NOT NULL;", aclk_start_sync_thread, NULL, NULL); + "h.host_id = ni.host_id AND ni.node_id IS NOT NULL;", aclk_start_sync_thread, NULL, &err_msg); + if (rc != SQLITE_OK) { + error_report("SQLite error when starting ACLK sync threads, rc = %d (%s)", rc, err_msg); + sqlite3_free(err_msg); + } #endif return; } @@ -323,7 +407,7 @@ static void timer_cb(uv_timer_t* handle) uv_stop(handle->loop); uv_update_time(handle->loop); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK struct aclk_database_worker_config *wc = handle->data; struct aclk_database_cmd cmd; memset(&cmd, 0, sizeof(cmd)); @@ -338,7 +422,7 @@ static void timer_cb(uv_timer_t* handle) wc->cleanup_after += ACLK_DATABASE_CLEANUP_INTERVAL; } - if (aclk_use_new_cloud_arch && aclk_connected) { + if (aclk_connected) { if (wc->rotation_after && wc->rotation_after < now) { cmd.opcode = ACLK_DATABASE_UPD_RETENTION; if (!aclk_database_enq_cmd_noblock(wc, &cmd)) @@ -373,7 +457,7 @@ static void timer_cb(uv_timer_t* handle) } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK void after_send_retention(uv_work_t *req, int status) { struct aclk_database_worker_config *wc = req->data; @@ -410,7 +494,6 @@ void aclk_database_worker(void *arg) { worker_register("ACLKSYNC"); worker_register_job_name(ACLK_DATABASE_NOOP, "noop"); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL worker_register_job_name(ACLK_DATABASE_ADD_CHART, "chart add"); worker_register_job_name(ACLK_DATABASE_ADD_DIMENSION, "dimension add"); worker_register_job_name(ACLK_DATABASE_PUSH_CHART, "chart push"); @@ -420,11 +503,11 @@ void aclk_database_worker(void *arg) worker_register_job_name(ACLK_DATABASE_UPD_RETENTION, "retention check"); worker_register_job_name(ACLK_DATABASE_DIM_DELETION, "dimension delete"); worker_register_job_name(ACLK_DATABASE_ORPHAN_HOST, "node orphan"); -#endif worker_register_job_name(ACLK_DATABASE_ALARM_HEALTH_LOG, "alert log"); worker_register_job_name(ACLK_DATABASE_CLEANUP, "cleanup"); worker_register_job_name(ACLK_DATABASE_DELETE_HOST, "node delete"); worker_register_job_name(ACLK_DATABASE_NODE_INFO, "node info"); + worker_register_job_name(ACLK_DATABASE_NODE_COLLECTORS, "node collectors"); worker_register_job_name(ACLK_DATABASE_PUSH_ALERT, "alert push"); worker_register_job_name(ACLK_DATABASE_PUSH_ALERT_CONFIG, "alert conf push"); worker_register_job_name(ACLK_DATABASE_PUSH_ALERT_SNAPSHOT, "alert snapshot"); @@ -474,12 +557,12 @@ void aclk_database_worker(void *arg) fatal_assert(0 == uv_timer_start(&timer_req, timer_cb, TIMER_PERIOD_MS, TIMER_PERIOD_MS)); // wc->retry_count = 0; - wc->node_info_send = (wc->host && !localhost); + wc->node_info_send = 1; // aclk_add_worker_thread(wc); info("Starting ACLK sync thread for host %s -- scratch area %lu bytes", wc->host_guid, sizeof(*wc)); memset(&cmd, 0, sizeof(cmd)); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK uv_work_t retention_work; sql_get_last_chart_sequence(wc); wc->chart_payload_count = sql_get_pending_count(wc); @@ -532,7 +615,7 @@ void aclk_database_worker(void *arg) break; // CHART / DIMENSION OPERATIONS -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK case ACLK_DATABASE_ADD_CHART: debug(D_ACLK_SYNC, "Adding chart event for %s", wc->host_guid); aclk_add_chart_event(wc, cmd); @@ -585,7 +668,11 @@ void aclk_database_worker(void *arg) debug(D_ACLK_SYNC,"Sending node info for %s", wc->uuid_str); sql_build_node_info(wc, cmd); break; -#ifdef ENABLE_NEW_CLOUD_PROTOCOL + case ACLK_DATABASE_NODE_COLLECTORS: + debug(D_ACLK_SYNC,"Sending node collectors info for %s", wc->uuid_str); + sql_build_node_collectors(wc); + break; +#ifdef ENABLE_ACLK case ACLK_DATABASE_DIM_DELETION: debug(D_ACLK_SYNC,"Sending dimension deletion information %s", wc->uuid_str); aclk_process_dimension_deletion(wc, cmd); @@ -624,16 +711,23 @@ void aclk_database_worker(void *arg) snprintfz(threadname, NETDATA_THREAD_NAME_MAX, "AS_%s", wc->host->hostname); uv_thread_set_name_np(wc->thread, threadname); wc->host->dbsync_worker = wc; + if (unlikely(!wc->hostname)) + wc->hostname = strdupz(wc->host->hostname); aclk_del_worker_thread(wc); wc->node_info_send = 1; } } } - if (wc->node_info_send && wc->host && localhost && claimed() && aclk_connected) { + if (wc->node_info_send && localhost && claimed() && aclk_connected) { cmd.opcode = ACLK_DATABASE_NODE_INFO; cmd.completion = NULL; wc->node_info_send = aclk_database_enq_cmd_noblock(wc, &cmd); } + if (wc->node_collectors_send && wc->node_collectors_send + 30 < now_realtime_sec()) { + cmd.opcode = ACLK_DATABASE_NODE_COLLECTORS; + cmd.completion = NULL; + wc->node_collectors_send = aclk_database_enq_cmd_noblock(wc, &cmd); + } if (localhost == wc->host) (void) sqlite3_wal_checkpoint(db_meta, NULL); break; @@ -676,6 +770,7 @@ void aclk_database_worker(void *arg) rrd_rdlock(); if (likely(wc->host)) wc->host->dbsync_worker = NULL; + freez(wc->hostname); freez(wc); rrd_unlock(); @@ -745,13 +840,17 @@ void sql_create_aclk_table(RRDHOST *host, uuid_t *host_uuid, uuid_t *node_id) return; struct aclk_database_worker_config *wc = callocz(1, sizeof(struct aclk_database_worker_config)); - if (likely(host)) - host->dbsync_worker = (void *) wc; + if (node_id && !uuid_is_null(*node_id)) + uuid_unparse_lower(*node_id, wc->node_id); + if (likely(host)) { + host->dbsync_worker = (void *)wc; + wc->hostname = strdupz(host->hostname); + } + else + wc->hostname = get_hostname_by_node_id(wc->node_id); wc->host = host; strcpy(wc->uuid_str, uuid_str); strcpy(wc->host_guid, host_guid); - if (node_id && !uuid_is_null(*node_id)) - uuid_unparse_lower(*node_id, wc->node_id); wc->chart_updates = 0; wc->alert_updates = 0; wc->retry_count = 0; @@ -775,7 +874,7 @@ void sql_maint_aclk_sync_database(struct aclk_database_worker_config *wc, struct BUFFER *sql = buffer_create(ACLK_SYNC_QUERY_SIZE); buffer_sprintf(sql,"DELETE FROM aclk_chart_%s WHERE date_submitted IS NOT NULL AND " - "date_updated < strftime('%%s','now','-%d seconds');", wc->uuid_str, ACLK_DELETE_ACK_INTERNAL); + "CAST(date_updated AS INT) < unixepoch()-%d;", wc->uuid_str, ACLK_DELETE_ACK_INTERNAL); db_execute(buffer_tostring(sql)); buffer_flush(sql); @@ -786,7 +885,18 @@ void sql_maint_aclk_sync_database(struct aclk_database_worker_config *wc, struct buffer_flush(sql); buffer_sprintf(sql,"DELETE FROM aclk_alert_%s WHERE date_submitted IS NOT NULL AND " - "date_cloud_ack < strftime('%%s','now','-%d seconds');", wc->uuid_str, ACLK_DELETE_ACK_ALERTS_INTERNAL); + "CAST(date_cloud_ack AS INT) < unixepoch()-%d;", wc->uuid_str, ACLK_DELETE_ACK_ALERTS_INTERNAL); + db_execute(buffer_tostring(sql)); + buffer_flush(sql); + + buffer_sprintf(sql,"UPDATE aclk_chart_%s SET status = NULL, date_submitted=unixepoch() WHERE " + "date_submitted IS NULL AND CAST(date_created AS INT) < unixepoch()-%d;", wc->uuid_str, ACLK_AUTO_MARK_SUBMIT_INTERVAL); + db_execute(buffer_tostring(sql)); + buffer_flush(sql); + + buffer_sprintf(sql,"UPDATE aclk_chart_%s SET date_updated = unixepoch() WHERE date_updated IS NULL" + " AND date_submitted IS NOT NULL AND CAST(date_submitted AS INT) < unixepoch()-%d;", + wc->uuid_str, ACLK_AUTO_MARK_UPDATED_INTERVAL); db_execute(buffer_tostring(sql)); buffer_free(sql); @@ -912,15 +1022,15 @@ void sql_check_aclk_table_list(struct aclk_database_worker_config *wc) sqlite3_free(err_msg); } db_execute("DELETE FROM dimension_delete WHERE host_id NOT IN (SELECT host_id FROM host) " - " OR strftime('%s') - date_created > 604800;"); + " OR unixepoch() - date_created > 604800;"); return; } void aclk_data_rotated(void) { -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK - if (!aclk_use_new_cloud_arch || !aclk_connected) + if (!aclk_connected) return; time_t next_rotation_time = now_realtime_sec()+ACLK_DATABASE_ROTATION_DELAY; diff --git a/database/sqlite/sqlite_aclk.h b/database/sqlite/sqlite_aclk.h index 37e3d4530..b73f422e1 100644 --- a/database/sqlite/sqlite_aclk.h +++ b/database/sqlite/sqlite_aclk.h @@ -22,6 +22,8 @@ #define ACLK_DATABASE_ROTATION_INTERVAL (3600) #define ACLK_DELETE_ACK_INTERNAL (600) #define ACLK_DELETE_ACK_ALERTS_INTERNAL (86400) +#define ACLK_AUTO_MARK_SUBMIT_INTERVAL (3600) +#define ACLK_AUTO_MARK_UPDATED_INTERVAL (1800) #define ACLK_SYNC_QUERY_SIZE 512 struct aclk_completion { @@ -98,7 +100,7 @@ static inline char *get_str_from_uuid(uuid_t *uuid) #define TRIGGER_ACLK_CHART_PAYLOAD "CREATE TRIGGER IF NOT EXISTS aclk_tr_chart_payload_%s " \ "after insert on aclk_chart_payload_%s " \ "begin insert into aclk_chart_%s (uuid, unique_id, type, status, date_created) values " \ - " (new.uuid, new.unique_id, new.type, 'pending', strftime('%%s')) on conflict(uuid, status) " \ + " (new.uuid, new.unique_id, new.type, 'pending', unixepoch()) on conflict(uuid, status) " \ " do update set unique_id = new.unique_id, update_count = update_count + 1; " \ "end;" @@ -115,7 +117,6 @@ static inline char *get_str_from_uuid(uuid_t *uuid) enum aclk_database_opcode { ACLK_DATABASE_NOOP = 0, -#ifdef ENABLE_NEW_CLOUD_PROTOCOL ACLK_DATABASE_ADD_CHART, ACLK_DATABASE_ADD_DIMENSION, ACLK_DATABASE_PUSH_CHART, @@ -125,7 +126,6 @@ enum aclk_database_opcode { ACLK_DATABASE_UPD_RETENTION, ACLK_DATABASE_DIM_DELETION, ACLK_DATABASE_ORPHAN_HOST, -#endif ACLK_DATABASE_ALARM_HEALTH_LOG, ACLK_DATABASE_CLEANUP, ACLK_DATABASE_DELETE_HOST, @@ -134,6 +134,7 @@ enum aclk_database_opcode { ACLK_DATABASE_PUSH_ALERT_CONFIG, ACLK_DATABASE_PUSH_ALERT_SNAPSHOT, ACLK_DATABASE_QUEUE_REMOVED_ALERTS, + ACLK_DATABASE_NODE_COLLECTORS, ACLK_DATABASE_TIMER, // leave this last @@ -170,6 +171,7 @@ struct aclk_database_worker_config { char uuid_str[GUID_LEN + 1]; char node_id[GUID_LEN + 1]; char host_guid[GUID_LEN + 1]; + char *hostname; // hostname to avoid constant lookups uint64_t chart_sequence_id; // last chart_sequence_id time_t chart_timestamp; // last chart timestamp time_t cleanup_after; // Start a cleanup after this timestamp @@ -196,6 +198,7 @@ struct aclk_database_worker_config { int alert_updates; time_t batch_created; int node_info_send; + time_t node_collectors_send; int chart_pending; int chart_reset_count; int retention_running; diff --git a/database/sqlite/sqlite_aclk_alert.c b/database/sqlite/sqlite_aclk_alert.c index 53c6c2a65..ea1cc9fea 100644 --- a/database/sqlite/sqlite_aclk_alert.c +++ b/database/sqlite/sqlite_aclk_alert.c @@ -3,7 +3,7 @@ #include "sqlite_functions.h" #include "sqlite_aclk_alert.h" -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK #include "../../aclk/aclk_alarm_api.h" #include "../../aclk/aclk.h" #endif @@ -123,21 +123,6 @@ done: // and handle both cases int sql_queue_alarm_to_aclk(RRDHOST *host, ALARM_ENTRY *ae, int skip_filter) { - //check aclk architecture and handle old json alarm update to cloud - //include also the valid statuses for this case -#ifdef ENABLE_ACLK -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (!aclk_use_new_cloud_arch && aclk_connected) { -#endif - - if ((ae->new_status == RRDCALC_STATUS_WARNING || ae->new_status == RRDCALC_STATUS_CRITICAL) || - ((ae->old_status == RRDCALC_STATUS_WARNING || ae->old_status == RRDCALC_STATUS_CRITICAL))) { - aclk_update_alarm(host, ae); - } -#endif -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - } - if (!claimed()) return 0; @@ -164,7 +149,7 @@ int sql_queue_alarm_to_aclk(RRDHOST *host, ALARM_ENTRY *ae, int skip_filter) buffer_sprintf( sql, "INSERT INTO aclk_alert_%s (alert_unique_id, date_created) " - "VALUES (@alert_unique_id, strftime('%%s')) on conflict (alert_unique_id) do nothing; ", + "VALUES (@alert_unique_id, unixepoch()) on conflict (alert_unique_id) do nothing; ", uuid_str); rc = sqlite3_prepare_v2(db_meta, buffer_tostring(sql), -1, &res_alert, 0); @@ -196,17 +181,11 @@ bind_fail: buffer_free(sql); return 0; -#else - UNUSED(host); - UNUSED(ae); - UNUSED(skip_filter); -#endif - return 0; } int rrdcalc_status_to_proto_enum(RRDCALC_STATUS status) { -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK switch(status) { case RRDCALC_STATUS_REMOVED: return ALARM_STATUS_REMOVED; @@ -234,7 +213,7 @@ int rrdcalc_status_to_proto_enum(RRDCALC_STATUS status) void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd) { -#ifndef ENABLE_NEW_CLOUD_PROTOCOL +#ifndef ENABLE_ACLK UNUSED(wc); UNUSED(cmd); #else @@ -245,7 +224,7 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d return; } - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (unlikely(!claim_id)) return; @@ -260,9 +239,9 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d buffer_sprintf( sql, "UPDATE aclk_alert_%s SET date_submitted = NULL, date_cloud_ack = NULL WHERE sequence_id >= %"PRIu64 - "; UPDATE aclk_alert_%s SET date_cloud_ack = strftime('%%s','now') WHERE sequence_id < %"PRIu64 + "; UPDATE aclk_alert_%s SET date_cloud_ack = unixepoch() WHERE sequence_id < %"PRIu64 " and date_cloud_ack is null " - "; UPDATE aclk_alert_%s SET date_submitted = strftime('%%s','now') WHERE sequence_id < %"PRIu64 + "; UPDATE aclk_alert_%s SET date_submitted = unixepoch() WHERE sequence_id < %"PRIu64 " and date_submitted is null", wc->uuid_str, wc->alerts_start_seq_id, @@ -282,7 +261,7 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d buffer_sprintf(sql, "select aa.sequence_id, hl.unique_id, hl.alarm_id, hl.config_hash_id, hl.updated_by_id, hl.when_key, \ hl.duration, hl.non_clear_duration, hl.flags, hl.exec_run_timestamp, hl.delay_up_to_timestamp, hl.name, \ hl.chart, hl.family, hl.exec, hl.recipient, hl.source, hl.units, hl.info, hl.exec_code, hl.new_status, \ - hl.old_status, hl.delay, hl.new_value, hl.old_value, hl.last_repeat \ + hl.old_status, hl.delay, hl.new_value, hl.old_value, hl.last_repeat, hl.chart_context \ from health_log_%s hl, aclk_alert_%s aa \ where hl.unique_id = aa.alert_unique_id and aa.date_submitted is null \ order by aa.sequence_id asc limit %d;", wc->uuid_str, wc->uuid_str, limit); @@ -357,14 +336,18 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d strdupz((char *)format_value_and_unit( old_value_string, 100, sqlite3_column_double(res, 24), (char *)sqlite3_column_text(res, 17), -1)); - alarm_log.value = (calculated_number) sqlite3_column_double(res, 23); - alarm_log.old_value = (calculated_number) sqlite3_column_double(res, 24); + alarm_log.value = (NETDATA_DOUBLE) sqlite3_column_double(res, 23); + alarm_log.old_value = (NETDATA_DOUBLE) sqlite3_column_double(res, 24); alarm_log.updated = (sqlite3_column_int64(res, 8) & HEALTH_ENTRY_FLAG_UPDATED) ? 1 : 0; alarm_log.rendered_info = sqlite3_column_type(res, 18) == SQLITE_NULL ? strdupz((char *)"") : strdupz((char *)sqlite3_column_text(res, 18)); + alarm_log.chart_context = sqlite3_column_type(res, 26) == SQLITE_NULL ? + strdupz((char *)"") : + strdupz((char *)sqlite3_column_text(res, 26)); + aclk_send_alarm_log_entry(&alarm_log); if (first_sequence_id == 0) @@ -382,7 +365,7 @@ void aclk_push_alert_event(struct aclk_database_worker_config *wc, struct aclk_d if (first_sequence_id) { buffer_flush(sql); - buffer_sprintf(sql, "UPDATE aclk_alert_%s SET date_submitted=strftime('%%s') " + buffer_sprintf(sql, "UPDATE aclk_alert_%s SET date_submitted=unixepoch() " "WHERE date_submitted IS NULL AND sequence_id BETWEEN %" PRIu64 " AND %" PRIu64 ";", wc->uuid_str, first_sequence_id, last_sequence_id); db_execute(buffer_tostring(sql)); @@ -417,10 +400,11 @@ void sql_queue_existing_alerts_to_aclk(RRDHOST *host) uuid_unparse_lower_fix(&host->host_uuid, uuid_str); BUFFER *sql = buffer_create(1024); - buffer_sprintf(sql,"insert into aclk_alert_%s (alert_unique_id, date_created) " \ - "select unique_id alert_unique_id, strftime('%%s') date_created from health_log_%s " \ + buffer_sprintf(sql,"delete from aclk_alert_%s; " \ + "insert into aclk_alert_%s (alert_unique_id, date_created) " \ + "select unique_id alert_unique_id, unixepoch() from health_log_%s " \ "where new_status <> 0 and new_status <> -2 and config_hash_id is not null and updated_by_id = 0 " \ - "order by unique_id asc on conflict (alert_unique_id) do nothing;", uuid_str, uuid_str); + "order by unique_id asc on conflict (alert_unique_id) do nothing;", uuid_str, uuid_str, uuid_str); db_execute(buffer_tostring(sql)); @@ -437,45 +421,40 @@ void aclk_send_alarm_health_log(char *node_id) if (unlikely(!node_id)) return; - char *hostname= NULL; + struct aclk_database_worker_config *wc = find_inactive_wc_by_node_id(node_id); - struct aclk_database_worker_config *wc = NULL; - struct aclk_database_cmd cmd; - memset(&cmd, 0, sizeof(cmd)); - cmd.opcode = ACLK_DATABASE_ALARM_HEALTH_LOG; + if (likely(!wc)) { + rrd_rdlock(); + RRDHOST *host = find_host_by_node_id(node_id); + rrd_unlock(); + if (likely(host)) + wc = (struct aclk_database_worker_config *)host->dbsync_worker; + } - rrd_rdlock(); - RRDHOST *host = find_host_by_node_id(node_id); - if (likely(host)) { - wc = (struct aclk_database_worker_config *)host->dbsync_worker; - hostname = host->hostname; + if (!wc) { + log_access("ACLK REQ [%s (N/A)]: HEALTH LOG REQUEST RECEIVED FOR INVALID NODE", node_id); + return; } - else - hostname = get_hostname_by_node_id(node_id); - rrd_unlock(); - log_access("ACLK REQ [%s (%s)]: HEALTH LOG request received", node_id, hostname ? hostname : "N/A"); - if (unlikely(!host)) - freez(hostname); + log_access("ACLK REQ [%s (%s)]: HEALTH LOG REQUEST RECEIVED", node_id, wc->hostname ? wc->hostname : "N/A"); - if (wc) - aclk_database_enq_cmd(wc, &cmd); - else { - if (aclk_worker_enq_cmd(node_id, &cmd)) - log_access("ACLK STA [%s (N/A)]: ACLK synchronization thread is not active.", node_id); - } + struct aclk_database_cmd cmd; + memset(&cmd, 0, sizeof(cmd)); + cmd.opcode = ACLK_DATABASE_ALARM_HEALTH_LOG; + + aclk_database_enq_cmd(wc, &cmd); return; } void aclk_push_alarm_health_log(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd) { UNUSED(cmd); -#ifndef ENABLE_NEW_CLOUD_PROTOCOL +#ifndef ENABLE_ACLK UNUSED(wc); #else int rc; - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (unlikely(!claim_id)) return; @@ -549,7 +528,7 @@ void aclk_push_alarm_health_log(struct aclk_database_worker_config *wc, struct a wc->alert_sequence_id = last_sequence; aclk_send_alarm_log_health(&alarm_log); - log_access("ACLK RES [%s (%s)]: HEALTH LOG SENT from %"PRIu64" to %"PRIu64, wc->node_id, wc->host ? wc->host->hostname : "N/A", first_sequence, last_sequence); + log_access("ACLK RES [%s (%s)]: HEALTH LOG SENT from %"PRIu64" to %"PRIu64, wc->node_id, wc->hostname ? wc->hostname : "N/A", first_sequence, last_sequence); rc = sqlite3_finalize(res); if (unlikely(rc != SQLITE_OK)) @@ -595,7 +574,7 @@ void aclk_send_alarm_configuration(char *config_hash) int aclk_push_alert_config_event(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd) { UNUSED(wc); -#ifndef ENABLE_NEW_CLOUD_PROTOCOL +#ifndef ENABLE_ACLK UNUSED(cmd); #else int rc = 0; @@ -708,7 +687,6 @@ bind_fail: // Start streaming alerts void aclk_start_alert_streaming(char *node_id, uint64_t batch_id, uint64_t start_seq_id) { -#ifdef ENABLE_NEW_CLOUD_PROTOCOL if (unlikely(!node_id)) return; @@ -749,24 +727,17 @@ void aclk_start_alert_streaming(char *node_id, uint64_t batch_id, uint64_t start else log_access("ACLK STA [%s (N/A)]: ACLK synchronization thread is not active.", node_id); -#else - UNUSED(node_id); - UNUSED(start_seq_id); - UNUSED(batch_id); -#endif return; } void sql_process_queue_removed_alerts_to_aclk(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd) { UNUSED(cmd); -#ifndef ENABLE_NEW_CLOUD_PROTOCOL - UNUSED(wc); -#else + BUFFER *sql = buffer_create(1024); buffer_sprintf(sql,"insert into aclk_alert_%s (alert_unique_id, date_created) " \ - "select unique_id alert_unique_id, strftime('%%s') date_created from health_log_%s " \ + "select unique_id alert_unique_id, unixepoch() from health_log_%s " \ "where new_status = -2 and updated_by_id = 0 and unique_id not in " \ "(select alert_unique_id from aclk_alert_%s) order by unique_id asc " \ "on conflict (alert_unique_id) do nothing;", wc->uuid_str, wc->uuid_str, wc->uuid_str); @@ -778,13 +749,11 @@ void sql_process_queue_removed_alerts_to_aclk(struct aclk_database_worker_config buffer_free(sql); wc->pause_alert_updates = 0; -#endif return; } void sql_queue_removed_alerts_to_aclk(RRDHOST *host) { -#ifdef ENABLE_NEW_CLOUD_PROTOCOL if (unlikely(!host->dbsync_worker)) return; @@ -798,15 +767,11 @@ void sql_queue_removed_alerts_to_aclk(RRDHOST *host) cmd.data_param = NULL; cmd.completion = NULL; aclk_database_enq_cmd((struct aclk_database_worker_config *) host->dbsync_worker, &cmd); -#else - UNUSED(host); -#endif } void aclk_process_send_alarm_snapshot(char *node_id, char *claim_id, uint64_t snapshot_id, uint64_t sequence_id) { UNUSED(claim_id); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL if (unlikely(!node_id)) return; @@ -843,11 +808,7 @@ void aclk_process_send_alarm_snapshot(char *node_id, char *claim_id, uint64_t sn aclk_database_enq_cmd(wc, &cmd); } else log_access("ACLK STA [%s (N/A)]: ACLK synchronization thread is not active.", node_id); -#else - UNUSED(node_id); - UNUSED(snapshot_id); - UNUSED(sequence_id); -#endif + return; } @@ -858,7 +819,7 @@ void aclk_mark_alert_cloud_ack(char *uuid_str, uint64_t alerts_ack_sequence_id) if (alerts_ack_sequence_id != 0) { buffer_sprintf( sql, - "UPDATE aclk_alert_%s SET date_cloud_ack = strftime('%%s','now') WHERE sequence_id <= %" PRIu64 "", + "UPDATE aclk_alert_%s SET date_cloud_ack = unixepoch() WHERE sequence_id <= %" PRIu64 "", uuid_str, alerts_ack_sequence_id); db_execute(buffer_tostring(sql)); @@ -867,7 +828,7 @@ void aclk_mark_alert_cloud_ack(char *uuid_str, uint64_t alerts_ack_sequence_id) buffer_free(sql); } -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK void health_alarm_entry2proto_nolock(struct alarm_log_entry *alarm_log, ALARM_ENTRY *ae, RRDHOST *host) { char *edit_command = ae->source ? health_edit_command_from_source(ae->source) : strdupz("UNKNOWN=0=UNKNOWN"); @@ -907,17 +868,18 @@ void health_alarm_entry2proto_nolock(struct alarm_log_entry *alarm_log, ALARM_EN alarm_log->value_string = strdupz(ae->new_value_string); alarm_log->old_value_string = strdupz(ae->old_value_string); - alarm_log->value = (!isnan(ae->new_value)) ? (calculated_number)ae->new_value : 0; - alarm_log->old_value = (!isnan(ae->old_value)) ? (calculated_number)ae->old_value : 0; + alarm_log->value = (!isnan(ae->new_value)) ? (NETDATA_DOUBLE)ae->new_value : 0; + alarm_log->old_value = (!isnan(ae->old_value)) ? (NETDATA_DOUBLE)ae->old_value : 0; alarm_log->updated = (ae->flags & HEALTH_ENTRY_FLAG_UPDATED) ? 1 : 0; alarm_log->rendered_info = ae->info ? strdupz(ae->info) : strdupz((char *)""); + alarm_log->chart_context = ae->chart_context ? strdupz(ae->chart_context) : strdupz((char *)""); freez(edit_command); } #endif -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK static int have_recent_alarm(RRDHOST *host, uint32_t alarm_id, time_t mark) { ALARM_ENTRY *ae = host->health_log.alarms; @@ -936,7 +898,7 @@ static int have_recent_alarm(RRDHOST *host, uint32_t alarm_id, time_t mark) #define ALARM_EVENTS_PER_CHUNK 10 void aclk_push_alert_snapshot_event(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd) { -#ifndef ENABLE_NEW_CLOUD_PROTOCOL +#ifndef ENABLE_ACLK UNUSED(wc); UNUSED(cmd); #else @@ -955,7 +917,7 @@ void aclk_push_alert_snapshot_event(struct aclk_database_worker_config *wc, stru if (unlikely(!wc->alerts_snapshot_id)) return; - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (unlikely(!claim_id)) return; @@ -1055,7 +1017,6 @@ void aclk_push_alert_snapshot_event(struct aclk_database_worker_config *wc, stru void sql_aclk_alert_clean_dead_entries(RRDHOST *host) { -#ifdef ENABLE_NEW_CLOUD_PROTOCOL if (!claimed()) return; @@ -1075,9 +1036,6 @@ void sql_aclk_alert_clean_dead_entries(RRDHOST *host) sqlite3_free(err_msg); } buffer_free(sql); -#else - UNUSED(host); -#endif } int get_proto_alert_status(RRDHOST *host, struct proto_alert_status *proto_alert_status) diff --git a/database/sqlite/sqlite_aclk_chart.c b/database/sqlite/sqlite_aclk_chart.c index a9db5282a..c1db60c49 100644 --- a/database/sqlite/sqlite_aclk_chart.c +++ b/database/sqlite/sqlite_aclk_chart.c @@ -3,7 +3,7 @@ #include "sqlite_functions.h" #include "sqlite_aclk_chart.h" -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK #include "../../aclk/aclk_charts_api.h" #include "../../aclk/aclk.h" @@ -87,7 +87,7 @@ static int aclk_add_chart_payload( char sql[ACLK_SYNC_QUERY_SIZE]; snprintfz(sql,ACLK_SYNC_QUERY_SIZE-1, "INSERT INTO aclk_chart_payload_%s (unique_id, uuid, claim_id, date_created, type, payload) " \ - "VALUES (@unique_id, @uuid, @claim_id, strftime('%%s','now'), @type, @payload);", wc->uuid_str); + "VALUES (@unique_id, @uuid, @claim_id, unixepoch(), @type, @payload);", wc->uuid_str); rc = prepare_statement(db_meta, sql, &res_chart); if (rc != SQLITE_OK) { error_report("Failed to prepare statement to store chart payload data"); @@ -143,7 +143,7 @@ int aclk_add_chart_event(struct aclk_database_worker_config *wc, struct aclk_dat int rc = 0; CHECK_SQLITE_CONNECTION(db_meta); - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); RRDSET *st = cmd.data; @@ -158,16 +158,8 @@ int aclk_add_chart_event(struct aclk_database_worker_config *wc, struct aclk_dat chart_payload.claim_id = claim_id; chart_payload.id = strdupz(st->id); - struct label_index *labels = &st->state->labels; - netdata_rwlock_rdlock(&labels->labels_rwlock); - struct label *label_list = labels->head; - struct label *chart_label = NULL; - while (label_list) { - chart_label = add_label_to_list(chart_label, label_list->key, label_list->value, label_list->label_source); - label_list = label_list->next; - } - netdata_rwlock_unlock(&labels->labels_rwlock); - chart_payload.label_head = chart_label; + chart_payload.chart_labels = rrdlabels_create(); + rrdlabels_copy(chart_payload.chart_labels, st->state->chart_labels); size_t size; char *payload = generate_chart_instance_updated(&size, &chart_payload); @@ -220,7 +212,7 @@ void aclk_process_dimension_deletion(struct aclk_database_worker_config *wc, str int rc = 0; sqlite3_stmt *res = NULL; - if (!aclk_use_new_cloud_arch || !aclk_connected) + if (!aclk_connected) return; if (unlikely(!db_meta)) @@ -230,7 +222,7 @@ void aclk_process_dimension_deletion(struct aclk_database_worker_config *wc, str if (uuid_parse(wc->host_guid, host_id)) return; - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (!claim_id) return; @@ -289,7 +281,7 @@ int aclk_add_dimension_event(struct aclk_database_worker_config *wc, struct aclk struct aclk_chart_dimension_data *aclk_cd_data = cmd.data; - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (!claim_id) goto cleanup; @@ -316,7 +308,7 @@ void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_d return; } - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (unlikely(!claim_id)) return; @@ -333,12 +325,6 @@ void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_d char sql[ACLK_SYNC_QUERY_SIZE]; static __thread sqlite3_stmt *res = NULL; - char *hostname = NULL; - if (wc->host) - hostname = strdupz(wc->host->hostname); - else - hostname = get_hostname_by_node_id(wc->node_id); - if (unlikely(!res)) { snprintfz(sql,ACLK_SYNC_QUERY_SIZE-1,"SELECT ac.sequence_id, acp.payload, ac.date_created, ac.type, ac.uuid " \ "FROM aclk_chart_%s ac, aclk_chart_payload_%s acp " \ @@ -348,7 +334,6 @@ void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_d if (rc != SQLITE_OK) { error_report("Failed to prepare statement when trying to send a chart update via ACLK"); freez(claim_id); - freez(hostname); return; } } @@ -406,7 +391,7 @@ void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_d if (likely(first_sequence)) { db_lock(); - snprintfz(sql,ACLK_SYNC_QUERY_SIZE-1, "UPDATE aclk_chart_%s SET status = NULL, date_submitted=strftime('%%s','now') " + snprintfz(sql,ACLK_SYNC_QUERY_SIZE-1, "UPDATE aclk_chart_%s SET status = NULL, date_submitted=unixepoch() " "WHERE date_submitted IS NULL AND sequence_id BETWEEN %" PRIu64 " AND %" PRIu64 ";", wc->uuid_str, first_sequence, last_sequence); db_execute(sql); @@ -422,7 +407,7 @@ void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_d log_access( "ACLK RES [%s (%s)]: CHARTS SENT from %" PRIu64 " to %" PRIu64 " batch=%" PRIu64, wc->node_id, - hostname ? hostname : "N/A", + wc->hostname ? wc->hostname : "N/A", first_sequence, last_sequence, wc->batch_id); @@ -443,7 +428,7 @@ void aclk_send_chart_event(struct aclk_database_worker_config *wc, struct aclk_d log_access( "ACLK STA [%s (%s)]: Sync of charts and dimensions done in %ld seconds.", wc->node_id, - hostname ? hostname : "N/A", + wc->hostname ? wc->hostname : "N/A", now_realtime_sec() - wc->startup_time); } @@ -462,7 +447,6 @@ bind_fail: error_report("Failed to reset statement when pushing chart events, rc = %d", rc); freez(claim_id); - freez(hostname); return; } @@ -548,7 +532,7 @@ void aclk_receive_chart_ack(struct aclk_database_worker_config *wc, struct aclk_ char sql[ACLK_SYNC_QUERY_SIZE]; - snprintfz(sql,ACLK_SYNC_QUERY_SIZE-1,"UPDATE aclk_chart_%s SET date_updated=strftime('%%s','now') WHERE sequence_id <= @sequence_id " + snprintfz(sql,ACLK_SYNC_QUERY_SIZE-1,"UPDATE aclk_chart_%s SET date_updated=unixepoch() WHERE sequence_id <= @sequence_id " "AND date_submitted IS NOT NULL AND date_updated IS NULL;", wc->uuid_str); rc = sqlite3_prepare_v2(db_meta, sql, -1, &res, 0); @@ -587,13 +571,8 @@ void aclk_receive_chart_reset(struct aclk_database_worker_config *wc, struct acl cmd.param1); db_execute(buffer_tostring(sql)); if (cmd.param1 == 1) { - char *hostname = NULL; - if (wc->host) - hostname = strdupz(wc->host->hostname); - else - hostname = get_hostname_by_node_id(wc->node_id); buffer_flush(sql); - log_access("ACLK REQ [%s (%s)]: Received chart full resync.", wc->node_id, hostname? hostname : "N/A"); + log_access("ACLK REQ [%s (%s)]: Received chart full resync.", wc->node_id, wc->hostname ? wc->hostname: "N/A"); buffer_sprintf(sql, "DELETE FROM aclk_chart_payload_%s; DELETE FROM aclk_chart_%s; " \ "DELETE FROM aclk_chart_latest_%s;", wc->uuid_str, wc->uuid_str, wc->uuid_str); db_lock(); @@ -619,19 +598,18 @@ void aclk_receive_chart_reset(struct aclk_database_worker_config *wc, struct acl rrddim_foreach_read(rd, st) { rrddim_flag_clear(rd, RRDDIM_FLAG_ACLK); - rd->state->aclk_live_status = (rd->state->aclk_live_status == 0); + rd->aclk_live_status = (rd->aclk_live_status == 0); } rrdset_unlock(st); } rrdhost_unlock(host); } else error_report("ACLK synchronization thread for %s is not linked to HOST", wc->host_guid); - freez(hostname); } else { log_access( "ACLK STA [%s (%s)]: RESTARTING CHART SYNC FROM SEQUENCE %" PRIu64, wc->node_id, - wc->host ? wc->host->hostname : "N/A", + wc->hostname ? wc->hostname : "N/A", cmd.param1); wc->chart_payload_count = sql_get_pending_count(wc); sql_get_last_chart_sequence(wc); @@ -732,12 +710,7 @@ void aclk_start_streaming(char *node_id, uint64_t sequence_id, time_t created_at wc = (struct aclk_database_worker_config *)host->dbsync_worker ? (struct aclk_database_worker_config *)host->dbsync_worker : (struct aclk_database_worker_config *)find_inactive_wc_by_node_id(node_id); - char *hostname = NULL; if (likely(wc)) { - if (wc->host) - hostname = strdupz(wc->host->hostname); - else - hostname = get_hostname_by_node_id(node_id); wc->chart_reset_count++; __sync_synchronize(); wc->chart_updates = 0; @@ -747,7 +720,7 @@ void aclk_start_streaming(char *node_id, uint64_t sequence_id, time_t created_at log_access( "ACLK REQ [%s (%s)]: CHARTS STREAM from %"PRIu64" (LOCAL %"PRIu64") t=%ld resets=%d" , wc->node_id, - hostname ? hostname : "N/A", + wc->hostname ? wc->hostname : "N/A", sequence_id + 1, wc->chart_sequence_id, wc->chart_timestamp, @@ -757,13 +730,13 @@ void aclk_start_streaming(char *node_id, uint64_t sequence_id, time_t created_at "ACLK RES [%s (%s)]: CHARTS FULL RESYNC REQUEST " "remote_seq=%" PRIu64 " local_seq=%" PRIu64 " resets=%d ", wc->node_id, - hostname ? hostname : "N/A", + wc->hostname ? wc->hostname : "N/A", sequence_id, wc->chart_sequence_id, wc->chart_reset_count); chart_reset_t chart_reset; - chart_reset.claim_id = is_agent_claimed(); + chart_reset.claim_id = get_agent_claimid(); if (chart_reset.claim_id) { chart_reset.node_id = node_id; chart_reset.reason = SEQ_ID_NOT_EXISTS; @@ -780,7 +753,7 @@ void aclk_start_streaming(char *node_id, uint64_t sequence_id, time_t created_at log_access( "ACLK REQ [%s (%s)]: CHART RESET from %" PRIu64 " t=%ld batch=%" PRIu64, wc->node_id, - hostname ? hostname : "N/A", + wc->hostname ? wc->hostname : "N/A", sequence_id + 1, wc->chart_timestamp, wc->batch_id); @@ -794,10 +767,8 @@ void aclk_start_streaming(char *node_id, uint64_t sequence_id, time_t created_at } } } else { - hostname = get_hostname_by_node_id(node_id); - log_access("ACLK STA [%s (%s)]: ACLK synchronization thread is not active.", node_id, hostname ? hostname : "N/A"); + log_access("ACLK STA [%s (%s)]: ACLK synchronization thread is not active.", node_id, wc->hostname ? wc->hostname : "N/A"); } - freez(hostname); return; } host = host->next; @@ -851,10 +822,15 @@ void aclk_update_retention(struct aclk_database_worker_config *wc) { int rc; - if (!aclk_use_new_cloud_arch || !aclk_connected) + if (!aclk_connected) + return; + + if (wc->host && rrdhost_flag_check(wc->host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS)) { + internal_error(true, "Skipping aclk_update_retention for host %s because context streaming is enabled", wc->host->hostname); return; + } - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (unlikely(!claim_id)) return; @@ -935,7 +911,7 @@ void aclk_update_retention(struct aclk_database_worker_config *wc) #ifdef ENABLE_DBENGINE if (memory_mode == RRD_MEMORY_MODE_DBENGINE) rc = - rrdeng_metric_latest_time_by_uuid((uuid_t *)sqlite3_column_blob(res, 0), &first_entry_t, &last_entry_t); + rrdeng_metric_latest_time_by_uuid((uuid_t *)sqlite3_column_blob(res, 0), &first_entry_t, &last_entry_t, 0); else #endif { @@ -1000,17 +976,12 @@ void aclk_update_retention(struct aclk_database_worker_config *wc) rotate_data.interval_duration_count++; } - char *hostname = NULL; - if (!wc->host) - hostname = get_hostname_by_node_id(wc->node_id); - if (dimension_update_count < ACLK_MAX_DIMENSION_CLEANUP && !netdata_exit) log_access("ACLK STA [%s (%s)]: UPDATES %d RETENTION MESSAGE SENT. CHECKED %u DIMENSIONS. %u DELETED, %u STOPPED COLLECTING", - wc->node_id, wc->host ? wc->host->hostname : hostname ? hostname : "N/A", wc->chart_updates, total_checked, total_deleted, total_stopped); + wc->node_id, wc->hostname ? wc->hostname : "N/A", wc->chart_updates, total_checked, total_deleted, total_stopped); else log_access("ACLK STA [%s (%s)]: UPDATES %d RETENTION MESSAGE NOT SENT. CHECKED %u DIMENSIONS. %u DELETED, %u STOPPED COLLECTING", - wc->node_id, wc->host ? wc->host->hostname : hostname ? hostname : "N/A", wc->chart_updates, total_checked, total_deleted, total_stopped); - freez(hostname); + wc->node_id, wc->hostname ? wc->hostname : "N/A", wc->chart_updates, total_checked, total_deleted, total_stopped); #ifdef NETDATA_INTERNAL_CHECKS info("Retention update for %s (chart updates = %d)", wc->host_guid, wc->chart_updates); @@ -1094,23 +1065,27 @@ void sql_get_last_chart_sequence(struct aclk_database_worker_config *wc) void queue_dimension_to_aclk(RRDDIM *rd, time_t last_updated) { + RRDHOST *host = rd->rrdset->rrdhost; + if (likely(rrdhost_flag_check(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS))) + return; + int live = !last_updated; - if (likely(rd->state->aclk_live_status == live)) + if (likely(rd->aclk_live_status == live)) return; - time_t created_at = rd->state->query_ops.oldest_time(rd); + time_t created_at = rd->tiers[0]->query_ops.oldest_time(rd->tiers[0]->db_metric_handle); if (unlikely(!created_at && rd->updated)) created_at = rd->last_collected_time.tv_sec; - rd->state->aclk_live_status = live; + rd->aclk_live_status = live; struct aclk_database_worker_config *wc = rd->rrdset->rrdhost->dbsync_worker; if (unlikely(!wc)) return; - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (unlikely(!claim_id)) return; @@ -1132,7 +1107,7 @@ void queue_dimension_to_aclk(RRDDIM *rd, time_t last_updated) return; struct aclk_chart_dimension_data *aclk_cd_data = mallocz(sizeof(*aclk_cd_data)); - uuid_copy(aclk_cd_data->uuid, rd->state->metric_uuid); + uuid_copy(aclk_cd_data->uuid, rd->metric_uuid); aclk_cd_data->payload = payload; aclk_cd_data->payload_size = size; aclk_cd_data->check_payload = 1; @@ -1147,17 +1122,14 @@ void queue_dimension_to_aclk(RRDDIM *rd, time_t last_updated) if (unlikely(rc)) { freez(aclk_cd_data->payload); freez(aclk_cd_data); - rd->state->aclk_live_status = !live; + rd->aclk_live_status = !live; } return; } void aclk_send_dimension_update(RRDDIM *rd) { - if (!aclk_use_new_cloud_arch) - return; - - char *claim_id = is_agent_claimed(); + char *claim_id = get_agent_claimid(); if (unlikely(!claim_id)) return; @@ -1167,11 +1139,11 @@ void aclk_send_dimension_update(RRDDIM *rd) time_t now = now_realtime_sec(); int live = ((now - rd->last_collected_time.tv_sec) < (RRDSET_MINIMUM_DIM_LIVE_MULTIPLIER * rd->update_every)); - if (!live || rd->state->aclk_live_status != live || !first_entry_t) { + if (!live || rd->aclk_live_status != live || !first_entry_t) { (void)aclk_upd_dimension_event( rd->rrdset->rrdhost->dbsync_worker, claim_id, - &rd->state->metric_uuid, + &rd->metric_uuid, rd->id, rd->name, rd->rrdset->id, @@ -1200,7 +1172,7 @@ void aclk_send_dimension_update(RRDDIM *rd) first_entry_t, last_entry_t, now - last_entry_t); - rd->state->aclk_live_status = live; + rd->aclk_live_status = live; } freez(claim_id); @@ -1324,24 +1296,16 @@ void sql_check_chart_liveness(RRDSET *st) { rrdset_unlock(st); } -#endif //ENABLE_NEW_CLOUD_PROTOCOL - // ST is read locked int queue_chart_to_aclk(RRDSET *st) { -#ifndef ENABLE_NEW_CLOUD_PROTOCOL -#ifdef ENABLE_ACLK - aclk_update_chart(st->rrdhost, st->id, 1); -#else - UNUSED(st); -#endif - return 0; -#else - if (!aclk_use_new_cloud_arch && aclk_connected) { - aclk_update_chart(st->rrdhost, st->id, 1); + RRDHOST *host = st->rrdhost; + + if (likely(rrdhost_flag_check(host, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS))) return 0; - } + return sql_queue_chart_payload((struct aclk_database_worker_config *) st->rrdhost->dbsync_worker, st, ACLK_DATABASE_ADD_CHART); -#endif } + +#endif //ENABLE_ACLK diff --git a/database/sqlite/sqlite_aclk_node.c b/database/sqlite/sqlite_aclk_node.c index 239a24b8c..3d11f83aa 100644 --- a/database/sqlite/sqlite_aclk_node.c +++ b/database/sqlite/sqlite_aclk_node.c @@ -3,23 +3,72 @@ #include "sqlite_functions.h" #include "sqlite_aclk_node.h" -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK #include "../../aclk/aclk_charts_api.h" #endif +#ifdef ENABLE_ACLK +DICTIONARY *collectors_from_charts(RRDHOST *host, DICTIONARY *dict) { + RRDSET *st; + char name[500]; + + rrdhost_rdlock(host); + rrdset_foreach_read(st, host) { + if (rrdset_is_available_for_viewers(st)) { + struct collector_info col = { + .plugin = st->plugin_name ? st->plugin_name : "", + .module = st->module_name ? st->module_name : "" + }; + snprintfz(name, 499, "%s:%s", col.plugin, col.module); + dictionary_set(dict, name, &col, sizeof(struct collector_info)); + } + } + rrdhost_unlock(host); + + return dict; +} +#endif + +void sql_build_node_collectors(struct aclk_database_worker_config *wc) +{ +#ifdef ENABLE_ACLK + if (!wc->host) + return; + + struct update_node_collectors upd_node_collectors; + DICTIONARY *dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED); + + upd_node_collectors.node_id = wc->node_id; + upd_node_collectors.claim_id = get_agent_claimid(); + + upd_node_collectors.node_collectors = collectors_from_charts(wc->host, dict); + aclk_update_node_collectors(&upd_node_collectors); + + dictionary_destroy(dict); + freez(upd_node_collectors.claim_id); + + log_access("ACLK RES [%s (%s)]: NODE COLLECTORS SENT", wc->node_id, wc->host->hostname); +#else + UNUSED(wc); +#endif + return; +} + void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd) { UNUSED(cmd); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL +#ifdef ENABLE_ACLK struct update_node_info node_info; - if (!wc->host) + if (!wc->host) { + wc->node_info_send = 1; return; + } rrd_rdlock(); node_info.node_id = wc->node_id; - node_info.claim_id = is_agent_claimed(); + node_info.claim_id = get_agent_claimid(); node_info.machine_guid = wc->host_guid; node_info.child = (wc->host != localhost); node_info.ml_info.ml_capable = ml_capable(localhost); @@ -29,6 +78,7 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat { .name = "proto", .version = 1, .enabled = 1 }, { .name = "ml", .version = ml_capable(localhost), .enabled = ml_enabled(wc->host) }, { .name = "mc", .version = enable_metric_correlations ? metric_correlations_version : 0, .enabled = enable_metric_correlations }, + { .name = "ctx", .version = 1, .enabled = rrdcontext_enabled}, { .name = NULL, .version = 0, .enabled = 0 } }; node_info.node_instance_capabilities = instance_caps; @@ -61,8 +111,6 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat node_info.data.virtualization_type = host->system_info->virtualization ? host->system_info->virtualization : "unknown"; node_info.data.container_type = host->system_info->container ? host->system_info->container : "unknown"; node_info.data.custom_info = config_get(CONFIG_SECTION_WEB, "custom dashboard_info.js", ""); - node_info.data.services = NULL; // char ** - node_info.data.service_count = 0; node_info.data.machine_guid = wc->host_guid; struct capability node_caps[] = { @@ -75,17 +123,16 @@ void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_dat node_info.data.ml_info.ml_capable = host->system_info->ml_capable; node_info.data.ml_info.ml_enabled = host->system_info->ml_enabled; - struct label_index *labels = &host->labels; - netdata_rwlock_rdlock(&labels->labels_rwlock); - node_info.data.host_labels_head = labels->head; + node_info.data.host_labels_ptr = host->host_labels; aclk_update_node_info(&node_info); log_access("ACLK RES [%s (%s)]: NODE INFO SENT for guid [%s] (%s)", wc->node_id, wc->host->hostname, wc->host_guid, wc->host == localhost ? "parent" : "child"); - netdata_rwlock_unlock(&labels->labels_rwlock); rrd_unlock(); freez(node_info.claim_id); freez(host_version); + + wc->node_collectors_send = now_realtime_sec(); #else UNUSED(wc); #endif diff --git a/database/sqlite/sqlite_aclk_node.h b/database/sqlite/sqlite_aclk_node.h index b8f8c6bbf..c2c54f8c7 100644 --- a/database/sqlite/sqlite_aclk_node.h +++ b/database/sqlite/sqlite_aclk_node.h @@ -4,4 +4,5 @@ #define NETDATA_SQLITE_ACLK_NODE_H void sql_build_node_info(struct aclk_database_worker_config *wc, struct aclk_database_cmd cmd); +void sql_build_node_collectors(struct aclk_database_worker_config *wc); #endif //NETDATA_SQLITE_ACLK_NODE_H diff --git a/database/sqlite/sqlite_context.c b/database/sqlite/sqlite_context.c new file mode 100644 index 000000000..88818579b --- /dev/null +++ b/database/sqlite/sqlite_context.c @@ -0,0 +1,551 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "sqlite_functions.h" +#include "sqlite_context.h" +#include "sqlite_db_migration.h" + +#define DB_CONTEXT_METADATA_VERSION 1 + +const char *database_context_config[] = { + "CREATE TABLE IF NOT EXISTS context (host_id BLOB, id TEXT NOT NULL, version INT NOT NULL, title TEXT NOT NULL, " \ + "chart_type TEXT NOT NULL, unit TEXT NOT NULL, priority INT NOT NULL, first_time_t INT NOT NULL, " + "last_time_t INT NOT NULL, deleted INT NOT NULL, " + "family TEXT, PRIMARY KEY (host_id, id));", + + NULL +}; + +const char *database_context_cleanup[] = { + "VACUUM;", + NULL +}; + +sqlite3 *db_context_meta = NULL; + +/* + * Initialize the SQLite database + * Return 0 on success + */ +int sql_init_context_database(int memory) +{ + char sqlite_database[FILENAME_MAX + 1]; + int rc; + + if (likely(!memory)) + snprintfz(sqlite_database, FILENAME_MAX, "%s/context-meta.db", netdata_configured_cache_dir); + else + strcpy(sqlite_database, ":memory:"); + + rc = sqlite3_open(sqlite_database, &db_context_meta); + if (rc != SQLITE_OK) { + error_report("Failed to initialize database at %s, due to \"%s\"", sqlite_database, sqlite3_errstr(rc)); + sqlite3_close(db_context_meta); + db_context_meta = NULL; + return 1; + } + + info("SQLite database %s initialization", sqlite_database); + + char buf[1024 + 1] = ""; + const char *list[2] = { buf, NULL }; + + int target_version = DB_CONTEXT_METADATA_VERSION; + if (likely(!memory)) + target_version = perform_context_database_migration(db_context_meta, DB_CONTEXT_METADATA_VERSION); + + // https://www.sqlite.org/pragma.html#pragma_auto_vacuum + // PRAGMA schema.auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL; + snprintfz(buf, 1024, "PRAGMA auto_vacuum=%s;", config_get(CONFIG_SECTION_SQLITE, "auto vacuum", "INCREMENTAL")); + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + // https://www.sqlite.org/pragma.html#pragma_synchronous + // PRAGMA schema.synchronous = 0 | OFF | 1 | NORMAL | 2 | FULL | 3 | EXTRA; + snprintfz(buf, 1024, "PRAGMA synchronous=%s;", config_get(CONFIG_SECTION_SQLITE, "synchronous", "NORMAL")); + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + // https://www.sqlite.org/pragma.html#pragma_journal_mode + // PRAGMA schema.journal_mode = DELETE | TRUNCATE | PERSIST | MEMORY | WAL | OFF + snprintfz(buf, 1024, "PRAGMA journal_mode=%s;", config_get(CONFIG_SECTION_SQLITE, "journal mode", "WAL")); + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + // https://www.sqlite.org/pragma.html#pragma_temp_store + // PRAGMA temp_store = 0 | DEFAULT | 1 | FILE | 2 | MEMORY; + snprintfz(buf, 1024, "PRAGMA temp_store=%s;", config_get(CONFIG_SECTION_SQLITE, "temp store", "MEMORY")); + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + // https://www.sqlite.org/pragma.html#pragma_journal_size_limit + // PRAGMA schema.journal_size_limit = N ; + snprintfz(buf, 1024, "PRAGMA journal_size_limit=%lld;", config_get_number(CONFIG_SECTION_SQLITE, "journal size limit", 16777216)); + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + // https://www.sqlite.org/pragma.html#pragma_cache_size + // PRAGMA schema.cache_size = pages; + // PRAGMA schema.cache_size = -kibibytes; + snprintfz(buf, 1024, "PRAGMA cache_size=%lld;", config_get_number(CONFIG_SECTION_SQLITE, "cache size", -2000)); + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + snprintfz(buf, 1024, "PRAGMA user_version=%d;", target_version); + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + if (likely(!memory)) + snprintfz(buf, 1024, "ATTACH DATABASE \"%s/netdata-meta.db\" as meta;", netdata_configured_cache_dir); + else + snprintfz(buf, 1024, "ATTACH DATABASE ':memory:' as meta;"); + + if(init_database_batch(db_context_meta, DB_CHECK_NONE, 0, list)) return 1; + + if (init_database_batch(db_context_meta, DB_CHECK_NONE, 0, &database_context_config[0])) + return 1; + + if (init_database_batch(db_context_meta, DB_CHECK_NONE, 0, &database_context_cleanup[0])) + return 1; + + return 0; +} + +/* + * Close the sqlite database + */ + +void sql_close_context_database(void) +{ + int rc; + if (unlikely(!db_context_meta)) + return; + + info("Closing context SQLite database"); + + rc = sqlite3_close_v2(db_context_meta); + if (unlikely(rc != SQLITE_OK)) + error_report("Error %d while closing the context SQLite database, %s", rc, sqlite3_errstr(rc)); + return; +} + +// +// Fetching data +// +#define CTX_GET_CHART_LIST "SELECT c.chart_id, c.type||'.'||c.id, c.name, c.context, c.title, c.unit, c.priority, " \ + "c.update_every, c.chart_type, c.family FROM meta.chart c WHERE c.host_id = @host_id; " + +void ctx_get_chart_list(uuid_t *host_uuid, void (*dict_cb)(SQL_CHART_DATA *, void *), void *data) +{ + int rc; + sqlite3_stmt *res = NULL; + + if (unlikely(!host_uuid)) { + internal_error(true, "Requesting context chart list without host_id"); + return; + } + + rc = sqlite3_prepare_v2(db_context_meta, CTX_GET_CHART_LIST, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to fetch chart list"); + return; + } + + rc = sqlite3_bind_blob(res, 1, host_uuid, sizeof(*host_uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host_id to fetch the chart list"); + goto skip_load; + } + + SQL_CHART_DATA chart_data = { 0 }; + while (sqlite3_step(res) == SQLITE_ROW) { + uuid_copy(chart_data.chart_id, *((uuid_t *)sqlite3_column_blob(res, 0))); + chart_data.id = (char *) sqlite3_column_text(res, 1); + chart_data.name = (char *) sqlite3_column_text(res, 2); + chart_data.context = (char *) sqlite3_column_text(res, 3); + chart_data.title = (char *) sqlite3_column_text(res, 4); + chart_data.units = (char *) sqlite3_column_text(res, 5); + chart_data.priority = sqlite3_column_int(res, 6); + chart_data.update_every = sqlite3_column_int(res, 7); + chart_data.chart_type = sqlite3_column_int(res, 8); + chart_data.family = (char *) sqlite3_column_text(res, 9); + dict_cb(&chart_data, data); + } + +skip_load: + rc = sqlite3_finalize(res); + if (rc != SQLITE_OK) + error_report("Failed to finalize statement that fetches chart label data, rc = %d", rc); +} + +// Dimension list +#define CTX_GET_DIMENSION_LIST "SELECT d.dim_id, d.id, d.name FROM meta.dimension d WHERE d.chart_id = @id;" +void ctx_get_dimension_list(uuid_t *chart_uuid, void (*dict_cb)(SQL_DIMENSION_DATA *, void *), void *data) +{ + int rc; + sqlite3_stmt *res = NULL; + + rc = sqlite3_prepare_v2(db_context_meta, CTX_GET_DIMENSION_LIST, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to fetch chart dimension data"); + return; + } + + rc = sqlite3_bind_blob(res, 1, chart_uuid, sizeof(*chart_uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind chart_id to fetch dimension list"); + goto failed; + } + + SQL_DIMENSION_DATA dimension_data; + + while (sqlite3_step(res) == SQLITE_ROW) { + uuid_copy(dimension_data.dim_id, *((uuid_t *)sqlite3_column_blob(res, 0))); + dimension_data.id = (char *) sqlite3_column_text(res, 1); + dimension_data.name = (char *) sqlite3_column_text(res, 2); + dict_cb(&dimension_data, data); + } + +failed: + rc = sqlite3_finalize(res); + if (rc != SQLITE_OK) + error_report("Failed to finalize statement that fetches the chart dimension list, rc = %d", rc); +} + +// LABEL LIST +#define CTX_GET_LABEL_LIST "SELECT l.label_key, l.label_value, l.source_type FROM meta.chart_label l WHERE l.chart_id = @id;" +void ctx_get_label_list(uuid_t *chart_uuid, void (*dict_cb)(SQL_CLABEL_DATA *, void *), void *data) +{ + int rc; + sqlite3_stmt *res = NULL; + + rc = sqlite3_prepare_v2(db_context_meta, CTX_GET_LABEL_LIST, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to fetch chart lanbels"); + return; + } + + rc = sqlite3_bind_blob(res, 1, chart_uuid, sizeof(*chart_uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind chart_id to fetch chart labels"); + goto failed; + } + + SQL_CLABEL_DATA label_data; + + while (sqlite3_step(res) == SQLITE_ROW) { + label_data.label_key = (char *) sqlite3_column_text(res, 0); + label_data.label_value = (char *) sqlite3_column_text(res, 1); + label_data.label_source = sqlite3_column_int(res, 2); + dict_cb(&label_data, data); + } + +failed: + rc = sqlite3_finalize(res); + if (rc != SQLITE_OK) + error_report("Failed to finalize statement that fetches chart label data, rc = %d", rc); + + return; +} + +// CONTEXT LIST +#define CTX_GET_CONTEXT_LIST "SELECT id, version, title, chart_type, unit, priority, first_time_t, " \ + "last_time_t, deleted, family FROM context c WHERE c.host_id = @host_id;" +void ctx_get_context_list(uuid_t *host_uuid, void (*dict_cb)(VERSIONED_CONTEXT_DATA *, void *), void *data) +{ + + if (unlikely(!host_uuid)) + return; + + int rc; + sqlite3_stmt *res = NULL; + + rc = sqlite3_prepare_v2(db_context_meta, CTX_GET_CONTEXT_LIST, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to fetch stored context list"); + return; + } + + VERSIONED_CONTEXT_DATA context_data = {0}; + + rc = sqlite3_bind_blob(res, 1, host_uuid, sizeof(*host_uuid), SQLITE_STATIC); + + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host_id to fetch versioned context data"); + goto failed; + } + + while (sqlite3_step(res) == SQLITE_ROW) { + context_data.id = (char *) sqlite3_column_text(res, 0); + context_data.version = sqlite3_column_int64(res, 1); + context_data.title = (char *) sqlite3_column_text(res, 2); + context_data.chart_type = (char *) sqlite3_column_text(res, 3); + context_data.units = (char *) sqlite3_column_text(res, 4); + context_data.priority = sqlite3_column_int64(res, 5); + context_data.first_time_t = sqlite3_column_int64(res, 6); + context_data.last_time_t = sqlite3_column_int64(res, 7); + context_data.deleted = sqlite3_column_int(res, 8); + context_data.family = (char *) sqlite3_column_text(res, 9); + dict_cb(&context_data, data); + } + +failed: + rc = sqlite3_finalize(res); + if (rc != SQLITE_OK) + error_report("Failed to finalize statement that fetches stored context versioned data, rc = %d", rc); +} + + +// +// Storing Data +// +#define CTX_STORE_CONTEXT "INSERT OR REPLACE INTO context " \ + "(host_id, id, version, title, chart_type, unit, priority, first_time_t, last_time_t, deleted, family) " \ + "VALUES (@host_id, @context, @version, @title, @chart_type, @unit, @priority, @first_time_t, @last_time_t, @deleted, @family);" + +int ctx_store_context(uuid_t *host_uuid, VERSIONED_CONTEXT_DATA *context_data) +{ + int rc, rc_stored = 1; + sqlite3_stmt *res = NULL; + + if (unlikely(!host_uuid || !context_data || !context_data->id)) + return 0; + + rc = sqlite3_prepare_v2(db_context_meta, CTX_STORE_CONTEXT, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to store context"); + return 1; + } + + rc = sqlite3_bind_blob(res, 1, host_uuid, sizeof(*host_uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host_uuid to store context details"); + goto skip_store; + } + + rc = bind_text_null(res, 2, context_data->id, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind context to store details"); + goto skip_store; + } + + rc = sqlite3_bind_int64(res, 3, (time_t) context_data->version); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind first_time_t to store context details"); + goto skip_store; + } + + rc = bind_text_null(res, 4, context_data->title, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind context to store details"); + goto skip_store; + } + + rc = bind_text_null(res, 5, context_data->chart_type, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind context to store details"); + goto skip_store; + } + + rc = bind_text_null(res, 6, context_data->units, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind context to store details"); + goto skip_store; + } + + rc = sqlite3_bind_int64(res, 7, (time_t) context_data->priority); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind first_time_t to store context details"); + goto skip_store; + } + + rc = sqlite3_bind_int64(res, 8, (time_t) context_data->first_time_t); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind first_time_t to store context details"); + goto skip_store; + } + + rc = sqlite3_bind_int64(res, 9, (time_t) context_data->last_time_t); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind last_time_t to store context details"); + goto skip_store; + } + + rc = sqlite3_bind_int(res, 10, (time_t) context_data->deleted); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind last_time_t to store context details"); + goto skip_store; + } + + rc = bind_text_null(res, 11, context_data->family, 1); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind context to store details"); + goto skip_store; + } + + rc_stored = execute_insert(res); + + if (rc_stored != SQLITE_DONE) + error_report("Failed store context details for context %s, rc = %d", context_data->id, rc_stored); + +skip_store: + rc = sqlite3_finalize(res); + if (rc != SQLITE_OK) + error_report("Failed to finalize statement that stores context details, rc = %d", rc); + + return (rc_stored != SQLITE_DONE); +} + +// Delete a context + +#define CTX_DELETE_CONTEXT "DELETE FROM context WHERE host_id = @host_id AND id = @context;" +int ctx_delete_context(uuid_t *host_uuid, VERSIONED_CONTEXT_DATA *context_data) +{ + int rc, rc_stored = 1; + sqlite3_stmt *res = NULL; + + if (unlikely(!context_data || !context_data->id)) + return 0; + + rc = sqlite3_prepare_v2(db_context_meta, CTX_DELETE_CONTEXT, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to delete context"); + return 1; + } + + rc = sqlite3_bind_blob(res, 1, host_uuid, sizeof(*host_uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host_id to delete context data"); + goto skip_delete; + } + + rc = sqlite3_bind_text(res, 2, context_data->id, -1, SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind context id for data deletion"); + goto skip_delete; + } + + rc_stored = execute_insert(res); + + if (rc_stored != SQLITE_DONE) + error_report("Failed to delete context %s, rc = %d", context_data->id, rc_stored); +#ifdef NETDATA_INTERNAL_CHECKS + else { + char host_uuid_str[UUID_STR_LEN]; + uuid_unparse_lower(*host_uuid, host_uuid_str); + info("%s: Deleted context %s under host %s", __FUNCTION__ , context_data->id, host_uuid_str); + } +#endif + +skip_delete: + rc = sqlite3_finalize(res); + if (rc != SQLITE_OK) + error_report("Failed to finalize statement where deleting a context, rc = %d", rc); + + return (rc_stored != SQLITE_DONE); +} + +// +// TESTING FUNCTIONS +// + +static void dict_ctx_get_context_list_cb(VERSIONED_CONTEXT_DATA *context_data, void *data) +{ + (void)data; + info(" Context id = %s " + "version = %lu " + "title = %s " + "chart_type = %s " + "units = %s " + "priority = %lu " + "first time = %lu " + "last time = %lu " + "deleted = %d " + "family = %s", + context_data->id, + context_data->version, + context_data->title, + context_data->chart_type, + context_data->units, + context_data->priority, + context_data->first_time_t, + context_data->last_time_t, + context_data->deleted, + context_data->family); +} + +int ctx_unittest(void) +{ + uuid_t host_uuid; + uuid_generate(host_uuid); + + int rc = sql_init_context_database(1); + + if (rc != SQLITE_OK) + return 1; + + // Store a context + VERSIONED_CONTEXT_DATA context_data; + + context_data.id = strdupz("cpu.cpu"); + context_data.title = strdupz("TestContextTitle"); + context_data.units= strdupz("TestContextUnits"); + context_data.chart_type = strdupz("TestContextChartType"); + context_data.family = strdupz("TestContextFamily"); + context_data.priority = 50000; + context_data.deleted = 0; + context_data.first_time_t = 1657781000; + context_data.last_time_t = 1657781100; + context_data.version = now_realtime_usec(); + + if (likely(!ctx_store_context(&host_uuid, &context_data))) + info("Entry %s inserted", context_data.id); + else + info("Entry %s not inserted", context_data.id); + + if (likely(!ctx_store_context(&host_uuid, &context_data))) + info("Entry %s inserted", context_data.id); + else + info("Entry %s not inserted", context_data.id); + + // This will change end time + context_data.first_time_t = 1657781000; + context_data.last_time_t = 1657782001; + if (likely(!ctx_update_context(&host_uuid, &context_data))) + info("Entry %s updated", context_data.id); + else + info("Entry %s not updated", context_data.id); + info("List context start after insert"); + ctx_get_context_list(&host_uuid, dict_ctx_get_context_list_cb, NULL); + info("List context end after insert"); + + // This will change start time + context_data.first_time_t = 1657782000; + context_data.last_time_t = 1657782001; + if (likely(!ctx_update_context(&host_uuid, &context_data))) + info("Entry %s updated", context_data.id); + else + info("Entry %s not updated", context_data.id); + + // This will list one entry + info("List context start after insert"); + ctx_get_context_list(&host_uuid, dict_ctx_get_context_list_cb, NULL); + info("List context end after insert"); + + info("List context start after insert"); + ctx_get_context_list(&host_uuid, dict_ctx_get_context_list_cb, NULL); + info("List context end after insert"); + + // This will delete the entry + if (likely(!ctx_delete_context(&host_uuid, &context_data))) + info("Entry %s deleted", context_data.id); + else + info("Entry %s not deleted", context_data.id); + + freez((void *)context_data.id); + freez((void *)context_data.title); + freez((void *)context_data.chart_type); + freez((void *)context_data.family); + + // The list should be empty + info("List context start after delete"); + ctx_get_context_list(&host_uuid, dict_ctx_get_context_list_cb, NULL); + info("List context end after delete"); + + sql_close_context_database(); + + return 0; +} + diff --git a/database/sqlite/sqlite_context.h b/database/sqlite/sqlite_context.h new file mode 100644 index 000000000..12937fffd --- /dev/null +++ b/database/sqlite/sqlite_context.h @@ -0,0 +1,68 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_SQLITE_CONTEXT_H +#define NETDATA_SQLITE_CONTEXT_H + +#include "daemon/common.h" +#include "sqlite3.h" + +typedef struct ctx_chart { + uuid_t chart_id; + const char *id; + const char *name; + const char *context; + const char *title; + const char *units; + const char *family; + int chart_type; + int priority; + int update_every; +} SQL_CHART_DATA; + +typedef struct ctx_dimension { + uuid_t dim_id; + char *id; + char *name; +} SQL_DIMENSION_DATA; + +typedef struct ctx_label { + char *label_key; + char *label_value; + int label_source; +} SQL_CLABEL_DATA; + +// Structure to store or delete +typedef struct versioned_context_data { + uint64_t version; // the version of this context as EPOCH in seconds + + const char *id; // the id of the context + const char *title; // the title of the context + const char *chart_type; // the chart_type of the context + const char *units; // the units of the context + const char *family; // the family of the context + + uint64_t priority; // the chart priority of the context + + uint64_t first_time_t; // the first entry in the database, in seconds + uint64_t last_time_t; // the last point in the database, in seconds + + bool deleted; // true when this is deleted + +} VERSIONED_CONTEXT_DATA; + +extern void ctx_get_context_list(uuid_t *host_uuid, void (*dict_cb)(VERSIONED_CONTEXT_DATA *, void *), void *data); + +extern void ctx_get_chart_list(uuid_t *host_uuid, void (*dict_cb)(SQL_CHART_DATA *, void *), void *data); +extern void ctx_get_label_list(uuid_t *chart_uuid, void (*dict_cb)(SQL_CLABEL_DATA *, void *), void *data); +extern void ctx_get_dimension_list(uuid_t *chart_uuid, void (*dict_cb)(SQL_DIMENSION_DATA *, void *), void *data); + +extern int ctx_store_context(uuid_t *host_uuid, VERSIONED_CONTEXT_DATA *context_data); + +#define ctx_update_context(host_uuid, context_data) ctx_store_context(host_uuid, context_data) + +extern int ctx_delete_context(uuid_t *host_id, VERSIONED_CONTEXT_DATA *context_data); + +extern int sql_init_context_database(int memory); +extern void sql_close_context_database(void); +extern int ctx_unittest(void); +#endif //NETDATA_SQLITE_CONTEXT_H diff --git a/database/sqlite/sqlite_db_migration.c b/database/sqlite/sqlite_db_migration.c new file mode 100644 index 000000000..bd4743364 --- /dev/null +++ b/database/sqlite/sqlite_db_migration.c @@ -0,0 +1,185 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "sqlite_db_migration.h" + +static int return_int_cb(void *data, int argc, char **argv, char **column) +{ + int *status = data; + UNUSED(argc); + UNUSED(column); + *status = str2uint32_t(argv[0]); + return 0; +} + + +static int table_exists_in_database(const char *table) +{ + char *err_msg = NULL; + char sql[128]; + + int exists = 0; + + snprintf(sql, 127, "select 1 from sqlite_schema where type = 'table' and name = '%s';", table); + + int rc = sqlite3_exec(db_meta, sql, return_int_cb, (void *) &exists, &err_msg); + if (rc != SQLITE_OK) { + info("Error checking table existence; %s", err_msg); + sqlite3_free(err_msg); + } + + return exists; +} + +static int column_exists_in_table(const char *table, const char *column) +{ + char *err_msg = NULL; + char sql[128]; + + int exists = 0; + + snprintf(sql, 127, "SELECT 1 FROM pragma_table_info('%s') where name = '%s';", table, column); + + int rc = sqlite3_exec(db_meta, sql, return_int_cb, (void *) &exists, &err_msg); + if (rc != SQLITE_OK) { + info("Error checking column existence; %s", err_msg); + sqlite3_free(err_msg); + } + + return exists; +} + +const char *database_migrate_v1_v2[] = { + "ALTER TABLE host ADD hops INTEGER;", + NULL +}; + +const char *database_migrate_v2_v3[] = { + "ALTER TABLE host ADD memory_mode INT NOT NULL DEFAULT 0;", + "ALTER TABLE host ADD abbrev_timezone TEXT NOT NULL DEFAULT '';", + "ALTER TABLE host ADD utc_offset INT NOT NULL DEFAULT 0;", + "ALTER TABLE host ADD program_name TEXT NOT NULL DEFAULT 'unknown';", + "ALTER TABLE host ADD program_version TEXT NOT NULL DEFAULT 'unknown';", + "ALTER TABLE host ADD entries INT NOT NULL DEFAULT 0;", + "ALTER TABLE host ADD health_enabled INT NOT NULL DEFAULT 0;", + NULL +}; + +static int do_migration_v1_v2(sqlite3 *database, const char *name) +{ + UNUSED(name); + info("Running \"%s\" database migration", name); + + if (table_exists_in_database("host") && !column_exists_in_table("host", "hops")) + return init_database_batch(database, DB_CHECK_NONE, 0, &database_migrate_v1_v2[0]); + return 0; +} + +static int do_migration_v2_v3(sqlite3 *database, const char *name) +{ + UNUSED(name); + info("Running \"%s\" database migration", name); + + if (table_exists_in_database("host") && !column_exists_in_table("host", "memory_mode")) + return init_database_batch(database, DB_CHECK_NONE, 0, &database_migrate_v2_v3[0]); + return 0; +} + +static int do_migration_v3_v4(sqlite3 *database, const char *name) +{ + UNUSED(name); + info("Running database migration %s", name); + + char sql[256]; + + int rc; + sqlite3_stmt *res = NULL; + snprintfz(sql, 255, "SELECT name FROM sqlite_schema WHERE type ='table' AND name LIKE 'health_log_%%';"); + rc = sqlite3_prepare_v2(database, sql, -1, &res, 0); + if (rc != SQLITE_OK) { + error_report("Failed to prepare statement to alter health_log tables"); + return 1; + } + + while (sqlite3_step(res) == SQLITE_ROW) { + char *table = strdupz((char *) sqlite3_column_text(res, 0)); + if (!column_exists_in_table(table, "chart_context")) { + snprintfz(sql, 255, "ALTER TABLE %s ADD chart_context text", table); + sqlite3_exec(database, sql, 0, 0, NULL); + } + freez(table); + } + + rc = sqlite3_finalize(res); + if (unlikely(rc != SQLITE_OK)) + error_report("Failed to finalize statement when altering health_log tables, rc = %d", rc); + + return 0; +} + +static int do_migration_noop(sqlite3 *database, const char *name) +{ + UNUSED(database); + UNUSED(name); + info("Running database migration %s", name); + return 0; +} + +typedef struct database_func_migration_list { + char *name; + int (*func)(sqlite3 *database, const char *name); +} DATABASE_FUNC_MIGRATION_LIST; + + +static int migrate_database(sqlite3 *database, int target_version, char *db_name, DATABASE_FUNC_MIGRATION_LIST *migration_list) +{ + int user_version = 0; + char *err_msg = NULL; + + int rc = sqlite3_exec(database, "PRAGMA user_version;", return_int_cb, (void *) &user_version, &err_msg); + if (rc != SQLITE_OK) { + info("Error checking the %s database version; %s", db_name, err_msg); + sqlite3_free(err_msg); + } + + if (likely(user_version == target_version)) { + info("%s database version is %d (no migration needed)", db_name, target_version); + return target_version; + } + + info("Database version is %d, current version is %d. Running migration for %s ...", user_version, target_version, db_name); + for (int i = user_version; i < target_version && migration_list[i].func; i++) { + rc = (migration_list[i].func)(database, migration_list[i].name); + if (unlikely(rc)) { + error_report("Database %s migration from version %d to version %d failed", db_name, i, i + 1); + return i; + } + } + return target_version; + +} + +DATABASE_FUNC_MIGRATION_LIST migration_action[] = { + {.name = "v0 to v1", .func = do_migration_noop}, + {.name = "v1 to v2", .func = do_migration_v1_v2}, + {.name = "v2 to v3", .func = do_migration_v2_v3}, + {.name = "v3 to v4", .func = do_migration_v3_v4}, + // the terminator of this array + {.name = NULL, .func = NULL} +}; + +DATABASE_FUNC_MIGRATION_LIST context_migration_action[] = { + {.name = "v0 to v1", .func = do_migration_noop}, + // the terminator of this array + {.name = NULL, .func = NULL} +}; + + +int perform_database_migration(sqlite3 *database, int target_version) +{ + return migrate_database(database, target_version, "metadata", migration_action); +} + +int perform_context_database_migration(sqlite3 *database, int target_version) +{ + return migrate_database(database, target_version, "context", context_migration_action); +} diff --git a/database/sqlite/sqlite_db_migration.h b/database/sqlite/sqlite_db_migration.h new file mode 100644 index 000000000..138643a49 --- /dev/null +++ b/database/sqlite/sqlite_db_migration.h @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-3.0-or-later +#ifndef NETDATA_SQLITE_DB_MIGRATION_H +#define NETDATA_SQLITE_DB_MIGRATION_H + +#include "daemon/common.h" +#include "sqlite3.h" + + +int perform_database_migration(sqlite3 *database, int target_version); +int perform_context_database_migration(sqlite3 *database, int target_version); + +#endif //NETDATA_SQLITE_DB_MIGRATION_H diff --git a/database/sqlite/sqlite_functions.c b/database/sqlite/sqlite_functions.c index 502633c67..f46450afa 100644 --- a/database/sqlite/sqlite_functions.c +++ b/database/sqlite/sqlite_functions.c @@ -1,12 +1,20 @@ // SPDX-License-Identifier: GPL-3.0-or-later #include "sqlite_functions.h" +#include "sqlite_db_migration.h" -#define DB_METADATA_VERSION "1" +#define DB_METADATA_VERSION 4 const char *database_config[] = { - "CREATE TABLE IF NOT EXISTS host(host_id blob PRIMARY KEY, hostname text, " - "registry_hostname text, update_every int, os text, timezone text, tags text);", + "CREATE TABLE IF NOT EXISTS host(host_id BLOB PRIMARY KEY, hostname TEXT NOT NULL, " + "registry_hostname TEXT NOT NULL default 'unknown', update_every INT NOT NULL default 1, " + "os TEXT NOT NULL default 'unknown', timezone TEXT NOT NULL default 'unknown', tags TEXT NOT NULL default ''," + "hops INT NOT NULL DEFAULT 0," + "memory_mode INT DEFAULT 0, abbrev_timezone TEXT DEFAULT '', utc_offset INT NOT NULL DEFAULT 0," + "program_name TEXT NOT NULL DEFAULT 'unknown', program_version TEXT NOT NULL DEFAULT 'unknown', " + "entries INT NOT NULL DEFAULT 0," + "health_enabled INT NOT NULL DEFAULT 0);", + "CREATE TABLE IF NOT EXISTS chart(chart_id blob PRIMARY KEY, host_id blob, type text, id text, name text, " "family text, context text, title text, unit text, plugin text, module text, priority int, update_every int, " "chart_type int, memory_mode int, history_entries);", @@ -31,6 +39,12 @@ const char *database_config[] = { "repeat text, host_labels text, p_db_lookup_dimensions text, p_db_lookup_method text, p_db_lookup_options int, " "p_db_lookup_after int, p_db_lookup_before int, p_update_every int);", + "CREATE TABLE IF NOT EXISTS host_info(host_id blob, system_key text NOT NULL, system_value text NOT NULL, " + "date_created INT, PRIMARY KEY(host_id, system_key));", + + "CREATE TABLE IF NOT EXISTS host_label(host_id blob, source_type int, label_key text NOT NULL, " + "label_value text NOT NULL, date_created INT, PRIMARY KEY (host_id, label_key));", + "CREATE TABLE IF NOT EXISTS chart_hash_map(chart_id blob , hash_id blob, UNIQUE (chart_id, hash_id));", "CREATE TABLE IF NOT EXISTS chart_hash(hash_id blob PRIMARY KEY,type text, id text, name text, " @@ -41,18 +55,17 @@ const char *database_config[] = { "WHERE ch.hash_id = chm.hash_id;", "CREATE TRIGGER IF NOT EXISTS ins_host AFTER INSERT ON host BEGIN INSERT INTO node_instance (host_id, date_created)" - " SELECT new.host_id, strftime(\"%s\") WHERE new.host_id NOT IN (SELECT host_id FROM node_instance); END;", + " SELECT new.host_id, unixepoch() WHERE new.host_id NOT IN (SELECT host_id FROM node_instance); END;", "CREATE TRIGGER IF NOT EXISTS tr_v_chart_hash INSTEAD OF INSERT on v_chart_hash BEGIN " "INSERT INTO chart_hash (hash_id, type, id, name, family, context, title, unit, plugin, " "module, priority, chart_type, last_used) " "values (new.hash_id, new.type, new.id, new.name, new.family, new.context, new.title, new.unit, new.plugin, " - "new.module, new.priority, new.chart_type, strftime('%s')) " - "ON CONFLICT (hash_id) DO UPDATE SET last_used = strftime('%s'); " + "new.module, new.priority, new.chart_type, unixepoch()) " + "ON CONFLICT (hash_id) DO UPDATE SET last_used = unixepoch(); " "INSERT INTO chart_hash_map (chart_id, hash_id) values (new.chart_id, new.hash_id) " "on conflict (chart_id, hash_id) do nothing; END; ", - "PRAGMA user_version="DB_METADATA_VERSION";", NULL }; @@ -63,11 +76,16 @@ const char *database_cleanup[] = { "DELETE FROM chart_hash_map WHERE chart_id NOT IN (SELECT chart_id FROM chart);", "DELETE FROM chart_hash WHERE hash_id NOT IN (SELECT hash_id FROM chart_hash_map);", "DELETE FROM node_instance WHERE host_id NOT IN (SELECT host_id FROM host);", + "DELETE FROM host_info WHERE host_id NOT IN (SELECT host_id FROM host);", + "DELETE FROM host_label WHERE host_id NOT IN (SELECT host_id FROM host);", NULL }; sqlite3 *db_meta = NULL; +#define MAX_PREPARED_STATEMENTS (32) +pthread_key_t key_pool[MAX_PREPARED_STATEMENTS]; + static uv_mutex_t sqlite_transaction_lock; int execute_insert(sqlite3_stmt *res) @@ -96,6 +114,10 @@ static void add_stmt_to_list(sqlite3_stmt *res) static sqlite3_stmt *statements[MAX_OPEN_STATEMENTS]; if (unlikely(!res)) { + if (idx) + info("Finilizing %d statements", idx); + else + info("No statements pending to finalize"); while (idx > 0) { int rc; rc = sqlite3_finalize(statements[--idx]); @@ -107,13 +129,39 @@ static void add_stmt_to_list(sqlite3_stmt *res) if (unlikely(idx == MAX_OPEN_STATEMENTS)) return; - statements[idx++] = res; } -int prepare_statement(sqlite3 *database, char *query, sqlite3_stmt **statement) { +static void release_statement(void *statement) +{ + int rc; +#ifdef NETDATA_INTERNAL_CHECKS + info("Thread %d: Cleaning prepared statement on %p", gettid(), statement); +#endif + if (unlikely(rc = sqlite3_finalize((sqlite3_stmt *) statement) != SQLITE_OK)) + error_report("Failed to finalize statement, rc = %d", rc); +} + +int prepare_statement(sqlite3 *database, char *query, sqlite3_stmt **statement) +{ + static __thread uint32_t keys_used = 0; + + pthread_key_t *key = NULL; + int ret = 1; + + if (likely(keys_used < MAX_PREPARED_STATEMENTS)) + key = &key_pool[keys_used++]; + int rc = sqlite3_prepare_v2(database, query, -1, statement, 0); - if (likely(rc == SQLITE_OK)) - add_stmt_to_list(*statement); + if (likely(rc == SQLITE_OK)) { + if (likely(key)) { + ret = pthread_setspecific(*key, *statement); +#ifdef NETDATA_INTERNAL_CHECKS + info("Thread %d: Using key %u on statement %p", gettid(), keys_used, *statement); +#endif + } + if (ret) + add_stmt_to_list(*statement); + } return rc; } @@ -312,13 +360,13 @@ static int attempt_database_fix() return sql_init_database(DB_CHECK_FIX_DB | DB_CHECK_CONT, 0); } -static int init_database_batch(int rebuild, int init_type, const char *batch[]) +int init_database_batch(sqlite3 *database, int rebuild, int init_type, const char *batch[]) { int rc; char *err_msg = NULL; for (int i = 0; batch[i]; i++) { debug(D_METADATALOG, "Executing %s", batch[i]); - rc = sqlite3_exec(db_meta, batch[i], 0, 0, &err_msg); + rc = sqlite3_exec(database, batch[i], 0, 0, &err_msg); if (rc != SQLITE_OK) { error_report("SQLite error during database %s, rc = %d (%s)", init_type ? "cleanup" : "setup", rc, err_msg); error_report("SQLite failed statement %s", batch[i]); @@ -404,45 +452,57 @@ int sql_init_database(db_check_action_type_t rebuild, int memory) char buf[1024 + 1] = ""; const char *list[2] = { buf, NULL }; + int target_version = DB_METADATA_VERSION; + + if (likely(!memory)) + target_version = perform_database_migration(db_meta, DB_METADATA_VERSION); + // https://www.sqlite.org/pragma.html#pragma_auto_vacuum // PRAGMA schema.auto_vacuum = 0 | NONE | 1 | FULL | 2 | INCREMENTAL; snprintfz(buf, 1024, "PRAGMA auto_vacuum=%s;", config_get(CONFIG_SECTION_SQLITE, "auto vacuum", "INCREMENTAL")); - if(init_database_batch(rebuild, 0, list)) return 1; + if(init_database_batch(db_meta, rebuild, 0, list)) return 1; // https://www.sqlite.org/pragma.html#pragma_synchronous // PRAGMA schema.synchronous = 0 | OFF | 1 | NORMAL | 2 | FULL | 3 | EXTRA; snprintfz(buf, 1024, "PRAGMA synchronous=%s;", config_get(CONFIG_SECTION_SQLITE, "synchronous", "NORMAL")); - if(init_database_batch(rebuild, 0, list)) return 1; + if(init_database_batch(db_meta, rebuild, 0, list)) return 1; // https://www.sqlite.org/pragma.html#pragma_journal_mode // PRAGMA schema.journal_mode = DELETE | TRUNCATE | PERSIST | MEMORY | WAL | OFF snprintfz(buf, 1024, "PRAGMA journal_mode=%s;", config_get(CONFIG_SECTION_SQLITE, "journal mode", "WAL")); - if(init_database_batch(rebuild, 0, list)) return 1; + if(init_database_batch(db_meta, rebuild, 0, list)) return 1; // https://www.sqlite.org/pragma.html#pragma_temp_store // PRAGMA temp_store = 0 | DEFAULT | 1 | FILE | 2 | MEMORY; snprintfz(buf, 1024, "PRAGMA temp_store=%s;", config_get(CONFIG_SECTION_SQLITE, "temp store", "MEMORY")); - if(init_database_batch(rebuild, 0, list)) return 1; - + if(init_database_batch(db_meta, rebuild, 0, list)) return 1; + // https://www.sqlite.org/pragma.html#pragma_journal_size_limit // PRAGMA schema.journal_size_limit = N ; snprintfz(buf, 1024, "PRAGMA journal_size_limit=%lld;", config_get_number(CONFIG_SECTION_SQLITE, "journal size limit", 16777216)); - if(init_database_batch(rebuild, 0, list)) return 1; + if(init_database_batch(db_meta, rebuild, 0, list)) return 1; // https://www.sqlite.org/pragma.html#pragma_cache_size // PRAGMA schema.cache_size = pages; // PRAGMA schema.cache_size = -kibibytes; snprintfz(buf, 1024, "PRAGMA cache_size=%lld;", config_get_number(CONFIG_SECTION_SQLITE, "cache size", -2000)); - if(init_database_batch(rebuild, 0, list)) return 1; + if(init_database_batch(db_meta, rebuild, 0, list)) return 1; + + snprintfz(buf, 1024, "PRAGMA user_version=%d;", target_version); + if(init_database_batch(db_meta, rebuild, 0, list)) return 1; - if (init_database_batch(rebuild, 0, &database_config[0])) + if (init_database_batch(db_meta, rebuild, 0, &database_config[0])) return 1; - if (init_database_batch(rebuild, 0, &database_cleanup[0])) + if (init_database_batch(db_meta, rebuild, 0, &database_cleanup[0])) return 1; fatal_assert(0 == uv_mutex_init(&sqlite_transaction_lock)); info("SQLite database initialization completed"); + + for (int i = 0; i < MAX_PREPARED_STATEMENTS; i++) + (void)pthread_key_create(&key_pool[i], release_statement); + return 0; } @@ -689,11 +749,53 @@ uuid_t *create_chart_uuid(RRDSET *st, const char *id, const char *name) return uuid; } -// Functions to create host, chart, dimension in the database +static int exec_statement_with_uuid(const char *sql, uuid_t *uuid) +{ + int rc, result = 1; + sqlite3_stmt *res = NULL; + + rc = sqlite3_prepare_v2(db_meta, sql, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement %s, rc = %d", sql, rc); + return 1; + } + + rc = sqlite3_bind_blob(res, 1, uuid, sizeof(*uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host parameter to %s, rc = %d", sql, rc); + goto failed; + } + + rc = execute_insert(res); + if (likely(rc == SQLITE_DONE)) + result = SQLITE_OK; + else + error_report("Failed to execute %s, rc = %d", sql, rc); + +failed: + rc = sqlite3_finalize(res); + if (unlikely(rc != SQLITE_OK)) + error_report("Failed to finalize statement %s, rc = %d", sql, rc); + return result; +} + + +// Migrate all hosts with hops zero to this host_uuid +void migrate_localhost(uuid_t *host_uuid) +{ + int rc; + + rc = exec_statement_with_uuid("UPDATE chart SET host_id = @host_id WHERE host_id in (SELECT host_id FROM host where host_id <> @host_id and hops = 0); ", host_uuid); + if (!rc) + rc = exec_statement_with_uuid("DELETE FROM host WHERE hops = 0 AND host_id <> @host_id; ", host_uuid); + if (!rc) + db_execute("DELETE FROM node_instance WHERE host_id NOT IN (SELECT host_id FROM host);"); + +} int sql_store_host( uuid_t *host_uuid, const char *hostname, const char *registry_hostname, int update_every, const char *os, - const char *tzone, const char *tags) + const char *tzone, const char *tags, int hops) { static __thread sqlite3_stmt *res = NULL; int rc; @@ -741,6 +843,10 @@ int sql_store_host( if (unlikely(rc != SQLITE_OK)) goto bind_fail; + rc = sqlite3_bind_int(res, 8, hops); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + int store_rc = sqlite3_step(res); if (unlikely(store_rc != SQLITE_DONE)) error_report("Failed to store host %s, rc = %d", hostname, rc); @@ -758,6 +864,113 @@ bind_fail: return 1; } +// +// Store host and host system info information in the database +#define SQL_STORE_HOST_INFO "INSERT OR REPLACE INTO host " \ + "(host_id, hostname, registry_hostname, update_every, os, timezone," \ + "tags, hops, memory_mode, abbrev_timezone, utc_offset, program_name, program_version," \ + "entries, health_enabled) " \ + "values (@host_id, @hostname, @registry_hostname, @update_every, @os, @timezone, @tags, @hops, @memory_mode, " \ + "@abbrev_timezone, @utc_offset, @program_name, @program_version, " \ + "@entries, @health_enabled);" + +int sql_store_host_info(RRDHOST *host) +{ + static __thread sqlite3_stmt *res = NULL; + int rc; + + if (unlikely(!db_meta)) { + if (default_rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE) + return 0; + error_report("Database has not been initialized"); + return 1; + } + + if (unlikely((!res))) { + rc = prepare_statement(db_meta, SQL_STORE_HOST_INFO, &res); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to store host, rc = %d", rc); + return 1; + } + } + + rc = sqlite3_bind_blob(res, 1, &host->host_uuid, sizeof(host->host_uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 2, host->hostname, 0); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 3, host->registry_hostname, 1); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = sqlite3_bind_int(res, 4, host->rrd_update_every); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 5, host->os, 1); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 6, host->timezone, 1); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 7, host->tags, 1); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = sqlite3_bind_int(res, 8, host->system_info ? host->system_info->hops : 0); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = sqlite3_bind_int(res, 9, host->rrd_memory_mode); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 10, host->abbrev_timezone, 1); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = sqlite3_bind_int(res, 11, host->utc_offset); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 12, host->program_name, 1); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = bind_text_null(res, 13, host->program_version, 1); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = sqlite3_bind_int64(res, 14, host->rrd_history_entries); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + rc = sqlite3_bind_int(res, 15, host->health_enabled); + if (unlikely(rc != SQLITE_OK)) + goto bind_fail; + + int store_rc = sqlite3_step(res); + if (unlikely(store_rc != SQLITE_DONE)) + error_report("Failed to store host %s, rc = %d", host->hostname, rc); + + rc = sqlite3_reset(res); + if (unlikely(rc != SQLITE_OK)) + error_report("Failed to reset statement to store host %s, rc = %d", host->hostname, rc); + + return !(store_rc == SQLITE_DONE); +bind_fail: + error_report("Failed to bind parameter to store host %s, rc = %d", host->hostname, rc); + rc = sqlite3_reset(res); + if (unlikely(rc != SQLITE_OK)) + error_report("Failed to reset statement to store host %s, rc = %d", host->hostname, rc); + return 1; +} + /* * Store a chart in the database */ @@ -1278,8 +1491,10 @@ RRDHOST *sql_create_host_by_uuid(char *hostname) host->system_info = callocz(1, sizeof(*host->system_info));; rrdhost_flag_set(host, RRDHOST_FLAG_ARCHIVED); + #ifdef ENABLE_DBENGINE - host->rrdeng_ctx = &multidb_ctx; + for(int tier = 0; tier < storage_tiers ; tier++) + host->storage_instance[tier] = (STORAGE_INSTANCE *)multidb_ctx[tier]; #endif failed: @@ -1353,7 +1568,7 @@ int file_is_migrated(char *path) } #define STORE_MIGRATED_FILE "insert or replace into metadata_migration (filename, file_size, date_created) " \ - "values (@file, @size, strftime('%s'));" + "values (@file, @size, unixepoch());" void add_migrated_file(char *path, uint64_t file_size) { @@ -1388,9 +1603,48 @@ void add_migrated_file(char *path, uint64_t file_size) return; } +static int sql_store_label(sqlite3_stmt *res, uuid_t *uuid, int source_type, const char *label, const char *value) +{ + int rc; + + rc = sqlite3_bind_blob(res, 1, uuid, sizeof(*uuid), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind UUID parameter to store label information"); + goto skip_store; + } + + rc = sqlite3_bind_int(res, 2, source_type); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind type parameter to store label information"); + goto skip_store; + } + + rc = sqlite3_bind_text(res, 3, label, -1, SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind label parameter to store label information"); + goto skip_store; + } + + rc = sqlite3_bind_text(res, 4, value, -1, SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind value parameter to store label information"); + goto skip_store; + } + + rc = execute_insert(res); + if (unlikely(rc != SQLITE_DONE)) + error_report("Failed to store label entry, rc = %d", rc); + +skip_store: + if (unlikely(sqlite3_reset(res) != SQLITE_OK)) + error_report("Failed to reset the prepared statement when storing label information"); + + return rc != SQLITE_DONE; +} + #define SQL_INS_CHART_LABEL "insert or replace into chart_label " \ "(chart_id, source_type, label_key, label_value, date_created) " \ - "values (@chart, @source, @label, @value, strftime('%s'));" + "values (@chart, @source, @label, @value, unixepoch());" void sql_store_chart_label(uuid_t *chart_uuid, int source_type, char *label, char *value) { @@ -1411,43 +1665,39 @@ void sql_store_chart_label(uuid_t *chart_uuid, int source_type, char *label, cha } } - rc = sqlite3_bind_blob(res, 1, chart_uuid, sizeof(*chart_uuid), SQLITE_STATIC); - if (unlikely(rc != SQLITE_OK)) { - error_report("Failed to bind chart_id parameter to store label information"); - goto failed; - } + sql_store_label(res, chart_uuid, source_type, label, value); - rc = sqlite3_bind_int(res, 2, source_type); - if (unlikely(rc != SQLITE_OK)) { - error_report("Failed to bind type parameter to store label information"); - goto failed; - } + return; +} - rc = sqlite3_bind_text(res, 3, label, -1, SQLITE_STATIC); - if (unlikely(rc != SQLITE_OK)) { - error_report("Failed to bind label parameter to store label information"); - goto failed; - } +#define SQL_INS_HOST_LABEL "INSERT OR REPLACE INTO host_label " \ + "(host_id, source_type, label_key, label_value, date_created) " \ + "values (@chart, @source, @label, @value, unixepoch());" - rc = sqlite3_bind_text(res, 4, value, -1, SQLITE_STATIC); - if (unlikely(rc != SQLITE_OK)) { - error_report("Failed to bind value parameter to store label information"); - goto failed; - } +static void sql_store_host_label(uuid_t *host_uuid, int source_type, const char *label, const char *value) +{ + static __thread sqlite3_stmt *res = NULL; + int rc; - rc = execute_insert(res); - if (unlikely(rc != SQLITE_DONE)) - error_report("Failed to store chart label entry, rc = %d", rc); + if (unlikely(!db_meta)) { + if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) + error_report("Database has not been initialized"); + return; + } -failed: - if (unlikely(sqlite3_reset(res) != SQLITE_OK)) - error_report("Failed to reset the prepared statement when storing chart label information"); + if (unlikely(!res)) { + rc = prepare_statement(db_meta, SQL_INS_HOST_LABEL, &res); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement store chart labels"); + return; + } + } - return; + (void) sql_store_label(res, host_uuid, source_type, label, value); } int find_dimension_first_last_t(char *machine_guid, char *chart_id, char *dim_id, - uuid_t *uuid, time_t *first_entry_t, time_t *last_entry_t, uuid_t *rrdeng_uuid) + uuid_t *uuid, time_t *first_entry_t, time_t *last_entry_t, uuid_t *rrdeng_uuid, int tier) { #ifdef ENABLE_DBENGINE int rc; @@ -1455,13 +1705,13 @@ int find_dimension_first_last_t(char *machine_guid, char *chart_id, char *dim_id uuid_t multihost_legacy_uuid; time_t dim_first_entry_t, dim_last_entry_t; - rc = rrdeng_metric_latest_time_by_uuid(uuid, &dim_first_entry_t, &dim_last_entry_t); + rc = rrdeng_metric_latest_time_by_uuid(uuid, &dim_first_entry_t, &dim_last_entry_t, tier); if (unlikely(rc)) { rrdeng_generate_legacy_uuid(dim_id, chart_id, &legacy_uuid); - rc = rrdeng_metric_latest_time_by_uuid(&legacy_uuid, &dim_first_entry_t, &dim_last_entry_t); + rc = rrdeng_metric_latest_time_by_uuid(&legacy_uuid, &dim_first_entry_t, &dim_last_entry_t, tier); if (likely(rc)) { rrdeng_convert_legacy_uuid_to_multihost(machine_guid, &legacy_uuid, &multihost_legacy_uuid); - rc = rrdeng_metric_latest_time_by_uuid(&multihost_legacy_uuid, &dim_first_entry_t, &dim_last_entry_t); + rc = rrdeng_metric_latest_time_by_uuid(&multihost_legacy_uuid, &dim_first_entry_t, &dim_last_entry_t, tier); if (likely(!rc)) uuid_copy(*rrdeng_uuid, multihost_legacy_uuid); } @@ -1487,27 +1737,39 @@ int find_dimension_first_last_t(char *machine_guid, char *chart_id, char *dim_id return 1; #endif } - +#include "../storage_engine.h" #ifdef ENABLE_DBENGINE static RRDDIM *create_rrdim_entry(ONEWAYALLOC *owa, RRDSET *st, char *id, char *name, uuid_t *metric_uuid) { + STORAGE_ENGINE *eng = storage_engine_get(RRD_MEMORY_MODE_DBENGINE); + + if (unlikely(!eng)) + return NULL; + RRDDIM *rd = onewayalloc_callocz(owa, 1, sizeof(*rd)); rd->rrdset = st; + rd->update_every = st->update_every; rd->last_stored_value = NAN; rrddim_flag_set(rd, RRDDIM_FLAG_NONE); - rd->state = onewayalloc_mallocz(owa, sizeof(*rd->state)); - rd->rrd_memory_mode = RRD_MEMORY_MODE_DBENGINE; - rd->state->query_ops.init = rrdeng_load_metric_init; - rd->state->query_ops.next_metric = rrdeng_load_metric_next; - rd->state->query_ops.is_finished = rrdeng_load_metric_is_finished; - rd->state->query_ops.finalize = rrdeng_load_metric_finalize; - rd->state->query_ops.latest_time = rrdeng_metric_latest_time; - rd->state->query_ops.oldest_time = rrdeng_metric_oldest_time; - rd->state->rrdeng_uuid = onewayalloc_mallocz(owa, sizeof(uuid_t)); - uuid_copy(*rd->state->rrdeng_uuid, *metric_uuid); - uuid_copy(rd->state->metric_uuid, *metric_uuid); + + uuid_copy(rd->metric_uuid, *metric_uuid); rd->id = onewayalloc_strdupz(owa, id); rd->name = onewayalloc_strdupz(owa, name); + + for(int tier = 0; tier < storage_tiers ;tier++) { + rd->tiers[tier] = onewayalloc_callocz(owa, 1, sizeof(*rd->tiers[tier])); + rd->rrd_memory_mode = RRD_MEMORY_MODE_DBENGINE; + rd->tiers[tier]->tier_grouping = get_tier_grouping(tier); + rd->tiers[tier]->mode = RRD_MEMORY_MODE_DBENGINE; + rd->tiers[tier]->query_ops.init = rrdeng_load_metric_init; + rd->tiers[tier]->query_ops.next_metric = rrdeng_load_metric_next; + rd->tiers[tier]->query_ops.is_finished = rrdeng_load_metric_is_finished; + rd->tiers[tier]->query_ops.finalize = rrdeng_load_metric_finalize; + rd->tiers[tier]->query_ops.latest_time = rrdeng_metric_latest_time; + rd->tiers[tier]->query_ops.oldest_time = rrdeng_metric_oldest_time; + rd->tiers[tier]->db_metric_handle = eng->api.init(rd, st->rrdhost->storage_instance[tier]); + } + return rd; } #endif @@ -1606,13 +1868,15 @@ void sql_build_context_param_list(ONEWAYALLOC *owa, struct context_param **para if (unlikely(find_dimension_first_last_t(machine_guid, (char *)st->name, (char *)sqlite3_column_text(res, 1), (uuid_t *)sqlite3_column_blob(res, 0), &(*param_list)->first_entry_t, &(*param_list)->last_entry_t, - &rrdeng_uuid))) + &rrdeng_uuid, 0))) continue; st->counter++; st->last_entry_t = MAX(st->last_entry_t, (*param_list)->last_entry_t); RRDDIM *rd = create_rrdim_entry(owa, st, (char *)sqlite3_column_text(res, 1), (char *)sqlite3_column_text(res, 2), &rrdeng_uuid); + if (unlikely(!rd)) + continue; if (sqlite3_column_int(res, 9) == 1) rrddim_flag_set(rd, RRDDIM_FLAG_HIDDEN); rd->next = (*param_list)->rd; @@ -1649,7 +1913,7 @@ failed: #define SQL_STORE_CHART_HASH "insert into v_chart_hash (hash_id, type, id, " \ "name, family, context, title, unit, plugin, module, priority, chart_type, last_used, chart_id) " \ - "values (?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11, ?12, strftime('%s'), ?13);" + "values (?1,?2,?3,?4,?5,?6,?7,?8,?9,?10,?11, ?12, unixepoch(), ?13);" int sql_store_chart_hash( uuid_t *hash_id, uuid_t *chart_id, const char *type, const char *id, const char *name, const char *family, @@ -1773,6 +2037,11 @@ void compute_chart_hash(RRDSET *st) unsigned int hash_len; char priority_str[32]; + if (rrdhost_flag_check(st->rrdhost, RRDHOST_FLAG_ACLK_STREAM_CONTEXTS)) { + internal_error(true, "Skipping compute_chart_hash for host %s because context streaming is enabled", st->rrdhost->hostname); + return; + } + sprintf(priority_str, "%ld", st->priority); evpctx = EVP_MD_CTX_create(); @@ -1820,7 +2089,7 @@ void compute_chart_hash(RRDSET *st) } #define SQL_STORE_CLAIM_ID "insert into node_instance " \ - "(host_id, claim_id, date_created) values (@host_id, @claim_id, strftime('%s')) " \ + "(host_id, claim_id, date_created) values (@host_id, @claim_id, unixepoch()) " \ "on conflict(host_id) do update set claim_id = excluded.claim_id;" void store_claim_id(uuid_t *host_id, uuid_t *claim_id) @@ -1951,12 +2220,6 @@ char *get_hostname_by_node_id(char *node) char *hostname = NULL; int rc; - rrd_rdlock(); - RRDHOST *host = find_host_by_node_id(node); - rrd_unlock(); - if (host) - return strdupz(host->hostname); - if (unlikely(!db_meta)) { if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) error_report("Database has not been initialized"); @@ -2212,3 +2475,232 @@ failed: return; }; + + +#define SELECT_HOST_INFO "SELECT system_key, system_value FROM host_info WHERE host_id = @host_id;" + +void sql_build_host_system_info(uuid_t *host_id, struct rrdhost_system_info *system_info) +{ + int rc; + + sqlite3_stmt *res = NULL; + + rc = sqlite3_prepare_v2(db_meta, SELECT_HOST_INFO, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to read host information"); + return; + } + + rc = sqlite3_bind_blob(res, 1, host_id, sizeof(*host_id), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host parameter host information"); + goto skip_loading; + } + + while (sqlite3_step(res) == SQLITE_ROW) { + rrdhost_set_system_info_variable(system_info, (char *) sqlite3_column_text(res, 0), + (char *) sqlite3_column_text(res, 1)); + } + +skip_loading: + if (unlikely(sqlite3_finalize(res) != SQLITE_OK)) + error_report("Failed to finalize the prepared statement when reading host information"); + return; +} + + +#define SQL_INS_HOST_SYSTEM_INFO "INSERT OR REPLACE INTO host_info " \ + "(host_id, system_key, system_value, date_created) " \ + "VALUES (@host, @key, @value, unixepoch());" + +void sql_store_host_system_info_key_value(uuid_t *host_id, const char *name, const char *value) +{ + sqlite3_stmt *res = NULL; + int rc; + + if (unlikely(!db_meta)) { + if (default_rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) + error_report("Database has not been initialized"); + return; + } + + rc = sqlite3_prepare_v2(db_meta, SQL_INS_HOST_SYSTEM_INFO, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to store system info"); + return; + } + + rc = sqlite3_bind_blob(res, 1, host_id, sizeof(*host_id), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host parameter to store system information"); + goto skip_store; + } + + rc = sqlite3_bind_text(res, 2, name, -1, SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind label parameter to store name information"); + goto skip_store; + } + + rc = sqlite3_bind_text(res, 3, value, -1, SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind value parameter to store value information"); + goto skip_store; + } + + rc = execute_insert(res); + if (unlikely(rc != SQLITE_DONE)) + error_report("Failed to store host system info, rc = %d", rc); + +skip_store: + if (unlikely(sqlite3_finalize(res) != SQLITE_OK)) + error_report("Failed to finalize the prepared statement when storing host system information"); + + return; +} + + +void sql_store_host_system_info(uuid_t *host_id, const struct rrdhost_system_info *system_info) +{ + if (unlikely(!system_info)) + return; + + if (system_info->container_os_name) + sql_store_host_system_info_key_value(host_id, "NETDATA_CONTAINER_OS_NAME", system_info->container_os_name); + + if (system_info->container_os_id) + sql_store_host_system_info_key_value(host_id, "NETDATA_CONTAINER_OS_ID", system_info->container_os_id); + + if (system_info->container_os_id_like) + sql_store_host_system_info_key_value(host_id, "NETDATA_CONTAINER_OS_ID_LIKE", system_info->container_os_id_like); + + if (system_info->container_os_version) + sql_store_host_system_info_key_value(host_id, "NETDATA_CONTAINER_OS_VERSION", system_info->container_os_version); + + if (system_info->container_os_version_id) + sql_store_host_system_info_key_value(host_id, "NETDATA_CONTAINER_OS_VERSION_ID", system_info->container_os_version_id); + + if (system_info->host_os_detection) + sql_store_host_system_info_key_value(host_id, "NETDATA_CONTAINER_OS_DETECTION", system_info->host_os_detection); + + if (system_info->host_os_name) + sql_store_host_system_info_key_value(host_id, "NETDATA_HOST_OS_NAME", system_info->host_os_name); + + if (system_info->host_os_id) + sql_store_host_system_info_key_value(host_id, "NETDATA_HOST_OS_ID", system_info->host_os_id); + + if (system_info->host_os_id_like) + sql_store_host_system_info_key_value(host_id, "NETDATA_HOST_OS_ID_LIKE", system_info->host_os_id_like); + + if (system_info->host_os_version) + sql_store_host_system_info_key_value(host_id, "NETDATA_HOST_OS_VERSION", system_info->host_os_version); + + if (system_info->host_os_version_id) + sql_store_host_system_info_key_value(host_id, "NETDATA_HOST_OS_VERSION_ID", system_info->host_os_version_id); + + if (system_info->host_os_detection) + sql_store_host_system_info_key_value(host_id, "NETDATA_HOST_OS_DETECTION", system_info->host_os_detection); + + if (system_info->kernel_name) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_KERNEL_NAME", system_info->kernel_name); + + if (system_info->host_cores) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_CPU_LOGICAL_CPU_COUNT", system_info->host_cores); + + if (system_info->host_cpu_freq) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_CPU_FREQ", system_info->host_cpu_freq); + + if (system_info->host_ram_total) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_TOTAL_RAM", system_info->host_ram_total); + + if (system_info->host_disk_space) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_TOTAL_DISK_SIZE", system_info->host_disk_space); + + if (system_info->kernel_version) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_KERNEL_VERSION", system_info->kernel_version); + + if (system_info->architecture) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_ARCHITECTURE", system_info->architecture); + + if (system_info->virtualization) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_VIRTUALIZATION", system_info->virtualization); + + if (system_info->virt_detection) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_VIRT_DETECTION", system_info->virt_detection); + + if (system_info->container) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_CONTAINER", system_info->container); + + if (system_info->container_detection) + sql_store_host_system_info_key_value(host_id, "NETDATA_SYSTEM_CONTAINER_DETECTION", system_info->container_detection); + + if (system_info->is_k8s_node) + sql_store_host_system_info_key_value(host_id, "NETDATA_HOST_IS_K8S_NODE", system_info->is_k8s_node); + + return; +} + +static int save_host_label_callback(const char *name, const char *value, RRDLABEL_SRC label_source, void *data) +{ + RRDHOST *host = (RRDHOST *)data; + sql_store_host_label(&host->host_uuid, (int)label_source & ~(RRDLABEL_FLAG_INTERNAL), name, value); + return 0; +} + +#define SQL_DELETE_HOST_LABELS "DELETE FROM host_label WHERE host_id = @uuid;" +void sql_store_host_labels(RRDHOST *host) +{ + int rc = exec_statement_with_uuid(SQL_DELETE_HOST_LABELS, &host->host_uuid); + if (rc != SQLITE_OK) + error_report("Failed to remove old host labels for host %s", host->hostname); + + rrdlabels_walkthrough_read(host->host_labels, save_host_label_callback, host); +} + +#define SELECT_HOST_LABELS "SELECT label_key, label_value, source_type FROM host_label WHERE host_id = @host_id " \ + "AND label_key IS NOT NULL AND label_value IS NOT NULL;" + +DICTIONARY *sql_load_host_labels(uuid_t *host_id) +{ + int rc; + + DICTIONARY *labels = NULL; + sqlite3_stmt *res = NULL; + + rc = sqlite3_prepare_v2(db_meta, SELECT_HOST_LABELS, -1, &res, 0); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to prepare statement to read host information"); + return NULL; + } + + rc = sqlite3_bind_blob(res, 1, host_id, sizeof(*host_id), SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind host parameter host information"); + goto skip_loading; + } + + labels = rrdlabels_create(); + + while (sqlite3_step(res) == SQLITE_ROW) { + rrdlabels_add( + labels, + (const char *)sqlite3_column_text(res, 0), + (const char *)sqlite3_column_text(res, 1), + sqlite3_column_int(res, 2)); + } + +skip_loading: + if (unlikely(sqlite3_finalize(res) != SQLITE_OK)) + error_report("Failed to finalize the prepared statement when reading host information"); + return labels; +} + +// Utils +int bind_text_null(sqlite3_stmt *res, int position, const char *text, bool can_be_null) +{ + if (likely(text)) + return sqlite3_bind_text(res, position, text, -1, SQLITE_STATIC); + if (!can_be_null) + return 1; + return sqlite3_bind_null(res, position); +} diff --git a/database/sqlite/sqlite_functions.h b/database/sqlite/sqlite_functions.h index d24484774..e6808aa81 100644 --- a/database/sqlite/sqlite_functions.h +++ b/database/sqlite/sqlite_functions.h @@ -27,7 +27,8 @@ typedef enum db_check_action_type { #define SQL_MAX_RETRY (100) #define SQLITE_INSERT_DELAY (50) // Insert delay in case of lock -#define SQL_STORE_HOST "insert or replace into host (host_id,hostname,registry_hostname,update_every,os,timezone,tags) values (?1,?2,?3,?4,?5,?6,?7);" +#define SQL_STORE_HOST "insert or replace into host (host_id,hostname,registry_hostname,update_every,os,timezone,tags, hops) " \ + "values (?1,?2,?3,?4,?5,?6,?7,?8);" #define SQL_STORE_CHART "insert or replace into chart (chart_id, host_id, type, id, " \ "name, family, context, title, unit, plugin, module, priority, update_every , chart_type , memory_mode , " \ @@ -37,7 +38,7 @@ typedef enum db_check_action_type { "select chart_id from chart where host_id = @host and type=@type and id=@id and (name is null or name=@name);" #define SQL_STORE_ACTIVE_CHART \ - "insert or replace into chart_active (chart_id, date_created) values (@id, strftime('%s'));" + "insert or replace into chart_active (chart_id, date_created) values (@id, unixepoch());" #define SQL_STORE_DIMENSION \ "INSERT OR REPLACE into dimension (dim_id, chart_id, id, name, multiplier, divisor , algorithm) values (?0001,?0002,?0003,?0004,?0005,?0006,?0007);" @@ -46,7 +47,7 @@ typedef enum db_check_action_type { "select dim_id from dimension where chart_id=@chart and id=@id and name=@name and length(dim_id)=16;" #define SQL_STORE_ACTIVE_DIMENSION \ - "insert or replace into dimension_active (dim_id, date_created) values (@id, strftime('%s'));" + "insert or replace into dimension_active (dim_id, date_created) values (@id, unixepoch());" #define CHECK_SQLITE_CONNECTION(db_meta) \ if (unlikely(!db_meta)) { \ @@ -59,8 +60,12 @@ typedef enum db_check_action_type { extern int sql_init_database(db_check_action_type_t rebuild, int memory); extern void sql_close_database(void); +extern int bind_text_null(sqlite3_stmt *res, int position, const char *text, bool can_be_null); +extern int sql_store_host(uuid_t *guid, const char *hostname, const char *registry_hostname, int update_every, const char *os, + const char *timezone, const char *tags, int hops); + +extern int sql_store_host_info(RRDHOST *host); -extern int sql_store_host(uuid_t *guid, const char *hostname, const char *registry_hostname, int update_every, const char *os, const char *timezone, const char *tags); extern int sql_store_chart( uuid_t *chart_uuid, uuid_t *host_uuid, const char *type, const char *id, const char *name, const char *family, const char *context, const char *title, const char *units, const char *plugin, const char *module, long priority, @@ -102,4 +107,10 @@ extern void compute_chart_hash(RRDSET *st); extern int sql_set_dimension_option(uuid_t *dim_uuid, char *option); char *get_hostname_by_node_id(char *node_id); void free_temporary_host(RRDHOST *host); +int init_database_batch(sqlite3 *database, int rebuild, int init_type, const char *batch[]); +void migrate_localhost(uuid_t *host_uuid); +extern void sql_store_host_system_info(uuid_t *host_id, const struct rrdhost_system_info *system_info); +extern void sql_build_host_system_info(uuid_t *host_id, struct rrdhost_system_info *system_info); +void sql_store_host_labels(RRDHOST *host); +DICTIONARY *sql_load_host_labels(uuid_t *host_id); #endif //NETDATA_SQLITE_FUNCTIONS_H diff --git a/database/sqlite/sqlite_health.c b/database/sqlite/sqlite_health.c index 53742a1a6..8e59cad1e 100644 --- a/database/sqlite/sqlite_health.c +++ b/database/sqlite/sqlite_health.c @@ -8,7 +8,7 @@ /* Health related SQL queries Creates a health log table in sqlite, one per host guid */ -#define SQL_CREATE_HEALTH_LOG_TABLE(guid) "CREATE TABLE IF NOT EXISTS health_log_%s(hostname text, unique_id int, alarm_id int, alarm_event_id int, config_hash_id blob, updated_by_id int, updates_id int, when_key int, duration int, non_clear_duration int, flags int, exec_run_timestamp int, delay_up_to_timestamp int, name text, chart text, family text, exec text, recipient text, source text, units text, info text, exec_code int, new_status real, old_status real, delay int, new_value double, old_value double, last_repeat int, class text, component text, type text);", guid +#define SQL_CREATE_HEALTH_LOG_TABLE(guid) "CREATE TABLE IF NOT EXISTS health_log_%s(hostname text, unique_id int, alarm_id int, alarm_event_id int, config_hash_id blob, updated_by_id int, updates_id int, when_key int, duration int, non_clear_duration int, flags int, exec_run_timestamp int, delay_up_to_timestamp int, name text, chart text, family text, exec text, recipient text, source text, units text, info text, exec_code int, new_status real, old_status real, delay int, new_value double, old_value double, last_repeat int, class text, component text, type text, chart_context text);", guid int sql_create_health_log_table(RRDHOST *host) { int rc; char *err_msg = NULL, command[MAX_HEALTH_SQL_SIZE + 1]; @@ -113,7 +113,7 @@ void sql_health_alarm_log_update(RRDHOST *host, ALARM_ENTRY *ae) { "config_hash_id, updated_by_id, updates_id, when_key, duration, non_clear_duration, flags, " \ "exec_run_timestamp, delay_up_to_timestamp, name, chart, family, exec, recipient, source, " \ "units, info, exec_code, new_status, old_status, delay, new_value, old_value, last_repeat, " \ - "class, component, type) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", guid + "class, component, type, chart_context) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);", guid void sql_health_alarm_log_insert(RRDHOST *host, ALARM_ENTRY *ae) { sqlite3_stmt *res = NULL; @@ -323,6 +323,12 @@ void sql_health_alarm_log_insert(RRDHOST *host, ALARM_ENTRY *ae) { goto failed; } + rc = sqlite3_bind_text(res, 32, ae->chart_context, -1, SQLITE_STATIC); + if (unlikely(rc != SQLITE_OK)) { + error_report("Failed to bind chart_context parameter for SQL_INSERT_HEALTH_LOG"); + goto failed; + } + rc = execute_insert(res); if (unlikely(rc != SQLITE_DONE)) { error_report("HEALTH [%s]: Failed to execute SQL_INSERT_HEALTH_LOG, rc = %d", host->hostname, rc); @@ -434,9 +440,9 @@ void sql_health_alarm_log_count(RRDHOST *host) { } #define SQL_INJECT_REMOVED(guid, guid2) "insert into health_log_%s (hostname, unique_id, alarm_id, alarm_event_id, config_hash_id, updated_by_id, updates_id, when_key, duration, non_clear_duration, flags, exec_run_timestamp, " \ -"delay_up_to_timestamp, name, chart, family, exec, recipient, source, units, info, exec_code, new_status, old_status, delay, new_value, old_value, last_repeat, class, component, type) " \ -"select hostname, ?1, ?2, ?3, config_hash_id, 0, ?4, strftime('%%s'), 0, 0, flags, exec_run_timestamp, " \ -"strftime('%%s'), name, chart, family, exec, recipient, source, units, info, exec_code, -2, new_status, delay, NULL, new_value, 0, class, component, type " \ +"delay_up_to_timestamp, name, chart, family, exec, recipient, source, units, info, exec_code, new_status, old_status, delay, new_value, old_value, last_repeat, class, component, type, chart_context) " \ +"select hostname, ?1, ?2, ?3, config_hash_id, 0, ?4, unixepoch(), 0, 0, flags, exec_run_timestamp, " \ +"unixepoch(), name, chart, family, exec, recipient, source, units, info, exec_code, -2, new_status, delay, NULL, new_value, 0, class, component, type, chart_context " \ "from health_log_%s where unique_id = ?5", guid, guid2 #define SQL_INJECT_REMOVED_UPDATE(guid) "update health_log_%s set flags = flags | ?1, updated_by_id = ?2 where unique_id = ?3; ", guid void sql_inject_removed_status(char *uuid_str, uint32_t alarm_id, uint32_t alarm_event_id, uint32_t unique_id, uint32_t max_unique_id) @@ -598,7 +604,7 @@ void sql_check_removed_alerts_state(char *uuid_str) /* Health related SQL queries Load from the health log table */ -#define SQL_LOAD_HEALTH_LOG(guid,limit) "SELECT hostname, unique_id, alarm_id, alarm_event_id, config_hash_id, updated_by_id, updates_id, when_key, duration, non_clear_duration, flags, exec_run_timestamp, delay_up_to_timestamp, name, chart, family, exec, recipient, source, units, info, exec_code, new_status, old_status, delay, new_value, old_value, last_repeat, class, component, type FROM (SELECT hostname, unique_id, alarm_id, alarm_event_id, config_hash_id, updated_by_id, updates_id, when_key, duration, non_clear_duration, flags, exec_run_timestamp, delay_up_to_timestamp, name, chart, family, exec, recipient, source, units, info, exec_code, new_status, old_status, delay, new_value, old_value, last_repeat, class, component, type FROM health_log_%s order by unique_id desc limit %u) order by unique_id asc;", guid, limit +#define SQL_LOAD_HEALTH_LOG(guid,limit) "SELECT hostname, unique_id, alarm_id, alarm_event_id, config_hash_id, updated_by_id, updates_id, when_key, duration, non_clear_duration, flags, exec_run_timestamp, delay_up_to_timestamp, name, chart, family, exec, recipient, source, units, info, exec_code, new_status, old_status, delay, new_value, old_value, last_repeat, class, component, type, chart_context FROM (SELECT hostname, unique_id, alarm_id, alarm_event_id, config_hash_id, updated_by_id, updates_id, when_key, duration, non_clear_duration, flags, exec_run_timestamp, delay_up_to_timestamp, name, chart, family, exec, recipient, source, units, info, exec_code, new_status, old_status, delay, new_value, old_value, last_repeat, class, component, type, chart_context FROM health_log_%s order by unique_id desc limit %u) order by unique_id asc;", guid, limit void sql_health_alarm_log_load(RRDHOST *host) { sqlite3_stmt *res = NULL; int rc; @@ -751,8 +757,8 @@ void sql_health_alarm_log_load(RRDHOST *host) { ae->old_status = (RRDCALC_STATUS)sqlite3_column_int(res, 23); ae->delay = (int) sqlite3_column_int(res, 24); - ae->new_value = (calculated_number) sqlite3_column_double(res, 25); - ae->old_value = (calculated_number) sqlite3_column_double(res, 26); + ae->new_value = (NETDATA_DOUBLE) sqlite3_column_double(res, 25); + ae->old_value = (NETDATA_DOUBLE) sqlite3_column_double(res, 26); ae->last_repeat = last_repeat; @@ -771,6 +777,11 @@ void sql_health_alarm_log_load(RRDHOST *host) { else ae->type = NULL; + if (sqlite3_column_type(res, 31) != SQLITE_NULL) + ae->chart_context = strdupz((char *) sqlite3_column_text(res, 31)); + else + ae->chart_context = NULL; + char value_string[100 + 1]; freez(ae->old_value_string); freez(ae->new_value_string); @@ -814,7 +825,7 @@ void sql_health_alarm_log_load(RRDHOST *host) { "on_key, class, component, type, os, hosts, lookup, every, units, calc, families, plugin, module, " \ "charts, green, red, warn, crit, exec, to_key, info, delay, options, repeat, host_labels, " \ "p_db_lookup_dimensions, p_db_lookup_method, p_db_lookup_options, p_db_lookup_after, " \ - "p_db_lookup_before, p_update_every) values (?1,strftime('%s'),?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12," \ + "p_db_lookup_before, p_update_every) values (?1,unixepoch(),?2,?3,?4,?5,?6,?7,?8,?9,?10,?11,?12," \ "?13,?14,?15,?16,?17,?18,?19,?20,?21,?22,?23,?24,?25,?26,?27,?28,?29,?30,?31,?32,?33,?34);" int sql_store_alert_config_hash(uuid_t *hash_id, struct alert_config *cfg) diff --git a/database/storage_engine.c b/database/storage_engine.c index 36f01de16..76597acd5 100644 --- a/database/storage_engine.c +++ b/database/storage_engine.c @@ -9,6 +9,7 @@ #define im_collect_ops { \ .init = rrddim_collect_init,\ .store_metric = rrddim_collect_store_metric,\ + .flush = rrddim_store_metric_flush,\ .finalize = rrddim_collect_finalize\ } @@ -26,6 +27,8 @@ static STORAGE_ENGINE engines[] = { .id = RRD_MEMORY_MODE_NONE, .name = RRD_MEMORY_MODE_NONE_NAME, .api = { + .init = rrddim_metric_init, + .free = rrddim_metric_free, .collect_ops = im_collect_ops, .query_ops = im_query_ops } @@ -34,6 +37,8 @@ static STORAGE_ENGINE engines[] = { .id = RRD_MEMORY_MODE_RAM, .name = RRD_MEMORY_MODE_RAM_NAME, .api = { + .init = rrddim_metric_init, + .free = rrddim_metric_free, .collect_ops = im_collect_ops, .query_ops = im_query_ops } @@ -42,6 +47,8 @@ static STORAGE_ENGINE engines[] = { .id = RRD_MEMORY_MODE_MAP, .name = RRD_MEMORY_MODE_MAP_NAME, .api = { + .init = rrddim_metric_init, + .free = rrddim_metric_free, .collect_ops = im_collect_ops, .query_ops = im_query_ops } @@ -50,6 +57,8 @@ static STORAGE_ENGINE engines[] = { .id = RRD_MEMORY_MODE_SAVE, .name = RRD_MEMORY_MODE_SAVE_NAME, .api = { + .init = rrddim_metric_init, + .free = rrddim_metric_free, .collect_ops = im_collect_ops, .query_ops = im_query_ops } @@ -58,6 +67,8 @@ static STORAGE_ENGINE engines[] = { .id = RRD_MEMORY_MODE_ALLOC, .name = RRD_MEMORY_MODE_ALLOC_NAME, .api = { + .init = rrddim_metric_init, + .free = rrddim_metric_free, .collect_ops = im_collect_ops, .query_ops = im_query_ops } @@ -67,9 +78,12 @@ static STORAGE_ENGINE engines[] = { .id = RRD_MEMORY_MODE_DBENGINE, .name = RRD_MEMORY_MODE_DBENGINE_NAME, .api = { + .init = rrdeng_metric_init, + .free = rrdeng_metric_free, .collect_ops = { .init = rrdeng_store_metric_init, .store_metric = rrdeng_store_metric_next, + .flush = rrdeng_store_metric_flush_current_page, .finalize = rrdeng_store_metric_finalize }, .query_ops = { diff --git a/database/storage_engine.h b/database/storage_engine.h index 0aa70d093..3ed515e0a 100644 --- a/database/storage_engine.h +++ b/database/storage_engine.h @@ -10,6 +10,8 @@ typedef struct storage_engine STORAGE_ENGINE; // ------------------------------------------------------------------------ // function pointers for all APIs provided by a storge engine typedef struct storage_engine_api { + STORAGE_METRIC_HANDLE *(*init)(RRDDIM *rd, STORAGE_INSTANCE *instance); + void (*free)(STORAGE_METRIC_HANDLE *); struct rrddim_collect_ops collect_ops; struct rrddim_query_ops query_ops; } STORAGE_ENGINE_API; diff --git a/docs/Demo-Sites.md b/docs/Demo-Sites.md index e6e8eb3dc..80c98df3d 100644 --- a/docs/Demo-Sites.md +++ b/docs/Demo-Sites.md @@ -12,7 +12,6 @@ You can also view live demos of Netdata at **[https://www.netdata.cloud](https:/ | :------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| :------------------------------------------------- | | London (UK) | **[london3.my-netdata.io](https://london3.my-netdata.io)**
(this is the global Netdata **registry** and has **named** and **mysql** charts) | [![Requests Per Second](https://london3.my-netdata.io/api/v1/badge.svg?chart=netdata.requests&dimensions=requests&after=-3600&options=unaligned&group=sum&label=reqs&units=empty&value_color=blue&precision=0&v42)](https://london3.my-netdata.io) | [DigitalOcean.com](https://m.do.co/c/83dc9f941745) | | Atlanta (USA) | **[cdn77.my-netdata.io](https://cdn77.my-netdata.io)**
(with **named** and **mysql** charts) | [![Requests Per Second](https://cdn77.my-netdata.io/api/v1/badge.svg?chart=netdata.requests&dimensions=requests&after=-3600&options=unaligned&group=sum&label=reqs&units=empty&value_color=blue&precision=0&v42)](https://cdn77.my-netdata.io) | [CDN77.com](https://www.cdn77.com/) | -| Israel | **[octopuscs.my-netdata.io](https://octopuscs.my-netdata.io)** | [![Requests Per Second](https://octopuscs.my-netdata.io/api/v1/badge.svg?chart=netdata.requests&dimensions=requests&after=-3600&options=unaligned&group=sum&label=reqs&units=empty&value_color=blue&precision=0&v42)](https://octopuscs.my-netdata.io) | [OctopusCS.com](https://www.octopuscs.com) | | Bangalore (India) | **[bangalore.my-netdata.io](https://bangalore.my-netdata.io)** | [![Requests Per Second](https://bangalore.my-netdata.io/api/v1/badge.svg?chart=netdata.requests&dimensions=requests&after=-3600&options=unaligned&group=sum&label=reqs&units=empty&value_color=blue&precision=0&v42)](https://bangalore.my-netdata.io) | [DigitalOcean.com](https://m.do.co/c/83dc9f941745) | | Frankfurt (Germany) | **[frankfurt.my-netdata.io](https://frankfurt.my-netdata.io)** | [![Requests Per Second](https://frankfurt.my-netdata.io/api/v1/badge.svg?chart=netdata.requests&dimensions=requests&after=-3600&options=unaligned&group=sum&label=reqs&units=empty&value_color=blue&precision=0&v42)](https://frankfurt.my-netdata.io) | [DigitalOcean.com](https://m.do.co/c/83dc9f941745) | | New York (USA) | **[newyork.my-netdata.io](https://newyork.my-netdata.io)** | [![Requests Per Second](https://newyork.my-netdata.io/api/v1/badge.svg?chart=netdata.requests&dimensions=requests&after=-3600&options=unaligned&group=sum&label=reqs&units=empty&value_color=blue&precision=0&v42)](https://newyork.my-netdata.io) | [DigitalOcean.com](https://m.do.co/c/83dc9f941745) | diff --git a/docs/Running-behind-h2o.md b/docs/Running-behind-h2o.md new file mode 100644 index 000000000..c49e4e16f --- /dev/null +++ b/docs/Running-behind-h2o.md @@ -0,0 +1,183 @@ + + +# Running Netdata behind H2O + +[H2O](https://h2o.examp1e.net/) is a new generation HTTP server that provides quicker response to users with less CPU utilization when compared to older generation of web servers. + +It is notable for having much simpler configuration than many popular HTTP servers, low resource requirements, and integrated native support for many things that other HTTP servers may need special setup to use. + +## Why H2O + +- Sane configuration defaults mean that typical configurations are very minimalistic and easy to work with. + +- Native support for HTTP/2 provides improved performance when accessing the Netdata dashboard remotely. + +- Password protect access to the Netdata dashboard without requiring Netdata Cloud. + +## H2O configuration file. + +On most systems, the H2O configuration is found under `/etc/h2o`. H2O uses [YAML 1.1](https://yaml.org/spec/1.1/), with a few special extensions, for it’s configuration files, with the main configuration file being `/etc/h2o/h2o.conf`. + +You can edit the H2O configuration file with Nano, Vim or any other text editors with which you are comfortable. + +After making changes to the configuration files, perform the following: + +- Test the configuration with `h2o -m test -c /etc/h2o/h2o.conf` + +- Restart H2O to apply tha changes with `/etc/init.d/h2o restart` or `service h2o restart` + +## Ways to access Netdata via H2O + +### As a virtual host + +With this method instead of `SERVER_IP_ADDRESS:19999`, the Netdata dashboard can be accessed via a human-readable URL such as `netdata.example.com` used in the configuration below. + +```yaml +hosts: + netdata.example.com: + listen: + port: 80 + paths: + /: + proxy.preserve-host: ON + proxy.reverse.url: http://127.0.0.1:19999 +``` + +### As a subfolder of an existing virtual host + +This method is recommended when Netdata is to be served from a subfolder (or directory). +In this case, the virtual host `netdata.example.com` already exists and Netdata has to be accessed via `netdata.example.com/netdata/`. + +```yaml +hosts: + netdata.example.com: + listen: + port: 80 + paths: + /netdata: + redirect: + status: 301 + url: /netdata/ + /netdata/: + proxy.preserve-host: ON + proxy.reverse.url: http://127.0.0.1:19999 +``` + +### As a subfolder for multiple Netdata servers, via one H2O instance + +This is the recommended configuration when one H2O instance will be used to manage multiple Netdata servers via subfolders. + +```yaml +hosts: + netdata.example.com: + listen: + port: 80 + paths: + /netdata/server1: + redirect: + status: 301 + url: /netdata/server1/ + /netdata/server1/: + proxy.preserve-host: ON + proxy.reverse.url: http://198.51.100.1:19999 + /netdata/server2: + redirect: + status: 301 + url: /netdata/server2/ + /netdata/server2/: + proxy.preserve-host: ON + proxy.reverse.url: http://198.51.100.2:19999 +``` + +Of course you can add as many backend servers as you like. + +Using the above, you access Netdata on the backend servers, like this: + +- `http://netdata.example.com/netdata/server1/` to reach Netdata on `198.51.100.1:19999` +- `http://netdata.example.com/netdata/server2/` to reach Netdata on `198.51.100.2:19999` + +### Encrypt the communication between H2O and Netdata + +In case Netdata's web server has been [configured to use TLS](/web/server/README.md#enabling-tls-support), it is +necessary to specify inside the H2O configuration that the final destination is using TLS. To do this, change the +`http://` on the `proxy.reverse.url` line in your H2O configuration with `https://` + +### Enable authentication + +Create an authentication file to enable basic authentication via H2O, this secures your Netdata dashboard. + +If you don't have an authentication file, you can use the following command: + +```sh +printf "yourusername:$(openssl passwd -apr1)" > /etc/h2o/passwords +``` + +And then add a basic authentication handler to each path definition: + +```yaml +hosts: + netdata.example.com: + listen: + port: 80 + paths: + /: + mruby.handler: | + require "htpasswd.rb" + Htpasswd.new("/etc/h2o/passwords", "netdata.example.com") + proxy.preserve-host: ON + proxy.reverse.url: http://127.0.0.1:19999 +``` + +For more information on using basic authentication with H2O, see [their official documentation](https://h2o.examp1e.net/configure/basic_auth.html). + +## Limit direct access to Netdata + +If your H2O server is on `localhost`, you can use this to ensure external access is only possible through H2O: + +``` +[web] + bind to = 127.0.0.1 ::1 +``` + +--- + +You can also use a unix domain socket. This will provide faster communication between H2O and Netdata as well: + +``` +[web] + bind to = unix:/run/netdata/netdata.sock +``` + +In the H2O configuration, use a line like the following to connect to Netdata via the unix socket: + +```yaml +proxy.reverse.url http://[unix:/run/netdata/netdata.sock] +``` + +--- + +If your H2O server is not on localhost, you can set: + +``` +[web] + bind to = * + allow connections from = IP_OF_H2O_SERVER +``` + +*note: Netdata v1.9+ support `allow connections from`* + +`allow connections from` accepts [Netdata simple patterns](/libnetdata/simple_pattern/README.md) to match against +the connection IP address. + +## Prevent the double access.log + +H2O logs accesses and Netdata logs them too. You can prevent Netdata from generating its access log, by setting +this in `/etc/netdata/netdata.conf`: + +``` +[global] + access log = none +``` diff --git a/docs/anonymous-statistics.md b/docs/anonymous-statistics.md index 73ac8e978..99bd3dc7f 100644 --- a/docs/anonymous-statistics.md +++ b/docs/anonymous-statistics.md @@ -1,8 +1,6 @@ # Anonymous statistics @@ -10,7 +8,7 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/docs/anonymous-s By default, Netdata collects anonymous usage information from the open-source monitoring agent using the open-source product analytics platform [PostHog](https://github.com/PostHog/posthog). We use their [cloud enterprise platform](https://posthog.com/product). -We are strongly committed to your [data privacy](https://netdata.cloud/data-privacy/). +We are strongly committed to your [data privacy](https://netdata.cloud/privacy/). We use the statistics gathered from this information for two purposes: diff --git a/docs/collect/application-metrics.md b/docs/collect/application-metrics.md index ffd6b0ac0..c9bc4e2c8 100644 --- a/docs/collect/application-metrics.md +++ b/docs/collect/application-metrics.md @@ -21,25 +21,26 @@ charts under **Users**, and per-user group charts under **User Groups**. Our most popular application collectors: -- [Prometheus endpoints](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/prometheus): Gathers - metrics from one or more Prometheus endpoints that use the OpenMetrics exposition format. Autodetects more than 600 - endpoints. -- [Web server logs (Apache, NGINX)](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/weblog/): - Tail access logs and provide very detailed web server performance statistics. This module is able to parse 200k+ - rows in less than half a second. -- [MySQL](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/mysql/): Collect database global, - replication, and per-user statistics. -- [Redis](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/redis): Monitor database status by reading the server's response to the `INFO` - command. -- [Apache](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/apache/): Collect Apache web - server performance metrics via the `server-status?auto` endpoint. -- [Nginx](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/nginx/): Monitor web server - status information by gathering metrics via `ngx_http_stub_status_module`. -- [Postgres](/collectors/python.d.plugin/postgres/README.md): Collect database health and performance metrics. -- [ElasticSearch](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/elasticsearch): Collect search engine performance and health - statistics. Optionally collects per-index metrics. -- [PHP-FPM](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/phpfpm/): Collect application - summary and processes health metrics by scraping the status page (`/status?full`). +- [Prometheus endpoints](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/prometheus): Gathers + metrics from one or more Prometheus endpoints that use the OpenMetrics exposition format. Auto-detects more than 600 + endpoints. +- [Web server logs (Apache, NGINX)](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/weblog/): + Tail access logs and provide very detailed web server performance statistics. This module is able to parse 200k+ + rows in less than half a second. +- [MySQL](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/mysql/): Collect database global, + replication, and per-user statistics. +- [Redis](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/redis): Monitor database status by + reading the server's response to the `INFO` command. +- [Apache](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/apache/): Collect Apache web server + performance metrics via the `server-status?auto` endpoint. +- [Nginx](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/nginx/): Monitor web server status + information by gathering metrics via `ngx_http_stub_status_module`. +- [Postgres](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/postgres): Collect database health + and performance metrics. +- [ElasticSearch](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/elasticsearch): Collect search + engine performance and health statistics. Optionally collects per-index metrics. +- [PHP-FPM](https://learn.netdata.cloud/docs/agent/collectors/go.d.plugin/modules/phpfpm/): Collect application summary + and processes health metrics by scraping the status page (`/status?full`). Our [supported collectors list](/collectors/COLLECTORS.md#service-and-application-collectors) shows all Netdata's application metrics collectors, including those for containers/k8s clusters. diff --git a/docs/configure/nodes.md b/docs/configure/nodes.md index 02cf6f052..841419a72 100644 --- a/docs/configure/nodes.md +++ b/docs/configure/nodes.md @@ -61,6 +61,10 @@ The Netdata config directory also contains one symlink: versions are copied into the config directory when opened with `edit-config`. _Do not edit the files in `/usr/lib/netdata/conf.d`, as they are overwritten by updates to the Netdata Agent._ +## Configure a Netdata docker container + +See [configure agent containers](/packaging/docker/README.md#configure-agent-containers). + ## Use `edit-config` to edit configuration files The **recommended way to easily and safely edit Netdata's configuration** is with the `edit-config` script. This script diff --git a/docs/guides/deploy/ansible.md b/docs/guides/deploy/ansible.md index 7e5532b62..35c946021 100644 --- a/docs/guides/deploy/ansible.md +++ b/docs/guides/deploy/ansible.md @@ -56,6 +56,8 @@ mv community/netdata-agent-deployment/ansible-quickstart . rm -rf community ``` +Or if you don't want to clone the entire repository, use the [gitzip browser extension](https://gitzip.org/) to get the netdata-agent-deployment directory as a zip file. + Next, `cd` into the Ansible directory. ```bash diff --git a/docs/guides/longer-metrics-storage.md b/docs/guides/longer-metrics-storage.md index 85edb55ee..8ccd9585f 100644 --- a/docs/guides/longer-metrics-storage.md +++ b/docs/guides/longer-metrics-storage.md @@ -1,160 +1,158 @@ -# Change how long Netdata stores metrics +# Netdata Longer Metrics Retention -Netdata helps you collect thousands of system and application metrics every second, but what about storing them for the -long term? +Metrics retention affects 3 parameters on the operation of a Netdata Agent: -Many people think Netdata can only store about an hour's worth of real-time metrics, but that's simply not true any -more. With the right settings, Netdata is quite capable of efficiently storing hours or days worth of historical, -per-second metrics without having to rely on an [exporting engine](/docs/export/external-databases.md). +1. The disk space required to store the metrics. +2. The memory the Netdata Agent will require to have that retention available for queries. +3. The CPU resources that will be required to query longer time-frames. -This guide gives two options for configuring Netdata to store more metrics. **We recommend the default [database -engine](#using-the-database-engine)**, but you can stick with or switch to the round-robin database if you prefer. +As retention increases, the resources required to support that retention increase too. -Let's get started. +Since Netdata Agents usually run at the edge, inside production systems, Netdata Agent **parents** should be considered. When having a **parent - child** setup, the child (the Netdata Agent running on a production system) delegates all its functions, including longer metrics retention and querying, to the parent node that can dedicate more resources to this task. A single Netdata Agent parent can centralize multiple children Netdata Agents (dozens, hundreds, or even thousands depending on its available resources). -## Using the database engine -The database engine uses RAM to store recent metrics while also using a "spill to disk" feature that takes advantage of -available disk space for long-term metrics storage. This feature of the database engine allows you to store a much -larger dataset than your system's available RAM. +## Ephemerality of metrics -The database engine is currently the default method of storing metrics, but if you're not sure which database you're -using, check out your `netdata.conf` file and look for the `memory mode` setting: +The ephemerality of metrics plays an important role in retention. In environments where metrics stop being collected and new metrics are constantly being generated, we are interested about 2 parameters: -```conf -[global] - memory mode = dbengine -``` - -If `memory mode` is set to anything but `dbengine`, change it and restart Netdata using the standard command for -restarting services on your system. You're now using the database engine! +1. The **expected concurrent number of metrics** as an average for the lifetime of the database. + This affects mainly the storage requirements. -What makes the database engine efficient? While it's structured like a traditional database, the database engine splits -data between RAM and disk. The database engine caches and indexes data on RAM to keep memory usage low, and then -compresses older metrics onto disk for long-term storage. +2. The **expected total number of unique metrics** for the lifetime of the database. + This affects mainly the memory requirements for having all these metrics indexed and available to be queried. -When the Netdata dashboard queries for historical metrics, the database engine will use its cache, stored in RAM, to -return relevant metrics for visualization in charts. +## Granularity of metrics -Now, given that the database engine uses _both_ RAM and disk, there are two other settings to consider: `page cache -size` and `dbengine multihost disk space`. +The granularity of metrics (the frequency they are collected and stored, i.e. their resolution) is significantly affecting retention. -```conf -[global] - page cache size = 32 - dbengine multihost disk space = 256 -``` +Lowering the granularity from per second to every two seconds, will double their retention and half the CPU requirements of the Netdata Agent, without affecting disk space or memory requirements. -`page cache size` sets the maximum amount of RAM (in MiB) the database engine will use for caching and indexing. -`dbengine multihost disk space` sets the maximum disk space (again, in MiB) the database engine will use for storing -compressed metrics. The default settings retain about two day's worth of metrics on a system collecting 2,000 metrics -every second. +## Which database mode to use -[**See our database engine -calculator**](/docs/store/change-metrics-storage.md#calculate-the-system-resources-ram-disk-space-needed-to-store-metrics) -to help you correctly set `dbengine multihost disk space` based on your needs. The calculator gives an accurate estimate -based on how many child nodes you have, how many metrics your Agent collects, and more. +Netdata Agents support multiple database modes. -With the database engine active, you can back up your `/var/cache/netdata/dbengine/` folder to another location for -redundancy. +The default mode `[db].mode = dbengine` has been designed to scale for longer retentions. -Now that you know how to switch to the database engine, let's cover the default round-robin database for those who -aren't ready to make the move. +The other available database modes are designed to minimize resource utilization and should usually be considered on **parent - child** setups at the children side. -## Using the round-robin database +So, -In previous versions, Netdata used a round-robin database to store 1 hour of per-second metrics. +* On a single node setup, use `[db].mode = dbengine` to increase retention. +* On a **parent - child** setup, use `[db].mode = dbengine` on the parent to increase retention and a more resource efficient mode (like `save`, `ram` or `none`) for the child to minimize resources utilization. -To see if you're still using this database, or if you would like to switch to it, open your `netdata.conf` file and see -if `memory mode` option is set to `save`. +To use `dbengine`, set this in `netdata.conf` (it is the default): -```conf -[global] - memory mode = save ``` +[db] + mode = dbengine +``` + +## Tiering -If `memory mode` is set to `save`, then you're using the round-robin database. If so, the `history` option is set to -`3600`, which is the equivalent to 3,600 seconds, or one hour. +`dbengine` supports tiering. Tiering allows having up to 3 versions of the data: -To increase your historical metrics, you can increase `history` to the number of seconds you'd like to store: +1. Tier 0 is the high resolution data. +2. Tier 1 is the first tier that samples data every 60 data collections of Tier 0. +3. Tier 2 is the second tier that samples data every 3600 data collections of Tier 0 (60 of Tier 1). -```conf -[global] - # 2 hours = 2 * 60 * 60 = 7200 seconds - history = 7200 - # 4 hours = 4 * 60 * 60 = 14440 seconds - history = 14440 - # 24 hours = 24 * 60 * 60 = 86400 seconds - history = 86400 +To enable tiering set `[db].storage tiers` in `netdata.conf` (the default is 1, to enable only Tier 0): + +``` +[db] + mode = dbengine + storage tiers = 3 ``` -And so on. +## Disk space requirements -Next, check to see how many metrics Netdata collects on your system, and how much RAM that uses. Visit the Netdata -dashboard and look at the bottom-right corner of the interface. You'll find a sentence similar to the following: +Netdata Agents require about 1 bytes on disk per database point on Tier 0 and 4 times more on higher tiers (Tier 1 and 2). They require 4 times more storage per point compared to Tier 0, because for every point higher tiers store `min`, `max`, `sum`, `count` and `anomaly rate` (the values are 5, but they require 4 times the storage because `count` and `anomaly rate` are 16-bit integers). The `average` is calculated on the fly at query time using `sum / count`. -> Every second, Netdata collects 1,938 metrics, presents them in 299 charts and monitors them with 81 alarms. Netdata is -> using 25 MB of memory on **netdata-linux** for 1 hour, 6 minutes and 36 seconds of real-time history. +### Tier 0 - per second for a week -On this desktop system, using a Ryzen 5 1600 and 16GB of RAM, the round-robin databases uses 25 MB of RAM to store just -over an hour's worth of data for nearly 2,000 metrics. +For 2000 metrics, collected every second and retained for a week, Tier 0 needs: 1 byte x 2000 metrics x 3600 secs per hour x 24 hours per day x 7 days per week = 1100MB. -To increase the `history` option, you need to edit your `netdata.conf` file and increase the `history` setting. In most -installations, you'll find it at `/etc/netdata/netdata.conf`, but some operating systems place it at -`/opt/netdata/etc/netdata/netdata.conf`. +The setting to control this is in `netdata.conf`: -Use `/etc/netdata/edit-config netdata.conf`, or your favorite text editor, to replace `3600` with the number of seconds -you'd like to store. +``` +[db] + mode = dbengine + + # per second data collection + update every = 1 + + # enable only Tier 0 + storage tiers = 1 + + # Tier 0, per second data for a week + dbengine multihost disk space MB = 1100 +``` -You should base this number on two things: How much history you need for your use case, and how much RAM you're willing -to dedicate to Netdata. +By setting it to `1100` and restarting the Netdata Agent, this node will start maintaining about a week of data. But pay attention to the number of metrics. If you have more than 2000 metrics on a node, or you need more that a week of high resolution metrics, you may need to adjust this setting accordingly. -> Take care when you change the `history` option on production systems. Netdata is configured to stop its process if -> your system starts running out of RAM, but you can never be too careful. Out of memory situations are very bad. +### Tier 1 - per minute for a month -How much RAM will a longer history use? Let's use a little math. +Tier 1 is by default sampling the data every 60 points of Tier 0. If Tier 0 is per second, then Tier 1 is per minute. -The round-robin database needs 4 bytes for every value Netdata collects. If Netdata collects metrics every second, -that's 4 bytes, per second, per metric. +Tier 1 needs 4 times more storage per point compared to Tier 0. So, for 2000 metrics, with per minute resolution, retained for a month, Tier 1 needs: 4 bytes x 2000 metrics x 60 minutes per hour x 24 hours per day x 30 days per month = 330MB. -```text -4 bytes * X seconds * Y metrics = RAM usage in bytes +Do this in `netdata.conf`: + +``` +[db] + mode = dbengine + + # per second data collection + update every = 1 + + # enable only Tier 0 and Tier 1 + storage tiers = 2 + + # Tier 0, per second data for a week + dbengine multihost disk space MB = 1100 + + # Tier 1, per minute data for a month + dbengine tier 1 multihost disk space MB = 330 ``` -Let's assume your system collects 1,000 metrics per second. +Once `netdata.conf` is edited, the Netdata Agent needs to be restarted for the changes to take effect. -```text -4 bytes * 3600 seconds * 1,000 metrics = 14400000 bytes = 14.4 MB RAM -``` +### Tier 2 - per hour for a year -With that formula, you can calculate the RAM usage for much larger history settings. - -```conf -# 2 hours at 1,000 metrics per second -4 bytes * 7200 seconds * 1,000 metrics = 28800000 bytes = 28.8 MB RAM -# 2 hours at 2,000 metrics per second -4 bytes * 7200 seconds * 2,000 metrics = 57600000 bytes = 57.6 MB RAM -# 4 hours at 2,000 metrics per second -4 bytes * 14440 seconds * 2,000 metrics = 115520000 bytes = 115.52 MB RAM -# 24 hours at 1,000 metrics per second -4 bytes * 86400 seconds * 1,000 metrics = 345600000 bytes = 345.6 MB RAM -``` +Tier 2 is by default sampling data every 3600 points of Tier 0 (60 of Tier 1). If Tier 0 is per second, then Tier 2 is per hour. -## What's next? +The storage requirements are the same to Tier 1. -Now that you have either configured database engine or round-robin database engine to store more metrics, you'll -probably want to see it in action! +For 2000 metrics, with per hour resolution, retained for a year, Tier 2 needs: 4 bytes x 2000 metrics x 24 hours per day x 365 days per year = 67MB. + +Do this in `netdata.conf`: + +``` +[db] + mode = dbengine + + # per second data collection + update every = 1 + + # enable only Tier 0 and Tier 1 + storage tiers = 3 + + # Tier 0, per second data for a week + dbengine multihost disk space MB = 1100 + + # Tier 1, per minute data for a month + dbengine tier 1 multihost disk space MB = 330 + + # Tier 2, per hour data for a year + dbengine tier 2 multihost disk space MB = 67 +``` -For more information about how to pan charts to view historical metrics, see our documentation on [using -charts](/web/README.md#using-charts). +Once `netdata.conf` is edited, the Netdata Agent needs to be restarted for the changes to take effect. -And if you'd now like to reduce Netdata's resource usage, view our [performance -guide](/docs/guides/configure/performance.md) for our best practices on optimization. diff --git a/docs/guides/monitor/anomaly-detection.md b/docs/guides/monitor/anomaly-detection.md index 7b4388a05..e98c5c02e 100644 --- a/docs/guides/monitor/anomaly-detection.md +++ b/docs/guides/monitor/anomaly-detection.md @@ -5,270 +5,71 @@ image: /img/seo/guides/monitor/anomaly-detection.png author: "Andrew Maguire" author_title: "Analytics & ML Lead" author_img: "/img/authors/andy-maguire.jpg" -custom_edit_url: https://github.com/netdata/netdata/edit/master/ml/README.md +custom_edit_url: https://github.com/netdata/netdata/edit/master/docs/guides/monitor/anomaly-detection.md --> -# Machine learning (ML) powered anomaly detection -## Overview - -As of [`v1.32.0`](https://github.com/netdata/netdata/releases/tag/v1.32.0), Netdata comes with some ML powered [anomaly detection](https://en.wikipedia.org/wiki/Anomaly_detection) capabilities built into it and available to use out of the box, with minimal configuration required. - -🚧 **Note**: This functionality is still under active development and considered experimental. Changes might cause the feature to break. We dogfood it internally and among early adopters within the Netdata community to build the feature. If you would like to get involved and help us with some feedback, email us at analytics-ml-team@netdata.cloud or come join us in the [🤖-ml-powered-monitoring](https://discord.gg/4eRSEUpJnc) channel of the Netdata discord. - -Once ML is enabled, Netdata will begin training a model for each dimension. By default this model is a [k-means clustering](https://en.wikipedia.org/wiki/K-means_clustering) model trained on the most recent 4 hours of data. Rather than just using the most recent value of each raw metric, the model works on a preprocessed ["feature vector"](#feature-vector) of recent smoothed and differenced values. This should enable the model to detect a wider range of potentially anomalous patterns in recent observations as opposed to just point anomalies like big spikes or drops. ([This infographic](https://user-images.githubusercontent.com/2178292/144414415-275a3477-5b47-43d6-8959-509eb48ebb20.png) shows some different types of anomalies.) - -The sections below will introduce some of the main concepts: -- anomaly bit -- anomaly score -- anomaly rate -- anomaly detector - -Additional explanations and details can be found in the [Glossary](#glossary) and [Notes](#notes) at the bottom of the page. - -### Anomaly Bit - (100 = Anomalous, 0 = Normal) - -Once each model is trained, Netdata will begin producing an ["anomaly score"](#anomaly-score) at each time step for each dimension. This ["anomaly score"](#anomaly-score) is essentially a distance measure to the trained cluster centers of the model (by default each model has k=2, so two cluster centers are learned). More anomalous looking data should be more distant to those cluster centers. If this ["anomaly score"](#anomaly-score) is sufficiently large, this is a sign that the recent raw values of the dimension could potentially be anomalous. By default, "sufficiently large" means that the distance is in the 99th percentile or above of all distances observed during training or, put another way, it has to be further away than the furthest 1% of the data used during training. Once this threshold is passed, the ["anomaly bit"](#anomaly-bit) corresponding to that dimension is set to 100 to flag it as anomalous, otherwise it would be left at 0 to signal normal data. - -What this means is that in addition to the raw value of each metric, Netdata now also stores an ["anomaly bit"](#anomaly-bit) that is either 100 (anomalous) or 0 (normal). Importantly, this is achieved without additional storage overhead due to how the anomaly bit has been implemented within the existing internal Netdata storage representation. - -This ["anomaly bit"](#anomaly-bit) is exposed via the `anomaly-bit` key that can be passed to the `options` param of the `/api/v1/data` REST API. - -For example, here are some recent raw dimension values for `system.ip` on our [london](http://london.my-netdata.io/) demo server: - -[`https://london.my-netdata.io/api/v1/data?chart=system.ip`](https://london.my-netdata.io/api/v1/data?chart=system.ip) - -``` -{ - "labels": ["time", "received", "sent"], - "data": - [ - [ 1638365672, 54.84098, -76.70201], - [ 1638365671, 124.4328, -309.7543], - [ 1638365670, 123.73152, -167.9056], - ... - ] -} -``` - -And if we add the `&options=anomaly-bit` params, we can see the "anomaly bit" value corresponding to each raw dimension value: - -[`https://london.my-netdata.io/api/v1/data?chart=system.ip&options=anomaly-bit`](https://london.my-netdata.io/api/v1/data?chart=system.ip&options=anomaly-bit) - -``` -{ - "labels": ["time", "received", "sent"], - "data": - [ - [ 1638365672, 0, 0], - [ 1638365671, 0, 0], - [ 1638365670, 0, 0], - ... - ] -} -``` -In this example, the dimensions "received" and "sent" didn't show any abnormal behavior, so the anomaly bit is zero. -Under normal circumstances, the anomaly bit will mostly be 0. However, there can be random fluctuations setting the anomaly to 100, although this very much depends on the nature of the dimension in question. - -### Anomaly Rate - average(anomaly bit) - -Once all models have been trained, we can think of the Netdata dashboard as essentially a big matrix or table of 0's and 100's. If we consider this "anomaly bit"-based representation of the state of the node, we can now think about how we might detect overall node level anomalies. The figure below illustrates the main ideas. - -``` - dimensions -time d1 d2 d3 d4 d5 NAR - 1 0 0 0 0 0 0% - 2 0 0 0 0 100 20% - 3 0 0 0 0 0 0% - 4 0 100 0 0 0 20% - 5 100 0 0 0 0 20% - 6 0 100 100 0 100 60% - 7 0 100 0 100 0 40% - 8 0 0 0 0 100 20% - 9 0 0 100 100 0 40% - 10 0 0 0 0 0 0% - -DAR 10% 30% 20% 20% 30% 22% NAR_t1-t10 - -DAR = Dimension Anomaly Rate -NAR = Node Anomaly Rate -NAR_t1-t10 = Node Anomaly Rate over t1 to t10 -``` - -To work out an ["anomaly rate"](#anomaly-rate), we can just average a row or a column in any direction. For example, if we were to just average along a row then this would be the ["node anomaly rate"](#node-anomaly-rate) (all dimensions) at time t. Likewise if we averaged a column then we would have the ["dimension anomaly rate"](#dimension-anomaly-rate) for each dimension over the time window t=1-10. Extending this idea, we can work out an overall ["anomaly rate"](#anomaly-rate) for the whole matrix or any subset of it we might be interested in. - -### Anomaly Detector - Node level anomaly events - -An ["anomaly detector"](#anomaly-detector) looks at all anomaly bits of a node. Netdata's anomaly detector produces an ["anomaly event"](#anomaly-event) when a the percentage of anomaly bits is high enough for a persistent amount of time. This anomaly event signals that there was sufficient evidence among all the anomaly bits that some strange behavior might have been detected in a more global sense across the node. -Essentially if the ["Node Anomaly Rate"](#node-anomaly-rate) (NAR) passes a defined threshold and stays above that threshold for a persistent amount of time, a "Node [Anomaly Event](#anomaly-event)" will be triggered. - -These anomaly events are currently exposed via `/api/v1/anomaly_events` - -**Note**: Clicking the link below will likely return an empty list of `[]`. This is the response when no anomaly events exist in the specified range. The example response below is illustrative of what the response would be when one or more anomaly events exist within the range of `after` to `before`. - -https://london.my-netdata.io/api/v1/anomaly_events?after=1638365182000&before=1638365602000 - -If an event exists within the window, the result would be a list of start and end times. - -``` -[ - [ - 1638367788, - 1638367851 - ] -] -``` +## Overview -Information about each anomaly event can then be found at the `/api/v1/anomaly_event_info` endpoint (making sure to pass the `after` and `before` params): +As of [`v1.32.0`](https://github.com/netdata/netdata/releases/tag/v1.32.0), Netdata comes with some ML powered [anomaly detection](https://en.wikipedia.org/wiki/Anomaly_detection) capabilities built into it and available to use out of the box, with zero configuration required (ML was enabled by default in `v1.35.0-29-nightly` in [this PR](https://github.com/netdata/netdata/pull/13158), previously it required a one line config change). -**Note**: If you click the below url you will get a `null` since no such anomaly event exists as the response is just an illustrative example taken from a node that did have such an anomaly event. +This means that in addition to collecting raw value metrics, the Netdata agent will also produce an [`anomaly-bit`](https://learn.netdata.cloud/docs/agent/ml#anomaly-bit---100--anomalous-0--normal) every second which will be `100` when recent raw metric values are considered anomalous by Netdata and `0` when they look normal. Once we aggregate beyond one second intervals this aggregated `anomaly-bit` becomes an ["anomaly rate"](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate---averageanomaly-bit). -https://london.my-netdata.io/api/v1/anomaly_event_info?after=1638367788&before=1638367851 +To be as concrete as possible, the below api call shows how to access the raw anomaly bit of the `system.cpu` chart from the [london.my-netdata.io](https://london.my-netdata.io) Netdata demo server. Passing `options=anomaly-bit` returns the anomay bit instead of the raw metric value. ``` -[ - [ - 0.66, - "netdata.response_time|max" - ], - [ - 0.63, - "netdata.response_time|average" - ], - [ - 0.54, - "netdata.requests|requests" - ], - ... +https://london.my-netdata.io/api/v1/data?chart=system.cpu&options=anomaly-bit ``` -The query returns a list of dimension anomaly rates for all dimensions that were considered part of the detected anomaly event. - -**Note**: We plan to build additional anomaly detection and exploration features into both Netdata Agent and Netdata Cloud. The current endpoints are still under active development to power the upcoming features. - -## Configuration - -To enable anomaly detection: -1. Find and open the Netdata configuration file `netdata.conf`. -2. In the `[ml]` section, set `enabled = yes`. -3. Restart netdata (typically `sudo systemctl restart netdata`). - -**Note**: If you would like to learn more about configuring Netdata please see [the configuration guide](https://learn.netdata.cloud/guides/step-by-step/step-04). - -Below is a list of all the available configuration params and their default values. +If we aggregate the above to just 1 point by adding `points=1` we get an "[Anomaly Rate](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate---averageanomaly-bit)": ``` -[ml] - # enabled = no - # maximum num samples to train = 14400 - # minimum num samples to train = 3600 - # train every = 3600 - # num samples to diff = 1 - # num samples to smooth = 3 - # num samples to lag = 5 - # maximum number of k-means iterations = 1000 - # dimension anomaly score threshold = 0.99 - # host anomaly rate threshold = 0.01000 - # minimum window size = 30.00000 - # maximum window size = 600.00000 - # idle window size = 30.00000 - # window minimum anomaly rate = 0.25000 - # anomaly event min dimension rate threshold = 0.05000 - # hosts to skip from training = !* - # charts to skip from training = !system.* !cpu.* !mem.* !disk.* !disk_* !ip.* !ipv4.* !ipv6.* !net.* !net_* !netfilter.* !services.* !apps.* !groups.* !user.* !ebpf.* !netdata.* * +https://london.my-netdata.io/api/v1/data?chart=system.cpu&options=anomaly-bit&points=1 ``` -### Descriptions (min/max) - -- `enabled`: `yes` to enable, `no` to disable. -- `maximum num samples to train`: (`3600`/`21600`) This is the maximum amount of time you would like to train each model on. For example, the default of `14400` trains on the preceding 4 hours of data, assuming an `update every` of 1 second. -- `minimum num samples to train`: (`900`/`21600`) This is the minimum amount of data required to be able to train a model. For example, the default of `3600` implies that once at least 1 hour of data is available for training, a model is trained, otherwise it is skipped and checked again at the next training run. -- `train every`: (`1800`/`21600`) This is how often each model will be retrained. For example, the default of `3600` means that each model is retrained every hour. Note: The training of all models is spread out across the `train every` period for efficiency, so in reality, it means that each model will be trained in a staggered manner within each `train every` period. -- `num samples to diff`: (`0`/`1`) This is a `0` or `1` to determine if you want the model to operate on differences of the raw data or just the raw data. For example, the default of `1` means that we take differences of the raw values. Using differences is more general and works on dimensions that might naturally tend to have some trends or cycles in them that is normal behavior to which we don't want to be too sensitive. -- `num samples to smooth`: (`0`/`5`) This is a small integer that controls the amount of smoothing applied as part of the feature processing used by the model. For example, the default of `3` means that the rolling average of the last 3 values is used. Smoothing like this helps the model be a little more robust to spiky types of dimensions that naturally "jump" up or down as part of their normal behavior. -- `num samples to lag`: (`0`/`5`) This is a small integer that determines how many lagged values of the dimension to include in the feature vector. For example, the default of `5` means that in addition to the most recent (by default, differenced and smoothed) value of the dimension, the feature vector will also include the 5 previous values too. Using lagged values in our feature representation allows the model to work over strange patterns over recent values of a dimension as opposed to just focusing on if the most recent value itself is big or small enough to be anomalous. -- `maximum number of k-means iterations`: This is a parameter that can be passed to the model to limit the number of iterations in training the k-means model. Vast majority of cases can ignore and leave as default. -- `dimension anomaly score threshold`: (`0.01`/`5.00`) This is the threshold at which an individual dimension at a specific timestep is considered anomalous or not. For example, the default of `0.99` means that a dimension with an anomaly score of 99% or higher is flagged as anomalous. This is a normalized probability based on the training data, so the default of 99% means that anything that is as strange (based on distance measure) or more strange as the most strange 1% of data observed during training will be flagged as anomalous. If you wanted to make the anomaly detection on individual dimensions more sensitive you could try a value like `0.90` (90%) or to make it less sensitive you could try `1.5` (150%). -- `host anomaly rate threshold`: (`0.0`/`1.0`) This is the percentage of dimensions (based on all those enabled for anomaly detection) that need to be considered anomalous at specific timestep for the host itself to be considered anomalous. For example, the default value of `0.01` means that if more than 1% of dimensions are anomalous at the same time then the host itself is considered in an anomalous state. -- `minimum window size`: The Netdata "Anomaly Detector" logic works over a rolling window of data. This parameter defines the minimum length of window to consider. If over this window the host is in an anomalous state then an anomaly detection event will be triggered. For example, the default of `30` means that the detector will initially work over a rolling window of 30 seconds. Note: The length of this window will be dynamic once an anomaly event has been triggered such that it will expand as needed until either the max length of an anomaly event is hit or the host settles back into a normal state with sufficiently decreased host level anomaly states in the rolling window. Note: If you wanted to adjust the higher level anomaly detector behavior then this is one parameter you might adjust to see the impact of on anomaly detection events. -- `maximum window size`: This parameter defines the maximum length of window to consider. If an anomaly event reaches this size, it will be closed. This is to provide an upper bound on the length of an anomaly event and cost of the anomaly detector logic for that event. -- `window minimum anomaly rate`: (`0.0`/`1.0`) This parameter corresponds to a threshold on the percentage of time in the rolling window that the host was considered in an anomalous state. For example, the default of `0.25` means that if the host is in an anomalous state for 25% of more of the rolling window then and anomaly event will be triggered or extended if one is already active. Note: If you want to make the anomaly detector itself less sensitive, you can adjust this value to something like `0.75` which would mean the host needs to be much more consistently in an anomalous state to trigger an anomaly detection event. Likewise, a lower value like `0.1` would make the anomaly detector more sensitive. -- `anomaly event min dimension rate threshold`: (`0.0`/`1.0`) This is a parameter that helps filter out irrelevant dimensions from anomaly events. For example, the default of `0.05` means that only dimensions that were considered anomalous for at least 5% of the anomaly event itself will be included in that anomaly event. The idea here is to just include dimensions that were consistently anomalous as opposed to those that may have just randomly happened to be anomalous at the same time. -- `hosts to skip from training`: This parameter allows you to turn off anomaly detection for any child hosts on a parent host by defining those you would like to skip from training here. For example, a value like `dev-*` skips all hosts on a parent that begin with the "dev-" prefix. The default value of `!*` means "don't skip any". -- `charts to skip from training`: This parameter allows you to exclude certain charts from anomaly detection by defining them here. By default, all charts, apart from a specific allow list of the typical basic Netdata charts, are excluded. If you have additional charts you would like to include for anomaly detection, you can add them here. **Note**: It is recommended to add charts in small groups and then measure any impact on performance before adding additional ones. - -## Charts - -Once enabled, the "Anomaly Detection" menu and charts will be available on the dashboard. - -![anomaly_detection_menu](https://user-images.githubusercontent.com/2178292/144255721-4568aabf-39c7-4855-bf1c-31b1d60e28e6.png) - -In terms of anomaly detection, the most interesting charts would be the `anomaly_detection.dimensions` and `anomaly_detection.anomaly_rate` ones, which hold the `anomalous` and `anomaly_rate` dimensions that show the overall number of dimensions considered anomalous at any time and the corresponding anomaly rate. - -- `anomaly_detection.dimensions`: Total count of dimensions considered anomalous or normal. -- `anomaly_detection.dimensions`: Percentage of anomalous dimensions. -- `anomaly_detection.detector_window`: The length of the active window used by the detector. -- `anomaly_detection.detector_events`: Flags (0 or 1) to show when an anomaly event has been triggered by the detector. -- `anomaly_detection.prediction_stats`: Diagnostic metrics relating to prediction time of anomaly detection. -- `anomaly_detection.training_stats`: Diagnostic metrics relating to training time of anomaly detection. - -Below is an example of how these charts may look in the presence of an anomaly event. - -Initially we see a jump in `anomalous` dimensions: - -![anomalous](https://user-images.githubusercontent.com/2178292/144256036-c89fa768-5e5f-4278-9725-c67521c0d95e.png) - -And a corresponding jump in the `anomaly_rate`: - -![anomaly_rate](https://user-images.githubusercontent.com/2178292/144256071-7d157438-31f3-4b23-a795-0fd3b2e2e85c.png) - -After a short while the rolling node anomaly rate goes `above_threshold`, and once it stays above threshold for long enough a `new_anomaly_event` is created: - -![anomaly_event](https://user-images.githubusercontent.com/2178292/144256152-910b06ec-26b8-45b4-bcb7-4c2acdf9af15.png) - -## Glossary - -#### _feature vector_ +The fundamentals of Netdata's anomaly detection approach and implmentation are covered in lots more detail in the [agent ML documentation](https://learn.netdata.cloud/docs/agent/ml). -A [feature vector](https://en.wikipedia.org/wiki/Feature_(machine_learning)) is what the ML model is trained on and uses for prediction. The most simple feature vector would be just the latest raw dimension value itself [x]. By default Netdata will use a feature vector consisting of the 6 latest differences and smoothed values of the dimension so conceptually something like `[avg3(diff1(x-5)), avg3(diff1(x-4)), avg3(diff1(x-3)), avg3(diff1(x-2)), avg3(diff1(x-1)), avg3(diff1(x))]` which ends up being just 6 floating point numbers that try and represent the "shape" of recent data. +This guide will explain how to get started using these ML based anomaly detection capabilities within Netdata. -#### _anomaly score_ +## Anomaly Advisor -At prediction time the anomaly score is just the distance of the most recent feature vector to the trained cluster centers of the model, which are themselves just feature vectors, albeit supposedly the best most representative feature vectors that could be "learned" from the training data. So if the most recent feature vector is very far away in terms of [euclidean distance](https://en.wikipedia.org/wiki/Euclidean_distance#:~:text=In%20mathematics%2C%20the%20Euclidean%20distance,being%20called%20the%20Pythagorean%20distance.) it's more likely that the recent data it represents consists of some strange pattern not commonly found in the training data. +The [Anomaly Advisor](https://learn.netdata.cloud/docs/cloud/insights/anomaly-advisor) is the flagship anomaly detection feature within Netdata. In the "Anomalies" tab of Netdata you will see an overall "Anomaly Rate" chart that aggregates node level anomaly rate for all nodes in a space. The aim of this chart is to make it easy to quickly spot periods of time where the overall "[node anomaly rate](https://learn.netdata.cloud/docs/agent/ml#node-anomaly-rate)" is evelated in some unusual way and for what node or nodes this relates to. -#### _anomaly bit_ +![image](https://user-images.githubusercontent.com/2178292/175928290-490dd8b9-9c55-4724-927e-e145cb1cc837.png) -If the anomaly score is greater than a specified threshold then the most recent feature vector, and hence most recent raw data, is considered anomalous. Since storing the raw anomaly score would essentially double amount of storage space Netdata would need, we instead efficiently store just the anomaly bit in the existing internal Netdata data representation without any additional storage overhead. +Once an area on the Anomaly Rate chart is highlighted netdata will append a "heatmap" to the bottom of the screen that shows which metrics were more anomalous in the highlighted timeframe. Each row in the heatmap consists of an anomaly rate sparkline graph that can be expanded to reveal the raw underlying metric chart for that dimension. -#### _anomaly rate_ +![image](https://user-images.githubusercontent.com/2178292/175929162-02c8fe69-cc4f-4cf4-9b3a-a5e559a6feca.png) -An anomaly rate is really just an average over one or more anomaly bits. An anomaly rate can be calculated over time for one or more dimensions or at a point in time across multiple dimensions, or some combination of the two. Its just an average of some collection of anomaly bits. +## Embedded Anomaly Rate Charts -#### _anomaly detector_ +Charts in both the [Overview](https://learn.netdata.cloud/docs/cloud/visualize/overview) and [single node dashboard](https://learn.netdata.cloud/docs/cloud/visualize/overview#jump-to-single-node-dashboards) tabs also expose the underlying anomaly rates for each dimension so users can easily see if the raw metrics are considered anomalous or not by Netdata. -The is essentially business logic that just tries to process a collection of anomaly bits to determine if there is enough active anomaly bits to merit investigation or declaration of a node level anomaly event. +Pressing the anomalies icon (next to the information icon in the chart header) will expand the anomaly rate chart to make it easy to see how the anomaly rate for any individual dimension corresponds to the raw underlying data. In the example below we can see that the spike in `system.pgpgio|in` corresponded in the anomaly rate for that dimension jumping to 100% for a small period of time until the spike passed. -#### _anomaly event_ +![image](https://user-images.githubusercontent.com/2178292/175933078-5dd951ff-7709-4bb9-b4be-34199afb3945.png) -Anomaly events are triggered by the anomaly detector and represent a window of time on the node with sufficiently elevated anomaly rates across all dimensions. +## Anomaly Rate Based Alerts -#### _dimension anomaly rate_ +It is possible to use the `anomaly-bit` when defining traditional Alerts within netdata. The `anomaly-bit` is just another `options` parameter that can be passed as part of an [alarm line lookup](https://learn.netdata.cloud/docs/agent/health/reference#alarm-line-lookup). -The anomaly rate of a specific dimension over some window of time. +You can see some example ML based alert configurations below: -#### _node anomaly rate_ +- [Anomaly rate based CPU dimensions alarm](https://learn.netdata.cloud/docs/agent/health/reference#example-8---anomaly-rate-based-cpu-dimensions-alarm) +- [Anomaly rate based CPU chart alarm](https://learn.netdata.cloud/docs/agent/health/reference#example-9---anomaly-rate-based-cpu-chart-alarm) +- [Anomaly rate based node level alarm](https://learn.netdata.cloud/docs/agent/health/reference#example-10---anomaly-rate-based-node-level-alarm) +- More examples in the [`/health/health.d/ml.conf`](https://github.com/netdata/netdata/blob/master/health/health.d/ml.conf) file that ships with the agent. -The anomaly rate across all dimensions of a node. +## Learn More -## Notes +Check out the resources below to learn more about how Netdata is approaching ML: -- We would love to hear any feedback relating to this functionality, please email us at analytics-ml-team@netdata.cloud or come join us in the [🤖-ml-powered-monitoring](https://discord.gg/4eRSEUpJnc) channel of the Netdata discord. -- We are working on additional UI/UX based features that build on these core components to make them as useful as possible out of the box. -- Although not yet a core focus of this work, users could leverage the `anomaly_detection` chart dimensions and/or `anomaly-bit` options in defining alarms based on ML driven anomaly detection models. -- [This presentation](https://docs.google.com/presentation/d/18zkCvU3nKP-Bw_nQZuXTEa4PIVM6wppH3VUnAauq-RU/edit?usp=sharing) walks through some of the main concepts covered above in a more informal way. -- After restart Netdata will wait until `minimum num samples to train` observations of data are available before starting training and prediction. -- Netdata uses [dlib](https://github.com/davisking/dlib) under the hood for its core ML features. -- You should benchmark Netdata resource usage before and after enabling ML. Typical overhead ranges from 1-2% additional CPU at most. -- The "anomaly bit" has been implemented to be a building block to underpin many more ML based use cases that we plan to deliver soon. -- At its core Netdata uses an approach and problem formulation very similar to the Netdata python [anomalies collector](https://learn.netdata.cloud/docs/agent/collectors/python.d.plugin/anomalies), just implemented in a much much more efficient and scalable way in the agent in c++. So if you would like to learn more about the approach and are familiar with Python that is a useful resource to explore, as is the corresponding [deep dive tutorial](https://nbviewer.org/github/netdata/community/blob/main/netdata-agent-api/netdata-pandas/anomalies_collector_deepdive.ipynb) where the default model used is PCA instead of K-Means but the overall approach and formulation is similar. \ No newline at end of file +- [Agent ML documentation](https://learn.netdata.cloud/docs/agent/ml). +- [Anomaly Advisor documentation](https://learn.netdata.cloud/docs/cloud/insights/anomaly-advisor). +- [Metric Correlations documentation](https://learn.netdata.cloud/docs/cloud/insights/metric-correlations). +- Anomaly Advisor [launch blog post](https://www.netdata.cloud/blog/introducing-anomaly-advisor-unsupervised-anomaly-detection-in-netdata/). +- Netdata Approach to ML [blog post](https://www.netdata.cloud/blog/our-approach-to-machine-learning/). +- `areal/ml` related [GitHub Discussions](https://github.com/netdata/netdata/discussions?discussions_q=label%3Aarea%2Fml). +- Netdata Machine Learning Meetup [deck](https://docs.google.com/presentation/d/1rfSxktg2av2k-eMwMbjN0tXeo76KC33iBaxerYinovs/edit?usp=sharing) and [YouTube recording](https://www.youtube.com/watch?v=eJGWZHVQdNU). +- Netdata Anomaly Advisor [YouTube Playlist](https://youtube.com/playlist?list=PL-P-gAHfL2KPeUcCKmNHXC-LX-FfdO43j). diff --git a/docs/guides/troubleshoot/troubleshooting-agent-with-cloud-connection.md b/docs/guides/troubleshoot/troubleshooting-agent-with-cloud-connection.md new file mode 100644 index 000000000..ee214c814 --- /dev/null +++ b/docs/guides/troubleshoot/troubleshooting-agent-with-cloud-connection.md @@ -0,0 +1,117 @@ + + +# Troubleshoot Agent-Cloud connectivity issues + +When you are claiming a node, you might not be able to immediately see it online in Netdata Cloud. +This could be due to an error in the claiming process or a temporary outage of some services. + +We identified some scenarios that might cause this delay and possible actions you could take to overcome each situation. + +The most common explanation for the delay usually falls into one of the following three categories: + +- [The claiming process of the kickstart script was unsuccessful](#the-claiming-process-of-the-kickstart-script-was-unsuccessful) +- [Claiming on an older, deprecated version of the Agent](#claiming-on-an-older-deprecated-version-of-the-agent) +- [Network issues while connecting to the Cloud](#network-issues-while-connecting-to-the-cloud) + +## The claiming process of the kickstart script was unsuccessful + +Here, we will try to define some edge cases you might encounter when claiming a node. + +### The kickstart script auto-claimed the Agent but there was no error message displayed + +The kickstart script will install/update your Agent and then try to claim the node to the Cloud (if tokens are provided). To +complete the second part, the Agent must be running. In some platforms, the Netdata service cannot be enabled by default +and you must do it manually, using the following steps: + +1. Check if the Agent is running: + + ```bash + systemctl status netdata + ``` + + The expected output should contain info like this: + + ```bash + Active: active (running) since Wed 2022-07-06 12:25:02 EEST; 1h 40min ago + ``` + +2. Enable and start the Netdata Service. + + ```bash + systemctl enable netdata + systemctl start netdata + ``` + +3. Retry the kickstart claiming process. + +:::note + +In some cases a simple restart of the Agent can fix the issue. +Read more about [Starting, Stopping and Restarting the Agent](/docs/configure/start-stop-restart.md). + +::: + +## Claiming on an older, deprecated version of the Agent + +Make sure that you are using the latest version of Netdata if you are using the [Claiming script](https://learn.netdata.cloud/docs/agent/claim#claiming-script). + +With the introduction of our new architecture, Agents running versions lower than `v1.32.0` can face claiming problems, so we recommend you [update the Netdata Agent](https://learn.netdata.cloud/docs/agent/packaging/installer/update) to the latest stable version. + +## Network issues while connecting to the Cloud + +### Verify that your IP is whitelisted from Netdata Cloud + +Most of the nodes change IPs dynamically. It is possible that your current IP has been restricted from accessing `app.netdata.cloud` due to security concerns. + +To verify this: + +1. Check the Agent's `aclk-state`. + + ```bash + sudo netdatacli aclk-state | grep "Banned By Cloud" + ``` + + The output will contain a line indicating if the IP is banned from `app.netdata.cloud`: + + ```bash + Banned By Cloud: yes + ``` + +2. If your node's IP is banned, you can: + + - Contact our team to whitelist your IP by submitting a ticket in the [Netdata forum](https://community.netdata.cloud/) + - Change your node's IP + +### Make sure that your node has internet connectivity and can resolve network domains + +1. Try to reach a well known host: + + ```bash + ping 8.8.8.8 + ``` + +2. If you can reach external IPs, then check your domain resolution. + + ```bash + host app.netdata.cloud + ``` + + The expected output should be something like this: + + ```bash + app.netdata.cloud is an alias for main-ingress-545609a41fcaf5d6.elb.us-east-1.amazonaws.com. + main-ingress-545609a41fcaf5d6.elb.us-east-1.amazonaws.com has address 54.198.178.11 + main-ingress-545609a41fcaf5d6.elb.us-east-1.amazonaws.com has address 44.207.131.212 + main-ingress-545609a41fcaf5d6.elb.us-east-1.amazonaws.com has address 44.196.50.41 + ``` + + :::info + + There will be cases in which the firewall restricts network access. In those cases, you need to whitelist the `app.netdata.cloud` domain to be able to see your nodes in Netdata Cloud. + If you can't whitelist domains in your firewall, you can whitelist the IPs that the above command will produce, but keep in mind that they can change without any notice. + + ::: diff --git a/docs/store/change-metrics-storage.md b/docs/store/change-metrics-storage.md index 99760e8d3..437b45fc2 100644 --- a/docs/store/change-metrics-storage.md +++ b/docs/store/change-metrics-storage.md @@ -6,72 +6,95 @@ custom_edit_url: https://github.com/netdata/netdata/edit/master/docs/store/chang # Change how long Netdata stores metrics -import { Calculator } from '../../src/components/agent/dbCalc/' +The Netdata Agent uses a custom made time-series database (TSDB), named the [`dbengine`](/database/engine/README.md), to store metrics. -The Netdata Agent uses a time-series database (TSDB), named the [database engine -(`dbengine`)](/database/engine/README.md), to store metrics data. The most recently-collected metrics are stored in RAM, -and when metrics reach a certain age, and based on how much system RAM you allocate toward storing metrics in memory, -they are compressed and "spilled" to disk for long-term storage. +The default settings retain approximately two day's worth of metrics on a system collecting 2,000 metrics every second, +but the Netdata Agent is highly configurable if you want your nodes to store days, weeks, or months worth of per-second +data. -The default settings retain about two day's worth of metrics on a system collecting 2,000 metrics every second, but the -Netdata Agent is highly configurable if you want your nodes to store days, weeks, or months worth of per-second data. - -The Netdata Agent uses two settings in `netdata.conf` to change the behavior of the database engine: +The Netdata Agent uses the following three fundamental settings in `netdata.conf` to change the behavior of the database engine: ```conf [global] - page cache size = 32 + dbengine page cache size = 32 dbengine multihost disk space = 256 + storage tiers = 1 ``` -`page cache size` sets the maximum amount of RAM (in MiB) the database engine uses to cache and index recent metrics. +`dbengine page cache size` sets the maximum amount of RAM (in MiB) the database engine uses to cache and index recent +metrics. `dbengine multihost disk space` sets the maximum disk space (again, in MiB) the database engine uses to store -historical, compressed metrics. When the size of stored metrics exceeds the allocated disk space, the database engine -removes the oldest metrics on a rolling basis. +historical, compressed metrics and `storage tiers` specifies the number of storage tiers you want to have in +your `dbengine`. When the size of stored metrics exceeds the allocated disk space, the database engine removes the +oldest metrics on a rolling basis. ## Calculate the system resources (RAM, disk space) needed to store metrics You can store more or less metrics using the database engine by changing the allocated disk space. Use the calculator -below to find an appropriate value for `dbengine multihost disk space` based on how many metrics your node(s) collect, -whether you are streaming metrics to a parent node, and more. +below to find the appropriate value for the `dbengine` based on how many metrics your node(s) collect, whether you are +streaming metrics to a parent node, and more. + +You do not need to edit the `dbengine page cache size` setting to store more metrics using the database engine. However, +if you want to store more metrics _specifically in memory_, you can increase the cache size. + +:::tip + +We advise you to visit the [tiering mechanism](/database/engine/README.md#tiering) reference. This will help you +configure the Agent to retain metrics for longer periods. -You do not need to edit the `page cache size` setting to store more metrics using the database engine. However, if you -want to store more metrics _specifically in memory_, you can increase the cache size. +::: -> ⚠️ This calculator provides an estimate of disk and RAM usage for **metrics storage**, along with its best -> recommendation for the `dbengine multihost disk space` setting. Real-life usage may vary based on the accuracy of the -> values you enter below, changes in the compression ratio, and the types of metrics stored. +:::caution - +This calculator provides an estimation of disk and RAM usage for **metrics usage**. Real-life usage may vary based on +the accuracy of the values you enter below, changes in the compression ratio, and the types of metrics stored. + +::: + +Download +the [calculator](https://docs.google.com/spreadsheets/d/e/2PACX-1vTYMhUU90aOnIQ7qF6iIk6tXps57wmY9lxS6qDXznNJrzCKMDzxU3zkgh8Uv0xj_XqwFl3U6aHDZ6ag/pub?output=xlsx) +to optimize the data retention to your preferences. Utilize the "Front" spreadsheet. Experiment with the variables which +are padded with yellow to come up with the best settings for your use case. ## Edit `netdata.conf` with recommended database engine settings -Now that you have a recommended setting for `dbengine multihost disk space`, open `netdata.conf` with -[`edit-config`](/docs/configure/nodes.md#use-edit-config-to-edit-configuration-files) and look for the `dbengine -multihost disk space` setting. Change it to the value recommended above. For example: +Now that you have a recommended setting for your Agent's `dbengine`, open `netdata.conf` with +[`edit-config`](/docs/configure/nodes.md#use-edit-config-to-edit-configuration-files) and look for the `[db]` +subsection. Change it to the recommended values you calculated from the calculator. For example: ```conf -[global] - dbengine multihost disk space = 1024 +[db] + mode = dbengine + storage tiers = 3 + update every = 1 + dbengine multihost disk space MB = 1024 + dbengine page cache size MB = 32 + dbengine tier 1 update every iterations = 60 + dbengine tier 1 multihost disk space MB = 384 + dbengine tier 1 page cache size MB = 32 + dbengine tier 2 update every iterations = 60 + dbengine tier 2 multihost disk space MB = 16 + dbengine tier 2 page cache size MB = 32 ``` -Save the file and restart the Agent with `sudo systemctl restart netdata`, or the [appropriate -method](/docs/configure/start-stop-restart.md) for your system, to change the database engine's size. +Save the file and restart the Agent with `sudo systemctl restart netdata`, or +the [appropriate method](/docs/configure/start-stop-restart.md) for your system, to change the database engine's size. ## What's next? -If you have multiple nodes with the Netdata Agent installed, you can [stream -metrics](/docs/metrics-storage-management/how-streaming-works.mdx) from any number of _child_ nodes to a _parent_ node -and store metrics using a centralized time-series database. Streaming allows you to centralize your data, run Agents as -headless collectors, replicate data, and more. +If you have multiple nodes with the Netdata Agent installed, you +can [stream metrics](/docs/metrics-storage-management/how-streaming-works.mdx) from any number of _child_ nodes to a _ +parent_ node and store metrics using a centralized time-series database. Streaming allows you to centralize your data, +run Agents as headless collectors, replicate data, and more. -Storing metrics with the database engine is completely interoperable with [exporting to other time-series -databases](/docs/export/external-databases.md). With exporting, you can use the node's resources to surface metrics -when [viewing dashboards](/docs/visualize/interact-dashboards-charts.md), while also archiving metrics elsewhere for -further analysis, visualization, or correlation with other tools. +Storing metrics with the database engine is completely interoperable +with [exporting to other time-series databases](/docs/export/external-databases.md). With exporting, you can use the +node's resources to surface metrics when [viewing dashboards](/docs/visualize/interact-dashboards-charts.md), while also +archiving metrics elsewhere for further analysis, visualization, or correlation with other tools. ### Related reference documentation - [Netdata Agent · Database engine](/database/engine/README.md) +- [Netdata Agent · Database engine configuration option](/daemon/config/README.md#[db]-section-options) diff --git a/docs/store/distributed-data-architecture.md b/docs/store/distributed-data-architecture.md index c834d710a..62933cfe5 100644 --- a/docs/store/distributed-data-architecture.md +++ b/docs/store/distributed-data-architecture.md @@ -10,34 +10,43 @@ Netdata uses a distributed data architecture to help you collect and store per-s Every node in your infrastructure, whether it's one or a thousand, stores the metrics it collects. Netdata Cloud bridges the gap between many distributed databases by _centralizing the interface_ you use to query and -visualize your nodes' metrics. When you [look at charts in Netdata -Cloud](/docs/visualize/interact-dashboards-charts.md), the metrics values are queried directly from that node's database -and securely streamed to Netdata Cloud, which proxies them to your browser. +visualize your nodes' metrics. When you [look at charts in Netdata Cloud](/docs/visualize/interact-dashboards-charts.md) +, the metrics values are queried directly from that node's database and securely streamed to Netdata Cloud, which +proxies them to your browser. Netdata's distributed data architecture has a number of benefits: -- **Performance**: Every query to a node's database takes only a few milliseconds to complete for responsiveness when - viewing dashboards or using features like [Metric - Correlations](https://learn.netdata.cloud/docs/cloud/insights/metric-correlations). -- **Scalability**: As your infrastructure scales, install the Netdata Agent on every new node to immediately add it to - your monitoring solution without adding cost or complexity. -- **1-second granularity**: Without an expensive centralized data lake, you can store all of your nodes' per-second - metrics, for any period of time, while keeping costs down. -- **No filtering or selecting of metrics**: Because Netdata's distributed data architecture allows you to store all - metrics, you don't have to configure which metrics you retain. Keep everything for full visibility during - troubleshooting and root cause analysis. -- **Easy maintenance**: There is no centralized data lake to purchase, allocate, monitor, and update, removing - complexity from your monitoring infrastructure. +- **Performance**: Every query to a node's database takes only a few milliseconds to complete for responsiveness when + viewing dashboards or using features + like [Metric Correlations](https://learn.netdata.cloud/docs/cloud/insights/metric-correlations). +- **Scalability**: As your infrastructure scales, install the Netdata Agent on every new node to immediately add it to + your monitoring solution without adding cost or complexity. +- **1-second granularity**: Without an expensive centralized data lake, you can store all of your nodes' per-second + metrics, for any period of time, while keeping costs down. +- **No filtering or selecting of metrics**: Because Netdata's distributed data architecture allows you to store all + metrics, you don't have to configure which metrics you retain. Keep everything for full visibility during + troubleshooting and root cause analysis. +- **Easy maintenance**: There is no centralized data lake to purchase, allocate, monitor, and update, removing + complexity from your monitoring infrastructure. -## Does Netdata Cloud store my metrics? +## Ephemerality of metrics -Netdata Cloud does not store metric values. +The ephemerality of metrics plays an important role in retention. In environments where metrics collection is dynamic and +new metrics are constantly being generated, we are interested about 2 parameters: -To enable certain features, such as [viewing active alarms](/docs/monitor/view-active-alarms.md) or [filtering by -hostname/service](https://learn.netdata.cloud/docs/cloud/war-rooms#node-filter), Netdata Cloud does store configured -alarms, their status, and a list of active collectors. +1. The **expected concurrent number of metrics** as an average for the lifetime of the database. This affects mainly the + storage requirements. -Netdata does not and never will sell your personal data or data about your deployment. +2. The **expected total number of unique metrics** for the lifetime of the database. This affects mainly the memory + requirements for having all these metrics indexed and available to be queried. + +## Granularity of metrics + +The granularity of metrics (the frequency they are collected and stored, i.e. their resolution) is significantly +affecting retention. + +Lowering the granularity from per second to every two seconds, will double their retention and half the CPU requirements +of the Netdata Agent, without affecting disk space or memory requirements. ## Long-term metrics storage with Netdata @@ -47,7 +56,8 @@ appropriate amount of RAM and disk space. Read our document on changing [how long Netdata stores metrics](/docs/store/change-metrics-storage.md) on your nodes for details. -## Other options for your metrics data +You can also stream between nodes using [streaming](/streaming/README.md), allowing to replicate databases and create +your own centralized data lake of metrics, if you choose to do so. While a distributed data architecture is the default when monitoring infrastructure with Netdata, you can also configure its behavior based on your needs or the type of infrastructure you manage. @@ -55,12 +65,19 @@ its behavior based on your needs or the type of infrastructure you manage. To archive metrics to an external time-series database, such as InfluxDB, Graphite, OpenTSDB, Elasticsearch, TimescaleDB, and many others, see details on [integrating Netdata via exporting](/docs/export/external-databases.md). -You can also stream between nodes using [streaming](/streaming/README.md), allowing to replicate databases and create -your own centralized data lake of metrics, if you choose to do so. - When you use the database engine to store your metrics, you can always perform a quick backup of a node's `/var/cache/netdata/dbengine/` folder using the tool of your choice. +## Does Netdata Cloud store my metrics? + +Netdata Cloud does not store metric values. + +To enable certain features, such as [viewing active alarms](/docs/monitor/view-active-alarms.md) +or [filtering by hostname/service](https://learn.netdata.cloud/docs/cloud/war-rooms#node-filter), Netdata Cloud does +store configured alarms, their status, and a list of active collectors. + +Netdata does not and never will sell your personal data or data about your deployment. + ## What's next? You can configure the Netdata Agent to store days, weeks, or months worth of distributed, per-second data by diff --git a/exporting/aws_kinesis/aws_kinesis.c b/exporting/aws_kinesis/aws_kinesis.c index fe4181e3a..1d89cc79a 100644 --- a/exporting/aws_kinesis/aws_kinesis.c +++ b/exporting/aws_kinesis/aws_kinesis.c @@ -45,6 +45,7 @@ int init_aws_kinesis_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_json_plaintext; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = NULL; diff --git a/exporting/check_filters.c b/exporting/check_filters.c index f7eba22db..726fd02a1 100644 --- a/exporting/check_filters.c +++ b/exporting/check_filters.c @@ -2,6 +2,14 @@ #include "exporting_engine.h" + +bool exporting_labels_filter_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) { + (void)name; + (void)value; + struct instance *instance = (struct instance *)data; + return should_send_label(instance, ls); +} + /** * Check if the connector instance should export the host metrics * diff --git a/exporting/clean_connectors.c b/exporting/clean_connectors.c index 4af1219a6..e93563741 100644 --- a/exporting/clean_connectors.c +++ b/exporting/clean_connectors.c @@ -33,7 +33,7 @@ static void clean_instance_config(struct instance_config *config) void clean_instance(struct instance *instance) { clean_instance_config(&instance->config); - buffer_free(instance->labels); + buffer_free(instance->labels_buffer); uv_cond_destroy(&instance->cond_var); // uv_mutex_destroy(&instance->mutex); diff --git a/exporting/exporting.conf b/exporting/exporting.conf index 314e1541e..f2ec56a52 100644 --- a/exporting/exporting.conf +++ b/exporting/exporting.conf @@ -45,6 +45,7 @@ # send names instead of ids = yes # send charts matching = * # send hosts matching = localhost * + # send variables = no # [kinesis:my_kinesis_instance] # enabled = no diff --git a/exporting/exporting_engine.h b/exporting/exporting_engine.h index 20f260c15..2141caa41 100644 --- a/exporting/exporting_engine.h +++ b/exporting/exporting_engine.h @@ -4,7 +4,6 @@ #define NETDATA_EXPORTING_ENGINE_H 1 #include "daemon/common.h" - #include #define exporter_get(section, name, value) expconfig_get(&exporting_config, section, name, value) @@ -27,7 +26,8 @@ typedef enum exporting_options { EXPORTING_OPTION_SEND_AUTOMATIC_LABELS = (1 << 4), EXPORTING_OPTION_USE_TLS = (1 << 5), - EXPORTING_OPTION_SEND_NAMES = (1 << 16) + EXPORTING_OPTION_SEND_NAMES = (1 << 16), + EXPORTING_OPTION_SEND_VARIABLES = (1 << 17) } EXPORTING_OPTIONS; #define EXPORTING_OPTIONS_SOURCE_BITS \ @@ -40,11 +40,13 @@ extern const char *global_exporting_prefix; #define sending_labels_configured(instance) \ (instance->config.options & (EXPORTING_OPTION_SEND_CONFIGURED_LABELS | EXPORTING_OPTION_SEND_AUTOMATIC_LABELS)) -#define should_send_label(instance, label) \ +#define should_send_label(instance, label_source) \ ((instance->config.options & EXPORTING_OPTION_SEND_CONFIGURED_LABELS && \ - label->label_source == LABEL_SOURCE_NETDATA_CONF) || \ + label_source & RRDLABEL_SRC_CONFIG) || \ (instance->config.options & EXPORTING_OPTION_SEND_AUTOMATIC_LABELS && \ - label->label_source != LABEL_SOURCE_NETDATA_CONF)) + label_source & RRDLABEL_SRC_AUTO)) + +#define should_send_variables(instance) (instance->config.options & EXPORTING_OPTION_SEND_VARIABLES) typedef enum exporting_connector_types { EXPORTING_CONNECTOR_TYPE_UNKNOWN, // Invalid type @@ -205,7 +207,7 @@ struct instance { int skip_host; int skip_chart; - BUFFER *labels; + BUFFER *labels_buffer; time_t after; time_t before; @@ -220,6 +222,7 @@ struct instance { int (*start_chart_formatting)(struct instance *instance, RRDSET *st); int (*metric_formatting)(struct instance *instance, RRDDIM *rd); int (*end_chart_formatting)(struct instance *instance, RRDSET *st); + int (*variables_formatting)(struct instance *instance, RRDHOST *host); int (*end_host_formatting)(struct instance *instance, RRDHOST *host); int (*end_batch_formatting)(struct instance *instance); @@ -270,7 +273,8 @@ int rrdset_is_exportable(struct instance *instance, RRDSET *st); extern EXPORTING_OPTIONS exporting_parse_data_source(const char *source, EXPORTING_OPTIONS exporting_options); -calculated_number exporting_calculate_value_from_stored_data( +NETDATA_DOUBLE +exporting_calculate_value_from_stored_data( struct instance *instance, RRDDIM *rd, time_t *last_timestamp); @@ -280,6 +284,7 @@ void start_host_formatting(struct engine *engine, RRDHOST *host); void start_chart_formatting(struct engine *engine, RRDSET *st); void metric_formatting(struct engine *engine, RRDDIM *rd); void end_chart_formatting(struct engine *engine, RRDSET *st); +void variables_formatting(struct engine *engine, RRDHOST *host); void end_host_formatting(struct engine *engine, RRDHOST *host); void end_batch_formatting(struct engine *engine); int flush_host_labels(struct instance *instance, RRDHOST *host); diff --git a/exporting/graphite/graphite.c b/exporting/graphite/graphite.c index 84d4febf1..8ca094b3b 100644 --- a/exporting/graphite/graphite.c +++ b/exporting/graphite/graphite.c @@ -37,6 +37,7 @@ int init_graphite_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_graphite_plaintext; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = simple_connector_end_batch; @@ -71,7 +72,7 @@ int init_graphite_instance(struct instance *instance) * @param len the maximum number of characters copied. */ -void sanitize_graphite_label_value(char *dst, char *src, size_t len) +void sanitize_graphite_label_value(char *dst, const char *src, size_t len) { while (*src != '\0' && len) { if (isspace(*src) || *src == ';' || *src == '~') @@ -91,29 +92,18 @@ void sanitize_graphite_label_value(char *dst, char *src, size_t len) * @param host a data collecting host. * @return Always returns 0. */ + int format_host_labels_graphite_plaintext(struct instance *instance, RRDHOST *host) { - if (!instance->labels) - instance->labels = buffer_create(1024); + if (!instance->labels_buffer) + instance->labels_buffer = buffer_create(1024); if (unlikely(!sending_labels_configured(instance))) return 0; - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - for (struct label *label = host->labels.head; label; label = label->next) { - if (!should_send_label(instance, label)) - continue; - - char value[CONFIG_MAX_VALUE + 1]; - sanitize_graphite_label_value(value, label->value, CONFIG_MAX_VALUE); - - if (*value) { - buffer_strcat(instance->labels, ";"); - buffer_sprintf(instance->labels, "%s=%s", label->key, value); - } - } - netdata_rwlock_unlock(&host->labels.labels_rwlock); + rrdlabels_to_buffer(host->host_labels, instance->labels_buffer, ";", "=", "", "", + exporting_labels_filter_callback, instance, + NULL, sanitize_graphite_label_value); return 0; } @@ -151,7 +141,7 @@ int format_dimension_collected_graphite_plaintext(struct instance *instance, RRD dimension_name, (host->tags) ? ";" : "", (host->tags) ? host->tags : "", - (instance->labels) ? buffer_tostring(instance->labels) : "", + (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : "", rd->last_collected_value, (unsigned long long)rd->last_collected_time.tv_sec); @@ -183,21 +173,21 @@ int format_dimension_stored_graphite_plaintext(struct instance *instance, RRDDIM RRD_ID_LENGTH_MAX); time_t last_t; - calculated_number value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); + NETDATA_DOUBLE value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); if(isnan(value)) return 0; buffer_sprintf( instance->buffer, - "%s.%s.%s.%s%s%s%s " CALCULATED_NUMBER_FORMAT " %llu\n", + "%s.%s.%s.%s%s%s%s " NETDATA_DOUBLE_FORMAT " %llu\n", instance->config.prefix, (host == localhost) ? instance->config.hostname : host->hostname, chart_name, dimension_name, (host->tags) ? ";" : "", (host->tags) ? host->tags : "", - (instance->labels) ? buffer_tostring(instance->labels) : "", + (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : "", value, (unsigned long long)last_t); diff --git a/exporting/graphite/graphite.h b/exporting/graphite/graphite.h index 993c12e57..79f87e46e 100644 --- a/exporting/graphite/graphite.h +++ b/exporting/graphite/graphite.h @@ -7,7 +7,7 @@ int init_graphite_instance(struct instance *instance); -void sanitize_graphite_label_value(char *dst, char *src, size_t len); +void sanitize_graphite_label_value(char *dst, const char *src, size_t len); int format_host_labels_graphite_plaintext(struct instance *instance, RRDHOST *host); int format_dimension_collected_graphite_plaintext(struct instance *instance, RRDDIM *rd); diff --git a/exporting/init_connectors.c b/exporting/init_connectors.c index 69ea0685c..bfb6525ea 100644 --- a/exporting/init_connectors.c +++ b/exporting/init_connectors.c @@ -117,7 +117,7 @@ static size_t base64_encode(unsigned char *input, size_t input_size, char *outpu return 0; } size_t count = 0; - while (input_size > 3) { + while (input_size >= 3) { value = ((input[0] << 16) + (input[1] << 8) + input[2]) & 0xffffff; output[0] = lookup[value >> 18]; output[1] = lookup[(value >> 12) & 0x3f]; @@ -138,6 +138,7 @@ static size_t base64_encode(unsigned char *input, size_t input_size, char *outpu output[3] = '='; //error("Base-64 encode (%06x) -> %c %c %c %c\n", (value>>2)&0xffff, output[0], output[1], output[2], output[3]); count += 4; + output[4] = '\0'; break; case 1: value = input[0] << 4; @@ -147,10 +148,13 @@ static size_t base64_encode(unsigned char *input, size_t input_size, char *outpu output[3] = '='; //error("Base-64 encode (%06x) -> %c %c %c %c\n", value, output[0], output[1], output[2], output[3]); count += 4; + output[4] = '\0'; break; case 0: + output[0] = '\0'; break; } + return count; } @@ -199,7 +203,7 @@ void simple_connector_init(struct instance *instance) char *encoded_credentials = callocz(1, encoded_size); base64_encode((unsigned char*)buffer_tostring(auth_string), buffer_strlen(auth_string), encoded_credentials, encoded_size); - + buffer_flush(auth_string); buffer_sprintf(auth_string, "Authorization: Basic %s\n", encoded_credentials); diff --git a/exporting/json/json.c b/exporting/json/json.c index 50278c5b8..45a8c9d9f 100644 --- a/exporting/json/json.c +++ b/exporting/json/json.c @@ -29,6 +29,7 @@ int init_json_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_json_plaintext; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = simple_connector_end_batch; @@ -87,6 +88,7 @@ int init_json_http_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_json_plaintext; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = close_batch_json_http; @@ -113,34 +115,20 @@ int init_json_http_instance(struct instance *instance) * @param host a data collecting host. * @return Always returns 0. */ + int format_host_labels_json_plaintext(struct instance *instance, RRDHOST *host) { - if (!instance->labels) - instance->labels = buffer_create(1024); + if (!instance->labels_buffer) + instance->labels_buffer = buffer_create(1024); if (unlikely(!sending_labels_configured(instance))) return 0; - buffer_strcat(instance->labels, "\"labels\":{"); - - int count = 0; - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - for (struct label *label = host->labels.head; label; label = label->next) { - if (!should_send_label(instance, label)) - continue; - - char value[CONFIG_MAX_VALUE * 2 + 1]; - sanitize_json_string(value, label->value, CONFIG_MAX_VALUE); - if (count > 0) - buffer_strcat(instance->labels, ","); - buffer_sprintf(instance->labels, "\"%s\":\"%s\"", label->key, value); - - count++; - } - netdata_rwlock_unlock(&host->labels.labels_rwlock); - - buffer_strcat(instance->labels, "},"); + buffer_strcat(instance->labels_buffer, "\"labels\":{"); + rrdlabels_to_buffer(host->host_labels, instance->labels_buffer, "", ":", "\"", ",", + exporting_labels_filter_callback, instance, + NULL, sanitize_json_string); + buffer_strcat(instance->labels_buffer, "},"); return 0; } @@ -203,7 +191,7 @@ int format_dimension_collected_json_plaintext(struct instance *instance, RRDDIM tags_pre, tags, tags_post, - instance->labels ? buffer_tostring(instance->labels) : "", + instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : "", st->id, st->name, @@ -238,7 +226,7 @@ int format_dimension_stored_json_plaintext(struct instance *instance, RRDDIM *rd RRDHOST *host = st->rrdhost; time_t last_t; - calculated_number value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); + NETDATA_DOUBLE value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); if(isnan(value)) return 0; @@ -279,7 +267,7 @@ int format_dimension_stored_json_plaintext(struct instance *instance, RRDDIM *rd "\"id\":\"%s\"," "\"name\":\"%s\"," - "\"value\":" CALCULATED_NUMBER_FORMAT "," + "\"value\":" NETDATA_DOUBLE_FORMAT "," "\"timestamp\": %llu}", @@ -288,7 +276,7 @@ int format_dimension_stored_json_plaintext(struct instance *instance, RRDDIM *rd tags_pre, tags, tags_post, - instance->labels ? buffer_tostring(instance->labels) : "", + instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : "", st->id, st->name, diff --git a/exporting/mongodb/mongodb.c b/exporting/mongodb/mongodb.c index aab1770d2..850d07fb3 100644 --- a/exporting/mongodb/mongodb.c +++ b/exporting/mongodb/mongodb.c @@ -99,6 +99,7 @@ int init_mongodb_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_json_plaintext; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = format_batch_mongodb; diff --git a/exporting/opentsdb/opentsdb.c b/exporting/opentsdb/opentsdb.c index 7ed88fd6d..282de2e6b 100644 --- a/exporting/opentsdb/opentsdb.c +++ b/exporting/opentsdb/opentsdb.c @@ -38,6 +38,7 @@ int init_opentsdb_telnet_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_opentsdb_telnet; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = simple_connector_end_batch; @@ -94,6 +95,7 @@ int init_opentsdb_http_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_opentsdb_http; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = close_batch_json_http; @@ -124,13 +126,14 @@ int init_opentsdb_http_instance(struct instance *instance) * @param len the maximum number of characters copied. */ -void sanitize_opentsdb_label_value(char *dst, char *src, size_t len) +void sanitize_opentsdb_label_value(char *dst, const char *src, size_t len) { while (*src != '\0' && len) { - if (isalpha(*src) || isdigit(*src) || *src == '-' || *src == '_' || *src == '.' || *src == '/' || IS_UTF8_BYTE(*src)) + if (isalpha(*src) || isdigit(*src) || *src == '-' || *src == '.' || *src == '/' || IS_UTF8_BYTE(*src)) *dst++ = *src; else *dst++ = '_'; + src++; len--; } @@ -144,28 +147,18 @@ void sanitize_opentsdb_label_value(char *dst, char *src, size_t len) * @param host a data collecting host. * @return Always returns 0. */ -int format_host_labels_opentsdb_telnet(struct instance *instance, RRDHOST *host) -{ - if (!instance->labels) - instance->labels = buffer_create(1024); + +int format_host_labels_opentsdb_telnet(struct instance *instance, RRDHOST *host) { + if(!instance->labels_buffer) + instance->labels_buffer = buffer_create(1024); if (unlikely(!sending_labels_configured(instance))) return 0; - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - for (struct label *label = host->labels.head; label; label = label->next) { - if (!should_send_label(instance, label)) - continue; - - char value[CONFIG_MAX_VALUE + 1]; - sanitize_opentsdb_label_value(value, label->value, CONFIG_MAX_VALUE); - - if (*value) - buffer_sprintf(instance->labels, " %s=%s", label->key, value); - } - netdata_rwlock_unlock(&host->labels.labels_rwlock); - + buffer_strcat(instance->labels_buffer, " "); + rrdlabels_to_buffer(host->host_labels, instance->labels_buffer, "", "=", "", " ", + exporting_labels_filter_callback, instance, + NULL, sanitize_opentsdb_label_value); return 0; } @@ -204,7 +197,7 @@ int format_dimension_collected_opentsdb_telnet(struct instance *instance, RRDDIM (host == localhost) ? instance->config.hostname : host->hostname, (host->tags) ? " " : "", (host->tags) ? host->tags : "", - (instance->labels) ? buffer_tostring(instance->labels) : ""); + (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : ""); return 0; } @@ -234,14 +227,14 @@ int format_dimension_stored_opentsdb_telnet(struct instance *instance, RRDDIM *r RRD_ID_LENGTH_MAX); time_t last_t; - calculated_number value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); + NETDATA_DOUBLE value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); if(isnan(value)) return 0; buffer_sprintf( instance->buffer, - "put %s.%s.%s %llu " CALCULATED_NUMBER_FORMAT " host=%s%s%s%s\n", + "put %s.%s.%s %llu " NETDATA_DOUBLE_FORMAT " host=%s%s%s%s\n", instance->config.prefix, chart_name, dimension_name, @@ -250,7 +243,7 @@ int format_dimension_stored_opentsdb_telnet(struct instance *instance, RRDDIM *r (host == localhost) ? instance->config.hostname : host->hostname, (host->tags) ? " " : "", (host->tags) ? host->tags : "", - (instance->labels) ? buffer_tostring(instance->labels) : ""); + (instance->labels_buffer) ? buffer_tostring(instance->labels_buffer) : ""); return 0; } @@ -287,33 +280,17 @@ void opentsdb_http_prepare_header(struct instance *instance) * @param host a data collecting host. * @return Always returns 0. */ -int format_host_labels_opentsdb_http(struct instance *instance, RRDHOST *host) -{ - if (!instance->labels) - instance->labels = buffer_create(1024); + +int format_host_labels_opentsdb_http(struct instance *instance, RRDHOST *host) { + if (!instance->labels_buffer) + instance->labels_buffer = buffer_create(1024); if (unlikely(!sending_labels_configured(instance))) return 0; - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - for (struct label *label = host->labels.head; label; label = label->next) { - if (!should_send_label(instance, label)) - continue; - - char escaped_value[CONFIG_MAX_VALUE * 2 + 1]; - sanitize_json_string(escaped_value, label->value, CONFIG_MAX_VALUE); - - char value[CONFIG_MAX_VALUE + 1]; - sanitize_opentsdb_label_value(value, escaped_value, CONFIG_MAX_VALUE); - - if (*value) { - buffer_strcat(instance->labels, ","); - buffer_sprintf(instance->labels, "\"%s\":\"%s\"", label->key, value); - } - } - netdata_rwlock_unlock(&host->labels.labels_rwlock); - + rrdlabels_to_buffer(host->host_labels, instance->labels_buffer, ",", ":", "\"", "", + exporting_labels_filter_callback, instance, + NULL, sanitize_opentsdb_label_value); return 0; } @@ -362,7 +339,7 @@ int format_dimension_collected_opentsdb_http(struct instance *instance, RRDDIM * (host == localhost) ? instance->config.hostname : host->hostname, (host->tags) ? " " : "", (host->tags) ? host->tags : "", - instance->labels ? buffer_tostring(instance->labels) : ""); + instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : ""); return 0; } @@ -392,7 +369,7 @@ int format_dimension_stored_opentsdb_http(struct instance *instance, RRDDIM *rd) RRD_ID_LENGTH_MAX); time_t last_t; - calculated_number value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); + NETDATA_DOUBLE value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); if(isnan(value)) return 0; @@ -405,7 +382,7 @@ int format_dimension_stored_opentsdb_http(struct instance *instance, RRDDIM *rd) "{" "\"metric\":\"%s.%s.%s\"," "\"timestamp\":%llu," - "\"value\":"CALCULATED_NUMBER_FORMAT"," + "\"value\":" NETDATA_DOUBLE_FORMAT "," "\"tags\":{" "\"host\":\"%s%s%s\"%s" "}" @@ -418,7 +395,7 @@ int format_dimension_stored_opentsdb_http(struct instance *instance, RRDDIM *rd) (host == localhost) ? instance->config.hostname : host->hostname, (host->tags) ? " " : "", (host->tags) ? host->tags : "", - instance->labels ? buffer_tostring(instance->labels) : ""); + instance->labels_buffer ? buffer_tostring(instance->labels_buffer) : ""); return 0; } diff --git a/exporting/opentsdb/opentsdb.h b/exporting/opentsdb/opentsdb.h index d53a5054f..b544ba8c1 100644 --- a/exporting/opentsdb/opentsdb.h +++ b/exporting/opentsdb/opentsdb.h @@ -8,7 +8,7 @@ int init_opentsdb_telnet_instance(struct instance *instance); int init_opentsdb_http_instance(struct instance *instance); -void sanitize_opentsdb_label_value(char *dst, char *src, size_t len); +void sanitize_opentsdb_label_value(char *dst, const char *src, size_t len); int format_host_labels_opentsdb_telnet(struct instance *instance, RRDHOST *host); int format_host_labels_opentsdb_http(struct instance *instance, RRDHOST *host); diff --git a/exporting/process_data.c b/exporting/process_data.c index c77b7ad4a..d5138b787 100644 --- a/exporting/process_data.c +++ b/exporting/process_data.c @@ -64,7 +64,7 @@ int mark_scheduled_instances(struct engine *engine) * @param last_timestamp the timestamp that should be reported to the exporting connector instance. * @return Returns the value, calculated over the given period. */ -calculated_number exporting_calculate_value_from_stored_data( +NETDATA_DOUBLE exporting_calculate_value_from_stored_data( struct instance *instance, RRDDIM *rd, time_t *last_timestamp) @@ -77,11 +77,10 @@ calculated_number exporting_calculate_value_from_stored_data( time_t before = instance->before; // find the edges of the rrd database for this chart - time_t first_t = rd->state->query_ops.oldest_time(rd); - time_t last_t = rd->state->query_ops.latest_time(rd); + time_t first_t = rd->tiers[0]->query_ops.oldest_time(rd->tiers[0]->db_metric_handle); + time_t last_t = rd->tiers[0]->query_ops.latest_time(rd->tiers[0]->db_metric_handle); time_t update_every = st->update_every; struct rrddim_query_handle handle; - storage_number n; // step back a little, to make sure we have complete data collection // for all metrics @@ -124,23 +123,21 @@ calculated_number exporting_calculate_value_from_stored_data( *last_timestamp = before; size_t counter = 0; - calculated_number sum = 0; + NETDATA_DOUBLE sum = 0; - for (rd->state->query_ops.init(rd, &handle, after, before); !rd->state->query_ops.is_finished(&handle);) { - time_t curr_t; - n = rd->state->query_ops.next_metric(&handle, &curr_t); + for (rd->tiers[0]->query_ops.init(rd->tiers[0]->db_metric_handle, &handle, after, before, TIER_QUERY_FETCH_SUM); !rd->tiers[0]->query_ops.is_finished(&handle);) { + STORAGE_POINT sp = rd->tiers[0]->query_ops.next_metric(&handle); - if (unlikely(!does_storage_number_exist(n))) { + if (unlikely(storage_point_is_empty(sp))) { // not collected continue; } - calculated_number value = unpack_storage_number(n); - sum += value; - - counter++; + sum += sp.sum; + counter += sp.count; } - rd->state->query_ops.finalize(&handle); + rd->tiers[0]->query_ops.finalize(&handle); + if (unlikely(!counter)) { debug( D_EXPORTING, @@ -156,7 +153,7 @@ calculated_number exporting_calculate_value_from_stored_data( if (unlikely(EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_SUM)) return sum; - return sum / (calculated_number)counter; + return sum / (NETDATA_DOUBLE)counter; } /** @@ -261,6 +258,27 @@ void end_chart_formatting(struct engine *engine, RRDSET *st) } } +/** + * Format variables for every connector instance's buffer + * + * @param engine an engine data structure. + * @param host a data collecting host. + */ +void variables_formatting(struct engine *engine, RRDHOST *host) +{ + for (struct instance *instance = engine->instance_root; instance; instance = instance->next) { + if (instance->scheduled && !instance->skip_host && should_send_variables(instance)) { + if (instance->variables_formatting && instance->variables_formatting(instance, host) != 0){ + error("EXPORTING: cannot format variables for %s", instance->config.name); + disable_instance(instance); + continue; + } + // sum all variables as one metrics + instance->stats.buffered_metrics++; + } + } +} + /** * End host formatting for every connector instance's buffer * @@ -337,7 +355,7 @@ void prepare_buffers(struct engine *engine) end_chart_formatting(engine, st); rrdset_unlock(st); } - + variables_formatting(engine, host); end_host_formatting(engine, host); rrdhost_unlock(host); } @@ -358,8 +376,8 @@ int flush_host_labels(struct instance *instance, RRDHOST *host) { (void)host; - if (instance->labels) - buffer_flush(instance->labels); + if (instance->labels_buffer) + buffer_flush(instance->labels_buffer); return 0; } diff --git a/exporting/prometheus/prometheus.c b/exporting/prometheus/prometheus.c index c7f3f1d38..7d632164f 100644 --- a/exporting/prometheus/prometheus.c +++ b/exporting/prometheus/prometheus.c @@ -290,35 +290,44 @@ inline char *prometheus_units_copy(char *d, const char *s, size_t usable, int sh * @param instance an instance data structure. * @param host a data collecting host. */ -void format_host_labels_prometheus(struct instance *instance, RRDHOST *host) -{ - if (unlikely(!sending_labels_configured(instance))) - return; - if (!instance->labels) - instance->labels = buffer_create(1024); +struct format_prometheus_label_callback { + struct instance *instance; + size_t count; +}; - int count = 0; - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - for (struct label *label = host->labels.head; label; label = label->next) { - if (!should_send_label(instance, label)) - continue; +static int format_prometheus_label_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) { + struct format_prometheus_label_callback *d = (struct format_prometheus_label_callback *)data; - char key[PROMETHEUS_ELEMENT_MAX + 1]; - char value[PROMETHEUS_ELEMENT_MAX + 1]; + if (!should_send_label(d->instance, ls)) return 0; - prometheus_name_copy(key, label->key, PROMETHEUS_ELEMENT_MAX); - prometheus_label_copy(value, label->value, PROMETHEUS_ELEMENT_MAX); + char k[PROMETHEUS_ELEMENT_MAX + 1]; + char v[PROMETHEUS_ELEMENT_MAX + 1]; - if (*key && *value) { - if (count > 0) - buffer_strcat(instance->labels, ","); - buffer_sprintf(instance->labels, "%s=\"%s\"", key, value); - count++; - } + prometheus_name_copy(k, name, PROMETHEUS_ELEMENT_MAX); + prometheus_label_copy(v, value, PROMETHEUS_ELEMENT_MAX); + + if (*k && *v) { + if (d->count > 0) buffer_strcat(d->instance->labels_buffer, ","); + buffer_sprintf(d->instance->labels_buffer, "%s=\"%s\"", k, v); + d->count++; } - netdata_rwlock_unlock(&host->labels.labels_rwlock); + return 1; +} + +void format_host_labels_prometheus(struct instance *instance, RRDHOST *host) +{ + if (unlikely(!sending_labels_configured(instance))) + return; + + if (!instance->labels_buffer) + instance->labels_buffer = buffer_create(1024); + + struct format_prometheus_label_callback tmp = { + .instance = instance, + .count = 0 + }; + rrdlabels_walkthrough_read(host->host_labels, format_prometheus_label_callback, &tmp); } struct host_variables_callback_options { @@ -353,7 +362,7 @@ static int print_host_variables(RRDVAR *rv, void *data) } } - calculated_number value = rrdvar2number(rv); + NETDATA_DOUBLE value = rrdvar2number(rv); if (isnan(value) || isinf(value)) { if (opts->output_options & PROMETHEUS_OUTPUT_HELP) buffer_sprintf( @@ -374,7 +383,7 @@ static int print_host_variables(RRDVAR *rv, void *data) if (opts->output_options & PROMETHEUS_OUTPUT_TIMESTAMPS) buffer_sprintf( opts->wb, - "%s_%s%s%s%s " CALCULATED_NUMBER_FORMAT " %llu\n", + "%s_%s%s%s%s " NETDATA_DOUBLE_FORMAT " %llu\n", opts->prefix, opts->name, label_pre, @@ -385,7 +394,7 @@ static int print_host_variables(RRDVAR *rv, void *data) else buffer_sprintf( opts->wb, - "%s_%s%s%s%s " CALCULATED_NUMBER_FORMAT "\n", + "%s_%s%s%s%s " NETDATA_DOUBLE_FORMAT "\n", opts->prefix, opts->name, label_pre, @@ -474,9 +483,9 @@ static void generate_as_collected_prom_metric(BUFFER *wb, struct gen_parameters if (prometheus_collector) buffer_sprintf( wb, - CALCULATED_NUMBER_FORMAT, - (calculated_number)p->rd->last_collected_value * (calculated_number)p->rd->multiplier / - (calculated_number)p->rd->divisor); + NETDATA_DOUBLE_FORMAT, + (NETDATA_DOUBLE)p->rd->last_collected_value * (NETDATA_DOUBLE)p->rd->multiplier / + (NETDATA_DOUBLE)p->rd->divisor); else buffer_sprintf(wb, COLLECTED_NUMBER_FORMAT, p->rd->last_collected_value); @@ -516,77 +525,29 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus( format_host_labels_prometheus(instance, host); + buffer_sprintf( + wb, + "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"", + hostname, + host->program_name, + host->program_version); + + if (instance->labels_buffer && *buffer_tostring(instance->labels_buffer)) { + buffer_sprintf(wb, ",%s", buffer_tostring(instance->labels_buffer)); + } + if (output_options & PROMETHEUS_OUTPUT_TIMESTAMPS) - buffer_sprintf( - wb, - "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1 %llu\n", - hostname, - host->program_name, - host->program_version, - now_realtime_usec() / USEC_PER_MS); + buffer_sprintf(wb, "} 1 %llu\n", now_realtime_usec() / USEC_PER_MS); else - buffer_sprintf( - wb, - "netdata_info{instance=\"%s\",application=\"%s\",version=\"%s\"} 1\n", - hostname, - host->program_name, - host->program_version); + buffer_sprintf(wb, "} 1\n"); char labels[PROMETHEUS_LABELS_MAX + 1] = ""; if (allhosts) { - if (instance->labels && buffer_tostring(instance->labels)) { - if (output_options & PROMETHEUS_OUTPUT_TIMESTAMPS) { - buffer_sprintf( - wb, - "netdata_host_tags_info{instance=\"%s\",%s} 1 %llu\n", - hostname, - buffer_tostring(instance->labels), - now_realtime_usec() / USEC_PER_MS); - - // deprecated, exists only for compatibility with older queries - buffer_sprintf( - wb, - "netdata_host_tags{instance=\"%s\",%s} 1 %llu\n", - hostname, - buffer_tostring(instance->labels), - now_realtime_usec() / USEC_PER_MS); - } else { - buffer_sprintf( - wb, "netdata_host_tags_info{instance=\"%s\",%s} 1\n", hostname, buffer_tostring(instance->labels)); - - // deprecated, exists only for compatibility with older queries - buffer_sprintf( - wb, "netdata_host_tags{instance=\"%s\",%s} 1\n", hostname, buffer_tostring(instance->labels)); - } - } - snprintfz(labels, PROMETHEUS_LABELS_MAX, ",instance=\"%s\"", hostname); - } else { - if (instance->labels && buffer_tostring(instance->labels)) { - if (output_options & PROMETHEUS_OUTPUT_TIMESTAMPS) { - buffer_sprintf( - wb, - "netdata_host_tags_info{%s} 1 %llu\n", - buffer_tostring(instance->labels), - now_realtime_usec() / USEC_PER_MS); - - // deprecated, exists only for compatibility with older queries - buffer_sprintf( - wb, - "netdata_host_tags{%s} 1 %llu\n", - buffer_tostring(instance->labels), - now_realtime_usec() / USEC_PER_MS); - } else { - buffer_sprintf(wb, "netdata_host_tags_info{%s} 1\n", buffer_tostring(instance->labels)); - - // deprecated, exists only for compatibility with older queries - buffer_sprintf(wb, "netdata_host_tags{%s} 1\n", buffer_tostring(instance->labels)); - } - } - } + } - if (instance->labels) - buffer_flush(instance->labels); + if (instance->labels_buffer) + buffer_flush(instance->labels_buffer); // send custom variables set for the host if (output_options & PROMETHEUS_OUTPUT_VARIABLES) { @@ -723,7 +684,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus( time_t first_time = instance->after; time_t last_time = instance->before; - calculated_number value = exporting_calculate_value_from_stored_data(instance, rd, &last_time); + NETDATA_DOUBLE value = exporting_calculate_value_from_stored_data(instance, rd, &last_time); if (!isnan(value) && !isinf(value)) { if (EXPORTING_OPTIONS_DATA_SOURCE(exporting_options) == EXPORTING_SOURCE_DATA_AVERAGE) @@ -755,7 +716,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus( if (output_options & PROMETHEUS_OUTPUT_TIMESTAMPS) buffer_sprintf( wb, - "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " CALCULATED_NUMBER_FORMAT + "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " NETDATA_DOUBLE_FORMAT " %llu\n", prefix, context, @@ -770,7 +731,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus( else buffer_sprintf( wb, - "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " CALCULATED_NUMBER_FORMAT + "%s_%s%s%s{chart=\"%s\",family=\"%s\",dimension=\"%s\"%s} " NETDATA_DOUBLE_FORMAT "\n", prefix, context, diff --git a/exporting/prometheus/remote_write/remote_write.c b/exporting/prometheus/remote_write/remote_write.c index 59a488e1b..03feb2c08 100644 --- a/exporting/prometheus/remote_write/remote_write.c +++ b/exporting/prometheus/remote_write/remote_write.c @@ -97,6 +97,7 @@ int init_prometheus_remote_write_instance(struct instance *instance) instance->start_chart_formatting = format_chart_prometheus_remote_write; instance->metric_formatting = format_dimension_prometheus_remote_write; instance->end_chart_formatting = NULL; + instance->variables_formatting = format_variables_prometheus_remote_write; instance->end_host_formatting = NULL; instance->end_batch_formatting = format_batch_prometheus_remote_write; @@ -134,6 +135,25 @@ int init_prometheus_remote_write_instance(struct instance *instance) return 0; } +struct format_remote_write_label_callback { + struct instance *instance; + void *write_request; +}; + +static int format_remote_write_label_callback(const char *name, const char *value, RRDLABEL_SRC ls, void *data) { + struct format_remote_write_label_callback *d = (struct format_remote_write_label_callback *)data; + + if (!should_send_label(d->instance, ls)) return 0; + + char k[PROMETHEUS_ELEMENT_MAX + 1]; + char v[PROMETHEUS_ELEMENT_MAX + 1]; + + prometheus_name_copy(k, name, PROMETHEUS_ELEMENT_MAX); + prometheus_label_copy(v, value, PROMETHEUS_ELEMENT_MAX); + add_label(d->write_request, k, v); + return 1; +} + /** * Format host data for Prometheus Remote Write connector * @@ -157,23 +177,13 @@ int format_host_prometheus_remote_write(struct instance *instance, RRDHOST *host add_host_info( connector_specific_data->write_request, "netdata_info", hostname, host->program_name, host->program_version, now_realtime_usec() / USEC_PER_MS); - + if (unlikely(sending_labels_configured(instance))) { - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - for (struct label *label = host->labels.head; label; label = label->next) { - if (!should_send_label(instance, label)) - continue; - - char key[PROMETHEUS_ELEMENT_MAX + 1]; - prometheus_name_copy(key, label->key, PROMETHEUS_ELEMENT_MAX); - - char value[PROMETHEUS_ELEMENT_MAX + 1]; - prometheus_label_copy(value, label->value, PROMETHEUS_ELEMENT_MAX); - - add_label(connector_specific_data->write_request, key, value); - } - netdata_rwlock_unlock(&host->labels.labels_rwlock); + struct format_remote_write_label_callback tmp = { + .write_request = connector_specific_data->write_request, + .instance = instance + }; + rrdlabels_walkthrough_read(host->host_labels, format_remote_write_label_callback, &tmp); } return 0; @@ -284,7 +294,7 @@ int format_dimension_prometheus_remote_write(struct instance *instance, RRDDIM * // we need average or sum of the data time_t last_t = instance->before; - calculated_number value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); + NETDATA_DOUBLE value = exporting_calculate_value_from_stored_data(instance, rd, &last_t); if (!isnan(value) && !isinf(value)) { if (EXPORTING_OPTIONS_DATA_SOURCE(instance->config.options) == EXPORTING_SOURCE_DATA_AVERAGE) @@ -311,6 +321,49 @@ int format_dimension_prometheus_remote_write(struct instance *instance, RRDDIM * return 0; } +int format_variable_prometheus_remote_write_callback(RRDVAR *rv, void *data) { + struct prometheus_remote_write_variables_callback_options *opts = data; + + if (rv->options & (RRDVAR_OPTION_CUSTOM_HOST_VAR | RRDVAR_OPTION_CUSTOM_CHART_VAR)) { + RRDHOST *host = opts->host; + struct instance *instance = opts->instance; + struct simple_connector_data *simple_connector_data = + (struct simple_connector_data *)instance->connector_specific_data; + struct prometheus_remote_write_specific_data *connector_specific_data = + (struct prometheus_remote_write_specific_data *)simple_connector_data->connector_specific_data; + + char name[PROMETHEUS_LABELS_MAX + 1]; + char *suffix = ""; + + prometheus_name_copy(context, rv->name, PROMETHEUS_ELEMENT_MAX); + snprintf(name, PROMETHEUS_LABELS_MAX, "%s_%s%s", instance->config.prefix, context, suffix); + + NETDATA_DOUBLE value = rrdvar2number(rv); + add_variable(connector_specific_data->write_request, name, + (host == localhost) ? instance->config.hostname : host->hostname, value, opts->now / USEC_PER_MS); + } + + return 0; +} + +/** + * Format a variable for Prometheus Remote Write connector + * + * @param rv a variable. + * @param instance an instance data structure. + * @return Always returns 0. + */ +int format_variables_prometheus_remote_write(struct instance *instance, RRDHOST *host) +{ + struct prometheus_remote_write_variables_callback_options opt = { + .host = host, + .instance = instance, + .now = now_realtime_usec(), + }; + + return foreach_host_variable_callback(host, format_variable_prometheus_remote_write_callback, &opt); +} + /** * Format a batch for Prometheus Remote Write connector * @@ -339,7 +392,6 @@ int format_batch_prometheus_remote_write(struct instance *instance) return 1; } buffer->len = data_size; - instance->stats.buffered_bytes = (collected_number)buffer_strlen(buffer); simple_connector_end_batch(instance); diff --git a/exporting/prometheus/remote_write/remote_write.h b/exporting/prometheus/remote_write/remote_write.h index d738f5126..4740772d0 100644 --- a/exporting/prometheus/remote_write/remote_write.h +++ b/exporting/prometheus/remote_write/remote_write.h @@ -11,12 +11,19 @@ struct prometheus_remote_write_specific_data { void *write_request; }; +struct prometheus_remote_write_variables_callback_options { + RRDHOST *host; + time_t now; + struct instance *instance; +}; + int init_prometheus_remote_write_instance(struct instance *instance); extern void clean_prometheus_remote_write(struct instance *instance); int format_host_prometheus_remote_write(struct instance *instance, RRDHOST *host); int format_chart_prometheus_remote_write(struct instance *instance, RRDSET *st); int format_dimension_prometheus_remote_write(struct instance *instance, RRDDIM *rd); +int format_variables_prometheus_remote_write(struct instance *instance, RRDHOST *host); int format_batch_prometheus_remote_write(struct instance *instance); void prometheus_remote_write_prepare_header(struct instance *instance); diff --git a/exporting/prometheus/remote_write/remote_write_request.cc b/exporting/prometheus/remote_write/remote_write_request.cc index cfd61271e..ecfa11fa8 100644 --- a/exporting/prometheus/remote_write/remote_write_request.cc +++ b/exporting/prometheus/remote_write/remote_write_request.cc @@ -137,6 +137,38 @@ void add_metric( sample->set_timestamp(timestamp); } +/** + * Adds a metric to a write request + * + * @param write_request_p the write request + * @param name the name of the metric + * @param instance the name of the host, the metric belongs to + * @param value the value of the metric + * @param timestamp the timestamp for the metric in milliseconds + */ +void add_variable( + void *write_request_p, const char *name, const char *instance, const double value, const int64_t timestamp) +{ + WriteRequest *write_request = (WriteRequest *)write_request_p; + TimeSeries *timeseries; + Sample *sample; + Label *label; + + timeseries = write_request->add_timeseries(); + + label = timeseries->add_labels(); + label->set_name("__name__"); + label->set_value(name); + + label = timeseries->add_labels(); + label->set_name("instance"); + label->set_value(instance); + + sample = timeseries->add_samples(); + sample->set_value(value); + sample->set_timestamp(timestamp); +} + /** * Gets the size of a write request * diff --git a/exporting/prometheus/remote_write/remote_write_request.h b/exporting/prometheus/remote_write/remote_write_request.h index 5f242b941..b25370133 100644 --- a/exporting/prometheus/remote_write/remote_write_request.h +++ b/exporting/prometheus/remote_write/remote_write_request.h @@ -20,6 +20,9 @@ void add_metric( const char *name, const char *chart, const char *family, const char *dimension, const char *instance, const double value, const int64_t timestamp); +void add_variable( + void *write_request_p, const char *name, const char *instance, const double value, const int64_t timestamp); + size_t get_write_request_size(void *write_request_p); int pack_and_clear_write_request(void *write_request_p, char *buffer, size_t *size); diff --git a/exporting/pubsub/pubsub.c b/exporting/pubsub/pubsub.c index 5a5afbdc2..b218338f1 100644 --- a/exporting/pubsub/pubsub.c +++ b/exporting/pubsub/pubsub.c @@ -23,6 +23,7 @@ int init_pubsub_instance(struct instance *instance) instance->metric_formatting = format_dimension_stored_json_plaintext; instance->end_chart_formatting = NULL; + instance->variables_formatting = NULL; instance->end_host_formatting = flush_host_labels; instance->end_batch_formatting = NULL; diff --git a/exporting/read_config.c b/exporting/read_config.c index b834e867d..1cba16826 100644 --- a/exporting/read_config.c +++ b/exporting/read_config.c @@ -399,6 +399,11 @@ struct engine *read_exporting_config() else tmp_instance->config.options &= ~EXPORTING_OPTION_SEND_NAMES; + if (exporter_get_boolean(instance_name, "send variables", CONFIG_BOOLEAN_YES)) + tmp_instance->config.options |= EXPORTING_OPTION_SEND_VARIABLES; + else + tmp_instance->config.options &= ~EXPORTING_OPTION_SEND_VARIABLES; + if (tmp_instance->config.type == EXPORTING_CONNECTOR_TYPE_PROMETHEUS_REMOTE_WRITE) { struct prometheus_remote_write_specific_config *connector_specific_config = callocz(1, sizeof(struct prometheus_remote_write_specific_config)); diff --git a/exporting/tests/exporting_doubles.c b/exporting/tests/exporting_doubles.c index b8c9f3756..75ab7ba43 100644 --- a/exporting/tests/exporting_doubles.c +++ b/exporting/tests/exporting_doubles.c @@ -52,11 +52,11 @@ int __wrap_mark_scheduled_instances(struct engine *engine) return mock_type(int); } -calculated_number __real_exporting_calculate_value_from_stored_data( +NETDATA_DOUBLE __real_exporting_calculate_value_from_stored_data( struct instance *instance, RRDDIM *rd, time_t *last_timestamp); -calculated_number __wrap_exporting_calculate_value_from_stored_data( +NETDATA_DOUBLE __wrap_exporting_calculate_value_from_stored_data( struct instance *instance, RRDDIM *rd, time_t *last_timestamp) @@ -67,7 +67,7 @@ calculated_number __wrap_exporting_calculate_value_from_stored_data( *last_timestamp = 15052; function_called(); - return mock_type(calculated_number); + return mock_type(NETDATA_DOUBLE); } int __real_prepare_buffers(struct engine *engine); @@ -156,6 +156,14 @@ int __mock_end_chart_formatting(struct instance *instance, RRDSET *st) return mock_type(int); } +int __mock_variables_formatting(struct instance *instance, RRDHOST *host) +{ + function_called(); + check_expected_ptr(instance); + check_expected_ptr(host); + return mock_type(int); +} + int __mock_end_host_formatting(struct instance *instance, RRDHOST *host) { function_called(); diff --git a/exporting/tests/exporting_fixtures.c b/exporting/tests/exporting_fixtures.c index 501fc405c..aae1c53fb 100644 --- a/exporting/tests/exporting_fixtures.c +++ b/exporting/tests/exporting_fixtures.c @@ -41,17 +41,9 @@ int setup_rrdhost() localhost->tags = strdupz("TAG1=VALUE1 TAG2=VALUE2"); - struct label *label = calloc(1, sizeof(struct label)); - label->key = strdupz("key1"); - label->value = strdupz("value1"); - label->label_source = LABEL_SOURCE_NETDATA_CONF; - localhost->labels.head = label; - - label = calloc(1, sizeof(struct label)); - label->key = strdupz("key2"); - label->value = strdupz("value2"); - label->label_source = LABEL_SOURCE_AUTO; - localhost->labels.head->next = label; + localhost->host_labels = rrdlabels_create(); + rrdlabels_add(localhost->host_labels, "key1", "value1", RRDLABEL_SRC_CONFIG); + rrdlabels_add(localhost->host_labels, "key2", "value2", RRDLABEL_SRC_CONFIG); localhost->rrdset_root = calloc(1, sizeof(RRDSET)); RRDSET *st = localhost->rrdset_root; @@ -71,13 +63,13 @@ int setup_rrdhost() rd->collections_counter++; rd->next = NULL; - rd->state = calloc(1, sizeof(*rd->state)); - rd->state->query_ops.oldest_time = __mock_rrddim_query_oldest_time; - rd->state->query_ops.latest_time = __mock_rrddim_query_latest_time; - rd->state->query_ops.init = __mock_rrddim_query_init; - rd->state->query_ops.is_finished = __mock_rrddim_query_is_finished; - rd->state->query_ops.next_metric = __mock_rrddim_query_next_metric; - rd->state->query_ops.finalize = __mock_rrddim_query_finalize; + rd->tiers[0] = calloc(1, sizeof(struct rrddim_tier)); + rd->tiers[0]->query_ops.oldest_time = __mock_rrddim_query_oldest_time; + rd->tiers[0]->query_ops.latest_time = __mock_rrddim_query_latest_time; + rd->tiers[0]->query_ops.init = __mock_rrddim_query_init; + rd->tiers[0]->query_ops.is_finished = __mock_rrddim_query_is_finished; + rd->tiers[0]->query_ops.next_metric = __mock_rrddim_query_next_metric; + rd->tiers[0]->query_ops.finalize = __mock_rrddim_query_finalize; return 0; } @@ -87,19 +79,14 @@ int teardown_rrdhost() RRDDIM *rd = localhost->rrdset_root->dimensions; free((void *)rd->name); free((void *)rd->id); - free(rd->state); + free(rd->tiers[0]); free(rd); RRDSET *st = localhost->rrdset_root; free((void *)st->name); free(st); - free(localhost->labels.head->next->key); - free(localhost->labels.head->next->value); - free(localhost->labels.head->next); - free(localhost->labels.head->key); - free(localhost->labels.head->value); - free(localhost->labels.head); + rrdlabels_destroy(localhost->host_labels); free((void *)localhost->tags); free(localhost); @@ -124,7 +111,7 @@ int teardown_initialized_engine(void **state) struct engine *engine = *state; teardown_rrdhost(); - buffer_free(engine->instance_root->labels); + buffer_free(engine->instance_root->labels_buffer); buffer_free(engine->instance_root->buffer); teardown_configured_engine(state); diff --git a/exporting/tests/netdata_doubles.c b/exporting/tests/netdata_doubles.c index a9a184336..ee36e887a 100644 --- a/exporting/tests/netdata_doubles.c +++ b/exporting/tests/netdata_doubles.c @@ -177,7 +177,7 @@ const char *rrd_memory_mode_name(RRD_MEMORY_MODE id) return RRD_MEMORY_MODE_NONE_NAME; } -calculated_number rrdvar2number(RRDVAR *rv) +NETDATA_DOUBLE rrdvar2number(RRDVAR *rv) { (void)rv; return 0; @@ -196,26 +196,27 @@ void rrdset_update_heterogeneous_flag(RRDSET *st) (void)st; } -time_t __mock_rrddim_query_oldest_time(RRDDIM *rd) +time_t __mock_rrddim_query_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle) { - (void)rd; + (void)db_metric_handle; function_called(); return mock_type(time_t); } -time_t __mock_rrddim_query_latest_time(RRDDIM *rd) +time_t __mock_rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle) { - (void)rd; + (void)db_metric_handle; function_called(); return mock_type(time_t); } -void __mock_rrddim_query_init(RRDDIM *rd, struct rrddim_query_handle *handle, time_t start_time, time_t end_time) +void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type) { - (void)rd; + (void)db_metric_handle; (void)handle; + (void)tier_query_fetch_type; function_called(); check_expected(start_time); @@ -230,13 +231,14 @@ int __mock_rrddim_query_is_finished(struct rrddim_query_handle *handle) return mock_type(int); } -storage_number __mock_rrddim_query_next_metric(struct rrddim_query_handle *handle, time_t *current_time) +STORAGE_POINT __mock_rrddim_query_next_metric(struct rrddim_query_handle *handle) { (void)handle; - (void)current_time; function_called(); - return mock_type(storage_number); + + STORAGE_POINT sp = {}; + return sp; } void __mock_rrddim_query_finalize(struct rrddim_query_handle *handle) @@ -245,3 +247,11 @@ void __mock_rrddim_query_finalize(struct rrddim_query_handle *handle) function_called(); } + +void sql_store_chart_label(uuid_t *chart_uuid, int source_type, char *label, char *value) +{ + (void)chart_uuid; + (void)source_type; + (void)label; + (void)value; +} diff --git a/exporting/tests/test_exporting_engine.c b/exporting/tests/test_exporting_engine.c index 6bb7d2efd..56a28059f 100644 --- a/exporting/tests/test_exporting_engine.c +++ b/exporting/tests/test_exporting_engine.c @@ -307,19 +307,17 @@ static void test_exporting_calculate_value_from_stored_data(void **state) expect_function_call(__mock_rrddim_query_is_finished); will_return(__mock_rrddim_query_is_finished, 0); expect_function_call(__mock_rrddim_query_next_metric); - will_return(__mock_rrddim_query_next_metric, pack_storage_number(27, SN_DEFAULT_FLAGS)); expect_function_call(__mock_rrddim_query_is_finished); will_return(__mock_rrddim_query_is_finished, 0); expect_function_call(__mock_rrddim_query_next_metric); - will_return(__mock_rrddim_query_next_metric, pack_storage_number(45, SN_DEFAULT_FLAGS)); expect_function_call(__mock_rrddim_query_is_finished); will_return(__mock_rrddim_query_is_finished, 1); expect_function_call(__mock_rrddim_query_finalize); - assert_int_equal(__real_exporting_calculate_value_from_stored_data(instance, rd, ×tamp), 36); + assert_float_equal(__real_exporting_calculate_value_from_stored_data(instance, rd, ×tamp), 36, 0.1); } static void test_prepare_buffers(void **state) @@ -381,7 +379,7 @@ static void test_prepare_buffers(void **state) expect_value(__mock_end_batch_formatting, instance, instance); will_return(__mock_end_batch_formatting, 0); - assert_int_equal(__real_prepare_buffers(engine), 0); + __real_prepare_buffers(engine); assert_int_equal(instance->stats.buffered_metrics, 1); @@ -393,7 +391,7 @@ static void test_prepare_buffers(void **state) instance->end_chart_formatting = NULL; instance->end_host_formatting = NULL; instance->end_batch_formatting = NULL; - assert_int_equal(__real_prepare_buffers(engine), 0); + __real_prepare_buffers(engine); assert_int_equal(instance->scheduled, 0); assert_int_equal(instance->after, 2); @@ -705,7 +703,7 @@ static void test_format_host_labels_json_plaintext(void **state) instance->config.options |= EXPORTING_OPTION_SEND_AUTOMATIC_LABELS; assert_int_equal(format_host_labels_json_plaintext(instance, localhost), 0); - assert_string_equal(buffer_tostring(instance->labels), "\"labels\":{\"key1\":\"value1\",\"key2\":\"value2\"},"); + assert_string_equal(buffer_tostring(instance->labels_buffer), "\"labels\":{\"key1\":\"value1\",\"key2\":\"value2\"},"); } static void test_format_host_labels_graphite_plaintext(void **state) @@ -717,7 +715,7 @@ static void test_format_host_labels_graphite_plaintext(void **state) instance->config.options |= EXPORTING_OPTION_SEND_AUTOMATIC_LABELS; assert_int_equal(format_host_labels_graphite_plaintext(instance, localhost), 0); - assert_string_equal(buffer_tostring(instance->labels), ";key1=value1;key2=value2"); + assert_string_equal(buffer_tostring(instance->labels_buffer), ";key1=value1;key2=value2"); } static void test_format_host_labels_opentsdb_telnet(void **state) @@ -729,7 +727,7 @@ static void test_format_host_labels_opentsdb_telnet(void **state) instance->config.options |= EXPORTING_OPTION_SEND_AUTOMATIC_LABELS; assert_int_equal(format_host_labels_opentsdb_telnet(instance, localhost), 0); - assert_string_equal(buffer_tostring(instance->labels), " key1=value1 key2=value2"); + assert_string_equal(buffer_tostring(instance->labels_buffer), " key1=value1 key2=value2"); } static void test_format_host_labels_opentsdb_http(void **state) @@ -741,7 +739,7 @@ static void test_format_host_labels_opentsdb_http(void **state) instance->config.options |= EXPORTING_OPTION_SEND_AUTOMATIC_LABELS; assert_int_equal(format_host_labels_opentsdb_http(instance, localhost), 0); - assert_string_equal(buffer_tostring(instance->labels), ",\"key1\":\"value1\",\"key2\":\"value2\""); + assert_string_equal(buffer_tostring(instance->labels_buffer), ",\"key1\":\"value1\",\"key2\":\"value2\""); } static void test_flush_host_labels(void **state) @@ -749,12 +747,12 @@ static void test_flush_host_labels(void **state) struct engine *engine = *state; struct instance *instance = engine->instance_root; - instance->labels = buffer_create(12); - buffer_strcat(instance->labels, "check string"); - assert_int_equal(buffer_strlen(instance->labels), 12); + instance->labels_buffer = buffer_create(12); + buffer_strcat(instance->labels_buffer, "check string"); + assert_int_equal(buffer_strlen(instance->labels_buffer), 12); assert_int_equal(flush_host_labels(instance, localhost), 0); - assert_int_equal(buffer_strlen(instance->labels), 0); + assert_int_equal(buffer_strlen(instance->labels_buffer), 0); } static void test_create_main_rusage_chart(void **state) @@ -1048,7 +1046,7 @@ static void test_format_host_labels_prometheus(void **state) instance->config.options |= EXPORTING_OPTION_SEND_AUTOMATIC_LABELS; format_host_labels_prometheus(instance, localhost); - assert_string_equal(buffer_tostring(instance->labels), "key1=\"value1\",key2=\"value2\""); + assert_string_equal(buffer_tostring(instance->labels_buffer), "key1=\"value1\",key2=\"value2\""); } static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) @@ -1071,9 +1069,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) assert_string_equal( buffer_tostring(buffer), - "netdata_info{instance=\"test_hostname\",application=\"(null)\",version=\"(null)\"} 1\n" - "netdata_host_tags_info{key1=\"value1\",key2=\"value2\"} 1\n" - "netdata_host_tags{key1=\"value1\",key2=\"value2\"} 1\n" + "netdata_info{instance=\"test_hostname\",application=\"(null)\",version=\"(null)\",key1=\"value1\",key2=\"value2\"} 1\n" "test_prefix_test_context{chart=\"chart_id\",family=\"test_family\",dimension=\"dimension_id\"} 690565856.0000000\n"); buffer_flush(buffer); @@ -1089,9 +1085,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) assert_string_equal( buffer_tostring(buffer), - "netdata_info{instance=\"test_hostname\",application=\"(null)\",version=\"(null)\"} 1\n" - "netdata_host_tags_info{key1=\"value1\",key2=\"value2\"} 1\n" - "netdata_host_tags{key1=\"value1\",key2=\"value2\"} 1\n" + "netdata_info{instance=\"test_hostname\",application=\"(null)\",version=\"(null)\",key1=\"value1\",key2=\"value2\"} 1\n" "# TYPE test_prefix_test_context gauge\n" "test_prefix_test_context{chart=\"chart_name\",family=\"test_family\",dimension=\"dimension_name\"} 690565856.0000000\n"); @@ -1107,9 +1101,7 @@ static void rrd_stats_api_v1_charts_allmetrics_prometheus(void **state) assert_string_equal( buffer_tostring(buffer), - "netdata_info{instance=\"test_hostname\",application=\"(null)\",version=\"(null)\"} 1\n" - "netdata_host_tags_info{instance=\"test_hostname\",key1=\"value1\",key2=\"value2\"} 1\n" - "netdata_host_tags{instance=\"test_hostname\",key1=\"value1\",key2=\"value2\"} 1\n" + "netdata_info{instance=\"test_hostname\",application=\"(null)\",version=\"(null)\",key1=\"value1\",key2=\"value2\"} 1\n" "test_prefix_test_context{chart=\"chart_id\",family=\"test_family\",dimension=\"dimension_id\",instance=\"test_hostname\"} 690565856.0000000\n"); free(localhost->rrdset_root->context); diff --git a/exporting/tests/test_exporting_engine.h b/exporting/tests/test_exporting_engine.h index 800be1b99..ae0b7df9a 100644 --- a/exporting/tests/test_exporting_engine.h +++ b/exporting/tests/test_exporting_engine.h @@ -30,7 +30,14 @@ #include #include #include + +#ifndef UNIT_TESTING +#include +#else +#undef UNIT_TESTING #include +#define UNIT_TESTING +#endif #define MAX_LOG_LINE 1024 extern char log_line[]; @@ -50,11 +57,11 @@ int __wrap_connect_to_one_of( void __rrdhost_check_rdlock(RRDHOST *host, const char *file, const char *function, const unsigned long line); void __rrdset_check_rdlock(RRDSET *st, const char *file, const char *function, const unsigned long line); void __rrd_check_rdlock(const char *file, const char *function, const unsigned long line); -time_t __mock_rrddim_query_oldest_time(RRDDIM *rd); -time_t __mock_rrddim_query_latest_time(RRDDIM *rd); -void __mock_rrddim_query_init(RRDDIM *rd, struct rrddim_query_handle *handle, time_t start_time, time_t end_time); +time_t __mock_rrddim_query_oldest_time(STORAGE_METRIC_HANDLE *db_metric_handle); +time_t __mock_rrddim_query_latest_time(STORAGE_METRIC_HANDLE *db_metric_handle); +void __mock_rrddim_query_init(STORAGE_METRIC_HANDLE *db_metric_handle, struct rrddim_query_handle *handle, time_t start_time, time_t end_time, TIER_QUERY_FETCH tier_query_fetch_type); int __mock_rrddim_query_is_finished(struct rrddim_query_handle *handle); -storage_number __mock_rrddim_query_next_metric(struct rrddim_query_handle *handle, time_t *current_time); +STORAGE_POINT __mock_rrddim_query_next_metric(struct rrddim_query_handle *handle); void __mock_rrddim_query_finalize(struct rrddim_query_handle *handle); // ----------------------------------------------------------------------- @@ -81,11 +88,11 @@ int __wrap_init_connectors(struct engine *engine); int __real_mark_scheduled_instances(struct engine *engine); int __wrap_mark_scheduled_instances(struct engine *engine); -calculated_number __real_exporting_calculate_value_from_stored_data( +NETDATA_DOUBLE __real_exporting_calculate_value_from_stored_data( struct instance *instance, RRDDIM *rd, time_t *last_timestamp); -calculated_number __wrap_exporting_calculate_value_from_stored_data( +NETDATA_DOUBLE __wrap_exporting_calculate_value_from_stored_data( struct instance *instance, RRDDIM *rd, time_t *last_timestamp); @@ -113,6 +120,7 @@ int __mock_start_host_formatting(struct instance *instance, RRDHOST *host); int __mock_start_chart_formatting(struct instance *instance, RRDSET *st); int __mock_metric_formatting(struct instance *instance, RRDDIM *rd); int __mock_end_chart_formatting(struct instance *instance, RRDSET *st); +int __mock_variables_formatting(struct instance *instance, RRDHOST *host); int __mock_end_host_formatting(struct instance *instance, RRDHOST *host); int __mock_end_batch_formatting(struct instance *instance); diff --git a/health/Makefile.am b/health/Makefile.am index d5eb88468..777b35858 100644 --- a/health/Makefile.am +++ b/health/Makefile.am @@ -61,6 +61,7 @@ dist_healthconfig_DATA = \ health.d/megacli.conf \ health.d/memcached.conf \ health.d/memory.conf \ + health.d/ml.conf \ health.d/mysql.conf \ health.d/net.conf \ health.d/netfilter.conf \ diff --git a/health/REFERENCE.md b/health/REFERENCE.md index 3c1e53b2a..d1af74767 100644 --- a/health/REFERENCE.md +++ b/health/REFERENCE.md @@ -895,6 +895,68 @@ lookup: mean -10s of user Since [`z = (x - mean) / stddev`](https://en.wikipedia.org/wiki/Standard_score) we create two input alarms, one for `mean` and one for `stddev` and then use them both as inputs in our final `cpu_user_zscore` alarm. +### Example 8 - [Anomaly rate](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate) based CPU dimensions alarm + +Warning if 5 minute rolling [anomaly rate](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate) for any CPU dimension is above 5%, critical if it goes above 20%: + +```yaml +template: ml_5min_cpu_dims + on: system.cpu + os: linux + hosts: * + lookup: average -5m anomaly-bit foreach * + calc: $this + units: % + every: 30s + warn: $this > (($status >= $WARNING) ? (5) : (20)) + crit: $this > (($status == $CRITICAL) ? (20) : (100)) + info: rolling 5min anomaly rate for each system.cpu dimension +``` + +The `lookup` line will calculate the average anomaly rate of each `system.cpu` dimension over the last 5 minues. In this case +Netdata will create alarms for all dimensions of the chart. + +### Example 9 - [Anomaly rate](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate) based CPU chart alarm + +Warning if 5 minute rolling [anomaly rate](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate) averaged across all CPU dimensions is above 5%, critical if it goes above 20%: + +```yaml +template: ml_5min_cpu_chart + on: system.cpu + os: linux + hosts: * + lookup: average -5m anomaly-bit of * + calc: $this + units: % + every: 30s + warn: $this > (($status >= $WARNING) ? (5) : (20)) + crit: $this > (($status == $CRITICAL) ? (20) : (100)) + info: rolling 5min anomaly rate for system.cpu chart +``` + +The `lookup` line will calculate the average anomaly rate across all `system.cpu` dimensions over the last 5 minues. In this case +Netdata will create one alarm for the chart. + +### Example 10 - [Anomaly rate](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate) based node level alarm + +Warning if 5 minute rolling [anomaly rate](https://learn.netdata.cloud/docs/agent/ml#anomaly-rate) averaged across all ML enabled dimensions is above 5%, critical if it goes above 20%: + +```yaml +template: ml_5min_node + on: anomaly_detection.anomaly_rate + os: linux + hosts: * + lookup: average -5m of anomaly_rate + calc: $this + units: % + every: 30s + warn: $this > (($status >= $WARNING) ? (5) : (20)) + crit: $this > (($status == $CRITICAL) ? (20) : (100)) + info: rolling 5min anomaly rate for all ML enabled dims +``` + +The `lookup` line will use the `anomaly_rate` dimension of the `anomaly_detection.anomaly_rate` ML chart to calculate the average [node level anomaly rate](https://learn.netdata.cloud/docs/agent/ml#node-anomaly-rate) over the last 5 minues. + ## Troubleshooting You can compile Netdata with [debugging](/daemon/README.md#debugging) and then set in `netdata.conf`: diff --git a/health/health.c b/health/health.c index 3c1e5693e..9eb36a9c6 100644 --- a/health/health.c +++ b/health/health.c @@ -11,6 +11,12 @@ static struct { ALARM_ENTRY *tail; // latest } alarm_notifications_in_progress = {NULL, NULL}; +typedef struct active_alerts { + char *name; + time_t last_status_change; + RRDCALC_STATUS status; +} active_alerts_t; + static inline void enqueue_alarm_notify_in_progress(ALARM_ENTRY *ae) { ae->prev_in_progress = NULL; @@ -219,10 +225,6 @@ static void health_reload_host(RRDHOST *host) { * Reload the host configuration for all hosts. */ void health_reload(void) { -#ifdef ENABLE_ACLK - if (netdata_cloud_setting) - aclk_single_update_disable(); -#endif sql_refresh_hashes(); rrd_rdlock(); @@ -234,11 +236,7 @@ void health_reload(void) { rrd_unlock(); #ifdef ENABLE_ACLK if (netdata_cloud_setting) { - aclk_single_update_enable(); - aclk_alarm_reload(); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL aclk_alert_reloaded = 1; -#endif } #endif } @@ -246,13 +244,22 @@ void health_reload(void) { // ---------------------------------------------------------------------------- // health main thread and friends -static inline RRDCALC_STATUS rrdcalc_value2status(calculated_number n) { +static inline RRDCALC_STATUS rrdcalc_value2status(NETDATA_DOUBLE n) { if(isnan(n) || isinf(n)) return RRDCALC_STATUS_UNDEFINED; if(n) return RRDCALC_STATUS_RAISED; return RRDCALC_STATUS_CLEAR; } #define ALARM_EXEC_COMMAND_LENGTH 8192 +#define ACTIVE_ALARMS_LIST_EXAMINE 500 +#define ACTIVE_ALARMS_LIST 15 + +static inline int compare_active_alerts(const void * a, const void * b) { + active_alerts_t *active_alerts_a = (active_alerts_t *)a; + active_alerts_t *active_alerts_b = (active_alerts_t *)b; + + return ( active_alerts_b->last_status_change - active_alerts_a->last_status_change ); +} static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) { ae->flags |= HEALTH_ENTRY_FLAG_PROCESSED; @@ -318,31 +325,28 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) { RRDCALC *rc; EVAL_EXPRESSION *expr=NULL; BUFFER *warn_alarms, *crit_alarms; + active_alerts_t *active_alerts = callocz(ACTIVE_ALARMS_LIST_EXAMINE, sizeof(active_alerts_t)); warn_alarms = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE); crit_alarms = buffer_create(NETDATA_WEB_RESPONSE_INITIAL_SIZE); - for(rc = host->alarms; rc ; rc = rc->next) { + for(rc = host->alarms; rc && (n_warn + n_crit) < ACTIVE_ALARMS_LIST_EXAMINE ; rc = rc->next) { if(unlikely(!rc->rrdset || !rc->rrdset->last_collected_time.tv_sec)) continue; if (unlikely(rc->status == RRDCALC_STATUS_WARNING)) { if (likely(ae->alarm_id != rc->id) || likely(ae->alarm_event_id != rc->next_event_id - 1)) { - if (n_warn) - buffer_strcat(warn_alarms, ","); - buffer_strcat(warn_alarms, rc->name); - buffer_strcat(warn_alarms, "="); - buffer_snprintf(warn_alarms, 11, "%"PRId64"", (int64_t)rc->last_status_change); + active_alerts[n_warn+n_crit].name = rc->name; + active_alerts[n_warn+n_crit].last_status_change = rc->last_status_change; + active_alerts[n_warn+n_crit].status = rc->status; n_warn++; } else if (ae->alarm_id == rc->id) expr = rc->warning; } else if (unlikely(rc->status == RRDCALC_STATUS_CRITICAL)) { if (likely(ae->alarm_id != rc->id) || likely(ae->alarm_event_id != rc->next_event_id - 1)) { - if (n_crit) - buffer_strcat(crit_alarms, ","); - buffer_strcat(crit_alarms, rc->name); - buffer_strcat(crit_alarms, "="); - buffer_snprintf(crit_alarms, 11, "%"PRId64"", (int64_t)rc->last_status_change); + active_alerts[n_warn+n_crit].name = rc->name; + active_alerts[n_warn+n_crit].last_status_change = rc->last_status_change; + active_alerts[n_warn+n_crit].status = rc->status; n_crit++; } else if (ae->alarm_id == rc->id) expr = rc->critical; @@ -352,9 +356,34 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) { } } + if (n_warn+n_crit>1) + qsort (active_alerts, n_warn+n_crit, sizeof(active_alerts_t), compare_active_alerts); + + int count_w = 0, count_c = 0; + while (count_w + count_c < n_warn + n_crit && count_w + count_c < ACTIVE_ALARMS_LIST) { + if (active_alerts[count_w+count_c].status == RRDCALC_STATUS_WARNING) { + if (count_w) + buffer_strcat(warn_alarms, ","); + buffer_strcat(warn_alarms, active_alerts[count_w+count_c].name); + buffer_strcat(warn_alarms, "="); + buffer_snprintf(warn_alarms, 11, "%"PRId64"", (int64_t)active_alerts[count_w+count_c].last_status_change); + count_w++; + } + else if (active_alerts[count_w+count_c].status == RRDCALC_STATUS_CRITICAL) { + if (count_c) + buffer_strcat(crit_alarms, ","); + buffer_strcat(crit_alarms, active_alerts[count_w+count_c].name); + buffer_strcat(crit_alarms, "="); + buffer_snprintf(crit_alarms, 11, "%"PRId64"", (int64_t)active_alerts[count_w+count_c].last_status_change); + count_c++; + } + } + char *edit_command = ae->source ? health_edit_command_from_source(ae->source) : strdupz("UNKNOWN=0=UNKNOWN"); - snprintfz(command_to_run, ALARM_EXEC_COMMAND_LENGTH, "exec %s '%s' '%s' '%u' '%u' '%u' '%lu' '%s' '%s' '%s' '%s' '%s' '" CALCULATED_NUMBER_FORMAT_ZERO "' '" CALCULATED_NUMBER_FORMAT_ZERO "' '%s' '%u' '%u' '%s' '%s' '%s' '%s' '%s' '%s' '%d' '%d' '%s' '%s' '%s' '%s' '%s'", + snprintfz(command_to_run, ALARM_EXEC_COMMAND_LENGTH, "exec %s '%s' '%s' '%u' '%u' '%u' '%lu' '%s' '%s' '%s' '%s' '%s' '" NETDATA_DOUBLE_FORMAT_ZERO + "' '" NETDATA_DOUBLE_FORMAT_ZERO + "' '%s' '%u' '%u' '%s' '%s' '%s' '%s' '%s' '%s' '%d' '%d' '%s' '%s' '%s' '%s' '%s'", exec, recipient, host->registry_hostname, @@ -398,6 +427,7 @@ static inline void health_alarm_execute(RRDHOST *host, ALARM_ENTRY *ae) { freez(edit_command); buffer_free(warn_alarms); buffer_free(crit_alarms); + freez(active_alerts); return; //health_alarm_wait_for_execution done: @@ -419,7 +449,7 @@ static inline void health_alarm_wait_for_execution(ALARM_ENTRY *ae) { } static inline void health_process_notifications(RRDHOST *host, ALARM_ENTRY *ae) { - debug(D_HEALTH, "Health alarm '%s.%s' = " CALCULATED_NUMBER_FORMAT_AUTO " - changed status from %s to %s", + debug(D_HEALTH, "Health alarm '%s.%s' = " NETDATA_DOUBLE_FORMAT_AUTO " - changed status from %s to %s", ae->chart?ae->chart:"NOCHART", ae->name, ae->new_value, rrdcalc_status2string(ae->old_status), @@ -736,7 +766,7 @@ void *health_main(void *ptr) { rrdcalc_labels_unlink(); unsigned int loop = 0; -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK unsigned int marked_aclk_reload_loop = 0; #endif while(!netdata_exit) { @@ -765,7 +795,7 @@ void *health_main(void *ptr) { } } -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK if (aclk_alert_reloaded && !marked_aclk_reload_loop) marked_aclk_reload_loop = loop; #endif @@ -795,6 +825,11 @@ void *health_main(void *ptr) { host->health_delay_up_to = 0; } + // wait until cleanup of obsolete charts on children is complete + if (host != localhost) + if (unlikely(host->trigger_chart_obsoletion_check == 1)) + continue; + if(likely(!host->health_log_fp) && (loop == 1 || loop % cleanup_sql_every_loop == 0)) sql_health_alarm_log_cleanup(host); @@ -818,7 +853,7 @@ void *health_main(void *ptr) { worker_is_busy(WORKER_HEALTH_JOB_ALARM_LOG_ENTRY); time_t now = now_realtime_sec(); ALARM_ENTRY *ae = health_create_alarm_entry( - host, rc->id, rc->next_event_id++, rc->config_hash_id, now, rc->name, rc->rrdset->id, + host, rc->id, rc->next_event_id++, rc->config_hash_id, now, rc->name, rc->rrdset->id, rc->rrdset->context, rc->rrdset->family, rc->classification, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change, rc->value, NAN, rc->status, RRDCALC_STATUS_REMOVED, rc->source, rc->units, rc->info, 0, 0); if (ae) { @@ -828,7 +863,7 @@ void *health_main(void *ptr) { rc->last_status_change = now; rc->last_updated = now; rc->value = NAN; -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK if (netdata_cloud_setting && likely(!aclk_alert_reloaded)) sql_queue_alarm_to_aclk(host, ae, 1); #endif @@ -855,10 +890,12 @@ void *health_main(void *ptr) { /* time_t old_db_timestamp = rc->db_before; */ int value_is_null = 0; - int ret = rrdset2value_api_v1(rc->rrdset, NULL, &rc->value, rc->dimensions, 1, rc->after, - rc->before, rc->group, 0, rc->options, &rc->db_after, - &rc->db_before, &value_is_null, 0 - ); + int ret = rrdset2value_api_v1(rc->rrdset, NULL, &rc->value, rc->dimensions, 1, + rc->after, rc->before, rc->group, NULL, + 0, rc->options, + &rc->db_after,&rc->db_before, + NULL, NULL, NULL, + &value_is_null, NULL, 0, 0); if (unlikely(ret != 200)) { // database lookup failed @@ -898,8 +935,7 @@ void *health_main(void *ptr) { } else rc->rrdcalc_flags &= ~RRDCALC_FLAG_DB_NAN; - debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup gave value " - CALCULATED_NUMBER_FORMAT, host->hostname, rc->chart ? rc->chart : "NOCHART", rc->name, + debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': database lookup gave value " NETDATA_DOUBLE_FORMAT, host->hostname, rc->chart ? rc->chart : "NOCHART", rc->name, rc->value ); } @@ -923,7 +959,7 @@ void *health_main(void *ptr) { rc->rrdcalc_flags &= ~RRDCALC_FLAG_CALC_ERROR; debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': expression '%s' gave value " - CALCULATED_NUMBER_FORMAT + NETDATA_DOUBLE_FORMAT ": %s (source: %s)", host->hostname, rc->chart ? rc->chart : "NOCHART", rc->name, rc->calculation->parsed_as, rc->calculation->result, buffer_tostring(rc->calculation->error_msg), rc->source @@ -972,7 +1008,7 @@ void *health_main(void *ptr) { } else { rc->rrdcalc_flags &= ~RRDCALC_FLAG_WARN_ERROR; debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': warning expression gave value " - CALCULATED_NUMBER_FORMAT + NETDATA_DOUBLE_FORMAT ": %s (source: %s)", host->hostname, rc->chart ? rc->chart : "NOCHART", rc->name, rc->warning->result, buffer_tostring(rc->warning->error_msg), rc->source ); @@ -998,7 +1034,7 @@ void *health_main(void *ptr) { } else { rc->rrdcalc_flags &= ~RRDCALC_FLAG_CRIT_ERROR; debug(D_HEALTH, "Health on host '%s', alarm '%s.%s': critical expression gave value " - CALCULATED_NUMBER_FORMAT + NETDATA_DOUBLE_FORMAT ": %s (source: %s)", host->hostname, rc->chart ? rc->chart : "NOCHART", rc->name, rc->critical->result, buffer_tostring(rc->critical->error_msg), rc->source @@ -1077,7 +1113,7 @@ void *health_main(void *ptr) { ALARM_ENTRY *ae = health_create_alarm_entry( - host, rc->id, rc->next_event_id++, rc->config_hash_id, now, rc->name, rc->rrdset->id, + host, rc->id, rc->next_event_id++, rc->config_hash_id, now, rc->name, rc->rrdset->id, rc->rrdset->context, rc->rrdset->family, rc->classification, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change, rc->old_value, rc->value, rc->status, status, rc->source, rc->units, rc->info, rc->delay_last, @@ -1129,7 +1165,7 @@ void *health_main(void *ptr) { rc->last_repeat = now; if (likely(rc->times_repeat < UINT32_MAX)) rc->times_repeat++; ALARM_ENTRY *ae = health_create_alarm_entry( - host, rc->id, rc->next_event_id++, rc->config_hash_id, now, rc->name, rc->rrdset->id, + host, rc->id, rc->next_event_id++, rc->config_hash_id, now, rc->name, rc->rrdset->id, rc->rrdset->context, rc->rrdset->family, rc->classification, rc->component, rc->type, rc->exec, rc->recipient, now - rc->last_status_change, rc->old_value, rc->value, rc->old_status, rc->status, rc->source, rc->units, rc->info, rc->delay_last, @@ -1178,7 +1214,7 @@ void *health_main(void *ptr) { health_alarm_wait_for_execution(ae); } -#if defined(ENABLE_ACLK) && defined(ENABLE_NEW_CLOUD_PROTOCOL) +#ifdef ENABLE_ACLK if (netdata_cloud_setting && unlikely(aclk_alert_reloaded) && loop > (marked_aclk_reload_loop + 2)) { rrdhost_foreach_read(host) { if (unlikely(!host->health_enabled)) diff --git a/health/health.d/cgroups.conf b/health/health.d/cgroups.conf index aa416c795..4bfe38b65 100644 --- a/health/health.d/cgroups.conf +++ b/health/health.d/cgroups.conf @@ -69,3 +69,73 @@ component: Network info: ratio of average number of received packets for the network interface $family over the last 10 seconds, \ compared to the rate over the last minute to: sysadmin + +# ---------------------------------K8s containers-------------------------------------------- + + template: k8s_cgroup_10min_cpu_usage + on: k8s.cgroup.cpu_limit + class: Utilization + type: Cgroups +component: CPU + os: linux + hosts: * + lookup: average -10m unaligned + units: % + every: 1m + warn: $this > (($status >= $WARNING) ? (75) : (85)) + crit: $this > (($status == $CRITICAL) ? (85) : (95)) + delay: down 15m multiplier 1.5 max 1h + info: average cgroup CPU utilization over the last 10 minutes + to: sysadmin + + template: k8s_cgroup_ram_in_use + on: k8s.cgroup.mem_usage + class: Utilization + type: Cgroups +component: Memory + os: linux + hosts: * + calc: ($ram) * 100 / $memory_limit + units: % + every: 10s + warn: $this > (($status >= $WARNING) ? (80) : (90)) + crit: $this > (($status == $CRITICAL) ? (90) : (98)) + delay: down 15m multiplier 1.5 max 1h + info: cgroup memory utilization + to: sysadmin + +# check for packet storms + +# 1. calculate the rate packets are received in 1m: 1m_received_packets_rate +# 2. do the same for the last 10s +# 3. raise an alarm if the later is 10x or 20x the first +# we assume the minimum packet storm should at least have +# 10000 packets/s, average of the last 10 seconds + + template: k8s_cgroup_1m_received_packets_rate + on: k8s.cgroup.net_packets + class: Workload + type: Cgroups +component: Network + hosts: * + lookup: average -1m unaligned of received + units: packets + every: 10s + info: average number of packets received by the network interface $family over the last minute + + template: k8s_cgroup_10s_received_packets_storm + on: k8s.cgroup.net_packets + class: Workload + type: Cgroups +component: Network + hosts: * + lookup: average -10s unaligned of received + calc: $this * 100 / (($k8s_cgroup_10s_received_packets_storm < 1000)?(1000):($k8s_cgroup_10s_received_packets_storm)) + every: 10s + units: % + warn: $this > (($status >= $WARNING)?(200):(5000)) + crit: $this > (($status == $CRITICAL)?(5000):(6000)) + options: no-clear-notification + info: ratio of average number of received packets for the network interface $family over the last 10 seconds, \ + compared to the rate over the last minute + to: sysadmin diff --git a/health/health.d/go.d.plugin.conf b/health/health.d/go.d.plugin.conf index 8bf84a976..a84ab342f 100644 --- a/health/health.d/go.d.plugin.conf +++ b/health/health.d/go.d.plugin.conf @@ -6,7 +6,7 @@ class: Error type: Netdata component: go.d.plugin - module: * + module: !* * calc: $now - $last_collected_t units: seconds ago every: 10s diff --git a/health/health.d/ml.conf b/health/health.d/ml.conf new file mode 100644 index 000000000..9bcc81e76 --- /dev/null +++ b/health/health.d/ml.conf @@ -0,0 +1,36 @@ +# below are some examples of using the `anomaly-bit` option to define alerts based on anomaly +# rates as opposed to raw metric values. You can read more about the anomaly-bit and Netdata's +# native anomaly detection here: +# https://learn.netdata.cloud/docs/configure/machine-learning#anomaly-bit---100--anomalous-0--normal + +# examples below are commented, you would need to uncomment and adjust as desired to enable them. + +# alert per dimension example +# if anomaly rate is between 5-20% then warning (pick your own threshold that works best via tial and error). +# if anomaly rate is above 20% then critical (pick your own threshold that works best via tial and error). +# template: ml_5min_cpu_dims +# on: system.cpu +# os: linux +# hosts: * +# lookup: average -5m anomaly-bit foreach * +# calc: $this +# units: % +# every: 30s +# warn: $this > (($status >= $WARNING) ? (5) : (20)) +# crit: $this > (($status == $CRITICAL) ? (20) : (100)) +# info: rolling 5min anomaly rate for each system.cpu dimension + +# alert per chart example +# if anomaly rate is between 5-20% then warning (pick your own threshold that works best via tial and error). +# if anomaly rate is above 20% then critical (pick your own threshold that works best via tial and error). +# template: ml_5min_cpu_chart +# on: system.cpu +# os: linux +# hosts: * +# lookup: average -5m anomaly-bit of * +# calc: $this +# units: % +# every: 30s +# warn: $this > (($status >= $WARNING) ? (5) : (20)) +# crit: $this > (($status == $CRITICAL) ? (20) : (100)) +# info: rolling 5min anomaly rate for system.cpu chart \ No newline at end of file diff --git a/health/health.d/python.d.plugin.conf b/health/health.d/python.d.plugin.conf index f3abc588f..e3b3d11cf 100644 --- a/health/health.d/python.d.plugin.conf +++ b/health/health.d/python.d.plugin.conf @@ -6,7 +6,7 @@ class: Error type: Netdata component: python.d.plugin - module: * + module: !* * calc: $now - $last_collected_t units: seconds ago every: 10s diff --git a/health/health.d/ram.conf b/health/health.d/ram.conf index ff5f3ac17..ab382c43b 100644 --- a/health/health.d/ram.conf +++ b/health/health.d/ram.conf @@ -54,7 +54,7 @@ host labels: _is_k8s_node = false component: Memory os: freebsd hosts: * - calc: ($active + $wired + $laundry + $buffers) * 100 / ($active + $wired + $laundry + $buffers - $used_ram_to_ignore + $cache + $free + $inactive) + calc: ($active + $wired + $laundry + $buffers) * 100 / ($active + $wired + $laundry + $buffers + $cache + $free + $inactive) units: % every: 10s warn: $this > (($status >= $WARNING) ? (80) : (90)) @@ -64,13 +64,13 @@ component: Memory to: sysadmin alarm: ram_available - on: system.ram + on: mem.available class: Utilization type: System component: Memory os: freebsd hosts: * - calc: ($free + $inactive + $cache) * 100 / ($free + $active + $inactive + $wired + $cache + $laundry + $buffers) + calc: $avail * 100 / ($system.ram.free + $system.ram.active + $system.ram.inactive + $system.ram.wired + $system.ram.cache + $system.ram.laundry + $system.ram.buffers) units: % every: 10s warn: $this < (($status >= $WARNING) ? (15) : (10)) diff --git a/health/health.d/redis.conf b/health/health.d/redis.conf index dfb771e8c..cad5230c5 100644 --- a/health/health.d/redis.conf +++ b/health/health.d/redis.conf @@ -6,7 +6,7 @@ type: KV Storage component: Redis every: 10s - crit: $rdb_last_bgsave_status != 0 + crit: $last_bgsave != nan AND $last_bgsave != 0 units: ok/failed info: status of the last RDB save operation (0: ok, 1: error) delay: down 5m multiplier 1.5 max 1h @@ -19,8 +19,9 @@ component: Redis type: KV Storage component: Redis every: 10s - warn: $rdb_bgsave_in_progress > 600 - crit: $rdb_bgsave_in_progress > 1200 + calc: $current_bgsave_time + warn: $this > 600 + crit: $this > 1200 units: seconds info: duration of the on-going RDB save operation delay: down 5m multiplier 1.5 max 1h diff --git a/health/health.d/web_log.conf b/health/health.d/web_log.conf index 454e0abef..c33c4664c 100644 --- a/health/health.d/web_log.conf +++ b/health/health.d/web_log.conf @@ -1,218 +1,4 @@ -# ----------------------------------------------------------------------------- -# high level response code alarms - -# the following alarms trigger only when there are enough data. -# we assume there are enough data when: -# -# $1m_requests > 120 -# -# i.e. when there are at least 120 requests during the last minute - - template: 1m_requests - on: web_log.response_statuses - class: Workload - type: Web Server -component: Web log - families: * - lookup: sum -1m unaligned - calc: ($this == 0)?(1):($this) - units: requests - every: 10s - info: number of HTTP requests in the last minute - - template: 1m_successful - on: web_log.response_statuses - class: Workload - type: Web Server -component: Web log - families: * - lookup: sum -1m unaligned of successful_requests - calc: $this * 100 / $1m_requests - units: % - every: 10s - warn: ($1m_requests > 120) ? ($this < (($status >= $WARNING ) ? ( 95 ) : ( 85 )) ) : ( 0 ) - crit: ($1m_requests > 120) ? ($this < (($status == $CRITICAL) ? ( 85 ) : ( 75 )) ) : ( 0 ) - delay: up 2m down 15m multiplier 1.5 max 1h - info: ratio of successful HTTP requests over the last minute (1xx, 2xx, 304, 401) - to: webmaster - - template: 1m_redirects - on: web_log.response_statuses - class: Workload - type: Web Server -component: Web log - families: * - lookup: sum -1m unaligned of redirects - calc: $this * 100 / $1m_requests - units: % - every: 10s - warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING ) ? ( 1 ) : ( 20 )) ) : ( 0 ) - delay: up 2m down 15m multiplier 1.5 max 1h - info: ratio of redirection HTTP requests over the last minute (3xx except 304) - to: webmaster - - template: 1m_bad_requests - on: web_log.response_statuses - class: Errors - type: Web Server -component: Web log - families: * - lookup: sum -1m unaligned of bad_requests - calc: $this * 100 / $1m_requests - units: % - every: 10s - warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING) ? ( 10 ) : ( 30 )) ) : ( 0 ) - delay: up 2m down 15m multiplier 1.5 max 1h - info: ratio of client error HTTP requests over the last minute (4xx except 401) - to: webmaster - - template: 1m_internal_errors - on: web_log.response_statuses - class: Errors - type: Web Server -component: Web log - families: * - lookup: sum -1m unaligned of server_errors - calc: $this * 100 / $1m_requests - units: % - every: 10s - warn: ($1m_requests > 120) ? ($this > (($status >= $WARNING) ? ( 1 ) : ( 2 )) ) : ( 0 ) - crit: ($1m_requests > 120) ? ($this > (($status == $CRITICAL) ? ( 2 ) : ( 5 )) ) : ( 0 ) - delay: up 2m down 15m multiplier 1.5 max 1h - info: ratio of server error HTTP requests over the last minute (5xx) - to: webmaster - -# unmatched lines - -# the following alarms trigger only when there are enough data. -# we assume there are enough data when: -# -# $1m_total_requests > 120 -# -# i.e. when there are at least 120 requests during the last minute - - template: 1m_total_requests - on: web_log.response_codes - class: Workload - type: Web Server -component: Web log - families: * - lookup: sum -1m unaligned - calc: ($this == 0)?(1):($this) - units: requests - every: 10s - info: number of HTTP requests over the last minute - - template: 1m_unmatched - on: web_log.response_codes - class: Errors - type: Web Server -component: Web log - families: * - lookup: sum -1m unaligned of unmatched - calc: $this * 100 / $1m_total_requests - units: % - every: 10s - warn: ($1m_total_requests > 120) ? ($this > 1) : ( 0 ) - delay: up 1m down 5m multiplier 1.5 max 1h - info: percentage of unparsed log lines over the last minute - to: webmaster - -# ----------------------------------------------------------------------------- -# web slow - -# the following alarms trigger only when there are enough data. -# we assume there are enough data when: -# -# $1m_requests > 120 -# -# i.e. when there are at least 120 requests during the last minute - - template: 10m_response_time - on: web_log.response_time - class: Latency - type: System -component: Web log - families: * - lookup: average -10m unaligned of avg - units: ms - every: 30s - info: average HTTP response time over the last 10 minutes - - template: web_slow - on: web_log.response_time - class: Latency - type: Web Server -component: Web log - families: * - lookup: average -1m unaligned of avg - units: ms - every: 10s - green: 500 - red: 1000 - warn: ($1m_requests > 120) ? ($this > $green && $this > ($10m_response_time * 2) ) : ( 0 ) - crit: ($1m_requests > 120) ? ($this > $red && $this > ($10m_response_time * 4) ) : ( 0 ) - delay: down 15m multiplier 1.5 max 1h - info: average HTTP response time over the last minute - options: no-clear-notification - to: webmaster - -# ----------------------------------------------------------------------------- -# web too many or too few requests - -# the following alarms trigger only when there are enough data. -# we assume there are enough data when: -# -# $5m_successful_old > 120 -# -# i.e. when there were at least 120 requests during the 5 minutes starting -# at -10m and ending at -5m - - template: 5m_successful_old - on: web_log.response_statuses - class: Workload - type: Web Server -component: Web log - families: * - lookup: average -5m at -5m unaligned of successful_requests - units: requests/s - every: 30s - info: average number of successful HTTP requests for the 5 minutes starting 10 minutes ago - - template: 5m_successful - on: web_log.response_statuses - class: Workload - type: Web Server -component: Web log - families: * - lookup: average -5m unaligned of successful_requests - units: requests/s - every: 30s - info: average number of successful HTTP requests over the last 5 minutes - - template: 5m_requests_ratio - on: web_log.response_codes - class: Workload - type: Web Server -component: Web log - families: * - calc: ($5m_successful_old > 0)?($5m_successful * 100 / $5m_successful_old):(100) - units: % - every: 30s - warn: ($5m_successful_old > 120) ? ($this > 200 OR $this < 50) : (0) - crit: ($5m_successful_old > 120) ? ($this > 400 OR $this < 25) : (0) - delay: down 15m multiplier 1.5 max 1h - options: no-clear-notification - info: ratio of successful HTTP requests over the last 5 minutes, \ - compared with the previous 5 minutes \ - (clear notification for this alarm will not be sent) - to: webmaster - - - -# ---------------------------------------------------GO-VERSION--------------------------------------------------------- - # unmatched lines # the following alarms trigger only when there are enough data. diff --git a/health/health.h b/health/health.h index f25ae6bc6..3e77c12a7 100644 --- a/health/health.h +++ b/health/health.h @@ -35,7 +35,7 @@ extern void health_init(void); extern void health_reload(void); -extern int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, calculated_number *result); +extern int health_variable_lookup(const char *variable, uint32_t hash, RRDCALC *rc, NETDATA_DOUBLE *result); extern void health_aggregate_alarms(RRDHOST *host, BUFFER *wb, BUFFER* context, RRDCALC_STATUS status); extern void health_alarms2json(RRDHOST *host, BUFFER *wb, int all); extern void health_alarms_values2json(RRDHOST *host, BUFFER *wb, int all); @@ -56,6 +56,7 @@ extern ALARM_ENTRY* health_create_alarm_entry( time_t when, const char *name, const char *chart, + const char *chart_context, const char *family, const char *classification, const char *component, @@ -63,8 +64,8 @@ extern ALARM_ENTRY* health_create_alarm_entry( const char *exec, const char *recipient, time_t duration, - calculated_number old_value, - calculated_number new_value, + NETDATA_DOUBLE old_value, + NETDATA_DOUBLE new_value, RRDCALC_STATUS old_status, RRDCALC_STATUS new_status, const char *source, diff --git a/health/health_config.c b/health/health_config.c index df6d7b609..e1dd32ab1 100644 --- a/health/health_config.c +++ b/health/health_config.c @@ -54,7 +54,9 @@ static inline int rrdcalc_add_alarm_from_config(RRDHOST *host, RRDCALC *rc) { rc->id = rrdcalc_get_unique_id(host, rc->chart, rc->name, &rc->next_event_id); - debug(D_HEALTH, "Health configuration adding alarm '%s.%s' (%u): exec '%s', recipient '%s', green " CALCULATED_NUMBER_FORMAT_AUTO ", red " CALCULATED_NUMBER_FORMAT_AUTO ", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u", + debug(D_HEALTH, "Health configuration adding alarm '%s.%s' (%u): exec '%s', recipient '%s', green " NETDATA_DOUBLE_FORMAT_AUTO + ", red " NETDATA_DOUBLE_FORMAT_AUTO + ", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u", rc->chart?rc->chart:"NOCHART", rc->name, rc->id, @@ -141,7 +143,9 @@ static inline int rrdcalctemplate_add_template_from_config(RRDHOST *host, RRDCAL } } - debug(D_HEALTH, "Health configuration adding template '%s': context '%s', exec '%s', recipient '%s', green " CALCULATED_NUMBER_FORMAT_AUTO ", red " CALCULATED_NUMBER_FORMAT_AUTO ", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u", + debug(D_HEALTH, "Health configuration adding template '%s': context '%s', exec '%s', recipient '%s', green " NETDATA_DOUBLE_FORMAT_AUTO + ", red " NETDATA_DOUBLE_FORMAT_AUTO + ", lookup: group %d, after %d, before %d, options %u, dimensions '%s', for each dimension '%s', update every %d, calculation '%s', warning '%s', critical '%s', source '%s', delay up %d, delay down %d, delay max %d, delay_multiplier %f, warn_repeat_every %u, crit_repeat_every %u", rt->name, (rt->context)?rt->context:"NONE", (rt->exec)?rt->exec:"DEFAULT", @@ -848,7 +852,7 @@ static int health_readfile(const char *filename, void *data) { else if(hash == hash_green && !strcasecmp(key, HEALTH_GREEN_KEY)) { alert_cfg->green = strdupz(value); char *e; - rc->green = str2ld(value, &e); + rc->green = str2ndd(value, &e); if(e && *e) { error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' leaves this string unmatched: '%s'.", line, filename, rc->name, key, e); @@ -857,7 +861,7 @@ static int health_readfile(const char *filename, void *data) { else if(hash == hash_red && !strcasecmp(key, HEALTH_RED_KEY)) { alert_cfg->red = strdupz(value); char *e; - rc->red = str2ld(value, &e); + rc->red = str2ndd(value, &e); if(e && *e) { error("Health configuration at line %zu of file '%s' for alarm '%s' at key '%s' leaves this string unmatched: '%s'.", line, filename, rc->name, key, e); @@ -955,17 +959,17 @@ static int health_readfile(const char *filename, void *data) { } else if(hash == hash_host_label && !strcasecmp(key, HEALTH_HOST_LABEL_KEY)) { alert_cfg->host_labels = strdupz(value); - if(rc->labels) { - if(strcmp(rc->labels, value) != 0) + if(rc->host_labels) { + if(strcmp(rc->host_labels, value) != 0) error("Health configuration at line %zu of file '%s' for alarm '%s' has key '%s' twice, once with value '%s' and later with value '%s'.", line, filename, rc->name, key, value, value); - freez(rc->labels); - simple_pattern_free(rc->splabels); + freez(rc->host_labels); + simple_pattern_free(rc->host_labels_pattern); } - rc->labels = simple_pattern_trim_around_equal(value); - rc->splabels = simple_pattern_create(rc->labels, NULL, SIMPLE_PATTERN_EXACT); + rc->host_labels = simple_pattern_trim_around_equal(value); + rc->host_labels_pattern = simple_pattern_create(rc->host_labels, NULL, SIMPLE_PATTERN_EXACT); } else if(hash == hash_plugin && !strcasecmp(key, HEALTH_PLUGIN_KEY)) { alert_cfg->plugin = strdupz(value); @@ -1097,7 +1101,7 @@ static int health_readfile(const char *filename, void *data) { else if(hash == hash_green && !strcasecmp(key, HEALTH_GREEN_KEY)) { alert_cfg->green = strdupz(value); char *e; - rt->green = str2ld(value, &e); + rt->green = str2ndd(value, &e); if(e && *e) { error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' leaves this string unmatched: '%s'.", line, filename, rt->name, key, e); @@ -1106,7 +1110,7 @@ static int health_readfile(const char *filename, void *data) { else if(hash == hash_red && !strcasecmp(key, HEALTH_RED_KEY)) { alert_cfg->red = strdupz(value); char *e; - rt->red = str2ld(value, &e); + rt->red = str2ndd(value, &e); if(e && *e) { error("Health configuration at line %zu of file '%s' for template '%s' at key '%s' leaves this string unmatched: '%s'.", line, filename, rt->name, key, e); @@ -1204,17 +1208,17 @@ static int health_readfile(const char *filename, void *data) { } else if(hash == hash_host_label && !strcasecmp(key, HEALTH_HOST_LABEL_KEY)) { alert_cfg->host_labels = strdupz(value); - if(rt->labels) { - if(strcmp(rt->labels, value) != 0) + if(rt->host_labels) { + if(strcmp(rt->host_labels, value) != 0) error("Health configuration at line %zu of file '%s' for template '%s' has key '%s' twice, once with value '%s' and later with value '%s'. Using ('%s').", - line, filename, rt->name, key, rt->labels, value, value); + line, filename, rt->name, key, rt->host_labels, value, value); - freez(rt->labels); - simple_pattern_free(rt->splabels); + freez(rt->host_labels); + simple_pattern_free(rt->host_labels_pattern); } - rt->labels = simple_pattern_trim_around_equal(value); - rt->splabels = simple_pattern_create(rt->labels, NULL, SIMPLE_PATTERN_EXACT); + rt->host_labels = simple_pattern_trim_around_equal(value); + rt->host_labels_pattern = simple_pattern_create(rt->host_labels, NULL, SIMPLE_PATTERN_EXACT); } else { error("Health configuration at line %zu of file '%s' for template '%s' has unknown key '%s'.", diff --git a/health/health_json.c b/health/health_json.c index d5285c11e..4e8f43761 100644 --- a/health/health_json.c +++ b/health/health_json.c @@ -29,6 +29,7 @@ void health_alarm_entry2json_nolock(BUFFER *wb, ALARM_ENTRY *ae, RRDHOST *host) "\t\t\"config_hash_id\": \"%s\",\n" "\t\t\"name\": \"%s\",\n" "\t\t\"chart\": \"%s\",\n" + "\t\t\"context\": \"%s\",\n" "\t\t\"family\": \"%s\",\n" "\t\t\"class\": \"%s\",\n" "\t\t\"component\": \"%s\",\n" @@ -65,6 +66,7 @@ void health_alarm_entry2json_nolock(BUFFER *wb, ALARM_ENTRY *ae, RRDHOST *host) , config_hash_id , ae->name , ae->chart + , ae->chart_context , ae->family , ae->classification?ae->classification:"Unknown" , ae->component?ae->component:"Unknown" diff --git a/health/health_log.c b/health/health_log.c index 54f6dc9fc..f0a05531d 100644 --- a/health/health_log.c +++ b/health/health_log.c @@ -74,28 +74,15 @@ inline void health_label_log_save(RRDHOST *host) { if(unlikely(host->health_log_fp)) { BUFFER *wb = buffer_create(1024); - rrdhost_check_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - struct label *l=localhost->labels.head; - while (l != NULL) { - buffer_sprintf(wb,"%s=%s\t ", l->key, l->value); - l = l->next; - } - netdata_rwlock_unlock(&host->labels.labels_rwlock); - - char *write = (char *) buffer_tostring(wb) ; - write[wb->len-2] = '\n'; - write[wb->len-1] = '\0'; + rrdlabels_to_buffer(localhost->host_labels, wb, "", "=", "", "\t ", NULL, NULL, NULL, NULL); + char *write = (char *) buffer_tostring(wb); - if (unlikely(fprintf(host->health_log_fp, "L\t%s" - , write - ) < 0)) + if (unlikely(fprintf(host->health_log_fp, "L\t%s", write) < 0)) error("HEALTH [%s]: failed to save alarm log entry to '%s'. Health data may be lost in case of abnormal restart.", host->hostname, host->health_log_filename); - else { + else host->health_log_entries_written++; - } buffer_free(wb); } @@ -111,7 +98,7 @@ inline void health_alarm_log_save(RRDHOST *host, ALARM_ENTRY *ae) { "\t%08x\t%08x\t%08x" "\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s" "\t%d\t%d\t%d\t%d" - "\t" CALCULATED_NUMBER_FORMAT_AUTO "\t" CALCULATED_NUMBER_FORMAT_AUTO + "\t" NETDATA_DOUBLE_FORMAT_AUTO "\t" NETDATA_DOUBLE_FORMAT_AUTO "\t%016"PRIx64"" "\t%s\t%s\t%s" "\n" @@ -463,6 +450,7 @@ inline ALARM_ENTRY* health_create_alarm_entry( time_t when, const char *name, const char *chart, + const char *chart_context, const char *family, const char *class, const char *component, @@ -470,8 +458,8 @@ inline ALARM_ENTRY* health_create_alarm_entry( const char *exec, const char *recipient, time_t duration, - calculated_number old_value, - calculated_number new_value, + NETDATA_DOUBLE old_value, + NETDATA_DOUBLE new_value, RRDCALC_STATUS old_status, RRDCALC_STATUS new_status, const char *source, @@ -491,6 +479,9 @@ inline ALARM_ENTRY* health_create_alarm_entry( ae->hash_chart = simple_hash(ae->chart); } + if(chart_context) + ae->chart_context = strdupz(chart_context); + uuid_copy(ae->config_hash_id, *((uuid_t *) config_hash_id)); if(family) @@ -596,6 +587,7 @@ inline void health_alarm_log( inline void health_alarm_log_free_one_nochecks_nounlink(ALARM_ENTRY *ae) { freez(ae->name); freez(ae->chart); + freez(ae->chart_context); freez(ae->family); freez(ae->classification); freez(ae->component); diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in index 38a69a0f3..0dfecade5 100755 --- a/health/notifications/alarm-notify.sh.in +++ b/health/notifications/alarm-notify.sh.in @@ -2898,6 +2898,10 @@ if [ -n "$total_crit_alarms" ]; then done <<<"$total_crit_alarms," fi +if (( total_warnings + total_critical > 15 )); then + EXTRA_ALARMS_LIST_TEXT="(Showing latest 15 alerts)" +fi + if [ -n "$edit_command_line" ]; then IFS='=' read -r edit_command line s_host <<<"$edit_command_line" fi @@ -3423,6 +3427,10 @@ Content-Transfer-Encoding: 8bit ${total_critical} critical additional active alert(s) + + +
${EXTRA_ALARMS_LIST_TEXT}
+ diff --git a/health/notifications/msteams/README.md b/health/notifications/msteams/README.md index 14dbe7511..c9a13bac9 100644 --- a/health/notifications/msteams/README.md +++ b/health/notifications/msteams/README.md @@ -1,8 +1,6 @@ # Microsoft Teams diff --git a/libnetdata/Makefile.am b/libnetdata/Makefile.am index 167d05caa..5962323e8 100644 --- a/libnetdata/Makefile.am +++ b/libnetdata/Makefile.am @@ -5,6 +5,7 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in SUBDIRS = \ adaptive_resortable_list \ + arrayalloc \ avl \ buffer \ clocks \ diff --git a/libnetdata/arrayalloc/Makefile.am b/libnetdata/arrayalloc/Makefile.am new file mode 100644 index 000000000..161784b8f --- /dev/null +++ b/libnetdata/arrayalloc/Makefile.am @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +AUTOMAKE_OPTIONS = subdir-objects +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +dist_noinst_DATA = \ + README.md \ + $(NULL) diff --git a/libnetdata/arrayalloc/README.md b/libnetdata/arrayalloc/README.md new file mode 100644 index 000000000..2f21bf3ff --- /dev/null +++ b/libnetdata/arrayalloc/README.md @@ -0,0 +1,7 @@ + + +# Array Allocator + diff --git a/libnetdata/arrayalloc/arrayalloc.c b/libnetdata/arrayalloc/arrayalloc.c new file mode 100644 index 000000000..bdf1384d4 --- /dev/null +++ b/libnetdata/arrayalloc/arrayalloc.c @@ -0,0 +1,335 @@ +#include "../libnetdata.h" +#include "arrayalloc.h" +#include "daemon/common.h" + +// max file size +#define ARAL_MAX_PAGE_SIZE_MMAP (1*1024*1024*1024) + +// max malloc size +#define ARAL_MAX_PAGE_SIZE_MALLOC (10*1024*1024) + +typedef struct arrayalloc_free { + size_t size; + struct arrayalloc_page *page; + struct arrayalloc_free *next; +} ARAL_FREE; + +typedef struct arrayalloc_page { + const char *filename; + size_t size; // the total size of the page + size_t used_elements; // the total number of used elements on this page + uint8_t *data; + ARAL_FREE *free_list; + struct arrayalloc_page *prev; // the prev page on the list + struct arrayalloc_page *next; // the next page on the list +} ARAL_PAGE; + +#define ARAL_NATURAL_ALIGNMENT (sizeof(uintptr_t) * 2) +static inline size_t natural_alignment(size_t size, size_t alignment) { + if(unlikely(size % alignment)) + size = size + alignment - (size % alignment); + + return size; +} + +static void arrayalloc_init(ARAL *ar) { + static netdata_mutex_t mutex = NETDATA_MUTEX_INITIALIZER; + netdata_mutex_lock(&mutex); + + if(!ar->internal.initialized) { + netdata_mutex_init(&ar->internal.mutex); + + long int page_size = sysconf(_SC_PAGE_SIZE); + if (unlikely(page_size == -1)) + ar->internal.natural_page_size = 4096; + else + ar->internal.natural_page_size = page_size; + + // we need to add a page pointer after the element + // so, first align the element size to the pointer size + ar->internal.element_size = natural_alignment(ar->element_size, sizeof(uintptr_t)); + + // then add the size of a pointer to it + ar->internal.element_size += sizeof(uintptr_t); + + // make sure it is at least what we need for an ARAL_FREE slot + if (ar->internal.element_size < sizeof(ARAL_FREE)) + ar->internal.element_size = sizeof(ARAL_FREE); + + // and finally align it to the natural alignment + ar->internal.element_size = natural_alignment(ar->internal.element_size, ARAL_NATURAL_ALIGNMENT); + + // this is where we should write the pointer + ar->internal.page_ptr_offset = ar->internal.element_size - sizeof(uintptr_t); + + if(ar->element_size + sizeof(uintptr_t) > ar->internal.element_size) + fatal("ARRAYALLOC: failed to calculate properly page_ptr_offset: element size %zu, sizeof(uintptr_t) %zu, natural alignment %zu, final element size %zu, page_ptr_offset %zu", + ar->element_size, sizeof(uintptr_t), ARAL_NATURAL_ALIGNMENT, ar->internal.element_size, ar->internal.page_ptr_offset); + + //info("ARRAYALLOC: element size %zu, sizeof(uintptr_t) %zu, natural alignment %zu, final element size %zu, page_ptr_offset %zu", + // ar->element_size, sizeof(uintptr_t), ARAL_NATURAL_ALIGNMENT, ar->internal.element_size, ar->internal.page_ptr_offset); + + if (ar->elements < 10) + ar->elements = 10; + + ar->internal.mmap = (ar->use_mmap && ar->cache_dir && *ar->cache_dir) ? true : false; + ar->internal.max_alloc_size = ar->internal.mmap ? ARAL_MAX_PAGE_SIZE_MMAP : ARAL_MAX_PAGE_SIZE_MALLOC; + + if(ar->internal.max_alloc_size % ar->internal.natural_page_size) + ar->internal.max_alloc_size += ar->internal.natural_page_size - (ar->internal.max_alloc_size % ar->internal.natural_page_size) ; + + if(ar->internal.max_alloc_size % ar->internal.element_size) + ar->internal.max_alloc_size -= ar->internal.max_alloc_size % ar->internal.element_size; + + ar->internal.first_page = NULL; + ar->internal.last_page = NULL; + ar->internal.allocation_multiplier = 1; + ar->internal.file_number = 0; + + if(ar->internal.mmap) { + char filename[FILENAME_MAX + 1]; + snprintfz(filename, FILENAME_MAX, "%s/array_alloc.mmap", *ar->cache_dir); + int r = mkdir(filename, 0775); + if (r != 0 && errno != EEXIST) + fatal("Cannot create directory '%s'", filename); + } + + ar->internal.initialized = true; + } + + netdata_mutex_unlock(&mutex); +} + +#ifdef NETDATA_INTERNAL_CHECKS +static inline void arrayalloc_free_checks(ARAL *ar, ARAL_FREE *fr) { + if(fr->size < ar->internal.element_size) + fatal("ARRAYALLOC: free item of size %zu, less than the expected element size %zu", fr->size, ar->internal.element_size); + + if(fr->size % ar->internal.element_size) + fatal("ARRAYALLOC: free item of size %zu is not multiple to element size %zu", fr->size, ar->internal.element_size); +} +#else +#define arrayalloc_free_checks(ar, fr) debug_dummy() +#endif + +static inline void unlink_page(ARAL *ar, ARAL_PAGE *page) { + if(unlikely(!page)) return; + + if(page->next) + page->next->prev = page->prev; + + if(page->prev) + page->prev->next = page->next; + + if(page == ar->internal.first_page) + ar->internal.first_page = page->next; + + if(page == ar->internal.last_page) + ar->internal.last_page = page->prev; +} + +static inline void link_page_first(ARAL *ar, ARAL_PAGE *page) { + page->prev = NULL; + page->next = ar->internal.first_page; + if(page->next) page->next->prev = page; + + ar->internal.first_page = page; + + if(!ar->internal.last_page) + ar->internal.last_page = page; +} + +static inline void link_page_last(ARAL *ar, ARAL_PAGE *page) { + page->next = NULL; + page->prev = ar->internal.last_page; + if(page->prev) page->prev->next = page; + + ar->internal.last_page = page; + + if(!ar->internal.first_page) + ar->internal.first_page = page; +} + +static inline ARAL_PAGE *find_page_with_allocation(ARAL *ar, void *ptr) { + uintptr_t seeking = (uintptr_t)ptr; + ARAL_PAGE *page; + + for(page = ar->internal.first_page; page ; page = page->next) { + if(unlikely(seeking >= (uintptr_t)page->data && seeking < (uintptr_t)page->data + page->size)) + break; + } + + return page; +} + +static void arrayalloc_increase(ARAL *ar) { + if(unlikely(!ar->internal.initialized)) + arrayalloc_init(ar); + + ARAL_PAGE *page = callocz(1, sizeof(ARAL_PAGE)); + page->size = ar->elements * ar->internal.element_size * ar->internal.allocation_multiplier; + if(page->size > ar->internal.max_alloc_size) + page->size = ar->internal.max_alloc_size; + else + ar->internal.allocation_multiplier *= 2; + + if(ar->internal.mmap) { + ar->internal.file_number++; + char filename[FILENAME_MAX + 1]; + snprintfz(filename, FILENAME_MAX, "%s/array_alloc.mmap/%s.%zu", *ar->cache_dir, ar->filename, ar->internal.file_number); + page->filename = strdupz(filename); + page->data = netdata_mmap(page->filename, page->size, MAP_SHARED, 0); + if (unlikely(!page->data)) + fatal("Cannot allocate arrayalloc buffer of size %zu on filename '%s'", page->size, page->filename); + } + else + page->data = mallocz(page->size); + + // link the free space to its page + ARAL_FREE *fr = (ARAL_FREE *)page->data; + fr->size = page->size; + fr->page = page; + fr->next = NULL; + page->free_list = fr; + + // link the new page at the front of the list of pages + link_page_first(ar, page); + + arrayalloc_free_checks(ar, fr); +} + +static void arrayalloc_lock(ARAL *ar) { + if(!ar->internal.lockless) + netdata_mutex_lock(&ar->internal.mutex); +} + +static void arrayalloc_unlock(ARAL *ar) { + if(!ar->internal.lockless) + netdata_mutex_unlock(&ar->internal.mutex); +} + +ARAL *arrayalloc_create(size_t element_size, size_t elements, const char *filename, char **cache_dir) { + ARAL *ar = callocz(1, sizeof(ARAL)); + ar->element_size = element_size; + ar->elements = elements; + ar->filename = filename; + ar->cache_dir = cache_dir; + return ar; +} + +void *arrayalloc_mallocz(ARAL *ar) { + arrayalloc_lock(ar); + + if(unlikely(!ar->internal.first_page || !ar->internal.first_page->free_list)) + arrayalloc_increase(ar); + + ARAL_PAGE *page = ar->internal.first_page; + ARAL_FREE *fr = page->free_list; + + if(unlikely(!fr)) + fatal("ARRAYALLOC: free item cannot be NULL."); + + if(unlikely(fr->size < ar->internal.element_size)) + fatal("ARRAYALLOC: free item size %zu is smaller than %zu", fr->size, ar->internal.element_size); + + if(fr->size - ar->internal.element_size <= ar->internal.element_size) { + // we are done with this page + page->free_list = NULL; + + if(page != ar->internal.last_page) { + unlink_page(ar, page); + link_page_last(ar, page); + } + } + else { + uint8_t *data = (uint8_t *)fr; + ARAL_FREE *fr2 = (ARAL_FREE *)&data[ar->internal.element_size]; + fr2->page = fr->page; + fr2->size = fr->size - ar->internal.element_size; + fr2->next = fr->next; + page->free_list = fr2; + + arrayalloc_free_checks(ar, fr2); + } + + fr->page->used_elements++; + + // put the page pointer after the element + uint8_t *data = (uint8_t *)fr; + ARAL_PAGE **page_ptr = (ARAL_PAGE **)&data[ar->internal.page_ptr_offset]; + *page_ptr = page; + + arrayalloc_unlock(ar); + return (void *)fr; +} + +void arrayalloc_freez(ARAL *ar, void *ptr) { + if(!ptr) return; + arrayalloc_lock(ar); + + // get the page pointer + ARAL_PAGE *page; + { + uint8_t *data = (uint8_t *)ptr; + ARAL_PAGE **page_ptr = (ARAL_PAGE **)&data[ar->internal.page_ptr_offset]; + page = *page_ptr; + +#ifdef NETDATA_INTERNAL_CHECKS + // make it NULL so that we will fail on double free + // do not enable this on production, because the MMAP file + // will need to be saved again! + *page_ptr = NULL; +#endif + } + +#ifdef NETDATA_INTERNAL_CHECKS + { + // find the page ptr belongs + ARAL_PAGE *page2 = find_page_with_allocation(ar, ptr); + + if(unlikely(page != page2)) + fatal("ARRAYALLOC: page pointers do not match!"); + + if (unlikely(!page2)) + fatal("ARRAYALLOC: free of pointer %p is not in arrayalloc address space.", ptr); + } +#endif + + if(unlikely(!page)) + fatal("ARRAYALLOC: possible corruption or double free of pointer %p", ptr); + + if (unlikely(!page->used_elements)) + fatal("ARRAYALLOC: free of pointer %p is inside a page without any active allocations.", ptr); + + page->used_elements--; + + // make this element available + ARAL_FREE *fr = (ARAL_FREE *)ptr; + fr->page = page; + fr->size = ar->internal.element_size; + fr->next = page->free_list; + page->free_list = fr; + + // if the page is empty, release it + if(!page->used_elements) { + unlink_page(ar, page); + + // free it + if(ar->internal.mmap) { + munmap(page->data, page->size); + if (unlikely(unlink(page->filename) == 1)) + error("Cannot delete file '%s'", page->filename); + freez((void *)page->filename); + } + else + freez(page->data); + + freez(page); + } + else if(page != ar->internal.first_page) { + unlink_page(ar, page); + link_page_first(ar, page); + } + + arrayalloc_unlock(ar); +} diff --git a/libnetdata/arrayalloc/arrayalloc.h b/libnetdata/arrayalloc/arrayalloc.h new file mode 100644 index 000000000..e0e9e7f9f --- /dev/null +++ b/libnetdata/arrayalloc/arrayalloc.h @@ -0,0 +1,35 @@ + +#ifndef ARRAYALLOC_H +#define ARRAYALLOC_H 1 + +#include "../libnetdata.h" + +typedef struct arrayalloc { + size_t element_size; + size_t elements; + const char *filename; + char **cache_dir; + bool use_mmap; + + // private members - do not touch + struct { + bool mmap; + bool lockless; + bool initialized; + size_t element_size; + size_t page_ptr_offset; + size_t file_number; + size_t natural_page_size; + size_t allocation_multiplier; + size_t max_alloc_size; + netdata_mutex_t mutex; + struct arrayalloc_page *first_page; + struct arrayalloc_page *last_page; + } internal; +} ARAL; + +extern ARAL *arrayalloc_create(size_t element_size, size_t elements, const char *filename, char **cache_dir); +extern void *arrayalloc_mallocz(ARAL *ar); +extern void arrayalloc_freez(ARAL *ar, void *ptr); + +#endif // ARRAYALLOC_H diff --git a/libnetdata/buffer/buffer.c b/libnetdata/buffer/buffer.c index 880417551..8a32184f6 100644 --- a/libnetdata/buffer/buffer.c +++ b/libnetdata/buffer/buffer.c @@ -65,9 +65,9 @@ void buffer_char_replace(BUFFER *wb, char from, char to) } // This trick seems to give an 80% speed increase in 32bit systems -// print_calculated_number_llu_r() will just print the digits up to the +// print_number_llu_r() will just print the digits up to the // point the remaining value fits in 32 bits, and then calls -// print_calculated_number_lu_r() to print the rest with 32 bit arithmetic. +// print_number_lu_r() to print the rest with 32 bit arithmetic. inline char *print_number_lu_r(char *str, unsigned long uvalue) { char *wstr = str; @@ -299,7 +299,7 @@ void buffer_sprintf(BUFFER *wb, const char *fmt, ...) } -void buffer_rrd_value(BUFFER *wb, calculated_number value) +void buffer_rrd_value(BUFFER *wb, NETDATA_DOUBLE value) { buffer_need_bytes(wb, 50); @@ -308,7 +308,7 @@ void buffer_rrd_value(BUFFER *wb, calculated_number value) return; } else - wb->len += print_calculated_number(&wb->buffer[wb->len], value); + wb->len += print_netdata_double(&wb->buffer[wb->len], value); // terminate it buffer_need_bytes(wb, 1); diff --git a/libnetdata/buffer/buffer.h b/libnetdata/buffer/buffer.h index ceaeadd9b..42425b4cb 100644 --- a/libnetdata/buffer/buffer.h +++ b/libnetdata/buffer/buffer.h @@ -56,7 +56,7 @@ extern void buffer_reset(BUFFER *wb); extern void buffer_strcat(BUFFER *wb, const char *txt); extern void buffer_fast_strcat(BUFFER *wb, const char *txt, size_t len); -extern void buffer_rrd_value(BUFFER *wb, calculated_number value); +extern void buffer_rrd_value(BUFFER *wb, NETDATA_DOUBLE value); extern void buffer_date(BUFFER *wb, int year, int month, int day, int hours, int minutes, int seconds); extern void buffer_jsdate(BUFFER *wb, int year, int month, int day, int hours, int minutes, int seconds); diff --git a/libnetdata/clocks/clocks.c b/libnetdata/clocks/clocks.c index f0e17b232..e4dca6c8b 100644 --- a/libnetdata/clocks/clocks.c +++ b/libnetdata/clocks/clocks.c @@ -393,7 +393,7 @@ static inline collected_number read_proc_uptime(char *filename) { return 0; } - return (collected_number)(strtold(procfile_lineword(read_proc_uptime_ff, 0, 0), NULL) * 1000.0); + return (collected_number)(strtondd(procfile_lineword(read_proc_uptime_ff, 0, 0), NULL) * 1000.0); } inline collected_number uptime_msec(char *filename){ diff --git a/libnetdata/config/appconfig.c b/libnetdata/config/appconfig.c index 0272877bf..1288366da 100644 --- a/libnetdata/config/appconfig.c +++ b/libnetdata/config/appconfig.c @@ -462,15 +462,15 @@ long long appconfig_get_number(struct config *root, const char *section, const c return strtoll(s, NULL, 0); } -LONG_DOUBLE appconfig_get_float(struct config *root, const char *section, const char *name, LONG_DOUBLE value) +NETDATA_DOUBLE appconfig_get_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value) { char buffer[100], *s; - sprintf(buffer, "%0.5" LONG_DOUBLE_MODIFIER, value); + sprintf(buffer, "%0.5" NETDATA_DOUBLE_MODIFIER, value); s = appconfig_get(root, section, name, buffer); if(!s) return value; - return str2ld(s, NULL); + return str2ndd(s, NULL); } static inline int appconfig_test_boolean_value(char *s) { @@ -588,10 +588,10 @@ long long appconfig_set_number(struct config *root, const char *section, const c return value; } -LONG_DOUBLE appconfig_set_float(struct config *root, const char *section, const char *name, LONG_DOUBLE value) +NETDATA_DOUBLE appconfig_set_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value) { char buffer[100]; - sprintf(buffer, "%0.5" LONG_DOUBLE_MODIFIER, value); + sprintf(buffer, "%0.5" NETDATA_DOUBLE_MODIFIER, value); appconfig_set(root, section, name, buffer); @@ -805,6 +805,18 @@ void appconfig_generate(struct config *root, BUFFER *wb, int only_changed) struct section *co; struct config_option *cv; + { + int found_host_labels = 0; + for (co = root->first_section; co; co = co->next) + if(!strcmp(co->name, CONFIG_SECTION_HOST_LABEL)) + found_host_labels = 1; + + if(!found_host_labels) { + appconfig_section_create(root, CONFIG_SECTION_HOST_LABEL); + appconfig_get(root, CONFIG_SECTION_HOST_LABEL, "name", "value"); + } + } + buffer_strcat(wb, "# netdata configuration\n" "#\n" @@ -819,26 +831,27 @@ void appconfig_generate(struct config *root, BUFFER *wb, int only_changed) "#\n" "\n# global netdata configuration\n"); - for(i = 0; i <= 15 ;i++) { + for(i = 0; i <= 16 ;i++) { appconfig_wrlock(root); for(co = root->first_section; co ; co = co->next) { if(!strcmp(co->name, CONFIG_SECTION_GLOBAL)) pri = 0; - else if(!strcmp(co->name, CONFIG_SECTION_DIRECTORIES)) pri = 1; - else if(!strcmp(co->name, CONFIG_SECTION_LOGS)) pri = 2; - else if(!strcmp(co->name, CONFIG_SECTION_ENV_VARS)) pri = 3; - else if(!strcmp(co->name, CONFIG_SECTION_HOST_LABEL)) pri = 4; - else if(!strcmp(co->name, CONFIG_SECTION_SQLITE)) pri = 5; - else if(!strcmp(co->name, CONFIG_SECTION_CLOUD)) pri = 6; - else if(!strcmp(co->name, CONFIG_SECTION_ML)) pri = 7; - else if(!strcmp(co->name, CONFIG_SECTION_HEALTH)) pri = 8; - else if(!strcmp(co->name, CONFIG_SECTION_WEB)) pri = 9; - // by default, new sections will get pri = 10 (set at the end, below) - else if(!strcmp(co->name, CONFIG_SECTION_REGISTRY)) pri = 11; - else if(!strcmp(co->name, CONFIG_SECTION_GLOBAL_STATISTICS)) pri = 12; - else if(!strcmp(co->name, CONFIG_SECTION_PLUGINS)) pri = 13; - else if(!strcmp(co->name, CONFIG_SECTION_STATSD)) pri = 14; - else if(!strncmp(co->name, "plugin:", 7)) pri = 15; // << change the loop too if you change this - else pri = 10; // this is used for any new (currently unknown) sections + else if(!strcmp(co->name, CONFIG_SECTION_DB)) pri = 1; + else if(!strcmp(co->name, CONFIG_SECTION_DIRECTORIES)) pri = 2; + else if(!strcmp(co->name, CONFIG_SECTION_LOGS)) pri = 3; + else if(!strcmp(co->name, CONFIG_SECTION_ENV_VARS)) pri = 4; + else if(!strcmp(co->name, CONFIG_SECTION_HOST_LABEL)) pri = 5; + else if(!strcmp(co->name, CONFIG_SECTION_SQLITE)) pri = 6; + else if(!strcmp(co->name, CONFIG_SECTION_CLOUD)) pri = 7; + else if(!strcmp(co->name, CONFIG_SECTION_ML)) pri = 8; + else if(!strcmp(co->name, CONFIG_SECTION_HEALTH)) pri = 9; + else if(!strcmp(co->name, CONFIG_SECTION_WEB)) pri = 10; + // by default, new sections will get pri = 11 (set at the end, below) + else if(!strcmp(co->name, CONFIG_SECTION_REGISTRY)) pri = 12; + else if(!strcmp(co->name, CONFIG_SECTION_GLOBAL_STATISTICS)) pri = 13; + else if(!strcmp(co->name, CONFIG_SECTION_PLUGINS)) pri = 14; + else if(!strcmp(co->name, CONFIG_SECTION_STATSD)) pri = 15; + else if(!strncmp(co->name, "plugin:", 7)) pri = 16; // << change the loop too if you change this + else pri = 11; // this is used for any new (currently unknown) sections if(i == pri) { int loaded = 0; @@ -904,7 +917,7 @@ int config_parse_duration(const char* string, int* result) { if(!(isdigit(*string) || *string == '+' || *string == '-')) goto fallback; char *e = NULL; - calculated_number n = str2ld(string, &e); + NETDATA_DOUBLE n = str2ndd(string, &e); if(e && *e) { switch (*e) { case 'Y': diff --git a/libnetdata/config/appconfig.h b/libnetdata/config/appconfig.h index f1f61e31d..d72a3140e 100644 --- a/libnetdata/config/appconfig.h +++ b/libnetdata/config/appconfig.h @@ -100,6 +100,8 @@ #define CONFIG_SECTION_HOST_LABEL "host labels" #define EXPORTING_CONF "exporting.conf" #define CONFIG_SECTION_GLOBAL_STATISTICS "global statistics" +#define CONFIG_SECTION_DB "db" + // these are used to limit the configuration names and values lengths // they are not enforced by config.c functions (they will strdup() all strings, no matter of their length) @@ -168,7 +170,7 @@ extern void config_section_unlock(struct section *co); extern char *appconfig_get_by_section(struct section *co, const char *name, const char *default_value); extern char *appconfig_get(struct config *root, const char *section, const char *name, const char *default_value); extern long long appconfig_get_number(struct config *root, const char *section, const char *name, long long value); -extern LONG_DOUBLE appconfig_get_float(struct config *root, const char *section, const char *name, LONG_DOUBLE value); +extern NETDATA_DOUBLE appconfig_get_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value); extern int appconfig_get_boolean_by_section(struct section *co, const char *name, int value); extern int appconfig_get_boolean(struct config *root, const char *section, const char *name, int value); extern int appconfig_get_boolean_ondemand(struct config *root, const char *section, const char *name, int value); @@ -177,7 +179,7 @@ extern int appconfig_get_duration(struct config *root, const char *section, cons extern const char *appconfig_set(struct config *root, const char *section, const char *name, const char *value); extern const char *appconfig_set_default(struct config *root, const char *section, const char *name, const char *value); extern long long appconfig_set_number(struct config *root, const char *section, const char *name, long long value); -extern LONG_DOUBLE appconfig_set_float(struct config *root, const char *section, const char *name, LONG_DOUBLE value); +extern NETDATA_DOUBLE appconfig_set_float(struct config *root, const char *section, const char *name, NETDATA_DOUBLE value); extern int appconfig_set_boolean(struct config *root, const char *section, const char *name, int value); extern int appconfig_exists(struct config *root, const char *section, const char *name); diff --git a/libnetdata/dictionary/README.md b/libnetdata/dictionary/README.md index 28d0cfbbd..879c1bcc1 100644 --- a/libnetdata/dictionary/README.md +++ b/libnetdata/dictionary/README.md @@ -22,7 +22,7 @@ Dictionaries are **ordered**, meaning that the order they have been added is pre Dictionaries guarantee **uniqueness** of all items added to them, meaning that only one item with a given name can exist in the dictionary at any given time. -Dictionaries are extremely fast in all operations. They are indexing the keys with `JudyHS` and they utilize a double-linked-list for the traversal operations. Deletion is the most expensive operation, usually somewhat slower than insertion. +Dictionaries are extremely fast in all operations. They are indexing the keys with `JudyHS` (or `AVL` when `libJudy` is not available) and they utilize a double-linked-list for the traversal operations. Deletion is the most expensive operation, usually somewhat slower than insertion. ## Memory management @@ -31,13 +31,13 @@ Dictionaries come with 2 memory management options: - **Clone** (copy) the name and/or the value to memory allocated by the dictionary. - **Link** the name and/or the value, without allocating any memory about them. -In **clone** mode, the dictionary guarantees that all operations on the dictionary items will automatically take care of the memory used by the name and/or the value. In case the value is an object needs to have user allocated memory, the following callback functions can be registered: +In **clone** mode, the dictionary guarantees that all operations on the dictionary items will automatically take care of the memory used by the name and/or the value. In case the value is an object that needs to have user allocated memory, the following callback functions can be registered: 1.`dictionary_register_insert_callback()` that will be called just after the insertion of an item to the dictionary, or after the replacement of the value of a dictionary item (but while the dictionary is write-locked - if locking is enabled). 2. `dictionary_register_delete_callback()` that will be called just prior to the deletion of an item from the dictionary, or prior to the replacement of the value of a dictionary item (but while the dictionary is write-locked - if locking is enabled). 3. `dictionary_register_conflict_callback()` that will be called when `DICTIONARY_FLAG_DONT_OVERWRITE_VALUE` is set and another value is attempted to be inserted for the same key. -In **link** mode, the name and/or the value are just linked to the dictionary item, and it is the user's responsibility to free the memory used after an item is deleted from the dictionary. +In **link** mode, the name and/or the value are just linked to the dictionary item, and it is the user's responsibility to free the memory they use after an item is deleted from the dictionary or when the dictionary is destroyed. By default, **clone** mode is used for both the name and the value. @@ -63,7 +63,7 @@ The dictionary supports the following operations supported by the hash table: Use `dictionary_create()` to create a dictionary. -Use `dictionary_destroy()` to destroy a dictionary. When destroyed, a dictionary frees all the memory it has allocated on its own. The exception is the registration of a deletion callback function that can be called on deletion of an item, which may free additional resources. +Use `dictionary_destroy()` to destroy a dictionary. When destroyed, a dictionary frees all the memory it has allocated on its own. This can be complemented by the registration of a deletion callback function that can be called upon deletion of each item in the dictionary, which may free additional resources. ### dictionary_set() @@ -72,7 +72,7 @@ This call is used to: - **add** an item to the dictionary. - **reset** the value of an existing item in the dictionary. -If **resetting** is not desired, add `DICTIONARY_FLAG_DONT_OVERWRITE_VALUE` to the flags when creating the dictionary. In this case, `dictionary_set()` will return the value of the original item found in the dictionary instead of resetting it and the value passed to the call will be ignored. +If **resetting** is not desired, add `DICTIONARY_FLAG_DONT_OVERWRITE_VALUE` to the flags when creating the dictionary. In this case, `dictionary_set()` will return the value of the original item found in the dictionary instead of resetting it and the value passed to the call will be ignored. Optionally a conflict callback function can be registered, to manipulate (probably merge or extend) the original value, based on the new value attempted to be added to the dictionary. For **multi-threaded** operation, the `dictionary_set()` calls get an exclusive write lock on the dictionary. @@ -89,14 +89,16 @@ Where: * `value` is a pointer to the value associated with this item. In **clone** mode, if `value` is `NULL`, a new memory allocation will be made of `value_len` size and will be initialized to zero. * `value_len` is the size of the `value` data. If `value_len` is zero, no allocation will be done and the dictionary item will permanently have the `NULL` value. -> **IMPORTANT**
There is also an **unsafe** version (without locks) of this call. This is to be used when traversing the dictionary. It should never be called without an active lock on the dictionary, which can only be acquired while traversing. +> **IMPORTANT**
There is also an **unsafe** version (without locks) of this call. This is to be used when traversing the dictionary in write mode. It should never be called without an active lock on the dictionary, which can only be acquired while traversing. ### dictionary_get() -This call is used to get the value of an item, given its name. It utilizes the JudyHS hash table for making the lookup. +This call is used to get the value of an item, given its name. It utilizes the `JudyHS` hash table for making the lookup. For **multi-threaded** operation, the `dictionary_get()` call gets a shared read lock on the dictionary. +In clone mode, the value returned is not guaranteed to be valid, as any other thread may delete the item from the dictionary at any time. To ensure the value will be available, use `dictionary_get_and_acquire_item()`, which uses a reference counter to defer deletes until the item is released. + The format is: ```c @@ -114,7 +116,7 @@ Where: This call is used to delete an item from the dictionary, given its name. -If there is a delete callback registered to the dictionary (`dictionary_register_delete_callback()`), it is called prior to the actual deletion of the item. +If there is a deletion callback registered to the dictionary (`dictionary_register_delete_callback()`), it is called prior to the actual deletion of the item. For **multi-threaded** operation, the `dictionary_del()` calls get an exclusive write lock on the dictionary. @@ -131,29 +133,65 @@ Where: > **IMPORTANT**
There is also an **unsafe** version (without locks) of this call. This is to be used when traversing the dictionary, to delete the current item. It should never be called without an active lock on the dictionary, which can only be acquired while traversing. +### dictionary_get_and_acquire_item() + +This call can be used the search and get a dictionary item, while ensuring that it will be available for use, until `dictionary_acquired_item_release()` is called. + +This call **does not return the value** of the dictionary item. It returns an internal pointer to a structure that maintains the reference counter used to protect the actual value. To get the value of the item (the same value as returned by `dictionary_get()`), the function `dictionary_acquired_item_value()` has to be called. + +Example: + +```c +// create the dictionary +DICTIONARY *dict = dictionary_create(DICTIONARY_FLAGS_NONE); + +// add an item to it +dictionary_set(dict, "name", "value", 6); + +// find the item we added and acquire it +void *item = dictionary_get_and_acquire_item(dict, "name"); + +// extract its value +char *value = (char *)dictionary_acquired_item_value(dict, item); + +// now value points to the string "value" +printf("I got value = '%s'\n", value); + +// release the item, so that it can deleted +dictionary_acquired_item_release(dict, item); + +// destroy the dictionary +dictionary_destroy(dict); +``` + +When items are acquired, a reference counter is maintained to keep track of how many users exist for it. If an item with a non-zero number of users is deleted, it is removed from the index, it can be added again to the index (without conflict), and although it exists in the linked-list, it is not offered during traversal. Garbage collection to actually delete the item happens every time a write-locked dictionary is unlocked (just before the unlock) and items are deleted only if no users are using them. + +If any item is still acquired when the dictionary is destroyed, the destruction of the dictionary is also deferred until all the acquired items are released. When the dictionary is destroyed like that, all operations on the dictionary fail (traversals do not traverse, insertions do not insert, deletions do not delete, searches do not find any items, etc). Once the last item in the dictionary is released, the dictionary is automatically destroyed too. + ## Traversal -Dictionaries offer 2 ways to traverse the entire dictionary: +Dictionaries offer 3 ways to traverse the entire dictionary: - **walkthrough**, implemented by setting a callback function to be called for every item. +- **sorted walkthrough**, which first sorts the dictionary and then call a callback function for every item. - **foreach**, a way to traverse the dictionary with a for-next loop. -Both of these methods are available in **read** or **write** mode. In **read** mode only lookups are allowed to the dictionary. In **write** both lookups but also deletion of the currently working item is also allowed. +All these methods are available in **read** or **write** mode. In **read** mode only lookups are allowed to the dictionary. In **write** lookups but also insertions and deletions are allowed. -While traversing the dictionary with any of these methods, all calls to the dictionary have to use the `_unsafe` versions of the function calls, otherwise deadlock may arise. +While traversing the dictionary with any of these methods, all calls to the dictionary have to use the `_unsafe` versions of the function calls, otherwise deadlocks may arise. > **IMPORTANT**
The dictionary itself does not check to ensure that a user is actually using the right lock mode (read or write) while traversing the dictionary for each of the unsafe calls. ### walkthrough (callback) -There are 2 calls: +There are 4 calls: -- `dictionary_walkthrough_read()` that acquires a shared read lock, and it calls a callback function for every item of the dictionary. The callback function may use the unsafe versions of the `dictionary_get()` calls to lookup other items in the dictionary, but it should not add or remove item from the dictionary. -- `dictionary_walkthrough_write()` that acquires an exclusive write lock, and it calls a callback function for every item of the dictionary. This is to be used when items need to be added to the dictionary, or when the current item may need to be deleted. If the callback function deletes any other items, the behavior may be undefined (actually, the item next to the one currently working should not be deleted - a pointer to it is held by the traversal function to move on traversing the dictionary). +- `dictionary_walkthrough_read()` and `dictionary_sorted_walkthrough_read()` that acquire a shared read lock, and they call a callback function for every item of the dictionary. The callback function may use the unsafe versions of the `dictionary_get()` calls to lookup other items in the dictionary, but it should not attempt to add or remove items to/from the dictionary. +- `dictionary_walkthrough_write()` and `dictionary_sorted_walkthrough_write()` that acquire an exclusive write lock, and they call a callback function for every item of the dictionary. This is to be used when items need to be added to or removed from the dictionary. The `write` versions can be used to delete any or all the items from the dictionary, including the currently working one. For the `sorted` version, all items in the dictionary maintain a reference counter, so all deletions are deferred until the sorted walkthrough finishes.** -The items are traversed in the same order they have been added to the dictionary (or the reverse order if the flag `DICTIONARY_FLAG_ADD_IN_FRONT` is set during dictionary creation). +The non sorted versions traverse the items in the same order they have been added to the dictionary (or the reverse order if the flag `DICTIONARY_FLAG_ADD_IN_FRONT` is set during dictionary creation). The sorted versions sort alphabetically the items based on their name, and then they traverse them in the sorted order. -The callback function returns an `int`. If this value is negative, traversal of the dictionary is stopped immediately and the negative value is returned to the caller. If the returned value of all callbacks is zero or positive, the walkthrough functions return the sum of the return values of all callbacks. So, if you are just interested to know how many items fall into some condition, write a callback function that returns 1 when the item satisfies that condition and 0 when it does not and the walkthrough function will return how many tested positive. +The callback function returns an `int`. If this value is negative, traversal of the dictionary is stopped immediately and the negative value is returned to the caller. If the returned value of all callback calls is zero or positive, the walkthrough functions return the sum of the return values of all callbacks. So, if you are just interested to know how many items fall into some condition, write a callback function that returns 1 when the item satisfies that condition and 0 when it does not and the walkthrough function will return how many tested positive. ### foreach (for-next loop) @@ -186,14 +224,14 @@ else something else; ``` -In the above, the `if(x)` condition will work as expected. It will do the foreach loop when x is 1, otherwise it will run `something else`. +In the above, the `if(x == 1)` condition will work as expected. It will do the foreach loop when x is 1, otherwise it will run `something else`. There are 2 versions of `dfe_start`: - `dfe_start_read()` that acquires a shared read lock to the dictionary. - `dfe_start_write()` that acquires an exclusive write lock to the dictionary. -While in the loop, depending on the read or write versions of `dfe_start`, the caller may lookup or manipulate the dictionary. The rules are the same with the walkthrough callback functions. +While in the loop, depending on the read or write versions of `dfe_start`, the caller may lookup or manipulate the dictionary using the unsafe functions. The rules are the same with the unsorted walkthrough callback functions. PS: DFE is Dictionary For Each. diff --git a/libnetdata/dictionary/dictionary.c b/libnetdata/dictionary/dictionary.c index 42285037d..c1325ecb5 100644 --- a/libnetdata/dictionary/dictionary.c +++ b/libnetdata/dictionary/dictionary.c @@ -1,7 +1,12 @@ // SPDX-License-Identifier: GPL-3.0-or-later -// NOT TO BE USED BY USERS YET -#define DICTIONARY_FLAG_REFERENCE_COUNTERS (1 << 6) // maintain reference counter in walkthrough and foreach +// NOT TO BE USED BY USERS +#define DICTIONARY_FLAG_EXCLUSIVE_ACCESS (1 << 29) // there is only one thread accessing the dictionary +#define DICTIONARY_FLAG_DESTROYED (1 << 30) // this dictionary has been destroyed +#define DICTIONARY_FLAG_DEFER_ALL_DELETIONS (1 << 31) // defer all deletions of items in the dictionary + +// our reserved flags that cannot be set by users +#define DICTIONARY_FLAGS_RESERVED (DICTIONARY_FLAG_EXCLUSIVE_ACCESS|DICTIONARY_FLAG_DESTROYED|DICTIONARY_FLAG_DEFER_ALL_DELETIONS) typedef struct dictionary DICTIONARY; #define DICTIONARY_INTERNALS @@ -19,99 +24,49 @@ typedef struct dictionary DICTIONARY; #include #endif -/* - * This version uses JudyHS arrays to index the dictionary - * - * The following output is from the unit test, at the end of this file: - * - * This is the JudyHS version: - * - * 1000000 x dictionary_set() (dictionary size 0 entries, 0 KB)... - * 1000000 x dictionary_get(existing) (dictionary size 1000000 entries, 74001 KB)... - * 1000000 x dictionary_get(non-existing) (dictionary size 1000000 entries, 74001 KB)... - * Walking through the dictionary (dictionary size 1000000 entries, 74001 KB)... - * 1000000 x dictionary_del(existing) (dictionary size 1000000 entries, 74001 KB)... - * 1000000 x dictionary_set() (dictionary size 0 entries, 0 KB)... - * Destroying dictionary (dictionary size 1000000 entries, 74001 KB)... - * - * TIMINGS: - * adding 316027 usec, positive search 156740 usec, negative search 84524, walk through 15036 usec, deleting 361444, destroy 107394 usec - * - * This is from the JudySL version: - * - * Creating dictionary of 1000000 entries... - * Checking index of 1000000 entries... - * Walking 1000000 entries and checking name-value pairs... - * Created and checked 1000000 entries, found 0 errors - used 58376 KB of memory - * Destroying dictionary of 1000000 entries... - * Deleted 1000000 entries - * create 338975 usec, check 156080 usec, walk 80764 usec, destroy 444569 usec - * - * This is the AVL version: - * - * Creating dictionary of 1000000 entries... - * Checking index of 1000000 entries... - * Walking 1000000 entries and checking name-value pairs... - * Created and checked 1000000 entries, found 0 errors - used 89626 KB of memory - * Destroying dictionary of 1000000 entries... - * create 413892 usec, check 220006 usec, walk 34247 usec, destroy 98062 usec - * - * So, the JudySL is a lot slower to WALK and DESTROY (DESTROY does a WALK) - * It is slower, because for every item, JudySL copies the KEY/NAME to a - * caller supplied buffer (Index). So, by just walking over 1 million items, - * JudySL does 1 million strcpy() !!! - * - * It also seems that somehow JudySLDel() is unbelievably slow too! - * - */ +typedef enum name_value_flags { + NAME_VALUE_FLAG_NONE = 0, + NAME_VALUE_FLAG_NAME_IS_ALLOCATED = (1 << 0), // the name pointer is a STRING + NAME_VALUE_FLAG_DELETED = (1 << 1), // this item is deleted, so it is not available for traversal + NAME_VALUE_FLAG_NEW_OR_UPDATED = (1 << 2), // this item is new or just updated (used by the react callback) + // IMPORTANT: IF YOU ADD ANOTHER FLAG, YOU NEED TO ALLOCATE ANOTHER BIT TO FLAGS IN NAME_VALUE !!! +} NAME_VALUE_FLAGS; /* * Every item in the dictionary has the following structure. */ + typedef struct name_value { #ifdef DICTIONARY_WITH_AVL avl_t avl_node; #endif +#ifdef NETDATA_INTERNAL_CHECKS + DICTIONARY *dict; +#endif + struct name_value *next; // a double linked list to allow fast insertions and deletions struct name_value *prev; - char *name; // the name of the dictionary item + uint32_t refcount; // the reference counter + uint32_t value_len:29; // the size of the value (assumed binary) + uint8_t flags:3; // the flags for this item + void *value; // the value of the dictionary item + union { + STRING *string_name; // the name of the dictionary item + char *caller_name; // the user supplied string pointer + }; } NAME_VALUE; -/* - * When DICTIONARY_FLAG_WITH_STATISTICS is set, we need to keep track of all the memory - * we allocate and free. So, we need to keep track of the sizes of all names and values. - * We do this by overloading NAME_VALUE with the following additional fields. - */ - -typedef enum name_value_flags { - NAME_VALUE_FLAG_NONE = 0, - NAME_VALUE_FLAG_DELETED = (1 << 0), // this item is deleted -} NAME_VALUE_FLAGS; - -typedef struct name_value_with_stats { - NAME_VALUE name_value_data_here; // never used - just to put the lengths at the right position - - size_t name_len; // the size of the name, including the terminating zero - size_t value_len; // the size of the value (assumed binary) - - size_t refcount; // the reference counter - NAME_VALUE_FLAGS flags; // the flags for this item -} NAME_VALUE_WITH_STATS; - -struct dictionary_stats { - size_t inserts; - size_t deletes; - size_t searches; - size_t resets; - size_t entries; - size_t memory; -}; - struct dictionary { +#ifdef NETDATA_INTERNAL_CHECKS + const char *creation_function; + const char *creation_file; + size_t creation_line; +#endif + DICTIONARY_FLAGS flags; // the flags of the dictionary NAME_VALUE *first_item; // the double linked list base pointers @@ -120,26 +75,51 @@ struct dictionary { #ifdef DICTIONARY_WITH_AVL avl_tree_type values_index; NAME_VALUE *hash_base; + void *(*get_thread_static_name_value)(const char *name); #endif #ifdef DICTIONARY_WITH_JUDYHS Pvoid_t JudyHSArray; // the hash table #endif - netdata_rwlock_t *rwlock; // the r/w lock when DICTIONARY_FLAG_SINGLE_THREADED is not set + netdata_rwlock_t rwlock; // the r/w lock when DICTIONARY_FLAG_SINGLE_THREADED is not set void (*ins_callback)(const char *name, void *value, void *data); void *ins_callback_data; + void (*react_callback)(const char *name, void *value, void *data); + void *react_callback_data; + void (*del_callback)(const char *name, void *value, void *data); void *del_callback_data; void (*conflict_callback)(const char *name, void *old_value, void *new_value, void *data); void *conflict_callback_data; - struct dictionary_stats *stats; // the statistics when DICTIONARY_FLAG_WITH_STATISTICS is set + size_t version; // the current version of the dictionary + size_t inserts; // how many index insertions have been performed + size_t deletes; // how many index deletions have been performed + size_t searches; // how many index searches have been performed + size_t resets; // how many times items have reset their values + size_t walkthroughs; // how many walkthroughs have been done + long int memory; // how much memory the dictionary has currently allocated + long int entries; // how many items are currently in the index (the linked list may have more) + long int referenced_items; // how many items of the dictionary are currently being used by 3rd parties + long int pending_deletion_items; // how many items of the dictionary have been deleted, but have not been removed yet + int readers; // how many readers are currently using the dictionary + int writers; // how many writers are currently using the dictionary + + size_t scratchpad_size; // the size of the scratchpad in bytes + uint8_t scratchpad[]; // variable size scratchpad requested by the caller }; +static inline void linkedlist_namevalue_unlink_unsafe(DICTIONARY *dict, NAME_VALUE *nv); +static size_t namevalue_destroy_unsafe(DICTIONARY *dict, NAME_VALUE *nv); +static inline const char *namevalue_get_name(NAME_VALUE *nv); + +// ---------------------------------------------------------------------------- +// callbacks registration + void dictionary_register_insert_callback(DICTIONARY *dict, void (*ins_callback)(const char *name, void *value, void *data), void *data) { dict->ins_callback = ins_callback; dict->ins_callback_data = data; @@ -155,63 +135,156 @@ void dictionary_register_conflict_callback(DICTIONARY *dict, void (*conflict_cal dict->conflict_callback_data = data; } +void dictionary_register_react_callback(DICTIONARY *dict, void (*react_callback)(const char *name, void *value, void *data), void *data) { + dict->react_callback = react_callback; + dict->react_callback_data = data; +} + // ---------------------------------------------------------------------------- // dictionary statistics maintenance -size_t dictionary_stats_allocated_memory(DICTIONARY *dict) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) - return dict->stats->memory; - return 0; +long int dictionary_stats_allocated_memory(DICTIONARY *dict) { + return dict->memory; } -size_t dictionary_stats_entries(DICTIONARY *dict) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) - return dict->stats->entries; - return 0; +long int dictionary_stats_entries(DICTIONARY *dict) { + return dict->entries; +} +size_t dictionary_stats_version(DICTIONARY *dict) { + return dict->version; } size_t dictionary_stats_searches(DICTIONARY *dict) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) - return dict->stats->searches; - return 0; + return dict->searches; } size_t dictionary_stats_inserts(DICTIONARY *dict) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) - return dict->stats->inserts; - return 0; + return dict->inserts; } size_t dictionary_stats_deletes(DICTIONARY *dict) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) - return dict->stats->deletes; - return 0; + return dict->deletes; } size_t dictionary_stats_resets(DICTIONARY *dict) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) - return dict->stats->resets; - return 0; + return dict->resets; +} +size_t dictionary_stats_walkthroughs(DICTIONARY *dict) { + return dict->walkthroughs; +} +size_t dictionary_stats_referenced_items(DICTIONARY *dict) { + return __atomic_load_n(&dict->referenced_items, __ATOMIC_SEQ_CST); } static inline void DICTIONARY_STATS_SEARCHES_PLUS1(DICTIONARY *dict) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) - dict->stats->searches++; + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) { + dict->searches++; + } + else { + __atomic_fetch_add(&dict->searches, 1, __ATOMIC_RELAXED); + } } static inline void DICTIONARY_STATS_ENTRIES_PLUS1(DICTIONARY *dict, size_t size) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - dict->stats->inserts++; - dict->stats->entries++; - dict->stats->memory += size; + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) { + dict->version++; + dict->inserts++; + dict->entries++; + dict->memory += (long)size; + } + else { + __atomic_fetch_add(&dict->version, 1, __ATOMIC_SEQ_CST); + __atomic_fetch_add(&dict->inserts, 1, __ATOMIC_RELAXED); + __atomic_fetch_add(&dict->entries, 1, __ATOMIC_RELAXED); + __atomic_fetch_add(&dict->memory, (long)size, __ATOMIC_RELAXED); + } +} +static inline void DICTIONARY_STATS_ENTRIES_MINUS1(DICTIONARY *dict) { + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) { + dict->version++; + dict->deletes++; + dict->entries--; + } + else { + __atomic_fetch_add(&dict->version, 1, __ATOMIC_SEQ_CST); + __atomic_fetch_add(&dict->deletes, 1, __ATOMIC_RELAXED); + __atomic_fetch_sub(&dict->entries, 1, __ATOMIC_RELAXED); } } -static inline void DICTIONARY_STATS_ENTRIES_MINUS1(DICTIONARY *dict, size_t size) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - dict->stats->deletes++; - dict->stats->entries--; - dict->stats->memory -= size; +static inline void DICTIONARY_STATS_ENTRIES_MINUS_MEMORY(DICTIONARY *dict, size_t size) { + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) { + dict->memory -= (long)size; + } + else { + __atomic_fetch_sub(&dict->memory, (long)size, __ATOMIC_RELAXED); } } static inline void DICTIONARY_STATS_VALUE_RESETS_PLUS1(DICTIONARY *dict, size_t oldsize, size_t newsize) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - dict->stats->resets++; - dict->stats->memory += newsize; - dict->stats->memory -= oldsize; + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) { + dict->version++; + dict->resets++; + dict->memory += (long)newsize; + dict->memory -= (long)oldsize; + } + else { + __atomic_fetch_add(&dict->version, 1, __ATOMIC_SEQ_CST); + __atomic_fetch_add(&dict->resets, 1, __ATOMIC_RELAXED); + __atomic_fetch_add(&dict->memory, (long)newsize, __ATOMIC_RELAXED); + __atomic_fetch_sub(&dict->memory, (long)oldsize, __ATOMIC_RELAXED); + } +} + +static inline void DICTIONARY_STATS_WALKTHROUGHS_PLUS1(DICTIONARY *dict) { + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) { + dict->walkthroughs++; + } + else { + __atomic_fetch_add(&dict->walkthroughs, 1, __ATOMIC_RELAXED); + } +} + +static inline size_t DICTIONARY_STATS_REFERENCED_ITEMS_PLUS1(DICTIONARY *dict) { + return __atomic_add_fetch(&dict->referenced_items, 1, __ATOMIC_SEQ_CST); +} + +static inline size_t DICTIONARY_STATS_REFERENCED_ITEMS_MINUS1(DICTIONARY *dict) { + return __atomic_sub_fetch(&dict->referenced_items, 1, __ATOMIC_SEQ_CST); +} + +static inline size_t DICTIONARY_STATS_PENDING_DELETES_PLUS1(DICTIONARY *dict) { + return __atomic_add_fetch(&dict->pending_deletion_items, 1, __ATOMIC_SEQ_CST); +} + +static inline size_t DICTIONARY_STATS_PENDING_DELETES_MINUS1(DICTIONARY *dict) { + return __atomic_sub_fetch(&dict->pending_deletion_items, 1, __ATOMIC_SEQ_CST); +} + +static inline size_t DICTIONARY_STATS_PENDING_DELETES_GET(DICTIONARY *dict) { + return __atomic_load_n(&dict->pending_deletion_items, __ATOMIC_SEQ_CST); +} + +static inline int DICTIONARY_NAME_VALUE_REFCOUNT_GET(NAME_VALUE *nv) { + return __atomic_load_n(&nv->refcount, __ATOMIC_SEQ_CST); +} + +// ---------------------------------------------------------------------------- +// garbage collector +// it is called every time someone gets a write lock to the dictionary + +static void garbage_collect_pending_deletes_unsafe(DICTIONARY *dict) { + if(!(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS)) return; + + if(likely(!DICTIONARY_STATS_PENDING_DELETES_GET(dict))) return; + + NAME_VALUE *nv = dict->first_item; + while(nv) { + if((nv->flags & NAME_VALUE_FLAG_DELETED) && DICTIONARY_NAME_VALUE_REFCOUNT_GET(nv) == 0) { + NAME_VALUE *nv_next = nv->next; + + linkedlist_namevalue_unlink_unsafe(dict, nv); + namevalue_destroy_unsafe(dict, nv); + + size_t pending = DICTIONARY_STATS_PENDING_DELETES_MINUS1(dict); + if(!pending) break; + + nv = nv_next; + } + else + nv = nv->next; } } @@ -220,41 +293,104 @@ static inline void DICTIONARY_STATS_VALUE_RESETS_PLUS1(DICTIONARY *dict, size_t static inline size_t dictionary_lock_init(DICTIONARY *dict) { if(likely(!(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED))) { - dict->rwlock = mallocz(sizeof(netdata_rwlock_t)); - netdata_rwlock_init(dict->rwlock); - return sizeof(netdata_rwlock_t); + netdata_rwlock_init(&dict->rwlock); + + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) + dict->flags &= ~DICTIONARY_FLAG_EXCLUSIVE_ACCESS; + + return 0; } - dict->rwlock = NULL; + + // we are single threaded + dict->flags |= DICTIONARY_FLAG_EXCLUSIVE_ACCESS; return 0; } static inline size_t dictionary_lock_free(DICTIONARY *dict) { if(likely(!(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED))) { - netdata_rwlock_destroy(dict->rwlock); - freez(dict->rwlock); - return sizeof(netdata_rwlock_t); + netdata_rwlock_destroy(&dict->rwlock); + return 0; } return 0; } -static inline void dictionary_lock_rlock(DICTIONARY *dict) { - if(likely(!(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED))) { - // debug(D_DICTIONARY, "Dictionary READ lock"); - netdata_rwlock_rdlock(dict->rwlock); +static void dictionary_lock(DICTIONARY *dict, char rw) { + if(rw == 'u' || rw == 'U') return; + + if(rw == 'r' || rw == 'R') { + // read lock + __atomic_add_fetch(&dict->readers, 1, __ATOMIC_RELAXED); + } + else { + // write lock + __atomic_add_fetch(&dict->writers, 1, __ATOMIC_RELAXED); + } + + if(likely(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED)) + return; + + if(rw == 'r' || rw == 'R') { + // read lock + netdata_rwlock_rdlock(&dict->rwlock); + + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) { + internal_error(true, "DICTIONARY: left-over exclusive access to dictionary created by %s (%zu@%s) found", dict->creation_function, dict->creation_line, dict->creation_file); + dict->flags &= ~DICTIONARY_FLAG_EXCLUSIVE_ACCESS; + } + } + else { + // write lock + netdata_rwlock_wrlock(&dict->rwlock); + + dict->flags |= DICTIONARY_FLAG_EXCLUSIVE_ACCESS; } } -static inline void dictionary_lock_wrlock(DICTIONARY *dict) { - if(likely(!(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED))) { - // debug(D_DICTIONARY, "Dictionary WRITE lock"); - netdata_rwlock_wrlock(dict->rwlock); +static void dictionary_unlock(DICTIONARY *dict, char rw) { + if(rw == 'u' || rw == 'U') return; + + if(rw == 'r' || rw == 'R') { + // read unlock + __atomic_sub_fetch(&dict->readers, 1, __ATOMIC_RELAXED); + } + else { + // write unlock + garbage_collect_pending_deletes_unsafe(dict); + __atomic_sub_fetch(&dict->writers, 1, __ATOMIC_RELAXED); } + + if(likely(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED)) + return; + + if(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS) + dict->flags &= ~DICTIONARY_FLAG_EXCLUSIVE_ACCESS; + + netdata_rwlock_unlock(&dict->rwlock); } -static inline void dictionary_unlock(DICTIONARY *dict) { - if(likely(!(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED))) { - // debug(D_DICTIONARY, "Dictionary UNLOCK lock"); - netdata_rwlock_unlock(dict->rwlock); +// ---------------------------------------------------------------------------- +// deferred deletions + +void dictionary_defer_all_deletions_unsafe(DICTIONARY *dict, char rw) { + if(rw == 'r' || rw == 'R') { + // read locked - no need to defer deletions + ; + } + else { + // write locked - defer deletions + dict->flags |= DICTIONARY_FLAG_DEFER_ALL_DELETIONS; + } +} + +void dictionary_restore_all_deletions_unsafe(DICTIONARY *dict, char rw) { + if(rw == 'r' || rw == 'R') { + // read locked - no need to defer deletions + internal_error(dict->flags & DICTIONARY_FLAG_DEFER_ALL_DELETIONS, "DICTIONARY: deletions are deferred on a read lock"); + } + else { + // write locked - defer deletions + if(dict->flags & DICTIONARY_FLAG_DEFER_ALL_DELETIONS) + dict->flags &= ~DICTIONARY_FLAG_DEFER_ALL_DELETIONS; } } @@ -277,39 +413,90 @@ static inline size_t reference_counter_free(DICTIONARY *dict) { return 0; } -static void reference_counter_acquire(DICTIONARY *dict, NAME_VALUE *nv) { - if(unlikely(dict->flags & DICTIONARY_FLAG_REFERENCE_COUNTERS)) { - NAME_VALUE_WITH_STATS *nvs = (NAME_VALUE_WITH_STATS *)nv; - __atomic_fetch_add(&nvs->refcount, 1, __ATOMIC_SEQ_CST); - } +static int reference_counter_increase(NAME_VALUE *nv) { + int refcount = __atomic_add_fetch(&nv->refcount, 1, __ATOMIC_SEQ_CST); + if(refcount == 1) + fatal("DICTIONARY: request to dup item '%s' but its reference counter was zero", namevalue_get_name(nv)); + return refcount; } -static void reference_counter_release(DICTIONARY *dict, NAME_VALUE *nv) { - if(unlikely(dict->flags & DICTIONARY_FLAG_REFERENCE_COUNTERS)) { - NAME_VALUE_WITH_STATS *nvs = (NAME_VALUE_WITH_STATS *)nv; - __atomic_fetch_sub(&nvs->refcount, 1, __ATOMIC_SEQ_CST); +static int reference_counter_acquire(DICTIONARY *dict, NAME_VALUE *nv) { + int refcount; + if(likely(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED)) + refcount = ++nv->refcount; + else + refcount = __atomic_add_fetch(&nv->refcount, 1, __ATOMIC_SEQ_CST); + + if(refcount == 1) { + // referenced items counts number of unique items referenced + // so, we increase it only when refcount == 1 + DICTIONARY_STATS_REFERENCED_ITEMS_PLUS1(dict); + + // if this is a deleted item, but the counter increased to 1 + // we need to remove it from the pending items to delete + if (nv->flags & NAME_VALUE_FLAG_DELETED) + DICTIONARY_STATS_PENDING_DELETES_MINUS1(dict); } + + return refcount; } -static int reference_counter_mark_deleted(DICTIONARY *dict, NAME_VALUE *nv) { - if(unlikely(dict->flags & DICTIONARY_FLAG_REFERENCE_COUNTERS)) { - NAME_VALUE_WITH_STATS *nvs = (NAME_VALUE_WITH_STATS *)nv; - nvs->flags |= NAME_VALUE_FLAG_DELETED; - return 1; +static uint32_t reference_counter_release(DICTIONARY *dict, NAME_VALUE *nv, bool can_get_write_lock) { + // this function may be called without any lock on the dictionary + // or even when someone else has a write lock on the dictionary + // so, we cannot check for EXCLUSIVE ACCESS + + uint32_t refcount; + if(likely(dict->flags & DICTIONARY_FLAG_SINGLE_THREADED)) + refcount = nv->refcount--; + else + refcount = __atomic_fetch_sub(&nv->refcount, 1, __ATOMIC_SEQ_CST); + + if(refcount == 0) { + internal_error(true, "DICTIONARY: attempted to release item without references: '%s' on dictionary created by %s() (%zu@%s)", namevalue_get_name(nv), dict->creation_function, dict->creation_line, dict->creation_file); + fatal("DICTIONARY: attempted to release item without references: '%s'", namevalue_get_name(nv)); } - return 0; + + if(refcount == 1) { + if((nv->flags & NAME_VALUE_FLAG_DELETED)) + DICTIONARY_STATS_PENDING_DELETES_PLUS1(dict); + + // referenced items counts number of unique items referenced + // so, we decrease it only when refcount == 0 + DICTIONARY_STATS_REFERENCED_ITEMS_MINUS1(dict); + } + + if(can_get_write_lock && DICTIONARY_STATS_PENDING_DELETES_GET(dict)) { + // we can garbage collect now + + dictionary_lock(dict, DICTIONARY_LOCK_WRITE); + garbage_collect_pending_deletes_unsafe(dict); + dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); + } + + return refcount; } // ---------------------------------------------------------------------------- // hash table #ifdef DICTIONARY_WITH_AVL +static inline const char *namevalue_get_name(NAME_VALUE *nv); + static int name_value_compare(void* a, void* b) { - return strcmp(((NAME_VALUE *)a)->name, ((NAME_VALUE *)b)->name); + return strcmp(namevalue_get_name((NAME_VALUE *)a), namevalue_get_name((NAME_VALUE *)b)); +} + +static void *get_thread_static_name_value(const char *name) { + static __thread NAME_VALUE tmp = { 0 }; + tmp.flags = NAME_VALUE_FLAG_NONE; + tmp.caller_name = (char *)name; + return &tmp; } static void hashtable_init_unsafe(DICTIONARY *dict) { avl_init(&dict->values_index, name_value_compare); + dict->get_thread_static_name_value = get_thread_static_name_value; } static size_t hashtable_destroy_unsafe(DICTIONARY *dict) { @@ -317,7 +504,7 @@ static size_t hashtable_destroy_unsafe(DICTIONARY *dict) { return 0; } -static inline int hashtable_delete_unsafe(DICTIONARY *dict, const char *name, size_t name_len, NAME_VALUE *nv) { +static inline int hashtable_delete_unsafe(DICTIONARY *dict, const char *name, size_t name_len, void *nv) { (void)name; (void)name_len; @@ -330,9 +517,8 @@ static inline int hashtable_delete_unsafe(DICTIONARY *dict, const char *name, si static inline NAME_VALUE *hashtable_get_unsafe(DICTIONARY *dict, const char *name, size_t name_len) { (void)name_len; - NAME_VALUE tmp; - tmp.name = (char *)name; - return (NAME_VALUE *)avl_search(&(dict->values_index), (avl_t *) &tmp); + void *tmp = dict->get_thread_static_name_value(name); + return (NAME_VALUE *)avl_search(&(dict->values_index), (avl_t *)tmp); } static inline NAME_VALUE **hashtable_insert_unsafe(DICTIONARY *dict, const char *name, size_t name_len) { @@ -346,13 +532,10 @@ static inline NAME_VALUE **hashtable_insert_unsafe(DICTIONARY *dict, const char return &dict->hash_base; } -static inline void hashtable_inserted_name_value_unsafe(DICTIONARY *dict, const char *name, size_t name_len, NAME_VALUE *nv) { +static inline void hashtable_inserted_name_value_unsafe(DICTIONARY *dict, void *nv) { // we have our new NAME_VALUE object. // Let's index it. - (void)name; - (void)name_len; - if(unlikely(avl_insert(&((dict)->values_index), (avl_t *)(nv)) != (avl_t *)nv)) error("dictionary: INTERNAL ERROR: duplicate insertion to dictionary."); } @@ -380,6 +563,8 @@ static size_t hashtable_destroy_unsafe(DICTIONARY *dict) { } static inline NAME_VALUE **hashtable_insert_unsafe(DICTIONARY *dict, const char *name, size_t name_len) { + internal_error(!(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS), "DICTIONARY: inserting item from the index without exclusive access to the dictionary created by %s() (%zu@%s)", dict->creation_function, dict->creation_line, dict->creation_file); + JError_t J_Error; Pvoid_t *Rc = JudyHSIns(&dict->JudyHSArray, (void *)name, name_len, &J_Error); if (unlikely(Rc == PJERR)) { @@ -397,9 +582,10 @@ static inline NAME_VALUE **hashtable_insert_unsafe(DICTIONARY *dict, const char return (NAME_VALUE **)Rc; } -static inline int hashtable_delete_unsafe(DICTIONARY *dict, const char *name, size_t name_len, NAME_VALUE *nv) { - (void)nv; +static inline int hashtable_delete_unsafe(DICTIONARY *dict, const char *name, size_t name_len, void *nv) { + internal_error(!(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS), "DICTIONARY: deleting item from the index without exclusive access to the dictionary created by %s() (%zu@%s)", dict->creation_function, dict->creation_line, dict->creation_file); + (void)nv; if(unlikely(!dict->JudyHSArray)) return 0; JError_t J_Error; @@ -440,10 +626,8 @@ static inline NAME_VALUE *hashtable_get_unsafe(DICTIONARY *dict, const char *nam } } -static inline void hashtable_inserted_name_value_unsafe(DICTIONARY *dict, const char *name, size_t name_len, NAME_VALUE *nv) { +static inline void hashtable_inserted_name_value_unsafe(DICTIONARY *dict, void *nv) { (void)dict; - (void)name; - (void)name_len; (void)nv; ; } @@ -454,6 +638,8 @@ static inline void hashtable_inserted_name_value_unsafe(DICTIONARY *dict, const // linked list management static inline void linkedlist_namevalue_link_unsafe(DICTIONARY *dict, NAME_VALUE *nv) { + internal_error(!(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS), "DICTIONARY: adding item to the linked-list without exclusive access to the dictionary created by %s() (%zu@%s)", dict->creation_function, dict->creation_line, dict->creation_file); + if (unlikely(!dict->first_item)) { // we are the only ones here nv->next = NULL; @@ -481,6 +667,8 @@ static inline void linkedlist_namevalue_link_unsafe(DICTIONARY *dict, NAME_VALUE } static inline void linkedlist_namevalue_unlink_unsafe(DICTIONARY *dict, NAME_VALUE *nv) { + internal_error(!(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS), "DICTIONARY: removing item from the linked-list without exclusive access to the dictionary created by %s() (%zu@%s)", dict->creation_function, dict->creation_line, dict->creation_file); + if(nv->next) nv->next->prev = nv->prev; if(nv->prev) nv->prev->next = nv->next; if(dict->first_item == nv) dict->first_item = nv->next; @@ -490,54 +678,47 @@ static inline void linkedlist_namevalue_unlink_unsafe(DICTIONARY *dict, NAME_VAL // ---------------------------------------------------------------------------- // NAME_VALUE methods -static inline size_t namevalue_alloc_size(DICTIONARY *dict) { - return (dict->flags & DICTIONARY_FLAG_WITH_STATISTICS) ? sizeof(NAME_VALUE_WITH_STATS) : sizeof(NAME_VALUE); -} - -static inline size_t namevalue_get_namelen(DICTIONARY *dict, NAME_VALUE *nv) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - NAME_VALUE_WITH_STATS *nvs = (NAME_VALUE_WITH_STATS *)nv; - return nvs->name_len; +static inline size_t namevalue_set_name(DICTIONARY *dict, NAME_VALUE *nv, const char *name, size_t name_len) { + if(likely(dict->flags & DICTIONARY_FLAG_NAME_LINK_DONT_CLONE)) { + nv->caller_name = (char *)name; + return 0; } - return 0; + + nv->string_name = string_strdupz(name); + nv->flags |= NAME_VALUE_FLAG_NAME_IS_ALLOCATED; + return name_len; } -static inline size_t namevalue_get_valuelen(DICTIONARY *dict, NAME_VALUE *nv) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - NAME_VALUE_WITH_STATS *nvs = (NAME_VALUE_WITH_STATS *)nv; - return nvs->value_len; - } + +static inline size_t namevalue_free_name(DICTIONARY *dict, NAME_VALUE *nv) { + if(unlikely(!(dict->flags & DICTIONARY_FLAG_NAME_LINK_DONT_CLONE))) + string_freez(nv->string_name); + return 0; } -static inline void namevalue_set_valuelen(DICTIONARY *dict, NAME_VALUE *nv, size_t value_len) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - NAME_VALUE_WITH_STATS *nvs = (NAME_VALUE_WITH_STATS *)nv; - nvs->value_len = value_len; - } -} -static inline void namevalue_set_namevaluelen(DICTIONARY *dict, NAME_VALUE *nv, size_t name_len, size_t value_len) { - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - NAME_VALUE_WITH_STATS *nvs = (NAME_VALUE_WITH_STATS *)nv; - nvs->name_len = name_len; - nvs->value_len = value_len; - } + +static inline const char *namevalue_get_name(NAME_VALUE *nv) { + if(nv->flags & NAME_VALUE_FLAG_NAME_IS_ALLOCATED) + return string2str(nv->string_name); + else + return nv->caller_name; } static NAME_VALUE *namevalue_create_unsafe(DICTIONARY *dict, const char *name, size_t name_len, void *value, size_t value_len) { debug(D_DICTIONARY, "Creating name value entry for name '%s'.", name); - size_t size = namevalue_alloc_size(dict); + size_t size = sizeof(NAME_VALUE); NAME_VALUE *nv = mallocz(size); size_t allocated = size; - namevalue_set_namevaluelen(dict, nv, name_len, value_len); +#ifdef NETDATA_INTERNAL_CHECKS + nv->dict = dict; +#endif - if(likely(dict->flags & DICTIONARY_FLAG_NAME_LINK_DONT_CLONE)) - nv->name = (char *)name; - else { - nv->name = mallocz(name_len); - memcpy(nv->name, name, name_len); - allocated += name_len; - } + nv->refcount = 0; + nv->flags = NAME_VALUE_FLAG_NONE; + nv->value_len = value_len; + + allocated += namevalue_set_name(dict, nv, name, name_len); if(likely(dict->flags & DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE)) nv->value = value; @@ -556,7 +737,7 @@ static NAME_VALUE *namevalue_create_unsafe(DICTIONARY *dict, const char *name, s } } else { - // the caller want an item without any value + // the caller wants an item without any value nv->value = NULL; } @@ -565,107 +746,189 @@ static NAME_VALUE *namevalue_create_unsafe(DICTIONARY *dict, const char *name, s DICTIONARY_STATS_ENTRIES_PLUS1(dict, allocated); + if(dict->ins_callback) + dict->ins_callback(namevalue_get_name(nv), nv->value, dict->ins_callback_data); + return nv; } static void namevalue_reset_unsafe(DICTIONARY *dict, NAME_VALUE *nv, void *value, size_t value_len) { - debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", nv->name); + debug(D_DICTIONARY, "Dictionary entry with name '%s' found. Changing its value.", namevalue_get_name(nv)); + + DICTIONARY_STATS_VALUE_RESETS_PLUS1(dict, nv->value_len, value_len); + + if(dict->del_callback) + dict->del_callback(namevalue_get_name(nv), nv->value, dict->del_callback_data); if(likely(dict->flags & DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE)) { - debug(D_DICTIONARY, "Dictionary: linking value to '%s'", nv->name); + debug(D_DICTIONARY, "Dictionary: linking value to '%s'", namevalue_get_name(nv)); nv->value = value; - namevalue_set_valuelen(dict, nv, value_len); + nv->value_len = value_len; } else { - debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", nv->name); - DICTIONARY_STATS_VALUE_RESETS_PLUS1(dict, namevalue_get_valuelen(dict, nv), value_len); - - void *old = nv->value; - void *new = mallocz(value_len); - memcpy(new, value, value_len); - nv->value = new; - namevalue_set_valuelen(dict, nv, value_len); + debug(D_DICTIONARY, "Dictionary: cloning value to '%s'", namevalue_get_name(nv)); + + void *oldvalue = nv->value; + void *newvalue = NULL; + if(value_len) { + newvalue = mallocz(value_len); + if(value) memcpy(newvalue, value, value_len); + else memset(newvalue, 0, value_len); + } + nv->value = newvalue; + nv->value_len = value_len; - debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", nv->name); - freez(old); + debug(D_DICTIONARY, "Dictionary: freeing old value of '%s'", namevalue_get_name(nv)); + freez(oldvalue); } + + if(dict->ins_callback) + dict->ins_callback(namevalue_get_name(nv), nv->value, dict->ins_callback_data); } static size_t namevalue_destroy_unsafe(DICTIONARY *dict, NAME_VALUE *nv) { - debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", nv->name); + debug(D_DICTIONARY, "Destroying name value entry for name '%s'.", namevalue_get_name(nv)); + + if(dict->del_callback) + dict->del_callback(namevalue_get_name(nv), nv->value, dict->del_callback_data); size_t freed = 0; if(unlikely(!(dict->flags & DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE))) { - debug(D_DICTIONARY, "Dictionary freeing value of '%s'", nv->name); + debug(D_DICTIONARY, "Dictionary freeing value of '%s'", namevalue_get_name(nv)); freez(nv->value); - freed += namevalue_get_valuelen(dict, nv); + freed += nv->value_len; } if(unlikely(!(dict->flags & DICTIONARY_FLAG_NAME_LINK_DONT_CLONE))) { - debug(D_DICTIONARY, "Dictionary freeing name '%s'", nv->name); - freez(nv->name); - freed += namevalue_get_namelen(dict, nv); + debug(D_DICTIONARY, "Dictionary freeing name '%s'", namevalue_get_name(nv)); + freed += namevalue_free_name(dict, nv); } freez(nv); - freed += namevalue_alloc_size(dict); + freed += sizeof(NAME_VALUE); - DICTIONARY_STATS_ENTRIES_MINUS1(dict, freed); + DICTIONARY_STATS_ENTRIES_MINUS_MEMORY(dict, freed); return freed; } +// if a dictionary item can be deleted, return true, otherwise return false +static bool name_value_can_be_deleted(DICTIONARY *dict, NAME_VALUE *nv) { + if(unlikely(dict->flags & DICTIONARY_FLAG_DEFER_ALL_DELETIONS)) + return false; + + if(unlikely(DICTIONARY_NAME_VALUE_REFCOUNT_GET(nv) > 0)) + return false; + + return true; +} + // ---------------------------------------------------------------------------- // API - dictionary management - -DICTIONARY *dictionary_create(DICTIONARY_FLAGS flags) { +#ifdef NETDATA_INTERNAL_CHECKS +DICTIONARY *dictionary_create_advanced_with_trace(DICTIONARY_FLAGS flags, size_t scratchpad_size, const char *function, size_t line, const char *file) { +#else +DICTIONARY *dictionary_create_advanced(DICTIONARY_FLAGS flags, size_t scratchpad_size) { +#endif debug(D_DICTIONARY, "Creating dictionary."); - if((flags & DICTIONARY_FLAG_REFERENCE_COUNTERS) && (flags & DICTIONARY_FLAG_SINGLE_THREADED)) { - error("DICTIONARY: requested reference counters on single threaded dictionary. Not adding reference counters."); - flags &= ~DICTIONARY_FLAG_REFERENCE_COUNTERS; - } - - if(flags & DICTIONARY_FLAG_REFERENCE_COUNTERS) { - // we need statistics to allocate the extra NAME_VALUE attributes - flags |= DICTIONARY_FLAG_WITH_STATISTICS; - } + if(unlikely(flags & DICTIONARY_FLAGS_RESERVED)) + flags &= ~DICTIONARY_FLAGS_RESERVED; - DICTIONARY *dict = callocz(1, sizeof(DICTIONARY)); - size_t allocated = sizeof(DICTIONARY); + DICTIONARY *dict = callocz(1, sizeof(DICTIONARY) + scratchpad_size); + size_t allocated = sizeof(DICTIONARY) + scratchpad_size; + dict->scratchpad_size = scratchpad_size; dict->flags = flags; dict->first_item = dict->last_item = NULL; allocated += dictionary_lock_init(dict); allocated += reference_counter_init(dict); - - if(flags & DICTIONARY_FLAG_WITH_STATISTICS) { - dict->stats = callocz(1, sizeof(struct dictionary_stats)); - allocated += sizeof(struct dictionary_stats); - dict->stats->memory = allocated; - } - else - dict->stats = NULL; + dict->memory = (long)allocated; hashtable_init_unsafe(dict); + +#ifdef NETDATA_INTERNAL_CHECKS + dict->creation_function = function; + dict->creation_file = file; + dict->creation_line = line; +#endif + return (DICTIONARY *)dict; } +void *dictionary_scratchpad(DICTIONARY *dict) { + return &dict->scratchpad; +} + size_t dictionary_destroy(DICTIONARY *dict) { + if(!dict) return 0; + + NAME_VALUE *nv; + debug(D_DICTIONARY, "Destroying dictionary."); - dictionary_lock_wrlock(dict); + long referenced_items = 0; + size_t retries = 0; + do { + referenced_items = __atomic_load_n(&dict->referenced_items, __ATOMIC_SEQ_CST); + if (referenced_items) { + dictionary_lock(dict, DICTIONARY_LOCK_WRITE); + + // there are referenced items + // delete all items individually, so that only the referenced will remain + NAME_VALUE *nv_next; + for (nv = dict->first_item; nv; nv = nv_next) { + nv_next = nv->next; + size_t refcount = DICTIONARY_NAME_VALUE_REFCOUNT_GET(nv); + if (!refcount && !(nv->flags & NAME_VALUE_FLAG_DELETED)) + dictionary_del_unsafe(dict, namevalue_get_name(nv)); + } + + internal_error( + retries == 0, + "DICTIONARY: waiting (try %zu) for destruction of dictionary created from %s() %zu@%s, because it has %ld referenced items in it (%ld total).", + retries + 1, + dict->creation_function, + dict->creation_line, + dict->creation_file, + referenced_items, + dict->entries); + + dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); + sleep_usec(10000); + } + } while(referenced_items > 0 && ++retries < 10); + + if(referenced_items) { + dictionary_lock(dict, DICTIONARY_LOCK_WRITE); + + dict->flags |= DICTIONARY_FLAG_DESTROYED; + internal_error( + true, + "DICTIONARY: delaying destruction of dictionary created from %s() %zu@%s after %zu retries, because it has %ld referenced items in it (%ld total).", + dict->creation_function, + dict->creation_line, + dict->creation_file, + retries, + referenced_items, + dict->entries); + + dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); + return 0; + } + + dictionary_lock(dict, DICTIONARY_LOCK_WRITE); size_t freed = 0; - NAME_VALUE *nv = dict->first_item; + nv = dict->first_item; while (nv) { // cache nv->next // because we are going to free nv - NAME_VALUE *nvnext = nv->next; + NAME_VALUE *nv_next = nv->next; freed += namevalue_destroy_unsafe(dict, nv); - nv = nvnext; + nv = nv_next; // to speed up destruction, we don't // unlink nv from the linked-list here } @@ -676,31 +939,31 @@ size_t dictionary_destroy(DICTIONARY *dict) { // destroy the dictionary freed += hashtable_destroy_unsafe(dict); - dictionary_unlock(dict); + dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); freed += dictionary_lock_free(dict); freed += reference_counter_free(dict); - - if(unlikely(dict->flags & DICTIONARY_FLAG_WITH_STATISTICS)) { - freez(dict->stats); - dict->stats = NULL; - freed += sizeof(struct dictionary_stats); - } - + freed += sizeof(DICTIONARY) + dict->scratchpad_size; freez(dict); - freed += sizeof(DICTIONARY); return freed; } // ---------------------------------------------------------------------------- -// API - items management +// helpers -void *dictionary_set_unsafe(DICTIONARY *dict, const char *name, void *value, size_t value_len) { - if(unlikely(!name || !*name)) { - error("Attempted to dictionary_set() a dictionary item without a name"); +static NAME_VALUE *dictionary_set_name_value_unsafe(DICTIONARY *dict, const char *name, void *value, size_t value_len) { + if(unlikely(!name)) { + internal_error(true, "DICTIONARY: attempted to dictionary_set() a dictionary item without a name"); + return NULL; + } + + if(unlikely(dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_set() on a destroyed dictionary"); return NULL; } + internal_error(!(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS), "DICTIONARY: inserting dictionary item '%s' without exclusive access to dictionary", name); + size_t name_len = strlen(name) + 1; // we need the terminating null too debug(D_DICTIONARY, "SET dictionary entry with name '%s'.", name); @@ -720,11 +983,9 @@ void *dictionary_set_unsafe(DICTIONARY *dict, const char *name, void *value, siz if(likely(*pnv == 0)) { // a new item added to the index nv = *pnv = namevalue_create_unsafe(dict, name, name_len, value, value_len); - hashtable_inserted_name_value_unsafe(dict, name, name_len, nv); + hashtable_inserted_name_value_unsafe(dict, nv); linkedlist_namevalue_link_unsafe(dict, nv); - - if(dict->ins_callback) - dict->ins_callback(nv->name, nv->value, dict->ins_callback_data); + nv->flags |= NAME_VALUE_FLAG_NEW_OR_UPDATED; } else { // the item is already in the index @@ -732,33 +993,34 @@ void *dictionary_set_unsafe(DICTIONARY *dict, const char *name, void *value, siz // or overwrite the value, depending on dictionary flags nv = *pnv; - if(!(dict->flags & DICTIONARY_FLAG_DONT_OVERWRITE_VALUE)) { - - if(dict->del_callback) - dict->del_callback(nv->name, nv->value, dict->del_callback_data); + if(!(dict->flags & DICTIONARY_FLAG_DONT_OVERWRITE_VALUE)) { namevalue_reset_unsafe(dict, nv, value, value_len); + nv->flags |= NAME_VALUE_FLAG_NEW_OR_UPDATED; + } + + else if(dict->conflict_callback) { + dict->conflict_callback(namevalue_get_name(nv), nv->value, value, dict->conflict_callback_data); + nv->flags |= NAME_VALUE_FLAG_NEW_OR_UPDATED; + } - if(dict->ins_callback) - dict->ins_callback(nv->name, nv->value, dict->ins_callback_data); + else { + // make sure this flag is not set + nv->flags &= ~NAME_VALUE_FLAG_NEW_OR_UPDATED; } - else if(dict->conflict_callback) - dict->conflict_callback(nv->name, nv->value, value, dict->conflict_callback_data); } - return nv->value; + return nv; } -void *dictionary_set(DICTIONARY *dict, const char *name, void *value, size_t value_len) { - dictionary_lock_wrlock(dict); - void *ret = dictionary_set_unsafe(dict, name, value, value_len); - dictionary_unlock(dict); - return ret; -} +static NAME_VALUE *dictionary_get_name_value_unsafe(DICTIONARY *dict, const char *name) { + if(unlikely(!name)) { + internal_error(true, "attempted to dictionary_get() without a name"); + return NULL; + } -void *dictionary_get_unsafe(DICTIONARY *dict, const char *name) { - if(unlikely(!name || !*name)) { - error("Attempted to dictionary_get() without a name"); + if(unlikely(dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_get() on a destroyed dictionary"); return NULL; } @@ -773,34 +1035,180 @@ void *dictionary_get_unsafe(DICTIONARY *dict, const char *name) { } debug(D_DICTIONARY, "Found dictionary entry with name '%s'.", name); - return nv->value; + return nv; } -void *dictionary_get(DICTIONARY *dict, const char *name) { - dictionary_lock_rlock(dict); - void *ret = dictionary_get_unsafe(dict, name); - dictionary_unlock(dict); - return ret; -} +// ---------------------------------------------------------------------------- +// API - items management -int dictionary_del_unsafe(DICTIONARY *dict, const char *name) { - if(unlikely(!name || !*name)) { - error("Attempted to dictionary_det() without a name"); - return -1; +void *dictionary_set_unsafe(DICTIONARY *dict, const char *name, void *value, size_t value_len) { + NAME_VALUE *nv = dictionary_set_name_value_unsafe(dict, name, value, value_len); + + if(unlikely(dict->react_callback && nv && (nv->flags & NAME_VALUE_FLAG_NEW_OR_UPDATED))) { + // we need to call the react callback with a reference counter on nv + reference_counter_acquire(dict, nv); + dict->react_callback(namevalue_get_name(nv), nv->value, dict->react_callback_data); + reference_counter_release(dict, nv, false); } - size_t name_len = strlen(name) + 1; // we need the terminating null too + return nv ? nv->value : NULL; +} - debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name); +void *dictionary_set(DICTIONARY *dict, const char *name, void *value, size_t value_len) { + dictionary_lock(dict, DICTIONARY_LOCK_WRITE); + NAME_VALUE *nv = dictionary_set_name_value_unsafe(dict, name, value, value_len); - // Unfortunately, the JudyHSDel() does not return the value of the - // item that was deleted, so we have to find it before we delete it, - // since we need to release our structures too. + // we need to get a reference counter for the react callback + // before we unlock the dictionary + if(unlikely(dict->react_callback && nv && (nv->flags & NAME_VALUE_FLAG_NEW_OR_UPDATED))) + reference_counter_acquire(dict, nv); - int ret; - NAME_VALUE *nv = hashtable_get_unsafe(dict, name, name_len); - if(unlikely(!nv)) { - debug(D_DICTIONARY, "Not found dictionary entry with name '%s'.", name); + dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); + + if(unlikely(dict->react_callback && nv && (nv->flags & NAME_VALUE_FLAG_NEW_OR_UPDATED))) { + // we got the reference counter we need, above + dict->react_callback(namevalue_get_name(nv), nv->value, dict->react_callback_data); + reference_counter_release(dict, nv, false); + } + + return nv ? nv->value : NULL; +} + +DICTIONARY_ITEM *dictionary_set_and_acquire_item_unsafe(DICTIONARY *dict, const char *name, void *value, size_t value_len) { + NAME_VALUE *nv = dictionary_set_name_value_unsafe(dict, name, value, value_len); + + if(unlikely(!nv)) + return NULL; + + reference_counter_acquire(dict, nv); + + if(unlikely(dict->react_callback && (nv->flags & NAME_VALUE_FLAG_NEW_OR_UPDATED))) { + dict->react_callback(namevalue_get_name(nv), nv->value, dict->react_callback_data); + } + + return (DICTIONARY_ITEM *)nv; +} + +DICTIONARY_ITEM *dictionary_set_and_acquire_item(DICTIONARY *dict, const char *name, void *value, size_t value_len) { + dictionary_lock(dict, DICTIONARY_LOCK_WRITE); + NAME_VALUE *nv = dictionary_set_name_value_unsafe(dict, name, value, value_len); + + // we need to get the reference counter before we unlock + if(nv) reference_counter_acquire(dict, nv); + + dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); + + if(unlikely(dict->react_callback && nv && (nv->flags & NAME_VALUE_FLAG_NEW_OR_UPDATED))) { + // we already have a reference counter, for the caller, no need for another one + dict->react_callback(namevalue_get_name(nv), nv->value, dict->react_callback_data); + } + + return (DICTIONARY_ITEM *)nv; +} + +void *dictionary_get_unsafe(DICTIONARY *dict, const char *name) { + NAME_VALUE *nv = dictionary_get_name_value_unsafe(dict, name); + + if(unlikely(!nv)) + return NULL; + + return nv->value; +} + +void *dictionary_get(DICTIONARY *dict, const char *name) { + dictionary_lock(dict, DICTIONARY_LOCK_READ); + void *ret = dictionary_get_unsafe(dict, name); + dictionary_unlock(dict, DICTIONARY_LOCK_READ); + return ret; +} + +DICTIONARY_ITEM *dictionary_get_and_acquire_item_unsafe(DICTIONARY *dict, const char *name) { + NAME_VALUE *nv = dictionary_get_name_value_unsafe(dict, name); + + if(unlikely(!nv)) + return NULL; + + reference_counter_acquire(dict, nv); + return (DICTIONARY_ITEM *)nv; +} + +DICTIONARY_ITEM *dictionary_get_and_acquire_item(DICTIONARY *dict, const char *name) { + dictionary_lock(dict, DICTIONARY_LOCK_READ); + void *ret = dictionary_get_and_acquire_item_unsafe(dict, name); + dictionary_unlock(dict, DICTIONARY_LOCK_READ); + return ret; +} + +DICTIONARY_ITEM *dictionary_acquired_item_dup(DICTIONARY_ITEM *item) { + if(unlikely(!item)) return NULL; + reference_counter_increase((NAME_VALUE *)item); + return item; +} + +const char *dictionary_acquired_item_name(DICTIONARY_ITEM *item) { + if(unlikely(!item)) return NULL; + return namevalue_get_name((NAME_VALUE *)item); +} + +void *dictionary_acquired_item_value(DICTIONARY_ITEM *item) { + if(unlikely(!item)) return NULL; + return ((NAME_VALUE *)item)->value; +} + +void dictionary_acquired_item_release_unsafe(DICTIONARY *dict, DICTIONARY_ITEM *item) { + if(unlikely(!item)) return; + +#ifdef NETDATA_INTERNAL_CHECKS + if(((NAME_VALUE *)item)->dict != dict) + fatal("DICTIONARY: %s(): name_value item with name '%s' does not belong to this dictionary", __FUNCTION__, namevalue_get_name((NAME_VALUE *)item)); +#endif + + reference_counter_release(dict, (NAME_VALUE *)item, false); +} + +void dictionary_acquired_item_release(DICTIONARY *dict, DICTIONARY_ITEM *item) { + if(unlikely(!item)) return; + +#ifdef NETDATA_INTERNAL_CHECKS + if(((NAME_VALUE *)item)->dict != dict) + fatal("DICTIONARY: %s(): name_value item with name '%s' does not belong to this dictionary", __FUNCTION__, namevalue_get_name((NAME_VALUE *)item)); +#endif + + // no need to get a lock here + // we pass the last parameter to reference_counter_release() as true + // so that the release may get a write-lock if required to clean up + + reference_counter_release(dict, (NAME_VALUE *)item, true); + + if(unlikely(dict->flags & DICTIONARY_FLAG_DESTROYED)) + dictionary_destroy(dict); +} + +int dictionary_del_unsafe(DICTIONARY *dict, const char *name) { + if(unlikely(dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_del() on a destroyed dictionary"); + return -1; + } + + if(unlikely(!name || !*name)) { + internal_error(true, "DICTIONARY: attempted to dictionary_del() without a name"); + return -1; + } + + internal_error(!(dict->flags & DICTIONARY_FLAG_EXCLUSIVE_ACCESS), "DICTIONARY: INTERNAL ERROR: deleting dictionary item '%s' without exclusive access to dictionary", name); + + size_t name_len = strlen(name) + 1; // we need the terminating null too + + debug(D_DICTIONARY, "DEL dictionary entry with name '%s'.", name); + + // Unfortunately, the JudyHSDel() does not return the value of the + // item that was deleted, so we have to find it before we delete it, + // since we need to release our structures too. + + int ret; + NAME_VALUE *nv = hashtable_get_unsafe(dict, name, name_len); + if(unlikely(!nv)) { + debug(D_DICTIONARY, "Not found dictionary entry with name '%s'.", name); ret = -1; } else { @@ -809,23 +1217,25 @@ int dictionary_del_unsafe(DICTIONARY *dict, const char *name) { if(hashtable_delete_unsafe(dict, name, name_len, nv) == 0) error("DICTIONARY: INTERNAL ERROR: tried to delete item with name '%s' that is not in the index", name); - if(!reference_counter_mark_deleted(dict, nv)) { + if(name_value_can_be_deleted(dict, nv)) { linkedlist_namevalue_unlink_unsafe(dict, nv); - - if(dict->del_callback) - dict->del_callback(nv->name, nv->value, dict->del_callback_data); - namevalue_destroy_unsafe(dict, nv); } + else + nv->flags |= NAME_VALUE_FLAG_DELETED; + ret = 0; + + DICTIONARY_STATS_ENTRIES_MINUS1(dict); + } return ret; } int dictionary_del(DICTIONARY *dict, const char *name) { - dictionary_lock_wrlock(dict); + dictionary_lock(dict, DICTIONARY_LOCK_WRITE); int ret = dictionary_del_unsafe(dict, name); - dictionary_unlock(dict); + dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); return ret; } @@ -835,25 +1245,37 @@ int dictionary_del(DICTIONARY *dict, const char *name) { void *dictionary_foreach_start_rw(DICTFE *dfe, DICTIONARY *dict, char rw) { if(unlikely(!dfe || !dict)) return NULL; + if(unlikely(dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_foreach_start_rw() on a destroyed dictionary"); + dfe->last_item = NULL; + dfe->name = NULL; + dfe->value = NULL; + return NULL; + } + dfe->dict = dict; + dfe->rw = rw; dfe->started_ut = now_realtime_usec(); - if(rw == 'r' || rw == 'R') - dictionary_lock_rlock(dict); - else - dictionary_lock_wrlock(dict); + dictionary_lock(dict, dfe->rw); + + DICTIONARY_STATS_WALKTHROUGHS_PLUS1(dict); + // get the first item from the list NAME_VALUE *nv = dict->first_item; - dfe->last_position_index = (void *)nv; + + // skip all the deleted items + while(nv && (nv->flags & NAME_VALUE_FLAG_DELETED)) + nv = nv->next; if(likely(nv)) { - dfe->next_position_index = (void *)nv->next; - dfe->name = nv->name; - dfe->value = (void *)nv->value; + dfe->last_item = nv; + dfe->name = (char *)namevalue_get_name(nv); + dfe->value = nv->value; reference_counter_acquire(dict, nv); } else { - dfe->next_position_index = NULL; + dfe->last_item = NULL; dfe->name = NULL; dfe->value = NULL; } @@ -864,21 +1286,36 @@ void *dictionary_foreach_start_rw(DICTFE *dfe, DICTIONARY *dict, char rw) { void *dictionary_foreach_next(DICTFE *dfe) { if(unlikely(!dfe || !dfe->dict)) return NULL; - NAME_VALUE *nv = (NAME_VALUE *)dfe->last_position_index; - if(likely(nv)) - reference_counter_release(dfe->dict, nv); + if(unlikely(dfe->dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_foreach_next() on a destroyed dictionary"); + dfe->last_item = NULL; + dfe->name = NULL; + dfe->value = NULL; + return NULL; + } - nv = dfe->last_position_index = dfe->next_position_index; + // the item we just did + NAME_VALUE *nv = (NAME_VALUE *)dfe->last_item; - if(likely(nv)) { - dfe->next_position_index = (void *)nv->next; - dfe->name = nv->name; - dfe->value = (void *)nv->value; + // get the next item from the list + NAME_VALUE *nv_next = (nv) ? nv->next : NULL; + + // skip all the deleted items + while(nv_next && (nv_next->flags & NAME_VALUE_FLAG_DELETED)) + nv_next = nv_next->next; + + // release the old, so that it can possibly be deleted + if(likely(nv)) + reference_counter_release(dfe->dict, nv, false); + if(likely(nv = nv_next)) { + dfe->last_item = nv; + dfe->name = (char *)namevalue_get_name(nv); + dfe->value = nv->value; reference_counter_acquire(dfe->dict, nv); } else { - dfe->next_position_index = NULL; + dfe->last_item = NULL; dfe->name = NULL; dfe->value = NULL; } @@ -889,14 +1326,21 @@ void *dictionary_foreach_next(DICTFE *dfe) { usec_t dictionary_foreach_done(DICTFE *dfe) { if(unlikely(!dfe || !dfe->dict)) return 0; - NAME_VALUE *nv = (NAME_VALUE *)dfe->last_position_index; - if(nv) - reference_counter_release(dfe->dict, nv); + if(unlikely(dfe->dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_foreach_next() on a destroyed dictionary"); + return 0; + } - dictionary_unlock((DICTIONARY *)dfe->dict); + // the item we just did + NAME_VALUE *nv = (NAME_VALUE *)dfe->last_item; + + // release it, so that it can possibly be deleted + if(likely(nv)) + reference_counter_release(dfe->dict, nv, false); + + dictionary_unlock(dfe->dict, dfe->rw); dfe->dict = NULL; - dfe->last_position_index = NULL; - dfe->next_position_index = NULL; + dfe->last_item = NULL; dfe->name = NULL; dfe->value = NULL; @@ -912,21 +1356,40 @@ usec_t dictionary_foreach_done(DICTFE *dfe) { // do not use other dictionary calls while walking the dictionary - deadlock! int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const char *name, void *entry, void *data), void *data) { - if(rw == 'r' || rw == 'R') - dictionary_lock_rlock(dict); - else - dictionary_lock_wrlock(dict); + if(unlikely(!dict)) return 0; + + if(unlikely(dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_walkthrough_rw() on a destroyed dictionary"); + return 0; + } + + dictionary_lock(dict, rw); + + DICTIONARY_STATS_WALKTHROUGHS_PLUS1(dict); // written in such a way, that the callback can delete the active element int ret = 0; NAME_VALUE *nv = dict->first_item, *nv_next; while(nv) { - nv_next = nv->next; + // skip the deleted items + if(unlikely(nv->flags & NAME_VALUE_FLAG_DELETED)) { + nv = nv->next; + continue; + } + + // get a reference counter, so that our item will not be deleted + // while we are using it reference_counter_acquire(dict, nv); - int r = callback(nv->name, nv->value, data); - reference_counter_release(dict, nv); + + int r = callback(namevalue_get_name(nv), nv->value, data); + + // since we have a reference counter, this item cannot be deleted + // until we release the reference counter, so the pointers are there + nv_next = nv->next; + reference_counter_release(dict, nv, false); + if(unlikely(r < 0)) { ret = r; break; @@ -937,11 +1400,248 @@ int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const c nv = nv_next; } - dictionary_unlock(dict); + dictionary_unlock(dict, rw); + + return ret; +} + +// ---------------------------------------------------------------------------- +// sorted walkthrough + +static int dictionary_sort_compar(const void *nv1, const void *nv2) { + return strcmp(namevalue_get_name((*(NAME_VALUE **)nv1)), namevalue_get_name((*(NAME_VALUE **)nv2))); +} + +int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const char *name, void *entry, void *data), void *data) { + if(unlikely(!dict || !dict->entries)) return 0; + + if(unlikely(dict->flags & DICTIONARY_FLAG_DESTROYED)) { + internal_error(true, "DICTIONARY: attempted to dictionary_sorted_walkthrough_rw() on a destroyed dictionary"); + return 0; + } + + dictionary_lock(dict, rw); + dictionary_defer_all_deletions_unsafe(dict, rw); + + DICTIONARY_STATS_WALKTHROUGHS_PLUS1(dict); + + size_t count = dict->entries; + NAME_VALUE **array = mallocz(sizeof(NAME_VALUE *) * count); + + size_t i; + NAME_VALUE *nv; + for(nv = dict->first_item, i = 0; nv && i < count ;nv = nv->next) { + if(likely(!(nv->flags & NAME_VALUE_FLAG_DELETED))) + array[i++] = nv; + } + + internal_error(nv != NULL, "DICTIONARY: during sorting expected to have %zu items in dictionary, but there are more. Sorted results may be incomplete. Dictionary fails to maintain an accurate number of the number of entries it has.", count); + + if(unlikely(i != count)) { + internal_error(true, "DICTIONARY: during sorting expected to have %zu items in dictionary, but there are %zu. Sorted results may be incomplete. Dictionary fails to maintain an accurate number of the number of entries it has.", count, i); + count = i; + } + + qsort(array, count, sizeof(NAME_VALUE *), dictionary_sort_compar); + + int ret = 0; + for(i = 0; i < count ;i++) { + nv = array[i]; + if(likely(!(nv->flags & NAME_VALUE_FLAG_DELETED))) { + reference_counter_acquire(dict, nv); + int r = callback(namevalue_get_name(nv), nv->value, data); + reference_counter_release(dict, nv, false); + if (r < 0) { + ret = r; + break; + } + ret += r; + } + } + + dictionary_restore_all_deletions_unsafe(dict, rw); + dictionary_unlock(dict, rw); + freez(array); return ret; } +// ---------------------------------------------------------------------------- +// STRING implementation - dedup all STRINGs + +typedef struct string_entry { +#ifdef DICTIONARY_WITH_AVL + avl_t avl_node; +#endif + uint32_t length; // the string length with the terminating '\0' + uint32_t refcount; // how many times this string is used + const char str[]; // the string itself +} STRING_ENTRY; + +#ifdef DICTIONARY_WITH_AVL +static int string_entry_compare(void* a, void* b) { + return strcmp(((STRING_ENTRY *)a)->str, ((STRING_ENTRY *)b)->str); +} + +static void *get_thread_static_string_entry(const char *name) { + static __thread size_t _length = 0; + static __thread STRING_ENTRY *_tmp = NULL; + + size_t size = sizeof(STRING_ENTRY) + strlen(name) + 1; + if(likely(_tmp && _length < size)) { + freez(_tmp); + _tmp = NULL; + _length = 0; + } + + if(unlikely(!_tmp)) { + _tmp = callocz(1, size); + _length = size; + } + + strcpy((char *)&_tmp->str[0], name); + return _tmp; +} +#endif + +DICTIONARY string_dictionary = { +#ifdef DICTIONARY_WITH_AVL + .values_index = { + .root = NULL, + .compar = string_entry_compare + }, + .get_thread_static_name_value = get_thread_static_string_entry, +#endif + + .flags = DICTIONARY_FLAG_EXCLUSIVE_ACCESS, + .rwlock = NETDATA_RWLOCK_INITIALIZER +}; + +static netdata_mutex_t string_mutex = NETDATA_MUTEX_INITIALIZER; + +STRING *string_dup(STRING *string) { + if(unlikely(!string)) return NULL; + + STRING_ENTRY *se = (STRING_ENTRY *)string; + netdata_mutex_lock(&string_mutex); + se->refcount++; + netdata_mutex_unlock(&string_mutex); + return string; +} + +STRING *string_strdupz(const char *str) { + if(unlikely(!str || !*str)) return NULL; + + netdata_mutex_lock(&string_mutex); + + size_t length = strlen(str) + 1; + STRING_ENTRY *se; + STRING_ENTRY **ptr = (STRING_ENTRY **)hashtable_insert_unsafe(&string_dictionary, str, length); + if(unlikely(*ptr == 0)) { + // a new item added to the index + size_t mem_size = sizeof(STRING_ENTRY) + length; + se = mallocz(mem_size); + strcpy((char *)se->str, str); + se->length = length; + se->refcount = 1; + *ptr = se; + hashtable_inserted_name_value_unsafe(&string_dictionary, se); + string_dictionary.version++; + string_dictionary.inserts++; + string_dictionary.entries++; + string_dictionary.memory += (long)mem_size; + } + else { + // the item is already in the index + se = *ptr; + se->refcount++; + string_dictionary.searches++; + } + + netdata_mutex_unlock(&string_mutex); + return (STRING *)se; +} + +void string_freez(STRING *string) { + if(unlikely(!string)) return; + netdata_mutex_lock(&string_mutex); + + STRING_ENTRY *se = (STRING_ENTRY *)string; + + if(se->refcount == 0) + fatal("STRING: tried to free string that has zero references."); + + se->refcount--; + if(unlikely(se->refcount == 0)) { + if(hashtable_delete_unsafe(&string_dictionary, se->str, se->length, se) == 0) + error("STRING: INTERNAL ERROR: tried to delete '%s' that is not in the index", se->str); + + size_t mem_size = sizeof(STRING_ENTRY) + se->length; + freez(se); + string_dictionary.version++; + string_dictionary.deletes++; + string_dictionary.entries--; + string_dictionary.memory -= (long)mem_size; + } + + netdata_mutex_unlock(&string_mutex); +} + +size_t string_length(STRING *string) { + if(unlikely(!string)) return 0; + return ((STRING_ENTRY *)string)->length - 1; +} + +const char *string2str(STRING *string) { + if(unlikely(!string)) return ""; + return ((STRING_ENTRY *)string)->str; +} + +STRING *string_2way_merge(STRING *a, STRING *b) { + static STRING *X = NULL; + + if(unlikely(!X)) { + X = string_strdupz("[x]"); + } + + if(unlikely(a == b)) return string_dup(a); + if(unlikely(a == X)) return string_dup(a); + if(unlikely(b == X)) return string_dup(b); + if(unlikely(!a)) return string_dup(X); + if(unlikely(!b)) return string_dup(X); + + size_t alen = string_length(a); + size_t blen = string_length(b); + size_t length = alen + blen + string_length(X) + 1; + char buf1[length + 1], buf2[length + 1], *dst1; + const char *s1, *s2; + + s1 = string2str(a); + s2 = string2str(b); + dst1 = buf1; + for( ; *s1 && *s2 && *s1 == *s2 ;s1++, s2++) + *dst1++ = *s1; + + *dst1 = '\0'; + + if(*s1 != '\0' || *s2 != '\0') { + *dst1++ = '['; + *dst1++ = 'x'; + *dst1++ = ']'; + + s1 = &(string2str(a))[alen - 1]; + s2 = &(string2str(b))[blen - 1]; + char *dst2 = &buf2[length]; + *dst2 = '\0'; + for (; *s1 && *s2 && *s1 == *s2; s1--, s2--) + *(--dst2) = *s1; + + strcpy(dst1, dst2); + } + + return string_strdupz(buf1); +} + // ---------------------------------------------------------------------------- // unit test @@ -983,6 +1683,22 @@ static size_t dictionary_unittest_set_clone(DICTIONARY *dict, char **names, char return errors; } +static size_t dictionary_unittest_set_null(DICTIONARY *dict, char **names, char **values, size_t entries) { + (void)values; + size_t errors = 0; + long i = 0; + for(; i < (long)entries ;i++) { + void *val = dictionary_set(dict, names[i], NULL, 0); + if(val != NULL) { fprintf(stderr, ">>> %s() returns a non NULL value\n", __FUNCTION__); errors++; } + } + if(dictionary_stats_entries(dict) != i) { + fprintf(stderr, ">>> %s() dictionary items do not match\n", __FUNCTION__); + errors++; + } + return errors; +} + + static size_t dictionary_unittest_set_nonclone(DICTIONARY *dict, char **names, char **values, size_t entries) { size_t errors = 0; for(size_t i = 0; i < entries ;i++) { @@ -1182,7 +1898,7 @@ static size_t dictionary_unittest_destroy(DICTIONARY *dict, char **names, char * } static usec_t dictionary_unittest_run_and_measure_time(DICTIONARY *dict, char *message, char **names, char **values, size_t entries, size_t *errors, size_t (*callback)(DICTIONARY *dict, char **names, char **values, size_t entries)) { - fprintf(stderr, "%-40s... ", message); + fprintf(stderr, "%40s ... ", message); usec_t started = now_realtime_usec(); size_t errs = callback(dict, names, values, entries); @@ -1191,12 +1907,12 @@ static usec_t dictionary_unittest_run_and_measure_time(DICTIONARY *dict, char *m if(callback == dictionary_unittest_destroy) dict = NULL; - fprintf(stderr, " %zu errors, %zu items in dictionary, %llu usec \n", errs, dict? dictionary_stats_entries(dict):0, dt); + fprintf(stderr, " %zu errors, %ld items in dictionary, %llu usec \n", errs, dict? dictionary_stats_entries(dict):0, dt); *errors += errs; return dt; } -void dictionary_unittest_clone(DICTIONARY *dict, char **names, char **values, size_t entries, size_t *errors) { +static void dictionary_unittest_clone(DICTIONARY *dict, char **names, char **values, size_t entries, size_t *errors) { dictionary_unittest_run_and_measure_time(dict, "adding entries", names, values, entries, errors, dictionary_unittest_set_clone); dictionary_unittest_run_and_measure_time(dict, "getting entries", names, values, entries, errors, dictionary_unittest_get_clone); dictionary_unittest_run_and_measure_time(dict, "getting non-existing entries", names, values, entries, errors, dictionary_unittest_get_nonexisting); @@ -1211,7 +1927,7 @@ void dictionary_unittest_clone(DICTIONARY *dict, char **names, char **values, si dictionary_unittest_run_and_measure_time(dict, "destroying empty dictionary", names, values, entries, errors, dictionary_unittest_destroy); } -void dictionary_unittest_nonclone(DICTIONARY *dict, char **names, char **values, size_t entries, size_t *errors) { +static void dictionary_unittest_nonclone(DICTIONARY *dict, char **names, char **values, size_t entries, size_t *errors) { dictionary_unittest_run_and_measure_time(dict, "adding entries", names, values, entries, errors, dictionary_unittest_set_nonclone); dictionary_unittest_run_and_measure_time(dict, "getting entries", names, values, entries, errors, dictionary_unittest_get_nonclone); dictionary_unittest_run_and_measure_time(dict, "getting non-existing entries", names, values, entries, errors, dictionary_unittest_get_nonexisting); @@ -1226,6 +1942,217 @@ void dictionary_unittest_nonclone(DICTIONARY *dict, char **names, char **values, dictionary_unittest_run_and_measure_time(dict, "destroying empty dictionary", names, values, entries, errors, dictionary_unittest_destroy); } +struct dictionary_unittest_sorting { + const char *oldname; + const char *oldvalue; + size_t count; +}; + +static int dictionary_unittest_sorting_callback(const char *name, void *value, void *data) { + struct dictionary_unittest_sorting *t = (struct dictionary_unittest_sorting *)data; + const char *v = (const char *)value; + + int ret = 0; + if(t->oldname && strcmp(t->oldname, name) > 0) { + fprintf(stderr, "name '%s' should be after '%s'\n", t->oldname, name); + ret = 1; + } + t->count++; + t->oldname = name; + t->oldvalue = v; + + return ret; +} + +static size_t dictionary_unittest_sorted_walkthrough(DICTIONARY *dict, char **names, char **values, size_t entries) { + (void)names; + (void)values; + struct dictionary_unittest_sorting tmp = { .oldname = NULL, .oldvalue = NULL, .count = 0 }; + size_t errors; + errors = dictionary_sorted_walkthrough_read(dict, dictionary_unittest_sorting_callback, &tmp); + + if(tmp.count != entries) { + fprintf(stderr, "Expected %zu entries, counted %zu\n", entries, tmp.count); + errors++; + } + return errors; +} + +static void dictionary_unittest_sorting(DICTIONARY *dict, char **names, char **values, size_t entries, size_t *errors) { + dictionary_unittest_run_and_measure_time(dict, "adding entries", names, values, entries, errors, dictionary_unittest_set_clone); + dictionary_unittest_run_and_measure_time(dict, "sorted walkthrough", names, values, entries, errors, dictionary_unittest_sorted_walkthrough); +} + +static void dictionary_unittest_null_dfe(DICTIONARY *dict, char **names, char **values, size_t entries, size_t *errors) { + dictionary_unittest_run_and_measure_time(dict, "adding null value entries", names, values, entries, errors, dictionary_unittest_set_null); + dictionary_unittest_run_and_measure_time(dict, "traverse foreach read loop", names, values, entries, errors, dictionary_unittest_foreach); +} + + +static int check_dictionary_callback(const char *name, void *value, void *data) { + (void)name; + (void)value; + (void)data; + return 1; +} + +static size_t check_dictionary(DICTIONARY *dict, size_t entries, size_t linked_list_members) { + size_t errors = 0; + + fprintf(stderr, "dictionary entries %ld, expected %zu...\t\t\t\t\t", dictionary_stats_entries(dict), entries); + if (dictionary_stats_entries(dict) != (long)entries) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + size_t ll = 0; + void *t; + dfe_start_read(dict, t) + ll++; + dfe_done(t); + + fprintf(stderr, "dictionary foreach entries %zu, expected %zu...\t\t\t\t", ll, entries); + if(ll != entries) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + ll = dictionary_walkthrough_read(dict, check_dictionary_callback, NULL); + fprintf(stderr, "dictionary walkthrough entries %zu, expected %zu...\t\t\t\t", ll, entries); + if(ll != entries) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + ll = dictionary_sorted_walkthrough_read(dict, check_dictionary_callback, NULL); + fprintf(stderr, "dictionary sorted walkthrough entries %zu, expected %zu...\t\t\t", ll, entries); + if(ll != entries) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + NAME_VALUE *nv; + for(ll = 0, nv = dict->first_item; nv ;nv = nv->next) + ll++; + + fprintf(stderr, "dictionary linked list entries %zu, expected %zu...\t\t\t\t", ll, linked_list_members); + if(ll != linked_list_members) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + return errors; +} + +static int check_name_value_callback(const char *name, void *value, void *data) { + (void)name; + return value == data; +} + +static size_t check_name_value_deleted_flag(DICTIONARY *dict, NAME_VALUE *nv, const char *name, const char *value, unsigned refcount, NAME_VALUE_FLAGS deleted_flags, bool searchable, bool browsable, bool linked) { + size_t errors = 0; + + fprintf(stderr, "NAME_VALUE name is '%s', expected '%s'...\t\t\t\t", namevalue_get_name(nv), name); + if(strcmp(namevalue_get_name(nv), name) != 0) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + fprintf(stderr, "NAME_VALUE value is '%s', expected '%s'...\t\t\t", (const char *)nv->value, value); + if(strcmp((const char *)nv->value, value) != 0) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + fprintf(stderr, "NAME_VALUE refcount is %u, expected %u...\t\t\t\t\t", nv->refcount, refcount); + if (nv->refcount != refcount) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + fprintf(stderr, "NAME_VALUE deleted flag is %s, expected %s...\t\t\t", (nv->flags & NAME_VALUE_FLAG_DELETED)?"TRUE":"FALSE", (deleted_flags & NAME_VALUE_FLAG_DELETED)?"TRUE":"FALSE"); + if ((nv->flags & NAME_VALUE_FLAG_DELETED) != (deleted_flags & NAME_VALUE_FLAG_DELETED)) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + void *v = dictionary_get(dict, name); + bool found = v == nv->value; + fprintf(stderr, "NAME_VALUE searchable %5s, expected %5s...\t\t\t\t", found?"true":"false", searchable?"true":"false"); + if(found != searchable) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + found = false; + void *t; + dfe_start_read(dict, t) { + if(t == nv->value) found = true; + } + dfe_done(t); + + fprintf(stderr, "NAME_VALUE dfe browsable %5s, expected %5s...\t\t\t", found?"true":"false", browsable?"true":"false"); + if(found != browsable) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + found = dictionary_walkthrough_read(dict, check_name_value_callback, nv->value); + fprintf(stderr, "NAME_VALUE walkthrough browsable %5s, expected %5s...\t\t", found?"true":"false", browsable?"true":"false"); + if(found != browsable) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + found = dictionary_sorted_walkthrough_read(dict, check_name_value_callback, nv->value); + fprintf(stderr, "NAME_VALUE sorted walkthrough browsable %5s, expected %5s...\t", found?"true":"false", browsable?"true":"false"); + if(found != browsable) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + found = false; + NAME_VALUE *n; + for(n = dict->first_item; n ;n = n->next) + if(n == nv) found = true; + + fprintf(stderr, "NAME_VALUE linked %5s, expected %5s...\t\t\t\t", found?"true":"false", linked?"true":"false"); + if(found != linked) { + fprintf(stderr, "FAILED\n"); + errors++; + } + else + fprintf(stderr, "OK\n"); + + return errors; +} + int dictionary_unittest(size_t entries) { if(entries < 10) entries = 10; @@ -1237,23 +2164,23 @@ int dictionary_unittest(size_t entries) { char **values = dictionary_unittest_generate_values(entries); fprintf(stderr, "\nCreating dictionary single threaded, clone, %zu items\n", entries); - dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_WITH_STATISTICS); + dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED); dictionary_unittest_clone(dict, names, values, entries, &errors); fprintf(stderr, "\nCreating dictionary multi threaded, clone, %zu items\n", entries); - dict = dictionary_create(DICTIONARY_FLAG_WITH_STATISTICS); + dict = dictionary_create(DICTIONARY_FLAG_NONE); dictionary_unittest_clone(dict, names, values, entries, &errors); fprintf(stderr, "\nCreating dictionary single threaded, non-clone, add-in-front options, %zu items\n", entries); - dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_WITH_STATISTICS|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_ADD_IN_FRONT); + dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_ADD_IN_FRONT); dictionary_unittest_nonclone(dict, names, values, entries, &errors); fprintf(stderr, "\nCreating dictionary multi threaded, non-clone, add-in-front options, %zu items\n", entries); - dict = dictionary_create(DICTIONARY_FLAG_WITH_STATISTICS|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_ADD_IN_FRONT); + dict = dictionary_create(DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_ADD_IN_FRONT); dictionary_unittest_nonclone(dict, names, values, entries, &errors); fprintf(stderr, "\nCreating dictionary single-threaded, non-clone, don't overwrite options, %zu items\n", entries); - dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_WITH_STATISTICS|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); dictionary_unittest_run_and_measure_time(dict, "adding entries", names, values, entries, &errors, dictionary_unittest_set_nonclone); dictionary_unittest_run_and_measure_time(dict, "resetting non-overwrite entries", names, values, entries, &errors, dictionary_unittest_reset_dont_overwrite_nonclone); dictionary_unittest_run_and_measure_time(dict, "traverse foreach read loop", names, values, entries, &errors, dictionary_unittest_foreach); @@ -1262,22 +2189,222 @@ int dictionary_unittest(size_t entries) { dictionary_unittest_run_and_measure_time(dict, "destroying full dictionary", names, values, entries, &errors, dictionary_unittest_destroy); fprintf(stderr, "\nCreating dictionary multi-threaded, non-clone, don't overwrite options, %zu items\n", entries); - dict = dictionary_create(DICTIONARY_FLAG_WITH_STATISTICS|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + dict = dictionary_create(DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); dictionary_unittest_run_and_measure_time(dict, "adding entries", names, values, entries, &errors, dictionary_unittest_set_nonclone); dictionary_unittest_run_and_measure_time(dict, "walkthrough write delete this", names, values, entries, &errors, dictionary_unittest_walkthrough_delete_this); dictionary_unittest_run_and_measure_time(dict, "destroying empty dictionary", names, values, entries, &errors, dictionary_unittest_destroy); fprintf(stderr, "\nCreating dictionary multi-threaded, non-clone, don't overwrite options, %zu items\n", entries); - dict = dictionary_create(DICTIONARY_FLAG_WITH_STATISTICS|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); + dict = dictionary_create(DICTIONARY_FLAG_NAME_LINK_DONT_CLONE|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE|DICTIONARY_FLAG_DONT_OVERWRITE_VALUE); dictionary_unittest_run_and_measure_time(dict, "adding entries", names, values, entries, &errors, dictionary_unittest_set_nonclone); dictionary_unittest_run_and_measure_time(dict, "foreach write delete this", names, values, entries, &errors, dictionary_unittest_foreach_delete_this); dictionary_unittest_run_and_measure_time(dict, "traverse foreach read loop empty", names, values, 0, &errors, dictionary_unittest_foreach); dictionary_unittest_run_and_measure_time(dict, "walkthrough read callback empty", names, values, 0, &errors, dictionary_unittest_walkthrough); dictionary_unittest_run_and_measure_time(dict, "destroying empty dictionary", names, values, entries, &errors, dictionary_unittest_destroy); + fprintf(stderr, "\nCreating dictionary single threaded, clone, %zu items\n", entries); + dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED); + dictionary_unittest_sorting(dict, names, values, entries, &errors); + dictionary_unittest_run_and_measure_time(dict, "destroying full dictionary", names, values, entries, &errors, dictionary_unittest_destroy); + + fprintf(stderr, "\nCreating dictionary single threaded, clone, %zu items\n", entries); + dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED); + dictionary_unittest_null_dfe(dict, names, values, entries, &errors); + dictionary_unittest_run_and_measure_time(dict, "destroying full dictionary", names, values, entries, &errors, dictionary_unittest_destroy); + + fprintf(stderr, "\nCreating dictionary single threaded, noclone, %zu items\n", entries); + dict = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE); + dictionary_unittest_null_dfe(dict, names, values, entries, &errors); + dictionary_unittest_run_and_measure_time(dict, "destroying full dictionary", names, values, entries, &errors, dictionary_unittest_destroy); + + // check reference counters + { + fprintf(stderr, "\nTesting reference counters:\n"); + dict = dictionary_create(DICTIONARY_FLAG_NONE|DICTIONARY_FLAG_NAME_LINK_DONT_CLONE); + errors += check_dictionary(dict, 0, 0); + + fprintf(stderr, "\nAdding test item to dictionary and acquiring it\n"); + dictionary_set(dict, "test", "ITEM1", 6); + NAME_VALUE *nv = (NAME_VALUE *)dictionary_get_and_acquire_item(dict, "test"); + + errors += check_dictionary(dict, 1, 1); + errors += check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 1, NAME_VALUE_FLAG_NONE, true, true, true); + + fprintf(stderr, "\nChecking that reference counters are increased:\n"); + void *t; + dfe_start_read(dict, t) { + errors += check_dictionary(dict, 1, 1); + errors += + check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 2, NAME_VALUE_FLAG_NONE, true, true, true); + } + dfe_done(t); + + fprintf(stderr, "\nChecking that reference counters are decreased:\n"); + errors += check_dictionary(dict, 1, 1); + errors += check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 1, NAME_VALUE_FLAG_NONE, true, true, true); + + fprintf(stderr, "\nDeleting the item we have acquired:\n"); + dictionary_del(dict, "test"); + + errors += check_dictionary(dict, 0, 1); + errors += check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 1, NAME_VALUE_FLAG_DELETED, false, false, true); + + fprintf(stderr, "\nAdding another item with the same name of the item we deleted, while being acquired:\n"); + dictionary_set(dict, "test", "ITEM2", 6); + errors += check_dictionary(dict, 1, 2); + + fprintf(stderr, "\nAcquiring the second item:\n"); + NAME_VALUE *nv2 = (NAME_VALUE *)dictionary_get_and_acquire_item(dict, "test"); + errors += check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 1, NAME_VALUE_FLAG_DELETED, false, false, true); + errors += check_name_value_deleted_flag(dict, nv2, "test", "ITEM2", 1, NAME_VALUE_FLAG_NONE, true, true, true); + + fprintf(stderr, "\nReleasing the second item (the first is still acquired):\n"); + dictionary_acquired_item_release(dict, (DICTIONARY_ITEM *)nv2); + errors += check_dictionary(dict, 1, 2); + errors += check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 1, NAME_VALUE_FLAG_DELETED, false, false, true); + errors += check_name_value_deleted_flag(dict, nv2, "test", "ITEM2", 0, NAME_VALUE_FLAG_NONE, true, true, true); + + fprintf(stderr, "\nDeleting the second item (the first is still acquired):\n"); + dictionary_del(dict, "test"); + errors += check_dictionary(dict, 0, 1); + errors += check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 1, NAME_VALUE_FLAG_DELETED, false, false, true); + + fprintf(stderr, "\nReleasing the first item (which we have already deleted):\n"); + dictionary_acquired_item_release(dict, (DICTIONARY_ITEM *)nv); + errors += check_dictionary(dict, 0, 0); + + fprintf(stderr, "\nAdding again the test item to dictionary and acquiring it\n"); + dictionary_set(dict, "test", "ITEM1", 6); + nv = (NAME_VALUE *)dictionary_get_and_acquire_item(dict, "test"); + + errors += check_dictionary(dict, 1, 1); + errors += check_name_value_deleted_flag(dict, nv, "test", "ITEM1", 1, NAME_VALUE_FLAG_NONE, true, true, true); + + fprintf(stderr, "\nDestroying the dictionary while we have acquired an item\n"); + dictionary_destroy(dict); + + fprintf(stderr, "Releasing the item (on a destroyed dictionary)\n"); + dictionary_acquired_item_release(dict, (DICTIONARY_ITEM *)nv); + nv = NULL; + dict = NULL; + } + + // check string + { + long string_entries_starting = dictionary_stats_entries(&string_dictionary); + + fprintf(stderr, "\nChecking strings...\n"); + + STRING *s1 = string_strdupz("hello unittest"); + STRING *s2 = string_strdupz("hello unittest"); + if(s1 != s2) { + errors++; + fprintf(stderr, "ERROR: duplicating strings are not deduplicated\n"); + } + else + fprintf(stderr, "OK: duplicating string are deduplicated\n"); + + STRING *s3 = string_dup(s1); + if(s3 != s1) { + errors++; + fprintf(stderr, "ERROR: cloning strings are not deduplicated\n"); + } + else + fprintf(stderr, "OK: cloning string are deduplicated\n"); + + STRING_ENTRY *se = (STRING_ENTRY *)s1; + if(se->refcount != 3) { + errors++; + fprintf(stderr, "ERROR: string refcount is not 3\n"); + } + else + fprintf(stderr, "OK: string refcount is 3\n"); + + STRING *s4 = string_strdupz("world unittest"); + if(s4 == s1) { + errors++; + fprintf(stderr, "ERROR: string is sharing pointers on different strings\n"); + } + else + fprintf(stderr, "OK: string is properly handling different strings\n"); + + usec_t start_ut, end_ut; + STRING **strings = mallocz(entries * sizeof(STRING *)); + + start_ut = now_realtime_usec(); + for(size_t i = 0; i < entries ;i++) { + strings[i] = string_strdupz(names[i]); + } + end_ut = now_realtime_usec(); + fprintf(stderr, "Created %zu strings in %llu usecs\n", entries, end_ut - start_ut); + + start_ut = now_realtime_usec(); + for(size_t i = 0; i < entries ;i++) { + strings[i] = string_dup(strings[i]); + } + end_ut = now_realtime_usec(); + fprintf(stderr, "Cloned %zu strings in %llu usecs\n", entries, end_ut - start_ut); + + start_ut = now_realtime_usec(); + for(size_t i = 0; i < entries ;i++) { + string_freez(strings[i]); + string_freez(strings[i]); + } + end_ut = now_realtime_usec(); + fprintf(stderr, "Freed %zu strings in %llu usecs\n", entries, end_ut - start_ut); + + freez(strings); + + if(dictionary_stats_entries(&string_dictionary) != string_entries_starting + 2) { + errors++; + fprintf(stderr, "ERROR: strings dictionary should have %ld items but it has %ld\n", string_entries_starting + 2, dictionary_stats_entries(&string_dictionary)); + } + else + fprintf(stderr, "OK: strings dictionary has 2 items\n"); + } + + // check 2-way merge + { + struct testcase { + char *src1; char *src2; char *expected; + } tests[] = { + { "", "", ""}, + { "a", "", "[x]"}, + { "", "a", "[x]"}, + { "a", "a", "a"}, + { "abcd", "abcd", "abcd"}, + { "foo_cs", "bar_cs", "[x]_cs"}, + { "cp_UNIQUE_INFIX_cs", "cp_unique_infix_cs", "cp_[x]_cs"}, + { "cp_UNIQUE_INFIX_ci_unique_infix_cs", "cp_unique_infix_ci_UNIQUE_INFIX_cs", "cp_[x]_cs"}, + { "foo[1234]", "foo[4321]", "foo[[x]]"}, + { NULL, NULL, NULL }, + }; + + for (struct testcase *tc = &tests[0]; tc->expected != NULL; tc++) { + STRING *src1 = string_strdupz(tc->src1); + STRING *src2 = string_strdupz(tc->src2); + STRING *expected = string_strdupz(tc->expected); + + STRING *result = string_2way_merge(src1, src2); + if (string_cmp(result, expected) != 0) { + fprintf(stderr, "string_2way_merge(\"%s\", \"%s\") -> \"%s\" (expected=\"%s\")\n", + string2str(src1), + string2str(src2), + string2str(result), + string2str(expected)); + errors++; + } + + string_freez(src1); + string_freez(src2); + string_freez(expected); + string_freez(result); + } + } + dictionary_unittest_free_char_pp(names, entries); dictionary_unittest_free_char_pp(values, entries); fprintf(stderr, "\n%zu errors found\n", errors); - return (int)errors; + return errors ? 1 : 0; } diff --git a/libnetdata/dictionary/dictionary.h b/libnetdata/dictionary/dictionary.h index 356bf1895..fdb2088c0 100644 --- a/libnetdata/dictionary/dictionary.h +++ b/libnetdata/dictionary/dictionary.h @@ -35,23 +35,34 @@ * */ -#ifndef DICTIONARY_INTERNALS -typedef void DICTIONARY; -#endif +typedef struct dictionary DICTIONARY; +typedef struct dictionary_item DICTIONARY_ITEM; typedef enum dictionary_flags { - DICTIONARY_FLAG_NONE = 0, // the default is the opposite of all below - DICTIONARY_FLAG_SINGLE_THREADED = (1 << 0), // don't use any locks (default: use locks) - DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE = (1 << 1), // don't copy the value, just point to the one provided (default: copy) - DICTIONARY_FLAG_NAME_LINK_DONT_CLONE = (1 << 2), // don't copy the name, just point to the one provided (default: copy) - DICTIONARY_FLAG_WITH_STATISTICS = (1 << 3), // maintain statistics about dictionary operations (default: disabled) - DICTIONARY_FLAG_DONT_OVERWRITE_VALUE = (1 << 4), // don't overwrite values of dictionary items (default: overwrite) - DICTIONARY_FLAG_ADD_IN_FRONT = (1 << 5), // add dictionary items at the front of the linked list (default: at the end) - DICTIONARY_FLAG_RESERVED1 = (1 << 6), // this is reserved for DICTIONARY_FLAG_REFERENCE_COUNTERS + DICTIONARY_FLAG_NONE = 0, // the default is the opposite of all below + DICTIONARY_FLAG_SINGLE_THREADED = (1 << 0), // don't use any locks (default: use locks) + DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE = (1 << 1), // don't copy the value, just point to the one provided (default: copy) + DICTIONARY_FLAG_NAME_LINK_DONT_CLONE = (1 << 2), // don't copy the name, just point to the one provided (default: copy) + DICTIONARY_FLAG_DONT_OVERWRITE_VALUE = (1 << 3), // don't overwrite values of dictionary items (default: overwrite) + DICTIONARY_FLAG_ADD_IN_FRONT = (1 << 4), // add dictionary items at the front of the linked list (default: at the end) + + // to change the value of the following, you also need to change the corresponding #defines in dictionary.c + DICTIONARY_FLAG_RESERVED1 = (1 << 29), // reserved for DICTIONARY_FLAG_EXCLUSIVE_ACCESS + DICTIONARY_FLAG_RESERVED2 = (1 << 30), // reserved for DICTIONARY_FLAG_DESTROYED + DICTIONARY_FLAG_RESERVED3 = (1 << 31), // reserved for DICTIONARY_FLAG_DEFER_ALL_DELETIONS } DICTIONARY_FLAGS; // Create a dictionary -extern DICTIONARY *dictionary_create(DICTIONARY_FLAGS flags); +#ifdef NETDATA_INTERNAL_CHECKS +#define dictionary_create(flags) dictionary_create_advanced_with_trace(flags, 0, __FUNCTION__, __LINE__, __FILE__); +#define dictionary_create_advanced(flags) dictionary_create_advanced_with_trace(flags, 0, __FUNCTION__, __LINE__, __FILE__); +extern DICTIONARY *dictionary_create_advanced_with_trace(DICTIONARY_FLAGS flags, size_t scratchpad_size, const char *function, size_t line, const char *file); +#else +#define dictionary_create(flags) dictionary_create_advanced(flags, 0); +extern DICTIONARY *dictionary_create_advanced(DICTIONARY_FLAGS flags, size_t scratchpad_size); +#endif + +extern void *dictionary_scratchpad(DICTIONARY *dict); // an insert callback to be called just after an item is added to the dictionary // this callback is called while the dictionary is write locked! @@ -66,6 +77,11 @@ extern void dictionary_register_delete_callback(DICTIONARY *dict, void (*del_cal // the old_value will remain in the dictionary - the new_value is ignored extern void dictionary_register_conflict_callback(DICTIONARY *dict, void (*conflict_callback)(const char *name, void *old_value, void *new_value, void *data), void *data); +// a reaction callback to be called after every item insertion or conflict +// after the constructors have finished and the items are fully available for use +// and the dictionary is not write locked anymore +extern void dictionary_register_react_callback(DICTIONARY *dict, void (*react_callback)(const char *name, void *value, void *data), void *data); + // Destroy a dictionary // returns the number of bytes freed // the returned value will not include name and value sizes if DICTIONARY_FLAG_WITH_STATISTICS is not set @@ -85,7 +101,7 @@ extern size_t dictionary_destroy(DICTIONARY *dict); // // Passing NULL as value, the dictionary will callocz() the newly allocated value, otherwise it will copy it. // Passing 0 as value_len, the dictionary will set the value to NULL (no allocations for value will be made). -extern void *dictionary_set(DICTIONARY *dict, const char *name, void *value, size_t value_len) NEVERNULL; +extern void *dictionary_set(DICTIONARY *dict, const char *name, void *value, size_t value_len); // Get an item from the dictionary // If it returns NULL, the item is not found @@ -96,6 +112,19 @@ extern void *dictionary_get(DICTIONARY *dict, const char *name); // returns -1 if the item was not found in the index extern int dictionary_del(DICTIONARY *dict, const char *name); +extern DICTIONARY_ITEM *dictionary_get_and_acquire_item_unsafe(DICTIONARY *dict, const char *name); +extern DICTIONARY_ITEM *dictionary_get_and_acquire_item(DICTIONARY *dict, const char *name); + +extern DICTIONARY_ITEM *dictionary_set_and_acquire_item_unsafe(DICTIONARY *dict, const char *name, void *value, size_t value_len); +extern DICTIONARY_ITEM *dictionary_set_and_acquire_item(DICTIONARY *dict, const char *name, void *value, size_t value_len); + +extern void dictionary_acquired_item_release_unsafe(DICTIONARY *dict, DICTIONARY_ITEM *item); +extern void dictionary_acquired_item_release(DICTIONARY *dict, DICTIONARY_ITEM *item); + +extern DICTIONARY_ITEM *dictionary_acquired_item_dup(DICTIONARY_ITEM *item); +extern const char *dictionary_acquired_item_name(DICTIONARY_ITEM *item); +extern void *dictionary_acquired_item_value(DICTIONARY_ITEM *item); + // UNSAFE functions, without locks // to be used when the user is traversing with the right lock type // Read lock is acquired by dictionary_walktrhough_read() and dfe_start_read() @@ -126,6 +155,10 @@ extern int dictionary_del_unsafe(DICTIONARY *dict, const char *name); #define dictionary_walkthrough_write(dict, callback, data) dictionary_walkthrough_rw(dict, 'w', callback, data) extern int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const char *name, void *value, void *data), void *data); +#define dictionary_sorted_walkthrough_read(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'r', callback, data) +#define dictionary_sorted_walkthrough_write(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'w', callback, data) +int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const char *name, void *entry, void *data), void *data); + // Traverse with foreach // // Use like this: @@ -146,29 +179,35 @@ extern int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)( #define DICTFE_CONST const #endif +#define DICTIONARY_LOCK_READ 'r' +#define DICTIONARY_LOCK_WRITE 'w' +#define DICTIONARY_LOCK_NONE 'u' + typedef DICTFE_CONST struct dictionary_foreach { DICTFE_CONST char *name; // the dictionary name of the last item used void *value; // the dictionary value of the last item used // same as the return value of dictfe_start() and dictfe_next() // the following are for internal use only - to keep track of the point we are + char rw; // the lock mode 'r' or 'w' usec_t started_ut; // the time the caller started iterating (now_realtime_usec()) DICTIONARY *dict; // the dictionary upon we work - void *last_position_index; // the internal position index, to remember the position we are at - void *next_position_index; // the internal position index, of the next item + void *last_item; // the item we work on, to remember the position we are at } DICTFE; -#define dfe_start_read(dict, value) dfe_start_rw(dict, value, 'r') -#define dfe_start_write(dict, value) dfe_start_rw(dict, value, 'w') +#define dfe_start_read(dict, value) dfe_start_rw(dict, value, DICTIONARY_LOCK_READ) +#define dfe_start_write(dict, value) dfe_start_rw(dict, value, DICTIONARY_LOCK_WRITE) #define dfe_start_rw(dict, value, mode) \ do { \ DICTFE value ## _dfe = {}; \ - const char *value ## _name; (void)(value ## _name); \ + const char *value ## _name; (void)(value ## _name); (void)value; \ for((value) = dictionary_foreach_start_rw(&value ## _dfe, (dict), (mode)), ( value ## _name ) = value ## _dfe.name; \ - (value) ;\ - (value) = dictionary_foreach_next(&value ## _dfe), ( value ## _name ) = value ## _dfe.name) + (value ## _dfe.name) ;\ + (value) = dictionary_foreach_next(&value ## _dfe), ( value ## _name ) = value ## _dfe.name) \ + { #define dfe_done(value) \ + } \ dictionary_foreach_done(&value ## _dfe); \ } while(0) @@ -177,14 +216,37 @@ extern void * dictionary_foreach_next(DICTFE *dfe); extern usec_t dictionary_foreach_done(DICTFE *dfe); // Get statistics about the dictionary -// If DICTIONARY_FLAG_WITH_STATISTICS is not set, these return zero -extern size_t dictionary_stats_allocated_memory(DICTIONARY *dict); -extern size_t dictionary_stats_entries(DICTIONARY *dict); +extern long int dictionary_stats_allocated_memory(DICTIONARY *dict); +extern long int dictionary_stats_entries(DICTIONARY *dict); +extern size_t dictionary_stats_version(DICTIONARY *dict); extern size_t dictionary_stats_inserts(DICTIONARY *dict); extern size_t dictionary_stats_searches(DICTIONARY *dict); extern size_t dictionary_stats_deletes(DICTIONARY *dict); extern size_t dictionary_stats_resets(DICTIONARY *dict); +extern size_t dictionary_stats_walkthroughs(DICTIONARY *dict); +extern size_t dictionary_stats_referenced_items(DICTIONARY *dict); extern int dictionary_unittest(size_t entries); +// ---------------------------------------------------------------------------- +// STRING implementation + +typedef struct netdata_string STRING; +extern STRING *string_strdupz(const char *str); +extern STRING *string_dup(STRING *string); +extern void string_freez(STRING *string); +extern size_t string_length(STRING *string); +extern const char *string2str(STRING *string) NEVERNULL; + +// keep common prefix/suffix and replace everything else with [x] +extern STRING *string_2way_merge(STRING *a, STRING *b); + +static inline int string_cmp(STRING *s1, STRING *s2) { + // STRINGs are deduplicated, so the same strings have the same pointer + if(unlikely(s1 == s2)) return 0; + + // they differ, do the typical comparison + return strcmp(string2str(s1), string2str(s2)); +} + #endif /* NETDATA_DICTIONARY_H */ diff --git a/libnetdata/ebpf/ebpf.c b/libnetdata/ebpf/ebpf.c index ffb602307..c48f2f24e 100644 --- a/libnetdata/ebpf/ebpf.c +++ b/libnetdata/ebpf/ebpf.c @@ -608,7 +608,7 @@ static void ebpf_update_maps(ebpf_module_t *em, struct bpf_object *obj) void ebpf_update_controller(int fd, ebpf_module_t *em) { uint32_t key = NETDATA_CONTROLLER_APPS_ENABLED; - uint32_t value = em->apps_charts | em->cgroup_charts; + uint32_t value = (em->apps_charts & NETDATA_EBPF_APPS_FLAG_YES) | em->cgroup_charts; int ret = bpf_map_update_elem(fd, &key, &value, 0); if (ret) error("Add key(%u) for controller table failed.", key); @@ -969,7 +969,7 @@ void ebpf_update_module_using_config(ebpf_module_t *modules) EBPF_CFG_UPDATE_EVERY, modules->update_every); modules->apps_charts = appconfig_get_boolean(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_APPLICATION, - modules->apps_charts); + (int) (modules->apps_charts & NETDATA_EBPF_APPS_FLAG_YES)); modules->cgroup_charts = appconfig_get_boolean(modules->cfg, EBPF_GLOBAL_SECTION, EBPF_CFG_CGROUP, modules->cgroup_charts); diff --git a/libnetdata/ebpf/ebpf.h b/libnetdata/ebpf/ebpf.h index ec486b59a..55b68a51e 100644 --- a/libnetdata/ebpf/ebpf.h +++ b/libnetdata/ebpf/ebpf.h @@ -34,6 +34,7 @@ #define EBPF_CFG_PROGRAM_PATH "btf path" #define EBPF_CFG_UPDATE_EVERY "update every" +#define EBPF_CFG_UPDATE_APPS_EVERY_DEFAULT 10 #define EBPF_CFG_PID_SIZE "pid table size" #define EBPF_CFG_APPLICATION "apps" #define EBPF_CFG_CGROUP "cgroups" @@ -212,6 +213,12 @@ typedef struct ebpf_plugin_stats { uint32_t trampolines; // Number of trampolines used } ebpf_plugin_stats_t; +typedef enum netdata_apps_integration_flags { + NETDATA_EBPF_APPS_FLAG_NO, + NETDATA_EBPF_APPS_FLAG_YES, + NETDATA_EBPF_APPS_FLAG_CHART_CREATED +} netdata_apps_integration_flags_t; + typedef struct ebpf_module { const char *thread_name; const char *config_name; @@ -219,7 +226,7 @@ typedef struct ebpf_module { void *(*start_routine)(void *); int update_every; int global_charts; - int apps_charts; + netdata_apps_integration_flags_t apps_charts; int cgroup_charts; netdata_run_mode_t mode; uint32_t thread_id; @@ -233,6 +240,8 @@ typedef struct ebpf_module { uint64_t kernels; netdata_ebpf_load_mode_t load; netdata_ebpf_targets_t *targets; + struct bpf_link **probe_links; + struct bpf_object *objects; } ebpf_module_t; extern int ebpf_get_kernel_version(); @@ -266,6 +275,43 @@ typedef struct netdata_ebpf_histogram { uint64_t histogram[NETDATA_EBPF_HIST_MAX_BINS]; } netdata_ebpf_histogram_t; +typedef struct ebpf_filesystem_partitions { + char *filesystem; + char *optional_filesystem; + char *family; + char *family_name; + struct bpf_object *objects; + struct bpf_link **probe_links; + + netdata_ebpf_histogram_t hread; + netdata_ebpf_histogram_t hwrite; + netdata_ebpf_histogram_t hopen; + netdata_ebpf_histogram_t hadditional; + + uint32_t flags; + uint32_t enabled; + + ebpf_addresses_t addresses; + uint64_t kernels; +} ebpf_filesystem_partitions_t; + +typedef struct ebpf_sync_syscalls { + char *syscall; + int enabled; + uint32_t flags; + + // BTF structure + struct bpf_object *objects; + struct bpf_link **probe_links; + + // BPF structure +#ifdef LIBBPF_MAJOR_VERSION + struct sync_bpf *sync_obj; +#else + void *sync_obj; +#endif +} ebpf_sync_syscalls_t; + extern void ebpf_histogram_dimension_cleanup(char **ptr, size_t length); // Tracepoint helpers diff --git a/libnetdata/eval/eval.c b/libnetdata/eval/eval.c index 7ca45882f..e86cbd587 100644 --- a/libnetdata/eval/eval.c +++ b/libnetdata/eval/eval.c @@ -9,7 +9,7 @@ typedef struct eval_value { int type; union { - calculated_number number; + NETDATA_DOUBLE number; EVAL_VARIABLE *variable; struct eval_node *expression; }; @@ -54,16 +54,16 @@ typedef struct eval_node { static inline void eval_node_free(EVAL_NODE *op); static inline EVAL_NODE *parse_full_expression(const char **string, int *error); static inline EVAL_NODE *parse_one_full_operand(const char **string, int *error); -static inline calculated_number eval_node(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error); +static inline NETDATA_DOUBLE eval_node(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error); static inline void print_parsed_as_node(BUFFER *out, EVAL_NODE *op, int *error); -static inline void print_parsed_as_constant(BUFFER *out, calculated_number n); +static inline void print_parsed_as_constant(BUFFER *out, NETDATA_DOUBLE n); // ---------------------------------------------------------------------------- // evaluation of expressions -static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABLE *v, int *error) { +static inline NETDATA_DOUBLE eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABLE *v, int *error) { static uint32_t this_hash = 0, now_hash = 0, after_hash = 0, before_hash = 0, status_hash = 0, removed_hash = 0, uninitialized_hash = 0, undefined_hash = 0, clear_hash = 0, warning_hash = 0, critical_hash = 0; - calculated_number n; + NETDATA_DOUBLE n; if(unlikely(this_hash == 0)) { this_hash = simple_hash("this"); @@ -179,8 +179,8 @@ static inline calculated_number eval_variable(EVAL_EXPRESSION *exp, EVAL_VARIABL return NAN; } -static inline calculated_number eval_value(EVAL_EXPRESSION *exp, EVAL_VALUE *v, int *error) { - calculated_number n; +static inline NETDATA_DOUBLE eval_value(EVAL_EXPRESSION *exp, EVAL_VALUE *v, int *error) { + NETDATA_DOUBLE n; switch(v->type) { case EVAL_VALUE_EXPRESSION: @@ -204,101 +204,101 @@ static inline calculated_number eval_value(EVAL_EXPRESSION *exp, EVAL_VALUE *v, return n; } -static inline int is_true(calculated_number n) { +static inline int is_true(NETDATA_DOUBLE n) { if(isnan(n)) return 0; if(isinf(n)) return 1; if(n == 0) return 0; return 1; } -calculated_number eval_and(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +NETDATA_DOUBLE eval_and(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { return is_true(eval_value(exp, &op->ops[0], error)) && is_true(eval_value(exp, &op->ops[1], error)); } -calculated_number eval_or(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +NETDATA_DOUBLE eval_or(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { return is_true(eval_value(exp, &op->ops[0], error)) || is_true(eval_value(exp, &op->ops[1], error)); } -calculated_number eval_greater_than_or_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_greater_than_or_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); return isgreaterequal(n1, n2); } -calculated_number eval_less_than_or_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_less_than_or_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); return islessequal(n1, n2); } -calculated_number eval_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); if(isnan(n1) && isnan(n2)) return 1; if(isinf(n1) && isinf(n2)) return 1; if(isnan(n1) || isnan(n2)) return 0; if(isinf(n1) || isinf(n2)) return 0; - return calculated_number_equal(n1, n2); + return considered_equal_ndd(n1, n2); } -calculated_number eval_not_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +NETDATA_DOUBLE eval_not_equal(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { return !eval_equal(exp, op, error); } -calculated_number eval_less(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_less(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); return isless(n1, n2); } -calculated_number eval_greater(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_greater(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); return isgreater(n1, n2); } -calculated_number eval_plus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_plus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); if(isnan(n1) || isnan(n2)) return NAN; if(isinf(n1) || isinf(n2)) return INFINITY; return n1 + n2; } -calculated_number eval_minus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_minus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); if(isnan(n1) || isnan(n2)) return NAN; if(isinf(n1) || isinf(n2)) return INFINITY; return n1 - n2; } -calculated_number eval_multiply(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_multiply(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); if(isnan(n1) || isnan(n2)) return NAN; if(isinf(n1) || isinf(n2)) return INFINITY; return n1 * n2; } -calculated_number eval_divide(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); - calculated_number n2 = eval_value(exp, &op->ops[1], error); +NETDATA_DOUBLE eval_divide(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); + NETDATA_DOUBLE n2 = eval_value(exp, &op->ops[1], error); if(isnan(n1) || isnan(n2)) return NAN; if(isinf(n1) || isinf(n2)) return INFINITY; return n1 / n2; } -calculated_number eval_nop(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +NETDATA_DOUBLE eval_nop(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { return eval_value(exp, &op->ops[0], error); } -calculated_number eval_not(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +NETDATA_DOUBLE eval_not(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { return !is_true(eval_value(exp, &op->ops[0], error)); } -calculated_number eval_sign_plus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +NETDATA_DOUBLE eval_sign_plus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { return eval_value(exp, &op->ops[0], error); } -calculated_number eval_sign_minus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); +NETDATA_DOUBLE eval_sign_minus(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); if(isnan(n1)) return NAN; if(isinf(n1)) return INFINITY; return -n1; } -calculated_number eval_abs(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { - calculated_number n1 = eval_value(exp, &op->ops[0], error); +NETDATA_DOUBLE eval_abs(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { + NETDATA_DOUBLE n1 = eval_value(exp, &op->ops[0], error); if(isnan(n1)) return NAN; if(isinf(n1)) return INFINITY; return ABS(n1); } -calculated_number eval_if_then_else(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +NETDATA_DOUBLE eval_if_then_else(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { if(is_true(eval_value(exp, &op->ops[0], error))) return eval_value(exp, &op->ops[1], error); else @@ -310,7 +310,7 @@ static struct operator { char precedence; char parameters; char isfunction; - calculated_number (*eval)(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error); + NETDATA_DOUBLE (*eval)(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error); } operators[256] = { // this is a random access array // we always access it with a known EVAL_OPERATOR_X @@ -341,13 +341,13 @@ static struct operator { #define eval_precedence(operator) (operators[(unsigned char)(operator)].precedence) -static inline calculated_number eval_node(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { +static inline NETDATA_DOUBLE eval_node(EVAL_EXPRESSION *exp, EVAL_NODE *op, int *error) { if(unlikely(op->count != operators[op->operator].parameters)) { *error = EVAL_ERROR_INVALID_NUMBER_OF_OPERANDS; return 0; } - calculated_number n = operators[op->operator].eval(exp, op, error); + NETDATA_DOUBLE n = operators[op->operator].eval(exp, op, error); return n; } @@ -360,7 +360,7 @@ static inline void print_parsed_as_variable(BUFFER *out, EVAL_VARIABLE *v, int * buffer_sprintf(out, "${%s}", v->name); } -static inline void print_parsed_as_constant(BUFFER *out, calculated_number n) { +static inline void print_parsed_as_constant(BUFFER *out, NETDATA_DOUBLE n) { if(unlikely(isnan(n))) { buffer_strcat(out, "nan"); return; @@ -372,7 +372,7 @@ static inline void print_parsed_as_constant(BUFFER *out, calculated_number n) { } char b[100+1], *s; - snprintfz(b, 100, CALCULATED_NUMBER_FORMAT, n); + snprintfz(b, 100, NETDATA_DOUBLE_FORMAT, n); s = &b[strlen(b) - 1]; while(s > b && *s == '0') { @@ -737,9 +737,9 @@ static inline int parse_variable(const char **string, char *buffer, size_t len) return 0; } -static inline int parse_constant(const char **string, calculated_number *number) { +static inline int parse_constant(const char **string, NETDATA_DOUBLE *number) { char *end = NULL; - calculated_number n = str2ld(*string, &end); + NETDATA_DOUBLE n = str2ndd(*string, &end); if(unlikely(!end || *string == end)) { *number = 0; return 0; @@ -845,7 +845,7 @@ static inline void eval_node_set_value_to_node(EVAL_NODE *op, int pos, EVAL_NODE op->ops[pos].expression = value; } -static inline void eval_node_set_value_to_constant(EVAL_NODE *op, int pos, calculated_number value) { +static inline void eval_node_set_value_to_constant(EVAL_NODE *op, int pos, NETDATA_DOUBLE value) { if(pos >= op->count) fatal("Invalid request to set position %d of OPERAND that has only %d values", pos + 1, op->count + 1); @@ -911,7 +911,7 @@ static inline EVAL_NODE *parse_next_operand_given_its_operator(const char **stri static inline EVAL_NODE *parse_one_full_operand(const char **string, int *error) { char variable_buffer[EVAL_MAX_VARIABLE_NAME_LENGTH + 1]; EVAL_NODE *op1 = NULL; - calculated_number number; + NETDATA_DOUBLE number; *error = EVAL_ERROR_OK; diff --git a/libnetdata/eval/eval.h b/libnetdata/eval/eval.h index fc03d7c1f..086d171aa 100644 --- a/libnetdata/eval/eval.h +++ b/libnetdata/eval/eval.h @@ -28,11 +28,11 @@ typedef struct eval_expression { const char *parsed_as; RRDCALC_STATUS *status; - calculated_number *myself; + NETDATA_DOUBLE *myself; time_t *after; time_t *before; - calculated_number result; + NETDATA_DOUBLE result; int error; BUFFER *error_msg; @@ -83,6 +83,6 @@ extern const char *expression_strerror(int error); // 2 = FAILED, the error message is in: buffer_tostring(expression->error_msg) extern int expression_evaluate(EVAL_EXPRESSION *expression); -extern int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result); +extern int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, NETDATA_DOUBLE *result); #endif //NETDATA_EVAL_H diff --git a/libnetdata/inlined.h b/libnetdata/inlined.h index 7e7d8ebed..5c265fc01 100644 --- a/libnetdata/inlined.h +++ b/libnetdata/inlined.h @@ -151,77 +151,6 @@ static inline long long str2ll(const char *s, char **endptr) { return n; } -static inline long double str2ld(const char *s, char **endptr) { - int negative = 0; - const char *start = s; - unsigned long long integer_part = 0; - unsigned long decimal_part = 0; - size_t decimal_digits = 0; - - switch(*s) { - case '-': - s++; - negative = 1; - break; - - case '+': - s++; - break; - - case 'n': - if(s[1] == 'a' && s[2] == 'n') { - if(endptr) *endptr = (char *)&s[3]; - return NAN; - } - break; - - case 'i': - if(s[1] == 'n' && s[2] == 'f') { - if(endptr) *endptr = (char *)&s[3]; - return INFINITY; - } - break; - - default: - break; - } - - while (*s >= '0' && *s <= '9') { - integer_part = (integer_part * 10) + (*s - '0'); - s++; - } - - if(unlikely(*s == '.')) { - decimal_part = 0; - s++; - - while (*s >= '0' && *s <= '9') { - decimal_part = (decimal_part * 10) + (*s - '0'); - s++; - decimal_digits++; - } - } - - if(unlikely(*s == 'e' || *s == 'E')) - return strtold(start, endptr); - - if(unlikely(endptr)) - *endptr = (char *)s; - - if(unlikely(negative)) { - if(unlikely(decimal_digits)) - return -((long double)integer_part + (long double)decimal_part / powl(10.0, decimal_digits)); - else - return -((long double)integer_part); - } - else { - if(unlikely(decimal_digits)) - return (long double)integer_part + (long double)decimal_part / powl(10.0, decimal_digits); - else - return (long double)integer_part; - } -} - static inline char *strncpyz(char *dst, const char *src, size_t n) { char *p = dst; @@ -233,21 +162,21 @@ static inline char *strncpyz(char *dst, const char *src, size_t n) { return p; } -static inline void sanitize_json_string(char *dst, char *src, size_t len) { - while (*src != '\0' && len > 1) { - if (*src == '\\' || *src == '\"' || *src < 0x1F) { - if (*src < 0x1F) { - *dst++ = '_'; - src++; - len--; - } else { - *dst++ = '\\'; - *dst++ = *src++; - len -= 2; - } - } else { +static inline void sanitize_json_string(char *dst, const char *src, size_t dst_size) { + while (*src != '\0' && dst_size > 1) { + if (*src < 0x1F) { + *dst++ = '_'; + src++; + dst_size--; + } + else if (*src == '\\' || *src == '\"') { + *dst++ = '\\'; + *dst++ = *src++; + dst_size -= 2; + } + else { *dst++ = *src++; - len--; + dst_size--; } } *dst = '\0'; diff --git a/libnetdata/json/json.c b/libnetdata/json/json.c index 1f391eeaa..e03556b50 100644 --- a/libnetdata/json/json.c +++ b/libnetdata/json/json.c @@ -111,7 +111,7 @@ int json_callback_print(JSON_ENTRY *e) break; case JSON_NUMBER: - sprintf(txt,"%Lf", e->data.number); + sprintf(txt, NETDATA_DOUBLE_FORMAT_AUTO, e->data.number); buffer_strcat(wb,txt); break; @@ -168,7 +168,7 @@ static inline void json_jsonc_set_integer(JSON_ENTRY *e, char *key, int64_t valu e->type = JSON_NUMBER; memcpy(e->name, key, len); e->name[len] = 0; - e->data.number = value; + e->data.number = (NETDATA_DOUBLE)value; } /** diff --git a/libnetdata/json/json.h b/libnetdata/json/json.h index 79b58b170..b43f06b50 100644 --- a/libnetdata/json/json.h +++ b/libnetdata/json/json.h @@ -3,8 +3,13 @@ #if ENABLE_JSONC -# include -#endif +#include +// fix an older json-c bug +// https://github.com/json-c/json-c/issues/135 +#ifdef error_description +#undef error_description +#endif // error_description +#endif // ENABLE_JSONC #include "jsmn.h" @@ -26,12 +31,12 @@ typedef struct json_entry { char name[JSON_NAME_LEN + 1]; char fullname[JSON_FULLNAME_LEN + 1]; union { - char *string; // type == JSON_STRING - long double number; // type == JSON_NUMBER - int boolean; // type == JSON_BOOLEAN - size_t items; // type == JSON_ARRAY + char *string; // type == JSON_STRING + NETDATA_DOUBLE number; // type == JSON_NUMBER + int boolean; // type == JSON_BOOLEAN + size_t items; // type == JSON_ARRAY } data; - size_t pos; // the position of this item in its parent + size_t pos; // the position of this item in its parent char *original_string; diff --git a/libnetdata/libjudy/src/Judy.h b/libnetdata/libjudy/src/Judy.h new file mode 100644 index 000000000..adfb5b53b --- /dev/null +++ b/libnetdata/libjudy/src/Judy.h @@ -0,0 +1,622 @@ +#ifndef _JUDY_INCLUDED +#define _JUDY_INCLUDED +// _________________ +// +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.52 $ $Source: /judy/src/Judy.h $ +// +// HEADER FILE FOR EXPORTED FEATURES IN JUDY LIBRARY, libJudy.* +// +// See the manual entries for details. +// +// Note: This header file uses old-style comments on #-directive lines and +// avoids "()" on macro names in comments for compatibility with older cc -Aa +// and some tools on some platforms. + + +// PLATFORM-SPECIFIC + +#ifdef JU_WIN /* =============================================== */ + +typedef __int8 int8_t; +typedef __int16 int16_t; +typedef __int32 int32_t; +typedef __int64 int64_t; + +typedef unsigned __int8 uint8_t; +typedef unsigned __int16 uint16_t; +typedef unsigned __int32 uint32_t; +typedef unsigned __int64 uint64_t; + +#else /* ================ ! JU_WIN ============================= */ + +// ISO C99: 7.8 Format conversion of integer types +#include /* if this FAILS, try #include */ + +// ISO C99: 7.18 Integer types uint*_t +//#include + +#endif /* ================ ! JU_WIN ============================= */ + +// ISO C99 Standard: 7.20 General utilities +#include + +// ISO C99 Standard: 7.10/5.2.4.2.1 Sizes of integer types +#include + +#ifdef __cplusplus /* support use by C++ code */ +extern "C" { +#endif + + +// **************************************************************************** +// DECLARE SOME BASE TYPES IN CASE THEY ARE MISSING: +// +// These base types include "const" where appropriate, but only where of +// interest to the caller. For example, a caller cares that a variable passed +// by reference will not be modified, such as, "const void * Pindex", but not +// that the called function internally does not modify the pointer itself, such +// as, "void * const Pindex". +// +// Note that its OK to pass a Pvoid_t to a Pcvoid_t; the latter is the same, +// only constant. Callers need to do this so they can also pass & Pvoid_t to +// PPvoid_t (non-constant). + +#ifndef _PCVOID_T +#define _PCVOID_T +typedef const void * Pcvoid_t; +#endif + +#ifndef _PVOID_T +#define _PVOID_T +typedef void * Pvoid_t; +typedef void ** PPvoid_t; +#endif + +#ifndef _WORD_T +#define _WORD_T +typedef unsigned long Word_t, * PWord_t; // expect 32-bit or 64-bit words. +#endif + +#ifndef NULL +#define NULL 0 +#endif + + +// **************************************************************************** +// SUPPORT FOR ERROR HANDLING: +// +// Judy error numbers: +// +// Note: These are an enum so theres a related typedef, but the numbers are +// spelled out so you can map a number back to its name. + +typedef enum // uint8_t -- but C does not support this type of enum. +{ + +// Note: JU_ERRNO_NONE and JU_ERRNO_FULL are not real errors. They specify +// conditions which are otherwise impossible return values from 32-bit +// Judy1Count, which has 2^32 + 1 valid returns (0..2^32) plus one error +// return. These pseudo-errors support the return values that cannot otherwise +// be unambiguously represented in a 32-bit word, and will never occur on a +// 64-bit system. + + JU_ERRNO_NONE = 0, + JU_ERRNO_FULL = 1, + JU_ERRNO_NFMAX = JU_ERRNO_FULL, + +// JU_ERRNO_NOMEM comes from malloc(3C) when Judy cannot obtain needed memory. +// The system errno value is also set to ENOMEM. This error can be recoverable +// if the calling application frees other memory. +// +// TBD: Currently there is no guarantee the Judy array has no memory leaks +// upon JU_ERRNO_NOMEM. + + JU_ERRNO_NOMEM = 2, + +// Problems with parameters from the calling program: +// +// JU_ERRNO_NULLPPARRAY means PPArray was null; perhaps PArray was passed where +// &PArray was intended. Similarly, JU_ERRNO_NULLPINDEX means PIndex was null; +// perhaps &Index was intended. Also, JU_ERRNO_NONNULLPARRAY, +// JU_ERRNO_NULLPVALUE, and JU_ERRNO_UNSORTED, all added later (hence with +// higher numbers), mean: A non-null array was passed in where a null pointer +// was required; PValue was null; and unsorted indexes were detected. + + JU_ERRNO_NULLPPARRAY = 3, // see above. + JU_ERRNO_NONNULLPARRAY = 10, // see above. + JU_ERRNO_NULLPINDEX = 4, // see above. + JU_ERRNO_NULLPVALUE = 11, // see above. + JU_ERRNO_NOTJUDY1 = 5, // PArray is not to a Judy1 array. + JU_ERRNO_NOTJUDYL = 6, // PArray is not to a JudyL array. + JU_ERRNO_NOTJUDYSL = 7, // PArray is not to a JudySL array. + JU_ERRNO_UNSORTED = 12, // see above. + +// Errors below this point are not recoverable; further tries to access the +// Judy array might result in EFAULT and a core dump: +// +// JU_ERRNO_OVERRUN occurs when Judy detects, upon reallocation, that a block +// of memory in its own freelist was modified since being freed. + + JU_ERRNO_OVERRUN = 8, + +// JU_ERRNO_CORRUPT occurs when Judy detects an impossible value in a Judy data +// structure: +// +// Note: The Judy data structure contains some redundant elements that support +// this type of checking. + + JU_ERRNO_CORRUPT = 9 + +// Warning: At least some C or C++ compilers do not tolerate a trailing comma +// above here. At least we know of one case, in aCC; see JAGad58928. + +} JU_Errno_t; + + +// Judy errno structure: +// +// WARNING: For compatibility with possible future changes, the fields of this +// struct should not be referenced directly. Instead use the macros supplied +// below. + +// This structure should be declared on the stack in a threaded process. + +typedef struct J_UDY_ERROR_STRUCT +{ + JU_Errno_t je_Errno; // one of the enums above. + int je_ErrID; // often an internal source line number. + Word_t je_reserved[4]; // for future backward compatibility. + +} JError_t, * PJError_t; + + +// Related macros: +// +// Fields from error struct: + +#define JU_ERRNO(PJError) ((PJError)->je_Errno) +#define JU_ERRID(PJError) ((PJError)->je_ErrID) + +// For checking return values from various Judy functions: +// +// Note: Define JERR as -1, not as the seemingly more portable (Word_t) +// (~0UL), to avoid a compiler "overflow in implicit constant conversion" +// warning. + +#define JERR (-1) /* functions returning int or Word_t */ +#define PJERR ((Pvoid_t) (~0UL)) /* mainly for use here, see below */ +#define PPJERR ((PPvoid_t) (~0UL)) /* functions that return PPvoid_t */ + +// Convenience macro for when detailed error information (PJError_t) is not +// desired by the caller; a purposely short name: + +#define PJE0 ((PJError_t) NULL) + + +// **************************************************************************** +// JUDY FUNCTIONS: +// +// P_JE is a shorthand for use below: + +#define P_JE PJError_t PJError + +// **************************************************************************** +// JUDY1 FUNCTIONS: + +extern int Judy1Test( Pcvoid_t PArray, Word_t Index, P_JE); +extern int Judy1Set( PPvoid_t PPArray, Word_t Index, P_JE); +extern int Judy1SetArray( PPvoid_t PPArray, Word_t Count, + const Word_t * const PIndex, + P_JE); +extern int Judy1Unset( PPvoid_t PPArray, Word_t Index, P_JE); +extern Word_t Judy1Count( Pcvoid_t PArray, Word_t Index1, + Word_t Index2, P_JE); +extern int Judy1ByCount( Pcvoid_t PArray, Word_t Count, + Word_t * PIndex, P_JE); +extern Word_t Judy1FreeArray( PPvoid_t PPArray, P_JE); +extern Word_t Judy1MemUsed( Pcvoid_t PArray); +extern Word_t Judy1MemActive( Pcvoid_t PArray); +extern int Judy1First( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int Judy1Next( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int Judy1Last( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int Judy1Prev( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int Judy1FirstEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int Judy1NextEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int Judy1LastEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int Judy1PrevEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); + +extern PPvoid_t JudyLGet( Pcvoid_t PArray, Word_t Index, P_JE); +extern PPvoid_t JudyLIns( PPvoid_t PPArray, Word_t Index, P_JE); +extern int JudyLInsArray( PPvoid_t PPArray, Word_t Count, + const Word_t * const PIndex, + const Word_t * const PValue, + +// **************************************************************************** +// JUDYL FUNCTIONS: + P_JE); +extern int JudyLDel( PPvoid_t PPArray, Word_t Index, P_JE); +extern Word_t JudyLCount( Pcvoid_t PArray, Word_t Index1, + Word_t Index2, P_JE); +extern PPvoid_t JudyLByCount( Pcvoid_t PArray, Word_t Count, + Word_t * PIndex, P_JE); +extern Word_t JudyLFreeArray( PPvoid_t PPArray, P_JE); +extern Word_t JudyLMemUsed( Pcvoid_t PArray); +extern Word_t JudyLMemActive( Pcvoid_t PArray); +extern PPvoid_t JudyLFirst( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern PPvoid_t JudyLNext( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern PPvoid_t JudyLLast( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern PPvoid_t JudyLPrev( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int JudyLFirstEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int JudyLNextEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int JudyLLastEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); +extern int JudyLPrevEmpty( Pcvoid_t PArray, Word_t * PIndex, P_JE); + +// **************************************************************************** +// JUDYSL FUNCTIONS: + +extern PPvoid_t JudySLGet( Pcvoid_t, const uint8_t * Index, P_JE); +extern PPvoid_t JudySLIns( PPvoid_t, const uint8_t * Index, P_JE); +extern int JudySLDel( PPvoid_t, const uint8_t * Index, P_JE); +extern Word_t JudySLFreeArray( PPvoid_t, P_JE); +extern PPvoid_t JudySLFirst( Pcvoid_t, uint8_t * Index, P_JE); +extern PPvoid_t JudySLNext( Pcvoid_t, uint8_t * Index, P_JE); +extern PPvoid_t JudySLLast( Pcvoid_t, uint8_t * Index, P_JE); +extern PPvoid_t JudySLPrev( Pcvoid_t, uint8_t * Index, P_JE); + +// **************************************************************************** +// JUDYHSL FUNCTIONS: + +extern PPvoid_t JudyHSGet( Pcvoid_t, void *, Word_t); +extern PPvoid_t JudyHSIns( PPvoid_t, void *, Word_t, P_JE); +extern int JudyHSDel( PPvoid_t, void *, Word_t, P_JE); +extern Word_t JudyHSFreeArray( PPvoid_t, P_JE); + +extern const char *Judy1MallocSizes; +extern const char *JudyLMallocSizes; + +// **************************************************************************** +// JUDY memory interface to malloc() FUNCTIONS: + +extern Word_t JudyMalloc(Word_t); // words reqd => words allocd. +extern Word_t JudyMallocVirtual(Word_t); // words reqd => words allocd. +extern void JudyFree(Pvoid_t, Word_t); // free, size in words. +extern void JudyFreeVirtual(Pvoid_t, Word_t); // free, size in words. + +#define JLAP_INVALID 0x1 /* flag to mark pointer "not a Judy array" */ + +// **************************************************************************** +// MACRO EQUIVALENTS FOR JUDY FUNCTIONS: +// +// The following macros, such as J1T, are shorthands for calling Judy functions +// with parameter address-of and detailed error checking included. Since they +// are macros, the error checking code is replicated each time the macro is +// used, but it runs fast in the normal case of no error. +// +// If the caller does not like the way the default JUDYERROR macro handles +// errors (such as an exit(1) call when out of memory), they may define their +// own before the "#include ". A routine such as HandleJudyError +// could do checking on specific error numbers and print a different message +// dependent on the error. The following is one example: +// +// Note: the back-slashes are removed because some compilers will not accept +// them in comments. +// +// void HandleJudyError(uint8_t *, int, uint8_t *, int, int); +// #define JUDYERROR(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID) +// { +// HandleJudyError(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID); +// } +// +// The routine HandleJudyError could do checking on specific error numbers and +// print a different message dependent on the error. +// +// The macro receives five parameters that are: +// +// 1. CallerFile: Source filename where a Judy call returned a serious error. +// 2. CallerLine: Line number in that source file. +// 3. JudyFunc: Name of Judy function reporting the error. +// 4. JudyErrno: One of the JU_ERRNO* values enumerated above. +// 5. JudyErrID: The je_ErrID field described above. + +#ifndef JUDYERROR_NOTEST +#ifndef JUDYERROR /* supply a default error macro */ +#include + +#define JUDYERROR(CallerFile, CallerLine, JudyFunc, JudyErrno, JudyErrID) \ + { \ + (void) fprintf(stderr, "File '%s', line %d: %s(), " \ + "JU_ERRNO_* == %d, ID == %d\n", \ + CallerFile, CallerLine, \ + JudyFunc, JudyErrno, JudyErrID); \ + exit(1); \ + } + +#endif /* JUDYERROR */ +#endif /* JUDYERROR_NOTEST */ + +// If the JUDYERROR macro is not desired at all, then the following eliminates +// it. However, the return code from each Judy function (that is, the first +// parameter of each macro) must be checked by the caller to assure that an +// error did not occur. +// +// Example: +// +// #define JUDYERROR_NOTEST 1 +// #include +// +// or use this cc option at compile time: +// +// cc -DJUDYERROR_NOTEST ... +// +// Example code: +// +// J1S(Rc, PArray, Index); +// if (Rc == JERR) goto ...error +// +// or: +// +// JLI(PValue, PArray, Index); +// if (PValue == PJERR) goto ...error + + +// Internal shorthand macros for writing the J1S, etc. macros: + +#ifdef JUDYERROR_NOTEST /* ============================================ */ + +// "Judy Set Error": + +#define J_SE(FuncName,Errno) ((void) 0) + +// Note: In each J_*() case below, the digit is the number of key parameters +// to the Judy*() call. Just assign the Func result to the callers Rc value +// without a cast because none is required, and this keeps the API simpler. +// However, a family of different J_*() macros is needed to support the +// different numbers of key parameters (0,1,2) and the Func return type. +// +// In the names below, "I" = integer result; "P" = pointer result. Note, the +// Funcs for J_*P() return PPvoid_t, but cast this to a Pvoid_t for flexible, +// error-free assignment, and then compare to PJERR. + +#define J_0I(Rc,PArray,Func,FuncName) \ + { (Rc) = Func(PArray, PJE0); } + +#define J_1I(Rc,PArray,Index,Func,FuncName) \ + { (Rc) = Func(PArray, Index, PJE0); } + +#define J_1P(PV,PArray,Index,Func,FuncName) \ + { (PV) = (Pvoid_t) Func(PArray, Index, PJE0); } + +#define J_2I(Rc,PArray,Index,Arg2,Func,FuncName) \ + { (Rc) = Func(PArray, Index, Arg2, PJE0); } + +#define J_2C(Rc,PArray,Index1,Index2,Func,FuncName) \ + { (Rc) = Func(PArray, Index1, Index2, PJE0); } + +#define J_2P(PV,PArray,Index,Arg2,Func,FuncName) \ + { (PV) = (Pvoid_t) Func(PArray, Index, Arg2, PJE0); } + +// Variations for Judy*Set/InsArray functions: + +#define J_2AI(Rc,PArray,Count,PIndex,Func,FuncName) \ + { (Rc) = Func(PArray, Count, PIndex, PJE0); } +#define J_3AI(Rc,PArray,Count,PIndex,PValue,Func,FuncName) \ + { (Rc) = Func(PArray, Count, PIndex, PValue, PJE0); } + +#else /* ================ ! JUDYERROR_NOTEST ============================= */ + +#define J_E(FuncName,PJE) \ + JUDYERROR(__FILE__, __LINE__, FuncName, JU_ERRNO(PJE), JU_ERRID(PJE)) + +#define J_SE(FuncName,Errno) \ + { \ + JError_t J_Error; \ + JU_ERRNO(&J_Error) = (Errno); \ + JU_ERRID(&J_Error) = __LINE__; \ + J_E(FuncName, &J_Error); \ + } + +// Note: In each J_*() case below, the digit is the number of key parameters +// to the Judy*() call. Just assign the Func result to the callers Rc value +// without a cast because none is required, and this keeps the API simpler. +// However, a family of different J_*() macros is needed to support the +// different numbers of key parameters (0,1,2) and the Func return type. +// +// In the names below, "I" = integer result; "P" = pointer result. Note, the +// Funcs for J_*P() return PPvoid_t, but cast this to a Pvoid_t for flexible, +// error-free assignment, and then compare to PJERR. + +#define J_0I(Rc,PArray,Func,FuncName) \ + { \ + JError_t J_Error; \ + if (((Rc) = Func(PArray, &J_Error)) == JERR) \ + J_E(FuncName, &J_Error); \ + } + +#define J_1I(Rc,PArray,Index,Func,FuncName) \ + { \ + JError_t J_Error; \ + if (((Rc) = Func(PArray, Index, &J_Error)) == JERR) \ + J_E(FuncName, &J_Error); \ + } + +#define J_1P(Rc,PArray,Index,Func,FuncName) \ + { \ + JError_t J_Error; \ + if (((Rc) = (Pvoid_t) Func(PArray, Index, &J_Error)) == PJERR) \ + J_E(FuncName, &J_Error); \ + } + +#define J_2I(Rc,PArray,Index,Arg2,Func,FuncName) \ + { \ + JError_t J_Error; \ + if (((Rc) = Func(PArray, Index, Arg2, &J_Error)) == JERR) \ + J_E(FuncName, &J_Error); \ + } + +// Variation for Judy*Count functions, which return 0, not JERR, for error (and +// also for other non-error cases): +// +// Note: JU_ERRNO_NFMAX should only apply to 32-bit Judy1, but this header +// file lacks the necessary ifdefs to make it go away otherwise, so always +// check against it. + +#define J_2C(Rc,PArray,Index1,Index2,Func,FuncName) \ + { \ + JError_t J_Error; \ + if ((((Rc) = Func(PArray, Index1, Index2, &J_Error)) == 0) \ + && (JU_ERRNO(&J_Error) > JU_ERRNO_NFMAX)) \ + { \ + J_E(FuncName, &J_Error); \ + } \ + } + +#define J_2P(PV,PArray,Index,Arg2,Func,FuncName) \ + { \ + JError_t J_Error; \ + if (((PV) = (Pvoid_t) Func(PArray, Index, Arg2, &J_Error)) \ + == PJERR) J_E(FuncName, &J_Error); \ + } + +// Variations for Judy*Set/InsArray functions: + +#define J_2AI(Rc,PArray,Count,PIndex,Func,FuncName) \ + { \ + JError_t J_Error; \ + if (((Rc) = Func(PArray, Count, PIndex, &J_Error)) == JERR) \ + J_E(FuncName, &J_Error); \ + } + +#define J_3AI(Rc,PArray,Count,PIndex,PValue,Func,FuncName) \ + { \ + JError_t J_Error; \ + if (((Rc) = Func(PArray, Count, PIndex, PValue, &J_Error)) \ + == JERR) J_E(FuncName, &J_Error); \ + } + +#endif /* ================ ! JUDYERROR_NOTEST ============================= */ + +// Some of the macros are special cases that use inlined shortcuts for speed +// with root-level leaves: + +// This is a slower version with current processors, but in the future... + +#define J1T(Rc,PArray,Index) \ + (Rc) = Judy1Test((Pvoid_t)(PArray), Index, PJE0) + +#define J1S( Rc, PArray, Index) \ + J_1I(Rc, (&(PArray)), Index, Judy1Set, "Judy1Set") +#define J1SA(Rc, PArray, Count, PIndex) \ + J_2AI(Rc,(&(PArray)), Count, PIndex, Judy1SetArray, "Judy1SetArray") +#define J1U( Rc, PArray, Index) \ + J_1I(Rc, (&(PArray)), Index, Judy1Unset, "Judy1Unset") +#define J1F( Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1First, "Judy1First") +#define J1N( Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1Next, "Judy1Next") +#define J1L( Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1Last, "Judy1Last") +#define J1P( Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1Prev, "Judy1Prev") +#define J1FE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1FirstEmpty, "Judy1FirstEmpty") +#define J1NE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1NextEmpty, "Judy1NextEmpty") +#define J1LE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1LastEmpty, "Judy1LastEmpty") +#define J1PE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), Judy1PrevEmpty, "Judy1PrevEmpty") +#define J1C( Rc, PArray, Index1, Index2) \ + J_2C(Rc, PArray, Index1, Index2, Judy1Count, "Judy1Count") +#define J1BC(Rc, PArray, Count, Index) \ + J_2I(Rc, PArray, Count, &(Index), Judy1ByCount, "Judy1ByCount") +#define J1FA(Rc, PArray) \ + J_0I(Rc, (&(PArray)), Judy1FreeArray, "Judy1FreeArray") +#define J1MU(Rc, PArray) \ + (Rc) = Judy1MemUsed(PArray) + +#define JLG(PV,PArray,Index) \ + (PV) = (Pvoid_t)JudyLGet((Pvoid_t)PArray, Index, PJE0) + +#define JLI( PV, PArray, Index) \ + J_1P(PV, (&(PArray)), Index, JudyLIns, "JudyLIns") + +#define JLIA(Rc, PArray, Count, PIndex, PValue) \ + J_3AI(Rc,(&(PArray)), Count, PIndex, PValue, JudyLInsArray, \ + "JudyLInsArray") +#define JLD( Rc, PArray, Index) \ + J_1I(Rc, (&(PArray)), Index, JudyLDel, "JudyLDel") + +#define JLF( PV, PArray, Index) \ + J_1P(PV, PArray, &(Index), JudyLFirst, "JudyLFirst") + +#define JLN( PV, PArray, Index) \ + J_1P(PV, PArray, &(Index), JudyLNext, "JudyLNext") + +#define JLL( PV, PArray, Index) \ + J_1P(PV, PArray, &(Index), JudyLLast, "JudyLLast") +#define JLP( PV, PArray, Index) \ + J_1P(PV, PArray, &(Index), JudyLPrev, "JudyLPrev") +#define JLFE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), JudyLFirstEmpty, "JudyLFirstEmpty") +#define JLNE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), JudyLNextEmpty, "JudyLNextEmpty") +#define JLLE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), JudyLLastEmpty, "JudyLLastEmpty") +#define JLPE(Rc, PArray, Index) \ + J_1I(Rc, PArray, &(Index), JudyLPrevEmpty, "JudyLPrevEmpty") +#define JLC( Rc, PArray, Index1, Index2) \ + J_2C(Rc, PArray, Index1, Index2, JudyLCount, "JudyLCount") +#define JLBC(PV, PArray, Count, Index) \ + J_2P(PV, PArray, Count, &(Index), JudyLByCount, "JudyLByCount") +#define JLFA(Rc, PArray) \ + J_0I(Rc, (&(PArray)), JudyLFreeArray, "JudyLFreeArray") +#define JLMU(Rc, PArray) \ + (Rc) = JudyLMemUsed(PArray) + +#define JHSI(PV, PArray, PIndex, Count) \ + J_2P(PV, (&(PArray)), PIndex, Count, JudyHSIns, "JudyHSIns") +#define JHSG(PV, PArray, PIndex, Count) \ + (PV) = (Pvoid_t) JudyHSGet(PArray, PIndex, Count) +#define JHSD(Rc, PArray, PIndex, Count) \ + J_2I(Rc, (&(PArray)), PIndex, Count, JudyHSDel, "JudyHSDel") +#define JHSFA(Rc, PArray) \ + J_0I(Rc, (&(PArray)), JudyHSFreeArray, "JudyHSFreeArray") + +#define JSLG( PV, PArray, Index) \ + J_1P( PV, PArray, Index, JudySLGet, "JudySLGet") +#define JSLI( PV, PArray, Index) \ + J_1P( PV, (&(PArray)), Index, JudySLIns, "JudySLIns") +#define JSLD( Rc, PArray, Index) \ + J_1I( Rc, (&(PArray)), Index, JudySLDel, "JudySLDel") +#define JSLF( PV, PArray, Index) \ + J_1P( PV, PArray, Index, JudySLFirst, "JudySLFirst") +#define JSLN( PV, PArray, Index) \ + J_1P( PV, PArray, Index, JudySLNext, "JudySLNext") +#define JSLL( PV, PArray, Index) \ + J_1P( PV, PArray, Index, JudySLLast, "JudySLLast") +#define JSLP( PV, PArray, Index) \ + J_1P( PV, PArray, Index, JudySLPrev, "JudySLPrev") +#define JSLFA(Rc, PArray) \ + J_0I( Rc, (&(PArray)), JudySLFreeArray, "JudySLFreeArray") + +#ifdef __cplusplus +} +#endif +#endif /* ! _JUDY_INCLUDED */ diff --git a/libnetdata/libjudy/src/JudyCommon/JudyMalloc.c b/libnetdata/libjudy/src/JudyCommon/JudyMalloc.c new file mode 100644 index 000000000..09a20e399 --- /dev/null +++ b/libnetdata/libjudy/src/JudyCommon/JudyMalloc.c @@ -0,0 +1,87 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.33 $ $Source: /judy/src/JudyCommon/JudyMalloc.c $ +// ************************************************************************ // +// JUDY - Memory Allocater // +// -by- // +// Douglas L. Baskins // +// Hewlett Packard // +// Fort Collins, Co // +// (970) 229-2027 // +// // +// ************************************************************************ // + +// JUDY INCLUDE FILES +#include "Judy.h" + +// **************************************************************************** +// J U D Y M A L L O C +// +// Allocate RAM. This is the single location in Judy code that calls +// malloc(3C). Note: JPM accounting occurs at a higher level. + +Word_t JudyMalloc( + Word_t Words) +{ + Word_t Addr; + + Addr = (Word_t) malloc(Words * sizeof(Word_t)); + return(Addr); + +} // JudyMalloc() + + +// **************************************************************************** +// J U D Y F R E E + +void JudyFree( + void * PWord, + Word_t Words) +{ + (void) Words; + free(PWord); + +} // JudyFree() + + +// **************************************************************************** +// J U D Y M A L L O C +// +// Higher-level "wrapper" for allocating objects that need not be in RAM, +// although at this time they are in fact only in RAM. Later we hope that some +// entire subtrees (at a JPM or branch) can be "virtual", so their allocations +// and frees should go through this level. + +Word_t JudyMallocVirtual( + Word_t Words) +{ + return(JudyMalloc(Words)); + +} // JudyMallocVirtual() + + +// **************************************************************************** +// J U D Y F R E E + +void JudyFreeVirtual( + void * PWord, + Word_t Words) +{ + JudyFree(PWord, Words); + +} // JudyFreeVirtual() diff --git a/libnetdata/libjudy/src/JudyCommon/JudyPrivate.h b/libnetdata/libjudy/src/JudyCommon/JudyPrivate.h new file mode 100644 index 000000000..350631f01 --- /dev/null +++ b/libnetdata/libjudy/src/JudyCommon/JudyPrivate.h @@ -0,0 +1,1613 @@ +#ifndef _JUDYPRIVATE_INCLUDED +#define _JUDYPRIVATE_INCLUDED +// _________________ +// +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.77 $ $Source: /judy/src/JudyCommon/JudyPrivate.h $ +// +// Header file for all Judy sources, for global but private (non-exported) +// declarations. + +#include "Judy.h" + +// **************************************************************************** +// A VERY BRIEF EXPLANATION OF A JUDY ARRAY +// +// A Judy array is, effectively, a digital tree (or Trie) with 256 element +// branches (nodes), and with "compression tricks" applied to low-population +// branches or leaves to save a lot of memory at the cost of relatively little +// CPU time or cache fills. +// +// In the actual implementation, a Judy array is level-less, and traversing the +// "tree" actually means following the states in a state machine (SM) as +// directed by the Index. A Judy array is referred to here as an "SM", rather +// than as a "tree"; having "states", rather than "levels". +// +// Each branch or leaf in the SM decodes a portion ("digit") of the original +// Index; with 256-way branches there are 8 bits per digit. There are 3 kinds +// of branches, called: Linear, Bitmap and Uncompressed, of which the first 2 +// are compressed to contain no NULL entries. +// +// An Uncompressed branch has a 1.0 cache line fill cost to decode 8 bits of +// (digit, part of an Index), but it might contain many NULL entries, and is +// therefore inefficient with memory if lightly populated. +// +// A Linear branch has a ~1.75 cache line fill cost when at maximum population. +// A Bitmap branch has ~2.0 cache line fills. Linear and Bitmap branches are +// converted to Uncompressed branches when the additional memory can be +// amortized with larger populations. Higher-state branches have higher +// priority to be converted. +// +// Linear branches can hold 28 elements (based on detailed analysis) -- thus 28 +// expanses. A Linear branch is converted to a Bitmap branch when the 29th +// expanse is required. +// +// A Bitmap branch could hold 256 expanses, but is forced to convert to an +// Uncompressed branch when 185 expanses are required. Hopefully, it is +// converted before that because of population growth (again, based on detailed +// analysis and heuristics in the code). +// +// A path through the SM terminates to a leaf when the Index (or key) +// population in the expanse below a pointer will fit into 1 or 2 cache lines +// (~31..255 Indexes). A maximum-population Leaf has ~1.5 cache line fill +// cost. +// +// Leaves are sorted arrays of Indexes, where the Index Sizes (IS) are: 0, 1, +// 8, 16, 24, 32, [40, 48, 56, 64] bits. The IS depends on the "density" +// (population/expanse) of the values in the Leaf. Zero bits are possible if +// population == expanse in the SM (that is, a full small expanse). +// +// Elements of a branches are called Judy Pointers (JPs). Each JP object +// points to the next object in the SM, plus, a JP can decode an additional +// 2[6] bytes of an Index, but at the cost of "narrowing" the expanse +// represented by the next object in the SM. A "narrow" JP (one which has +// decode bytes/digits) is a way of skipping states in the SM. +// +// Although counterintuitive, we think a Judy SM is optimal when the Leaves are +// stored at MINIMUM compression (narrowing, or use of Decode bytes). If more +// aggressive compression was used, decompression of a leaf be required to +// insert an index. Additional compression would save a little memory but not +// help performance significantly. + + +#ifdef A_PICTURE_IS_WORTH_1000_WORDS +******************************************************************************* + +JUDY 32-BIT STATE MACHINE (SM) EXAMPLE, FOR INDEX = 0x02040103 + +The Index used in this example is purposely chosen to allow small, simple +examples below; each 1-byte "digit" from the Index has a small numeric value +that fits in one column. In the drawing below: + + JRP == Judy Root Pointer; + + C == 1 byte of a 1..3 byte Population (count of Indexes) below this + pointer. Since this is shared with the Decode field, the combined + sizes must be 3[7], that is, 1 word less 1 byte for the JP Type. + + The 1-byte field jp_Type is represented as: + + 1..3 == Number of bytes in the population (Pop0) word of the Branch or Leaf + below the pointer (note: 1..7 on 64-bit); indicates: + - number of bytes in Decode field == 3 - this number; + - number of bytes remaining to decode. + Note: The maximum is 3, not 4, because the 1st byte of the Index is + always decoded digitally in the top branch. + -B- == JP points to a Branch (there are many kinds of Branches). + -L- == JP points to a Leaf (there are many kinds of Leaves). + + (2) == Digit of Index decoded by position offset in branch (really + 0..0xff). + + 4* == Digit of Index necessary for decoding a "narrow" pointer, in a + Decode field; replaces 1 missing branch (really 0..0xff). + + 4+ == Digit of Index NOT necessary for decoding a "narrow" pointer, but + used for fast traversal of the SM by Judy1Test() and JudyLGet() + (see the code) (really 0..0xff). + + 0 == Byte in a JPs Pop0 field that is always ignored, because a leaf + can never contain more than 256 Indexes (Pop0 <= 255). + + +----- == A Branch or Leaf; drawn open-ended to remind you that it could + | have up to 256 columns. + +----- + + | + | == Pointer to next Branch or Leaf. + V + + | + O == A state is skipped by using a "narrow" pointer. + | + + < 1 > == Digit (Index) shown as an example is not necessarily in the + position shown; is sorted in order with neighbor Indexes. + (Really 0..0xff.) + +Note that this example shows every possibly topology to reach a leaf in a +32-bit Judy SM, although this is a very subtle point! + + STATE or` + LEVEL + +---+ +---+ +---+ +---+ +---+ +---+ +---+ +---+ + |RJP| |RJP| |RJP| |RJP| |RJP| |RJP| |RJP| |RJP| + L---+ B---+ B---+ B---+ B---+ B---+ B---+ B---+ + | | | | | | | | + | | | | | | | | + V V (2) V (2) V (2) V (2) V (2) V (2) V (2) + +------ +------ +------ +------ +------ +------ +------ +------ +Four |< 2 > | 0 | 4* | C | 4* | 4* | C | C +byte |< 4 > | 0 | 0 | C | 1* | C | C | C 4 +Index|< 1 > | C | C | C | C | C | C | C +Leaf |< 3 > | 3 | 2 | 3 | 1 | 2 | 3 | 3 + +------ +--L--- +--L--- +--B--- +--L--- +--B--- +--B--- +--B--- + | | | | | | | + / | / | | / / + / | / | | / / + | | | | | | | + V | V (4) | | V (4) V (4) + +------ | +------ | | +------ +------ + Three |< 4 > | | 4+ | | | 4+ | 4+ + byte Index|< 1 > O | 0 O O | 1* | C 3 + Leaf |< 3 > | | C | | | C | C + +------ | | 2 | | | 1 | 2 + / +----L- | | +----L- +----B- + / | | | | | + | / | / / / + | / | / / / + | / | | / / + | / | | / / + | | | | | | + V V | V(1) | V(1) + +------ +------ | +------ | +------ + Two byte |< 1 > |< 1 > | | 4+ | | 4+ + Index Leaf |< 3 > |< 3 > O | 1+ O | 1+ 2 + +------ +------ / | C | | C + / | 1 | | 1 + | +-L---- | +-L---- + | | | | + | / | / + | | | | + V V V V + +------ +------ +------ +------ + One byte Index Leaf |< 3 > |< 3 > |< 3 > |< 3 > 1 + +------ +------ +------ +------ + + +#endif // A_PICTURE_IS_WORTH_1000_WORDS + + +// **************************************************************************** +// MISCELLANEOUS GLOBALS: +// +// PLATFORM-SPECIFIC CONVENIENCE MACROS: +// +// These are derived from context (set by cc or in system header files) or +// based on JU_ macros from make_includes/platform.*.mk. We decided +// on 011018 that any macro reliably derivable from context (cc or headers) for +// ALL platforms supported by Judy is based on that derivation, but ANY +// exception means to stop using the external macro completely and derive from +// JU_ instead. + +// Other miscellaneous stuff: + +#ifndef _BOOL_T +#define _BOOL_T +typedef int bool_t; +#endif + +#define FUNCTION // null; easy to find functions. + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifdef TRACE // turn on all other tracing in the code: +#define TRACEJP 1 // JP traversals in JudyIns.c and JudyDel.c. +#define TRACEJPR 1 // JP traversals in retrieval code, JudyGet.c. +#define TRACECF 1 // cache fills in JudyGet.c. +#define TRACEMI 1 // malloc calls in JudyMallocIF.c. +#define TRACEMF 1 // malloc calls at a lower level in JudyMalloc.c. +#endif + + +// SUPPORT FOR DEBUG-ONLY CODE: +// +// By convention, use -DDEBUG to enable both debug-only code AND assertions in +// the Judy sources. +// +// Invert the sense of assertions, so they are off unless explicitly requested, +// in a uniform way. +// +// Note: It is NOT appropriate to put this in Judy.h; it would mess up +// application code. + +#ifndef DEBUG +#define NDEBUG 1 // must be 1 for "#if". +#endif + +// Shorthand notations to avoid #ifdefs for single-line conditional statements: +// +// Warning: These cannot be used around compiler directives, such as +// "#include", nor in the case where Code contains a comma other than nested +// within parentheses or quotes. + +#ifndef DEBUG +#define DBGCODE(Code) // null. +#else +#define DBGCODE(Code) Code +#endif + +#ifdef JUDY1 +#define JUDY1CODE(Code) Code +#define JUDYLCODE(Code) // null. +#endif + +#ifdef JUDYL +#define JUDYLCODE(Code) Code +#define JUDY1CODE(Code) // null. +#endif + +#include + +// **************************************************************************** +// FUNDAMENTAL CONSTANTS FOR MACHINE +// **************************************************************************** + +// Machine (CPU) cache line size: +// +// NOTE: A leaf size of 2 cache lines maximum is the target (optimal) for +// Judy. Its hard to obtain a machines cache line size at compile time, but +// if the machine has an unexpected cache line size, its not devastating if +// the following constants end up causing leaves that are 1 cache line in size, +// or even 4 cache lines in size. The assumed 32-bit system has 16-word = +// 64-byte cache lines, and the assumed 64-bit system has 16-word = 128-byte +// cache lines. + +#ifdef JU_64BIT +#define cJU_BYTESPERCL 128 // cache line size in bytes. +#else +#define cJU_BYTESPERCL 64 // cache line size in bytes. +#endif + +// Bits Per Byte: + +#define cJU_BITSPERBYTE 0x8 + +// Bytes Per Word and Bits Per Word, latter assuming sizeof(byte) is 8 bits: +// +// Expect 32 [64] bits per word. + +#define cJU_BYTESPERWORD (sizeof(Word_t)) +#define cJU_BITSPERWORD (sizeof(Word_t) * cJU_BITSPERBYTE) + +#define JU_BYTESTOWORDS(BYTES) \ + (((BYTES) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD) + +// A word that is all-ones, normally equal to -1UL, but safer with ~0: + +#define cJU_ALLONES (~0UL) + +// Note, these are forward references, but thats OK: + +#define cJU_FULLBITMAPB ((BITMAPB_t) cJU_ALLONES) +#define cJU_FULLBITMAPL ((BITMAPL_t) cJU_ALLONES) + + +// **************************************************************************** +// MISCELLANEOUS JUDY-SPECIFIC DECLARATIONS +// **************************************************************************** + +// ROOT STATE: +// +// State at the start of the Judy SM, based on 1 byte decoded per state; equal +// to the number of bytes per Index to decode. + +#define cJU_ROOTSTATE (sizeof(Word_t)) + + +// SUBEXPANSES PER STATE: +// +// Number of subexpanses per state traversed, which is the number of JPs in a +// branch (actual or theoretical) and the number of bits in a bitmap. + +#define cJU_SUBEXPPERSTATE 256 + + +// LEAF AND VALUE POINTERS: +// +// Some other basic object types are in declared in JudyPrivateBranch.h +// (Pjbl_t, Pjbb_t, Pjbu_t, Pjp_t) or are Judy1/L-specific (Pjlb_t). The +// few remaining types are declared below. +// +// Note: Leaf pointers are cast to different-sized objects depending on the +// leafs level, but are at least addresses (not just numbers), so use void * +// (Pvoid_t), not PWord_t or Word_t for them, except use Pjlw_t for whole-word +// (top-level, root-level) leaves. Value areas, however, are always whole +// words. +// +// Furthermore, use Pjll_t only for generic leaf pointers (for various size +// LeafLs). Use Pjlw_t for LeafWs. Use Pleaf (with type uint8_t *, uint16_t +// *, etc) when the leaf index size is known. + +typedef PWord_t Pjlw_t; // pointer to root-level leaf (whole-word indexes). +typedef Pvoid_t Pjll_t; // pointer to lower-level linear leaf. + +#ifdef JUDYL +typedef PWord_t Pjv_t; // pointer to JudyL value area. +#endif + + +// POINTER PREPARATION MACROS: +// +// These macros are used to strip malloc-namespace-type bits from a pointer + +// malloc-type word (which references any Judy mallocd object that might be +// obtained from other than a direct call of malloc()), prior to dereferencing +// the pointer as an address. The malloc-type bits allow Judy mallocd objects +// to come from different "malloc() namespaces". +// +// (root pointer) (JRP, see above) +// jp.jp_Addr generic pointer to next-level node, except when used +// as a JudyL Immed01 value area +// JU_JBB_PJP macro hides jbbs_Pjp (pointer to JP subarray) +// JL_JLB_PVALUE macro hides jLlbs_PValue (pointer to value subarray) +// +// When setting one of these fields or passing an address to j__udyFree*(), the +// "raw" memory address is used; otherwise the memory address must be passed +// through one of the macros below before its dereferenced. +// +// Note: After much study, the typecasts below appear in the macros rather +// than at the point of use, which is both simpler and allows the compiler to +// do type-checking. + + +#define P_JLW( ADDR) ((Pjlw_t) (ADDR)) // root leaf. +#define P_JPM( ADDR) ((Pjpm_t) (ADDR)) // root JPM. +#define P_JBL( ADDR) ((Pjbl_t) (ADDR)) // BranchL. +#define P_JBB( ADDR) ((Pjbb_t) (ADDR)) // BranchB. +#define P_JBU( ADDR) ((Pjbu_t) (ADDR)) // BranchU. +#define P_JLL( ADDR) ((Pjll_t) (ADDR)) // LeafL. +#define P_JLB( ADDR) ((Pjlb_t) (ADDR)) // LeafB1. +#define P_JP( ADDR) ((Pjp_t) (ADDR)) // JP. + +#ifdef JUDYL +#define P_JV( ADDR) ((Pjv_t) (ADDR)) // &value. +#endif + + +// LEAST BYTES: +// +// Mask for least bytes of a word, and a macro to perform this mask on an +// Index. +// +// Note: This macro has been problematic in the past to get right and to make +// portable. Its not OK on all systems to shift by the full word size. This +// macro should allow shifting by 1..N bytes, where N is the word size, but +// should produce a compiler warning if the macro is called with Bytes == 0. +// +// Warning: JU_LEASTBYTESMASK() is not a constant macro unless Bytes is a +// constant; otherwise it is a variable shift, which is expensive on some +// processors. + +#define JU_LEASTBYTESMASK(BYTES) \ + ((0x100UL << (cJU_BITSPERBYTE * ((BYTES) - 1))) - 1) + +#define JU_LEASTBYTES(INDEX,BYTES) ((INDEX) & JU_LEASTBYTESMASK(BYTES)) + + +// BITS IN EACH BITMAP SUBEXPANSE FOR BITMAP BRANCH AND LEAF: +// +// The bits per bitmap subexpanse times the number of subexpanses equals a +// constant (cJU_SUBEXPPERSTATE). You can also think of this as a compile-time +// choice of "aspect ratio" for bitmap branches and leaves (which can be set +// independently for each). +// +// A default aspect ratio is hardwired here if not overridden at compile time, +// such as by "EXTCCOPTS=-DBITMAP_BRANCH16x16 make". + +#if (! (defined(BITMAP_BRANCH8x32) || defined(BITMAP_BRANCH16x16) || defined(BITMAP_BRANCH32x8))) +#define BITMAP_BRANCH32x8 1 // 32 bits per subexpanse, 8 subexpanses. +#endif + +#ifdef BITMAP_BRANCH8x32 +#define BITMAPB_t uint8_t +#endif + +#ifdef BITMAP_BRANCH16x16 +#define BITMAPB_t uint16_t +#endif + +#ifdef BITMAP_BRANCH32x8 +#define BITMAPB_t uint32_t +#endif + +// Note: For bitmap leaves, BITMAP_LEAF64x4 is only valid for 64 bit: +// +// Note: Choice of aspect ratio mostly matters for JudyL bitmap leaves. For +// Judy1 the choice doesnt matter much -- the code generated for different +// BITMAP_LEAF* values choices varies, but correctness and performance are the +// same. + +#ifndef JU_64BIT + +#if (! (defined(BITMAP_LEAF8x32) || defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8))) +#define BITMAP_LEAF32x8 // 32 bits per subexpanse, 8 subexpanses. +#endif + +#else // 32BIT + +#if (! (defined(BITMAP_LEAF8x32) || defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8) || defined(BITMAP_LEAF64x4))) +#define BITMAP_LEAF64x4 // 64 bits per subexpanse, 4 subexpanses. + +#endif +#endif // JU_64BIT + +#ifdef BITMAP_LEAF8x32 +#define BITMAPL_t uint8_t +#endif + +#ifdef BITMAP_LEAF16x16 +#define BITMAPL_t uint16_t +#endif + +#ifdef BITMAP_LEAF32x8 +#define BITMAPL_t uint32_t +#endif + +#ifdef BITMAP_LEAF64x4 +#define BITMAPL_t uint64_t +#endif + + +// EXPORTED DATA AND FUNCTIONS: + +#ifdef JUDY1 +extern const uint8_t j__1_BranchBJPPopToWords[]; +#endif + +#ifdef JUDYL +extern const uint8_t j__L_BranchBJPPopToWords[]; +#endif + +// Fast LeafL search routine used for inlined code: + +#if (! defined(SEARCH_BINARY)) || (! defined(SEARCH_LINEAR)) +// default a binary search leaf method +#define SEARCH_BINARY 1 +//#define SEARCH_LINEAR 1 +#endif + +#ifdef SEARCH_LINEAR + +#define SEARCHLEAFNATIVE(LEAFTYPE,ADDR,POP1,INDEX) \ + LEAFTYPE *P_leaf = (LEAFTYPE *)(ADDR); \ + LEAFTYPE I_ndex = (INDEX); /* with masking */ \ + if (I_ndex > P_leaf[(POP1) - 1]) return(~(POP1)); \ + while(I_ndex > *P_leaf) P_leaf++; \ + if (I_ndex == *P_leaf) return(P_leaf - (LEAFTYPE *)(ADDR)); \ + return(~(P_leaf - (LEAFTYPE *)(ADDR))); + + +#define SEARCHLEAFNONNAT(ADDR,POP1,INDEX,LFBTS,COPYINDEX) \ +{ \ + uint8_t *P_leaf, *P_leafEnd; \ + Word_t i_ndex; \ + Word_t I_ndex = JU_LEASTBYTES((INDEX), (LFBTS)); \ + Word_t p_op1; \ + \ + P_leaf = (uint8_t *)(ADDR); \ + P_leafEnd = P_leaf + ((POP1) * (LFBTS)); \ + \ + do { \ + JU_COPY3_PINDEX_TO_LONG(i_ndex, P_leaf); \ + if (I_ndex <= i_ndex) break; \ + P_leaf += (LFBTS); \ + } while (P_leaf < P_leafEnd); \ + \ + p_op1 = (P_leaf - (uint8_t *) (ADDR)) / (LFBTS); \ + if (I_ndex == i_ndex) return(p_op1); \ + return(~p_op1); \ +} +#endif // SEARCH_LINEAR + +#ifdef SEARCH_BINARY + +#define SEARCHLEAFNATIVE(LEAFTYPE,ADDR,POP1,INDEX) \ + LEAFTYPE *P_leaf = (LEAFTYPE *)(ADDR); \ + LEAFTYPE I_ndex = (LEAFTYPE)INDEX; /* truncate hi bits */ \ + Word_t l_ow = cJU_ALLONES; \ + Word_t m_id; \ + Word_t h_igh = POP1; \ + \ + while ((h_igh - l_ow) > 1UL) \ + { \ + m_id = (h_igh + l_ow) / 2; \ + if (P_leaf[m_id] > I_ndex) \ + h_igh = m_id; \ + else \ + l_ow = m_id; \ + } \ + if (l_ow == cJU_ALLONES || P_leaf[l_ow] != I_ndex) \ + return(~h_igh); \ + return(l_ow) + + +#define SEARCHLEAFNONNAT(ADDR,POP1,INDEX,LFBTS,COPYINDEX) \ + uint8_t *P_leaf = (uint8_t *)(ADDR); \ + Word_t l_ow = cJU_ALLONES; \ + Word_t m_id; \ + Word_t h_igh = POP1; \ + Word_t I_ndex = JU_LEASTBYTES((INDEX), (LFBTS)); \ + Word_t i_ndex; \ + \ + I_ndex = JU_LEASTBYTES((INDEX), (LFBTS)); \ + \ + while ((h_igh - l_ow) > 1UL) \ + { \ + m_id = (h_igh + l_ow) / 2; \ + COPYINDEX(i_ndex, &P_leaf[m_id * (LFBTS)]); \ + if (i_ndex > I_ndex) \ + h_igh = m_id; \ + else \ + l_ow = m_id; \ + } \ + if (l_ow == cJU_ALLONES) return(~h_igh); \ + \ + COPYINDEX(i_ndex, &P_leaf[l_ow * (LFBTS)]); \ + if (i_ndex != I_ndex) return(~h_igh); \ + return(l_ow) + +#endif // SEARCH_BINARY + +// Fast way to count bits set in 8..32[64]-bit int: +// +// For performance, j__udyCountBits*() are written to take advantage of +// platform-specific features where available. +// + +#ifdef JU_NOINLINE + +extern BITMAPB_t j__udyCountBitsB(BITMAPB_t word); +extern BITMAPL_t j__udyCountBitsL(BITMAPL_t word); + +// Compiler supports inline + +#elif defined(JU_HPUX_IPF) + +#define j__udyCountBitsB(WORD) _Asm_popcnt(WORD) +#define j__udyCountBitsL(WORD) _Asm_popcnt(WORD) + +#elif defined(JU_LINUX_IPF) + +static inline BITMAPB_t j__udyCountBitsB(BITMAPB_t word) +{ + BITMAPB_t result; + __asm__ ("popcnt %0=%1" : "=r" (result) : "r" (word)); + return(result); +} + +static inline BITMAPL_t j__udyCountBitsL(BITMAPL_t word) +{ + BITMAPL_t result; + __asm__ ("popcnt %0=%1" : "=r" (result) : "r" (word)); + return(result); +} + + +#else // No instructions available, use inline code + +// **************************************************************************** +// __ J U D Y C O U N T B I T S B +// +// Return the number of bits set in "Word", for a bitmap branch. +// +// Note: Bitmap branches have maximum bitmap size = 32 bits. + +#ifdef JU_WIN +static __inline BITMAPB_t j__udyCountBitsB(BITMAPB_t word) +#else +static inline BITMAPB_t j__udyCountBitsB(BITMAPB_t word) +#endif +{ + word = (word & 0x55555555) + ((word & 0xAAAAAAAA) >> 1); + word = (word & 0x33333333) + ((word & 0xCCCCCCCC) >> 2); + word = (word & 0x0F0F0F0F) + ((word & 0xF0F0F0F0) >> 4); // >= 8 bits. +#if defined(BITMAP_BRANCH16x16) || defined(BITMAP_BRANCH32x8) + word = (word & 0x00FF00FF) + ((word & 0xFF00FF00) >> 8); // >= 16 bits. +#endif + +#ifdef BITMAP_BRANCH32x8 + word = (word & 0x0000FFFF) + ((word & 0xFFFF0000) >> 16); // >= 32 bits. +#endif + return(word); + +} // j__udyCountBitsB() + + +// **************************************************************************** +// __ J U D Y C O U N T B I T S L +// +// Return the number of bits set in "Word", for a bitmap leaf. +// +// Note: Bitmap branches have maximum bitmap size = 32 bits. + +// Note: Need both 32-bit and 64-bit versions of j__udyCountBitsL() because +// bitmap leaves can have 64-bit bitmaps. + +#ifdef JU_WIN +static __inline BITMAPL_t j__udyCountBitsL(BITMAPL_t word) +#else +static inline BITMAPL_t j__udyCountBitsL(BITMAPL_t word) +#endif +{ +#ifndef JU_64BIT + + word = (word & 0x55555555) + ((word & 0xAAAAAAAA) >> 1); + word = (word & 0x33333333) + ((word & 0xCCCCCCCC) >> 2); + word = (word & 0x0F0F0F0F) + ((word & 0xF0F0F0F0) >> 4); // >= 8 bits. +#if defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8) + word = (word & 0x00FF00FF) + ((word & 0xFF00FF00) >> 8); // >= 16 bits. +#endif +#ifdef BITMAP_LEAF32x8 + word = (word & 0x0000FFFF) + ((word & 0xFFFF0000) >> 16); // >= 32 bits. +#endif + +#else // JU_64BIT + + word = (word & 0x5555555555555555) + ((word & 0xAAAAAAAAAAAAAAAA) >> 1); + word = (word & 0x3333333333333333) + ((word & 0xCCCCCCCCCCCCCCCC) >> 2); + word = (word & 0x0F0F0F0F0F0F0F0F) + ((word & 0xF0F0F0F0F0F0F0F0) >> 4); +#if defined(BITMAP_LEAF16x16) || defined(BITMAP_LEAF32x8) || defined(BITMAP_LEAF64x4) + word = (word & 0x00FF00FF00FF00FF) + ((word & 0xFF00FF00FF00FF00) >> 8); +#endif +#if defined(BITMAP_LEAF32x8) || defined(BITMAP_LEAF64x4) + word = (word & 0x0000FFFF0000FFFF) + ((word & 0xFFFF0000FFFF0000) >>16); +#endif +#ifdef BITMAP_LEAF64x4 + word = (word & 0x00000000FFFFFFFF) + ((word & 0xFFFFFFFF00000000) >>32); +#endif +#endif // JU_64BIT + + return(word); + +} // j__udyCountBitsL() + +#endif // Compiler supports inline + +// GET POP0: +// +// Get from jp_DcdPopO the Pop0 for various JP Types. +// +// Notes: +// +// - Different macros require different parameters... +// +// - There are no simple macros for cJU_BRANCH* Types because their +// populations must be added up and dont reside in an already-calculated +// place. (TBD: This is no longer true, now its in the JPM.) +// +// - cJU_JPIMM_POP0() is not defined because it would be redundant because the +// Pop1 is already encoded in each enum name. +// +// - A linear or bitmap leaf Pop0 cannot exceed cJU_SUBEXPPERSTATE - 1 (Pop0 = +// 0..255), so use a simpler, faster macro for it than for other JP Types. +// +// - Avoid any complex calculations that would slow down the compiled code. +// Assume these macros are only called for the appropriate JP Types. +// Unfortunately theres no way to trigger an assertion here if the JP type +// is incorrect for the macro, because these are merely expressions, not +// statements. + +#define JU_LEAFW_POP0(JRP) (*P_JLW(JRP)) +#define cJU_JPFULLPOPU1_POP0 (cJU_SUBEXPPERSTATE - 1) + +// GET JP Type: +// Since bit fields greater than 32 bits are not supported in some compilers +// the jp_DcdPopO field is expanded to include the jp_Type in the high 8 bits +// of the Word_t. +// First the read macro: + +#define JU_JPTYPE(PJP) ((PJP)->jp_Type) + +#define JU_JPLEAF_POP0(PJP) ((PJP)->jp_DcdP0[sizeof(Word_t) - 2]) + +#ifdef JU_64BIT + +#define JU_JPDCDPOP0(PJP) \ + ((Word_t)(PJP)->jp_DcdP0[0] << 48 | \ + (Word_t)(PJP)->jp_DcdP0[1] << 40 | \ + (Word_t)(PJP)->jp_DcdP0[2] << 32 | \ + (Word_t)(PJP)->jp_DcdP0[3] << 24 | \ + (Word_t)(PJP)->jp_DcdP0[4] << 16 | \ + (Word_t)(PJP)->jp_DcdP0[5] << 8 | \ + (Word_t)(PJP)->jp_DcdP0[6]) + + +#define JU_JPSETADT(PJP,ADDR,DCDPOP0,TYPE) \ +{ \ + (PJP)->jp_Addr = (ADDR); \ + (PJP)->jp_DcdP0[0] = (uint8_t)((Word_t)(DCDPOP0) >> 48); \ + (PJP)->jp_DcdP0[1] = (uint8_t)((Word_t)(DCDPOP0) >> 40); \ + (PJP)->jp_DcdP0[2] = (uint8_t)((Word_t)(DCDPOP0) >> 32); \ + (PJP)->jp_DcdP0[3] = (uint8_t)((Word_t)(DCDPOP0) >> 24); \ + (PJP)->jp_DcdP0[4] = (uint8_t)((Word_t)(DCDPOP0) >> 16); \ + (PJP)->jp_DcdP0[5] = (uint8_t)((Word_t)(DCDPOP0) >> 8); \ + (PJP)->jp_DcdP0[6] = (uint8_t)((Word_t)(DCDPOP0)); \ + (PJP)->jp_Type = (TYPE); \ +} + +#else // 32 Bit + +#define JU_JPDCDPOP0(PJP) \ + ((Word_t)(PJP)->jp_DcdP0[0] << 16 | \ + (Word_t)(PJP)->jp_DcdP0[1] << 8 | \ + (Word_t)(PJP)->jp_DcdP0[2]) + + +#define JU_JPSETADT(PJP,ADDR,DCDPOP0,TYPE) \ +{ \ + (PJP)->jp_Addr = (ADDR); \ + (PJP)->jp_DcdP0[0] = (uint8_t)((Word_t)(DCDPOP0) >> 16); \ + (PJP)->jp_DcdP0[1] = (uint8_t)((Word_t)(DCDPOP0) >> 8); \ + (PJP)->jp_DcdP0[2] = (uint8_t)((Word_t)(DCDPOP0)); \ + (PJP)->jp_Type = (TYPE); \ +} + +#endif // 32 Bit + +// NUMBER OF BITS IN A BRANCH OR LEAF BITMAP AND SUBEXPANSE: +// +// Note: cJU_BITSPERBITMAP must be the same as the number of JPs in a branch. + +#define cJU_BITSPERBITMAP cJU_SUBEXPPERSTATE + +// Bitmaps are accessed in units of "subexpanses": + +#define cJU_BITSPERSUBEXPB (sizeof(BITMAPB_t) * cJU_BITSPERBYTE) +#define cJU_NUMSUBEXPB (cJU_BITSPERBITMAP / cJU_BITSPERSUBEXPB) + +#define cJU_BITSPERSUBEXPL (sizeof(BITMAPL_t) * cJU_BITSPERBYTE) +#define cJU_NUMSUBEXPL (cJU_BITSPERBITMAP / cJU_BITSPERSUBEXPL) + + +// MASK FOR A SPECIFIED BIT IN A BITMAP: +// +// Warning: If BitNum is a variable, this results in a variable shift that is +// expensive, at least on some processors. Use with caution. +// +// Warning: BitNum must be less than cJU_BITSPERWORD, that is, 0 .. +// cJU_BITSPERWORD - 1, to avoid a truncated shift on some machines. +// +// TBD: Perhaps use an array[32] of masks instead of calculating them. + +#define JU_BITPOSMASKB(BITNUM) (1L << ((BITNUM) % cJU_BITSPERSUBEXPB)) +#define JU_BITPOSMASKL(BITNUM) (1L << ((BITNUM) % cJU_BITSPERSUBEXPL)) + + +// TEST/SET/CLEAR A BIT IN A BITMAP LEAF: +// +// Test if a byte-sized Digit (portion of Index) has a corresponding bit set in +// a bitmap, or set a byte-sized Digits bit into a bitmap, by looking up the +// correct subexpanse and then checking/setting the correct bit. +// +// Note: Mask higher bits, if any, for the convenience of the user of this +// macro, in case they pass a full Index, not just a digit. If the caller has +// a true 8-bit digit, make it of type uint8_t and the compiler should skip the +// unnecessary mask step. + +#define JU_SUBEXPL(DIGIT) (((DIGIT) / cJU_BITSPERSUBEXPL) & (cJU_NUMSUBEXPL-1)) + +#define JU_BITMAPTESTL(PJLB, INDEX) \ + (JU_JLB_BITMAP(PJLB, JU_SUBEXPL(INDEX)) & JU_BITPOSMASKL(INDEX)) + +#define JU_BITMAPSETL(PJLB, INDEX) \ + (JU_JLB_BITMAP(PJLB, JU_SUBEXPL(INDEX)) |= JU_BITPOSMASKL(INDEX)) + +#define JU_BITMAPCLEARL(PJLB, INDEX) \ + (JU_JLB_BITMAP(PJLB, JU_SUBEXPL(INDEX)) ^= JU_BITPOSMASKL(INDEX)) + + +// MAP BITMAP BIT OFFSET TO DIGIT: +// +// Given a digit variable to set, a bitmap branch or leaf subexpanse (base 0), +// the bitmap (BITMAP*_t) for that subexpanse, and an offset (Nth set bit in +// the bitmap, base 0), compute the digit (also base 0) corresponding to the +// subexpanse and offset by counting all bits in the bitmap until offset+1 set +// bits are seen. Avoid expensive variable shifts. Offset should be less than +// the number of set bits in the bitmap; assert this. +// +// If theres a better way to do this, I dont know what it is. + +#define JU_BITMAPDIGITB(DIGIT,SUBEXP,BITMAP,OFFSET) \ + { \ + BITMAPB_t bitmap = (BITMAP); int remain = (OFFSET); \ + (DIGIT) = (SUBEXP) * cJU_BITSPERSUBEXPB; \ + \ + while ((remain -= (bitmap & 1)) >= 0) \ + { \ + bitmap >>= 1; ++(DIGIT); \ + assert((DIGIT) < ((SUBEXP) + 1) * cJU_BITSPERSUBEXPB); \ + } \ + } + +#define JU_BITMAPDIGITL(DIGIT,SUBEXP,BITMAP,OFFSET) \ + { \ + BITMAPL_t bitmap = (BITMAP); int remain = (OFFSET); \ + (DIGIT) = (SUBEXP) * cJU_BITSPERSUBEXPL; \ + \ + while ((remain -= (bitmap & 1)) >= 0) \ + { \ + bitmap >>= 1; ++(DIGIT); \ + assert((DIGIT) < ((SUBEXP) + 1) * cJU_BITSPERSUBEXPL); \ + } \ + } + + +// MASKS FOR PORTIONS OF 32-BIT WORDS: +// +// These are useful for bitmap subexpanses. +// +// "LOWER"/"HIGHER" means bits representing lower/higher-valued Indexes. The +// exact order of bits in the word is explicit here but is hidden from the +// caller. +// +// "EXC" means exclusive of the specified bit; "INC" means inclusive. +// +// In each case, BitPos is either "JU_BITPOSMASK*(BitNum)", or a variable saved +// from an earlier call of that macro; either way, it must be a 32-bit word +// with a single bit set. In the first case, assume the compiler is smart +// enough to optimize out common subexpressions. +// +// The expressions depend on unsigned decimal math that should be universal. + +#define JU_MASKLOWEREXC( BITPOS) ((BITPOS) - 1) +#define JU_MASKLOWERINC( BITPOS) (JU_MASKLOWEREXC(BITPOS) | (BITPOS)) +#define JU_MASKHIGHERINC(BITPOS) (-(BITPOS)) +#define JU_MASKHIGHEREXC(BITPOS) (JU_MASKHIGHERINC(BITPOS) ^ (BITPOS)) + + +// **************************************************************************** +// SUPPORT FOR NATIVE INDEX SIZES +// **************************************************************************** +// +// Copy a series of generic objects (uint8_t, uint16_t, uint32_t, Word_t) from +// one place to another. + +#define JU_COPYMEM(PDST,PSRC,POP1) \ + { \ + Word_t i_ndex = 0; \ + assert((POP1) > 0); \ + do { (PDST)[i_ndex] = (PSRC)[i_ndex]; } \ + while (++i_ndex < (POP1)); \ + } + + +// **************************************************************************** +// SUPPORT FOR NON-NATIVE INDEX SIZES +// **************************************************************************** +// +// Copy a 3-byte Index pointed by a uint8_t * to a Word_t: +// +#define JU_COPY3_PINDEX_TO_LONG(DESTLONG,PINDEX) \ + DESTLONG = (Word_t)(PINDEX)[0] << 16; \ + DESTLONG += (Word_t)(PINDEX)[1] << 8; \ + DESTLONG += (Word_t)(PINDEX)[2] + +// Copy a Word_t to a 3-byte Index pointed at by a uint8_t *: + +#define JU_COPY3_LONG_TO_PINDEX(PINDEX,SOURCELONG) \ + (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 16); \ + (PINDEX)[1] = (uint8_t)((SOURCELONG) >> 8); \ + (PINDEX)[2] = (uint8_t)((SOURCELONG)) + +#ifdef JU_64BIT + +// Copy a 5-byte Index pointed by a uint8_t * to a Word_t: +// +#define JU_COPY5_PINDEX_TO_LONG(DESTLONG,PINDEX) \ + DESTLONG = (Word_t)(PINDEX)[0] << 32; \ + DESTLONG += (Word_t)(PINDEX)[1] << 24; \ + DESTLONG += (Word_t)(PINDEX)[2] << 16; \ + DESTLONG += (Word_t)(PINDEX)[3] << 8; \ + DESTLONG += (Word_t)(PINDEX)[4] + +// Copy a Word_t to a 5-byte Index pointed at by a uint8_t *: + +#define JU_COPY5_LONG_TO_PINDEX(PINDEX,SOURCELONG) \ + (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 32); \ + (PINDEX)[1] = (uint8_t)((SOURCELONG) >> 24); \ + (PINDEX)[2] = (uint8_t)((SOURCELONG) >> 16); \ + (PINDEX)[3] = (uint8_t)((SOURCELONG) >> 8); \ + (PINDEX)[4] = (uint8_t)((SOURCELONG)) + +// Copy a 6-byte Index pointed by a uint8_t * to a Word_t: +// +#define JU_COPY6_PINDEX_TO_LONG(DESTLONG,PINDEX) \ + DESTLONG = (Word_t)(PINDEX)[0] << 40; \ + DESTLONG += (Word_t)(PINDEX)[1] << 32; \ + DESTLONG += (Word_t)(PINDEX)[2] << 24; \ + DESTLONG += (Word_t)(PINDEX)[3] << 16; \ + DESTLONG += (Word_t)(PINDEX)[4] << 8; \ + DESTLONG += (Word_t)(PINDEX)[5] + +// Copy a Word_t to a 6-byte Index pointed at by a uint8_t *: + +#define JU_COPY6_LONG_TO_PINDEX(PINDEX,SOURCELONG) \ + (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 40); \ + (PINDEX)[1] = (uint8_t)((SOURCELONG) >> 32); \ + (PINDEX)[2] = (uint8_t)((SOURCELONG) >> 24); \ + (PINDEX)[3] = (uint8_t)((SOURCELONG) >> 16); \ + (PINDEX)[4] = (uint8_t)((SOURCELONG) >> 8); \ + (PINDEX)[5] = (uint8_t)((SOURCELONG)) + +// Copy a 7-byte Index pointed by a uint8_t * to a Word_t: +// +#define JU_COPY7_PINDEX_TO_LONG(DESTLONG,PINDEX) \ + DESTLONG = (Word_t)(PINDEX)[0] << 48; \ + DESTLONG += (Word_t)(PINDEX)[1] << 40; \ + DESTLONG += (Word_t)(PINDEX)[2] << 32; \ + DESTLONG += (Word_t)(PINDEX)[3] << 24; \ + DESTLONG += (Word_t)(PINDEX)[4] << 16; \ + DESTLONG += (Word_t)(PINDEX)[5] << 8; \ + DESTLONG += (Word_t)(PINDEX)[6] + +// Copy a Word_t to a 7-byte Index pointed at by a uint8_t *: + +#define JU_COPY7_LONG_TO_PINDEX(PINDEX,SOURCELONG) \ + (PINDEX)[0] = (uint8_t)((SOURCELONG) >> 48); \ + (PINDEX)[1] = (uint8_t)((SOURCELONG) >> 40); \ + (PINDEX)[2] = (uint8_t)((SOURCELONG) >> 32); \ + (PINDEX)[3] = (uint8_t)((SOURCELONG) >> 24); \ + (PINDEX)[4] = (uint8_t)((SOURCELONG) >> 16); \ + (PINDEX)[5] = (uint8_t)((SOURCELONG) >> 8); \ + (PINDEX)[6] = (uint8_t)((SOURCELONG)) + +#endif // JU_64BIT + +// **************************************************************************** +// COMMON CODE FRAGMENTS (MACROS) +// **************************************************************************** +// +// These code chunks are shared between various source files. + + +// SET (REPLACE) ONE DIGIT IN AN INDEX: +// +// To avoid endian issues, use masking and ORing, which operates in a +// big-endian register, rather than treating the Index as an array of bytes, +// though that would be simpler, but would operate in endian-specific memory. +// +// TBD: This contains two variable shifts, is that bad? + +#define JU_SETDIGIT(INDEX,DIGIT,STATE) \ + (INDEX) = ((INDEX) & (~cJU_MASKATSTATE(STATE))) \ + | (((Word_t) (DIGIT)) \ + << (((STATE) - 1) * cJU_BITSPERBYTE)) + +// Fast version for single LSB: + +#define JU_SETDIGIT1(INDEX,DIGIT) (INDEX) = ((INDEX) & ~0xff) | (DIGIT) + + +// SET (REPLACE) "N" LEAST DIGITS IN AN INDEX: + +#define JU_SETDIGITS(INDEX,INDEX2,cSTATE) \ + (INDEX) = ((INDEX ) & (~JU_LEASTBYTESMASK(cSTATE))) \ + | ((INDEX2) & ( JU_LEASTBYTESMASK(cSTATE))) + +// COPY DECODE BYTES FROM JP TO INDEX: +// +// Modify Index digit(s) to match the bytes in jp_DcdPopO in case one or more +// branches are skipped and the digits are significant. Its probably faster +// to just do this unconditionally than to check if its necessary. +// +// To avoid endian issues, use masking and ORing, which operates in a +// big-endian register, rather than treating the Index as an array of bytes, +// though that would be simpler, but would operate in endian-specific memory. +// +// WARNING: Must not call JU_LEASTBYTESMASK (via cJU_DCDMASK) with Bytes = +// cJU_ROOTSTATE or a bad mask is generated, but there are no Dcd bytes to copy +// in this case anyway. In fact there are no Dcd bytes unless State < +// cJU_ROOTSTATE - 1, so dont call this macro except in those cases. +// +// TBD: It would be nice to validate jp_DcdPopO against known digits to ensure +// no corruption, but this is non-trivial. + +#define JU_SETDCD(INDEX,PJP,cSTATE) \ + (INDEX) = ((INDEX) & ~cJU_DCDMASK(cSTATE)) \ + | (JU_JPDCDPOP0(PJP) & cJU_DCDMASK(cSTATE)) + +// INSERT/DELETE AN INDEX IN-PLACE IN MEMORY: +// +// Given a pointer to an array of "even" (native), same-sized objects +// (indexes), the current population of the array, an offset in the array, and +// a new Index to insert, "shift up" the array elements (Indexes) above the +// insertion point and insert the new Index. Assume there is sufficient memory +// to do this. +// +// In these macros, "i_offset" is an index offset, and "b_off" is a byte +// offset for odd Index sizes. +// +// Note: Endian issues only arise fro insertion, not deletion, and even for +// insertion, they are transparent when native (even) objects are used, and +// handled explicitly for odd (non-native) Index sizes. +// +// Note: The following macros are tricky enough that there is some test code +// for them appended to this file. + +#define JU_INSERTINPLACE(PARRAY,POP1,OFFSET,INDEX) \ + assert((long) (POP1) > 0); \ + assert((Word_t) (OFFSET) <= (Word_t) (POP1)); \ + { \ + Word_t i_offset = (POP1); \ + \ + while (i_offset-- > (OFFSET)) \ + (PARRAY)[i_offset + 1] = (PARRAY)[i_offset]; \ + \ + (PARRAY)[OFFSET] = (INDEX); \ + } + + +// Variation for non-native Indexes, where cIS = Index Size +// and PByte must point to a uint8_t (byte); shift byte-by-byte: +// + +#define JU_INSERTINPLACE3(PBYTE,POP1,OFFSET,INDEX) \ +{ \ + Word_t i_off = POP1; \ + \ + while (i_off-- > (OFFSET)) \ + { \ + Word_t i_dx = i_off * 3; \ + (PBYTE)[i_dx + 0 + 3] = (PBYTE)[i_dx + 0]; \ + (PBYTE)[i_dx + 1 + 3] = (PBYTE)[i_dx + 1]; \ + (PBYTE)[i_dx + 2 + 3] = (PBYTE)[i_dx + 2]; \ + } \ + JU_COPY3_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 3]), INDEX); \ +} + +#ifdef JU_64BIT + +#define JU_INSERTINPLACE5(PBYTE,POP1,OFFSET,INDEX) \ +{ \ + Word_t i_off = POP1; \ + \ + while (i_off-- > (OFFSET)) \ + { \ + Word_t i_dx = i_off * 5; \ + (PBYTE)[i_dx + 0 + 5] = (PBYTE)[i_dx + 0]; \ + (PBYTE)[i_dx + 1 + 5] = (PBYTE)[i_dx + 1]; \ + (PBYTE)[i_dx + 2 + 5] = (PBYTE)[i_dx + 2]; \ + (PBYTE)[i_dx + 3 + 5] = (PBYTE)[i_dx + 3]; \ + (PBYTE)[i_dx + 4 + 5] = (PBYTE)[i_dx + 4]; \ + } \ + JU_COPY5_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 5]), INDEX); \ +} + +#define JU_INSERTINPLACE6(PBYTE,POP1,OFFSET,INDEX) \ +{ \ + Word_t i_off = POP1; \ + \ + while (i_off-- > (OFFSET)) \ + { \ + Word_t i_dx = i_off * 6; \ + (PBYTE)[i_dx + 0 + 6] = (PBYTE)[i_dx + 0]; \ + (PBYTE)[i_dx + 1 + 6] = (PBYTE)[i_dx + 1]; \ + (PBYTE)[i_dx + 2 + 6] = (PBYTE)[i_dx + 2]; \ + (PBYTE)[i_dx + 3 + 6] = (PBYTE)[i_dx + 3]; \ + (PBYTE)[i_dx + 4 + 6] = (PBYTE)[i_dx + 4]; \ + (PBYTE)[i_dx + 5 + 6] = (PBYTE)[i_dx + 5]; \ + } \ + JU_COPY6_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 6]), INDEX); \ +} + +#define JU_INSERTINPLACE7(PBYTE,POP1,OFFSET,INDEX) \ +{ \ + Word_t i_off = POP1; \ + \ + while (i_off-- > (OFFSET)) \ + { \ + Word_t i_dx = i_off * 7; \ + (PBYTE)[i_dx + 0 + 7] = (PBYTE)[i_dx + 0]; \ + (PBYTE)[i_dx + 1 + 7] = (PBYTE)[i_dx + 1]; \ + (PBYTE)[i_dx + 2 + 7] = (PBYTE)[i_dx + 2]; \ + (PBYTE)[i_dx + 3 + 7] = (PBYTE)[i_dx + 3]; \ + (PBYTE)[i_dx + 4 + 7] = (PBYTE)[i_dx + 4]; \ + (PBYTE)[i_dx + 5 + 7] = (PBYTE)[i_dx + 5]; \ + (PBYTE)[i_dx + 6 + 7] = (PBYTE)[i_dx + 6]; \ + } \ + JU_COPY7_LONG_TO_PINDEX(&((PBYTE)[(OFFSET) * 7]), INDEX); \ +} +#endif // JU_64BIT + +// Counterparts to the above for deleting an Index: +// +// "Shift down" the array elements starting at the Index to be deleted. + +#define JU_DELETEINPLACE(PARRAY,POP1,OFFSET,IGNORE) \ + assert((long) (POP1) > 0); \ + assert((Word_t) (OFFSET) < (Word_t) (POP1)); \ + { \ + Word_t i_offset = (OFFSET); \ + \ + while (++i_offset < (POP1)) \ + (PARRAY)[i_offset - 1] = (PARRAY)[i_offset]; \ + } + +// Variation for odd-byte-sized (non-native) Indexes, where cIS = Index Size +// and PByte must point to a uint8_t (byte); copy byte-by-byte: +// +// Note: If cIS == 1, JU_DELETEINPLACE_ODD == JU_DELETEINPLACE. +// +// Note: There are no endian issues here because bytes are just shifted as-is, +// not converted to/from an Index. + +#define JU_DELETEINPLACE_ODD(PBYTE,POP1,OFFSET,cIS) \ + assert((long) (POP1) > 0); \ + assert((Word_t) (OFFSET) < (Word_t) (POP1)); \ + { \ + Word_t b_off = (((OFFSET) + 1) * (cIS)) - 1; \ + \ + while (++b_off < ((POP1) * (cIS))) \ + (PBYTE)[b_off - (cIS)] = (PBYTE)[b_off]; \ + } + + +// INSERT/DELETE AN INDEX WHILE COPYING OTHERS: +// +// Copy PSource[] to PDest[], where PSource[] has Pop1 elements (Indexes), +// inserting Index at PDest[Offset]. Unlike JU_*INPLACE*() above, these macros +// are used when moving Indexes from one memory object to another. + +#define JU_INSERTCOPY(PDEST,PSOURCE,POP1,OFFSET,INDEX) \ + assert((long) (POP1) > 0); \ + assert((Word_t) (OFFSET) <= (Word_t) (POP1)); \ + { \ + Word_t i_offset; \ + \ + for (i_offset = 0; i_offset < (OFFSET); ++i_offset) \ + (PDEST)[i_offset] = (PSOURCE)[i_offset]; \ + \ + (PDEST)[i_offset] = (INDEX); \ + \ + for (/* null */; i_offset < (POP1); ++i_offset) \ + (PDEST)[i_offset + 1] = (PSOURCE)[i_offset]; \ + } + +#define JU_INSERTCOPY3(PDEST,PSOURCE,POP1,OFFSET,INDEX) \ +assert((long) (POP1) > 0); \ +assert((Word_t) (OFFSET) <= (Word_t) (POP1)); \ +{ \ + Word_t o_ff; \ + \ + for (o_ff = 0; o_ff < (OFFSET); o_ff++) \ + { \ + Word_t i_dx = o_ff * 3; \ + (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2]; \ + } \ + JU_COPY3_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 3]), INDEX); \ + \ + for (/* null */; o_ff < (POP1); o_ff++) \ + { \ + Word_t i_dx = o_ff * 3; \ + (PDEST)[i_dx + 0 + 3] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1 + 3] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2 + 3] = (PSOURCE)[i_dx + 2]; \ + } \ +} + +#ifdef JU_64BIT + +#define JU_INSERTCOPY5(PDEST,PSOURCE,POP1,OFFSET,INDEX) \ +assert((long) (POP1) > 0); \ +assert((Word_t) (OFFSET) <= (Word_t) (POP1)); \ +{ \ + Word_t o_ff; \ + \ + for (o_ff = 0; o_ff < (OFFSET); o_ff++) \ + { \ + Word_t i_dx = o_ff * 5; \ + (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2]; \ + (PDEST)[i_dx + 3] = (PSOURCE)[i_dx + 3]; \ + (PDEST)[i_dx + 4] = (PSOURCE)[i_dx + 4]; \ + } \ + JU_COPY5_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 5]), INDEX); \ + \ + for (/* null */; o_ff < (POP1); o_ff++) \ + { \ + Word_t i_dx = o_ff * 5; \ + (PDEST)[i_dx + 0 + 5] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1 + 5] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2 + 5] = (PSOURCE)[i_dx + 2]; \ + (PDEST)[i_dx + 3 + 5] = (PSOURCE)[i_dx + 3]; \ + (PDEST)[i_dx + 4 + 5] = (PSOURCE)[i_dx + 4]; \ + } \ +} + +#define JU_INSERTCOPY6(PDEST,PSOURCE,POP1,OFFSET,INDEX) \ +assert((long) (POP1) > 0); \ +assert((Word_t) (OFFSET) <= (Word_t) (POP1)); \ +{ \ + Word_t o_ff; \ + \ + for (o_ff = 0; o_ff < (OFFSET); o_ff++) \ + { \ + Word_t i_dx = o_ff * 6; \ + (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2]; \ + (PDEST)[i_dx + 3] = (PSOURCE)[i_dx + 3]; \ + (PDEST)[i_dx + 4] = (PSOURCE)[i_dx + 4]; \ + (PDEST)[i_dx + 5] = (PSOURCE)[i_dx + 5]; \ + } \ + JU_COPY6_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 6]), INDEX); \ + \ + for (/* null */; o_ff < (POP1); o_ff++) \ + { \ + Word_t i_dx = o_ff * 6; \ + (PDEST)[i_dx + 0 + 6] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1 + 6] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2 + 6] = (PSOURCE)[i_dx + 2]; \ + (PDEST)[i_dx + 3 + 6] = (PSOURCE)[i_dx + 3]; \ + (PDEST)[i_dx + 4 + 6] = (PSOURCE)[i_dx + 4]; \ + (PDEST)[i_dx + 5 + 6] = (PSOURCE)[i_dx + 5]; \ + } \ +} + +#define JU_INSERTCOPY7(PDEST,PSOURCE,POP1,OFFSET,INDEX) \ +assert((long) (POP1) > 0); \ +assert((Word_t) (OFFSET) <= (Word_t) (POP1)); \ +{ \ + Word_t o_ff; \ + \ + for (o_ff = 0; o_ff < (OFFSET); o_ff++) \ + { \ + Word_t i_dx = o_ff * 7; \ + (PDEST)[i_dx + 0] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2] = (PSOURCE)[i_dx + 2]; \ + (PDEST)[i_dx + 3] = (PSOURCE)[i_dx + 3]; \ + (PDEST)[i_dx + 4] = (PSOURCE)[i_dx + 4]; \ + (PDEST)[i_dx + 5] = (PSOURCE)[i_dx + 5]; \ + (PDEST)[i_dx + 6] = (PSOURCE)[i_dx + 6]; \ + } \ + JU_COPY7_LONG_TO_PINDEX(&((PDEST)[(OFFSET) * 7]), INDEX); \ + \ + for (/* null */; o_ff < (POP1); o_ff++) \ + { \ + Word_t i_dx = o_ff * 7; \ + (PDEST)[i_dx + 0 + 7] = (PSOURCE)[i_dx + 0]; \ + (PDEST)[i_dx + 1 + 7] = (PSOURCE)[i_dx + 1]; \ + (PDEST)[i_dx + 2 + 7] = (PSOURCE)[i_dx + 2]; \ + (PDEST)[i_dx + 3 + 7] = (PSOURCE)[i_dx + 3]; \ + (PDEST)[i_dx + 4 + 7] = (PSOURCE)[i_dx + 4]; \ + (PDEST)[i_dx + 5 + 7] = (PSOURCE)[i_dx + 5]; \ + (PDEST)[i_dx + 6 + 7] = (PSOURCE)[i_dx + 6]; \ + } \ +} + +#endif // JU_64BIT + +// Counterparts to the above for deleting an Index: + +#define JU_DELETECOPY(PDEST,PSOURCE,POP1,OFFSET,IGNORE) \ + assert((long) (POP1) > 0); \ + assert((Word_t) (OFFSET) < (Word_t) (POP1)); \ + { \ + Word_t i_offset; \ + \ + for (i_offset = 0; i_offset < (OFFSET); ++i_offset) \ + (PDEST)[i_offset] = (PSOURCE)[i_offset]; \ + \ + for (++i_offset; i_offset < (POP1); ++i_offset) \ + (PDEST)[i_offset - 1] = (PSOURCE)[i_offset]; \ + } + +// Variation for odd-byte-sized (non-native) Indexes, where cIS = Index Size; +// copy byte-by-byte: +// +// Note: There are no endian issues here because bytes are just shifted as-is, +// not converted to/from an Index. +// +// Note: If cIS == 1, JU_DELETECOPY_ODD == JU_DELETECOPY, at least in concept. + +#define JU_DELETECOPY_ODD(PDEST,PSOURCE,POP1,OFFSET,cIS) \ + assert((long) (POP1) > 0); \ + assert((Word_t) (OFFSET) < (Word_t) (POP1)); \ + { \ + uint8_t *_Pdest = (uint8_t *) (PDEST); \ + uint8_t *_Psource = (uint8_t *) (PSOURCE); \ + Word_t b_off; \ + \ + for (b_off = 0; b_off < ((OFFSET) * (cIS)); ++b_off) \ + *_Pdest++ = *_Psource++; \ + \ + _Psource += (cIS); \ + \ + for (b_off += (cIS); b_off < ((POP1) * (cIS)); ++b_off) \ + *_Pdest++ = *_Psource++; \ + } + + +// GENERIC RETURN CODE HANDLING FOR JUDY1 (NO VALUE AREAS) AND JUDYL (VALUE +// AREAS): +// +// This common code hides Judy1 versus JudyL details of how to return various +// conditions, including a pointer to a value area for JudyL. +// +// First, define an internal variation of JERR called JERRI (I = int) to make +// lint happy. We accidentally shipped to 11.11 OEUR with all functions that +// return int or Word_t using JERR, which is type Word_t, for errors. Lint +// complains about this for functions that return int. So, internally use +// JERRI for error returns from the int functions. Experiments show that +// callers which compare int Foo() to (Word_t) JERR (~0UL) are OK, since JERRI +// sign-extends to match JERR. + +#define JERRI ((int) ~0) // see above. + +#ifdef JUDY1 + +#define JU_RET_FOUND return(1) +#define JU_RET_NOTFOUND return(0) + +// For Judy1, these all "fall through" to simply JU_RET_FOUND, since there is no +// value area pointer to return: + +#define JU_RET_FOUND_LEAFW(PJLW,POP1,OFFSET) JU_RET_FOUND + +#define JU_RET_FOUND_JPM(Pjpm) JU_RET_FOUND +#define JU_RET_FOUND_PVALUE(Pjv,OFFSET) JU_RET_FOUND +#ifndef JU_64BIT +#define JU_RET_FOUND_LEAF1(Pjll,POP1,OFFSET) JU_RET_FOUND +#endif +#define JU_RET_FOUND_LEAF2(Pjll,POP1,OFFSET) JU_RET_FOUND +#define JU_RET_FOUND_LEAF3(Pjll,POP1,OFFSET) JU_RET_FOUND +#ifdef JU_64BIT +#define JU_RET_FOUND_LEAF4(Pjll,POP1,OFFSET) JU_RET_FOUND +#define JU_RET_FOUND_LEAF5(Pjll,POP1,OFFSET) JU_RET_FOUND +#define JU_RET_FOUND_LEAF6(Pjll,POP1,OFFSET) JU_RET_FOUND +#define JU_RET_FOUND_LEAF7(Pjll,POP1,OFFSET) JU_RET_FOUND +#endif +#define JU_RET_FOUND_IMM_01(Pjp) JU_RET_FOUND +#define JU_RET_FOUND_IMM(Pjp,OFFSET) JU_RET_FOUND + +// Note: No JudyL equivalent: + +#define JU_RET_FOUND_FULLPOPU1 JU_RET_FOUND +#define JU_RET_FOUND_LEAF_B1(PJLB,SUBEXP,OFFSET) JU_RET_FOUND + +#else // JUDYL + +// JU_RET_FOUND // see below; must NOT be defined for JudyL. +#define JU_RET_NOTFOUND return((PPvoid_t) NULL) + +// For JudyL, the location of the value area depends on the JP type and other +// factors: +// +// TBD: The value areas should be accessed via data structures, here and in +// Dougs code, not by hard-coded address calculations. +// +// This is useful in insert/delete code when the value area is returned from +// lower levels in the JPM: + +#define JU_RET_FOUND_JPM(Pjpm) return((PPvoid_t) ((Pjpm)->jpm_PValue)) + +// This is useful in insert/delete code when the value area location is already +// computed: + +#define JU_RET_FOUND_PVALUE(Pjv,OFFSET) return((PPvoid_t) ((Pjv) + OFFSET)) + +#define JU_RET_FOUND_LEAFW(PJLW,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAFWVALUEAREA(PJLW, POP1) + (OFFSET))) + +#define JU_RET_FOUND_LEAF1(Pjll,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAF1VALUEAREA(Pjll, POP1) + (OFFSET))) +#define JU_RET_FOUND_LEAF2(Pjll,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAF2VALUEAREA(Pjll, POP1) + (OFFSET))) +#define JU_RET_FOUND_LEAF3(Pjll,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAF3VALUEAREA(Pjll, POP1) + (OFFSET))) +#ifdef JU_64BIT +#define JU_RET_FOUND_LEAF4(Pjll,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAF4VALUEAREA(Pjll, POP1) + (OFFSET))) +#define JU_RET_FOUND_LEAF5(Pjll,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAF5VALUEAREA(Pjll, POP1) + (OFFSET))) +#define JU_RET_FOUND_LEAF6(Pjll,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAF6VALUEAREA(Pjll, POP1) + (OFFSET))) +#define JU_RET_FOUND_LEAF7(Pjll,POP1,OFFSET) \ + return((PPvoid_t) (JL_LEAF7VALUEAREA(Pjll, POP1) + (OFFSET))) +#endif + +// Note: Here jp_Addr is a value area itself and not an address, so P_JV() is +// not needed: + +#define JU_RET_FOUND_IMM_01(PJP) return((PPvoid_t) (&((PJP)->jp_Addr))) + +// Note: Here jp_Addr is a pointer to a separately-mallocd value area, so +// P_JV() is required; likewise for JL_JLB_PVALUE: + +#define JU_RET_FOUND_IMM(PJP,OFFSET) \ + return((PPvoid_t) (P_JV((PJP)->jp_Addr) + (OFFSET))) + +#define JU_RET_FOUND_LEAF_B1(PJLB,SUBEXP,OFFSET) \ + return((PPvoid_t) (P_JV(JL_JLB_PVALUE(PJLB, SUBEXP)) + (OFFSET))) + +#endif // JUDYL + + +// GENERIC ERROR HANDLING: +// +// This is complicated by variations in the needs of the callers of these +// macros. Only use JU_SET_ERRNO() for PJError, because it can be null; use +// JU_SET_ERRNO_NONNULL() for Pjpm, which is never null, and also in other +// cases where the pointer is known not to be null (to save dead branches). +// +// Note: Most cases of JU_ERRNO_OVERRUN or JU_ERRNO_CORRUPT should result in +// an assertion failure in debug code, so they are more likely to be caught, so +// do that here in each macro. + +#define JU_SET_ERRNO(PJError, JErrno) \ + { \ + assert((JErrno) != JU_ERRNO_OVERRUN); \ + assert((JErrno) != JU_ERRNO_CORRUPT); \ + \ + if (PJError != (PJError_t) NULL) \ + { \ + JU_ERRNO(PJError) = (JErrno); \ + JU_ERRID(PJError) = __LINE__; \ + } \ + } + +// Variation for callers who know already that PJError is non-null; and, it can +// also be Pjpm (both PJError_t and Pjpm_t have je_* fields), so only assert it +// for null, not cast to any specific pointer type: + +#define JU_SET_ERRNO_NONNULL(PJError, JErrno) \ + { \ + assert((JErrno) != JU_ERRNO_OVERRUN); \ + assert((JErrno) != JU_ERRNO_CORRUPT); \ + assert(PJError); \ + \ + JU_ERRNO(PJError) = (JErrno); \ + JU_ERRID(PJError) = __LINE__; \ + } + +// Variation to copy error info from a (required) JPM to an (optional) +// PJError_t: +// +// Note: The assertions above about JU_ERRNO_OVERRUN and JU_ERRNO_CORRUPT +// should have already popped, so they are not needed here. + +#define JU_COPY_ERRNO(PJError, Pjpm) \ + { \ + if (PJError) \ + { \ + JU_ERRNO(PJError) = (uint8_t)JU_ERRNO(Pjpm); \ + JU_ERRID(PJError) = JU_ERRID(Pjpm); \ + } \ + } + +// For JErrno parameter to previous macros upon return from Judy*Alloc*(): +// +// The memory allocator returns an address of 0 for out of memory, +// 1..sizeof(Word_t)-1 for corruption (an invalid pointer), otherwise a valid +// pointer. + +#define JU_ALLOC_ERRNO(ADDR) \ + (((void *) (ADDR) != (void *) NULL) ? JU_ERRNO_OVERRUN : JU_ERRNO_NOMEM) + +#define JU_CHECKALLOC(Type,Ptr,Retval) \ + if ((Ptr) < (Type) sizeof(Word_t)) \ + { \ + JU_SET_ERRNO(PJError, JU_ALLOC_ERRNO(Ptr)); \ + return(Retval); \ + } + +// Leaf search routines + +#ifdef JU_NOINLINE + +int j__udySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index); +int j__udySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index); +int j__udySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index); + +#ifdef JU_64BIT + +int j__udySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index); +int j__udySearchLeaf5(Pjll_t Pjll, Word_t LeafPop1, Word_t Index); +int j__udySearchLeaf6(Pjll_t Pjll, Word_t LeafPop1, Word_t Index); +int j__udySearchLeaf7(Pjll_t Pjll, Word_t LeafPop1, Word_t Index); + +#endif // JU_64BIT + +int j__udySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index); + +#else // complier support for inline + +#ifdef JU_WIN +static __inline int j__udySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeaf1(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNATIVE(uint8_t, Pjll, LeafPop1, Index); } + +#ifdef JU_WIN +static __inline int j__udySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeaf2(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNATIVE(uint16_t, Pjll, LeafPop1, Index); } + +#ifdef JU_WIN +static __inline int j__udySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeaf3(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 3, JU_COPY3_PINDEX_TO_LONG); } + +#ifdef JU_64BIT + +#ifdef JU_WIN +static __inline int j__udySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeaf4(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNATIVE(uint32_t, Pjll, LeafPop1, Index); } + +#ifdef JU_WIN +static __inline int j__udySearchLeaf5(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeaf5(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 5, JU_COPY5_PINDEX_TO_LONG); } + +#ifdef JU_WIN +static __inline int j__udySearchLeaf6(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeaf6(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 6, JU_COPY6_PINDEX_TO_LONG); } + +#ifdef JU_WIN +static __inline int j__udySearchLeaf7(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeaf7(Pjll_t Pjll, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNONNAT(Pjll, LeafPop1, Index, 7, JU_COPY7_PINDEX_TO_LONG); } + +#endif // JU_64BIT + +#ifdef JU_WIN +static __inline int j__udySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index) +#else +static inline int j__udySearchLeafW(Pjlw_t Pjlw, Word_t LeafPop1, Word_t Index) +#endif +{ SEARCHLEAFNATIVE(Word_t, Pjlw, LeafPop1, Index); } + +#endif // compiler support for inline + +#endif // ! _JUDYPRIVATE_INCLUDED diff --git a/libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h b/libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h new file mode 100644 index 000000000..5b4704899 --- /dev/null +++ b/libnetdata/libjudy/src/JudyCommon/JudyPrivate1L.h @@ -0,0 +1,485 @@ +#ifndef _JUDYPRIVATE1L_INCLUDED +#define _JUDYPRIVATE1L_INCLUDED +// _________________ +// +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.31 $ $Source: /judy/src/JudyCommon/JudyPrivate1L.h $ + +// **************************************************************************** +// Declare common cJU_* names for JP Types that occur in both Judy1 and JudyL, +// for use by code that ifdefs JUDY1 and JUDYL. Only JP Types common to both +// Judy1 and JudyL are #defined here with equivalent cJU_* names. JP Types +// unique to only Judy1 or JudyL are listed in comments, so the type lists +// match the Judy1.h and JudyL.h files. +// +// This file also defines cJU_* for other JP-related constants and functions +// that some shared JUDY1/JUDYL code finds handy. +// +// At least in principle this file should be included AFTER Judy1.h or JudyL.h. +// +// WARNING: This file must be kept consistent with the enums in Judy1.h and +// JudyL.h. +// +// TBD: You might think, why not define common cJU_* enums in, say, +// JudyPrivate.h, and then inherit them into superset enums in Judy1.h and +// JudyL.h? The problem is that the enum lists for each class (cJ1_* and +// cJL_*) must be numerically "packed" into the correct order, for two reasons: +// (1) allow the compiler to generate "tight" switch statements with no wasted +// slots (although this is not very big), and (2) allow calculations using the +// enum values, although this is also not an issue if the calculations are only +// within each cJ*_JPIMMED_*_* class and the members are packed within the +// class. + +#ifdef JUDY1 + +#define cJU_JRPNULL cJ1_JRPNULL +#define cJU_JPNULL1 cJ1_JPNULL1 +#define cJU_JPNULL2 cJ1_JPNULL2 +#define cJU_JPNULL3 cJ1_JPNULL3 +#ifdef JU_64BIT +#define cJU_JPNULL4 cJ1_JPNULL4 +#define cJU_JPNULL5 cJ1_JPNULL5 +#define cJU_JPNULL6 cJ1_JPNULL6 +#define cJU_JPNULL7 cJ1_JPNULL7 +#endif +#define cJU_JPNULLMAX cJ1_JPNULLMAX +#define cJU_JPBRANCH_L2 cJ1_JPBRANCH_L2 +#define cJU_JPBRANCH_L3 cJ1_JPBRANCH_L3 +#ifdef JU_64BIT +#define cJU_JPBRANCH_L4 cJ1_JPBRANCH_L4 +#define cJU_JPBRANCH_L5 cJ1_JPBRANCH_L5 +#define cJU_JPBRANCH_L6 cJ1_JPBRANCH_L6 +#define cJU_JPBRANCH_L7 cJ1_JPBRANCH_L7 +#endif +#define cJU_JPBRANCH_L cJ1_JPBRANCH_L +#define j__U_BranchBJPPopToWords j__1_BranchBJPPopToWords +#define cJU_JPBRANCH_B2 cJ1_JPBRANCH_B2 +#define cJU_JPBRANCH_B3 cJ1_JPBRANCH_B3 +#ifdef JU_64BIT +#define cJU_JPBRANCH_B4 cJ1_JPBRANCH_B4 +#define cJU_JPBRANCH_B5 cJ1_JPBRANCH_B5 +#define cJU_JPBRANCH_B6 cJ1_JPBRANCH_B6 +#define cJU_JPBRANCH_B7 cJ1_JPBRANCH_B7 +#endif +#define cJU_JPBRANCH_B cJ1_JPBRANCH_B +#define cJU_JPBRANCH_U2 cJ1_JPBRANCH_U2 +#define cJU_JPBRANCH_U3 cJ1_JPBRANCH_U3 +#ifdef JU_64BIT +#define cJU_JPBRANCH_U4 cJ1_JPBRANCH_U4 +#define cJU_JPBRANCH_U5 cJ1_JPBRANCH_U5 +#define cJU_JPBRANCH_U6 cJ1_JPBRANCH_U6 +#define cJU_JPBRANCH_U7 cJ1_JPBRANCH_U7 +#endif +#define cJU_JPBRANCH_U cJ1_JPBRANCH_U +#ifndef JU_64BIT +#define cJU_JPLEAF1 cJ1_JPLEAF1 +#endif +#define cJU_JPLEAF2 cJ1_JPLEAF2 +#define cJU_JPLEAF3 cJ1_JPLEAF3 +#ifdef JU_64BIT +#define cJU_JPLEAF4 cJ1_JPLEAF4 +#define cJU_JPLEAF5 cJ1_JPLEAF5 +#define cJU_JPLEAF6 cJ1_JPLEAF6 +#define cJU_JPLEAF7 cJ1_JPLEAF7 +#endif +#define cJU_JPLEAF_B1 cJ1_JPLEAF_B1 +// cJ1_JPFULLPOPU1 +#define cJU_JPIMMED_1_01 cJ1_JPIMMED_1_01 +#define cJU_JPIMMED_2_01 cJ1_JPIMMED_2_01 +#define cJU_JPIMMED_3_01 cJ1_JPIMMED_3_01 +#ifdef JU_64BIT +#define cJU_JPIMMED_4_01 cJ1_JPIMMED_4_01 +#define cJU_JPIMMED_5_01 cJ1_JPIMMED_5_01 +#define cJU_JPIMMED_6_01 cJ1_JPIMMED_6_01 +#define cJU_JPIMMED_7_01 cJ1_JPIMMED_7_01 +#endif +#define cJU_JPIMMED_1_02 cJ1_JPIMMED_1_02 +#define cJU_JPIMMED_1_03 cJ1_JPIMMED_1_03 +#define cJU_JPIMMED_1_04 cJ1_JPIMMED_1_04 +#define cJU_JPIMMED_1_05 cJ1_JPIMMED_1_05 +#define cJU_JPIMMED_1_06 cJ1_JPIMMED_1_06 +#define cJU_JPIMMED_1_07 cJ1_JPIMMED_1_07 +#ifdef JU_64BIT +// cJ1_JPIMMED_1_08 +// cJ1_JPIMMED_1_09 +// cJ1_JPIMMED_1_10 +// cJ1_JPIMMED_1_11 +// cJ1_JPIMMED_1_12 +// cJ1_JPIMMED_1_13 +// cJ1_JPIMMED_1_14 +// cJ1_JPIMMED_1_15 +#endif +#define cJU_JPIMMED_2_02 cJ1_JPIMMED_2_02 +#define cJU_JPIMMED_2_03 cJ1_JPIMMED_2_03 +#ifdef JU_64BIT +// cJ1_JPIMMED_2_04 +// cJ1_JPIMMED_2_05 +// cJ1_JPIMMED_2_06 +// cJ1_JPIMMED_2_07 +#endif +#define cJU_JPIMMED_3_02 cJ1_JPIMMED_3_02 +#ifdef JU_64BIT +// cJ1_JPIMMED_3_03 +// cJ1_JPIMMED_3_04 +// cJ1_JPIMMED_3_05 +// cJ1_JPIMMED_4_02 +// cJ1_JPIMMED_4_03 +// cJ1_JPIMMED_5_02 +// cJ1_JPIMMED_5_03 +// cJ1_JPIMMED_6_02 +// cJ1_JPIMMED_7_02 +#endif +#define cJU_JPIMMED_CAP cJ1_JPIMMED_CAP + +#else // JUDYL **************************************************************** + +#define cJU_JRPNULL cJL_JRPNULL +#define cJU_JPNULL1 cJL_JPNULL1 +#define cJU_JPNULL2 cJL_JPNULL2 +#define cJU_JPNULL3 cJL_JPNULL3 +#ifdef JU_64BIT +#define cJU_JPNULL4 cJL_JPNULL4 +#define cJU_JPNULL5 cJL_JPNULL5 +#define cJU_JPNULL6 cJL_JPNULL6 +#define cJU_JPNULL7 cJL_JPNULL7 +#endif +#define cJU_JPNULLMAX cJL_JPNULLMAX +#define cJU_JPBRANCH_L2 cJL_JPBRANCH_L2 +#define cJU_JPBRANCH_L3 cJL_JPBRANCH_L3 +#ifdef JU_64BIT +#define cJU_JPBRANCH_L4 cJL_JPBRANCH_L4 +#define cJU_JPBRANCH_L5 cJL_JPBRANCH_L5 +#define cJU_JPBRANCH_L6 cJL_JPBRANCH_L6 +#define cJU_JPBRANCH_L7 cJL_JPBRANCH_L7 +#endif +#define cJU_JPBRANCH_L cJL_JPBRANCH_L +#define j__U_BranchBJPPopToWords j__L_BranchBJPPopToWords +#define cJU_JPBRANCH_B2 cJL_JPBRANCH_B2 +#define cJU_JPBRANCH_B3 cJL_JPBRANCH_B3 +#ifdef JU_64BIT +#define cJU_JPBRANCH_B4 cJL_JPBRANCH_B4 +#define cJU_JPBRANCH_B5 cJL_JPBRANCH_B5 +#define cJU_JPBRANCH_B6 cJL_JPBRANCH_B6 +#define cJU_JPBRANCH_B7 cJL_JPBRANCH_B7 +#endif +#define cJU_JPBRANCH_B cJL_JPBRANCH_B +#define cJU_JPBRANCH_U2 cJL_JPBRANCH_U2 +#define cJU_JPBRANCH_U3 cJL_JPBRANCH_U3 +#ifdef JU_64BIT +#define cJU_JPBRANCH_U4 cJL_JPBRANCH_U4 +#define cJU_JPBRANCH_U5 cJL_JPBRANCH_U5 +#define cJU_JPBRANCH_U6 cJL_JPBRANCH_U6 +#define cJU_JPBRANCH_U7 cJL_JPBRANCH_U7 +#endif +#define cJU_JPBRANCH_U cJL_JPBRANCH_U +#define cJU_JPLEAF1 cJL_JPLEAF1 +#define cJU_JPLEAF2 cJL_JPLEAF2 +#define cJU_JPLEAF3 cJL_JPLEAF3 +#ifdef JU_64BIT +#define cJU_JPLEAF4 cJL_JPLEAF4 +#define cJU_JPLEAF5 cJL_JPLEAF5 +#define cJU_JPLEAF6 cJL_JPLEAF6 +#define cJU_JPLEAF7 cJL_JPLEAF7 +#endif +#define cJU_JPLEAF_B1 cJL_JPLEAF_B1 +#define cJU_JPIMMED_1_01 cJL_JPIMMED_1_01 +#define cJU_JPIMMED_2_01 cJL_JPIMMED_2_01 +#define cJU_JPIMMED_3_01 cJL_JPIMMED_3_01 +#ifdef JU_64BIT +#define cJU_JPIMMED_4_01 cJL_JPIMMED_4_01 +#define cJU_JPIMMED_5_01 cJL_JPIMMED_5_01 +#define cJU_JPIMMED_6_01 cJL_JPIMMED_6_01 +#define cJU_JPIMMED_7_01 cJL_JPIMMED_7_01 +#endif +#define cJU_JPIMMED_1_02 cJL_JPIMMED_1_02 +#define cJU_JPIMMED_1_03 cJL_JPIMMED_1_03 +#ifdef JU_64BIT +#define cJU_JPIMMED_1_04 cJL_JPIMMED_1_04 +#define cJU_JPIMMED_1_05 cJL_JPIMMED_1_05 +#define cJU_JPIMMED_1_06 cJL_JPIMMED_1_06 +#define cJU_JPIMMED_1_07 cJL_JPIMMED_1_07 +#define cJU_JPIMMED_2_02 cJL_JPIMMED_2_02 +#define cJU_JPIMMED_2_03 cJL_JPIMMED_2_03 +#define cJU_JPIMMED_3_02 cJL_JPIMMED_3_02 +#endif +#define cJU_JPIMMED_CAP cJL_JPIMMED_CAP + +#endif // JUDYL + + +// **************************************************************************** +// cJU*_ other than JP types: + +#ifdef JUDY1 + +#define cJU_LEAFW_MAXPOP1 cJ1_LEAFW_MAXPOP1 +#ifndef JU_64BIT +#define cJU_LEAF1_MAXPOP1 cJ1_LEAF1_MAXPOP1 +#endif +#define cJU_LEAF2_MAXPOP1 cJ1_LEAF2_MAXPOP1 +#define cJU_LEAF3_MAXPOP1 cJ1_LEAF3_MAXPOP1 +#ifdef JU_64BIT +#define cJU_LEAF4_MAXPOP1 cJ1_LEAF4_MAXPOP1 +#define cJU_LEAF5_MAXPOP1 cJ1_LEAF5_MAXPOP1 +#define cJU_LEAF6_MAXPOP1 cJ1_LEAF6_MAXPOP1 +#define cJU_LEAF7_MAXPOP1 cJ1_LEAF7_MAXPOP1 +#endif +#define cJU_IMMED1_MAXPOP1 cJ1_IMMED1_MAXPOP1 +#define cJU_IMMED2_MAXPOP1 cJ1_IMMED2_MAXPOP1 +#define cJU_IMMED3_MAXPOP1 cJ1_IMMED3_MAXPOP1 +#ifdef JU_64BIT +#define cJU_IMMED4_MAXPOP1 cJ1_IMMED4_MAXPOP1 +#define cJU_IMMED5_MAXPOP1 cJ1_IMMED5_MAXPOP1 +#define cJU_IMMED6_MAXPOP1 cJ1_IMMED6_MAXPOP1 +#define cJU_IMMED7_MAXPOP1 cJ1_IMMED7_MAXPOP1 +#endif + +#define JU_LEAF1POPTOWORDS(Pop1) J1_LEAF1POPTOWORDS(Pop1) +#define JU_LEAF2POPTOWORDS(Pop1) J1_LEAF2POPTOWORDS(Pop1) +#define JU_LEAF3POPTOWORDS(Pop1) J1_LEAF3POPTOWORDS(Pop1) +#ifdef JU_64BIT +#define JU_LEAF4POPTOWORDS(Pop1) J1_LEAF4POPTOWORDS(Pop1) +#define JU_LEAF5POPTOWORDS(Pop1) J1_LEAF5POPTOWORDS(Pop1) +#define JU_LEAF6POPTOWORDS(Pop1) J1_LEAF6POPTOWORDS(Pop1) +#define JU_LEAF7POPTOWORDS(Pop1) J1_LEAF7POPTOWORDS(Pop1) +#endif +#define JU_LEAFWPOPTOWORDS(Pop1) J1_LEAFWPOPTOWORDS(Pop1) + +#ifndef JU_64BIT +#define JU_LEAF1GROWINPLACE(Pop1) J1_LEAF1GROWINPLACE(Pop1) +#endif +#define JU_LEAF2GROWINPLACE(Pop1) J1_LEAF2GROWINPLACE(Pop1) +#define JU_LEAF3GROWINPLACE(Pop1) J1_LEAF3GROWINPLACE(Pop1) +#ifdef JU_64BIT +#define JU_LEAF4GROWINPLACE(Pop1) J1_LEAF4GROWINPLACE(Pop1) +#define JU_LEAF5GROWINPLACE(Pop1) J1_LEAF5GROWINPLACE(Pop1) +#define JU_LEAF6GROWINPLACE(Pop1) J1_LEAF6GROWINPLACE(Pop1) +#define JU_LEAF7GROWINPLACE(Pop1) J1_LEAF7GROWINPLACE(Pop1) +#endif +#define JU_LEAFWGROWINPLACE(Pop1) J1_LEAFWGROWINPLACE(Pop1) + +#define j__udyCreateBranchL j__udy1CreateBranchL +#define j__udyCreateBranchB j__udy1CreateBranchB +#define j__udyCreateBranchU j__udy1CreateBranchU +#define j__udyCascade1 j__udy1Cascade1 +#define j__udyCascade2 j__udy1Cascade2 +#define j__udyCascade3 j__udy1Cascade3 +#ifdef JU_64BIT +#define j__udyCascade4 j__udy1Cascade4 +#define j__udyCascade5 j__udy1Cascade5 +#define j__udyCascade6 j__udy1Cascade6 +#define j__udyCascade7 j__udy1Cascade7 +#endif +#define j__udyCascadeL j__udy1CascadeL +#define j__udyInsertBranch j__udy1InsertBranch + +#define j__udyBranchBToBranchL j__udy1BranchBToBranchL +#ifndef JU_64BIT +#define j__udyLeafB1ToLeaf1 j__udy1LeafB1ToLeaf1 +#endif +#define j__udyLeaf1ToLeaf2 j__udy1Leaf1ToLeaf2 +#define j__udyLeaf2ToLeaf3 j__udy1Leaf2ToLeaf3 +#ifndef JU_64BIT +#define j__udyLeaf3ToLeafW j__udy1Leaf3ToLeafW +#else +#define j__udyLeaf3ToLeaf4 j__udy1Leaf3ToLeaf4 +#define j__udyLeaf4ToLeaf5 j__udy1Leaf4ToLeaf5 +#define j__udyLeaf5ToLeaf6 j__udy1Leaf5ToLeaf6 +#define j__udyLeaf6ToLeaf7 j__udy1Leaf6ToLeaf7 +#define j__udyLeaf7ToLeafW j__udy1Leaf7ToLeafW +#endif + +#define jpm_t j1pm_t +#define Pjpm_t Pj1pm_t + +#define jlb_t j1lb_t +#define Pjlb_t Pj1lb_t + +#define JU_JLB_BITMAP J1_JLB_BITMAP + +#define j__udyAllocJPM j__udy1AllocJ1PM +#define j__udyAllocJBL j__udy1AllocJBL +#define j__udyAllocJBB j__udy1AllocJBB +#define j__udyAllocJBBJP j__udy1AllocJBBJP +#define j__udyAllocJBU j__udy1AllocJBU +#ifndef JU_64BIT +#define j__udyAllocJLL1 j__udy1AllocJLL1 +#endif +#define j__udyAllocJLL2 j__udy1AllocJLL2 +#define j__udyAllocJLL3 j__udy1AllocJLL3 +#ifdef JU_64BIT +#define j__udyAllocJLL4 j__udy1AllocJLL4 +#define j__udyAllocJLL5 j__udy1AllocJLL5 +#define j__udyAllocJLL6 j__udy1AllocJLL6 +#define j__udyAllocJLL7 j__udy1AllocJLL7 +#endif +#define j__udyAllocJLW j__udy1AllocJLW +#define j__udyAllocJLB1 j__udy1AllocJLB1 +#define j__udyFreeJPM j__udy1FreeJ1PM +#define j__udyFreeJBL j__udy1FreeJBL +#define j__udyFreeJBB j__udy1FreeJBB +#define j__udyFreeJBBJP j__udy1FreeJBBJP +#define j__udyFreeJBU j__udy1FreeJBU +#ifndef JU_64BIT +#define j__udyFreeJLL1 j__udy1FreeJLL1 +#endif +#define j__udyFreeJLL2 j__udy1FreeJLL2 +#define j__udyFreeJLL3 j__udy1FreeJLL3 +#ifdef JU_64BIT +#define j__udyFreeJLL4 j__udy1FreeJLL4 +#define j__udyFreeJLL5 j__udy1FreeJLL5 +#define j__udyFreeJLL6 j__udy1FreeJLL6 +#define j__udyFreeJLL7 j__udy1FreeJLL7 +#endif +#define j__udyFreeJLW j__udy1FreeJLW +#define j__udyFreeJLB1 j__udy1FreeJLB1 +#define j__udyFreeSM j__udy1FreeSM + +#define j__uMaxWords j__u1MaxWords + +#ifdef DEBUG +#define JudyCheckPop Judy1CheckPop +#endif + +#else // JUDYL **************************************************************** + +#define cJU_LEAFW_MAXPOP1 cJL_LEAFW_MAXPOP1 +#define cJU_LEAF1_MAXPOP1 cJL_LEAF1_MAXPOP1 +#define cJU_LEAF2_MAXPOP1 cJL_LEAF2_MAXPOP1 +#define cJU_LEAF3_MAXPOP1 cJL_LEAF3_MAXPOP1 +#ifdef JU_64BIT +#define cJU_LEAF4_MAXPOP1 cJL_LEAF4_MAXPOP1 +#define cJU_LEAF5_MAXPOP1 cJL_LEAF5_MAXPOP1 +#define cJU_LEAF6_MAXPOP1 cJL_LEAF6_MAXPOP1 +#define cJU_LEAF7_MAXPOP1 cJL_LEAF7_MAXPOP1 +#endif +#define cJU_IMMED1_MAXPOP1 cJL_IMMED1_MAXPOP1 +#define cJU_IMMED2_MAXPOP1 cJL_IMMED2_MAXPOP1 +#define cJU_IMMED3_MAXPOP1 cJL_IMMED3_MAXPOP1 +#ifdef JU_64BIT +#define cJU_IMMED4_MAXPOP1 cJL_IMMED4_MAXPOP1 +#define cJU_IMMED5_MAXPOP1 cJL_IMMED5_MAXPOP1 +#define cJU_IMMED6_MAXPOP1 cJL_IMMED6_MAXPOP1 +#define cJU_IMMED7_MAXPOP1 cJL_IMMED7_MAXPOP1 +#endif + +#define JU_LEAF1POPTOWORDS(Pop1) JL_LEAF1POPTOWORDS(Pop1) +#define JU_LEAF2POPTOWORDS(Pop1) JL_LEAF2POPTOWORDS(Pop1) +#define JU_LEAF3POPTOWORDS(Pop1) JL_LEAF3POPTOWORDS(Pop1) +#ifdef JU_64BIT +#define JU_LEAF4POPTOWORDS(Pop1) JL_LEAF4POPTOWORDS(Pop1) +#define JU_LEAF5POPTOWORDS(Pop1) JL_LEAF5POPTOWORDS(Pop1) +#define JU_LEAF6POPTOWORDS(Pop1) JL_LEAF6POPTOWORDS(Pop1) +#define JU_LEAF7POPTOWORDS(Pop1) JL_LEAF7POPTOWORDS(Pop1) +#endif +#define JU_LEAFWPOPTOWORDS(Pop1) JL_LEAFWPOPTOWORDS(Pop1) + +#define JU_LEAF1GROWINPLACE(Pop1) JL_LEAF1GROWINPLACE(Pop1) +#define JU_LEAF2GROWINPLACE(Pop1) JL_LEAF2GROWINPLACE(Pop1) +#define JU_LEAF3GROWINPLACE(Pop1) JL_LEAF3GROWINPLACE(Pop1) +#ifdef JU_64BIT +#define JU_LEAF4GROWINPLACE(Pop1) JL_LEAF4GROWINPLACE(Pop1) +#define JU_LEAF5GROWINPLACE(Pop1) JL_LEAF5GROWINPLACE(Pop1) +#define JU_LEAF6GROWINPLACE(Pop1) JL_LEAF6GROWINPLACE(Pop1) +#define JU_LEAF7GROWINPLACE(Pop1) JL_LEAF7GROWINPLACE(Pop1) +#endif +#define JU_LEAFWGROWINPLACE(Pop1) JL_LEAFWGROWINPLACE(Pop1) + +#define j__udyCreateBranchL j__udyLCreateBranchL +#define j__udyCreateBranchB j__udyLCreateBranchB +#define j__udyCreateBranchU j__udyLCreateBranchU +#define j__udyCascade1 j__udyLCascade1 +#define j__udyCascade2 j__udyLCascade2 +#define j__udyCascade3 j__udyLCascade3 +#ifdef JU_64BIT +#define j__udyCascade4 j__udyLCascade4 +#define j__udyCascade5 j__udyLCascade5 +#define j__udyCascade6 j__udyLCascade6 +#define j__udyCascade7 j__udyLCascade7 +#endif +#define j__udyCascadeL j__udyLCascadeL +#define j__udyInsertBranch j__udyLInsertBranch + +#define j__udyBranchBToBranchL j__udyLBranchBToBranchL +#define j__udyLeafB1ToLeaf1 j__udyLLeafB1ToLeaf1 +#define j__udyLeaf1ToLeaf2 j__udyLLeaf1ToLeaf2 +#define j__udyLeaf2ToLeaf3 j__udyLLeaf2ToLeaf3 +#ifndef JU_64BIT +#define j__udyLeaf3ToLeafW j__udyLLeaf3ToLeafW +#else +#define j__udyLeaf3ToLeaf4 j__udyLLeaf3ToLeaf4 +#define j__udyLeaf4ToLeaf5 j__udyLLeaf4ToLeaf5 +#define j__udyLeaf5ToLeaf6 j__udyLLeaf5ToLeaf6 +#define j__udyLeaf6ToLeaf7 j__udyLLeaf6ToLeaf7 +#define j__udyLeaf7ToLeafW j__udyLLeaf7ToLeafW +#endif + +#define jpm_t jLpm_t +#define Pjpm_t PjLpm_t + +#define jlb_t jLlb_t +#define Pjlb_t PjLlb_t + +#define JU_JLB_BITMAP JL_JLB_BITMAP + +#define j__udyAllocJPM j__udyLAllocJLPM +#define j__udyAllocJBL j__udyLAllocJBL +#define j__udyAllocJBB j__udyLAllocJBB +#define j__udyAllocJBBJP j__udyLAllocJBBJP +#define j__udyAllocJBU j__udyLAllocJBU +#define j__udyAllocJLL1 j__udyLAllocJLL1 +#define j__udyAllocJLL2 j__udyLAllocJLL2 +#define j__udyAllocJLL3 j__udyLAllocJLL3 +#ifdef JU_64BIT +#define j__udyAllocJLL4 j__udyLAllocJLL4 +#define j__udyAllocJLL5 j__udyLAllocJLL5 +#define j__udyAllocJLL6 j__udyLAllocJLL6 +#define j__udyAllocJLL7 j__udyLAllocJLL7 +#endif +#define j__udyAllocJLW j__udyLAllocJLW +#define j__udyAllocJLB1 j__udyLAllocJLB1 +// j__udyLAllocJV +#define j__udyFreeJPM j__udyLFreeJLPM +#define j__udyFreeJBL j__udyLFreeJBL +#define j__udyFreeJBB j__udyLFreeJBB +#define j__udyFreeJBBJP j__udyLFreeJBBJP +#define j__udyFreeJBU j__udyLFreeJBU +#define j__udyFreeJLL1 j__udyLFreeJLL1 +#define j__udyFreeJLL2 j__udyLFreeJLL2 +#define j__udyFreeJLL3 j__udyLFreeJLL3 +#ifdef JU_64BIT +#define j__udyFreeJLL4 j__udyLFreeJLL4 +#define j__udyFreeJLL5 j__udyLFreeJLL5 +#define j__udyFreeJLL6 j__udyLFreeJLL6 +#define j__udyFreeJLL7 j__udyLFreeJLL7 +#endif +#define j__udyFreeJLW j__udyLFreeJLW +#define j__udyFreeJLB1 j__udyLFreeJLB1 +#define j__udyFreeSM j__udyLFreeSM +// j__udyLFreeJV + +#define j__uMaxWords j__uLMaxWords + +#ifdef DEBUG +#define JudyCheckPop JudyLCheckPop +#endif + +#endif // JUDYL + +#endif // _JUDYPRIVATE1L_INCLUDED diff --git a/libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h b/libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h new file mode 100644 index 000000000..10295ba95 --- /dev/null +++ b/libnetdata/libjudy/src/JudyCommon/JudyPrivateBranch.h @@ -0,0 +1,788 @@ +#ifndef _JUDY_PRIVATE_BRANCH_INCLUDED +#define _JUDY_PRIVATE_BRANCH_INCLUDED +// _________________ +// +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 1.2 $ $Source: /home/doug/judy-1.0.5_min/test/../src/JudyCommon/RCS/JudyPrivateBranch.h,v $ +// +// Header file for all Judy sources, for global but private (non-exported) +// declarations specific to branch support. +// +// See also the "Judy Shop Manual" (try judy/doc/int/JudyShopManual.*). + + +// **************************************************************************** +// JUDY POINTER (JP) SUPPORT +// **************************************************************************** +// +// This "rich pointer" object is pivotal to Judy execution. +// +// JP CONTAINING OTHER THAN IMMEDIATE INDEXES: +// +// If the JP points to a linear or bitmap leaf, jp_DcdPopO contains the +// Population-1 in LSbs and Decode (Dcd) bytes in the MSBs. (In practice the +// Decode bits are masked off while accessing the Pop0 bits.) +// +// The Decode Size, the number of Dcd bytes available, is encoded in jpo_Type. +// It can also be thought of as the number of states "skipped" in the SM, where +// each state decodes 8 bits = 1 byte. +// +// TBD: Dont need two structures, except possibly to force jp_Type to highest +// address! +// +// Note: The jpo_u union is not required by HP-UX or Linux but Win32 because +// the cl.exe compiler otherwise refuses to pack a bitfield (DcdPopO) with +// anything else, even with the -Zp option. This is pretty ugly, but +// fortunately portable, and its all hide-able by macros (see below). + +typedef struct J_UDY_POINTER_OTHERS // JPO. + { + Word_t j_po_Addr; // first word: Pjp_t, Word_t, etc. + union { + Word_t j_po_Addr1; + uint8_t j_po_DcdP0[sizeof(Word_t) - 1]; + uint8_t j_po_Bytes[sizeof(Word_t)]; // last byte = jp_Type. + } jpo_u; + } jpo_t; + + +// JP CONTAINING IMMEDIATE INDEXES: +// +// j_pi_1Index[] plus j_pi_LIndex[] together hold as many N-byte (1..3-byte +// [1..7-byte]) Indexes as will fit in sizeof(jpi_t) less 1 byte for j_pi_Type +// (that is, 7..1 [15..1] Indexes). +// +// For Judy1, j_pi_1Index[] is used and j_pi_LIndex[] is not used. +// For JudyL, j_pi_LIndex[] is used and j_pi_1Index[] is not used. +// +// Note: Actually when Pop1 = 1, jpi_t is not used, and the least bytes of the +// single Index are stored in j_po_DcdPopO, for both Judy1 and JudyL, so for +// JudyL the j_po_Addr field can hold the target value. +// +// TBD: Revise this structure to not overload j_po_DcdPopO this way? The +// current arrangement works, its just confusing. + +typedef struct _JUDY_POINTER_IMMEDL + { + Word_t j_pL_Addr; + uint8_t j_pL_LIndex[sizeof(Word_t) - 1]; // see above. + uint8_t j_pL_Type; + } jpL_t; + +typedef struct _JUDY_POINTER_IMMED1 + { + uint8_t j_p1_1Index[(2 * sizeof(Word_t)) - 1]; + uint8_t j_p1_Type; + } jp1_t; + +// UNION OF JP TYPES: +// +// A branch is an array of cJU_BRANCHUNUMJPS (256) of this object, or an +// alternate data type such as: A linear branch which is a list of 2..7 JPs, +// or a bitmap branch which contains 8 lists of 0..32 JPs. JPs reside only in +// branches of a Judy SM. + +typedef union J_UDY_POINTER // JP. + { + jpo_t j_po; // other than immediate indexes. + jpL_t j_pL; // immediate indexes. + jp1_t j_p1; // immediate indexes. + } jp_t, *Pjp_t; + +// For coding convenience: +// +// Note, jp_Type has the same bits in jpo_t jpL_t and jp1_t. + +#define jp_1Index j_p1.j_p1_1Index // for storing Indexes in first word. +#define jp_LIndex j_pL.j_pL_LIndex // for storing Indexes in second word. +#define jp_Addr j_po.j_po_Addr +#define jp_Addr1 j_po.jpo_u.j_po_Addr1 +//#define jp_DcdPop0 j_po.jpo_u.j_po_DcdPop0 +#define jp_Addr1 j_po.jpo_u.j_po_Addr1 +//#define jp_Type j_po.jpo_u.j_po_Bytes[sizeof(Word_t) - 1] +#define jp_Type j_p1.j_p1_Type +#define jp_DcdP0 j_po.jpo_u.j_po_DcdP0 + + +// **************************************************************************** +// JUDY POINTER (JP) -- RELATED MACROS AND CONSTANTS +// **************************************************************************** + +// EXTRACT VALUES FROM JP: +// +// Masks for the bytes in the Dcd and Pop0 parts of jp_DcdPopO: +// +// cJU_DCDMASK() consists of a mask that excludes the (LSb) Pop0 bytes and +// also, just to be safe, the top byte of the word, since jp_DcdPopO is 1 byte +// less than a full word. +// +// Note: These are constant macros (cJU) because cPopBytes should be a +// constant. Also note cPopBytes == state in the SM. + +#define cJU_POP0MASK(cPopBytes) JU_LEASTBYTESMASK(cPopBytes) + +#define cJU_DCDMASK(cPopBytes) \ + ((cJU_ALLONES >> cJU_BITSPERBYTE) & (~cJU_POP0MASK(cPopBytes))) + +// Mask off the high byte from INDEX to it can be compared to DcdPopO: + +#define JU_TRIMTODCDSIZE(INDEX) ((cJU_ALLONES >> cJU_BITSPERBYTE) & (INDEX)) + +// Get from jp_DcdPopO the Pop0 for various branch JP Types: +// +// Note: There are no simple macros for cJU_BRANCH* Types because their +// populations must be added up and dont reside in an already-calculated +// place. + +#define JU_JPBRANCH_POP0(PJP,cPopBytes) \ + (JU_JPDCDPOP0(PJP) & cJU_POP0MASK(cPopBytes)) + +// METHOD FOR DETERMINING IF OBJECTS HAVE ROOM TO GROW: +// +// J__U_GROWCK() is a generic method to determine if an object can grow in +// place, based on whether the next population size (one more) would use the +// same space. + +#define J__U_GROWCK(POP1,MAXPOP1,POPTOWORDS) \ + (((POP1) != (MAXPOP1)) && (POPTOWORDS[POP1] == POPTOWORDS[(POP1) + 1])) + +#define JU_BRANCHBJPGROWINPLACE(NumJPs) \ + J__U_GROWCK(NumJPs, cJU_BITSPERSUBEXPB, j__U_BranchBJPPopToWords) + + +// DETERMINE IF AN INDEX IS (NOT) IN A JPS EXPANSE: + +#define JU_DCDNOTMATCHINDEX(INDEX,PJP,POP0BYTES) \ + (((INDEX) ^ JU_JPDCDPOP0(PJP)) & cJU_DCDMASK(POP0BYTES)) + + +// NUMBER OF JPs IN AN UNCOMPRESSED BRANCH: +// +// An uncompressed branch is simply an array of 256 Judy Pointers (JPs). It is +// a minimum cacheline fill object. Define it here before its first needed. + +#define cJU_BRANCHUNUMJPS cJU_SUBEXPPERSTATE + + +// **************************************************************************** +// JUDY BRANCH LINEAR (JBL) SUPPORT +// **************************************************************************** +// +// A linear branch is a way of compressing empty expanses (null JPs) out of an +// uncompressed 256-way branch, when the number of populated expanses is so +// small that even a bitmap branch is excessive. +// +// The maximum number of JPs in a Judy linear branch: +// +// Note: This number results in a 1-cacheline sized structure. Previous +// versions had a larger struct so a linear branch didnt become a bitmap +// branch until the memory consumed was even, but for speed, its better to +// switch "sooner" and keep a linear branch fast. + +#define cJU_BRANCHLMAXJPS 7 + + +// LINEAR BRANCH STRUCT: +// +// 1-byte count, followed by array of byte-sized expanses, followed by JPs. + +typedef struct J__UDY_BRANCH_LINEAR + { + uint8_t jbl_NumJPs; // num of JPs (Pjp_t), 1..N. + uint8_t jbl_Expanse[cJU_BRANCHLMAXJPS]; // 1..7 MSbs of pop exps. + jp_t jbl_jp [cJU_BRANCHLMAXJPS]; // JPs for populated exps. + } jbl_t, * Pjbl_t; + + +// **************************************************************************** +// JUDY BRANCH BITMAP (JBB) SUPPORT +// **************************************************************************** +// +// A bitmap branch is a way of compressing empty expanses (null JPs) out of +// uncompressed 256-way branch. This costs 1 additional cache line fill, but +// can save a lot of memory when it matters most, near the leaves, and +// typically there will be only one at most in the path to any Index (leaf). +// +// The bitmap indicates which of the cJU_BRANCHUNUMJPS (256) JPs in the branch +// are NOT null, that is, their expanses are populated. The jbb_t also +// contains N pointers to "mini" Judy branches ("subexpanses") of up to M JPs +// each (see BITMAP_BRANCHMxN, for example, BITMAP_BRANCH32x8), where M x N = +// cJU_BRANCHUNUMJPS. These are dynamically allocated and never contain +// cJ*_JPNULL* jp_Types. An empty subexpanse is represented by no bit sets in +// the corresponding subexpanse bitmap, in which case the corresponding +// jbbs_Pjp pointers value is unused. +// +// Note that the number of valid JPs in each 1-of-N subexpanses is determined +// by POPULATION rather than by EXPANSE -- the desired outcome to save memory +// when near the leaves. Note that the memory required for 185 JPs is about as +// much as an uncompressed 256-way branch, therefore 184 is set as the maximum. +// However, it is expected that a conversion to an uncompressed 256-way branch +// will normally take place before this limit is reached for other reasons, +// such as improving performance when the "wasted" memory is well amortized by +// the population under the branch, preserving an acceptable overall +// bytes/Index in the Judy array. +// +// The number of pointers to arrays of JPs in the Judy bitmap branch: +// +// Note: The numbers below are the same in both 32 and 64 bit systems. + +#define cJU_BRANCHBMAXJPS 184 // maximum JPs for bitmap branches. + +// Convenience wrappers for referencing BranchB bitmaps or JP subarray +// pointers: +// +// Note: JU_JBB_PJP produces a "raw" memory address that must pass through +// P_JP before use, except when freeing memory: + +#define JU_JBB_BITMAP(Pjbb, SubExp) ((Pjbb)->jbb_jbbs[SubExp].jbbs_Bitmap) +#define JU_JBB_PJP( Pjbb, SubExp) ((Pjbb)->jbb_jbbs[SubExp].jbbs_Pjp) + +#define JU_SUBEXPB(Digit) (((Digit) / cJU_BITSPERSUBEXPB) & (cJU_NUMSUBEXPB-1)) + +#define JU_BITMAPTESTB(Pjbb, Index) \ + (JU_JBB_BITMAP(Pjbb, JU_SUBEXPB(Index)) & JU_BITPOSMASKB(Index)) + +#define JU_BITMAPSETB(Pjbb, Index) \ + (JU_JBB_BITMAP(Pjbb, JU_SUBEXPB(Index)) |= JU_BITPOSMASKB(Index)) + +// Note: JU_BITMAPCLEARB is not defined because the code does it a faster way. + +typedef struct J__UDY_BRANCH_BITMAP_SUBEXPANSE + { + BITMAPB_t jbbs_Bitmap; + Pjp_t jbbs_Pjp; + + } jbbs_t; + +typedef struct J__UDY_BRANCH_BITMAP + { + jbbs_t jbb_jbbs [cJU_NUMSUBEXPB]; +#ifdef SUBEXPCOUNTS + Word_t jbb_subPop1[cJU_NUMSUBEXPB]; +#endif + } jbb_t, * Pjbb_t; + +#define JU_BRANCHJP_NUMJPSTOWORDS(NumJPs) (j__U_BranchBJPPopToWords[NumJPs]) + +#ifdef SUBEXPCOUNTS +#define cJU_NUMSUBEXPU 16 // number of subexpanse counts. +#endif + + +// **************************************************************************** +// JUDY BRANCH UNCOMPRESSED (JBU) SUPPORT +// **************************************************************************** + +// Convenience wrapper for referencing BranchU JPs: +// +// Note: This produces a non-"raw" address already passed through P_JBU(). + +#define JU_JBU_PJP(Pjp,Index,Level) \ + (&((P_JBU((Pjp)->jp_Addr))->jbu_jp[JU_DIGITATSTATE(Index, Level)])) +#define JU_JBU_PJP0(Pjp) \ + (&((P_JBU((Pjp)->jp_Addr))->jbu_jp[0])) + +typedef struct J__UDY_BRANCH_UNCOMPRESSED + { + jp_t jbu_jp [cJU_BRANCHUNUMJPS]; // JPs for populated exp. +#ifdef SUBEXPCOUNTS + Word_t jbu_subPop1[cJU_NUMSUBEXPU]; +#endif + } jbu_t, * Pjbu_t; + + +// **************************************************************************** +// OTHER SUPPORT FOR JUDY STATE MACHINES (SMs) +// **************************************************************************** + +// OBJECT SIZES IN WORDS: +// +// Word_ts per various JudyL structures that have constant sizes. +// cJU_WORDSPERJP should always be 2; this is fundamental to the Judy +// structures. + +#define cJU_WORDSPERJP (sizeof(jp_t) / cJU_BYTESPERWORD) +#define cJU_WORDSPERCL (cJU_BYTESPERCL / cJU_BYTESPERWORD) + + +// OPPORTUNISTIC UNCOMPRESSION: +// +// Define populations at which a BranchL or BranchB must convert to BranchU. +// Earlier conversion is possible with good memory efficiency -- see below. + +#ifndef NO_BRANCHU + +// Max population below BranchL, then convert to BranchU: + +#define JU_BRANCHL_MAX_POP 1000 + +// Minimum global population increment before next conversion of a BranchB to a +// BranchU: +// +// This is was done to allow malloc() to coalesce memory before the next big +// (~512 words) allocation. + +#define JU_BTOU_POP_INCREMENT 300 + +// Min/max population below BranchB, then convert to BranchU: + +#define JU_BRANCHB_MIN_POP 135 +#define JU_BRANCHB_MAX_POP 750 + +#else // NO_BRANCHU + +// These are set up to have conservative conversion schedules to BranchU: + +#define JU_BRANCHL_MAX_POP (-1UL) +#define JU_BTOU_POP_INCREMENT 300 +#define JU_BRANCHB_MIN_POP 1000 +#define JU_BRANCHB_MAX_POP (-1UL) + +#endif // NO_BRANCHU + + +// MISCELLANEOUS MACROS: + +// Get N most significant bits from the shifted Index word: +// +// As Index words are decoded, they are shifted left so only relevant, +// undecoded Index bits remain. + +#define JU_BITSFROMSFTIDX(SFTIDX, N) ((SFTIDX) >> (cJU_BITSPERWORD - (N))) + +// TBD: I have my doubts about the necessity of these macros (dlb): + +// Produce 1-digit mask at specified state: + +#define cJU_MASKATSTATE(State) (0xffL << (((State) - 1) * cJU_BITSPERBYTE)) + +// Get byte (digit) from Index at the specified state, right justified: +// +// Note: State must be 1..cJU_ROOTSTATE, and Digits must be 1..(cJU_ROOTSTATE +// - 1), but theres no way to assert these within an expression. + +#define JU_DIGITATSTATE(Index,cState) \ + ((uint8_t)((Index) >> (((cState) - 1) * cJU_BITSPERBYTE))) + +// Similarly, place byte (digit) at correct position for the specified state: +// +// Note: Cast digit to a Word_t first so there are no complaints or problems +// about shifting it more than 32 bits on a 64-bit system, say, when it is a +// uint8_t from jbl_Expanse[]. (Believe it or not, the C standard says to +// promote an unsigned char to a signed int; -Ac does not do this, but -Ae +// does.) +// +// Also, to make lint happy, cast the whole result again because apparently +// shifting a Word_t does not result in a Word_t! + +#define JU_DIGITTOSTATE(Digit,cState) \ + ((Word_t) (((Word_t) (Digit)) << (((cState) - 1) * cJU_BITSPERBYTE))) + +#endif // ! _JUDY_PRIVATE_BRANCH_INCLUDED + + +#ifdef TEST_INSDEL + +// **************************************************************************** +// TEST CODE FOR INSERT/DELETE MACROS +// **************************************************************************** +// +// To use this, compile a temporary *.c file containing: +// +// #define DEBUG +// #define JUDY_ASSERT +// #define TEST_INSDEL +// #include "JudyPrivate.h" +// #include "JudyPrivateBranch.h" +// +// Use a command like this: cc -Ae +DD64 -I. -I JudyCommon -o t t.c +// For best results, include +DD64 on a 64-bit system. +// +// This test code exercises some tricky macros, but the output must be studied +// manually to verify it. Assume that for even-index testing, whole words +// (Word_t) suffices. + +#include + +#define INDEXES 3 // in each array. + + +// **************************************************************************** +// I N I T +// +// Set up variables for next test. See usage. + +FUNCTION void Init ( + int base, + PWord_t PeIndex, + PWord_t PoIndex, + PWord_t Peleaf, // always whole words. +#ifndef JU_64BIT + uint8_t * Poleaf3) +#else + uint8_t * Poleaf3, + uint8_t * Poleaf5, + uint8_t * Poleaf6, + uint8_t * Poleaf7) +#endif +{ + int offset; + + *PeIndex = 99; + + for (offset = 0; offset <= INDEXES; ++offset) + Peleaf[offset] = base + offset; + + for (offset = 0; offset < (INDEXES + 1) * 3; ++offset) + Poleaf3[offset] = base + offset; + +#ifndef JU_64BIT + *PoIndex = (91 << 24) | (92 << 16) | (93 << 8) | 94; +#else + + *PoIndex = (91L << 56) | (92L << 48) | (93L << 40) | (94L << 32) + | (95L << 24) | (96L << 16) | (97L << 8) | 98L; + + for (offset = 0; offset < (INDEXES + 1) * 5; ++offset) + Poleaf5[offset] = base + offset; + + for (offset = 0; offset < (INDEXES + 1) * 6; ++offset) + Poleaf6[offset] = base + offset; + + for (offset = 0; offset < (INDEXES + 1) * 7; ++offset) + Poleaf7[offset] = base + offset; +#endif + +} // Init() + + +// **************************************************************************** +// P R I N T L E A F +// +// Print the byte values in a leaf. + +FUNCTION void PrintLeaf ( + char * Label, // for output. + int IOffset, // insertion offset in array. + int Indsize, // index size in bytes. + uint8_t * PLeaf) // array of Index bytes. +{ + int offset; // in PLeaf. + int byte; // in one word. + + (void) printf("%s %u: ", Label, IOffset); + + for (offset = 0; offset <= INDEXES; ++offset) + { + for (byte = 0; byte < Indsize; ++byte) + (void) printf("%2d", PLeaf[(offset * Indsize) + byte]); + + (void) printf(" "); + } + + (void) printf("\n"); + +} // PrintLeaf() + + +// **************************************************************************** +// M A I N +// +// Test program. + +FUNCTION main() +{ + Word_t eIndex; // even, to insert. + Word_t oIndex; // odd, to insert. + Word_t eleaf [ INDEXES + 1]; // even leaf, index size 4. + uint8_t oleaf3[(INDEXES + 1) * 3]; // odd leaf, index size 3. +#ifdef JU_64BIT + uint8_t oleaf5[(INDEXES + 1) * 5]; // odd leaf, index size 5. + uint8_t oleaf6[(INDEXES + 1) * 6]; // odd leaf, index size 6. + uint8_t oleaf7[(INDEXES + 1) * 7]; // odd leaf, index size 7. +#endif + Word_t eleaf_2 [ INDEXES + 1]; // same, but second arrays: + uint8_t oleaf3_2[(INDEXES + 1) * 3]; +#ifdef JU_64BIT + uint8_t oleaf5_2[(INDEXES + 1) * 5]; + uint8_t oleaf6_2[(INDEXES + 1) * 6]; + uint8_t oleaf7_2[(INDEXES + 1) * 7]; +#endif + int ioffset; // index insertion offset. + +#ifndef JU_64BIT +#define INIT Init( 0, & eIndex, & oIndex, eleaf, oleaf3) +#define INIT2 INIT; Init(50, & eIndex, & oIndex, eleaf_2, oleaf3_2) +#else +#define INIT Init( 0, & eIndex, & oIndex, eleaf, oleaf3, \ + oleaf5, oleaf6, oleaf7) +#define INIT2 INIT; Init(50, & eIndex, & oIndex, eleaf_2, oleaf3_2, \ + oleaf5_2, oleaf6_2, oleaf7_2) +#endif + +#define WSIZE sizeof (Word_t) // shorthand. + +#ifdef PRINTALL // to turn on "noisy" printouts. +#define PRINTLEAF(Label,IOffset,Indsize,PLeaf) \ + PrintLeaf(Label,IOffset,Indsize,PLeaf) +#else +#define PRINTLEAF(Label,IOffset,Indsize,PLeaf) \ + if (ioffset == 0) \ + PrintLeaf(Label,IOffset,Indsize,PLeaf) +#endif + + (void) printf( +"In each case, tests operate on an initial array of %d indexes. Even-index\n" +"tests set index values to 0,1,2...; odd-index tests set byte values to\n" +"0,1,2... Inserted indexes have a value of 99 or else byte values 91,92,...\n", + INDEXES); + + (void) puts("\nJU_INSERTINPLACE():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, WSIZE, (uint8_t *) eleaf); + JU_INSERTINPLACE(eleaf, INDEXES, ioffset, eIndex); + PrintLeaf("After ", ioffset, WSIZE, (uint8_t *) eleaf); + } + + (void) puts("\nJU_INSERTINPLACE3():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 3, oleaf3); + JU_INSERTINPLACE3(oleaf3, INDEXES, ioffset, oIndex); + PrintLeaf("After ", ioffset, 3, oleaf3); + } + +#ifdef JU_64BIT + (void) puts("\nJU_INSERTINPLACE5():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 5, oleaf5); + JU_INSERTINPLACE5(oleaf5, INDEXES, ioffset, oIndex); + PrintLeaf("After ", ioffset, 5, oleaf5); + } + + (void) puts("\nJU_INSERTINPLACE6():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 6, oleaf6); + JU_INSERTINPLACE6(oleaf6, INDEXES, ioffset, oIndex); + PrintLeaf("After ", ioffset, 6, oleaf6); + } + + (void) puts("\nJU_INSERTINPLACE7():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 7, oleaf7); + JU_INSERTINPLACE7(oleaf7, INDEXES, ioffset, oIndex); + PrintLeaf("After ", ioffset, 7, oleaf7); + } +#endif // JU_64BIT + + (void) puts("\nJU_DELETEINPLACE():"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, WSIZE, (uint8_t *) eleaf); + JU_DELETEINPLACE(eleaf, INDEXES, ioffset); + PrintLeaf("After ", ioffset, WSIZE, (uint8_t *) eleaf); + } + + (void) puts("\nJU_DELETEINPLACE_ODD(3):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 3, oleaf3); + JU_DELETEINPLACE_ODD(oleaf3, INDEXES, ioffset, 3); + PrintLeaf("After ", ioffset, 3, oleaf3); + } + +#ifdef JU_64BIT + (void) puts("\nJU_DELETEINPLACE_ODD(5):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 5, oleaf5); + JU_DELETEINPLACE_ODD(oleaf5, INDEXES, ioffset, 5); + PrintLeaf("After ", ioffset, 5, oleaf5); + } + + (void) puts("\nJU_DELETEINPLACE_ODD(6):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 6, oleaf6); + JU_DELETEINPLACE_ODD(oleaf6, INDEXES, ioffset, 6); + PrintLeaf("After ", ioffset, 6, oleaf6); + } + + (void) puts("\nJU_DELETEINPLACE_ODD(7):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT; + PRINTLEAF("Before", ioffset, 7, oleaf7); + JU_DELETEINPLACE_ODD(oleaf7, INDEXES, ioffset, 7); + PrintLeaf("After ", ioffset, 7, oleaf7); + } +#endif // JU_64BIT + + (void) puts("\nJU_INSERTCOPY():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, WSIZE, (uint8_t *) eleaf); + PRINTLEAF("Before, dest", ioffset, WSIZE, (uint8_t *) eleaf_2); + JU_INSERTCOPY(eleaf_2, eleaf, INDEXES, ioffset, eIndex); + PRINTLEAF("After, src ", ioffset, WSIZE, (uint8_t *) eleaf); + PrintLeaf("After, dest", ioffset, WSIZE, (uint8_t *) eleaf_2); + } + + (void) puts("\nJU_INSERTCOPY3():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 3, oleaf3); + PRINTLEAF("Before, dest", ioffset, 3, oleaf3_2); + JU_INSERTCOPY3(oleaf3_2, oleaf3, INDEXES, ioffset, oIndex); + PRINTLEAF("After, src ", ioffset, 3, oleaf3); + PrintLeaf("After, dest", ioffset, 3, oleaf3_2); + } + +#ifdef JU_64BIT + (void) puts("\nJU_INSERTCOPY5():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 5, oleaf5); + PRINTLEAF("Before, dest", ioffset, 5, oleaf5_2); + JU_INSERTCOPY5(oleaf5_2, oleaf5, INDEXES, ioffset, oIndex); + PRINTLEAF("After, src ", ioffset, 5, oleaf5); + PrintLeaf("After, dest", ioffset, 5, oleaf5_2); + } + + (void) puts("\nJU_INSERTCOPY6():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 6, oleaf6); + PRINTLEAF("Before, dest", ioffset, 6, oleaf6_2); + JU_INSERTCOPY6(oleaf6_2, oleaf6, INDEXES, ioffset, oIndex); + PRINTLEAF("After, src ", ioffset, 6, oleaf6); + PrintLeaf("After, dest", ioffset, 6, oleaf6_2); + } + + (void) puts("\nJU_INSERTCOPY7():"); + + for (ioffset = 0; ioffset <= INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 7, oleaf7); + PRINTLEAF("Before, dest", ioffset, 7, oleaf7_2); + JU_INSERTCOPY7(oleaf7_2, oleaf7, INDEXES, ioffset, oIndex); + PRINTLEAF("After, src ", ioffset, 7, oleaf7); + PrintLeaf("After, dest", ioffset, 7, oleaf7_2); + } +#endif // JU_64BIT + + (void) puts("\nJU_DELETECOPY():"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, WSIZE, (uint8_t *) eleaf); + PRINTLEAF("Before, dest", ioffset, WSIZE, (uint8_t *) eleaf_2); + JU_DELETECOPY(eleaf_2, eleaf, INDEXES, ioffset, ignore); + PRINTLEAF("After, src ", ioffset, WSIZE, (uint8_t *) eleaf); + PrintLeaf("After, dest", ioffset, WSIZE, (uint8_t *) eleaf_2); + } + + (void) puts("\nJU_DELETECOPY_ODD(3):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 3, oleaf3); + PRINTLEAF("Before, dest", ioffset, 3, oleaf3_2); + JU_DELETECOPY_ODD(oleaf3_2, oleaf3, INDEXES, ioffset, 3); + PRINTLEAF("After, src ", ioffset, 3, oleaf3); + PrintLeaf("After, dest", ioffset, 3, oleaf3_2); + } + +#ifdef JU_64BIT + (void) puts("\nJU_DELETECOPY_ODD(5):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 5, oleaf5); + PRINTLEAF("Before, dest", ioffset, 5, oleaf5_2); + JU_DELETECOPY_ODD(oleaf5_2, oleaf5, INDEXES, ioffset, 5); + PRINTLEAF("After, src ", ioffset, 5, oleaf5); + PrintLeaf("After, dest", ioffset, 5, oleaf5_2); + } + + (void) puts("\nJU_DELETECOPY_ODD(6):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 6, oleaf6); + PRINTLEAF("Before, dest", ioffset, 6, oleaf6_2); + JU_DELETECOPY_ODD(oleaf6_2, oleaf6, INDEXES, ioffset, 6); + PRINTLEAF("After, src ", ioffset, 6, oleaf6); + PrintLeaf("After, dest", ioffset, 6, oleaf6_2); + } + + (void) puts("\nJU_DELETECOPY_ODD(7):"); + + for (ioffset = 0; ioffset < INDEXES; ++ioffset) + { + INIT2; + PRINTLEAF("Before, src ", ioffset, 7, oleaf7); + PRINTLEAF("Before, dest", ioffset, 7, oleaf7_2); + JU_DELETECOPY_ODD(oleaf7_2, oleaf7, INDEXES, ioffset, 7); + PRINTLEAF("After, src ", ioffset, 7, oleaf7); + PrintLeaf("After, dest", ioffset, 7, oleaf7_2); + } +#endif // JU_64BIT + + return(0); + +} // main() + +#endif // TEST_INSDEL diff --git a/libnetdata/libjudy/src/JudyHS/JudyHS.c b/libnetdata/libjudy/src/JudyHS/JudyHS.c new file mode 100644 index 000000000..21191babc --- /dev/null +++ b/libnetdata/libjudy/src/JudyHS/JudyHS.c @@ -0,0 +1,771 @@ +// @(#) $Revision: 4.1 $ $Source: /judy/src/JudyHS/JudyHS.c +//======================================================================= +// Author Douglas L. Baskins, Dec 2003. +// Permission to use this code is freely granted, provided that this +// statement is retained. +// email - doug@sourcejudy.com -or- dougbaskins@yahoo.com +//======================================================================= + +#include // for memcmp(), memcpy() + +#include // for JudyL* routines/macros + +/* + This routine is a very fast "string" version of an ADT that stores + (JudyHSIns()), retrieves (JudyHSGet()), deletes (JudyHSDel()) and + frees the entire ADT (JudyHSFreeArray()) strings. It uses the "Judy + arrays" JudyL() API as the main workhorse. The length of the string + is included in the calling parameters so that strings with embedded + \0s can be used. The string lengths can be from 0 bytes to whatever + malloc() can handle (~2GB). + + Compile: + + cc -O JudyHS.c -c needs to link with -lJudy (libJudy.a) + + Note: in gcc version 3.3.1, -O2 generates faster code than -O + Note: in gcc version 3.3.2, -O3 generates faster code than -O2 + + NOTES: + +1) There may be some performance issues with 64 bit machines, because I + have not characterized that it yet. + +2) It appears that a modern CPU (>2Ghz) that the instruction times are + much faster that a RAM access, so building up a word from bytes takes + no longer that a whole word access. I am taking advantage of this to + make this code endian neutral. A side effect of this is strings do + not need to be aligned, nor tested to be on to a word boundry. In + older and in slow (RISC) machines, this may be a performance issue. + I have given up trying to optimize for machines that have very slow + mpy, mod, variable shifts and call returns. + +3) JudyHS is very scalable from 1 string to billions (with enough RAM). + The memory usage is also scales with population. I have attempted to + combine the best characteristics of JudyL arrays with Hashing methods + and well designed modern processors (such as the 1.3Ghz Intel + Centrino this is being written on). + + HOW JudyHS WORKS: ( 4[8] means 4 bytes in 32 bit machine and 8 in 64) + + A) A JudyL array is used to separate strings of equal lengths into + their own structures (a different hash table is used for each length + of string). The additional time overhead is very near zero because + of the CPU cache. The space efficiency is improved because the + length need not be stored with the string (ls_t). The "JLHash" ADT + in the test program "StringCompare" is verification of both these + assumptions. + + B) A 32 bit hash value is produced from the string. Many thanks to + the Internet and the author (Bob Jenkins) for coming up with a very + good and fast universal string hash. Next the 32 bit hash number is + used as an Index to another JudyL array. Notice that one (1) JudyL + array is used as a hash table per each string length. If there are + no hash collisions (normally) then the string is copied to a + structure (ls_t) along with room for storing a Value. A flag is + added to the pointer to note it is pointing to a ls_t structure. + Since the lengths of the strings are the same, there is no need to + stored length of string in the ls_t structure. This saves about a + word per string of memory. + + C) When there is a hashing collision (very rare), a JudyL array is + used to decode the next 4[8] bytes of the string. That is, the next + 4[8] bytes of the string are used as the Index. This process is + repeated until the remaining string is unique. The remaining string + (if any) is stored in a (now smaller) ls_t structure. If the + remaining string is less or equal to 4[8] bytes, then the ls_t + structure is not needed and the Value area in the JudyL array is + used. A compile option -DDONOTUSEHASH is available to test this + structure without using hashing (only the JudyL tree is used). This + is equivalent to having all strings hashed to the same bucket. The + speed is still better than all other tree based ADTs I have tested. + An added benefit of this is a very fast "hash collision" resolving. + It could foil hackers that exploit the slow synonym (linked-list) + collision handling property used with most hashing algorithms. If + this is not a necessary property, then a simpler ADT "JLHash" that is + documented the the test program "StringCompare.c" may be used with a + little loss of memory efficiency (because it includes the string + length with the ls_t structure). JudyHS was written to be the + fastest, very scalable, memory efficient, general purpose string ADT + possible. (However, I would like to eat those words someday). (dlb) + +*/ + +#ifdef EXAMPLE_CODE +#include +#include +#include + +#include + +//#include "JudyHS.h" // for Judy.h without JudyHS*() + +// By Doug Baskins Apr 2004 - for JudyHS man page + +#define MAXLINE 1000000 /* max length of line */ +char Index[MAXLINE]; // string to check + +int // Usage: CheckDupLines < file +main() +{ + Pvoid_t PJArray = (PWord_t)NULL; // Judy array. + PWord_t PValue; // ^ Judy array element. + Word_t Bytes; // size of JudyHS array. + Word_t LineNumb = 0; // current line number + Word_t Dups = 0; // number of duplicate lines + + while (fgets(Index, MAXLINE, stdin) != (char *)NULL) + { + LineNumb++; // line number + +// store string into array + JHSI(PValue, PJArray, Index, strlen(Index)); + if (*PValue) // check if duplicate + { + Dups++; // count duplicates + printf("Duplicate lines %lu:%lu:%s", *PValue, LineNumb, Index); + } + else + { + *PValue = LineNumb; // store Line number + } + } + printf("%lu Duplicates, free JudyHS array of %lu Lines\n", + Dups, LineNumb - Dups); + JHSFA(Bytes, PJArray); // free array + printf("The JudyHS array allocated %lu bytes of memory\n", Bytes); + return (0); +} +#endif // EXAMPLE_CODE + +// Note: Use JLAP_INVALID, which is non-zero, to mark pointers to a ls_t +// This makes it compatable with previous versions of JudyL() + +#define IS_PLS(PLS) (((Word_t) (PLS)) & JLAP_INVALID) +#define CLEAR_PLS(PLS) (((Word_t) (PLS)) & (~JLAP_INVALID)) +#define SET_PLS(PLS) (((Word_t) (PLS)) | JLAP_INVALID) + +#define WORDSIZE (sizeof(Word_t)) + +// this is the struct used for "leaf" strings. Note that +// the Value is followed by a "variable" length ls_String array. +// +typedef struct L_EAFSTRING +{ + Word_t ls_Value; // Value area (cannot change size) + uint8_t ls_String[WORDSIZE]; // to fill out to a Word_t size +} ls_t , *Pls_t; + +#define LS_STRUCTOVD (sizeof(ls_t) - WORDSIZE) + +// Calculate size of ls_t including the string of length of LEN. +// +#define LS_WORDLEN(LEN) (((LEN) + LS_STRUCTOVD + WORDSIZE - 1) / WORDSIZE) + +// Copy from 0..4[8] bytes from string to a Word_t +// NOTE: the copy in in little-endian order to take advantage of improved +// memory efficiency of JudyLIns() with smaller numbers +// +#define COPYSTRING4toWORD(WORD,STR,LEN) \ +{ \ + WORD = 0; \ + switch(LEN) \ + { \ + default: /* four and greater */ \ + case 4: \ + WORD += (Word_t)(((uint8_t *)(STR))[3] << 24); \ + case 3: \ + WORD += (Word_t)(((uint8_t *)(STR))[2] << 16); \ + case 2: \ + WORD += (Word_t)(((uint8_t *)(STR))[1] << 8); \ + case 1: \ + WORD += (Word_t)(((uint8_t *)(STR))[0]); \ + case 0: break; \ + } \ +} + +#ifdef JU_64BIT + +// copy from 0..8 bytes from string to Word_t +// +#define COPYSTRING8toWORD(WORD,STR,LEN) \ +{ \ + WORD = 0UL; \ + switch(LEN) \ + { \ + default: /* eight and greater */ \ + case 8: \ + WORD += ((Word_t)((uint8_t *)(STR))[7] << 56); \ + case 7: \ + WORD += ((Word_t)((uint8_t *)(STR))[6] << 48); \ + case 6: \ + WORD += ((Word_t)((uint8_t *)(STR))[5] << 40); \ + case 5: \ + WORD += ((Word_t)((uint8_t *)(STR))[4] << 32); \ + case 4: \ + WORD += ((Word_t)((uint8_t *)(STR))[3] << 24); \ + case 3: \ + WORD += ((Word_t)((uint8_t *)(STR))[2] << 16); \ + case 2: \ + WORD += ((Word_t)((uint8_t *)(STR))[1] << 8); \ + case 1: \ + WORD += ((Word_t)((uint8_t *)(STR))[0]); \ + case 0: break; \ + } \ +} + +#define COPYSTRINGtoWORD COPYSTRING8toWORD + +#else // JU_32BIT + +#define COPYSTRINGtoWORD COPYSTRING4toWORD + +#endif // JU_32BIT + +// set JError_t locally + +#define JU_SET_ERRNO(PJERROR, JERRNO) \ +{ \ + if (PJERROR != (PJError_t) NULL) \ + { \ + if (JERRNO) \ + JU_ERRNO(PJError) = (JERRNO); \ + JU_ERRID(PJERROR) = __LINE__; \ + } \ +} + +//======================================================================= +// This routine must hash string to 24..32 bits. The "goodness" of +// the hash is not as important as its speed. +//======================================================================= + +// hash to no more than 32 bits + +// extern Word_t gHmask; for hash bits experiments + +#define JUDYHASHSTR(HVALUE,STRING,LENGTH) \ +{ \ + uint8_t *p_ = (uint8_t *)(STRING); \ + uint8_t *q_ = p_ + (LENGTH); \ + uint32_t c_ = 0; \ + for (; p_ != q_; ++p_) \ + { \ + c_ = (c_ * 31) + *p_; \ + } \ +/* c_ &= gHmask; see above */ \ + (HVALUE) = c_; \ +} + +// Find String of Len in JudyHS structure, return pointer to associated Value + +PPvoid_t +JudyHSGet(Pcvoid_t PArray, // pointer (^) to structure + void * Str, // pointer to string + Word_t Len // length of string + ) +{ + uint8_t *String = (uint8_t *)Str; + PPvoid_t PPValue; // pointer to Value + Word_t Index; // 4[8] bytes of String + + JLG(PPValue, PArray, Len); // find hash table for strings of Len + if (PPValue == (PPvoid_t) NULL) + return ((PPvoid_t) NULL); // no strings of this Len + +// check for caller error (null pointer) +// + if ((String == (void *) NULL) && (Len != 0)) + return ((PPvoid_t) NULL); // avoid null-pointer dereference + +#ifndef DONOTUSEHASH + if (Len > WORDSIZE) // Hash table not necessary with short + { + uint32_t HValue; // hash of input string + JUDYHASHSTR(HValue, String, Len); // hash to no more than 32 bits + JLG(PPValue, *PPValue, (Word_t)HValue); // get ^ to hash bucket + if (PPValue == (PPvoid_t) NULL) + return ((PPvoid_t) NULL); // no entry in Hash table + } +#endif // DONOTUSEHASH + +/* + Each JudyL array decodes 4[8] bytes of the string. Since the hash + collisions occur very infrequently, the performance is not important. + However, even if the Hash code is not used this method still is + significantly faster than common tree methods (AVL, Red-Black, Splay, + b-tree, etc..). You can compare it yourself with #define DONOTUSEHASH + 1 or putting -DDONOTUSEHASH in the cc line. Use the "StringCompare.c" + code to compare (9Dec2003 dlb). +*/ + while (Len > WORDSIZE) // traverse tree of JudyL arrays + { + if (IS_PLS(*PPValue)) // ^ to JudyL array or ls_t struct? + { + Pls_t Pls; // ls_t struct, termination of tree + Pls = (Pls_t) CLEAR_PLS(*PPValue); // remove flag from ^ + +// if remaining string matches, return ^ to Value, else NULL + + if (memcmp(String, Pls->ls_String, Len) == 0) + return ((PPvoid_t) (&(Pls->ls_Value))); + else + return ((PPvoid_t) NULL); // string does not match + } + else + { + COPYSTRINGtoWORD(Index, String, WORDSIZE); + + JLG(PPValue, *PPValue, Index); // decode next 4[8] bytes + if (PPValue == (PPvoid_t) NULL) // if NULL array, bail out + return ((PPvoid_t) NULL); // string does not match + + String += WORDSIZE; // advance + Len -= WORDSIZE; + } + } + +// Get remaining 1..4[8] bytes left in string + + COPYSTRINGtoWORD(Index, String, Len); + JLG(PPValue, *PPValue, Index); // decode last 1-4[8] bytes + return (PPValue); +} + +// Add string to a tree of JudyL arrays (all lengths must be same) + +static PPvoid_t +insStrJudyLTree(uint8_t * String, // string to add to tree of JudyL arrays + Word_t Len, // length of string + PPvoid_t PPValue, // pointer to root pointer + PJError_t PJError // for returning error info + ) +{ + Word_t Index; // next 4[8] bytes of String + + while (Len > WORDSIZE) // add to JudyL tree + { +// CASE 1, pointer is to a NULL, make a new ls_t leaf + + if (*PPValue == (Pvoid_t)NULL) + { + Pls_t Pls; // memory for a ls_t + Pls = (Pls_t) JudyMalloc(LS_WORDLEN(Len)); + if (Pls == NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NOMEM); + return (PPJERR); + } + Pls->ls_Value = 0; // clear Value word + memcpy(Pls->ls_String, String, Len); // copy to new struct + *PPValue = (Pvoid_t)SET_PLS(Pls); // mark pointer + return ((PPvoid_t) (&Pls->ls_Value)); // return ^ to Value + } // no exit here +// CASE 2: is a ls_t, free (and shorten), then decode into JudyL tree + + if (IS_PLS(*PPValue)) // pointer to a ls_t? (leaf) + { + Pls_t Pls; // ^ to ls_t + uint8_t *String0; // ^ to string in ls_t + Word_t Index0; // 4[8] bytes in string + Word_t FreeLen; // length of ls_t + PPvoid_t PPsplit; + + FreeLen = LS_WORDLEN(Len); // length of ls_t + + Pls = (Pls_t) CLEAR_PLS(*PPValue); // demangle ^ to ls_t + String0 = Pls->ls_String; + if (memcmp(String, String0, Len) == 0) // check if match? + { + return ((PPvoid_t) (&Pls->ls_Value)); // yes, duplicate + } + + *PPValue = NULL; // clear ^ to ls_t and make JudyL + +// This do loop is technically not required, saves multiple JudyFree() +// when storing already sorted strings into structure + + do // decode next 4[8] bytes of string + { // with a JudyL array +// Note: string0 is always aligned + + COPYSTRINGtoWORD(Index0, String0, WORDSIZE); + String0 += WORDSIZE; + COPYSTRINGtoWORD(Index, String, WORDSIZE); + String += WORDSIZE; + Len -= WORDSIZE; + PPsplit = PPValue; // save for split below + PPValue = JudyLIns(PPValue, Index0, PJError); + if (PPValue == PPJERR) + { + JU_SET_ERRNO(PJError, 0); + return (PPJERR); + } + + } while ((Index0 == Index) && (Len > WORDSIZE)); + +// finish storing remainder of string that was in the ls_t + + PPValue = insStrJudyLTree(String0, Len, PPValue, PJError); + if (PPValue == PPJERR) + { + return (PPJERR); + } +// copy old Value to Value in new struct + + *(PWord_t)PPValue = Pls->ls_Value; + +// free the string buffer (ls_t) + + JudyFree((Pvoid_t)Pls, FreeLen); + PPValue = JudyLIns(PPsplit, Index, PJError); + if (PPValue == PPJERR) + { + JU_SET_ERRNO(PJError, 0); + return (PPValue); + } + +// finish remainder of newly inserted string + + PPValue = insStrJudyLTree(String, Len, PPValue, PJError); + return (PPValue); + } // no exit here +// CASE 3, more JudyL arrays, decode to next tree + + COPYSTRINGtoWORD(Index, String, WORDSIZE); + Len -= WORDSIZE; + String += WORDSIZE; + + PPValue = JudyLIns(PPValue, Index, PJError); // next 4[8] bytes + if (PPValue == PPJERR) + { + JU_SET_ERRNO(PJError, 0); + return (PPValue); + } + } +// this is done outside of loop so "Len" can be an unsigned number + + COPYSTRINGtoWORD(Index, String, Len); + PPValue = JudyLIns(PPValue, Index, PJError); // remaining 4[8] bytes + + return (PPValue); +} + + +// Insert string to JudyHS structure, return pointer to associated Value + +PPvoid_t +JudyHSIns(PPvoid_t PPArray, // ^ to JudyHashArray name + void * Str, // pointer to string + Word_t Len, // length of string + PJError_t PJError // optional, for returning error info + ) +{ + uint8_t * String = (uint8_t *)Str; + PPvoid_t PPValue; + +// string can only be NULL if Len is 0. + + if ((String == (uint8_t *) NULL) && (Len != 0UL)) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + return (PPJERR); + } + JLG(PPValue, *PPArray, Len); // JudyL hash table for strings of Len + if (PPValue == (PPvoid_t) NULL) // make new if missing, (very rare) + { + PPValue = JudyLIns(PPArray, Len, PJError); + if (PPValue == PPJERR) + { + JU_SET_ERRNO(PJError, 0); + return (PPJERR); + } + } +#ifndef DONOTUSEHASH + if (Len > WORDSIZE) + { + uint32_t HValue; // hash of input string + JUDYHASHSTR(HValue, String, Len); // hash to no more than 32 bits + PPValue = JudyLIns(PPValue, (Word_t)HValue, PJError); + if (PPValue == PPJERR) + { + JU_SET_ERRNO(PJError, 0); + return (PPJERR); + } + } +#endif // DONOTUSEHASH + + PPValue = insStrJudyLTree(String, Len, PPValue, PJError); // add string + return (PPValue); // ^ to Value +} + +// Delete string from tree of JudyL arrays (all Lens must be same) + +static int +delStrJudyLTree(uint8_t * String, // delete from tree of JudyL arrays + Word_t Len, // length of string + PPvoid_t PPValue, // ^ to hash bucket + PJError_t PJError // for returning error info + ) +{ + PPvoid_t PPValueN; // next pointer + Word_t Index; + int Ret; // -1=failed, 1=success, 2=quit del + + if (IS_PLS(*PPValue)) // is pointer to ls_t? + { + Pls_t Pls; + Pls = (Pls_t) CLEAR_PLS(*PPValue); // demangle pointer + JudyFree((Pvoid_t)Pls, LS_WORDLEN(Len)); // free the ls_t + + *PPValue = (Pvoid_t)NULL; // clean pointer + return (1); // successfully deleted + } + + if (Len > WORDSIZE) // delete from JudyL tree, not leaf + { + COPYSTRINGtoWORD(Index, String, WORDSIZE); // get Index + JLG(PPValueN, *PPValue, Index); // get pointer to next JudyL array + + String += WORDSIZE; // advance to next 4[8] bytes + Len -= WORDSIZE; + + Ret = delStrJudyLTree(String, Len, PPValueN, PJError); + if (Ret != 1) return(Ret); + + if (*PPValueN == (PPvoid_t) NULL) + { +// delete JudyL element from tree + + Ret = JudyLDel(PPValue, Index, PJError); + } + } + else + { + COPYSTRINGtoWORD(Index, String, Len); // get leaf element + +// delete last 1-4[8] bytes from leaf element + + Ret = JudyLDel(PPValue, Index, PJError); + } + return (Ret); +} + +// Delete string from JHS structure + +int +JudyHSDel(PPvoid_t PPArray, // ^ to JudyHashArray struct + void * Str, // pointer to string + Word_t Len, // length of string + PJError_t PJError // optional, for returning error info + ) +{ + uint8_t * String = (uint8_t *)Str; + PPvoid_t PPBucket, PPHtble; + int Ret; // return bool from Delete routine +#ifndef DONOTUSEHASH + uint32_t HValue = 0; // hash value of input string +#endif // DONOTUSEHASH + + if (PPArray == NULL) + return (0); // no pointer, return not found + +// This is a little slower than optimum method, but not much in new CPU +// Verify that string is in the structure -- simplifies future assumptions + + if (JudyHSGet(*PPArray, String, Len) == (PPvoid_t) NULL) + return (0); // string not found, return + +// string is in structure, so testing for absence is not necessary + + JLG(PPHtble, *PPArray, Len); // JudyL hash table for strings of Len + +#ifdef DONOTUSEHASH + PPBucket = PPHtble; // simulate below code +#else // USEHASH + if (Len > WORDSIZE) + { + JUDYHASHSTR(HValue, String, Len); // hash to no more than 32 bits + +// get pointer to hash bucket + + JLG(PPBucket, *PPHtble, (Word_t)HValue); + } + else + { + PPBucket = PPHtble; // no bucket to JLGet + } +#endif // USEHASH + +// delete from JudyL tree +// + Ret = delStrJudyLTree(String, Len, PPBucket, PJError); + if (Ret != 1) + { + JU_SET_ERRNO(PJError, 0); + return(-1); + } +// handle case of missing JudyL array from hash table and length table + + if (*PPBucket == (Pvoid_t)NULL) // if JudyL tree gone + { +#ifndef DONOTUSEHASH + if (Len > WORDSIZE) + { +// delete entry in Hash table + + Ret = JudyLDel(PPHtble, (Word_t)HValue, PJError); + if (Ret != 1) + { + JU_SET_ERRNO(PJError, 0); + return(-1); + } + } +#endif // USEHASH + if (*PPHtble == (PPvoid_t) NULL) // if Hash table gone + { +// delete entry from the String length table + + Ret = JudyLDel(PPArray, Len, PJError); + if (Ret != 1) + { + JU_SET_ERRNO(PJError, 0); + return(-1); + } + } + } + return (1); // success +} + +static Word_t +delJudyLTree(PPvoid_t PPValue, // ^ to JudyL root pointer + Word_t Len, // length of string + PJError_t PJError) // for returning error info +{ + Word_t bytes_freed = 0; // bytes freed at point + Word_t bytes_total = 0; // accumulated bytes freed + PPvoid_t PPValueN; + +// Pointer is to another tree of JudyL arrays or ls_t struct + + if (Len > WORDSIZE) // more depth to tree + { + Word_t NEntry; + +// Pointer is to a ls_t struct + + if (IS_PLS(*PPValue)) + { + Pls_t Pls; + Word_t freewords; + + freewords = LS_WORDLEN(Len); // calculate length + Pls = (Pls_t)CLEAR_PLS(*PPValue); // demangle pointer + +// *PPValue = (Pvoid_t)NULL; // clean pointer + JudyFree((Pvoid_t)Pls, freewords); // free the ls_t + + return(freewords * WORDSIZE); + } +// else +// Walk all the entrys in the JudyL array + + NEntry = 0; // start at beginning + for (PPValueN = JudyLFirst(*PPValue, &NEntry, PJError); + (PPValueN != (PPvoid_t) NULL) && (PPValueN != PPJERR); + PPValueN = JudyLNext(*PPValue, &NEntry, PJError)) + { +// recurse to the next level in the tree of arrays + + bytes_freed = delJudyLTree(PPValueN, Len - WORDSIZE, PJError); + if (bytes_freed == JERR) return(JERR); + bytes_total += bytes_freed; + } + if (PPValueN == PPJERR) return(JERR); + +// now free this JudyL array + + bytes_freed = JudyLFreeArray(PPValue, PJError); + if (bytes_freed == JERR) return(JERR); + bytes_total += bytes_freed; + + return(bytes_total); // return amount freed + } +// else + +// Pointer to simple JudyL array + + bytes_freed = JudyLFreeArray(PPValue, PJError); + + return(bytes_freed); +} + + +Word_t // bytes freed +JudyHSFreeArray(PPvoid_t PPArray, // ^ to JudyHashArray struct + PJError_t PJError // optional, for returning error info + ) +{ + Word_t Len; // start at beginning + Word_t bytes_freed; // bytes freed at this level. + Word_t bytes_total; // bytes total at all levels. + PPvoid_t PPHtble; + + if (PPArray == NULL) + return (0); // no pointer, return none + +// Walk the string length table for subsidary hash structs +// NOTE: This is necessary to determine the depth of the tree + + bytes_freed = 0; + bytes_total = 0; + Len = 0; // walk to length table + + for (PPHtble = JudyLFirst(*PPArray, &Len, PJError); + (PPHtble != (PPvoid_t) NULL) && (PPHtble != PPJERR); + PPHtble = JudyLNext(*PPArray, &Len, PJError)) + { + PPvoid_t PPValueH; + +#ifndef DONOTUSEHASH + if (Len > WORDSIZE) + { + Word_t HEntry = 0; // walk the hash tables + + for (PPValueH = JudyLFirst(*PPHtble, &HEntry, PJError); + (PPValueH != (PPvoid_t) NULL) && (PPValueH != PPJERR); + PPValueH = JudyLNext(*PPHtble, &HEntry, PJError)) + { + bytes_freed = delJudyLTree(PPValueH, Len, PJError); + if (bytes_freed == JERR) return(JERR); + bytes_total += bytes_freed; + } + + if (PPValueH == PPJERR) return(JERR); + +// free the Hash table for this length of string + + bytes_freed = JudyLFreeArray(PPHtble, PJError); + if (bytes_freed == JERR) return(JERR); + bytes_total += bytes_freed; + } + else +#endif // DONOTUSEHASH + { + PPValueH = PPHtble; // simulate hash table + + bytes_freed = delJudyLTree(PPValueH, Len, PJError); + if (bytes_freed == JERR) return(JERR); + bytes_total += bytes_freed; + } + } + if (PPHtble == PPJERR) return(JERR); + +// free the length table + + bytes_freed = JudyLFreeArray(PPArray, PJError); + if (bytes_freed == JERR) return(JERR); + + bytes_total += bytes_freed; + + return(bytes_total); // return bytes freed +} diff --git a/libnetdata/libjudy/src/JudyL/JudyL.h b/libnetdata/libjudy/src/JudyL/JudyL.h new file mode 100644 index 000000000..d901969d6 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyL.h @@ -0,0 +1,505 @@ +#ifndef _JUDYL_INCLUDED +#define _JUDYL_INCLUDED +// _________________ +// +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.41 $ $Source: /judy/src/JudyL/JudyL.h $ + +// **************************************************************************** +// JUDYL -- SMALL/LARGE AND/OR CLUSTERED/SPARSE ARRAYS +// +// -by- +// +// Douglas L. Baskins +// doug@sourcejudy.com +// +// Judy arrays are designed to be used instead of arrays. The performance +// suggests the reason why Judy arrays are thought of as arrays, instead of +// trees. They are remarkably memory efficient at all populations. +// Implemented as a hybrid digital tree (but really a state machine, see +// below), Judy arrays feature fast insert/retrievals, fast near neighbor +// searching, and contain a population tree for extremely fast ordinal related +// retrievals. +// +// CONVENTIONS: +// +// - The comments here refer to 32-bit [64-bit] systems. +// +// - BranchL, LeafL refer to linear branches and leaves (small populations), +// except LeafL does not actually appear as such; rather, Leaf1..3 [Leaf1..7] +// is used to represent leaf Index sizes, and LeafW refers to a Leaf with +// full (Long) word Indexes, which is also a type of linear leaf. Note that +// root-level LeafW (Leaf4 [Leaf8]) leaves are called LEAFW. +// +// - BranchB, LeafB1 refer to bitmap branches and leaves (intermediate +// populations). +// +// - BranchU refers to uncompressed branches. An uncompressed branch has 256 +// JPs, some of which could be null. Note: All leaves are compressed (and +// sorted), or else an expanse is full (FullPopu), so there is no LeafU +// equivalent to BranchU. +// +// - "Popu" is short for "Population". +// - "Pop1" refers to actual population (base 1). +// - "Pop0" refers to Pop1 - 1 (base 0), the way populations are stored in data +// structures. +// +// - Branches and Leaves are both named by the number of bytes in their Pop0 +// field. In the case of Leaves, the same number applies to the Index sizes. +// +// - The representation of many numbers as hex is a relatively safe and +// portable way to get desired bitpatterns as unsigned longs. +// +// - Some preprocessors cant handle single apostrophe characters within +// #ifndef code, so here, delete all instead. + + +#include "JudyPrivate.h" // includes Judy.h in turn. +#include "JudyPrivateBranch.h" // support for branches. + + +// **************************************************************************** +// JUDYL ROOT POINTER (JRP) AND JUDYL POINTER (JP) TYPE FIELDS +// **************************************************************************** + +typedef enum // uint8_t -- but C does not support this type of enum. +{ + +// JP NULL TYPES: +// +// There is a series of cJL_JPNULL* Types because each one pre-records a +// different Index Size for when the first Index is inserted in the previously +// null JP. They must start >= 8 (three bits). +// +// Note: These Types must be in sequential order for doing relative +// calculations between them. + + cJL_JPNULL1 = 1, + // Index Size 1[1] byte when 1 Index inserted. + cJL_JPNULL2, // Index Size 2[2] bytes when 1 Index inserted. + cJL_JPNULL3, // Index Size 3[3] bytes when 1 Index inserted. + +#ifndef JU_64BIT +#define cJL_JPNULLMAX cJL_JPNULL3 +#else + cJL_JPNULL4, // Index Size 4[4] bytes when 1 Index inserted. + cJL_JPNULL5, // Index Size 5[5] bytes when 1 Index inserted. + cJL_JPNULL6, // Index Size 6[6] bytes when 1 Index inserted. + cJL_JPNULL7, // Index Size 7[7] bytes when 1 Index inserted. +#define cJL_JPNULLMAX cJL_JPNULL7 +#endif + + +// JP BRANCH TYPES: +// +// Note: There are no state-1 branches; only leaves reside at state 1. + +// Linear branches: +// +// Note: These Types must be in sequential order for doing relative +// calculations between them. + + cJL_JPBRANCH_L2, // 2[2] bytes Pop0, 1[5] bytes Dcd. + cJL_JPBRANCH_L3, // 3[3] bytes Pop0, 0[4] bytes Dcd. + +#ifdef JU_64BIT + cJL_JPBRANCH_L4, // [4] bytes Pop0, [3] bytes Dcd. + cJL_JPBRANCH_L5, // [5] bytes Pop0, [2] bytes Dcd. + cJL_JPBRANCH_L6, // [6] bytes Pop0, [1] byte Dcd. + cJL_JPBRANCH_L7, // [7] bytes Pop0, [0] bytes Dcd. +#endif + + cJL_JPBRANCH_L, // note: DcdPopO field not used. + +// Bitmap branches: +// +// Note: These Types must be in sequential order for doing relative +// calculations between them. + + cJL_JPBRANCH_B2, // 2[2] bytes Pop0, 1[5] bytes Dcd. + cJL_JPBRANCH_B3, // 3[3] bytes Pop0, 0[4] bytes Dcd. + +#ifdef JU_64BIT + cJL_JPBRANCH_B4, // [4] bytes Pop0, [3] bytes Dcd. + cJL_JPBRANCH_B5, // [5] bytes Pop0, [2] bytes Dcd. + cJL_JPBRANCH_B6, // [6] bytes Pop0, [1] byte Dcd. + cJL_JPBRANCH_B7, // [7] bytes Pop0, [0] bytes Dcd. +#endif + + cJL_JPBRANCH_B, // note: DcdPopO field not used. + +// Uncompressed branches: +// +// Note: These Types must be in sequential order for doing relative +// calculations between them. + + cJL_JPBRANCH_U2, // 2[2] bytes Pop0, 1[5] bytes Dcd. + cJL_JPBRANCH_U3, // 3[3] bytes Pop0, 0[4] bytes Dcd. + +#ifdef JU_64BIT + cJL_JPBRANCH_U4, // [4] bytes Pop0, [3] bytes Dcd. + cJL_JPBRANCH_U5, // [5] bytes Pop0, [2] bytes Dcd. + cJL_JPBRANCH_U6, // [6] bytes Pop0, [1] byte Dcd. + cJL_JPBRANCH_U7, // [7] bytes Pop0, [0] bytes Dcd. +#endif + + cJL_JPBRANCH_U, // note: DcdPopO field not used. + + +// JP LEAF TYPES: + +// Linear leaves: +// +// Note: These Types must be in sequential order for doing relative +// calculations between them. +// +// Note: There is no full-word (4-byte [8-byte]) Index leaf under a JP because +// non-root-state leaves only occur under branches that decode at least one +// byte. Full-word, root-state leaves are under a JRP, not a JP. However, in +// the code a "fake" JP can be created temporarily above a root-state leaf. + + cJL_JPLEAF1, // 1[1] byte Pop0, 2 bytes Dcd. + cJL_JPLEAF2, // 2[2] bytes Pop0, 1[5] bytes Dcd. + cJL_JPLEAF3, // 3[3] bytes Pop0, 0[4] bytes Dcd. + +#ifdef JU_64BIT + cJL_JPLEAF4, // [4] bytes Pop0, [3] bytes Dcd. + cJL_JPLEAF5, // [5] bytes Pop0, [2] bytes Dcd. + cJL_JPLEAF6, // [6] bytes Pop0, [1] byte Dcd. + cJL_JPLEAF7, // [7] bytes Pop0, [0] bytes Dcd. +#endif + +// Bitmap leaf; Index Size == 1: +// +// Note: These are currently only supported at state 1. At other states the +// bitmap would grow from 256 to 256^2, 256^3, ... bits, which would not be +// efficient.. + + cJL_JPLEAF_B1, // 1[1] byte Pop0, 2[6] bytes Dcd. + +// Full population; Index Size == 1 virtual leaf: +// +// Note: JudyL has no cJL_JPFULLPOPU1 equivalent to cJ1_JPFULLPOPU1, because +// in the JudyL case this could result in a values-only leaf of up to 256 words +// (value areas) that would be slow to insert/delete. + + +// JP IMMEDIATES; leaves (Indexes) stored inside a JP: +// +// The second numeric suffix is the Pop1 for each type. As the Index Size +// increases, the maximum possible population decreases. +// +// Note: These Types must be in sequential order in each group (Index Size), +// and the groups in correct order too, for doing relative calculations between +// them. For example, since these Types enumerate the Pop1 values (unlike +// other JP Types where there is a Pop0 value in the JP), the maximum Pop1 for +// each Index Size is computable. +// +// All enums equal or above this point are cJL_JPIMMEDs. + + cJL_JPIMMED_1_01, // Index Size = 1, Pop1 = 1. + cJL_JPIMMED_2_01, // Index Size = 2, Pop1 = 1. + cJL_JPIMMED_3_01, // Index Size = 3, Pop1 = 1. + +#ifdef JU_64BIT + cJL_JPIMMED_4_01, // Index Size = 4, Pop1 = 1. + cJL_JPIMMED_5_01, // Index Size = 5, Pop1 = 1. + cJL_JPIMMED_6_01, // Index Size = 6, Pop1 = 1. + cJL_JPIMMED_7_01, // Index Size = 7, Pop1 = 1. +#endif + + cJL_JPIMMED_1_02, // Index Size = 1, Pop1 = 2. + cJL_JPIMMED_1_03, // Index Size = 1, Pop1 = 3. + +#ifdef JU_64BIT + cJL_JPIMMED_1_04, // Index Size = 1, Pop1 = 4. + cJL_JPIMMED_1_05, // Index Size = 1, Pop1 = 5. + cJL_JPIMMED_1_06, // Index Size = 1, Pop1 = 6. + cJL_JPIMMED_1_07, // Index Size = 1, Pop1 = 7. + + cJL_JPIMMED_2_02, // Index Size = 2, Pop1 = 2. + cJL_JPIMMED_2_03, // Index Size = 2, Pop1 = 3. + + cJL_JPIMMED_3_02, // Index Size = 3, Pop1 = 2. +#endif + +// This special Type is merely a sentinel for doing relative calculations. +// This value should not be used in switch statements (to avoid allocating code +// for it), which is also why it appears at the end of the enum list. + + cJL_JPIMMED_CAP + +} jpL_Type_t; + + +// RELATED VALUES: + +// Index Size (state) for leaf JP, and JP type based on Index Size (state): + +#define JL_LEAFINDEXSIZE(jpType) ((jpType) - cJL_JPLEAF1 + 1) +#define JL_LEAFTYPE(IndexSize) ((IndexSize) + cJL_JPLEAF1 - 1) + + +// MAXIMUM POPULATIONS OF LINEAR LEAVES: + +#ifndef JU_64BIT // 32-bit + +#define J_L_MAXB (sizeof(Word_t) * 64) +#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words. +#define cJL_LEAF1_MAXWORDS (32) // max Leaf1 size in words. + +// Note: cJL_LEAF1_MAXPOP1 is chosen such that the index portion is less than +// 32 bytes -- the number of bytes the index takes in a bitmap leaf. + +#define cJL_LEAF1_MAXPOP1 \ + ((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD)) +#define cJL_LEAF2_MAXPOP1 (J_L_MAXB / (2 + cJU_BYTESPERWORD)) +#define cJL_LEAF3_MAXPOP1 (J_L_MAXB / (3 + cJU_BYTESPERWORD)) +#define cJL_LEAFW_MAXPOP1 \ + ((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD)) + +#else // 64-bit + +#define J_L_MAXB (sizeof(Word_t) * 64) +#define ALLOCSIZES { 3, 5, 7, 11, 15, 23, 32, 47, 64, TERMINATOR } // in words. +#define cJL_LEAF1_MAXWORDS (15) // max Leaf1 size in words. + +#define cJL_LEAF1_MAXPOP1 \ + ((cJL_LEAF1_MAXWORDS * cJU_BYTESPERWORD)/(1 + cJU_BYTESPERWORD)) +#define cJL_LEAF2_MAXPOP1 (J_L_MAXB / (2 + cJU_BYTESPERWORD)) +#define cJL_LEAF3_MAXPOP1 (J_L_MAXB / (3 + cJU_BYTESPERWORD)) +#define cJL_LEAF4_MAXPOP1 (J_L_MAXB / (4 + cJU_BYTESPERWORD)) +#define cJL_LEAF5_MAXPOP1 (J_L_MAXB / (5 + cJU_BYTESPERWORD)) +#define cJL_LEAF6_MAXPOP1 (J_L_MAXB / (6 + cJU_BYTESPERWORD)) +#define cJL_LEAF7_MAXPOP1 (J_L_MAXB / (7 + cJU_BYTESPERWORD)) +#define cJL_LEAFW_MAXPOP1 \ + ((J_L_MAXB - cJU_BYTESPERWORD) / (2 * cJU_BYTESPERWORD)) + +#endif // 64-bit + + +// MAXIMUM POPULATIONS OF IMMEDIATE JPs: +// +// These specify the maximum Population of immediate JPs with various Index +// Sizes (== sizes of remaining undecoded Index bits). Since the JP Types enum +// already lists all the immediates in order by state and size, calculate these +// values from it to avoid redundancy. + +#define cJL_IMMED1_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 1) // 3 [7]. +#define cJL_IMMED2_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 2) // 1 [3]. +#define cJL_IMMED3_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 3) // 1 [2]. + +#ifdef JU_64BIT +#define cJL_IMMED4_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 4) // [1]. +#define cJL_IMMED5_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 5) // [1]. +#define cJL_IMMED6_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 6) // [1]. +#define cJL_IMMED7_MAXPOP1 ((cJU_BYTESPERWORD - 1) / 7) // [1]. +#endif + + +// **************************************************************************** +// JUDYL LEAF BITMAP (JLLB) SUPPORT +// **************************************************************************** +// +// Assemble bitmap leaves out of smaller units that put bitmap subexpanses +// close to their associated pointers. Why not just use a bitmap followed by a +// series of pointers? (See 4.27.) Turns out this wastes a cache fill on +// systems with smaller cache lines than the assumed value cJU_WORDSPERCL. + +#define JL_JLB_BITMAP(Pjlb, Subexp) ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_Bitmap) +#define JL_JLB_PVALUE(Pjlb, Subexp) ((Pjlb)->jLlb_jLlbs[Subexp].jLlbs_PValue) + +typedef struct J__UDYL_LEAF_BITMAP_SUBEXPANSE +{ + BITMAPL_t jLlbs_Bitmap; + Pjv_t jLlbs_PValue; + +} jLlbs_t; + +typedef struct J__UDYL_LEAF_BITMAP +{ + jLlbs_t jLlb_jLlbs[cJU_NUMSUBEXPL]; + +} jLlb_t, * PjLlb_t; + +// Words per bitmap leaf: + +#define cJL_WORDSPERLEAFB1 (sizeof(jLlb_t) / cJU_BYTESPERWORD) + + +// **************************************************************************** +// MEMORY ALLOCATION SUPPORT +// **************************************************************************** + +// ARRAY-GLOBAL INFORMATION: +// +// At the cost of an occasional additional cache fill, this object, which is +// pointed at by a JRP and in turn points to a JP_BRANCH*, carries array-global +// information about a JudyL array that has sufficient population to amortize +// the cost. The jpm_Pop0 field prevents having to add up the total population +// for the array in insert, delete, and count code. The jpm_JP field prevents +// having to build a fake JP for entry to a state machine; however, the +// jp_DcdPopO field in jpm_JP, being one byte too small, is not used. +// +// Note: Struct fields are ordered to keep "hot" data in the first 8 words +// (see left-margin comments) for machines with 8-word cache lines, and to keep +// sub-word fields together for efficient packing. + +typedef struct J_UDYL_POPULATION_AND_MEMORY +{ +/* 1 */ Word_t jpm_Pop0; // total population-1 in array. +/* 2 */ jp_t jpm_JP; // JP to first branch; see above. +/* 4 */ Word_t jpm_LastUPop0; // last jpm_Pop0 when convert to BranchU +/* 7 */ Pjv_t jpm_PValue; // pointer to value to return. +// Note: Field names match PJError_t for convenience in macros: +/* 8 */ char je_Errno; // one of the enums in Judy.h. +/* 8/9 */ int je_ErrID; // often an internal source line number. +/* 9/10 */ Word_t jpm_TotalMemWords; // words allocated in array. +} jLpm_t, *PjLpm_t; + + +// TABLES FOR DETERMINING IF LEAVES HAVE ROOM TO GROW: +// +// These tables indicate if a given memory chunk can support growth of a given +// object into wasted (rounded-up) memory in the chunk. Note: This violates +// the hiddenness of the JudyMalloc code. + +extern const uint8_t j__L_Leaf1PopToWords[cJL_LEAF1_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf2PopToWords[cJL_LEAF2_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf3PopToWords[cJL_LEAF3_MAXPOP1 + 1]; +#ifdef JU_64BIT +extern const uint8_t j__L_Leaf4PopToWords[cJL_LEAF4_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf5PopToWords[cJL_LEAF5_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf6PopToWords[cJL_LEAF6_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf7PopToWords[cJL_LEAF7_MAXPOP1 + 1]; +#endif +extern const uint8_t j__L_LeafWPopToWords[cJL_LEAFW_MAXPOP1 + 1]; +extern const uint8_t j__L_LeafVPopToWords[]; + +// These tables indicate where value areas start: + +extern const uint8_t j__L_Leaf1Offset [cJL_LEAF1_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf2Offset [cJL_LEAF2_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf3Offset [cJL_LEAF3_MAXPOP1 + 1]; +#ifdef JU_64BIT +extern const uint8_t j__L_Leaf4Offset [cJL_LEAF4_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf5Offset [cJL_LEAF5_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf6Offset [cJL_LEAF6_MAXPOP1 + 1]; +extern const uint8_t j__L_Leaf7Offset [cJL_LEAF7_MAXPOP1 + 1]; +#endif +extern const uint8_t j__L_LeafWOffset [cJL_LEAFW_MAXPOP1 + 1]; + +// Also define macros to hide the details in the code using these tables. + +#define JL_LEAF1GROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAF1_MAXPOP1, j__L_Leaf1PopToWords) +#define JL_LEAF2GROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAF2_MAXPOP1, j__L_Leaf2PopToWords) +#define JL_LEAF3GROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAF3_MAXPOP1, j__L_Leaf3PopToWords) +#ifdef JU_64BIT +#define JL_LEAF4GROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAF4_MAXPOP1, j__L_Leaf4PopToWords) +#define JL_LEAF5GROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAF5_MAXPOP1, j__L_Leaf5PopToWords) +#define JL_LEAF6GROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAF6_MAXPOP1, j__L_Leaf6PopToWords) +#define JL_LEAF7GROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAF7_MAXPOP1, j__L_Leaf7PopToWords) +#endif +#define JL_LEAFWGROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJL_LEAFW_MAXPOP1, j__L_LeafWPopToWords) +#define JL_LEAFVGROWINPLACE(Pop1) \ + J__U_GROWCK(Pop1, cJU_BITSPERSUBEXPL, j__L_LeafVPopToWords) + +#define JL_LEAF1VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf1Offset[Pop1]) +#define JL_LEAF2VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf2Offset[Pop1]) +#define JL_LEAF3VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf3Offset[Pop1]) +#ifdef JU_64BIT +#define JL_LEAF4VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf4Offset[Pop1]) +#define JL_LEAF5VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf5Offset[Pop1]) +#define JL_LEAF6VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf6Offset[Pop1]) +#define JL_LEAF7VALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_Leaf7Offset[Pop1]) +#endif +#define JL_LEAFWVALUEAREA(Pjv,Pop1) (((PWord_t)(Pjv)) + j__L_LeafWOffset[Pop1]) + +#define JL_LEAF1POPTOWORDS(Pop1) (j__L_Leaf1PopToWords[Pop1]) +#define JL_LEAF2POPTOWORDS(Pop1) (j__L_Leaf2PopToWords[Pop1]) +#define JL_LEAF3POPTOWORDS(Pop1) (j__L_Leaf3PopToWords[Pop1]) +#ifdef JU_64BIT +#define JL_LEAF4POPTOWORDS(Pop1) (j__L_Leaf4PopToWords[Pop1]) +#define JL_LEAF5POPTOWORDS(Pop1) (j__L_Leaf5PopToWords[Pop1]) +#define JL_LEAF6POPTOWORDS(Pop1) (j__L_Leaf6PopToWords[Pop1]) +#define JL_LEAF7POPTOWORDS(Pop1) (j__L_Leaf7PopToWords[Pop1]) +#endif +#define JL_LEAFWPOPTOWORDS(Pop1) (j__L_LeafWPopToWords[Pop1]) +#define JL_LEAFVPOPTOWORDS(Pop1) (j__L_LeafVPopToWords[Pop1]) + + +// FUNCTIONS TO ALLOCATE OBJECTS: + +PjLpm_t j__udyLAllocJLPM(void); // constant size. + +Pjbl_t j__udyLAllocJBL( PjLpm_t); // constant size. +Pjbb_t j__udyLAllocJBB( PjLpm_t); // constant size. +Pjp_t j__udyLAllocJBBJP(Word_t, PjLpm_t); +Pjbu_t j__udyLAllocJBU( PjLpm_t); // constant size. + +Pjll_t j__udyLAllocJLL1( Word_t, PjLpm_t); +Pjll_t j__udyLAllocJLL2( Word_t, PjLpm_t); +Pjll_t j__udyLAllocJLL3( Word_t, PjLpm_t); + +#ifdef JU_64BIT +Pjll_t j__udyLAllocJLL4( Word_t, PjLpm_t); +Pjll_t j__udyLAllocJLL5( Word_t, PjLpm_t); +Pjll_t j__udyLAllocJLL6( Word_t, PjLpm_t); +Pjll_t j__udyLAllocJLL7( Word_t, PjLpm_t); +#endif + +Pjlw_t j__udyLAllocJLW( Word_t ); // no PjLpm_t needed. +PjLlb_t j__udyLAllocJLB1( PjLpm_t); // constant size. +Pjv_t j__udyLAllocJV( Word_t, PjLpm_t); + + +// FUNCTIONS TO FREE OBJECTS: + +void j__udyLFreeJLPM( PjLpm_t, PjLpm_t); // constant size. + +void j__udyLFreeJBL( Pjbl_t, PjLpm_t); // constant size. +void j__udyLFreeJBB( Pjbb_t, PjLpm_t); // constant size. +void j__udyLFreeJBBJP(Pjp_t, Word_t, PjLpm_t); +void j__udyLFreeJBU( Pjbu_t, PjLpm_t); // constant size. + +void j__udyLFreeJLL1( Pjll_t, Word_t, PjLpm_t); +void j__udyLFreeJLL2( Pjll_t, Word_t, PjLpm_t); +void j__udyLFreeJLL3( Pjll_t, Word_t, PjLpm_t); + +#ifdef JU_64BIT +void j__udyLFreeJLL4( Pjll_t, Word_t, PjLpm_t); +void j__udyLFreeJLL5( Pjll_t, Word_t, PjLpm_t); +void j__udyLFreeJLL6( Pjll_t, Word_t, PjLpm_t); +void j__udyLFreeJLL7( Pjll_t, Word_t, PjLpm_t); +#endif + +void j__udyLFreeJLW( Pjlw_t, Word_t, PjLpm_t); +void j__udyLFreeJLB1( PjLlb_t, PjLpm_t); // constant size. +void j__udyLFreeJV( Pjv_t, Word_t, PjLpm_t); +void j__udyLFreeSM( Pjp_t, PjLpm_t); // everything below Pjp. + +#endif // ! _JUDYL_INCLUDED diff --git a/libnetdata/libjudy/src/JudyL/JudyLByCount.c b/libnetdata/libjudy/src/JudyL/JudyLByCount.c new file mode 100644 index 000000000..c5a004796 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLByCount.c @@ -0,0 +1,954 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.28 $ $Source: /judy/src/JudyCommon/JudyByCount.c $ +// +// Judy*ByCount() function for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// Compile with -DNOSMARTJBB, -DNOSMARTJBU, and/or -DNOSMARTJLB to build a +// version with cache line optimizations deleted, for testing. +// +// Judy*ByCount() is a conceptual although not literal inverse of Judy*Count(). +// Judy*Count() takes a pair of Indexes, and allows finding the ordinal of a +// given Index (that is, its position in the list of valid indexes from the +// beginning) as a degenerate case, because in general the count between two +// Indexes, inclusive, is not always just the difference in their ordinals. +// However, it suffices for Judy*ByCount() to simply be an ordinal-to-Index +// mapper. +// +// Note: Like Judy*Count(), this code must "count sideways" in branches, which +// can result in a lot of cache line fills. However, unlike Judy*Count(), this +// code does not receive a specific Index, hence digit, where to start in each +// branch, so it cant accurately calculate cache line fills required in each +// direction. The best it can do is an approximation based on the total +// population of the expanse (pop1 from Pjp) and the ordinal of the target +// Index (see SETOFFSET()) within the expanse. +// +// Compile with -DSMARTMETRICS to obtain global variables containing smart +// cache line metrics. Note: Dont turn this on simultaneously for this file +// and JudyCount.c because they export the same globals. +// **************************************************************************** + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +// These are imported from JudyCount.c: +// +// TBD: Should this be in common code? Exported from a header file? + +#ifdef JUDY1 +extern Word_t j__udy1JPPop1(const Pjp_t Pjp); +#define j__udyJPPop1 j__udy1JPPop1 +#else +extern Word_t j__udyLJPPop1(const Pjp_t Pjp); +#define j__udyJPPop1 j__udyLJPPop1 +#endif + +// Avoid duplicate symbols since this file is multi-compiled: + +#ifdef SMARTMETRICS +#ifdef JUDY1 +Word_t jbb_upward = 0; // counts of directions taken: +Word_t jbb_downward = 0; +Word_t jbu_upward = 0; +Word_t jbu_downward = 0; +Word_t jlb_upward = 0; +Word_t jlb_downward = 0; +#else +extern Word_t jbb_upward; +extern Word_t jbb_downward; +extern Word_t jbu_upward; +extern Word_t jbu_downward; +extern Word_t jlb_upward; +extern Word_t jlb_downward; +#endif +#endif + + +// **************************************************************************** +// J U D Y 1 B Y C O U N T +// J U D Y L B Y C O U N T +// +// See the manual entry. + +#ifdef JUDY1 +FUNCTION int Judy1ByCount +#else +FUNCTION PPvoid_t JudyLByCount +#endif + ( + Pcvoid_t PArray, // root pointer to first branch/leaf in SM. + Word_t Count, // ordinal of Index to find, 1..MAX. + Word_t * PIndex, // to return found Index. + PJError_t PJError // optional, for returning error info. + ) +{ + Word_t Count0; // Count, base-0, to match pop0. + Word_t state; // current state in SM. + Word_t pop1; // of current branch or leaf, or of expanse. + Word_t pop1lower; // pop1 of expanses (JPs) below that for Count. + Word_t digit; // current word in branch. + Word_t jpcount; // JPs in a BranchB subexpanse. + long jpnum; // JP number in a branch (base 0). + long subexp; // for stepping through layer 1 (subexpanses). + int offset; // index ordinal within a leaf, base 0. + + Pjp_t Pjp; // current JP in branch. + Pjll_t Pjll; // current Judy linear leaf. + + +// CHECK FOR EMPTY ARRAY OR NULL PINDEX: + + if (PArray == (Pvoid_t) NULL) JU_RET_NOTFOUND; + + if (PIndex == (PWord_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +// Convert Count to Count0; assume special case of Count = 0 maps to ~0, as +// desired, to represent the last index in a full array: +// +// Note: Think of Count0 as a reliable "number of Indexes below the target." + + Count0 = Count - 1; + assert((Count || Count0 == ~0)); // ensure CPU is sane about 0 - 1. + pop1lower = 0; + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + + if (Count0 > Pjlw[0]) JU_RET_NOTFOUND; // too high. + + *PIndex = Pjlw[Count]; // Index, base 1. + + JU_RET_FOUND_LEAFW(Pjlw, Pjlw[0] + 1, Count0); + } + else + { + Pjpm_t Pjpm = P_JPM(PArray); + + if (Count0 > (Pjpm->jpm_Pop0)) JU_RET_NOTFOUND; // too high. + + Pjp = &(Pjpm->jpm_JP); + pop1 = (Pjpm->jpm_Pop0) + 1; + +// goto SMByCount; + } + +// COMMON CODE: +// +// Prepare to handle a root-level or lower-level branch: Save the current +// state, obtain the total population for the branch in a state-dependent way, +// and then branch to common code for multiple cases. +// +// For root-level branches, the state is always cJU_ROOTSTATE, and the array +// population must already be set in pop1; it is not available in jp_DcdPopO. +// +// Note: The total population is only needed in cases where the common code +// "counts down" instead of up to minimize cache line fills. However, its +// available cheaply, and its better to do it with a constant shift (constant +// state value) instead of a variable shift later "when needed". + +#define PREPB_ROOT(Next) \ + state = cJU_ROOTSTATE; \ + goto Next + +// Use PREPB_DCD() to first copy the Dcd bytes to *PIndex if there are any +// (only if state < cJU_ROOTSTATE - 1): + +#define PREPB_DCD(Pjp,cState,Next) \ + JU_SETDCD(*PIndex, Pjp, cState); \ + PREPB((Pjp), cState, Next) + +#define PREPB(Pjp,cState,Next) \ + state = (cState); \ + pop1 = JU_JPBRANCH_POP0(Pjp, (cState)) + 1; \ + goto Next + +// Calculate whether the ordinal of an Index within a given expanse falls in +// the lower or upper half of the expanses population, taking care with +// unsigned math and boundary conditions: +// +// Note: Assume the ordinal falls within the expanses population, that is, +// 0 < (Count - Pop1lower) <= Pop1exp (assuming infinite math). +// +// Note: If the ordinal is the middle element, it doesnt matter whether +// LOWERHALF() is TRUE or FALSE. + +#define LOWERHALF(Count0,Pop1lower,Pop1exp) \ + (((Count0) - (Pop1lower)) < ((Pop1exp) / 2)) + +// Calculate the (signed) offset within a leaf to the desired ordinal (Count - +// Pop1lower; offset is one less), and optionally ensure its in range: + +#define SETOFFSET(Offset,Count0,Pop1lower,Pjp) \ + (Offset) = (Count0) - (Pop1lower); \ + assert((Offset) >= 0); \ + assert((Offset) <= JU_JPLEAF_POP0(Pjp)) + +// Variations for immediate indexes, with and without pop1-specific assertions: + +#define SETOFFSET_IMM_CK(Offset,Count0,Pop1lower,cPop1) \ + (Offset) = (Count0) - (Pop1lower); \ + assert((Offset) >= 0); \ + assert((Offset) < (cPop1)) + +#define SETOFFSET_IMM(Offset,Count0,Pop1lower) \ + (Offset) = (Count0) - (Pop1lower) + + +// STATE MACHINE -- TRAVERSE TREE: +// +// In branches, look for the expanse (digit), if any, where the total pop1 +// below or at that expanse would meet or exceed Count, meaning the Index must +// be in this expanse. + +SMByCount: // return here for next branch/leaf. + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH; count populations in JPs in the JBL upwards until finding the +// expanse (digit) containing Count, and "recurse". +// +// Note: There are no null JPs in a JBL; watch out for pop1 == 0. +// +// Note: A JBL should always fit in one cache line => no need to count up +// versus down to save cache line fills. +// +// TBD: The previous is no longer true. Consider enhancing this code to count +// up/down, but it can wait for a later tuning phase. In the meantime, PREPB() +// sets pop1 for the whole array, but that value is not used here. 001215: +// Maybe its true again? + + case cJU_JPBRANCH_L2: PREPB_DCD(Pjp, 2, BranchL); +#ifndef JU_64BIT + case cJU_JPBRANCH_L3: PREPB( Pjp, 3, BranchL); +#else + case cJU_JPBRANCH_L3: PREPB_DCD(Pjp, 3, BranchL); + case cJU_JPBRANCH_L4: PREPB_DCD(Pjp, 4, BranchL); + case cJU_JPBRANCH_L5: PREPB_DCD(Pjp, 5, BranchL); + case cJU_JPBRANCH_L6: PREPB_DCD(Pjp, 6, BranchL); + case cJU_JPBRANCH_L7: PREPB( Pjp, 7, BranchL); +#endif + case cJU_JPBRANCH_L: PREPB_ROOT( BranchL); + { + Pjbl_t Pjbl; + +// Common code (state-independent) for all cases of linear branches: + +BranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + + for (jpnum = 0; jpnum < (Pjbl->jbl_NumJPs); ++jpnum) + { + if ((pop1 = j__udyJPPop1((Pjbl->jbl_jp) + jpnum)) + == cJU_ALLONES) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + assert(pop1 != 0); + +// Warning: pop1lower and pop1 are unsigned, so do not subtract 1 and compare +// >=, but instead use the following expression: + + if (pop1lower + pop1 > Count0) // Index is in this expanse. + { + JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[jpnum], state); + Pjp = (Pjbl->jbl_jp) + jpnum; + goto SMByCount; // look under this expanse. + } + + pop1lower += pop1; // add this JPs pop1. + } + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here. + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // case cJU_JPBRANCH_L + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH; count populations in JPs in the JBB upwards or downwards +// until finding the expanse (digit) containing Count, and "recurse". +// +// Note: There are no null JPs in a JBB; watch out for pop1 == 0. + + case cJU_JPBRANCH_B2: PREPB_DCD(Pjp, 2, BranchB); +#ifndef JU_64BIT + case cJU_JPBRANCH_B3: PREPB( Pjp, 3, BranchB); +#else + case cJU_JPBRANCH_B3: PREPB_DCD(Pjp, 3, BranchB); + case cJU_JPBRANCH_B4: PREPB_DCD(Pjp, 4, BranchB); + case cJU_JPBRANCH_B5: PREPB_DCD(Pjp, 5, BranchB); + case cJU_JPBRANCH_B6: PREPB_DCD(Pjp, 6, BranchB); + case cJU_JPBRANCH_B7: PREPB( Pjp, 7, BranchB); +#endif + case cJU_JPBRANCH_B: PREPB_ROOT( BranchB); + { + Pjbb_t Pjbb; + +// Common code (state-independent) for all cases of bitmap branches: + +BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + +// Shorthand for one subexpanse in a bitmap and for one JP in a bitmap branch: +// +// Note: BMPJP0 exists separately to support assertions. + +#define BMPJP0(Subexp) (P_JP(JU_JBB_PJP(Pjbb, Subexp))) +#define BMPJP(Subexp,JPnum) (BMPJP0(Subexp) + (JPnum)) + + +// Common code for descending through a JP: +// +// Determine the digit for the expanse and save it in *PIndex; then "recurse". + +#define JBB_FOUNDEXPANSE \ + { \ + JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb,subexp), jpnum); \ + JU_SETDIGIT(*PIndex, digit, state); \ + Pjp = BMPJP(subexp, jpnum); \ + goto SMByCount; \ + } + + +#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes. + +// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s +// in JPs upwards, or subtracting the pop1s in JPs downwards: +// +// See header comments about limitations of this for Judy*ByCount(). + +#endif + +// COUNT UPWARD, adding each "below" JPs pop1: + +#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes. + + if (LOWERHALF(Count0, pop1lower, pop1)) + { +#endif +#ifdef SMARTMETRICS + ++jbb_upward; +#endif + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) + { + if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb,subexp))) + && (BMPJP0(subexp) == (Pjp_t) NULL)) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr. + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +// Note: An empty subexpanse (jpcount == 0) is handled "for free": + + for (jpnum = 0; jpnum < jpcount; ++jpnum) + { + if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum))) + == cJU_ALLONES) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + assert(pop1 != 0); + +// Warning: pop1lower and pop1 are unsigned, see earlier comment: + + if (pop1lower + pop1 > Count0) + JBB_FOUNDEXPANSE; // Index is in this expanse. + + pop1lower += pop1; // add this JPs pop1. + } + } +#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes. + } + + +// COUNT DOWNWARD, subtracting each "above" JPs pop1 from the whole expanses +// pop1: + + else + { +#ifdef SMARTMETRICS + ++jbb_downward; +#endif + pop1lower += pop1; // add whole branch to start. + + for (subexp = cJU_NUMSUBEXPB - 1; subexp >= 0; --subexp) + { + if ((jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp))) + && (BMPJP0(subexp) == (Pjp_t) NULL)) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // null ptr. + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +// Note: An empty subexpanse (jpcount == 0) is handled "for free": + + for (jpnum = jpcount - 1; jpnum >= 0; --jpnum) + { + if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum))) + == cJU_ALLONES) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + assert(pop1 != 0); + +// Warning: pop1lower and pop1 are unsigned, see earlier comment: + + pop1lower -= pop1; + +// Beware unsigned math problems: + + if ((pop1lower == 0) || (pop1lower - 1 < Count0)) + JBB_FOUNDEXPANSE; // Index is in this expanse. + } + } + } +#endif // NOSMARTJBB + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here. + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // case cJU_JPBRANCH_B + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH; count populations in JPs in the JBU upwards or +// downwards until finding the expanse (digit) containing Count, and "recurse". + + case cJU_JPBRANCH_U2: PREPB_DCD(Pjp, 2, BranchU); +#ifndef JU_64BIT + case cJU_JPBRANCH_U3: PREPB( Pjp, 3, BranchU); +#else + case cJU_JPBRANCH_U3: PREPB_DCD(Pjp, 3, BranchU); + case cJU_JPBRANCH_U4: PREPB_DCD(Pjp, 4, BranchU); + case cJU_JPBRANCH_U5: PREPB_DCD(Pjp, 5, BranchU); + case cJU_JPBRANCH_U6: PREPB_DCD(Pjp, 6, BranchU); + case cJU_JPBRANCH_U7: PREPB( Pjp, 7, BranchU); +#endif + case cJU_JPBRANCH_U: PREPB_ROOT( BranchU); + { + Pjbu_t Pjbu; + +// Common code (state-independent) for all cases of uncompressed branches: + +BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + +// Common code for descending through a JP: +// +// Save the digit for the expanse in *PIndex, then "recurse". + +#define JBU_FOUNDEXPANSE \ + { \ + JU_SETDIGIT(*PIndex, jpnum, state); \ + Pjp = (Pjbu->jbu_jp) + jpnum; \ + goto SMByCount; \ + } + + +#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes. + +// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s +// in JPs upwards, or subtracting the pop1s in JPs downwards: +// +// See header comments about limitations of this for Judy*ByCount(). + +#endif + +// COUNT UPWARD, simply adding the pop1 of each JP: + +#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes. + + if (LOWERHALF(Count0, pop1lower, pop1)) + { +#endif +#ifdef SMARTMETRICS + ++jbu_upward; +#endif + + for (jpnum = 0; jpnum < cJU_BRANCHUNUMJPS; ++jpnum) + { + // shortcut, save a function call: + + if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX) + continue; + + if ((pop1 = j__udyJPPop1((Pjbu->jbu_jp) + jpnum)) + == cJU_ALLONES) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + assert(pop1 != 0); + +// Warning: pop1lower and pop1 are unsigned, see earlier comment: + + if (pop1lower + pop1 > Count0) + JBU_FOUNDEXPANSE; // Index is in this expanse. + + pop1lower += pop1; // add this JPs pop1. + } +#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes. + } + + +// COUNT DOWNWARD, subtracting the pop1 of each JP above from the whole +// expanses pop1: + + else + { +#ifdef SMARTMETRICS + ++jbu_downward; +#endif + pop1lower += pop1; // add whole branch to start. + + for (jpnum = cJU_BRANCHUNUMJPS - 1; jpnum >= 0; --jpnum) + { + // shortcut, save a function call: + + if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX) + continue; + + if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum)) + == cJU_ALLONES) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + assert(pop1 != 0); + +// Warning: pop1lower and pop1 are unsigned, see earlier comment: + + pop1lower -= pop1; + +// Beware unsigned math problems: + + if ((pop1lower == 0) || (pop1lower - 1 < Count0)) + JBU_FOUNDEXPANSE; // Index is in this expanse. + } + } +#endif // NOSMARTJBU + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here. + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // case cJU_JPBRANCH_U + +// ---------------------------------------------------------------------------- +// LINEAR LEAF: +// +// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf. First +// copy Dcd bytes, if there are any (only if state < cJU_ROOTSTATE - 1), to +// *PIndex. +// +// Note: The preceding branch traversal code MIGHT set pop1 for this expanse +// (linear leaf) as a side-effect, but dont depend on that (for JUDYL, which +// is the only cases that need it anyway). + +#define PREPL_DCD(cState) \ + JU_SETDCD(*PIndex, Pjp, cState); \ + PREPL + +#ifdef JUDY1 +#define PREPL_SETPOP1 // not needed in any cases. +#else +#define PREPL_SETPOP1 pop1 = JU_JPLEAF_POP0(Pjp) + 1 +#endif + +#define PREPL \ + Pjll = P_JLL(Pjp->jp_Addr); \ + PREPL_SETPOP1; \ + SETOFFSET(offset, Count0, pop1lower, Pjp) + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: + + PREPL_DCD(1); + JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]); + JU_RET_FOUND_LEAF1(Pjll, pop1, offset); +#endif + + case cJU_JPLEAF2: + + PREPL_DCD(2); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF2(Pjll, pop1, offset); + +#ifndef JU_64BIT + case cJU_JPLEAF3: + { + Word_t lsb; + PREPL; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + +#else + case cJU_JPLEAF3: + { + Word_t lsb; + PREPL_DCD(3); + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + + case cJU_JPLEAF4: + + PREPL_DCD(4); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF4(Pjll, pop1, offset); + + case cJU_JPLEAF5: + { + Word_t lsb; + PREPL_DCD(5); + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_LEAF5(Pjll, pop1, offset); + } + + case cJU_JPLEAF6: + { + Word_t lsb; + PREPL_DCD(6); + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_LEAF6(Pjll, pop1, offset); + } + + case cJU_JPLEAF7: + { + Word_t lsb; + PREPL; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_LEAF7(Pjll, pop1, offset); + } +#endif + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF: +// +// Return the Index at the proper ordinal (see SETOFFSET()) in the leaf by +// counting bits. First copy Dcd bytes (always present since state 1 < +// cJU_ROOTSTATE) to *PIndex. +// +// Note: The preceding branch traversal code MIGHT set pop1 for this expanse +// (bitmap leaf) as a side-effect, but dont depend on that. + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb; + + JU_SETDCD(*PIndex, Pjp, 1); + Pjlb = P_JLB(Pjp->jp_Addr); + pop1 = JU_JPLEAF_POP0(Pjp) + 1; + +// COUNT UPWARD, adding the pop1 of each subexpanse: +// +// The entire bitmap should fit in one cache line, but still try to save some +// CPU time by counting the fewest possible number of subexpanses from the +// bitmap. +// +// See header comments about limitations of this for Judy*ByCount(). + +#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes. + + if (LOWERHALF(Count0, pop1lower, pop1)) + { +#endif +#ifdef SMARTMETRICS + ++jlb_upward; +#endif + for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp) + { + pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)); + +// Warning: pop1lower and pop1 are unsigned, see earlier comment: + + if (pop1lower + pop1 > Count0) + goto LeafB1; // Index is in this subexpanse. + + pop1lower += pop1; // add this subexpanses pop1. + } +#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes. + } + + +// COUNT DOWNWARD, subtracting each "above" subexpanses pop1 from the whole +// expanses pop1: + + else + { +#ifdef SMARTMETRICS + ++jlb_downward; +#endif + pop1lower += pop1; // add whole leaf to start. + + for (subexp = cJU_NUMSUBEXPL - 1; subexp >= 0; --subexp) + { + pop1lower -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)); + +// Beware unsigned math problems: + + if ((pop1lower == 0) || (pop1lower - 1 < Count0)) + goto LeafB1; // Index is in this subexpanse. + } + } +#endif // NOSMARTJLB + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // should never get here. + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + +// RETURN INDEX FOUND: +// +// Come here with subexp set to the correct subexpanse, and pop1lower set to +// the sum for all lower expanses and subexpanses in the Judy tree. Calculate +// and save in *PIndex the digit corresponding to the ordinal in this +// subexpanse. + +LeafB1: + SETOFFSET(offset, Count0, pop1lower, Pjp); + JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset); + JU_SETDIGIT1(*PIndex, digit); + JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset); +// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + offset)) + + } // case cJU_JPLEAF_B1 + + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// Copy Dcd bytes (always present since state 1 < cJU_ROOTSTATE) to *PIndex, +// then set the appropriate digit for the ordinal (see SETOFFSET()) in the leaf +// as the LSB in *PIndex. + + case cJ1_JPFULLPOPU1: + + JU_SETDCD(*PIndex, Pjp, 1); + SETOFFSET(offset, Count0, pop1lower, Pjp); + assert(offset >= 0); + assert(offset <= cJU_JPFULLPOPU1_POP0); + JU_SETDIGIT1(*PIndex, offset); + JU_RET_FOUND_FULLPOPU1; +#endif + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: +// +// Locate the Index with the proper ordinal (see SETOFFSET()) in the Immediate, +// depending on leaf Index Size and pop1. Note: There are no Dcd bytes in an +// Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the least bytes +// of the immediate Index. + +#define SET_01(cState) JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState) + + case cJU_JPIMMED_1_01: SET_01(1); goto Imm_01; + case cJU_JPIMMED_2_01: SET_01(2); goto Imm_01; + case cJU_JPIMMED_3_01: SET_01(3); goto Imm_01; +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: SET_01(4); goto Imm_01; + case cJU_JPIMMED_5_01: SET_01(5); goto Imm_01; + case cJU_JPIMMED_6_01: SET_01(6); goto Imm_01; + case cJU_JPIMMED_7_01: SET_01(7); goto Imm_01; +#endif + +Imm_01: + + DBGCODE(SETOFFSET_IMM_CK(offset, Count0, pop1lower, 1);) + JU_RET_FOUND_IMM_01(Pjp); + +// Shorthand for where to find start of Index bytes array: + +#ifdef JUDY1 +#define PJI (Pjp->jp_1Index) +#else +#define PJI (Pjp->jp_LIndex) +#endif + +// Optional code to check the remaining ordinal (see SETOFFSET_IMM()) against +// the Index Size of the Immediate: + +#ifndef DEBUG // simple placeholder: +#define IMM(cPop1,Next) \ + goto Next +#else // extra pop1-specific checking: +#define IMM(cPop1,Next) \ + SETOFFSET_IMM_CK(offset, Count0, pop1lower, cPop1); \ + goto Next +#endif + + case cJU_JPIMMED_1_02: IMM( 2, Imm1); + case cJU_JPIMMED_1_03: IMM( 3, Imm1); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: IMM( 4, Imm1); + case cJU_JPIMMED_1_05: IMM( 5, Imm1); + case cJU_JPIMMED_1_06: IMM( 6, Imm1); + case cJU_JPIMMED_1_07: IMM( 7, Imm1); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: IMM( 8, Imm1); + case cJ1_JPIMMED_1_09: IMM( 9, Imm1); + case cJ1_JPIMMED_1_10: IMM(10, Imm1); + case cJ1_JPIMMED_1_11: IMM(11, Imm1); + case cJ1_JPIMMED_1_12: IMM(12, Imm1); + case cJ1_JPIMMED_1_13: IMM(13, Imm1); + case cJ1_JPIMMED_1_14: IMM(14, Imm1); + case cJ1_JPIMMED_1_15: IMM(15, Imm1); +#endif + +Imm1: SETOFFSET_IMM(offset, Count0, pop1lower); + JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]); + JU_RET_FOUND_IMM(Pjp, offset); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: IMM(2, Imm2); + case cJU_JPIMMED_2_03: IMM(3, Imm2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: IMM(4, Imm2); + case cJ1_JPIMMED_2_05: IMM(5, Imm2); + case cJ1_JPIMMED_2_06: IMM(6, Imm2); + case cJ1_JPIMMED_2_07: IMM(7, Imm2); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) +Imm2: SETOFFSET_IMM(offset, Count0, pop1lower); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: IMM(2, Imm3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: IMM(3, Imm3); + case cJ1_JPIMMED_3_04: IMM(4, Imm3); + case cJ1_JPIMMED_3_05: IMM(5, Imm3); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) +Imm3: + { + Word_t lsb; + SETOFFSET_IMM(offset, Count0, pop1lower); + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_4_02: IMM(2, Imm4); + case cJ1_JPIMMED_4_03: IMM(3, Imm4); + +Imm4: SETOFFSET_IMM(offset, Count0, pop1lower); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); + + case cJ1_JPIMMED_5_02: IMM(2, Imm5); + case cJ1_JPIMMED_5_03: IMM(3, Imm5); + +Imm5: + { + Word_t lsb; + SETOFFSET_IMM(offset, Count0, pop1lower); + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_6_02: IMM(2, Imm6); + +Imm6: + { + Word_t lsb; + SETOFFSET_IMM(offset, Count0, pop1lower); + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_7_02: IMM(2, Imm7); + +Imm7: + { + Word_t lsb; + SETOFFSET_IMM(offset, Count0, pop1lower); + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif // (JUDY1 && JU_64BIT) + + +// ---------------------------------------------------------------------------- +// UNEXPECTED JP TYPES: + + default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // SMByCount switch. + + /*NOTREACHED*/ + +} // Judy1ByCount() / JudyLByCount() diff --git a/libnetdata/libjudy/src/JudyL/JudyLCascade.c b/libnetdata/libjudy/src/JudyL/JudyLCascade.c new file mode 100644 index 000000000..6b52ddf5f --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLCascade.c @@ -0,0 +1,1942 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.38 $ $Source: /judy/src/JudyCommon/JudyCascade.c $ + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +extern int j__udyCreateBranchL(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t); +extern int j__udyCreateBranchB(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t); + +DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);) + +static const jbb_t StageJBBZero; // zeroed versions of namesake struct. + +// TBD: There are multiple copies of (some of) these CopyWto3, Copy3toW, +// CopyWto7 and Copy7toW functions in Judy1Cascade.c, JudyLCascade.c, and +// JudyDecascade.c. These static functions should probably be moved to a +// common place, made macros, or something to avoid having four copies. + + +// **************************************************************************** +// __ J U D Y C O P Y X T O W + + +FUNCTION static void j__udyCopy3toW( + PWord_t PDest, + uint8_t * PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY3_PINDEX_TO_LONG(*PDest, PSrc); + PSrc += 3; + PDest += 1; + + } while(--LeafIndexes); + +} //j__udyCopy3toW() + + +#ifdef JU_64BIT + +FUNCTION static void j__udyCopy4toW( + PWord_t PDest, + uint32_t * PSrc, + Word_t LeafIndexes) +{ + do { *PDest++ = *PSrc++; + } while(--LeafIndexes); + +} // j__udyCopy4toW() + + +FUNCTION static void j__udyCopy5toW( + PWord_t PDest, + uint8_t * PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY5_PINDEX_TO_LONG(*PDest, PSrc); + PSrc += 5; + PDest += 1; + + } while(--LeafIndexes); + +} // j__udyCopy5toW() + + +FUNCTION static void j__udyCopy6toW( + PWord_t PDest, + uint8_t * PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY6_PINDEX_TO_LONG(*PDest, PSrc); + PSrc += 6; + PDest += 1; + + } while(--LeafIndexes); + +} // j__udyCopy6toW() + + +FUNCTION static void j__udyCopy7toW( + PWord_t PDest, + uint8_t * PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY7_PINDEX_TO_LONG(*PDest, PSrc); + PSrc += 7; + PDest += 1; + + } while(--LeafIndexes); + +} // j__udyCopy7toW() + +#endif // JU_64BIT + + +// **************************************************************************** +// __ J U D Y C O P Y W T O X + + +FUNCTION static void j__udyCopyWto3( + uint8_t * PDest, + PWord_t PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY3_LONG_TO_PINDEX(PDest, *PSrc); + PSrc += 1; + PDest += 3; + + } while(--LeafIndexes); + +} // j__udyCopyWto3() + + +#ifdef JU_64BIT + +FUNCTION static void j__udyCopyWto4( + uint8_t * PDest, + PWord_t PSrc, + Word_t LeafIndexes) +{ + uint32_t *PDest32 = (uint32_t *)PDest; + + do + { + *PDest32 = *PSrc; + PSrc += 1; + PDest32 += 1; + } while(--LeafIndexes); + +} // j__udyCopyWto4() + + +FUNCTION static void j__udyCopyWto5( + uint8_t * PDest, + PWord_t PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY5_LONG_TO_PINDEX(PDest, *PSrc); + PSrc += 1; + PDest += 5; + + } while(--LeafIndexes); + +} // j__udyCopyWto5() + + +FUNCTION static void j__udyCopyWto6( + uint8_t * PDest, + PWord_t PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY6_LONG_TO_PINDEX(PDest, *PSrc); + PSrc += 1; + PDest += 6; + + } while(--LeafIndexes); + +} // j__udyCopyWto6() + + +FUNCTION static void j__udyCopyWto7( + uint8_t * PDest, + PWord_t PSrc, + Word_t LeafIndexes) +{ + do + { + JU_COPY7_LONG_TO_PINDEX(PDest, *PSrc); + PSrc += 1; + PDest += 7; + + } while(--LeafIndexes); + +} // j__udyCopyWto7() + +#endif // JU_64BIT + + +// **************************************************************************** +// COMMON CODE (MACROS): +// +// Free objects in an array of valid JPs, StageJP[ExpCnt] == last one may +// include Immeds, which are ignored. + +#define FREEALLEXIT(ExpCnt,StageJP,Pjpm) \ + { \ + Word_t _expct = (ExpCnt); \ + while (_expct--) j__udyFreeSM(&((StageJP)[_expct]), Pjpm); \ + return(-1); \ + } + +// Clear the array that keeps track of the number of JPs in a subexpanse: + +#define ZEROJP(SubJPCount) \ + { \ + int ii; \ + for (ii = 0; ii < cJU_NUMSUBEXPB; ii++) (SubJPCount[ii]) = 0; \ + } + +// **************************************************************************** +// __ J U D Y S T A G E J B B T O J B B +// +// Create a mallocd BranchB (jbb_t) from a staged BranchB while "splaying" a +// single old leaf. Return -1 if out of memory, otherwise 1. + +static int j__udyStageJBBtoJBB( + Pjp_t PjpLeaf, // JP of leaf being splayed. + Pjbb_t PStageJBB, // temp jbb_t on stack. + Pjp_t PjpArray, // array of JPs to splayed new leaves. + uint8_t * PSubCount, // count of JPs for each subexpanse. + Pjpm_t Pjpm) // the jpm_t for JudyAlloc*(). +{ + Pjbb_t PjbbRaw; // pointer to new bitmap branch. + Pjbb_t Pjbb; + Word_t subexp; + +// Get memory for new BranchB: + + if ((PjbbRaw = j__udyAllocJBB(Pjpm)) == (Pjbb_t) NULL) return(-1); + Pjbb = P_JBB(PjbbRaw); + +// Copy staged BranchB into just-allocated BranchB: + + *Pjbb = *PStageJBB; + +// Allocate the JP subarrays (BJP) for the new BranchB: + + for (subexp = 0; subexp < cJU_NUMSUBEXPB; subexp++) + { + Pjp_t PjpRaw; + Pjp_t Pjp; + Word_t NumJP; // number of JPs in each subexpanse. + + if ((NumJP = PSubCount[subexp]) == 0) continue; // empty. + +// Out of memory, back out previous allocations: + + if ((PjpRaw = j__udyAllocJBBJP(NumJP, Pjpm)) == (Pjp_t) NULL) + { + while(subexp--) + { + if ((NumJP = PSubCount[subexp]) == 0) continue; + + PjpRaw = JU_JBB_PJP(Pjbb, subexp); + j__udyFreeJBBJP(PjpRaw, NumJP, Pjpm); + } + j__udyFreeJBB(PjbbRaw, Pjpm); + return(-1); // out of memory. + } + Pjp = P_JP(PjpRaw); + +// Place the JP subarray pointer in the new BranchB, copy subarray JPs, and +// advance to the next subexpanse: + + JU_JBB_PJP(Pjbb, subexp) = PjpRaw; + JU_COPYMEM(Pjp, PjpArray, NumJP); + PjpArray += NumJP; + + } // for each subexpanse. + +// Change the PjpLeaf from Leaf to BranchB: + + PjpLeaf->jp_Addr = (Word_t) PjbbRaw; + PjpLeaf->jp_Type += cJU_JPBRANCH_B2 - cJU_JPLEAF2; // Leaf to BranchB. + + return(1); + +} // j__udyStageJBBtoJBB() + + +// **************************************************************************** +// __ J U D Y J L L 2 T O J L B 1 +// +// Create a LeafB1 (jlb_t = JLB1) from a Leaf2 (2-byte Indexes and for JudyL, +// Word_t Values). Return NULL if out of memory, else a pointer to the new +// LeafB1. +// +// NOTE: Caller must release the Leaf2 that was passed in. + +FUNCTION static Pjlb_t j__udyJLL2toJLB1( + uint16_t * Pjll, // array of 16-bit indexes. +#ifdef JUDYL + Pjv_t Pjv, // array of associated values. +#endif + Word_t LeafPop1, // number of indexes/values. + Pvoid_t Pjpm) // jpm_t for JudyAlloc*()/JudyFree*(). +{ + Pjlb_t PjlbRaw; + Pjlb_t Pjlb; + int offset; +JUDYLCODE(int subexp;) + +// Allocate the LeafB1: + + if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL) + return((Pjlb_t) NULL); + Pjlb = P_JLB(PjlbRaw); + +// Copy Leaf2 indexes to LeafB1: + + for (offset = 0; offset < LeafPop1; ++offset) + JU_BITMAPSETL(Pjlb, Pjll[offset]); + +#ifdef JUDYL + +// Build LeafVs from bitmap: + + for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp) + { + struct _POINTER_VALUES + { + Word_t pv_Pop1; // size of value area. + Pjv_t pv_Pjv; // raw pointer to value area. + } pv[cJU_NUMSUBEXPL]; + +// Get the population of the subexpanse, and if any, allocate a LeafV: + + pv[subexp].pv_Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)); + + if (pv[subexp].pv_Pop1) + { + Pjv_t Pjvnew; + +// TBD: There is an opportunity to put pop == 1 value in pointer: + + pv[subexp].pv_Pjv = j__udyLAllocJV(pv[subexp].pv_Pop1, Pjpm); + +// Upon out of memory, free all previously allocated: + + if (pv[subexp].pv_Pjv == (Pjv_t) NULL) + { + while(subexp--) + { + if (pv[subexp].pv_Pop1) + { + j__udyLFreeJV(pv[subexp].pv_Pjv, pv[subexp].pv_Pop1, + Pjpm); + } + } + j__udyFreeJLB1(PjlbRaw, Pjpm); + return((Pjlb_t) NULL); + } + + Pjvnew = P_JV(pv[subexp].pv_Pjv); + JU_COPYMEM(Pjvnew, Pjv, pv[subexp].pv_Pop1); + Pjv += pv[subexp].pv_Pop1; // advance value pointer. + +// Place raw pointer to value array in bitmap subexpanse: + + JL_JLB_PVALUE(Pjlb, subexp) = pv[subexp].pv_Pjv; + + } // populated subexpanse. + } // each subexpanse. + +#endif // JUDYL + + return(PjlbRaw); // pointer to LeafB1. + +} // j__udyJLL2toJLB1() + + +// **************************************************************************** +// __ J U D Y C A S C A D E 1 +// +// Create bitmap leaf from 1-byte Indexes and Word_t Values. +// +// TBD: There must be a better way. +// +// Only for JudyL 32 bit: (note, unifdef disallows comment on next line) + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + +FUNCTION int j__udyCascade1( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + Word_t DcdP0; + uint8_t * PLeaf; + Pjlb_t PjlbRaw; + Pjlb_t Pjlb; + Word_t Pop1; + Word_t ii; // temp for loop counter +JUDYLCODE(Pjv_t Pjv;) + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF1); + assert((JU_JPDCDPOP0(Pjp) & 0xFF) == (cJU_LEAF1_MAXPOP1-1)); + + PjlbRaw = j__udyAllocJLB1(Pjpm); + if (PjlbRaw == (Pjlb_t) NULL) return(-1); + + Pjlb = P_JLB(PjlbRaw); + PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr); + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + + JUDYLCODE(Pjv = JL_LEAF1VALUEAREA(PLeaf, Pop1);) + +// Copy 1 byte index Leaf to bitmap Leaf + for (ii = 0; ii < Pop1; ii++) JU_BITMAPSETL(Pjlb, PLeaf[ii]); + +#ifdef JUDYL +// Build 8 subexpanse Value leaves from bitmap + for (ii = 0; ii < cJU_NUMSUBEXPL; ii++) + { +// Get number of Indexes in subexpanse + if ((Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, ii)))) + { + Pjv_t PjvnewRaw; // value area of new leaf. + Pjv_t Pjvnew; + + PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm); + if (PjvnewRaw == (Pjv_t) NULL) // out of memory. + { +// Free prevously allocated LeafVs: + while(ii--) + { + if ((Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, ii)))) + { + PjvnewRaw = JL_JLB_PVALUE(Pjlb, ii); + j__udyLFreeJV(PjvnewRaw, Pop1, Pjpm); + } + } +// Free the bitmap leaf + j__udyLFreeJLB1(PjlbRaw,Pjpm); + return(-1); + } + Pjvnew = P_JV(PjvnewRaw); + JU_COPYMEM(Pjvnew, Pjv, Pop1); + + Pjv += Pop1; + JL_JLB_PVALUE(Pjlb, ii) = PjvnewRaw; + } + } +#endif // JUDYL + + DcdP0 = JU_JPDCDPOP0(Pjp) | (PLeaf[0] & cJU_DCDMASK(1)); + JU_JPSETADT(Pjp, (Word_t)PjlbRaw, DcdP0, cJU_JPLEAF_B1); + + return(1); // return success + +} // j__udyCascade1() + +#endif // (!(JUDY1 && JU_64BIT)) + + +// **************************************************************************** +// __ J U D Y C A S C A D E 2 +// +// Entry PLeaf of size LeafPop1 is either compressed or splayed with pointer +// returned in Pjp. Entry Levels sizeof(Word_t) down to level 2. +// +// Splay or compress the 2-byte Index Leaf that Pjp point to. Return *Pjp as a +// (compressed) cJU_LEAFB1 or a cJU_BRANCH_*2 + +FUNCTION int j__udyCascade2( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + uint16_t * PLeaf; // pointer to leaf, explicit type. + Word_t End, Start; // temporaries. + Word_t ExpCnt; // count of expanses of splay. + Word_t CIndex; // current Index word. +JUDYLCODE(Pjv_t Pjv;) // value area of leaf. + +// Temp staging for parts(Leaves) of newly splayed leaf + jp_t StageJP [cJU_LEAF2_MAXPOP1]; // JPs of new leaves + uint8_t StageExp [cJU_LEAF2_MAXPOP1]; // Expanses of new leaves + uint8_t SubJPCount[cJU_NUMSUBEXPB]; // JPs in each subexpanse + jbb_t StageJBB; // staged bitmap branch + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF2); + assert((JU_JPDCDPOP0(Pjp) & 0xFFFF) == (cJU_LEAF2_MAXPOP1-1)); + +// Get the address of the Leaf + PLeaf = (uint16_t *) P_JLL(Pjp->jp_Addr); + +// And its Value area + JUDYLCODE(Pjv = JL_LEAF2VALUEAREA(PLeaf, cJU_LEAF2_MAXPOP1);) + +// If Leaf is in 1 expanse -- just compress it to a Bitmap Leaf + + CIndex = PLeaf[0]; + if (!JU_DIGITATSTATE(CIndex ^ PLeaf[cJU_LEAF2_MAXPOP1-1], 2)) + { +// cJU_JPLEAF_B1 + Word_t DcdP0; + Pjlb_t PjlbRaw; + PjlbRaw = j__udyJLL2toJLB1(PLeaf, +#ifdef JUDYL + Pjv, +#endif + cJU_LEAF2_MAXPOP1, Pjpm); + if (PjlbRaw == (Pjlb_t)NULL) return(-1); // out of memory + +// Merge in another Dcd byte because compressing + DcdP0 = (CIndex & cJU_DCDMASK(1)) | JU_JPDCDPOP0(Pjp); + JU_JPSETADT(Pjp, (Word_t)PjlbRaw, DcdP0, cJU_JPLEAF_B1); + + return(1); + } + +// Else in 2+ expanses, splay Leaf into smaller leaves at higher compression + + StageJBB = StageJBBZero; // zero staged bitmap branch + ZEROJP(SubJPCount); + +// Splay the 2 byte index Leaf to 1 byte Index Leaves + for (ExpCnt = Start = 0, End = 1; ; End++) + { +// Check if new expanse or last one + if ( (End == cJU_LEAF2_MAXPOP1) + || + (JU_DIGITATSTATE(CIndex ^ PLeaf[End], 2)) + ) + { +// Build a leaf below the previous expanse +// + Pjp_t PjpJP = StageJP + ExpCnt; + Word_t Pop1 = End - Start; + Word_t expanse = JU_DIGITATSTATE(CIndex, 2); + Word_t subexp = expanse / cJU_BITSPERSUBEXPB; +// +// set the bit that is the current expanse + JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse); +#ifdef SUBEXPCOUNTS + StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse +#endif +// count number of expanses in each subexpanse + SubJPCount[subexp]++; + +// Save byte expanse of leaf + StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 2); + + if (Pop1 == 1) // cJU_JPIMMED_1_01 + { + Word_t DcdP0; + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(1)) | + CIndex; +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_1_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, + cJL_JPIMMED_1_01); +#endif // JUDYL + } + else if (Pop1 <= cJU_IMMED1_MAXPOP1) // bigger + { +// cJL_JPIMMED_1_02..3: JudyL 32 +// cJ1_JPIMMED_1_02..7: Judy1 32 +// cJL_JPIMMED_1_02..7: JudyL 64 +// cJ1_JPIMMED_1_02..15: Judy1 64 +#ifdef JUDYL + Pjv_t PjvnewRaw; // value area of leaf. + Pjv_t Pjvnew; + +// Allocate Value area for Immediate Leaf + PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm); + if (PjvnewRaw == (Pjv_t) NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjvnew = P_JV(PjvnewRaw); + +// Copy to Values to Value Leaf + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); + PjpJP->jp_Addr = (Word_t) PjvnewRaw; + +// Copy to JP as an immediate Leaf + JU_COPYMEM(PjpJP->jp_LIndex, PLeaf + Start, + Pop1); +#else + JU_COPYMEM(PjpJP->jp_1Index, PLeaf + Start, + Pop1); +#endif +// Set Type, Population and Index size + PjpJP->jp_Type = cJU_JPIMMED_1_02 + Pop1 - 2; + } + +// 64Bit Judy1 does not have Leaf1: (note, unifdef disallows comment on next +// line) + +#if (! (defined(JUDY1) && defined(JU_64BIT))) + else if (Pop1 <= cJU_LEAF1_MAXPOP1) // still bigger + { +// cJU_JPLEAF1 + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Get a new Leaf + PjllRaw = j__udyAllocJLL1(Pop1, Pjpm); + if (PjllRaw == (Pjll_t)NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjll = P_JLL(PjllRaw); +#ifdef JUDYL +// Copy to Values to new Leaf + Pjvnew = JL_LEAF1VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif +// Copy Indexes to new Leaf + JU_COPYMEM((uint8_t *)Pjll, PLeaf+Start, Pop1); + + DBGCODE(JudyCheckSorted(Pjll, Pop1, 1);) + + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(2)) + | + (CIndex & cJU_DCDMASK(2-1)) + | + (Pop1 - 1); + + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0, + cJU_JPLEAF1); + } +#endif // (!(JUDY1 && JU_64BIT)) // Not 64Bit Judy1 + + else // biggest + { +// cJU_JPLEAF_B1 + Word_t DcdP0; + Pjlb_t PjlbRaw; + PjlbRaw = j__udyJLL2toJLB1( + PLeaf + Start, +#ifdef JUDYL + Pjv + Start, +#endif + Pop1, Pjpm); + if (PjlbRaw == (Pjlb_t)NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(2)) + | + (CIndex & cJU_DCDMASK(2-1)) + | + (Pop1 - 1); + + JU_JPSETADT(PjpJP, (Word_t)PjlbRaw, DcdP0, + cJU_JPLEAF_B1); + } + ExpCnt++; +// Done? + if (End == cJU_LEAF2_MAXPOP1) break; + +// New Expanse, Start and Count + CIndex = PLeaf[End]; + Start = End; + } + } + +// Now put all the Leaves below a BranchL or BranchB: + if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL + { + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt, + Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_L2; + } + else + { + if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm) + == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + } + return(1); + +} // j__udyCascade2() + + +// **************************************************************************** +// __ J U D Y C A S C A D E 3 +// +// Return *Pjp as a (compressed) cJU_LEAF2, cJU_BRANCH_L3, cJU_BRANCH_B3. + +FUNCTION int j__udyCascade3( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + uint8_t * PLeaf; // pointer to leaf, explicit type. + Word_t End, Start; // temporaries. + Word_t ExpCnt; // count of expanses of splay. + Word_t CIndex; // current Index word. +JUDYLCODE(Pjv_t Pjv;) // value area of leaf. + +// Temp staging for parts(Leaves) of newly splayed leaf + jp_t StageJP [cJU_LEAF3_MAXPOP1]; // JPs of new leaves + Word_t StageA [cJU_LEAF3_MAXPOP1]; + uint8_t StageExp [cJU_LEAF3_MAXPOP1]; // Expanses of new leaves + uint8_t SubJPCount[cJU_NUMSUBEXPB]; // JPs in each subexpanse + jbb_t StageJBB; // staged bitmap branch + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF3); + assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFF) == (cJU_LEAF3_MAXPOP1-1)); + +// Get the address of the Leaf + PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr); + +// Extract leaf to Word_t and insert-sort Index into it + j__udyCopy3toW(StageA, PLeaf, cJU_LEAF3_MAXPOP1); + +// Get the address of the Leaf and Value area + JUDYLCODE(Pjv = JL_LEAF3VALUEAREA(PLeaf, cJU_LEAF3_MAXPOP1);) + +// If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index) + + CIndex = StageA[0]; + if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF3_MAXPOP1-1], 3)) + { + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Alloc a 2 byte Index Leaf + PjllRaw = j__udyAllocJLL2(cJU_LEAF3_MAXPOP1, Pjpm); + if (PjllRaw == (Pjlb_t)NULL) return(-1); // out of memory + + Pjll = P_JLL(PjllRaw); + +// Copy just 2 bytes Indexes to new Leaf +// j__udyCopyWto2((uint16_t *) Pjll, StageA, cJU_LEAF3_MAXPOP1); + JU_COPYMEM ((uint16_t *) Pjll, StageA, cJU_LEAF3_MAXPOP1); +#ifdef JUDYL +// Copy Value area into new Leaf + Pjvnew = JL_LEAF2VALUEAREA(Pjll, cJU_LEAF3_MAXPOP1); + JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF3_MAXPOP1); +#endif + DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF3_MAXPOP1, 2);) + +// Form new JP, Pop0 field is unchanged +// Add in another Dcd byte because compressing + DcdP0 = (CIndex & cJU_DCDMASK(2)) | JU_JPDCDPOP0(Pjp); + + JU_JPSETADT(Pjp, (Word_t) PjllRaw, DcdP0, cJU_JPLEAF2); + + return(1); // Success + } + +// Else in 2+ expanses, splay Leaf into smaller leaves at higher compression + + StageJBB = StageJBBZero; // zero staged bitmap branch + ZEROJP(SubJPCount); + +// Splay the 3 byte index Leaf to 2 byte Index Leaves + for (ExpCnt = Start = 0, End = 1; ; End++) + { +// Check if new expanse or last one + if ( (End == cJU_LEAF3_MAXPOP1) + || + (JU_DIGITATSTATE(CIndex ^ StageA[End], 3)) + ) + { +// Build a leaf below the previous expanse + + Pjp_t PjpJP = StageJP + ExpCnt; + Word_t Pop1 = End - Start; + Word_t expanse = JU_DIGITATSTATE(CIndex, 3); + Word_t subexp = expanse / cJU_BITSPERSUBEXPB; +// +// set the bit that is the current expanse + JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse); +#ifdef SUBEXPCOUNTS + StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse +#endif +// count number of expanses in each subexpanse + SubJPCount[subexp]++; + +// Save byte expanse of leaf + StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 3); + + if (Pop1 == 1) // cJU_JPIMMED_2_01 + { + Word_t DcdP0; + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(2)) | + CIndex; +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_2_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, + cJL_JPIMMED_2_01); +#endif // JUDYL + } +#if (defined(JUDY1) || defined(JU_64BIT)) + else if (Pop1 <= cJU_IMMED2_MAXPOP1) + { +// cJ1_JPIMMED_2_02..3: Judy1 32 +// cJL_JPIMMED_2_02..3: JudyL 64 +// cJ1_JPIMMED_2_02..7: Judy1 64 +#ifdef JUDYL +// Alloc is 1st in case of malloc fail + Pjv_t PjvnewRaw; // value area of new leaf. + Pjv_t Pjvnew; + +// Allocate Value area for Immediate Leaf + PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm); + if (PjvnewRaw == (Pjv_t) NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjvnew = P_JV(PjvnewRaw); + +// Copy to Values to Value Leaf + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); + + PjpJP->jp_Addr = (Word_t) PjvnewRaw; + +// Copy to Index to JP as an immediate Leaf + JU_COPYMEM((uint16_t *) (PjpJP->jp_LIndex), + StageA + Start, Pop1); +#else // JUDY1 + JU_COPYMEM((uint16_t *) (PjpJP->jp_1Index), + StageA + Start, Pop1); +#endif // JUDY1 +// Set Type, Population and Index size + PjpJP->jp_Type = cJU_JPIMMED_2_02 + Pop1 - 2; + } +#endif // (JUDY1 || JU_64BIT) + + else // Make a linear leaf2 + { +// cJU_JPLEAF2 + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + + PjllRaw = j__udyAllocJLL2(Pop1, Pjpm); + if (PjllRaw == (Pjll_t) NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjll = P_JLL(PjllRaw); +#ifdef JUDYL +// Copy to Values to new Leaf + Pjvnew = JL_LEAF2VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif +// Copy least 2 bytes per Index of Leaf to new Leaf + JU_COPYMEM((uint16_t *) Pjll, StageA+Start, + Pop1); + + DBGCODE(JudyCheckSorted(Pjll, Pop1, 2);) + + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(3)) + | + (CIndex & cJU_DCDMASK(3-1)) + | + (Pop1 - 1); + + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0, + cJU_JPLEAF2); + } + ExpCnt++; +// Done? + if (End == cJU_LEAF3_MAXPOP1) break; + +// New Expanse, Start and Count + CIndex = StageA[End]; + Start = End; + } + } + +// Now put all the Leaves below a BranchL or BranchB: + if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL + { + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt, + Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_L3; + } + else + { + if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm) + == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + } + return(1); + +} // j__udyCascade3() + + +#ifdef JU_64BIT // JudyCascade[4567] + +// **************************************************************************** +// __ J U D Y C A S C A D E 4 +// +// Cascade from a cJU_JPLEAF4 to one of the following: +// 1. if leaf is in 1 expanse: +// compress it into a JPLEAF3 +// 2. if leaf contains multiple expanses: +// create linear or bitmap branch containing +// each new expanse is either a: +// JPIMMED_3_01 branch +// JPIMMED_3_02 branch +// JPLEAF3 + +FUNCTION int j__udyCascade4( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + uint32_t * PLeaf; // pointer to leaf, explicit type. + Word_t End, Start; // temporaries. + Word_t ExpCnt; // count of expanses of splay. + Word_t CIndex; // current Index word. +JUDYLCODE(Pjv_t Pjv;) // value area of leaf. + +// Temp staging for parts(Leaves) of newly splayed leaf + jp_t StageJP [cJU_LEAF4_MAXPOP1]; // JPs of new leaves + Word_t StageA [cJU_LEAF4_MAXPOP1]; + uint8_t StageExp [cJU_LEAF4_MAXPOP1]; // Expanses of new leaves + uint8_t SubJPCount[cJU_NUMSUBEXPB]; // JPs in each subexpanse + jbb_t StageJBB; // staged bitmap branch + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF4); + assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFFFF) == (cJU_LEAF4_MAXPOP1-1)); + +// Get the address of the Leaf + PLeaf = (uint32_t *) P_JLL(Pjp->jp_Addr); + +// Extract 4 byte index Leaf to Word_t + j__udyCopy4toW(StageA, PLeaf, cJU_LEAF4_MAXPOP1); + +// Get the address of the Leaf and Value area + JUDYLCODE(Pjv = JL_LEAF4VALUEAREA(PLeaf, cJU_LEAF4_MAXPOP1);) + +// If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index) + + CIndex = StageA[0]; + if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF4_MAXPOP1-1], 4)) + { + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new Leaf. + +// Alloc a 3 byte Index Leaf + PjllRaw = j__udyAllocJLL3(cJU_LEAF4_MAXPOP1, Pjpm); + if (PjllRaw == (Pjlb_t)NULL) return(-1); // out of memory + + Pjll = P_JLL(PjllRaw); + +// Copy Index area into new Leaf + j__udyCopyWto3((uint8_t *) Pjll, StageA, cJU_LEAF4_MAXPOP1); +#ifdef JUDYL +// Copy Value area into new Leaf + Pjvnew = JL_LEAF3VALUEAREA(Pjll, cJU_LEAF4_MAXPOP1); + JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF4_MAXPOP1); +#endif + DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF4_MAXPOP1, 3);) + + DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(3)); + JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF3); + + return(1); + } + +// Else in 2+ expanses, splay Leaf into smaller leaves at higher compression + + StageJBB = StageJBBZero; // zero staged bitmap branch + ZEROJP(SubJPCount); + +// Splay the 4 byte index Leaf to 3 byte Index Leaves + for (ExpCnt = Start = 0, End = 1; ; End++) + { +// Check if new expanse or last one + if ( (End == cJU_LEAF4_MAXPOP1) + || + (JU_DIGITATSTATE(CIndex ^ StageA[End], 4)) + ) + { +// Build a leaf below the previous expanse + + Pjp_t PjpJP = StageJP + ExpCnt; + Word_t Pop1 = End - Start; + Word_t expanse = JU_DIGITATSTATE(CIndex, 4); + Word_t subexp = expanse / cJU_BITSPERSUBEXPB; +// +// set the bit that is the current expanse + JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse); +#ifdef SUBEXPCOUNTS + StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse +#endif +// count number of expanses in each subexpanse + SubJPCount[subexp]++; + +// Save byte expanse of leaf + StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 4); + + if (Pop1 == 1) // cJU_JPIMMED_3_01 + { + Word_t DcdP0; + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(3)) | + CIndex; +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_3_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, + cJL_JPIMMED_3_01); +#endif // JUDYL + } + else if (Pop1 <= cJU_IMMED3_MAXPOP1) + { +// cJ1_JPIMMED_3_02 : Judy1 32 +// cJL_JPIMMED_3_02 : JudyL 64 +// cJ1_JPIMMED_3_02..5: Judy1 64 + +#ifdef JUDYL +// Alloc is 1st in case of malloc fail + Pjv_t PjvnewRaw; // value area of new leaf. + Pjv_t Pjvnew; + +// Allocate Value area for Immediate Leaf + PjvnewRaw = j__udyLAllocJV(Pop1, Pjpm); + if (PjvnewRaw == (Pjv_t) NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjvnew = P_JV(PjvnewRaw); + +// Copy to Values to Value Leaf + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); + PjpJP->jp_Addr = (Word_t) PjvnewRaw; + +// Copy to Index to JP as an immediate Leaf + j__udyCopyWto3(PjpJP->jp_LIndex, + StageA + Start, Pop1); +#else + j__udyCopyWto3(PjpJP->jp_1Index, + StageA + Start, Pop1); +#endif +// Set type, population and Index size + PjpJP->jp_Type = cJU_JPIMMED_3_02 + Pop1 - 2; + } + else + { +// cJU_JPLEAF3 + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + + PjllRaw = j__udyAllocJLL3(Pop1, Pjpm); + if (PjllRaw == (Pjll_t)NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjll = P_JLL(PjllRaw); + +// Copy Indexes to new Leaf + j__udyCopyWto3((uint8_t *) Pjll, StageA + Start, + Pop1); +#ifdef JUDYL +// Copy to Values to new Leaf + Pjvnew = JL_LEAF3VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif + DBGCODE(JudyCheckSorted(Pjll, Pop1, 3);) + + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(4)) + | + (CIndex & cJU_DCDMASK(4-1)) + | + (Pop1 - 1); + + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0, + cJU_JPLEAF3); + } + ExpCnt++; +// Done? + if (End == cJU_LEAF4_MAXPOP1) break; + +// New Expanse, Start and Count + CIndex = StageA[End]; + Start = End; + } + } + +// Now put all the Leaves below a BranchL or BranchB: + if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL + { + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt, + Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_L4; + } + else + { + if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm) + == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + } + return(1); + +} // j__udyCascade4() + + +// **************************************************************************** +// __ J U D Y C A S C A D E 5 +// +// Cascade from a cJU_JPLEAF5 to one of the following: +// 1. if leaf is in 1 expanse: +// compress it into a JPLEAF4 +// 2. if leaf contains multiple expanses: +// create linear or bitmap branch containing +// each new expanse is either a: +// JPIMMED_4_01 branch +// JPLEAF4 + +FUNCTION int j__udyCascade5( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + uint8_t * PLeaf; // pointer to leaf, explicit type. + Word_t End, Start; // temporaries. + Word_t ExpCnt; // count of expanses of splay. + Word_t CIndex; // current Index word. +JUDYLCODE(Pjv_t Pjv;) // value area of leaf. + +// Temp staging for parts(Leaves) of newly splayed leaf + jp_t StageJP [cJU_LEAF5_MAXPOP1]; // JPs of new leaves + Word_t StageA [cJU_LEAF5_MAXPOP1]; + uint8_t StageExp [cJU_LEAF5_MAXPOP1]; // Expanses of new leaves + uint8_t SubJPCount[cJU_NUMSUBEXPB]; // JPs in each subexpanse + jbb_t StageJBB; // staged bitmap branch + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF5); + assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFFFFFF) == (cJU_LEAF5_MAXPOP1-1)); + +// Get the address of the Leaf + PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr); + +// Extract 5 byte index Leaf to Word_t + j__udyCopy5toW(StageA, PLeaf, cJU_LEAF5_MAXPOP1); + +// Get the address of the Leaf and Value area + JUDYLCODE(Pjv = JL_LEAF5VALUEAREA(PLeaf, cJU_LEAF5_MAXPOP1);) + +// If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index) + + CIndex = StageA[0]; + if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF5_MAXPOP1-1], 5)) + { + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Alloc a 4 byte Index Leaf + PjllRaw = j__udyAllocJLL4(cJU_LEAF5_MAXPOP1, Pjpm); + if (PjllRaw == (Pjlb_t)NULL) return(-1); // out of memory + + Pjll = P_JLL(PjllRaw); + +// Copy Index area into new Leaf + j__udyCopyWto4((uint8_t *) Pjll, StageA, cJU_LEAF5_MAXPOP1); +#ifdef JUDYL +// Copy Value area into new Leaf + Pjvnew = JL_LEAF4VALUEAREA(Pjll, cJU_LEAF5_MAXPOP1); + JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF5_MAXPOP1); +#endif + DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF5_MAXPOP1, 4);) + + DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(4)); + JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF4); + + return(1); + } + +// Else in 2+ expanses, splay Leaf into smaller leaves at higher compression + + StageJBB = StageJBBZero; // zero staged bitmap branch + ZEROJP(SubJPCount); + +// Splay the 5 byte index Leaf to 4 byte Index Leaves + for (ExpCnt = Start = 0, End = 1; ; End++) + { +// Check if new expanse or last one + if ( (End == cJU_LEAF5_MAXPOP1) + || + (JU_DIGITATSTATE(CIndex ^ StageA[End], 5)) + ) + { +// Build a leaf below the previous expanse + + Pjp_t PjpJP = StageJP + ExpCnt; + Word_t Pop1 = End - Start; + Word_t expanse = JU_DIGITATSTATE(CIndex, 5); + Word_t subexp = expanse / cJU_BITSPERSUBEXPB; +// +// set the bit that is the current expanse + JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse); +#ifdef SUBEXPCOUNTS + StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse +#endif +// count number of expanses in each subexpanse + SubJPCount[subexp]++; + +// Save byte expanse of leaf + StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 5); + + if (Pop1 == 1) // cJU_JPIMMED_4_01 + { + Word_t DcdP0; + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(4)) | + CIndex; +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_4_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, + cJL_JPIMMED_4_01); +#endif // JUDYL + } +#ifdef JUDY1 + else if (Pop1 <= cJ1_IMMED4_MAXPOP1) + { +// cJ1_JPIMMED_4_02..3: Judy1 64 + +// Copy to Index to JP as an immediate Leaf + j__udyCopyWto4(PjpJP->jp_1Index, + StageA + Start, Pop1); + +// Set pointer, type, population and Index size + PjpJP->jp_Type = cJ1_JPIMMED_4_02 + Pop1 - 2; + } +#endif + else + { +// cJU_JPLEAF4 + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Get a new Leaf + PjllRaw = j__udyAllocJLL4(Pop1, Pjpm); + if (PjllRaw == (Pjll_t)NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjll = P_JLL(PjllRaw); + +// Copy Indexes to new Leaf + j__udyCopyWto4((uint8_t *) Pjll, StageA + Start, + Pop1); +#ifdef JUDYL +// Copy to Values to new Leaf + Pjvnew = JL_LEAF4VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif + DBGCODE(JudyCheckSorted(Pjll, Pop1, 4);) + + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(5)) + | + (CIndex & cJU_DCDMASK(5-1)) + | + (Pop1 - 1); + + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0, + cJU_JPLEAF4); + } + ExpCnt++; +// Done? + if (End == cJU_LEAF5_MAXPOP1) break; + +// New Expanse, Start and Count + CIndex = StageA[End]; + Start = End; + } + } + +// Now put all the Leaves below a BranchL or BranchB: + if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL + { + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt, + Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_L5; + } + else + { + if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm) + == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + } + return(1); + +} // j__udyCascade5() + + +// **************************************************************************** +// __ J U D Y C A S C A D E 6 +// +// Cascade from a cJU_JPLEAF6 to one of the following: +// 1. if leaf is in 1 expanse: +// compress it into a JPLEAF5 +// 2. if leaf contains multiple expanses: +// create linear or bitmap branch containing +// each new expanse is either a: +// JPIMMED_5_01 ... JPIMMED_5_03 branch +// JPIMMED_5_01 branch +// JPLEAF5 + +FUNCTION int j__udyCascade6( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + uint8_t * PLeaf; // pointer to leaf, explicit type. + Word_t End, Start; // temporaries. + Word_t ExpCnt; // count of expanses of splay. + Word_t CIndex; // current Index word. +JUDYLCODE(Pjv_t Pjv;) // value area of leaf. + +// Temp staging for parts(Leaves) of newly splayed leaf + jp_t StageJP [cJU_LEAF6_MAXPOP1]; // JPs of new leaves + Word_t StageA [cJU_LEAF6_MAXPOP1]; + uint8_t StageExp [cJU_LEAF6_MAXPOP1]; // Expanses of new leaves + uint8_t SubJPCount[cJU_NUMSUBEXPB]; // JPs in each subexpanse + jbb_t StageJBB; // staged bitmap branch + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF6); + assert((JU_JPDCDPOP0(Pjp) & 0xFFFFFFFFFFFF) == (cJU_LEAF6_MAXPOP1-1)); + +// Get the address of the Leaf + PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr); + +// Extract 6 byte index Leaf to Word_t + j__udyCopy6toW(StageA, PLeaf, cJU_LEAF6_MAXPOP1); + +// Get the address of the Leaf and Value area + JUDYLCODE(Pjv = JL_LEAF6VALUEAREA(PLeaf, cJU_LEAF6_MAXPOP1);) + +// If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index) + + CIndex = StageA[0]; + if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF6_MAXPOP1-1], 6)) + { + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Alloc a 5 byte Index Leaf + PjllRaw = j__udyAllocJLL5(cJU_LEAF6_MAXPOP1, Pjpm); + if (PjllRaw == (Pjlb_t)NULL) return(-1); // out of memory + + Pjll = P_JLL(PjllRaw); + +// Copy Index area into new Leaf + j__udyCopyWto5((uint8_t *) Pjll, StageA, cJU_LEAF6_MAXPOP1); +#ifdef JUDYL +// Copy Value area into new Leaf + Pjvnew = JL_LEAF5VALUEAREA(Pjll, cJU_LEAF6_MAXPOP1); + JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF6_MAXPOP1); +#endif + DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF6_MAXPOP1, 5);) + + DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(5)); + JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF5); + + return(1); + } + +// Else in 2+ expanses, splay Leaf into smaller leaves at higher compression + + StageJBB = StageJBBZero; // zero staged bitmap branch + ZEROJP(SubJPCount); + +// Splay the 6 byte index Leaf to 5 byte Index Leaves + for (ExpCnt = Start = 0, End = 1; ; End++) + { +// Check if new expanse or last one + if ( (End == cJU_LEAF6_MAXPOP1) + || + (JU_DIGITATSTATE(CIndex ^ StageA[End], 6)) + ) + { +// Build a leaf below the previous expanse + + Pjp_t PjpJP = StageJP + ExpCnt; + Word_t Pop1 = End - Start; + Word_t expanse = JU_DIGITATSTATE(CIndex, 6); + Word_t subexp = expanse / cJU_BITSPERSUBEXPB; +// +// set the bit that is the current expanse + JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse); +#ifdef SUBEXPCOUNTS + StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse +#endif +// count number of expanses in each subexpanse + SubJPCount[subexp]++; + +// Save byte expanse of leaf + StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 6); + + if (Pop1 == 1) // cJU_JPIMMED_5_01 + { + Word_t DcdP0; + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(5)) | + CIndex; +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_5_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, + cJL_JPIMMED_5_01); +#endif // JUDYL + } +#ifdef JUDY1 + else if (Pop1 <= cJ1_IMMED5_MAXPOP1) + { +// cJ1_JPIMMED_5_02..3: Judy1 64 + +// Copy to Index to JP as an immediate Leaf + j__udyCopyWto5(PjpJP->jp_1Index, + StageA + Start, Pop1); + +// Set pointer, type, population and Index size + PjpJP->jp_Type = cJ1_JPIMMED_5_02 + Pop1 - 2; + } +#endif + else + { +// cJU_JPLEAF5 + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Get a new Leaf + PjllRaw = j__udyAllocJLL5(Pop1, Pjpm); + if (PjllRaw == (Pjll_t)NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjll = P_JLL(PjllRaw); + +// Copy Indexes to new Leaf + j__udyCopyWto5((uint8_t *) Pjll, StageA + Start, + Pop1); + +// Copy to Values to new Leaf +#ifdef JUDYL + Pjvnew = JL_LEAF5VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif + DBGCODE(JudyCheckSorted(Pjll, Pop1, 5);) + + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(6)) + | + (CIndex & cJU_DCDMASK(6-1)) + | + (Pop1 - 1); + + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0, + cJU_JPLEAF5); + } + ExpCnt++; +// Done? + if (End == cJU_LEAF6_MAXPOP1) break; + +// New Expanse, Start and Count + CIndex = StageA[End]; + Start = End; + } + } + +// Now put all the Leaves below a BranchL or BranchB: + if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL + { + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt, + Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_L6; + } + else + { + if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm) + == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + } + return(1); + +} // j__udyCascade6() + + +// **************************************************************************** +// __ J U D Y C A S C A D E 7 +// +// Cascade from a cJU_JPLEAF7 to one of the following: +// 1. if leaf is in 1 expanse: +// compress it into a JPLEAF6 +// 2. if leaf contains multiple expanses: +// create linear or bitmap branch containing +// each new expanse is either a: +// JPIMMED_6_01 ... JPIMMED_6_02 branch +// JPIMMED_6_01 branch +// JPLEAF6 + +FUNCTION int j__udyCascade7( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + uint8_t * PLeaf; // pointer to leaf, explicit type. + Word_t End, Start; // temporaries. + Word_t ExpCnt; // count of expanses of splay. + Word_t CIndex; // current Index word. +JUDYLCODE(Pjv_t Pjv;) // value area of leaf. + +// Temp staging for parts(Leaves) of newly splayed leaf + jp_t StageJP [cJU_LEAF7_MAXPOP1]; // JPs of new leaves + Word_t StageA [cJU_LEAF7_MAXPOP1]; + uint8_t StageExp [cJU_LEAF7_MAXPOP1]; // Expanses of new leaves + uint8_t SubJPCount[cJU_NUMSUBEXPB]; // JPs in each subexpanse + jbb_t StageJBB; // staged bitmap branch + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF7); + assert(JU_JPDCDPOP0(Pjp) == (cJU_LEAF7_MAXPOP1-1)); + +// Get the address of the Leaf + PLeaf = (uint8_t *) P_JLL(Pjp->jp_Addr); + +// Extract 7 byte index Leaf to Word_t + j__udyCopy7toW(StageA, PLeaf, cJU_LEAF7_MAXPOP1); + +// Get the address of the Leaf and Value area + JUDYLCODE(Pjv = JL_LEAF7VALUEAREA(PLeaf, cJU_LEAF7_MAXPOP1);) + +// If Leaf is in 1 expanse -- just compress it (compare 1st, last & Index) + + CIndex = StageA[0]; + if (!JU_DIGITATSTATE(CIndex ^ StageA[cJU_LEAF7_MAXPOP1-1], 7)) + { + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Alloc a 6 byte Index Leaf + PjllRaw = j__udyAllocJLL6(cJU_LEAF7_MAXPOP1, Pjpm); + if (PjllRaw == (Pjlb_t)NULL) return(-1); // out of memory + + Pjll = P_JLL(PjllRaw); + +// Copy Index area into new Leaf + j__udyCopyWto6((uint8_t *) Pjll, StageA, cJU_LEAF7_MAXPOP1); +#ifdef JUDYL +// Copy Value area into new Leaf + Pjvnew = JL_LEAF6VALUEAREA(Pjll, cJU_LEAF7_MAXPOP1); + JU_COPYMEM(Pjvnew, Pjv, cJU_LEAF7_MAXPOP1); +#endif + DBGCODE(JudyCheckSorted(Pjll, cJU_LEAF7_MAXPOP1, 6);) + + DcdP0 = JU_JPDCDPOP0(Pjp) | (CIndex & cJU_DCDMASK(6)); + JU_JPSETADT(Pjp, (Word_t)PjllRaw, DcdP0, cJU_JPLEAF6); + + return(1); + } + +// Else in 2+ expanses, splay Leaf into smaller leaves at higher compression + + StageJBB = StageJBBZero; // zero staged bitmap branch + ZEROJP(SubJPCount); + +// Splay the 7 byte index Leaf to 6 byte Index Leaves + for (ExpCnt = Start = 0, End = 1; ; End++) + { +// Check if new expanse or last one + if ( (End == cJU_LEAF7_MAXPOP1) + || + (JU_DIGITATSTATE(CIndex ^ StageA[End], 7)) + ) + { +// Build a leaf below the previous expanse + + Pjp_t PjpJP = StageJP + ExpCnt; + Word_t Pop1 = End - Start; + Word_t expanse = JU_DIGITATSTATE(CIndex, 7); + Word_t subexp = expanse / cJU_BITSPERSUBEXPB; +// +// set the bit that is the current expanse + JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse); +#ifdef SUBEXPCOUNTS + StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse +#endif +// count number of expanses in each subexpanse + SubJPCount[subexp]++; + +// Save byte expanse of leaf + StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, 7); + + if (Pop1 == 1) // cJU_JPIMMED_6_01 + { + Word_t DcdP0; + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(6)) | + CIndex; +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, DcdP0, cJ1_JPIMMED_6_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], DcdP0, + cJL_JPIMMED_6_01); +#endif // JUDYL + } +#ifdef JUDY1 + else if (Pop1 == cJ1_IMMED6_MAXPOP1) + { +// cJ1_JPIMMED_6_02: Judy1 64 + +// Copy to Index to JP as an immediate Leaf + j__udyCopyWto6(PjpJP->jp_1Index, + StageA + Start, 2); + +// Set pointer, type, population and Index size + PjpJP->jp_Type = cJ1_JPIMMED_6_02; + } +#endif + else + { +// cJU_JPLEAF6 + Word_t DcdP0; + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Get a new Leaf + PjllRaw = j__udyAllocJLL6(Pop1, Pjpm); + if (PjllRaw == (Pjll_t)NULL) + FREEALLEXIT(ExpCnt, StageJP, Pjpm); + Pjll = P_JLL(PjllRaw); + +// Copy Indexes to new Leaf + j__udyCopyWto6((uint8_t *) Pjll, StageA + Start, + Pop1); +#ifdef JUDYL +// Copy to Values to new Leaf + Pjvnew = JL_LEAF6VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif + DBGCODE(JudyCheckSorted(Pjll, Pop1, 6);) + + DcdP0 = (JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(7)) + | + (CIndex & cJU_DCDMASK(7-1)) + | + (Pop1 - 1); + + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, DcdP0, + cJU_JPLEAF6); + } + ExpCnt++; +// Done? + if (End == cJU_LEAF7_MAXPOP1) break; + +// New Expanse, Start and Count + CIndex = StageA[End]; + Start = End; + } + } + +// Now put all the Leaves below a BranchL or BranchB: + if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL + { + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt, + Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_L7; + } + else + { + if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm) + == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + } + return(1); + +} // j__udyCascade7() + +#endif // JU_64BIT + + +// **************************************************************************** +// __ J U D Y C A S C A D E L +// +// (Compressed) cJU_LEAF3[7], cJ1_JPBRANCH_L. +// +// Cascade from a LEAFW (under Pjp) to one of the following: +// 1. if LEAFW is in 1 expanse: +// create linear branch with a JPLEAF3[7] under it +// 2. LEAFW contains multiple expanses: +// create linear or bitmap branch containing new expanses +// each new expanse is either a: 32 64 +// JPIMMED_3_01 branch Y N +// JPIMMED_7_01 branch N Y +// JPLEAF3 Y N +// JPLEAF7 N Y + +FUNCTION int j__udyCascadeL( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + Pjlw_t Pjlw; // leaf to work on. + Word_t End, Start; // temporaries. + Word_t ExpCnt; // count of expanses of splay. + Word_t CIndex; // current Index word. +JUDYLCODE(Pjv_t Pjv;) // value area of leaf. + +// Temp staging for parts(Leaves) of newly splayed leaf + jp_t StageJP [cJU_LEAFW_MAXPOP1]; + uint8_t StageExp[cJU_LEAFW_MAXPOP1]; + uint8_t SubJPCount[cJU_NUMSUBEXPB]; // JPs in each subexpanse + jbb_t StageJBB; // staged bitmap branch + +// Get the address of the Leaf + Pjlw = P_JLW(Pjp->jp_Addr); + + assert(Pjlw[0] == (cJU_LEAFW_MAXPOP1 - 1)); + +// Get pointer to Value area of old Leaf + JUDYLCODE(Pjv = JL_LEAFWVALUEAREA(Pjlw, cJU_LEAFW_MAXPOP1);) + + Pjlw++; // Now point to Index area + +// If Leaf is in 1 expanse -- first compress it (compare 1st, last & Index): + + CIndex = Pjlw[0]; // also used far below + if (!JU_DIGITATSTATE(CIndex ^ Pjlw[cJU_LEAFW_MAXPOP1 - 1], + cJU_ROOTSTATE)) + { + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. + +// Get the common expanse to all elements in Leaf + StageExp[0] = JU_DIGITATSTATE(CIndex, cJU_ROOTSTATE); + +// Alloc a 3[7] byte Index Leaf +#ifdef JU_64BIT + PjllRaw = j__udyAllocJLL7(cJU_LEAFW_MAXPOP1, Pjpm); + if (PjllRaw == (Pjlb_t)NULL) return(-1); // out of memory + + Pjll = P_JLL(PjllRaw); + +// Copy LEAFW to a cJU_JPLEAF7 + j__udyCopyWto7((uint8_t *) Pjll, Pjlw, cJU_LEAFW_MAXPOP1); +#ifdef JUDYL +// Get the Value area of new Leaf + Pjvnew = JL_LEAF7VALUEAREA(Pjll, cJU_LEAFW_MAXPOP1); + JU_COPYMEM(Pjvnew, Pjv, cJU_LEAFW_MAXPOP1); +#endif + DBGCODE(JudyCheckSorted(Pjll, cJU_LEAFW_MAXPOP1, 7);) +#else // 32 Bit + PjllRaw = j__udyAllocJLL3(cJU_LEAFW_MAXPOP1, Pjpm); + if (PjllRaw == (Pjll_t) NULL) return(-1); + + Pjll = P_JLL(PjllRaw); + +// Copy LEAFW to a cJU_JPLEAF3 + j__udyCopyWto3((uint8_t *) Pjll, Pjlw, cJU_LEAFW_MAXPOP1); +#ifdef JUDYL +// Get the Value area of new Leaf + Pjvnew = JL_LEAF3VALUEAREA(Pjll, cJU_LEAFW_MAXPOP1); + JU_COPYMEM(Pjvnew, Pjv, cJU_LEAFW_MAXPOP1); +#endif + DBGCODE(JudyCheckSorted(Pjll, cJU_LEAFW_MAXPOP1, 3);) +#endif // 32 Bit + +// Following not needed because cJU_DCDMASK(3[7]) is == 0 +////// StageJP[0].jp_DcdPopO |= (CIndex & cJU_DCDMASK(3[7])); +#ifdef JU_64BIT + JU_JPSETADT(&(StageJP[0]), (Word_t)PjllRaw, cJU_LEAFW_MAXPOP1-1, + cJU_JPLEAF7); +#else // 32BIT + JU_JPSETADT(&(StageJP[0]), (Word_t)PjllRaw, cJU_LEAFW_MAXPOP1-1, + cJU_JPLEAF3); +#endif // 32BIT +// Create a 1 element Linear branch + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, 1, Pjpm) == -1) + return(-1); + +// Change the type of callers JP + Pjp->jp_Type = cJU_JPBRANCH_L; + + return(1); + } + +// Else in 2+ expanses, splay Leaf into smaller leaves at higher compression + + StageJBB = StageJBBZero; // zero staged bitmap branch + ZEROJP(SubJPCount); + +// Splay the 4[8] byte Index Leaf to 3[7] byte Index Leaves + for (ExpCnt = Start = 0, End = 1; ; End++) + { +// Check if new expanse or last one + if ( (End == cJU_LEAFW_MAXPOP1) + || + (JU_DIGITATSTATE(CIndex ^ Pjlw[End], cJU_ROOTSTATE)) + ) + { +// Build a leaf below the previous expanse + + Pjp_t PjpJP = StageJP + ExpCnt; + Word_t Pop1 = End - Start; + Word_t expanse = JU_DIGITATSTATE(CIndex, cJU_ROOTSTATE); + Word_t subexp = expanse / cJU_BITSPERSUBEXPB; +// +// set the bit that is the current expanse + JU_JBB_BITMAP(&StageJBB, subexp) |= JU_BITPOSMASKB(expanse); +#ifdef SUBEXPCOUNTS + StageJBB.jbb_subPop1[subexp] += Pop1; // pop of subexpanse +#endif +// count number of expanses in each subexpanse + SubJPCount[subexp]++; + +// Save byte expanse of leaf + StageExp[ExpCnt] = JU_DIGITATSTATE(CIndex, + cJU_ROOTSTATE); + + if (Pop1 == 1) // cJU_JPIMMED_3[7]_01 + { +#ifdef JU_64BIT +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, CIndex, cJ1_JPIMMED_7_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], CIndex, + cJL_JPIMMED_7_01); +#endif // JUDYL + +#else // JU_32BIT +#ifdef JUDY1 + JU_JPSETADT(PjpJP, 0, CIndex, cJ1_JPIMMED_3_01); +#else // JUDYL + JU_JPSETADT(PjpJP, Pjv[Start], CIndex, + cJL_JPIMMED_3_01); +#endif // JUDYL +#endif // JU_32BIT + } +#ifdef JUDY1 +#ifdef JU_64BIT + else if (Pop1 <= cJ1_IMMED7_MAXPOP1) +#else + else if (Pop1 <= cJ1_IMMED3_MAXPOP1) +#endif + { +// cJ1_JPIMMED_3_02 : Judy1 32 +// cJ1_JPIMMED_7_02 : Judy1 64 +// Copy to JP as an immediate Leaf +#ifdef JU_64BIT + j__udyCopyWto7(PjpJP->jp_1Index, Pjlw+Start, 2); + PjpJP->jp_Type = cJ1_JPIMMED_7_02; +#else + j__udyCopyWto3(PjpJP->jp_1Index, Pjlw+Start, 2); + PjpJP->jp_Type = cJ1_JPIMMED_3_02; +#endif // 32 Bit + } +#endif // JUDY1 + else // Linear Leaf JPLEAF3[7] + { +// cJU_JPLEAF3[7] + Pjll_t PjllRaw; // pointer to new leaf. + Pjll_t Pjll; + JUDYLCODE(Pjv_t Pjvnew;) // value area of new leaf. +#ifdef JU_64BIT + PjllRaw = j__udyAllocJLL7(Pop1, Pjpm); + if (PjllRaw == (Pjll_t) NULL) return(-1); + Pjll = P_JLL(PjllRaw); + + j__udyCopyWto7((uint8_t *) Pjll, Pjlw + Start, + Pop1); +#ifdef JUDYL + Pjvnew = JL_LEAF7VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif // JUDYL + DBGCODE(JudyCheckSorted(Pjll, Pop1, 7);) +#else // JU_64BIT - 32 Bit + PjllRaw = j__udyAllocJLL3(Pop1, Pjpm); + if (PjllRaw == (Pjll_t) NULL) return(-1); + Pjll = P_JLL(PjllRaw); + + j__udyCopyWto3((uint8_t *) Pjll, Pjlw + Start, + Pop1); +#ifdef JUDYL + Pjvnew = JL_LEAF3VALUEAREA(Pjll, Pop1); + JU_COPYMEM(Pjvnew, Pjv + Start, Pop1); +#endif // JUDYL + DBGCODE(JudyCheckSorted(Pjll, Pop1, 3);) +#endif // 32 Bit + +#ifdef JU_64BIT + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, Pop1 - 1, + cJU_JPLEAF7); +#else // JU_64BIT - 32 Bit + JU_JPSETADT(PjpJP, (Word_t)PjllRaw, Pop1 - 1, + cJU_JPLEAF3); +#endif // 32 Bit + } + ExpCnt++; +// Done? + if (End == cJU_LEAFW_MAXPOP1) break; + +// New Expanse, Start and Count + CIndex = Pjlw[End]; + Start = End; + } + } + +// Now put all the Leaves below a BranchL or BranchB: + if (ExpCnt <= cJU_BRANCHLMAXJPS) // put the Leaves below a BranchL + { + if (j__udyCreateBranchL(Pjp, StageJP, StageExp, ExpCnt, + Pjpm) == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_L; + } + else + { + if (j__udyStageJBBtoJBB(Pjp, &StageJBB, StageJP, SubJPCount, Pjpm) + == -1) FREEALLEXIT(ExpCnt, StageJP, Pjpm); + + Pjp->jp_Type = cJU_JPBRANCH_B; // cJU_LEAFW is out of sequence + } + return(1); + +} // j__udyCascadeL() diff --git a/libnetdata/libjudy/src/JudyL/JudyLCount.c b/libnetdata/libjudy/src/JudyL/JudyLCount.c new file mode 100644 index 000000000..179757f0a --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLCount.c @@ -0,0 +1,1195 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.78 $ $Source: /judy/src/JudyCommon/JudyCount.c $ +// +// Judy*Count() function for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// Compile with -DNOSMARTJBB, -DNOSMARTJBU, and/or -DNOSMARTJLB to build a +// version with cache line optimizations deleted, for testing. +// +// Compile with -DSMARTMETRICS to obtain global variables containing smart +// cache line metrics. Note: Dont turn this on simultaneously for this file +// and JudyByCount.c because they export the same globals. +// +// Judy*Count() returns the "count of Indexes" (inclusive) between the two +// specified limits (Indexes). This code is remarkably fast. It traverses the +// "Judy array" data structure. +// +// This count code is the GENERIC untuned version (minimum code size). It +// might be possible to tuned to a specific architecture to be faster. +// However, in real applications, with a modern machine, it is expected that +// the instruction times will be swamped by cache line fills. +// **************************************************************************** + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + + +// define a phoney that is for sure + +#define cJU_LEAFW cJU_JPIMMED_CAP + +// Avoid duplicate symbols since this file is multi-compiled: + +#ifdef SMARTMETRICS +#ifdef JUDY1 +Word_t jbb_upward = 0; // counts of directions taken: +Word_t jbb_downward = 0; +Word_t jbu_upward = 0; +Word_t jbu_downward = 0; +Word_t jlb_upward = 0; +Word_t jlb_downward = 0; +#else +extern Word_t jbb_upward; +extern Word_t jbb_downward; +extern Word_t jbu_upward; +extern Word_t jbu_downward; +extern Word_t jlb_upward; +extern Word_t jlb_downward; +#endif +#endif + + +// FORWARD DECLARATIONS (prototypes): + +static Word_t j__udy1LCountSM(const Pjp_t Pjp, const Word_t Index, + const Pjpm_t Pjpm); + +// Each of Judy1 and JudyL get their own private (static) version of this +// function: + +static int j__udyCountLeafB1(const Pjll_t Pjll, const Word_t Pop1, + const Word_t Index); + +// These functions are not static because they are exported to Judy*ByCount(): +// +// TBD: Should be made static for performance reasons? And thus duplicated? +// +// Note: There really are two different functions, but for convenience they +// are referred to here with a generic name. + +#ifdef JUDY1 +#define j__udyJPPop1 j__udy1JPPop1 +#else +#define j__udyJPPop1 j__udyLJPPop1 +#endif + +Word_t j__udyJPPop1(const Pjp_t Pjp); + + +// LOCAL ERROR HANDLING: +// +// The Judy*Count() functions are unusual because they return 0 instead of JERR +// for an error. In this source file, define C_JERR for clarity. + +#define C_JERR 0 + + +// **************************************************************************** +// J U D Y 1 C O U N T +// J U D Y L C O U N T +// +// See the manual entry for details. +// +// This code is written recursively, at least at first, because thats much +// simpler; hope its fast enough. + +#ifdef JUDY1 +FUNCTION Word_t Judy1Count +#else +FUNCTION Word_t JudyLCount +#endif + ( + Pcvoid_t PArray, // JRP to first branch/leaf in SM. + Word_t Index1, // starting Index. + Word_t Index2, // ending Index. + PJError_t PJError // optional, for returning error info. + ) +{ + jpm_t fakejpm; // local temporary for small arrays. + Pjpm_t Pjpm; // top JPM or local temporary for error info. + jp_t fakejp; // constructed for calling j__udy1LCountSM(). + Pjp_t Pjp; // JP to pass to j__udy1LCountSM(). + Word_t pop1; // total for the array. + Word_t pop1above1; // indexes at or above Index1, inclusive. + Word_t pop1above2; // indexes at or above Index2, exclusive. + int retcode; // from Judy*First() calls. +JUDYLCODE(PPvoid_t PPvalue); // from JudyLFirst() calls. + + +// CHECK FOR SHORTCUTS: +// +// As documented, return C_JERR if the Judy array is empty or Index1 > Index2. + + if ((PArray == (Pvoid_t) NULL) || (Index1 > Index2)) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NONE); + return(C_JERR); + } + +// If Index1 == Index2, simply check if the specified Index is set; pass +// through the return value from Judy1Test() or JudyLGet() with appropriate +// translations. + + if (Index1 == Index2) + { +#ifdef JUDY1 + retcode = Judy1Test(PArray, Index1, PJError); + + if (retcode == JERRI) return(C_JERR); // pass through error. + + if (retcode == 0) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NONE); + return(C_JERR); + } +#else + PPvalue = JudyLGet(PArray, Index1, PJError); + + if (PPvalue == PPJERR) return(C_JERR); // pass through error. + + if (PPvalue == (PPvoid_t) NULL) // Index is not set. + { + JU_SET_ERRNO(PJError, JU_ERRNO_NONE); + return(C_JERR); + } +#endif + return(1); // single index is set. + } + + +// CHECK JRP TYPE: +// +// Use an if/then for speed rather than a switch, and put the most common cases +// first. +// +// Note: Since even cJU_LEAFW types require counting between two Indexes, +// prepare them here for common code below that calls j__udy1LCountSM(), rather +// than handling them even more specially here. + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + Pjpm = & fakejpm; + Pjp = & fakejp; + Pjp->jp_Addr = (Word_t) Pjlw; + Pjp->jp_Type = cJU_LEAFW; + Pjpm->jpm_Pop0 = Pjlw[0]; // from first word of leaf. + pop1 = Pjpm->jpm_Pop0 + 1; + } + else + { + Pjpm = P_JPM(PArray); + Pjp = &(Pjpm->jpm_JP); + pop1 = (Pjpm->jpm_Pop0) + 1; // note: can roll over to 0. + +#if (defined(JUDY1) && (! defined(JU_64BIT))) + if (pop1 == 0) // rare special case of full array: + { + Word_t count = Index2 - Index1 + 1; // can roll over again. + + if (count == 0) + { + JU_SET_ERRNO(PJError, JU_ERRNO_FULL); + return(C_JERR); + } + return(count); + } +#else + assert(pop1); // JudyL or 64-bit cannot create a full array! +#endif + } + + +// COUNT POP1 ABOVE INDEX1, INCLUSIVE: + + assert(pop1); // just to be safe. + + if (Index1 == 0) // shortcut, pop1above1 is entire population: + { + pop1above1 = pop1; + } + else // find first valid Index above Index1, if any: + { +#ifdef JUDY1 + if ((retcode = Judy1First(PArray, & Index1, PJError)) == JERRI) + return(C_JERR); // pass through error. +#else + if ((PPvalue = JudyLFirst(PArray, & Index1, PJError)) == PPJERR) + return(C_JERR); // pass through error. + + retcode = (PPvalue != (PPvoid_t) NULL); // found a next Index. +#endif + +// If theres no Index at or above Index1, just return C_JERR (early exit): + + if (retcode == 0) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NONE); + return(C_JERR); + } + +// If a first/next Index was found, call the counting motor starting with that +// known valid Index, meaning the return should be positive, not C_JERR except +// in case of a real error: + + if ((pop1above1 = j__udy1LCountSM(Pjp, Index1, Pjpm)) == C_JERR) + { + JU_COPY_ERRNO(PJError, Pjpm); // pass through error. + return(C_JERR); + } + } + + +// COUNT POP1 ABOVE INDEX2, EXCLUSIVE, AND RETURN THE DIFFERENCE: +// +// In principle, calculate the ordinal of each Index and take the difference, +// with caution about off-by-one errors due to the specified Indexes being set +// or unset. In practice: +// +// - The ordinals computed here are inverse ordinals, that is, the populations +// ABOVE the specified Indexes (Index1 inclusive, Index2 exclusive), so +// subtract pop1above2 from pop1above1, rather than vice-versa. +// +// - Index1s result already includes a count for Index1 and/or Index2 if +// either is set, so calculate pop1above2 exclusive of Index2. +// +// TBD: If Index1 and Index2 fall in the same expanse in the top-state +// branch(es), would it be faster to walk the SM only once, to their divergence +// point, before calling j__udy1LCountSM() or equivalent? Possibly a non-issue +// if a top-state pop1 becomes stored with each Judy1 array. Also, consider +// whether the first call of j__udy1LCountSM() fills the cache, for common tree +// branches, for the second call. +// +// As for pop1above1, look for shortcuts for special cases when pop1above2 is +// zero. Otherwise call the counting "motor". + + assert(pop1above1); // just to be safe. + + if (Index2++ == cJU_ALLONES) return(pop1above1); // Index2 at limit. + +#ifdef JUDY1 + if ((retcode = Judy1First(PArray, & Index2, PJError)) == JERRI) + return(C_JERR); +#else + if ((PPvalue = JudyLFirst(PArray, & Index2, PJError)) == PPJERR) + return(C_JERR); + + retcode = (PPvalue != (PPvoid_t) NULL); // found a next Index. +#endif + if (retcode == 0) return(pop1above1); // no Index above Index2. + +// Just as for Index1, j__udy1LCountSM() cannot return 0 (locally == C_JERR) +// except in case of a real error: + + if ((pop1above2 = j__udy1LCountSM(Pjp, Index2, Pjpm)) == C_JERR) + { + JU_COPY_ERRNO(PJError, Pjpm); // pass through error. + return(C_JERR); + } + + if (pop1above1 == pop1above2) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NONE); + return(C_JERR); + } + + return(pop1above1 - pop1above2); + +} // Judy1Count() / JudyLCount() + + +// **************************************************************************** +// __ J U D Y 1 L C O U N T S M +// +// Given a pointer to a JP (with invalid jp_DcdPopO at cJU_ROOTSTATE), a known +// valid Index, and a Pjpm for returning error info, recursively visit a Judy +// array state machine (SM) and return the count of Indexes, including Index, +// through the end of the Judy array at this state or below. In case of error +// or a count of 0 (should never happen), return C_JERR with appropriate +// JU_ERRNO in the Pjpm. +// +// Note: This function is not told the current state because its encoded in +// the JP Type. +// +// Method: To minimize cache line fills, while studying each branch, if Index +// resides above the midpoint of the branch (which often consists of multiple +// cache lines), ADD the populations at or above Index; otherwise, SUBTRACT +// from the population of the WHOLE branch (available from the JP) the +// populations at or above Index. This is especially tricky for bitmap +// branches. +// +// Note: Unlike, say, the Ins and Del walk routines, this function returns the +// same type of returns as Judy*Count(), so it can use *_SET_ERRNO*() macros +// the same way. + +FUNCTION static Word_t j__udy1LCountSM( +const Pjp_t Pjp, // top of Judy (sub)SM. +const Word_t Index, // count at or above this Index. +const Pjpm_t Pjpm) // for returning error info. +{ + Pjbl_t Pjbl; // Pjp->jp_Addr masked and cast to types: + Pjbb_t Pjbb; + Pjbu_t Pjbu; + Pjll_t Pjll; // a Judy lower-level linear leaf. + + Word_t digit; // next digit to decode from Index. + long jpnum; // JP number in a branch (base 0). + int offset; // index ordinal within a leaf, base 0. + Word_t pop1; // total population of an expanse. + Word_t pop1above; // to return. + +// Common code to check Decode bits in a JP against the equivalent portion of +// Index; XOR together, then mask bits of interest; must be all 0: +// +// Note: Why does this code only assert() compliance rather than actively +// checking for outliers? Its because Index is supposed to be valid, hence +// always match any Dcd bits traversed. +// +// Note: This assertion turns out to be always true for cState = 3 on 32-bit +// and 7 on 64-bit, but its harmless, probably removed by the compiler. + +#define CHECKDCD(Pjp,cState) \ + assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cState)) + +// Common code to prepare to handle a root-level or lower-level branch: +// Extract a state-dependent digit from Index in a "constant" way, obtain the +// total population for the branch in a state-dependent way, and then branch to +// common code for multiple cases: +// +// For root-level branches, the state is always cJU_ROOTSTATE, and the +// population is received in Pjpm->jpm_Pop0. +// +// Note: The total population is only needed in cases where the common code +// "counts up" instead of down to minimize cache line fills. However, its +// available cheaply, and its better to do it with a constant shift (constant +// state value) instead of a variable shift later "when needed". + +#define PREPB_ROOT(Pjp,Next) \ + digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); \ + pop1 = (Pjpm->jpm_Pop0) + 1; \ + goto Next + +#define PREPB(Pjp,cState,Next) \ + digit = JU_DIGITATSTATE(Index, cState); \ + pop1 = JU_JPBRANCH_POP0(Pjp, (cState)) + 1; \ + goto Next + + +// SWITCH ON JP TYPE: +// +// WARNING: For run-time efficiency the following cases replicate code with +// varying constants, rather than using common code with variable values! + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// ROOT-STATE LEAF that starts with a Pop0 word; just count within the leaf: + + case cJU_LEAFW: + { + Pjlw_t Pjlw = P_JLW(Pjp->jp_Addr); // first word of leaf. + + assert((Pjpm->jpm_Pop0) + 1 == Pjlw[0] + 1); // sent correctly. + offset = j__udySearchLeafW(Pjlw + 1, Pjpm->jpm_Pop0 + 1, Index); + assert(offset >= 0); // Index must exist. + assert(offset < (Pjpm->jpm_Pop0) + 1); // Index be in range. + return((Pjpm->jpm_Pop0) + 1 - offset); // INCLUSIVE of Index. + } + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH; count populations in JPs in the JBL ABOVE the next digit in +// Index, and recurse for the next digit in Index: +// +// Note: There are no null JPs in a JBL; watch out for pop1 == 0. +// +// Note: A JBL should always fit in one cache line => no need to count up +// versus down to save cache line fills. (PREPB() sets pop1 for no reason.) + + case cJU_JPBRANCH_L2: CHECKDCD(Pjp, 2); PREPB(Pjp, 2, BranchL); + case cJU_JPBRANCH_L3: CHECKDCD(Pjp, 3); PREPB(Pjp, 3, BranchL); + +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: CHECKDCD(Pjp, 4); PREPB(Pjp, 4, BranchL); + case cJU_JPBRANCH_L5: CHECKDCD(Pjp, 5); PREPB(Pjp, 5, BranchL); + case cJU_JPBRANCH_L6: CHECKDCD(Pjp, 6); PREPB(Pjp, 6, BranchL); + case cJU_JPBRANCH_L7: CHECKDCD(Pjp, 7); PREPB(Pjp, 7, BranchL); +#endif + case cJU_JPBRANCH_L: PREPB_ROOT(Pjp, BranchL); + +// Common code (state-independent) for all cases of linear branches: + +BranchL: + + Pjbl = P_JBL(Pjp->jp_Addr); + jpnum = Pjbl->jbl_NumJPs; // above last JP. + pop1above = 0; + + while (digit < (Pjbl->jbl_Expanse[--jpnum])) // still ABOVE digit. + { + if ((pop1 = j__udyJPPop1((Pjbl->jbl_jp) + jpnum)) == cJU_ALLONES) + { + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); + return(C_JERR); + } + + pop1above += pop1; + assert(jpnum > 0); // should find digit. + } + + assert(digit == (Pjbl->jbl_Expanse[jpnum])); // should find digit. + + pop1 = j__udy1LCountSM((Pjbl->jbl_jp) + jpnum, Index, Pjpm); + if (pop1 == C_JERR) return(C_JERR); // pass error up. + + assert(pop1above + pop1); + return(pop1above + pop1); + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH; count populations in JPs in the JBB ABOVE the next digit in +// Index, and recurse for the next digit in Index: +// +// Note: There are no null JPs in a JBB; watch out for pop1 == 0. + + case cJU_JPBRANCH_B2: CHECKDCD(Pjp, 2); PREPB(Pjp, 2, BranchB); + case cJU_JPBRANCH_B3: CHECKDCD(Pjp, 3); PREPB(Pjp, 3, BranchB); +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: CHECKDCD(Pjp, 4); PREPB(Pjp, 4, BranchB); + case cJU_JPBRANCH_B5: CHECKDCD(Pjp, 5); PREPB(Pjp, 5, BranchB); + case cJU_JPBRANCH_B6: CHECKDCD(Pjp, 6); PREPB(Pjp, 6, BranchB); + case cJU_JPBRANCH_B7: CHECKDCD(Pjp, 7); PREPB(Pjp, 7, BranchB); +#endif + case cJU_JPBRANCH_B: PREPB_ROOT(Pjp, BranchB); + +// Common code (state-independent) for all cases of bitmap branches: + +BranchB: + { + long subexp; // for stepping through layer 1 (subexpanses). + long findsub; // subexpanse containing Index (digit). + Word_t findbit; // bit representing Index (digit). + Word_t lowermask; // bits for indexes at or below Index. + Word_t jpcount; // JPs in a subexpanse. + Word_t clbelow; // cache lines below digits cache line. + Word_t clabove; // cache lines above digits cache line. + + Pjbb = P_JBB(Pjp->jp_Addr); + findsub = digit / cJU_BITSPERSUBEXPB; + findbit = digit % cJU_BITSPERSUBEXPB; + lowermask = JU_MASKLOWERINC(JU_BITPOSMASKB(findbit)); + clbelow = clabove = 0; // initial/default => always downward. + + assert(JU_BITMAPTESTB(Pjbb, digit)); // digit must have a JP. + assert(findsub < cJU_NUMSUBEXPB); // falls in expected range. + +// Shorthand for one subexpanse in a bitmap and for one JP in a bitmap branch: +// +// Note: BMPJP0 exists separately to support assertions. + +#define BMPJP0(Subexp) (P_JP(JU_JBB_PJP(Pjbb, Subexp))) +#define BMPJP(Subexp,JPnum) (BMPJP0(Subexp) + (JPnum)) + +#ifndef NOSMARTJBB // enable to turn off smart code for comparison purposes. + +// FIGURE OUT WHICH DIRECTION CAUSES FEWER CACHE LINE FILLS; adding the pop1s +// in JPs above Indexs JP, or subtracting the pop1s in JPs below Indexs JP. +// +// This is tricky because, while each set bit in the bitmap represents a JP, +// the JPs are scattered over cJU_NUMSUBEXPB subexpanses, each of which can +// contain JPs packed into multiple cache lines, and this code must visit every +// JP either BELOW or ABOVE the JP for Index. +// +// Number of cache lines required to hold a linear list of the given number of +// JPs, assuming the first JP is at the start of a cache line or the JPs in +// jpcount fit wholly within a single cache line, which is ensured by +// JudyMalloc(): + +#define CLPERJPS(jpcount) \ + ((((jpcount) * cJU_WORDSPERJP) + cJU_WORDSPERCL - 1) / cJU_WORDSPERCL) + +// Count cache lines below/above for each subexpanse: + + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) + { + jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)); + +// When at the subexpanse containing Index (digit), add cache lines +// below/above appropriately, excluding the cache line containing the JP for +// Index itself: + + if (subexp < findsub) clbelow += CLPERJPS(jpcount); + else if (subexp > findsub) clabove += CLPERJPS(jpcount); + else // (subexp == findsub) + { + Word_t clfind; // cache line containing Index (digit). + + clfind = CLPERJPS(j__udyCountBitsB( + JU_JBB_BITMAP(Pjbb, subexp) & lowermask)); + + assert(clfind > 0); // digit itself should have 1 CL. + clbelow += clfind - 1; + clabove += CLPERJPS(jpcount) - clfind; + } + } +#endif // ! NOSMARTJBB + +// Note: Its impossible to get through the following "if" without setting +// jpnum -- see some of the assertions below -- but gcc -Wall doesnt know +// this, so preset jpnum to make it happy: + + jpnum = 0; + + +// COUNT POPULATION FOR A BITMAP BRANCH, in whichever direction should result +// in fewer cache line fills: +// +// Note: If the remainder of Index is zero, pop1above is the pop1 of the +// entire expanse and theres no point in recursing to lower levels; but this +// should be so rare that its not worth checking for; +// Judy1Count()/JudyLCount() never even calls the motor for Index == 0 (all +// bytes). + + +// COUNT UPWARD, subtracting each "below or at" JPs pop1 from the whole +// expanses pop1: +// +// Note: If this causes clbelow + 1 cache line fills including JPs cache +// line, thats OK; at worst this is the same as clabove. + + if (clbelow < clabove) + { +#ifdef SMARTMETRICS + ++jbb_upward; +#endif + pop1above = pop1; // subtract JPs at/below Index. + +// Count JPs for which to accrue pop1s in this subexpanse: +// +// TBD: If JU_JBB_BITMAP is cJU_FULLBITMAPB, dont bother counting. + + for (subexp = 0; subexp <= findsub; ++subexp) + { + jpcount = j__udyCountBitsB((subexp < findsub) ? + JU_JBB_BITMAP(Pjbb, subexp) : + JU_JBB_BITMAP(Pjbb, subexp) & lowermask); + + // should always find findbit: + assert((subexp < findsub) || jpcount); + +// Subtract pop1s from JPs BELOW OR AT Index (digit): +// +// Note: The pop1 for Indexs JP itself is partially added back later at a +// lower state. +// +// Note: An empty subexpanse (jpcount == 0) is handled "for free". +// +// Note: Must be null JP subexp pointer in empty subexpanse and non-empty in +// non-empty subexpanse: + + assert( jpcount || (BMPJP0(subexp) == (Pjp_t) NULL)); + assert((! jpcount) || (BMPJP0(subexp) != (Pjp_t) NULL)); + + for (jpnum = 0; jpnum < jpcount; ++jpnum) + { + if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum))) + == cJU_ALLONES) + { + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); + return(C_JERR); + } + + pop1above -= pop1; + } + + jpnum = jpcount - 1; // make correct for digit. + } + } + +// COUNT DOWNWARD, adding each "above" JPs pop1: + + else + { + long jpcountbf; // below findbit, inclusive. +#ifdef SMARTMETRICS + ++jbb_downward; +#endif + pop1above = 0; // add JPs above Index. + jpcountbf = 0; // until subexp == findsub. + +// Count JPs for which to accrue pop1s in this subexpanse: +// +// This is more complicated than counting upward because the scan of digits +// subexpanse must count ALL JPs, to know where to START counting down, and +// ALSO note the offset of digits JP to know where to STOP counting down. + + for (subexp = cJU_NUMSUBEXPB - 1; subexp >= findsub; --subexp) + { + jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)); + + // should always find findbit: + assert((subexp > findsub) || jpcount); + + if (! jpcount) continue; // empty subexpanse, save time. + +// Count JPs below digit, inclusive: + + if (subexp == findsub) + { + jpcountbf = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp) + & lowermask); + } + + // should always find findbit: + assert((subexp > findsub) || jpcountbf); + assert(jpcount >= jpcountbf); // proper relationship. + +// Add pop1s from JPs ABOVE Index (digit): + + // no null JP subexp pointers: + assert(BMPJP0(subexp) != (Pjp_t) NULL); + + for (jpnum = jpcount - 1; jpnum >= jpcountbf; --jpnum) + { + if ((pop1 = j__udyJPPop1(BMPJP(subexp, jpnum))) + == cJU_ALLONES) + { + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); + return(C_JERR); + } + + pop1above += pop1; + } + // jpnum is now correct for digit. + } + } // else. + +// Return the net population ABOVE the digits JP at this state (in this JBB) +// plus the population AT OR ABOVE Index in the SM under the digits JP: + + pop1 = j__udy1LCountSM(BMPJP(findsub, jpnum), Index, Pjpm); + if (pop1 == C_JERR) return(C_JERR); // pass error up. + + assert(pop1above + pop1); + return(pop1above + pop1); + + } // case. + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH; count populations in JPs in the JBU ABOVE the next +// digit in Index, and recurse for the next digit in Index: +// +// Note: If the remainder of Index is zero, pop1above is the pop1 of the +// entire expanse and theres no point in recursing to lower levels; but this +// should be so rare that its not worth checking for; +// Judy1Count()/JudyLCount() never even calls the motor for Index == 0 (all +// bytes). + + case cJU_JPBRANCH_U2: CHECKDCD(Pjp, 2); PREPB(Pjp, 2, BranchU); + case cJU_JPBRANCH_U3: CHECKDCD(Pjp, 3); PREPB(Pjp, 3, BranchU); +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: CHECKDCD(Pjp, 4); PREPB(Pjp, 4, BranchU); + case cJU_JPBRANCH_U5: CHECKDCD(Pjp, 5); PREPB(Pjp, 5, BranchU); + case cJU_JPBRANCH_U6: CHECKDCD(Pjp, 6); PREPB(Pjp, 6, BranchU); + case cJU_JPBRANCH_U7: CHECKDCD(Pjp, 7); PREPB(Pjp, 7, BranchU); +#endif + case cJU_JPBRANCH_U: PREPB_ROOT(Pjp, BranchU); + +// Common code (state-independent) for all cases of uncompressed branches: + +BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + +#ifndef NOSMARTJBU // enable to turn off smart code for comparison purposes. + +// FIGURE OUT WHICH WAY CAUSES FEWER CACHE LINE FILLS; adding the JPs above +// Indexs JP, or subtracting the JPs below Indexs JP. +// +// COUNT UPWARD, subtracting the pop1 of each JP BELOW OR AT Index, from the +// whole expanses pop1: + + if (digit < (cJU_BRANCHUNUMJPS / 2)) + { + pop1above = pop1; // subtract JPs below Index. +#ifdef SMARTMETRICS + ++jbu_upward; +#endif + for (jpnum = 0; jpnum <= digit; ++jpnum) + { + if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX) + continue; // shortcut, save a function call. + + if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum)) + == cJU_ALLONES) + { + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); + return(C_JERR); + } + + pop1above -= pop1; + } + } + +// COUNT DOWNWARD, simply adding the pop1 of each JP ABOVE Index: + + else +#endif // NOSMARTJBU + { + assert(digit < cJU_BRANCHUNUMJPS); +#ifdef SMARTMETRICS + ++jbu_downward; +#endif + pop1above = 0; // add JPs above Index. + + for (jpnum = cJU_BRANCHUNUMJPS - 1; jpnum > digit; --jpnum) + { + if ((Pjbu->jbu_jp[jpnum].jp_Type) <= cJU_JPNULLMAX) + continue; // shortcut, save a function call. + + if ((pop1 = j__udyJPPop1(Pjbu->jbu_jp + jpnum)) + == cJU_ALLONES) + { + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); + return(C_JERR); + } + + pop1above += pop1; + } + } + + if ((pop1 = j__udy1LCountSM(Pjbu->jbu_jp + digit, Index, Pjpm)) + == C_JERR) return(C_JERR); // pass error up. + + assert(pop1above + pop1); + return(pop1above + pop1); + + +// ---------------------------------------------------------------------------- +// LEAF COUNT MACROS: +// +// LEAF*ABOVE() are common code for different JP types (linear leaves, bitmap +// leaves, and immediates) and different leaf Index Sizes, which result in +// calling different leaf search functions. Linear leaves get the leaf address +// from jp_Addr and the Population from jp_DcdPopO, while immediates use Pjp +// itself as the leaf address and get Population from jp_Type. + +#define LEAFLABOVE(Func) \ + Pjll = P_JLL(Pjp->jp_Addr); \ + pop1 = JU_JPLEAF_POP0(Pjp) + 1; \ + LEAFABOVE(Func, Pjll, pop1) + +#define LEAFB1ABOVE(Func) LEAFLABOVE(Func) // different Func, otherwise same. + +#ifdef JUDY1 +#define IMMABOVE(Func,Pop1) \ + Pjll = (Pjll_t) Pjp; \ + LEAFABOVE(Func, Pjll, Pop1) +#else +// Note: For JudyL immediates with >= 2 Indexes, the index bytes are in a +// different place than for Judy1: + +#define IMMABOVE(Func,Pop1) \ + LEAFABOVE(Func, (Pjll_t) (Pjp->jp_LIndex), Pop1) +#endif + +// For all leaf types, the population AT OR ABOVE is the total pop1 less the +// offset of Index; and Index should always be found: + +#define LEAFABOVE(Func,Pjll,Pop1) \ + offset = Func(Pjll, Pop1, Index); \ + assert(offset >= 0); \ + assert(offset < (Pop1)); \ + return((Pop1) - offset) + +// IMMABOVE_01 handles the special case of an immediate JP with 1 index, which +// the search functions arent used for anyway: +// +// The target Index should be the one in this Immediate, in which case the +// count above (inclusive) is always 1. + +#define IMMABOVE_01 \ + assert((JU_JPDCDPOP0(Pjp)) == JU_TRIMTODCDSIZE(Index)); \ + return(1) + + +// ---------------------------------------------------------------------------- +// LINEAR LEAF; search the leaf for Index; size is computed from jp_Type: + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: LEAFLABOVE(j__udySearchLeaf1); +#endif + case cJU_JPLEAF2: LEAFLABOVE(j__udySearchLeaf2); + case cJU_JPLEAF3: LEAFLABOVE(j__udySearchLeaf3); + +#ifdef JU_64BIT + case cJU_JPLEAF4: LEAFLABOVE(j__udySearchLeaf4); + case cJU_JPLEAF5: LEAFLABOVE(j__udySearchLeaf5); + case cJU_JPLEAF6: LEAFLABOVE(j__udySearchLeaf6); + case cJU_JPLEAF7: LEAFLABOVE(j__udySearchLeaf7); +#endif + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF; search the leaf for Index: +// +// Since the bitmap describes Indexes digitally rather than linearly, this is +// not really a search, but just a count. + + case cJU_JPLEAF_B1: LEAFB1ABOVE(j__udyCountLeafB1); + + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// Return the count of Indexes AT OR ABOVE Index, which is the total population +// of the expanse (a constant) less the value of the undecoded digit remaining +// in Index (its base-0 offset in the expanse), which yields an inclusive count +// above. +// +// TBD: This only supports a 1-byte full expanse. Should this extract a +// stored value for pop0 and possibly more LSBs of Index, to handle larger full +// expanses? + + case cJ1_JPFULLPOPU1: + return(cJU_JPFULLPOPU1_POP0 + 1 - JU_DIGITATSTATE(Index, 1)); +#endif + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: + + case cJU_JPIMMED_1_01: IMMABOVE_01; + case cJU_JPIMMED_2_01: IMMABOVE_01; + case cJU_JPIMMED_3_01: IMMABOVE_01; +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: IMMABOVE_01; + case cJU_JPIMMED_5_01: IMMABOVE_01; + case cJU_JPIMMED_6_01: IMMABOVE_01; + case cJU_JPIMMED_7_01: IMMABOVE_01; +#endif + + case cJU_JPIMMED_1_02: IMMABOVE(j__udySearchLeaf1, 2); + case cJU_JPIMMED_1_03: IMMABOVE(j__udySearchLeaf1, 3); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: IMMABOVE(j__udySearchLeaf1, 4); + case cJU_JPIMMED_1_05: IMMABOVE(j__udySearchLeaf1, 5); + case cJU_JPIMMED_1_06: IMMABOVE(j__udySearchLeaf1, 6); + case cJU_JPIMMED_1_07: IMMABOVE(j__udySearchLeaf1, 7); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: IMMABOVE(j__udySearchLeaf1, 8); + case cJ1_JPIMMED_1_09: IMMABOVE(j__udySearchLeaf1, 9); + case cJ1_JPIMMED_1_10: IMMABOVE(j__udySearchLeaf1, 10); + case cJ1_JPIMMED_1_11: IMMABOVE(j__udySearchLeaf1, 11); + case cJ1_JPIMMED_1_12: IMMABOVE(j__udySearchLeaf1, 12); + case cJ1_JPIMMED_1_13: IMMABOVE(j__udySearchLeaf1, 13); + case cJ1_JPIMMED_1_14: IMMABOVE(j__udySearchLeaf1, 14); + case cJ1_JPIMMED_1_15: IMMABOVE(j__udySearchLeaf1, 15); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: IMMABOVE(j__udySearchLeaf2, 2); + case cJU_JPIMMED_2_03: IMMABOVE(j__udySearchLeaf2, 3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: IMMABOVE(j__udySearchLeaf2, 4); + case cJ1_JPIMMED_2_05: IMMABOVE(j__udySearchLeaf2, 5); + case cJ1_JPIMMED_2_06: IMMABOVE(j__udySearchLeaf2, 6); + case cJ1_JPIMMED_2_07: IMMABOVE(j__udySearchLeaf2, 7); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: IMMABOVE(j__udySearchLeaf3, 2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: IMMABOVE(j__udySearchLeaf3, 3); + case cJ1_JPIMMED_3_04: IMMABOVE(j__udySearchLeaf3, 4); + case cJ1_JPIMMED_3_05: IMMABOVE(j__udySearchLeaf3, 5); + + case cJ1_JPIMMED_4_02: IMMABOVE(j__udySearchLeaf4, 2); + case cJ1_JPIMMED_4_03: IMMABOVE(j__udySearchLeaf4, 3); + + case cJ1_JPIMMED_5_02: IMMABOVE(j__udySearchLeaf5, 2); + case cJ1_JPIMMED_5_03: IMMABOVE(j__udySearchLeaf5, 3); + + case cJ1_JPIMMED_6_02: IMMABOVE(j__udySearchLeaf6, 2); + + case cJ1_JPIMMED_7_02: IMMABOVE(j__udySearchLeaf7, 2); +#endif + + +// ---------------------------------------------------------------------------- +// OTHER CASES: + + default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); return(C_JERR); + + } // switch on JP type + + /*NOTREACHED*/ + +} // j__udy1LCountSM() + + +// **************************************************************************** +// J U D Y C O U N T L E A F B 1 +// +// This is a private analog of the j__udySearchLeaf*() functions for counting +// in bitmap 1-byte leaves. Since a bitmap leaf describes Indexes digitally +// rather than linearly, this is not really a search, but just a count of the +// valid Indexes == set bits below or including Index, which should be valid. +// Return the "offset" (really the ordinal), 0 .. Pop1 - 1, of Index in Pjll; +// if Indexs bit is not set (which should never happen, so this is DEBUG-mode +// only), return the 1s-complement equivalent (== negative offset minus 1). +// +// Note: The source code for this function looks identical for both Judy1 and +// JudyL, but the JU_JLB_BITMAP macro varies. +// +// Note: For simpler calling, the first arg is of type Pjll_t but then cast to +// Pjlb_t. + +FUNCTION static int j__udyCountLeafB1( +const Pjll_t Pjll, // bitmap leaf, as Pjll_t for consistency. +const Word_t Pop1, // Population of whole leaf. +const Word_t Index) // to which to count. +{ + Pjlb_t Pjlb = (Pjlb_t) Pjll; // to proper type. + Word_t digit = Index & cJU_MASKATSTATE(1); + Word_t findsub = digit / cJU_BITSPERSUBEXPL; + Word_t findbit = digit % cJU_BITSPERSUBEXPL; + int count; // in leaf through Index. + long subexp; // for stepping through subexpanses. + + +// COUNT UPWARD: +// +// The entire bitmap should fit in one cache line, but still try to save some +// CPU time by counting the fewest possible number of subexpanses from the +// bitmap. + +#ifndef NOSMARTJLB // enable to turn off smart code for comparison purposes. + + if (findsub < (cJU_NUMSUBEXPL / 2)) + { +#ifdef SMARTMETRICS + ++jlb_upward; +#endif + count = 0; + + for (subexp = 0; subexp < findsub; ++subexp) + { + count += ((JU_JLB_BITMAP(Pjlb, subexp) == cJU_FULLBITMAPL) ? + cJU_BITSPERSUBEXPL : + j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp))); + } + +// This count includes findbit, which should be set, resulting in a base-1 +// offset: + + count += j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, findsub) + & JU_MASKLOWERINC(JU_BITPOSMASKL(findbit))); + + DBGCODE(if (! JU_BITMAPTESTL(Pjlb, digit)) return(~count);) + assert(count >= 1); + return(count - 1); // convert to base-0 offset. + } +#endif // NOSMARTJLB + + +// COUNT DOWNWARD: +// +// Count the valid Indexes above or at Index, and subtract from Pop1. + +#ifdef SMARTMETRICS + ++jlb_downward; +#endif + count = Pop1; // base-1 for now. + + for (subexp = cJU_NUMSUBEXPL - 1; subexp > findsub; --subexp) + { + count -= ((JU_JLB_BITMAP(Pjlb, subexp) == cJU_FULLBITMAPL) ? + cJU_BITSPERSUBEXPL : + j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp))); + } + +// This count includes findbit, which should be set, resulting in a base-0 +// offset: + + count -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, findsub) + & JU_MASKHIGHERINC(JU_BITPOSMASKL(findbit))); + + DBGCODE(if (! JU_BITMAPTESTL(Pjlb, digit)) return(~count);) + assert(count >= 0); // should find Index itself. + return(count); // is already a base-0 offset. + +} // j__udyCountLeafB1() + + +// **************************************************************************** +// J U D Y J P P O P 1 +// +// This function takes any type of JP other than a root-level JP (cJU_LEAFW* or +// cJU_JPBRANCH* with no number suffix) and extracts the Pop1 from it. In some +// sense this is a wrapper around the JU_JP*_POP0 macros. Why write it as a +// function instead of a complex macro containing a trinary? (See version +// Judy1.h version 4.17.) We think its cheaper to call a function containing +// a switch statement with "constant" cases than to do the variable +// calculations in a trinary. +// +// For invalid JP Types return cJU_ALLONES. Note that this is an impossibly +// high Pop1 for any JP below a top level branch. + +FUNCTION Word_t j__udyJPPop1( +const Pjp_t Pjp) // JP to count. +{ + switch (JU_JPTYPE(Pjp)) + { +#ifdef notdef // caller should shortcut and not even call with these: + + case cJU_JPNULL1: + case cJU_JPNULL2: + case cJU_JPNULL3: return(0); +#ifdef JU_64BIT + case cJU_JPNULL4: + case cJU_JPNULL5: + case cJU_JPNULL6: + case cJU_JPNULL7: return(0); +#endif +#endif // notdef + + case cJU_JPBRANCH_L2: + case cJU_JPBRANCH_B2: + case cJU_JPBRANCH_U2: return(JU_JPBRANCH_POP0(Pjp,2) + 1); + + case cJU_JPBRANCH_L3: + case cJU_JPBRANCH_B3: + case cJU_JPBRANCH_U3: return(JU_JPBRANCH_POP0(Pjp,3) + 1); + +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: + case cJU_JPBRANCH_B4: + case cJU_JPBRANCH_U4: return(JU_JPBRANCH_POP0(Pjp,4) + 1); + + case cJU_JPBRANCH_L5: + case cJU_JPBRANCH_B5: + case cJU_JPBRANCH_U5: return(JU_JPBRANCH_POP0(Pjp,5) + 1); + + case cJU_JPBRANCH_L6: + case cJU_JPBRANCH_B6: + case cJU_JPBRANCH_U6: return(JU_JPBRANCH_POP0(Pjp,6) + 1); + + case cJU_JPBRANCH_L7: + case cJU_JPBRANCH_B7: + case cJU_JPBRANCH_U7: return(JU_JPBRANCH_POP0(Pjp,7) + 1); +#endif + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: +#endif + case cJU_JPLEAF2: + case cJU_JPLEAF3: +#ifdef JU_64BIT + case cJU_JPLEAF4: + case cJU_JPLEAF5: + case cJU_JPLEAF6: + case cJU_JPLEAF7: +#endif + case cJU_JPLEAF_B1: return(JU_JPLEAF_POP0(Pjp) + 1); + +#ifdef JUDY1 + case cJ1_JPFULLPOPU1: return(cJU_JPFULLPOPU1_POP0 + 1); +#endif + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: return(1); +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: return(1); +#endif + + case cJU_JPIMMED_1_02: return(2); + case cJU_JPIMMED_1_03: return(3); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: return(4); + case cJU_JPIMMED_1_05: return(5); + case cJU_JPIMMED_1_06: return(6); + case cJU_JPIMMED_1_07: return(7); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: return(8); + case cJ1_JPIMMED_1_09: return(9); + case cJ1_JPIMMED_1_10: return(10); + case cJ1_JPIMMED_1_11: return(11); + case cJ1_JPIMMED_1_12: return(12); + case cJ1_JPIMMED_1_13: return(13); + case cJ1_JPIMMED_1_14: return(14); + case cJ1_JPIMMED_1_15: return(15); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: return(2); + case cJU_JPIMMED_2_03: return(3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: return(4); + case cJ1_JPIMMED_2_05: return(5); + case cJ1_JPIMMED_2_06: return(6); + case cJ1_JPIMMED_2_07: return(7); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: return(2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: return(3); + case cJ1_JPIMMED_3_04: return(4); + case cJ1_JPIMMED_3_05: return(5); + + case cJ1_JPIMMED_4_02: return(2); + case cJ1_JPIMMED_4_03: return(3); + + case cJ1_JPIMMED_5_02: return(2); + case cJ1_JPIMMED_5_03: return(3); + + case cJ1_JPIMMED_6_02: return(2); + + case cJ1_JPIMMED_7_02: return(2); +#endif + + default: return(cJU_ALLONES); + } + + /*NOTREACHED*/ + +} // j__udyJPPop1() diff --git a/libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c b/libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c new file mode 100644 index 000000000..ffe6b3bde --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLCreateBranch.c @@ -0,0 +1,314 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.26 $ $Source: /judy/src/JudyCommon/JudyCreateBranch.c $ + +// Branch creation functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + + +// **************************************************************************** +// J U D Y C R E A T E B R A N C H L +// +// Build a BranchL from an array of JPs and associated 1 byte digits +// (expanses). Return with Pjp pointing to the BranchL. Caller must +// deallocate passed arrays, if necessary. +// +// We have no idea what kind of BranchL it is, so caller must set the jp_Type. +// +// Return -1 if error (details in Pjpm), otherwise return 1. + +FUNCTION int j__udyCreateBranchL( + Pjp_t Pjp, // Build JPs from this place + Pjp_t PJPs, // Array of JPs to put into Bitmap branch + uint8_t Exp[], // Array of expanses to put into bitmap + Word_t ExpCnt, // Number of above JPs and Expanses + Pvoid_t Pjpm) +{ + Pjbl_t PjblRaw; // pointer to linear branch. + Pjbl_t Pjbl; + + assert(ExpCnt <= cJU_BRANCHLMAXJPS); + + PjblRaw = j__udyAllocJBL(Pjpm); + if (PjblRaw == (Pjbl_t) NULL) return(-1); + Pjbl = P_JBL(PjblRaw); + +// Build a Linear Branch + Pjbl->jbl_NumJPs = ExpCnt; + +// Copy from the Linear branch from splayed leaves + JU_COPYMEM(Pjbl->jbl_Expanse, Exp, ExpCnt); + JU_COPYMEM(Pjbl->jbl_jp, PJPs, ExpCnt); + +// Pass back new pointer to the Linear branch in JP + Pjp->jp_Addr = (Word_t) PjblRaw; + + return(1); + +} // j__udyCreateBranchL() + + +// **************************************************************************** +// J U D Y C R E A T E B R A N C H B +// +// Build a BranchB from an array of JPs and associated 1 byte digits +// (expanses). Return with Pjp pointing to the BranchB. Caller must +// deallocate passed arrays, if necessary. +// +// We have no idea what kind of BranchB it is, so caller must set the jp_Type. +// +// Return -1 if error (details in Pjpm), otherwise return 1. + +FUNCTION int j__udyCreateBranchB( + Pjp_t Pjp, // Build JPs from this place + Pjp_t PJPs, // Array of JPs to put into Bitmap branch + uint8_t Exp[], // Array of expanses to put into bitmap + Word_t ExpCnt, // Number of above JPs and Expanses + Pvoid_t Pjpm) +{ + Pjbb_t PjbbRaw; // pointer to bitmap branch. + Pjbb_t Pjbb; + Word_t ii, jj; // Temps + uint8_t CurrSubExp; // Current sub expanse for BM + +// This assertion says the number of populated subexpanses is not too large. +// This function is only called when a BranchL overflows to a BranchB or when a +// cascade occurs, meaning a leaf overflows. Either way ExpCnt cant be very +// large, in fact a lot smaller than cJU_BRANCHBMAXJPS. (Otherwise a BranchU +// would be used.) Popping this assertion means something (unspecified) has +// gone very wrong, or else Judys design criteria have changed, although in +// fact there should be no HARM in creating a BranchB with higher actual +// fanout. + + assert(ExpCnt <= cJU_BRANCHBMAXJPS); + +// Get memory for a Bitmap branch + PjbbRaw = j__udyAllocJBB(Pjpm); + if (PjbbRaw == (Pjbb_t) NULL) return(-1); + Pjbb = P_JBB(PjbbRaw); + +// Get 1st "sub" expanse (0..7) of bitmap branch + CurrSubExp = Exp[0] / cJU_BITSPERSUBEXPB; + +// Index thru all 1 byte sized expanses: + + for (jj = ii = 0; ii <= ExpCnt; ii++) + { + Word_t SubExp; // Cannot be a uint8_t + +// Make sure we cover the last one + if (ii == ExpCnt) + { + SubExp = cJU_ALLONES; // Force last one + } + else + { +// Calculate the "sub" expanse of the byte expanse + SubExp = Exp[ii] / cJU_BITSPERSUBEXPB; // Bits 5..7. + +// Set the bit that represents the expanse in Exp[] + JU_JBB_BITMAP(Pjbb, SubExp) |= JU_BITPOSMASKB(Exp[ii]); + } +// Check if a new "sub" expanse range needed + if (SubExp != CurrSubExp) + { +// Get number of JPs in this sub expanse + Word_t NumJP = ii - jj; + Pjp_t PjpRaw; + Pjp_t Pjp; + + PjpRaw = j__udyAllocJBBJP(NumJP, Pjpm); + Pjp = P_JP(PjpRaw); + + if (PjpRaw == (Pjp_t) NULL) // out of memory. + { + +// Free any previous allocations: + + while(CurrSubExp--) + { + NumJP = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, + CurrSubExp)); + if (NumJP) + { + j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, + CurrSubExp), NumJP, Pjpm); + } + } + j__udyFreeJBB(PjbbRaw, Pjpm); + return(-1); + } + +// Place the array of JPs in bitmap branch: + + JU_JBB_PJP(Pjbb, CurrSubExp) = PjpRaw; + +// Copy the JPs to new leaf: + + JU_COPYMEM(Pjp, PJPs + jj, NumJP); + +// On to the next bitmap branch "sub" expanse: + + jj = ii; + CurrSubExp = SubExp; + } + } // for each 1-byte expanse + +// Pass back some of the JP to the new Bitmap branch: + + Pjp->jp_Addr = (Word_t) PjbbRaw; + + return(1); + +} // j__udyCreateBranchB() + + +// **************************************************************************** +// J U D Y C R E A T E B R A N C H U +// +// Build a BranchU from a BranchB. Return with Pjp pointing to the BranchU. +// Free the BranchB and its JP subarrays. +// +// Return -1 if error (details in Pjpm), otherwise return 1. + +FUNCTION int j__udyCreateBranchU( + Pjp_t Pjp, + Pvoid_t Pjpm) +{ + jp_t JPNull; + Pjbu_t PjbuRaw; + Pjbu_t Pjbu; + Pjbb_t PjbbRaw; + Pjbb_t Pjbb; + Word_t ii, jj; + BITMAPB_t BitMap; + Pjp_t PDstJP; +#ifdef JU_STAGED_EXP + jbu_t BranchU; // Staged uncompressed branch +#else + +// Allocate memory for a BranchU: + + PjbuRaw = j__udyAllocJBU(Pjpm); + if (PjbuRaw == (Pjbu_t) NULL) return(-1); + Pjbu = P_JBU(PjbuRaw); +#endif + JU_JPSETADT(&JPNull, 0, 0, JU_JPTYPE(Pjp) - cJU_JPBRANCH_B2 + cJU_JPNULL1); + +// Get the pointer to the BranchB: + + PjbbRaw = (Pjbb_t) (Pjp->jp_Addr); + Pjbb = P_JBB(PjbbRaw); + +// Set the pointer to the Uncompressed branch +#ifdef JU_STAGED_EXP + PDstJP = BranchU.jbu_jp; +#else + PDstJP = Pjbu->jbu_jp; +#endif + for (ii = 0; ii < cJU_NUMSUBEXPB; ii++) + { + Pjp_t PjpA; + Pjp_t PjpB; + + PjpB = PjpA = P_JP(JU_JBB_PJP(Pjbb, ii)); + +// Get the bitmap for this subexpanse + BitMap = JU_JBB_BITMAP(Pjbb, ii); + +// NULL empty subexpanses + if (BitMap == 0) + { +// But, fill with NULLs + for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++) + { + PDstJP[jj] = JPNull; + } + PDstJP += cJU_BITSPERSUBEXPB; + continue; + } +// Check if Uncompressed subexpanse + if (BitMap == cJU_FULLBITMAPB) + { +// Copy subexpanse to the Uncompressed branch intact + JU_COPYMEM(PDstJP, PjpA, cJU_BITSPERSUBEXPB); + +// Bump to next subexpanse + PDstJP += cJU_BITSPERSUBEXPB; + +// Set length of subexpanse + jj = cJU_BITSPERSUBEXPB; + } + else + { + for (jj = 0; jj < cJU_BITSPERSUBEXPB; jj++) + { +// Copy JP or NULLJP depending on bit + if (BitMap & 1) { *PDstJP = *PjpA++; } + else { *PDstJP = JPNull; } + + PDstJP++; // advance to next JP + BitMap >>= 1; + } + jj = PjpA - PjpB; + } + +// Free the subexpanse: + + j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, ii), jj, Pjpm); + + } // for each JP in BranchU + +#ifdef JU_STAGED_EXP + +// Allocate memory for a BranchU: + + PjbuRaw = j__udyAllocJBU(Pjpm); + if (PjbuRaw == (Pjbu_t) NULL) return(-1); + Pjbu = P_JBU(PjbuRaw); + +// Copy staged branch to newly allocated branch: +// +// TBD: I think this code is broken. + + *Pjbu = BranchU; + +#endif // JU_STAGED_EXP + +// Finally free the BranchB and put the BranchU in its place: + + j__udyFreeJBB(PjbbRaw, Pjpm); + + Pjp->jp_Addr = (Word_t) PjbuRaw; + Pjp->jp_Type += cJU_JPBRANCH_U - cJU_JPBRANCH_B; + + return(1); + +} // j__udyCreateBranchU() diff --git a/libnetdata/libjudy/src/JudyL/JudyLDecascade.c b/libnetdata/libjudy/src/JudyL/JudyLDecascade.c new file mode 100644 index 000000000..39a89eff1 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLDecascade.c @@ -0,0 +1,1206 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.25 $ $Source: /judy/src/JudyCommon/JudyDecascade.c $ +// +// "Decascade" support functions for JudyDel.c: These functions convert +// smaller-index-size leaves to larger-index-size leaves, and also, bitmap +// leaves (LeafB1s) to Leaf1s, and some types of branches to smaller branches +// at the same index size. Some "decascading" occurs explicitly in JudyDel.c, +// but rare or large subroutines appear as functions here, and the overhead to +// call them is negligible. +// +// Compile with one of -DJUDY1 or -DJUDYL. Note: Function names are converted +// to Judy1 or JudyL specific values by external #defines. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#endif +#ifdef JUDYL +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);) + + +// **************************************************************************** +// __ J U D Y C O P Y 2 T O 3 +// +// Copy one or more 2-byte Indexes to a series of 3-byte Indexes. + +FUNCTION static void j__udyCopy2to3( + uint8_t * PDest, // to where to copy 3-byte Indexes. + uint16_t * PSrc, // from where to copy 2-byte indexes. + Word_t Pop1, // number of Indexes to copy. + Word_t MSByte) // most-significant byte, prefix to each Index. +{ + Word_t Temp; // for building 3-byte Index. + + assert(Pop1); + + do { + Temp = MSByte | *PSrc++; + JU_COPY3_LONG_TO_PINDEX(PDest, Temp); + PDest += 3; + } while (--Pop1); + +} // j__udyCopy2to3() + + +#ifdef JU_64BIT + +// **************************************************************************** +// __ J U D Y C O P Y 3 T O 4 +// +// Copy one or more 3-byte Indexes to a series of 4-byte Indexes. + +FUNCTION static void j__udyCopy3to4( + uint32_t * PDest, // to where to copy 4-byte Indexes. + uint8_t * PSrc, // from where to copy 3-byte indexes. + Word_t Pop1, // number of Indexes to copy. + Word_t MSByte) // most-significant byte, prefix to each Index. +{ + Word_t Temp; // for building 4-byte Index. + + assert(Pop1); + + do { + JU_COPY3_PINDEX_TO_LONG(Temp, PSrc); + Temp |= MSByte; + PSrc += 3; + *PDest++ = Temp; // truncates to uint32_t. + } while (--Pop1); + +} // j__udyCopy3to4() + + +// **************************************************************************** +// __ J U D Y C O P Y 4 T O 5 +// +// Copy one or more 4-byte Indexes to a series of 5-byte Indexes. + +FUNCTION static void j__udyCopy4to5( + uint8_t * PDest, // to where to copy 4-byte Indexes. + uint32_t * PSrc, // from where to copy 4-byte indexes. + Word_t Pop1, // number of Indexes to copy. + Word_t MSByte) // most-significant byte, prefix to each Index. +{ + Word_t Temp; // for building 5-byte Index. + + assert(Pop1); + + do { + Temp = MSByte | *PSrc++; + JU_COPY5_LONG_TO_PINDEX(PDest, Temp); + PDest += 5; + } while (--Pop1); + +} // j__udyCopy4to5() + + +// **************************************************************************** +// __ J U D Y C O P Y 5 T O 6 +// +// Copy one or more 5-byte Indexes to a series of 6-byte Indexes. + +FUNCTION static void j__udyCopy5to6( + uint8_t * PDest, // to where to copy 6-byte Indexes. + uint8_t * PSrc, // from where to copy 5-byte indexes. + Word_t Pop1, // number of Indexes to copy. + Word_t MSByte) // most-significant byte, prefix to each Index. +{ + Word_t Temp; // for building 6-byte Index. + + assert(Pop1); + + do { + JU_COPY5_PINDEX_TO_LONG(Temp, PSrc); + Temp |= MSByte; + JU_COPY6_LONG_TO_PINDEX(PDest, Temp); + PSrc += 5; + PDest += 6; + } while (--Pop1); + +} // j__udyCopy5to6() + + +// **************************************************************************** +// __ J U D Y C O P Y 6 T O 7 +// +// Copy one or more 6-byte Indexes to a series of 7-byte Indexes. + +FUNCTION static void j__udyCopy6to7( + uint8_t * PDest, // to where to copy 6-byte Indexes. + uint8_t * PSrc, // from where to copy 5-byte indexes. + Word_t Pop1, // number of Indexes to copy. + Word_t MSByte) // most-significant byte, prefix to each Index. +{ + Word_t Temp; // for building 6-byte Index. + + assert(Pop1); + + do { + JU_COPY6_PINDEX_TO_LONG(Temp, PSrc); + Temp |= MSByte; + JU_COPY7_LONG_TO_PINDEX(PDest, Temp); + PSrc += 6; + PDest += 7; + } while (--Pop1); + +} // j__udyCopy6to7() + +#endif // JU_64BIT + + +#ifndef JU_64BIT // 32-bit + +// **************************************************************************** +// __ J U D Y C O P Y 3 T O W +// +// Copy one or more 3-byte Indexes to a series of longs (words, always 4-byte). + +FUNCTION static void j__udyCopy3toW( + PWord_t PDest, // to where to copy full-word Indexes. + uint8_t * PSrc, // from where to copy 3-byte indexes. + Word_t Pop1, // number of Indexes to copy. + Word_t MSByte) // most-significant byte, prefix to each Index. +{ + assert(Pop1); + + do { + JU_COPY3_PINDEX_TO_LONG(*PDest, PSrc); + *PDest++ |= MSByte; + PSrc += 3; + } while (--Pop1); + +} // j__udyCopy3toW() + + +#else // JU_64BIT + +// **************************************************************************** +// __ J U D Y C O P Y 7 T O W +// +// Copy one or more 7-byte Indexes to a series of longs (words, always 8-byte). + +FUNCTION static void j__udyCopy7toW( + PWord_t PDest, // to where to copy full-word Indexes. + uint8_t * PSrc, // from where to copy 7-byte indexes. + Word_t Pop1, // number of Indexes to copy. + Word_t MSByte) // most-significant byte, prefix to each Index. +{ + assert(Pop1); + + do { + JU_COPY7_PINDEX_TO_LONG(*PDest, PSrc); + *PDest++ |= MSByte; + PSrc += 7; + } while (--Pop1); + +} // j__udyCopy7toW() + +#endif // JU_64BIT + + +// **************************************************************************** +// __ J U D Y B R A N C H B T O B R A N C H L +// +// When a BranchB shrinks to have few enough JPs, call this function to convert +// it to a BranchL. Return 1 for success, or -1 for failure (with details in +// Pjpm). + +FUNCTION int j__udyBranchBToBranchL( + Pjp_t Pjp, // points to BranchB to shrink. + Pvoid_t Pjpm) // for global accounting. +{ + Pjbb_t PjbbRaw; // old BranchB to shrink. + Pjbb_t Pjbb; + Pjbl_t PjblRaw; // new BranchL to create. + Pjbl_t Pjbl; + Word_t Digit; // in BranchB. + Word_t NumJPs; // non-null JPs in BranchB. + uint8_t Expanse[cJU_BRANCHLMAXJPS]; // for building jbl_Expanse[]. + Pjp_t Pjpjbl; // current JP in BranchL. + Word_t SubExp; // in BranchB. + + assert(JU_JPTYPE(Pjp) >= cJU_JPBRANCH_B2); + assert(JU_JPTYPE(Pjp) <= cJU_JPBRANCH_B); + + PjbbRaw = (Pjbb_t) (Pjp->jp_Addr); + Pjbb = P_JBB(PjbbRaw); + +// Copy 1-byte subexpanse digits from BranchB to temporary buffer for BranchL, +// for each bit set in the BranchB: +// +// TBD: The following supports variable-sized linear branches, but they are no +// longer variable; this could be simplified to save the copying. +// +// TBD: Since cJU_BRANCHLMAXJP == 7 now, and cJU_BRANCHUNUMJPS == 256, the +// following might be inefficient; is there a faster way to do it? At least +// skip wholly empty subexpanses? + + for (NumJPs = Digit = 0; Digit < cJU_BRANCHUNUMJPS; ++Digit) + { + if (JU_BITMAPTESTB(Pjbb, Digit)) + { + Expanse[NumJPs++] = Digit; + assert(NumJPs <= cJU_BRANCHLMAXJPS); // required of caller. + } + } + +// Allocate and populate the BranchL: + + if ((PjblRaw = j__udyAllocJBL(Pjpm)) == (Pjbl_t) NULL) return(-1); + Pjbl = P_JBL(PjblRaw); + + JU_COPYMEM(Pjbl->jbl_Expanse, Expanse, NumJPs); + + Pjbl->jbl_NumJPs = NumJPs; + DBGCODE(JudyCheckSorted((Pjll_t) (Pjbl->jbl_Expanse), NumJPs, 1);) + +// Copy JPs from each BranchB subexpanse subarray: + + Pjpjbl = P_JP(Pjbl->jbl_jp); // start at first JP in array. + + for (SubExp = 0; SubExp < cJU_NUMSUBEXPB; ++SubExp) + { + Pjp_t PjpRaw = JU_JBB_PJP(Pjbb, SubExp); // current Pjp. + Pjp_t Pjp; + + if (PjpRaw == (Pjp_t) NULL) continue; // skip empty subexpanse. + Pjp = P_JP(PjpRaw); + + NumJPs = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, SubExp)); + assert(NumJPs); + JU_COPYMEM(Pjpjbl, Pjp, NumJPs); // one subarray at a time. + + Pjpjbl += NumJPs; + j__udyFreeJBBJP(PjpRaw, NumJPs, Pjpm); // subarray. + } + j__udyFreeJBB(PjbbRaw, Pjpm); // BranchB itself. + +// Finish up: Calculate new JP type (same index size = level in new class), +// and tie new BranchB into parent JP: + + Pjp->jp_Type += cJU_JPBRANCH_L - cJU_JPBRANCH_B; + Pjp->jp_Addr = (Word_t) PjblRaw; + + return(1); + +} // j__udyBranchBToBranchL() + + +#ifdef notdef + +// **************************************************************************** +// __ J U D Y B R A N C H U T O B R A N C H B +// +// When a BranchU shrinks to need little enough memory, call this function to +// convert it to a BranchB to save memory (at the cost of some speed). Return +// 1 for success, or -1 for failure (with details in Pjpm). +// +// TBD: Fill out if/when needed. Not currently used in JudyDel.c for reasons +// explained there. + +FUNCTION int j__udyBranchUToBranchB( + Pjp_t Pjp, // points to BranchU to shrink. + Pvoid_t Pjpm) // for global accounting. +{ + assert(FALSE); + return(1); +} +#endif // notdef + + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + +// **************************************************************************** +// __ J U D Y L E A F B 1 T O L E A F 1 +// +// Shrink a bitmap leaf (cJU_LEAFB1) to linear leaf (cJU_JPLEAF1). +// Return 1 for success, or -1 for failure (with details in Pjpm). +// +// Note: This function is different than the other JudyLeaf*ToLeaf*() +// functions because it receives a Pjp, not just a leaf, and handles its own +// allocation and free, in order to allow the caller to continue with a LeafB1 +// if allocation fails. + +FUNCTION int j__udyLeafB1ToLeaf1( + Pjp_t Pjp, // points to LeafB1 to shrink. + Pvoid_t Pjpm) // for global accounting. +{ + Pjlb_t PjlbRaw; // bitmap in old leaf. + Pjlb_t Pjlb; + Pjll_t PjllRaw; // new Leaf1. + uint8_t * Pleaf1; // Leaf1 pointer type. + Word_t Digit; // in LeafB1 bitmap. +#ifdef JUDYL + Pjv_t PjvNew; // value area in new Leaf1. + Word_t Pop1; + Word_t SubExp; +#endif + + assert(JU_JPTYPE(Pjp) == cJU_JPLEAF_B1); + assert(((JU_JPDCDPOP0(Pjp) & 0xFF) + 1) == cJU_LEAF1_MAXPOP1); + +// Allocate JPLEAF1 and prepare pointers: + + if ((PjllRaw = j__udyAllocJLL1(cJU_LEAF1_MAXPOP1, Pjpm)) == 0) + return(-1); + + Pleaf1 = (uint8_t *) P_JLL(PjllRaw); + PjlbRaw = (Pjlb_t) (Pjp->jp_Addr); + Pjlb = P_JLB(PjlbRaw); + JUDYLCODE(PjvNew = JL_LEAF1VALUEAREA(Pleaf1, cJL_LEAF1_MAXPOP1);) + +// Copy 1-byte indexes from old LeafB1 to new Leaf1: + + for (Digit = 0; Digit < cJU_BRANCHUNUMJPS; ++Digit) + if (JU_BITMAPTESTL(Pjlb, Digit)) + *Pleaf1++ = Digit; + +#ifdef JUDYL + +// Copy all old-LeafB1 value areas from value subarrays to new Leaf1: + + for (SubExp = 0; SubExp < cJU_NUMSUBEXPL; ++SubExp) + { + Pjv_t PjvRaw = JL_JLB_PVALUE(Pjlb, SubExp); + Pjv_t Pjv = P_JV(PjvRaw); + + if (Pjv == (Pjv_t) NULL) continue; // skip empty subarray. + + Pop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, SubExp)); // subarray. + assert(Pop1); + + JU_COPYMEM(PjvNew, Pjv, Pop1); // copy value areas. + j__udyLFreeJV(PjvRaw, Pop1, Pjpm); + PjvNew += Pop1; // advance through new. + } + + assert((((Word_t) Pleaf1) - (Word_t) P_JLL(PjllRaw)) + == (PjvNew - JL_LEAF1VALUEAREA(P_JLL(PjllRaw), cJL_LEAF1_MAXPOP1))); +#endif // JUDYL + + DBGCODE(JudyCheckSorted((Pjll_t) P_JLL(PjllRaw), + (((Word_t) Pleaf1) - (Word_t) P_JLL(PjllRaw)), 1);) + +// Finish up: Free the old LeafB1 and plug the new Leaf1 into the JP: +// +// Note: jp_DcdPopO does not change here. + + j__udyFreeJLB1(PjlbRaw, Pjpm); + + Pjp->jp_Addr = (Word_t) PjllRaw; + Pjp->jp_Type = cJU_JPLEAF1; + + return(1); + +} // j__udyLeafB1ToLeaf1() + +#endif // (JUDYL || (! JU_64BIT)) + + +// **************************************************************************** +// __ J U D Y L E A F 1 T O L E A F 2 +// +// Copy 1-byte Indexes from a LeafB1 or Leaf1 to 2-byte Indexes in a Leaf2. +// Pjp MUST be one of: cJU_JPLEAF_B1, cJU_JPLEAF1, or cJU_JPIMMED_1_*. +// Return number of Indexes copied. +// +// TBD: In this and all following functions, the caller should already be able +// to compute the Pop1 return value, so why return it? + +FUNCTION Word_t j__udyLeaf1ToLeaf2( + uint16_t * PLeaf2, // destination uint16_t * Index portion of leaf. +#ifdef JUDYL + Pjv_t Pjv2, // destination value part of leaf. +#endif + Pjp_t Pjp, // 1-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. + Word_t Offset; // in linear leaf list. +JUDYLCODE(Pjv_t Pjv1Raw;) // source object value area. +JUDYLCODE(Pjv_t Pjv1;) + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF_B1: + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb = P_JLB(Pjp->jp_Addr); + Word_t Digit; // in LeafB1 bitmap. + JUDYLCODE(Word_t SubExp;) // in LeafB1. + + Pop1 = JU_JPBRANCH_POP0(Pjp, 1) + 1; assert(Pop1); + +// Copy 1-byte indexes from old LeafB1 to new Leaf2, including splicing in +// the missing MSByte needed in the Leaf2: + + for (Digit = 0; Digit < cJU_BRANCHUNUMJPS; ++Digit) + if (JU_BITMAPTESTL(Pjlb, Digit)) + *PLeaf2++ = MSByte | Digit; + +#ifdef JUDYL + +// Copy all old-LeafB1 value areas from value subarrays to new Leaf2: + + for (SubExp = 0; SubExp < cJU_NUMSUBEXPL; ++SubExp) + { + Word_t SubExpPop1; + + Pjv1Raw = JL_JLB_PVALUE(Pjlb, SubExp); + if (Pjv1Raw == (Pjv_t) NULL) continue; // skip empty. + Pjv1 = P_JV(Pjv1Raw); + + SubExpPop1 = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, SubExp)); + assert(SubExpPop1); + + JU_COPYMEM(Pjv2, Pjv1, SubExpPop1); // copy value areas. + j__udyLFreeJV(Pjv1Raw, SubExpPop1, Pjpm); + Pjv2 += SubExpPop1; // advance through new. + } +#endif // JUDYL + + j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm); // LeafB1 itself. + return(Pop1); + + } // case cJU_JPLEAF_B1 + + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + +// JPLEAF1: + + case cJU_JPLEAF1: + { + uint8_t * PLeaf1 = (uint8_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPBRANCH_POP0(Pjp, 1) + 1; assert(Pop1); + JUDYLCODE(Pjv1 = JL_LEAF1VALUEAREA(PLeaf1, Pop1);) + +// Copy all Index bytes including splicing in missing MSByte needed in Leaf2 +// (plus, for JudyL, value areas): + + for (Offset = 0; Offset < Pop1; ++Offset) + { + PLeaf2[Offset] = MSByte | PLeaf1[Offset]; + JUDYLCODE(Pjv2[Offset] = Pjv1[Offset];) + } + j__udyFreeJLL1((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } +#endif // (JUDYL || (! JU_64BIT)) + + +// JPIMMED_1_01: +// +// Note: jp_DcdPopO has 3 [7] bytes of Index (all but most significant byte), +// so the assignment to PLeaf2[] truncates and MSByte is not needed. + + case cJU_JPIMMED_1_01: + { + PLeaf2[0] = JU_JPDCDPOP0(Pjp); // see above. + JUDYLCODE(Pjv2[0] = Pjp->jp_Addr;) + return(1); + } + + +// JPIMMED_1_0[2+]: + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: + case cJ1_JPIMMED_1_09: + case cJ1_JPIMMED_1_10: + case cJ1_JPIMMED_1_11: + case cJ1_JPIMMED_1_12: + case cJ1_JPIMMED_1_13: + case cJ1_JPIMMED_1_14: + case cJ1_JPIMMED_1_15: +#endif + { + Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_02 + 2; assert(Pop1); + JUDYLCODE(Pjv1Raw = (Pjv_t) (Pjp->jp_Addr);) + JUDYLCODE(Pjv1 = P_JV(Pjv1Raw);) + + for (Offset = 0; Offset < Pop1; ++Offset) + { +#ifdef JUDY1 + PLeaf2[Offset] = MSByte | Pjp->jp_1Index[Offset]; +#else + PLeaf2[Offset] = MSByte | Pjp->jp_LIndex[Offset]; + Pjv2 [Offset] = Pjv1[Offset]; +#endif + } + JUDYLCODE(j__udyLFreeJV(Pjv1Raw, Pop1, Pjpm);) + return(Pop1); + } + + +// UNEXPECTED CASES, including JPNULL1, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf1ToLeaf2() + + +// ***************************************************************************** +// __ J U D Y L E A F 2 T O L E A F 3 +// +// Copy 2-byte Indexes from a Leaf2 to 3-byte Indexes in a Leaf3. +// Pjp MUST be one of: cJU_JPLEAF2 or cJU_JPIMMED_2_*. +// Return number of Indexes copied. +// +// Note: By the time this function is called to compress a level-3 branch to a +// Leaf3, the branch has no narrow pointers under it, meaning only level-2 +// objects are below it and must be handled here. + +FUNCTION Word_t j__udyLeaf2ToLeaf3( + uint8_t * PLeaf3, // destination "uint24_t *" Index part of leaf. +#ifdef JUDYL + Pjv_t Pjv3, // destination value part of leaf. +#endif + Pjp_t Pjp, // 2-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. +#if (defined(JUDYL) && defined(JU_64BIT)) + Pjv_t Pjv2Raw; // source object value area. +#endif +JUDYLCODE(Pjv_t Pjv2;) + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF2: + + case cJU_JPLEAF2: + { + uint16_t * PLeaf2 = (uint16_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1); + j__udyCopy2to3(PLeaf3, PLeaf2, Pop1, MSByte); +#ifdef JUDYL + Pjv2 = JL_LEAF2VALUEAREA(PLeaf2, Pop1); + JU_COPYMEM(Pjv3, Pjv2, Pop1); +#endif + j__udyFreeJLL2((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } + + +// JPIMMED_2_01: +// +// Note: jp_DcdPopO has 3 [7] bytes of Index (all but most significant byte), +// so the "assignment" to PLeaf3[] is exact [truncates] and MSByte is not +// needed. + + case cJU_JPIMMED_2_01: + { + JU_COPY3_LONG_TO_PINDEX(PLeaf3, JU_JPDCDPOP0(Pjp)); // see above. + JUDYLCODE(Pjv3[0] = Pjp->jp_Addr;) + return(1); + } + + +// JPIMMED_2_0[2+]: + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: + case cJ1_JPIMMED_2_05: + case cJ1_JPIMMED_2_06: + case cJ1_JPIMMED_2_07: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + { + JUDY1CODE(uint16_t * PLeaf2 = (uint16_t *) (Pjp->jp_1Index);) + JUDYLCODE(uint16_t * PLeaf2 = (uint16_t *) (Pjp->jp_LIndex);) + + Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_2_02 + 2; assert(Pop1); + j__udyCopy2to3(PLeaf3, PLeaf2, Pop1, MSByte); +#ifdef JUDYL + Pjv2Raw = (Pjv_t) (Pjp->jp_Addr); + Pjv2 = P_JV(Pjv2Raw); + JU_COPYMEM(Pjv3, Pjv2, Pop1); + j__udyLFreeJV(Pjv2Raw, Pop1, Pjpm); +#endif + return(Pop1); + } +#endif // (JUDY1 || JU_64BIT) + + +// UNEXPECTED CASES, including JPNULL2, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf2ToLeaf3() + + +#ifdef JU_64BIT + +// **************************************************************************** +// __ J U D Y L E A F 3 T O L E A F 4 +// +// Copy 3-byte Indexes from a Leaf3 to 4-byte Indexes in a Leaf4. +// Pjp MUST be one of: cJU_JPLEAF3 or cJU_JPIMMED_3_*. +// Return number of Indexes copied. +// +// Note: By the time this function is called to compress a level-4 branch to a +// Leaf4, the branch has no narrow pointers under it, meaning only level-3 +// objects are below it and must be handled here. + +FUNCTION Word_t j__udyLeaf3ToLeaf4( + uint32_t * PLeaf4, // destination uint32_t * Index part of leaf. +#ifdef JUDYL + Pjv_t Pjv4, // destination value part of leaf. +#endif + Pjp_t Pjp, // 3-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. +JUDYLCODE(Pjv_t Pjv3Raw;) // source object value area. +JUDYLCODE(Pjv_t Pjv3;) + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF3: + + case cJU_JPLEAF3: + { + uint8_t * PLeaf3 = (uint8_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1); + j__udyCopy3to4(PLeaf4, (uint8_t *) PLeaf3, Pop1, MSByte); +#ifdef JUDYL + Pjv3 = JL_LEAF3VALUEAREA(PLeaf3, Pop1); + JU_COPYMEM(Pjv4, Pjv3, Pop1); +#endif + j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } + + +// JPIMMED_3_01: +// +// Note: jp_DcdPopO has 7 bytes of Index (all but most significant byte), so +// the assignment to PLeaf4[] truncates and MSByte is not needed. + + case cJU_JPIMMED_3_01: + { + PLeaf4[0] = JU_JPDCDPOP0(Pjp); // see above. + JUDYLCODE(Pjv4[0] = Pjp->jp_Addr;) + return(1); + } + + +// JPIMMED_3_0[2+]: + + case cJU_JPIMMED_3_02: +#ifdef JUDY1 + case cJ1_JPIMMED_3_03: + case cJ1_JPIMMED_3_04: + case cJ1_JPIMMED_3_05: +#endif + { + JUDY1CODE(uint8_t * PLeaf3 = (uint8_t *) (Pjp->jp_1Index);) + JUDYLCODE(uint8_t * PLeaf3 = (uint8_t *) (Pjp->jp_LIndex);) + + JUDY1CODE(Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_3_02 + 2;) + JUDYLCODE(Pop1 = 2;) + + j__udyCopy3to4(PLeaf4, PLeaf3, Pop1, MSByte); +#ifdef JUDYL + Pjv3Raw = (Pjv_t) (Pjp->jp_Addr); + Pjv3 = P_JV(Pjv3Raw); + JU_COPYMEM(Pjv4, Pjv3, Pop1); + j__udyLFreeJV(Pjv3Raw, Pop1, Pjpm); +#endif + return(Pop1); + } + + +// UNEXPECTED CASES, including JPNULL3, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf3ToLeaf4() + + +// Note: In all following j__udyLeaf*ToLeaf*() functions, JPIMMED_*_0[2+] +// cases exist for Judy1 (&& 64-bit) only. JudyL has no equivalent Immeds. + + +// ***************************************************************************** +// __ J U D Y L E A F 4 T O L E A F 5 +// +// Copy 4-byte Indexes from a Leaf4 to 5-byte Indexes in a Leaf5. +// Pjp MUST be one of: cJU_JPLEAF4 or cJU_JPIMMED_4_*. +// Return number of Indexes copied. +// +// Note: By the time this function is called to compress a level-5 branch to a +// Leaf5, the branch has no narrow pointers under it, meaning only level-4 +// objects are below it and must be handled here. + +FUNCTION Word_t j__udyLeaf4ToLeaf5( + uint8_t * PLeaf5, // destination "uint40_t *" Index part of leaf. +#ifdef JUDYL + Pjv_t Pjv5, // destination value part of leaf. +#endif + Pjp_t Pjp, // 4-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. +JUDYLCODE(Pjv_t Pjv4;) // source object value area. + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF4: + + case cJU_JPLEAF4: + { + uint32_t * PLeaf4 = (uint32_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1); + j__udyCopy4to5(PLeaf5, PLeaf4, Pop1, MSByte); +#ifdef JUDYL + Pjv4 = JL_LEAF4VALUEAREA(PLeaf4, Pop1); + JU_COPYMEM(Pjv5, Pjv4, Pop1); +#endif + j__udyFreeJLL4((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } + + +// JPIMMED_4_01: +// +// Note: jp_DcdPopO has 7 bytes of Index (all but most significant byte), so +// the assignment to PLeaf5[] truncates and MSByte is not needed. + + case cJU_JPIMMED_4_01: + { + JU_COPY5_LONG_TO_PINDEX(PLeaf5, JU_JPDCDPOP0(Pjp)); // see above. + JUDYLCODE(Pjv5[0] = Pjp->jp_Addr;) + return(1); + } + + +#ifdef JUDY1 + +// JPIMMED_4_0[4+]: + + case cJ1_JPIMMED_4_02: + case cJ1_JPIMMED_4_03: + { + uint32_t * PLeaf4 = (uint32_t *) (Pjp->jp_1Index); + + Pop1 = JU_JPTYPE(Pjp) - cJ1_JPIMMED_4_02 + 2; + j__udyCopy4to5(PLeaf5, PLeaf4, Pop1, MSByte); + return(Pop1); + } +#endif // JUDY1 + + +// UNEXPECTED CASES, including JPNULL4, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf4ToLeaf5() + + +// **************************************************************************** +// __ J U D Y L E A F 5 T O L E A F 6 +// +// Copy 5-byte Indexes from a Leaf5 to 6-byte Indexes in a Leaf6. +// Pjp MUST be one of: cJU_JPLEAF5 or cJU_JPIMMED_5_*. +// Return number of Indexes copied. +// +// Note: By the time this function is called to compress a level-6 branch to a +// Leaf6, the branch has no narrow pointers under it, meaning only level-5 +// objects are below it and must be handled here. + +FUNCTION Word_t j__udyLeaf5ToLeaf6( + uint8_t * PLeaf6, // destination uint8_t * Index part of leaf. +#ifdef JUDYL + Pjv_t Pjv6, // destination value part of leaf. +#endif + Pjp_t Pjp, // 5-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. +JUDYLCODE(Pjv_t Pjv5;) // source object value area. + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF5: + + case cJU_JPLEAF5: + { + uint8_t * PLeaf5 = (uint8_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; assert(Pop1); + j__udyCopy5to6(PLeaf6, PLeaf5, Pop1, MSByte); +#ifdef JUDYL + Pjv5 = JL_LEAF5VALUEAREA(PLeaf5, Pop1); + JU_COPYMEM(Pjv6, Pjv5, Pop1); +#endif + j__udyFreeJLL5((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } + + +// JPIMMED_5_01: +// +// Note: jp_DcdPopO has 7 bytes of Index (all but most significant byte), so +// the assignment to PLeaf6[] truncates and MSByte is not needed. + + case cJU_JPIMMED_5_01: + { + JU_COPY6_LONG_TO_PINDEX(PLeaf6, JU_JPDCDPOP0(Pjp)); // see above. + JUDYLCODE(Pjv6[0] = Pjp->jp_Addr;) + return(1); + } + + +#ifdef JUDY1 + +// JPIMMED_5_0[2+]: + + case cJ1_JPIMMED_5_02: + case cJ1_JPIMMED_5_03: + { + uint8_t * PLeaf5 = (uint8_t *) (Pjp->jp_1Index); + + Pop1 = JU_JPTYPE(Pjp) - cJ1_JPIMMED_5_02 + 2; + j__udyCopy5to6(PLeaf6, PLeaf5, Pop1, MSByte); + return(Pop1); + } +#endif // JUDY1 + + +// UNEXPECTED CASES, including JPNULL5, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf5ToLeaf6() + + +// ***************************************************************************** +// __ J U D Y L E A F 6 T O L E A F 7 +// +// Copy 6-byte Indexes from a Leaf2 to 7-byte Indexes in a Leaf7. +// Pjp MUST be one of: cJU_JPLEAF6 or cJU_JPIMMED_6_*. +// Return number of Indexes copied. +// +// Note: By the time this function is called to compress a level-7 branch to a +// Leaf7, the branch has no narrow pointers under it, meaning only level-6 +// objects are below it and must be handled here. + +FUNCTION Word_t j__udyLeaf6ToLeaf7( + uint8_t * PLeaf7, // destination "uint24_t *" Index part of leaf. +#ifdef JUDYL + Pjv_t Pjv7, // destination value part of leaf. +#endif + Pjp_t Pjp, // 6-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. +JUDYLCODE(Pjv_t Pjv6;) // source object value area. + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF6: + + case cJU_JPLEAF6: + { + uint8_t * PLeaf6 = (uint8_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyCopy6to7(PLeaf7, PLeaf6, Pop1, MSByte); +#ifdef JUDYL + Pjv6 = JL_LEAF6VALUEAREA(PLeaf6, Pop1); + JU_COPYMEM(Pjv7, Pjv6, Pop1); +#endif + j__udyFreeJLL6((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } + + +// JPIMMED_6_01: +// +// Note: jp_DcdPopO has 7 bytes of Index (all but most significant byte), so +// the "assignment" to PLeaf7[] is exact and MSByte is not needed. + + case cJU_JPIMMED_6_01: + { + JU_COPY7_LONG_TO_PINDEX(PLeaf7, JU_JPDCDPOP0(Pjp)); // see above. + JUDYLCODE(Pjv7[0] = Pjp->jp_Addr;) + return(1); + } + + +#ifdef JUDY1 + +// JPIMMED_6_02: + + case cJ1_JPIMMED_6_02: + { + uint8_t * PLeaf6 = (uint8_t *) (Pjp->jp_1Index); + + j__udyCopy6to7(PLeaf7, PLeaf6, /* Pop1 = */ 2, MSByte); + return(2); + } +#endif // JUDY1 + + +// UNEXPECTED CASES, including JPNULL6, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf6ToLeaf7() + +#endif // JU_64BIT + + +#ifndef JU_64BIT // 32-bit version first + +// **************************************************************************** +// __ J U D Y L E A F 3 T O L E A F W +// +// Copy 3-byte Indexes from a Leaf3 to 4-byte Indexes in a LeafW. Pjp MUST be +// one of: cJU_JPLEAF3 or cJU_JPIMMED_3_*. Return number of Indexes copied. +// +// Note: By the time this function is called to compress a level-L branch to a +// LeafW, the branch has no narrow pointers under it, meaning only level-3 +// objects are below it and must be handled here. + +FUNCTION Word_t j__udyLeaf3ToLeafW( + Pjlw_t Pjlw, // destination Index part of leaf. +#ifdef JUDYL + Pjv_t PjvW, // destination value part of leaf. +#endif + Pjp_t Pjp, // 3-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. +JUDYLCODE(Pjv_t Pjv3;) // source object value area. + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF3: + + case cJU_JPLEAF3: + { + uint8_t * PLeaf3 = (uint8_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyCopy3toW((PWord_t) Pjlw, PLeaf3, Pop1, MSByte); +#ifdef JUDYL + Pjv3 = JL_LEAF3VALUEAREA(PLeaf3, Pop1); + JU_COPYMEM(PjvW, Pjv3, Pop1); +#endif + j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } + + +// JPIMMED_3_01: +// +// Note: jp_DcdPopO has 3 bytes of Index (all but most significant byte), and +// MSByte must be ord in. + + case cJU_JPIMMED_3_01: + { + Pjlw[0] = MSByte | JU_JPDCDPOP0(Pjp); // see above. + JUDYLCODE(PjvW[0] = Pjp->jp_Addr;) + return(1); + } + + +#ifdef JUDY1 + +// JPIMMED_3_02: + + case cJU_JPIMMED_3_02: + { + uint8_t * PLeaf3 = (uint8_t *) (Pjp->jp_1Index); + + j__udyCopy3toW((PWord_t) Pjlw, PLeaf3, /* Pop1 = */ 2, MSByte); + return(2); + } +#endif // JUDY1 + + +// UNEXPECTED CASES, including JPNULL3, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf3ToLeafW() + + +#else // JU_64BIT + + +// **************************************************************************** +// __ J U D Y L E A F 7 T O L E A F W +// +// Copy 7-byte Indexes from a Leaf7 to 8-byte Indexes in a LeafW. +// Pjp MUST be one of: cJU_JPLEAF7 or cJU_JPIMMED_7_*. +// Return number of Indexes copied. +// +// Note: By the time this function is called to compress a level-L branch to a +// LeafW, the branch has no narrow pointers under it, meaning only level-7 +// objects are below it and must be handled here. + +FUNCTION Word_t j__udyLeaf7ToLeafW( + Pjlw_t Pjlw, // destination Index part of leaf. +#ifdef JUDYL + Pjv_t PjvW, // destination value part of leaf. +#endif + Pjp_t Pjp, // 7-byte-index object from which to copy. + Word_t MSByte, // most-significant byte, prefix to each Index. + Pvoid_t Pjpm) // for global accounting. +{ + Word_t Pop1; // Indexes in leaf. +JUDYLCODE(Pjv_t Pjv7;) // source object value area. + + switch (JU_JPTYPE(Pjp)) + { + + +// JPLEAF7: + + case cJU_JPLEAF7: + { + uint8_t * PLeaf7 = (uint8_t *) P_JLL(Pjp->jp_Addr); + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyCopy7toW((PWord_t) Pjlw, PLeaf7, Pop1, MSByte); +#ifdef JUDYL + Pjv7 = JL_LEAF7VALUEAREA(PLeaf7, Pop1); + JU_COPYMEM(PjvW, Pjv7, Pop1); +#endif + j__udyFreeJLL7((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + return(Pop1); + } + + +// JPIMMED_7_01: +// +// Note: jp_DcdPopO has 7 bytes of Index (all but most significant byte), and +// MSByte must be ord in. + + case cJU_JPIMMED_7_01: + { + Pjlw[0] = MSByte | JU_JPDCDPOP0(Pjp); // see above. + JUDYLCODE(PjvW[0] = Pjp->jp_Addr;) + return(1); + } + + +#ifdef JUDY1 + +// JPIMMED_7_02: + + case cJ1_JPIMMED_7_02: + { + uint8_t * PLeaf7 = (uint8_t *) (Pjp->jp_1Index); + + j__udyCopy7toW((PWord_t) Pjlw, PLeaf7, /* Pop1 = */ 2, MSByte); + return(2); + } +#endif + + +// UNEXPECTED CASES, including JPNULL7, should be handled by caller: + + default: assert(FALSE); break; + + } // switch + + return(0); + +} // j__udyLeaf7ToLeafW() + +#endif // JU_64BIT diff --git a/libnetdata/libjudy/src/JudyL/JudyLDel.c b/libnetdata/libjudy/src/JudyL/JudyLDel.c new file mode 100644 index 000000000..ced4b5fb3 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLDel.c @@ -0,0 +1,2146 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.68 $ $Source: /judy/src/JudyCommon/JudyDel.c $ +// +// Judy1Unset() and JudyLDel() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// About HYSTERESIS: In the Judy code, hysteresis means leaving around a +// nominally suboptimal (not maximally compressed) data structure after a +// deletion. As a result, the shape of the tree for two identical index sets +// can differ depending on the insert/delete path taken to arrive at the index +// sets. The purpose is to minimize worst-case behavior (thrashing) that could +// result from a series of intermixed insertions and deletions. It also makes +// for MUCH simpler code, because instead of performing, "delete and then +// compress," it can say, "compress and then delete," where due to hysteresis, +// compression is not even attempted until the object IS compressible. +// +// In some cases the code has no choice and it must "ungrow" a data structure +// across a "phase transition" boundary without hysteresis. In other cases the +// amount (such as "hysteresis = 1") is indicated by the number of JP deletions +// (in branches) or index deletions (in leaves) that can occur in succession +// before compressing the data structure. (It appears that hysteresis <= 1 in +// all cases.) +// +// In general no hysteresis occurs when the data structure type remains the +// same but the allocated memory chunk for the node must shrink, because the +// relationship is hardwired and theres no way to know how much memory is +// allocated to a given data structure. Hysteresis = 0 in all these cases. +// +// TBD: Could this code be faster if memory chunk hysteresis were supported +// somehow along with data structure type hysteresis? +// +// TBD: Should some of the assertions here be converted to product code that +// returns JU_ERRNO_CORRUPT? +// +// TBD: Dougs code had an odd mix of function-wide and limited-scope +// variables. Should some of the function-wide variables appear only in +// limited scopes, or more likely, vice-versa? + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);) +DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);) + +#ifdef TRACEJP +#include "JudyPrintJP.c" +#endif + +// These are defined to generic values in JudyCommon/JudyPrivateTypes.h: +// +// TBD: These should be exported from a header file, but perhaps not, as they +// are only used here, and exported from JudyDecascade.c, which is a separate +// file for profiling reasons (to prevent inlining), but which potentially +// could be merged with this file, either in SoftCM or at compile-time: + +#ifdef JUDY1 + +extern int j__udy1BranchBToBranchL(Pjp_t Pjp, Pvoid_t Pjpm); +#ifndef JU_64BIT +extern int j__udy1LeafB1ToLeaf1(Pjp_t, Pvoid_t); +#endif +extern Word_t j__udy1Leaf1ToLeaf2(uint16_t *, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udy1Leaf2ToLeaf3(uint8_t *, Pjp_t, Word_t, Pvoid_t); +#ifndef JU_64BIT +extern Word_t j__udy1Leaf3ToLeafW(Pjlw_t, Pjp_t, Word_t, Pvoid_t); +#else +extern Word_t j__udy1Leaf3ToLeaf4(uint32_t *, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udy1Leaf4ToLeaf5(uint8_t *, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udy1Leaf5ToLeaf6(uint8_t *, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udy1Leaf6ToLeaf7(uint8_t *, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udy1Leaf7ToLeafW(Pjlw_t, Pjp_t, Word_t, Pvoid_t); +#endif + +#else // JUDYL + +extern int j__udyLBranchBToBranchL(Pjp_t Pjp, Pvoid_t Pjpm); +extern int j__udyLLeafB1ToLeaf1(Pjp_t, Pvoid_t); +extern Word_t j__udyLLeaf1ToLeaf2(uint16_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udyLLeaf2ToLeaf3(uint8_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t); +#ifndef JU_64BIT +extern Word_t j__udyLLeaf3ToLeafW(Pjlw_t, Pjv_t, Pjp_t, Word_t, Pvoid_t); +#else +extern Word_t j__udyLLeaf3ToLeaf4(uint32_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udyLLeaf4ToLeaf5(uint8_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udyLLeaf5ToLeaf6(uint8_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udyLLeaf6ToLeaf7(uint8_t *, Pjv_t, Pjp_t, Word_t, Pvoid_t); +extern Word_t j__udyLLeaf7ToLeafW(Pjlw_t, Pjv_t, Pjp_t, Word_t, Pvoid_t); +#endif + +#endif // JUDYL + +// For convenience in the calling code; "M1" means "minus one": + +#ifndef JU_64BIT +#define j__udyLeafM1ToLeafW j__udyLeaf3ToLeafW +#else +#define j__udyLeafM1ToLeafW j__udyLeaf7ToLeafW +#endif + + +// **************************************************************************** +// __ J U D Y D E L W A L K +// +// Given a pointer to a JP, an Index known to be valid, the number of bytes +// left to decode (== level in the tree), and a pointer to a global JPM, walk a +// Judy (sub)tree to do an unset/delete of that index, and possibly modify the +// JPM. This function is only called internally, and recursively. Unlike +// Judy1Test() and JudyLGet(), the extra time required for recursion should be +// negligible compared with the total. +// +// Return values: +// +// -1 error; details in JPM +// +// 0 Index already deleted (should never happen, Index is known to be valid) +// +// 1 previously valid Index deleted +// +// 2 same as 1, but in addition the JP now points to a BranchL containing a +// single JP, which should be compressed into the parent branch (if there +// is one, which is not the case for a top-level branch under a JPM) + +DBGCODE(uint8_t parentJPtype;) // parent branch JP type. + +FUNCTION static int j__udyDelWalk( + Pjp_t Pjp, // current JP under which to delete. + Word_t Index, // to delete. + Word_t ParentLevel, // of parent branch. + Pjpm_t Pjpm) // for returning info to top level. +{ + Word_t pop1; // of a leaf. + Word_t level; // of a leaf. + uint8_t digit; // from Index, in current branch. + Pjll_t PjllnewRaw; // address of newly allocated leaf. + Pjll_t Pjllnew; + int offset; // within a branch. + int retcode; // return code: -1, 0, 1, 2. +JUDYLCODE(Pjv_t PjvRaw;) // value area. +JUDYLCODE(Pjv_t Pjv;) + + DBGCODE(level = 0;) + +ContinueDelWalk: // for modifying state without recursing. + +#ifdef TRACEJP + JudyPrintJP(Pjp, "d", __LINE__); +#endif + + switch (JU_JPTYPE(Pjp)) // entry: Pjp, Index. + { + + +// **************************************************************************** +// LINEAR BRANCH: +// +// MACROS FOR COMMON CODE: +// +// Check for population too high to compress a branch to a leaf, meaning just +// descend through the branch, with a purposeful off-by-one error that +// constitutes hysteresis = 1. In other words, do not compress until the +// branchs CURRENT population fits in the leaf, even BEFORE deleting one +// index. +// +// Next is a label for branch-type-specific common code. Variables pop1, +// level, digit, and Index are in the context. + +#define JU_BRANCH_KEEP(cLevel,MaxPop1,Next) \ + if (pop1 > (MaxPop1)) /* hysteresis = 1 */ \ + { \ + assert((cLevel) >= 2); \ + level = (cLevel); \ + digit = JU_DIGITATSTATE(Index, cLevel); \ + goto Next; \ + } + +// Support for generic calling of JudyLeaf*ToLeaf*() functions: +// +// Note: Cannot use JUDYLCODE() because this contains a comma. + +#ifdef JUDY1 +#define JU_PVALUEPASS // null. +#else +#define JU_PVALUEPASS Pjv, +#endif + +// During compression to a leaf, check if a JP contains nothing but a +// cJU_JPIMMED_*_01, in which case shortcut calling j__udyLeaf*ToLeaf*(): +// +// Copy the index bytes from the jp_DcdPopO field (with possible truncation), +// and continue the branch-JP-walk loop. Variables Pjp and Pleaf are in the +// context. + +#define JU_BRANCH_COPY_IMMED_EVEN(cLevel,Pjp,ignore) \ + if (JU_JPTYPE(Pjp) == cJU_JPIMMED_1_01 + (cLevel) - 2) \ + { \ + *Pleaf++ = JU_JPDCDPOP0(Pjp); \ + JUDYLCODE(*Pjv++ = (Pjp)->jp_Addr;) \ + continue; /* for-loop */ \ + } + +#define JU_BRANCH_COPY_IMMED_ODD(cLevel,Pjp,CopyIndex) \ + if (JU_JPTYPE(Pjp) == cJU_JPIMMED_1_01 + (cLevel) - 2) \ + { \ + CopyIndex(Pleaf, (Word_t) (JU_JPDCDPOP0(Pjp))); \ + Pleaf += (cLevel); /* index size = level */ \ + JUDYLCODE(*Pjv++ = (Pjp)->jp_Addr;) \ + continue; /* for-loop */ \ + } + +// Compress a BranchL into a leaf one index size larger: +// +// Allocate a new leaf, walk the JPs in the old BranchL and pack their contents +// into the new leaf (of type NewJPType), free the old BranchL, and finally +// restart the switch to delete Index from the new leaf. (Note that all +// BranchLs are the same size.) Variables Pjp, Pjpm, Pleaf, digit, and pop1 +// are in the context. + +#define JU_BRANCHL_COMPRESS(cLevel,LeafType,MaxPop1,NewJPType, \ + LeafToLeaf,Alloc,ValueArea, \ + CopyImmed,CopyIndex) \ + { \ + LeafType Pleaf; \ + Pjbl_t PjblRaw; \ + Pjbl_t Pjbl; \ + Word_t numJPs; \ + \ + if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1); \ + Pjllnew = P_JLL(PjllnewRaw); \ + Pleaf = (LeafType) Pjllnew; \ + JUDYLCODE(Pjv = ValueArea(Pleaf, MaxPop1);) \ + \ + PjblRaw = (Pjbl_t) (Pjp->jp_Addr); \ + Pjbl = P_JBL(PjblRaw); \ + numJPs = Pjbl->jbl_NumJPs; \ + \ + for (offset = 0; offset < numJPs; ++offset) \ + { \ + CopyImmed(cLevel, (Pjbl->jbl_jp) + offset, CopyIndex); \ + \ + pop1 = LeafToLeaf(Pleaf, JU_PVALUEPASS \ + (Pjbl->jbl_jp) + offset, \ + JU_DIGITTOSTATE(Pjbl->jbl_Expanse[offset], \ + cLevel), (Pvoid_t) Pjpm); \ + Pleaf = (LeafType) (((Word_t) Pleaf) + ((cLevel) * pop1)); \ + JUDYLCODE(Pjv += pop1;) \ + } \ + assert(((((Word_t) Pleaf) - ((Word_t) Pjllnew)) / (cLevel)) == (MaxPop1)); \ + JUDYLCODE(assert((Pjv - ValueArea(Pjllnew, MaxPop1)) == (MaxPop1));) \ + DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cLevel);) \ + \ + j__udyFreeJBL(PjblRaw, Pjpm); \ + \ + Pjp->jp_Type = (NewJPType); \ + Pjp->jp_Addr = (Word_t) PjllnewRaw; \ + goto ContinueDelWalk; /* delete from new leaf */ \ + } + +// Overall common code for initial BranchL deletion handling: +// +// Assert that Index is in the branch, then see if the BranchL should be kept +// or else compressed to a leaf. Variables Index, Pjp, and pop1 are in the +// context. + +#define JU_BRANCHL(cLevel,MaxPop1,LeafType,NewJPType, \ + LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex) \ + \ + assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel)); \ + assert(ParentLevel > (cLevel)); \ + \ + pop1 = JU_JPBRANCH_POP0(Pjp, cLevel) + 1; \ + JU_BRANCH_KEEP(cLevel, MaxPop1, BranchLKeep); \ + assert(pop1 == (MaxPop1)); \ + \ + JU_BRANCHL_COMPRESS(cLevel, LeafType, MaxPop1, NewJPType, \ + LeafToLeaf, Alloc, ValueArea, CopyImmed, CopyIndex) + + +// END OF MACROS, START OF CASES: + + case cJU_JPBRANCH_L2: + + JU_BRANCHL(2, cJU_LEAF2_MAXPOP1, uint16_t *, cJU_JPLEAF2, + j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA, + JU_BRANCH_COPY_IMMED_EVEN, ignore); + + case cJU_JPBRANCH_L3: + + JU_BRANCHL(3, cJU_LEAF3_MAXPOP1, uint8_t *, cJU_JPLEAF3, + j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY3_LONG_TO_PINDEX); + +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: + + JU_BRANCHL(4, cJU_LEAF4_MAXPOP1, uint32_t *, cJU_JPLEAF4, + j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA, + JU_BRANCH_COPY_IMMED_EVEN, ignore); + + case cJU_JPBRANCH_L5: + + JU_BRANCHL(5, cJU_LEAF5_MAXPOP1, uint8_t *, cJU_JPLEAF5, + j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY5_LONG_TO_PINDEX); + + case cJU_JPBRANCH_L6: + + JU_BRANCHL(6, cJU_LEAF6_MAXPOP1, uint8_t *, cJU_JPLEAF6, + j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY6_LONG_TO_PINDEX); + + case cJU_JPBRANCH_L7: + + JU_BRANCHL(7, cJU_LEAF7_MAXPOP1, uint8_t *, cJU_JPLEAF7, + j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY7_LONG_TO_PINDEX); +#endif // JU_64BIT + +// A top-level BranchL is different and cannot use JU_BRANCHL(): Dont try to +// compress to a (LEAFW) leaf yet, but leave this for a later deletion +// (hysteresis > 0); and the next JP type depends on the system word size; so +// dont use JU_BRANCH_KEEP(): + + case cJU_JPBRANCH_L: + { + Pjbl_t Pjbl; + Word_t numJPs; + + level = cJU_ROOTSTATE; + digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + + // fall through: + + +// COMMON CODE FOR KEEPING AND DESCENDING THROUGH A BRANCHL: +// +// Come here with level and digit set. + +BranchLKeep: + Pjbl = P_JBL(Pjp->jp_Addr); + numJPs = Pjbl->jbl_NumJPs; + assert(numJPs > 0); + DBGCODE(parentJPtype = JU_JPTYPE(Pjp);) + +// Search for a match to the digit (valid Index => must find digit): + + for (offset = 0; (Pjbl->jbl_Expanse[offset]) != digit; ++offset) + assert(offset < numJPs - 1); + + Pjp = (Pjbl->jbl_jp) + offset; + +// If not at a (deletable) JPIMMED_*_01, continue the walk (to descend through +// the BranchL): + + assert(level >= 2); + if ((JU_JPTYPE(Pjp)) != cJU_JPIMMED_1_01 + level - 2) break; + +// At JPIMMED_*_01: Ensure the index is in the right expanse, then delete the +// Immed from the BranchL: +// +// Note: A BranchL has a fixed size and format regardless of numJPs. + + assert(JU_JPDCDPOP0(Pjp) == JU_TRIMTODCDSIZE(Index)); + + JU_DELETEINPLACE(Pjbl->jbl_Expanse, numJPs, offset, ignore); + JU_DELETEINPLACE(Pjbl->jbl_jp, numJPs, offset, ignore); + + DBGCODE(JudyCheckSorted((Pjll_t) (Pjbl->jbl_Expanse), + numJPs - 1, 1);) + +// If only one index left in the BranchL, indicate this to the caller: + + return ((--(Pjbl->jbl_NumJPs) <= 1) ? 2 : 1); + + } // case cJU_JPBRANCH_L. + + +// **************************************************************************** +// BITMAP BRANCH: +// +// MACROS FOR COMMON CODE: +// +// Note the reuse of common macros here, defined earlier: JU_BRANCH_KEEP(), +// JU_PVALUE*. +// +// Compress a BranchB into a leaf one index size larger: +// +// Allocate a new leaf, walk the JPs in the old BranchB (one bitmap subexpanse +// at a time) and pack their contents into the new leaf (of type NewJPType), +// free the old BranchB, and finally restart the switch to delete Index from +// the new leaf. Variables Pjp, Pjpm, Pleaf, digit, and pop1 are in the +// context. +// +// Note: Its no accident that the interface to JU_BRANCHB_COMPRESS() is +// identical to JU_BRANCHL_COMPRESS(). Only the details differ in how to +// traverse the branchs JPs. + +#define JU_BRANCHB_COMPRESS(cLevel,LeafType,MaxPop1,NewJPType, \ + LeafToLeaf,Alloc,ValueArea, \ + CopyImmed,CopyIndex) \ + { \ + LeafType Pleaf; \ + Pjbb_t PjbbRaw; /* BranchB to compress */ \ + Pjbb_t Pjbb; \ + Word_t subexp; /* current subexpanse number */ \ + BITMAPB_t bitmap; /* portion for this subexpanse */ \ + Pjp_t Pjp2Raw; /* one subexpanses subarray */ \ + Pjp_t Pjp2; \ + \ + if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1); \ + Pjllnew = P_JLL(PjllnewRaw); \ + Pleaf = (LeafType) Pjllnew; \ + JUDYLCODE(Pjv = ValueArea(Pleaf, MaxPop1);) \ + \ + PjbbRaw = (Pjbb_t) (Pjp->jp_Addr); \ + Pjbb = P_JBB(PjbbRaw); \ + \ + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) \ + { \ + if ((bitmap = JU_JBB_BITMAP(Pjbb, subexp)) == 0) \ + continue; /* empty subexpanse */ \ + \ + digit = subexp * cJU_BITSPERSUBEXPB; \ + Pjp2Raw = JU_JBB_PJP(Pjbb, subexp); \ + Pjp2 = P_JP(Pjp2Raw); \ + assert(Pjp2 != (Pjp_t) NULL); \ + \ + for (offset = 0; bitmap != 0; bitmap >>= 1, ++digit) \ + { \ + if (! (bitmap & 1)) \ + continue; /* empty sub-subexpanse */ \ + \ + ++offset; /* before any continue */ \ + \ + CopyImmed(cLevel, Pjp2 + offset - 1, CopyIndex); \ + \ + pop1 = LeafToLeaf(Pleaf, JU_PVALUEPASS \ + Pjp2 + offset - 1, \ + JU_DIGITTOSTATE(digit, cLevel), \ + (Pvoid_t) Pjpm); \ + Pleaf = (LeafType) (((Word_t) Pleaf) + ((cLevel) * pop1)); \ + JUDYLCODE(Pjv += pop1;) \ + } \ + j__udyFreeJBBJP(Pjp2Raw, /* pop1 = */ offset, Pjpm); \ + } \ + assert(((((Word_t) Pleaf) - ((Word_t) Pjllnew)) / (cLevel)) == (MaxPop1)); \ + JUDYLCODE(assert((Pjv - ValueArea(Pjllnew, MaxPop1)) == (MaxPop1));) \ + DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cLevel);) \ + \ + j__udyFreeJBB(PjbbRaw, Pjpm); \ + \ + Pjp->jp_Type = (NewJPType); \ + Pjp->jp_Addr = (Word_t) PjllnewRaw; \ + goto ContinueDelWalk; /* delete from new leaf */ \ + } + +// Overall common code for initial BranchB deletion handling: +// +// Assert that Index is in the branch, then see if the BranchB should be kept +// or else compressed to a leaf. Variables Index, Pjp, and pop1 are in the +// context. + +#define JU_BRANCHB(cLevel,MaxPop1,LeafType,NewJPType, \ + LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex) \ + \ + assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel)); \ + assert(ParentLevel > (cLevel)); \ + \ + pop1 = JU_JPBRANCH_POP0(Pjp, cLevel) + 1; \ + JU_BRANCH_KEEP(cLevel, MaxPop1, BranchBKeep); \ + assert(pop1 == (MaxPop1)); \ + \ + JU_BRANCHB_COMPRESS(cLevel, LeafType, MaxPop1, NewJPType, \ + LeafToLeaf, Alloc, ValueArea, CopyImmed, CopyIndex) + + +// END OF MACROS, START OF CASES: +// +// Note: Its no accident that the macro calls for these cases is nearly +// identical to the code for BranchLs. + + case cJU_JPBRANCH_B2: + + JU_BRANCHB(2, cJU_LEAF2_MAXPOP1, uint16_t *, cJU_JPLEAF2, + j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA, + JU_BRANCH_COPY_IMMED_EVEN, ignore); + + case cJU_JPBRANCH_B3: + + JU_BRANCHB(3, cJU_LEAF3_MAXPOP1, uint8_t *, cJU_JPLEAF3, + j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY3_LONG_TO_PINDEX); + +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: + + JU_BRANCHB(4, cJU_LEAF4_MAXPOP1, uint32_t *, cJU_JPLEAF4, + j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA, + JU_BRANCH_COPY_IMMED_EVEN, ignore); + + case cJU_JPBRANCH_B5: + + JU_BRANCHB(5, cJU_LEAF5_MAXPOP1, uint8_t *, cJU_JPLEAF5, + j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY5_LONG_TO_PINDEX); + + case cJU_JPBRANCH_B6: + + JU_BRANCHB(6, cJU_LEAF6_MAXPOP1, uint8_t *, cJU_JPLEAF6, + j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY6_LONG_TO_PINDEX); + + case cJU_JPBRANCH_B7: + + JU_BRANCHB(7, cJU_LEAF7_MAXPOP1, uint8_t *, cJU_JPLEAF7, + j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY7_LONG_TO_PINDEX); +#endif // JU_64BIT + +// A top-level BranchB is different and cannot use JU_BRANCHB(): Dont try to +// compress to a (LEAFW) leaf yet, but leave this for a later deletion +// (hysteresis > 0); and the next JP type depends on the system word size; so +// dont use JU_BRANCH_KEEP(): + + case cJU_JPBRANCH_B: + { + Pjbb_t Pjbb; // BranchB to modify. + Word_t subexp; // current subexpanse number. + Word_t subexp2; // in second-level loop. + BITMAPB_t bitmap; // portion for this subexpanse. + BITMAPB_t bitmask; // with digits bit set. + Pjp_t Pjp2Raw; // one subexpanses subarray. + Pjp_t Pjp2; + Word_t numJPs; // in one subexpanse. + + level = cJU_ROOTSTATE; + digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + + // fall through: + + +// COMMON CODE FOR KEEPING AND DESCENDING THROUGH A BRANCHB: +// +// Come here with level and digit set. + +BranchBKeep: + Pjbb = P_JBB(Pjp->jp_Addr); + subexp = digit / cJU_BITSPERSUBEXPB; + bitmap = JU_JBB_BITMAP(Pjbb, subexp); + bitmask = JU_BITPOSMASKB(digit); + assert(bitmap & bitmask); // Index valid => digits bit is set. + DBGCODE(parentJPtype = JU_JPTYPE(Pjp);) + +// Compute digits offset into the bitmap, with a fast method if all bits are +// set: + + offset = ((bitmap == (cJU_FULLBITMAPB)) ? + digit % cJU_BITSPERSUBEXPB : + j__udyCountBitsB(bitmap & JU_MASKLOWEREXC(bitmask))); + + Pjp2Raw = JU_JBB_PJP(Pjbb, subexp); + Pjp2 = P_JP(Pjp2Raw); + assert(Pjp2 != (Pjp_t) NULL); // valid subexpanse pointer. + +// If not at a (deletable) JPIMMED_*_01, continue the walk (to descend through +// the BranchB): + + if (JU_JPTYPE(Pjp2 + offset) != cJU_JPIMMED_1_01 + level - 2) + { + Pjp = Pjp2 + offset; + break; + } + +// At JPIMMED_*_01: Ensure the index is in the right expanse, then delete the +// Immed from the BranchB: + + assert(JU_JPDCDPOP0(Pjp2 + offset) + == JU_TRIMTODCDSIZE(Index)); + +// If only one index is left in the subexpanse, free the JP array: + + if ((numJPs = j__udyCountBitsB(bitmap)) == 1) + { + j__udyFreeJBBJP(Pjp2Raw, /* pop1 = */ 1, Pjpm); + JU_JBB_PJP(Pjbb, subexp) = (Pjp_t) NULL; + } + +// Shrink JP array in-place: + + else if (JU_BRANCHBJPGROWINPLACE(numJPs - 1)) + { + assert(numJPs > 0); + JU_DELETEINPLACE(Pjp2, numJPs, offset, ignore); + } + +// JP array would end up too large; compress it to a smaller one: + + else + { + Pjp_t PjpnewRaw; + Pjp_t Pjpnew; + + if ((PjpnewRaw = j__udyAllocJBBJP(numJPs - 1, Pjpm)) + == (Pjp_t) NULL) return(-1); + Pjpnew = P_JP(PjpnewRaw); + + JU_DELETECOPY(Pjpnew, Pjp2, numJPs, offset, ignore); + j__udyFreeJBBJP(Pjp2Raw, numJPs, Pjpm); // old. + + JU_JBB_PJP(Pjbb, subexp) = PjpnewRaw; + } + +// Clear digits bit in the bitmap: + + JU_JBB_BITMAP(Pjbb, subexp) ^= bitmask; + +// If the current subexpanse alone is still too large for a BranchL (with +// hysteresis = 1), the delete is all done: + + if (numJPs > cJU_BRANCHLMAXJPS) return(1); + +// Consider shrinking the current BranchB to a BranchL: +// +// Check the numbers of JPs in other subexpanses in the BranchL. Upon reaching +// the critical number of numJPs (which could be right at the start; again, +// with hysteresis = 1), its faster to just watch for any non-empty subexpanse +// than to count bits in each subexpanse. Upon finding too many JPs, give up +// on shrinking the BranchB. + + for (subexp2 = 0; subexp2 < cJU_NUMSUBEXPB; ++subexp2) + { + if (subexp2 == subexp) continue; // skip current subexpanse. + + if ((numJPs == cJU_BRANCHLMAXJPS) ? + JU_JBB_BITMAP(Pjbb, subexp2) : + ((numJPs += j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp2))) + > cJU_BRANCHLMAXJPS)) + { + return(1); // too many JPs, cannot shrink. + } + } + +// Shrink current BranchB to a BranchL: +// +// Note: In this rare case, ignore the return value, do not pass it to the +// caller, because the deletion is already successfully completed and the +// caller(s) must decrement population counts. The only errors expected from +// this call are JU_ERRNO_NOMEM and JU_ERRNO_OVERRUN, neither of which is worth +// forwarding from this point. See also 4.1, 4.8, and 4.15 of this file. + + (void) j__udyBranchBToBranchL(Pjp, Pjpm); + return(1); + + } // case. + + +// **************************************************************************** +// UNCOMPRESSED BRANCH: +// +// MACROS FOR COMMON CODE: +// +// Note the reuse of common macros here, defined earlier: JU_PVALUE*. +// +// Compress a BranchU into a leaf one index size larger: +// +// Allocate a new leaf, walk the JPs in the old BranchU and pack their contents +// into the new leaf (of type NewJPType), free the old BranchU, and finally +// restart the switch to delete Index from the new leaf. Variables Pjp, Pjpm, +// digit, and pop1 are in the context. +// +// Note: Its no accident that the interface to JU_BRANCHU_COMPRESS() is +// nearly identical to JU_BRANCHL_COMPRESS(); just NullJPType is added. The +// details differ in how to traverse the branchs JPs -- +// +// -- and also, what to do upon encountering a cJU_JPIMMED_*_01 JP. In +// BranchLs and BranchBs the JP must be deleted, but in a BranchU its merely +// converted to a null JP, and this is done by other switch cases, so the "keep +// branch" situation is simpler here and JU_BRANCH_KEEP() is not used. Also, +// theres no code to convert a BranchU to a BranchB since counting the JPs in +// a BranchU is (at least presently) expensive, and besides, keeping around a +// BranchU is form of hysteresis. + +#define JU_BRANCHU_COMPRESS(cLevel,LeafType,MaxPop1,NullJPType,NewJPType, \ + LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex) \ + { \ + LeafType Pleaf; \ + Pjbu_t PjbuRaw = (Pjbu_t) (Pjp->jp_Addr); \ + Pjp_t Pjp2 = JU_JBU_PJP0(Pjp); \ + Word_t ldigit; /* larger than uint8_t */ \ + \ + if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1); \ + Pjllnew = P_JLL(PjllnewRaw); \ + Pleaf = (LeafType) Pjllnew; \ + JUDYLCODE(Pjv = ValueArea(Pleaf, MaxPop1);) \ + \ + for (ldigit = 0; ldigit < cJU_BRANCHUNUMJPS; ++ldigit, ++Pjp2) \ + { \ + /* fast-process common types: */ \ + if (JU_JPTYPE(Pjp2) == (NullJPType)) continue; \ + CopyImmed(cLevel, Pjp2, CopyIndex); \ + \ + pop1 = LeafToLeaf(Pleaf, JU_PVALUEPASS Pjp2, \ + JU_DIGITTOSTATE(ldigit, cLevel), \ + (Pvoid_t) Pjpm); \ + Pleaf = (LeafType) (((Word_t) Pleaf) + ((cLevel) * pop1)); \ + JUDYLCODE(Pjv += pop1;) \ + } \ + assert(((((Word_t) Pleaf) - ((Word_t) Pjllnew)) / (cLevel)) == (MaxPop1)); \ + JUDYLCODE(assert((Pjv - ValueArea(Pjllnew, MaxPop1)) == (MaxPop1));) \ + DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cLevel);) \ + \ + j__udyFreeJBU(PjbuRaw, Pjpm); \ + \ + Pjp->jp_Type = (NewJPType); \ + Pjp->jp_Addr = (Word_t) PjllnewRaw; \ + goto ContinueDelWalk; /* delete from new leaf */ \ + } + +// Overall common code for initial BranchU deletion handling: +// +// Assert that Index is in the branch, then see if a BranchU should be kept or +// else compressed to a leaf. Variables level, Index, Pjp, and pop1 are in the +// context. +// +// Note: BranchU handling differs from BranchL and BranchB as described above. + +#define JU_BRANCHU(cLevel,MaxPop1,LeafType,NullJPType,NewJPType, \ + LeafToLeaf,Alloc,ValueArea,CopyImmed,CopyIndex) \ + \ + assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel)); \ + assert(ParentLevel > (cLevel)); \ + DBGCODE(parentJPtype = JU_JPTYPE(Pjp);) \ + \ + pop1 = JU_JPBRANCH_POP0(Pjp, cLevel) + 1; \ + \ + if (pop1 > (MaxPop1)) /* hysteresis = 1 */ \ + { \ + level = (cLevel); \ + Pjp = P_JP(Pjp->jp_Addr) + JU_DIGITATSTATE(Index, cLevel);\ + break; /* descend to next level */ \ + } \ + assert(pop1 == (MaxPop1)); \ + \ + JU_BRANCHU_COMPRESS(cLevel, LeafType, MaxPop1, NullJPType, NewJPType, \ + LeafToLeaf, Alloc, ValueArea, CopyImmed, CopyIndex) + + +// END OF MACROS, START OF CASES: +// +// Note: Its no accident that the macro calls for these cases is nearly +// identical to the code for BranchLs, with the addition of cJU_JPNULL* +// parameters only needed for BranchUs. + + case cJU_JPBRANCH_U2: + + JU_BRANCHU(2, cJU_LEAF2_MAXPOP1, uint16_t *, + cJU_JPNULL1, cJU_JPLEAF2, + j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA, + JU_BRANCH_COPY_IMMED_EVEN, ignore); + + case cJU_JPBRANCH_U3: + + JU_BRANCHU(3, cJU_LEAF3_MAXPOP1, uint8_t *, + cJU_JPNULL2, cJU_JPLEAF3, + j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY3_LONG_TO_PINDEX); + +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: + + JU_BRANCHU(4, cJU_LEAF4_MAXPOP1, uint32_t *, + cJU_JPNULL3, cJU_JPLEAF4, + j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA, + JU_BRANCH_COPY_IMMED_EVEN, ignore); + + case cJU_JPBRANCH_U5: + + JU_BRANCHU(5, cJU_LEAF5_MAXPOP1, uint8_t *, + cJU_JPNULL4, cJU_JPLEAF5, + j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY5_LONG_TO_PINDEX); + + case cJU_JPBRANCH_U6: + + JU_BRANCHU(6, cJU_LEAF6_MAXPOP1, uint8_t *, + cJU_JPNULL5, cJU_JPLEAF6, + j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY6_LONG_TO_PINDEX); + + case cJU_JPBRANCH_U7: + + JU_BRANCHU(7, cJU_LEAF7_MAXPOP1, uint8_t *, + cJU_JPNULL6, cJU_JPLEAF7, + j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA, + JU_BRANCH_COPY_IMMED_ODD, JU_COPY7_LONG_TO_PINDEX); +#endif // JU_64BIT + +// A top-level BranchU is different and cannot use JU_BRANCHU(): Dont try to +// compress to a (LEAFW) leaf yet, but leave this for a later deletion +// (hysteresis > 0); just descend through the BranchU: + + case cJU_JPBRANCH_U: + + DBGCODE(parentJPtype = JU_JPTYPE(Pjp);) + + level = cJU_ROOTSTATE; + Pjp = P_JP(Pjp->jp_Addr) + JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + break; + + +// **************************************************************************** +// LINEAR LEAF: +// +// State transitions while deleting an Index, the inverse of the similar table +// that appears in JudyIns.c: +// +// Note: In JudyIns.c this table is not needed and does not appear until the +// Immed handling code; because once a Leaf is reached upon growing the tree, +// the situation remains simpler, but for deleting indexes, the complexity +// arises when leaves must compress to Immeds. +// +// Note: There are other transitions possible too, not shown here, such as to +// a leaf one level higher. +// +// (Yes, this is very terse... Study it and it will make sense.) +// (Note, parts of this diagram are repeated below for quick reference.) +// +// reformat JP here for Judy1 only, from word-1 to word-2 +// | +// JUDY1 && JU_64BIT JUDY1 || JU_64BIT | +// V +// (*) Leaf1 [[ => 1_15..08 ] => 1_07 => ... => 1_04 ] => 1_03 => 1_02 => 1_01 +// Leaf2 [[ => 2_07..04 ] => 2_03 => 2_02 ] => 2_01 +// Leaf3 [[ => 3_05..03 ] => 3_02 ] => 3_01 +// JU_64BIT only: +// Leaf4 [[ => 4_03..02 ]] => 4_01 +// Leaf5 [[ => 5_03..02 ]] => 5_01 +// Leaf6 [[ => 6_02 ]] => 6_01 +// Leaf7 [[ => 7_02 ]] => 7_01 +// +// (*) For Judy1 & 64-bit, go directly from a LeafB1 to cJU_JPIMMED_1_15; skip +// Leaf1, as described in Judy1.h regarding cJ1_JPLEAF1. +// +// MACROS FOR COMMON CODE: +// +// (De)compress a LeafX into a LeafY one index size (cIS) larger (X+1 = Y): +// +// This is only possible when the current leaf is under a narrow pointer +// ((ParentLevel - 1) > cIS) and its population fits in a higher-level leaf. +// Variables ParentLevel, pop1, PjllnewRaw, Pjllnew, Pjpm, and Index are in the +// context. +// +// Note: Doing an "uplevel" doesnt occur until the old leaf can be compressed +// up one level BEFORE deleting an index; that is, hysteresis = 1. +// +// Note: LeafType, MaxPop1, NewJPType, and Alloc refer to the up-level leaf, +// not the current leaf. +// +// Note: 010327: Fixed bug where the jp_DcdPopO next-uplevel digit (byte) +// above the current Pop0 value was not being cleared. When upleveling, one +// digit in jp_DcdPopO "moves" from being part of the Dcd subfield to the Pop0 +// subfield, but since a leaf maxpop1 is known to be <= 1 byte in size, the new +// Pop0 byte should always be zero. This is easy to overlook because +// JU_JPLEAF_POP0() "knows" to only use the LSB of Pop0 (for efficiency) and +// ignore the other bytes... Until someone uses cJU_POP0MASK() instead of +// JU_JPLEAF_POP0(), such as in JudyInsertBranch.c. +// +// TBD: Should JudyInsertBranch.c use JU_JPLEAF_POP0() rather than +// cJU_POP0MASK(), for efficiency? Does it know for sure its a narrow pointer +// under the leaf? Not necessarily. + +#define JU_LEAF_UPLEVEL(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf, \ + Alloc,ValueArea) \ + \ + assert(((ParentLevel - 1) == (cIS)) || (pop1 >= (MaxPop1))); \ + \ + if (((ParentLevel - 1) > (cIS)) /* under narrow pointer */ \ + && (pop1 == (MaxPop1))) /* hysteresis = 1 */ \ + { \ + Word_t D_cdP0; \ + if ((PjllnewRaw = Alloc(MaxPop1, Pjpm)) == 0) return(-1); \ + Pjllnew = P_JLL(PjllnewRaw); \ + JUDYLCODE(Pjv = ValueArea((LeafType) Pjllnew, MaxPop1);) \ + \ + (void) LeafToLeaf((LeafType) Pjllnew, JU_PVALUEPASS Pjp, \ + Index & cJU_DCDMASK(cIS), /* TBD, Doug says */ \ + (Pvoid_t) Pjpm); \ + DBGCODE(JudyCheckSorted(Pjllnew, MaxPop1, cIS + 1);) \ + \ + D_cdP0 = (~cJU_MASKATSTATE((cIS) + 1)) & JU_JPDCDPOP0(Pjp); \ + JU_JPSETADT(Pjp, (Word_t)PjllnewRaw, D_cdP0, NewJPType); \ + goto ContinueDelWalk; /* delete from new leaf */ \ + } + + +// For Leaf3, only support JU_LEAF_UPLEVEL on a 64-bit system, and for Leaf7, +// there is no JU_LEAF_UPLEVEL: +// +// Note: Theres no way here to go from Leaf3 [Leaf7] to LEAFW on a 32-bit +// [64-bit] system. Thats handled in the main code, because its different in +// that a JPM is involved. + +#ifndef JU_64BIT // 32-bit. +#define JU_LEAF_UPLEVEL64(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf, \ + Alloc,ValueArea) // null. +#else +#define JU_LEAF_UPLEVEL64(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf, \ + Alloc,ValueArea) \ + JU_LEAF_UPLEVEL (cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf, \ + Alloc,ValueArea) +#define JU_LEAF_UPLEVEL_NONE(cIS,LeafType,MaxPop1,NewJPType,LeafToLeaf, \ + Alloc,ValueArea) // null. +#endif + +// Compress a Leaf* with pop1 = 2, or a JPIMMED_*_02, into a JPIMMED_*_01: +// +// Copy whichever Index is NOT being deleted (and assert that the other one is +// found; Index must be valid). This requires special handling of the Index +// bytes (and value area). Variables Pjp, Index, offset, and Pleaf are in the +// context, offset is modified to the undeleted Index, and Pjp is modified +// including jp_Addr. + + +#define JU_TOIMMED_01_EVEN(cIS,ignore1,ignore2) \ +{ \ + Word_t D_cdP0; \ + Word_t A_ddr = 0; \ + uint8_t T_ype = JU_JPTYPE(Pjp); \ + offset = (Pleaf[0] == JU_LEASTBYTES(Index, cIS)); /* undeleted Ind */ \ + assert(Pleaf[offset ? 0 : 1] == JU_LEASTBYTES(Index, cIS)); \ + D_cdP0 = (Index & cJU_DCDMASK(cIS)) | Pleaf[offset]; \ +JUDYLCODE(A_ddr = Pjv[offset];) \ + JU_JPSETADT(Pjp, A_ddr, D_cdP0, T_ype); \ +} + +#define JU_TOIMMED_01_ODD(cIS,SearchLeaf,CopyPIndex) \ + { \ + Word_t D_cdP0; \ + Word_t A_ddr = 0; \ + uint8_t T_ype = JU_JPTYPE(Pjp); \ + \ + offset = SearchLeaf(Pleaf, 2, Index); \ + assert(offset >= 0); /* Index must be valid */ \ + CopyPIndex(D_cdP0, & (Pleaf[offset ? 0 : cIS])); \ + D_cdP0 |= Index & cJU_DCDMASK(cIS); \ + JUDYLCODE(A_ddr = Pjv[offset ? 0 : 1];) \ + JU_JPSETADT(Pjp, A_ddr, D_cdP0, T_ype); \ + } + + +// Compress a Leaf* into a JPIMMED_*_0[2+]: +// +// This occurs as soon as its possible, with hysteresis = 0. Variables pop1, +// Pleaf, offset, and Pjpm are in the context. +// +// TBD: Explain why hysteresis = 0 here, rather than > 0. Probably because +// the insert code assumes if the population is small enough, an Immed is used, +// not a leaf. +// +// The differences between Judy1 and JudyL with respect to value area handling +// are just too large for completely common code between them... Oh well, some +// big ifdefs follow. + +#ifdef JUDY1 + +#define JU_LEAF_TOIMMED(cIS,LeafType,MaxPop1,BaseJPType,ignore1,\ + ignore2,ignore3,ignore4, \ + DeleteCopy,FreeLeaf) \ + \ + assert(pop1 > (MaxPop1)); \ + \ + if ((pop1 - 1) == (MaxPop1)) /* hysteresis = 0 */ \ + { \ + Pjll_t PjllRaw = (Pjll_t) (Pjp->jp_Addr); \ + DeleteCopy((LeafType) (Pjp->jp_1Index), Pleaf, pop1, offset, cIS); \ + DBGCODE(JudyCheckSorted((Pjll_t) (Pjp->jp_1Index), pop1-1, cIS);) \ + Pjp->jp_Type = (BaseJPType) - 1 + (MaxPop1) - 1; \ + FreeLeaf(PjllRaw, pop1, Pjpm); \ + return(1); \ + } + +#else // JUDYL + +// Pjv is also in the context. + +#define JU_LEAF_TOIMMED(cIS,LeafType,MaxPop1,BaseJPType,ignore1,\ + ignore2,ignore3,ignore4, \ + DeleteCopy,FreeLeaf) \ + \ + assert(pop1 > (MaxPop1)); \ + \ + if ((pop1 - 1) == (MaxPop1)) /* hysteresis = 0 */ \ + { \ + Pjll_t PjllRaw = (Pjll_t) (Pjp->jp_Addr); \ + Pjv_t PjvnewRaw; \ + Pjv_t Pjvnew; \ + \ + if ((PjvnewRaw = j__udyLAllocJV(pop1 - 1, Pjpm)) \ + == (Pjv_t) NULL) return(-1); \ + JUDYLCODE(Pjvnew = P_JV(PjvnewRaw);) \ + \ + DeleteCopy((LeafType) (Pjp->jp_LIndex), Pleaf, pop1, offset, cIS); \ + JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, cIS); \ + DBGCODE(JudyCheckSorted((Pjll_t) (Pjp->jp_LIndex), pop1-1, cIS);) \ + FreeLeaf(PjllRaw, pop1, Pjpm); \ + Pjp->jp_Addr = (Word_t) PjvnewRaw; \ + Pjp->jp_Type = (BaseJPType) - 2 + (MaxPop1); \ + return(1); \ + } + +// A complicating factor for JudyL & 32-bit is that Leaf2..3, and for JudyL & +// 64-bit Leaf 4..7, go directly to an Immed*_01, where the value is stored in +// jp_Addr and not in a separate LeafV. For efficiency, use the following +// macro in cases where it can apply; it is rigged to do the right thing. +// Unfortunately, this requires the calling code to "know" the transition table +// and call the right macro. +// +// This variant compresses a Leaf* with pop1 = 2 into a JPIMMED_*_01: + +#define JU_LEAF_TOIMMED_01(cIS,LeafType,MaxPop1,ignore,Immed01JPType, \ + ToImmed,SearchLeaf,CopyPIndex, \ + DeleteCopy,FreeLeaf) \ + \ + assert(pop1 > (MaxPop1)); \ + \ + if ((pop1 - 1) == (MaxPop1)) /* hysteresis = 0 */ \ + { \ + Pjll_t PjllRaw = (Pjll_t) (Pjp->jp_Addr); \ + ToImmed(cIS, SearchLeaf, CopyPIndex); \ + FreeLeaf(PjllRaw, pop1, Pjpm); \ + Pjp->jp_Type = (Immed01JPType); \ + return(1); \ + } +#endif // JUDYL + +// See comments above about these: +// +// Note: Here "23" means index size 2 or 3, and "47" means 4..7. + +#if (defined(JUDY1) || defined(JU_64BIT)) +#define JU_LEAF_TOIMMED_23(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \ + ToImmed,SearchLeaf,CopyPIndex, \ + DeleteCopy,FreeLeaf) \ + JU_LEAF_TOIMMED( cIS,LeafType,MaxPop1,BaseJPType,ignore1, \ + ignore2,ignore3,ignore4, \ + DeleteCopy,FreeLeaf) +#else // JUDYL && 32-bit +#define JU_LEAF_TOIMMED_23(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \ + ToImmed,SearchLeaf,CopyPIndex, \ + DeleteCopy,FreeLeaf) \ + JU_LEAF_TOIMMED_01(cIS,LeafType,MaxPop1,ignore,Immed01JPType, \ + ToImmed,SearchLeaf,CopyPIndex, \ + DeleteCopy,FreeLeaf) +#endif + +#ifdef JU_64BIT +#ifdef JUDY1 +#define JU_LEAF_TOIMMED_47(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \ + ToImmed,SearchLeaf,CopyPIndex, \ + DeleteCopy,FreeLeaf) \ + JU_LEAF_TOIMMED( cIS,LeafType,MaxPop1,BaseJPType,ignore1, \ + ignore2,ignore3,ignore4, \ + DeleteCopy,FreeLeaf) +#else // JUDYL && 64-bit +#define JU_LEAF_TOIMMED_47(cIS,LeafType,MaxPop1,BaseJPType,Immed01JPType, \ + ToImmed,SearchLeaf,CopyPIndex, \ + DeleteCopy,FreeLeaf) \ + JU_LEAF_TOIMMED_01(cIS,LeafType,MaxPop1,ignore,Immed01JPType, \ + ToImmed,SearchLeaf,CopyPIndex, \ + DeleteCopy,FreeLeaf) +#endif // JUDYL +#endif // JU_64BIT + +// Compress a Leaf* in place: +// +// Here hysteresis = 0 (no memory is wasted). Variables pop1, Pleaf, and +// offset, and for JudyL, Pjv, are in the context. + +#ifdef JUDY1 +#define JU_LEAF_INPLACE(cIS,GrowInPlace,DeleteInPlace) \ + if (GrowInPlace(pop1 - 1)) /* hysteresis = 0 */ \ + { \ + DeleteInPlace(Pleaf, pop1, offset, cIS); \ + DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);) \ + return(1); \ + } +#else +#define JU_LEAF_INPLACE(cIS,GrowInPlace,DeleteInPlace) \ + if (GrowInPlace(pop1 - 1)) /* hysteresis = 0 */ \ + { \ + DeleteInPlace(Pleaf, pop1, offset, cIS); \ +/**/ JU_DELETEINPLACE(Pjv, pop1, offset, ignore); \ + DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);) \ + return(1); \ + } +#endif + +// Compress a Leaf* into a smaller memory object of the same JP type: +// +// Variables PjllnewRaw, Pjllnew, Pleafpop1, Pjpm, PleafRaw, Pleaf, and offset +// are in the context. + +#ifdef JUDY1 + +#define JU_LEAF_SHRINK(cIS,LeafType,DeleteCopy,Alloc,FreeLeaf,ValueArea) \ + if ((PjllnewRaw = Alloc(pop1 - 1, Pjpm)) == 0) return(-1); \ + Pjllnew = P_JLL(PjllnewRaw); \ + DeleteCopy((LeafType) Pjllnew, Pleaf, pop1, offset, cIS); \ + DBGCODE(JudyCheckSorted(Pjllnew, pop1 - 1, cIS);) \ + FreeLeaf(PleafRaw, pop1, Pjpm); \ + Pjp->jp_Addr = (Word_t) PjllnewRaw; \ + return(1) + +#else // JUDYL + +#define JU_LEAF_SHRINK(cIS,LeafType,DeleteCopy,Alloc,FreeLeaf,ValueArea) \ + { \ +/**/ Pjv_t Pjvnew; \ + \ + if ((PjllnewRaw = Alloc(pop1 - 1, Pjpm)) == 0) return(-1); \ + Pjllnew = P_JLL(PjllnewRaw); \ +/**/ Pjvnew = ValueArea(Pjllnew, pop1 - 1); \ + DeleteCopy((LeafType) Pjllnew, Pleaf, pop1, offset, cIS); \ +/**/ JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, cIS); \ + DBGCODE(JudyCheckSorted(Pjllnew, pop1 - 1, cIS);) \ + FreeLeaf(PleafRaw, pop1, Pjpm); \ + Pjp->jp_Addr = (Word_t) PjllnewRaw; \ + return(1); \ + } +#endif // JUDYL + +// Overall common code for Leaf* deletion handling: +// +// See if the leaf can be: +// - (de)compressed to one a level higher (JU_LEAF_UPLEVEL()), or if not, +// - compressed to an Immediate JP (JU_LEAF_TOIMMED()), or if not, +// - shrunk in place (JU_LEAF_INPLACE()), or if none of those, then +// - shrink the leaf to a smaller chunk of memory (JU_LEAF_SHRINK()). +// +// Variables Pjp, pop1, Index, and offset are in the context. +// The *Up parameters refer to a leaf one level up, if there is any. + +#define JU_LEAF(cIS, \ + UpLevel, \ + LeafTypeUp,MaxPop1Up,LeafJPTypeUp,LeafToLeaf, \ + AllocUp,ValueAreaUp, \ + LeafToImmed,ToImmed,CopyPIndex, \ + LeafType,ImmedMaxPop1,ImmedBaseJPType,Immed01JPType, \ + SearchLeaf,GrowInPlace,DeleteInPlace,DeleteCopy, \ + Alloc,FreeLeaf,ValueArea) \ + { \ + Pjll_t PleafRaw; \ + LeafType Pleaf; \ + \ + assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, cIS)); \ + assert(ParentLevel > (cIS)); \ + \ + PleafRaw = (Pjll_t) (Pjp->jp_Addr); \ + Pleaf = (LeafType) P_JLL(PleafRaw); \ + pop1 = JU_JPLEAF_POP0(Pjp) + 1; \ + \ + UpLevel(cIS, LeafTypeUp, MaxPop1Up, LeafJPTypeUp, \ + LeafToLeaf, AllocUp, ValueAreaUp); \ + \ + offset = SearchLeaf(Pleaf, pop1, Index); \ + assert(offset >= 0); /* Index must be valid */ \ + JUDYLCODE(Pjv = ValueArea(Pleaf, pop1);) \ + \ + LeafToImmed(cIS, LeafType, ImmedMaxPop1, \ + ImmedBaseJPType, Immed01JPType, \ + ToImmed, SearchLeaf, CopyPIndex, \ + DeleteCopy, FreeLeaf); \ + \ + JU_LEAF_INPLACE(cIS, GrowInPlace, DeleteInPlace); \ + \ + JU_LEAF_SHRINK(cIS, LeafType, DeleteCopy, Alloc, FreeLeaf, \ + ValueArea); \ + } + +// END OF MACROS, START OF CASES: +// +// (*) Leaf1 [[ => 1_15..08 ] => 1_07 => ... => 1_04 ] => 1_03 => 1_02 => 1_01 + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: + + JU_LEAF(1, + JU_LEAF_UPLEVEL, uint16_t *, cJU_LEAF2_MAXPOP1, cJU_JPLEAF2, + j__udyLeaf1ToLeaf2, j__udyAllocJLL2, JL_LEAF2VALUEAREA, + JU_LEAF_TOIMMED, ignore, ignore, + uint8_t *, cJU_IMMED1_MAXPOP1, + cJU_JPIMMED_1_02, cJU_JPIMMED_1_01, j__udySearchLeaf1, + JU_LEAF1GROWINPLACE, JU_DELETEINPLACE, JU_DELETECOPY, + j__udyAllocJLL1, j__udyFreeJLL1, JL_LEAF1VALUEAREA); +#endif + +// A complicating factor is that for JudyL & 32-bit, a Leaf2 must go directly +// to an Immed 2_01 and a Leaf3 must go directly to an Immed 3_01: +// +// Leaf2 [[ => 2_07..04 ] => 2_03 => 2_02 ] => 2_01 +// Leaf3 [[ => 3_05..03 ] => 3_02 ] => 3_01 +// +// Hence use JU_LEAF_TOIMMED_23 instead of JU_LEAF_TOIMMED in the cases below, +// and also the parameters ToImmed and, for odd index sizes, CopyPIndex, are +// required. + + case cJU_JPLEAF2: + + JU_LEAF(2, + JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF3_MAXPOP1, cJU_JPLEAF3, + j__udyLeaf2ToLeaf3, j__udyAllocJLL3, JL_LEAF3VALUEAREA, + JU_LEAF_TOIMMED_23, JU_TOIMMED_01_EVEN, ignore, + uint16_t *, cJU_IMMED2_MAXPOP1, + cJU_JPIMMED_2_02, cJU_JPIMMED_2_01, j__udySearchLeaf2, + JU_LEAF2GROWINPLACE, JU_DELETEINPLACE, JU_DELETECOPY, + j__udyAllocJLL2, j__udyFreeJLL2, JL_LEAF2VALUEAREA); + +// On 32-bit there is no transition to "uplevel" for a Leaf3, so use +// JU_LEAF_UPLEVEL64 instead of JU_LEAF_UPLEVEL: + + case cJU_JPLEAF3: + + JU_LEAF(3, + JU_LEAF_UPLEVEL64, uint32_t *, cJU_LEAF4_MAXPOP1, + cJU_JPLEAF4, + j__udyLeaf3ToLeaf4, j__udyAllocJLL4, JL_LEAF4VALUEAREA, + JU_LEAF_TOIMMED_23, + JU_TOIMMED_01_ODD, JU_COPY3_PINDEX_TO_LONG, + uint8_t *, cJU_IMMED3_MAXPOP1, + cJU_JPIMMED_3_02, cJU_JPIMMED_3_01, j__udySearchLeaf3, + JU_LEAF3GROWINPLACE, JU_DELETEINPLACE_ODD, + JU_DELETECOPY_ODD, + j__udyAllocJLL3, j__udyFreeJLL3, JL_LEAF3VALUEAREA); + +#ifdef JU_64BIT + +// A complicating factor is that for JudyL & 64-bit, a Leaf[4-7] must go +// directly to an Immed [4-7]_01: +// +// Leaf4 [[ => 4_03..02 ]] => 4_01 +// Leaf5 [[ => 5_03..02 ]] => 5_01 +// Leaf6 [[ => 6_02 ]] => 6_01 +// Leaf7 [[ => 7_02 ]] => 7_01 +// +// Hence use JU_LEAF_TOIMMED_47 instead of JU_LEAF_TOIMMED in the cases below. + + case cJU_JPLEAF4: + + JU_LEAF(4, + JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF5_MAXPOP1, cJU_JPLEAF5, + j__udyLeaf4ToLeaf5, j__udyAllocJLL5, JL_LEAF5VALUEAREA, + JU_LEAF_TOIMMED_47, JU_TOIMMED_01_EVEN, ignore, + uint32_t *, cJU_IMMED4_MAXPOP1, + cJ1_JPIMMED_4_02, cJU_JPIMMED_4_01, j__udySearchLeaf4, + JU_LEAF4GROWINPLACE, JU_DELETEINPLACE, JU_DELETECOPY, + j__udyAllocJLL4, j__udyFreeJLL4, JL_LEAF4VALUEAREA); + + case cJU_JPLEAF5: + + JU_LEAF(5, + JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF6_MAXPOP1, cJU_JPLEAF6, + j__udyLeaf5ToLeaf6, j__udyAllocJLL6, JL_LEAF6VALUEAREA, + JU_LEAF_TOIMMED_47, + JU_TOIMMED_01_ODD, JU_COPY5_PINDEX_TO_LONG, + uint8_t *, cJU_IMMED5_MAXPOP1, + cJ1_JPIMMED_5_02, cJU_JPIMMED_5_01, j__udySearchLeaf5, + JU_LEAF5GROWINPLACE, JU_DELETEINPLACE_ODD, + JU_DELETECOPY_ODD, + j__udyAllocJLL5, j__udyFreeJLL5, JL_LEAF5VALUEAREA); + + case cJU_JPLEAF6: + + JU_LEAF(6, + JU_LEAF_UPLEVEL, uint8_t *, cJU_LEAF7_MAXPOP1, cJU_JPLEAF7, + j__udyLeaf6ToLeaf7, j__udyAllocJLL7, JL_LEAF7VALUEAREA, + JU_LEAF_TOIMMED_47, + JU_TOIMMED_01_ODD, JU_COPY6_PINDEX_TO_LONG, + uint8_t *, cJU_IMMED6_MAXPOP1, + cJ1_JPIMMED_6_02, cJU_JPIMMED_6_01, j__udySearchLeaf6, + JU_LEAF6GROWINPLACE, JU_DELETEINPLACE_ODD, + JU_DELETECOPY_ODD, + j__udyAllocJLL6, j__udyFreeJLL6, JL_LEAF6VALUEAREA); + +// There is no transition to "uplevel" for a Leaf7, so use JU_LEAF_UPLEVEL_NONE +// instead of JU_LEAF_UPLEVEL, and ignore all of the parameters to that macro: + + case cJU_JPLEAF7: + + JU_LEAF(7, + JU_LEAF_UPLEVEL_NONE, ignore1, ignore2, ignore3, ignore4, + ignore5, ignore6, + JU_LEAF_TOIMMED_47, + JU_TOIMMED_01_ODD, JU_COPY7_PINDEX_TO_LONG, + uint8_t *, cJU_IMMED7_MAXPOP1, + cJ1_JPIMMED_7_02, cJU_JPIMMED_7_01, j__udySearchLeaf7, + JU_LEAF7GROWINPLACE, JU_DELETEINPLACE_ODD, + JU_DELETECOPY_ODD, + j__udyAllocJLL7, j__udyFreeJLL7, JL_LEAF7VALUEAREA); +#endif // JU_64BIT + + +// **************************************************************************** +// BITMAP LEAF: + + case cJU_JPLEAF_B1: + { +#ifdef JUDYL + Pjv_t PjvnewRaw; // new value area. + Pjv_t Pjvnew; + Word_t subexp; // 1 of 8 subexpanses in bitmap. + Pjlb_t Pjlb; // pointer to bitmap part of the leaf. + BITMAPL_t bitmap; // for one subexpanse. + BITMAPL_t bitmask; // bit set for Indexs digit. +#endif + assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, 1)); + assert(ParentLevel > 1); + // valid Index: + assert(JU_BITMAPTESTL(P_JLB(Pjp->jp_Addr), Index)); + + pop1 = JU_JPLEAF_POP0(Pjp) + 1; + +// Like a Leaf1, see if its under a narrow pointer and can become a Leaf2 +// (hysteresis = 1): + + JU_LEAF_UPLEVEL(1, uint16_t *, cJU_LEAF2_MAXPOP1, cJU_JPLEAF2, + j__udyLeaf1ToLeaf2, j__udyAllocJLL2, + JL_LEAF2VALUEAREA); + +#if (defined(JUDY1) && defined(JU_64BIT)) + +// Handle the unusual special case, on Judy1 64-bit only, where a LeafB1 goes +// directly to a JPIMMED_1_15; as described in comments in Judy1.h and +// JudyIns.c. Copy 1-byte indexes from old LeafB1 to the Immed: + + if ((pop1 - 1) == cJU_IMMED1_MAXPOP1) // hysteresis = 0. + { + Pjlb_t PjlbRaw; // bitmap in old leaf. + Pjlb_t Pjlb; + uint8_t * Pleafnew; // JPIMMED as a pointer. + Word_t ldigit; // larger than uint8_t. + + PjlbRaw = (Pjlb_t) (Pjp->jp_Addr); + Pjlb = P_JLB(PjlbRaw); + Pleafnew = Pjp->jp_1Index; + + JU_BITMAPCLEARL(Pjlb, Index); // unset Indexs bit. + +// TBD: This is very slow, there must be a better way: + + for (ldigit = 0; ldigit < cJU_BRANCHUNUMJPS; ++ldigit) + { + if (JU_BITMAPTESTL(Pjlb, ldigit)) + { + *Pleafnew++ = ldigit; + assert(Pleafnew - (Pjp->jp_1Index) + <= cJU_IMMED1_MAXPOP1); + } + } + + DBGCODE(JudyCheckSorted((Pjll_t) (Pjp->jp_1Index), + cJU_IMMED1_MAXPOP1, 1);) + j__udyFreeJLB1(PjlbRaw, Pjpm); + + Pjp->jp_Type = cJ1_JPIMMED_1_15; + return(1); + } + +#else // (JUDYL || (! JU_64BIT)) + +// Compress LeafB1 to a Leaf1: +// +// Note: 4.37 of this file contained alternate code for Judy1 only that simply +// cleared the bit and allowed the LeafB1 to go below cJU_LEAF1_MAXPOP1. This +// was the ONLY case where a malloc failure was not fatal; however, it violated +// the critical assumption that the tree is always kept in least-compressed +// form. + + if (pop1 == cJU_LEAF1_MAXPOP1) // hysteresis = 1. + { + if (j__udyLeafB1ToLeaf1(Pjp, Pjpm) == -1) return(-1); + goto ContinueDelWalk; // delete Index in new Leaf1. + } +#endif // (JUDYL || (! JU_64BIT)) + +#ifdef JUDY1 + // unset Indexs bit: + + JU_BITMAPCLEARL(P_JLB(Pjp->jp_Addr), Index); +#else // JUDYL + +// This is very different from Judy1 because of the need to manage the value +// area: +// +// Get last byte to decode from Index, and pointer to bitmap leaf: + + digit = JU_DIGITATSTATE(Index, 1); + Pjlb = P_JLB(Pjp->jp_Addr); + +// Prepare additional values: + + subexp = digit / cJU_BITSPERSUBEXPL; // which subexpanse. + bitmap = JU_JLB_BITMAP(Pjlb, subexp); // subexps 32-bit map. + PjvRaw = JL_JLB_PVALUE(Pjlb, subexp); // corresponding values. + Pjv = P_JV(PjvRaw); + bitmask = JU_BITPOSMASKL(digit); // mask for Index. + + assert(bitmap & bitmask); // Index must be valid. + + if (bitmap == cJU_FULLBITMAPL) // full bitmap, take shortcut: + { + pop1 = cJU_BITSPERSUBEXPL; + offset = digit % cJU_BITSPERSUBEXPL; + } + else // compute subexpanse pop1 and value area offset: + { + pop1 = j__udyCountBitsL(bitmap); + offset = j__udyCountBitsL(bitmap & (bitmask - 1)); + } + +// Handle solitary Index remaining in subexpanse: + + if (pop1 == 1) + { + j__udyLFreeJV(PjvRaw, 1, Pjpm); + + JL_JLB_PVALUE(Pjlb, subexp) = (Pjv_t) NULL; + JU_JLB_BITMAP(Pjlb, subexp) = 0; + + return(1); + } + +// Shrink value area in place or move to a smaller value area: + + if (JL_LEAFVGROWINPLACE(pop1 - 1)) // hysteresis = 0. + { + JU_DELETEINPLACE(Pjv, pop1, offset, ignore); + } + else + { + if ((PjvnewRaw = j__udyLAllocJV(pop1 - 1, Pjpm)) + == (Pjv_t) NULL) return(-1); + Pjvnew = P_JV(PjvnewRaw); + + JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, ignore); + j__udyLFreeJV(PjvRaw, pop1, Pjpm); + JL_JLB_PVALUE(Pjlb, subexp) = (Pjv_t) PjvnewRaw; + } + + JU_JLB_BITMAP(Pjlb, subexp) ^= bitmask; // clear Indexs bit. + +#endif // JUDYL + + return(1); + + } // case. + + +#ifdef JUDY1 + +// **************************************************************************** +// FULL POPULATION LEAF: +// +// Convert to a LeafB1 and delete the index. Hysteresis = 0; none is possible. +// +// Note: Earlier the second assertion below said, "== 2", but in fact the +// parent could be at a higher level if a fullpop is under a narrow pointer. + + case cJ1_JPFULLPOPU1: + { + Pjlb_t PjlbRaw; + Pjlb_t Pjlb; + Word_t subexp; + + assert(! JU_DCDNOTMATCHINDEX(Index, Pjp, 2)); + assert(ParentLevel > 1); // see above. + + if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL) + return(-1); + Pjlb = P_JLB(PjlbRaw); + +// Fully populate the leaf, then unset Indexs bit: + + for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp) + JU_JLB_BITMAP(Pjlb, subexp) = cJU_FULLBITMAPL; + + JU_BITMAPCLEARL(Pjlb, Index); + + Pjp->jp_Addr = (Word_t) PjlbRaw; + Pjp->jp_Type = cJU_JPLEAF_B1; + + return(1); + } +#endif // JUDY1 + + +// **************************************************************************** +// IMMEDIATE JP: +// +// If theres just the one Index in the Immed, convert the JP to a JPNULL* +// (should only happen in a BranchU); otherwise delete the Index from the +// Immed. See the state transitions table elsewhere in this file for a summary +// of which Immed types must be handled. Hysteresis = 0; none is possible with +// Immeds. +// +// MACROS FOR COMMON CODE: +// +// Single Index remains in cJU_JPIMMED_*_01; convert JP to null: +// +// Variables Pjp and parentJPtype are in the context. +// +// Note: cJU_JPIMMED_*_01 should only be encountered in BranchUs, not in +// BranchLs or BranchBs (where its improper to merely modify the JP to be a +// null JP); that is, BranchL and BranchB code should have already handled +// any cJU_JPIMMED_*_01 by different means. + +#define JU_IMMED_01(NewJPType,ParentJPType) \ + \ + assert(parentJPtype == (ParentJPType)); \ + assert(JU_JPDCDPOP0(Pjp) == JU_TRIMTODCDSIZE(Index)); \ + JU_JPSETADT(Pjp, 0, 0, NewJPType); \ + return(1) + +// Convert cJ*_JPIMMED_*_02 to cJU_JPIMMED_*_01: +// +// Move the undeleted Index, whichever does not match the least bytes of Index, +// from undecoded-bytes-only (in jp_1Index or jp_LIndex as appropriate) to +// jp_DcdPopO (full-field). Pjp, Index, and offset are in the context. + +#define JU_IMMED_02(cIS,LeafType,NewJPType) \ + { \ + LeafType Pleaf; \ + \ + assert((ParentLevel - 1) == (cIS)); \ + JUDY1CODE(Pleaf = (LeafType) (Pjp->jp_1Index);) \ + JUDYLCODE(Pleaf = (LeafType) (Pjp->jp_LIndex);) \ + JUDYLCODE(PjvRaw = (Pjv_t) (Pjp->jp_Addr);) \ + JUDYLCODE(Pjv = P_JV(PjvRaw);) \ + JU_TOIMMED_01_EVEN(cIS, ignore, ignore); \ + JUDYLCODE(j__udyLFreeJV(PjvRaw, 2, Pjpm);) \ + Pjp->jp_Type = (NewJPType); \ + return(1); \ + } + +#if (defined(JUDY1) || defined(JU_64BIT)) + +// Variation for "odd" cJ*_JPIMMED_*_02 JP types, which are very different from +// "even" types because they use leaf search code and odd-copy macros: +// +// Note: JudyL 32-bit has no "odd" JPIMMED_*_02 types. + +#define JU_IMMED_02_ODD(cIS,NewJPType,SearchLeaf,CopyPIndex) \ + { \ + uint8_t * Pleaf; \ + \ + assert((ParentLevel - 1) == (cIS)); \ + JUDY1CODE(Pleaf = (uint8_t *) (Pjp->jp_1Index);) \ + JUDYLCODE(Pleaf = (uint8_t *) (Pjp->jp_LIndex);) \ + JUDYLCODE(PjvRaw = (Pjv_t) (Pjp->jp_Addr);) \ + JUDYLCODE(Pjv = P_JV(PjvRaw);) \ + JU_TOIMMED_01_ODD(cIS, SearchLeaf, CopyPIndex); \ + JUDYLCODE(j__udyLFreeJV(PjvRaw, 2, Pjpm);) \ + Pjp->jp_Type = (NewJPType); \ + return(1); \ + } +#endif // (JUDY1 || JU_64BIT) + +// Core code for deleting one Index (and for JudyL, its value area) from a +// larger Immed: +// +// Variables Pleaf, pop1, and offset are in the context. + +#ifdef JUDY1 +#define JU_IMMED_DEL(cIS,DeleteInPlace) \ + DeleteInPlace(Pleaf, pop1, offset, cIS); \ + DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);) + +#else // JUDYL + +// For JudyL the value area might need to be shrunk: + +#define JU_IMMED_DEL(cIS,DeleteInPlace) \ + \ + if (JL_LEAFVGROWINPLACE(pop1 - 1)) /* hysteresis = 0 */ \ + { \ + DeleteInPlace( Pleaf, pop1, offset, cIS); \ + JU_DELETEINPLACE(Pjv, pop1, offset, ignore); \ + DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);) \ + } \ + else \ + { \ + Pjv_t PjvnewRaw; \ + Pjv_t Pjvnew; \ + \ + if ((PjvnewRaw = j__udyLAllocJV(pop1 - 1, Pjpm)) \ + == (Pjv_t) NULL) return(-1); \ + Pjvnew = P_JV(PjvnewRaw); \ + \ + DeleteInPlace(Pleaf, pop1, offset, cIS); \ + JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, ignore); \ + DBGCODE(JudyCheckSorted(Pleaf, pop1 - 1, cIS);) \ + j__udyLFreeJV(PjvRaw, pop1, Pjpm); \ + \ + (Pjp->jp_Addr) = (Word_t) PjvnewRaw; \ + } +#endif // JUDYL + +// Delete one Index from a larger Immed where no restructuring is required: +// +// Variables pop1, Pjp, offset, and Index are in the context. + +#define JU_IMMED(cIS,LeafType,BaseJPType,SearchLeaf,DeleteInPlace) \ + { \ + LeafType Pleaf; \ + \ + assert((ParentLevel - 1) == (cIS)); \ + JUDY1CODE(Pleaf = (LeafType) (Pjp->jp_1Index);) \ + JUDYLCODE(Pleaf = (LeafType) (Pjp->jp_LIndex);) \ + JUDYLCODE(PjvRaw = (Pjv_t) (Pjp->jp_Addr);) \ + JUDYLCODE(Pjv = P_JV(PjvRaw);) \ + pop1 = (JU_JPTYPE(Pjp)) - (BaseJPType) + 2; \ + offset = SearchLeaf(Pleaf, pop1, Index); \ + assert(offset >= 0); /* Index must be valid */ \ + \ + JU_IMMED_DEL(cIS, DeleteInPlace); \ + --(Pjp->jp_Type); \ + return(1); \ + } + + +// END OF MACROS, START OF CASES: + +// Single Index remains in Immed; convert JP to null: + + case cJU_JPIMMED_1_01: JU_IMMED_01(cJU_JPNULL1, cJU_JPBRANCH_U2); + case cJU_JPIMMED_2_01: JU_IMMED_01(cJU_JPNULL2, cJU_JPBRANCH_U3); +#ifndef JU_64BIT + case cJU_JPIMMED_3_01: JU_IMMED_01(cJU_JPNULL3, cJU_JPBRANCH_U); +#else + case cJU_JPIMMED_3_01: JU_IMMED_01(cJU_JPNULL3, cJU_JPBRANCH_U4); + case cJU_JPIMMED_4_01: JU_IMMED_01(cJU_JPNULL4, cJU_JPBRANCH_U5); + case cJU_JPIMMED_5_01: JU_IMMED_01(cJU_JPNULL5, cJU_JPBRANCH_U6); + case cJU_JPIMMED_6_01: JU_IMMED_01(cJU_JPNULL6, cJU_JPBRANCH_U7); + case cJU_JPIMMED_7_01: JU_IMMED_01(cJU_JPNULL7, cJU_JPBRANCH_U); +#endif + +// Multiple Indexes remain in the Immed JP; delete the specified Index: + + case cJU_JPIMMED_1_02: + + JU_IMMED_02(1, uint8_t *, cJU_JPIMMED_1_01); + + case cJU_JPIMMED_1_03: +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: + case cJ1_JPIMMED_1_09: + case cJ1_JPIMMED_1_10: + case cJ1_JPIMMED_1_11: + case cJ1_JPIMMED_1_12: + case cJ1_JPIMMED_1_13: + case cJ1_JPIMMED_1_14: + case cJ1_JPIMMED_1_15: +#endif + JU_IMMED(1, uint8_t *, cJU_JPIMMED_1_02, + j__udySearchLeaf1, JU_DELETEINPLACE); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: + + JU_IMMED_02(2, uint16_t *, cJU_JPIMMED_2_01); + + case cJU_JPIMMED_2_03: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: + case cJ1_JPIMMED_2_05: + case cJ1_JPIMMED_2_06: + case cJ1_JPIMMED_2_07: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + JU_IMMED(2, uint16_t *, cJU_JPIMMED_2_02, + j__udySearchLeaf2, JU_DELETEINPLACE); + + case cJU_JPIMMED_3_02: + + JU_IMMED_02_ODD(3, cJU_JPIMMED_3_01, + j__udySearchLeaf3, JU_COPY3_PINDEX_TO_LONG); + +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: + case cJ1_JPIMMED_3_04: + case cJ1_JPIMMED_3_05: + + JU_IMMED(3, uint8_t *, cJU_JPIMMED_3_02, + j__udySearchLeaf3, JU_DELETEINPLACE_ODD); + + case cJ1_JPIMMED_4_02: + + JU_IMMED_02(4, uint32_t *, cJU_JPIMMED_4_01); + + case cJ1_JPIMMED_4_03: + + JU_IMMED(4, uint32_t *, cJ1_JPIMMED_4_02, + j__udySearchLeaf4, JU_DELETEINPLACE); + + case cJ1_JPIMMED_5_02: + + JU_IMMED_02_ODD(5, cJU_JPIMMED_5_01, + j__udySearchLeaf5, JU_COPY5_PINDEX_TO_LONG); + + case cJ1_JPIMMED_5_03: + + JU_IMMED(5, uint8_t *, cJ1_JPIMMED_5_02, + j__udySearchLeaf5, JU_DELETEINPLACE_ODD); + + case cJ1_JPIMMED_6_02: + + JU_IMMED_02_ODD(6, cJU_JPIMMED_6_01, + j__udySearchLeaf6, JU_COPY6_PINDEX_TO_LONG); + + case cJ1_JPIMMED_7_02: + + JU_IMMED_02_ODD(7, cJU_JPIMMED_7_01, + j__udySearchLeaf7, JU_COPY7_PINDEX_TO_LONG); + +#endif // (JUDY1 && JU_64BIT) + + +// **************************************************************************** +// INVALID JP TYPE: + + default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); return(-1); + + } // switch + + +// PROCESS JP -- RECURSIVELY: +// +// For non-Immed JP types, if successful, post-decrement the population count +// at this level, or collapse a BranchL if necessary by copying the remaining +// JP in the BranchL to the parent (hysteresis = 0), which implicitly creates a +// narrow pointer if there was not already one in the hierarchy. + + assert(level); + retcode = j__udyDelWalk(Pjp, Index, level, Pjpm); + assert(retcode != 0); // should never happen. + + if ((JU_JPTYPE(Pjp)) < cJU_JPIMMED_1_01) // not an Immed. + { + switch (retcode) + { + case 1: + { + jp_t JP = *Pjp; + Word_t DcdP0; + + DcdP0 = JU_JPDCDPOP0(Pjp) - 1; // decrement count. + JU_JPSETADT(Pjp, JP.jp_Addr, DcdP0, JU_JPTYPE(&JP)); + break; + } + case 2: // collapse BranchL to single JP; see above: + { + Pjbl_t PjblRaw = (Pjbl_t) (Pjp->jp_Addr); + Pjbl_t Pjbl = P_JBL(PjblRaw); + + *Pjp = Pjbl->jbl_jp[0]; + j__udyFreeJBL(PjblRaw, Pjpm); + retcode = 1; + } + } + } + + return(retcode); + +} // j__udyDelWalk() + + +// **************************************************************************** +// J U D Y 1 U N S E T +// J U D Y L D E L +// +// Main entry point. See the manual entry for details. + +#ifdef JUDY1 +FUNCTION int Judy1Unset +#else +FUNCTION int JudyLDel +#endif + ( + PPvoid_t PPArray, // in which to delete. + Word_t Index, // to delete. + PJError_t PJError // optional, for returning error info. + ) +{ + Word_t pop1; // population of leaf. + int offset; // at which to delete Index. + JUDY1CODE(int retcode;) // return code from Judy1Test(). +JUDYLCODE(PPvoid_t PPvalue;) // pointer from JudyLGet(). + + +// CHECK FOR NULL ARRAY POINTER (error by caller): + + if (PPArray == (PPvoid_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY); + return(JERRI); + } + + +// CHECK IF INDEX IS INVALID: +// +// If so, theres nothing to do. This saves a lot of time. Pass through +// PJError, if any, from the "get" function. + +#ifdef JUDY1 + if ((retcode = Judy1Test(*PPArray, Index, PJError)) == JERRI) + return (JERRI); + + if (retcode == 0) return(0); +#else + if ((PPvalue = JudyLGet(*PPArray, Index, PJError)) == PPJERR) + return (JERRI); + + if (PPvalue == (PPvoid_t) NULL) return(0); +#endif + + +// **************************************************************************** +// PROCESS TOP LEVEL (LEAFW) BRANCHES AND LEAVES: + +// **************************************************************************** +// LEAFW LEAF, OTHER SIZE: +// +// Shrink or convert the leaf as necessary. Hysteresis = 0; none is possible. + + if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + JUDYLCODE(Pjv_t Pjv;) // current value area. + JUDYLCODE(Pjv_t Pjvnew;) // value area in new leaf. + Pjlw_t Pjlw = P_JLW(*PPArray); // first word of leaf. + Pjlw_t Pjlwnew; // replacement leaf. + pop1 = Pjlw[0] + 1; // first word of leaf is pop0. + +// Delete single (last) Index from array: + + if (pop1 == 1) + { + j__udyFreeJLW(Pjlw, /* pop1 = */ 1, (Pjpm_t) NULL); + *PPArray = (Pvoid_t) NULL; + return(1); + } + +// Locate Index in compressible leaf: + + offset = j__udySearchLeafW(Pjlw + 1, pop1, Index); + assert(offset >= 0); // Index must be valid. + + JUDYLCODE(Pjv = JL_LEAFWVALUEAREA(Pjlw, pop1);) + +// Delete Index in-place: +// +// Note: "Grow in place from pop1 - 1" is the logical inverse of, "shrink in +// place from pop1." Also, Pjlw points to the count word, so skip that for +// doing the deletion. + + if (JU_LEAFWGROWINPLACE(pop1 - 1)) + { + JU_DELETEINPLACE(Pjlw + 1, pop1, offset, ignore); +#ifdef JUDYL // also delete from value area: + JU_DELETEINPLACE(Pjv, pop1, offset, ignore); +#endif + DBGCODE(JudyCheckSorted((Pjll_t) (Pjlw + 1), pop1 - 1, + cJU_ROOTSTATE);) + --(Pjlw[0]); // decrement population. + DBGCODE(JudyCheckPop(*PPArray);) + return(1); + } + +// Allocate new leaf for use in either case below: + + Pjlwnew = j__udyAllocJLW(pop1 - 1); + JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI); + +// Shrink to smaller LEAFW: +// +// Note: Skip the first word = pop0 in each leaf. + + Pjlwnew[0] = (pop1 - 1) - 1; + JU_DELETECOPY(Pjlwnew + 1, Pjlw + 1, pop1, offset, ignore); + +#ifdef JUDYL // also delete from value area: + Pjvnew = JL_LEAFWVALUEAREA(Pjlwnew, pop1 - 1); + JU_DELETECOPY(Pjvnew, Pjv, pop1, offset, ignore); +#endif + DBGCODE(JudyCheckSorted(Pjlwnew + 1, pop1 - 1, cJU_ROOTSTATE);) + + j__udyFreeJLW(Pjlw, pop1, (Pjpm_t) NULL); + +//// *PPArray = (Pvoid_t) Pjlwnew | cJU_LEAFW); + *PPArray = (Pvoid_t) Pjlwnew; + DBGCODE(JudyCheckPop(*PPArray);) + return(1); + + } + else + + +// **************************************************************************** +// JRP BRANCH: +// +// Traverse through the JPM to do the deletion unless the population is small +// enough to convert immediately to a LEAFW. + + { + Pjpm_t Pjpm; + Pjp_t Pjp; // top-level JP to process. + Word_t digit; // in a branch. + JUDYLCODE(Pjv_t Pjv;) // to value area. + Pjlw_t Pjlwnew; // replacement leaf. + DBGCODE(Pjlw_t Pjlwnew_orig;) + + Pjpm = P_JPM(*PPArray); // top object in array (tree). + Pjp = &(Pjpm->jpm_JP); // next object (first branch or leaf). + + assert(((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_L) + || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_B) + || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_U)); + +// WALK THE TREE +// +// Note: Recursive code in j__udyDelWalk() knows how to collapse a lower-level +// BranchL containing a single JP into the parent JP as a narrow pointer, but +// the code here cant do that for a top-level BranchL. The result can be +// PArray -> JPM -> BranchL containing a single JP. This situation is +// unavoidable because a JPM cannot contain a narrow pointer; the BranchL is +// required in order to hold the top digit decoded, and it does not collapse to +// a LEAFW until the population is low enough. +// +// TBD: Should we add a topdigit field to JPMs so they can hold narrow +// pointers? + + if (j__udyDelWalk(Pjp, Index, cJU_ROOTSTATE, Pjpm) == -1) + { + JU_COPY_ERRNO(PJError, Pjpm); + return(JERRI); + } + + --(Pjpm->jpm_Pop0); // success; decrement total population. + + if ((Pjpm->jpm_Pop0 + 1) != cJU_LEAFW_MAXPOP1) + { + DBGCODE(JudyCheckPop(*PPArray);) + return(1); + } + +// COMPRESS A BRANCH[LBU] TO A LEAFW: +// + Pjlwnew = j__udyAllocJLW(cJU_LEAFW_MAXPOP1); + JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI); + +// Plug leaf into root pointer and set population count: + +//// *PPArray = (Pvoid_t) ((Word_t) Pjlwnew | cJU_LEAFW); + *PPArray = (Pvoid_t) Pjlwnew; +#ifdef JUDYL // prepare value area: + Pjv = JL_LEAFWVALUEAREA(Pjlwnew, cJU_LEAFW_MAXPOP1); +#endif + *Pjlwnew++ = cJU_LEAFW_MAXPOP1 - 1; // set pop0. + DBGCODE(Pjlwnew_orig = Pjlwnew;) + + switch (JU_JPTYPE(Pjp)) + { + +// JPBRANCH_L: Copy each JPs indexes to the new LEAFW and free the old +// branch: + + case cJU_JPBRANCH_L: + { + Pjbl_t PjblRaw = (Pjbl_t) (Pjp->jp_Addr); + Pjbl_t Pjbl = P_JBL(PjblRaw); + + for (offset = 0; offset < Pjbl->jbl_NumJPs; ++offset) + { + pop1 = j__udyLeafM1ToLeafW(Pjlwnew, JU_PVALUEPASS + (Pjbl->jbl_jp) + offset, + JU_DIGITTOSTATE(Pjbl->jbl_Expanse[offset], + cJU_BYTESPERWORD), + (Pvoid_t) Pjpm); + Pjlwnew += pop1; // advance through indexes. + JUDYLCODE(Pjv += pop1;) // advance through values. + } + j__udyFreeJBL(PjblRaw, Pjpm); + + assert(Pjlwnew == Pjlwnew_orig + cJU_LEAFW_MAXPOP1); + break; // delete Index from new LEAFW. + } + +// JPBRANCH_B: Copy each JPs indexes to the new LEAFW and free the old +// branch, including each JP subarray: + + case cJU_JPBRANCH_B: + { + Pjbb_t PjbbRaw = (Pjbb_t) (Pjp->jp_Addr); + Pjbb_t Pjbb = P_JBB(PjbbRaw); + Word_t subexp; // current subexpanse number. + BITMAPB_t bitmap; // portion for this subexpanse. + Pjp_t Pjp2Raw; // one subexpanses subarray. + Pjp_t Pjp2; + + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) + { + if ((bitmap = JU_JBB_BITMAP(Pjbb, subexp)) == 0) + continue; // skip empty subexpanse. + + digit = subexp * cJU_BITSPERSUBEXPB; + Pjp2Raw = JU_JBB_PJP(Pjbb, subexp); + Pjp2 = P_JP(Pjp2Raw); + assert(Pjp2 != (Pjp_t) NULL); + +// Walk through bits for all possible sub-subexpanses (digits); increment +// offset for each populated subexpanse; until no more set bits: + + for (offset = 0; bitmap != 0; bitmap >>= 1, ++digit) + { + if (! (bitmap & 1)) // skip empty sub-subexpanse. + continue; + + pop1 = j__udyLeafM1ToLeafW(Pjlwnew, JU_PVALUEPASS + Pjp2 + offset, + JU_DIGITTOSTATE(digit, cJU_BYTESPERWORD), + (Pvoid_t) Pjpm); + Pjlwnew += pop1; // advance through indexes. + JUDYLCODE(Pjv += pop1;) // advance through values. + ++offset; + } + j__udyFreeJBBJP(Pjp2Raw, /* pop1 = */ offset, Pjpm); + } + j__udyFreeJBB(PjbbRaw, Pjpm); + + assert(Pjlwnew == Pjlwnew_orig + cJU_LEAFW_MAXPOP1); + break; // delete Index from new LEAFW. + + } // case cJU_JPBRANCH_B. + + +// JPBRANCH_U: Copy each JPs indexes to the new LEAFW and free the old +// branch: + + case cJU_JPBRANCH_U: + { + Pjbu_t PjbuRaw = (Pjbu_t) (Pjp->jp_Addr); + Pjbu_t Pjbu = P_JBU(PjbuRaw); + Word_t ldigit; // larger than uint8_t. + + for (Pjp = Pjbu->jbu_jp, ldigit = 0; + ldigit < cJU_BRANCHUNUMJPS; + ++Pjp, ++ldigit) + { + +// Shortcuts, to save a little time for possibly big branches: + + if ((JU_JPTYPE(Pjp)) == cJU_JPNULLMAX) // skip null JP. + continue; + +// TBD: Should the following shortcut also be used in BranchL and BranchB +// code? + +#ifndef JU_64BIT + if ((JU_JPTYPE(Pjp)) == cJU_JPIMMED_3_01) +#else + if ((JU_JPTYPE(Pjp)) == cJU_JPIMMED_7_01) +#endif + { // single Immed: + *Pjlwnew++ = JU_DIGITTOSTATE(ldigit, cJU_BYTESPERWORD) + | JU_JPDCDPOP0(Pjp); // rebuild Index. +#ifdef JUDYL + *Pjv++ = Pjp->jp_Addr; // copy value area. +#endif + continue; + } + + pop1 = j__udyLeafM1ToLeafW(Pjlwnew, JU_PVALUEPASS + Pjp, JU_DIGITTOSTATE(ldigit, cJU_BYTESPERWORD), + (Pvoid_t) Pjpm); + Pjlwnew += pop1; // advance through indexes. + JUDYLCODE(Pjv += pop1;) // advance through values. + } + j__udyFreeJBU(PjbuRaw, Pjpm); + + assert(Pjlwnew == Pjlwnew_orig + cJU_LEAFW_MAXPOP1); + break; // delete Index from new LEAFW. + + } // case cJU_JPBRANCH_U. + + +// INVALID JP TYPE in jpm_t struct + + default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); + return(JERRI); + + } // end switch on sub-JP type. + + DBGCODE(JudyCheckSorted((Pjll_t) Pjlwnew_orig, cJU_LEAFW_MAXPOP1, + cJU_ROOTSTATE);) + +// FREE JPM (no longer needed): + + j__udyFreeJPM(Pjpm, (Pjpm_t) NULL); + DBGCODE(JudyCheckPop(*PPArray);) + return(1); + + } + /*NOTREACHED*/ + +} // Judy1Unset() / JudyLDel() diff --git a/libnetdata/libjudy/src/JudyL/JudyLFirst.c b/libnetdata/libjudy/src/JudyL/JudyLFirst.c new file mode 100644 index 000000000..aaf6639cf --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLFirst.c @@ -0,0 +1,213 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.12 $ $Source: /judy/src/JudyCommon/JudyFirst.c $ +// +// Judy*First[Empty]() and Judy*Last[Empty]() routines for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// These are inclusive versions of Judy*Next[Empty]() and Judy*Prev[Empty](). + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + + +// **************************************************************************** +// J U D Y 1 F I R S T +// J U D Y L F I R S T +// +// See the manual entry for details. + +#ifdef JUDY1 +FUNCTION int Judy1First +#else +FUNCTION PPvoid_t JudyLFirst +#endif + ( + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError // optional, for returning error info. + ) +{ + if (PIndex == (PWord_t) NULL) // caller error: + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +#ifdef JUDY1 + switch (Judy1Test(PArray, *PIndex, PJError)) + { + case 1: return(1); // found *PIndex itself. + case 0: return(Judy1Next(PArray, PIndex, PJError)); + default: return(JERRI); + } +#else + { + PPvoid_t PValue; + + if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR) + return(PPJERR); + + if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex. + + return(JudyLNext(PArray, PIndex, PJError)); + } +#endif + +} // Judy1First() / JudyLFirst() + + +// **************************************************************************** +// J U D Y 1 L A S T +// J U D Y L L A S T +// +// See the manual entry for details. + +#ifdef JUDY1 +FUNCTION int Judy1Last( +#else +FUNCTION PPvoid_t JudyLLast( +#endif + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError) // optional, for returning error info. +{ + if (PIndex == (PWord_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error. + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +#ifdef JUDY1 + switch (Judy1Test(PArray, *PIndex, PJError)) + { + case 1: return(1); // found *PIndex itself. + case 0: return(Judy1Prev(PArray, PIndex, PJError)); + default: return(JERRI); + } +#else + { + PPvoid_t PValue; + + if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR) + return(PPJERR); + + if (PValue != (PPvoid_t) NULL) return(PValue); // found *PIndex. + + return(JudyLPrev(PArray, PIndex, PJError)); + } +#endif + +} // Judy1Last() / JudyLLast() + + +// **************************************************************************** +// J U D Y 1 F I R S T E M P T Y +// J U D Y L F I R S T E M P T Y +// +// See the manual entry for details. + +#ifdef JUDY1 +FUNCTION int Judy1FirstEmpty( +#else +FUNCTION int JudyLFirstEmpty( +#endif + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError) // optional, for returning error info. +{ + if (PIndex == (PWord_t) NULL) // caller error: + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + return(JERRI); + } + +#ifdef JUDY1 + switch (Judy1Test(PArray, *PIndex, PJError)) + { + case 0: return(1); // found *PIndex itself. + case 1: return(Judy1NextEmpty(PArray, PIndex, PJError)); + default: return(JERRI); + } +#else + { + PPvoid_t PValue; + + if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR) + return(JERRI); + + if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex. + + return(JudyLNextEmpty(PArray, PIndex, PJError)); + } +#endif + +} // Judy1FirstEmpty() / JudyLFirstEmpty() + + +// **************************************************************************** +// J U D Y 1 L A S T E M P T Y +// J U D Y L L A S T E M P T Y +// +// See the manual entry for details. + +#ifdef JUDY1 +FUNCTION int Judy1LastEmpty( +#else +FUNCTION int JudyLLastEmpty( +#endif + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError) // optional, for returning error info. +{ + if (PIndex == (PWord_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); // caller error. + return(JERRI); + } + +#ifdef JUDY1 + switch (Judy1Test(PArray, *PIndex, PJError)) + { + case 0: return(1); // found *PIndex itself. + case 1: return(Judy1PrevEmpty(PArray, PIndex, PJError)); + default: return(JERRI); + } +#else + { + PPvoid_t PValue; + + if ((PValue = JudyLGet(PArray, *PIndex, PJError)) == PPJERR) + return(JERRI); + + if (PValue == (PPvoid_t) NULL) return(1); // found *PIndex. + + return(JudyLPrevEmpty(PArray, PIndex, PJError)); + } +#endif + +} // Judy1LastEmpty() / JudyLLastEmpty() diff --git a/libnetdata/libjudy/src/JudyL/JudyLFreeArray.c b/libnetdata/libjudy/src/JudyL/JudyLFreeArray.c new file mode 100644 index 000000000..34fac509e --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLFreeArray.c @@ -0,0 +1,363 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.51 $ $Source: /judy/src/JudyCommon/JudyFreeArray.c $ +// +// Judy1FreeArray() and JudyLFreeArray() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// Return the number of bytes freed from the array. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);) + + +// **************************************************************************** +// J U D Y 1 F R E E A R R A Y +// J U D Y L F R E E A R R A Y +// +// See the Judy*(3C) manual entry for details. +// +// This code is written recursively, at least at first, because thats much +// simpler. Hope its fast enough. + +#ifdef JUDY1 +FUNCTION Word_t Judy1FreeArray +#else +FUNCTION Word_t JudyLFreeArray +#endif + ( + PPvoid_t PPArray, // array to free. + PJError_t PJError // optional, for returning error info. + ) +{ + jpm_t jpm; // local to accumulate free statistics. + +// CHECK FOR NULL POINTER (error by caller): + + if (PPArray == (PPvoid_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY); + return(JERR); + } + + DBGCODE(JudyCheckPop(*PPArray);) + +// Zero jpm.jpm_Pop0 (meaning the array will be empty in a moment) for accurate +// logging in TRACEMI2. + + jpm.jpm_Pop0 = 0; // see above. + jpm.jpm_TotalMemWords = 0; // initialize memory freed. + +// Empty array: + + if (P_JLW(*PPArray) == (Pjlw_t) NULL) return(0); + +// PROCESS TOP LEVEL "JRP" BRANCHES AND LEAF: + + if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(*PPArray); // first word of leaf. + + j__udyFreeJLW(Pjlw, Pjlw[0] + 1, &jpm); + *PPArray = (Pvoid_t) NULL; // make an empty array. + return (-(jpm.jpm_TotalMemWords * cJU_BYTESPERWORD)); // see above. + } + else + +// Rootstate leaves: just free the leaf: + +// Common code for returning the amount of memory freed. +// +// Note: In a an ordinary LEAFW, pop0 = *PPArray[0]. +// +// Accumulate (negative) words freed, while freeing objects. +// Return the positive bytes freed. + + { + Pjpm_t Pjpm = P_JPM(*PPArray); + Word_t TotalMem = Pjpm->jpm_TotalMemWords; + + j__udyFreeSM(&(Pjpm->jpm_JP), &jpm); // recurse through tree. + j__udyFreeJPM(Pjpm, &jpm); + +// Verify the array was not corrupt. This means that amount of memory freed +// (which is negative) is equal to the initial amount: + + if (TotalMem + jpm.jpm_TotalMemWords) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + return(JERR); + } + + *PPArray = (Pvoid_t) NULL; // make an empty array. + return (TotalMem * cJU_BYTESPERWORD); + } + +} // Judy1FreeArray() / JudyLFreeArray() + + +// **************************************************************************** +// __ J U D Y F R E E S M +// +// Given a pointer to a JP, recursively visit and free (depth first) all nodes +// in a Judy array BELOW the JP, but not the JP itself. Accumulate in *Pjpm +// the total words freed (as a negative value). "SM" = State Machine. +// +// Note: Corruption is not detected at this level because during a FreeArray, +// if the code hasnt already core dumped, its better to remain silent, even +// if some memory has not been freed, than to bother the caller about the +// corruption. TBD: Is this true? If not, must list all legitimate JPNULL +// and JPIMMED above first, and revert to returning bool_t (see 4.34). + +FUNCTION void j__udyFreeSM( + Pjp_t Pjp, // top of Judy (top-state). + Pjpm_t Pjpm) // to return words freed. +{ + Word_t Pop1; + + switch (JU_JPTYPE(Pjp)) + { + +#ifdef JUDY1 + +// FULL EXPANSE -- nothing to free for this jp_Type. + + case cJ1_JPFULLPOPU1: + break; +#endif + +// JUDY BRANCH -- free the sub-tree depth first: + +// LINEAR BRANCH -- visit each JP in the JBLs list, then free the JBL: +// +// Note: There are no null JPs in a JBL. + + case cJU_JPBRANCH_L: + case cJU_JPBRANCH_L2: + case cJU_JPBRANCH_L3: +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: + case cJU_JPBRANCH_L5: + case cJU_JPBRANCH_L6: + case cJU_JPBRANCH_L7: +#endif // JU_64BIT + { + Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr); + Word_t offset; + + for (offset = 0; offset < Pjbl->jbl_NumJPs; ++offset) + j__udyFreeSM((Pjbl->jbl_jp) + offset, Pjpm); + + j__udyFreeJBL((Pjbl_t) (Pjp->jp_Addr), Pjpm); + break; + } + + +// BITMAP BRANCH -- visit each JP in the JBBs list based on the bitmap, also +// +// Note: There are no null JPs in a JBB. + + case cJU_JPBRANCH_B: + case cJU_JPBRANCH_B2: + case cJU_JPBRANCH_B3: +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: + case cJU_JPBRANCH_B5: + case cJU_JPBRANCH_B6: + case cJU_JPBRANCH_B7: +#endif // JU_64BIT + { + Word_t subexp; + Word_t offset; + Word_t jpcount; + + Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr); + + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) + { + jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)); + + if (jpcount) + { + for (offset = 0; offset < jpcount; ++offset) + { + j__udyFreeSM(P_JP(JU_JBB_PJP(Pjbb, subexp)) + offset, + Pjpm); + } + j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, subexp), jpcount, Pjpm); + } + } + j__udyFreeJBB((Pjbb_t) (Pjp->jp_Addr), Pjpm); + + break; + } + + +// UNCOMPRESSED BRANCH -- visit each JP in the JBU array, then free the JBU +// itself: +// +// Note: Null JPs are handled during recursion at a lower state. + + case cJU_JPBRANCH_U: + case cJU_JPBRANCH_U2: + case cJU_JPBRANCH_U3: +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: + case cJU_JPBRANCH_U5: + case cJU_JPBRANCH_U6: + case cJU_JPBRANCH_U7: +#endif // JU_64BIT + { + Word_t offset; + Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr); + + for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset) + j__udyFreeSM((Pjbu->jbu_jp) + offset, Pjpm); + + j__udyFreeJBU((Pjbu_t) (Pjp->jp_Addr), Pjpm); + break; + } + + +// -- Cases below here terminate and do not recurse. -- + + +// LINEAR LEAF -- just free the leaf; size is computed from jp_Type: +// +// Note: cJU_JPLEAF1 is a special case, see discussion in ../Judy1/Judy1.h + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyFreeJLL1((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; +#endif + + case cJU_JPLEAF2: + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyFreeJLL2((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; + + case cJU_JPLEAF3: + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyFreeJLL3((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; + +#ifdef JU_64BIT + case cJU_JPLEAF4: + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyFreeJLL4((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; + + case cJU_JPLEAF5: + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyFreeJLL5((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; + + case cJU_JPLEAF6: + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyFreeJLL6((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; + + case cJU_JPLEAF7: + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + j__udyFreeJLL7((Pjll_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; +#endif // JU_64BIT + + +// BITMAP LEAF -- free sub-expanse arrays of JPs, then free the JBB. + + case cJU_JPLEAF_B1: + { +#ifdef JUDYL + Word_t subexp; + Word_t jpcount; + Pjlb_t Pjlb = P_JLB(Pjp->jp_Addr); + +// Free the value areas in the bitmap leaf: + + for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp) + { + jpcount = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)); + + if (jpcount) + j__udyLFreeJV(JL_JLB_PVALUE(Pjlb, subexp), jpcount, Pjpm); + } +#endif // JUDYL + + j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm); + break; + + } // case cJU_JPLEAF_B1 + +#ifdef JUDYL + + +// IMMED*: +// +// For JUDYL, all non JPIMMED_*_01s have a LeafV which must be freed: + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#ifdef JU_64BIT + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: +#endif + Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_02 + 2; + j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; + +#ifdef JU_64BIT + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: + + Pop1 = JU_JPTYPE(Pjp) - cJU_JPIMMED_2_02 + 2; + j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), Pop1, Pjpm); + break; + + case cJU_JPIMMED_3_02: + j__udyLFreeJV((Pjv_t) (Pjp->jp_Addr), 2, Pjpm); + break; + +#endif // JU_64BIT +#endif // JUDYL + + +// OTHER JPNULL, JPIMMED, OR UNEXPECTED TYPE -- nothing to free for this type: +// +// Note: Lump together no-op and invalid JP types; see function header +// comments. + + default: break; + + } // switch (JU_JPTYPE(Pjp)) + +} // j__udyFreeSM() diff --git a/libnetdata/libjudy/src/JudyL/JudyLGet.c b/libnetdata/libjudy/src/JudyL/JudyLGet.c new file mode 100644 index 000000000..0bb9971cc --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLGet.c @@ -0,0 +1,1094 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.43 $ $Source: /judy/src/JudyCommon/JudyGet.c $ +// +// Judy1Test() and JudyLGet() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +#ifdef TRACEJPR // different macro name, for "retrieval" only. +#include "JudyPrintJP.c" +#endif + + +// **************************************************************************** +// J U D Y 1 T E S T +// J U D Y L G E T +// +// See the manual entry for details. Note support for "shortcut" entries to +// trees known to start with a JPM. + +#ifdef JUDY1 + +#ifdef JUDYGETINLINE +FUNCTION int j__udy1Test +#else +FUNCTION int Judy1Test +#endif + +#else // JUDYL + +#ifdef JUDYGETINLINE +FUNCTION PPvoid_t j__udyLGet +#else +FUNCTION PPvoid_t JudyLGet +#endif + +#endif // JUDYL + ( +#ifdef JUDYGETINLINE + Pvoid_t PArray, // from which to retrieve. + Word_t Index // to retrieve. +#else + Pcvoid_t PArray, // from which to retrieve. + Word_t Index, // to retrieve. + PJError_t PJError // optional, for returning error info. +#endif + ) +{ + Pjp_t Pjp; // current JP while walking the tree. + Pjpm_t Pjpm; // for global accounting. + uint8_t Digit; // byte just decoded from Index. + Word_t Pop1; // leaf population (number of indexes). + Pjll_t Pjll; // pointer to LeafL. + DBGCODE(uint8_t ParentJPType;) + +#ifndef JUDYGETINLINE + + if (PArray == (Pcvoid_t) NULL) // empty array. + { + JUDY1CODE(return(0);) + JUDYLCODE(return((PPvoid_t) NULL);) + } + +// **************************************************************************** +// PROCESS TOP LEVEL BRANCHES AND LEAF: + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + int posidx; // signed offset in leaf. + + Pop1 = Pjlw[0] + 1; + posidx = j__udySearchLeafW(Pjlw + 1, Pop1, Index); + + if (posidx >= 0) + { + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAFWVALUEAREA(Pjlw, Pop1) + posidx));) + } + JUDY1CODE(return(0);) + JUDYLCODE(return((PPvoid_t) NULL);) + } + +#endif // ! JUDYGETINLINE + + Pjpm = P_JPM(PArray); + Pjp = &(Pjpm->jpm_JP); // top branch is below JPM. + +// **************************************************************************** +// WALK THE JUDY TREE USING A STATE MACHINE: + +ContinueWalk: // for going down one level; come here with Pjp set. + +#ifdef TRACEJPR + JudyPrintJP(Pjp, "g", __LINE__); +#endif + switch (JU_JPTYPE(Pjp)) + { + +// Ensure the switch table starts at 0 for speed; otherwise more code is +// executed: + + case 0: goto ReturnCorrupt; // save a little code. + + +// **************************************************************************** +// JPNULL*: +// +// Note: These are legitimate in a BranchU (only) and do not constitute a +// fault. + + case cJU_JPNULL1: + case cJU_JPNULL2: + case cJU_JPNULL3: +#ifdef JU_64BIT + case cJU_JPNULL4: + case cJU_JPNULL5: + case cJU_JPNULL6: + case cJU_JPNULL7: +#endif + assert(ParentJPType >= cJU_JPBRANCH_U2); + assert(ParentJPType <= cJU_JPBRANCH_U); + JUDY1CODE(return(0);) + JUDYLCODE(return((PPvoid_t) NULL);) + + +// **************************************************************************** +// JPBRANCH_L*: +// +// Note: The use of JU_DCDNOTMATCHINDEX() in branches is not strictly +// required,since this can be done at leaf level, but it costs nothing to do it +// sooner, and it aborts an unnecessary traversal sooner. + + case cJU_JPBRANCH_L2: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + Digit = JU_DIGITATSTATE(Index, 2); + goto JudyBranchL; + + case cJU_JPBRANCH_L3: + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + Digit = JU_DIGITATSTATE(Index, 3); + goto JudyBranchL; + +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + Digit = JU_DIGITATSTATE(Index, 4); + goto JudyBranchL; + + case cJU_JPBRANCH_L5: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + Digit = JU_DIGITATSTATE(Index, 5); + goto JudyBranchL; + + case cJU_JPBRANCH_L6: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + Digit = JU_DIGITATSTATE(Index, 6); + goto JudyBranchL; + + case cJU_JPBRANCH_L7: + + // JU_DCDNOTMATCHINDEX() would be a no-op. + Digit = JU_DIGITATSTATE(Index, 7); + goto JudyBranchL; + +#endif // JU_64BIT + + case cJU_JPBRANCH_L: + { + Pjbl_t Pjbl; + int posidx; + + Digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + +// Common code for all BranchLs; come here with Digit set: + +JudyBranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + + posidx = 0; + + do { + if (Pjbl->jbl_Expanse[posidx] == Digit) + { // found Digit; continue traversal: + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = Pjbl->jbl_jp + posidx; + goto ContinueWalk; + } + } while (++posidx != Pjbl->jbl_NumJPs); + + break; + } + + +// **************************************************************************** +// JPBRANCH_B*: + + case cJU_JPBRANCH_B2: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + Digit = JU_DIGITATSTATE(Index, 2); + goto JudyBranchB; + + case cJU_JPBRANCH_B3: + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + Digit = JU_DIGITATSTATE(Index, 3); + goto JudyBranchB; + + +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + Digit = JU_DIGITATSTATE(Index, 4); + goto JudyBranchB; + + case cJU_JPBRANCH_B5: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + Digit = JU_DIGITATSTATE(Index, 5); + goto JudyBranchB; + + case cJU_JPBRANCH_B6: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + Digit = JU_DIGITATSTATE(Index, 6); + goto JudyBranchB; + + case cJU_JPBRANCH_B7: + + // JU_DCDNOTMATCHINDEX() would be a no-op. + Digit = JU_DIGITATSTATE(Index, 7); + goto JudyBranchB; + +#endif // JU_64BIT + + case cJU_JPBRANCH_B: + { + Pjbb_t Pjbb; + Word_t subexp; // in bitmap, 0..7. + BITMAPB_t BitMap; // for one subexpanse. + BITMAPB_t BitMask; // bit in BitMap for Indexs Digit. + + Digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + +// Common code for all BranchBs; come here with Digit set: + +JudyBranchB: + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjbb = P_JBB(Pjp->jp_Addr); + subexp = Digit / cJU_BITSPERSUBEXPB; + + BitMap = JU_JBB_BITMAP(Pjbb, subexp); + Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp)); + + BitMask = JU_BITPOSMASKB(Digit); + +// No JP in subexpanse for Index => Index not found: + + if (! (BitMap & BitMask)) break; + +// Count JPs in the subexpanse below the one for Index: + + Pjp += j__udyCountBitsB(BitMap & (BitMask - 1)); + + goto ContinueWalk; + + } // case cJU_JPBRANCH_B* + + +// **************************************************************************** +// JPBRANCH_U*: +// +// Notice the reverse order of the cases, and falling through to the next case, +// for performance. + + case cJU_JPBRANCH_U: + + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, cJU_ROOTSTATE); + +// If not a BranchU, traverse; otherwise fall into the next case, which makes +// this very fast code for a large Judy array (mainly BranchUs), especially +// when branches are already in the cache, such as for prev/next: + +#ifndef JU_64BIT + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U3) goto ContinueWalk; +#else + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U7) goto ContinueWalk; +#endif + +#ifdef JU_64BIT + case cJU_JPBRANCH_U7: + + // JU_DCDNOTMATCHINDEX() would be a no-op. + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 7); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U6) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U6: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 6); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U5) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U5: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 5); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U4) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U4: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 4); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U3) goto ContinueWalk; + // and fall through. + +#endif // JU_64BIT + + case cJU_JPBRANCH_U3: + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 3); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U2) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U2: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 2); + +// Note: BranchU2 is a special case that must continue traversal to a leaf, +// immed, full, or null type: + + goto ContinueWalk; + + +// **************************************************************************** +// JPLEAF*: +// +// Note: Here the calls of JU_DCDNOTMATCHINDEX() are necessary and check +// whether Index is out of the expanse of a narrow pointer. + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + + case cJU_JPLEAF1: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf1(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF1VALUEAREA(Pjll, Pop1) + posidx));) + } + +#endif // (JUDYL || (! JU_64BIT)) + + case cJU_JPLEAF2: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf2(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF2VALUEAREA(Pjll, Pop1) + posidx));) + } + case cJU_JPLEAF3: + { + int posidx; // signed offset in leaf. + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf3(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF3VALUEAREA(Pjll, Pop1) + posidx));) + } +#ifdef JU_64BIT + case cJU_JPLEAF4: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf4(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF4VALUEAREA(Pjll, Pop1) + posidx));) + } + case cJU_JPLEAF5: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf5(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF5VALUEAREA(Pjll, Pop1) + posidx));) + } + + case cJU_JPLEAF6: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf6(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF6VALUEAREA(Pjll, Pop1) + posidx));) + } + case cJU_JPLEAF7: + { + int posidx; // signed offset in leaf. + + // JU_DCDNOTMATCHINDEX() would be a no-op. + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf7(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF7VALUEAREA(Pjll, Pop1) + posidx));) + } +#endif // JU_64BIT + + +// **************************************************************************** +// JPLEAF_B1: + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb; +#ifdef JUDYL + int posidx; + Word_t subexp; // in bitmap, 0..7. + BITMAPL_t BitMap; // for one subexpanse. + BITMAPL_t BitMask; // bit in BitMap for Indexs Digit. + Pjv_t Pjv; +#endif + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + + Pjlb = P_JLB(Pjp->jp_Addr); + +#ifdef JUDY1 + +// Simply check if Indexs bit is set in the bitmap: + + if (JU_BITMAPTESTL(Pjlb, Index)) return(1); + break; + +#else // JUDYL + +// JudyL is much more complicated because of value area subarrays: + + Digit = JU_DIGITATSTATE(Index, 1); + subexp = Digit / cJU_BITSPERSUBEXPL; + BitMap = JU_JLB_BITMAP(Pjlb, subexp); + BitMask = JU_BITPOSMASKL(Digit); + +// No value in subexpanse for Index => Index not found: + + if (! (BitMap & BitMask)) break; + +// Count value areas in the subexpanse below the one for Index: + + Pjv = P_JV(JL_JLB_PVALUE(Pjlb, subexp)); + assert(Pjv != (Pjv_t) NULL); + posidx = j__udyCountBitsL(BitMap & (BitMask - 1)); + + return((PPvoid_t) (Pjv + posidx)); + +#endif // JUDYL + + } // case cJU_JPLEAF_B1 + +#ifdef JUDY1 + +// **************************************************************************** +// JPFULLPOPU1: +// +// If the Index is in the expanse, it is necessarily valid (found). + + case cJ1_JPFULLPOPU1: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + return(1); + +#ifdef notdef // for future enhancements +#ifdef JU_64BIT + +// Note: Need ? if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + + case cJ1_JPFULLPOPU1m15: + if (Pjp->jp_1Index[14] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m14: + if (Pjp->jp_1Index[13] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m13: + if (Pjp->jp_1Index[12] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m12: + if (Pjp->jp_1Index[11] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m11: + if (Pjp->jp_1Index[10] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m10: + if (Pjp->jp_1Index[9] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m9: + if (Pjp->jp_1Index[8] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m8: + if (Pjp->jp_1Index[7] == (uint8_t)Index) break; +#endif + case cJ1_JPFULLPOPU1m7: + if (Pjp->jp_1Index[6] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m6: + if (Pjp->jp_1Index[5] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m5: + if (Pjp->jp_1Index[4] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m4: + if (Pjp->jp_1Index[3] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m3: + if (Pjp->jp_1Index[2] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m2: + if (Pjp->jp_1Index[1] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m1: + if (Pjp->jp_1Index[0] == (uint8_t)Index) break; + + return(1); // found, not in exclusion list + +#endif // JUDY1 +#endif // notdef + +// **************************************************************************** +// JPIMMED*: +// +// Note that the contents of jp_DcdPopO are different for cJU_JPIMMED_*_01: + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + if (JU_JPDCDPOP0(Pjp) != JU_TRIMTODCDSIZE(Index)) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) &(Pjp->jp_Addr));) // immediate value area. + + +// Macros to make code more readable and avoid dup errors + +#ifdef JUDY1 + +#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX) \ +if (((LEAF_T *)((PJP)->jp_1Index))[(IDX) - 1] == (LEAF_T)(INDEX)) \ + return(1) + +#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY) \ +{ \ + Word_t i_ndex; \ + uint8_t *a_ddr; \ + a_ddr = (PJP)->jp_1Index + (((IDX) - 1) * (LFBTS)); \ + COPY(i_ndex, a_ddr); \ + if (i_ndex == JU_LEASTBYTES((INDEX), (LFBTS))) \ + return(1); \ +} +#endif + +#ifdef JUDYL + +#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX) \ +if (((LEAF_T *)((PJP)->jp_LIndex))[(IDX) - 1] == (LEAF_T)(INDEX)) \ + return((PPvoid_t)(P_JV((PJP)->jp_Addr) + (IDX) - 1)) + +#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY) \ +{ \ + Word_t i_ndex; \ + uint8_t *a_ddr; \ + a_ddr = (PJP)->jp_LIndex + (((IDX) - 1) * (LFBTS)); \ + COPY(i_ndex, a_ddr); \ + if (i_ndex == JU_LEASTBYTES((INDEX), (LFBTS))) \ + return((PPvoid_t)(P_JV((PJP)->jp_Addr) + (IDX) - 1)); \ +} +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_15: CHECKINDEXNATIVE(uint8_t, Pjp, 15, Index); + case cJ1_JPIMMED_1_14: CHECKINDEXNATIVE(uint8_t, Pjp, 14, Index); + case cJ1_JPIMMED_1_13: CHECKINDEXNATIVE(uint8_t, Pjp, 13, Index); + case cJ1_JPIMMED_1_12: CHECKINDEXNATIVE(uint8_t, Pjp, 12, Index); + case cJ1_JPIMMED_1_11: CHECKINDEXNATIVE(uint8_t, Pjp, 11, Index); + case cJ1_JPIMMED_1_10: CHECKINDEXNATIVE(uint8_t, Pjp, 10, Index); + case cJ1_JPIMMED_1_09: CHECKINDEXNATIVE(uint8_t, Pjp, 9, Index); + case cJ1_JPIMMED_1_08: CHECKINDEXNATIVE(uint8_t, Pjp, 8, Index); +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_07: CHECKINDEXNATIVE(uint8_t, Pjp, 7, Index); + case cJU_JPIMMED_1_06: CHECKINDEXNATIVE(uint8_t, Pjp, 6, Index); + case cJU_JPIMMED_1_05: CHECKINDEXNATIVE(uint8_t, Pjp, 5, Index); + case cJU_JPIMMED_1_04: CHECKINDEXNATIVE(uint8_t, Pjp, 4, Index); +#endif + case cJU_JPIMMED_1_03: CHECKINDEXNATIVE(uint8_t, Pjp, 3, Index); + case cJU_JPIMMED_1_02: CHECKINDEXNATIVE(uint8_t, Pjp, 2, Index); + CHECKINDEXNATIVE(uint8_t, Pjp, 1, Index); + break; + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_07: CHECKINDEXNATIVE(uint16_t, Pjp, 7, Index); + case cJ1_JPIMMED_2_06: CHECKINDEXNATIVE(uint16_t, Pjp, 6, Index); + case cJ1_JPIMMED_2_05: CHECKINDEXNATIVE(uint16_t, Pjp, 5, Index); + case cJ1_JPIMMED_2_04: CHECKINDEXNATIVE(uint16_t, Pjp, 4, Index); +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_03: CHECKINDEXNATIVE(uint16_t, Pjp, 3, Index); + case cJU_JPIMMED_2_02: CHECKINDEXNATIVE(uint16_t, Pjp, 2, Index); + CHECKINDEXNATIVE(uint16_t, Pjp, 1, Index); + break; +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_05: + CHECKLEAFNONNAT(3, Pjp, Index, 5, JU_COPY3_PINDEX_TO_LONG); + case cJ1_JPIMMED_3_04: + CHECKLEAFNONNAT(3, Pjp, Index, 4, JU_COPY3_PINDEX_TO_LONG); + case cJ1_JPIMMED_3_03: + CHECKLEAFNONNAT(3, Pjp, Index, 3, JU_COPY3_PINDEX_TO_LONG); +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: + CHECKLEAFNONNAT(3, Pjp, Index, 2, JU_COPY3_PINDEX_TO_LONG); + CHECKLEAFNONNAT(3, Pjp, Index, 1, JU_COPY3_PINDEX_TO_LONG); + break; +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + + case cJ1_JPIMMED_4_03: CHECKINDEXNATIVE(uint32_t, Pjp, 3, Index); + case cJ1_JPIMMED_4_02: CHECKINDEXNATIVE(uint32_t, Pjp, 2, Index); + CHECKINDEXNATIVE(uint32_t, Pjp, 1, Index); + break; + + case cJ1_JPIMMED_5_03: + CHECKLEAFNONNAT(5, Pjp, Index, 3, JU_COPY5_PINDEX_TO_LONG); + case cJ1_JPIMMED_5_02: + CHECKLEAFNONNAT(5, Pjp, Index, 2, JU_COPY5_PINDEX_TO_LONG); + CHECKLEAFNONNAT(5, Pjp, Index, 1, JU_COPY5_PINDEX_TO_LONG); + break; + + case cJ1_JPIMMED_6_02: + CHECKLEAFNONNAT(6, Pjp, Index, 2, JU_COPY6_PINDEX_TO_LONG); + CHECKLEAFNONNAT(6, Pjp, Index, 1, JU_COPY6_PINDEX_TO_LONG); + break; + + case cJ1_JPIMMED_7_02: + CHECKLEAFNONNAT(7, Pjp, Index, 2, JU_COPY7_PINDEX_TO_LONG); + CHECKLEAFNONNAT(7, Pjp, Index, 1, JU_COPY7_PINDEX_TO_LONG); + break; + +#endif // (JUDY1 && JU_64BIT) + + +// **************************************************************************** +// INVALID JP TYPE: + + default: + +ReturnCorrupt: + +#ifdef JUDYGETINLINE // Pjpm is known to be non-null: + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); +#else + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); +#endif + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // switch on JP type + +JUDY1CODE(return(0);) +JUDYLCODE(return((PPvoid_t) NULL);) + +} // Judy1Test() / JudyLGet() + + +#ifndef JUDYGETINLINE // only compile the following function once: +#ifdef DEBUG + +// **************************************************************************** +// J U D Y C H E C K P O P +// +// Given a pointer to a Judy array, traverse the entire array to ensure +// population counts add up correctly. This can catch various coding errors. +// +// Since walking the entire tree is probably time-consuming, enable this +// function by setting env parameter $CHECKPOP to first call at which to start +// checking. Note: This function is called both from insert and delete code. +// +// Note: Even though this function does nothing useful for LEAFW leaves, its +// good practice to call it anyway, and cheap too. +// +// TBD: This is a debug-only check function similar to JudyCheckSorted(), but +// since it walks the tree it is Judy1/JudyL-specific and must live in a source +// file that is built both ways. +// +// TBD: As feared, enabling this code for every insert/delete makes Judy +// deathly slow, even for a small tree (10K indexes). Its not so bad if +// present but disabled (<1% slowdown measured). Still, should it be ifdefd +// other than DEBUG and/or called less often? +// +// TBD: Should this "population checker" be expanded to a comprehensive tree +// checker? It currently detects invalid LEAFW/JP types as well as inconsistent +// pop1s. Other possible checks, all based on essentially redundant data in +// the Judy tree, include: +// +// - Zero LS bits in jp_Addr field. +// +// - Correct Dcd bits. +// +// - Consistent JP types (always descending down the tree). +// +// - Sorted linear lists in BranchLs and leaves (using JudyCheckSorted(), but +// ideally that function is already called wherever appropriate after any +// linear list is modified). +// +// - Any others possible? + +#include // for getenv() and atol(). + +static Word_t JudyCheckPopSM(Pjp_t Pjp, Word_t RootPop1); + +FUNCTION void JudyCheckPop( + Pvoid_t PArray) +{ +static bool_t checked = FALSE; // already checked env parameter. +static bool_t enabled = FALSE; // env parameter set. +static bool_t active = FALSE; // calls >= callsmin. +static Word_t callsmin; // start point from $CHECKPOP. +static Word_t calls = 0; // times called so far. + + +// CHECK FOR EXTERNAL ENABLING: + + if (! checked) // only check once. + { + char * value; // for getenv(). + + checked = TRUE; + + if ((value = getenv("CHECKPOP")) == (char *) NULL) + { +#ifdef notdef +// Take this out because nightly tests want to be flavor-independent; its not +// OK to emit special non-error output from the debug flavor: + + (void) puts("JudyCheckPop() present but not enabled by " + "$CHECKPOP env parameter; set it to the number of " + "calls at which to begin checking"); +#endif + return; + } + + callsmin = atol(value); // note: non-number evaluates to 0. + enabled = TRUE; + + (void) printf("JudyCheckPop() present and enabled; callsmin = " + "%lu\n", callsmin); + } + else if (! enabled) return; + +// Previously or just now enabled; check if non-active or newly active: + + if (! active) + { + if (++calls < callsmin) return; + + (void) printf("JudyCheckPop() activated at call %lu\n", calls); + active = TRUE; + } + +// IGNORE LEAFW AT TOP OF TREE: + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + return; + +// Check JPM pop0 against tree, recursively: +// +// Note: The traversal code in JudyCheckPopSM() is simplest when the case +// statement for each JP type compares the pop1 for that JP to its subtree (if +// any) after traversing the subtree (thats the hard part) and adding up +// actual pop1s. A top branchs JP in the JPM does not have room for a +// full-word pop1, so pass it in as a special case. + + { + Pjpm_t Pjpm = P_JPM(PArray); + (void) JudyCheckPopSM(&(Pjpm->jpm_JP), Pjpm->jpm_Pop0 + 1); + return; + } + +} // JudyCheckPop() + + +// **************************************************************************** +// J U D Y C H E C K P O P S M +// +// Recursive state machine (subroutine) for JudyCheckPop(): Given a Pjp (other +// than JPNULL*; caller should shortcut) and the root population for top-level +// branches, check the subtrees actual pop1 against its nominal value, and +// return the total pop1 for the subtree. +// +// Note: Expect RootPop1 to be ignored at lower levels, so pass down 0, which +// should pop an assertion if this expectation is violated. + +FUNCTION static Word_t JudyCheckPopSM( + Pjp_t Pjp, // top of subtree. + Word_t RootPop1) // whole array, for top-level branches only. +{ + Word_t pop1_jp; // nominal population from the JP. + Word_t pop1 = 0; // actual population at this level. + Word_t offset; // in a branch. + +#define PREPBRANCH(cPopBytes,Next) \ + pop1_jp = JU_JPBRANCH_POP0(Pjp, cPopBytes) + 1; goto Next + +assert((((Word_t) (Pjp->jp_Addr)) & 7) == 3); + switch (JU_JPTYPE(Pjp)) + { + + case cJU_JPBRANCH_L2: PREPBRANCH(2, BranchL); + case cJU_JPBRANCH_L3: PREPBRANCH(3, BranchL); +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: PREPBRANCH(4, BranchL); + case cJU_JPBRANCH_L5: PREPBRANCH(5, BranchL); + case cJU_JPBRANCH_L6: PREPBRANCH(6, BranchL); + case cJU_JPBRANCH_L7: PREPBRANCH(7, BranchL); +#endif + case cJU_JPBRANCH_L: pop1_jp = RootPop1; + { + Pjbl_t Pjbl; +BranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + + for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset) + pop1 += JudyCheckPopSM((Pjbl->jbl_jp) + offset, 0); + + assert(pop1_jp == pop1); + return(pop1); + } + + case cJU_JPBRANCH_B2: PREPBRANCH(2, BranchB); + case cJU_JPBRANCH_B3: PREPBRANCH(3, BranchB); +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: PREPBRANCH(4, BranchB); + case cJU_JPBRANCH_B5: PREPBRANCH(5, BranchB); + case cJU_JPBRANCH_B6: PREPBRANCH(6, BranchB); + case cJU_JPBRANCH_B7: PREPBRANCH(7, BranchB); +#endif + case cJU_JPBRANCH_B: pop1_jp = RootPop1; + { + Word_t subexp; + Word_t jpcount; + Pjbb_t Pjbb; +BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) + { + jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)); + + for (offset = 0; offset < jpcount; ++offset) + { + pop1 += JudyCheckPopSM(P_JP(JU_JBB_PJP(Pjbb, subexp)) + + offset, 0); + } + } + + assert(pop1_jp == pop1); + return(pop1); + } + + case cJU_JPBRANCH_U2: PREPBRANCH(2, BranchU); + case cJU_JPBRANCH_U3: PREPBRANCH(3, BranchU); +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: PREPBRANCH(4, BranchU); + case cJU_JPBRANCH_U5: PREPBRANCH(5, BranchU); + case cJU_JPBRANCH_U6: PREPBRANCH(6, BranchU); + case cJU_JPBRANCH_U7: PREPBRANCH(7, BranchU); +#endif + case cJU_JPBRANCH_U: pop1_jp = RootPop1; + { + Pjbu_t Pjbu; +BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + + for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset) + { + if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1) + && ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX)) + { + continue; // skip null JP to save time. + } + + pop1 += JudyCheckPopSM((Pjbu->jbu_jp) + offset, 0); + } + + assert(pop1_jp == pop1); + return(pop1); + } + + +// -- Cases below here terminate and do not recurse. -- +// +// For all of these cases except JPLEAF_B1, there is no way to check the JPs +// pop1 against the object itself; just return the pop1; but for linear leaves, +// a bounds check is possible. + +#define CHECKLEAF(MaxPop1) \ + pop1 = JU_JPLEAF_POP0(Pjp) + 1; \ + assert(pop1 >= 1); \ + assert(pop1 <= (MaxPop1)); \ + return(pop1) + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: CHECKLEAF(cJU_LEAF1_MAXPOP1); +#endif + case cJU_JPLEAF2: CHECKLEAF(cJU_LEAF2_MAXPOP1); + case cJU_JPLEAF3: CHECKLEAF(cJU_LEAF3_MAXPOP1); +#ifdef JU_64BIT + case cJU_JPLEAF4: CHECKLEAF(cJU_LEAF4_MAXPOP1); + case cJU_JPLEAF5: CHECKLEAF(cJU_LEAF5_MAXPOP1); + case cJU_JPLEAF6: CHECKLEAF(cJU_LEAF6_MAXPOP1); + case cJU_JPLEAF7: CHECKLEAF(cJU_LEAF7_MAXPOP1); +#endif + + case cJU_JPLEAF_B1: + { + Word_t subexp; + Pjlb_t Pjlb; + + pop1_jp = JU_JPLEAF_POP0(Pjp) + 1; + + Pjlb = P_JLB(Pjp->jp_Addr); + + for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp) + pop1 += j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)); + + assert(pop1_jp == pop1); + return(pop1); + } + + JUDY1CODE(case cJ1_JPFULLPOPU1: return(cJU_JPFULLPOPU1_POP0);) + + case cJU_JPIMMED_1_01: return(1); + case cJU_JPIMMED_2_01: return(1); + case cJU_JPIMMED_3_01: return(1); +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: return(1); + case cJU_JPIMMED_5_01: return(1); + case cJU_JPIMMED_6_01: return(1); + case cJU_JPIMMED_7_01: return(1); +#endif + + case cJU_JPIMMED_1_02: return(2); + case cJU_JPIMMED_1_03: return(3); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: return(4); + case cJU_JPIMMED_1_05: return(5); + case cJU_JPIMMED_1_06: return(6); + case cJU_JPIMMED_1_07: return(7); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: return(8); + case cJ1_JPIMMED_1_09: return(9); + case cJ1_JPIMMED_1_10: return(10); + case cJ1_JPIMMED_1_11: return(11); + case cJ1_JPIMMED_1_12: return(12); + case cJ1_JPIMMED_1_13: return(13); + case cJ1_JPIMMED_1_14: return(14); + case cJ1_JPIMMED_1_15: return(15); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: return(2); + case cJU_JPIMMED_2_03: return(3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: return(4); + case cJ1_JPIMMED_2_05: return(5); + case cJ1_JPIMMED_2_06: return(6); + case cJ1_JPIMMED_2_07: return(7); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: return(2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: return(3); + case cJ1_JPIMMED_3_04: return(4); + case cJ1_JPIMMED_3_05: return(5); + + case cJ1_JPIMMED_4_02: return(2); + case cJ1_JPIMMED_4_03: return(3); + case cJ1_JPIMMED_5_02: return(2); + case cJ1_JPIMMED_5_03: return(3); + case cJ1_JPIMMED_6_02: return(2); + case cJ1_JPIMMED_7_02: return(2); +#endif + + } // switch (JU_JPTYPE(Pjp)) + + assert(FALSE); // unrecognized JP type => corruption. + return(0); // to make some compilers happy. + +} // JudyCheckPopSM() + +#endif // DEBUG +#endif // ! JUDYGETINLINE diff --git a/libnetdata/libjudy/src/JudyL/JudyLIns.c b/libnetdata/libjudy/src/JudyL/JudyLIns.c new file mode 100644 index 000000000..f96df4101 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLIns.c @@ -0,0 +1,1873 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.116 $ $Source: /judy/src/JudyCommon/JudyIns.c $ +// +// Judy1Set() and JudyLIns() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// TBD: Should some of the assertions here be converted to product code that +// returns JU_ERRNO_CORRUPT? + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +// Note: Call JudyCheckPop() even before "already inserted" returns, to catch +// population errors; see fix in 4.84: + +DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);) +DBGCODE(extern void JudyCheckSorted(Pjll_t Pjll, Word_t Pop1, long IndexSize);) + +#ifdef TRACEJP +#include "JudyPrintJP.c" +#endif + + +// These are defined to generic values in JudyCommon/JudyPrivateTypes.h: +// +// TBD: These should be exported from a header file, but perhaps not, as they +// are only used here, and exported from Judy*Decascade, which is a separate +// file for profiling reasons (to prevent inlining), but which potentially +// could be merged with this file, either in SoftCM or at compile-time. + +#ifdef JUDY1 +extern int j__udy1CreateBranchB(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t); +extern int j__udy1CreateBranchU(Pjp_t, Pvoid_t); + +#ifndef JU_64BIT +extern int j__udy1Cascade1(Pjp_t, Pvoid_t); +#endif +extern int j__udy1Cascade2(Pjp_t, Pvoid_t); +extern int j__udy1Cascade3(Pjp_t, Pvoid_t); +#ifdef JU_64BIT +extern int j__udy1Cascade4(Pjp_t, Pvoid_t); +extern int j__udy1Cascade5(Pjp_t, Pvoid_t); +extern int j__udy1Cascade6(Pjp_t, Pvoid_t); +extern int j__udy1Cascade7(Pjp_t, Pvoid_t); +#endif +extern int j__udy1CascadeL(Pjp_t, Pvoid_t); + +extern int j__udy1InsertBranch(Pjp_t Pjp, Word_t Index, Word_t Btype, Pjpm_t); + +#else // JUDYL + +extern int j__udyLCreateBranchB(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t); +extern int j__udyLCreateBranchU(Pjp_t, Pvoid_t); + +extern int j__udyLCascade1(Pjp_t, Pvoid_t); +extern int j__udyLCascade2(Pjp_t, Pvoid_t); +extern int j__udyLCascade3(Pjp_t, Pvoid_t); +#ifdef JU_64BIT +extern int j__udyLCascade4(Pjp_t, Pvoid_t); +extern int j__udyLCascade5(Pjp_t, Pvoid_t); +extern int j__udyLCascade6(Pjp_t, Pvoid_t); +extern int j__udyLCascade7(Pjp_t, Pvoid_t); +#endif +extern int j__udyLCascadeL(Pjp_t, Pvoid_t); + +extern int j__udyLInsertBranch(Pjp_t Pjp, Word_t Index, Word_t Btype, Pjpm_t); +#endif + + +// **************************************************************************** +// MACROS FOR COMMON CODE: +// +// Check if Index is an outlier to (that is, not a member of) this expanse: +// +// An outlier is an Index in-the-expanse of the slot containing the pointer, +// but not-in-the-expanse of the "narrow" pointer in that slot. (This means +// the Dcd part of the Index differs from the equivalent part of jp_DcdPopO.) +// Therefore, the remedy is to put a cJU_JPBRANCH_L* between the narrow pointer +// and the object to which it points, and add the outlier Index as an Immediate +// in the cJU_JPBRANCH_L*. The "trick" is placing the cJU_JPBRANCH_L* at a +// Level that is as low as possible. This is determined by counting the digits +// in the existing narrow pointer that are the same as the digits in the new +// Index (see j__udyInsertBranch()). +// +// Note: At some high Levels, cJU_DCDMASK() is all zeros => dead code; assume +// the compiler optimizes this out. + +#define JU_CHECK_IF_OUTLIER(Pjp, Index, cLevel, Pjpm) \ + if (JU_DCDNOTMATCHINDEX(Index, Pjp, cLevel)) \ + return(j__udyInsertBranch(Pjp, Index, cLevel, Pjpm)) + +// Check if an Index is already in a leaf or immediate, after calling +// j__udySearchLeaf*() to set Offset: +// +// A non-negative Offset means the Index already exists, so return 0; otherwise +// complement Offset to proceed. + +#ifdef JUDY1 +#define Pjv ignore // placeholder. +#define JU_CHECK_IF_EXISTS(Offset,ignore,Pjpm) \ + { \ + if ((Offset) >= 0) return(0); \ + (Offset) = ~(Offset); \ + } +#else +// For JudyL, also set the value area pointer in the Pjpm: + +#define JU_CHECK_IF_EXISTS(Offset,Pjv,Pjpm) \ + { \ + if ((Offset) >= 0) \ + { \ + (Pjpm)->jpm_PValue = (Pjv) + (Offset); \ + return(0); \ + } \ + (Offset) = ~(Offset); \ + } +#endif + + +// **************************************************************************** +// __ J U D Y I N S W A L K +// +// Walk the Judy tree to do a set/insert. This is only called internally, and +// recursively. Unlike Judy1Test() and JudyLGet(), the extra time required for +// recursion should be negligible compared with the total. +// +// Return -1 for error (details in JPM), 0 for Index already inserted, 1 for +// new Index inserted. + +FUNCTION static int j__udyInsWalk( + Pjp_t Pjp, // current JP to descend. + Word_t Index, // to insert. + Pjpm_t Pjpm) // for returning info to top Level. +{ + uint8_t digit; // from Index, current offset into a branch. + jp_t newJP; // for creating a new Immed JP. + Word_t exppop1; // expanse (leaf) population. + int retcode; // return codes: -1, 0, 1. + +#ifdef SUBEXPCOUNTS +// Pointer to BranchB/U subexpanse counter: +// +// Note: Very important for performance reasons (avoids cache fills). + + PWord_t PSubExp = (PWord_t) NULL; +#endif + +ContinueInsWalk: // for modifying state without recursing. + +#ifdef TRACEJP + JudyPrintJP(Pjp, "i", __LINE__); +#endif + + switch (JU_JPTYPE(Pjp)) // entry: Pjp, Index. + { + + +// **************************************************************************** +// JPNULL*: +// +// Convert JP in place from current null type to cJU_JPIMMED_*_01 by +// calculating new JP type. + + case cJU_JPNULL1: + case cJU_JPNULL2: + case cJU_JPNULL3: +#ifdef JU_64BIT + case cJU_JPNULL4: + case cJU_JPNULL5: + case cJU_JPNULL6: + case cJU_JPNULL7: +#endif + assert((Pjp->jp_Addr) == 0); + JU_JPSETADT(Pjp, 0, Index, JU_JPTYPE(Pjp) + cJU_JPIMMED_1_01 - cJU_JPNULL1); +#ifdef JUDYL + // value area is first word of new Immed_01 JP: + Pjpm->jpm_PValue = (Pjv_t) (&(Pjp->jp_Addr)); +#endif + return(1); + + +// **************************************************************************** +// JPBRANCH_L*: +// +// If the new Index is not an outlier to the branchs expanse, and the branch +// should not be converted to uncompressed, extract the digit and record the +// Immediate type to create for a new Immed JP, before going to common code. +// +// Note: JU_CHECK_IF_OUTLIER() is a no-op for BranchB3[7] on 32[64]-bit. + +#define JU_BRANCH_OUTLIER(DIGIT,POP1,cLEVEL,PJP,INDEX,PJPM) \ + JU_CHECK_IF_OUTLIER(PJP, INDEX, cLEVEL, PJPM); \ + (DIGIT) = JU_DIGITATSTATE(INDEX, cLEVEL); \ + (POP1) = JU_JPBRANCH_POP0(PJP, cLEVEL) + + case cJU_JPBRANCH_L2: + JU_BRANCH_OUTLIER(digit, exppop1, 2, Pjp, Index, Pjpm); + goto JudyBranchL; + + case cJU_JPBRANCH_L3: + JU_BRANCH_OUTLIER(digit, exppop1, 3, Pjp, Index, Pjpm); + goto JudyBranchL; + +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: + JU_BRANCH_OUTLIER(digit, exppop1, 4, Pjp, Index, Pjpm); + goto JudyBranchL; + + case cJU_JPBRANCH_L5: + JU_BRANCH_OUTLIER(digit, exppop1, 5, Pjp, Index, Pjpm); + goto JudyBranchL; + + case cJU_JPBRANCH_L6: + JU_BRANCH_OUTLIER(digit, exppop1, 6, Pjp, Index, Pjpm); + goto JudyBranchL; + + case cJU_JPBRANCH_L7: + JU_BRANCH_OUTLIER(digit, exppop1, 7, Pjp, Index, Pjpm); + goto JudyBranchL; +#endif + +// Similar to common code above, but no outlier check is needed, and the Immed +// type depends on the word size: + + case cJU_JPBRANCH_L: + { + Pjbl_t PjblRaw; // pointer to old linear branch. + Pjbl_t Pjbl; + Pjbu_t PjbuRaw; // pointer to new uncompressed branch. + Pjbu_t Pjbu; + Word_t numJPs; // number of JPs = populated expanses. + int offset; // in branch. + + digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + exppop1 = Pjpm->jpm_Pop0; + + // fall through: + +// COMMON CODE FOR LINEAR BRANCHES: +// +// Come here with digit and exppop1 already set. + +JudyBranchL: + PjblRaw = (Pjbl_t) (Pjp->jp_Addr); + Pjbl = P_JBL(PjblRaw); + +// If population under this branch greater than: + + if (exppop1 > JU_BRANCHL_MAX_POP) + goto ConvertBranchLtoU; + + numJPs = Pjbl->jbl_NumJPs; + + if ((numJPs == 0) || (numJPs > cJU_BRANCHLMAXJPS)) + { + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); + return(-1); + } + +// Search for a match to the digit: + + offset = j__udySearchLeaf1((Pjll_t) (Pjbl->jbl_Expanse), numJPs, + digit); + +// If Index is found, offset is into an array of 1..cJU_BRANCHLMAXJPS JPs: + + if (offset >= 0) + { + Pjp = (Pjbl->jbl_jp) + offset; // address of next JP. + break; // continue walk. + } + +// Expanse is missing (not populated) for the passed Index, so insert an Immed +// -- if theres room: + + if (numJPs < cJU_BRANCHLMAXJPS) + { + offset = ~offset; // insertion offset. + + JU_JPSETADT(&newJP, 0, Index, + JU_JPTYPE(Pjp) + cJU_JPIMMED_1_01-cJU_JPBRANCH_L2); + + JU_INSERTINPLACE(Pjbl->jbl_Expanse, numJPs, offset, digit); + JU_INSERTINPLACE(Pjbl->jbl_jp, numJPs, offset, newJP); + + DBGCODE(JudyCheckSorted((Pjll_t) (Pjbl->jbl_Expanse), + numJPs + 1, /* IndexSize = */ 1);) + ++(Pjbl->jbl_NumJPs); +#ifdef JUDYL + // value area is first word of new Immed 01 JP: + Pjpm->jpm_PValue = (Pjv_t) ((Pjbl->jbl_jp) + offset); +#endif + return(1); + } + + +// MAXED OUT LINEAR BRANCH, CONVERT TO A BITMAP BRANCH, THEN INSERT: +// +// Copy the linear branch to a bitmap branch. +// +// TBD: Consider renaming j__udyCreateBranchB() to j__udyConvertBranchLtoB(). + + assert((numJPs) <= cJU_BRANCHLMAXJPS); + + if (j__udyCreateBranchB(Pjp, Pjbl->jbl_jp, Pjbl->jbl_Expanse, + numJPs, Pjpm) == -1) + { + return(-1); + } + +// Convert jp_Type from linear branch to equivalent bitmap branch: + + Pjp->jp_Type += cJU_JPBRANCH_B - cJU_JPBRANCH_L; + + j__udyFreeJBL(PjblRaw, Pjpm); // free old BranchL. + +// Having changed branch types, now do the insert in the new branch type: + + goto ContinueInsWalk; + + +// OPPORTUNISTICALLY CONVERT FROM BRANCHL TO BRANCHU: +// +// Memory efficiency is no object because the branchs pop1 is large enough, so +// speed up array access. Come here with PjblRaw set. Note: This is goto +// code because the previous block used to fall through into it as well, but no +// longer. + +ConvertBranchLtoU: + +// Allocate memory for an uncompressed branch: + + if ((PjbuRaw = j__udyAllocJBU(Pjpm)) == (Pjbu_t) NULL) + return(-1); + Pjbu = P_JBU(PjbuRaw); + +// Set the proper NULL type for most of the uncompressed branchs JPs: + + JU_JPSETADT(&newJP, 0, 0, + JU_JPTYPE(Pjp) - cJU_JPBRANCH_L2 + cJU_JPNULL1); + +// Initialize: Pre-set uncompressed branch to mostly JPNULL*s: + + for (numJPs = 0; numJPs < cJU_BRANCHUNUMJPS; ++numJPs) + Pjbu->jbu_jp[numJPs] = newJP; + +// Copy JPs from linear branch to uncompressed branch: + + { +#ifdef SUBEXPCOUNTS + Word_t popmask = cJU_POP0MASK(JU_JPTYPE(Pjp)) + - cJU_JPBRANCH_L2 - 2; + + for (numJPs = 0; numJPs < cJU_NUMSUBEXPU; ++numJPs) + Pjbu->jbu_subPop1[numJPs] = 0; +#endif + for (numJPs = 0; numJPs < Pjbl->jbl_NumJPs; ++numJPs) + { + Pjp_t Pjp1 = &(Pjbl->jbl_jp[numJPs]); + offset = Pjbl->jbl_Expanse[numJPs]; + Pjbu->jbu_jp[offset] = *Pjp1; +#ifdef SUBEXPCOUNTS + Pjbu->jbu_subPop1[offset/cJU_NUMSUBEXPU] += + JU_JPDCDPOP0(Pjp1) & popmask + 1; +#endif + } + } + j__udyFreeJBL(PjblRaw, Pjpm); // free old BranchL. + +// Plug new values into parent JP: + + Pjp->jp_Addr = (Word_t) PjbuRaw; + Pjp->jp_Type += cJU_JPBRANCH_U - cJU_JPBRANCH_L; // to BranchU. + +// Save global population of last BranchU conversion: + + Pjpm->jpm_LastUPop0 = Pjpm->jpm_Pop0; + goto ContinueInsWalk; + + } // case cJU_JPBRANCH_L. + + +// **************************************************************************** +// JPBRANCH_B*: +// +// If the new Index is not an outlier to the branchs expanse, extract the +// digit and record the Immediate type to create for a new Immed JP, before +// going to common code. +// +// Note: JU_CHECK_IF_OUTLIER() is a no-op for BranchB3[7] on 32[64]-bit. + + case cJU_JPBRANCH_B2: + JU_BRANCH_OUTLIER(digit, exppop1, 2, Pjp, Index, Pjpm); + goto JudyBranchB; + + case cJU_JPBRANCH_B3: + JU_BRANCH_OUTLIER(digit, exppop1, 3, Pjp, Index, Pjpm); + goto JudyBranchB; + +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: + JU_BRANCH_OUTLIER(digit, exppop1, 4, Pjp, Index, Pjpm); + goto JudyBranchB; + + case cJU_JPBRANCH_B5: + JU_BRANCH_OUTLIER(digit, exppop1, 5, Pjp, Index, Pjpm); + goto JudyBranchB; + + case cJU_JPBRANCH_B6: + JU_BRANCH_OUTLIER(digit, exppop1, 6, Pjp, Index, Pjpm); + goto JudyBranchB; + + case cJU_JPBRANCH_B7: + JU_BRANCH_OUTLIER(digit, exppop1, 7, Pjp, Index, Pjpm); + goto JudyBranchB; +#endif + + case cJU_JPBRANCH_B: + { + Pjbb_t Pjbb; // pointer to bitmap branch. + Pjbb_t PjbbRaw; // pointer to bitmap branch. + Pjp_t Pjp2Raw; // 1 of N arrays of JPs. + Pjp_t Pjp2; // 1 of N arrays of JPs. + Word_t subexp; // 1 of N subexpanses in bitmap. + BITMAPB_t bitmap; // for one subexpanse. + BITMAPB_t bitmask; // bit set for Indexs digit. + Word_t numJPs; // number of JPs = populated expanses. + int offset; // in bitmap branch. + +// Similar to common code above, but no outlier check is needed, and the Immed +// type depends on the word size: + + digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + exppop1 = Pjpm->jpm_Pop0; + + // fall through: + + +// COMMON CODE FOR BITMAP BRANCHES: +// +// Come here with digit and exppop1 already set. + +JudyBranchB: + +// If population increment is greater than.. (300): + + if ((Pjpm->jpm_Pop0 - Pjpm->jpm_LastUPop0) > JU_BTOU_POP_INCREMENT) + { + +// If total population of array is greater than.. (750): + + if (Pjpm->jpm_Pop0 > JU_BRANCHB_MAX_POP) + { + +// If population under the branch is greater than.. (135): + + if (exppop1 > JU_BRANCHB_MIN_POP) + { + if (j__udyCreateBranchU(Pjp, Pjpm) == -1) return(-1); + +// Save global population of last BranchU conversion: + + Pjpm->jpm_LastUPop0 = Pjpm->jpm_Pop0; + + goto ContinueInsWalk; + } + } + } + +// CONTINUE TO USE BRANCHB: +// +// Get pointer to bitmap branch (JBB): + + PjbbRaw = (Pjbb_t) (Pjp->jp_Addr); + Pjbb = P_JBB(PjbbRaw); + +// Form the Int32 offset, and Bit offset values: +// +// 8 bit Decode | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +// |SubExpanse | Bit offset | +// +// Get the 1 of 8 expanses from digit, Bits 5..7 = 1 of 8, and get the 32-bit +// word that may have a bit set: + + subexp = digit / cJU_BITSPERSUBEXPB; + bitmap = JU_JBB_BITMAP(Pjbb, subexp); + + Pjp2Raw = JU_JBB_PJP(Pjbb, subexp); + Pjp2 = P_JP(Pjp2Raw); + +// Get the bit position that represents the desired expanse, and get the offset +// into the array of JPs for the JP that matches the bit. + + bitmask = JU_BITPOSMASKB(digit); + offset = j__udyCountBitsB(bitmap & (bitmask - 1)); + +// If JP is already in this expanse, get Pjp and continue the walk: + + if (bitmap & bitmask) + { +#ifdef SUBEXPCOUNTS + PSubExp = &(Pjbb->jbb_Counts[subexp]); // ptr to subexp counts. +#endif + Pjp = Pjp2 + offset; + break; // continue walk. + } + + +// ADD NEW EXPANSE FOR NEW INDEX: +// +// The new expanse always an cJU_JPIMMED_*_01 containing just the new Index, so +// finish setting up an Immed JP. + + JU_JPSETADT(&newJP, 0, Index, + JU_JPTYPE(Pjp) + cJU_JPIMMED_1_01-cJU_JPBRANCH_B2); + +// Get 1 of the 8 JP arrays and calculate number of JPs in subexpanse array: + + Pjp2Raw = JU_JBB_PJP(Pjbb, subexp); + Pjp2 = P_JP(Pjp2Raw); + numJPs = j__udyCountBitsB(bitmap); + +// Expand branch JP subarray in-place: + + if (JU_BRANCHBJPGROWINPLACE(numJPs)) + { + assert(numJPs > 0); + JU_INSERTINPLACE(Pjp2, numJPs, offset, newJP); +#ifdef JUDYL + // value area is first word of new Immed 01 JP: + Pjpm->jpm_PValue = (Pjv_t) (Pjp2 + offset); +#endif + } + +// No room, allocate a bigger bitmap branch JP subarray: + + else + { + Pjp_t PjpnewRaw; + Pjp_t Pjpnew; + + if ((PjpnewRaw = j__udyAllocJBBJP(numJPs + 1, Pjpm)) == 0) + return(-1); + Pjpnew = P_JP(PjpnewRaw); + +// If there was an old JP array, then copy it, insert the new Immed JP, and +// free the old array: + + if (numJPs) + { + JU_INSERTCOPY(Pjpnew, Pjp2, numJPs, offset, newJP); + j__udyFreeJBBJP(Pjp2Raw, numJPs, Pjpm); +#ifdef JUDYL + // value area is first word of new Immed 01 JP: + Pjpm->jpm_PValue = (Pjv_t) (Pjpnew + offset); +#endif + } + +// New JP subarray; point to cJU_JPIMMED_*_01 and place it: + + else + { + assert(JU_JBB_PJP(Pjbb, subexp) == (Pjp_t) NULL); + Pjp = Pjpnew; + *Pjp = newJP; // copy to new memory. +#ifdef JUDYL + // value area is first word of new Immed 01 JP: + Pjpm->jpm_PValue = (Pjv_t) (&(Pjp->jp_Addr)); +#endif + } + +// Place new JP subarray in BranchB: + + JU_JBB_PJP(Pjbb, subexp) = PjpnewRaw; + + } // else + +// Set the new Indexs bit: + + JU_JBB_BITMAP(Pjbb, subexp) |= bitmask; + + return(1); + + } // case + + +// **************************************************************************** +// JPBRANCH_U*: +// +// Just drop through the JP for the correct digit. If the JP turns out to be a +// JPNULL*, thats OK, the memory is already allocated, and the next walk +// simply places an Immed in it. +// +#ifdef SUBEXPCOUNTS +#define JU_GETSUBEXP(PSubExp,Pjbu,Digit) \ + (PSubExp) = &((Pjbu)->jbu_subPop1[(Digit) / cJU_NUMSUBEXPU]) +#else +#define JU_GETSUBEXP(PSubExp,Pjbu,Digit) // null. +#endif + +#define JU_JBU_PJP_SUBEXP(Pjp,PSubExp,Index,Level) \ + { \ + uint8_t digit = JU_DIGITATSTATE(Index, Level); \ + Pjbu_t P_jbu = P_JBU((Pjp)->jp_Addr); \ + (Pjp) = &(P_jbu->jbu_jp[digit]); \ + JU_GETSUBEXP(PSubExp, P_jbu, digit); \ + } + + case cJU_JPBRANCH_U2: + JU_CHECK_IF_OUTLIER(Pjp, Index, 2, Pjpm); + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 2); + break; + +#ifdef JU_64BIT + case cJU_JPBRANCH_U3: + JU_CHECK_IF_OUTLIER(Pjp, Index, 3, Pjpm); + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 3); + break; + + case cJU_JPBRANCH_U4: + JU_CHECK_IF_OUTLIER(Pjp, Index, 4, Pjpm); + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 4); + break; + + case cJU_JPBRANCH_U5: + JU_CHECK_IF_OUTLIER(Pjp, Index, 5, Pjpm); + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 5); + break; + + case cJU_JPBRANCH_U6: + JU_CHECK_IF_OUTLIER(Pjp, Index, 6, Pjpm); + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 6); + break; + + case cJU_JPBRANCH_U7: + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 7); +#else + case cJU_JPBRANCH_U3: + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, 3); +#endif + break; + + case cJU_JPBRANCH_U: + JU_JBU_PJP_SUBEXP(Pjp, PSubExp, Index, cJU_ROOTSTATE); + break; + + +// **************************************************************************** +// JPLEAF*: +// +// COMMON CODE FRAGMENTS TO MINIMIZE REDUNDANCY BELOW: +// +// These are necessary to support performance by function and loop unrolling +// while avoiding huge amounts of nearly identical code. +// +// Prepare to handle a linear leaf: Check for an outlier; set pop1 and pointer +// to leaf: + +#ifdef JUDY1 +#define JU_LEAFVALUE(Pjv) // null. +#define JU_LEAFPREPVALUE(Pjv, ValueArea) // null. +#else +#define JU_LEAFVALUE(Pjv) Pjv_t Pjv +#define JU_LEAFPREPVALUE(Pjv, ValueArea) (Pjv) = ValueArea(Pleaf, exppop1) +#endif + +#define JU_LEAFPREP(cIS,Type,MaxPop1,ValueArea) \ + Pjll_t PjllRaw; \ + Type Pleaf; /* specific type */ \ + int offset; \ + JU_LEAFVALUE(Pjv); \ + \ + JU_CHECK_IF_OUTLIER(Pjp, Index, cIS, Pjpm); \ + \ + exppop1 = JU_JPLEAF_POP0(Pjp) + 1; \ + assert(exppop1 <= (MaxPop1)); \ + PjllRaw = (Pjll_t) (Pjp->jp_Addr); \ + Pleaf = (Type) P_JLL(PjllRaw); \ + JU_LEAFPREPVALUE(Pjv, ValueArea) + +// Add to, or grow, a linear leaf: Find Index position; if the Index is +// absent, if theres room in the leaf, insert the Index [and value of 0] in +// place, otherwise grow the leaf: +// +// Note: These insertions always take place with whole words, using +// JU_INSERTINPLACE() or JU_INSERTCOPY(). + +#ifdef JUDY1 +#define JU_LEAFGROWVALUEADD(Pjv,ExpPop1,Offset) // null. +#else +#define JU_LEAFGROWVALUEADD(Pjv,ExpPop1,Offset) \ + JU_INSERTINPLACE(Pjv, ExpPop1, Offset, 0); \ + Pjpm->jpm_PValue = (Pjv) + (Offset) +#endif + +#ifdef JUDY1 +#define JU_LEAFGROWVALUENEW(ValueArea,Pjv,ExpPop1,Offset) // null. +#else +#define JU_LEAFGROWVALUENEW(ValueArea,Pjv,ExpPop1,Offset) \ + { \ + Pjv_t Pjvnew = ValueArea(Pleafnew, (ExpPop1) + 1); \ + JU_INSERTCOPY(Pjvnew, Pjv, ExpPop1, Offset, 0); \ + Pjpm->jpm_PValue = (Pjvnew) + (Offset); \ + } +#endif + +#define JU_LEAFGROW(cIS,Type,MaxPop1,Search,ValueArea,GrowInPlace, \ + InsertInPlace,InsertCopy,Alloc,Free) \ + \ + offset = Search(Pleaf, exppop1, Index); \ + JU_CHECK_IF_EXISTS(offset, Pjv, Pjpm); \ + \ + if (GrowInPlace(exppop1)) /* add to current leaf */ \ + { \ + InsertInPlace(Pleaf, exppop1, offset, Index); \ + JU_LEAFGROWVALUEADD(Pjv, exppop1, offset); \ + DBGCODE(JudyCheckSorted((Pjll_t) Pleaf, exppop1 + 1, cIS);) \ + return(1); \ + } \ + \ + if (exppop1 < (MaxPop1)) /* grow to new leaf */ \ + { \ + Pjll_t PjllnewRaw; \ + Type Pleafnew; \ + if ((PjllnewRaw = Alloc(exppop1 + 1, Pjpm)) == 0) return(-1); \ + Pleafnew = (Type) P_JLL(PjllnewRaw); \ + InsertCopy(Pleafnew, Pleaf, exppop1, offset, Index); \ + JU_LEAFGROWVALUENEW(ValueArea, Pjv, exppop1, offset); \ + DBGCODE(JudyCheckSorted((Pjll_t) Pleafnew, exppop1 + 1, cIS);) \ + Free(PjllRaw, exppop1, Pjpm); \ + (Pjp->jp_Addr) = (Word_t) PjllnewRaw; \ + return(1); \ + } \ + assert(exppop1 == (MaxPop1)) + +// Handle linear leaf overflow (cascade): Splay or compress into smaller +// leaves: + +#define JU_LEAFCASCADE(MaxPop1,Cascade,Free) \ + if (Cascade(Pjp, Pjpm) == -1) return(-1); \ + Free(PjllRaw, MaxPop1, Pjpm); \ + goto ContinueInsWalk + +// Wrapper around all of the above: + +#define JU_LEAFSET(cIS,Type,MaxPop1,Search,GrowInPlace,InsertInPlace, \ + InsertCopy,Cascade,Alloc,Free,ValueArea) \ + { \ + JU_LEAFPREP(cIS,Type,MaxPop1,ValueArea); \ + JU_LEAFGROW(cIS,Type,MaxPop1,Search,ValueArea,GrowInPlace, \ + InsertInPlace,InsertCopy,Alloc,Free); \ + JU_LEAFCASCADE(MaxPop1,Cascade,Free); \ + } + +// END OF MACROS; LEAFL CASES START HERE: +// +// 64-bit Judy1 does not have 1-byte leaves: + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + + case cJU_JPLEAF1: + + JU_LEAFSET(1, uint8_t *, cJU_LEAF1_MAXPOP1, j__udySearchLeaf1, + JU_LEAF1GROWINPLACE, JU_INSERTINPLACE, JU_INSERTCOPY, + j__udyCascade1, j__udyAllocJLL1, j__udyFreeJLL1, + JL_LEAF1VALUEAREA); + +#endif // (JUDYL || ! JU_64BIT) + + case cJU_JPLEAF2: + + JU_LEAFSET(2, uint16_t *, cJU_LEAF2_MAXPOP1, j__udySearchLeaf2, + JU_LEAF2GROWINPLACE, JU_INSERTINPLACE, JU_INSERTCOPY, + j__udyCascade2, j__udyAllocJLL2, j__udyFreeJLL2, + JL_LEAF2VALUEAREA); + + case cJU_JPLEAF3: + + JU_LEAFSET(3, uint8_t *, cJU_LEAF3_MAXPOP1, j__udySearchLeaf3, + JU_LEAF3GROWINPLACE, JU_INSERTINPLACE3, JU_INSERTCOPY3, + j__udyCascade3, j__udyAllocJLL3, j__udyFreeJLL3, + JL_LEAF3VALUEAREA); + +#ifdef JU_64BIT + case cJU_JPLEAF4: + + JU_LEAFSET(4, uint32_t *, cJU_LEAF4_MAXPOP1, j__udySearchLeaf4, + JU_LEAF4GROWINPLACE, JU_INSERTINPLACE, JU_INSERTCOPY, + j__udyCascade4, j__udyAllocJLL4, j__udyFreeJLL4, + JL_LEAF4VALUEAREA); + + case cJU_JPLEAF5: + + JU_LEAFSET(5, uint8_t *, cJU_LEAF5_MAXPOP1, j__udySearchLeaf5, + JU_LEAF5GROWINPLACE, JU_INSERTINPLACE5, JU_INSERTCOPY5, + j__udyCascade5, j__udyAllocJLL5, j__udyFreeJLL5, + JL_LEAF5VALUEAREA); + + case cJU_JPLEAF6: + + JU_LEAFSET(6, uint8_t *, cJU_LEAF6_MAXPOP1, j__udySearchLeaf6, + JU_LEAF6GROWINPLACE, JU_INSERTINPLACE6, JU_INSERTCOPY6, + j__udyCascade6, j__udyAllocJLL6, j__udyFreeJLL6, + JL_LEAF6VALUEAREA); + + case cJU_JPLEAF7: + + JU_LEAFSET(7, uint8_t *, cJU_LEAF7_MAXPOP1, j__udySearchLeaf7, + JU_LEAF7GROWINPLACE, JU_INSERTINPLACE7, JU_INSERTCOPY7, + j__udyCascade7, j__udyAllocJLL7, j__udyFreeJLL7, + JL_LEAF7VALUEAREA); +#endif // JU_64BIT + + +// **************************************************************************** +// JPLEAF_B1: +// +// 8 bit Decode | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | +// |SubExpanse | Bit offset | +// +// Note: For JudyL, values are stored in 8 subexpanses, each a linear word +// array of up to 32 values each. + + case cJU_JPLEAF_B1: + { +#ifdef JUDYL + Pjv_t PjvRaw; // pointer to value part of the leaf. + Pjv_t Pjv; // pointer to value part of the leaf. + Pjv_t PjvnewRaw; // new value area. + Pjv_t Pjvnew; // new value area. + Word_t subexp; // 1 of 8 subexpanses in bitmap. + Pjlb_t Pjlb; // pointer to bitmap part of the leaf. + BITMAPL_t bitmap; // for one subexpanse. + BITMAPL_t bitmask; // bit set for Indexs digit. + int offset; // of index in value area. +#endif + + JU_CHECK_IF_OUTLIER(Pjp, Index, 1, Pjpm); + +#ifdef JUDY1 + +// If Index (bit) is already set, return now: + + if (JU_BITMAPTESTL(P_JLB(Pjp->jp_Addr), Index)) return(0); + +// If bitmap is not full, set the new Indexs bit; otherwise convert to a Full: + + if ((exppop1 = JU_JPLEAF_POP0(Pjp) + 1) + < cJU_JPFULLPOPU1_POP0) + { + JU_BITMAPSETL(P_JLB(Pjp->jp_Addr), Index); + } + else + { + j__udyFreeJLB1((Pjlb_t) (Pjp->jp_Addr), Pjpm); // free LeafB1. + Pjp->jp_Type = cJ1_JPFULLPOPU1; + Pjp->jp_Addr = 0; + } + +#else // JUDYL + +// This is very different from Judy1 because of the need to return a value area +// even for an existing Index, or manage the value area for a new Index, and +// because JudyL has no Full type: + +// Get last byte to decode from Index, and pointer to bitmap leaf: + + digit = JU_DIGITATSTATE(Index, 1); + Pjlb = P_JLB(Pjp->jp_Addr); + +// Prepare additional values: + + subexp = digit / cJU_BITSPERSUBEXPL; // which subexpanse. + bitmap = JU_JLB_BITMAP(Pjlb, subexp); // subexps 32-bit map. + PjvRaw = JL_JLB_PVALUE(Pjlb, subexp); // corresponding values. + Pjv = P_JV(PjvRaw); // corresponding values. + bitmask = JU_BITPOSMASKL(digit); // mask for Index. + offset = j__udyCountBitsL(bitmap & (bitmask - 1)); // of Index. + +// If Index already exists, get value pointer and exit: + + if (bitmap & bitmask) + { + assert(Pjv); + Pjpm->jpm_PValue = Pjv + offset; // existing value. + return(0); + } + +// Get the total bits set = expanse population of Value area: + + exppop1 = j__udyCountBitsL(bitmap); + +// If the value area can grow in place, do it: + + if (JL_LEAFVGROWINPLACE(exppop1)) + { + JU_INSERTINPLACE(Pjv, exppop1, offset, 0); + JU_JLB_BITMAP(Pjlb, subexp) |= bitmask; // set Indexs bit. + Pjpm->jpm_PValue = Pjv + offset; // new value area. + return(1); + } + +// Increase size of value area: + + if ((PjvnewRaw = j__udyLAllocJV(exppop1 + 1, Pjpm)) + == (Pjv_t) NULL) return(-1); + Pjvnew = P_JV(PjvnewRaw); + + if (exppop1) // have existing value area. + { + assert(Pjv); + JU_INSERTCOPY(Pjvnew, Pjv, exppop1, offset, 0); + Pjpm->jpm_PValue = Pjvnew + offset; + j__udyLFreeJV(PjvRaw, exppop1, Pjpm); // free old values. + } + else // first index, new value area: + { + Pjpm->jpm_PValue = Pjvnew; + *(Pjpm->jpm_PValue) = 0; + } + +// Set bit for new Index and place new leaf value area in bitmap: + + JU_JLB_BITMAP(Pjlb, subexp) |= bitmask; + JL_JLB_PVALUE(Pjlb, subexp) = PjvnewRaw; + +#endif // JUDYL + + return(1); + + } // case + + +#ifdef JUDY1 +// **************************************************************************** +// JPFULLPOPU1: +// +// If Index is not an outlier, then by definition its already set. + + case cJ1_JPFULLPOPU1: + + JU_CHECK_IF_OUTLIER(Pjp, Index, 1, Pjpm); + return(0); +#endif + + +// **************************************************************************** +// JPIMMED*: +// +// This is some of the most complex code in Judy considering Judy1 versus JudyL +// and 32-bit versus 64-bit variations. The following comments attempt to make +// this clearer. +// +// Of the 2 words in a JP, for immediate indexes Judy1 can use 2 words - 1 byte +// = 7 [15] bytes, but JudyL can only use 1 word - 1 byte = 3 [7] bytes because +// the other word is needed for a value area or a pointer to a value area. +// +// For both Judy1 and JudyL, cJU_JPIMMED_*_01 indexes are in word 2; otherwise +// for Judy1 only, a list of 2 or more indexes starts in word 1. JudyL keeps +// the list in word 2 because word 1 is a pointer (to a LeafV, that is, a leaf +// containing only values). Furthermore, cJU_JPIMMED_*_01 indexes are stored +// all-but-first-byte in jp_DcdPopO, not just the Index Sizes bytes. +// +// TBD: This can be confusing because Doug didnt use data structures for it. +// Instead he often directly accesses Pjp for the first word and jp_DcdPopO for +// the second word. It would be nice to use data structs, starting with +// jp_1Index and jp_LIndex where possible. +// +// Maximum Immed JP types for Judy1/JudyL, depending on Index Size (cIS): +// +// 32-bit 64-bit +// +// bytes: 7/ 3 15/ 7 (Judy1/JudyL) +// +// cIS +// 1_ 07/03 15/07 (as in: cJ1_JPIMMED_1_07) +// 2_ 03/01 07/03 +// 3_ 02/01 05/02 +// 4_ 03/01 +// 5_ 03/01 +// 6_ 02/01 +// 7_ 02/01 +// +// State transitions while inserting an Index, matching the above table: +// (Yes, this is very terse... Study it and it will make sense.) +// (Note, parts of this diagram are repeated below for quick reference.) +// +// +-- reformat JP here for Judy1 only, from word-2 to word-1 +// | +// | JUDY1 || JU_64BIT JUDY1 && JU_64BIT +// V +// 1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] Leaf1 (*) +// 2_01 => [ 2_02 => 2_03 => [ 2_04..07 => ]] Leaf2 +// 3_01 => [ 3_02 => [ 3_03..05 => ]] Leaf3 +// JU_64BIT only: +// 4_01 => [[ 4_02..03 => ]] Leaf4 +// 5_01 => [[ 5_02..03 => ]] Leaf5 +// 6_01 => [[ 6_02 => ]] Leaf6 +// 7_01 => [[ 7_02 => ]] Leaf7 +// +// (*) For Judy1 & 64-bit, go directly from cJU_JPIMMED_1_15 to a LeafB1; skip +// Leaf1, as described in Judy1.h regarding cJ1_JPLEAF1. + + +// COMMON CODE FRAGMENTS TO MINIMIZE REDUNDANCY BELOW: +// +// These are necessary to support performance by function and loop unrolling +// while avoiding huge amounts of nearly identical code. +// +// The differences between Judy1 and JudyL with respect to value area handling +// are just too large for completely common code between them... Oh well, some +// big ifdefs follow. However, even in the following ifdefd code, use cJU_*, +// JU_*, and Judy*() instead of cJ1_* / cJL_*, J1_* / JL_*, and +// Judy1*()/JudyL*(), for minimum diffs. +// +// Handle growth of cJU_JPIMMED_*_01 to cJU_JPIMMED_*_02, for an even or odd +// Index Size (cIS), given oldIndex, Index, and Pjll in the context: +// +// Put oldIndex and Index in their proper order. For odd indexes, must copy +// bytes. + +#ifdef JUDY1 + +#define JU_IMMSET_01_COPY_EVEN(ignore1,ignore2) \ + if (oldIndex < Index) { Pjll[0] = oldIndex; Pjll[1] = Index; } \ + else { Pjll[0] = Index; Pjll[1] = oldIndex; } + +#define JU_IMMSET_01_COPY_ODD(cIS,CopyWord) \ + if (oldIndex < Index) \ + { \ + CopyWord(Pjll + 0, oldIndex); \ + CopyWord(Pjll + (cIS), Index); \ + } \ + else \ + { \ + CopyWord(Pjll + 0, Index); \ + CopyWord(Pjll + (cIS), oldIndex); \ + } + +// The "real" *_01 Copy macro: +// +// Trim the high byte off Index, look for a match with the old Index, and if +// none, insert the new Index in the leaf in the correct place, given Pjp and +// Index in the context. +// +// Note: A single immediate index lives in the jp_DcdPopO field, but two or +// more reside starting at Pjp->jp_1Index. + +#define JU_IMMSET_01_COPY(cIS,LeafType,NewJPType,Copy,CopyWord) \ + { \ + LeafType Pjll; \ + Word_t oldIndex = JU_JPDCDPOP0(Pjp); \ + \ + Index = JU_TRIMTODCDSIZE(Index); \ + if (oldIndex == Index) return(0); \ + \ + Pjll = (LeafType) (Pjp->jp_1Index); \ + Copy(cIS,CopyWord); \ + DBGCODE(JudyCheckSorted(Pjll, 2, cIS);) \ + \ + Pjp->jp_Type = (NewJPType); \ + return(1); \ + } + +#else // JUDYL + +// Variations to also handle value areas; see comments above: +// +// For JudyL, Pjv (start of value area) and oldValue are also in the context; +// leave Pjv set to the value area for Index. + +#define JU_IMMSET_01_COPY_EVEN(cIS,CopyWord) \ + if (oldIndex < Index) \ + { \ + Pjll[0] = oldIndex; \ + Pjv [0] = oldValue; \ + Pjll[1] = Index; \ + ++Pjv; \ + } \ + else \ + { \ + Pjll[0] = Index; \ + Pjll[1] = oldIndex; \ + Pjv [1] = oldValue; \ + } + +#define JU_IMMSET_01_COPY_ODD(cIS,CopyWord) \ + if (oldIndex < Index) \ + { \ + CopyWord(Pjll + 0, oldIndex); \ + CopyWord(Pjll + (cIS), Index); \ + Pjv[0] = oldValue; \ + ++Pjv; \ + } \ + else \ + { \ + CopyWord(Pjll + 0, Index); \ + CopyWord(Pjll + (cIS), oldIndex); \ + Pjv[1] = oldValue; \ + } + +// The old value area is in the first word (*Pjp), and Pjv and Pjpm are also in +// the context. Also, unlike Judy1, indexes remain in word 2 (jp_LIndex), +// meaning insert-in-place rather than copy. +// +// Return jpm_PValue pointing to Indexs value area. If Index is new, allocate +// a 2-value-leaf and attach it to the JP. + +#define JU_IMMSET_01_COPY(cIS,LeafType,NewJPType,Copy,CopyWord) \ + { \ + LeafType Pjll; \ + Word_t oldIndex = JU_JPDCDPOP0(Pjp); \ + Word_t oldValue; \ + Pjv_t PjvRaw; \ + Pjv_t Pjv; \ + \ + Index = JU_TRIMTODCDSIZE(Index); \ + \ + if (oldIndex == Index) \ + { \ + Pjpm->jpm_PValue = (Pjv_t) Pjp; \ + return(0); \ + } \ + \ + if ((PjvRaw = j__udyLAllocJV(2, Pjpm)) == (Pjv_t) NULL) \ + return(-1); \ + Pjv = P_JV(PjvRaw); \ + \ + oldValue = Pjp->jp_Addr; \ + (Pjp->jp_Addr) = (Word_t) PjvRaw; \ + Pjll = (LeafType) (Pjp->jp_LIndex); \ + \ + Copy(cIS,CopyWord); \ + DBGCODE(JudyCheckSorted(Pjll, 2, cIS);) \ + \ + Pjp->jp_Type = (NewJPType); \ + *Pjv = 0; \ + Pjpm->jpm_PValue = Pjv; \ + return(1); \ + } + +// The following is a unique mix of JU_IMMSET_01() and JU_IMMSETCASCADE() for +// going from cJU_JPIMMED_*_01 directly to a cJU_JPLEAF* for JudyL: +// +// If Index is not already set, allocate a leaf, copy the old and new indexes +// into it, clear and return the new value area, and modify the current JP. +// Note that jp_DcdPop is set to a pop0 of 0 for now, and incremented later. + + +#define JU_IMMSET_01_CASCADE(cIS,LeafType,NewJPType,ValueArea, \ + Copy,CopyWord,Alloc) \ + { \ + Word_t D_P0; \ + LeafType PjllRaw; \ + LeafType Pjll; \ + Word_t oldIndex = JU_JPDCDPOP0(Pjp); \ + Word_t oldValue; \ + Pjv_t Pjv; \ + \ + Index = JU_TRIMTODCDSIZE(Index); \ + \ + if (oldIndex == Index) \ + { \ + Pjpm->jpm_PValue = (Pjv_t) (&(Pjp->jp_Addr)); \ + return(0); \ + } \ + \ + if ((PjllRaw = (LeafType) Alloc(2, Pjpm)) == (LeafType) NULL) \ + return(-1); \ + Pjll = (LeafType) P_JLL(PjllRaw); \ + Pjv = ValueArea(Pjll, 2); \ + \ + oldValue = Pjp->jp_Addr; \ + \ + Copy(cIS,CopyWord); \ + DBGCODE(JudyCheckSorted(Pjll, 2, cIS);) \ + \ + *Pjv = 0; \ + Pjpm->jpm_PValue = Pjv; \ + D_P0 = Index & cJU_DCDMASK(cIS); /* pop0 = 0 */ \ + JU_JPSETADT(Pjp, (Word_t)PjllRaw, D_P0, NewJPType); \ + \ + return(1); \ + } + +#endif // JUDYL + +// Handle growth of cJU_JPIMMED_*_[02..15]: + +#ifdef JUDY1 + +// Insert an Index into an immediate JP that has room for more, if the Index is +// not already present; given Pjp, Index, exppop1, Pjv, and Pjpm in the +// context: +// +// Note: Use this only when the JP format doesnt change, that is, going from +// cJU_JPIMMED_X_0Y to cJU_JPIMMED_X_0Z, where X >= 2 and Y+1 = Z. +// +// Note: Incrementing jp_Type is how to increase the Index population. + +#define JU_IMMSETINPLACE(cIS,LeafType,BaseJPType_02,Search,InsertInPlace) \ + { \ + LeafType Pjll; \ + int offset; \ + \ + exppop1 = JU_JPTYPE(Pjp) - (BaseJPType_02) + 2; \ + offset = Search((Pjll_t) (Pjp->jp_1Index), exppop1, Index); \ + \ + JU_CHECK_IF_EXISTS(offset, ignore, Pjpm); \ + \ + Pjll = (LeafType) (Pjp->jp_1Index); \ + InsertInPlace(Pjll, exppop1, offset, Index); \ + DBGCODE(JudyCheckSorted(Pjll, exppop1 + 1, cIS);) \ + ++(Pjp->jp_Type); \ + return(1); \ + } + +// Insert an Index into an immediate JP that has no room for more: +// +// If the Index is not already present, do a cascade (to a leaf); given Pjp, +// Index, Pjv, and Pjpm in the context. + + +#define JU_IMMSETCASCADE(cIS,OldPop1,LeafType,NewJPType, \ + ignore,Search,InsertCopy,Alloc) \ + { \ + Word_t D_P0; \ + Pjll_t PjllRaw; \ + Pjll_t Pjll; \ + int offset; \ + \ + offset = Search((Pjll_t) (Pjp->jp_1Index), (OldPop1), Index); \ + JU_CHECK_IF_EXISTS(offset, ignore, Pjpm); \ + \ + if ((PjllRaw = Alloc((OldPop1) + 1, Pjpm)) == 0) return(-1); \ + Pjll = P_JLL(PjllRaw); \ + \ + InsertCopy((LeafType) Pjll, (LeafType) (Pjp->jp_1Index), \ + OldPop1, offset, Index); \ + DBGCODE(JudyCheckSorted(Pjll, (OldPop1) + 1, cIS);) \ + \ + D_P0 = (Index & cJU_DCDMASK(cIS)) + (OldPop1) - 1; \ + JU_JPSETADT(Pjp, (Word_t)PjllRaw, D_P0, NewJPType); \ + return(1); \ + } + +#else // JUDYL + +// Variations to also handle value areas; see comments above: +// +// For JudyL, Pjv (start of value area) is also in the context. +// +// TBD: This code makes a true but weak assumption that a JudyL 32-bit 2-index +// value area must be copied to a new 3-index value area. AND it doesnt know +// anything about JudyL 64-bit cases (cJU_JPIMMED_1_0[3-7] only) where the +// value area can grow in place! However, this should not break it, just slow +// it down. + +#define JU_IMMSETINPLACE(cIS,LeafType,BaseJPType_02,Search,InsertInPlace) \ + { \ + LeafType Pleaf; \ + int offset; \ + Pjv_t PjvRaw; \ + Pjv_t Pjv; \ + Pjv_t PjvnewRaw; \ + Pjv_t Pjvnew; \ + \ + exppop1 = JU_JPTYPE(Pjp) - (BaseJPType_02) + 2; \ + offset = Search((Pjll_t) (Pjp->jp_LIndex), exppop1, Index); \ + PjvRaw = (Pjv_t) (Pjp->jp_Addr); \ + Pjv = P_JV(PjvRaw); \ + \ + JU_CHECK_IF_EXISTS(offset, Pjv, Pjpm); \ + \ + if ((PjvnewRaw = j__udyLAllocJV(exppop1 + 1, Pjpm)) \ + == (Pjv_t) NULL) return(-1); \ + Pjvnew = P_JV(PjvnewRaw); \ + \ + Pleaf = (LeafType) (Pjp->jp_LIndex); \ + \ + InsertInPlace(Pleaf, exppop1, offset, Index); \ + /* see TBD above about this: */ \ + JU_INSERTCOPY(Pjvnew, Pjv, exppop1, offset, 0); \ + DBGCODE(JudyCheckSorted(Pleaf, exppop1 + 1, cIS);) \ + j__udyLFreeJV(PjvRaw, exppop1, Pjpm); \ + Pjp->jp_Addr = (Word_t) PjvnewRaw; \ + Pjpm->jpm_PValue = Pjvnew + offset; \ + \ + ++(Pjp->jp_Type); \ + return(1); \ + } + +#define JU_IMMSETCASCADE(cIS,OldPop1,LeafType,NewJPType, \ + ValueArea,Search,InsertCopy,Alloc) \ + { \ + Word_t D_P0; \ + Pjll_t PjllRaw; \ + Pjll_t Pjll; \ + int offset; \ + Pjv_t PjvRaw; \ + Pjv_t Pjv; \ + Pjv_t Pjvnew; \ + \ + PjvRaw = (Pjv_t) (Pjp->jp_Addr); \ + Pjv = P_JV(PjvRaw); \ + offset = Search((Pjll_t) (Pjp->jp_LIndex), (OldPop1), Index); \ + JU_CHECK_IF_EXISTS(offset, Pjv, Pjpm); \ + \ + if ((PjllRaw = Alloc((OldPop1) + 1, Pjpm)) == 0) \ + return(-1); \ + Pjll = P_JLL(PjllRaw); \ + InsertCopy((LeafType) Pjll, (LeafType) (Pjp->jp_LIndex), \ + OldPop1, offset, Index); \ + DBGCODE(JudyCheckSorted(Pjll, (OldPop1) + 1, cIS);) \ + \ + Pjvnew = ValueArea(Pjll, (OldPop1) + 1); \ + JU_INSERTCOPY(Pjvnew, Pjv, OldPop1, offset, 0); \ + j__udyLFreeJV(PjvRaw, (OldPop1), Pjpm); \ + Pjpm->jpm_PValue = Pjvnew + offset; \ + \ + D_P0 = (Index & cJU_DCDMASK(cIS)) + (OldPop1) - 1; \ + JU_JPSETADT(Pjp, (Word_t)PjllRaw, D_P0, NewJPType); \ + return(1); \ + } + +#endif // JUDYL + +// Common convenience/shorthand wrappers around JU_IMMSET_01_COPY() for +// even/odd index sizes: + +#define JU_IMMSET_01( cIS, LeafType, NewJPType) \ + JU_IMMSET_01_COPY(cIS, LeafType, NewJPType, JU_IMMSET_01_COPY_EVEN, \ + ignore) + +#define JU_IMMSET_01_ODD( cIS, NewJPType, CopyWord) \ + JU_IMMSET_01_COPY(cIS, uint8_t *, NewJPType, JU_IMMSET_01_COPY_ODD, \ + CopyWord) + + +// END OF MACROS; IMMED CASES START HERE: + +// cJU_JPIMMED_*_01 cases: +// +// 1_01 always leads to 1_02: +// +// (1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] LeafL) + + case cJU_JPIMMED_1_01: JU_IMMSET_01(1, uint8_t *, cJU_JPIMMED_1_02); + +// 2_01 leads to 2_02, and 3_01 leads to 3_02, except for JudyL 32-bit, where +// they lead to a leaf: +// +// (2_01 => [ 2_02 => 2_03 => [ 2_04..07 => ]] LeafL) +// (3_01 => [ 3_02 => [ 3_03..05 => ]] LeafL) + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_01: JU_IMMSET_01(2, uint16_t *, cJU_JPIMMED_2_02); + case cJU_JPIMMED_3_01: JU_IMMSET_01_ODD (3, cJU_JPIMMED_3_02, + JU_COPY3_LONG_TO_PINDEX); +#else + case cJU_JPIMMED_2_01: + JU_IMMSET_01_CASCADE(2, uint16_t *, cJU_JPLEAF2, JL_LEAF2VALUEAREA, + JU_IMMSET_01_COPY_EVEN, ignore, + j__udyAllocJLL2); + case cJU_JPIMMED_3_01: + JU_IMMSET_01_CASCADE(3, uint8_t *, cJU_JPLEAF3, JL_LEAF3VALUEAREA, + JU_IMMSET_01_COPY_ODD, + JU_COPY3_LONG_TO_PINDEX, j__udyAllocJLL3); +#endif + +#ifdef JU_64BIT + +// [4-7]_01 lead to [4-7]_02 for Judy1, and to leaves for JudyL: +// +// (4_01 => [[ 4_02..03 => ]] LeafL) +// (5_01 => [[ 5_02..03 => ]] LeafL) +// (6_01 => [[ 6_02 => ]] LeafL) +// (7_01 => [[ 7_02 => ]] LeafL) + +#ifdef JUDY1 + case cJU_JPIMMED_4_01: JU_IMMSET_01(4, uint32_t *, cJ1_JPIMMED_4_02); + case cJU_JPIMMED_5_01: JU_IMMSET_01_ODD(5, cJ1_JPIMMED_5_02, + JU_COPY5_LONG_TO_PINDEX); + case cJU_JPIMMED_6_01: JU_IMMSET_01_ODD(6, cJ1_JPIMMED_6_02, + JU_COPY6_LONG_TO_PINDEX); + case cJU_JPIMMED_7_01: JU_IMMSET_01_ODD(7, cJ1_JPIMMED_7_02, + JU_COPY7_LONG_TO_PINDEX); +#else // JUDYL + case cJU_JPIMMED_4_01: + JU_IMMSET_01_CASCADE(4, uint32_t *, cJU_JPLEAF4, JL_LEAF4VALUEAREA, + JU_IMMSET_01_COPY_EVEN, ignore, + j__udyAllocJLL4); + case cJU_JPIMMED_5_01: + JU_IMMSET_01_CASCADE(5, uint8_t *, cJU_JPLEAF5, JL_LEAF5VALUEAREA, + JU_IMMSET_01_COPY_ODD, + JU_COPY5_LONG_TO_PINDEX, j__udyAllocJLL5); + case cJU_JPIMMED_6_01: + JU_IMMSET_01_CASCADE(6, uint8_t *, cJU_JPLEAF6, JL_LEAF6VALUEAREA, + JU_IMMSET_01_COPY_ODD, + JU_COPY6_LONG_TO_PINDEX, j__udyAllocJLL6); + case cJU_JPIMMED_7_01: + JU_IMMSET_01_CASCADE(7, uint8_t *, cJU_JPLEAF7, JL_LEAF7VALUEAREA, + JU_IMMSET_01_COPY_ODD, + JU_COPY7_LONG_TO_PINDEX, j__udyAllocJLL7); +#endif // JUDYL +#endif // JU_64BIT + +// cJU_JPIMMED_1_* cases that can grow in place: +// +// (1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] LeafL) + + case cJU_JPIMMED_1_02: +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_03: + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJU_JPIMMED_1_07: + case cJ1_JPIMMED_1_08: + case cJ1_JPIMMED_1_09: + case cJ1_JPIMMED_1_10: + case cJ1_JPIMMED_1_11: + case cJ1_JPIMMED_1_12: + case cJ1_JPIMMED_1_13: + case cJ1_JPIMMED_1_14: +#endif + JU_IMMSETINPLACE(1, uint8_t *, cJU_JPIMMED_1_02, j__udySearchLeaf1, + JU_INSERTINPLACE); + +// cJU_JPIMMED_1_* cases that must cascade: +// +// (1_01 => 1_02 => 1_03 => [ 1_04 => ... => 1_07 => [ 1_08..15 => ]] LeafL) + +#if (defined(JUDYL) && (! defined(JU_64BIT))) + case cJU_JPIMMED_1_03: + JU_IMMSETCASCADE(1, 3, uint8_t *, cJU_JPLEAF1, JL_LEAF1VALUEAREA, + j__udySearchLeaf1, JU_INSERTCOPY, + j__udyAllocJLL1); +#endif +#if (defined(JUDY1) && (! defined(JU_64BIT))) + case cJU_JPIMMED_1_07: + JU_IMMSETCASCADE(1, 7, uint8_t *, cJU_JPLEAF1, ignore, + j__udySearchLeaf1, JU_INSERTCOPY, + j__udyAllocJLL1); + +#endif +#if (defined(JUDYL) && defined(JU_64BIT)) + case cJU_JPIMMED_1_07: + JU_IMMSETCASCADE(1, 7, uint8_t *, cJU_JPLEAF1, JL_LEAF1VALUEAREA, + j__udySearchLeaf1, JU_INSERTCOPY, + j__udyAllocJLL1); + +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) +// Special case, as described above, go directly from Immed to LeafB1: + + case cJ1_JPIMMED_1_15: + { + Word_t DcdP0; + int offset; + Pjlb_t PjlbRaw; + Pjlb_t Pjlb; + + offset = j__udySearchLeaf1((Pjll_t) Pjp->jp_1Index, 15, Index); + + JU_CHECK_IF_EXISTS(offset, ignore, Pjpm); + +// Create a bitmap leaf (special case for Judy1 64-bit only, see usage): Set +// new Index in bitmap, copy an Immed1_15 to the bitmap, and set the parent JP +// EXCEPT jp_DcdPopO, leaving any followup to the caller: + + if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL) + return(-1); + Pjlb = P_JLB(PjlbRaw); + + JU_BITMAPSETL(Pjlb, Index); + + for (offset = 0; offset < 15; ++offset) + JU_BITMAPSETL(Pjlb, Pjp->jp_1Index[offset]); + +// Set jp_DcdPopO including the current pop0; incremented later: + DcdP0 = (Index & cJU_DCDMASK(1)) + 15 - 1; + JU_JPSETADT(Pjp, (Word_t)PjlbRaw, DcdP0, cJU_JPLEAF_B1); + + return(1); + } +#endif + +// cJU_JPIMMED_[2..7]_[02..15] cases that grow in place or cascade: +// +// (2_01 => [ 2_02 => 2_03 => [ 2_04..07 => ]] LeafL) + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJU_JPIMMED_2_03: + case cJ1_JPIMMED_2_04: + case cJ1_JPIMMED_2_05: + case cJ1_JPIMMED_2_06: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + JU_IMMSETINPLACE(2, uint16_t *, cJU_JPIMMED_2_02, j__udySearchLeaf2, + JU_INSERTINPLACE); +#endif + +#undef OLDPOP1 +#if ((defined(JUDY1) && (! defined(JU_64BIT))) || (defined(JUDYL) && defined(JU_64BIT))) + case cJU_JPIMMED_2_03: +#define OLDPOP1 3 +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_07: +#define OLDPOP1 7 +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + JU_IMMSETCASCADE(2, OLDPOP1, uint16_t *, cJU_JPLEAF2, + JL_LEAF2VALUEAREA, j__udySearchLeaf2, + JU_INSERTCOPY, j__udyAllocJLL2); +#endif + +// (3_01 => [ 3_02 => [ 3_03..05 => ]] LeafL) + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJU_JPIMMED_3_02: + case cJ1_JPIMMED_3_03: + case cJ1_JPIMMED_3_04: + + JU_IMMSETINPLACE(3, uint8_t *, cJU_JPIMMED_3_02, j__udySearchLeaf3, + JU_INSERTINPLACE3); +#endif + +#undef OLDPOP1 +#if ((defined(JUDY1) && (! defined(JU_64BIT))) || (defined(JUDYL) && defined(JU_64BIT))) + case cJU_JPIMMED_3_02: +#define OLDPOP1 2 +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_05: +#define OLDPOP1 5 +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + JU_IMMSETCASCADE(3, OLDPOP1, uint8_t *, cJU_JPLEAF3, + JL_LEAF3VALUEAREA, j__udySearchLeaf3, + JU_INSERTCOPY3, j__udyAllocJLL3); +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + +// (4_01 => [[ 4_02..03 => ]] LeafL) + + case cJ1_JPIMMED_4_02: + + JU_IMMSETINPLACE(4, uint32_t *, cJ1_JPIMMED_4_02, j__udySearchLeaf4, + JU_INSERTINPLACE); + + case cJ1_JPIMMED_4_03: + + JU_IMMSETCASCADE(4, 3, uint32_t *, cJU_JPLEAF4, ignore, + j__udySearchLeaf4, JU_INSERTCOPY, + j__udyAllocJLL4); + +// (5_01 => [[ 5_02..03 => ]] LeafL) + + case cJ1_JPIMMED_5_02: + + JU_IMMSETINPLACE(5, uint8_t *, cJ1_JPIMMED_5_02, j__udySearchLeaf5, + JU_INSERTINPLACE5); + + case cJ1_JPIMMED_5_03: + + JU_IMMSETCASCADE(5, 3, uint8_t *, cJU_JPLEAF5, ignore, + j__udySearchLeaf5, JU_INSERTCOPY5, + j__udyAllocJLL5); + +// (6_01 => [[ 6_02 => ]] LeafL) + + case cJ1_JPIMMED_6_02: + + JU_IMMSETCASCADE(6, 2, uint8_t *, cJU_JPLEAF6, ignore, + j__udySearchLeaf6, JU_INSERTCOPY6, + j__udyAllocJLL6); + +// (7_01 => [[ 7_02 => ]] LeafL) + + case cJ1_JPIMMED_7_02: + + JU_IMMSETCASCADE(7, 2, uint8_t *, cJU_JPLEAF7, ignore, + j__udySearchLeaf7, JU_INSERTCOPY7, + j__udyAllocJLL7); + +#endif // (JUDY1 && JU_64BIT) + + +// **************************************************************************** +// INVALID JP TYPE: + + default: JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); return(-1); + + } // switch on JP type + + { + +#ifdef SUBEXPCOUNTS + +// This code might seem strange here. However it saves some memory read time +// during insert (~70nS) because a pipelined processor does not need to "stall" +// waiting for the memory read to complete. Hope the compiler is not too smart +// or dumb and moves the code down to where it looks like it belongs (below a +// few lines). + + Word_t SubExpCount = 0; // current subexpanse counter. + + if (PSubExp != (PWord_t) NULL) // only if BranchB/U. + SubExpCount = PSubExp[0]; +#endif + +// PROCESS JP -- RECURSIVELY: +// +// For non-Immed JP types, if successful, post-increment the population count +// at this Level. + + retcode = j__udyInsWalk(Pjp, Index, Pjpm); + +// Successful insert, increment JP and subexpanse count: + + if ((JU_JPTYPE(Pjp) < cJU_JPIMMED_1_01) && (retcode == 1)) + { + jp_t JP; + Word_t DcdP0; +#ifdef SUBEXPCOUNTS + +// Note: Pjp must be a pointer to a BranchB/U: + + if (PSubExp != (PWord_t) NULL) PSubExp[0] = SubExpCount + 1; +#endif + + JP = *Pjp; + DcdP0 = JU_JPDCDPOP0(Pjp) + 1; + JU_JPSETADT(Pjp, JP.jp_Addr, DcdP0, JU_JPTYPE(&JP)); + } + } + return(retcode); + +} // j__udyInsWalk() + + +// **************************************************************************** +// J U D Y 1 S E T +// J U D Y L I N S +// +// Main entry point. See the manual entry for details. + +#ifdef JUDY1 +FUNCTION int Judy1Set +#else +FUNCTION PPvoid_t JudyLIns +#endif + ( + PPvoid_t PPArray, // in which to insert. + Word_t Index, // to insert. + PJError_t PJError // optional, for returning error info. + ) +{ +#ifdef JUDY1 +#define Pjv ignore // placeholders for macros. +#define Pjvnew ignore +#else + Pjv_t Pjv; // value area in old leaf. + Pjv_t Pjvnew; // value area in new leaf. +#endif + Pjpm_t Pjpm; // array-global info. + int offset; // position in which to store new Index. + Pjlw_t Pjlw; + + +// CHECK FOR NULL POINTER (error by caller): + + if (PPArray == (PPvoid_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjlw = P_JLW(*PPArray); // first word of leaf. + +// **************************************************************************** +// PROCESS TOP LEVEL "JRP" BRANCHES AND LEAVES: + +// **************************************************************************** +// JRPNULL (EMPTY ARRAY): BUILD A LEAFW WITH ONE INDEX: + +// if a valid empty array (null pointer), so create an array of population == 1: + + if (Pjlw == (Pjlw_t)NULL) + { + Pjlw_t Pjlwnew; + + Pjlwnew = j__udyAllocJLW(1); + JUDY1CODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI );) + JUDYLCODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, PPJERR);) + + Pjlwnew[0] = 1 - 1; // pop0 = 0. + Pjlwnew[1] = Index; + + *PPArray = (Pvoid_t) Pjlwnew; + DBGCODE(JudyCheckPop(*PPArray);) + + JUDY1CODE(return(1); ) + JUDYLCODE(Pjlwnew[2] = 0; ) // value area. + JUDYLCODE(return((PPvoid_t) (Pjlwnew + 2)); ) + + } // NULL JRP + +// **************************************************************************** +// LEAFW, OTHER SIZE: + + if (JU_LEAFW_POP0(*PPArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlwnew; + Word_t pop1; + + Pjlw = P_JLW(*PPArray); // first word of leaf. + pop1 = Pjlw[0] + 1; + +#ifdef JUDYL + Pjv = JL_LEAFWVALUEAREA(Pjlw, pop1); +#endif + offset = j__udySearchLeafW(Pjlw + 1, pop1, Index); + + if (offset >= 0) // index is already valid: + { + DBGCODE(JudyCheckPop(*PPArray);) + JUDY1CODE(return(0); ) + JUDYLCODE(return((PPvoid_t) (Pjv + offset)); ) + } + + offset = ~offset; + +// Insert index in cases where no new memory is needed: + + if (JU_LEAFWGROWINPLACE(pop1)) + { + ++Pjlw[0]; // increase population. + + JU_INSERTINPLACE(Pjlw + 1, pop1, offset, Index); +#ifdef JUDYL + JU_INSERTINPLACE(Pjv, pop1, offset, 0); +#endif + DBGCODE(JudyCheckPop(*PPArray);) + DBGCODE(JudyCheckSorted(Pjlw + 1, pop1 + 1, cJU_ROOTSTATE);) + + JUDY1CODE(return(1); ) + JUDYLCODE(return((PPvoid_t) (Pjv + offset)); ) + } + +// Insert index into a new, larger leaf: + + if (pop1 < cJU_LEAFW_MAXPOP1) // can grow to a larger leaf. + { + Pjlwnew = j__udyAllocJLW(pop1 + 1); + JUDY1CODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, JERRI );) + JUDYLCODE(JU_CHECKALLOC(Pjlw_t, Pjlwnew, PPJERR);) + + Pjlwnew[0] = pop1; // set pop0 in new leaf. + + JU_INSERTCOPY(Pjlwnew + 1, Pjlw + 1, pop1, offset, Index); +#ifdef JUDYL + Pjvnew = JL_LEAFWVALUEAREA(Pjlwnew, pop1 + 1); + JU_INSERTCOPY(Pjvnew, Pjv, pop1, offset, 0); +#endif + DBGCODE(JudyCheckSorted(Pjlwnew + 1, pop1 + 1, cJU_ROOTSTATE);) + + j__udyFreeJLW(Pjlw, pop1, NULL); + + *PPArray = (Pvoid_t) Pjlwnew; + DBGCODE(JudyCheckPop(*PPArray);) + + JUDY1CODE(return(1); ) + JUDYLCODE(return((PPvoid_t) (Pjvnew + offset)); ) + } + + assert(pop1 == cJU_LEAFW_MAXPOP1); + +// Leaf at max size => cannot insert new index, so cascade instead: +// +// Upon cascading from a LEAFW leaf to the first branch, must allocate and +// initialize a JPM. + + Pjpm = j__udyAllocJPM(); + JUDY1CODE(JU_CHECKALLOC(Pjpm_t, Pjpm, JERRI );) + JUDYLCODE(JU_CHECKALLOC(Pjpm_t, Pjpm, PPJERR);) + + (Pjpm->jpm_Pop0) = cJU_LEAFW_MAXPOP1 - 1; + (Pjpm->jpm_JP.jp_Addr) = (Word_t) Pjlw; + + if (j__udyCascadeL(&(Pjpm->jpm_JP), Pjpm) == -1) + { + JU_COPY_ERRNO(PJError, Pjpm); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +// Note: No need to pass Pjpm for memory decrement; LEAFW memory is never +// counted in a JPM at all: + + j__udyFreeJLW(Pjlw, cJU_LEAFW_MAXPOP1, NULL); + *PPArray = (Pvoid_t) Pjpm; + + } // JU_LEAFW + +// **************************************************************************** +// BRANCH: + + { + int retcode; // really only needed for Judy1, but free for JudyL. + + Pjpm = P_JPM(*PPArray); + retcode = j__udyInsWalk(&(Pjpm->jpm_JP), Index, Pjpm); + + if (retcode == -1) + { + JU_COPY_ERRNO(PJError, Pjpm); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + if (retcode == 1) ++(Pjpm->jpm_Pop0); // incr total array popu. + + assert(((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_L) + || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_B) + || ((Pjpm->jpm_JP.jp_Type) == cJU_JPBRANCH_U)); + DBGCODE(JudyCheckPop(*PPArray);) + +#ifdef JUDY1 + assert((retcode == 0) || (retcode == 1)); + return(retcode); // == JU_RET_*_JPM(). +#else + assert(Pjpm->jpm_PValue != (Pjv_t) NULL); + return((PPvoid_t) Pjpm->jpm_PValue); +#endif + } + /*NOTREACHED*/ + +} // Judy1Set() / JudyLIns() diff --git a/libnetdata/libjudy/src/JudyL/JudyLInsArray.c b/libnetdata/libjudy/src/JudyL/JudyLInsArray.c new file mode 100644 index 000000000..f8e361f27 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLInsArray.c @@ -0,0 +1,1178 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// TBD: It would probably be faster for the caller if the JudyL version took +// PIndex as an interleaved array of indexes and values rather than just +// indexes with a separate values array (PValue), especially considering +// indexes and values are copied here with for-loops anyway and not the +// equivalent of memcpy(). All code could be revised to simply count by two +// words for JudyL? Supports "streaming" the data to/from disk better later? +// In which case get rid of JU_ERRNO_NULLPVALUE, no longer needed, and simplify +// the API to this code. +// _________________ + +// @(#) $Revision: 4.21 $ $Source: /judy/src/JudyCommon/JudyInsArray.c $ +// +// Judy1SetArray() and JudyLInsArray() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +DBGCODE(extern void JudyCheckPop(Pvoid_t PArray);) + + +// IMMED AND LEAF SIZE AND BRANCH TYPE ARRAYS: +// +// These support fast and easy lookup by level. + +static uint8_t immed_maxpop1[] = { + 0, + cJU_IMMED1_MAXPOP1, + cJU_IMMED2_MAXPOP1, + cJU_IMMED3_MAXPOP1, +#ifdef JU_64BIT + cJU_IMMED4_MAXPOP1, + cJU_IMMED5_MAXPOP1, + cJU_IMMED6_MAXPOP1, + cJU_IMMED7_MAXPOP1, +#endif + // note: There are no IMMEDs for whole words. +}; + +static uint8_t leaf_maxpop1[] = { + 0, +#if (defined(JUDYL) || (! defined(JU_64BIT))) + cJU_LEAF1_MAXPOP1, +#else + 0, // 64-bit Judy1 has no Leaf1. +#endif + cJU_LEAF2_MAXPOP1, + cJU_LEAF3_MAXPOP1, +#ifdef JU_64BIT + cJU_LEAF4_MAXPOP1, + cJU_LEAF5_MAXPOP1, + cJU_LEAF6_MAXPOP1, + cJU_LEAF7_MAXPOP1, +#endif + // note: Root-level leaves are handled differently. +}; + +static uint8_t branchL_JPtype[] = { + 0, + 0, + cJU_JPBRANCH_L2, + cJU_JPBRANCH_L3, +#ifdef JU_64BIT + cJU_JPBRANCH_L4, + cJU_JPBRANCH_L5, + cJU_JPBRANCH_L6, + cJU_JPBRANCH_L7, +#endif + cJU_JPBRANCH_L, +}; + +static uint8_t branchB_JPtype[] = { + 0, + 0, + cJU_JPBRANCH_B2, + cJU_JPBRANCH_B3, +#ifdef JU_64BIT + cJU_JPBRANCH_B4, + cJU_JPBRANCH_B5, + cJU_JPBRANCH_B6, + cJU_JPBRANCH_B7, +#endif + cJU_JPBRANCH_B, +}; + +static uint8_t branchU_JPtype[] = { + 0, + 0, + cJU_JPBRANCH_U2, + cJU_JPBRANCH_U3, +#ifdef JU_64BIT + cJU_JPBRANCH_U4, + cJU_JPBRANCH_U5, + cJU_JPBRANCH_U6, + cJU_JPBRANCH_U7, +#endif + cJU_JPBRANCH_U, +}; + +// Subexpanse masks are similer to JU_DCDMASK() but without the need to clear +// the first digits bits. Avoid doing variable shifts by precomputing a +// lookup array. + +static Word_t subexp_mask[] = { + 0, + ~cJU_POP0MASK(1), + ~cJU_POP0MASK(2), + ~cJU_POP0MASK(3), +#ifdef JU_64BIT + ~cJU_POP0MASK(4), + ~cJU_POP0MASK(5), + ~cJU_POP0MASK(6), + ~cJU_POP0MASK(7), +#endif +}; + + +// FUNCTION PROTOTYPES: + +static bool_t j__udyInsArray(Pjp_t PjpParent, int Level, PWord_t PPop1, + PWord_t PIndex, +#ifdef JUDYL + Pjv_t PValue, +#endif + Pjpm_t Pjpm); + + +// **************************************************************************** +// J U D Y 1 S E T A R R A Y +// J U D Y L I N S A R R A Y +// +// Main entry point. See the manual entry for external overview. +// +// TBD: Until thats written, note that the function returns 1 for success or +// JERRI for serious error, including insufficient memory to build whole array; +// use Judy*Count() to see how many were stored, the first N of the total +// Count. Also, since it takes Count == Pop1, it cannot handle a full array. +// Also, "sorted" means ascending without duplicates, otherwise you get the +// "unsorted" error. +// +// The purpose of these functions is to allow rapid construction of a large +// Judy array given a sorted list of indexes (and for JudyL, corresponding +// values). At least one customer saw this as useful, and probably it would +// also be useful as a sufficient workaround for fast(er) unload/reload to/from +// disk. +// +// This code is written recursively for simplicity, until/unless someone +// decides to make it faster and more complex. Hopefully recursion is fast +// enough simply because the function is so much faster than a series of +// Set/Ins calls. + +#ifdef JUDY1 +FUNCTION int Judy1SetArray +#else +FUNCTION int JudyLInsArray +#endif + ( + PPvoid_t PPArray, // in which to insert, initially empty. + Word_t Count, // number of indexes (and values) to insert. +const Word_t * const PIndex, // list of indexes to insert. +#ifdef JUDYL +const Word_t * const PValue, // list of corresponding values. +#endif + PJError_t PJError // optional, for returning error info. + ) +{ + Pjlw_t Pjlw; // new root-level leaf. + Pjlw_t Pjlwindex; // first index in root-level leaf. + int offset; // in PIndex. + + +// CHECK FOR NULL OR NON-NULL POINTER (error by caller): + + if (PPArray == (PPvoid_t) NULL) + { JU_SET_ERRNO(PJError, JU_ERRNO_NULLPPARRAY); return(JERRI); } + + if (*PPArray != (Pvoid_t) NULL) + { JU_SET_ERRNO(PJError, JU_ERRNO_NONNULLPARRAY); return(JERRI); } + + if (PIndex == (PWord_t) NULL) + { JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); return(JERRI); } + +#ifdef JUDYL + if (PValue == (PWord_t) NULL) + { JU_SET_ERRNO(PJError, JU_ERRNO_NULLPVALUE); return(JERRI); } +#endif + + +// HANDLE LARGE COUNT (= POP1) (typical case): +// +// Allocate and initialize a JPM, set the root pointer to point to it, and then +// build the tree underneath it. + +// Common code for unusual error handling when no JPM available: + + if (Count > cJU_LEAFW_MAXPOP1) // too big for root-level leaf. + { + Pjpm_t Pjpm; // new, to allocate. + +// Allocate JPM: + + Pjpm = j__udyAllocJPM(); + JU_CHECKALLOC(Pjpm_t, Pjpm, JERRI); + *PPArray = (Pvoid_t) Pjpm; + +// Set some JPM fields: + + (Pjpm->jpm_Pop0) = Count - 1; + // note: (Pjpm->jpm_TotalMemWords) is now initialized. + +// Build Judy tree: +// +// In case of error save the final Count, possibly modified, unless modified to +// 0, in which case free the JPM itself: + + if (! j__udyInsArray(&(Pjpm->jpm_JP), cJU_ROOTSTATE, &Count, + (PWord_t) PIndex, +#ifdef JUDYL + (Pjv_t) PValue, +#endif + Pjpm)) + { + JU_COPY_ERRNO(PJError, Pjpm); + + if (Count) // partial success, adjust pop0: + { + (Pjpm->jpm_Pop0) = Count - 1; + } + else // total failure, free JPM: + { + j__udyFreeJPM(Pjpm, (Pjpm_t) NULL); + *PPArray = (Pvoid_t) NULL; + } + + DBGCODE(JudyCheckPop(*PPArray);) + return(JERRI); + } + + DBGCODE(JudyCheckPop(*PPArray);) + return(1); + + } // large count + + +// HANDLE SMALL COUNT (= POP1): +// +// First ensure indexes are in sorted order: + + for (offset = 1; offset < Count; ++offset) + { + if (PIndex[offset - 1] >= PIndex[offset]) + { JU_SET_ERRNO(PJError, JU_ERRNO_UNSORTED); return(JERRI); } + } + + if (Count == 0) return(1); // *PPArray remains null. + + { + Pjlw = j__udyAllocJLW(Count + 1); + JU_CHECKALLOC(Pjlw_t, Pjlw, JERRI); + *PPArray = (Pvoid_t) Pjlw; + Pjlw[0] = Count - 1; // set pop0. + Pjlwindex = Pjlw + 1; + } + +// Copy whole-word indexes (and values) to the root-level leaf: + + JU_COPYMEM(Pjlwindex, PIndex, Count); +JUDYLCODE(JU_COPYMEM(JL_LEAFWVALUEAREA(Pjlw, Count), PValue, Count)); + + DBGCODE(JudyCheckPop(*PPArray);) + return(1); + +} // Judy1SetArray() / JudyLInsArray() + + +// **************************************************************************** +// __ J U D Y I N S A R R A Y +// +// Given: +// +// - a pointer to a JP +// +// - the JPs level in the tree, that is, the number of digits left to decode +// in the indexes under the JP (one less than the level of the JPM or branch +// in which the JP resides); cJU_ROOTSTATE on first entry (when JP is the one +// in the JPM), down to 1 for a Leaf1, LeafB1, or FullPop +// +// - a pointer to the number of indexes (and corresponding values) to store in +// this subtree, to modify in case of partial success +// +// - a list of indexes (and for JudyL, corresponding values) to store in this +// subtree +// +// - a JPM for tracking memory usage and returning errors +// +// Recursively build a subtree (immediate indexes, leaf, or branch with +// subtrees) and modify the JP accordingly. On the way down, build a BranchU +// (only) for any expanse with *PPop1 too high for a leaf; on the way out, +// convert the BranchU to a BranchL or BranchB if appropriate. Keep memory +// statistics in the JPM. +// +// Return TRUE for success, or FALSE with error information set in the JPM in +// case of error, in which case leave a partially constructed but healthy tree, +// and modify parent population counts on the way out. +// +// Note: Each call of this function makes all modifications to the PjpParent +// it receives; neither the parent nor child calls do this. + +FUNCTION static bool_t j__udyInsArray( + Pjp_t PjpParent, // parent JP in/under which to store. + int Level, // initial digits remaining to decode. + PWord_t PPop1, // number of indexes to store. + PWord_t PIndex, // list of indexes to store. +#ifdef JUDYL + Pjv_t PValue, // list of corresponding values. +#endif + Pjpm_t Pjpm) // for memory and errors. +{ + Pjp_t Pjp; // lower-level JP. + Word_t Pjbany; // any type of branch. + int levelsub; // actual, of Pjps node, <= Level. + Word_t pop1 = *PPop1; // fast local value. + Word_t pop1sub; // population of one subexpanse. + uint8_t JPtype; // current JP type. + uint8_t JPtype_null; // precomputed value for new branch. + jp_t JPnull; // precomputed for speed. + Pjbu_t PjbuRaw; // constructed BranchU. + Pjbu_t Pjbu; + int digit; // in BranchU. + Word_t digitmask; // for a digit in a BranchU. + Word_t digitshifted; // shifted to correct offset. + Word_t digitshincr; // increment for digitshifted. + int offset; // in PIndex, or a bitmap subexpanse. + int numJPs; // number non-null in a BranchU. + bool_t retval; // to return from this func. +JUDYLCODE(Pjv_t PjvRaw); // destination value area. +JUDYLCODE(Pjv_t Pjv); + + +// MACROS FOR COMMON CODE: +// +// Note: These use function and local parameters from the context. +// Note: Assume newly allocated memory is zeroed. + +// Indicate whether a sorted list of indexes in PIndex, based on the first and +// last indexes in the list using pop1, are in the same subexpanse between +// Level and L_evel: +// +// This can be confusing! Note that SAMESUBEXP(L) == TRUE means the indexes +// are the same through level L + 1, and it says nothing about level L and +// lower; they might be the same or they might differ. +// +// Note: In principle SAMESUBEXP needs a mask for the digits from Level, +// inclusive, to L_evel, exclusive. But in practice, since the indexes are all +// known to be identical above Level, it just uses a mask for the digits +// through L_evel + 1; see subexp_mask[]. + +#define SAMESUBEXP(L_evel) \ + (! ((PIndex[0] ^ PIndex[pop1 - 1]) & subexp_mask[L_evel])) + +// Set PjpParent to a null JP appropriate for the level of the node to which it +// points, which is 1 less than the level of the node in which the JP resides, +// which is by definition Level: +// +// Note: This can set the JPMs JP to an invalid jp_Type, but it doesnt +// matter because the JPM is deleted by the caller. + +#define SETJPNULL_PARENT \ + JU_JPSETADT(PjpParent, 0, 0, cJU_JPNULL1 + Level - 1); + +// Variation to set a specified JP (in a branch being built) to a precomputed +// null JP: + +#define SETJPNULL(Pjp) *(Pjp) = JPnull + +// Handle complete (as opposed to partial) memory allocation failure: Set the +// parent JP to an appropriate null type (to leave a consistent tree), zero the +// callers population count, and return FALSE: +// +// Note: At Level == cJU_ROOTSTATE this sets the JPMs JPs jp_Type to a bogus +// value, but it doesnt matter because the JPM should be deleted by the +// caller. + +#define NOMEM { SETJPNULL_PARENT; *PPop1 = 0; return(FALSE); } + +// Allocate a Leaf1-N and save the address in Pjll; in case of failure, NOMEM: + +#define ALLOCLEAF(AllocLeaf) \ + if ((PjllRaw = AllocLeaf(pop1, Pjpm)) == (Pjll_t) NULL) NOMEM; \ + Pjll = P_JLL(PjllRaw); + +// Copy indexes smaller than words (and values which are whole words) from +// given arrays to immediate indexes or a leaf: +// +// TBD: These macros overlap with some of the code in JudyCascade.c; do some +// merging? That file has functions while these are macros. + +#define COPYTOLEAF_EVEN_SUB(Pjll,LeafType) \ + { \ + LeafType * P_leaf = (LeafType *) (Pjll); \ + Word_t p_op1 = pop1; \ + PWord_t P_Index = PIndex; \ + \ + assert(pop1 > 0); \ + \ + do { *P_leaf++ = *P_Index++; /* truncates */\ + } while (--(p_op1)); \ + } + +#define COPYTOLEAF_ODD_SUB(cLevel,Pjll,Copy) \ + { \ + uint8_t * P_leaf = (uint8_t *) (Pjll); \ + Word_t p_op1 = pop1; \ + PWord_t P_Index = PIndex; \ + \ + assert(pop1 > 0); \ + \ + do { \ + Copy(P_leaf, *P_Index); \ + P_leaf += (cLevel); ++P_Index; \ + } while (--(p_op1)); \ + } + +#ifdef JUDY1 + +#define COPYTOLEAF_EVEN(Pjll,LeafType) COPYTOLEAF_EVEN_SUB(Pjll,LeafType) +#define COPYTOLEAF_ODD(cLevel,Pjll,Copy) COPYTOLEAF_ODD_SUB(cLevel,Pjll,Copy) + +#else // JUDYL adds copying of values: + +#define COPYTOLEAF_EVEN(Pjll,LeafType) \ + { \ + COPYTOLEAF_EVEN_SUB(Pjll,LeafType) \ + JU_COPYMEM(Pjv, PValue, pop1); \ + } + +#define COPYTOLEAF_ODD(cLevel,Pjll,Copy) \ + { \ + COPYTOLEAF_ODD_SUB( cLevel,Pjll,Copy) \ + JU_COPYMEM(Pjv, PValue, pop1); \ + } + +#endif + +// Set the JP type for an immediate index, where BaseJPType is JPIMMED_*_02: + +#define SETIMMTYPE(BaseJPType) (PjpParent->jp_Type) = (BaseJPType) + pop1 - 2 + +// Allocate and populate a Leaf1-N: +// +// Build MAKELEAF_EVEN() and MAKELEAF_ODD() using macros for common code. + +#define MAKELEAF_SUB1(AllocLeaf,ValueArea,LeafType) \ + ALLOCLEAF(AllocLeaf); \ + JUDYLCODE(Pjv = ValueArea(Pjll, pop1)) + + +#define MAKELEAF_SUB2(cLevel,JPType) \ +{ \ + Word_t D_cdP0; \ + assert(pop1 - 1 <= cJU_POP0MASK(cLevel)); \ + D_cdP0 = (*PIndex & cJU_DCDMASK(cLevel)) | (pop1 - 1); \ + JU_JPSETADT(PjpParent, (Word_t)PjllRaw, D_cdP0, JPType); \ +} + + +#define MAKELEAF_EVEN(cLevel,JPType,AllocLeaf,ValueArea,LeafType) \ + MAKELEAF_SUB1(AllocLeaf,ValueArea,LeafType); \ + COPYTOLEAF_EVEN(Pjll, LeafType); \ + MAKELEAF_SUB2(cLevel, JPType) + +#define MAKELEAF_ODD(cLevel,JPType,AllocLeaf,ValueArea,Copy) \ + MAKELEAF_SUB1(AllocLeaf,ValueArea,LeafType); \ + COPYTOLEAF_ODD(cLevel, Pjll, Copy); \ + MAKELEAF_SUB2(cLevel, JPType) + +// Ensure that the indexes to be stored in immediate indexes or a leaf are +// sorted: +// +// This check is pure overhead, but required in order to protect the Judy array +// against caller error, to avoid a later corruption or core dump from a +// seemingly valid Judy array. Do this check piecemeal at the leaf level while +// the indexes are already in the cache. Higher-level order-checking occurs +// while building branches. +// +// Note: Any sorting error in the expanse of a single immediate indexes JP or +// a leaf => save no indexes in that expanse. + +#define CHECKLEAFORDER \ + { \ + for (offset = 1; offset < pop1; ++offset) \ + { \ + if (PIndex[offset - 1] >= PIndex[offset]) \ + { \ + SETJPNULL_PARENT; \ + *PPop1 = 0; \ + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_UNSORTED); \ + return(FALSE); \ + } \ + } \ + } + + +// ------ START OF CODE ------ + + assert( Level >= 1); + assert( Level <= cJU_ROOTSTATE); + assert((Level < cJU_ROOTSTATE) || (pop1 > cJU_LEAFW_MAXPOP1)); + + +// CHECK FOR TOP LEVEL: +// +// Special case: If at the top level (PjpParent is in the JPM), a top-level +// branch must be created, even if its a BranchL with just one JP. (The JPM +// cannot point to a leaf because the leaf would have to be a lower-level, +// higher-capacity leaf under a narrow pointer (otherwise a root-level leaf +// would suffice), and the JPMs JP cant handle a narrow pointer because the +// jp_DcdPopO field isnt big enough.) Otherwise continue to check for a pop1 +// small enough to support immediate indexes or a leaf before giving up and +// making a lower-level branch. + + if (Level == cJU_ROOTSTATE) + { + levelsub = cJU_ROOTSTATE; + goto BuildBranch2; + } + assert(Level < cJU_ROOTSTATE); + + +// SKIP JPIMMED_*_01: +// +// Immeds with pop1 == 1 should be handled in-line during branch construction. + + assert(pop1 > 1); + + +// BUILD JPIMMED_*_02+: +// +// The starting address of the indexes depends on Judy1 or JudyL; also, JudyL +// includes a pointer to a values-only leaf. + + if (pop1 <= immed_maxpop1[Level]) // note: always < root level. + { + JUDY1CODE(uint8_t * Pjll = (uint8_t *) (PjpParent->jp_1Index);) + JUDYLCODE(uint8_t * Pjll = (uint8_t *) (PjpParent->jp_LIndex);) + + CHECKLEAFORDER; // indexes to be stored are sorted. + +#ifdef JUDYL + if ((PjvRaw = j__udyLAllocJV(pop1, Pjpm)) == (Pjv_t) NULL) + NOMEM; + (PjpParent->jp_Addr) = (Word_t) PjvRaw; + Pjv = P_JV(PjvRaw); +#endif + + switch (Level) + { + case 1: COPYTOLEAF_EVEN(Pjll, uint8_t); + SETIMMTYPE(cJU_JPIMMED_1_02); + break; +#if (defined(JUDY1) || defined(JU_64BIT)) + case 2: COPYTOLEAF_EVEN(Pjll, uint16_t); + SETIMMTYPE(cJU_JPIMMED_2_02); + break; + case 3: COPYTOLEAF_ODD(3, Pjll, JU_COPY3_LONG_TO_PINDEX); + SETIMMTYPE(cJU_JPIMMED_3_02); + break; +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case 4: COPYTOLEAF_EVEN(Pjll, uint32_t); + SETIMMTYPE(cJ1_JPIMMED_4_02); + break; + case 5: COPYTOLEAF_ODD(5, Pjll, JU_COPY5_LONG_TO_PINDEX); + SETIMMTYPE(cJ1_JPIMMED_5_02); + break; + case 6: COPYTOLEAF_ODD(6, Pjll, JU_COPY6_LONG_TO_PINDEX); + SETIMMTYPE(cJ1_JPIMMED_6_02); + break; + case 7: COPYTOLEAF_ODD(7, Pjll, JU_COPY7_LONG_TO_PINDEX); + SETIMMTYPE(cJ1_JPIMMED_7_02); + break; +#endif + default: assert(FALSE); // should be impossible. + } + + return(TRUE); // note: no children => no *PPop1 mods. + + } // JPIMMED_*_02+ + + +// BUILD JPLEAF*: +// +// This code is a little tricky. The method is: For each level starting at +// the present Level down through levelsub = 1, and then as a special case for +// LeafB1 and FullPop (which are also at levelsub = 1 but have different +// capacity, see later), check if pop1 fits in a leaf (using leaf_maxpop1[]) +// at that level. If so, except for Level == levelsub, check if all of the +// current indexes to be stored are in the same (narrow) subexpanse, that is, +// the digits from Level to levelsub + 1, inclusive, are identical between the +// first and last index in the (sorted) list (in PIndex). If this condition is +// satisfied at any level, build a leaf at that level (under a narrow pointer +// if Level > levelsub). +// +// Note: Doing the search in this order results in storing the indexes in +// "least compressed form." + + for (levelsub = Level; levelsub >= 1; --levelsub) + { + Pjll_t PjllRaw; + Pjll_t Pjll; + +// Check if pop1 is too large to fit in a leaf at levelsub; if so, try the next +// lower level: + + if (pop1 > leaf_maxpop1[levelsub]) continue; + +// If pop1 fits in a leaf at levelsub, but levelsub is lower than Level, must +// also check whether all the indexes in the expanse to store can in fact be +// placed under a narrow pointer; if not, a leaf cannot be used, at this or any +// lower level (levelsub): + + if ((levelsub < Level) && (! SAMESUBEXP(levelsub))) + goto BuildBranch; // cant use a narrow, need a branch. + +// Ensure valid pop1 and all indexes are in fact common through Level: + + assert(pop1 <= cJU_POP0MASK(Level) + 1); + assert(! ((PIndex[0] ^ PIndex[pop1 - 1]) & cJU_DCDMASK(Level))); + + CHECKLEAFORDER; // indexes to be stored are sorted. + +// Build correct type of leaf: +// +// Note: The jp_DcdPopO and jp_Type assignments in MAKELEAF_* happen correctly +// for the levelsub (not Level) of the new leaf, even if its under a narrow +// pointer. + + switch (levelsub) + { +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case 1: MAKELEAF_EVEN(1, cJU_JPLEAF1, j__udyAllocJLL1, + JL_LEAF1VALUEAREA, uint8_t); + break; +#endif + case 2: MAKELEAF_EVEN(2, cJU_JPLEAF2, j__udyAllocJLL2, + JL_LEAF2VALUEAREA, uint16_t); + break; + case 3: MAKELEAF_ODD( 3, cJU_JPLEAF3, j__udyAllocJLL3, + JL_LEAF3VALUEAREA, JU_COPY3_LONG_TO_PINDEX); + break; +#ifdef JU_64BIT + case 4: MAKELEAF_EVEN(4, cJU_JPLEAF4, j__udyAllocJLL4, + JL_LEAF4VALUEAREA, uint32_t); + break; + case 5: MAKELEAF_ODD( 5, cJU_JPLEAF5, j__udyAllocJLL5, + JL_LEAF5VALUEAREA, JU_COPY5_LONG_TO_PINDEX); + break; + case 6: MAKELEAF_ODD( 6, cJU_JPLEAF6, j__udyAllocJLL6, + JL_LEAF6VALUEAREA, JU_COPY6_LONG_TO_PINDEX); + break; + case 7: MAKELEAF_ODD( 7, cJU_JPLEAF7, j__udyAllocJLL7, + JL_LEAF7VALUEAREA, JU_COPY7_LONG_TO_PINDEX); + break; +#endif + default: assert(FALSE); // should be impossible. + } + + return(TRUE); // note: no children => no *PPop1 mods. + + } // JPLEAF* + + +// BUILD JPLEAF_B1 OR JPFULLPOPU1: +// +// See above about JPLEAF*. If pop1 doesnt fit in any level of linear leaf, +// it might still fit in a LeafB1 or FullPop, perhaps under a narrow pointer. + + if ((Level == 1) || SAMESUBEXP(1)) // same until last digit. + { + Pjlb_t PjlbRaw; // for bitmap leaf. + Pjlb_t Pjlb; + + assert(pop1 <= cJU_JPFULLPOPU1_POP0 + 1); + CHECKLEAFORDER; // indexes to be stored are sorted. + +#ifdef JUDY1 + +// JPFULLPOPU1: + + if (pop1 == cJU_JPFULLPOPU1_POP0 + 1) + { + Word_t Addr = PjpParent->jp_Addr; + Word_t DcdP0 = (*PIndex & cJU_DCDMASK(1)) + | cJU_JPFULLPOPU1_POP0; + JU_JPSETADT(PjpParent, Addr, DcdP0, cJ1_JPFULLPOPU1); + + return(TRUE); + } +#endif + +// JPLEAF_B1: + + if ((PjlbRaw = j__udyAllocJLB1(Pjpm)) == (Pjlb_t) NULL) + NOMEM; + Pjlb = P_JLB(PjlbRaw); + + for (offset = 0; offset < pop1; ++offset) + JU_BITMAPSETL(Pjlb, PIndex[offset]); + + retval = TRUE; // default. + +#ifdef JUDYL + +// Build subexpanse values-only leaves (LeafVs) under LeafB1: + + for (offset = 0; offset < cJU_NUMSUBEXPL; ++offset) + { + if (! (pop1sub = j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, offset)))) + continue; // skip empty subexpanse. + +// Allocate one LeafV = JP subarray; if out of memory, clear bitmaps for higher +// subexpanses and adjust *PPop1: + + if ((PjvRaw = j__udyLAllocJV(pop1sub, Pjpm)) + == (Pjv_t) NULL) + { + for (/* null */; offset < cJU_NUMSUBEXPL; ++offset) + { + *PPop1 -= j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, offset)); + JU_JLB_BITMAP(Pjlb, offset) = 0; + } + + retval = FALSE; + break; + } + +// Populate values-only leaf and save the pointer to it: + + Pjv = P_JV(PjvRaw); + JU_COPYMEM(Pjv, PValue, pop1sub); + JL_JLB_PVALUE(Pjlb, offset) = PjvRaw; // first-tier pointer. + PValue += pop1sub; + + } // for each subexpanse + +#endif // JUDYL + +// Attach new LeafB1 to parent JP; note use of *PPop1 possibly < pop1: + + JU_JPSETADT(PjpParent, (Word_t) PjlbRaw, + (*PIndex & cJU_DCDMASK(1)) | (*PPop1 - 1), cJU_JPLEAF_B1); + + return(retval); + + } // JPLEAF_B1 or JPFULLPOPU1 + + +// BUILD JPBRANCH_U*: +// +// Arriving at BuildBranch means Level < top level but the pop1 is too large +// for immediate indexes or a leaf, even under a narrow pointer, including a +// LeafB1 or FullPop at level 1. This implies SAMESUBEXP(1) == FALSE, that is, +// the indexes to be stored "branch" at level 2 or higher. + +BuildBranch: // come here directly if a leaf wont work. + + assert(Level >= 2); + assert(Level < cJU_ROOTSTATE); + assert(! SAMESUBEXP(1)); // sanity check, see above. + +// Determine the appropriate level for a new branch node; see if a narrow +// pointer can be used: +// +// This can be confusing. The branch is required at the lowest level L where +// the indexes to store are not in the same subexpanse at level L-1. Work down +// from Level to tree level 3, which is 1 above the lowest tree level = 2 at +// which a branch can be used. Theres no need to check SAMESUBEXP at level 2 +// because its known to be false at level 2-1 = 1. +// +// Note: Unlike for a leaf node, a narrow pointer is always used for a branch +// if possible, that is, maximum compression is always used, except at the top +// level of the tree, where a JPM cannot support a narrow pointer, meaning a +// top BranchL can have a single JP (fanout = 1); but that case jumps directly +// to BuildBranch2. +// +// Note: For 32-bit systems the only usable values for a narrow pointer are +// Level = 3 and levelsub = 2; 64-bit systems have many more choices; but +// hopefully this for-loop is fast enough even on a 32-bit system. +// +// TBD: If not fast enough, #ifdef JU_64BIT and handle the 32-bit case faster. + + for (levelsub = Level; levelsub >= 3; --levelsub) // see above. + if (! SAMESUBEXP(levelsub - 1)) // at limit of narrow pointer. + break; // put branch at levelsub. + +BuildBranch2: // come here directly for Level = levelsub = cJU_ROOTSTATE. + + assert(levelsub >= 2); + assert(levelsub <= Level); + +// Initially build a BranchU: +// +// Always start with a BranchU because the number of populated subexpanses is +// not yet known. Use digitmask, digitshifted, and digitshincr to avoid +// expensive variable shifts within JU_DIGITATSTATE within the loop. +// +// TBD: The use of digitmask, etc. results in more increment operations per +// loop, is there an even faster way? +// +// TBD: Would it pay to pre-count the populated JPs (subexpanses) and +// pre-compress the branch, that is, build a BranchL or BranchB immediately, +// also taking account of opportunistic uncompression rules? Probably not +// because at high levels of the tree there might be huge numbers of indexes +// (hence cache lines) to scan in the PIndex array to determine the fanout +// (number of JPs) needed. + + if ((PjbuRaw = j__udyAllocJBU(Pjpm)) == (Pjbu_t) NULL) NOMEM; + Pjbu = P_JBU(PjbuRaw); + + JPtype_null = cJU_JPNULL1 + levelsub - 2; // in new BranchU. + JU_JPSETADT(&JPnull, 0, 0, JPtype_null); + + Pjp = Pjbu->jbu_jp; // for convenience in loop. + numJPs = 0; // non-null in the BranchU. + digitmask = cJU_MASKATSTATE(levelsub); // see above. + digitshincr = 1UL << (cJU_BITSPERBYTE * (levelsub - 1)); + retval = TRUE; + +// Scan and populate JPs (subexpanses): +// +// Look for all indexes matching each digit in the BranchU (at the correct +// levelsub), and meanwhile notice any sorting error. Increment PIndex (and +// PValue) and reduce pop1 for each subexpanse handled successfully. + + for (digit = digitshifted = 0; + digit < cJU_BRANCHUNUMJPS; + ++digit, digitshifted += digitshincr, ++Pjp) + { + DBGCODE(Word_t pop1subprev;) + assert(pop1 != 0); // end of indexes is handled elsewhere. + +// Count indexes in digits subexpanse: + + for (pop1sub = 0; pop1sub < pop1; ++pop1sub) + if (digitshifted != (PIndex[pop1sub] & digitmask)) break; + +// Empty subexpanse (typical, performance path) or sorting error (rare): + + if (pop1sub == 0) + { + if (digitshifted < (PIndex[0] & digitmask)) + { SETJPNULL(Pjp); continue; } // empty subexpanse. + + assert(pop1 < *PPop1); // did save >= 1 index and decr pop1. + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_UNSORTED); + goto AbandonBranch; + } + +// Non-empty subexpanse: +// +// First shortcut by handling pop1sub == 1 (JPIMMED_*_01) inline locally. + + if (pop1sub == 1) // note: can be at root level. + { + Word_t Addr = 0; + JUDYLCODE(Addr = (Word_t) (*PValue++);) + JU_JPSETADT(Pjp, Addr, *PIndex, cJU_JPIMMED_1_01 + levelsub -2); + + ++numJPs; + + if (--pop1) { ++PIndex; continue; } // more indexes to store. + + ++digit; ++Pjp; // skip JP just saved. + goto ClearBranch; // save time. + } + +// Recurse to populate one digits (subexpanses) JP; if successful, skip +// indexes (and values) just stored (performance path), except when expanse is +// completely stored: + + DBGCODE(pop1subprev = pop1sub;) + + if (j__udyInsArray(Pjp, levelsub - 1, &pop1sub, (PWord_t) PIndex, +#ifdef JUDYL + (Pjv_t) PValue, +#endif + Pjpm)) + { // complete success. + ++numJPs; + assert(pop1subprev == pop1sub); + assert(pop1 >= pop1sub); + + if ((pop1 -= pop1sub) != 0) // more indexes to store: + { + PIndex += pop1sub; // skip indexes just stored. + JUDYLCODE(PValue += pop1sub;) + continue; + } + // else leave PIndex in BranchUs expanse. + +// No more indexes to store in BranchUs expanse: + + ++digit; ++Pjp; // skip JP just saved. + goto ClearBranch; // save time. + } + +// Handle any error at a lower level of recursion: +// +// In case of partial success, pop1sub != 0, but it was reduced from the value +// passed to j__udyInsArray(); skip this JP later during ClearBranch. + + assert(pop1subprev > pop1sub); // check j__udyInsArray(). + assert(pop1 > pop1sub); // check j__udyInsArray(). + + if (pop1sub) // partial success. + { ++digit; ++Pjp; ++numJPs; } // skip JP just saved. + + pop1 -= pop1sub; // deduct saved indexes if any. + +// Same-level sorting error, or any lower-level error; abandon the rest of the +// branch: +// +// Arrive here with pop1 = remaining unsaved indexes (always non-zero). Adjust +// the *PPop1 value to record and return, modify retval, and use ClearBranch to +// finish up. + +AbandonBranch: + assert(pop1 != 0); // more to store, see above. + assert(pop1 <= *PPop1); // sanity check. + + *PPop1 -= pop1; // deduct unsaved indexes. + pop1 = 0; // to avoid error later. + retval = FALSE; + +// Error (rare), or end of indexes while traversing new BranchU (performance +// path); either way, mark the remaining JPs, if any, in the BranchU as nulls +// and exit the loop: +// +// Arrive here with digit and Pjp set to the first JP to set to null. + +ClearBranch: + for (/* null */; digit < cJU_BRANCHUNUMJPS; ++digit, ++Pjp) + SETJPNULL(Pjp); + break; // saves one more compare. + + } // for each digit + + +// FINISH JPBRANCH_U*: +// +// Arrive here with a BranchU built under Pjbu, numJPs set, and either: retval +// == TRUE and *PPop1 unmodified, or else retval == FALSE, *PPop1 set to the +// actual number of indexes saved (possibly 0 for complete failure at a lower +// level upon the first call of j__udyInsArray()), and the Judy error set in +// Pjpm. Either way, PIndex points to an index within the expanse just +// handled. + + Pjbany = (Word_t) PjbuRaw; // default = use this BranchU. + JPtype = branchU_JPtype[levelsub]; + +// Check for complete failure above: + + assert((! retval) || *PPop1); // sanity check. + + if ((! retval) && (*PPop1 == 0)) // nothing stored, full failure. + { + j__udyFreeJBU(PjbuRaw, Pjpm); + SETJPNULL_PARENT; + return(FALSE); + } + +// Complete or partial success so far; watch for sorting error after the +// maximum digit (255) in the BranchU, which is indicated by having more +// indexes to store in the BranchUs expanse: +// +// For example, if an index to store has a digit of 255 at levelsub, followed +// by an index with a digit of 254, the for-loop above runs out of digits +// without reducing pop1 to 0. + + if (pop1 != 0) + { + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_UNSORTED); + *PPop1 -= pop1; // deduct unsaved indexes. + retval = FALSE; + } + assert(*PPop1 != 0); // branch (still) cannot be empty. + + +// OPTIONALLY COMPRESS JPBRANCH_U*: +// +// See if the BranchU should be compressed to a BranchL or BranchB; if so, do +// that and free the BranchU; otherwise just use the existing BranchU. Follow +// the same rules as in JudyIns.c (version 4.95): Only check local population +// (cJU_OPP_UNCOMP_POP0) for BranchL, and only check global memory efficiency +// (JU_OPP_UNCOMPRESS) for BranchB. TBD: Have the rules changed? +// +// Note: Because of differing order of operations, the latter compression +// might not result in the same set of branch nodes as a series of sequential +// insertions. +// +// Note: Allocating a BranchU only to sometimes convert it to a BranchL or +// BranchB is unfortunate, but attempting to work with a temporary BranchU on +// the stack and then allocate and keep it as a BranchU in many cases is worse +// in terms of error handling. + + +// COMPRESS JPBRANCH_U* TO JPBRANCH_L*: + + if (numJPs <= cJU_BRANCHLMAXJPS) // JPs fit in a BranchL. + { + Pjbl_t PjblRaw = (Pjbl_t) NULL; // new BranchL; init for cc. + Pjbl_t Pjbl; + + if ((*PPop1 > JU_BRANCHL_MAX_POP) // pop too high. + || ((PjblRaw = j__udyAllocJBL(Pjpm)) == (Pjbl_t) NULL)) + { // cant alloc BranchL. + goto SetParent; // just keep BranchU. + } + + Pjbl = P_JBL(PjblRaw); + +// Copy BranchU JPs to BranchL: + + (Pjbl->jbl_NumJPs) = numJPs; + offset = 0; + + for (digit = 0; digit < cJU_BRANCHUNUMJPS; ++digit) + { + if ((((Pjbu->jbu_jp) + digit)->jp_Type) == JPtype_null) + continue; + + (Pjbl->jbl_Expanse[offset ]) = digit; + (Pjbl->jbl_jp [offset++]) = Pjbu->jbu_jp[digit]; + } + assert(offset == numJPs); // found same number. + +// Free the BranchU and prepare to use the new BranchL instead: + + j__udyFreeJBU(PjbuRaw, Pjpm); + + Pjbany = (Word_t) PjblRaw; + JPtype = branchL_JPtype[levelsub]; + + } // compress to BranchL + + +// COMPRESS JPBRANCH_U* TO JPBRANCH_B*: +// +// If unable to allocate the BranchB or any JP subarray, free all related +// memory and just keep the BranchU. +// +// Note: This use of JU_OPP_UNCOMPRESS is a bit conservative because the +// BranchU is already allocated while the (presumably smaller) BranchB is not, +// the opposite of how its used in single-insert code. + + else + { + Pjbb_t PjbbRaw = (Pjbb_t) NULL; // new BranchB; init for cc. + Pjbb_t Pjbb; + Pjp_t Pjp2; // in BranchU. + + if ((*PPop1 > JU_BRANCHB_MAX_POP) // pop too high. + || ((PjbbRaw = j__udyAllocJBB(Pjpm)) == (Pjbb_t) NULL)) + { // cant alloc BranchB. + goto SetParent; // just keep BranchU. + } + + Pjbb = P_JBB(PjbbRaw); + +// Set bits in bitmap for populated subexpanses: + + Pjp2 = Pjbu->jbu_jp; + + for (digit = 0; digit < cJU_BRANCHUNUMJPS; ++digit) + if ((((Pjbu->jbu_jp) + digit)->jp_Type) != JPtype_null) + JU_BITMAPSETB(Pjbb, digit); + +// Copy non-null JPs to BranchB JP subarrays: + + for (offset = 0; offset < cJU_NUMSUBEXPB; ++offset) + { + Pjp_t PjparrayRaw; + Pjp_t Pjparray; + + if (! (numJPs = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, offset)))) + continue; // skip empty subexpanse. + +// If unable to allocate a JP subarray, free all BranchB memory so far and +// continue to use the BranchU: + + if ((PjparrayRaw = j__udyAllocJBBJP(numJPs, Pjpm)) + == (Pjp_t) NULL) + { + while (offset-- > 0) + { + if (JU_JBB_PJP(Pjbb, offset) == (Pjp_t) NULL) continue; + + j__udyFreeJBBJP(JU_JBB_PJP(Pjbb, offset), + j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, offset)), + Pjpm); + } + j__udyFreeJBB(PjbbRaw, Pjpm); + goto SetParent; // keep BranchU. + } + +// Set one JP subarray pointer and copy the subexpanses JPs to the subarray: +// +// Scan the BranchU for non-null JPs until numJPs JPs are copied. + + JU_JBB_PJP(Pjbb, offset) = PjparrayRaw; + Pjparray = P_JP(PjparrayRaw); + + while (numJPs-- > 0) + { + while ((Pjp2->jp_Type) == JPtype_null) + { + ++Pjp2; + assert(Pjp2 < (Pjbu->jbu_jp) + cJU_BRANCHUNUMJPS); + } + *Pjparray++ = *Pjp2++; + } + } // for each subexpanse + +// Free the BranchU and prepare to use the new BranchB instead: + + j__udyFreeJBU(PjbuRaw, Pjpm); + + Pjbany = (Word_t) PjbbRaw; + JPtype = branchB_JPtype[levelsub]; + + } // compress to BranchB + + +// COMPLETE OR PARTIAL SUCCESS: +// +// Attach new branch (under Pjp, with JPtype) to parent JP; note use of *PPop1, +// possibly reduced due to partial failure. + +SetParent: + (PjpParent->jp_Addr) = Pjbany; + (PjpParent->jp_Type) = JPtype; + + if (Level < cJU_ROOTSTATE) // PjpParent not in JPM: + { + Word_t DcdP0 = (*PIndex & cJU_DCDMASK(levelsub)) | (*PPop1 - 1); + + JU_JPSETADT(PjpParent ,Pjbany, DcdP0, JPtype); + } + + return(retval); + +} // j__udyInsArray() diff --git a/libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c b/libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c new file mode 100644 index 000000000..cfa16bd6d --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLInsertBranch.c @@ -0,0 +1,135 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.17 $ $Source: /judy/src/JudyCommon/JudyInsertBranch.c $ + +// BranchL insertion functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +extern int j__udyCreateBranchL(Pjp_t, Pjp_t, uint8_t *, Word_t, Pvoid_t); + + +// **************************************************************************** +// __ J U D Y I N S E R T B R A N C H +// +// Insert 2-element BranchL in between Pjp and Pjp->jp_Addr. +// +// Return -1 if out of memory, otherwise return 1. + +FUNCTION int j__udyInsertBranch( + Pjp_t Pjp, // JP containing narrow pointer. + Word_t Index, // outlier to Pjp. + Word_t BranchLevel, // of what JP points to, mapped from JP type. + Pjpm_t Pjpm) // for global accounting. +{ + jp_t JP2 [2]; + jp_t JP; + Pjp_t PjpNull; + Word_t XorExp; + Word_t Inew, Iold; + Word_t DCDMask; // initially for original BranchLevel. + int Ret; + uint8_t Exp2[2]; + uint8_t DecodeByteN, DecodeByteO; + +// Get the current mask for the DCD digits: + + DCDMask = cJU_DCDMASK(BranchLevel); + +// Obtain Dcd bits that differ between Index and JP, shifted so the +// digit for BranchLevel is the LSB: + + XorExp = ((Index ^ JU_JPDCDPOP0(Pjp)) & (cJU_ALLONES >> cJU_BITSPERBYTE)) + >> (BranchLevel * cJU_BITSPERBYTE); + assert(XorExp); // Index must be an outlier. + +// Count levels between object under narrow pointer and the level at which +// the outlier diverges from it, which is always at least initial +// BranchLevel + 1, to end up with the level (JP type) at which to insert +// the new intervening BranchL: + + do { ++BranchLevel; } while ((XorExp >>= cJU_BITSPERBYTE)); + assert((BranchLevel > 1) && (BranchLevel < cJU_ROOTSTATE)); + +// Get the MSB (highest digit) that differs between the old expanse and +// the new Index to insert: + + DecodeByteO = JU_DIGITATSTATE(JU_JPDCDPOP0(Pjp), BranchLevel); + DecodeByteN = JU_DIGITATSTATE(Index, BranchLevel); + + assert(DecodeByteO != DecodeByteN); + +// Determine sorted order for old expanse and new Index digits: + + if (DecodeByteN > DecodeByteO) { Iold = 0; Inew = 1; } + else { Iold = 1; Inew = 0; } + +// Copy old JP into staging area for new Branch + JP2 [Iold] = *Pjp; + Exp2[Iold] = DecodeByteO; + Exp2[Inew] = DecodeByteN; + +// Create a 2 Expanse Linear branch +// +// Note: Pjp->jp_Addr is set by j__udyCreateBranchL() + + Ret = j__udyCreateBranchL(Pjp, JP2, Exp2, 2, Pjpm); + if (Ret == -1) return(-1); + +// Get Pjp to the NULL of where to do insert + PjpNull = ((P_JBL(Pjp->jp_Addr))->jbl_jp) + Inew; + +// Convert to a cJU_JPIMMED_*_01 at the correct level: +// Build JP and set type below to: cJU_JPIMMED_X_01 + JU_JPSETADT(PjpNull, 0, Index, cJU_JPIMMED_1_01 - 2 + BranchLevel); + +// Return pointer to Value area in cJU_JPIMMED_X_01 + JUDYLCODE(Pjpm->jpm_PValue = (Pjv_t) PjpNull;) + +// The old JP now points to a BranchL that is at higher level. Therefore +// it contains excess DCD bits (in the least significant position) that +// must be removed (zeroed); that is, they become part of the Pop0 +// subfield. Note that the remaining (lower) bytes in the Pop0 field do +// not change. +// +// Take from the old DCDMask, which went "down" to a lower BranchLevel, +// and zero any high bits that are still in the mask at the new, higher +// BranchLevel; then use this mask to zero the bits in jp_DcdPopO: + +// Set old JP to a BranchL at correct level + + Pjp->jp_Type = cJU_JPBRANCH_L2 - 2 + BranchLevel; + DCDMask ^= cJU_DCDMASK(BranchLevel); + DCDMask = ~DCDMask & JU_JPDCDPOP0(Pjp); + JP = *Pjp; + JU_JPSETADT(Pjp, JP.jp_Addr, DCDMask, JP.jp_Type); + + return(1); + +} // j__udyInsertBranch() diff --git a/libnetdata/libjudy/src/JudyL/JudyLMallocIF.c b/libnetdata/libjudy/src/JudyL/JudyLMallocIF.c new file mode 100644 index 000000000..9a7d02f21 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLMallocIF.c @@ -0,0 +1,782 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.45 $ $Source: /judy/src/JudyCommon/JudyMallocIF.c $ +// +// Judy malloc/free interface functions for Judy1 and JudyL. +// +// Compile with one of -DJUDY1 or -DJUDYL. +// +// Compile with -DTRACEMI (Malloc Interface) to turn on tracing of malloc/free +// calls at the interface level. (See also TRACEMF in lower-level code.) +// Use -DTRACEMI2 for a terser format suitable for trace analysis. +// +// There can be malloc namespace bits in the LSBs of "raw" addresses from most, +// but not all, of the j__udy*Alloc*() functions; see also JudyPrivate.h. To +// test the Judy code, compile this file with -DMALLOCBITS and use debug flavor +// only (for assertions). This test ensures that (a) all callers properly mask +// the namespace bits out before dereferencing a pointer (or else a core dump +// occurs), and (b) all callers send "raw" (unmasked) addresses to +// j__udy*Free*() calls. +// +// Note: Currently -DDEBUG turns on MALLOCBITS automatically. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +// Set "hidden" global j__uMaxWords to the maximum number of words to allocate +// to any one array (large enough to have a JPM, otherwise j__uMaxWords is +// ignored), to trigger a fake malloc error when the number is exceeded. Note, +// this code is always executed, not #ifdefd, because its virtually free. +// +// Note: To keep the MALLOC macro faster and simpler, set j__uMaxWords to +// MAXINT, not zero, by default. + +Word_t j__uMaxWords = ~0UL; + +// This macro hides the faking of a malloc failure: +// +// Note: To keep this fast, just compare WordsPrev to j__uMaxWords without the +// complexity of first adding WordsNow, meaning the trigger point is not +// exactly where you might assume, but it shouldnt matter. + +#define MALLOC(MallocFunc,WordsPrev,WordsNow) \ + (((WordsPrev) > j__uMaxWords) ? 0UL : MallocFunc(WordsNow)) + +// Clear words starting at address: +// +// Note: Only use this for objects that care; in other cases, it doesnt +// matter if the objects memory is pre-zeroed. + +#define ZEROWORDS(Addr,Words) \ + { \ + Word_t Words__ = (Words); \ + PWord_t Addr__ = (PWord_t) (Addr); \ + while (Words__--) *Addr__++ = 0UL; \ + } + +#ifdef TRACEMI + +// TRACING SUPPORT: +// +// Note: For TRACEMI, use a format for address printing compatible with other +// tracing facilities; in particular, %x not %lx, to truncate the "noisy" high +// part on 64-bit systems. +// +// TBD: The trace macros need fixing for alternate address types. +// +// Note: TRACEMI2 supports trace analysis no matter the underlying malloc/free +// engine used. + +#include + +static Word_t j__udyMemSequence = 0L; // event sequence number. + +#define TRACE_ALLOC5(a,b,c,d,e) (void) printf(a, (b), c, d) +#define TRACE_FREE5( a,b,c,d,e) (void) printf(a, (b), c, d) +#define TRACE_ALLOC6(a,b,c,d,e,f) (void) printf(a, (b), c, d, e) +#define TRACE_FREE6( a,b,c,d,e,f) (void) printf(a, (b), c, d, e) + +#else + +#ifdef TRACEMI2 + +#include + +#define b_pw cJU_BYTESPERWORD + +#define TRACE_ALLOC5(a,b,c,d,e) \ + (void) printf("a %lx %lx %lx\n", (b), (d) * b_pw, e) +#define TRACE_FREE5( a,b,c,d,e) \ + (void) printf("f %lx %lx %lx\n", (b), (d) * b_pw, e) +#define TRACE_ALLOC6(a,b,c,d,e,f) \ + (void) printf("a %lx %lx %lx\n", (b), (e) * b_pw, f) +#define TRACE_FREE6( a,b,c,d,e,f) \ + (void) printf("f %lx %lx %lx\n", (b), (e) * b_pw, f) + +static Word_t j__udyMemSequence = 0L; // event sequence number. + +#else + +#define TRACE_ALLOC5(a,b,c,d,e) // null. +#define TRACE_FREE5( a,b,c,d,e) // null. +#define TRACE_ALLOC6(a,b,c,d,e,f) // null. +#define TRACE_FREE6( a,b,c,d,e,f) // null. + +#endif // ! TRACEMI2 +#endif // ! TRACEMI + + +// MALLOC NAMESPACE SUPPORT: + +#if (defined(DEBUG) && (! defined(MALLOCBITS))) // for now, DEBUG => MALLOCBITS: +#define MALLOCBITS 1 +#endif + +#ifdef MALLOCBITS +#define MALLOCBITS_VALUE 0x3 // bit pattern to use. +#define MALLOCBITS_MASK 0x7 // note: matches mask__ in JudyPrivate.h. + +#define MALLOCBITS_SET( Type,Addr) \ + ((Addr) = (Type) ((Word_t) (Addr) | MALLOCBITS_VALUE)) +#define MALLOCBITS_TEST(Type,Addr) \ + assert((((Word_t) (Addr)) & MALLOCBITS_MASK) == MALLOCBITS_VALUE); \ + ((Addr) = (Type) ((Word_t) (Addr) & ~MALLOCBITS_VALUE)) +#else +#define MALLOCBITS_SET( Type,Addr) // null. +#define MALLOCBITS_TEST(Type,Addr) // null. +#endif + + +// SAVE ERROR INFORMATION IN A Pjpm: +// +// "Small" (invalid) Addr values are used to distinguish overrun and no-mem +// errors. (TBD, non-zero invalid values are no longer returned from +// lower-level functions, that is, JU_ERRNO_OVERRUN is no longer detected.) + +#define J__UDYSETALLOCERROR(Addr) \ + { \ + JU_ERRID(Pjpm) = __LINE__; \ + if ((Word_t) (Addr) > 0) JU_ERRNO(Pjpm) = JU_ERRNO_OVERRUN; \ + else JU_ERRNO(Pjpm) = JU_ERRNO_NOMEM; \ + return(0); \ + } + + +// **************************************************************************** +// ALLOCATION FUNCTIONS: +// +// To help the compiler catch coding errors, each function returns a specific +// object type. +// +// Note: Only j__udyAllocJPM() and j__udyAllocJLW() return multiple values <= +// sizeof(Word_t) to indicate the type of memory allocation failure. Other +// allocation functions convert this failure to a JU_ERRNO. + + +// Note: Unlike other j__udyAlloc*() functions, Pjpms are returned non-raw, +// that is, without malloc namespace or root pointer type bits: + +FUNCTION Pjpm_t j__udyAllocJPM(void) +{ + Word_t Words = (sizeof(jpm_t) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD; + Pjpm_t Pjpm = (Pjpm_t) MALLOC(JudyMalloc, Words, Words); + + assert((Words * cJU_BYTESPERWORD) == sizeof(jpm_t)); + + if ((Word_t) Pjpm > sizeof(Word_t)) + { + ZEROWORDS(Pjpm, Words); + Pjpm->jpm_TotalMemWords = Words; + } + + TRACE_ALLOC5("0x%x %8lu = j__udyAllocJPM(), Words = %lu\n", + Pjpm, j__udyMemSequence++, Words, cJU_LEAFW_MAXPOP1 + 1); + // MALLOCBITS_SET(Pjpm_t, Pjpm); // see above. + return(Pjpm); + +} // j__udyAllocJPM() + + +FUNCTION Pjbl_t j__udyAllocJBL(Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD; + Pjbl_t PjblRaw = (Pjbl_t) MALLOC(JudyMallocVirtual, + Pjpm->jpm_TotalMemWords, Words); + + assert((Words * cJU_BYTESPERWORD) == sizeof(jbl_t)); + + if ((Word_t) PjblRaw > sizeof(Word_t)) + { + ZEROWORDS(P_JBL(PjblRaw), Words); + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjblRaw); } + + TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBL(), Words = %lu\n", PjblRaw, + j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjbl_t, PjblRaw); + return(PjblRaw); + +} // j__udyAllocJBL() + + +FUNCTION Pjbb_t j__udyAllocJBB(Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD; + Pjbb_t PjbbRaw = (Pjbb_t) MALLOC(JudyMallocVirtual, + Pjpm->jpm_TotalMemWords, Words); + + assert((Words * cJU_BYTESPERWORD) == sizeof(jbb_t)); + + if ((Word_t) PjbbRaw > sizeof(Word_t)) + { + ZEROWORDS(P_JBB(PjbbRaw), Words); + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjbbRaw); } + + TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBB(), Words = %lu\n", PjbbRaw, + j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjbb_t, PjbbRaw); + return(PjbbRaw); + +} // j__udyAllocJBB() + + +FUNCTION Pjp_t j__udyAllocJBBJP(Word_t NumJPs, Pjpm_t Pjpm) +{ + Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs); + Pjp_t PjpRaw; + + PjpRaw = (Pjp_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjpRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjpRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJBBJP(%lu), Words = %lu\n", PjpRaw, + j__udyMemSequence++, NumJPs, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjp_t, PjpRaw); + return(PjpRaw); + +} // j__udyAllocJBBJP() + + +FUNCTION Pjbu_t j__udyAllocJBU(Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD; + Pjbu_t PjbuRaw = (Pjbu_t) MALLOC(JudyMallocVirtual, + Pjpm->jpm_TotalMemWords, Words); + + assert((Words * cJU_BYTESPERWORD) == sizeof(jbu_t)); + + if ((Word_t) PjbuRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjbuRaw); } + + TRACE_ALLOC5("0x%x %8lu = j__udyAllocJBU(), Words = %lu\n", PjbuRaw, + j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjbu_t, PjbuRaw); + return(PjbuRaw); + +} // j__udyAllocJBU() + + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + +FUNCTION Pjll_t j__udyAllocJLL1(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF1POPTOWORDS(Pop1); + Pjll_t PjllRaw; + + PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjllRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjllRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL1(%lu), Words = %lu\n", PjllRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjll_t, PjllRaw); + return(PjllRaw); + +} // j__udyAllocJLL1() + +#endif // (JUDYL || (! JU_64BIT)) + + +FUNCTION Pjll_t j__udyAllocJLL2(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF2POPTOWORDS(Pop1); + Pjll_t PjllRaw; + + PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjllRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjllRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL2(%lu), Words = %lu\n", PjllRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjll_t, PjllRaw); + return(PjllRaw); + +} // j__udyAllocJLL2() + + +FUNCTION Pjll_t j__udyAllocJLL3(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF3POPTOWORDS(Pop1); + Pjll_t PjllRaw; + + PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjllRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjllRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL3(%lu), Words = %lu\n", PjllRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjll_t, PjllRaw); + return(PjllRaw); + +} // j__udyAllocJLL3() + + +#ifdef JU_64BIT + +FUNCTION Pjll_t j__udyAllocJLL4(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF4POPTOWORDS(Pop1); + Pjll_t PjllRaw; + + PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjllRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjllRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL4(%lu), Words = %lu\n", PjllRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjll_t, PjllRaw); + return(PjllRaw); + +} // j__udyAllocJLL4() + + +FUNCTION Pjll_t j__udyAllocJLL5(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF5POPTOWORDS(Pop1); + Pjll_t PjllRaw; + + PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjllRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjllRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL5(%lu), Words = %lu\n", PjllRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjll_t, PjllRaw); + return(PjllRaw); + +} // j__udyAllocJLL5() + + +FUNCTION Pjll_t j__udyAllocJLL6(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF6POPTOWORDS(Pop1); + Pjll_t PjllRaw; + + PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjllRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjllRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL6(%lu), Words = %lu\n", PjllRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjll_t, PjllRaw); + return(PjllRaw); + +} // j__udyAllocJLL6() + + +FUNCTION Pjll_t j__udyAllocJLL7(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF7POPTOWORDS(Pop1); + Pjll_t PjllRaw; + + PjllRaw = (Pjll_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjllRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjllRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLL7(%lu), Words = %lu\n", PjllRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjll_t, PjllRaw); + return(PjllRaw); + +} // j__udyAllocJLL7() + +#endif // JU_64BIT + + +// Note: Root-level leaf addresses are always whole words (Pjlw_t), and unlike +// other j__udyAlloc*() functions, they are returned non-raw, that is, without +// malloc namespace or root pointer type bits (the latter are added later by +// the caller): + +FUNCTION Pjlw_t j__udyAllocJLW(Word_t Pop1) +{ + Word_t Words = JU_LEAFWPOPTOWORDS(Pop1); + Pjlw_t Pjlw = (Pjlw_t) MALLOC(JudyMalloc, Words, Words); + + TRACE_ALLOC6("0x%x %8lu = j__udyAllocJLW(%lu), Words = %lu\n", Pjlw, + j__udyMemSequence++, Pop1, Words, Pop1); + // MALLOCBITS_SET(Pjlw_t, Pjlw); // see above. + return(Pjlw); + +} // j__udyAllocJLW() + + +FUNCTION Pjlb_t j__udyAllocJLB1(Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD; + Pjlb_t PjlbRaw; + + PjlbRaw = (Pjlb_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + assert((Words * cJU_BYTESPERWORD) == sizeof(jlb_t)); + + if ((Word_t) PjlbRaw > sizeof(Word_t)) + { + ZEROWORDS(P_JLB(PjlbRaw), Words); + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjlbRaw); } + + TRACE_ALLOC5("0x%x %8lu = j__udyAllocJLB1(), Words = %lu\n", PjlbRaw, + j__udyMemSequence++, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjlb_t, PjlbRaw); + return(PjlbRaw); + +} // j__udyAllocJLB1() + + +#ifdef JUDYL + +FUNCTION Pjv_t j__udyLAllocJV(Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JL_LEAFVPOPTOWORDS(Pop1); + Pjv_t PjvRaw; + + PjvRaw = (Pjv_t) MALLOC(JudyMalloc, Pjpm->jpm_TotalMemWords, Words); + + if ((Word_t) PjvRaw > sizeof(Word_t)) + { + Pjpm->jpm_TotalMemWords += Words; + } + else { J__UDYSETALLOCERROR(PjvRaw); } + + TRACE_ALLOC6("0x%x %8lu = j__udyLAllocJV(%lu), Words = %lu\n", PjvRaw, + j__udyMemSequence++, Pop1, Words, (Pjpm->jpm_Pop0) + 2); + MALLOCBITS_SET(Pjv_t, PjvRaw); + return(PjvRaw); + +} // j__udyLAllocJV() + +#endif // JUDYL + + +// **************************************************************************** +// FREE FUNCTIONS: +// +// To help the compiler catch coding errors, each function takes a specific +// object type to free. + + +// Note: j__udyFreeJPM() receives a root pointer with NO root pointer type +// bits present, that is, they must be stripped by the caller using P_JPM(): + +FUNCTION void j__udyFreeJPM(Pjpm_t PjpmFree, Pjpm_t PjpmStats) +{ + Word_t Words = (sizeof(jpm_t) + cJU_BYTESPERWORD - 1) / cJU_BYTESPERWORD; + + // MALLOCBITS_TEST(Pjpm_t, PjpmFree); // see above. + JudyFree((Pvoid_t) PjpmFree, Words); + + if (PjpmStats != (Pjpm_t) NULL) PjpmStats->jpm_TotalMemWords -= Words; + +// Note: Log PjpmFree->jpm_Pop0, similar to other j__udyFree*() functions, not +// an assumed value of cJU_LEAFW_MAXPOP1, for when the caller is +// Judy*FreeArray(), jpm_Pop0 is set to 0, and the population after the free +// really will be 0, not cJU_LEAFW_MAXPOP1. + + TRACE_FREE6("0x%x %8lu = j__udyFreeJPM(%lu), Words = %lu\n", PjpmFree, + j__udyMemSequence++, Words, Words, PjpmFree->jpm_Pop0); + + +} // j__udyFreeJPM() + + +FUNCTION void j__udyFreeJBL(Pjbl_t Pjbl, Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jbl_t) / cJU_BYTESPERWORD; + + MALLOCBITS_TEST(Pjbl_t, Pjbl); + JudyFreeVirtual((Pvoid_t) Pjbl, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE5("0x%x %8lu = j__udyFreeJBL(), Words = %lu\n", Pjbl, + j__udyMemSequence++, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJBL() + + +FUNCTION void j__udyFreeJBB(Pjbb_t Pjbb, Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jbb_t) / cJU_BYTESPERWORD; + + MALLOCBITS_TEST(Pjbb_t, Pjbb); + JudyFreeVirtual((Pvoid_t) Pjbb, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE5("0x%x %8lu = j__udyFreeJBB(), Words = %lu\n", Pjbb, + j__udyMemSequence++, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJBB() + + +FUNCTION void j__udyFreeJBBJP(Pjp_t Pjp, Word_t NumJPs, Pjpm_t Pjpm) +{ + Word_t Words = JU_BRANCHJP_NUMJPSTOWORDS(NumJPs); + + MALLOCBITS_TEST(Pjp_t, Pjp); + JudyFree((Pvoid_t) Pjp, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJBBJP(%lu), Words = %lu\n", Pjp, + j__udyMemSequence++, NumJPs, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJBBJP() + + +FUNCTION void j__udyFreeJBU(Pjbu_t Pjbu, Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jbu_t) / cJU_BYTESPERWORD; + + MALLOCBITS_TEST(Pjbu_t, Pjbu); + JudyFreeVirtual((Pvoid_t) Pjbu, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE5("0x%x %8lu = j__udyFreeJBU(), Words = %lu\n", Pjbu, + j__udyMemSequence++, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJBU() + + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + +FUNCTION void j__udyFreeJLL1(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF1POPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjll_t, Pjll); + JudyFree((Pvoid_t) Pjll, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLL1(%lu), Words = %lu\n", Pjll, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLL1() + +#endif // (JUDYL || (! JU_64BIT)) + + +FUNCTION void j__udyFreeJLL2(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF2POPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjll_t, Pjll); + JudyFree((Pvoid_t) Pjll, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLL2(%lu), Words = %lu\n", Pjll, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLL2() + + +FUNCTION void j__udyFreeJLL3(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF3POPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjll_t, Pjll); + JudyFree((Pvoid_t) Pjll, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLL3(%lu), Words = %lu\n", Pjll, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLL3() + + +#ifdef JU_64BIT + +FUNCTION void j__udyFreeJLL4(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF4POPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjll_t, Pjll); + JudyFree((Pvoid_t) Pjll, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLL4(%lu), Words = %lu\n", Pjll, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLL4() + + +FUNCTION void j__udyFreeJLL5(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF5POPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjll_t, Pjll); + JudyFree((Pvoid_t) Pjll, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLL5(%lu), Words = %lu\n", Pjll, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLL5() + + +FUNCTION void j__udyFreeJLL6(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF6POPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjll_t, Pjll); + JudyFree((Pvoid_t) Pjll, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLL6(%lu), Words = %lu\n", Pjll, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLL6() + + +FUNCTION void j__udyFreeJLL7(Pjll_t Pjll, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAF7POPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjll_t, Pjll); + JudyFree((Pvoid_t) Pjll, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLL7(%lu), Words = %lu\n", Pjll, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLL7() + +#endif // JU_64BIT + + +// Note: j__udyFreeJLW() receives a root pointer with NO root pointer type +// bits present, that is, they are stripped by P_JLW(): + +FUNCTION void j__udyFreeJLW(Pjlw_t Pjlw, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JU_LEAFWPOPTOWORDS(Pop1); + + // MALLOCBITS_TEST(Pjlw_t, Pjlw); // see above. + JudyFree((Pvoid_t) Pjlw, Words); + + if (Pjpm) Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyFreeJLW(%lu), Words = %lu\n", Pjlw, + j__udyMemSequence++, Pop1, Words, Pop1 - 1); + + +} // j__udyFreeJLW() + + +FUNCTION void j__udyFreeJLB1(Pjlb_t Pjlb, Pjpm_t Pjpm) +{ + Word_t Words = sizeof(jlb_t) / cJU_BYTESPERWORD; + + MALLOCBITS_TEST(Pjlb_t, Pjlb); + JudyFree((Pvoid_t) Pjlb, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE5("0x%x %8lu = j__udyFreeJLB1(), Words = %lu\n", Pjlb, + j__udyMemSequence++, Words, Pjpm->jpm_Pop0); + + +} // j__udyFreeJLB1() + + +#ifdef JUDYL + +FUNCTION void j__udyLFreeJV(Pjv_t Pjv, Word_t Pop1, Pjpm_t Pjpm) +{ + Word_t Words = JL_LEAFVPOPTOWORDS(Pop1); + + MALLOCBITS_TEST(Pjv_t, Pjv); + JudyFree((Pvoid_t) Pjv, Words); + + Pjpm->jpm_TotalMemWords -= Words; + + TRACE_FREE6("0x%x %8lu = j__udyLFreeJV(%lu), Words = %lu\n", Pjv, + j__udyMemSequence++, Pop1, Words, Pjpm->jpm_Pop0); + + +} // j__udyLFreeJV() + +#endif // JUDYL diff --git a/libnetdata/libjudy/src/JudyL/JudyLMemActive.c b/libnetdata/libjudy/src/JudyL/JudyLMemActive.c new file mode 100644 index 000000000..fb58d0e25 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLMemActive.c @@ -0,0 +1,259 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.7 $ $Source: /judy/src/JudyCommon/JudyMemActive.c $ +// +// Return number of bytes of memory used to support a Judy1/L array. +// Compile with one of -DJUDY1 or -DJUDYL. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +FUNCTION static Word_t j__udyGetMemActive(Pjp_t); + + +// **************************************************************************** +// J U D Y 1 M E M A C T I V E +// J U D Y L M E M A C T I V E + +#ifdef JUDY1 +FUNCTION Word_t Judy1MemActive +#else +FUNCTION Word_t JudyLMemActive +#endif + ( + Pcvoid_t PArray // from which to retrieve. + ) +{ + if (PArray == (Pcvoid_t)NULL) return(0); + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + Word_t Words = Pjlw[0] + 1; // population. +#ifdef JUDY1 + return((Words + 1) * sizeof(Word_t)); +#else + return(((Words * 2) + 1) * sizeof(Word_t)); +#endif + } + else + { + Pjpm_t Pjpm = P_JPM(PArray); + return(j__udyGetMemActive(&Pjpm->jpm_JP) + sizeof(jpm_t)); + } + +} // JudyMemActive() + + +// **************************************************************************** +// __ J U D Y G E T M E M A C T I V E + +FUNCTION static Word_t j__udyGetMemActive( + Pjp_t Pjp) // top of subtree. +{ + Word_t offset; // in a branch. + Word_t Bytes = 0; // actual bytes used at this level. + Word_t IdxSz; // bytes per index in leaves + + switch (JU_JPTYPE(Pjp)) + { + + case cJU_JPBRANCH_L2: + case cJU_JPBRANCH_L3: +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: + case cJU_JPBRANCH_L5: + case cJU_JPBRANCH_L6: + case cJU_JPBRANCH_L7: +#endif + case cJU_JPBRANCH_L: + { + Pjbl_t Pjbl = P_JBL(Pjp->jp_Addr); + + for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset) + Bytes += j__udyGetMemActive((Pjbl->jbl_jp) + offset); + + return(Bytes + sizeof(jbl_t)); + } + + case cJU_JPBRANCH_B2: + case cJU_JPBRANCH_B3: +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: + case cJU_JPBRANCH_B5: + case cJU_JPBRANCH_B6: + case cJU_JPBRANCH_B7: +#endif + case cJU_JPBRANCH_B: + { + Word_t subexp; + Word_t jpcount; + Pjbb_t Pjbb = P_JBB(Pjp->jp_Addr); + + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) + { + jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)); + Bytes += jpcount * sizeof(jp_t); + + for (offset = 0; offset < jpcount; ++offset) + { + Bytes += j__udyGetMemActive(P_JP(JU_JBB_PJP(Pjbb, subexp)) + + offset); + } + } + + return(Bytes + sizeof(jbb_t)); + } + + case cJU_JPBRANCH_U2: + case cJU_JPBRANCH_U3: +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: + case cJU_JPBRANCH_U5: + case cJU_JPBRANCH_U6: + case cJU_JPBRANCH_U7: +#endif + case cJU_JPBRANCH_U: + { + Pjbu_t Pjbu = P_JBU(Pjp->jp_Addr); + + for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset) + { + if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1) + && ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX)) + { + continue; // skip null JP to save time. + } + + Bytes += j__udyGetMemActive(Pjbu->jbu_jp + offset); + } + + return(Bytes + sizeof(jbu_t)); + } + + +// -- Cases below here terminate and do not recurse. -- + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: IdxSz = 1; goto LeafWords; +#endif + case cJU_JPLEAF2: IdxSz = 2; goto LeafWords; + case cJU_JPLEAF3: IdxSz = 3; goto LeafWords; +#ifdef JU_64BIT + case cJU_JPLEAF4: IdxSz = 4; goto LeafWords; + case cJU_JPLEAF5: IdxSz = 5; goto LeafWords; + case cJU_JPLEAF6: IdxSz = 6; goto LeafWords; + case cJU_JPLEAF7: IdxSz = 7; goto LeafWords; +#endif +LeafWords: + +#ifdef JUDY1 + return(IdxSz * (JU_JPLEAF_POP0(Pjp) + 1)); +#else + return((IdxSz + sizeof(Word_t)) + * (JU_JPLEAF_POP0(Pjp) + 1)); +#endif + case cJU_JPLEAF_B1: + { +#ifdef JUDY1 + return(sizeof(jlb_t)); +#else + Bytes = (JU_JPLEAF_POP0(Pjp) + 1) * sizeof(Word_t); + + return(Bytes + sizeof(jlb_t)); +#endif + } + + JUDY1CODE(case cJ1_JPFULLPOPU1: return(0);) + +#ifdef JUDY1 +#define J__Mpy 0 +#else +#define J__Mpy sizeof(Word_t) +#endif + + case cJU_JPIMMED_1_01: return(0); + case cJU_JPIMMED_2_01: return(0); + case cJU_JPIMMED_3_01: return(0); +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: return(0); + case cJU_JPIMMED_5_01: return(0); + case cJU_JPIMMED_6_01: return(0); + case cJU_JPIMMED_7_01: return(0); +#endif + + case cJU_JPIMMED_1_02: return(J__Mpy * 2); + case cJU_JPIMMED_1_03: return(J__Mpy * 3); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: return(J__Mpy * 4); + case cJU_JPIMMED_1_05: return(J__Mpy * 5); + case cJU_JPIMMED_1_06: return(J__Mpy * 6); + case cJU_JPIMMED_1_07: return(J__Mpy * 7); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: return(0); + case cJ1_JPIMMED_1_09: return(0); + case cJ1_JPIMMED_1_10: return(0); + case cJ1_JPIMMED_1_11: return(0); + case cJ1_JPIMMED_1_12: return(0); + case cJ1_JPIMMED_1_13: return(0); + case cJ1_JPIMMED_1_14: return(0); + case cJ1_JPIMMED_1_15: return(0); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: return(J__Mpy * 2); + case cJU_JPIMMED_2_03: return(J__Mpy * 3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: return(0); + case cJ1_JPIMMED_2_05: return(0); + case cJ1_JPIMMED_2_06: return(0); + case cJ1_JPIMMED_2_07: return(0); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: return(J__Mpy * 2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: return(0); + case cJ1_JPIMMED_3_04: return(0); + case cJ1_JPIMMED_3_05: return(0); + + case cJ1_JPIMMED_4_02: return(0); + case cJ1_JPIMMED_4_03: return(0); + case cJ1_JPIMMED_5_02: return(0); + case cJ1_JPIMMED_5_03: return(0); + case cJ1_JPIMMED_6_02: return(0); + case cJ1_JPIMMED_7_02: return(0); +#endif + + } // switch (JU_JPTYPE(Pjp)) + + return(0); // to make some compilers happy. + +} // j__udyGetMemActive() diff --git a/libnetdata/libjudy/src/JudyL/JudyLMemUsed.c b/libnetdata/libjudy/src/JudyL/JudyLMemUsed.c new file mode 100644 index 000000000..81e3a79ce --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLMemUsed.c @@ -0,0 +1,61 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.5 $ $Source: /judy/src/JudyCommon/JudyMemUsed.c $ +// +// Return number of bytes of memory used to support a Judy1/L array. +// Compile with one of -DJUDY1 or -DJUDYL. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +#ifdef JUDY1 +FUNCTION Word_t Judy1MemUsed +#else // JUDYL +FUNCTION Word_t JudyLMemUsed +#endif + ( + Pcvoid_t PArray // from which to retrieve. + ) +{ + Word_t Words = 0; + + if (PArray == (Pcvoid_t) NULL) return(0); + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + Words = JU_LEAFWPOPTOWORDS(Pjlw[0] + 1); // based on pop1. + } + else + { + Pjpm_t Pjpm = P_JPM(PArray); + Words = Pjpm->jpm_TotalMemWords; + } + + return(Words * sizeof(Word_t)); // convert to bytes. + +} // Judy1MemUsed() / JudyLMemUsed() diff --git a/libnetdata/libjudy/src/JudyL/JudyLNext.c b/libnetdata/libjudy/src/JudyL/JudyLNext.c new file mode 100644 index 000000000..4bcdccf10 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLNext.c @@ -0,0 +1,1890 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.54 $ $Source: /judy/src/JudyCommon/JudyPrevNext.c $ +// +// Judy*Prev() and Judy*Next() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// Compile with -DJUDYNEXT for the Judy*Next() function; otherwise defaults to +// Judy*Prev(). + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifndef JUDYNEXT +#ifndef JUDYPREV +#define JUDYPREV 1 // neither set => use default. +#endif +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + + +// **************************************************************************** +// J U D Y 1 P R E V +// J U D Y 1 N E X T +// J U D Y L P R E V +// J U D Y L N E X T +// +// See the manual entry for the API. +// +// OVERVIEW OF Judy*Prev(): +// +// Use a reentrant switch statement (state machine, SM1 = "get") to decode the +// callers *PIndex-1, starting with the (PArray), through branches, if +// any, down to an immediate or a leaf. Look for *PIndex-1 in that leaf, and +// if found, return it. +// +// A dead end is either a branch that does not contain a JP for the appropriate +// digit in *PIndex-1, or a leaf that does not contain the undecoded digits of +// *PIndex-1. Upon reaching a dead end, backtrack through the leaf/branches +// that were just traversed, using a list (history) of parent JPs that is built +// while going forward in SM1Get. Start with the current leaf or branch. In a +// backtracked leaf, look for an Index less than *PIndex-1. In each +// backtracked branch, look "sideways" for the next JP, if any, lower than the +// one for the digit (from *PIndex-1) that was previously decoded. While +// backtracking, if a leaf has no previous Index or a branch has no lower JP, +// go to its parent branch in turn. Upon reaching the JRP, return failure, "no +// previous Index". The backtrack process is sufficiently different from +// SM1Get to merit its own separate reentrant switch statement (SM2 = +// "backtrack"). +// +// While backtracking, upon finding a lower JP in a branch, there is certain to +// be a "prev" Index under that JP (unless the Judy array is corrupt). +// Traverse forward again, this time taking the last (highest, right-most) JP +// in each branch, and the last (highest) Index upon reaching an immediate or a +// leaf. This traversal is sufficiently different from SM1Get and SM2Backtrack +// to merit its own separate reentrant switch statement (SM3 = "findlimit"). +// +// "Decode" bytes in JPs complicate this process a little. In SM1Get, when a +// JP is a narrow pointer, that is, when states are skipped (so the skipped +// digits are stored in jp_DcdPopO), compare the relevant digits to the same +// digits in *PIndex-1. If they are EQUAL, proceed in SM1Get as before. If +// jp_DcdPopOs digits are GREATER, treat the JP as a dead end and proceed in +// SM2Backtrack. If jp_DcdPopOs digits are LESS, treat the JP as if it had +// just been found during a backtrack and proceed directly in SM3Findlimit. +// +// Note that Decode bytes can be ignored in SM3Findlimit; they dont matter. +// Also note that in practice the Decode bytes are routinely compared with +// *PIndex-1 because thats simpler and no slower than first testing for +// narrowness. +// +// Decode bytes also make it unnecessary to construct the Index to return (the +// revised *PIndex) during the search. This step is deferred until finding an +// Index during backtrack or findlimit, before returning it. The first digit +// of *PIndex is derived (saved) based on which JP is used in a JRP branch. +// The remaining digits are obtained from the jp_DcdPopO field in the JP (if +// any) above the immediate or leaf containing the found (prev) Index, plus the +// remaining digit(s) in the immediate or leaf itself. In the case of a LEAFW, +// the Index to return is found directly in the leaf. +// +// Note: Theoretically, as described above, upon reaching a dead end, SM1Get +// passes control to SM2Backtrack to look sideways, even in a leaf. Actually +// its a little more efficient for the SM1Get leaf cases to shortcut this and +// take care of the sideways searches themselves. Hence the history list only +// contains branch JPs, and SM2Backtrack only handles branches. In fact, even +// the branch handling cases in SM1Get do some shortcutting (sideways +// searching) to avoid pushing history and calling SM2Backtrack unnecessarily. +// +// Upon reaching an Index to return after backtracking, *PIndex must be +// modified to the found Index. In principle this could be done by building +// the Index from a saved rootdigit (in the top branch) plus the Dcd bytes from +// the parent JP plus the appropriate Index bytes from the leaf. However, +// Immediates are difficult because their parent JPs lack one (last) digit. So +// instead just build the *PIndex to return "top down" while backtracking and +// findlimiting. +// +// This function is written iteratively for speed, rather than recursively. +// +// CAVEATS: +// +// Why use a backtrack list (history stack), since it has finite size? The +// size is small for Judy on both 32-bit and 64-bit systems, and a list (really +// just an array) is fast to maintain and use. Other alternatives include +// doing a lookahead (lookaside) in each branch while traversing forward +// (decoding), and restarting from the top upon a dead end. +// +// A lookahead means noting the last branch traversed which contained a +// non-null JP lower than the one specified by a digit in *PIndex-1, and +// returning to that point for SM3Findlimit. This seems like a good idea, and +// should be pretty cheap for linear and bitmap branches, but it could result +// in up to 31 unnecessary additional cache line fills (in extreme cases) for +// every uncompressed branch traversed. We have considered means of attaching +// to or hiding within an uncompressed branch (in null JPs) a "cache line map" +// or other structure, such as an offset to the next non-null JP, that would +// speed this up, but it seems unnecessary merely to avoid having a +// finite-length list (array). (If JudySL is ever made "native", the finite +// list length will be an issue.) +// +// Restarting at the top of the Judy array after a dead end requires a careful +// modification of *PIndex-1 to decrement the digit for the parent branch and +// set the remaining lower digits to all 1s. This must be repeated each time a +// parent branch contains another dead end, so even though it should all happen +// in cache, the CPU time can be excessive. (For JudySL or an equivalent +// "infinitely deep" Judy array, consider a hybrid of a large, finite, +// "circular" list and a restart-at-top when the list is backtracked to +// exhaustion.) +// +// Why search for *PIndex-1 instead of *PIndex during SM1Get? In rare +// instances this prevents an unnecessary decode down the wrong path followed +// by a backtrack; its pretty cheap to set up initially; and it means the +// SM1Get machine can simply return if/when it finds that Index. +// +// TBD: Wed like to enhance this function to make successive searches faster. +// This would require saving some previous state, including the previous Index +// returned, and in which leaf it was found. If the next call is for the same +// Index and the array has not been modified, start at the same leaf. This +// should be much easier to implement since this is iterative rather than +// recursive code. +// +// VARIATIONS FOR Judy*Next(): +// +// The Judy*Next() code is nearly a perfect mirror of the Judy*Prev() code. +// See the Judy*Prev() overview comments, and mentally switch the following: +// +// - "*PIndex-1" => "*PIndex+1" +// - "less than" => "greater than" +// - "lower" => "higher" +// - "lowest" => "highest" +// - "next-left" => "next-right" +// - "right-most" => "left-most" +// +// Note: SM3Findlimit could be called SM3Findmax/SM3Findmin, but a common name +// for both Prev and Next means many fewer ifdefs in this code. +// +// TBD: Currently this code traverses a JP whether its expanse is partially or +// completely full (populated). For Judy1 (only), since there is no value area +// needed, consider shortcutting to a "success" return upon encountering a full +// JP in SM1Get (or even SM3Findlimit?) A full JP looks like this: +// +// (((JU_JPDCDPOP0(Pjp) ^ cJU_ALLONES) & cJU_POP0MASK(cLevel)) == 0) + +#ifdef JUDY1 +#ifdef JUDYPREV +FUNCTION int Judy1Prev +#else +FUNCTION int Judy1Next +#endif +#else +#ifdef JUDYPREV +FUNCTION PPvoid_t JudyLPrev +#else +FUNCTION PPvoid_t JudyLNext +#endif +#endif + ( + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError // optional, for returning error info. + ) +{ + Pjp_t Pjp, Pjp2; // current JPs. + Pjbl_t Pjbl; // Pjp->jp_Addr masked and cast to types: + Pjbb_t Pjbb; + Pjbu_t Pjbu; + +// Note: The following initialization is not strictly required but it makes +// gcc -Wall happy because there is an "impossible" path from Immed handling to +// SM1LeafLImm code that looks like Pjll might be used before set: + + Pjll_t Pjll = (Pjll_t) NULL; + Word_t state; // current state in SM. + Word_t digit; // next digit to decode from Index. + +// Note: The following initialization is not strictly required but it makes +// gcc -Wall happy because there is an "impossible" path from Immed handling to +// SM1LeafLImm code (for JudyL & JudyPrev only) that looks like pop1 might be +// used before set: + +#if (defined(JUDYL) && defined(JUDYPREV)) + Word_t pop1 = 0; // in a leaf. +#else + Word_t pop1; // in a leaf. +#endif + int offset; // linear branch/leaf, from j__udySearchLeaf*(). + int subexp; // subexpanse in a bitmap branch. + Word_t bitposmask; // bit in bitmap for Index. + +// History for SM2Backtrack: +// +// For a given histnum, APjphist[histnum] is a parent JP that points to a +// branch, and Aoffhist[histnum] is the offset of the NEXT JP in the branch to +// which the parent JP points. The meaning of Aoffhist[histnum] depends on the +// type of branch to which the parent JP points: +// +// Linear: Offset of the next JP in the JP list. +// +// Bitmap: Which subexpanse, plus the offset of the next JP in the +// subexpanses JP list (to avoid bit-counting again), plus for Judy*Next(), +// hidden one byte to the left, which digit, because Judy*Next() also needs +// this. +// +// Uncompressed: Digit, which is actually the offset of the JP in the branch. +// +// Note: Only branch JPs are stored in APjphist[] because, as explained +// earlier, SM1Get shortcuts sideways searches in leaves (and even in branches +// in some cases), so SM2Backtrack only handles branches. + +#define HISTNUMMAX cJU_ROOTSTATE // maximum branches traversable. + Pjp_t APjphist[HISTNUMMAX]; // list of branch JPs traversed. + int Aoffhist[HISTNUMMAX]; // list of next JP offsets; see above. + int histnum = 0; // number of JPs now in list. + + +// ---------------------------------------------------------------------------- +// M A C R O S +// +// These are intended to make the code a bit more readable and less redundant. + + +// "PUSH" AND "POP" Pjp AND offset ON HISTORY STACKS: +// +// Note: Ensure a corrupt Judy array does not overflow *hist[]. Meanwhile, +// underflowing *hist[] simply means theres no more room to backtrack => +// "no previous/next Index". + +#define HISTPUSH(Pjp,Offset) \ + APjphist[histnum] = (Pjp); \ + Aoffhist[histnum] = (Offset); \ + \ + if (++histnum >= HISTNUMMAX) \ + { \ + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT) \ + JUDY1CODE(return(JERRI );) \ + JUDYLCODE(return(PPJERR);) \ + } + +#define HISTPOP(Pjp,Offset) \ + if ((histnum--) < 1) JU_RET_NOTFOUND; \ + (Pjp) = APjphist[histnum]; \ + (Offset) = Aoffhist[histnum] + +// How to pack/unpack Aoffhist[] values for bitmap branches: + +#ifdef JUDYPREV + +#define HISTPUSHBOFF(Subexp,Offset,Digit) \ + (((Subexp) * cJU_BITSPERSUBEXPB) | (Offset)) + +#define HISTPOPBOFF(Subexp,Offset,Digit) \ + (Subexp) = (Offset) / cJU_BITSPERSUBEXPB; \ + (Offset) %= cJU_BITSPERSUBEXPB +#else + +#define HISTPUSHBOFF(Subexp,Offset,Digit) \ + (((Digit) << cJU_BITSPERBYTE) \ + | ((Subexp) * cJU_BITSPERSUBEXPB) | (Offset)) + +#define HISTPOPBOFF(Subexp,Offset,Digit) \ + (Digit) = (Offset) >> cJU_BITSPERBYTE; \ + (Subexp) = ((Offset) & JU_LEASTBYTESMASK(1)) / cJU_BITSPERSUBEXPB; \ + (Offset) %= cJU_BITSPERSUBEXPB +#endif + + +// CHECK FOR NULL JP: + +#define JPNULL(Type) (((Type) >= cJU_JPNULL1) && ((Type) <= cJU_JPNULLMAX)) + + +// SEARCH A BITMAP: +// +// This is a weak analog of j__udySearchLeaf*() for bitmaps. Return the actual +// or next-left position, base 0, of Digit in the single uint32_t bitmap, also +// given a Bitposmask for Digit. +// +// Unlike j__udySearchLeaf*(), the offset is not returned bit-complemented if +// Digits bit is unset, because the caller can check the bitmap themselves to +// determine that. Also, if Digits bit is unset, the returned offset is to +// the next-left JP (including -1), not to the "ideal" position for the Index = +// next-right JP. +// +// Shortcut and skip calling j__udyCountBits*() if the bitmap is full, in which +// case (Digit % cJU_BITSPERSUBEXP*) itself is the base-0 offset. +// +// TBD for Judy*Next(): Should this return next-right instead of next-left? +// That is, +1 from current value? Maybe not, if Digits bit IS set, +1 would +// be wrong. + +#define SEARCHBITMAPB(Bitmap,Digit,Bitposmask) \ + (((Bitmap) == cJU_FULLBITMAPB) ? (Digit % cJU_BITSPERSUBEXPB) : \ + j__udyCountBitsB((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1) + +#define SEARCHBITMAPL(Bitmap,Digit,Bitposmask) \ + (((Bitmap) == cJU_FULLBITMAPL) ? (Digit % cJU_BITSPERSUBEXPL) : \ + j__udyCountBitsL((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1) + +#ifdef JUDYPREV +// Equivalent to search for the highest offset in Bitmap: + +#define SEARCHBITMAPMAXB(Bitmap) \ + (((Bitmap) == cJU_FULLBITMAPB) ? cJU_BITSPERSUBEXPB - 1 : \ + j__udyCountBitsB(Bitmap) - 1) + +#define SEARCHBITMAPMAXL(Bitmap) \ + (((Bitmap) == cJU_FULLBITMAPL) ? cJU_BITSPERSUBEXPL - 1 : \ + j__udyCountBitsL(Bitmap) - 1) +#endif + + +// CHECK DECODE BYTES: +// +// Check Decode bytes in a JP against the equivalent portion of *PIndex. If +// *PIndex is lower (for Judy*Prev()) or higher (for Judy*Next()), this JP is a +// dead end (the same as if it had been absent in a linear or bitmap branch or +// null in an uncompressed branch), enter SM2Backtrack; otherwise enter +// SM3Findlimit to find the highest/lowest Index under this JP, as if the code +// had already backtracked to this JP. + +#ifdef JUDYPREV +#define CDcmp__ < +#else +#define CDcmp__ > +#endif + +#define CHECKDCD(cState) \ + if (JU_DCDNOTMATCHINDEX(*PIndex, Pjp, cState)) \ + { \ + if ((*PIndex & cJU_DCDMASK(cState)) \ + CDcmp__(JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(cState))) \ + { \ + goto SM2Backtrack; \ + } \ + goto SM3Findlimit; \ + } + + +// PREPARE TO HANDLE A LEAFW OR JRP BRANCH IN SM1: +// +// Extract a state-dependent digit from Index in a "constant" way, then jump to +// common code for multiple cases. + +#define SM1PREPB(cState,Next) \ + state = (cState); \ + digit = JU_DIGITATSTATE(*PIndex, cState); \ + goto Next + + +// PREPARE TO HANDLE A LEAFW OR JRP BRANCH IN SM3: +// +// Optionally save Dcd bytes into *PIndex, then save state and jump to common +// code for multiple cases. + +#define SM3PREPB_DCD(cState,Next) \ + JU_SETDCD(*PIndex, Pjp, cState); \ + SM3PREPB(cState,Next) + +#define SM3PREPB(cState,Next) state = (cState); goto Next + + +// ---------------------------------------------------------------------------- +// CHECK FOR SHORTCUTS: +// +// Error out if PIndex is null. Execute JU_RET_NOTFOUND if the Judy array is +// empty or *PIndex is already the minimum/maximum Index possible. +// +// Note: As documented, in case of failure *PIndex may be modified. + + if (PIndex == (PWord_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +#ifdef JUDYPREV + if ((PArray == (Pvoid_t) NULL) || ((*PIndex)-- == 0)) +#else + if ((PArray == (Pvoid_t) NULL) || ((*PIndex)++ == cJU_ALLONES)) +#endif + JU_RET_NOTFOUND; + + +// HANDLE JRP: +// +// Before even entering SM1Get, check the JRP type. For JRP branches, traverse +// the JPM; handle LEAFW leaves directly; but look for the most common cases +// first. + +// ROOT-STATE LEAF that starts with a Pop0 word; just look within the leaf: +// +// If *PIndex is in the leaf, return it; otherwise return the Index, if any, +// below where it would belong. + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + pop1 = Pjlw[0] + 1; + + if ((offset = j__udySearchLeafW(Pjlw + 1, pop1, *PIndex)) + >= 0) // Index is present. + { + assert(offset < pop1); // in expected range. + JU_RET_FOUND_LEAFW(Pjlw, pop1, offset); // *PIndex is set. + } + +#ifdef JUDYPREV + if ((offset = ~offset) == 0) // no next-left Index. +#else + if ((offset = ~offset) >= pop1) // no next-right Index. +#endif + JU_RET_NOTFOUND; + + assert(offset <= pop1); // valid result. + +#ifdef JUDYPREV + *PIndex = Pjlw[offset--]; // next-left Index, base 1. +#else + *PIndex = Pjlw[offset + 1]; // next-right Index, base 1. +#endif + JU_RET_FOUND_LEAFW(Pjlw, pop1, offset); // base 0. + + } + else // JRP BRANCH + { + Pjpm_t Pjpm = P_JPM(PArray); + Pjp = &(Pjpm->jpm_JP); + +// goto SM1Get; + } + +// ============================================================================ +// STATE MACHINE 1 -- GET INDEX: +// +// Search for *PIndex (already decremented/incremented so as to be inclusive). +// If found, return it. Otherwise in theory hand off to SM2Backtrack or +// SM3Findlimit, but in practice "shortcut" by first sideways searching the +// current branch or leaf upon hitting a dead end. During sideways search, +// modify *PIndex to a new path taken. +// +// ENTRY: Pjp points to next JP to interpret, whose Decode bytes have not yet +// been checked. This JP is not yet listed in history. +// +// Note: Check Decode bytes at the start of each loop, not after looking up a +// new JP, so its easy to do constant shifts/masks, although this requires +// cautious handling of Pjp, offset, and *hist[] for correct entry to +// SM2Backtrack. +// +// EXIT: Return, or branch to SM2Backtrack or SM3Findlimit with correct +// interface, as described elsewhere. +// +// WARNING: For run-time efficiency the following cases replicate code with +// varying constants, rather than using common code with variable values! + +SM1Get: // return here for next branch/leaf. + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in *PIndex. + + case cJU_JPBRANCH_L2: CHECKDCD(2); SM1PREPB(2, SM1BranchL); + case cJU_JPBRANCH_L3: CHECKDCD(3); SM1PREPB(3, SM1BranchL); +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: CHECKDCD(4); SM1PREPB(4, SM1BranchL); + case cJU_JPBRANCH_L5: CHECKDCD(5); SM1PREPB(5, SM1BranchL); + case cJU_JPBRANCH_L6: CHECKDCD(6); SM1PREPB(6, SM1BranchL); + case cJU_JPBRANCH_L7: CHECKDCD(7); SM1PREPB(7, SM1BranchL); +#endif + case cJU_JPBRANCH_L: SM1PREPB(cJU_ROOTSTATE, SM1BranchL); + +// Common code (state-independent) for all cases of linear branches: + +SM1BranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + +// Found JP matching current digit in *PIndex; record parent JP and the next +// JPs offset, and iterate to the next JP: + + if ((offset = j__udySearchLeaf1((Pjll_t) (Pjbl->jbl_Expanse), + Pjbl->jbl_NumJPs, digit)) >= 0) + { + HISTPUSH(Pjp, offset); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM1Get; + } + +// Dead end, no JP in BranchL for next digit in *PIndex: +// +// Get the ideal location of digits JP, and if theres no next-left/right JP +// in the BranchL, shortcut and start backtracking one level up; ignore the +// current Pjp because it points to a BranchL with no next-left/right JP. + +#ifdef JUDYPREV + if ((offset = (~offset) - 1) < 0) // no next-left JP in BranchL. +#else + if ((offset = (~offset)) >= Pjbl->jbl_NumJPs) // no next-right. +#endif + goto SM2Backtrack; + +// Theres a next-left/right JP in the current BranchL; save its digit in +// *PIndex and shortcut to SM3Findlimit: + + JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: +// +// Check Decode bytes, if any, in the current JP, then look for a JP for the +// next digit in *PIndex. + + case cJU_JPBRANCH_B2: CHECKDCD(2); SM1PREPB(2, SM1BranchB); + case cJU_JPBRANCH_B3: CHECKDCD(3); SM1PREPB(3, SM1BranchB); +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: CHECKDCD(4); SM1PREPB(4, SM1BranchB); + case cJU_JPBRANCH_B5: CHECKDCD(5); SM1PREPB(5, SM1BranchB); + case cJU_JPBRANCH_B6: CHECKDCD(6); SM1PREPB(6, SM1BranchB); + case cJU_JPBRANCH_B7: CHECKDCD(7); SM1PREPB(7, SM1BranchB); +#endif + case cJU_JPBRANCH_B: SM1PREPB(cJU_ROOTSTATE, SM1BranchB); + +// Common code (state-independent) for all cases of bitmap branches: + +SM1BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + +// Locate the digits JP in the subexpanse list, if present, otherwise the +// offset of the next-left JP, if any: + + subexp = digit / cJU_BITSPERSUBEXPB; + assert(subexp < cJU_NUMSUBEXPB); // falls in expected range. + bitposmask = JU_BITPOSMASKB(digit); + offset = SEARCHBITMAPB(JU_JBB_BITMAP(Pjbb, subexp), digit, + bitposmask); + // right range: + assert((offset >= -1) && (offset < (int) cJU_BITSPERSUBEXPB)); + +// Found JP matching current digit in *PIndex: +// +// Record the parent JP and the next JPs offset; and iterate to the next JP. + +// if (JU_BITMAPTESTB(Pjbb, digit)) // slower. + if (JU_JBB_BITMAP(Pjbb, subexp) & bitposmask) // faster. + { + // not negative since at least one bit is set: + assert(offset >= 0); + + HISTPUSH(Pjp, HISTPUSHBOFF(subexp, offset, digit)); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM1Get; // iterate to next JP. + } + +// Dead end, no JP in BranchB for next digit in *PIndex: +// +// If theres a next-left/right JP in the current BranchB, shortcut to +// SM3Findlimit. Note: offset is already set to the correct value for the +// next-left/right JP. + +#ifdef JUDYPREV + if (offset >= 0) // next-left JP is in this subexpanse. + goto SM1BranchBFindlimit; + + while (--subexp >= 0) // search next-left subexpanses. +#else + if (JU_JBB_BITMAP(Pjbb, subexp) & JU_MASKHIGHEREXC(bitposmask)) + { + ++offset; // next-left => next-right. + goto SM1BranchBFindlimit; + } + + while (++subexp < cJU_NUMSUBEXPB) // search next-right subexps. +#endif + { + if (! JU_JBB_PJP(Pjbb, subexp)) continue; // empty subexpanse. + +#ifdef JUDYPREV + offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB)); +#else + offset = 0; +#endif + +// Save the next-left/right JPs digit in *PIndex: + +SM1BranchBFindlimit: + JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp), + offset); + JU_SETDIGIT(*PIndex, digit, state); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchB: +// +// Shortcut and start backtracking one level up; ignore the current Pjp because +// it points to a BranchB with no next-left/right JP. + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: +// +// Check Decode bytes, if any, in the current JP, then look for a JP for the +// next digit in *PIndex. + + case cJU_JPBRANCH_U2: CHECKDCD(2); SM1PREPB(2, SM1BranchU); + case cJU_JPBRANCH_U3: CHECKDCD(3); SM1PREPB(3, SM1BranchU); +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: CHECKDCD(4); SM1PREPB(4, SM1BranchU); + case cJU_JPBRANCH_U5: CHECKDCD(5); SM1PREPB(5, SM1BranchU); + case cJU_JPBRANCH_U6: CHECKDCD(6); SM1PREPB(6, SM1BranchU); + case cJU_JPBRANCH_U7: CHECKDCD(7); SM1PREPB(7, SM1BranchU); +#endif + case cJU_JPBRANCH_U: SM1PREPB(cJU_ROOTSTATE, SM1BranchU); + +// Common code (state-independent) for all cases of uncompressed branches: + +SM1BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + Pjp2 = (Pjbu->jbu_jp) + digit; + +// Found JP matching current digit in *PIndex: +// +// Record the parent JP and the next JPs digit, and iterate to the next JP. +// +// TBD: Instead of this, just goto SM1Get, and add cJU_JPNULL* cases to the +// SM1Get state machine? Then backtrack? However, it means you cant detect +// an inappropriate cJU_JPNULL*, when it occurs in other than a BranchU, and +// return JU_RET_CORRUPT. + + if (! JPNULL(JU_JPTYPE(Pjp2))) // digit has a JP. + { + HISTPUSH(Pjp, digit); + Pjp = Pjp2; + goto SM1Get; + } + +// Dead end, no JP in BranchU for next digit in *PIndex: +// +// Search for a next-left/right JP in the current BranchU, and if one is found, +// save its digit in *PIndex and shortcut to SM3Findlimit: + +#ifdef JUDYPREV + while (digit >= 1) + { + Pjp = (Pjbu->jbu_jp) + (--digit); +#else + while (digit < cJU_BRANCHUNUMJPS - 1) + { + Pjp = (Pjbu->jbu_jp) + (++digit); +#endif + if (JPNULL(JU_JPTYPE(Pjp))) continue; + + JU_SETDIGIT(*PIndex, digit, state); + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchU: +// +// Shortcut and start backtracking one level up; ignore the current Pjp because +// it points to a BranchU with no next-left/right JP. + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// LINEAR LEAF: +// +// Check Decode bytes, if any, in the current JP, then search the leaf for +// *PIndex. + +#define SM1LEAFL(Func) \ + Pjll = P_JLL(Pjp->jp_Addr); \ + pop1 = JU_JPLEAF_POP0(Pjp) + 1; \ + offset = Func(Pjll, pop1, *PIndex); \ + goto SM1LeafLImm + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: CHECKDCD(1); SM1LEAFL(j__udySearchLeaf1); +#endif + case cJU_JPLEAF2: CHECKDCD(2); SM1LEAFL(j__udySearchLeaf2); + case cJU_JPLEAF3: CHECKDCD(3); SM1LEAFL(j__udySearchLeaf3); + +#ifdef JU_64BIT + case cJU_JPLEAF4: CHECKDCD(4); SM1LEAFL(j__udySearchLeaf4); + case cJU_JPLEAF5: CHECKDCD(5); SM1LEAFL(j__udySearchLeaf5); + case cJU_JPLEAF6: CHECKDCD(6); SM1LEAFL(j__udySearchLeaf6); + case cJU_JPLEAF7: CHECKDCD(7); SM1LEAFL(j__udySearchLeaf7); +#endif + +// Common code (state-independent) for all cases of linear leaves and +// immediates: + +SM1LeafLImm: + if (offset >= 0) // *PIndex is in LeafL / Immed. +#ifdef JUDY1 + JU_RET_FOUND; +#else + { // JudyL is trickier... + switch (JU_JPTYPE(Pjp)) + { +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: JU_RET_FOUND_LEAF1(Pjll, pop1, offset); +#endif + case cJU_JPLEAF2: JU_RET_FOUND_LEAF2(Pjll, pop1, offset); + case cJU_JPLEAF3: JU_RET_FOUND_LEAF3(Pjll, pop1, offset); +#ifdef JU_64BIT + case cJU_JPLEAF4: JU_RET_FOUND_LEAF4(Pjll, pop1, offset); + case cJU_JPLEAF5: JU_RET_FOUND_LEAF5(Pjll, pop1, offset); + case cJU_JPLEAF6: JU_RET_FOUND_LEAF6(Pjll, pop1, offset); + case cJU_JPLEAF7: JU_RET_FOUND_LEAF7(Pjll, pop1, offset); +#endif + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + JU_RET_FOUND_IMM_01(Pjp); + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#ifdef JU_64BIT + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: + case cJU_JPIMMED_3_02: +#endif + JU_RET_FOUND_IMM(Pjp, offset); + } + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // impossible? + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // found *PIndex + +#endif // JUDYL + +// Dead end, no Index in LeafL / Immed for remaining digit(s) in *PIndex: +// +// Get the ideal location of Index, and if theres no next-left/right Index in +// the LeafL / Immed, shortcut and start backtracking one level up; ignore the +// current Pjp because it points to a LeafL / Immed with no next-left/right +// Index. + +#ifdef JUDYPREV + if ((offset = (~offset) - 1) < 0) // no next-left Index. +#else + if ((offset = (~offset)) >= pop1) // no next-right Index. +#endif + goto SM2Backtrack; + +// Theres a next-left/right Index in the current LeafL / Immed; shortcut by +// copying its digit(s) to *PIndex and returning it. +// +// Unfortunately this is pretty hairy, especially avoiding endian issues. +// +// The cJU_JPLEAF* cases are very similar to same-index-size cJU_JPIMMED* cases +// for *_02 and above, but must return differently, at least for JudyL, so +// spell them out separately here at the cost of a little redundant code for +// Judy1. + + switch (JU_JPTYPE(Pjp)) + { +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: + + JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]); + JU_RET_FOUND_LEAF1(Pjll, pop1, offset); +#endif + + case cJU_JPLEAF2: + + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF2(Pjll, pop1, offset); + + case cJU_JPLEAF3: + { + Word_t lsb; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + +#ifdef JU_64BIT + case cJU_JPLEAF4: + + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF4(Pjll, pop1, offset); + + case cJU_JPLEAF5: + { + Word_t lsb; + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_LEAF5(Pjll, pop1, offset); + } + + case cJU_JPLEAF6: + { + Word_t lsb; + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_LEAF6(Pjll, pop1, offset); + } + + case cJU_JPLEAF7: + { + Word_t lsb; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_LEAF7(Pjll, pop1, offset); + } + +#endif // JU_64BIT + +#define SET_01(cState) JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState) + + case cJU_JPIMMED_1_01: SET_01(1); goto SM1Imm_01; + case cJU_JPIMMED_2_01: SET_01(2); goto SM1Imm_01; + case cJU_JPIMMED_3_01: SET_01(3); goto SM1Imm_01; +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: SET_01(4); goto SM1Imm_01; + case cJU_JPIMMED_5_01: SET_01(5); goto SM1Imm_01; + case cJU_JPIMMED_6_01: SET_01(6); goto SM1Imm_01; + case cJU_JPIMMED_7_01: SET_01(7); goto SM1Imm_01; +#endif +SM1Imm_01: JU_RET_FOUND_IMM_01(Pjp); + +// Shorthand for where to find start of Index bytes array: + +#ifdef JUDY1 +#define PJI (Pjp->jp_1Index) +#else +#define PJI (Pjp->jp_LIndex) +#endif + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: + case cJ1_JPIMMED_1_09: + case cJ1_JPIMMED_1_10: + case cJ1_JPIMMED_1_11: + case cJ1_JPIMMED_1_12: + case cJ1_JPIMMED_1_13: + case cJ1_JPIMMED_1_14: + case cJ1_JPIMMED_1_15: +#endif + JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]); + JU_RET_FOUND_IMM(Pjp, offset); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: + case cJ1_JPIMMED_2_05: + case cJ1_JPIMMED_2_06: + case cJ1_JPIMMED_2_07: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: + case cJ1_JPIMMED_3_04: + case cJ1_JPIMMED_3_05: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + { + Word_t lsb; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_4_02: + case cJ1_JPIMMED_4_03: + + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); + + case cJ1_JPIMMED_5_02: + case cJ1_JPIMMED_5_03: + { + Word_t lsb; + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_6_02: + { + Word_t lsb; + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_7_02: + { + Word_t lsb; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + +#endif // (JUDY1 && JU_64BIT) + + } // switch for not-found *PIndex + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // impossible? + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF: +// +// Check Decode bytes, if any, in the current JP, then look in the leaf for +// *PIndex. + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb; + CHECKDCD(1); + + Pjlb = P_JLB(Pjp->jp_Addr); + digit = JU_DIGITATSTATE(*PIndex, 1); + subexp = JU_SUBEXPL(digit); + bitposmask = JU_BITPOSMASKL(digit); + assert(subexp < cJU_NUMSUBEXPL); // falls in expected range. + +// *PIndex exists in LeafB1: + +// if (JU_BITMAPTESTL(Pjlb, digit)) // slower. + if (JU_JLB_BITMAP(Pjlb, subexp) & bitposmask) // faster. + { +#ifdef JUDYL // needs offset at this point: + offset = SEARCHBITMAPL(JU_JLB_BITMAP(Pjlb, subexp), digit, bitposmask); +#endif + JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset); +// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset))); + } + +// Dead end, no Index in LeafB1 for remaining digit in *PIndex: +// +// If theres a next-left/right Index in the current LeafB1, which for +// Judy*Next() is true if any bits are set for higher Indexes, shortcut by +// returning it. Note: For Judy*Prev(), offset is set here to the correct +// value for the next-left JP. + + offset = SEARCHBITMAPL(JU_JLB_BITMAP(Pjlb, subexp), digit, + bitposmask); + // right range: + assert((offset >= -1) && (offset < (int) cJU_BITSPERSUBEXPL)); + +#ifdef JUDYPREV + if (offset >= 0) // next-left JP is in this subexpanse. + goto SM1LeafB1Findlimit; + + while (--subexp >= 0) // search next-left subexpanses. +#else + if (JU_JLB_BITMAP(Pjlb, subexp) & JU_MASKHIGHEREXC(bitposmask)) + { + ++offset; // next-left => next-right. + goto SM1LeafB1Findlimit; + } + + while (++subexp < cJU_NUMSUBEXPL) // search next-right subexps. +#endif + { + if (! JU_JLB_BITMAP(Pjlb, subexp)) continue; // empty subexp. + +#ifdef JUDYPREV + offset = SEARCHBITMAPMAXL(JU_JLB_BITMAP(Pjlb, subexp)); + // expected range: + assert((offset >= 0) && (offset < (int) cJU_BITSPERSUBEXPL)); +#else + offset = 0; +#endif + +// Save the next-left/right Indexess digit in *PIndex: + +SM1LeafB1Findlimit: + JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset); + JU_SETDIGIT1(*PIndex, digit); + JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset); +// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset))); + } + +// Theres no next-left/right Index in the LeafB1: +// +// Shortcut and start backtracking one level up; ignore the current Pjp because +// it points to a LeafB1 with no next-left/right Index. + + goto SM2Backtrack; + + } // case cJU_JPLEAF_B1 + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// If the Decode bytes match, *PIndex is found (without modification). + + case cJ1_JPFULLPOPU1: + + CHECKDCD(1); + JU_RET_FOUND_FULLPOPU1; +#endif + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: + +#ifdef JUDYPREV +#define SM1IMM_SETPOP1(cPop1) +#else +#define SM1IMM_SETPOP1(cPop1) pop1 = (cPop1) +#endif + +#define SM1IMM(Func,cPop1) \ + SM1IMM_SETPOP1(cPop1); \ + offset = Func((Pjll_t) (PJI), cPop1, *PIndex); \ + goto SM1LeafLImm + +// Special case for Pop1 = 1 Immediate JPs: +// +// If *PIndex is in the immediate, offset is 0, otherwise the binary NOT of the +// offset where it belongs, 0 or 1, same as from the search functions. + +#ifdef JUDYPREV +#define SM1IMM_01_SETPOP1 +#else +#define SM1IMM_01_SETPOP1 pop1 = 1 +#endif + +#define SM1IMM_01 \ + SM1IMM_01_SETPOP1; \ + offset = ((JU_JPDCDPOP0(Pjp) < JU_TRIMTODCDSIZE(*PIndex)) ? ~1 : \ + (JU_JPDCDPOP0(Pjp) == JU_TRIMTODCDSIZE(*PIndex)) ? 0 : \ + ~0); \ + goto SM1LeafLImm + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + SM1IMM_01; + +// TBD: Doug says it would be OK to have fewer calls and calculate arg 2, here +// and in Judy*Count() also. + + case cJU_JPIMMED_1_02: SM1IMM(j__udySearchLeaf1, 2); + case cJU_JPIMMED_1_03: SM1IMM(j__udySearchLeaf1, 3); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: SM1IMM(j__udySearchLeaf1, 4); + case cJU_JPIMMED_1_05: SM1IMM(j__udySearchLeaf1, 5); + case cJU_JPIMMED_1_06: SM1IMM(j__udySearchLeaf1, 6); + case cJU_JPIMMED_1_07: SM1IMM(j__udySearchLeaf1, 7); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: SM1IMM(j__udySearchLeaf1, 8); + case cJ1_JPIMMED_1_09: SM1IMM(j__udySearchLeaf1, 9); + case cJ1_JPIMMED_1_10: SM1IMM(j__udySearchLeaf1, 10); + case cJ1_JPIMMED_1_11: SM1IMM(j__udySearchLeaf1, 11); + case cJ1_JPIMMED_1_12: SM1IMM(j__udySearchLeaf1, 12); + case cJ1_JPIMMED_1_13: SM1IMM(j__udySearchLeaf1, 13); + case cJ1_JPIMMED_1_14: SM1IMM(j__udySearchLeaf1, 14); + case cJ1_JPIMMED_1_15: SM1IMM(j__udySearchLeaf1, 15); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: SM1IMM(j__udySearchLeaf2, 2); + case cJU_JPIMMED_2_03: SM1IMM(j__udySearchLeaf2, 3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: SM1IMM(j__udySearchLeaf2, 4); + case cJ1_JPIMMED_2_05: SM1IMM(j__udySearchLeaf2, 5); + case cJ1_JPIMMED_2_06: SM1IMM(j__udySearchLeaf2, 6); + case cJ1_JPIMMED_2_07: SM1IMM(j__udySearchLeaf2, 7); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: SM1IMM(j__udySearchLeaf3, 2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: SM1IMM(j__udySearchLeaf3, 3); + case cJ1_JPIMMED_3_04: SM1IMM(j__udySearchLeaf3, 4); + case cJ1_JPIMMED_3_05: SM1IMM(j__udySearchLeaf3, 5); + + case cJ1_JPIMMED_4_02: SM1IMM(j__udySearchLeaf4, 2); + case cJ1_JPIMMED_4_03: SM1IMM(j__udySearchLeaf4, 3); + + case cJ1_JPIMMED_5_02: SM1IMM(j__udySearchLeaf5, 2); + case cJ1_JPIMMED_5_03: SM1IMM(j__udySearchLeaf5, 3); + + case cJ1_JPIMMED_6_02: SM1IMM(j__udySearchLeaf6, 2); + + case cJ1_JPIMMED_7_02: SM1IMM(j__udySearchLeaf7, 2); +#endif + + +// ---------------------------------------------------------------------------- +// INVALID JP TYPE: + + default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // SM1Get switch. + + /*NOTREACHED*/ + + +// ============================================================================ +// STATE MACHINE 2 -- BACKTRACK BRANCH TO PREVIOUS JP: +// +// Look for the next-left/right JP in a branch, backing up the history list as +// necessary. Upon finding a next-left/right JP, modify the corresponding +// digit in *PIndex before passing control to SM3Findlimit. +// +// Note: As described earlier, only branch JPs are expected here; other types +// fall into the default case. +// +// Note: If a found JP contains needed Dcd bytes, thats OK, theyre copied to +// *PIndex in SM3Findlimit. +// +// TBD: This code has a lot in common with similar code in the shortcut cases +// in SM1Get. Can combine this code somehow? +// +// ENTRY: List, possibly empty, of JPs and offsets in APjphist[] and +// Aoffhist[]; see earlier comments. +// +// EXIT: Execute JU_RET_NOTFOUND if no previous/next JP; otherwise jump to +// SM3Findlimit to resume a new but different downward search. + +SM2Backtrack: // come or return here for first/next sideways search. + + HISTPOP(Pjp, offset); + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: + + case cJU_JPBRANCH_L2: state = 2; goto SM2BranchL; + case cJU_JPBRANCH_L3: state = 3; goto SM2BranchL; +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: state = 4; goto SM2BranchL; + case cJU_JPBRANCH_L5: state = 5; goto SM2BranchL; + case cJU_JPBRANCH_L6: state = 6; goto SM2BranchL; + case cJU_JPBRANCH_L7: state = 7; goto SM2BranchL; +#endif + case cJU_JPBRANCH_L: state = cJU_ROOTSTATE; goto SM2BranchL; + +SM2BranchL: +#ifdef JUDYPREV + if (--offset < 0) goto SM2Backtrack; // no next-left JP in BranchL. +#endif + Pjbl = P_JBL(Pjp->jp_Addr); +#ifdef JUDYNEXT + if (++offset >= (Pjbl->jbl_NumJPs)) goto SM2Backtrack; + // no next-right JP in BranchL. +#endif + +// Theres a next-left/right JP in the current BranchL; save its digit in +// *PIndex and continue with SM3Findlimit: + + JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: + + case cJU_JPBRANCH_B2: state = 2; goto SM2BranchB; + case cJU_JPBRANCH_B3: state = 3; goto SM2BranchB; +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: state = 4; goto SM2BranchB; + case cJU_JPBRANCH_B5: state = 5; goto SM2BranchB; + case cJU_JPBRANCH_B6: state = 6; goto SM2BranchB; + case cJU_JPBRANCH_B7: state = 7; goto SM2BranchB; +#endif + case cJU_JPBRANCH_B: state = cJU_ROOTSTATE; goto SM2BranchB; + +SM2BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + HISTPOPBOFF(subexp, offset, digit); // unpack values. + +// If theres a next-left/right JP in the current BranchB, which for +// Judy*Next() is true if any bits are set for higher Indexes, continue to +// SM3Findlimit: +// +// Note: offset is set to the JP previously traversed; go one to the +// left/right. + +#ifdef JUDYPREV + if (offset > 0) // next-left JP is in this subexpanse. + { + --offset; + goto SM2BranchBFindlimit; + } + + while (--subexp >= 0) // search next-left subexpanses. +#else + if (JU_JBB_BITMAP(Pjbb, subexp) + & JU_MASKHIGHEREXC(JU_BITPOSMASKB(digit))) + { + ++offset; // next-left => next-right. + goto SM2BranchBFindlimit; + } + + while (++subexp < cJU_NUMSUBEXPB) // search next-right subexps. +#endif + { + if (! JU_JBB_PJP(Pjbb, subexp)) continue; // empty subexpanse. + +#ifdef JUDYPREV + offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB)); +#else + offset = 0; +#endif + +// Save the next-left/right JPs digit in *PIndex: + +SM2BranchBFindlimit: + JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp), + offset); + JU_SETDIGIT(*PIndex, digit, state); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchB: + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: + + case cJU_JPBRANCH_U2: state = 2; goto SM2BranchU; + case cJU_JPBRANCH_U3: state = 3; goto SM2BranchU; +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: state = 4; goto SM2BranchU; + case cJU_JPBRANCH_U5: state = 5; goto SM2BranchU; + case cJU_JPBRANCH_U6: state = 6; goto SM2BranchU; + case cJU_JPBRANCH_U7: state = 7; goto SM2BranchU; +#endif + case cJU_JPBRANCH_U: state = cJU_ROOTSTATE; goto SM2BranchU; + +SM2BranchU: + +// Search for a next-left/right JP in the current BranchU, and if one is found, +// save its digit in *PIndex and continue to SM3Findlimit: + + Pjbu = P_JBU(Pjp->jp_Addr); + digit = offset; + +#ifdef JUDYPREV + while (digit >= 1) + { + Pjp = (Pjbu->jbu_jp) + (--digit); +#else + while (digit < cJU_BRANCHUNUMJPS - 1) + { + Pjp = (Pjbu->jbu_jp) + (++digit); +#endif + if (JPNULL(JU_JPTYPE(Pjp))) continue; + + JU_SETDIGIT(*PIndex, digit, state); + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchU: + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// INVALID JP TYPE: + + default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // SM2Backtrack switch. + + /*NOTREACHED*/ + + +// ============================================================================ +// STATE MACHINE 3 -- FIND LIMIT JP/INDEX: +// +// Look for the highest/lowest (right/left-most) JP in each branch and the +// highest/lowest Index in a leaf or immediate, and return it. While +// traversing, modify appropriate digit(s) in *PIndex to reflect the path +// taken, including Dcd bytes in each JP (which could hold critical missing +// digits for skipped branches). +// +// ENTRY: Pjp set to a JP under which to find max/min JPs (if a branch JP) or +// a max/min Index and return (if a leaf or immediate JP). +// +// EXIT: Execute JU_RET_FOUND* upon reaching a leaf or immediate. Should be +// impossible to fail, unless the Judy array is corrupt. + +SM3Findlimit: // come or return here for first/next branch/leaf. + + switch (JU_JPTYPE(Pjp)) + { +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: +// +// Simply use the highest/lowest (right/left-most) JP in the BranchL, but first +// copy the Dcd bytes to *PIndex if there are any (only if state < +// cJU_ROOTSTATE - 1). + + case cJU_JPBRANCH_L2: SM3PREPB_DCD(2, SM3BranchL); +#ifndef JU_64BIT + case cJU_JPBRANCH_L3: SM3PREPB( 3, SM3BranchL); +#else + case cJU_JPBRANCH_L3: SM3PREPB_DCD(3, SM3BranchL); + case cJU_JPBRANCH_L4: SM3PREPB_DCD(4, SM3BranchL); + case cJU_JPBRANCH_L5: SM3PREPB_DCD(5, SM3BranchL); + case cJU_JPBRANCH_L6: SM3PREPB_DCD(6, SM3BranchL); + case cJU_JPBRANCH_L7: SM3PREPB( 7, SM3BranchL); +#endif + case cJU_JPBRANCH_L: SM3PREPB( cJU_ROOTSTATE, SM3BranchL); + +SM3BranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + +#ifdef JUDYPREV + if ((offset = (Pjbl->jbl_NumJPs) - 1) < 0) +#else + offset = 0; if ((Pjbl->jbl_NumJPs) == 0) +#endif + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: +// +// Look for the highest/lowest (right/left-most) non-null subexpanse, then use +// the highest/lowest JP in that subexpanse, but first copy Dcd bytes, if there +// are any (only if state < cJU_ROOTSTATE - 1), to *PIndex. + + case cJU_JPBRANCH_B2: SM3PREPB_DCD(2, SM3BranchB); +#ifndef JU_64BIT + case cJU_JPBRANCH_B3: SM3PREPB( 3, SM3BranchB); +#else + case cJU_JPBRANCH_B3: SM3PREPB_DCD(3, SM3BranchB); + case cJU_JPBRANCH_B4: SM3PREPB_DCD(4, SM3BranchB); + case cJU_JPBRANCH_B5: SM3PREPB_DCD(5, SM3BranchB); + case cJU_JPBRANCH_B6: SM3PREPB_DCD(6, SM3BranchB); + case cJU_JPBRANCH_B7: SM3PREPB( 7, SM3BranchB); +#endif + case cJU_JPBRANCH_B: SM3PREPB( cJU_ROOTSTATE, SM3BranchB); + +SM3BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); +#ifdef JUDYPREV + subexp = cJU_NUMSUBEXPB; + + while (! (JU_JBB_BITMAP(Pjbb, --subexp))) // find non-empty subexp. + { + if (subexp <= 0) // wholly empty bitmap. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + + offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB)); +#else + subexp = -1; + + while (! (JU_JBB_BITMAP(Pjbb, ++subexp))) // find non-empty subexp. + { + if (subexp >= cJU_NUMSUBEXPB - 1) // didnt find one. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + + offset = 0; +#endif + + JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp), offset); + JU_SETDIGIT(*PIndex, digit, state); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: +// +// Look for the highest/lowest (right/left-most) non-null JP, and use it, but +// first copy Dcd bytes to *PIndex if there are any (only if state < +// cJU_ROOTSTATE - 1). + + case cJU_JPBRANCH_U2: SM3PREPB_DCD(2, SM3BranchU); +#ifndef JU_64BIT + case cJU_JPBRANCH_U3: SM3PREPB( 3, SM3BranchU); +#else + case cJU_JPBRANCH_U3: SM3PREPB_DCD(3, SM3BranchU); + case cJU_JPBRANCH_U4: SM3PREPB_DCD(4, SM3BranchU); + case cJU_JPBRANCH_U5: SM3PREPB_DCD(5, SM3BranchU); + case cJU_JPBRANCH_U6: SM3PREPB_DCD(6, SM3BranchU); + case cJU_JPBRANCH_U7: SM3PREPB( 7, SM3BranchU); +#endif + case cJU_JPBRANCH_U: SM3PREPB( cJU_ROOTSTATE, SM3BranchU); + +SM3BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); +#ifdef JUDYPREV + digit = cJU_BRANCHUNUMJPS; + + while (digit >= 1) + { + Pjp = (Pjbu->jbu_jp) + (--digit); +#else + + for (digit = 0; digit < cJU_BRANCHUNUMJPS; ++digit) + { + Pjp = (Pjbu->jbu_jp) + digit; +#endif + if (JPNULL(JU_JPTYPE(Pjp))) continue; + + JU_SETDIGIT(*PIndex, digit, state); + goto SM3Findlimit; + } + +// No non-null JPs in BranchU: + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + +// ---------------------------------------------------------------------------- +// LINEAR LEAF: +// +// Simply use the highest/lowest (right/left-most) Index in the LeafL, but the +// details vary depending on leaf Index Size. First copy Dcd bytes, if there +// are any (only if state < cJU_ROOTSTATE - 1), to *PIndex. + +#define SM3LEAFLDCD(cState) \ + JU_SETDCD(*PIndex, Pjp, cState); \ + SM3LEAFLNODCD + +#ifdef JUDY1 +#define SM3LEAFL_SETPOP1 // not needed in any cases. +#else +#define SM3LEAFL_SETPOP1 pop1 = JU_JPLEAF_POP0(Pjp) + 1 +#endif + +#ifdef JUDYPREV +#define SM3LEAFLNODCD \ + Pjll = P_JLL(Pjp->jp_Addr); \ + SM3LEAFL_SETPOP1; \ + offset = JU_JPLEAF_POP0(Pjp); assert(offset >= 0) +#else +#define SM3LEAFLNODCD \ + Pjll = P_JLL(Pjp->jp_Addr); \ + SM3LEAFL_SETPOP1; \ + offset = 0; assert(JU_JPLEAF_POP0(Pjp) >= 0); +#endif + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: + + SM3LEAFLDCD(1); + JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]); + JU_RET_FOUND_LEAF1(Pjll, pop1, offset); +#endif + + case cJU_JPLEAF2: + + SM3LEAFLDCD(2); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF2(Pjll, pop1, offset); + +#ifndef JU_64BIT + case cJU_JPLEAF3: + { + Word_t lsb; + SM3LEAFLNODCD; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + +#else + case cJU_JPLEAF3: + { + Word_t lsb; + SM3LEAFLDCD(3); + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + + case cJU_JPLEAF4: + + SM3LEAFLDCD(4); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF4(Pjll, pop1, offset); + + case cJU_JPLEAF5: + { + Word_t lsb; + SM3LEAFLDCD(5); + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_LEAF5(Pjll, pop1, offset); + } + + case cJU_JPLEAF6: + { + Word_t lsb; + SM3LEAFLDCD(6); + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_LEAF6(Pjll, pop1, offset); + } + + case cJU_JPLEAF7: + { + Word_t lsb; + SM3LEAFLNODCD; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_LEAF7(Pjll, pop1, offset); + } +#endif + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF: +// +// Look for the highest/lowest (right/left-most) non-null subexpanse, then use +// the highest/lowest Index in that subexpanse, but first copy Dcd bytes +// (always present since state 1 < cJU_ROOTSTATE) to *PIndex. + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb; + + JU_SETDCD(*PIndex, Pjp, 1); + + Pjlb = P_JLB(Pjp->jp_Addr); +#ifdef JUDYPREV + subexp = cJU_NUMSUBEXPL; + + while (! JU_JLB_BITMAP(Pjlb, --subexp)) // find non-empty subexp. + { + if (subexp <= 0) // wholly empty bitmap. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + +// TBD: Might it be faster to just use a variant of BITMAPDIGIT*() that yields +// the digit for the right-most Index with a bit set? + + offset = SEARCHBITMAPMAXL(JU_JLB_BITMAP(Pjlb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPL)); +#else + subexp = -1; + + while (! JU_JLB_BITMAP(Pjlb, ++subexp)) // find non-empty subexp. + { + if (subexp >= cJU_NUMSUBEXPL - 1) // didnt find one. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + + offset = 0; +#endif + + JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset); + JU_SETDIGIT1(*PIndex, digit); + JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset); +// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset))); + + } // case cJU_JPLEAF_B1 + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// Copy Dcd bytes to *PIndex (always present since state 1 < cJU_ROOTSTATE), +// then set the highest/lowest possible digit as the LSB in *PIndex. + + case cJ1_JPFULLPOPU1: + + JU_SETDCD( *PIndex, Pjp, 1); +#ifdef JUDYPREV + JU_SETDIGIT1(*PIndex, cJU_BITSPERBITMAP - 1); +#else + JU_SETDIGIT1(*PIndex, 0); +#endif + JU_RET_FOUND_FULLPOPU1; +#endif // JUDY1 + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: +// +// Simply use the highest/lowest (right/left-most) Index in the Imm, but the +// details vary depending on leaf Index Size and pop1. Note: There are no Dcd +// bytes in an Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the +// least bytes of the immediate Index. + + case cJU_JPIMMED_1_01: SET_01(1); goto SM3Imm_01; + case cJU_JPIMMED_2_01: SET_01(2); goto SM3Imm_01; + case cJU_JPIMMED_3_01: SET_01(3); goto SM3Imm_01; +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: SET_01(4); goto SM3Imm_01; + case cJU_JPIMMED_5_01: SET_01(5); goto SM3Imm_01; + case cJU_JPIMMED_6_01: SET_01(6); goto SM3Imm_01; + case cJU_JPIMMED_7_01: SET_01(7); goto SM3Imm_01; +#endif +SM3Imm_01: JU_RET_FOUND_IMM_01(Pjp); + +#ifdef JUDYPREV +#define SM3IMM_OFFSET(cPop1) (cPop1) - 1 // highest. +#else +#define SM3IMM_OFFSET(cPop1) 0 // lowest. +#endif + +#define SM3IMM(cPop1,Next) \ + offset = SM3IMM_OFFSET(cPop1); \ + goto Next + + case cJU_JPIMMED_1_02: SM3IMM( 2, SM3Imm1); + case cJU_JPIMMED_1_03: SM3IMM( 3, SM3Imm1); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: SM3IMM( 4, SM3Imm1); + case cJU_JPIMMED_1_05: SM3IMM( 5, SM3Imm1); + case cJU_JPIMMED_1_06: SM3IMM( 6, SM3Imm1); + case cJU_JPIMMED_1_07: SM3IMM( 7, SM3Imm1); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: SM3IMM( 8, SM3Imm1); + case cJ1_JPIMMED_1_09: SM3IMM( 9, SM3Imm1); + case cJ1_JPIMMED_1_10: SM3IMM(10, SM3Imm1); + case cJ1_JPIMMED_1_11: SM3IMM(11, SM3Imm1); + case cJ1_JPIMMED_1_12: SM3IMM(12, SM3Imm1); + case cJ1_JPIMMED_1_13: SM3IMM(13, SM3Imm1); + case cJ1_JPIMMED_1_14: SM3IMM(14, SM3Imm1); + case cJ1_JPIMMED_1_15: SM3IMM(15, SM3Imm1); +#endif + +SM3Imm1: JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]); + JU_RET_FOUND_IMM(Pjp, offset); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: SM3IMM(2, SM3Imm2); + case cJU_JPIMMED_2_03: SM3IMM(3, SM3Imm2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: SM3IMM(4, SM3Imm2); + case cJ1_JPIMMED_2_05: SM3IMM(5, SM3Imm2); + case cJ1_JPIMMED_2_06: SM3IMM(6, SM3Imm2); + case cJ1_JPIMMED_2_07: SM3IMM(7, SM3Imm2); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) +SM3Imm2: *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: SM3IMM(2, SM3Imm3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: SM3IMM(3, SM3Imm3); + case cJ1_JPIMMED_3_04: SM3IMM(4, SM3Imm3); + case cJ1_JPIMMED_3_05: SM3IMM(5, SM3Imm3); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) +SM3Imm3: + { + Word_t lsb; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_4_02: SM3IMM(2, SM3Imm4); + case cJ1_JPIMMED_4_03: SM3IMM(3, SM3Imm4); + +SM3Imm4: *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); + + case cJ1_JPIMMED_5_02: SM3IMM(2, SM3Imm5); + case cJ1_JPIMMED_5_03: SM3IMM(3, SM3Imm5); + +SM3Imm5: + { + Word_t lsb; + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_6_02: SM3IMM(2, SM3Imm6); + +SM3Imm6: + { + Word_t lsb; + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_7_02: SM3IMM(2, SM3Imm7); + +SM3Imm7: + { + Word_t lsb; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif // (JUDY1 && JU_64BIT) + + +// ---------------------------------------------------------------------------- +// OTHER CASES: + + default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // SM3Findlimit switch. + + /*NOTREACHED*/ + +} // Judy1Prev() / Judy1Next() / JudyLPrev() / JudyLNext() diff --git a/libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c b/libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c new file mode 100644 index 000000000..4da43565d --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLNextEmpty.c @@ -0,0 +1,1390 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.32 $ $Source: /judy/src/JudyCommon/JudyPrevNextEmpty.c $ +// +// Judy*PrevEmpty() and Judy*NextEmpty() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// Compile with -DJUDYNEXT for the Judy*NextEmpty() function; otherwise +// defaults to Judy*PrevEmpty(). +// +// Compile with -DTRACEJPSE to trace JP traversals. +// +// This file is separate from JudyPrevNext.c because it differs too greatly for +// ifdefs. This might be a bit surprising, but there are two reasons: +// +// - First, down in the details, searching for an empty index (SearchEmpty) is +// remarkably asymmetric with searching for a valid index (SearchValid), +// mainly with respect to: No return of a value area for JudyL; partially- +// full versus totally-full JPs; and handling of narrow pointers. +// +// - Second, we chose to implement SearchEmpty without a backtrack stack or +// backtrack engine, partly as an experiment, and partly because we think +// restarting from the top of the tree is less likely for SearchEmpty than +// for SearchValid, because empty indexes are more likely than valid indexes. +// +// A word about naming: A prior version of this feature (see 4.13) was named +// Judy*Free(), but there were concerns about that being read as a verb rather +// than an adjective. After prolonged debate and based on user input, we +// changed "Free" to "Empty". + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifndef JUDYNEXT +#ifndef JUDYPREV +#define JUDYPREV 1 // neither set => use default. +#endif +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +#ifdef TRACEJPSE +#include "JudyPrintJP.c" +#endif + + +// **************************************************************************** +// J U D Y 1 P R E V E M P T Y +// J U D Y 1 N E X T E M P T Y +// J U D Y L P R E V E M P T Y +// J U D Y L N E X T E M P T Y +// +// See the manual entry for the API. +// +// OVERVIEW OF Judy*PrevEmpty() / Judy*NextEmpty(): +// +// See also for comparison the equivalent comments in JudyPrevNext.c. +// +// Take the callers *PIndex and subtract/add 1, but watch out for +// underflow/overflow, which means "no previous/next empty index found." Use a +// reentrant switch statement (state machine, see SMGetRestart and +// SMGetContinue) to decode Index, starting with the JRP (PArray), through a +// JPM and branches, if any, down to an immediate or a leaf. Look for Index in +// that immediate or leaf, and if not found (invalid index), return success +// (Index is empty). +// +// This search can result in a dead end where taking a different path is +// required. There are four kinds of dead ends: +// +// BRANCH PRIMARY dead end: Encountering a fully-populated JP for the +// appropriate digit in Index. Search sideways in the branch for the +// previous/next absent/null/non-full JP, and if one is found, set Index to the +// highest/lowest index possible in that JPs expanse. Then if the JP is an +// absent or null JP, return success; otherwise for a non-full JP, traverse +// through the partially populated JP. +// +// BRANCH SECONDARY dead end: Reaching the end of a branch during a sideways +// search after a branch primary dead end. Set Index to the lowest/highest +// index possible in the whole branchs expanse (one higher/lower than the +// previous/next branchs expanse), then restart at the top of the tree, which +// includes pre-decrementing/incrementing Index (again) and watching for +// underflow/overflow (again). +// +// LEAF PRIMARY dead end: Finding a valid (non-empty) index in an immediate or +// leaf matching Index. Search sideways in the immediate/leaf for the +// previous/next empty index; if found, set *PIndex to match and return success. +// +// LEAF SECONDARY dead end: Reaching the end of an immediate or leaf during a +// sideways search after a leaf primary dead end. Just as for a branch +// secondary dead end, restart at the top of the tree with Index set to the +// lowest/highest index possible in the whole immediate/leafs expanse. +// TBD: If leaf secondary dead end occurs, could shortcut and treat it as a +// branch primary dead end; but this would require remembering the parent +// branchs type and offset (a "one-deep stack"), and also wrestling with +// narrow pointers, at least for leaves (but not for immediates). +// +// Note some ASYMMETRIES between SearchValid and SearchEmpty: +// +// - The SearchValid code, upon descending through a narrow pointer, if Index +// is outside the expanse of the subsidiary node (effectively a secondary +// dead end), must decide whether to backtrack or findlimit. But the +// SearchEmpty code simply returns success (Index is empty). +// +// - Similarly, the SearchValid code, upon finding no previous/next index in +// the expanse of a narrow pointer (again, a secondary dead end), can simply +// start to backtrack at the parent JP. But the SearchEmpty code would have +// to first determine whether or not the parent JPs narrow expanse contains +// a previous/next empty index outside the subexpanse. Rather than keeping a +// parent state stack and backtracking this way, upon a secondary dead end, +// the SearchEmpty code simply restarts at the top of the tree, whether or +// not a narrow pointer is involved. Again, see the equivalent comments in +// JudyPrevNext.c for comparison. +// +// This function is written iteratively for speed, rather than recursively. +// +// TBD: Wed like to enhance this function to make successive searches faster. +// This would require saving some previous state, including the previous Index +// returned, and in which leaf it was found. If the next call is for the same +// Index and the array has not been modified, start at the same leaf. This +// should be much easier to implement since this is iterative rather than +// recursive code. + +#ifdef JUDY1 +#ifdef JUDYPREV +FUNCTION int Judy1PrevEmpty +#else +FUNCTION int Judy1NextEmpty +#endif +#else +#ifdef JUDYPREV +FUNCTION int JudyLPrevEmpty +#else +FUNCTION int JudyLNextEmpty +#endif +#endif + ( + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError // optional, for returning error info. + ) +{ + Word_t Index; // fast copy, in a register. + Pjp_t Pjp; // current JP. + Pjbl_t Pjbl; // Pjp->jp_Addr masked and cast to types: + Pjbb_t Pjbb; + Pjbu_t Pjbu; + Pjlb_t Pjlb; + PWord_t Pword; // alternate name for use by GET* macros. + + Word_t digit; // next digit to decode from Index. + Word_t digits; // current state in SM = digits left to decode. + Word_t pop0; // in a leaf. + Word_t pop0mask; // precalculated to avoid variable shifts. + long offset; // within a branch or leaf (can be large). + int subexp; // subexpanse in a bitmap branch. + BITMAPB_t bitposmaskB; // bit in bitmap for bitmap branch. + BITMAPL_t bitposmaskL; // bit in bitmap for bitmap leaf. + Word_t possfullJP1; // JP types for possibly full subexpanses: + Word_t possfullJP2; + Word_t possfullJP3; + + +// ---------------------------------------------------------------------------- +// M A C R O S +// +// These are intended to make the code a bit more readable and less redundant. + + +// CHECK FOR NULL JP: +// +// TBD: In principle this can be reduced (here and in other *.c files) to just +// the latter clause since no Type should ever be below cJU_JPNULL1, but in +// fact some root pointer types can be lower, so for safety do both checks. + +#define JPNULL(Type) (((Type) >= cJU_JPNULL1) && ((Type) <= cJU_JPNULLMAX)) + + +// CHECK FOR A FULL JP: +// +// Given a JP, indicate if it is fully populated. Use digits, pop0mask, and +// possfullJP1..3 in the context. +// +// This is a difficult problem because it requires checking the Pop0 bits for +// all-ones, but the number of bytes depends on the JP type, which is not +// directly related to the parent branchs type or level -- the JPs child +// could be under a narrow pointer (hence not full). The simple answer +// requires switching on or otherwise calculating the JP type, which could be +// slow. Instead, in SMPREPB* precalculate pop0mask and also record in +// possfullJP1..3 the child JP (branch) types that could possibly be full (one +// level down), and use them here. For level-2 branches (with digits == 2), +// the test for a full child depends on Judy1/JudyL. +// +// Note: This cannot be applied to the JP in a JPM because it doesnt have +// enough pop0 digits. +// +// TBD: JPFULL_BRANCH diligently checks for BranchL or BranchB, where neither +// of those can ever be full as it turns out. Could just check for a BranchU +// at the right level. Also, pop0mask might be overkill, its not used much, +// so perhaps just call cJU_POP0MASK(digits - 1) here? +// +// First, JPFULL_BRANCH checks for a full expanse for a JP whose child can be a +// branch, that is, a JP in a branch at level 3 or higher: + +#define JPFULL_BRANCH(Pjp) \ + ((((JU_JPDCDPOP0(Pjp) ^ cJU_ALLONES) & pop0mask) == 0) \ + && ((JU_JPTYPE(Pjp) == possfullJP1) \ + || (JU_JPTYPE(Pjp) == possfullJP2) \ + || (JU_JPTYPE(Pjp) == possfullJP3))) + +#ifdef JUDY1 +#define JPFULL(Pjp) \ + ((digits == 2) ? \ + (JU_JPTYPE(Pjp) == cJ1_JPFULLPOPU1) : JPFULL_BRANCH(Pjp)) +#else +#define JPFULL(Pjp) \ + ((digits == 2) ? \ + (JU_JPTYPE(Pjp) == cJU_JPLEAF_B1) \ + && (((JU_JPDCDPOP0(Pjp) & cJU_POP0MASK(1)) == cJU_POP0MASK(1))) : \ + JPFULL_BRANCH(Pjp)) +#endif + + +// RETURN SUCCESS: +// +// This hides the need to set *PIndex back to the local value of Index -- use a +// local value for faster operation. Note that the callers *PIndex is ALWAYS +// modified upon success, at least decremented/incremented. + +#define RET_SUCCESS { *PIndex = Index; return(1); } + + +// RETURN A CORRUPTION: + +#define RET_CORRUPT { JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); return(JERRI); } + + +// SEARCH A BITMAP BRANCH: +// +// This is a weak analog of j__udySearchLeaf*() for bitmap branches. Return +// the actual or next-left position, base 0, of Digit in a BITMAPB_t bitmap +// (subexpanse of a full bitmap), also given a Bitposmask for Digit. The +// position is the offset within the set bits. +// +// Unlike j__udySearchLeaf*(), the offset is not returned bit-complemented if +// Digits bit is unset, because the caller can check the bitmap themselves to +// determine that. Also, if Digits bit is unset, the returned offset is to +// the next-left JP or index (including -1), not to the "ideal" position for +// the index = next-right JP or index. +// +// Shortcut and skip calling j__udyCountBitsB() if the bitmap is full, in which +// case (Digit % cJU_BITSPERSUBEXPB) itself is the base-0 offset. + +#define SEARCHBITMAPB(Bitmap,Digit,Bitposmask) \ + (((Bitmap) == cJU_FULLBITMAPB) ? (Digit % cJU_BITSPERSUBEXPB) : \ + j__udyCountBitsB((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1) + +#ifdef JUDYPREV +// Equivalent to search for the highest offset in Bitmap, that is, one less +// than the number of bits set: + +#define SEARCHBITMAPMAXB(Bitmap) \ + (((Bitmap) == cJU_FULLBITMAPB) ? cJU_BITSPERSUBEXPB - 1 : \ + j__udyCountBitsB(Bitmap) - 1) +#endif + + +// CHECK DECODE BYTES: +// +// Check Decode bytes in a JP against the equivalent portion of Index. If they +// dont match, Index is outside the subexpanse of a narrow pointer, hence is +// empty. + +#define CHECKDCD(cDigits) \ + if (JU_DCDNOTMATCHINDEX(Index, Pjp, cDigits)) RET_SUCCESS + + +// REVISE REMAINDER OF INDEX: +// +// Put one digit in place in Index and clear/set the lower digits, if any, so +// the resulting Index is at the start/end of an expanse, or just clear/set the +// least digits. +// +// Actually, to make simple use of JU_LEASTBYTESMASK, first clear/set all least +// digits of Index including the digit to be overridden, then set the value of +// that one digit. If Digits == 1 the first operation is redundant, but either +// very fast or even removed by the optimizer. + +#define CLEARLEASTDIGITS(Digits) Index &= ~JU_LEASTBYTESMASK(Digits) +#define SETLEASTDIGITS( Digits) Index |= JU_LEASTBYTESMASK(Digits) + +#define CLEARLEASTDIGITS_D(Digit,Digits) \ + { \ + CLEARLEASTDIGITS(Digits); \ + JU_SETDIGIT(Index, Digit, Digits); \ + } + +#define SETLEASTDIGITS_D(Digit,Digits) \ + { \ + SETLEASTDIGITS(Digits); \ + JU_SETDIGIT(Index, Digit, Digits); \ + } + + +// SET REMAINDER OF INDEX AND THEN RETURN OR CONTINUE: + +#define SET_AND_RETURN(OpLeastDigits,Digit,Digits) \ + { \ + OpLeastDigits(Digit, Digits); \ + RET_SUCCESS; \ + } + +#define SET_AND_CONTINUE(OpLeastDigits,Digit,Digits) \ + { \ + OpLeastDigits(Digit, Digits); \ + goto SMGetContinue; \ + } + + +// PREPARE TO HANDLE A LEAFW OR JP BRANCH IN THE STATE MACHINE: +// +// Extract a state-dependent digit from Index in a "constant" way, then jump to +// common code for multiple cases. +// +// TBD: Should this macro do more, such as preparing variable-shift masks for +// use in CLEARLEASTDIGITS and SETLEASTDIGITS? + +#define SMPREPB(cDigits,Next,PossFullJP1,PossFullJP2,PossFullJP3) \ + digits = (cDigits); \ + digit = JU_DIGITATSTATE(Index, cDigits); \ + pop0mask = cJU_POP0MASK((cDigits) - 1); /* for branchs JPs */ \ + possfullJP1 = (PossFullJP1); \ + possfullJP2 = (PossFullJP2); \ + possfullJP3 = (PossFullJP3); \ + goto Next + +// Variations for specific-level branches and for shorthands: +// +// Note: SMPREPB2 need not initialize possfullJP* because JPFULL does not use +// them for digits == 2, but gcc -Wall isnt quite smart enough to see this, so +// waste a bit of time and space to get rid of the warning: + +#define SMPREPB2(Next) \ + digits = 2; \ + digit = JU_DIGITATSTATE(Index, 2); \ + pop0mask = cJU_POP0MASK(1); /* for branchs JPs */ \ + possfullJP1 = possfullJP2 = possfullJP3 = 0; \ + goto Next + +#define SMPREPB3(Next) SMPREPB(3, Next, cJU_JPBRANCH_L2, \ + cJU_JPBRANCH_B2, \ + cJU_JPBRANCH_U2) +#ifndef JU_64BIT +#define SMPREPBL(Next) SMPREPB(cJU_ROOTSTATE, Next, cJU_JPBRANCH_L3, \ + cJU_JPBRANCH_B3, \ + cJU_JPBRANCH_U3) +#else +#define SMPREPB4(Next) SMPREPB(4, Next, cJU_JPBRANCH_L3, \ + cJU_JPBRANCH_B3, \ + cJU_JPBRANCH_U3) +#define SMPREPB5(Next) SMPREPB(5, Next, cJU_JPBRANCH_L4, \ + cJU_JPBRANCH_B4, \ + cJU_JPBRANCH_U4) +#define SMPREPB6(Next) SMPREPB(6, Next, cJU_JPBRANCH_L5, \ + cJU_JPBRANCH_B5, \ + cJU_JPBRANCH_U5) +#define SMPREPB7(Next) SMPREPB(7, Next, cJU_JPBRANCH_L6, \ + cJU_JPBRANCH_B6, \ + cJU_JPBRANCH_U6) +#define SMPREPBL(Next) SMPREPB(cJU_ROOTSTATE, Next, cJU_JPBRANCH_L7, \ + cJU_JPBRANCH_B7, \ + cJU_JPBRANCH_U7) +#endif + + +// RESTART AFTER SECONDARY DEAD END: +// +// Set Index to the first/last index in the branch or leaf subexpanse and start +// over at the top of the tree. + +#ifdef JUDYPREV +#define SMRESTART(Digits) { CLEARLEASTDIGITS(Digits); goto SMGetRestart; } +#else +#define SMRESTART(Digits) { SETLEASTDIGITS( Digits); goto SMGetRestart; } +#endif + + +// CHECK EDGE OF LEAFS EXPANSE: +// +// Given the LSBs of the lowest/highest valid index in a leaf (or equivalently +// in an immediate JP), the level (index size) of the leaf, and the full index +// to return (as Index in the context) already set to the full index matching +// the lowest/highest one, determine if there is an empty index in the leafs +// expanse below/above the lowest/highest index, which is true if the +// lowest/highest index is not at the "edge" of the leafs expanse based on its +// LSBs. If so, return Index decremented/incremented; otherwise restart at the +// top of the tree. +// +// Note: In many cases Index is already at the right spot and calling +// SMRESTART instead of just going directly to SMGetRestart is a bit of +// overkill. +// +// Note: Variable shift occurs if Digits is not a constant. + +#ifdef JUDYPREV +#define LEAF_EDGE(MinIndex,Digits) \ + { \ + if (MinIndex) { --Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#else +#define LEAF_EDGE(MaxIndex,Digits) \ + { \ + if ((MaxIndex) != JU_LEASTBYTES(cJU_ALLONES, Digits)) \ + { ++Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#endif + +// Same as above except Index is not already set to match the lowest/highest +// index, so do that before decrementing/incrementing it: + +#ifdef JUDYPREV +#define LEAF_EDGE_SET(MinIndex,Digits) \ + { \ + if (MinIndex) \ + { JU_SETDIGITS(Index, MinIndex, Digits); --Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#else +#define LEAF_EDGE_SET(MaxIndex,Digits) \ + { \ + if ((MaxIndex) != JU_LEASTBYTES(cJU_ALLONES, Digits)) \ + { JU_SETDIGITS(Index, MaxIndex, Digits); ++Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#endif + + +// FIND A HOLE (EMPTY INDEX) IN AN IMMEDIATE OR LEAF: +// +// Given an index location in a leaf (or equivalently an immediate JP) known to +// contain a usable hole (an empty index less/greater than Index), and the LSBs +// of a minimum/maximum index to locate, find the previous/next empty index and +// return it. +// +// Note: "Even" index sizes (1,2,4[,8] bytes) have corresponding native C +// types; "odd" index sizes dont, but they are not represented here because +// they are handled completely differently; see elsewhere. + +#ifdef JUDYPREV + +#define LEAF_HOLE_EVEN(cDigits,Pjll,IndexLSB) \ + { \ + while (*(Pjll) > (IndexLSB)) --(Pjll); /* too high */ \ + if (*(Pjll) < (IndexLSB)) RET_SUCCESS /* Index is empty */ \ + while (*(--(Pjll)) == --(IndexLSB)) /* null, find a hole */;\ + JU_SETDIGITS(Index, IndexLSB, cDigits); \ + RET_SUCCESS; \ + } +#else +#define LEAF_HOLE_EVEN(cDigits,Pjll,IndexLSB) \ + { \ + while (*(Pjll) < (IndexLSB)) ++(Pjll); /* too low */ \ + if (*(Pjll) > (IndexLSB)) RET_SUCCESS /* Index is empty */ \ + while (*(++(Pjll)) == ++(IndexLSB)) /* null, find a hole */;\ + JU_SETDIGITS(Index, IndexLSB, cDigits); \ + RET_SUCCESS; \ + } +#endif + + +// SEARCH FOR AN EMPTY INDEX IN AN IMMEDIATE OR LEAF: +// +// Given a pointer to the first index in a leaf (or equivalently an immediate +// JP), the population of the leaf, and a first empty Index to find (inclusive, +// as Index in the context), where Index is known to fall within the expanse of +// the leaf to search, efficiently find the previous/next empty index in the +// leaf, if any. For simplicity the following overview is stated in terms of +// Judy*NextEmpty() only, but the same concepts apply symmetrically for +// Judy*PrevEmpty(). Also, in each case the comparisons are for the LSBs of +// Index and leaf indexes, according to the leafs level. +// +// 1. If Index is GREATER than the last (highest) index in the leaf +// (maxindex), return success, Index is empty. (Remember, Index is known +// to be in the leafs expanse.) +// +// 2. If Index is EQUAL to maxindex: If maxindex is not at the edge of the +// leafs expanse, increment Index and return success, there is an empty +// Index one higher than any in the leaf; otherwise restart with Index +// reset to the upper edge of the leafs expanse. Note: This might cause +// an extra cache line fill, but this is OK for repeatedly-called search +// code, and it saves CPU time. +// +// 3. If Index is LESS than maxindex, check for "dense to end of leaf": +// Subtract Index from maxindex, and back up that many slots in the leaf. +// If the resulting offset is not before the start of the leaf then compare +// the index at this offset (baseindex) with Index: +// +// 3a. If GREATER, the leaf must be corrupt, since indexes are sorted and +// there are no duplicates. +// +// 3b. If EQUAL, the leaf is "dense" from Index to maxindex, meaning there is +// no reason to search it. "Slide right" to the high end of the leaf +// (modify Index to maxindex) and continue with step 2 above. +// +// 3c. If LESS, continue with step 4. +// +// 4. If the offset based on maxindex minus Index falls BEFORE the start of +// the leaf, or if, per 3c above, baseindex is LESS than Index, the leaf is +// guaranteed "not dense to the end" and a usable empty Index must exist. +// This supports a more efficient search loop. Start at the FIRST index in +// the leaf, or one BEYOND baseindex, respectively, and search the leaf as +// follows, comparing each current index (currindex) with Index: +// +// 4a. If LESS, keep going to next index. Note: This is certain to terminate +// because maxindex is known to be greater than Index, hence the loop can +// be small and fast. +// +// 4b. If EQUAL, loop and increment Index until finding currindex greater than +// Index, and return success with the modified Index. +// +// 4c. If GREATER, return success, Index (unmodified) is empty. +// +// Note: These are macros rather than functions for speed. + +#ifdef JUDYPREV + +#define JSLE_EVEN(Addr,Pop0,cDigits,LeafType) \ + { \ + LeafType * PjllLSB = (LeafType *) (Addr); \ + LeafType IndexLSB = Index; /* auto-masking */ \ + \ + /* Index before or at start of leaf: */ \ + \ + if (*PjllLSB >= IndexLSB) /* no need to search */ \ + { \ + if (*PjllLSB > IndexLSB) RET_SUCCESS; /* Index empty */ \ + LEAF_EDGE(*PjllLSB, cDigits); \ + } \ + \ + /* Index in or after leaf: */ \ + \ + offset = IndexLSB - *PjllLSB; /* tentative offset */ \ + if (offset <= (Pop0)) /* can check density */ \ + { \ + PjllLSB += offset; /* move to slot */ \ + \ + if (*PjllLSB <= IndexLSB) /* dense or corrupt */ \ + { \ + if (*PjllLSB == IndexLSB) /* dense, check edge */ \ + LEAF_EDGE_SET(PjllLSB[-offset], cDigits); \ + RET_CORRUPT; \ + } \ + --PjllLSB; /* not dense, start at previous */ \ + } \ + else PjllLSB = ((LeafType *) (Addr)) + (Pop0); /* start at max */ \ + \ + LEAF_HOLE_EVEN(cDigits, PjllLSB, IndexLSB); \ + } + +// JSLE_ODD is completely different from JSLE_EVEN because its important to +// minimize copying odd indexes to compare them (see 4.14). Furthermore, a +// very complex version (4.17, but abandoned before fully debugged) that +// avoided calling j__udySearchLeaf*() ran twice as fast as 4.14, but still +// half as fast as SearchValid. Doug suggested that to minimize complexity and +// share common code we should use j__udySearchLeaf*() for the initial search +// to establish if Index is empty, which should be common. If Index is valid +// in a leaf or immediate indexes, odds are good that an empty Index is nearby, +// so for simplicity just use a *COPY* function to linearly search the +// remainder. +// +// TBD: Pathological case? Average performance should be good, but worst-case +// might suffer. When Search says the initial Index is valid, so a linear +// copy-and-compare is begun, if the caller builds fairly large leaves with +// dense clusters AND frequently does a SearchEmpty at one end of such a +// cluster, performance wont be very good. Might a dense-check help? This +// means checking offset against the index at offset, and then against the +// first/last index in the leaf. We doubt the pathological case will appear +// much in real applications because they will probably alternate SearchValid +// and SearchEmpty calls. + +#define JSLE_ODD(cDigits,Pjll,Pop0,Search,Copy) \ + { \ + Word_t IndexLSB; /* least bytes only */ \ + Word_t IndexFound; /* in leaf */ \ + \ + if ((offset = Search(Pjll, (Pop0) + 1, Index)) < 0) \ + RET_SUCCESS; /* Index is empty */ \ + \ + IndexLSB = JU_LEASTBYTES(Index, cDigits); \ + offset *= (cDigits); \ + \ + while ((offset -= (cDigits)) >= 0) \ + { /* skip until empty or start */ \ + Copy(IndexFound, ((uint8_t *) (Pjll)) + offset); \ + if (IndexFound != (--IndexLSB)) /* found an empty */ \ + { JU_SETDIGITS(Index, IndexLSB, cDigits); RET_SUCCESS; }\ + } \ + LEAF_EDGE_SET(IndexLSB, cDigits); \ + } + +#else // JUDYNEXT + +#define JSLE_EVEN(Addr,Pop0,cDigits,LeafType) \ + { \ + LeafType * PjllLSB = ((LeafType *) (Addr)) + (Pop0); \ + LeafType IndexLSB = Index; /* auto-masking */ \ + \ + /* Index at or after end of leaf: */ \ + \ + if (*PjllLSB <= IndexLSB) /* no need to search */ \ + { \ + if (*PjllLSB < IndexLSB) RET_SUCCESS; /* Index empty */\ + LEAF_EDGE(*PjllLSB, cDigits); \ + } \ + \ + /* Index before or in leaf: */ \ + \ + offset = *PjllLSB - IndexLSB; /* tentative offset */ \ + if (offset <= (Pop0)) /* can check density */ \ + { \ + PjllLSB -= offset; /* move to slot */ \ + \ + if (*PjllLSB >= IndexLSB) /* dense or corrupt */ \ + { \ + if (*PjllLSB == IndexLSB) /* dense, check edge */ \ + LEAF_EDGE_SET(PjllLSB[offset], cDigits); \ + RET_CORRUPT; \ + } \ + ++PjllLSB; /* not dense, start at next */ \ + } \ + else PjllLSB = (LeafType *) (Addr); /* start at minimum */ \ + \ + LEAF_HOLE_EVEN(cDigits, PjllLSB, IndexLSB); \ + } + +#define JSLE_ODD(cDigits,Pjll,Pop0,Search,Copy) \ + { \ + Word_t IndexLSB; /* least bytes only */ \ + Word_t IndexFound; /* in leaf */ \ + int offsetmax; /* in bytes */ \ + \ + if ((offset = Search(Pjll, (Pop0) + 1, Index)) < 0) \ + RET_SUCCESS; /* Index is empty */ \ + \ + IndexLSB = JU_LEASTBYTES(Index, cDigits); \ + offset *= (cDigits); \ + offsetmax = (Pop0) * (cDigits); /* single multiply */ \ + \ + while ((offset += (cDigits)) <= offsetmax) \ + { /* skip until empty or end */ \ + Copy(IndexFound, ((uint8_t *) (Pjll)) + offset); \ + if (IndexFound != (++IndexLSB)) /* found an empty */ \ + { JU_SETDIGITS(Index, IndexLSB, cDigits); RET_SUCCESS; } \ + } \ + LEAF_EDGE_SET(IndexLSB, cDigits); \ + } + +#endif // JUDYNEXT + +// Note: Immediate indexes never fill a single index group, so for odd index +// sizes, save time by calling JSLE_ODD_IMM instead of JSLE_ODD. + +#define j__udySearchLeafEmpty1(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 1, uint8_t) + +#define j__udySearchLeafEmpty2(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 2, uint16_t) + +#define j__udySearchLeafEmpty3(Addr,Pop0) \ + JSLE_ODD(3, Addr, Pop0, j__udySearchLeaf3, JU_COPY3_PINDEX_TO_LONG) + +#ifndef JU_64BIT + +#define j__udySearchLeafEmptyL(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 4, Word_t) + +#else + +#define j__udySearchLeafEmpty4(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 4, uint32_t) + +#define j__udySearchLeafEmpty5(Addr,Pop0) \ + JSLE_ODD(5, Addr, Pop0, j__udySearchLeaf5, JU_COPY5_PINDEX_TO_LONG) + +#define j__udySearchLeafEmpty6(Addr,Pop0) \ + JSLE_ODD(6, Addr, Pop0, j__udySearchLeaf6, JU_COPY6_PINDEX_TO_LONG) + +#define j__udySearchLeafEmpty7(Addr,Pop0) \ + JSLE_ODD(7, Addr, Pop0, j__udySearchLeaf7, JU_COPY7_PINDEX_TO_LONG) + +#define j__udySearchLeafEmptyL(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 8, Word_t) + +#endif // JU_64BIT + + +// ---------------------------------------------------------------------------- +// START OF CODE: +// +// CHECK FOR SHORTCUTS: +// +// Error out if PIndex is null. + + if (PIndex == (PWord_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + return(JERRI); + } + + Index = *PIndex; // fast local copy. + +// Set and pre-decrement/increment Index, watching for underflow/overflow: +// +// An out-of-bounds Index means failure: No previous/next empty index. + +SMGetRestart: // return here with revised Index. + +#ifdef JUDYPREV + if (Index-- == 0) return(0); +#else + if (++Index == 0) return(0); +#endif + +// An empty array with an in-bounds (not underflowed/overflowed) Index means +// success: +// +// Note: This check is redundant after restarting at SMGetRestart, but should +// take insignificant time. + + if (PArray == (Pvoid_t) NULL) RET_SUCCESS; + +// ---------------------------------------------------------------------------- +// ROOT-LEVEL LEAF that starts with a Pop0 word; just look within the leaf: +// +// If Index is not in the leaf, return success; otherwise return the first +// empty Index, if any, below/above where it would belong. + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + pop0 = Pjlw[0]; + +#ifdef JUDY1 + if (pop0 == 0) // special case. + { +#ifdef JUDYPREV + if ((Index != Pjlw[1]) || (Index-- != 0)) RET_SUCCESS; +#else + if ((Index != Pjlw[1]) || (++Index != 0)) RET_SUCCESS; +#endif + return(0); // no previous/next empty index. + } +#endif // JUDY1 + + j__udySearchLeafEmptyL(Pjlw + 1, pop0); + +// No return -- thanks ALAN + + } + else + +// ---------------------------------------------------------------------------- +// HANDLE JRP Branch: +// +// For JRP branches, traverse the JPM; handle LEAFW +// directly; but look for the most common cases first. + + { + Pjpm_t Pjpm = P_JPM(PArray); + Pjp = &(Pjpm->jpm_JP); + +// goto SMGetContinue; + } + + +// ============================================================================ +// STATE MACHINE -- GET INDEX: +// +// Search for Index (already decremented/incremented so as to be an inclusive +// search). If not found (empty index), return success. Otherwise do a +// previous/next search, and if successful modify Index to the empty index +// found. See function header comments. +// +// ENTRY: Pjp points to next JP to interpret, whose Decode bytes have not yet +// been checked. +// +// Note: Check Decode bytes at the start of each loop, not after looking up a +// new JP, so its easy to do constant shifts/masks. +// +// EXIT: Return, or branch to SMGetRestart with modified Index, or branch to +// SMGetContinue with a modified Pjp, as described elsewhere. +// +// WARNING: For run-time efficiency the following cases replicate code with +// varying constants, rather than using common code with variable values! + +SMGetContinue: // return here for next branch/leaf. + +#ifdef TRACEJPSE + JudyPrintJP(Pjp, "sf", __LINE__); +#endif + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in Index. + + case cJU_JPBRANCH_L2: CHECKDCD(2); SMPREPB2(SMBranchL); + case cJU_JPBRANCH_L3: CHECKDCD(3); SMPREPB3(SMBranchL); +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: CHECKDCD(4); SMPREPB4(SMBranchL); + case cJU_JPBRANCH_L5: CHECKDCD(5); SMPREPB5(SMBranchL); + case cJU_JPBRANCH_L6: CHECKDCD(6); SMPREPB6(SMBranchL); + case cJU_JPBRANCH_L7: CHECKDCD(7); SMPREPB7(SMBranchL); +#endif + case cJU_JPBRANCH_L: SMPREPBL(SMBranchL); + +// Common code (state-independent) for all cases of linear branches: + +SMBranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + +// First, check if Indexs expanse (digit) is below/above the first/last +// populated expanse in the BranchL, in which case Index is empty; otherwise +// find the offset of the lowest/highest populated expanse at or above/below +// digit, if any: +// +// Note: The for-loop is guaranteed to exit eventually because the first/last +// expanse is known to be a terminator. +// +// Note: Cannot use j__udySearchLeaf*Empty1() here because it only applies to +// leaves and does not know about partial versus full JPs, unlike the use of +// j__udySearchLeaf1() for BranchLs in SearchValid code. Also, since linear +// leaf expanse lists are small, dont waste time calling j__udySearchLeaf1(), +// just scan the expanse list. + +#ifdef JUDYPREV + if ((Pjbl->jbl_Expanse[0]) > digit) RET_SUCCESS; + + for (offset = (Pjbl->jbl_NumJPs) - 1; /* null */; --offset) +#else + if ((Pjbl->jbl_Expanse[(Pjbl->jbl_NumJPs) - 1]) < digit) + RET_SUCCESS; + + for (offset = 0; /* null */; ++offset) +#endif + { + +// Too low/high, keep going; or too high/low, meaning the loop passed a hole +// and the initial Index is empty: + +#ifdef JUDYPREV + if ((Pjbl->jbl_Expanse[offset]) > digit) continue; + if ((Pjbl->jbl_Expanse[offset]) < digit) RET_SUCCESS; +#else + if ((Pjbl->jbl_Expanse[offset]) < digit) continue; + if ((Pjbl->jbl_Expanse[offset]) > digit) RET_SUCCESS; +#endif + +// Found expanse matching digit; if its not full, traverse through it: + + if (! JPFULL((Pjbl->jbl_jp) + offset)) + { + Pjp = (Pjbl->jbl_jp) + offset; + goto SMGetContinue; + } + +// Common code: While searching for a lower/higher hole or a non-full JP, upon +// finding a lower/higher hole, adjust Index using the revised digit and +// return; or upon finding a consecutive lower/higher expanse, if the expanses +// JP is non-full, modify Index and traverse through the JP: + +#define BRANCHL_CHECK(OpIncDec,OpLeastDigits,Digit,Digits) \ + { \ + if ((Pjbl->jbl_Expanse[offset]) != OpIncDec digit) \ + SET_AND_RETURN(OpLeastDigits, Digit, Digits); \ + \ + if (! JPFULL((Pjbl->jbl_jp) + offset)) \ + { \ + Pjp = (Pjbl->jbl_jp) + offset; \ + SET_AND_CONTINUE(OpLeastDigits, Digit, Digits); \ + } \ + } + +// BranchL primary dead end: Expanse matching Index/digit is full (rare except +// for dense/sequential indexes): +// +// Search for a lower/higher hole, a non-full JP, or the end of the expanse +// list, while decrementing/incrementing digit. + +#ifdef JUDYPREV + while (--offset >= 0) + BRANCHL_CHECK(--, SETLEASTDIGITS_D, digit, digits) +#else + while (++offset < Pjbl->jbl_NumJPs) + BRANCHL_CHECK(++, CLEARLEASTDIGITS_D, digit, digits) +#endif + +// Passed end of BranchL expanse list after finding a matching but full +// expanse: +// +// Digit now matches the lowest/highest expanse, which is a full expanse; if +// digit is at the end of BranchLs expanse (no hole before/after), break out +// of the loop; otherwise modify Index to the next lower/higher digit and +// return success: + +#ifdef JUDYPREV + if (digit == 0) break; + --digit; SET_AND_RETURN(SETLEASTDIGITS_D, digit, digits); +#else + if (digit == JU_LEASTBYTES(cJU_ALLONES, 1)) break; + ++digit; SET_AND_RETURN(CLEARLEASTDIGITS_D, digit, digits); +#endif + } // for-loop + +// BranchL secondary dead end, no non-full previous/next JP: + + SMRESTART(digits); + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in Index. + + case cJU_JPBRANCH_B2: CHECKDCD(2); SMPREPB2(SMBranchB); + case cJU_JPBRANCH_B3: CHECKDCD(3); SMPREPB3(SMBranchB); +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: CHECKDCD(4); SMPREPB4(SMBranchB); + case cJU_JPBRANCH_B5: CHECKDCD(5); SMPREPB5(SMBranchB); + case cJU_JPBRANCH_B6: CHECKDCD(6); SMPREPB6(SMBranchB); + case cJU_JPBRANCH_B7: CHECKDCD(7); SMPREPB7(SMBranchB); +#endif + case cJU_JPBRANCH_B: SMPREPBL(SMBranchB); + +// Common code (state-independent) for all cases of bitmap branches: + +SMBranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + +// Locate the digits JP in the subexpanse list, if present: + + subexp = digit / cJU_BITSPERSUBEXPB; + assert(subexp < cJU_NUMSUBEXPB); // falls in expected range. + bitposmaskB = JU_BITPOSMASKB(digit); + +// Absent JP = no JP matches current digit in Index: + +// if (! JU_BITMAPTESTB(Pjbb, digit)) // slower. + if (! (JU_JBB_BITMAP(Pjbb, subexp) & bitposmaskB)) // faster. + RET_SUCCESS; + +// Non-full JP matches current digit in Index: +// +// Iterate to the subsidiary non-full JP. + + offset = SEARCHBITMAPB(JU_JBB_BITMAP(Pjbb, subexp), digit, + bitposmaskB); + // not negative since at least one bit is set: + assert(offset >= 0); + assert(offset < (int) cJU_BITSPERSUBEXPB); + +// Watch for null JP subarray pointer with non-null bitmap (a corruption): + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) + == (Pjp_t) NULL) RET_CORRUPT; + + Pjp += offset; + if (! JPFULL(Pjp)) goto SMGetContinue; + +// BranchB primary dead end: +// +// Upon hitting a full JP in a BranchB for the next digit in Index, search +// sideways for a previous/next absent JP (unset bit) or non-full JP (set bit +// with non-full JP); first in the current bitmap subexpanse, then in +// lower/higher subexpanses. Upon entry, Pjp points to a known-unusable JP, +// ready to decrement/increment. +// +// Note: The preceding code is separate from this loop because Index does not +// need revising (see SET_AND_*()) if the initial index is an empty index. +// +// TBD: For speed, shift bitposmaskB instead of using JU_BITMAPTESTB or +// JU_BITPOSMASKB, but this shift has knowledge of bit order that really should +// be encapsulated in a header file. + +#define BRANCHB_CHECKBIT(OpLeastDigits) \ + if (! (JU_JBB_BITMAP(Pjbb, subexp) & bitposmaskB)) /* absent JP */ \ + SET_AND_RETURN(OpLeastDigits, digit, digits) + +#define BRANCHB_CHECKJPFULL(OpLeastDigits) \ + if (! JPFULL(Pjp)) \ + SET_AND_CONTINUE(OpLeastDigits, digit, digits) + +#define BRANCHB_STARTSUBEXP(OpLeastDigits) \ + if (! JU_JBB_BITMAP(Pjbb, subexp)) /* empty subexpanse, shortcut */ \ + SET_AND_RETURN(OpLeastDigits, digit, digits) \ + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) RET_CORRUPT + +#ifdef JUDYPREV + + --digit; // skip initial digit. + bitposmaskB >>= 1; // see TBD above. + +BranchBNextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskB) // more bits to check in subexp. + { + BRANCHB_CHECKBIT(SETLEASTDIGITS_D); + --Pjp; // previous in subarray. + BRANCHB_CHECKJPFULL(SETLEASTDIGITS_D); + assert(digit >= 0); + --digit; + bitposmaskB >>= 1; + } + + if (subexp-- > 0) // more subexpanses. + { + BRANCHB_STARTSUBEXP(SETLEASTDIGITS_D); + Pjp += SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)) + 1; + bitposmaskB = (1U << (cJU_BITSPERSUBEXPB - 1)); + goto BranchBNextSubexp; + } + +#else // JUDYNEXT + + ++digit; // skip initial digit. + bitposmaskB <<= 1; // note: BITMAPB_t. + +BranchBNextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskB) // more bits to check in subexp. + { + BRANCHB_CHECKBIT(CLEARLEASTDIGITS_D); + ++Pjp; // previous in subarray. + BRANCHB_CHECKJPFULL(CLEARLEASTDIGITS_D); + assert(digit < cJU_SUBEXPPERSTATE); + ++digit; + bitposmaskB <<= 1; // note: BITMAPB_t. + } + + if (++subexp < cJU_NUMSUBEXPB) // more subexpanses. + { + BRANCHB_STARTSUBEXP(CLEARLEASTDIGITS_D); + --Pjp; // pre-decrement. + bitposmaskB = 1; + goto BranchBNextSubexp; + } + +#endif // JUDYNEXT + +// BranchB secondary dead end, no non-full previous/next JP: + + SMRESTART(digits); + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in Index. + + case cJU_JPBRANCH_U2: CHECKDCD(2); SMPREPB2(SMBranchU); + case cJU_JPBRANCH_U3: CHECKDCD(3); SMPREPB3(SMBranchU); +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: CHECKDCD(4); SMPREPB4(SMBranchU); + case cJU_JPBRANCH_U5: CHECKDCD(5); SMPREPB5(SMBranchU); + case cJU_JPBRANCH_U6: CHECKDCD(6); SMPREPB6(SMBranchU); + case cJU_JPBRANCH_U7: CHECKDCD(7); SMPREPB7(SMBranchU); +#endif + case cJU_JPBRANCH_U: SMPREPBL(SMBranchU); + +// Common code (state-independent) for all cases of uncompressed branches: + +SMBranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + Pjp = (Pjbu->jbu_jp) + digit; + +// Absent JP = null JP for current digit in Index: + + if (JPNULL(JU_JPTYPE(Pjp))) RET_SUCCESS; + +// Non-full JP matches current digit in Index: +// +// Iterate to the subsidiary JP. + + if (! JPFULL(Pjp)) goto SMGetContinue; + +// BranchU primary dead end: +// +// Upon hitting a full JP in a BranchU for the next digit in Index, search +// sideways for a previous/next null or non-full JP. BRANCHU_CHECKJP() is +// shorthand for common code. +// +// Note: The preceding code is separate from this loop because Index does not +// need revising (see SET_AND_*()) if the initial index is an empty index. + +#define BRANCHU_CHECKJP(OpIncDec,OpLeastDigits) \ + { \ + OpIncDec Pjp; \ + \ + if (JPNULL(JU_JPTYPE(Pjp))) \ + SET_AND_RETURN(OpLeastDigits, digit, digits) \ + \ + if (! JPFULL(Pjp)) \ + SET_AND_CONTINUE(OpLeastDigits, digit, digits) \ + } + +#ifdef JUDYPREV + while (digit-- > 0) + BRANCHU_CHECKJP(--, SETLEASTDIGITS_D); +#else + while (++digit < cJU_BRANCHUNUMJPS) + BRANCHU_CHECKJP(++, CLEARLEASTDIGITS_D); +#endif + +// BranchU secondary dead end, no non-full previous/next JP: + + SMRESTART(digits); + + +// ---------------------------------------------------------------------------- +// LINEAR LEAF: +// +// Check Decode bytes, if any, in the current JP, then search the leaf for the +// previous/next empty index starting at Index. Primary leaf dead end is +// hidden within j__udySearchLeaf*Empty*(). In case of secondary leaf dead +// end, restart at the top of the tree. +// +// Note: Pword is the name known to GET*; think of it as Pjlw. + +#define SMLEAFL(cDigits,Func) \ + Pword = (PWord_t) P_JLW(Pjp->jp_Addr); \ + pop0 = JU_JPLEAF_POP0(Pjp); \ + Func(Pword, pop0) + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: CHECKDCD(1); SMLEAFL(1, j__udySearchLeafEmpty1); +#endif + case cJU_JPLEAF2: CHECKDCD(2); SMLEAFL(2, j__udySearchLeafEmpty2); + case cJU_JPLEAF3: CHECKDCD(3); SMLEAFL(3, j__udySearchLeafEmpty3); + +#ifdef JU_64BIT + case cJU_JPLEAF4: CHECKDCD(4); SMLEAFL(4, j__udySearchLeafEmpty4); + case cJU_JPLEAF5: CHECKDCD(5); SMLEAFL(5, j__udySearchLeafEmpty5); + case cJU_JPLEAF6: CHECKDCD(6); SMLEAFL(6, j__udySearchLeafEmpty6); + case cJU_JPLEAF7: CHECKDCD(7); SMLEAFL(7, j__udySearchLeafEmpty7); +#endif + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF: +// +// Check Decode bytes, if any, in the current JP, then search the leaf for the +// previous/next empty index starting at Index. + + case cJU_JPLEAF_B1: + + CHECKDCD(1); + + Pjlb = P_JLB(Pjp->jp_Addr); + digit = JU_DIGITATSTATE(Index, 1); + subexp = digit / cJU_BITSPERSUBEXPL; + bitposmaskL = JU_BITPOSMASKL(digit); + assert(subexp < cJU_NUMSUBEXPL); // falls in expected range. + +// Absent index = no index matches current digit in Index: + +// if (! JU_BITMAPTESTL(Pjlb, digit)) // slower. + if (! (JU_JLB_BITMAP(Pjlb, subexp) & bitposmaskL)) // faster. + RET_SUCCESS; + +// LeafB1 primary dead end: +// +// Upon hitting a valid (non-empty) index in a LeafB1 for the last digit in +// Index, search sideways for a previous/next absent index, first in the +// current bitmap subexpanse, then in lower/higher subexpanses. +// LEAFB1_CHECKBIT() is shorthand for common code to handle one bit in one +// bitmap subexpanse. +// +// Note: The preceding code is separate from this loop because Index does not +// need revising (see SET_AND_*()) if the initial index is an empty index. +// +// TBD: For speed, shift bitposmaskL instead of using JU_BITMAPTESTL or +// JU_BITPOSMASKL, but this shift has knowledge of bit order that really should +// be encapsulated in a header file. + +#define LEAFB1_CHECKBIT(OpLeastDigits) \ + if (! (JU_JLB_BITMAP(Pjlb, subexp) & bitposmaskL)) \ + SET_AND_RETURN(OpLeastDigits, digit, 1) + +#define LEAFB1_STARTSUBEXP(OpLeastDigits) \ + if (! JU_JLB_BITMAP(Pjlb, subexp)) /* empty subexp */ \ + SET_AND_RETURN(OpLeastDigits, digit, 1) + +#ifdef JUDYPREV + + --digit; // skip initial digit. + bitposmaskL >>= 1; // see TBD above. + +LeafB1NextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskL) // more bits to check in subexp. + { + LEAFB1_CHECKBIT(SETLEASTDIGITS_D); + assert(digit >= 0); + --digit; + bitposmaskL >>= 1; + } + + if (subexp-- > 0) // more subexpanses. + { + LEAFB1_STARTSUBEXP(SETLEASTDIGITS_D); + bitposmaskL = (1UL << (cJU_BITSPERSUBEXPL - 1)); + goto LeafB1NextSubexp; + } + +#else // JUDYNEXT + + ++digit; // skip initial digit. + bitposmaskL <<= 1; // note: BITMAPL_t. + +LeafB1NextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskL) // more bits to check in subexp. + { + LEAFB1_CHECKBIT(CLEARLEASTDIGITS_D); + assert(digit < cJU_SUBEXPPERSTATE); + ++digit; + bitposmaskL <<= 1; // note: BITMAPL_t. + } + + if (++subexp < cJU_NUMSUBEXPL) // more subexpanses. + { + LEAFB1_STARTSUBEXP(CLEARLEASTDIGITS_D); + bitposmaskL = 1; + goto LeafB1NextSubexp; + } + +#endif // JUDYNEXT + +// LeafB1 secondary dead end, no empty index: + + SMRESTART(1); + + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// If the Decode bytes do not match, Index is empty (without modification); +// otherwise restart. + + case cJ1_JPFULLPOPU1: + + CHECKDCD(1); + SMRESTART(1); +#endif + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: +// +// Pop1 = 1 Immediate JPs: +// +// If Index is not in the immediate JP, return success; otherwise check if +// there is an empty index below/above the immediate JPs index, and if so, +// return success with modified Index, else restart. +// +// Note: Doug says its fast enough to calculate the index size (digits) in +// the following; no need to set it separately for each case. + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + if (JU_JPDCDPOP0(Pjp) != JU_TRIMTODCDSIZE(Index)) RET_SUCCESS; + digits = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_01 + 1; + LEAF_EDGE(JU_LEASTBYTES(JU_JPDCDPOP0(Pjp), digits), digits); + +// Immediate JPs with Pop1 > 1: + +#define IMM_MULTI(Func,BaseJPType) \ + JUDY1CODE(Pword = (PWord_t) (Pjp->jp_1Index);) \ + JUDYLCODE(Pword = (PWord_t) (Pjp->jp_LIndex);) \ + Func(Pword, JU_JPTYPE(Pjp) - (BaseJPType) + 1) + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: + case cJ1_JPIMMED_1_09: + case cJ1_JPIMMED_1_10: + case cJ1_JPIMMED_1_11: + case cJ1_JPIMMED_1_12: + case cJ1_JPIMMED_1_13: + case cJ1_JPIMMED_1_14: + case cJ1_JPIMMED_1_15: +#endif + IMM_MULTI(j__udySearchLeafEmpty1, cJU_JPIMMED_1_02); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: + case cJ1_JPIMMED_2_05: + case cJ1_JPIMMED_2_06: + case cJ1_JPIMMED_2_07: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + IMM_MULTI(j__udySearchLeafEmpty2, cJU_JPIMMED_2_02); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: + case cJ1_JPIMMED_3_04: + case cJ1_JPIMMED_3_05: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + IMM_MULTI(j__udySearchLeafEmpty3, cJU_JPIMMED_3_02); +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_4_02: + case cJ1_JPIMMED_4_03: + IMM_MULTI(j__udySearchLeafEmpty4, cJ1_JPIMMED_4_02); + + case cJ1_JPIMMED_5_02: + case cJ1_JPIMMED_5_03: + IMM_MULTI(j__udySearchLeafEmpty5, cJ1_JPIMMED_5_02); + + case cJ1_JPIMMED_6_02: + IMM_MULTI(j__udySearchLeafEmpty6, cJ1_JPIMMED_6_02); + + case cJ1_JPIMMED_7_02: + IMM_MULTI(j__udySearchLeafEmpty7, cJ1_JPIMMED_7_02); +#endif + + +// ---------------------------------------------------------------------------- +// INVALID JP TYPE: + + default: RET_CORRUPT; + + } // SMGet switch. + +} // Judy1PrevEmpty() / Judy1NextEmpty() / JudyLPrevEmpty() / JudyLNextEmpty() diff --git a/libnetdata/libjudy/src/JudyL/JudyLPrev.c b/libnetdata/libjudy/src/JudyL/JudyLPrev.c new file mode 100644 index 000000000..4bcdccf10 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLPrev.c @@ -0,0 +1,1890 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.54 $ $Source: /judy/src/JudyCommon/JudyPrevNext.c $ +// +// Judy*Prev() and Judy*Next() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// Compile with -DJUDYNEXT for the Judy*Next() function; otherwise defaults to +// Judy*Prev(). + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifndef JUDYNEXT +#ifndef JUDYPREV +#define JUDYPREV 1 // neither set => use default. +#endif +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + + +// **************************************************************************** +// J U D Y 1 P R E V +// J U D Y 1 N E X T +// J U D Y L P R E V +// J U D Y L N E X T +// +// See the manual entry for the API. +// +// OVERVIEW OF Judy*Prev(): +// +// Use a reentrant switch statement (state machine, SM1 = "get") to decode the +// callers *PIndex-1, starting with the (PArray), through branches, if +// any, down to an immediate or a leaf. Look for *PIndex-1 in that leaf, and +// if found, return it. +// +// A dead end is either a branch that does not contain a JP for the appropriate +// digit in *PIndex-1, or a leaf that does not contain the undecoded digits of +// *PIndex-1. Upon reaching a dead end, backtrack through the leaf/branches +// that were just traversed, using a list (history) of parent JPs that is built +// while going forward in SM1Get. Start with the current leaf or branch. In a +// backtracked leaf, look for an Index less than *PIndex-1. In each +// backtracked branch, look "sideways" for the next JP, if any, lower than the +// one for the digit (from *PIndex-1) that was previously decoded. While +// backtracking, if a leaf has no previous Index or a branch has no lower JP, +// go to its parent branch in turn. Upon reaching the JRP, return failure, "no +// previous Index". The backtrack process is sufficiently different from +// SM1Get to merit its own separate reentrant switch statement (SM2 = +// "backtrack"). +// +// While backtracking, upon finding a lower JP in a branch, there is certain to +// be a "prev" Index under that JP (unless the Judy array is corrupt). +// Traverse forward again, this time taking the last (highest, right-most) JP +// in each branch, and the last (highest) Index upon reaching an immediate or a +// leaf. This traversal is sufficiently different from SM1Get and SM2Backtrack +// to merit its own separate reentrant switch statement (SM3 = "findlimit"). +// +// "Decode" bytes in JPs complicate this process a little. In SM1Get, when a +// JP is a narrow pointer, that is, when states are skipped (so the skipped +// digits are stored in jp_DcdPopO), compare the relevant digits to the same +// digits in *PIndex-1. If they are EQUAL, proceed in SM1Get as before. If +// jp_DcdPopOs digits are GREATER, treat the JP as a dead end and proceed in +// SM2Backtrack. If jp_DcdPopOs digits are LESS, treat the JP as if it had +// just been found during a backtrack and proceed directly in SM3Findlimit. +// +// Note that Decode bytes can be ignored in SM3Findlimit; they dont matter. +// Also note that in practice the Decode bytes are routinely compared with +// *PIndex-1 because thats simpler and no slower than first testing for +// narrowness. +// +// Decode bytes also make it unnecessary to construct the Index to return (the +// revised *PIndex) during the search. This step is deferred until finding an +// Index during backtrack or findlimit, before returning it. The first digit +// of *PIndex is derived (saved) based on which JP is used in a JRP branch. +// The remaining digits are obtained from the jp_DcdPopO field in the JP (if +// any) above the immediate or leaf containing the found (prev) Index, plus the +// remaining digit(s) in the immediate or leaf itself. In the case of a LEAFW, +// the Index to return is found directly in the leaf. +// +// Note: Theoretically, as described above, upon reaching a dead end, SM1Get +// passes control to SM2Backtrack to look sideways, even in a leaf. Actually +// its a little more efficient for the SM1Get leaf cases to shortcut this and +// take care of the sideways searches themselves. Hence the history list only +// contains branch JPs, and SM2Backtrack only handles branches. In fact, even +// the branch handling cases in SM1Get do some shortcutting (sideways +// searching) to avoid pushing history and calling SM2Backtrack unnecessarily. +// +// Upon reaching an Index to return after backtracking, *PIndex must be +// modified to the found Index. In principle this could be done by building +// the Index from a saved rootdigit (in the top branch) plus the Dcd bytes from +// the parent JP plus the appropriate Index bytes from the leaf. However, +// Immediates are difficult because their parent JPs lack one (last) digit. So +// instead just build the *PIndex to return "top down" while backtracking and +// findlimiting. +// +// This function is written iteratively for speed, rather than recursively. +// +// CAVEATS: +// +// Why use a backtrack list (history stack), since it has finite size? The +// size is small for Judy on both 32-bit and 64-bit systems, and a list (really +// just an array) is fast to maintain and use. Other alternatives include +// doing a lookahead (lookaside) in each branch while traversing forward +// (decoding), and restarting from the top upon a dead end. +// +// A lookahead means noting the last branch traversed which contained a +// non-null JP lower than the one specified by a digit in *PIndex-1, and +// returning to that point for SM3Findlimit. This seems like a good idea, and +// should be pretty cheap for linear and bitmap branches, but it could result +// in up to 31 unnecessary additional cache line fills (in extreme cases) for +// every uncompressed branch traversed. We have considered means of attaching +// to or hiding within an uncompressed branch (in null JPs) a "cache line map" +// or other structure, such as an offset to the next non-null JP, that would +// speed this up, but it seems unnecessary merely to avoid having a +// finite-length list (array). (If JudySL is ever made "native", the finite +// list length will be an issue.) +// +// Restarting at the top of the Judy array after a dead end requires a careful +// modification of *PIndex-1 to decrement the digit for the parent branch and +// set the remaining lower digits to all 1s. This must be repeated each time a +// parent branch contains another dead end, so even though it should all happen +// in cache, the CPU time can be excessive. (For JudySL or an equivalent +// "infinitely deep" Judy array, consider a hybrid of a large, finite, +// "circular" list and a restart-at-top when the list is backtracked to +// exhaustion.) +// +// Why search for *PIndex-1 instead of *PIndex during SM1Get? In rare +// instances this prevents an unnecessary decode down the wrong path followed +// by a backtrack; its pretty cheap to set up initially; and it means the +// SM1Get machine can simply return if/when it finds that Index. +// +// TBD: Wed like to enhance this function to make successive searches faster. +// This would require saving some previous state, including the previous Index +// returned, and in which leaf it was found. If the next call is for the same +// Index and the array has not been modified, start at the same leaf. This +// should be much easier to implement since this is iterative rather than +// recursive code. +// +// VARIATIONS FOR Judy*Next(): +// +// The Judy*Next() code is nearly a perfect mirror of the Judy*Prev() code. +// See the Judy*Prev() overview comments, and mentally switch the following: +// +// - "*PIndex-1" => "*PIndex+1" +// - "less than" => "greater than" +// - "lower" => "higher" +// - "lowest" => "highest" +// - "next-left" => "next-right" +// - "right-most" => "left-most" +// +// Note: SM3Findlimit could be called SM3Findmax/SM3Findmin, but a common name +// for both Prev and Next means many fewer ifdefs in this code. +// +// TBD: Currently this code traverses a JP whether its expanse is partially or +// completely full (populated). For Judy1 (only), since there is no value area +// needed, consider shortcutting to a "success" return upon encountering a full +// JP in SM1Get (or even SM3Findlimit?) A full JP looks like this: +// +// (((JU_JPDCDPOP0(Pjp) ^ cJU_ALLONES) & cJU_POP0MASK(cLevel)) == 0) + +#ifdef JUDY1 +#ifdef JUDYPREV +FUNCTION int Judy1Prev +#else +FUNCTION int Judy1Next +#endif +#else +#ifdef JUDYPREV +FUNCTION PPvoid_t JudyLPrev +#else +FUNCTION PPvoid_t JudyLNext +#endif +#endif + ( + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError // optional, for returning error info. + ) +{ + Pjp_t Pjp, Pjp2; // current JPs. + Pjbl_t Pjbl; // Pjp->jp_Addr masked and cast to types: + Pjbb_t Pjbb; + Pjbu_t Pjbu; + +// Note: The following initialization is not strictly required but it makes +// gcc -Wall happy because there is an "impossible" path from Immed handling to +// SM1LeafLImm code that looks like Pjll might be used before set: + + Pjll_t Pjll = (Pjll_t) NULL; + Word_t state; // current state in SM. + Word_t digit; // next digit to decode from Index. + +// Note: The following initialization is not strictly required but it makes +// gcc -Wall happy because there is an "impossible" path from Immed handling to +// SM1LeafLImm code (for JudyL & JudyPrev only) that looks like pop1 might be +// used before set: + +#if (defined(JUDYL) && defined(JUDYPREV)) + Word_t pop1 = 0; // in a leaf. +#else + Word_t pop1; // in a leaf. +#endif + int offset; // linear branch/leaf, from j__udySearchLeaf*(). + int subexp; // subexpanse in a bitmap branch. + Word_t bitposmask; // bit in bitmap for Index. + +// History for SM2Backtrack: +// +// For a given histnum, APjphist[histnum] is a parent JP that points to a +// branch, and Aoffhist[histnum] is the offset of the NEXT JP in the branch to +// which the parent JP points. The meaning of Aoffhist[histnum] depends on the +// type of branch to which the parent JP points: +// +// Linear: Offset of the next JP in the JP list. +// +// Bitmap: Which subexpanse, plus the offset of the next JP in the +// subexpanses JP list (to avoid bit-counting again), plus for Judy*Next(), +// hidden one byte to the left, which digit, because Judy*Next() also needs +// this. +// +// Uncompressed: Digit, which is actually the offset of the JP in the branch. +// +// Note: Only branch JPs are stored in APjphist[] because, as explained +// earlier, SM1Get shortcuts sideways searches in leaves (and even in branches +// in some cases), so SM2Backtrack only handles branches. + +#define HISTNUMMAX cJU_ROOTSTATE // maximum branches traversable. + Pjp_t APjphist[HISTNUMMAX]; // list of branch JPs traversed. + int Aoffhist[HISTNUMMAX]; // list of next JP offsets; see above. + int histnum = 0; // number of JPs now in list. + + +// ---------------------------------------------------------------------------- +// M A C R O S +// +// These are intended to make the code a bit more readable and less redundant. + + +// "PUSH" AND "POP" Pjp AND offset ON HISTORY STACKS: +// +// Note: Ensure a corrupt Judy array does not overflow *hist[]. Meanwhile, +// underflowing *hist[] simply means theres no more room to backtrack => +// "no previous/next Index". + +#define HISTPUSH(Pjp,Offset) \ + APjphist[histnum] = (Pjp); \ + Aoffhist[histnum] = (Offset); \ + \ + if (++histnum >= HISTNUMMAX) \ + { \ + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT) \ + JUDY1CODE(return(JERRI );) \ + JUDYLCODE(return(PPJERR);) \ + } + +#define HISTPOP(Pjp,Offset) \ + if ((histnum--) < 1) JU_RET_NOTFOUND; \ + (Pjp) = APjphist[histnum]; \ + (Offset) = Aoffhist[histnum] + +// How to pack/unpack Aoffhist[] values for bitmap branches: + +#ifdef JUDYPREV + +#define HISTPUSHBOFF(Subexp,Offset,Digit) \ + (((Subexp) * cJU_BITSPERSUBEXPB) | (Offset)) + +#define HISTPOPBOFF(Subexp,Offset,Digit) \ + (Subexp) = (Offset) / cJU_BITSPERSUBEXPB; \ + (Offset) %= cJU_BITSPERSUBEXPB +#else + +#define HISTPUSHBOFF(Subexp,Offset,Digit) \ + (((Digit) << cJU_BITSPERBYTE) \ + | ((Subexp) * cJU_BITSPERSUBEXPB) | (Offset)) + +#define HISTPOPBOFF(Subexp,Offset,Digit) \ + (Digit) = (Offset) >> cJU_BITSPERBYTE; \ + (Subexp) = ((Offset) & JU_LEASTBYTESMASK(1)) / cJU_BITSPERSUBEXPB; \ + (Offset) %= cJU_BITSPERSUBEXPB +#endif + + +// CHECK FOR NULL JP: + +#define JPNULL(Type) (((Type) >= cJU_JPNULL1) && ((Type) <= cJU_JPNULLMAX)) + + +// SEARCH A BITMAP: +// +// This is a weak analog of j__udySearchLeaf*() for bitmaps. Return the actual +// or next-left position, base 0, of Digit in the single uint32_t bitmap, also +// given a Bitposmask for Digit. +// +// Unlike j__udySearchLeaf*(), the offset is not returned bit-complemented if +// Digits bit is unset, because the caller can check the bitmap themselves to +// determine that. Also, if Digits bit is unset, the returned offset is to +// the next-left JP (including -1), not to the "ideal" position for the Index = +// next-right JP. +// +// Shortcut and skip calling j__udyCountBits*() if the bitmap is full, in which +// case (Digit % cJU_BITSPERSUBEXP*) itself is the base-0 offset. +// +// TBD for Judy*Next(): Should this return next-right instead of next-left? +// That is, +1 from current value? Maybe not, if Digits bit IS set, +1 would +// be wrong. + +#define SEARCHBITMAPB(Bitmap,Digit,Bitposmask) \ + (((Bitmap) == cJU_FULLBITMAPB) ? (Digit % cJU_BITSPERSUBEXPB) : \ + j__udyCountBitsB((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1) + +#define SEARCHBITMAPL(Bitmap,Digit,Bitposmask) \ + (((Bitmap) == cJU_FULLBITMAPL) ? (Digit % cJU_BITSPERSUBEXPL) : \ + j__udyCountBitsL((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1) + +#ifdef JUDYPREV +// Equivalent to search for the highest offset in Bitmap: + +#define SEARCHBITMAPMAXB(Bitmap) \ + (((Bitmap) == cJU_FULLBITMAPB) ? cJU_BITSPERSUBEXPB - 1 : \ + j__udyCountBitsB(Bitmap) - 1) + +#define SEARCHBITMAPMAXL(Bitmap) \ + (((Bitmap) == cJU_FULLBITMAPL) ? cJU_BITSPERSUBEXPL - 1 : \ + j__udyCountBitsL(Bitmap) - 1) +#endif + + +// CHECK DECODE BYTES: +// +// Check Decode bytes in a JP against the equivalent portion of *PIndex. If +// *PIndex is lower (for Judy*Prev()) or higher (for Judy*Next()), this JP is a +// dead end (the same as if it had been absent in a linear or bitmap branch or +// null in an uncompressed branch), enter SM2Backtrack; otherwise enter +// SM3Findlimit to find the highest/lowest Index under this JP, as if the code +// had already backtracked to this JP. + +#ifdef JUDYPREV +#define CDcmp__ < +#else +#define CDcmp__ > +#endif + +#define CHECKDCD(cState) \ + if (JU_DCDNOTMATCHINDEX(*PIndex, Pjp, cState)) \ + { \ + if ((*PIndex & cJU_DCDMASK(cState)) \ + CDcmp__(JU_JPDCDPOP0(Pjp) & cJU_DCDMASK(cState))) \ + { \ + goto SM2Backtrack; \ + } \ + goto SM3Findlimit; \ + } + + +// PREPARE TO HANDLE A LEAFW OR JRP BRANCH IN SM1: +// +// Extract a state-dependent digit from Index in a "constant" way, then jump to +// common code for multiple cases. + +#define SM1PREPB(cState,Next) \ + state = (cState); \ + digit = JU_DIGITATSTATE(*PIndex, cState); \ + goto Next + + +// PREPARE TO HANDLE A LEAFW OR JRP BRANCH IN SM3: +// +// Optionally save Dcd bytes into *PIndex, then save state and jump to common +// code for multiple cases. + +#define SM3PREPB_DCD(cState,Next) \ + JU_SETDCD(*PIndex, Pjp, cState); \ + SM3PREPB(cState,Next) + +#define SM3PREPB(cState,Next) state = (cState); goto Next + + +// ---------------------------------------------------------------------------- +// CHECK FOR SHORTCUTS: +// +// Error out if PIndex is null. Execute JU_RET_NOTFOUND if the Judy array is +// empty or *PIndex is already the minimum/maximum Index possible. +// +// Note: As documented, in case of failure *PIndex may be modified. + + if (PIndex == (PWord_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + +#ifdef JUDYPREV + if ((PArray == (Pvoid_t) NULL) || ((*PIndex)-- == 0)) +#else + if ((PArray == (Pvoid_t) NULL) || ((*PIndex)++ == cJU_ALLONES)) +#endif + JU_RET_NOTFOUND; + + +// HANDLE JRP: +// +// Before even entering SM1Get, check the JRP type. For JRP branches, traverse +// the JPM; handle LEAFW leaves directly; but look for the most common cases +// first. + +// ROOT-STATE LEAF that starts with a Pop0 word; just look within the leaf: +// +// If *PIndex is in the leaf, return it; otherwise return the Index, if any, +// below where it would belong. + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + pop1 = Pjlw[0] + 1; + + if ((offset = j__udySearchLeafW(Pjlw + 1, pop1, *PIndex)) + >= 0) // Index is present. + { + assert(offset < pop1); // in expected range. + JU_RET_FOUND_LEAFW(Pjlw, pop1, offset); // *PIndex is set. + } + +#ifdef JUDYPREV + if ((offset = ~offset) == 0) // no next-left Index. +#else + if ((offset = ~offset) >= pop1) // no next-right Index. +#endif + JU_RET_NOTFOUND; + + assert(offset <= pop1); // valid result. + +#ifdef JUDYPREV + *PIndex = Pjlw[offset--]; // next-left Index, base 1. +#else + *PIndex = Pjlw[offset + 1]; // next-right Index, base 1. +#endif + JU_RET_FOUND_LEAFW(Pjlw, pop1, offset); // base 0. + + } + else // JRP BRANCH + { + Pjpm_t Pjpm = P_JPM(PArray); + Pjp = &(Pjpm->jpm_JP); + +// goto SM1Get; + } + +// ============================================================================ +// STATE MACHINE 1 -- GET INDEX: +// +// Search for *PIndex (already decremented/incremented so as to be inclusive). +// If found, return it. Otherwise in theory hand off to SM2Backtrack or +// SM3Findlimit, but in practice "shortcut" by first sideways searching the +// current branch or leaf upon hitting a dead end. During sideways search, +// modify *PIndex to a new path taken. +// +// ENTRY: Pjp points to next JP to interpret, whose Decode bytes have not yet +// been checked. This JP is not yet listed in history. +// +// Note: Check Decode bytes at the start of each loop, not after looking up a +// new JP, so its easy to do constant shifts/masks, although this requires +// cautious handling of Pjp, offset, and *hist[] for correct entry to +// SM2Backtrack. +// +// EXIT: Return, or branch to SM2Backtrack or SM3Findlimit with correct +// interface, as described elsewhere. +// +// WARNING: For run-time efficiency the following cases replicate code with +// varying constants, rather than using common code with variable values! + +SM1Get: // return here for next branch/leaf. + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in *PIndex. + + case cJU_JPBRANCH_L2: CHECKDCD(2); SM1PREPB(2, SM1BranchL); + case cJU_JPBRANCH_L3: CHECKDCD(3); SM1PREPB(3, SM1BranchL); +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: CHECKDCD(4); SM1PREPB(4, SM1BranchL); + case cJU_JPBRANCH_L5: CHECKDCD(5); SM1PREPB(5, SM1BranchL); + case cJU_JPBRANCH_L6: CHECKDCD(6); SM1PREPB(6, SM1BranchL); + case cJU_JPBRANCH_L7: CHECKDCD(7); SM1PREPB(7, SM1BranchL); +#endif + case cJU_JPBRANCH_L: SM1PREPB(cJU_ROOTSTATE, SM1BranchL); + +// Common code (state-independent) for all cases of linear branches: + +SM1BranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + +// Found JP matching current digit in *PIndex; record parent JP and the next +// JPs offset, and iterate to the next JP: + + if ((offset = j__udySearchLeaf1((Pjll_t) (Pjbl->jbl_Expanse), + Pjbl->jbl_NumJPs, digit)) >= 0) + { + HISTPUSH(Pjp, offset); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM1Get; + } + +// Dead end, no JP in BranchL for next digit in *PIndex: +// +// Get the ideal location of digits JP, and if theres no next-left/right JP +// in the BranchL, shortcut and start backtracking one level up; ignore the +// current Pjp because it points to a BranchL with no next-left/right JP. + +#ifdef JUDYPREV + if ((offset = (~offset) - 1) < 0) // no next-left JP in BranchL. +#else + if ((offset = (~offset)) >= Pjbl->jbl_NumJPs) // no next-right. +#endif + goto SM2Backtrack; + +// Theres a next-left/right JP in the current BranchL; save its digit in +// *PIndex and shortcut to SM3Findlimit: + + JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: +// +// Check Decode bytes, if any, in the current JP, then look for a JP for the +// next digit in *PIndex. + + case cJU_JPBRANCH_B2: CHECKDCD(2); SM1PREPB(2, SM1BranchB); + case cJU_JPBRANCH_B3: CHECKDCD(3); SM1PREPB(3, SM1BranchB); +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: CHECKDCD(4); SM1PREPB(4, SM1BranchB); + case cJU_JPBRANCH_B5: CHECKDCD(5); SM1PREPB(5, SM1BranchB); + case cJU_JPBRANCH_B6: CHECKDCD(6); SM1PREPB(6, SM1BranchB); + case cJU_JPBRANCH_B7: CHECKDCD(7); SM1PREPB(7, SM1BranchB); +#endif + case cJU_JPBRANCH_B: SM1PREPB(cJU_ROOTSTATE, SM1BranchB); + +// Common code (state-independent) for all cases of bitmap branches: + +SM1BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + +// Locate the digits JP in the subexpanse list, if present, otherwise the +// offset of the next-left JP, if any: + + subexp = digit / cJU_BITSPERSUBEXPB; + assert(subexp < cJU_NUMSUBEXPB); // falls in expected range. + bitposmask = JU_BITPOSMASKB(digit); + offset = SEARCHBITMAPB(JU_JBB_BITMAP(Pjbb, subexp), digit, + bitposmask); + // right range: + assert((offset >= -1) && (offset < (int) cJU_BITSPERSUBEXPB)); + +// Found JP matching current digit in *PIndex: +// +// Record the parent JP and the next JPs offset; and iterate to the next JP. + +// if (JU_BITMAPTESTB(Pjbb, digit)) // slower. + if (JU_JBB_BITMAP(Pjbb, subexp) & bitposmask) // faster. + { + // not negative since at least one bit is set: + assert(offset >= 0); + + HISTPUSH(Pjp, HISTPUSHBOFF(subexp, offset, digit)); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM1Get; // iterate to next JP. + } + +// Dead end, no JP in BranchB for next digit in *PIndex: +// +// If theres a next-left/right JP in the current BranchB, shortcut to +// SM3Findlimit. Note: offset is already set to the correct value for the +// next-left/right JP. + +#ifdef JUDYPREV + if (offset >= 0) // next-left JP is in this subexpanse. + goto SM1BranchBFindlimit; + + while (--subexp >= 0) // search next-left subexpanses. +#else + if (JU_JBB_BITMAP(Pjbb, subexp) & JU_MASKHIGHEREXC(bitposmask)) + { + ++offset; // next-left => next-right. + goto SM1BranchBFindlimit; + } + + while (++subexp < cJU_NUMSUBEXPB) // search next-right subexps. +#endif + { + if (! JU_JBB_PJP(Pjbb, subexp)) continue; // empty subexpanse. + +#ifdef JUDYPREV + offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB)); +#else + offset = 0; +#endif + +// Save the next-left/right JPs digit in *PIndex: + +SM1BranchBFindlimit: + JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp), + offset); + JU_SETDIGIT(*PIndex, digit, state); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchB: +// +// Shortcut and start backtracking one level up; ignore the current Pjp because +// it points to a BranchB with no next-left/right JP. + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: +// +// Check Decode bytes, if any, in the current JP, then look for a JP for the +// next digit in *PIndex. + + case cJU_JPBRANCH_U2: CHECKDCD(2); SM1PREPB(2, SM1BranchU); + case cJU_JPBRANCH_U3: CHECKDCD(3); SM1PREPB(3, SM1BranchU); +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: CHECKDCD(4); SM1PREPB(4, SM1BranchU); + case cJU_JPBRANCH_U5: CHECKDCD(5); SM1PREPB(5, SM1BranchU); + case cJU_JPBRANCH_U6: CHECKDCD(6); SM1PREPB(6, SM1BranchU); + case cJU_JPBRANCH_U7: CHECKDCD(7); SM1PREPB(7, SM1BranchU); +#endif + case cJU_JPBRANCH_U: SM1PREPB(cJU_ROOTSTATE, SM1BranchU); + +// Common code (state-independent) for all cases of uncompressed branches: + +SM1BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + Pjp2 = (Pjbu->jbu_jp) + digit; + +// Found JP matching current digit in *PIndex: +// +// Record the parent JP and the next JPs digit, and iterate to the next JP. +// +// TBD: Instead of this, just goto SM1Get, and add cJU_JPNULL* cases to the +// SM1Get state machine? Then backtrack? However, it means you cant detect +// an inappropriate cJU_JPNULL*, when it occurs in other than a BranchU, and +// return JU_RET_CORRUPT. + + if (! JPNULL(JU_JPTYPE(Pjp2))) // digit has a JP. + { + HISTPUSH(Pjp, digit); + Pjp = Pjp2; + goto SM1Get; + } + +// Dead end, no JP in BranchU for next digit in *PIndex: +// +// Search for a next-left/right JP in the current BranchU, and if one is found, +// save its digit in *PIndex and shortcut to SM3Findlimit: + +#ifdef JUDYPREV + while (digit >= 1) + { + Pjp = (Pjbu->jbu_jp) + (--digit); +#else + while (digit < cJU_BRANCHUNUMJPS - 1) + { + Pjp = (Pjbu->jbu_jp) + (++digit); +#endif + if (JPNULL(JU_JPTYPE(Pjp))) continue; + + JU_SETDIGIT(*PIndex, digit, state); + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchU: +// +// Shortcut and start backtracking one level up; ignore the current Pjp because +// it points to a BranchU with no next-left/right JP. + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// LINEAR LEAF: +// +// Check Decode bytes, if any, in the current JP, then search the leaf for +// *PIndex. + +#define SM1LEAFL(Func) \ + Pjll = P_JLL(Pjp->jp_Addr); \ + pop1 = JU_JPLEAF_POP0(Pjp) + 1; \ + offset = Func(Pjll, pop1, *PIndex); \ + goto SM1LeafLImm + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: CHECKDCD(1); SM1LEAFL(j__udySearchLeaf1); +#endif + case cJU_JPLEAF2: CHECKDCD(2); SM1LEAFL(j__udySearchLeaf2); + case cJU_JPLEAF3: CHECKDCD(3); SM1LEAFL(j__udySearchLeaf3); + +#ifdef JU_64BIT + case cJU_JPLEAF4: CHECKDCD(4); SM1LEAFL(j__udySearchLeaf4); + case cJU_JPLEAF5: CHECKDCD(5); SM1LEAFL(j__udySearchLeaf5); + case cJU_JPLEAF6: CHECKDCD(6); SM1LEAFL(j__udySearchLeaf6); + case cJU_JPLEAF7: CHECKDCD(7); SM1LEAFL(j__udySearchLeaf7); +#endif + +// Common code (state-independent) for all cases of linear leaves and +// immediates: + +SM1LeafLImm: + if (offset >= 0) // *PIndex is in LeafL / Immed. +#ifdef JUDY1 + JU_RET_FOUND; +#else + { // JudyL is trickier... + switch (JU_JPTYPE(Pjp)) + { +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: JU_RET_FOUND_LEAF1(Pjll, pop1, offset); +#endif + case cJU_JPLEAF2: JU_RET_FOUND_LEAF2(Pjll, pop1, offset); + case cJU_JPLEAF3: JU_RET_FOUND_LEAF3(Pjll, pop1, offset); +#ifdef JU_64BIT + case cJU_JPLEAF4: JU_RET_FOUND_LEAF4(Pjll, pop1, offset); + case cJU_JPLEAF5: JU_RET_FOUND_LEAF5(Pjll, pop1, offset); + case cJU_JPLEAF6: JU_RET_FOUND_LEAF6(Pjll, pop1, offset); + case cJU_JPLEAF7: JU_RET_FOUND_LEAF7(Pjll, pop1, offset); +#endif + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + JU_RET_FOUND_IMM_01(Pjp); + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#ifdef JU_64BIT + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: + case cJU_JPIMMED_3_02: +#endif + JU_RET_FOUND_IMM(Pjp, offset); + } + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // impossible? + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // found *PIndex + +#endif // JUDYL + +// Dead end, no Index in LeafL / Immed for remaining digit(s) in *PIndex: +// +// Get the ideal location of Index, and if theres no next-left/right Index in +// the LeafL / Immed, shortcut and start backtracking one level up; ignore the +// current Pjp because it points to a LeafL / Immed with no next-left/right +// Index. + +#ifdef JUDYPREV + if ((offset = (~offset) - 1) < 0) // no next-left Index. +#else + if ((offset = (~offset)) >= pop1) // no next-right Index. +#endif + goto SM2Backtrack; + +// Theres a next-left/right Index in the current LeafL / Immed; shortcut by +// copying its digit(s) to *PIndex and returning it. +// +// Unfortunately this is pretty hairy, especially avoiding endian issues. +// +// The cJU_JPLEAF* cases are very similar to same-index-size cJU_JPIMMED* cases +// for *_02 and above, but must return differently, at least for JudyL, so +// spell them out separately here at the cost of a little redundant code for +// Judy1. + + switch (JU_JPTYPE(Pjp)) + { +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: + + JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]); + JU_RET_FOUND_LEAF1(Pjll, pop1, offset); +#endif + + case cJU_JPLEAF2: + + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF2(Pjll, pop1, offset); + + case cJU_JPLEAF3: + { + Word_t lsb; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + +#ifdef JU_64BIT + case cJU_JPLEAF4: + + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF4(Pjll, pop1, offset); + + case cJU_JPLEAF5: + { + Word_t lsb; + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_LEAF5(Pjll, pop1, offset); + } + + case cJU_JPLEAF6: + { + Word_t lsb; + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_LEAF6(Pjll, pop1, offset); + } + + case cJU_JPLEAF7: + { + Word_t lsb; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_LEAF7(Pjll, pop1, offset); + } + +#endif // JU_64BIT + +#define SET_01(cState) JU_SETDIGITS(*PIndex, JU_JPDCDPOP0(Pjp), cState) + + case cJU_JPIMMED_1_01: SET_01(1); goto SM1Imm_01; + case cJU_JPIMMED_2_01: SET_01(2); goto SM1Imm_01; + case cJU_JPIMMED_3_01: SET_01(3); goto SM1Imm_01; +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: SET_01(4); goto SM1Imm_01; + case cJU_JPIMMED_5_01: SET_01(5); goto SM1Imm_01; + case cJU_JPIMMED_6_01: SET_01(6); goto SM1Imm_01; + case cJU_JPIMMED_7_01: SET_01(7); goto SM1Imm_01; +#endif +SM1Imm_01: JU_RET_FOUND_IMM_01(Pjp); + +// Shorthand for where to find start of Index bytes array: + +#ifdef JUDY1 +#define PJI (Pjp->jp_1Index) +#else +#define PJI (Pjp->jp_LIndex) +#endif + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: + case cJ1_JPIMMED_1_09: + case cJ1_JPIMMED_1_10: + case cJ1_JPIMMED_1_11: + case cJ1_JPIMMED_1_12: + case cJ1_JPIMMED_1_13: + case cJ1_JPIMMED_1_14: + case cJ1_JPIMMED_1_15: +#endif + JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]); + JU_RET_FOUND_IMM(Pjp, offset); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: + case cJ1_JPIMMED_2_05: + case cJ1_JPIMMED_2_06: + case cJ1_JPIMMED_2_07: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: + case cJ1_JPIMMED_3_04: + case cJ1_JPIMMED_3_05: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + { + Word_t lsb; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_4_02: + case cJ1_JPIMMED_4_03: + + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); + + case cJ1_JPIMMED_5_02: + case cJ1_JPIMMED_5_03: + { + Word_t lsb; + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_6_02: + { + Word_t lsb; + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_7_02: + { + Word_t lsb; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + +#endif // (JUDY1 && JU_64BIT) + + } // switch for not-found *PIndex + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); // impossible? + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF: +// +// Check Decode bytes, if any, in the current JP, then look in the leaf for +// *PIndex. + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb; + CHECKDCD(1); + + Pjlb = P_JLB(Pjp->jp_Addr); + digit = JU_DIGITATSTATE(*PIndex, 1); + subexp = JU_SUBEXPL(digit); + bitposmask = JU_BITPOSMASKL(digit); + assert(subexp < cJU_NUMSUBEXPL); // falls in expected range. + +// *PIndex exists in LeafB1: + +// if (JU_BITMAPTESTL(Pjlb, digit)) // slower. + if (JU_JLB_BITMAP(Pjlb, subexp) & bitposmask) // faster. + { +#ifdef JUDYL // needs offset at this point: + offset = SEARCHBITMAPL(JU_JLB_BITMAP(Pjlb, subexp), digit, bitposmask); +#endif + JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset); +// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset))); + } + +// Dead end, no Index in LeafB1 for remaining digit in *PIndex: +// +// If theres a next-left/right Index in the current LeafB1, which for +// Judy*Next() is true if any bits are set for higher Indexes, shortcut by +// returning it. Note: For Judy*Prev(), offset is set here to the correct +// value for the next-left JP. + + offset = SEARCHBITMAPL(JU_JLB_BITMAP(Pjlb, subexp), digit, + bitposmask); + // right range: + assert((offset >= -1) && (offset < (int) cJU_BITSPERSUBEXPL)); + +#ifdef JUDYPREV + if (offset >= 0) // next-left JP is in this subexpanse. + goto SM1LeafB1Findlimit; + + while (--subexp >= 0) // search next-left subexpanses. +#else + if (JU_JLB_BITMAP(Pjlb, subexp) & JU_MASKHIGHEREXC(bitposmask)) + { + ++offset; // next-left => next-right. + goto SM1LeafB1Findlimit; + } + + while (++subexp < cJU_NUMSUBEXPL) // search next-right subexps. +#endif + { + if (! JU_JLB_BITMAP(Pjlb, subexp)) continue; // empty subexp. + +#ifdef JUDYPREV + offset = SEARCHBITMAPMAXL(JU_JLB_BITMAP(Pjlb, subexp)); + // expected range: + assert((offset >= 0) && (offset < (int) cJU_BITSPERSUBEXPL)); +#else + offset = 0; +#endif + +// Save the next-left/right Indexess digit in *PIndex: + +SM1LeafB1Findlimit: + JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset); + JU_SETDIGIT1(*PIndex, digit); + JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset); +// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset))); + } + +// Theres no next-left/right Index in the LeafB1: +// +// Shortcut and start backtracking one level up; ignore the current Pjp because +// it points to a LeafB1 with no next-left/right Index. + + goto SM2Backtrack; + + } // case cJU_JPLEAF_B1 + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// If the Decode bytes match, *PIndex is found (without modification). + + case cJ1_JPFULLPOPU1: + + CHECKDCD(1); + JU_RET_FOUND_FULLPOPU1; +#endif + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: + +#ifdef JUDYPREV +#define SM1IMM_SETPOP1(cPop1) +#else +#define SM1IMM_SETPOP1(cPop1) pop1 = (cPop1) +#endif + +#define SM1IMM(Func,cPop1) \ + SM1IMM_SETPOP1(cPop1); \ + offset = Func((Pjll_t) (PJI), cPop1, *PIndex); \ + goto SM1LeafLImm + +// Special case for Pop1 = 1 Immediate JPs: +// +// If *PIndex is in the immediate, offset is 0, otherwise the binary NOT of the +// offset where it belongs, 0 or 1, same as from the search functions. + +#ifdef JUDYPREV +#define SM1IMM_01_SETPOP1 +#else +#define SM1IMM_01_SETPOP1 pop1 = 1 +#endif + +#define SM1IMM_01 \ + SM1IMM_01_SETPOP1; \ + offset = ((JU_JPDCDPOP0(Pjp) < JU_TRIMTODCDSIZE(*PIndex)) ? ~1 : \ + (JU_JPDCDPOP0(Pjp) == JU_TRIMTODCDSIZE(*PIndex)) ? 0 : \ + ~0); \ + goto SM1LeafLImm + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + SM1IMM_01; + +// TBD: Doug says it would be OK to have fewer calls and calculate arg 2, here +// and in Judy*Count() also. + + case cJU_JPIMMED_1_02: SM1IMM(j__udySearchLeaf1, 2); + case cJU_JPIMMED_1_03: SM1IMM(j__udySearchLeaf1, 3); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: SM1IMM(j__udySearchLeaf1, 4); + case cJU_JPIMMED_1_05: SM1IMM(j__udySearchLeaf1, 5); + case cJU_JPIMMED_1_06: SM1IMM(j__udySearchLeaf1, 6); + case cJU_JPIMMED_1_07: SM1IMM(j__udySearchLeaf1, 7); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: SM1IMM(j__udySearchLeaf1, 8); + case cJ1_JPIMMED_1_09: SM1IMM(j__udySearchLeaf1, 9); + case cJ1_JPIMMED_1_10: SM1IMM(j__udySearchLeaf1, 10); + case cJ1_JPIMMED_1_11: SM1IMM(j__udySearchLeaf1, 11); + case cJ1_JPIMMED_1_12: SM1IMM(j__udySearchLeaf1, 12); + case cJ1_JPIMMED_1_13: SM1IMM(j__udySearchLeaf1, 13); + case cJ1_JPIMMED_1_14: SM1IMM(j__udySearchLeaf1, 14); + case cJ1_JPIMMED_1_15: SM1IMM(j__udySearchLeaf1, 15); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: SM1IMM(j__udySearchLeaf2, 2); + case cJU_JPIMMED_2_03: SM1IMM(j__udySearchLeaf2, 3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: SM1IMM(j__udySearchLeaf2, 4); + case cJ1_JPIMMED_2_05: SM1IMM(j__udySearchLeaf2, 5); + case cJ1_JPIMMED_2_06: SM1IMM(j__udySearchLeaf2, 6); + case cJ1_JPIMMED_2_07: SM1IMM(j__udySearchLeaf2, 7); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: SM1IMM(j__udySearchLeaf3, 2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: SM1IMM(j__udySearchLeaf3, 3); + case cJ1_JPIMMED_3_04: SM1IMM(j__udySearchLeaf3, 4); + case cJ1_JPIMMED_3_05: SM1IMM(j__udySearchLeaf3, 5); + + case cJ1_JPIMMED_4_02: SM1IMM(j__udySearchLeaf4, 2); + case cJ1_JPIMMED_4_03: SM1IMM(j__udySearchLeaf4, 3); + + case cJ1_JPIMMED_5_02: SM1IMM(j__udySearchLeaf5, 2); + case cJ1_JPIMMED_5_03: SM1IMM(j__udySearchLeaf5, 3); + + case cJ1_JPIMMED_6_02: SM1IMM(j__udySearchLeaf6, 2); + + case cJ1_JPIMMED_7_02: SM1IMM(j__udySearchLeaf7, 2); +#endif + + +// ---------------------------------------------------------------------------- +// INVALID JP TYPE: + + default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // SM1Get switch. + + /*NOTREACHED*/ + + +// ============================================================================ +// STATE MACHINE 2 -- BACKTRACK BRANCH TO PREVIOUS JP: +// +// Look for the next-left/right JP in a branch, backing up the history list as +// necessary. Upon finding a next-left/right JP, modify the corresponding +// digit in *PIndex before passing control to SM3Findlimit. +// +// Note: As described earlier, only branch JPs are expected here; other types +// fall into the default case. +// +// Note: If a found JP contains needed Dcd bytes, thats OK, theyre copied to +// *PIndex in SM3Findlimit. +// +// TBD: This code has a lot in common with similar code in the shortcut cases +// in SM1Get. Can combine this code somehow? +// +// ENTRY: List, possibly empty, of JPs and offsets in APjphist[] and +// Aoffhist[]; see earlier comments. +// +// EXIT: Execute JU_RET_NOTFOUND if no previous/next JP; otherwise jump to +// SM3Findlimit to resume a new but different downward search. + +SM2Backtrack: // come or return here for first/next sideways search. + + HISTPOP(Pjp, offset); + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: + + case cJU_JPBRANCH_L2: state = 2; goto SM2BranchL; + case cJU_JPBRANCH_L3: state = 3; goto SM2BranchL; +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: state = 4; goto SM2BranchL; + case cJU_JPBRANCH_L5: state = 5; goto SM2BranchL; + case cJU_JPBRANCH_L6: state = 6; goto SM2BranchL; + case cJU_JPBRANCH_L7: state = 7; goto SM2BranchL; +#endif + case cJU_JPBRANCH_L: state = cJU_ROOTSTATE; goto SM2BranchL; + +SM2BranchL: +#ifdef JUDYPREV + if (--offset < 0) goto SM2Backtrack; // no next-left JP in BranchL. +#endif + Pjbl = P_JBL(Pjp->jp_Addr); +#ifdef JUDYNEXT + if (++offset >= (Pjbl->jbl_NumJPs)) goto SM2Backtrack; + // no next-right JP in BranchL. +#endif + +// Theres a next-left/right JP in the current BranchL; save its digit in +// *PIndex and continue with SM3Findlimit: + + JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: + + case cJU_JPBRANCH_B2: state = 2; goto SM2BranchB; + case cJU_JPBRANCH_B3: state = 3; goto SM2BranchB; +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: state = 4; goto SM2BranchB; + case cJU_JPBRANCH_B5: state = 5; goto SM2BranchB; + case cJU_JPBRANCH_B6: state = 6; goto SM2BranchB; + case cJU_JPBRANCH_B7: state = 7; goto SM2BranchB; +#endif + case cJU_JPBRANCH_B: state = cJU_ROOTSTATE; goto SM2BranchB; + +SM2BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + HISTPOPBOFF(subexp, offset, digit); // unpack values. + +// If theres a next-left/right JP in the current BranchB, which for +// Judy*Next() is true if any bits are set for higher Indexes, continue to +// SM3Findlimit: +// +// Note: offset is set to the JP previously traversed; go one to the +// left/right. + +#ifdef JUDYPREV + if (offset > 0) // next-left JP is in this subexpanse. + { + --offset; + goto SM2BranchBFindlimit; + } + + while (--subexp >= 0) // search next-left subexpanses. +#else + if (JU_JBB_BITMAP(Pjbb, subexp) + & JU_MASKHIGHEREXC(JU_BITPOSMASKB(digit))) + { + ++offset; // next-left => next-right. + goto SM2BranchBFindlimit; + } + + while (++subexp < cJU_NUMSUBEXPB) // search next-right subexps. +#endif + { + if (! JU_JBB_PJP(Pjbb, subexp)) continue; // empty subexpanse. + +#ifdef JUDYPREV + offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB)); +#else + offset = 0; +#endif + +// Save the next-left/right JPs digit in *PIndex: + +SM2BranchBFindlimit: + JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp), + offset); + JU_SETDIGIT(*PIndex, digit, state); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchB: + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: + + case cJU_JPBRANCH_U2: state = 2; goto SM2BranchU; + case cJU_JPBRANCH_U3: state = 3; goto SM2BranchU; +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: state = 4; goto SM2BranchU; + case cJU_JPBRANCH_U5: state = 5; goto SM2BranchU; + case cJU_JPBRANCH_U6: state = 6; goto SM2BranchU; + case cJU_JPBRANCH_U7: state = 7; goto SM2BranchU; +#endif + case cJU_JPBRANCH_U: state = cJU_ROOTSTATE; goto SM2BranchU; + +SM2BranchU: + +// Search for a next-left/right JP in the current BranchU, and if one is found, +// save its digit in *PIndex and continue to SM3Findlimit: + + Pjbu = P_JBU(Pjp->jp_Addr); + digit = offset; + +#ifdef JUDYPREV + while (digit >= 1) + { + Pjp = (Pjbu->jbu_jp) + (--digit); +#else + while (digit < cJU_BRANCHUNUMJPS - 1) + { + Pjp = (Pjbu->jbu_jp) + (++digit); +#endif + if (JPNULL(JU_JPTYPE(Pjp))) continue; + + JU_SETDIGIT(*PIndex, digit, state); + goto SM3Findlimit; + } + +// Theres no next-left/right JP in the BranchU: + + goto SM2Backtrack; + + +// ---------------------------------------------------------------------------- +// INVALID JP TYPE: + + default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // SM2Backtrack switch. + + /*NOTREACHED*/ + + +// ============================================================================ +// STATE MACHINE 3 -- FIND LIMIT JP/INDEX: +// +// Look for the highest/lowest (right/left-most) JP in each branch and the +// highest/lowest Index in a leaf or immediate, and return it. While +// traversing, modify appropriate digit(s) in *PIndex to reflect the path +// taken, including Dcd bytes in each JP (which could hold critical missing +// digits for skipped branches). +// +// ENTRY: Pjp set to a JP under which to find max/min JPs (if a branch JP) or +// a max/min Index and return (if a leaf or immediate JP). +// +// EXIT: Execute JU_RET_FOUND* upon reaching a leaf or immediate. Should be +// impossible to fail, unless the Judy array is corrupt. + +SM3Findlimit: // come or return here for first/next branch/leaf. + + switch (JU_JPTYPE(Pjp)) + { +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: +// +// Simply use the highest/lowest (right/left-most) JP in the BranchL, but first +// copy the Dcd bytes to *PIndex if there are any (only if state < +// cJU_ROOTSTATE - 1). + + case cJU_JPBRANCH_L2: SM3PREPB_DCD(2, SM3BranchL); +#ifndef JU_64BIT + case cJU_JPBRANCH_L3: SM3PREPB( 3, SM3BranchL); +#else + case cJU_JPBRANCH_L3: SM3PREPB_DCD(3, SM3BranchL); + case cJU_JPBRANCH_L4: SM3PREPB_DCD(4, SM3BranchL); + case cJU_JPBRANCH_L5: SM3PREPB_DCD(5, SM3BranchL); + case cJU_JPBRANCH_L6: SM3PREPB_DCD(6, SM3BranchL); + case cJU_JPBRANCH_L7: SM3PREPB( 7, SM3BranchL); +#endif + case cJU_JPBRANCH_L: SM3PREPB( cJU_ROOTSTATE, SM3BranchL); + +SM3BranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + +#ifdef JUDYPREV + if ((offset = (Pjbl->jbl_NumJPs) - 1) < 0) +#else + offset = 0; if ((Pjbl->jbl_NumJPs) == 0) +#endif + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + JU_SETDIGIT(*PIndex, Pjbl->jbl_Expanse[offset], state); + Pjp = (Pjbl->jbl_jp) + offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: +// +// Look for the highest/lowest (right/left-most) non-null subexpanse, then use +// the highest/lowest JP in that subexpanse, but first copy Dcd bytes, if there +// are any (only if state < cJU_ROOTSTATE - 1), to *PIndex. + + case cJU_JPBRANCH_B2: SM3PREPB_DCD(2, SM3BranchB); +#ifndef JU_64BIT + case cJU_JPBRANCH_B3: SM3PREPB( 3, SM3BranchB); +#else + case cJU_JPBRANCH_B3: SM3PREPB_DCD(3, SM3BranchB); + case cJU_JPBRANCH_B4: SM3PREPB_DCD(4, SM3BranchB); + case cJU_JPBRANCH_B5: SM3PREPB_DCD(5, SM3BranchB); + case cJU_JPBRANCH_B6: SM3PREPB_DCD(6, SM3BranchB); + case cJU_JPBRANCH_B7: SM3PREPB( 7, SM3BranchB); +#endif + case cJU_JPBRANCH_B: SM3PREPB( cJU_ROOTSTATE, SM3BranchB); + +SM3BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); +#ifdef JUDYPREV + subexp = cJU_NUMSUBEXPB; + + while (! (JU_JBB_BITMAP(Pjbb, --subexp))) // find non-empty subexp. + { + if (subexp <= 0) // wholly empty bitmap. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + + offset = SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPB)); +#else + subexp = -1; + + while (! (JU_JBB_BITMAP(Pjbb, ++subexp))) // find non-empty subexp. + { + if (subexp >= cJU_NUMSUBEXPB - 1) // didnt find one. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + + offset = 0; +#endif + + JU_BITMAPDIGITB(digit, subexp, JU_JBB_BITMAP(Pjbb, subexp), offset); + JU_SETDIGIT(*PIndex, digit, state); + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + + Pjp += offset; + goto SM3Findlimit; + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: +// +// Look for the highest/lowest (right/left-most) non-null JP, and use it, but +// first copy Dcd bytes to *PIndex if there are any (only if state < +// cJU_ROOTSTATE - 1). + + case cJU_JPBRANCH_U2: SM3PREPB_DCD(2, SM3BranchU); +#ifndef JU_64BIT + case cJU_JPBRANCH_U3: SM3PREPB( 3, SM3BranchU); +#else + case cJU_JPBRANCH_U3: SM3PREPB_DCD(3, SM3BranchU); + case cJU_JPBRANCH_U4: SM3PREPB_DCD(4, SM3BranchU); + case cJU_JPBRANCH_U5: SM3PREPB_DCD(5, SM3BranchU); + case cJU_JPBRANCH_U6: SM3PREPB_DCD(6, SM3BranchU); + case cJU_JPBRANCH_U7: SM3PREPB( 7, SM3BranchU); +#endif + case cJU_JPBRANCH_U: SM3PREPB( cJU_ROOTSTATE, SM3BranchU); + +SM3BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); +#ifdef JUDYPREV + digit = cJU_BRANCHUNUMJPS; + + while (digit >= 1) + { + Pjp = (Pjbu->jbu_jp) + (--digit); +#else + + for (digit = 0; digit < cJU_BRANCHUNUMJPS; ++digit) + { + Pjp = (Pjbu->jbu_jp) + digit; +#endif + if (JPNULL(JU_JPTYPE(Pjp))) continue; + + JU_SETDIGIT(*PIndex, digit, state); + goto SM3Findlimit; + } + +// No non-null JPs in BranchU: + + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + +// ---------------------------------------------------------------------------- +// LINEAR LEAF: +// +// Simply use the highest/lowest (right/left-most) Index in the LeafL, but the +// details vary depending on leaf Index Size. First copy Dcd bytes, if there +// are any (only if state < cJU_ROOTSTATE - 1), to *PIndex. + +#define SM3LEAFLDCD(cState) \ + JU_SETDCD(*PIndex, Pjp, cState); \ + SM3LEAFLNODCD + +#ifdef JUDY1 +#define SM3LEAFL_SETPOP1 // not needed in any cases. +#else +#define SM3LEAFL_SETPOP1 pop1 = JU_JPLEAF_POP0(Pjp) + 1 +#endif + +#ifdef JUDYPREV +#define SM3LEAFLNODCD \ + Pjll = P_JLL(Pjp->jp_Addr); \ + SM3LEAFL_SETPOP1; \ + offset = JU_JPLEAF_POP0(Pjp); assert(offset >= 0) +#else +#define SM3LEAFLNODCD \ + Pjll = P_JLL(Pjp->jp_Addr); \ + SM3LEAFL_SETPOP1; \ + offset = 0; assert(JU_JPLEAF_POP0(Pjp) >= 0); +#endif + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: + + SM3LEAFLDCD(1); + JU_SETDIGIT1(*PIndex, ((uint8_t *) Pjll)[offset]); + JU_RET_FOUND_LEAF1(Pjll, pop1, offset); +#endif + + case cJU_JPLEAF2: + + SM3LEAFLDCD(2); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF2(Pjll, pop1, offset); + +#ifndef JU_64BIT + case cJU_JPLEAF3: + { + Word_t lsb; + SM3LEAFLNODCD; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + +#else + case cJU_JPLEAF3: + { + Word_t lsb; + SM3LEAFLDCD(3); + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_LEAF3(Pjll, pop1, offset); + } + + case cJU_JPLEAF4: + + SM3LEAFLDCD(4); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) Pjll)[offset]; + JU_RET_FOUND_LEAF4(Pjll, pop1, offset); + + case cJU_JPLEAF5: + { + Word_t lsb; + SM3LEAFLDCD(5); + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_LEAF5(Pjll, pop1, offset); + } + + case cJU_JPLEAF6: + { + Word_t lsb; + SM3LEAFLDCD(6); + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_LEAF6(Pjll, pop1, offset); + } + + case cJU_JPLEAF7: + { + Word_t lsb; + SM3LEAFLNODCD; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) Pjll) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_LEAF7(Pjll, pop1, offset); + } +#endif + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF: +// +// Look for the highest/lowest (right/left-most) non-null subexpanse, then use +// the highest/lowest Index in that subexpanse, but first copy Dcd bytes +// (always present since state 1 < cJU_ROOTSTATE) to *PIndex. + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb; + + JU_SETDCD(*PIndex, Pjp, 1); + + Pjlb = P_JLB(Pjp->jp_Addr); +#ifdef JUDYPREV + subexp = cJU_NUMSUBEXPL; + + while (! JU_JLB_BITMAP(Pjlb, --subexp)) // find non-empty subexp. + { + if (subexp <= 0) // wholly empty bitmap. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + +// TBD: Might it be faster to just use a variant of BITMAPDIGIT*() that yields +// the digit for the right-most Index with a bit set? + + offset = SEARCHBITMAPMAXL(JU_JLB_BITMAP(Pjlb, subexp)); + // expected range: + assert((offset >= 0) && (offset < cJU_BITSPERSUBEXPL)); +#else + subexp = -1; + + while (! JU_JLB_BITMAP(Pjlb, ++subexp)) // find non-empty subexp. + { + if (subexp >= cJU_NUMSUBEXPL - 1) // didnt find one. + { + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + } + } + + offset = 0; +#endif + + JU_BITMAPDIGITL(digit, subexp, JU_JLB_BITMAP(Pjlb, subexp), offset); + JU_SETDIGIT1(*PIndex, digit); + JU_RET_FOUND_LEAF_B1(Pjlb, subexp, offset); +// == return((PPvoid_t) (P_JV(JL_JLB_PVALUE(Pjlb, subexp)) + (offset))); + + } // case cJU_JPLEAF_B1 + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// Copy Dcd bytes to *PIndex (always present since state 1 < cJU_ROOTSTATE), +// then set the highest/lowest possible digit as the LSB in *PIndex. + + case cJ1_JPFULLPOPU1: + + JU_SETDCD( *PIndex, Pjp, 1); +#ifdef JUDYPREV + JU_SETDIGIT1(*PIndex, cJU_BITSPERBITMAP - 1); +#else + JU_SETDIGIT1(*PIndex, 0); +#endif + JU_RET_FOUND_FULLPOPU1; +#endif // JUDY1 + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: +// +// Simply use the highest/lowest (right/left-most) Index in the Imm, but the +// details vary depending on leaf Index Size and pop1. Note: There are no Dcd +// bytes in an Immediate JP, but in a cJU_JPIMMED_*_01 JP, the field holds the +// least bytes of the immediate Index. + + case cJU_JPIMMED_1_01: SET_01(1); goto SM3Imm_01; + case cJU_JPIMMED_2_01: SET_01(2); goto SM3Imm_01; + case cJU_JPIMMED_3_01: SET_01(3); goto SM3Imm_01; +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: SET_01(4); goto SM3Imm_01; + case cJU_JPIMMED_5_01: SET_01(5); goto SM3Imm_01; + case cJU_JPIMMED_6_01: SET_01(6); goto SM3Imm_01; + case cJU_JPIMMED_7_01: SET_01(7); goto SM3Imm_01; +#endif +SM3Imm_01: JU_RET_FOUND_IMM_01(Pjp); + +#ifdef JUDYPREV +#define SM3IMM_OFFSET(cPop1) (cPop1) - 1 // highest. +#else +#define SM3IMM_OFFSET(cPop1) 0 // lowest. +#endif + +#define SM3IMM(cPop1,Next) \ + offset = SM3IMM_OFFSET(cPop1); \ + goto Next + + case cJU_JPIMMED_1_02: SM3IMM( 2, SM3Imm1); + case cJU_JPIMMED_1_03: SM3IMM( 3, SM3Imm1); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: SM3IMM( 4, SM3Imm1); + case cJU_JPIMMED_1_05: SM3IMM( 5, SM3Imm1); + case cJU_JPIMMED_1_06: SM3IMM( 6, SM3Imm1); + case cJU_JPIMMED_1_07: SM3IMM( 7, SM3Imm1); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: SM3IMM( 8, SM3Imm1); + case cJ1_JPIMMED_1_09: SM3IMM( 9, SM3Imm1); + case cJ1_JPIMMED_1_10: SM3IMM(10, SM3Imm1); + case cJ1_JPIMMED_1_11: SM3IMM(11, SM3Imm1); + case cJ1_JPIMMED_1_12: SM3IMM(12, SM3Imm1); + case cJ1_JPIMMED_1_13: SM3IMM(13, SM3Imm1); + case cJ1_JPIMMED_1_14: SM3IMM(14, SM3Imm1); + case cJ1_JPIMMED_1_15: SM3IMM(15, SM3Imm1); +#endif + +SM3Imm1: JU_SETDIGIT1(*PIndex, ((uint8_t *) PJI)[offset]); + JU_RET_FOUND_IMM(Pjp, offset); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: SM3IMM(2, SM3Imm2); + case cJU_JPIMMED_2_03: SM3IMM(3, SM3Imm2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: SM3IMM(4, SM3Imm2); + case cJ1_JPIMMED_2_05: SM3IMM(5, SM3Imm2); + case cJ1_JPIMMED_2_06: SM3IMM(6, SM3Imm2); + case cJ1_JPIMMED_2_07: SM3IMM(7, SM3Imm2); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) +SM3Imm2: *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(2))) + | ((uint16_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: SM3IMM(2, SM3Imm3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: SM3IMM(3, SM3Imm3); + case cJ1_JPIMMED_3_04: SM3IMM(4, SM3Imm3); + case cJ1_JPIMMED_3_05: SM3IMM(5, SM3Imm3); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) +SM3Imm3: + { + Word_t lsb; + JU_COPY3_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (3 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(3))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_4_02: SM3IMM(2, SM3Imm4); + case cJ1_JPIMMED_4_03: SM3IMM(3, SM3Imm4); + +SM3Imm4: *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(4))) + | ((uint32_t *) PJI)[offset]; + JU_RET_FOUND_IMM(Pjp, offset); + + case cJ1_JPIMMED_5_02: SM3IMM(2, SM3Imm5); + case cJ1_JPIMMED_5_03: SM3IMM(3, SM3Imm5); + +SM3Imm5: + { + Word_t lsb; + JU_COPY5_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (5 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(5))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_6_02: SM3IMM(2, SM3Imm6); + +SM3Imm6: + { + Word_t lsb; + JU_COPY6_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (6 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(6))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } + + case cJ1_JPIMMED_7_02: SM3IMM(2, SM3Imm7); + +SM3Imm7: + { + Word_t lsb; + JU_COPY7_PINDEX_TO_LONG(lsb, ((uint8_t *) PJI) + (7 * offset)); + *PIndex = (*PIndex & (~JU_LEASTBYTESMASK(7))) | lsb; + JU_RET_FOUND_IMM(Pjp, offset); + } +#endif // (JUDY1 && JU_64BIT) + + +// ---------------------------------------------------------------------------- +// OTHER CASES: + + default: JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // SM3Findlimit switch. + + /*NOTREACHED*/ + +} // Judy1Prev() / Judy1Next() / JudyLPrev() / JudyLNext() diff --git a/libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c b/libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c new file mode 100644 index 000000000..4da43565d --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLPrevEmpty.c @@ -0,0 +1,1390 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.32 $ $Source: /judy/src/JudyCommon/JudyPrevNextEmpty.c $ +// +// Judy*PrevEmpty() and Judy*NextEmpty() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. +// +// Compile with -DJUDYNEXT for the Judy*NextEmpty() function; otherwise +// defaults to Judy*PrevEmpty(). +// +// Compile with -DTRACEJPSE to trace JP traversals. +// +// This file is separate from JudyPrevNext.c because it differs too greatly for +// ifdefs. This might be a bit surprising, but there are two reasons: +// +// - First, down in the details, searching for an empty index (SearchEmpty) is +// remarkably asymmetric with searching for a valid index (SearchValid), +// mainly with respect to: No return of a value area for JudyL; partially- +// full versus totally-full JPs; and handling of narrow pointers. +// +// - Second, we chose to implement SearchEmpty without a backtrack stack or +// backtrack engine, partly as an experiment, and partly because we think +// restarting from the top of the tree is less likely for SearchEmpty than +// for SearchValid, because empty indexes are more likely than valid indexes. +// +// A word about naming: A prior version of this feature (see 4.13) was named +// Judy*Free(), but there were concerns about that being read as a verb rather +// than an adjective. After prolonged debate and based on user input, we +// changed "Free" to "Empty". + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifndef JUDYNEXT +#ifndef JUDYPREV +#define JUDYPREV 1 // neither set => use default. +#endif +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +#ifdef TRACEJPSE +#include "JudyPrintJP.c" +#endif + + +// **************************************************************************** +// J U D Y 1 P R E V E M P T Y +// J U D Y 1 N E X T E M P T Y +// J U D Y L P R E V E M P T Y +// J U D Y L N E X T E M P T Y +// +// See the manual entry for the API. +// +// OVERVIEW OF Judy*PrevEmpty() / Judy*NextEmpty(): +// +// See also for comparison the equivalent comments in JudyPrevNext.c. +// +// Take the callers *PIndex and subtract/add 1, but watch out for +// underflow/overflow, which means "no previous/next empty index found." Use a +// reentrant switch statement (state machine, see SMGetRestart and +// SMGetContinue) to decode Index, starting with the JRP (PArray), through a +// JPM and branches, if any, down to an immediate or a leaf. Look for Index in +// that immediate or leaf, and if not found (invalid index), return success +// (Index is empty). +// +// This search can result in a dead end where taking a different path is +// required. There are four kinds of dead ends: +// +// BRANCH PRIMARY dead end: Encountering a fully-populated JP for the +// appropriate digit in Index. Search sideways in the branch for the +// previous/next absent/null/non-full JP, and if one is found, set Index to the +// highest/lowest index possible in that JPs expanse. Then if the JP is an +// absent or null JP, return success; otherwise for a non-full JP, traverse +// through the partially populated JP. +// +// BRANCH SECONDARY dead end: Reaching the end of a branch during a sideways +// search after a branch primary dead end. Set Index to the lowest/highest +// index possible in the whole branchs expanse (one higher/lower than the +// previous/next branchs expanse), then restart at the top of the tree, which +// includes pre-decrementing/incrementing Index (again) and watching for +// underflow/overflow (again). +// +// LEAF PRIMARY dead end: Finding a valid (non-empty) index in an immediate or +// leaf matching Index. Search sideways in the immediate/leaf for the +// previous/next empty index; if found, set *PIndex to match and return success. +// +// LEAF SECONDARY dead end: Reaching the end of an immediate or leaf during a +// sideways search after a leaf primary dead end. Just as for a branch +// secondary dead end, restart at the top of the tree with Index set to the +// lowest/highest index possible in the whole immediate/leafs expanse. +// TBD: If leaf secondary dead end occurs, could shortcut and treat it as a +// branch primary dead end; but this would require remembering the parent +// branchs type and offset (a "one-deep stack"), and also wrestling with +// narrow pointers, at least for leaves (but not for immediates). +// +// Note some ASYMMETRIES between SearchValid and SearchEmpty: +// +// - The SearchValid code, upon descending through a narrow pointer, if Index +// is outside the expanse of the subsidiary node (effectively a secondary +// dead end), must decide whether to backtrack or findlimit. But the +// SearchEmpty code simply returns success (Index is empty). +// +// - Similarly, the SearchValid code, upon finding no previous/next index in +// the expanse of a narrow pointer (again, a secondary dead end), can simply +// start to backtrack at the parent JP. But the SearchEmpty code would have +// to first determine whether or not the parent JPs narrow expanse contains +// a previous/next empty index outside the subexpanse. Rather than keeping a +// parent state stack and backtracking this way, upon a secondary dead end, +// the SearchEmpty code simply restarts at the top of the tree, whether or +// not a narrow pointer is involved. Again, see the equivalent comments in +// JudyPrevNext.c for comparison. +// +// This function is written iteratively for speed, rather than recursively. +// +// TBD: Wed like to enhance this function to make successive searches faster. +// This would require saving some previous state, including the previous Index +// returned, and in which leaf it was found. If the next call is for the same +// Index and the array has not been modified, start at the same leaf. This +// should be much easier to implement since this is iterative rather than +// recursive code. + +#ifdef JUDY1 +#ifdef JUDYPREV +FUNCTION int Judy1PrevEmpty +#else +FUNCTION int Judy1NextEmpty +#endif +#else +#ifdef JUDYPREV +FUNCTION int JudyLPrevEmpty +#else +FUNCTION int JudyLNextEmpty +#endif +#endif + ( + Pcvoid_t PArray, // Judy array to search. + Word_t * PIndex, // starting point and result. + PJError_t PJError // optional, for returning error info. + ) +{ + Word_t Index; // fast copy, in a register. + Pjp_t Pjp; // current JP. + Pjbl_t Pjbl; // Pjp->jp_Addr masked and cast to types: + Pjbb_t Pjbb; + Pjbu_t Pjbu; + Pjlb_t Pjlb; + PWord_t Pword; // alternate name for use by GET* macros. + + Word_t digit; // next digit to decode from Index. + Word_t digits; // current state in SM = digits left to decode. + Word_t pop0; // in a leaf. + Word_t pop0mask; // precalculated to avoid variable shifts. + long offset; // within a branch or leaf (can be large). + int subexp; // subexpanse in a bitmap branch. + BITMAPB_t bitposmaskB; // bit in bitmap for bitmap branch. + BITMAPL_t bitposmaskL; // bit in bitmap for bitmap leaf. + Word_t possfullJP1; // JP types for possibly full subexpanses: + Word_t possfullJP2; + Word_t possfullJP3; + + +// ---------------------------------------------------------------------------- +// M A C R O S +// +// These are intended to make the code a bit more readable and less redundant. + + +// CHECK FOR NULL JP: +// +// TBD: In principle this can be reduced (here and in other *.c files) to just +// the latter clause since no Type should ever be below cJU_JPNULL1, but in +// fact some root pointer types can be lower, so for safety do both checks. + +#define JPNULL(Type) (((Type) >= cJU_JPNULL1) && ((Type) <= cJU_JPNULLMAX)) + + +// CHECK FOR A FULL JP: +// +// Given a JP, indicate if it is fully populated. Use digits, pop0mask, and +// possfullJP1..3 in the context. +// +// This is a difficult problem because it requires checking the Pop0 bits for +// all-ones, but the number of bytes depends on the JP type, which is not +// directly related to the parent branchs type or level -- the JPs child +// could be under a narrow pointer (hence not full). The simple answer +// requires switching on or otherwise calculating the JP type, which could be +// slow. Instead, in SMPREPB* precalculate pop0mask and also record in +// possfullJP1..3 the child JP (branch) types that could possibly be full (one +// level down), and use them here. For level-2 branches (with digits == 2), +// the test for a full child depends on Judy1/JudyL. +// +// Note: This cannot be applied to the JP in a JPM because it doesnt have +// enough pop0 digits. +// +// TBD: JPFULL_BRANCH diligently checks for BranchL or BranchB, where neither +// of those can ever be full as it turns out. Could just check for a BranchU +// at the right level. Also, pop0mask might be overkill, its not used much, +// so perhaps just call cJU_POP0MASK(digits - 1) here? +// +// First, JPFULL_BRANCH checks for a full expanse for a JP whose child can be a +// branch, that is, a JP in a branch at level 3 or higher: + +#define JPFULL_BRANCH(Pjp) \ + ((((JU_JPDCDPOP0(Pjp) ^ cJU_ALLONES) & pop0mask) == 0) \ + && ((JU_JPTYPE(Pjp) == possfullJP1) \ + || (JU_JPTYPE(Pjp) == possfullJP2) \ + || (JU_JPTYPE(Pjp) == possfullJP3))) + +#ifdef JUDY1 +#define JPFULL(Pjp) \ + ((digits == 2) ? \ + (JU_JPTYPE(Pjp) == cJ1_JPFULLPOPU1) : JPFULL_BRANCH(Pjp)) +#else +#define JPFULL(Pjp) \ + ((digits == 2) ? \ + (JU_JPTYPE(Pjp) == cJU_JPLEAF_B1) \ + && (((JU_JPDCDPOP0(Pjp) & cJU_POP0MASK(1)) == cJU_POP0MASK(1))) : \ + JPFULL_BRANCH(Pjp)) +#endif + + +// RETURN SUCCESS: +// +// This hides the need to set *PIndex back to the local value of Index -- use a +// local value for faster operation. Note that the callers *PIndex is ALWAYS +// modified upon success, at least decremented/incremented. + +#define RET_SUCCESS { *PIndex = Index; return(1); } + + +// RETURN A CORRUPTION: + +#define RET_CORRUPT { JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); return(JERRI); } + + +// SEARCH A BITMAP BRANCH: +// +// This is a weak analog of j__udySearchLeaf*() for bitmap branches. Return +// the actual or next-left position, base 0, of Digit in a BITMAPB_t bitmap +// (subexpanse of a full bitmap), also given a Bitposmask for Digit. The +// position is the offset within the set bits. +// +// Unlike j__udySearchLeaf*(), the offset is not returned bit-complemented if +// Digits bit is unset, because the caller can check the bitmap themselves to +// determine that. Also, if Digits bit is unset, the returned offset is to +// the next-left JP or index (including -1), not to the "ideal" position for +// the index = next-right JP or index. +// +// Shortcut and skip calling j__udyCountBitsB() if the bitmap is full, in which +// case (Digit % cJU_BITSPERSUBEXPB) itself is the base-0 offset. + +#define SEARCHBITMAPB(Bitmap,Digit,Bitposmask) \ + (((Bitmap) == cJU_FULLBITMAPB) ? (Digit % cJU_BITSPERSUBEXPB) : \ + j__udyCountBitsB((Bitmap) & JU_MASKLOWERINC(Bitposmask)) - 1) + +#ifdef JUDYPREV +// Equivalent to search for the highest offset in Bitmap, that is, one less +// than the number of bits set: + +#define SEARCHBITMAPMAXB(Bitmap) \ + (((Bitmap) == cJU_FULLBITMAPB) ? cJU_BITSPERSUBEXPB - 1 : \ + j__udyCountBitsB(Bitmap) - 1) +#endif + + +// CHECK DECODE BYTES: +// +// Check Decode bytes in a JP against the equivalent portion of Index. If they +// dont match, Index is outside the subexpanse of a narrow pointer, hence is +// empty. + +#define CHECKDCD(cDigits) \ + if (JU_DCDNOTMATCHINDEX(Index, Pjp, cDigits)) RET_SUCCESS + + +// REVISE REMAINDER OF INDEX: +// +// Put one digit in place in Index and clear/set the lower digits, if any, so +// the resulting Index is at the start/end of an expanse, or just clear/set the +// least digits. +// +// Actually, to make simple use of JU_LEASTBYTESMASK, first clear/set all least +// digits of Index including the digit to be overridden, then set the value of +// that one digit. If Digits == 1 the first operation is redundant, but either +// very fast or even removed by the optimizer. + +#define CLEARLEASTDIGITS(Digits) Index &= ~JU_LEASTBYTESMASK(Digits) +#define SETLEASTDIGITS( Digits) Index |= JU_LEASTBYTESMASK(Digits) + +#define CLEARLEASTDIGITS_D(Digit,Digits) \ + { \ + CLEARLEASTDIGITS(Digits); \ + JU_SETDIGIT(Index, Digit, Digits); \ + } + +#define SETLEASTDIGITS_D(Digit,Digits) \ + { \ + SETLEASTDIGITS(Digits); \ + JU_SETDIGIT(Index, Digit, Digits); \ + } + + +// SET REMAINDER OF INDEX AND THEN RETURN OR CONTINUE: + +#define SET_AND_RETURN(OpLeastDigits,Digit,Digits) \ + { \ + OpLeastDigits(Digit, Digits); \ + RET_SUCCESS; \ + } + +#define SET_AND_CONTINUE(OpLeastDigits,Digit,Digits) \ + { \ + OpLeastDigits(Digit, Digits); \ + goto SMGetContinue; \ + } + + +// PREPARE TO HANDLE A LEAFW OR JP BRANCH IN THE STATE MACHINE: +// +// Extract a state-dependent digit from Index in a "constant" way, then jump to +// common code for multiple cases. +// +// TBD: Should this macro do more, such as preparing variable-shift masks for +// use in CLEARLEASTDIGITS and SETLEASTDIGITS? + +#define SMPREPB(cDigits,Next,PossFullJP1,PossFullJP2,PossFullJP3) \ + digits = (cDigits); \ + digit = JU_DIGITATSTATE(Index, cDigits); \ + pop0mask = cJU_POP0MASK((cDigits) - 1); /* for branchs JPs */ \ + possfullJP1 = (PossFullJP1); \ + possfullJP2 = (PossFullJP2); \ + possfullJP3 = (PossFullJP3); \ + goto Next + +// Variations for specific-level branches and for shorthands: +// +// Note: SMPREPB2 need not initialize possfullJP* because JPFULL does not use +// them for digits == 2, but gcc -Wall isnt quite smart enough to see this, so +// waste a bit of time and space to get rid of the warning: + +#define SMPREPB2(Next) \ + digits = 2; \ + digit = JU_DIGITATSTATE(Index, 2); \ + pop0mask = cJU_POP0MASK(1); /* for branchs JPs */ \ + possfullJP1 = possfullJP2 = possfullJP3 = 0; \ + goto Next + +#define SMPREPB3(Next) SMPREPB(3, Next, cJU_JPBRANCH_L2, \ + cJU_JPBRANCH_B2, \ + cJU_JPBRANCH_U2) +#ifndef JU_64BIT +#define SMPREPBL(Next) SMPREPB(cJU_ROOTSTATE, Next, cJU_JPBRANCH_L3, \ + cJU_JPBRANCH_B3, \ + cJU_JPBRANCH_U3) +#else +#define SMPREPB4(Next) SMPREPB(4, Next, cJU_JPBRANCH_L3, \ + cJU_JPBRANCH_B3, \ + cJU_JPBRANCH_U3) +#define SMPREPB5(Next) SMPREPB(5, Next, cJU_JPBRANCH_L4, \ + cJU_JPBRANCH_B4, \ + cJU_JPBRANCH_U4) +#define SMPREPB6(Next) SMPREPB(6, Next, cJU_JPBRANCH_L5, \ + cJU_JPBRANCH_B5, \ + cJU_JPBRANCH_U5) +#define SMPREPB7(Next) SMPREPB(7, Next, cJU_JPBRANCH_L6, \ + cJU_JPBRANCH_B6, \ + cJU_JPBRANCH_U6) +#define SMPREPBL(Next) SMPREPB(cJU_ROOTSTATE, Next, cJU_JPBRANCH_L7, \ + cJU_JPBRANCH_B7, \ + cJU_JPBRANCH_U7) +#endif + + +// RESTART AFTER SECONDARY DEAD END: +// +// Set Index to the first/last index in the branch or leaf subexpanse and start +// over at the top of the tree. + +#ifdef JUDYPREV +#define SMRESTART(Digits) { CLEARLEASTDIGITS(Digits); goto SMGetRestart; } +#else +#define SMRESTART(Digits) { SETLEASTDIGITS( Digits); goto SMGetRestart; } +#endif + + +// CHECK EDGE OF LEAFS EXPANSE: +// +// Given the LSBs of the lowest/highest valid index in a leaf (or equivalently +// in an immediate JP), the level (index size) of the leaf, and the full index +// to return (as Index in the context) already set to the full index matching +// the lowest/highest one, determine if there is an empty index in the leafs +// expanse below/above the lowest/highest index, which is true if the +// lowest/highest index is not at the "edge" of the leafs expanse based on its +// LSBs. If so, return Index decremented/incremented; otherwise restart at the +// top of the tree. +// +// Note: In many cases Index is already at the right spot and calling +// SMRESTART instead of just going directly to SMGetRestart is a bit of +// overkill. +// +// Note: Variable shift occurs if Digits is not a constant. + +#ifdef JUDYPREV +#define LEAF_EDGE(MinIndex,Digits) \ + { \ + if (MinIndex) { --Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#else +#define LEAF_EDGE(MaxIndex,Digits) \ + { \ + if ((MaxIndex) != JU_LEASTBYTES(cJU_ALLONES, Digits)) \ + { ++Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#endif + +// Same as above except Index is not already set to match the lowest/highest +// index, so do that before decrementing/incrementing it: + +#ifdef JUDYPREV +#define LEAF_EDGE_SET(MinIndex,Digits) \ + { \ + if (MinIndex) \ + { JU_SETDIGITS(Index, MinIndex, Digits); --Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#else +#define LEAF_EDGE_SET(MaxIndex,Digits) \ + { \ + if ((MaxIndex) != JU_LEASTBYTES(cJU_ALLONES, Digits)) \ + { JU_SETDIGITS(Index, MaxIndex, Digits); ++Index; RET_SUCCESS; } \ + SMRESTART(Digits); \ + } +#endif + + +// FIND A HOLE (EMPTY INDEX) IN AN IMMEDIATE OR LEAF: +// +// Given an index location in a leaf (or equivalently an immediate JP) known to +// contain a usable hole (an empty index less/greater than Index), and the LSBs +// of a minimum/maximum index to locate, find the previous/next empty index and +// return it. +// +// Note: "Even" index sizes (1,2,4[,8] bytes) have corresponding native C +// types; "odd" index sizes dont, but they are not represented here because +// they are handled completely differently; see elsewhere. + +#ifdef JUDYPREV + +#define LEAF_HOLE_EVEN(cDigits,Pjll,IndexLSB) \ + { \ + while (*(Pjll) > (IndexLSB)) --(Pjll); /* too high */ \ + if (*(Pjll) < (IndexLSB)) RET_SUCCESS /* Index is empty */ \ + while (*(--(Pjll)) == --(IndexLSB)) /* null, find a hole */;\ + JU_SETDIGITS(Index, IndexLSB, cDigits); \ + RET_SUCCESS; \ + } +#else +#define LEAF_HOLE_EVEN(cDigits,Pjll,IndexLSB) \ + { \ + while (*(Pjll) < (IndexLSB)) ++(Pjll); /* too low */ \ + if (*(Pjll) > (IndexLSB)) RET_SUCCESS /* Index is empty */ \ + while (*(++(Pjll)) == ++(IndexLSB)) /* null, find a hole */;\ + JU_SETDIGITS(Index, IndexLSB, cDigits); \ + RET_SUCCESS; \ + } +#endif + + +// SEARCH FOR AN EMPTY INDEX IN AN IMMEDIATE OR LEAF: +// +// Given a pointer to the first index in a leaf (or equivalently an immediate +// JP), the population of the leaf, and a first empty Index to find (inclusive, +// as Index in the context), where Index is known to fall within the expanse of +// the leaf to search, efficiently find the previous/next empty index in the +// leaf, if any. For simplicity the following overview is stated in terms of +// Judy*NextEmpty() only, but the same concepts apply symmetrically for +// Judy*PrevEmpty(). Also, in each case the comparisons are for the LSBs of +// Index and leaf indexes, according to the leafs level. +// +// 1. If Index is GREATER than the last (highest) index in the leaf +// (maxindex), return success, Index is empty. (Remember, Index is known +// to be in the leafs expanse.) +// +// 2. If Index is EQUAL to maxindex: If maxindex is not at the edge of the +// leafs expanse, increment Index and return success, there is an empty +// Index one higher than any in the leaf; otherwise restart with Index +// reset to the upper edge of the leafs expanse. Note: This might cause +// an extra cache line fill, but this is OK for repeatedly-called search +// code, and it saves CPU time. +// +// 3. If Index is LESS than maxindex, check for "dense to end of leaf": +// Subtract Index from maxindex, and back up that many slots in the leaf. +// If the resulting offset is not before the start of the leaf then compare +// the index at this offset (baseindex) with Index: +// +// 3a. If GREATER, the leaf must be corrupt, since indexes are sorted and +// there are no duplicates. +// +// 3b. If EQUAL, the leaf is "dense" from Index to maxindex, meaning there is +// no reason to search it. "Slide right" to the high end of the leaf +// (modify Index to maxindex) and continue with step 2 above. +// +// 3c. If LESS, continue with step 4. +// +// 4. If the offset based on maxindex minus Index falls BEFORE the start of +// the leaf, or if, per 3c above, baseindex is LESS than Index, the leaf is +// guaranteed "not dense to the end" and a usable empty Index must exist. +// This supports a more efficient search loop. Start at the FIRST index in +// the leaf, or one BEYOND baseindex, respectively, and search the leaf as +// follows, comparing each current index (currindex) with Index: +// +// 4a. If LESS, keep going to next index. Note: This is certain to terminate +// because maxindex is known to be greater than Index, hence the loop can +// be small and fast. +// +// 4b. If EQUAL, loop and increment Index until finding currindex greater than +// Index, and return success with the modified Index. +// +// 4c. If GREATER, return success, Index (unmodified) is empty. +// +// Note: These are macros rather than functions for speed. + +#ifdef JUDYPREV + +#define JSLE_EVEN(Addr,Pop0,cDigits,LeafType) \ + { \ + LeafType * PjllLSB = (LeafType *) (Addr); \ + LeafType IndexLSB = Index; /* auto-masking */ \ + \ + /* Index before or at start of leaf: */ \ + \ + if (*PjllLSB >= IndexLSB) /* no need to search */ \ + { \ + if (*PjllLSB > IndexLSB) RET_SUCCESS; /* Index empty */ \ + LEAF_EDGE(*PjllLSB, cDigits); \ + } \ + \ + /* Index in or after leaf: */ \ + \ + offset = IndexLSB - *PjllLSB; /* tentative offset */ \ + if (offset <= (Pop0)) /* can check density */ \ + { \ + PjllLSB += offset; /* move to slot */ \ + \ + if (*PjllLSB <= IndexLSB) /* dense or corrupt */ \ + { \ + if (*PjllLSB == IndexLSB) /* dense, check edge */ \ + LEAF_EDGE_SET(PjllLSB[-offset], cDigits); \ + RET_CORRUPT; \ + } \ + --PjllLSB; /* not dense, start at previous */ \ + } \ + else PjllLSB = ((LeafType *) (Addr)) + (Pop0); /* start at max */ \ + \ + LEAF_HOLE_EVEN(cDigits, PjllLSB, IndexLSB); \ + } + +// JSLE_ODD is completely different from JSLE_EVEN because its important to +// minimize copying odd indexes to compare them (see 4.14). Furthermore, a +// very complex version (4.17, but abandoned before fully debugged) that +// avoided calling j__udySearchLeaf*() ran twice as fast as 4.14, but still +// half as fast as SearchValid. Doug suggested that to minimize complexity and +// share common code we should use j__udySearchLeaf*() for the initial search +// to establish if Index is empty, which should be common. If Index is valid +// in a leaf or immediate indexes, odds are good that an empty Index is nearby, +// so for simplicity just use a *COPY* function to linearly search the +// remainder. +// +// TBD: Pathological case? Average performance should be good, but worst-case +// might suffer. When Search says the initial Index is valid, so a linear +// copy-and-compare is begun, if the caller builds fairly large leaves with +// dense clusters AND frequently does a SearchEmpty at one end of such a +// cluster, performance wont be very good. Might a dense-check help? This +// means checking offset against the index at offset, and then against the +// first/last index in the leaf. We doubt the pathological case will appear +// much in real applications because they will probably alternate SearchValid +// and SearchEmpty calls. + +#define JSLE_ODD(cDigits,Pjll,Pop0,Search,Copy) \ + { \ + Word_t IndexLSB; /* least bytes only */ \ + Word_t IndexFound; /* in leaf */ \ + \ + if ((offset = Search(Pjll, (Pop0) + 1, Index)) < 0) \ + RET_SUCCESS; /* Index is empty */ \ + \ + IndexLSB = JU_LEASTBYTES(Index, cDigits); \ + offset *= (cDigits); \ + \ + while ((offset -= (cDigits)) >= 0) \ + { /* skip until empty or start */ \ + Copy(IndexFound, ((uint8_t *) (Pjll)) + offset); \ + if (IndexFound != (--IndexLSB)) /* found an empty */ \ + { JU_SETDIGITS(Index, IndexLSB, cDigits); RET_SUCCESS; }\ + } \ + LEAF_EDGE_SET(IndexLSB, cDigits); \ + } + +#else // JUDYNEXT + +#define JSLE_EVEN(Addr,Pop0,cDigits,LeafType) \ + { \ + LeafType * PjllLSB = ((LeafType *) (Addr)) + (Pop0); \ + LeafType IndexLSB = Index; /* auto-masking */ \ + \ + /* Index at or after end of leaf: */ \ + \ + if (*PjllLSB <= IndexLSB) /* no need to search */ \ + { \ + if (*PjllLSB < IndexLSB) RET_SUCCESS; /* Index empty */\ + LEAF_EDGE(*PjllLSB, cDigits); \ + } \ + \ + /* Index before or in leaf: */ \ + \ + offset = *PjllLSB - IndexLSB; /* tentative offset */ \ + if (offset <= (Pop0)) /* can check density */ \ + { \ + PjllLSB -= offset; /* move to slot */ \ + \ + if (*PjllLSB >= IndexLSB) /* dense or corrupt */ \ + { \ + if (*PjllLSB == IndexLSB) /* dense, check edge */ \ + LEAF_EDGE_SET(PjllLSB[offset], cDigits); \ + RET_CORRUPT; \ + } \ + ++PjllLSB; /* not dense, start at next */ \ + } \ + else PjllLSB = (LeafType *) (Addr); /* start at minimum */ \ + \ + LEAF_HOLE_EVEN(cDigits, PjllLSB, IndexLSB); \ + } + +#define JSLE_ODD(cDigits,Pjll,Pop0,Search,Copy) \ + { \ + Word_t IndexLSB; /* least bytes only */ \ + Word_t IndexFound; /* in leaf */ \ + int offsetmax; /* in bytes */ \ + \ + if ((offset = Search(Pjll, (Pop0) + 1, Index)) < 0) \ + RET_SUCCESS; /* Index is empty */ \ + \ + IndexLSB = JU_LEASTBYTES(Index, cDigits); \ + offset *= (cDigits); \ + offsetmax = (Pop0) * (cDigits); /* single multiply */ \ + \ + while ((offset += (cDigits)) <= offsetmax) \ + { /* skip until empty or end */ \ + Copy(IndexFound, ((uint8_t *) (Pjll)) + offset); \ + if (IndexFound != (++IndexLSB)) /* found an empty */ \ + { JU_SETDIGITS(Index, IndexLSB, cDigits); RET_SUCCESS; } \ + } \ + LEAF_EDGE_SET(IndexLSB, cDigits); \ + } + +#endif // JUDYNEXT + +// Note: Immediate indexes never fill a single index group, so for odd index +// sizes, save time by calling JSLE_ODD_IMM instead of JSLE_ODD. + +#define j__udySearchLeafEmpty1(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 1, uint8_t) + +#define j__udySearchLeafEmpty2(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 2, uint16_t) + +#define j__udySearchLeafEmpty3(Addr,Pop0) \ + JSLE_ODD(3, Addr, Pop0, j__udySearchLeaf3, JU_COPY3_PINDEX_TO_LONG) + +#ifndef JU_64BIT + +#define j__udySearchLeafEmptyL(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 4, Word_t) + +#else + +#define j__udySearchLeafEmpty4(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 4, uint32_t) + +#define j__udySearchLeafEmpty5(Addr,Pop0) \ + JSLE_ODD(5, Addr, Pop0, j__udySearchLeaf5, JU_COPY5_PINDEX_TO_LONG) + +#define j__udySearchLeafEmpty6(Addr,Pop0) \ + JSLE_ODD(6, Addr, Pop0, j__udySearchLeaf6, JU_COPY6_PINDEX_TO_LONG) + +#define j__udySearchLeafEmpty7(Addr,Pop0) \ + JSLE_ODD(7, Addr, Pop0, j__udySearchLeaf7, JU_COPY7_PINDEX_TO_LONG) + +#define j__udySearchLeafEmptyL(Addr,Pop0) \ + JSLE_EVEN(Addr, Pop0, 8, Word_t) + +#endif // JU_64BIT + + +// ---------------------------------------------------------------------------- +// START OF CODE: +// +// CHECK FOR SHORTCUTS: +// +// Error out if PIndex is null. + + if (PIndex == (PWord_t) NULL) + { + JU_SET_ERRNO(PJError, JU_ERRNO_NULLPINDEX); + return(JERRI); + } + + Index = *PIndex; // fast local copy. + +// Set and pre-decrement/increment Index, watching for underflow/overflow: +// +// An out-of-bounds Index means failure: No previous/next empty index. + +SMGetRestart: // return here with revised Index. + +#ifdef JUDYPREV + if (Index-- == 0) return(0); +#else + if (++Index == 0) return(0); +#endif + +// An empty array with an in-bounds (not underflowed/overflowed) Index means +// success: +// +// Note: This check is redundant after restarting at SMGetRestart, but should +// take insignificant time. + + if (PArray == (Pvoid_t) NULL) RET_SUCCESS; + +// ---------------------------------------------------------------------------- +// ROOT-LEVEL LEAF that starts with a Pop0 word; just look within the leaf: +// +// If Index is not in the leaf, return success; otherwise return the first +// empty Index, if any, below/above where it would belong. + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + pop0 = Pjlw[0]; + +#ifdef JUDY1 + if (pop0 == 0) // special case. + { +#ifdef JUDYPREV + if ((Index != Pjlw[1]) || (Index-- != 0)) RET_SUCCESS; +#else + if ((Index != Pjlw[1]) || (++Index != 0)) RET_SUCCESS; +#endif + return(0); // no previous/next empty index. + } +#endif // JUDY1 + + j__udySearchLeafEmptyL(Pjlw + 1, pop0); + +// No return -- thanks ALAN + + } + else + +// ---------------------------------------------------------------------------- +// HANDLE JRP Branch: +// +// For JRP branches, traverse the JPM; handle LEAFW +// directly; but look for the most common cases first. + + { + Pjpm_t Pjpm = P_JPM(PArray); + Pjp = &(Pjpm->jpm_JP); + +// goto SMGetContinue; + } + + +// ============================================================================ +// STATE MACHINE -- GET INDEX: +// +// Search for Index (already decremented/incremented so as to be an inclusive +// search). If not found (empty index), return success. Otherwise do a +// previous/next search, and if successful modify Index to the empty index +// found. See function header comments. +// +// ENTRY: Pjp points to next JP to interpret, whose Decode bytes have not yet +// been checked. +// +// Note: Check Decode bytes at the start of each loop, not after looking up a +// new JP, so its easy to do constant shifts/masks. +// +// EXIT: Return, or branch to SMGetRestart with modified Index, or branch to +// SMGetContinue with a modified Pjp, as described elsewhere. +// +// WARNING: For run-time efficiency the following cases replicate code with +// varying constants, rather than using common code with variable values! + +SMGetContinue: // return here for next branch/leaf. + +#ifdef TRACEJPSE + JudyPrintJP(Pjp, "sf", __LINE__); +#endif + + switch (JU_JPTYPE(Pjp)) + { + + +// ---------------------------------------------------------------------------- +// LINEAR BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in Index. + + case cJU_JPBRANCH_L2: CHECKDCD(2); SMPREPB2(SMBranchL); + case cJU_JPBRANCH_L3: CHECKDCD(3); SMPREPB3(SMBranchL); +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: CHECKDCD(4); SMPREPB4(SMBranchL); + case cJU_JPBRANCH_L5: CHECKDCD(5); SMPREPB5(SMBranchL); + case cJU_JPBRANCH_L6: CHECKDCD(6); SMPREPB6(SMBranchL); + case cJU_JPBRANCH_L7: CHECKDCD(7); SMPREPB7(SMBranchL); +#endif + case cJU_JPBRANCH_L: SMPREPBL(SMBranchL); + +// Common code (state-independent) for all cases of linear branches: + +SMBranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + +// First, check if Indexs expanse (digit) is below/above the first/last +// populated expanse in the BranchL, in which case Index is empty; otherwise +// find the offset of the lowest/highest populated expanse at or above/below +// digit, if any: +// +// Note: The for-loop is guaranteed to exit eventually because the first/last +// expanse is known to be a terminator. +// +// Note: Cannot use j__udySearchLeaf*Empty1() here because it only applies to +// leaves and does not know about partial versus full JPs, unlike the use of +// j__udySearchLeaf1() for BranchLs in SearchValid code. Also, since linear +// leaf expanse lists are small, dont waste time calling j__udySearchLeaf1(), +// just scan the expanse list. + +#ifdef JUDYPREV + if ((Pjbl->jbl_Expanse[0]) > digit) RET_SUCCESS; + + for (offset = (Pjbl->jbl_NumJPs) - 1; /* null */; --offset) +#else + if ((Pjbl->jbl_Expanse[(Pjbl->jbl_NumJPs) - 1]) < digit) + RET_SUCCESS; + + for (offset = 0; /* null */; ++offset) +#endif + { + +// Too low/high, keep going; or too high/low, meaning the loop passed a hole +// and the initial Index is empty: + +#ifdef JUDYPREV + if ((Pjbl->jbl_Expanse[offset]) > digit) continue; + if ((Pjbl->jbl_Expanse[offset]) < digit) RET_SUCCESS; +#else + if ((Pjbl->jbl_Expanse[offset]) < digit) continue; + if ((Pjbl->jbl_Expanse[offset]) > digit) RET_SUCCESS; +#endif + +// Found expanse matching digit; if its not full, traverse through it: + + if (! JPFULL((Pjbl->jbl_jp) + offset)) + { + Pjp = (Pjbl->jbl_jp) + offset; + goto SMGetContinue; + } + +// Common code: While searching for a lower/higher hole or a non-full JP, upon +// finding a lower/higher hole, adjust Index using the revised digit and +// return; or upon finding a consecutive lower/higher expanse, if the expanses +// JP is non-full, modify Index and traverse through the JP: + +#define BRANCHL_CHECK(OpIncDec,OpLeastDigits,Digit,Digits) \ + { \ + if ((Pjbl->jbl_Expanse[offset]) != OpIncDec digit) \ + SET_AND_RETURN(OpLeastDigits, Digit, Digits); \ + \ + if (! JPFULL((Pjbl->jbl_jp) + offset)) \ + { \ + Pjp = (Pjbl->jbl_jp) + offset; \ + SET_AND_CONTINUE(OpLeastDigits, Digit, Digits); \ + } \ + } + +// BranchL primary dead end: Expanse matching Index/digit is full (rare except +// for dense/sequential indexes): +// +// Search for a lower/higher hole, a non-full JP, or the end of the expanse +// list, while decrementing/incrementing digit. + +#ifdef JUDYPREV + while (--offset >= 0) + BRANCHL_CHECK(--, SETLEASTDIGITS_D, digit, digits) +#else + while (++offset < Pjbl->jbl_NumJPs) + BRANCHL_CHECK(++, CLEARLEASTDIGITS_D, digit, digits) +#endif + +// Passed end of BranchL expanse list after finding a matching but full +// expanse: +// +// Digit now matches the lowest/highest expanse, which is a full expanse; if +// digit is at the end of BranchLs expanse (no hole before/after), break out +// of the loop; otherwise modify Index to the next lower/higher digit and +// return success: + +#ifdef JUDYPREV + if (digit == 0) break; + --digit; SET_AND_RETURN(SETLEASTDIGITS_D, digit, digits); +#else + if (digit == JU_LEASTBYTES(cJU_ALLONES, 1)) break; + ++digit; SET_AND_RETURN(CLEARLEASTDIGITS_D, digit, digits); +#endif + } // for-loop + +// BranchL secondary dead end, no non-full previous/next JP: + + SMRESTART(digits); + + +// ---------------------------------------------------------------------------- +// BITMAP BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in Index. + + case cJU_JPBRANCH_B2: CHECKDCD(2); SMPREPB2(SMBranchB); + case cJU_JPBRANCH_B3: CHECKDCD(3); SMPREPB3(SMBranchB); +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: CHECKDCD(4); SMPREPB4(SMBranchB); + case cJU_JPBRANCH_B5: CHECKDCD(5); SMPREPB5(SMBranchB); + case cJU_JPBRANCH_B6: CHECKDCD(6); SMPREPB6(SMBranchB); + case cJU_JPBRANCH_B7: CHECKDCD(7); SMPREPB7(SMBranchB); +#endif + case cJU_JPBRANCH_B: SMPREPBL(SMBranchB); + +// Common code (state-independent) for all cases of bitmap branches: + +SMBranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + +// Locate the digits JP in the subexpanse list, if present: + + subexp = digit / cJU_BITSPERSUBEXPB; + assert(subexp < cJU_NUMSUBEXPB); // falls in expected range. + bitposmaskB = JU_BITPOSMASKB(digit); + +// Absent JP = no JP matches current digit in Index: + +// if (! JU_BITMAPTESTB(Pjbb, digit)) // slower. + if (! (JU_JBB_BITMAP(Pjbb, subexp) & bitposmaskB)) // faster. + RET_SUCCESS; + +// Non-full JP matches current digit in Index: +// +// Iterate to the subsidiary non-full JP. + + offset = SEARCHBITMAPB(JU_JBB_BITMAP(Pjbb, subexp), digit, + bitposmaskB); + // not negative since at least one bit is set: + assert(offset >= 0); + assert(offset < (int) cJU_BITSPERSUBEXPB); + +// Watch for null JP subarray pointer with non-null bitmap (a corruption): + + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) + == (Pjp_t) NULL) RET_CORRUPT; + + Pjp += offset; + if (! JPFULL(Pjp)) goto SMGetContinue; + +// BranchB primary dead end: +// +// Upon hitting a full JP in a BranchB for the next digit in Index, search +// sideways for a previous/next absent JP (unset bit) or non-full JP (set bit +// with non-full JP); first in the current bitmap subexpanse, then in +// lower/higher subexpanses. Upon entry, Pjp points to a known-unusable JP, +// ready to decrement/increment. +// +// Note: The preceding code is separate from this loop because Index does not +// need revising (see SET_AND_*()) if the initial index is an empty index. +// +// TBD: For speed, shift bitposmaskB instead of using JU_BITMAPTESTB or +// JU_BITPOSMASKB, but this shift has knowledge of bit order that really should +// be encapsulated in a header file. + +#define BRANCHB_CHECKBIT(OpLeastDigits) \ + if (! (JU_JBB_BITMAP(Pjbb, subexp) & bitposmaskB)) /* absent JP */ \ + SET_AND_RETURN(OpLeastDigits, digit, digits) + +#define BRANCHB_CHECKJPFULL(OpLeastDigits) \ + if (! JPFULL(Pjp)) \ + SET_AND_CONTINUE(OpLeastDigits, digit, digits) + +#define BRANCHB_STARTSUBEXP(OpLeastDigits) \ + if (! JU_JBB_BITMAP(Pjbb, subexp)) /* empty subexpanse, shortcut */ \ + SET_AND_RETURN(OpLeastDigits, digit, digits) \ + if ((Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp))) == (Pjp_t) NULL) RET_CORRUPT + +#ifdef JUDYPREV + + --digit; // skip initial digit. + bitposmaskB >>= 1; // see TBD above. + +BranchBNextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskB) // more bits to check in subexp. + { + BRANCHB_CHECKBIT(SETLEASTDIGITS_D); + --Pjp; // previous in subarray. + BRANCHB_CHECKJPFULL(SETLEASTDIGITS_D); + assert(digit >= 0); + --digit; + bitposmaskB >>= 1; + } + + if (subexp-- > 0) // more subexpanses. + { + BRANCHB_STARTSUBEXP(SETLEASTDIGITS_D); + Pjp += SEARCHBITMAPMAXB(JU_JBB_BITMAP(Pjbb, subexp)) + 1; + bitposmaskB = (1U << (cJU_BITSPERSUBEXPB - 1)); + goto BranchBNextSubexp; + } + +#else // JUDYNEXT + + ++digit; // skip initial digit. + bitposmaskB <<= 1; // note: BITMAPB_t. + +BranchBNextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskB) // more bits to check in subexp. + { + BRANCHB_CHECKBIT(CLEARLEASTDIGITS_D); + ++Pjp; // previous in subarray. + BRANCHB_CHECKJPFULL(CLEARLEASTDIGITS_D); + assert(digit < cJU_SUBEXPPERSTATE); + ++digit; + bitposmaskB <<= 1; // note: BITMAPB_t. + } + + if (++subexp < cJU_NUMSUBEXPB) // more subexpanses. + { + BRANCHB_STARTSUBEXP(CLEARLEASTDIGITS_D); + --Pjp; // pre-decrement. + bitposmaskB = 1; + goto BranchBNextSubexp; + } + +#endif // JUDYNEXT + +// BranchB secondary dead end, no non-full previous/next JP: + + SMRESTART(digits); + + +// ---------------------------------------------------------------------------- +// UNCOMPRESSED BRANCH: +// +// Check Decode bytes, if any, in the current JP, then search for a JP for the +// next digit in Index. + + case cJU_JPBRANCH_U2: CHECKDCD(2); SMPREPB2(SMBranchU); + case cJU_JPBRANCH_U3: CHECKDCD(3); SMPREPB3(SMBranchU); +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: CHECKDCD(4); SMPREPB4(SMBranchU); + case cJU_JPBRANCH_U5: CHECKDCD(5); SMPREPB5(SMBranchU); + case cJU_JPBRANCH_U6: CHECKDCD(6); SMPREPB6(SMBranchU); + case cJU_JPBRANCH_U7: CHECKDCD(7); SMPREPB7(SMBranchU); +#endif + case cJU_JPBRANCH_U: SMPREPBL(SMBranchU); + +// Common code (state-independent) for all cases of uncompressed branches: + +SMBranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + Pjp = (Pjbu->jbu_jp) + digit; + +// Absent JP = null JP for current digit in Index: + + if (JPNULL(JU_JPTYPE(Pjp))) RET_SUCCESS; + +// Non-full JP matches current digit in Index: +// +// Iterate to the subsidiary JP. + + if (! JPFULL(Pjp)) goto SMGetContinue; + +// BranchU primary dead end: +// +// Upon hitting a full JP in a BranchU for the next digit in Index, search +// sideways for a previous/next null or non-full JP. BRANCHU_CHECKJP() is +// shorthand for common code. +// +// Note: The preceding code is separate from this loop because Index does not +// need revising (see SET_AND_*()) if the initial index is an empty index. + +#define BRANCHU_CHECKJP(OpIncDec,OpLeastDigits) \ + { \ + OpIncDec Pjp; \ + \ + if (JPNULL(JU_JPTYPE(Pjp))) \ + SET_AND_RETURN(OpLeastDigits, digit, digits) \ + \ + if (! JPFULL(Pjp)) \ + SET_AND_CONTINUE(OpLeastDigits, digit, digits) \ + } + +#ifdef JUDYPREV + while (digit-- > 0) + BRANCHU_CHECKJP(--, SETLEASTDIGITS_D); +#else + while (++digit < cJU_BRANCHUNUMJPS) + BRANCHU_CHECKJP(++, CLEARLEASTDIGITS_D); +#endif + +// BranchU secondary dead end, no non-full previous/next JP: + + SMRESTART(digits); + + +// ---------------------------------------------------------------------------- +// LINEAR LEAF: +// +// Check Decode bytes, if any, in the current JP, then search the leaf for the +// previous/next empty index starting at Index. Primary leaf dead end is +// hidden within j__udySearchLeaf*Empty*(). In case of secondary leaf dead +// end, restart at the top of the tree. +// +// Note: Pword is the name known to GET*; think of it as Pjlw. + +#define SMLEAFL(cDigits,Func) \ + Pword = (PWord_t) P_JLW(Pjp->jp_Addr); \ + pop0 = JU_JPLEAF_POP0(Pjp); \ + Func(Pword, pop0) + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: CHECKDCD(1); SMLEAFL(1, j__udySearchLeafEmpty1); +#endif + case cJU_JPLEAF2: CHECKDCD(2); SMLEAFL(2, j__udySearchLeafEmpty2); + case cJU_JPLEAF3: CHECKDCD(3); SMLEAFL(3, j__udySearchLeafEmpty3); + +#ifdef JU_64BIT + case cJU_JPLEAF4: CHECKDCD(4); SMLEAFL(4, j__udySearchLeafEmpty4); + case cJU_JPLEAF5: CHECKDCD(5); SMLEAFL(5, j__udySearchLeafEmpty5); + case cJU_JPLEAF6: CHECKDCD(6); SMLEAFL(6, j__udySearchLeafEmpty6); + case cJU_JPLEAF7: CHECKDCD(7); SMLEAFL(7, j__udySearchLeafEmpty7); +#endif + + +// ---------------------------------------------------------------------------- +// BITMAP LEAF: +// +// Check Decode bytes, if any, in the current JP, then search the leaf for the +// previous/next empty index starting at Index. + + case cJU_JPLEAF_B1: + + CHECKDCD(1); + + Pjlb = P_JLB(Pjp->jp_Addr); + digit = JU_DIGITATSTATE(Index, 1); + subexp = digit / cJU_BITSPERSUBEXPL; + bitposmaskL = JU_BITPOSMASKL(digit); + assert(subexp < cJU_NUMSUBEXPL); // falls in expected range. + +// Absent index = no index matches current digit in Index: + +// if (! JU_BITMAPTESTL(Pjlb, digit)) // slower. + if (! (JU_JLB_BITMAP(Pjlb, subexp) & bitposmaskL)) // faster. + RET_SUCCESS; + +// LeafB1 primary dead end: +// +// Upon hitting a valid (non-empty) index in a LeafB1 for the last digit in +// Index, search sideways for a previous/next absent index, first in the +// current bitmap subexpanse, then in lower/higher subexpanses. +// LEAFB1_CHECKBIT() is shorthand for common code to handle one bit in one +// bitmap subexpanse. +// +// Note: The preceding code is separate from this loop because Index does not +// need revising (see SET_AND_*()) if the initial index is an empty index. +// +// TBD: For speed, shift bitposmaskL instead of using JU_BITMAPTESTL or +// JU_BITPOSMASKL, but this shift has knowledge of bit order that really should +// be encapsulated in a header file. + +#define LEAFB1_CHECKBIT(OpLeastDigits) \ + if (! (JU_JLB_BITMAP(Pjlb, subexp) & bitposmaskL)) \ + SET_AND_RETURN(OpLeastDigits, digit, 1) + +#define LEAFB1_STARTSUBEXP(OpLeastDigits) \ + if (! JU_JLB_BITMAP(Pjlb, subexp)) /* empty subexp */ \ + SET_AND_RETURN(OpLeastDigits, digit, 1) + +#ifdef JUDYPREV + + --digit; // skip initial digit. + bitposmaskL >>= 1; // see TBD above. + +LeafB1NextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskL) // more bits to check in subexp. + { + LEAFB1_CHECKBIT(SETLEASTDIGITS_D); + assert(digit >= 0); + --digit; + bitposmaskL >>= 1; + } + + if (subexp-- > 0) // more subexpanses. + { + LEAFB1_STARTSUBEXP(SETLEASTDIGITS_D); + bitposmaskL = (1UL << (cJU_BITSPERSUBEXPL - 1)); + goto LeafB1NextSubexp; + } + +#else // JUDYNEXT + + ++digit; // skip initial digit. + bitposmaskL <<= 1; // note: BITMAPL_t. + +LeafB1NextSubexp: // return here to check next bitmap subexpanse. + + while (bitposmaskL) // more bits to check in subexp. + { + LEAFB1_CHECKBIT(CLEARLEASTDIGITS_D); + assert(digit < cJU_SUBEXPPERSTATE); + ++digit; + bitposmaskL <<= 1; // note: BITMAPL_t. + } + + if (++subexp < cJU_NUMSUBEXPL) // more subexpanses. + { + LEAFB1_STARTSUBEXP(CLEARLEASTDIGITS_D); + bitposmaskL = 1; + goto LeafB1NextSubexp; + } + +#endif // JUDYNEXT + +// LeafB1 secondary dead end, no empty index: + + SMRESTART(1); + + +#ifdef JUDY1 +// ---------------------------------------------------------------------------- +// FULL POPULATION: +// +// If the Decode bytes do not match, Index is empty (without modification); +// otherwise restart. + + case cJ1_JPFULLPOPU1: + + CHECKDCD(1); + SMRESTART(1); +#endif + + +// ---------------------------------------------------------------------------- +// IMMEDIATE: +// +// Pop1 = 1 Immediate JPs: +// +// If Index is not in the immediate JP, return success; otherwise check if +// there is an empty index below/above the immediate JPs index, and if so, +// return success with modified Index, else restart. +// +// Note: Doug says its fast enough to calculate the index size (digits) in +// the following; no need to set it separately for each case. + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + if (JU_JPDCDPOP0(Pjp) != JU_TRIMTODCDSIZE(Index)) RET_SUCCESS; + digits = JU_JPTYPE(Pjp) - cJU_JPIMMED_1_01 + 1; + LEAF_EDGE(JU_LEASTBYTES(JU_JPDCDPOP0(Pjp), digits), digits); + +// Immediate JPs with Pop1 > 1: + +#define IMM_MULTI(Func,BaseJPType) \ + JUDY1CODE(Pword = (PWord_t) (Pjp->jp_1Index);) \ + JUDYLCODE(Pword = (PWord_t) (Pjp->jp_LIndex);) \ + Func(Pword, JU_JPTYPE(Pjp) - (BaseJPType) + 1) + + case cJU_JPIMMED_1_02: + case cJU_JPIMMED_1_03: +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: + case cJU_JPIMMED_1_05: + case cJU_JPIMMED_1_06: + case cJU_JPIMMED_1_07: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: + case cJ1_JPIMMED_1_09: + case cJ1_JPIMMED_1_10: + case cJ1_JPIMMED_1_11: + case cJ1_JPIMMED_1_12: + case cJ1_JPIMMED_1_13: + case cJ1_JPIMMED_1_14: + case cJ1_JPIMMED_1_15: +#endif + IMM_MULTI(j__udySearchLeafEmpty1, cJU_JPIMMED_1_02); + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: + case cJU_JPIMMED_2_03: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: + case cJ1_JPIMMED_2_05: + case cJ1_JPIMMED_2_06: + case cJ1_JPIMMED_2_07: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + IMM_MULTI(j__udySearchLeafEmpty2, cJU_JPIMMED_2_02); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: + case cJ1_JPIMMED_3_04: + case cJ1_JPIMMED_3_05: +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + IMM_MULTI(j__udySearchLeafEmpty3, cJU_JPIMMED_3_02); +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_4_02: + case cJ1_JPIMMED_4_03: + IMM_MULTI(j__udySearchLeafEmpty4, cJ1_JPIMMED_4_02); + + case cJ1_JPIMMED_5_02: + case cJ1_JPIMMED_5_03: + IMM_MULTI(j__udySearchLeafEmpty5, cJ1_JPIMMED_5_02); + + case cJ1_JPIMMED_6_02: + IMM_MULTI(j__udySearchLeafEmpty6, cJ1_JPIMMED_6_02); + + case cJ1_JPIMMED_7_02: + IMM_MULTI(j__udySearchLeafEmpty7, cJ1_JPIMMED_7_02); +#endif + + +// ---------------------------------------------------------------------------- +// INVALID JP TYPE: + + default: RET_CORRUPT; + + } // SMGet switch. + +} // Judy1PrevEmpty() / Judy1NextEmpty() / JudyLPrevEmpty() / JudyLNextEmpty() diff --git a/libnetdata/libjudy/src/JudyL/JudyLTablesGen.c b/libnetdata/libjudy/src/JudyL/JudyLTablesGen.c new file mode 100644 index 000000000..cb8b13ff7 --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/JudyLTablesGen.c @@ -0,0 +1,296 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.37 $ $Source: /judy/src/JudyCommon/JudyTables.c $ + +#ifndef JU_WIN +#include // unavailable on win_*. +#endif + +#include +#include + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#define TERMINATOR 999 // terminator for Alloc tables + +#define BPW sizeof(Word_t) // define bytes per word + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +FILE *fd; + +// Definitions come from header files Judy1.h and JudyL.h: + +int AllocSizes[] = ALLOCSIZES; + +#define ROUNDUP(BYTES,BPW,OFFSETW) \ + ((((BYTES) + (BPW) - 1) / (BPW)) + (OFFSETW)) + + +// **************************************************************************** +// G E N T A B L E +// +// Note: "const" is required for newer compilers. + +FUNCTION void GenTable( + const char * TableName, // name of table string + const char * TableSize, // dimentioned size string + int IndexBytes, // bytes per Index + int LeafSize, // number elements in object + int ValueBytes, // bytes per Value + int OffsetWords) // 1 for LEAFW +{ + int * PAllocSizes = AllocSizes; + int OWord; + int CurWord; + int IWord; + int ii; + int BytesOfIndex; + int BytesOfObject; + int Index; + int LastWords; + int Words [1000] = { 0 }; + int Offset[1000] = { 0 }; + int MaxWords; + + MaxWords = ROUNDUP((IndexBytes + ValueBytes) * LeafSize, BPW, OffsetWords); + Words[0] = 0; + Offset[0] = 0; + CurWord = TERMINATOR; + +// Walk through all number of Indexes in table: + + for (Index = 1; /* null */; ++Index) + { + +// Calculate byte required for next size: + + BytesOfIndex = IndexBytes * Index; + BytesOfObject = (IndexBytes + ValueBytes) * Index; + +// Round up and calculate words required for next size: + + OWord = ROUNDUP(BytesOfObject, BPW, OffsetWords); + IWord = ROUNDUP(BytesOfIndex, BPW, OffsetWords); + +// Root-level leaves of population of 1 and 2 do not have the 1 word offset: + +// Save minimum value of offset: + + Offset[Index] = IWord; + +// Round up to next available size of words: + + while (OWord > *PAllocSizes) PAllocSizes++; + + if (Index == LeafSize) + { + CurWord = Words[Index] = OWord; + break; + } +// end of available sizes ? + + if (*PAllocSizes == TERMINATOR) + { + fprintf(stderr, "BUG, in %sPopToWords, sizes not big enough for object\n", TableName); + exit(1); + } + +// Save words required and last word: + + if (*PAllocSizes < MaxWords) { CurWord = Words[Index] = *PAllocSizes; } + else { CurWord = Words[Index] = MaxWords; } + + } // for each index + + LastWords = TERMINATOR; + +// Round up to largest size in each group of malloc sizes: + + for (ii = LeafSize; ii > 0; ii--) + { + if (LastWords > (Words[ii] - ii)) LastWords = Offset[ii]; + else Offset[ii] = LastWords; + } + +// Print the PopToWords[] table: + + fprintf(fd,"\n//\tobject uses %d words\n", CurWord); + fprintf(fd,"//\t%s = %d\n", TableSize, LeafSize); + + fprintf(fd,"const uint8_t\n"); + fprintf(fd,"%sPopToWords[%s + 1] =\n", TableName, TableSize); + fprintf(fd,"{\n\t 0,"); + + for (ii = 1; ii <= LeafSize; ii++) + { + +// 8 columns per line, starting with 1: + + if ((ii % 8) == 1) fprintf(fd,"\n\t"); + + fprintf(fd,"%2d", Words[ii]); + +// If not last number place comma: + + if (ii != LeafSize) fprintf(fd,", "); + } + fprintf(fd,"\n};\n"); + +// Print the Offset table if needed: + + if (! ValueBytes) return; + + fprintf(fd,"const uint8_t\n"); + fprintf(fd,"%sOffset[%s + 1] =\n", TableName, TableSize); + fprintf(fd,"{\n"); + fprintf(fd,"\t 0,"); + + for (ii = 1; ii <= LeafSize; ii++) + { + if ((ii % 8) == 1) fprintf(fd,"\n\t"); + + fprintf(fd,"%2d", Offset[ii]); + + if (ii != LeafSize) fprintf(fd,", "); + } + fprintf(fd,"\n};\n"); + +} // GenTable() + + +// **************************************************************************** +// M A I N + +FUNCTION int main() +{ + int ii; + +#ifdef JUDY1 + char *fname = "Judy1Tables.c"; +#else + char *fname = "JudyLTables.c"; +#endif + + if ((fd = fopen(fname, "w")) == NULL){ + perror("FATAL ERROR: could not write to Judy[1L]Tables.c file\n"); + return (-1); + } + + + fprintf(fd,"// @(#) From generation tool: $Revision: 4.37 $ $Source: /judy/src/JudyCommon/JudyTables.c $\n"); + fprintf(fd,"//\n\n"); + + +// ================================ Judy1 ================================= +#ifdef JUDY1 + + fprintf(fd,"#include \"Judy1.h\"\n"); + + fprintf(fd,"// Leave the malloc() sizes readable in the binary (via " + "strings(1)):\n"); + fprintf(fd,"const char * Judy1MallocSizes = \"Judy1MallocSizes ="); + + for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++) + fprintf(fd," %d,", AllocSizes[ii]); + +#ifndef JU_64BIT + fprintf(fd," Leaf1 = %d\";\n\n", cJ1_LEAF1_MAXPOP1); +#else + fprintf(fd,"\";\n\n"); // no Leaf1 in this case. +#endif + +// ================================ 32 bit ================================ +#ifndef JU_64BIT + + GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB,0,0); + + GenTable("j__1_Leaf1", "cJ1_LEAF1_MAXPOP1", 1, cJ1_LEAF1_MAXPOP1, 0, 0); + GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0); + GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0); + GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 4, cJ1_LEAFW_MAXPOP1, 0, 1); + +#endif + +// ================================ 64 bit ================================ +#ifdef JU_64BIT + GenTable("j__1_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB,0,0); + + GenTable("j__1_Leaf2", "cJ1_LEAF2_MAXPOP1", 2, cJ1_LEAF2_MAXPOP1, 0, 0); + GenTable("j__1_Leaf3", "cJ1_LEAF3_MAXPOP1", 3, cJ1_LEAF3_MAXPOP1, 0, 0); + GenTable("j__1_Leaf4", "cJ1_LEAF4_MAXPOP1", 4, cJ1_LEAF4_MAXPOP1, 0, 0); + GenTable("j__1_Leaf5", "cJ1_LEAF5_MAXPOP1", 5, cJ1_LEAF5_MAXPOP1, 0, 0); + GenTable("j__1_Leaf6", "cJ1_LEAF6_MAXPOP1", 6, cJ1_LEAF6_MAXPOP1, 0, 0); + GenTable("j__1_Leaf7", "cJ1_LEAF7_MAXPOP1", 7, cJ1_LEAF7_MAXPOP1, 0, 0); + GenTable("j__1_LeafW", "cJ1_LEAFW_MAXPOP1", 8, cJ1_LEAFW_MAXPOP1, 0, 1); +#endif +#endif // JUDY1 + + +// ================================ JudyL ================================= +#ifdef JUDYL + + fprintf(fd,"#include \"JudyL.h\"\n"); + + fprintf(fd,"// Leave the malloc() sizes readable in the binary (via " + "strings(1)):\n"); + fprintf(fd,"const char * JudyLMallocSizes = \"JudyLMallocSizes ="); + + for (ii = 0; AllocSizes[ii] != TERMINATOR; ii++) + fprintf(fd," %d,", AllocSizes[ii]); + + fprintf(fd," Leaf1 = %ld\";\n\n", (Word_t)cJL_LEAF1_MAXPOP1); + +#ifndef JU_64BIT +// ================================ 32 bit ================================ + GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB", 8, cJU_BITSPERSUBEXPB, 0,0); + + GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0); + GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0); + GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0); + GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 4, cJL_LEAFW_MAXPOP1, BPW,1); + GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 4, cJU_BITSPERSUBEXPL, 0,0); +#endif // 32 BIT + +#ifdef JU_64BIT +// ================================ 64 bit ================================ + GenTable("j__L_BranchBJP","cJU_BITSPERSUBEXPB",16, cJU_BITSPERSUBEXPB, 0,0); + + GenTable("j__L_Leaf1", "cJL_LEAF1_MAXPOP1", 1, cJL_LEAF1_MAXPOP1, BPW,0); + GenTable("j__L_Leaf2", "cJL_LEAF2_MAXPOP1", 2, cJL_LEAF2_MAXPOP1, BPW,0); + GenTable("j__L_Leaf3", "cJL_LEAF3_MAXPOP1", 3, cJL_LEAF3_MAXPOP1, BPW,0); + GenTable("j__L_Leaf4", "cJL_LEAF4_MAXPOP1", 4, cJL_LEAF4_MAXPOP1, BPW,0); + GenTable("j__L_Leaf5", "cJL_LEAF5_MAXPOP1", 5, cJL_LEAF5_MAXPOP1, BPW,0); + GenTable("j__L_Leaf6", "cJL_LEAF6_MAXPOP1", 6, cJL_LEAF6_MAXPOP1, BPW,0); + GenTable("j__L_Leaf7", "cJL_LEAF7_MAXPOP1", 7, cJL_LEAF7_MAXPOP1, BPW,0); + GenTable("j__L_LeafW", "cJL_LEAFW_MAXPOP1", 8, cJL_LEAFW_MAXPOP1, BPW,1); + GenTable("j__L_LeafV", "cJU_BITSPERSUBEXPL", 8, cJU_BITSPERSUBEXPL, 0,0); +#endif // 64 BIT + +#endif // JUDYL + fclose(fd); + + return(0); + +} // main() diff --git a/libnetdata/libjudy/src/JudyL/j__udyLGet.c b/libnetdata/libjudy/src/JudyL/j__udyLGet.c new file mode 100644 index 000000000..0bb9971cc --- /dev/null +++ b/libnetdata/libjudy/src/JudyL/j__udyLGet.c @@ -0,0 +1,1094 @@ +// Copyright (C) 2000 - 2002 Hewlett-Packard Company +// +// This program is free software; you can redistribute it and/or modify it +// under the term of the GNU Lesser General Public License as published by the +// Free Software Foundation; either version 2 of the License, or (at your +// option) any later version. +// +// This program is distributed in the hope that it will be useful, but WITHOUT +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License +// for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program; if not, write to the Free Software Foundation, +// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// _________________ + +// @(#) $Revision: 4.43 $ $Source: /judy/src/JudyCommon/JudyGet.c $ +// +// Judy1Test() and JudyLGet() functions for Judy1 and JudyL. +// Compile with one of -DJUDY1 or -DJUDYL. + +#if (! (defined(JUDY1) || defined(JUDYL))) +#error: One of -DJUDY1 or -DJUDYL must be specified. +#endif + +#ifdef JUDY1 +#include "Judy1.h" +#else +#include "JudyL.h" +#endif + +#include "JudyPrivate1L.h" + +#ifdef TRACEJPR // different macro name, for "retrieval" only. +#include "JudyPrintJP.c" +#endif + + +// **************************************************************************** +// J U D Y 1 T E S T +// J U D Y L G E T +// +// See the manual entry for details. Note support for "shortcut" entries to +// trees known to start with a JPM. + +#ifdef JUDY1 + +#ifdef JUDYGETINLINE +FUNCTION int j__udy1Test +#else +FUNCTION int Judy1Test +#endif + +#else // JUDYL + +#ifdef JUDYGETINLINE +FUNCTION PPvoid_t j__udyLGet +#else +FUNCTION PPvoid_t JudyLGet +#endif + +#endif // JUDYL + ( +#ifdef JUDYGETINLINE + Pvoid_t PArray, // from which to retrieve. + Word_t Index // to retrieve. +#else + Pcvoid_t PArray, // from which to retrieve. + Word_t Index, // to retrieve. + PJError_t PJError // optional, for returning error info. +#endif + ) +{ + Pjp_t Pjp; // current JP while walking the tree. + Pjpm_t Pjpm; // for global accounting. + uint8_t Digit; // byte just decoded from Index. + Word_t Pop1; // leaf population (number of indexes). + Pjll_t Pjll; // pointer to LeafL. + DBGCODE(uint8_t ParentJPType;) + +#ifndef JUDYGETINLINE + + if (PArray == (Pcvoid_t) NULL) // empty array. + { + JUDY1CODE(return(0);) + JUDYLCODE(return((PPvoid_t) NULL);) + } + +// **************************************************************************** +// PROCESS TOP LEVEL BRANCHES AND LEAF: + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + { + Pjlw_t Pjlw = P_JLW(PArray); // first word of leaf. + int posidx; // signed offset in leaf. + + Pop1 = Pjlw[0] + 1; + posidx = j__udySearchLeafW(Pjlw + 1, Pop1, Index); + + if (posidx >= 0) + { + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAFWVALUEAREA(Pjlw, Pop1) + posidx));) + } + JUDY1CODE(return(0);) + JUDYLCODE(return((PPvoid_t) NULL);) + } + +#endif // ! JUDYGETINLINE + + Pjpm = P_JPM(PArray); + Pjp = &(Pjpm->jpm_JP); // top branch is below JPM. + +// **************************************************************************** +// WALK THE JUDY TREE USING A STATE MACHINE: + +ContinueWalk: // for going down one level; come here with Pjp set. + +#ifdef TRACEJPR + JudyPrintJP(Pjp, "g", __LINE__); +#endif + switch (JU_JPTYPE(Pjp)) + { + +// Ensure the switch table starts at 0 for speed; otherwise more code is +// executed: + + case 0: goto ReturnCorrupt; // save a little code. + + +// **************************************************************************** +// JPNULL*: +// +// Note: These are legitimate in a BranchU (only) and do not constitute a +// fault. + + case cJU_JPNULL1: + case cJU_JPNULL2: + case cJU_JPNULL3: +#ifdef JU_64BIT + case cJU_JPNULL4: + case cJU_JPNULL5: + case cJU_JPNULL6: + case cJU_JPNULL7: +#endif + assert(ParentJPType >= cJU_JPBRANCH_U2); + assert(ParentJPType <= cJU_JPBRANCH_U); + JUDY1CODE(return(0);) + JUDYLCODE(return((PPvoid_t) NULL);) + + +// **************************************************************************** +// JPBRANCH_L*: +// +// Note: The use of JU_DCDNOTMATCHINDEX() in branches is not strictly +// required,since this can be done at leaf level, but it costs nothing to do it +// sooner, and it aborts an unnecessary traversal sooner. + + case cJU_JPBRANCH_L2: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + Digit = JU_DIGITATSTATE(Index, 2); + goto JudyBranchL; + + case cJU_JPBRANCH_L3: + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + Digit = JU_DIGITATSTATE(Index, 3); + goto JudyBranchL; + +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + Digit = JU_DIGITATSTATE(Index, 4); + goto JudyBranchL; + + case cJU_JPBRANCH_L5: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + Digit = JU_DIGITATSTATE(Index, 5); + goto JudyBranchL; + + case cJU_JPBRANCH_L6: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + Digit = JU_DIGITATSTATE(Index, 6); + goto JudyBranchL; + + case cJU_JPBRANCH_L7: + + // JU_DCDNOTMATCHINDEX() would be a no-op. + Digit = JU_DIGITATSTATE(Index, 7); + goto JudyBranchL; + +#endif // JU_64BIT + + case cJU_JPBRANCH_L: + { + Pjbl_t Pjbl; + int posidx; + + Digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + +// Common code for all BranchLs; come here with Digit set: + +JudyBranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + + posidx = 0; + + do { + if (Pjbl->jbl_Expanse[posidx] == Digit) + { // found Digit; continue traversal: + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = Pjbl->jbl_jp + posidx; + goto ContinueWalk; + } + } while (++posidx != Pjbl->jbl_NumJPs); + + break; + } + + +// **************************************************************************** +// JPBRANCH_B*: + + case cJU_JPBRANCH_B2: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + Digit = JU_DIGITATSTATE(Index, 2); + goto JudyBranchB; + + case cJU_JPBRANCH_B3: + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + Digit = JU_DIGITATSTATE(Index, 3); + goto JudyBranchB; + + +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + Digit = JU_DIGITATSTATE(Index, 4); + goto JudyBranchB; + + case cJU_JPBRANCH_B5: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + Digit = JU_DIGITATSTATE(Index, 5); + goto JudyBranchB; + + case cJU_JPBRANCH_B6: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + Digit = JU_DIGITATSTATE(Index, 6); + goto JudyBranchB; + + case cJU_JPBRANCH_B7: + + // JU_DCDNOTMATCHINDEX() would be a no-op. + Digit = JU_DIGITATSTATE(Index, 7); + goto JudyBranchB; + +#endif // JU_64BIT + + case cJU_JPBRANCH_B: + { + Pjbb_t Pjbb; + Word_t subexp; // in bitmap, 0..7. + BITMAPB_t BitMap; // for one subexpanse. + BITMAPB_t BitMask; // bit in BitMap for Indexs Digit. + + Digit = JU_DIGITATSTATE(Index, cJU_ROOTSTATE); + +// Common code for all BranchBs; come here with Digit set: + +JudyBranchB: + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjbb = P_JBB(Pjp->jp_Addr); + subexp = Digit / cJU_BITSPERSUBEXPB; + + BitMap = JU_JBB_BITMAP(Pjbb, subexp); + Pjp = P_JP(JU_JBB_PJP(Pjbb, subexp)); + + BitMask = JU_BITPOSMASKB(Digit); + +// No JP in subexpanse for Index => Index not found: + + if (! (BitMap & BitMask)) break; + +// Count JPs in the subexpanse below the one for Index: + + Pjp += j__udyCountBitsB(BitMap & (BitMask - 1)); + + goto ContinueWalk; + + } // case cJU_JPBRANCH_B* + + +// **************************************************************************** +// JPBRANCH_U*: +// +// Notice the reverse order of the cases, and falling through to the next case, +// for performance. + + case cJU_JPBRANCH_U: + + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, cJU_ROOTSTATE); + +// If not a BranchU, traverse; otherwise fall into the next case, which makes +// this very fast code for a large Judy array (mainly BranchUs), especially +// when branches are already in the cache, such as for prev/next: + +#ifndef JU_64BIT + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U3) goto ContinueWalk; +#else + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U7) goto ContinueWalk; +#endif + +#ifdef JU_64BIT + case cJU_JPBRANCH_U7: + + // JU_DCDNOTMATCHINDEX() would be a no-op. + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 7); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U6) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U6: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 6); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U5) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U5: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 5); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U4) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U4: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 4); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U3) goto ContinueWalk; + // and fall through. + +#endif // JU_64BIT + + case cJU_JPBRANCH_U3: + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 3); + + if (JU_JPTYPE(Pjp) != cJU_JPBRANCH_U2) goto ContinueWalk; + // and fall through. + + case cJU_JPBRANCH_U2: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + DBGCODE(ParentJPType = JU_JPTYPE(Pjp);) + Pjp = JU_JBU_PJP(Pjp, Index, 2); + +// Note: BranchU2 is a special case that must continue traversal to a leaf, +// immed, full, or null type: + + goto ContinueWalk; + + +// **************************************************************************** +// JPLEAF*: +// +// Note: Here the calls of JU_DCDNOTMATCHINDEX() are necessary and check +// whether Index is out of the expanse of a narrow pointer. + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + + case cJU_JPLEAF1: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf1(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF1VALUEAREA(Pjll, Pop1) + posidx));) + } + +#endif // (JUDYL || (! JU_64BIT)) + + case cJU_JPLEAF2: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 2)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf2(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF2VALUEAREA(Pjll, Pop1) + posidx));) + } + case cJU_JPLEAF3: + { + int posidx; // signed offset in leaf. + +#ifdef JU_64BIT // otherwise its a no-op: + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 3)) break; +#endif + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf3(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF3VALUEAREA(Pjll, Pop1) + posidx));) + } +#ifdef JU_64BIT + case cJU_JPLEAF4: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 4)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf4(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF4VALUEAREA(Pjll, Pop1) + posidx));) + } + case cJU_JPLEAF5: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 5)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf5(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF5VALUEAREA(Pjll, Pop1) + posidx));) + } + + case cJU_JPLEAF6: + { + int posidx; // signed offset in leaf. + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 6)) break; + + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf6(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF6VALUEAREA(Pjll, Pop1) + posidx));) + } + case cJU_JPLEAF7: + { + int posidx; // signed offset in leaf. + + // JU_DCDNOTMATCHINDEX() would be a no-op. + Pop1 = JU_JPLEAF_POP0(Pjp) + 1; + Pjll = P_JLL(Pjp->jp_Addr); + + if ((posidx = j__udySearchLeaf7(Pjll, Pop1, Index)) < 0) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) (JL_LEAF7VALUEAREA(Pjll, Pop1) + posidx));) + } +#endif // JU_64BIT + + +// **************************************************************************** +// JPLEAF_B1: + + case cJU_JPLEAF_B1: + { + Pjlb_t Pjlb; +#ifdef JUDYL + int posidx; + Word_t subexp; // in bitmap, 0..7. + BITMAPL_t BitMap; // for one subexpanse. + BITMAPL_t BitMask; // bit in BitMap for Indexs Digit. + Pjv_t Pjv; +#endif + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + + Pjlb = P_JLB(Pjp->jp_Addr); + +#ifdef JUDY1 + +// Simply check if Indexs bit is set in the bitmap: + + if (JU_BITMAPTESTL(Pjlb, Index)) return(1); + break; + +#else // JUDYL + +// JudyL is much more complicated because of value area subarrays: + + Digit = JU_DIGITATSTATE(Index, 1); + subexp = Digit / cJU_BITSPERSUBEXPL; + BitMap = JU_JLB_BITMAP(Pjlb, subexp); + BitMask = JU_BITPOSMASKL(Digit); + +// No value in subexpanse for Index => Index not found: + + if (! (BitMap & BitMask)) break; + +// Count value areas in the subexpanse below the one for Index: + + Pjv = P_JV(JL_JLB_PVALUE(Pjlb, subexp)); + assert(Pjv != (Pjv_t) NULL); + posidx = j__udyCountBitsL(BitMap & (BitMask - 1)); + + return((PPvoid_t) (Pjv + posidx)); + +#endif // JUDYL + + } // case cJU_JPLEAF_B1 + +#ifdef JUDY1 + +// **************************************************************************** +// JPFULLPOPU1: +// +// If the Index is in the expanse, it is necessarily valid (found). + + case cJ1_JPFULLPOPU1: + + if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + return(1); + +#ifdef notdef // for future enhancements +#ifdef JU_64BIT + +// Note: Need ? if (JU_DCDNOTMATCHINDEX(Index, Pjp, 1)) break; + + case cJ1_JPFULLPOPU1m15: + if (Pjp->jp_1Index[14] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m14: + if (Pjp->jp_1Index[13] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m13: + if (Pjp->jp_1Index[12] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m12: + if (Pjp->jp_1Index[11] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m11: + if (Pjp->jp_1Index[10] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m10: + if (Pjp->jp_1Index[9] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m9: + if (Pjp->jp_1Index[8] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m8: + if (Pjp->jp_1Index[7] == (uint8_t)Index) break; +#endif + case cJ1_JPFULLPOPU1m7: + if (Pjp->jp_1Index[6] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m6: + if (Pjp->jp_1Index[5] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m5: + if (Pjp->jp_1Index[4] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m4: + if (Pjp->jp_1Index[3] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m3: + if (Pjp->jp_1Index[2] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m2: + if (Pjp->jp_1Index[1] == (uint8_t)Index) break; + case cJ1_JPFULLPOPU1m1: + if (Pjp->jp_1Index[0] == (uint8_t)Index) break; + + return(1); // found, not in exclusion list + +#endif // JUDY1 +#endif // notdef + +// **************************************************************************** +// JPIMMED*: +// +// Note that the contents of jp_DcdPopO are different for cJU_JPIMMED_*_01: + + case cJU_JPIMMED_1_01: + case cJU_JPIMMED_2_01: + case cJU_JPIMMED_3_01: +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: + case cJU_JPIMMED_5_01: + case cJU_JPIMMED_6_01: + case cJU_JPIMMED_7_01: +#endif + if (JU_JPDCDPOP0(Pjp) != JU_TRIMTODCDSIZE(Index)) break; + + JUDY1CODE(return(1);) + JUDYLCODE(return((PPvoid_t) &(Pjp->jp_Addr));) // immediate value area. + + +// Macros to make code more readable and avoid dup errors + +#ifdef JUDY1 + +#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX) \ +if (((LEAF_T *)((PJP)->jp_1Index))[(IDX) - 1] == (LEAF_T)(INDEX)) \ + return(1) + +#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY) \ +{ \ + Word_t i_ndex; \ + uint8_t *a_ddr; \ + a_ddr = (PJP)->jp_1Index + (((IDX) - 1) * (LFBTS)); \ + COPY(i_ndex, a_ddr); \ + if (i_ndex == JU_LEASTBYTES((INDEX), (LFBTS))) \ + return(1); \ +} +#endif + +#ifdef JUDYL + +#define CHECKINDEXNATIVE(LEAF_T, PJP, IDX, INDEX) \ +if (((LEAF_T *)((PJP)->jp_LIndex))[(IDX) - 1] == (LEAF_T)(INDEX)) \ + return((PPvoid_t)(P_JV((PJP)->jp_Addr) + (IDX) - 1)) + +#define CHECKLEAFNONNAT(LFBTS, PJP, INDEX, IDX, COPY) \ +{ \ + Word_t i_ndex; \ + uint8_t *a_ddr; \ + a_ddr = (PJP)->jp_LIndex + (((IDX) - 1) * (LFBTS)); \ + COPY(i_ndex, a_ddr); \ + if (i_ndex == JU_LEASTBYTES((INDEX), (LFBTS))) \ + return((PPvoid_t)(P_JV((PJP)->jp_Addr) + (IDX) - 1)); \ +} +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_15: CHECKINDEXNATIVE(uint8_t, Pjp, 15, Index); + case cJ1_JPIMMED_1_14: CHECKINDEXNATIVE(uint8_t, Pjp, 14, Index); + case cJ1_JPIMMED_1_13: CHECKINDEXNATIVE(uint8_t, Pjp, 13, Index); + case cJ1_JPIMMED_1_12: CHECKINDEXNATIVE(uint8_t, Pjp, 12, Index); + case cJ1_JPIMMED_1_11: CHECKINDEXNATIVE(uint8_t, Pjp, 11, Index); + case cJ1_JPIMMED_1_10: CHECKINDEXNATIVE(uint8_t, Pjp, 10, Index); + case cJ1_JPIMMED_1_09: CHECKINDEXNATIVE(uint8_t, Pjp, 9, Index); + case cJ1_JPIMMED_1_08: CHECKINDEXNATIVE(uint8_t, Pjp, 8, Index); +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_07: CHECKINDEXNATIVE(uint8_t, Pjp, 7, Index); + case cJU_JPIMMED_1_06: CHECKINDEXNATIVE(uint8_t, Pjp, 6, Index); + case cJU_JPIMMED_1_05: CHECKINDEXNATIVE(uint8_t, Pjp, 5, Index); + case cJU_JPIMMED_1_04: CHECKINDEXNATIVE(uint8_t, Pjp, 4, Index); +#endif + case cJU_JPIMMED_1_03: CHECKINDEXNATIVE(uint8_t, Pjp, 3, Index); + case cJU_JPIMMED_1_02: CHECKINDEXNATIVE(uint8_t, Pjp, 2, Index); + CHECKINDEXNATIVE(uint8_t, Pjp, 1, Index); + break; + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_07: CHECKINDEXNATIVE(uint16_t, Pjp, 7, Index); + case cJ1_JPIMMED_2_06: CHECKINDEXNATIVE(uint16_t, Pjp, 6, Index); + case cJ1_JPIMMED_2_05: CHECKINDEXNATIVE(uint16_t, Pjp, 5, Index); + case cJ1_JPIMMED_2_04: CHECKINDEXNATIVE(uint16_t, Pjp, 4, Index); +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_03: CHECKINDEXNATIVE(uint16_t, Pjp, 3, Index); + case cJU_JPIMMED_2_02: CHECKINDEXNATIVE(uint16_t, Pjp, 2, Index); + CHECKINDEXNATIVE(uint16_t, Pjp, 1, Index); + break; +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_05: + CHECKLEAFNONNAT(3, Pjp, Index, 5, JU_COPY3_PINDEX_TO_LONG); + case cJ1_JPIMMED_3_04: + CHECKLEAFNONNAT(3, Pjp, Index, 4, JU_COPY3_PINDEX_TO_LONG); + case cJ1_JPIMMED_3_03: + CHECKLEAFNONNAT(3, Pjp, Index, 3, JU_COPY3_PINDEX_TO_LONG); +#endif +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: + CHECKLEAFNONNAT(3, Pjp, Index, 2, JU_COPY3_PINDEX_TO_LONG); + CHECKLEAFNONNAT(3, Pjp, Index, 1, JU_COPY3_PINDEX_TO_LONG); + break; +#endif + +#if (defined(JUDY1) && defined(JU_64BIT)) + + case cJ1_JPIMMED_4_03: CHECKINDEXNATIVE(uint32_t, Pjp, 3, Index); + case cJ1_JPIMMED_4_02: CHECKINDEXNATIVE(uint32_t, Pjp, 2, Index); + CHECKINDEXNATIVE(uint32_t, Pjp, 1, Index); + break; + + case cJ1_JPIMMED_5_03: + CHECKLEAFNONNAT(5, Pjp, Index, 3, JU_COPY5_PINDEX_TO_LONG); + case cJ1_JPIMMED_5_02: + CHECKLEAFNONNAT(5, Pjp, Index, 2, JU_COPY5_PINDEX_TO_LONG); + CHECKLEAFNONNAT(5, Pjp, Index, 1, JU_COPY5_PINDEX_TO_LONG); + break; + + case cJ1_JPIMMED_6_02: + CHECKLEAFNONNAT(6, Pjp, Index, 2, JU_COPY6_PINDEX_TO_LONG); + CHECKLEAFNONNAT(6, Pjp, Index, 1, JU_COPY6_PINDEX_TO_LONG); + break; + + case cJ1_JPIMMED_7_02: + CHECKLEAFNONNAT(7, Pjp, Index, 2, JU_COPY7_PINDEX_TO_LONG); + CHECKLEAFNONNAT(7, Pjp, Index, 1, JU_COPY7_PINDEX_TO_LONG); + break; + +#endif // (JUDY1 && JU_64BIT) + + +// **************************************************************************** +// INVALID JP TYPE: + + default: + +ReturnCorrupt: + +#ifdef JUDYGETINLINE // Pjpm is known to be non-null: + JU_SET_ERRNO_NONNULL(Pjpm, JU_ERRNO_CORRUPT); +#else + JU_SET_ERRNO(PJError, JU_ERRNO_CORRUPT); +#endif + JUDY1CODE(return(JERRI );) + JUDYLCODE(return(PPJERR);) + + } // switch on JP type + +JUDY1CODE(return(0);) +JUDYLCODE(return((PPvoid_t) NULL);) + +} // Judy1Test() / JudyLGet() + + +#ifndef JUDYGETINLINE // only compile the following function once: +#ifdef DEBUG + +// **************************************************************************** +// J U D Y C H E C K P O P +// +// Given a pointer to a Judy array, traverse the entire array to ensure +// population counts add up correctly. This can catch various coding errors. +// +// Since walking the entire tree is probably time-consuming, enable this +// function by setting env parameter $CHECKPOP to first call at which to start +// checking. Note: This function is called both from insert and delete code. +// +// Note: Even though this function does nothing useful for LEAFW leaves, its +// good practice to call it anyway, and cheap too. +// +// TBD: This is a debug-only check function similar to JudyCheckSorted(), but +// since it walks the tree it is Judy1/JudyL-specific and must live in a source +// file that is built both ways. +// +// TBD: As feared, enabling this code for every insert/delete makes Judy +// deathly slow, even for a small tree (10K indexes). Its not so bad if +// present but disabled (<1% slowdown measured). Still, should it be ifdefd +// other than DEBUG and/or called less often? +// +// TBD: Should this "population checker" be expanded to a comprehensive tree +// checker? It currently detects invalid LEAFW/JP types as well as inconsistent +// pop1s. Other possible checks, all based on essentially redundant data in +// the Judy tree, include: +// +// - Zero LS bits in jp_Addr field. +// +// - Correct Dcd bits. +// +// - Consistent JP types (always descending down the tree). +// +// - Sorted linear lists in BranchLs and leaves (using JudyCheckSorted(), but +// ideally that function is already called wherever appropriate after any +// linear list is modified). +// +// - Any others possible? + +#include // for getenv() and atol(). + +static Word_t JudyCheckPopSM(Pjp_t Pjp, Word_t RootPop1); + +FUNCTION void JudyCheckPop( + Pvoid_t PArray) +{ +static bool_t checked = FALSE; // already checked env parameter. +static bool_t enabled = FALSE; // env parameter set. +static bool_t active = FALSE; // calls >= callsmin. +static Word_t callsmin; // start point from $CHECKPOP. +static Word_t calls = 0; // times called so far. + + +// CHECK FOR EXTERNAL ENABLING: + + if (! checked) // only check once. + { + char * value; // for getenv(). + + checked = TRUE; + + if ((value = getenv("CHECKPOP")) == (char *) NULL) + { +#ifdef notdef +// Take this out because nightly tests want to be flavor-independent; its not +// OK to emit special non-error output from the debug flavor: + + (void) puts("JudyCheckPop() present but not enabled by " + "$CHECKPOP env parameter; set it to the number of " + "calls at which to begin checking"); +#endif + return; + } + + callsmin = atol(value); // note: non-number evaluates to 0. + enabled = TRUE; + + (void) printf("JudyCheckPop() present and enabled; callsmin = " + "%lu\n", callsmin); + } + else if (! enabled) return; + +// Previously or just now enabled; check if non-active or newly active: + + if (! active) + { + if (++calls < callsmin) return; + + (void) printf("JudyCheckPop() activated at call %lu\n", calls); + active = TRUE; + } + +// IGNORE LEAFW AT TOP OF TREE: + + if (JU_LEAFW_POP0(PArray) < cJU_LEAFW_MAXPOP1) // must be a LEAFW + return; + +// Check JPM pop0 against tree, recursively: +// +// Note: The traversal code in JudyCheckPopSM() is simplest when the case +// statement for each JP type compares the pop1 for that JP to its subtree (if +// any) after traversing the subtree (thats the hard part) and adding up +// actual pop1s. A top branchs JP in the JPM does not have room for a +// full-word pop1, so pass it in as a special case. + + { + Pjpm_t Pjpm = P_JPM(PArray); + (void) JudyCheckPopSM(&(Pjpm->jpm_JP), Pjpm->jpm_Pop0 + 1); + return; + } + +} // JudyCheckPop() + + +// **************************************************************************** +// J U D Y C H E C K P O P S M +// +// Recursive state machine (subroutine) for JudyCheckPop(): Given a Pjp (other +// than JPNULL*; caller should shortcut) and the root population for top-level +// branches, check the subtrees actual pop1 against its nominal value, and +// return the total pop1 for the subtree. +// +// Note: Expect RootPop1 to be ignored at lower levels, so pass down 0, which +// should pop an assertion if this expectation is violated. + +FUNCTION static Word_t JudyCheckPopSM( + Pjp_t Pjp, // top of subtree. + Word_t RootPop1) // whole array, for top-level branches only. +{ + Word_t pop1_jp; // nominal population from the JP. + Word_t pop1 = 0; // actual population at this level. + Word_t offset; // in a branch. + +#define PREPBRANCH(cPopBytes,Next) \ + pop1_jp = JU_JPBRANCH_POP0(Pjp, cPopBytes) + 1; goto Next + +assert((((Word_t) (Pjp->jp_Addr)) & 7) == 3); + switch (JU_JPTYPE(Pjp)) + { + + case cJU_JPBRANCH_L2: PREPBRANCH(2, BranchL); + case cJU_JPBRANCH_L3: PREPBRANCH(3, BranchL); +#ifdef JU_64BIT + case cJU_JPBRANCH_L4: PREPBRANCH(4, BranchL); + case cJU_JPBRANCH_L5: PREPBRANCH(5, BranchL); + case cJU_JPBRANCH_L6: PREPBRANCH(6, BranchL); + case cJU_JPBRANCH_L7: PREPBRANCH(7, BranchL); +#endif + case cJU_JPBRANCH_L: pop1_jp = RootPop1; + { + Pjbl_t Pjbl; +BranchL: + Pjbl = P_JBL(Pjp->jp_Addr); + + for (offset = 0; offset < (Pjbl->jbl_NumJPs); ++offset) + pop1 += JudyCheckPopSM((Pjbl->jbl_jp) + offset, 0); + + assert(pop1_jp == pop1); + return(pop1); + } + + case cJU_JPBRANCH_B2: PREPBRANCH(2, BranchB); + case cJU_JPBRANCH_B3: PREPBRANCH(3, BranchB); +#ifdef JU_64BIT + case cJU_JPBRANCH_B4: PREPBRANCH(4, BranchB); + case cJU_JPBRANCH_B5: PREPBRANCH(5, BranchB); + case cJU_JPBRANCH_B6: PREPBRANCH(6, BranchB); + case cJU_JPBRANCH_B7: PREPBRANCH(7, BranchB); +#endif + case cJU_JPBRANCH_B: pop1_jp = RootPop1; + { + Word_t subexp; + Word_t jpcount; + Pjbb_t Pjbb; +BranchB: + Pjbb = P_JBB(Pjp->jp_Addr); + + for (subexp = 0; subexp < cJU_NUMSUBEXPB; ++subexp) + { + jpcount = j__udyCountBitsB(JU_JBB_BITMAP(Pjbb, subexp)); + + for (offset = 0; offset < jpcount; ++offset) + { + pop1 += JudyCheckPopSM(P_JP(JU_JBB_PJP(Pjbb, subexp)) + + offset, 0); + } + } + + assert(pop1_jp == pop1); + return(pop1); + } + + case cJU_JPBRANCH_U2: PREPBRANCH(2, BranchU); + case cJU_JPBRANCH_U3: PREPBRANCH(3, BranchU); +#ifdef JU_64BIT + case cJU_JPBRANCH_U4: PREPBRANCH(4, BranchU); + case cJU_JPBRANCH_U5: PREPBRANCH(5, BranchU); + case cJU_JPBRANCH_U6: PREPBRANCH(6, BranchU); + case cJU_JPBRANCH_U7: PREPBRANCH(7, BranchU); +#endif + case cJU_JPBRANCH_U: pop1_jp = RootPop1; + { + Pjbu_t Pjbu; +BranchU: + Pjbu = P_JBU(Pjp->jp_Addr); + + for (offset = 0; offset < cJU_BRANCHUNUMJPS; ++offset) + { + if (((Pjbu->jbu_jp[offset].jp_Type) >= cJU_JPNULL1) + && ((Pjbu->jbu_jp[offset].jp_Type) <= cJU_JPNULLMAX)) + { + continue; // skip null JP to save time. + } + + pop1 += JudyCheckPopSM((Pjbu->jbu_jp) + offset, 0); + } + + assert(pop1_jp == pop1); + return(pop1); + } + + +// -- Cases below here terminate and do not recurse. -- +// +// For all of these cases except JPLEAF_B1, there is no way to check the JPs +// pop1 against the object itself; just return the pop1; but for linear leaves, +// a bounds check is possible. + +#define CHECKLEAF(MaxPop1) \ + pop1 = JU_JPLEAF_POP0(Pjp) + 1; \ + assert(pop1 >= 1); \ + assert(pop1 <= (MaxPop1)); \ + return(pop1) + +#if (defined(JUDYL) || (! defined(JU_64BIT))) + case cJU_JPLEAF1: CHECKLEAF(cJU_LEAF1_MAXPOP1); +#endif + case cJU_JPLEAF2: CHECKLEAF(cJU_LEAF2_MAXPOP1); + case cJU_JPLEAF3: CHECKLEAF(cJU_LEAF3_MAXPOP1); +#ifdef JU_64BIT + case cJU_JPLEAF4: CHECKLEAF(cJU_LEAF4_MAXPOP1); + case cJU_JPLEAF5: CHECKLEAF(cJU_LEAF5_MAXPOP1); + case cJU_JPLEAF6: CHECKLEAF(cJU_LEAF6_MAXPOP1); + case cJU_JPLEAF7: CHECKLEAF(cJU_LEAF7_MAXPOP1); +#endif + + case cJU_JPLEAF_B1: + { + Word_t subexp; + Pjlb_t Pjlb; + + pop1_jp = JU_JPLEAF_POP0(Pjp) + 1; + + Pjlb = P_JLB(Pjp->jp_Addr); + + for (subexp = 0; subexp < cJU_NUMSUBEXPL; ++subexp) + pop1 += j__udyCountBitsL(JU_JLB_BITMAP(Pjlb, subexp)); + + assert(pop1_jp == pop1); + return(pop1); + } + + JUDY1CODE(case cJ1_JPFULLPOPU1: return(cJU_JPFULLPOPU1_POP0);) + + case cJU_JPIMMED_1_01: return(1); + case cJU_JPIMMED_2_01: return(1); + case cJU_JPIMMED_3_01: return(1); +#ifdef JU_64BIT + case cJU_JPIMMED_4_01: return(1); + case cJU_JPIMMED_5_01: return(1); + case cJU_JPIMMED_6_01: return(1); + case cJU_JPIMMED_7_01: return(1); +#endif + + case cJU_JPIMMED_1_02: return(2); + case cJU_JPIMMED_1_03: return(3); +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_1_04: return(4); + case cJU_JPIMMED_1_05: return(5); + case cJU_JPIMMED_1_06: return(6); + case cJU_JPIMMED_1_07: return(7); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_1_08: return(8); + case cJ1_JPIMMED_1_09: return(9); + case cJ1_JPIMMED_1_10: return(10); + case cJ1_JPIMMED_1_11: return(11); + case cJ1_JPIMMED_1_12: return(12); + case cJ1_JPIMMED_1_13: return(13); + case cJ1_JPIMMED_1_14: return(14); + case cJ1_JPIMMED_1_15: return(15); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_2_02: return(2); + case cJU_JPIMMED_2_03: return(3); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_2_04: return(4); + case cJ1_JPIMMED_2_05: return(5); + case cJ1_JPIMMED_2_06: return(6); + case cJ1_JPIMMED_2_07: return(7); +#endif + +#if (defined(JUDY1) || defined(JU_64BIT)) + case cJU_JPIMMED_3_02: return(2); +#endif +#if (defined(JUDY1) && defined(JU_64BIT)) + case cJ1_JPIMMED_3_03: return(3); + case cJ1_JPIMMED_3_04: return(4); + case cJ1_JPIMMED_3_05: return(5); + + case cJ1_JPIMMED_4_02: return(2); + case cJ1_JPIMMED_4_03: return(3); + case cJ1_JPIMMED_5_02: return(2); + case cJ1_JPIMMED_5_03: return(3); + case cJ1_JPIMMED_6_02: return(2); + case cJ1_JPIMMED_7_02: return(2); +#endif + + } // switch (JU_JPTYPE(Pjp)) + + assert(FALSE); // unrecognized JP type => corruption. + return(0); // to make some compilers happy. + +} // JudyCheckPopSM() + +#endif // DEBUG +#endif // ! JUDYGETINLINE diff --git a/libnetdata/libnetdata.c b/libnetdata/libnetdata.c index 2997ce19e..5b6c541ed 100644 --- a/libnetdata/libnetdata.c +++ b/libnetdata/libnetdata.c @@ -1534,3 +1534,19 @@ char *find_and_replace(const char *src, const char *find, const char *replace, c return value; } + + +bool bitmap256_get_bit(BITMAP256 *ptr, uint8_t idx) { + if (unlikely(!ptr)) + return false; + return (ptr->data[idx / 64] & (1ULL << (idx % 64))); +} + +void bitmap256_set_bit(BITMAP256 *ptr, uint8_t idx, bool value) { + if (unlikely(!ptr)) + return; + if (likely(value)) + ptr->data[idx / 64] |= (1ULL << (idx % 64)); + else + ptr->data[idx / 64] &= ~(1ULL << (idx % 64)); +} diff --git a/libnetdata/libnetdata.h b/libnetdata/libnetdata.h index 34062f2a6..8cc6cce9f 100644 --- a/libnetdata/libnetdata.h +++ b/libnetdata/libnetdata.h @@ -311,6 +311,12 @@ extern char *find_and_replace(const char *src, const char *find, const char *rep // Taken from linux kernel #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) +typedef struct bitmap256 { + uint64_t data[4]; +} BITMAP256; + +extern bool bitmap256_get_bit(BITMAP256 *ptr, uint8_t idx); +extern void bitmap256_set_bit(BITMAP256 *ptr, uint8_t idx, bool value); extern void netdata_cleanup_and_exit(int ret) NORETURN; extern void send_statistics(const char *action, const char *action_result, const char *action_data); @@ -345,12 +351,25 @@ extern char *netdata_configured_host_prefix; #include "json/json.h" #include "health/health.h" #include "string/utf8.h" +#include "arrayalloc/arrayalloc.h" #include "onewayalloc/onewayalloc.h" #include "worker_utilization/worker_utilization.h" // BEWARE: Outside of the C code this also exists in alarm-notify.sh #define DEFAULT_CLOUD_BASE_URL "https://app.netdata.cloud" +#define RRD_STORAGE_TIERS 5 + +static inline size_t struct_natural_alignment(size_t size) __attribute__((const)); + +#define STRUCT_NATURAL_ALIGNMENT (sizeof(uintptr_t) * 2) +static inline size_t struct_natural_alignment(size_t size) { + if(unlikely(size % STRUCT_NATURAL_ALIGNMENT)) + size = size + STRUCT_NATURAL_ALIGNMENT - (size % STRUCT_NATURAL_ALIGNMENT); + + return size; +} + # ifdef __cplusplus } # endif diff --git a/libnetdata/log/log.c b/libnetdata/log/log.c index 90581269d..d6793b69b 100644 --- a/libnetdata/log/log.c +++ b/libnetdata/log/log.c @@ -6,7 +6,7 @@ int web_server_is_multithreaded = 1; const char *program_name = ""; -uint64_t debug_flags = DEBUG; +uint64_t debug_flags = 0; int access_log_syslog = 1; int error_log_syslog = 1; @@ -20,6 +20,14 @@ const char *stderr_filename = NULL; const char *stdout_filename = NULL; const char *facility_log = NULL; +#ifdef ENABLE_ACLK +const char *aclklog_filename = NULL; +int aclklog_fd = -1; +FILE *aclklog = NULL; +int aclklog_syslog = 1; +int aclklog_enabled = 0; +#endif + // ---------------------------------------------------------------------------- // Log facility(https://tools.ietf.org/html/rfc5424) // @@ -562,6 +570,11 @@ void reopen_all_log_files() { if(stderr_filename) open_log_file(STDERR_FILENO, stderr, stderr_filename, &error_log_syslog, 0, NULL); +#ifdef ENABLE_ACLK + if (aclklog_enabled) + aclklog = open_log_file(aclklog_fd, aclklog, aclklog_filename, NULL, 0, &aclklog_fd); +#endif + if(stdaccess_filename) stdaccess = open_log_file(stdaccess_fd, stdaccess, stdaccess_filename, &access_log_syslog, 1, &stdaccess_fd); } @@ -572,6 +585,12 @@ void open_all_log_files() { open_log_file(STDOUT_FILENO, stdout, stdout_filename, &output_log_syslog, 0, NULL); open_log_file(STDERR_FILENO, stderr, stderr_filename, &error_log_syslog, 0, NULL); + +#ifdef ENABLE_ACLK + if(aclklog_enabled) + aclklog = open_log_file(aclklog_fd, aclklog, aclklog_filename, NULL, 0, &aclklog_fd); +#endif + stdaccess = open_log_file(stdaccess_fd, stdaccess, stdaccess_filename, &access_log_syslog, 1, &stdaccess_fd); } @@ -681,6 +700,26 @@ int error_log_limit(int reset) { return 0; } +void error_log_limit_reset(void) { + log_lock(); + + error_log_errors_per_period = error_log_errors_per_period_backup; + error_log_limit(1); + + log_unlock(); +} + +void error_log_limit_unlimited(void) { + log_lock(); + + error_log_errors_per_period = error_log_errors_per_period_backup; + error_log_limit(1); + + error_log_errors_per_period = ((error_log_errors_per_period_backup * 10) < 10000) ? 10000 : (error_log_errors_per_period_backup * 10); + + log_unlock(); +} + // ---------------------------------------------------------------------------- // debug log @@ -691,7 +730,7 @@ void debug_int( const char *file, const char *function, const unsigned long line log_date(date, LOG_DATE_LENGTH); va_start( args, fmt ); - printf("%s: %s DEBUG : %s : (%04lu@%-10.10s:%-15.15s): ", date, program_name, netdata_thread_tag(), line, file, function); + printf("%s: %s DEBUG : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, netdata_thread_tag(), line, file, function); vprintf(fmt, args); va_end( args ); putchar('\n'); @@ -712,8 +751,13 @@ void info_int( const char *file, const char *function, const unsigned long line, { va_list args; + log_lock(); + // prevent logging too much - if(error_log_limit(0)) return; + if (error_log_limit(0)) { + log_unlock(); + return; + } if(error_log_syslog) { va_start( args, fmt ); @@ -724,11 +768,12 @@ void info_int( const char *file, const char *function, const unsigned long line, char date[LOG_DATE_LENGTH]; log_date(date, LOG_DATE_LENGTH); - log_lock(); - va_start( args, fmt ); - if(debug_flags) fprintf(stderr, "%s: %s INFO : %s : (%04lu@%-10.10s:%-15.15s): ", date, program_name, netdata_thread_tag(), line, file, function); - else fprintf(stderr, "%s: %s INFO : %s : ", date, program_name, netdata_thread_tag()); +#ifdef NETDATA_INTERNAL_CHECKS + fprintf(stderr, "%s: %s INFO : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, netdata_thread_tag(), line, file, function); +#else + fprintf(stderr, "%s: %s INFO : %s : ", date, program_name, netdata_thread_tag()); +#endif vfprintf( stderr, fmt, args ); va_end( args ); @@ -768,8 +813,13 @@ void error_int( const char *prefix, const char *file, const char *function, cons va_list args; + log_lock(); + // prevent logging too much - if(error_log_limit(0)) return; + if (error_log_limit(0)) { + log_unlock(); + return; + } if(error_log_syslog) { va_start( args, fmt ); @@ -780,11 +830,12 @@ void error_int( const char *prefix, const char *file, const char *function, cons char date[LOG_DATE_LENGTH]; log_date(date, LOG_DATE_LENGTH); - log_lock(); - va_start( args, fmt ); - if(debug_flags) fprintf(stderr, "%s: %s %-5.5s : %s : (%04lu@%-10.10s:%-15.15s): ", date, program_name, prefix, netdata_thread_tag(), line, file, function); - else fprintf(stderr, "%s: %s %-5.5s : %s : ", date, program_name, prefix, netdata_thread_tag()); +#ifdef NETDATA_INTERNAL_CHECKS + fprintf(stderr, "%s: %s %-5.5s : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, prefix, netdata_thread_tag(), line, file, function); +#else + fprintf(stderr, "%s: %s %-5.5s : %s : ", date, program_name, prefix, netdata_thread_tag()); +#endif vfprintf( stderr, fmt, args ); va_end( args ); @@ -826,8 +877,11 @@ void fatal_int( const char *file, const char *function, const unsigned long line log_lock(); va_start( args, fmt ); - if(debug_flags) fprintf(stderr, "%s: %s FATAL : %s : (%04lu@%-10.10s:%-15.15s): ", date, program_name, thread_tag, line, file, function); - else fprintf(stderr, "%s: %s FATAL : %s : ", date, program_name, thread_tag); +#ifdef NETDATA_INTERNAL_CHECKS + fprintf(stderr, "%s: %s FATAL : %s : (%04lu@%-20.20s:%-15.15s): ", date, program_name, thread_tag, line, file, function); +#else + fprintf(stderr, "%s: %s FATAL : %s : ", date, program_name, thread_tag); +#endif vfprintf( stderr, fmt, args ); va_end( args ); @@ -877,3 +931,22 @@ void log_access( const char *fmt, ... ) { netdata_mutex_unlock(&access_mutex); } } + +#ifdef ENABLE_ACLK +void log_aclk_message_bin( const char *data, const size_t data_len, int tx, const char *mqtt_topic, const char *message_name) { + if (aclklog) { + static netdata_mutex_t aclklog_mutex = NETDATA_MUTEX_INITIALIZER; + netdata_mutex_lock(&aclklog_mutex); + + char date[LOG_DATE_LENGTH]; + log_date(date, LOG_DATE_LENGTH); + fprintf(aclklog, "%s: %s Msg:\"%s\", MQTT-topic:\"%s\": ", date, tx ? "OUTGOING" : "INCOMING", message_name, mqtt_topic); + + fwrite(data, data_len, 1, aclklog); + + fputc('\n', aclklog); + + netdata_mutex_unlock(&aclklog_mutex); + } +} +#endif diff --git a/libnetdata/log/log.h b/libnetdata/log/log.h index 4cb62e955..ae86720cb 100644 --- a/libnetdata/log/log.h +++ b/libnetdata/log/log.h @@ -47,10 +47,6 @@ extern "C" { #define D_ACLK_SYNC 0x0000000800000000 #define D_SYSTEM 0x8000000000000000 -//#define DEBUG (D_WEB_CLIENT_ACCESS|D_LISTENER|D_RRD_STATS) -//#define DEBUG 0xffffffff -#define DEBUG (0) - extern int web_server_is_multithreaded; extern uint64_t debug_flags; @@ -65,6 +61,13 @@ extern const char *stderr_filename; extern const char *stdout_filename; extern const char *facility_log; +#ifdef ENABLE_ACLK +extern const char *aclklog_filename; +extern int aclklog_fd; +extern FILE *aclklog; +extern int aclklog_enabled; +#endif + extern int access_log_syslog; extern int error_log_syslog; extern int output_log_syslog; @@ -78,16 +81,15 @@ extern void reopen_all_log_files(); static inline void debug_dummy(void) {} -#define error_log_limit_reset() do { error_log_errors_per_period = error_log_errors_per_period_backup; error_log_limit(1); } while(0) -#define error_log_limit_unlimited() do { \ - error_log_limit_reset(); \ - error_log_errors_per_period = ((error_log_errors_per_period_backup * 10) < 10000) ? 10000 : (error_log_errors_per_period_backup * 10); \ - } while(0) +void error_log_limit_reset(void); +void error_log_limit_unlimited(void); #ifdef NETDATA_INTERNAL_CHECKS #define debug(type, args...) do { if(unlikely(debug_flags & type)) debug_int(__FILE__, __FUNCTION__, __LINE__, ##args); } while(0) +#define internal_error(condition, args...) do { if(unlikely(condition)) error_int("IERR", __FILE__, __FUNCTION__, __LINE__, ##args); } while(0) #else #define debug(type, args...) debug_dummy() +#define internal_error(args...) debug_dummy() #endif #define info(args...) info_int(__FILE__, __FUNCTION__, __LINE__, ##args) @@ -103,6 +105,10 @@ extern void error_int( const char *prefix, const char *file, const char *functio extern void fatal_int( const char *file, const char *function, const unsigned long line, const char *fmt, ... ) NORETURN PRINTFLIKE(4, 5); extern void log_access( const char *fmt, ... ) PRINTFLIKE(1, 2); +#ifdef ENABLE_ACLK +extern void log_aclk_message_bin( const char *data, const size_t data_len, int tx, const char *mqtt_topic, const char *message_name); +#endif + # ifdef __cplusplus } # endif diff --git a/libnetdata/onewayalloc/onewayalloc.c b/libnetdata/onewayalloc/onewayalloc.c index a048aebf6..59c3b6859 100644 --- a/libnetdata/onewayalloc/onewayalloc.c +++ b/libnetdata/onewayalloc/onewayalloc.c @@ -1,7 +1,7 @@ #include "onewayalloc.h" -static size_t OWA_NATURAL_PAGE_SIZE = 0; -static size_t OWA_NATURAL_ALIGNMENT = sizeof(int*); +// https://www.gnu.org/software/libc/manual/html_node/Aligned-Memory-Blocks.html +#define OWA_NATURAL_ALIGNMENT (sizeof(uintptr_t) * 2) typedef struct owa_page { size_t stats_pages; @@ -28,15 +28,22 @@ static inline size_t natural_alignment(size_t size) { // any number of times, for any amount of memory. static OWA_PAGE *onewayalloc_create_internal(OWA_PAGE *head, size_t size_hint) { - if(unlikely(!OWA_NATURAL_PAGE_SIZE)) - OWA_NATURAL_PAGE_SIZE = sysconf(_SC_PAGE_SIZE); + static size_t OWA_NATURAL_PAGE_SIZE = 0; + + if(unlikely(!OWA_NATURAL_PAGE_SIZE)) { + long int page_size = sysconf(_SC_PAGE_SIZE); + if (unlikely(page_size == -1)) + OWA_NATURAL_PAGE_SIZE = 4096; + else + OWA_NATURAL_PAGE_SIZE = page_size; + } // our default page size size_t size = OWA_NATURAL_PAGE_SIZE; // make sure the new page will fit both the requested size // and the OWA_PAGE structure at its beginning - size_hint += sizeof(OWA_PAGE); + size_hint += natural_alignment(sizeof(OWA_PAGE)); // prefer the user size if it is bigger than our size if(size_hint > size) size = size_hint; @@ -75,11 +82,11 @@ static OWA_PAGE *onewayalloc_create_internal(OWA_PAGE *head, size_t size_hint) { head->stats_pages++; head->stats_pages_size += size; - return (ONEWAYALLOC *)page; + return page; } ONEWAYALLOC *onewayalloc_create(size_t size_hint) { - return onewayalloc_create_internal(NULL, size_hint); + return (ONEWAYALLOC *)onewayalloc_create_internal(NULL, size_hint); } void *onewayalloc_mallocz(ONEWAYALLOC *owa, size_t size) { @@ -138,11 +145,11 @@ void onewayalloc_freez(ONEWAYALLOC *owa __maybe_unused, const void *ptr __maybe_ OWA_PAGE *head = (OWA_PAGE *)owa; OWA_PAGE *page; - size_t seeking = (size_t)ptr; + uintptr_t seeking = (uintptr_t)ptr; for(page = head; page ;page = page->next) { - size_t start = (size_t)page; - size_t end = start + page->size; + uintptr_t start = (uintptr_t)page; + uintptr_t end = start + page->size; if(seeking >= start && seeking <= end) { // found it - it is ours @@ -159,6 +166,14 @@ void onewayalloc_freez(ONEWAYALLOC *owa __maybe_unused, const void *ptr __maybe_ return; } +void *onewayalloc_doublesize(ONEWAYALLOC *owa, const void *src, size_t oldsize) { + size_t newsize = oldsize * 2; + void *dst = onewayalloc_mallocz(owa, newsize); + memcpy(dst, src, oldsize); + onewayalloc_freez(owa, src); + return dst; +} + void onewayalloc_destroy(ONEWAYALLOC *owa) { if(!owa) return; diff --git a/libnetdata/onewayalloc/onewayalloc.h b/libnetdata/onewayalloc/onewayalloc.h index ed8f12f39..9eb908bfb 100644 --- a/libnetdata/onewayalloc/onewayalloc.h +++ b/libnetdata/onewayalloc/onewayalloc.h @@ -14,4 +14,6 @@ extern char *onewayalloc_strdupz(ONEWAYALLOC *owa, const char *s); extern void *onewayalloc_memdupz(ONEWAYALLOC *owa, const void *src, size_t size); extern void onewayalloc_freez(ONEWAYALLOC *owa, const void *ptr); +extern void *onewayalloc_doublesize(ONEWAYALLOC *owa, const void *src, size_t oldsize); + #endif // ONEWAYALLOC_H diff --git a/libnetdata/required_dummies.h b/libnetdata/required_dummies.h index aa87e3964..6d51bfedd 100644 --- a/libnetdata/required_dummies.h +++ b/libnetdata/required_dummies.h @@ -23,7 +23,7 @@ void signals_unblock(void){}; void signals_reset(void){}; // callback required by eval() -int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, calculated_number *result) +int health_variable_lookup(const char *variable, uint32_t hash, struct rrdcalc *rc, NETDATA_DOUBLE *result) { (void)variable; (void)hash; diff --git a/libnetdata/socket/security.h b/libnetdata/socket/security.h index 17ecc6d05..dbf71a6fe 100644 --- a/libnetdata/socket/security.h +++ b/libnetdata/socket/security.h @@ -22,13 +22,21 @@ #define OPENSSL_VERSION_097 0x0907000L #define OPENSSL_VERSION_110 0x10100000L #define OPENSSL_VERSION_111 0x10101000L +#define OPENSSL_VERSION_300 0x30000000L # include # include +# include +# include # if (SSLEAY_VERSION_NUMBER >= OPENSSL_VERSION_097) && (OPENSSL_VERSION_NUMBER < OPENSSL_VERSION_110) # include # endif +#if OPENSSL_VERSION_NUMBER >= OPENSSL_VERSION_300 +#include +#include +#endif + struct netdata_ssl{ SSL *conn; //SSL connection uint32_t flags; //The flags for SSL connection diff --git a/libnetdata/statistical/statistical.c b/libnetdata/statistical/statistical.c index ba8f0c45a..ef9fe4e56 100644 --- a/libnetdata/statistical/statistical.c +++ b/libnetdata/statistical/statistical.c @@ -2,28 +2,28 @@ #include "../libnetdata.h" -LONG_DOUBLE default_single_exponential_smoothing_alpha = 0.1; +NETDATA_DOUBLE default_single_exponential_smoothing_alpha = 0.1; -void log_series_to_stderr(LONG_DOUBLE *series, size_t entries, calculated_number result, const char *msg) { - const LONG_DOUBLE *value, *end = &series[entries]; +void log_series_to_stderr(NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE result, const char *msg) { + const NETDATA_DOUBLE *value, *end = &series[entries]; fprintf(stderr, "%s of %zu entries [ ", msg, entries); for(value = series; value < end ;value++) { if(value != series) fprintf(stderr, ", "); - fprintf(stderr, "%" LONG_DOUBLE_MODIFIER, *value); + fprintf(stderr, "%" NETDATA_DOUBLE_MODIFIER, *value); } - fprintf(stderr, " ] results in " CALCULATED_NUMBER_FORMAT "\n", result); + fprintf(stderr, " ] results in " NETDATA_DOUBLE_FORMAT "\n", result); } // -------------------------------------------------------------------------------------------------------------------- -inline LONG_DOUBLE sum_and_count(const LONG_DOUBLE *series, size_t entries, size_t *count) { - const LONG_DOUBLE *value, *end = &series[entries]; - LONG_DOUBLE sum = 0; +inline NETDATA_DOUBLE sum_and_count(const NETDATA_DOUBLE *series, size_t entries, size_t *count) { + const NETDATA_DOUBLE *value, *end = &series[entries]; + NETDATA_DOUBLE sum = 0; size_t c = 0; for(value = series; value < end ; value++) { - if(calculated_number_isnumber(*value)) { + if(netdata_double_isnumber(*value)) { sum += *value; c++; } @@ -35,42 +35,42 @@ inline LONG_DOUBLE sum_and_count(const LONG_DOUBLE *series, size_t entries, size return sum; } -inline LONG_DOUBLE sum(const LONG_DOUBLE *series, size_t entries) { +inline NETDATA_DOUBLE sum(const NETDATA_DOUBLE *series, size_t entries) { return sum_and_count(series, entries, NULL); } -inline LONG_DOUBLE average(const LONG_DOUBLE *series, size_t entries) { +inline NETDATA_DOUBLE average(const NETDATA_DOUBLE *series, size_t entries) { size_t count = 0; - LONG_DOUBLE sum = sum_and_count(series, entries, &count); + NETDATA_DOUBLE sum = sum_and_count(series, entries, &count); if(unlikely(!count)) return NAN; - return sum / (LONG_DOUBLE)count; + return sum / (NETDATA_DOUBLE)count; } // -------------------------------------------------------------------------------------------------------------------- -LONG_DOUBLE moving_average(const LONG_DOUBLE *series, size_t entries, size_t period) { +NETDATA_DOUBLE moving_average(const NETDATA_DOUBLE *series, size_t entries, size_t period) { if(unlikely(period <= 0)) return 0.0; size_t i, count; - LONG_DOUBLE sum = 0, avg = 0; - LONG_DOUBLE p[period]; + NETDATA_DOUBLE sum = 0, avg = 0; + NETDATA_DOUBLE p[period]; for(count = 0; count < period ; count++) p[count] = 0.0; for(i = 0, count = 0; i < entries; i++) { - LONG_DOUBLE value = series[i]; - if(unlikely(!calculated_number_isnumber(value))) continue; + NETDATA_DOUBLE value = series[i]; + if(unlikely(!netdata_double_isnumber(value))) continue; if(unlikely(count < period)) { sum += value; - avg = (count == period - 1) ? sum / (LONG_DOUBLE)period : 0; + avg = (count == period - 1) ? sum / (NETDATA_DOUBLE)period : 0; } else { sum = sum - p[count % period] + value; - avg = sum / (LONG_DOUBLE)period; + avg = sum / (NETDATA_DOUBLE)period; } p[count % period] = value; @@ -83,8 +83,8 @@ LONG_DOUBLE moving_average(const LONG_DOUBLE *series, size_t entries, size_t per // -------------------------------------------------------------------------------------------------------------------- static int qsort_compare(const void *a, const void *b) { - LONG_DOUBLE *p1 = (LONG_DOUBLE *)a, *p2 = (LONG_DOUBLE *)b; - LONG_DOUBLE n1 = *p1, n2 = *p2; + NETDATA_DOUBLE *p1 = (NETDATA_DOUBLE *)a, *p2 = (NETDATA_DOUBLE *)b; + NETDATA_DOUBLE n1 = *p1, n2 = *p2; if(unlikely(isnan(n1) || isnan(n2))) { if(isnan(n1) && !isnan(n2)) return -1; @@ -102,22 +102,22 @@ static int qsort_compare(const void *a, const void *b) { return 0; } -inline void sort_series(LONG_DOUBLE *series, size_t entries) { - qsort(series, entries, sizeof(LONG_DOUBLE), qsort_compare); +inline void sort_series(NETDATA_DOUBLE *series, size_t entries) { + qsort(series, entries, sizeof(NETDATA_DOUBLE), qsort_compare); } -inline LONG_DOUBLE *copy_series(const LONG_DOUBLE *series, size_t entries) { - LONG_DOUBLE *copy = mallocz(sizeof(LONG_DOUBLE) * entries); - memcpy(copy, series, sizeof(LONG_DOUBLE) * entries); +inline NETDATA_DOUBLE *copy_series(const NETDATA_DOUBLE *series, size_t entries) { + NETDATA_DOUBLE *copy = mallocz(sizeof(NETDATA_DOUBLE) * entries); + memcpy(copy, series, sizeof(NETDATA_DOUBLE) * entries); return copy; } -LONG_DOUBLE median_on_sorted_series(const LONG_DOUBLE *series, size_t entries) { +NETDATA_DOUBLE median_on_sorted_series(const NETDATA_DOUBLE *series, size_t entries) { if(unlikely(entries == 0)) return NAN; if(unlikely(entries == 1)) return series[0]; if(unlikely(entries == 2)) return (series[0] + series[1]) / 2; - LONG_DOUBLE average; + NETDATA_DOUBLE average; if(entries % 2 == 0) { size_t m = entries / 2; average = (series[m] + series[m + 1]) / 2; @@ -129,17 +129,17 @@ LONG_DOUBLE median_on_sorted_series(const LONG_DOUBLE *series, size_t entries) { return average; } -LONG_DOUBLE median(const LONG_DOUBLE *series, size_t entries) { +NETDATA_DOUBLE median(const NETDATA_DOUBLE *series, size_t entries) { if(unlikely(entries == 0)) return NAN; if(unlikely(entries == 1)) return series[0]; if(unlikely(entries == 2)) return (series[0] + series[1]) / 2; - LONG_DOUBLE *copy = copy_series(series, entries); + NETDATA_DOUBLE *copy = copy_series(series, entries); sort_series(copy, entries); - LONG_DOUBLE avg = median_on_sorted_series(copy, entries); + NETDATA_DOUBLE avg = median_on_sorted_series(copy, entries); freez(copy); return avg; @@ -147,18 +147,18 @@ LONG_DOUBLE median(const LONG_DOUBLE *series, size_t entries) { // -------------------------------------------------------------------------------------------------------------------- -LONG_DOUBLE moving_median(const LONG_DOUBLE *series, size_t entries, size_t period) { +NETDATA_DOUBLE moving_median(const NETDATA_DOUBLE *series, size_t entries, size_t period) { if(entries <= period) return median(series, entries); - LONG_DOUBLE *data = copy_series(series, entries); + NETDATA_DOUBLE *data = copy_series(series, entries); size_t i; for(i = period; i < entries; i++) { data[i - period] = median(&series[i - period], period); } - LONG_DOUBLE avg = median(data, entries - period); + NETDATA_DOUBLE avg = median(data, entries - period); freez(data); return avg; } @@ -166,17 +166,17 @@ LONG_DOUBLE moving_median(const LONG_DOUBLE *series, size_t entries, size_t peri // -------------------------------------------------------------------------------------------------------------------- // http://stackoverflow.com/a/15150143/4525767 -LONG_DOUBLE running_median_estimate(const LONG_DOUBLE *series, size_t entries) { - LONG_DOUBLE median = 0.0f; - LONG_DOUBLE average = 0.0f; +NETDATA_DOUBLE running_median_estimate(const NETDATA_DOUBLE *series, size_t entries) { + NETDATA_DOUBLE median = 0.0f; + NETDATA_DOUBLE average = 0.0f; size_t i; for(i = 0; i < entries ; i++) { - LONG_DOUBLE value = series[i]; - if(unlikely(!calculated_number_isnumber(value))) continue; + NETDATA_DOUBLE value = series[i]; + if(unlikely(!netdata_double_isnumber(value))) continue; average += ( value - average ) * 0.1f; // rough running average. - median += copysignl( average * 0.01, value - median ); + median += copysignndd( average * 0.01, value - median ); } return median; @@ -184,16 +184,16 @@ LONG_DOUBLE running_median_estimate(const LONG_DOUBLE *series, size_t entries) { // -------------------------------------------------------------------------------------------------------------------- -LONG_DOUBLE standard_deviation(const LONG_DOUBLE *series, size_t entries) { +NETDATA_DOUBLE standard_deviation(const NETDATA_DOUBLE *series, size_t entries) { if(unlikely(entries == 0)) return NAN; if(unlikely(entries == 1)) return series[0]; - const LONG_DOUBLE *value, *end = &series[entries]; + const NETDATA_DOUBLE *value, *end = &series[entries]; size_t count; - LONG_DOUBLE sum; + NETDATA_DOUBLE sum; for(count = 0, sum = 0, value = series ; value < end ;value++) { - if(likely(calculated_number_isnumber(*value))) { + if(likely(netdata_double_isnumber(*value))) { count++; sum += *value; } @@ -202,55 +202,55 @@ LONG_DOUBLE standard_deviation(const LONG_DOUBLE *series, size_t entries) { if(unlikely(count == 0)) return NAN; if(unlikely(count == 1)) return sum; - LONG_DOUBLE average = sum / (LONG_DOUBLE)count; + NETDATA_DOUBLE average = sum / (NETDATA_DOUBLE)count; for(count = 0, sum = 0, value = series ; value < end ;value++) { - if(calculated_number_isnumber(*value)) { + if(netdata_double_isnumber(*value)) { count++; - sum += powl(*value - average, 2); + sum += powndd(*value - average, 2); } } if(unlikely(count == 0)) return NAN; if(unlikely(count == 1)) return average; - LONG_DOUBLE variance = sum / (LONG_DOUBLE)(count); // remove -1 from count to have a population stddev - LONG_DOUBLE stddev = sqrtl(variance); + NETDATA_DOUBLE variance = sum / (NETDATA_DOUBLE)(count); // remove -1 from count to have a population stddev + NETDATA_DOUBLE stddev = sqrtndd(variance); return stddev; } // -------------------------------------------------------------------------------------------------------------------- -LONG_DOUBLE single_exponential_smoothing(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha) { +NETDATA_DOUBLE single_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha) { if(unlikely(entries == 0)) return NAN; if(unlikely(isnan(alpha))) alpha = default_single_exponential_smoothing_alpha; - const LONG_DOUBLE *value = series, *end = &series[entries]; - LONG_DOUBLE level = (1.0 - alpha) * (*value); + const NETDATA_DOUBLE *value = series, *end = &series[entries]; + NETDATA_DOUBLE level = (1.0 - alpha) * (*value); for(value++ ; value < end; value++) { - if(likely(calculated_number_isnumber(*value))) + if(likely(netdata_double_isnumber(*value))) level = alpha * (*value) + (1.0 - alpha) * level; } return level; } -LONG_DOUBLE single_exponential_smoothing_reverse(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha) { +NETDATA_DOUBLE single_exponential_smoothing_reverse(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha) { if(unlikely(entries == 0)) return NAN; if(unlikely(isnan(alpha))) alpha = default_single_exponential_smoothing_alpha; - const LONG_DOUBLE *value = &series[entries -1]; - LONG_DOUBLE level = (1.0 - alpha) * (*value); + const NETDATA_DOUBLE *value = &series[entries -1]; + NETDATA_DOUBLE level = (1.0 - alpha) * (*value); for(value++ ; value >= series; value--) { - if(likely(calculated_number_isnumber(*value))) + if(likely(netdata_double_isnumber(*value))) level = alpha * (*value) + (1.0 - alpha) * level; } @@ -260,11 +260,14 @@ LONG_DOUBLE single_exponential_smoothing_reverse(const LONG_DOUBLE *series, size // -------------------------------------------------------------------------------------------------------------------- // http://grisha.org/blog/2016/02/16/triple-exponential-smoothing-forecasting-part-ii/ -LONG_DOUBLE double_exponential_smoothing(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha, LONG_DOUBLE beta, LONG_DOUBLE *forecast) { +NETDATA_DOUBLE double_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, + NETDATA_DOUBLE alpha, + NETDATA_DOUBLE beta, + NETDATA_DOUBLE *forecast) { if(unlikely(entries == 0)) return NAN; - LONG_DOUBLE level, trend; + NETDATA_DOUBLE level, trend; if(unlikely(isnan(alpha))) alpha = 0.3; @@ -279,11 +282,10 @@ LONG_DOUBLE double_exponential_smoothing(const LONG_DOUBLE *series, size_t entri else trend = 0; - const LONG_DOUBLE *value = series; + const NETDATA_DOUBLE *value = series; for(value++ ; value >= series; value--) { - if(likely(calculated_number_isnumber(*value))) { - - LONG_DOUBLE last_level = level; + if(likely(netdata_double_isnumber(*value))) { + NETDATA_DOUBLE last_level = level; level = alpha * *value + (1.0 - alpha) * (level + trend); trend = beta * (level - last_level) + (1.0 - beta) * trend; @@ -320,24 +322,26 @@ LONG_DOUBLE double_exponential_smoothing(const LONG_DOUBLE *series, size_t entri * s[t] = γ (Y[t] / a[t]) + (1-γ) s[t-p] */ static int __HoltWinters( - const LONG_DOUBLE *series, + const NETDATA_DOUBLE *series, int entries, // start_time + h - LONG_DOUBLE alpha, // alpha parameter of Holt-Winters Filter. - LONG_DOUBLE beta, // beta parameter of Holt-Winters Filter. If set to 0, the function will do exponential smoothing. - LONG_DOUBLE gamma, // gamma parameter used for the seasonal component. If set to 0, an non-seasonal model is fitted. + NETDATA_DOUBLE alpha, // alpha parameter of Holt-Winters Filter. + NETDATA_DOUBLE + beta, // beta parameter of Holt-Winters Filter. If set to 0, the function will do exponential smoothing. + NETDATA_DOUBLE + gamma, // gamma parameter used for the seasonal component. If set to 0, an non-seasonal model is fitted. const int *seasonal, const int *period, - const LONG_DOUBLE *a, // Start value for level (a[0]). - const LONG_DOUBLE *b, // Start value for trend (b[0]). - LONG_DOUBLE *s, // Vector of start values for the seasonal component (s_1[0] ... s_p[0]) + const NETDATA_DOUBLE *a, // Start value for level (a[0]). + const NETDATA_DOUBLE *b, // Start value for trend (b[0]). + NETDATA_DOUBLE *s, // Vector of start values for the seasonal component (s_1[0] ... s_p[0]) /* return values */ - LONG_DOUBLE *SSE, // The final sum of squared errors achieved in optimizing - LONG_DOUBLE *level, // Estimated values for the level component (size entries - t + 2) - LONG_DOUBLE *trend, // Estimated values for the trend component (size entries - t + 2) - LONG_DOUBLE *season // Estimated values for the seasonal component (size entries - t + 2) + NETDATA_DOUBLE *SSE, // The final sum of squared errors achieved in optimizing + NETDATA_DOUBLE *level, // Estimated values for the level component (size entries - t + 2) + NETDATA_DOUBLE *trend, // Estimated values for the trend component (size entries - t + 2) + NETDATA_DOUBLE *season // Estimated values for the seasonal component (size entries - t + 2) ) { if(unlikely(entries < 4)) @@ -345,13 +349,13 @@ static int __HoltWinters( int start_time = 2; - LONG_DOUBLE res = 0, xhat = 0, stmp = 0; + NETDATA_DOUBLE res = 0, xhat = 0, stmp = 0; int i, i0, s0; /* copy start values to the beginning of the vectors */ level[0] = *a; if(beta > 0) trend[0] = *b; - if(gamma > 0) memcpy(season, s, *period * sizeof(LONG_DOUBLE)); + if(gamma > 0) memcpy(season, s, *period * sizeof(NETDATA_DOUBLE)); for(i = start_time - 1; i < entries; i++) { /* indices for period i */ @@ -397,7 +401,11 @@ static int __HoltWinters( return 1; } -LONG_DOUBLE holtwinters(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha, LONG_DOUBLE beta, LONG_DOUBLE gamma, LONG_DOUBLE *forecast) { +NETDATA_DOUBLE holtwinters(const NETDATA_DOUBLE *series, size_t entries, + NETDATA_DOUBLE alpha, + NETDATA_DOUBLE beta, + NETDATA_DOUBLE gamma, + NETDATA_DOUBLE *forecast) { if(unlikely(isnan(alpha))) alpha = 0.3; @@ -409,15 +417,15 @@ LONG_DOUBLE holtwinters(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE a int seasonal = 0; int period = 0; - LONG_DOUBLE a0 = series[0]; - LONG_DOUBLE b0 = 0; - LONG_DOUBLE s[] = {}; + NETDATA_DOUBLE a0 = series[0]; + NETDATA_DOUBLE b0 = 0; + NETDATA_DOUBLE s[] = {}; - LONG_DOUBLE errors = 0.0; + NETDATA_DOUBLE errors = 0.0; size_t nb_computations = entries; - LONG_DOUBLE *estimated_level = callocz(nb_computations, sizeof(LONG_DOUBLE)); - LONG_DOUBLE *estimated_trend = callocz(nb_computations, sizeof(LONG_DOUBLE)); - LONG_DOUBLE *estimated_season = callocz(nb_computations, sizeof(LONG_DOUBLE)); + NETDATA_DOUBLE *estimated_level = callocz(nb_computations, sizeof(NETDATA_DOUBLE)); + NETDATA_DOUBLE *estimated_trend = callocz(nb_computations, sizeof(NETDATA_DOUBLE)); + NETDATA_DOUBLE *estimated_season = callocz(nb_computations, sizeof(NETDATA_DOUBLE)); int ret = __HoltWinters( series, @@ -436,7 +444,7 @@ LONG_DOUBLE holtwinters(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE a estimated_season ); - LONG_DOUBLE value = estimated_level[nb_computations - 1]; + NETDATA_DOUBLE value = estimated_level[nb_computations - 1]; if(forecast) *forecast = 0.0; diff --git a/libnetdata/statistical/statistical.h b/libnetdata/statistical/statistical.h index bbf241ff2..9496e0e7f 100644 --- a/libnetdata/statistical/statistical.h +++ b/libnetdata/statistical/statistical.h @@ -5,22 +5,30 @@ #include "../libnetdata.h" -extern void log_series_to_stderr(LONG_DOUBLE *series, size_t entries, calculated_number result, const char *msg); +extern void log_series_to_stderr(NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE result, const char *msg); -extern LONG_DOUBLE average(const LONG_DOUBLE *series, size_t entries); -extern LONG_DOUBLE moving_average(const LONG_DOUBLE *series, size_t entries, size_t period); -extern LONG_DOUBLE median(const LONG_DOUBLE *series, size_t entries); -extern LONG_DOUBLE moving_median(const LONG_DOUBLE *series, size_t entries, size_t period); -extern LONG_DOUBLE running_median_estimate(const LONG_DOUBLE *series, size_t entries); -extern LONG_DOUBLE standard_deviation(const LONG_DOUBLE *series, size_t entries); -extern LONG_DOUBLE single_exponential_smoothing(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha); -extern LONG_DOUBLE single_exponential_smoothing_reverse(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha); -extern LONG_DOUBLE double_exponential_smoothing(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha, LONG_DOUBLE beta, LONG_DOUBLE *forecast); -extern LONG_DOUBLE holtwinters(const LONG_DOUBLE *series, size_t entries, LONG_DOUBLE alpha, LONG_DOUBLE beta, LONG_DOUBLE gamma, LONG_DOUBLE *forecast); -extern LONG_DOUBLE sum_and_count(const LONG_DOUBLE *series, size_t entries, size_t *count); -extern LONG_DOUBLE sum(const LONG_DOUBLE *series, size_t entries); -extern LONG_DOUBLE median_on_sorted_series(const LONG_DOUBLE *series, size_t entries); -extern LONG_DOUBLE *copy_series(const LONG_DOUBLE *series, size_t entries); -extern void sort_series(LONG_DOUBLE *series, size_t entries); +extern NETDATA_DOUBLE average(const NETDATA_DOUBLE *series, size_t entries); +extern NETDATA_DOUBLE moving_average(const NETDATA_DOUBLE *series, size_t entries, size_t period); +extern NETDATA_DOUBLE median(const NETDATA_DOUBLE *series, size_t entries); +extern NETDATA_DOUBLE moving_median(const NETDATA_DOUBLE *series, size_t entries, size_t period); +extern NETDATA_DOUBLE running_median_estimate(const NETDATA_DOUBLE *series, size_t entries); +extern NETDATA_DOUBLE standard_deviation(const NETDATA_DOUBLE *series, size_t entries); +extern NETDATA_DOUBLE single_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha); +extern NETDATA_DOUBLE +single_exponential_smoothing_reverse(const NETDATA_DOUBLE *series, size_t entries, NETDATA_DOUBLE alpha); +extern NETDATA_DOUBLE double_exponential_smoothing(const NETDATA_DOUBLE *series, size_t entries, + NETDATA_DOUBLE alpha, + NETDATA_DOUBLE beta, + NETDATA_DOUBLE *forecast); +extern NETDATA_DOUBLE holtwinters(const NETDATA_DOUBLE *series, size_t entries, + NETDATA_DOUBLE alpha, + NETDATA_DOUBLE beta, + NETDATA_DOUBLE gamma, + NETDATA_DOUBLE *forecast); +extern NETDATA_DOUBLE sum_and_count(const NETDATA_DOUBLE *series, size_t entries, size_t *count); +extern NETDATA_DOUBLE sum(const NETDATA_DOUBLE *series, size_t entries); +extern NETDATA_DOUBLE median_on_sorted_series(const NETDATA_DOUBLE *series, size_t entries); +extern NETDATA_DOUBLE *copy_series(const NETDATA_DOUBLE *series, size_t entries); +extern void sort_series(NETDATA_DOUBLE *series, size_t entries); #endif //NETDATA_STATISTICAL_H diff --git a/libnetdata/storage_number/storage_number.c b/libnetdata/storage_number/storage_number.c index ba7a66874..6a8b68c11 100644 --- a/libnetdata/storage_number/storage_number.c +++ b/libnetdata/storage_number/storage_number.c @@ -2,12 +2,7 @@ #include "../libnetdata.h" -#define get_storage_number_flags(value) \ - ((((storage_number)(value)) & (1 << 24)) | \ - (((storage_number)(value)) & (1 << 25)) | \ - (((storage_number)(value)) & (1 << 26))) - -storage_number pack_storage_number(calculated_number value, uint32_t flags) { +storage_number pack_storage_number(NETDATA_DOUBLE value, SN_FLAGS flags) { // bit 32 = sign 0:positive, 1:negative // bit 31 = 0:divide, 1:multiply // bit 30, 29, 28 = (multiplier or divider) 0-7 (8 total) @@ -16,44 +11,48 @@ storage_number pack_storage_number(calculated_number value, uint32_t flags) { // bit 25 SN_ANOMALY_BIT = 0: anomalous, 1: not anomalous // bit 24 to bit 1 = the value - storage_number r = get_storage_number_flags(flags); - if(!value) - goto RET_SN; + if(unlikely(fpclassify(value) == FP_NAN || fpclassify(value) == FP_INFINITE)) + return SN_EMPTY_SLOT; + + storage_number r = flags & SN_USER_FLAGS; + + if(unlikely(fpclassify(value) == FP_ZERO || fpclassify(value) == FP_SUBNORMAL)) + return r; int m = 0; - calculated_number n = value, factor = 10; + NETDATA_DOUBLE n = value, factor = 10; // if the value is negative // add the sign bit and make it positive if(n < 0) { - r += (1 << 31); // the sign bit 32 + r += SN_FLAG_NEGATIVE; // the sign bit 32 n = -n; } if(n / 10000000.0 > 0x00ffffff) { factor = 100; - r |= SN_EXISTS_100; + r |= SN_FLAG_NOT_EXISTS_MUL100; } // make its integer part fit in 0x00ffffff // by dividing it by 10 up to 7 times // and increasing the multiplier - while(m < 7 && n > (calculated_number)0x00ffffff) { + while(m < 7 && n > (NETDATA_DOUBLE)0x00ffffff) { n /= factor; m++; } if(m) { - // the value was too big and we divided it - // so we add a multiplier to unpack it - r += (1 << 30) + (m << 27); // the multiplier m + // the value was too big, and we divided it + // so, we add a multiplier to unpack it + r += SN_FLAG_MULTIPLY + (m << 27); // the multiplier m - if(n > (calculated_number)0x00ffffff) { + if(n > (NETDATA_DOUBLE)0x00ffffff) { #ifdef NETDATA_INTERNAL_CHECKS - error("Number " CALCULATED_NUMBER_FORMAT " is too big.", value); + error("Number " NETDATA_DOUBLE_FORMAT " is too big.", value); #endif r += 0x00ffffff; - goto RET_SN; + return r; } } else { @@ -62,18 +61,18 @@ storage_number pack_storage_number(calculated_number value, uint32_t flags) { // while the value is below 0x0019999e we can // multiply it by 10, up to 7 times, increasing // the multiplier - while(m < 7 && n < (calculated_number)0x0019999e) { + while(m < 7 && n < (NETDATA_DOUBLE)0x0019999e) { n *= 10; m++; } - if (unlikely(n > (calculated_number) (0x00ffffff))) { + if (unlikely(n > (NETDATA_DOUBLE)0x00ffffff)) { n /= 10; m--; } - // the value was small enough and we multiplied it - // so we add a divider to unpack it - r += (0 << 30) + (m << 27); // the divider m + // the value was small enough, and we multiplied it + // so, we add a divider to unpack it + r += (m << 27); // the divider m } #ifdef STORAGE_WITH_MATH @@ -84,15 +83,11 @@ storage_number pack_storage_number(calculated_number value, uint32_t flags) { r += (storage_number)n; #endif -RET_SN: - if (r == SN_EMPTY_SLOT) - r = SN_ANOMALOUS_ZERO; - return r; } // Lookup table to make storage number unpacking efficient. -calculated_number unpack_storage_number_lut10x[4 * 8]; +NETDATA_DOUBLE unpack_storage_number_lut10x[4 * 8]; __attribute__((constructor)) void initialize_lut(void) { // The lookup table is partitioned in 4 subtables based on the @@ -109,7 +104,7 @@ __attribute__((constructor)) void initialize_lut(void) { } /* -int print_calculated_number(char *str, calculated_number value) +int print_netdata_double(char *str, NETDATA_DOUBLE value) { char *wstr = str; @@ -119,9 +114,9 @@ int print_calculated_number(char *str, calculated_number value) #ifdef STORAGE_WITH_MATH // without llrintl() there are rounding problems // for example 0.9 becomes 0.89 - unsigned long long uvalue = (unsigned long long int) llrintl(value * (calculated_number)100000); + unsigned long long uvalue = (unsigned long long int) llrintl(value * (NETDATA_DOUBLE)100000); #else - unsigned long long uvalue = value * (calculated_number)100000; + unsigned long long uvalue = value * (NETDATA_DOUBLE)100000; #endif wstr = print_number_llu_r_smart(str, uvalue); @@ -165,8 +160,8 @@ int print_calculated_number(char *str, calculated_number value) } */ -int print_calculated_number(char *str, calculated_number value) { - // info("printing number " CALCULATED_NUMBER_FORMAT, value); +int print_netdata_double(char *str, NETDATA_DOUBLE value) { + // info("printing number " NETDATA_DOUBLE_FORMAT, value); char integral_str[50], fractional_str[50]; char *wstr = str; @@ -176,22 +171,22 @@ int print_calculated_number(char *str, calculated_number value) { value = -value; } - calculated_number integral, fractional; + NETDATA_DOUBLE integral, fractional; #ifdef STORAGE_WITH_MATH - fractional = calculated_number_modf(value, &integral) * 10000000.0; + fractional = modfndd(value, &integral) * 10000000.0; #else fractional = ((unsigned long long)(value * 10000000ULL) % 10000000ULL); #endif unsigned long long integral_int = (unsigned long long)integral; - unsigned long long fractional_int = (unsigned long long)calculated_number_llrint(fractional); + unsigned long long fractional_int = (unsigned long long)llrintndd(fractional); if(unlikely(fractional_int >= 10000000)) { integral_int += 1; fractional_int -= 10000000; } - // info("integral " CALCULATED_NUMBER_FORMAT " (%llu), fractional " CALCULATED_NUMBER_FORMAT " (%llu)", integral, integral_int, fractional, fractional_int); + // info("integral " NETDATA_DOUBLE_FORMAT " (%llu), fractional " NETDATA_DOUBLE_FORMAT " (%llu)", integral, integral_int, fractional, fractional_int); char *istre; if(unlikely(integral_int == 0)) { diff --git a/libnetdata/storage_number/storage_number.h b/libnetdata/storage_number/storage_number.h index 7e7b511b0..faea47751 100644 --- a/libnetdata/storage_number/storage_number.h +++ b/libnetdata/storage_number/storage_number.h @@ -3,92 +3,114 @@ #ifndef NETDATA_STORAGE_NUMBER_H #define NETDATA_STORAGE_NUMBER_H 1 +#include #include "../libnetdata.h" -#ifdef NETDATA_WITHOUT_LONG_DOUBLE +#ifdef NETDATA_WITH_LONG_DOUBLE -#define powl pow -#define modfl modf -#define llrintl llrint -#define roundl round -#define sqrtl sqrt -#define copysignl copysign -#define strtold strtod +typedef long double NETDATA_DOUBLE; +#define NETDATA_DOUBLE_FORMAT "%0.7Lf" +#define NETDATA_DOUBLE_FORMAT_ZERO "%0.0Lf" +#define NETDATA_DOUBLE_FORMAT_AUTO "%Lf" +#define NETDATA_DOUBLE_MODIFIER "Lf" -typedef double calculated_number; -#define CALCULATED_NUMBER_FORMAT "%0.7f" -#define CALCULATED_NUMBER_FORMAT_ZERO "%0.0f" -#define CALCULATED_NUMBER_FORMAT_AUTO "%f" +#define NETDATA_DOUBLE_MAX LDBL_MAX -#define LONG_DOUBLE_MODIFIER "f" -typedef double LONG_DOUBLE; +#define strtondd(s, endptr) strtold(s, endptr) +#define powndd(x, y) powl(x, y) +#define llrintndd(x) llrintl(x) +#define roundndd(x) roundl(x) +#define sqrtndd(x) sqrtl(x) +#define copysignndd(x, y) copysignl(x, y) +#define modfndd(x, y) modfl(x, y) +#define fabsndd(x) fabsl(x) -#else // NETDATA_WITHOUT_LONG_DOUBLE +#else // NETDATA_WITH_LONG_DOUBLE -typedef long double calculated_number; -#define CALCULATED_NUMBER_FORMAT "%0.7Lf" -#define CALCULATED_NUMBER_FORMAT_ZERO "%0.0Lf" -#define CALCULATED_NUMBER_FORMAT_AUTO "%Lf" +typedef double NETDATA_DOUBLE; +#define NETDATA_DOUBLE_FORMAT "%0.7f" +#define NETDATA_DOUBLE_FORMAT_ZERO "%0.0f" +#define NETDATA_DOUBLE_FORMAT_AUTO "%f" +#define NETDATA_DOUBLE_MODIFIER "f" -#define LONG_DOUBLE_MODIFIER "Lf" -typedef long double LONG_DOUBLE; +#define NETDATA_DOUBLE_MAX DBL_MAX -#endif // NETDATA_WITHOUT_LONG_DOUBLE +#define strtondd(s, endptr) strtod(s, endptr) +#define powndd(x, y) pow(x, y) +#define llrintndd(x) llrint(x) +#define roundndd(x) round(x) +#define sqrtndd(x) sqrt(x) +#define copysignndd(x, y) copysign(x, y) +#define modfndd(x, y) modf(x, y) +#define fabsndd(x) fabs(x) -//typedef long long calculated_number; -//#define CALCULATED_NUMBER_FORMAT "%lld" +#endif // NETDATA_WITH_LONG_DOUBLE typedef long long collected_number; #define COLLECTED_NUMBER_FORMAT "%lld" -/* -typedef long double collected_number; -#define COLLECTED_NUMBER_FORMAT "%0.7Lf" -*/ +#define epsilonndd (NETDATA_DOUBLE)0.0000001 +#define considered_equal_ndd(a, b) (fabsndd((a) - (b)) < epsilonndd) -#define calculated_number_modf(x, y) modfl(x, y) -#define calculated_number_llrint(x) llrintl(x) -#define calculated_number_round(x) roundl(x) -#define calculated_number_fabs(x) fabsl(x) -#define calculated_number_pow(x, y) powl(x, y) -#define calculated_number_epsilon (calculated_number)0.0000001 +#if defined(HAVE_ISFINITE) || defined(isfinite) +// The isfinite() macro shall determine whether its argument has a +// finite value (zero, subnormal, or normal, and not infinite or NaN). +#define netdata_double_isnumber(a) (isfinite(a)) +#elif defined(HAVE_FINITE) || defined(finite) +#define netdata_double_isnumber(a) (finite(a)) +#else +#define netdata_double_isnumber(a) (fpclassify(a) != FP_NAN && fpclassify(a) != FP_INFINITE) +#endif -#define calculated_number_equal(a, b) (calculated_number_fabs((a) - (b)) < calculated_number_epsilon) +typedef uint32_t storage_number; -#define calculated_number_isnumber(a) (!(fpclassify(a) & (FP_NAN|FP_INFINITE))) +typedef struct storage_number_tier1 { + float sum_value; + float min_value; + float max_value; + uint16_t count; + uint16_t anomaly_count; +} storage_number_tier1_t; -typedef uint32_t storage_number; #define STORAGE_NUMBER_FORMAT "%u" -#define SN_ANOMALY_BIT (1 << 24) // the anomaly bit of the value -#define SN_EXISTS_RESET (1 << 25) // the value has been overflown -#define SN_EXISTS_100 (1 << 26) // very large value (multiplier is 100 instead of 10) +typedef enum { + SN_FLAG_NONE = 0, + SN_FLAG_NOT_ANOMALOUS = (1 << 24), // the anomaly bit of the value (0:anomalous, 1:not anomalous) + SN_FLAG_RESET = (1 << 25), // the value has been overflown + SN_FLAG_NOT_EXISTS_MUL100 = (1 << 26), // very large value (multiplier is 100 instead of 10) + SN_FLAG_MULTIPLY = (1 << 30), // multiply, else divide + SN_FLAG_NEGATIVE = (1 << 31), // negative, else positive +} SN_FLAGS; -#define SN_DEFAULT_FLAGS SN_ANOMALY_BIT +#define SN_USER_FLAGS (SN_FLAG_NOT_ANOMALOUS | SN_FLAG_RESET) -#define SN_EMPTY_SLOT 0x00000000 +// default flags for all storage numbers +// anomaly bit is reversed, so we set it by default +#define SN_DEFAULT_FLAGS SN_FLAG_NOT_ANOMALOUS // When the calculated number is zero and the value is anomalous (ie. it's bit // is zero) we want to return a storage_number representation that is // different from the empty slot. We achieve this by mapping zero to // SN_EXISTS_100. Unpacking the SN_EXISTS_100 value will return zero because // its fraction field (as well as its exponent factor field) will be zero. -#define SN_ANOMALOUS_ZERO SN_EXISTS_100 +#define SN_EMPTY_SLOT SN_FLAG_NOT_EXISTS_MUL100 // checks -#define does_storage_number_exist(value) (((storage_number) (value)) != SN_EMPTY_SLOT) -#define did_storage_number_reset(value) ((((storage_number) (value)) & SN_EXISTS_RESET) != 0) +#define does_storage_number_exist(value) (((storage_number)(value)) != SN_EMPTY_SLOT) +#define did_storage_number_reset(value) ((((storage_number)(value)) & SN_FLAG_RESET)) +#define is_storage_number_anomalous(value) (does_storage_number_exist(value) && !(((storage_number)(value)) & SN_FLAG_NOT_ANOMALOUS)) -storage_number pack_storage_number(calculated_number value, uint32_t flags); -static inline calculated_number unpack_storage_number(storage_number value) __attribute__((const)); +storage_number pack_storage_number(NETDATA_DOUBLE value, SN_FLAGS flags) __attribute__((const)); +static inline NETDATA_DOUBLE unpack_storage_number(storage_number value) __attribute__((const)); -int print_calculated_number(char *str, calculated_number value); +int print_netdata_double(char *str, NETDATA_DOUBLE value); -// sign div/mul <--- multiplier / divider ---> 10/100 RESET EXISTS VALUE -#define STORAGE_NUMBER_POSITIVE_MAX_RAW (storage_number)( (0 << 31) | (1 << 30) | (1 << 29) | (1 << 28) | (1<<27) | (1 << 26) | (0 << 25) | (1 << 24) | 0x00ffffff ) -#define STORAGE_NUMBER_POSITIVE_MIN_RAW (storage_number)( (0 << 31) | (0 << 30) | (1 << 29) | (1 << 28) | (1<<27) | (0 << 26) | (0 << 25) | (1 << 24) | 0x00000001 ) -#define STORAGE_NUMBER_NEGATIVE_MAX_RAW (storage_number)( (1 << 31) | (0 << 30) | (1 << 29) | (1 << 28) | (1<<27) | (0 << 26) | (0 << 25) | (1 << 24) | 0x00000001 ) -#define STORAGE_NUMBER_NEGATIVE_MIN_RAW (storage_number)( (1 << 31) | (1 << 30) | (1 << 29) | (1 << 28) | (1<<27) | (1 << 26) | (0 << 25) | (1 << 24) | 0x00ffffff ) +// sign div/mul <--- multiplier / divider ---> 10/100 RESET EXISTS VALUE +#define STORAGE_NUMBER_POSITIVE_MAX_RAW (storage_number)( (0 << 31) | (1 << 30) | (1 << 29) | (1 << 28) | (1 << 27) | (1 << 26) | (0 << 25) | (1 << 24) | 0x00ffffff ) +#define STORAGE_NUMBER_POSITIVE_MIN_RAW (storage_number)( (0 << 31) | (0 << 30) | (1 << 29) | (1 << 28) | (1 << 27) | (0 << 26) | (0 << 25) | (1 << 24) | 0x00000001 ) +#define STORAGE_NUMBER_NEGATIVE_MAX_RAW (storage_number)( (1 << 31) | (0 << 30) | (1 << 29) | (1 << 28) | (1 << 27) | (0 << 26) | (0 << 25) | (1 << 24) | 0x00000001 ) +#define STORAGE_NUMBER_NEGATIVE_MIN_RAW (storage_number)( (1 << 31) | (1 << 30) | (1 << 29) | (1 << 28) | (1 << 27) | (1 << 26) | (0 << 25) | (1 << 24) | 0x00ffffff ) // accepted accuracy loss #define ACCURACY_LOSS_ACCEPTED_PERCENT 0.0001 @@ -99,40 +121,112 @@ int print_calculated_number(char *str, calculated_number value); #define MAX_INCREMENTAL_PERCENT_RATE 10 -static inline calculated_number unpack_storage_number(storage_number value) { - extern calculated_number unpack_storage_number_lut10x[4 * 8]; +static inline NETDATA_DOUBLE unpack_storage_number(storage_number value) { + extern NETDATA_DOUBLE unpack_storage_number_lut10x[4 * 8]; - if(!value) return 0; + if(unlikely(value == SN_EMPTY_SLOT)) + return NAN; int sign = 1, exp = 0; int factor = 0; // bit 32 = 0:positive, 1:negative - if(unlikely(value & (1 << 31))) + if(unlikely(value & SN_FLAG_NEGATIVE)) sign = -1; // bit 31 = 0:divide, 1:multiply - if(unlikely(value & (1 << 30))) + if(unlikely(value & SN_FLAG_MULTIPLY)) exp = 1; - // bit 27 SN_EXISTS_100 - if(unlikely(value & (1 << 26))) + // bit 27 SN_FLAG_NOT_EXISTS_MUL100 + if(unlikely(value & SN_FLAG_NOT_EXISTS_MUL100)) factor = 1; - // bit 26 SN_EXISTS_RESET - // bit 25 SN_ANOMALY_BIT + // bit 26 SN_FLAG_RESET + // bit 25 SN_FLAG_NOT_ANOMALOUS // bit 30, 29, 28 = (multiplier or divider) 0-7 (8 total) - int mul = (value & ((1<<29)|(1<<28)|(1<<27))) >> 27; + int mul = (int)((value & ((1<<29)|(1<<28)|(1<<27))) >> 27); // bit 24 to bit 1 = the value, so remove all other bits value ^= value & ((1<<31)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<24)); - calculated_number n = value; + NETDATA_DOUBLE n = value; // fprintf(stderr, "UNPACK: %08X, sign = %d, exp = %d, mul = %d, factor = %d, n = " CALCULATED_NUMBER_FORMAT "\n", value, sign, exp, mul, factor, n); return sign * unpack_storage_number_lut10x[(factor * 16) + (exp * 8) + mul] * n; } +static inline NETDATA_DOUBLE str2ndd(const char *s, char **endptr) { + int negative = 0; + const char *start = s; + unsigned long long integer_part = 0; + unsigned long decimal_part = 0; + size_t decimal_digits = 0; + + switch(*s) { + case '-': + s++; + negative = 1; + break; + + case '+': + s++; + break; + + case 'n': + if(s[1] == 'a' && s[2] == 'n') { + if(endptr) *endptr = (char *)&s[3]; + return NAN; + } + break; + + case 'i': + if(s[1] == 'n' && s[2] == 'f') { + if(endptr) *endptr = (char *)&s[3]; + return INFINITY; + } + break; + + default: + break; + } + + while (*s >= '0' && *s <= '9') { + integer_part = (integer_part * 10) + (*s - '0'); + s++; + } + + if(unlikely(*s == '.')) { + decimal_part = 0; + s++; + + while (*s >= '0' && *s <= '9') { + decimal_part = (decimal_part * 10) + (*s - '0'); + s++; + decimal_digits++; + } + } + + if(unlikely(*s == 'e' || *s == 'E')) + return strtondd(start, endptr); + + if(unlikely(endptr)) + *endptr = (char *)s; + + if(unlikely(negative)) { + if(unlikely(decimal_digits)) + return -((NETDATA_DOUBLE)integer_part + (NETDATA_DOUBLE)decimal_part / powndd(10.0, decimal_digits)); + else + return -((NETDATA_DOUBLE)integer_part); + } + else { + if(unlikely(decimal_digits)) + return (NETDATA_DOUBLE)integer_part + (NETDATA_DOUBLE)decimal_part / powndd(10.0, decimal_digits); + else + return (NETDATA_DOUBLE)integer_part; + } +} + #endif /* NETDATA_STORAGE_NUMBER_H */ diff --git a/libnetdata/storage_number/tests/test_storage_number.c b/libnetdata/storage_number/tests/test_storage_number.c index f90521cab..19309e5c2 100644 --- a/libnetdata/storage_number/tests/test_storage_number.c +++ b/libnetdata/storage_number/tests/test_storage_number.c @@ -11,34 +11,34 @@ static void test_number_printing(void **state) char value[50]; - print_calculated_number(value, 0); + print_netdata_double(value, 0); assert_string_equal(value, "0"); - print_calculated_number(value, 0.0000001); + print_netdata_double(value, 0.0000001); assert_string_equal(value, "0.0000001"); - print_calculated_number(value, 0.00000009); + print_netdata_double(value, 0.00000009); assert_string_equal(value, "0.0000001"); - print_calculated_number(value, 0.000000001); + print_netdata_double(value, 0.000000001); assert_string_equal(value, "0"); - print_calculated_number(value, 99.99999999999999999); + print_netdata_double(value, 99.99999999999999999); assert_string_equal(value, "100"); - print_calculated_number(value, -99.99999999999999999); + print_netdata_double(value, -99.99999999999999999); assert_string_equal(value, "-100"); - print_calculated_number(value, 123.4567890123456789); + print_netdata_double(value, 123.4567890123456789); assert_string_equal(value, "123.456789"); - print_calculated_number(value, 9999.9999999); + print_netdata_double(value, 9999.9999999); assert_string_equal(value, "9999.9999999"); - print_calculated_number(value, -9999.9999999); + print_netdata_double(value, -9999.9999999); assert_string_equal(value, "-9999.9999999"); - print_calculated_number(value, unpack_storage_number(pack_storage_number(16.777218L, SN_DEFAULT_FLAGS))); + print_netdata_double(value, unpack_storage_number(pack_storage_number(16.777218L, SN_DEFAULT_FLAGS))); assert_string_equal(value, "16.77722"); } diff --git a/libnetdata/tests/test_str2ld.c b/libnetdata/tests/test_str2ld.c index 01d8677f0..8b97a70f8 100644 --- a/libnetdata/tests/test_str2ld.c +++ b/libnetdata/tests/test_str2ld.c @@ -24,8 +24,8 @@ static void test_str2ld(void **state) for (int i = 0; values[i]; i++) { char *e_mine = "hello", *e_sys = "world"; - LONG_DOUBLE mine = str2ld(values[i], &e_mine); - LONG_DOUBLE sys = strtold(values[i], &e_sys); + NETDATA_DOUBLE mine = str2ndd(values[i], &e_mine); + NETDATA_DOUBLE sys = strtondd(values[i], &e_sys); if (isnan(mine)) assert_true(isnan(sys)); diff --git a/ml/Config.cc b/ml/Config.cc index 37d0bb29e..65b05a34d 100644 --- a/ml/Config.cc +++ b/ml/Config.cc @@ -22,14 +22,14 @@ static T clamp(const T& Value, const T& Min, const T& Max) { void Config::readMLConfig(void) { const char *ConfigSectionML = CONFIG_SECTION_ML; - bool EnableAnomalyDetection = config_get_boolean(ConfigSectionML, "enabled", false); + bool EnableAnomalyDetection = config_get_boolean(ConfigSectionML, "enabled", true); /* * Read values */ unsigned MaxTrainSamples = config_get_number(ConfigSectionML, "maximum num samples to train", 4 * 3600); - unsigned MinTrainSamples = config_get_number(ConfigSectionML, "minimum num samples to train", 1 * 3600); + unsigned MinTrainSamples = config_get_number(ConfigSectionML, "minimum num samples to train", 1 * 900); unsigned TrainEvery = config_get_number(ConfigSectionML, "train every", 1 * 3600); unsigned DBEngineAnomalyRateEvery = config_get_number(ConfigSectionML, "dbengine anomaly rate every", 30); @@ -42,7 +42,7 @@ void Config::readMLConfig(void) { unsigned MaxKMeansIters = config_get_number(ConfigSectionML, "maximum number of k-means iterations", 1000); double DimensionAnomalyScoreThreshold = config_get_float(ConfigSectionML, "dimension anomaly score threshold", 0.99); - double HostAnomalyRateThreshold = config_get_float(ConfigSectionML, "host anomaly rate threshold", 0.02); + double HostAnomalyRateThreshold = config_get_float(ConfigSectionML, "host anomaly rate threshold", 0.01); double ADMinWindowSize = config_get_float(ConfigSectionML, "minimum window size", 30); double ADMaxWindowSize = config_get_float(ConfigSectionML, "maximum window size", 600); diff --git a/ml/Dimension.cc b/ml/Dimension.cc index 3146e45a6..0fe07530c 100644 --- a/ml/Dimension.cc +++ b/ml/Dimension.cc @@ -6,55 +6,6 @@ using namespace ml; -/* - * Copy of the unpack_storage_number which allows us to convert - * a storage_number to double. - */ -static CalculatedNumber unpack_storage_number_dbl(storage_number value) { - if(!value) - return 0; - - int sign = 0, exp = 0; - int factor = 10; - - // bit 32 = 0:positive, 1:negative - if(unlikely(value & (1 << 31))) - sign = 1; - - // bit 31 = 0:divide, 1:multiply - if(unlikely(value & (1 << 30))) - exp = 1; - - // bit 27 SN_EXISTS_100 - if(unlikely(value & (1 << 26))) - factor = 100; - - // bit 26 SN_EXISTS_RESET - // bit 25 SN_ANOMALY_BIT - - // bit 30, 29, 28 = (multiplier or divider) 0-7 (8 total) - int mul = (value & ((1<<29)|(1<<28)|(1<<27))) >> 27; - - // bit 24 to bit 1 = the value, so remove all other bits - value ^= value & ((1<<31)|(1<<30)|(1<<29)|(1<<28)|(1<<27)|(1<<26)|(1<<25)|(1<<24)); - - CalculatedNumber CN = value; - - if(exp) { - for(; mul; mul--) - CN *= factor; - } - else { - for( ; mul ; mul--) - CN /= 10; - } - - if(sign) - CN = -CN; - - return CN; -} - std::pair TrainableDimension::getCalculatedNumbers() { size_t MinN = Cfg.MinTrainSamples; @@ -89,10 +40,10 @@ TrainableDimension::getCalculatedNumbers() { break; auto P = Q.nextMetric(); - storage_number SN = P.second; + CalculatedNumber Value = P.second; - if (does_storage_number_exist(SN)) { - CNs[Idx] = unpack_storage_number_dbl(SN); + if (netdata_double_isnumber(Value)) { + CNs[Idx] = Value; LastValue = CNs[Idx]; CollectedValues++; } else diff --git a/ml/Dimension.h b/ml/Dimension.h index e4f8bd1c7..4fbc09b98 100644 --- a/ml/Dimension.h +++ b/ml/Dimension.h @@ -12,13 +12,13 @@ namespace ml { class RrdDimension { public: - RrdDimension(RRDDIM *RD) : RD(RD), Ops(&RD->state->query_ops) { } + RrdDimension(RRDDIM *RD) : RD(RD), Ops(&RD->tiers[0]->query_ops) { } RRDDIM *getRD() const { return RD; } - time_t latestTime() { return Ops->latest_time(RD); } + time_t latestTime() { return Ops->latest_time(RD->tiers[0]->db_metric_handle); } - time_t oldestTime() { return Ops->oldest_time(RD); } + time_t oldestTime() { return Ops->oldest_time(RD->tiers[0]->db_metric_handle); } unsigned updateEvery() const { return RD->update_every; } diff --git a/ml/Query.h b/ml/Query.h index 8b84bb73e..24c5fa384 100644 --- a/ml/Query.h +++ b/ml/Query.h @@ -8,29 +8,28 @@ namespace ml { class Query { public: Query(RRDDIM *RD) : RD(RD) { - Ops = &RD->state->query_ops; + Ops = &RD->tiers[0]->query_ops; } time_t latestTime() { - return Ops->latest_time(RD); + return Ops->latest_time(RD->tiers[0]->db_metric_handle); } time_t oldestTime() { - return Ops->oldest_time(RD); + return Ops->oldest_time(RD->tiers[0]->db_metric_handle); } void init(time_t AfterT, time_t BeforeT) { - Ops->init(RD, &Handle, AfterT, BeforeT); + Ops->init(RD->tiers[0]->db_metric_handle, &Handle, AfterT, BeforeT, TIER_QUERY_FETCH_SUM); } bool isFinished() { return Ops->is_finished(&Handle); } - std::pair nextMetric() { - time_t CurrT; - storage_number SN = Ops->next_metric(&Handle, &CurrT); - return { CurrT, SN }; + std::pair nextMetric() { + STORAGE_POINT sp = Ops->next_metric(&Handle); + return { sp.start_time, sp.sum / sp.count }; } ~Query() { diff --git a/ml/README.md b/ml/README.md index cb8384a66..2578993e2 100644 --- a/ml/README.md +++ b/ml/README.md @@ -1,5 +1,5 @@ + +# CountIf + +> This query is available as `countif`. + +CountIf returns the percentage of points in the database that satisfy the condition supplied. + +The following conditions are available: + +- `!` or `!=` or `<>`, different than +- `=` or `:`, equal to +- `>`, greater than +- `<`, less than +- `>=`, greater or equal to +- `<=`, less or equal to + +The target number and the desired condition can be set using the `group_options` query parameter, as a string, like in these examples: + +- `!0`, to match any number except zero. +- `>=-3` to match any number bigger or equal to -3. + +. When an invalid condition is given, the web server can deliver a not accurate response. + +## how to use + +This query cannot be used in alarms. + +`countif` changes the units of charts. The result of the calculation is always from zero to 1, expressing the percentage of database points that matched the condition. + +In APIs and badges can be used like this: `&group=countif&group_options=>10` in the URL. + + diff --git a/web/api/queries/countif/countif.c b/web/api/queries/countif/countif.c new file mode 100644 index 000000000..369b20be9 --- /dev/null +++ b/web/api/queries/countif/countif.c @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "countif.h" + +// ---------------------------------------------------------------------------- +// countif + +struct grouping_countif { + size_t (*comparison)(NETDATA_DOUBLE, NETDATA_DOUBLE); + NETDATA_DOUBLE target; + size_t count; + size_t matched; +}; + +static size_t countif_equal(NETDATA_DOUBLE v, NETDATA_DOUBLE target) { + return (v == target); +} + +static size_t countif_notequal(NETDATA_DOUBLE v, NETDATA_DOUBLE target) { + return (v != target); +} + +static size_t countif_less(NETDATA_DOUBLE v, NETDATA_DOUBLE target) { + return (v < target); +} + +static size_t countif_lessequal(NETDATA_DOUBLE v, NETDATA_DOUBLE target) { + return (v <= target); +} + +static size_t countif_greater(NETDATA_DOUBLE v, NETDATA_DOUBLE target) { + return (v > target); +} + +static size_t countif_greaterequal(NETDATA_DOUBLE v, NETDATA_DOUBLE target) { + return (v >= target); +} + +void grouping_create_countif(RRDR *r, const char *options __maybe_unused) { + struct grouping_countif *g = onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_countif)); + r->internal.grouping_data = g; + + if(options && *options) { + // skip any leading spaces + while(isspace(*options)) options++; + + // find the comparison function + switch(*options) { + case '!': + options++; + if(*options != '=' && *options != ':') + options--; + g->comparison = countif_notequal; + break; + + case '>': + options++; + if(*options == '=' || *options == ':') { + g->comparison = countif_greaterequal; + } + else { + options--; + g->comparison = countif_greater; + } + break; + + case '<': + options++; + if(*options == '>') { + g->comparison = countif_notequal; + } + else if(*options == '=' || *options == ':') { + g->comparison = countif_lessequal; + } + else { + options--; + g->comparison = countif_less; + } + break; + + default: + case '=': + case ':': + g->comparison = countif_equal; + break; + } + if(*options) options++; + + // skip everything up to the first digit + while(isspace(*options)) options++; + + g->target = str2ndd(options, NULL); + } + else { + g->target = 0.0; + g->comparison = countif_equal; + } +} + +// resets when switches dimensions +// so, clear everything to restart +void grouping_reset_countif(RRDR *r) { + struct grouping_countif *g = (struct grouping_countif *)r->internal.grouping_data; + g->matched = 0; + g->count = 0; +} + +void grouping_free_countif(RRDR *r) { + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); + r->internal.grouping_data = NULL; +} + +void grouping_add_countif(RRDR *r, NETDATA_DOUBLE value) { + struct grouping_countif *g = (struct grouping_countif *)r->internal.grouping_data; + g->matched += g->comparison(value, g->target); + g->count++; +} + +NETDATA_DOUBLE grouping_flush_countif(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { + struct grouping_countif *g = (struct grouping_countif *)r->internal.grouping_data; + + NETDATA_DOUBLE value; + + if(unlikely(!g->count)) { + value = 0.0; + *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; + } + else { + value = (NETDATA_DOUBLE)g->matched * 100 / (NETDATA_DOUBLE)g->count; + } + + g->matched = 0; + g->count = 0; + + return value; +} diff --git a/web/api/queries/countif/countif.h b/web/api/queries/countif/countif.h new file mode 100644 index 000000000..0c7d2d7d1 --- /dev/null +++ b/web/api/queries/countif/countif.h @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_API_QUERY_COUNTIF_H +#define NETDATA_API_QUERY_COUNTIF_H + +#include "../query.h" +#include "../rrdr.h" + +extern void grouping_create_countif(RRDR *r, const char *options __maybe_unused); +extern void grouping_reset_countif(RRDR *r); +extern void grouping_free_countif(RRDR *r); +extern void grouping_add_countif(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_countif(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); + +#endif //NETDATA_API_QUERY_COUNTIF_H diff --git a/web/api/queries/des/des.c b/web/api/queries/des/des.c index 8e4ca4bd4..a6c4e4051 100644 --- a/web/api/queries/des/des.c +++ b/web/api/queries/des/des.c @@ -8,13 +8,13 @@ // single exponential smoothing struct grouping_des { - calculated_number alpha; - calculated_number alpha_other; - calculated_number beta; - calculated_number beta_other; + NETDATA_DOUBLE alpha; + NETDATA_DOUBLE alpha_other; + NETDATA_DOUBLE beta; + NETDATA_DOUBLE beta_other; - calculated_number level; - calculated_number trend; + NETDATA_DOUBLE level; + NETDATA_DOUBLE trend; size_t count; }; @@ -31,22 +31,22 @@ void grouping_init_des(void) { } } -static inline calculated_number window(RRDR *r, struct grouping_des *g) { +static inline NETDATA_DOUBLE window(RRDR *r, struct grouping_des *g) { (void)g; - calculated_number points; + NETDATA_DOUBLE points; if(r->group == 1) { // provide a running DES - points = r->internal.points_wanted; + points = (NETDATA_DOUBLE)r->internal.points_wanted; } else { // provide a SES with flush points - points = r->group; + points = (NETDATA_DOUBLE)r->group; } // https://en.wikipedia.org/wiki/Moving_average#Exponential_moving_average // A commonly used value for alpha is 2 / (N + 1) - return (points > max_window_size) ? max_window_size : points; + return (points > (NETDATA_DOUBLE)max_window_size) ? (NETDATA_DOUBLE)max_window_size : points; } static inline void set_alpha(RRDR *r, struct grouping_des *g) { @@ -69,8 +69,8 @@ static inline void set_beta(RRDR *r, struct grouping_des *g) { //info("beta for chart '%s' is " CALCULATED_NUMBER_FORMAT, r->st->name, g->beta); } -void grouping_create_des(RRDR *r) { - struct grouping_des *g = (struct grouping_des *)mallocz(sizeof(struct grouping_des)); +void grouping_create_des(RRDR *r, const char *options __maybe_unused) { + struct grouping_des *g = (struct grouping_des *)onewayalloc_mallocz(r->internal.owa, sizeof(struct grouping_des)); set_alpha(r, g); set_beta(r, g); g->level = 0.0; @@ -92,11 +92,11 @@ void grouping_reset_des(RRDR *r) { } void grouping_free_des(RRDR *r) { - freez(r->internal.grouping_data); + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_des(RRDR *r, calculated_number value) { +void grouping_add_des(RRDR *r, NETDATA_DOUBLE value) { struct grouping_des *g = (struct grouping_des *)r->internal.grouping_data; if(likely(g->count > 0)) { @@ -109,7 +109,7 @@ void grouping_add_des(RRDR *r, calculated_number value) { } // for the values, except the first - calculated_number last_level = g->level; + NETDATA_DOUBLE last_level = g->level; g->level = (g->alpha * value) + (g->alpha_other * (g->level + g->trend)); g->trend = (g->beta * (g->level - last_level)) + (g->beta_other * g->trend); } @@ -123,10 +123,10 @@ void grouping_add_des(RRDR *r, calculated_number value) { //fprintf(stderr, "value: " CALCULATED_NUMBER_FORMAT ", level: " CALCULATED_NUMBER_FORMAT ", trend: " CALCULATED_NUMBER_FORMAT "\n", value, g->level, g->trend); } -calculated_number grouping_flush_des(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_des(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_des *g = (struct grouping_des *)r->internal.grouping_data; - if(unlikely(!g->count || !calculated_number_isnumber(g->level))) { + if(unlikely(!g->count || !netdata_double_isnumber(g->level))) { *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; return 0.0; } diff --git a/web/api/queries/des/des.h b/web/api/queries/des/des.h index bd361b865..8906d14eb 100644 --- a/web/api/queries/des/des.h +++ b/web/api/queries/des/des.h @@ -8,10 +8,10 @@ extern void grouping_init_des(void); -extern void grouping_create_des(RRDR *r); +extern void grouping_create_des(RRDR *r, const char *options __maybe_unused); extern void grouping_reset_des(RRDR *r); extern void grouping_free_des(RRDR *r); -extern void grouping_add_des(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_des(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_des(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_des(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERIES_DES_H diff --git a/web/api/queries/incremental_sum/incremental_sum.c b/web/api/queries/incremental_sum/incremental_sum.c index 304d9aa74..afca530c3 100644 --- a/web/api/queries/incremental_sum/incremental_sum.c +++ b/web/api/queries/incremental_sum/incremental_sum.c @@ -6,13 +6,13 @@ // incremental sum struct grouping_incremental_sum { - calculated_number first; - calculated_number last; + NETDATA_DOUBLE first; + NETDATA_DOUBLE last; size_t count; }; -void grouping_create_incremental_sum(RRDR *r) { - r->internal.grouping_data = callocz(1, sizeof(struct grouping_incremental_sum)); +void grouping_create_incremental_sum(RRDR *r, const char *options __maybe_unused) { + r->internal.grouping_data = onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_incremental_sum)); } // resets when switches dimensions @@ -25,11 +25,11 @@ void grouping_reset_incremental_sum(RRDR *r) { } void grouping_free_incremental_sum(RRDR *r) { - freez(r->internal.grouping_data); + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_incremental_sum(RRDR *r, calculated_number value) { +void grouping_add_incremental_sum(RRDR *r, NETDATA_DOUBLE value) { struct grouping_incremental_sum *g = (struct grouping_incremental_sum *)r->internal.grouping_data; if(unlikely(!g->count)) { @@ -42,10 +42,10 @@ void grouping_add_incremental_sum(RRDR *r, calculated_number value) { } } -calculated_number grouping_flush_incremental_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_incremental_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_incremental_sum *g = (struct grouping_incremental_sum *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(unlikely(!g->count)) { value = 0.0; diff --git a/web/api/queries/incremental_sum/incremental_sum.h b/web/api/queries/incremental_sum/incremental_sum.h index 5b55ad3c8..6d908cef6 100644 --- a/web/api/queries/incremental_sum/incremental_sum.h +++ b/web/api/queries/incremental_sum/incremental_sum.h @@ -6,10 +6,10 @@ #include "../query.h" #include "../rrdr.h" -extern void grouping_create_incremental_sum(RRDR *r); +extern void grouping_create_incremental_sum(RRDR *r, const char *options __maybe_unused); extern void grouping_reset_incremental_sum(RRDR *r); extern void grouping_free_incremental_sum(RRDR *r); -extern void grouping_add_incremental_sum(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_incremental_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_incremental_sum(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_incremental_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERY_INCREMENTAL_SUM_H diff --git a/web/api/queries/max/max.c b/web/api/queries/max/max.c index b6e723314..73cf9fa66 100644 --- a/web/api/queries/max/max.c +++ b/web/api/queries/max/max.c @@ -6,12 +6,12 @@ // max struct grouping_max { - calculated_number max; + NETDATA_DOUBLE max; size_t count; }; -void grouping_create_max(RRDR *r) { - r->internal.grouping_data = callocz(1, sizeof(struct grouping_max)); +void grouping_create_max(RRDR *r, const char *options __maybe_unused) { + r->internal.grouping_data = onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_max)); } // resets when switches dimensions @@ -23,23 +23,23 @@ void grouping_reset_max(RRDR *r) { } void grouping_free_max(RRDR *r) { - freez(r->internal.grouping_data); + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_max(RRDR *r, calculated_number value) { +void grouping_add_max(RRDR *r, NETDATA_DOUBLE value) { struct grouping_max *g = (struct grouping_max *)r->internal.grouping_data; - if(!g->count || calculated_number_fabs(value) > calculated_number_fabs(g->max)) { + if(!g->count || fabsndd(value) > fabsndd(g->max)) { g->max = value; g->count++; } } -calculated_number grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_max *g = (struct grouping_max *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(unlikely(!g->count)) { value = 0.0; diff --git a/web/api/queries/max/max.h b/web/api/queries/max/max.h index 7b606ce34..28913686b 100644 --- a/web/api/queries/max/max.h +++ b/web/api/queries/max/max.h @@ -6,10 +6,10 @@ #include "../query.h" #include "../rrdr.h" -extern void grouping_create_max(RRDR *r); +extern void grouping_create_max(RRDR *r, const char *options __maybe_unused); extern void grouping_reset_max(RRDR *r); extern void grouping_free_max(RRDR *r); -extern void grouping_add_max(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_max(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_max(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERY_MAX_H diff --git a/web/api/queries/median/README.md b/web/api/queries/median/README.md index bb7d4c66b..5600284c2 100644 --- a/web/api/queries/median/README.md +++ b/web/api/queries/median/README.md @@ -13,6 +13,20 @@ The median is the value separating the higher half from the lower half of a data `median` is not an accurate average. However, it eliminates all spikes, by sorting all the values in a period, and selecting the value in the middle of the sorted array. +Netdata also supports `trimmed-median`, which trims a percentage of the smaller and bigger values prior to finding the +median. The following `trimmed-median` functions are defined: + +- `trimmed-median1` +- `trimmed-median2` +- `trimmed-median3` +- `trimmed-median5` +- `trimmed-median10` +- `trimmed-median15` +- `trimmed-median20` +- `trimmed-median25` + +The function `trimmed-median` is an alias for `trimmed-median5`. + ## how to use Use it in alarms like this: @@ -27,7 +41,8 @@ lookup: median -1m unaligned of my_dimension `median` does not change the units. For example, if the chart units is `requests/sec`, the result will be again expressed in the same units. -It can also be used in APIs and badges as `&group=median` in the URL. +It can also be used in APIs and badges as `&group=median` in the URL. Additionally, a percentage may be given with +`&group_options=` to trim all small and big values before finding the median. ## Examples diff --git a/web/api/queries/median/median.c b/web/api/queries/median/median.c index bffcee12f..40fd4ec3a 100644 --- a/web/api/queries/median/median.c +++ b/web/api/queries/median/median.c @@ -2,27 +2,65 @@ #include "median.h" - // ---------------------------------------------------------------------------- // median struct grouping_median { size_t series_size; size_t next_pos; + NETDATA_DOUBLE percent; - LONG_DOUBLE series[]; + NETDATA_DOUBLE *series; }; -void grouping_create_median(RRDR *r) { +void grouping_create_median_internal(RRDR *r, const char *options, NETDATA_DOUBLE def) { long entries = r->group; - if(entries < 0) entries = 0; + if(entries < 10) entries = 10; - struct grouping_median *g = (struct grouping_median *)callocz(1, sizeof(struct grouping_median) + entries * sizeof(LONG_DOUBLE)); + struct grouping_median *g = (struct grouping_median *)onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_median)); + g->series = onewayalloc_mallocz(r->internal.owa, entries * sizeof(NETDATA_DOUBLE)); g->series_size = (size_t)entries; + g->percent = def; + if(options && *options) { + g->percent = str2ndd(options, NULL); + if(!netdata_double_isnumber(g->percent)) g->percent = 0.0; + if(g->percent < 0.0) g->percent = 0.0; + if(g->percent > 50.0) g->percent = 50.0; + } + + g->percent = g->percent / 100.0; r->internal.grouping_data = g; } +void grouping_create_median(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 0.0); +} +void grouping_create_trimmed_median1(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 1.0); +} +void grouping_create_trimmed_median2(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 2.0); +} +void grouping_create_trimmed_median3(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 3.0); +} +void grouping_create_trimmed_median5(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 5.0); +} +void grouping_create_trimmed_median10(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 10.0); +} +void grouping_create_trimmed_median15(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 15.0); +} +void grouping_create_trimmed_median20(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 20.0); +} +void grouping_create_trimmed_median25(RRDR *r, const char *options) { + grouping_create_median_internal(r, options, 25.0); +} + // resets when switches dimensions // so, clear everything to restart void grouping_reset_median(RRDR *r) { @@ -31,47 +69,72 @@ void grouping_reset_median(RRDR *r) { } void grouping_free_median(RRDR *r) { - freez(r->internal.grouping_data); + struct grouping_median *g = (struct grouping_median *)r->internal.grouping_data; + if(g) onewayalloc_freez(r->internal.owa, g->series); + + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_median(RRDR *r, calculated_number value) { +void grouping_add_median(RRDR *r, NETDATA_DOUBLE value) { struct grouping_median *g = (struct grouping_median *)r->internal.grouping_data; if(unlikely(g->next_pos >= g->series_size)) { - error("INTERNAL ERROR: median buffer overflow on chart '%s' - next_pos = %zu, series_size = %zu, r->group = %ld.", r->st->name, g->next_pos, g->series_size, r->group); + g->series = onewayalloc_doublesize( r->internal.owa, g->series, g->series_size * sizeof(NETDATA_DOUBLE)); + g->series_size *= 2; } - else - g->series[g->next_pos++] = (LONG_DOUBLE)value; + + g->series[g->next_pos++] = value; } -calculated_number grouping_flush_median(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_median(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_median *g = (struct grouping_median *)r->internal.grouping_data; - calculated_number value; + size_t available_slots = g->next_pos; + NETDATA_DOUBLE value; - if(unlikely(!g->next_pos)) { + if(unlikely(!available_slots)) { value = 0.0; *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; } + else if(available_slots == 1) { + value = g->series[0]; + } else { - if(g->next_pos > 1) { - sort_series(g->series, g->next_pos); - value = (calculated_number)median_on_sorted_series(g->series, g->next_pos); - } - else - value = (calculated_number)g->series[0]; + sort_series(g->series, available_slots); + + size_t start_slot = 0; + size_t end_slot = available_slots - 1; + + if(g->percent > 0.0) { + NETDATA_DOUBLE min = g->series[0]; + NETDATA_DOUBLE max = g->series[available_slots - 1]; + NETDATA_DOUBLE delta = (max - min) * g->percent; + + NETDATA_DOUBLE wanted_min = min + delta; + NETDATA_DOUBLE wanted_max = max - delta; + + for (start_slot = 0; start_slot < available_slots; start_slot++) + if (g->series[start_slot] >= wanted_min) break; - if(!calculated_number_isnumber(value)) { - value = 0.0; - *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; + for (end_slot = available_slots - 1; end_slot > start_slot; end_slot--) + if (g->series[end_slot] <= wanted_max) break; } - //log_series_to_stderr(g->series, g->next_pos, value, "median"); + if(start_slot == end_slot) + value = g->series[start_slot]; + else + value = median_on_sorted_series(&g->series[start_slot], end_slot - start_slot + 1); } + if(unlikely(!netdata_double_isnumber(value))) { + value = 0.0; + *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; + } + + //log_series_to_stderr(g->series, g->next_pos, value, "median"); + g->next_pos = 0; return value; } - diff --git a/web/api/queries/median/median.h b/web/api/queries/median/median.h index 28d52b31e..dd1b3de61 100644 --- a/web/api/queries/median/median.h +++ b/web/api/queries/median/median.h @@ -6,10 +6,18 @@ #include "../query.h" #include "../rrdr.h" -extern void grouping_create_median(RRDR *r); +extern void grouping_create_median(RRDR *r, const char *options); +extern void grouping_create_trimmed_median1(RRDR *r, const char *options); +extern void grouping_create_trimmed_median2(RRDR *r, const char *options); +extern void grouping_create_trimmed_median3(RRDR *r, const char *options); +extern void grouping_create_trimmed_median5(RRDR *r, const char *options); +extern void grouping_create_trimmed_median10(RRDR *r, const char *options); +extern void grouping_create_trimmed_median15(RRDR *r, const char *options); +extern void grouping_create_trimmed_median20(RRDR *r, const char *options); +extern void grouping_create_trimmed_median25(RRDR *r, const char *options); extern void grouping_reset_median(RRDR *r); extern void grouping_free_median(RRDR *r); -extern void grouping_add_median(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_median(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_median(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_median(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERIES_MEDIAN_H diff --git a/web/api/queries/min/min.c b/web/api/queries/min/min.c index 497bae04d..1752e9e0c 100644 --- a/web/api/queries/min/min.c +++ b/web/api/queries/min/min.c @@ -6,12 +6,12 @@ // min struct grouping_min { - calculated_number min; + NETDATA_DOUBLE min; size_t count; }; -void grouping_create_min(RRDR *r) { - r->internal.grouping_data = callocz(1, sizeof(struct grouping_min)); +void grouping_create_min(RRDR *r, const char *options __maybe_unused) { + r->internal.grouping_data = onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_min)); } // resets when switches dimensions @@ -23,23 +23,23 @@ void grouping_reset_min(RRDR *r) { } void grouping_free_min(RRDR *r) { - freez(r->internal.grouping_data); + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_min(RRDR *r, calculated_number value) { +void grouping_add_min(RRDR *r, NETDATA_DOUBLE value) { struct grouping_min *g = (struct grouping_min *)r->internal.grouping_data; - if(!g->count || calculated_number_fabs(value) < calculated_number_fabs(g->min)) { + if(!g->count || fabsndd(value) < fabsndd(g->min)) { g->min = value; g->count++; } } -calculated_number grouping_flush_min(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_min(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_min *g = (struct grouping_min *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(unlikely(!g->count)) { value = 0.0; diff --git a/web/api/queries/min/min.h b/web/api/queries/min/min.h index 9207c74f7..b8627f667 100644 --- a/web/api/queries/min/min.h +++ b/web/api/queries/min/min.h @@ -6,10 +6,10 @@ #include "../query.h" #include "../rrdr.h" -extern void grouping_create_min(RRDR *r); +extern void grouping_create_min(RRDR *r, const char *options __maybe_unused); extern void grouping_reset_min(RRDR *r); extern void grouping_free_min(RRDR *r); -extern void grouping_add_min(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_min(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_min(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_min(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERY_MIN_H diff --git a/web/api/queries/percentile/Makefile.am b/web/api/queries/percentile/Makefile.am new file mode 100644 index 000000000..161784b8f --- /dev/null +++ b/web/api/queries/percentile/Makefile.am @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +AUTOMAKE_OPTIONS = subdir-objects +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +dist_noinst_DATA = \ + README.md \ + $(NULL) diff --git a/web/api/queries/percentile/README.md b/web/api/queries/percentile/README.md new file mode 100644 index 000000000..70afc7420 --- /dev/null +++ b/web/api/queries/percentile/README.md @@ -0,0 +1,58 @@ + + +# Percentile + +The percentile is the average value of a series using only the smaller N percentile of the values. +(a population or a probability distribution). + +Netdata applies linear interpolation on the last point, if the percentile requested does not give a round number of +points. + +The following percentile aliases are defined: + +- `percentile25` +- `percentile50` +- `percentile75` +- `percentile80` +- `percentile90` +- `percentile95` +- `percentile97` +- `percentile98` +- `percentile99` + +The default `percentile` is an alias for `percentile95`. +Any percentile may be requested using the `group_options` query parameter. + +## how to use + +Use it in alarms like this: + +``` + alarm: my_alarm + on: my_chart +lookup: percentile95 -1m unaligned of my_dimension + warn: $this > 1000 +``` + +`percentile` does not change the units. For example, if the chart units is `requests/sec`, the result +will be again expressed in the same units. + +It can also be used in APIs and badges as `&group=percentile` in the URL and the additional parameter `group_options` +may be used to request any percentile (e.g. `&group=percentile&group_options=96`). + +## Examples + +Examining last 1 minute `successful` web server responses: + +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=min&after=-60&label=min) +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=average&after=-60&label=average) +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=percentile95&after=-60&label=percentile95&value_color=orange) +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=max&after=-60&label=max) + +## References + +- . diff --git a/web/api/queries/percentile/percentile.c b/web/api/queries/percentile/percentile.c new file mode 100644 index 000000000..88f8600dd --- /dev/null +++ b/web/api/queries/percentile/percentile.c @@ -0,0 +1,169 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "percentile.h" + +// ---------------------------------------------------------------------------- +// median + +struct grouping_percentile { + size_t series_size; + size_t next_pos; + NETDATA_DOUBLE percent; + + NETDATA_DOUBLE *series; +}; + +static void grouping_create_percentile_internal(RRDR *r, const char *options, NETDATA_DOUBLE def) { + long entries = r->group; + if(entries < 10) entries = 10; + + struct grouping_percentile *g = (struct grouping_percentile *)onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_percentile)); + g->series = onewayalloc_mallocz(r->internal.owa, entries * sizeof(NETDATA_DOUBLE)); + g->series_size = (size_t)entries; + + g->percent = def; + if(options && *options) { + g->percent = str2ndd(options, NULL); + if(!netdata_double_isnumber(g->percent)) g->percent = 0.0; + if(g->percent < 0.0) g->percent = 0.0; + if(g->percent > 100.0) g->percent = 100.0; + } + + g->percent = g->percent / 100.0; + r->internal.grouping_data = g; +} + +void grouping_create_percentile25(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 25.0); +} +void grouping_create_percentile50(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 50.0); +} +void grouping_create_percentile75(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 75.0); +} +void grouping_create_percentile80(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 80.0); +} +void grouping_create_percentile90(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 90.0); +} +void grouping_create_percentile95(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 95.0); +} +void grouping_create_percentile97(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 97.0); +} +void grouping_create_percentile98(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 98.0); +} +void grouping_create_percentile99(RRDR *r, const char *options) { + grouping_create_percentile_internal(r, options, 99.0); +} + +// resets when switches dimensions +// so, clear everything to restart +void grouping_reset_percentile(RRDR *r) { + struct grouping_percentile *g = (struct grouping_percentile *)r->internal.grouping_data; + g->next_pos = 0; +} + +void grouping_free_percentile(RRDR *r) { + struct grouping_percentile *g = (struct grouping_percentile *)r->internal.grouping_data; + if(g) onewayalloc_freez(r->internal.owa, g->series); + + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); + r->internal.grouping_data = NULL; +} + +void grouping_add_percentile(RRDR *r, NETDATA_DOUBLE value) { + struct grouping_percentile *g = (struct grouping_percentile *)r->internal.grouping_data; + + if(unlikely(g->next_pos >= g->series_size)) { + g->series = onewayalloc_doublesize( r->internal.owa, g->series, g->series_size * sizeof(NETDATA_DOUBLE)); + g->series_size *= 2; + } + + g->series[g->next_pos++] = value; +} + +NETDATA_DOUBLE grouping_flush_percentile(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { + struct grouping_percentile *g = (struct grouping_percentile *)r->internal.grouping_data; + + NETDATA_DOUBLE value; + size_t available_slots = g->next_pos; + + if(unlikely(!available_slots)) { + value = 0.0; + *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; + } + else if(available_slots == 1) { + value = g->series[0]; + } + else { + sort_series(g->series, available_slots); + + NETDATA_DOUBLE min = g->series[0]; + NETDATA_DOUBLE max = g->series[available_slots - 1]; + + if (min != max) { + size_t slots_to_use = (size_t)((NETDATA_DOUBLE)available_slots * g->percent); + if(!slots_to_use) slots_to_use = 1; + + NETDATA_DOUBLE percent_to_use = (NETDATA_DOUBLE)slots_to_use / (NETDATA_DOUBLE)available_slots; + NETDATA_DOUBLE percent_delta = g->percent - percent_to_use; + + NETDATA_DOUBLE percent_interpolation_slot = 0.0; + NETDATA_DOUBLE percent_last_slot = 0.0; + if(percent_delta > 0.0) { + NETDATA_DOUBLE percent_to_use_plus_1_slot = (NETDATA_DOUBLE)(slots_to_use + 1) / (NETDATA_DOUBLE)available_slots; + NETDATA_DOUBLE percent_1slot = percent_to_use_plus_1_slot - percent_to_use; + + percent_interpolation_slot = percent_delta / percent_1slot; + percent_last_slot = 1 - percent_interpolation_slot; + } + + int start_slot, stop_slot, step, last_slot, interpolation_slot; + if(min >= 0.0 && max >= 0.0) { + start_slot = 0; + stop_slot = start_slot + (int)slots_to_use; + last_slot = stop_slot - 1; + interpolation_slot = stop_slot; + step = 1; + } + else { + start_slot = (int)available_slots - 1; + stop_slot = start_slot - (int)slots_to_use; + last_slot = stop_slot + 1; + interpolation_slot = stop_slot; + step = -1; + } + + value = 0.0; + for(int slot = start_slot; slot != stop_slot ; slot += step) + value += g->series[slot]; + + size_t counted = slots_to_use; + if(percent_interpolation_slot > 0.0 && interpolation_slot >= 0 && interpolation_slot < (int)available_slots) { + value += g->series[interpolation_slot] * percent_interpolation_slot; + value += g->series[last_slot] * percent_last_slot; + counted++; + } + + value = value / (NETDATA_DOUBLE)counted; + } + else + value = min; + } + + if(unlikely(!netdata_double_isnumber(value))) { + value = 0.0; + *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; + } + + //log_series_to_stderr(g->series, g->next_pos, value, "percentile"); + + g->next_pos = 0; + + return value; +} diff --git a/web/api/queries/percentile/percentile.h b/web/api/queries/percentile/percentile.h new file mode 100644 index 000000000..709717ebd --- /dev/null +++ b/web/api/queries/percentile/percentile.h @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_API_QUERIES_PERCENTILE_H +#define NETDATA_API_QUERIES_PERCENTILE_H + +#include "../query.h" +#include "../rrdr.h" + +extern void grouping_create_percentile25(RRDR *r, const char *options); +extern void grouping_create_percentile50(RRDR *r, const char *options); +extern void grouping_create_percentile75(RRDR *r, const char *options); +extern void grouping_create_percentile80(RRDR *r, const char *options); +extern void grouping_create_percentile90(RRDR *r, const char *options); +extern void grouping_create_percentile95(RRDR *r, const char *options); +extern void grouping_create_percentile97(RRDR *r, const char *options); +extern void grouping_create_percentile98(RRDR *r, const char *options); +extern void grouping_create_percentile99(RRDR *r, const char *options ); +extern void grouping_reset_percentile(RRDR *r); +extern void grouping_free_percentile(RRDR *r); +extern void grouping_add_percentile(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_percentile(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); + +#endif //NETDATA_API_QUERIES_PERCENTILE_H diff --git a/web/api/queries/query.c b/web/api/queries/query.c index 5c6c70411..d776f6d11 100644 --- a/web/api/queries/query.c +++ b/web/api/queries/query.c @@ -3,9 +3,9 @@ #include "query.h" #include "web/api/formatters/rrd2json.h" #include "rrdr.h" -#include "database/ram/rrddim_mem.h" #include "average/average.h" +#include "countif/countif.h" #include "incremental_sum/incremental_sum.h" #include "max/max.h" #include "median/median.h" @@ -14,6 +14,8 @@ #include "stddev/stddev.h" #include "ses/ses.h" #include "des/des.h" +#include "percentile/percentile.h" +#include "trimmed_mean/trimmed_mean.h" // ---------------------------------------------------------------------------- @@ -28,7 +30,7 @@ static struct { // Allocate all required structures for a query. // This is called once for each netdata query. - void (*create)(struct rrdresult *r); + void (*create)(struct rrdresult *r, const char *options); // Cleanup collected values, but don't destroy the structures. // This is called when the query engine switches dimensions, @@ -40,7 +42,7 @@ static struct { // Add a single value into the calculation. // The module may decide to cache it, or use it in the fly. - void (*add)(struct rrdresult *r, calculated_number value); + void (*add)(struct rrdresult *r, NETDATA_DOUBLE value); // Generate a single result for the values added so far. // More values and points may be requested later. @@ -48,7 +50,9 @@ static struct { // when flushing it (so for a few modules it may be better to // continue after a flush as if nothing changed, for others a // cleanup of the internal structures may be required). - calculated_number (*flush)(struct rrdresult *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); + NETDATA_DOUBLE (*flush)(struct rrdresult *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); + + TIER_QUERY_FETCH tier_query_fetch; } api_v1_data_groups[] = { {.name = "average", .hash = 0, @@ -58,7 +62,8 @@ static struct { .reset = grouping_reset_average, .free = grouping_free_average, .add = grouping_add_average, - .flush = grouping_flush_average + .flush = grouping_flush_average, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "mean", // alias on 'average' .hash = 0, @@ -68,7 +73,107 @@ static struct { .reset = grouping_reset_average, .free = grouping_free_average, .add = grouping_add_average, - .flush = grouping_flush_average + .flush = grouping_flush_average, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean1", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN1, + .init = NULL, + .create= grouping_create_trimmed_mean1, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean2", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN2, + .init = NULL, + .create= grouping_create_trimmed_mean2, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean3", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN3, + .init = NULL, + .create= grouping_create_trimmed_mean3, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean5", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN5, + .init = NULL, + .create= grouping_create_trimmed_mean5, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean10", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN10, + .init = NULL, + .create= grouping_create_trimmed_mean10, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean15", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN15, + .init = NULL, + .create= grouping_create_trimmed_mean15, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean20", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN20, + .init = NULL, + .create= grouping_create_trimmed_mean20, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean25", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN25, + .init = NULL, + .create= grouping_create_trimmed_mean25, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-mean", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEAN5, + .init = NULL, + .create= grouping_create_trimmed_mean5, + .reset = grouping_reset_trimmed_mean, + .free = grouping_free_trimmed_mean, + .add = grouping_add_trimmed_mean, + .flush = grouping_flush_trimmed_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "incremental_sum", .hash = 0, @@ -78,7 +183,8 @@ static struct { .reset = grouping_reset_incremental_sum, .free = grouping_free_incremental_sum, .add = grouping_add_incremental_sum, - .flush = grouping_flush_incremental_sum + .flush = grouping_flush_incremental_sum, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "incremental-sum", .hash = 0, @@ -88,7 +194,8 @@ static struct { .reset = grouping_reset_incremental_sum, .free = grouping_free_incremental_sum, .add = grouping_add_incremental_sum, - .flush = grouping_flush_incremental_sum + .flush = grouping_flush_incremental_sum, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "median", .hash = 0, @@ -98,7 +205,217 @@ static struct { .reset = grouping_reset_median, .free = grouping_free_median, .add = grouping_add_median, - .flush = grouping_flush_median + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median1", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN1, + .init = NULL, + .create= grouping_create_trimmed_median1, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median2", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN2, + .init = NULL, + .create= grouping_create_trimmed_median2, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median3", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN3, + .init = NULL, + .create= grouping_create_trimmed_median3, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median5", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN5, + .init = NULL, + .create= grouping_create_trimmed_median5, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median10", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN10, + .init = NULL, + .create= grouping_create_trimmed_median10, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median15", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN15, + .init = NULL, + .create= grouping_create_trimmed_median15, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median20", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN20, + .init = NULL, + .create= grouping_create_trimmed_median20, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median25", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN25, + .init = NULL, + .create= grouping_create_trimmed_median25, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "trimmed-median", + .hash = 0, + .value = RRDR_GROUPING_TRIMMED_MEDIAN5, + .init = NULL, + .create= grouping_create_trimmed_median5, + .reset = grouping_reset_median, + .free = grouping_free_median, + .add = grouping_add_median, + .flush = grouping_flush_median, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile25", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE25, + .init = NULL, + .create= grouping_create_percentile25, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile50", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE50, + .init = NULL, + .create= grouping_create_percentile50, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile75", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE75, + .init = NULL, + .create= grouping_create_percentile75, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile80", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE80, + .init = NULL, + .create= grouping_create_percentile80, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile90", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE90, + .init = NULL, + .create= grouping_create_percentile90, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile95", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE95, + .init = NULL, + .create= grouping_create_percentile95, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile97", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE97, + .init = NULL, + .create= grouping_create_percentile97, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile98", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE98, + .init = NULL, + .create= grouping_create_percentile98, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile99", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE99, + .init = NULL, + .create= grouping_create_percentile99, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + {.name = "percentile", + .hash = 0, + .value = RRDR_GROUPING_PERCENTILE95, + .init = NULL, + .create= grouping_create_percentile95, + .reset = grouping_reset_percentile, + .free = grouping_free_percentile, + .add = grouping_add_percentile, + .flush = grouping_flush_percentile, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "min", .hash = 0, @@ -108,7 +425,8 @@ static struct { .reset = grouping_reset_min, .free = grouping_free_min, .add = grouping_add_min, - .flush = grouping_flush_min + .flush = grouping_flush_min, + .tier_query_fetch = TIER_QUERY_FETCH_MIN }, {.name = "max", .hash = 0, @@ -118,7 +436,8 @@ static struct { .reset = grouping_reset_max, .free = grouping_free_max, .add = grouping_add_max, - .flush = grouping_flush_max + .flush = grouping_flush_max, + .tier_query_fetch = TIER_QUERY_FETCH_MAX }, {.name = "sum", .hash = 0, @@ -128,7 +447,8 @@ static struct { .reset = grouping_reset_sum, .free = grouping_free_sum, .add = grouping_add_sum, - .flush = grouping_flush_sum + .flush = grouping_flush_sum, + .tier_query_fetch = TIER_QUERY_FETCH_SUM }, // standard deviation @@ -140,7 +460,8 @@ static struct { .reset = grouping_reset_stddev, .free = grouping_free_stddev, .add = grouping_add_stddev, - .flush = grouping_flush_stddev + .flush = grouping_flush_stddev, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "cv", // coefficient variation is calculated by stddev .hash = 0, @@ -150,7 +471,8 @@ static struct { .reset = grouping_reset_stddev, // not an error, stddev calculates this too .free = grouping_free_stddev, // not an error, stddev calculates this too .add = grouping_add_stddev, // not an error, stddev calculates this too - .flush = grouping_flush_coefficient_of_variation + .flush = grouping_flush_coefficient_of_variation, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "rsd", // alias of 'cv' .hash = 0, @@ -160,7 +482,8 @@ static struct { .reset = grouping_reset_stddev, // not an error, stddev calculates this too .free = grouping_free_stddev, // not an error, stddev calculates this too .add = grouping_add_stddev, // not an error, stddev calculates this too - .flush = grouping_flush_coefficient_of_variation + .flush = grouping_flush_coefficient_of_variation, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, /* @@ -172,7 +495,8 @@ static struct { .reset = grouping_reset_stddev, .free = grouping_free_stddev, .add = grouping_add_stddev, - .flush = grouping_flush_mean + .flush = grouping_flush_mean, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, */ @@ -185,7 +509,8 @@ static struct { .reset = grouping_reset_stddev, .free = grouping_free_stddev, .add = grouping_add_stddev, - .flush = grouping_flush_variance + .flush = grouping_flush_variance, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, */ @@ -193,44 +518,60 @@ static struct { {.name = "ses", .hash = 0, .value = RRDR_GROUPING_SES, - .init = grouping_init_ses, + .init = grouping_init_ses, .create= grouping_create_ses, .reset = grouping_reset_ses, .free = grouping_free_ses, .add = grouping_add_ses, - .flush = grouping_flush_ses + .flush = grouping_flush_ses, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "ema", // alias for 'ses' .hash = 0, .value = RRDR_GROUPING_SES, - .init = NULL, + .init = NULL, .create= grouping_create_ses, .reset = grouping_reset_ses, .free = grouping_free_ses, .add = grouping_add_ses, - .flush = grouping_flush_ses + .flush = grouping_flush_ses, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, {.name = "ewma", // alias for ses .hash = 0, .value = RRDR_GROUPING_SES, - .init = NULL, + .init = NULL, .create= grouping_create_ses, .reset = grouping_reset_ses, .free = grouping_free_ses, .add = grouping_add_ses, - .flush = grouping_flush_ses + .flush = grouping_flush_ses, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, // double exponential smoothing {.name = "des", .hash = 0, .value = RRDR_GROUPING_DES, - .init = grouping_init_des, + .init = grouping_init_des, .create= grouping_create_des, .reset = grouping_reset_des, .free = grouping_free_des, .add = grouping_add_des, - .flush = grouping_flush_des + .flush = grouping_flush_des, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE + }, + + {.name = "countif", + .hash = 0, + .value = RRDR_GROUPING_COUNTIF, + .init = NULL, + .create= grouping_create_countif, + .reset = grouping_reset_countif, + .free = grouping_free_countif, + .add = grouping_add_countif, + .flush = grouping_flush_countif, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE }, // terminator @@ -242,7 +583,8 @@ static struct { .reset = grouping_reset_average, .free = grouping_free_average, .add = grouping_add_average, - .flush = grouping_flush_average + .flush = grouping_flush_average, + .tier_query_fetch = TIER_QUERY_FETCH_AVERAGE } }; @@ -280,6 +622,41 @@ RRDR_GROUPING web_client_api_request_v1_data_group(const char *name, RRDR_GROUPI return def; } +const char *web_client_api_request_v1_data_group_to_string(RRDR_GROUPING group) { + int i; + + for(i = 0; api_v1_data_groups[i].name ; i++) + if(unlikely(group == api_v1_data_groups[i].value)) + return api_v1_data_groups[i].name; + + return "unknown"; +} + +static void rrdr_set_grouping_function(RRDR *r, RRDR_GROUPING group_method) { + int i, found = 0; + for(i = 0; !found && api_v1_data_groups[i].name ;i++) { + if(api_v1_data_groups[i].value == group_method) { + r->internal.grouping_create = api_v1_data_groups[i].create; + r->internal.grouping_reset = api_v1_data_groups[i].reset; + r->internal.grouping_free = api_v1_data_groups[i].free; + r->internal.grouping_add = api_v1_data_groups[i].add; + r->internal.grouping_flush = api_v1_data_groups[i].flush; + r->internal.tier_query_fetch = api_v1_data_groups[i].tier_query_fetch; + found = 1; + } + } + if(!found) { + errno = 0; + internal_error(true, "QUERY: grouping method %u not found. Using 'average'", (unsigned int)group_method); + r->internal.grouping_create = grouping_create_average; + r->internal.grouping_reset = grouping_reset_average; + r->internal.grouping_free = grouping_free_average; + r->internal.grouping_add = grouping_add_average; + r->internal.grouping_flush = grouping_flush_average; + r->internal.tier_query_fetch = TIER_QUERY_FETCH_AVERAGE; + } +} + // ---------------------------------------------------------------------------- static void rrdr_disable_not_selected_dimensions(RRDR *r, RRDR_OPTIONS options, const char *dims, @@ -335,7 +712,7 @@ static void rrdr_disable_not_selected_dimensions(RRDR *r, RRDR_OPTIONS options, // check if all dimensions are hidden if(unlikely(!dims_not_hidden_not_zero && dims_selected)) { - // there are a few selected dimensions + // there are a few selected dimensions, // but they are all zero // enable the selected ones // to avoid returning an empty chart @@ -352,22 +729,20 @@ static inline RRDR_VALUE_FLAGS *UNUSED_FUNCTION(rrdr_line_options)(RRDR *r, long return &r->o[ rrdr_line * r->d ]; } -static inline calculated_number *UNUSED_FUNCTION(rrdr_line_values)(RRDR *r, long rrdr_line) { +static inline NETDATA_DOUBLE *UNUSED_FUNCTION(rrdr_line_values)(RRDR *r, long rrdr_line) { return &r->v[ rrdr_line * r->d ]; } static inline long rrdr_line_init(RRDR *r, time_t t, long rrdr_line) { rrdr_line++; - #ifdef NETDATA_INTERNAL_CHECKS + internal_error(rrdr_line >= r->n, + "QUERY: requested to step above RRDR size for chart '%s'", + r->st->name); - if(unlikely(rrdr_line >= r->n)) - error("INTERNAL ERROR: requested to step above RRDR size for chart '%s'", r->st->name); - - if(unlikely(r->t[rrdr_line] != 0 && r->t[rrdr_line] != t)) - error("INTERNAL ERROR: overwriting the timestamp of RRDR line %zu from %zu to %zu, of chart '%s'", (size_t)rrdr_line, (size_t)r->t[rrdr_line], (size_t)t, r->st->name); - - #endif + internal_error(r->t[rrdr_line] != 0 && r->t[rrdr_line] != t, + "QUERY: overwriting the timestamp of RRDR line %zu from %zu to %zu, of chart '%s'", + (size_t)rrdr_line, (size_t)r->t[rrdr_line], (size_t)t, r->st->name); // save the time r->t[rrdr_line] = t; @@ -381,337 +756,737 @@ static inline void rrdr_done(RRDR *r, long rrdr_line) { // ---------------------------------------------------------------------------- -// fill RRDR for a single dimension +// tier management -static inline void do_dimension_variablestep( - RRDR *r - , long points_wanted - , RRDDIM *rd - , long dim_id_in_rrdr - , time_t after_wanted - , time_t before_wanted - , uint32_t options -){ -// RRDSET *st = r->st; +static int rrddim_find_best_tier_for_timeframe(RRDDIM *rd, time_t after_wanted, time_t before_wanted, long points_wanted) { + if(unlikely(storage_tiers < 2)) + return 0; - time_t - now = after_wanted, - dt = r->update_every, - max_date = 0, - min_date = 0; + if(unlikely(after_wanted == before_wanted || points_wanted <= 0 || !rd || !rd->rrdset)) { - long -// group_size = r->group, - points_added = 0, - values_in_group = 0, - values_in_group_non_zero = 0, - rrdr_line = -1; + if(!rd) + internal_error(true, "QUERY: NULL dimension - invalid params to tier calculation"); + else + internal_error(true, "QUERY: chart '%s' dimension '%s' invalid params to tier calculation", + (rd->rrdset)?rd->rrdset->name:"unknown", rd->name); - RRDR_VALUE_FLAGS - group_value_flags = RRDR_VALUE_NOTHING; + return 0; + } - struct rrddim_query_handle handle; + //BUFFER *wb = buffer_create(1000); + //buffer_sprintf(wb, "Best tier for chart '%s', dim '%s', from %ld to %ld (dur %ld, every %d), points %ld", + // rd->rrdset->name, rd->name, after_wanted, before_wanted, before_wanted - after_wanted, rd->update_every, points_wanted); + + long weight[storage_tiers]; + + for(int tier = 0; tier < storage_tiers ; tier++) { + if(unlikely(!rd->tiers[tier])) { + internal_error(true, "QUERY: tier %d of chart '%s' dimension '%s' not initialized", + tier, rd->rrdset->name, rd->name); + // buffer_free(wb); + return 0; + } + + time_t first_t = rd->tiers[tier]->query_ops.oldest_time(rd->tiers[tier]->db_metric_handle); + time_t last_t = rd->tiers[tier]->query_ops.latest_time(rd->tiers[tier]->db_metric_handle); + + time_t common_after = MAX(first_t, after_wanted); + time_t common_before = MIN(last_t, before_wanted); + + long time_coverage = (common_before - common_after) * 1000 / (before_wanted - after_wanted); + if(time_coverage < 0) time_coverage = 0; + + int update_every = (int)rd->tiers[tier]->tier_grouping * (int)rd->update_every; + if(unlikely(update_every == 0)) { + internal_error(true, "QUERY: update_every of tier %d for chart '%s' dimension '%s' is zero. tg = %d, ue = %d", + tier, rd->rrdset->name, rd->name, rd->tiers[tier]->tier_grouping, rd->update_every); + // buffer_free(wb); + return 0; + } + + long points_available = (before_wanted - after_wanted) / update_every; + long points_delta = points_available - points_wanted; + long points_coverage = (points_delta < 0) ? points_available * 1000 / points_wanted: 1000; + + if(points_available <= 0) + weight[tier] = -LONG_MAX; + else + weight[tier] = points_coverage; + + // buffer_sprintf(wb, ": tier %d, first %ld, last %ld (dur %ld, tg %d, every %d), points %ld, tcoverage %ld, pcoverage %ld, weight %ld", + // tier, first_t, last_t, last_t - first_t, rd->tiers[tier]->tier_grouping, update_every, + // points_available, time_coverage, points_coverage, weight[tier]); + } + + int best_tier = 0; + for(int tier = 1; tier < storage_tiers ; tier++) { + if(weight[tier] >= weight[best_tier]) + best_tier = tier; + } + + if(weight[best_tier] == -LONG_MAX) + best_tier = 0; + + //buffer_sprintf(wb, ": final best tier %d", best_tier); + //internal_error(true, "%s", buffer_tostring(wb)); + //buffer_free(wb); + + return best_tier; +} + +static int rrdset_find_natural_update_every_for_timeframe(RRDSET *st, time_t after_wanted, time_t before_wanted, long points_wanted, RRDR_OPTIONS options, int tier) { + int ret = st->update_every; + + if(unlikely(!st->dimensions)) + return ret; - calculated_number min = r->min, max = r->max; - size_t db_points_read = 0; - time_t db_now = now; - storage_number n_curr, n_prev = SN_EMPTY_SLOT; - calculated_number value; + rrdset_rdlock(st); + int best_tier; - for(rd->state->query_ops.init(rd, &handle, now, before_wanted) ; points_added < points_wanted ; now += dt) { - // make sure we return data in the proper time range - if (unlikely(now > before_wanted)) { + if(options & RRDR_OPTION_SELECTED_TIER && tier >= 0 && tier < storage_tiers) + best_tier = tier; + else + best_tier = rrddim_find_best_tier_for_timeframe(st->dimensions, after_wanted, before_wanted, points_wanted); + + if(!st->dimensions->tiers[best_tier]) { + internal_error( + true, + "QUERY: tier %d on chart '%s', is not initialized", best_tier, st->name); + } + else { + ret = (int)st->dimensions->tiers[best_tier]->tier_grouping * (int)st->update_every; + if(unlikely(!ret)) { + internal_error( + true, + "QUERY: update_every calculated to be zero on chart '%s', tier_grouping %d, update_every %d", + st->name, st->dimensions->tiers[best_tier]->tier_grouping, st->update_every); + + ret = st->update_every; + } + } + + rrdset_unlock(st); + + return ret; +} + +// ---------------------------------------------------------------------------- +// query ops + +typedef struct query_point { + time_t end_time; + time_t start_time; + NETDATA_DOUBLE value; + NETDATA_DOUBLE anomaly; + SN_FLAGS flags; #ifdef NETDATA_INTERNAL_CHECKS - r->internal.log = "stopped, because attempted to access the db after 'wanted before'"; + size_t id; #endif - break; - } - if (unlikely(now < after_wanted)) { +} QUERY_POINT; + +QUERY_POINT QUERY_POINT_EMPTY = { + .end_time = 0, + .start_time = 0, + .value = NAN, + .anomaly = 0, + .flags = SN_FLAG_NONE, #ifdef NETDATA_INTERNAL_CHECKS - r->internal.log = "skipped, because attempted to access the db before 'wanted after'"; + .id = 0, #endif - continue; - } +}; - while (now >= db_now && (!rd->state->query_ops.is_finished(&handle) || - does_storage_number_exist(n_prev))) { - value = NAN; - if (does_storage_number_exist(n_prev)) { - // use the previously read database value - n_curr = n_prev; - } else { - // read the value from the database - n_curr = rd->state->query_ops.next_metric(&handle, &db_now); - } - n_prev = SN_EMPTY_SLOT; - // db_now has a different value than above - if (likely(now >= db_now)) { - if (likely(does_storage_number_exist(n_curr))) { - if (options & RRDR_OPTION_ANOMALY_BIT) - value = (n_curr & SN_ANOMALY_BIT) ? 0.0 : 100.0; - else - value = unpack_storage_number(n_curr); - - if (likely(value != 0.0)) - values_in_group_non_zero++; - - if (unlikely(did_storage_number_reset(n_curr))) - group_value_flags |= RRDR_VALUE_RESET; - } - } else { - // We must postpone processing the value and fill the result with gaps instead - if (likely(does_storage_number_exist(n_curr))) { - n_prev = n_curr; - } - } - // add this value to grouping - if(likely(!isnan(value))) - r->internal.grouping_add(r, value); +#ifdef NETDATA_INTERNAL_CHECKS +#define query_point_set_id(point, point_id) (point).id = point_id +#else +#define query_point_set_id(point, point_id) debug_dummy() +#endif - values_in_group++; - db_points_read++; - } +typedef struct query_plan_entry { + size_t tier; + time_t after; + time_t before; +} QUERY_PLAN_ENTRY; - if (0 == values_in_group) { - // add NAN to grouping - r->internal.grouping_add(r, NAN); - } +typedef struct query_plan { + size_t entries; + QUERY_PLAN_ENTRY data[RRD_STORAGE_TIERS*2]; +} QUERY_PLAN; + +typedef struct query_engine_ops { + // configuration + RRDR *r; + RRDDIM *rd; + time_t view_update_every; + time_t query_granularity; + TIER_QUERY_FETCH tier_query_fetch; + + // query planer + QUERY_PLAN plan; + size_t current_plan; + time_t current_plan_expire_time; + + // storage queries + size_t tier; + struct rrddim_tier *tier_ptr; + struct rrddim_query_handle handle; + STORAGE_POINT (*next_metric)(struct rrddim_query_handle *handle); + int (*is_finished)(struct rrddim_query_handle *handle); + void (*finalize)(struct rrddim_query_handle *handle); - rrdr_line = rrdr_line_init(r, now, rrdr_line); + // aggregating points over time + void (*grouping_add)(struct rrdresult *r, NETDATA_DOUBLE value); + NETDATA_DOUBLE (*grouping_flush)(struct rrdresult *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); + size_t group_points_non_zero; + size_t group_points_added; + NETDATA_DOUBLE group_anomaly_rate; + RRDR_VALUE_FLAGS group_value_flags; - if(unlikely(!min_date)) min_date = now; - max_date = now; + // statistics + size_t db_total_points_read; + size_t db_points_read_per_tier[RRD_STORAGE_TIERS]; +} QUERY_ENGINE_OPS; - // find the place to store our values - RRDR_VALUE_FLAGS *rrdr_value_options_ptr = &r->o[rrdr_line * r->d + dim_id_in_rrdr]; - // update the dimension options - if(likely(values_in_group_non_zero)) - r->od[dim_id_in_rrdr] |= RRDR_DIMENSION_NONZERO; +// ---------------------------------------------------------------------------- +// query planer - // store the specific point options - *rrdr_value_options_ptr = group_value_flags; +#define query_plan_should_switch_plan(ops, now) ((now) >= (ops).current_plan_expire_time) - // store the value - value = r->internal.grouping_flush(r, rrdr_value_options_ptr); - r->v[rrdr_line * r->d + dim_id_in_rrdr] = value; +static void query_planer_activate_plan(QUERY_ENGINE_OPS *ops, size_t plan_id, time_t overwrite_after) { + if(unlikely(plan_id >= ops->plan.entries)) + plan_id = ops->plan.entries - 1; - if(likely(points_added || dim_id_in_rrdr)) { - // find the min/max across all dimensions + time_t after = ops->plan.data[plan_id].after; + time_t before = ops->plan.data[plan_id].before; - if(unlikely(value < min)) min = value; - if(unlikely(value > max)) max = value; + if(overwrite_after > after && overwrite_after < before) + after = overwrite_after; + ops->tier = ops->plan.data[plan_id].tier; + ops->tier_ptr = ops->rd->tiers[ops->tier]; + ops->tier_ptr->query_ops.init(ops->tier_ptr->db_metric_handle, &ops->handle, after, before, ops->r->internal.tier_query_fetch); + ops->next_metric = ops->tier_ptr->query_ops.next_metric; + ops->is_finished = ops->tier_ptr->query_ops.is_finished; + ops->finalize = ops->tier_ptr->query_ops.finalize; + ops->current_plan = plan_id; + ops->current_plan_expire_time = ops->plan.data[plan_id].before; +} + +static void query_planer_next_plan(QUERY_ENGINE_OPS *ops, time_t now, time_t last_point_end_time) { + internal_error(now < ops->current_plan_expire_time && now < ops->plan.data[ops->current_plan].before, + "QUERY: switching query plan too early!"); + + time_t next_plan_before_time; + do { + ops->current_plan++; + + if (ops->current_plan >= ops->plan.entries) { + ops->current_plan = ops->plan.entries - 1; + return; } - else { - // runs only when dim_id_in_rrdr == 0 && points_added == 0 - // so, on the first point added for the query. - min = max = value; - } - points_added++; - values_in_group = 0; - group_value_flags = RRDR_VALUE_NOTHING; - values_in_group_non_zero = 0; + next_plan_before_time = ops->plan.data[ops->current_plan].before; + } while(now >= next_plan_before_time || last_point_end_time >= next_plan_before_time); + + if(ops->finalize) { + ops->finalize(&ops->handle); + ops->finalize = NULL; } - rd->state->query_ops.finalize(&handle); - r->internal.db_points_read += db_points_read; - r->internal.result_points_generated += points_added; + query_planer_activate_plan(ops, ops->current_plan, MIN(now, last_point_end_time)); - r->min = min; - r->max = max; - r->before = max_date; - r->after = min_date - (r->group - 1) * dt; - rrdr_done(r, rrdr_line); + // internal_error(true, "QUERY: switched plan to %zu (all is %zu), previous expiration was %ld, this starts at %ld, now is %ld, last_point_end_time %ld", ops->current_plan, ops->plan.entries, ops->plan.data[ops->current_plan-1].before, ops->plan.data[ops->current_plan].after, now, last_point_end_time); +} - #ifdef NETDATA_INTERNAL_CHECKS - if(unlikely(r->rows != points_added)) - error("INTERNAL ERROR: %s.%s added %zu rows, but RRDR says I added %zu.", r->st->name, rd->name, (size_t)points_added, (size_t)r->rows); - #endif +static int compare_query_plan_entries_on_start_time(const void *a, const void *b) { + QUERY_PLAN_ENTRY *p1 = (QUERY_PLAN_ENTRY *)a; + QUERY_PLAN_ENTRY *p2 = (QUERY_PLAN_ENTRY *)b; + return (p1->after < p2->after)?-1:1; } -static inline void do_dimension_fixedstep( - RRDR *r - , long points_wanted - , RRDDIM *rd - , long dim_id_in_rrdr - , time_t after_wanted - , time_t before_wanted - , uint32_t options -){ - time_t now = after_wanted, - dt = r->update_every / r->group, /* usually is st->update_every */ - max_date = 0, - min_date = 0; +static void query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before_wanted, long points_wanted) { + RRDDIM *rd = ops->rd; - long group_size = r->group, - points_added = 0, - values_in_group = 0, - values_in_group_non_zero = 0, - rrdr_line = -1; + //BUFFER *wb = buffer_create(1000); + //buffer_sprintf(wb, "QUERY PLAN for chart '%s' dimension '%s', from %ld to %ld:", rd->rrdset->name, rd->name, after_wanted, before_wanted); - RRDR_VALUE_FLAGS group_value_flags = RRDR_VALUE_NOTHING; + // put our selected tier as the first plan + size_t selected_tier; - struct rrddim_query_handle handle; + if(ops->r->internal.query_options & RRDR_OPTION_SELECTED_TIER && ops->r->internal.query_tier >= 0 && ops->r->internal.query_tier < storage_tiers) { + selected_tier = ops->r->internal.query_tier; + } + else { - calculated_number min = r->min, max = r->max; - size_t db_points_read = 0; - time_t db_now = now; - time_t first_time_t = rrddim_first_entry_t(rd); + selected_tier = rrddim_find_best_tier_for_timeframe(rd, after_wanted, before_wanted, points_wanted); - // cache the function pointers we need in the loop - storage_number (*next_metric)(struct rrddim_query_handle *handle, time_t *current_time) = rd->state->query_ops.next_metric; - void (*grouping_add)(struct rrdresult *r, calculated_number value) = r->internal.grouping_add; - calculated_number (*grouping_flush)(struct rrdresult *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) = r->internal.grouping_flush; - RRD_MEMORY_MODE rrd_memory_mode = rd->rrd_memory_mode; + if(ops->r->internal.query_options & RRDR_OPTION_SELECTED_TIER) + ops->r->internal.query_options &= ~RRDR_OPTION_SELECTED_TIER; + } - for(rd->state->query_ops.init(rd, &handle, now, before_wanted) ; points_added < points_wanted ; now += dt) { - // make sure we return data in the proper time range - if(unlikely(now > before_wanted)) { -#ifdef NETDATA_INTERNAL_CHECKS - r->internal.log = "stopped, because attempted to access the db after 'wanted before'"; -#endif - break; + ops->plan.entries = 1; + ops->plan.data[0].tier = selected_tier; + ops->plan.data[0].after = rd->tiers[selected_tier]->query_ops.oldest_time(rd->tiers[selected_tier]->db_metric_handle); + ops->plan.data[0].before = rd->tiers[selected_tier]->query_ops.latest_time(rd->tiers[selected_tier]->db_metric_handle); + + if(!(ops->r->internal.query_options & RRDR_OPTION_SELECTED_TIER)) { + // the selected tier + time_t selected_tier_first_time_t = ops->plan.data[0].after; + time_t selected_tier_last_time_t = ops->plan.data[0].before; + + //buffer_sprintf(wb, ": SELECTED tier %zu, from %ld to %ld", selected_tier, ops->plan.data[0].after, ops->plan.data[0].before); + + // check if our selected tier can start the query + if (selected_tier_first_time_t > after_wanted) { + // we need some help from other tiers + for (int tr = (int)selected_tier + 1; tr < storage_tiers; tr++) { + // find the first time of this tier + time_t first_time_t = rd->tiers[tr]->query_ops.oldest_time(rd->tiers[tr]->db_metric_handle); + + //buffer_sprintf(wb, ": EVAL AFTER tier %d, %ld", tier, first_time_t); + + // can it help? + if (first_time_t < selected_tier_first_time_t) { + // it can help us add detail at the beginning of the query + QUERY_PLAN_ENTRY t = { + .tier = tr, + .after = (first_time_t < after_wanted) ? after_wanted : first_time_t, + .before = selected_tier_first_time_t}; + ops->plan.data[ops->plan.entries++] = t; + + // prepare for the tier + selected_tier_first_time_t = t.after; + + if (t.after <= after_wanted) + break; + } + } } - if(unlikely(now < after_wanted)) { -#ifdef NETDATA_INTERNAL_CHECKS - r->internal.log = "skipped, because attempted to access the db before 'wanted after'"; -#endif - continue; + // check if our selected tier can finish the query + if (selected_tier_last_time_t < before_wanted) { + // we need some help from other tiers + for (int tr = (int)selected_tier - 1; tr >= 0; tr--) { + // find the last time of this tier + time_t last_time_t = rd->tiers[tr]->query_ops.latest_time(rd->tiers[tr]->db_metric_handle); + + //buffer_sprintf(wb, ": EVAL BEFORE tier %d, %ld", tier, last_time_t); + + // can it help? + if (last_time_t > selected_tier_last_time_t) { + // it can help us add detail at the end of the query + QUERY_PLAN_ENTRY t = { + .tier = tr, + .after = selected_tier_last_time_t, + .before = (last_time_t > before_wanted) ? before_wanted : last_time_t}; + ops->plan.data[ops->plan.entries++] = t; + + // prepare for the tier + selected_tier_last_time_t = t.before; + + if (t.before >= before_wanted) + break; + } + } } + } - // read the value from the database - //storage_number n = rd->values[slot]; + // sort the query plan + if(ops->plan.entries > 1) + qsort(&ops->plan.data, ops->plan.entries, sizeof(QUERY_PLAN_ENTRY), compare_query_plan_entries_on_start_time); -#ifdef NETDATA_INTERNAL_CHECKS - struct mem_query_handle* mem_handle = (struct mem_query_handle*)handle.handle; - if ((rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE) && - (rrdset_time2slot(r->st, now) != (long unsigned)(mem_handle->slot))) { - error("INTERNAL CHECK: Unaligned query for %s, database slot: %lu, expected slot: %lu", rd->id, (long unsigned)mem_handle->slot, rrdset_time2slot(r->st, now)); - } -#endif + // make sure it has the whole timeframe we need + ops->plan.data[0].after = after_wanted; + ops->plan.data[ops->plan.entries - 1].before = before_wanted; - db_now = now; // this is needed to set db_now in case the next_metric implementation does not set it + //buffer_sprintf(wb, ": FINAL STEPS %zu", ops->plan.entries); - storage_number n; - calculated_number value; + //for(size_t i = 0; i < ops->plan.entries ;i++) + // buffer_sprintf(wb, ": STEP %zu = use tier %zu from %ld to %ld", i+1, ops->plan.data[i].tier, ops->plan.data[i].after, ops->plan.data[i].before); - if (unlikely(rrd_memory_mode != RRD_MEMORY_MODE_DBENGINE && now <= first_time_t)) { - n = SN_EMPTY_SLOT; - value = NAN; - } - else { - // load the metric value - n = next_metric(&handle, &db_now); - db_points_read++; - - // and unpack it - if(likely(does_storage_number_exist(n))) { - if (options & RRDR_OPTION_ANOMALY_BIT) - value = (n & SN_ANOMALY_BIT) ? 0.0 : 100.0; - else - value = unpack_storage_number(n); - } - else - value = NAN; - } + //internal_error(true, "%s", buffer_tostring(wb)); - if(unlikely(db_now > before_wanted)) { -#ifdef NETDATA_INTERNAL_CHECKS - r->internal.log = "stopped, because attempted to access the db after 'wanted before'"; -#endif - break; - } + query_planer_activate_plan(ops, 0, 0); +} - // this loop exists only to fill nulls - // so, if there is a value already, we use it for the first iteration - // but the following iterations will just fill nulls to the destination - for ( ; now <= db_now ; now += dt, value = NAN, n = SN_EMPTY_SLOT) { - if(likely(does_storage_number_exist(n))) { - -#if defined(NETDATA_INTERNAL_CHECKS) && defined(ENABLE_DBENGINE) - if(now >= db_now) { - struct rrdeng_query_handle *rrd_handle = (struct rrdeng_query_handle *)handle.handle; - if ((rd->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) && (now != rrd_handle->now)) - error( - "INTERNAL CHECK: Unaligned query for %s, database time: %ld, expected time: %ld", - rd->id, - (long)rrd_handle->now, - (long)now); - } -#endif - if(likely(value != 0.0)) - values_in_group_non_zero++; +// ---------------------------------------------------------------------------- +// dimension level query engine + +#define query_interpolate_point(this_point, last_point, now) do { \ + if(likely( \ + /* the point to interpolate is more than 1s wide */ \ + (this_point).end_time - (this_point).start_time > 1 \ + \ + /* the two points are exactly next to each other */ \ + && (last_point).end_time == (this_point).start_time \ + \ + /* both points are valid numbers */ \ + && netdata_double_isnumber((this_point).value) \ + && netdata_double_isnumber((last_point).value) \ + \ + )) { \ + (this_point).value = (last_point).value + ((this_point).value - (last_point).value) * (1.0 - (NETDATA_DOUBLE)((this_point).end_time - (now)) / (NETDATA_DOUBLE)((this_point).end_time - (this_point).start_time)); \ + (this_point).end_time = now; \ + } \ +} while(0) + +#define query_add_point_to_group(r, point, ops) do { \ + if(likely(netdata_double_isnumber((point).value))) { \ + if(likely(fpclassify((point).value) != FP_ZERO)) \ + (ops).group_points_non_zero++; \ + \ + if(unlikely((point).flags & SN_FLAG_RESET)) \ + (ops).group_value_flags |= RRDR_VALUE_RESET; \ + \ + (ops).grouping_add(r, (point).value); \ + } \ + \ + (ops).group_points_added++; \ + (ops).group_anomaly_rate += (point).anomaly; \ +} while(0) + +static inline void rrd2rrdr_do_dimension( + RRDR *r + , long points_wanted + , RRDDIM *rd + , long dim_id_in_rrdr + , time_t after_wanted + , time_t before_wanted +){ + time_t max_date = 0, + min_date = 0; + + size_t points_added = 0; + + QUERY_ENGINE_OPS ops = { + .r = r, + .rd = rd, + .grouping_add = r->internal.grouping_add, + .grouping_flush = r->internal.grouping_flush, + .tier_query_fetch = r->internal.tier_query_fetch, + .view_update_every = r->update_every, + .query_granularity = r->update_every / r->group, + .group_value_flags = RRDR_VALUE_NOTHING + }; + + long rrdr_line = -1; + bool use_anomaly_bit_as_value = (r->internal.query_options & RRDR_OPTION_ANOMALY_BIT) ? true : false; + + query_plan(&ops, after_wanted, before_wanted, points_wanted); + + NETDATA_DOUBLE min = r->min, max = r->max; + + QUERY_POINT last2_point = QUERY_POINT_EMPTY; + QUERY_POINT last1_point = QUERY_POINT_EMPTY; + QUERY_POINT new_point = QUERY_POINT_EMPTY; - if(unlikely(did_storage_number_reset(n))) - group_value_flags |= RRDR_VALUE_RESET; + time_t now_start_time = after_wanted - ops.query_granularity; + time_t now_end_time = after_wanted + ops.view_update_every - ops.query_granularity; - grouping_add(r, value); + // The main loop, based on the query granularity we need + for( ; (long)points_added < points_wanted ; now_start_time = now_end_time, now_end_time += ops.view_update_every) { + + if(query_plan_should_switch_plan(ops, now_end_time)) + query_planer_next_plan(&ops, now_end_time, new_point.end_time); + + // read all the points of the db, prior to the time we need (now_end_time) + + + size_t count_same_end_time = 0; + while(count_same_end_time < 100) { + if(likely(count_same_end_time == 0)) { + last2_point = last1_point; + last1_point = new_point; } - // add this value for grouping - values_in_group++; + if(unlikely(ops.is_finished(&ops.handle))) { + if(count_same_end_time != 0) { + last2_point = last1_point; + last1_point = new_point; + } + new_point = QUERY_POINT_EMPTY; + new_point.start_time = last1_point.end_time; + new_point.end_time = now_end_time; + break; + } - if(unlikely(values_in_group == group_size)) { - rrdr_line = rrdr_line_init(r, now, rrdr_line); - size_t rrdr_o_v_index = rrdr_line * r->d + dim_id_in_rrdr; + // fetch the new point + { + STORAGE_POINT sp = ops.next_metric(&ops.handle); - if(unlikely(!min_date)) min_date = now; - max_date = now; + ops.db_points_read_per_tier[ops.tier]++; + ops.db_total_points_read++; - // find the place to store our values - RRDR_VALUE_FLAGS *rrdr_value_options_ptr = &r->o[rrdr_o_v_index]; + new_point.start_time = sp.start_time; + new_point.end_time = sp.end_time; + new_point.anomaly = sp.count ? (NETDATA_DOUBLE)sp.anomaly_count * 100.0 / (NETDATA_DOUBLE)sp.count : 0.0; + query_point_set_id(new_point, ops.db_total_points_read); - // update the dimension options - if(likely(values_in_group_non_zero)) - r->od[dim_id_in_rrdr] |= RRDR_DIMENSION_NONZERO; + // set the right value to the point we got + if(likely(!storage_point_is_unset(sp) && !storage_point_is_empty(sp))) { - // store the specific point options - *rrdr_value_options_ptr = group_value_flags; + if(unlikely(use_anomaly_bit_as_value)) + new_point.value = new_point.anomaly; - // store the group value - calculated_number group_value = grouping_flush(r, rrdr_value_options_ptr); - r->v[rrdr_o_v_index] = group_value; + else { + switch (ops.tier_query_fetch) { + default: + case TIER_QUERY_FETCH_AVERAGE: + new_point.value = sp.sum / sp.count; + break; - if(likely(points_added || dim_id_in_rrdr)) { - // find the min/max across all dimensions + case TIER_QUERY_FETCH_MIN: + new_point.value = sp.min; + break; - if(unlikely(group_value < min)) min = group_value; - if(unlikely(group_value > max)) max = group_value; + case TIER_QUERY_FETCH_MAX: + new_point.value = sp.max; + break; + case TIER_QUERY_FETCH_SUM: + new_point.value = sp.sum; + break; + }; + } } else { - // runs only when dim_id_in_rrdr == 0 && points_added == 0 - // so, on the first point added for the query. - min = max = group_value; + new_point.value = NAN; + new_point.flags = SN_FLAG_NONE; } + } + + // check if the db is giving us zero duration points + if(unlikely(new_point.start_time == new_point.end_time)) { + internal_error(true, "QUERY: next_metric(%s, %s) returned point %zu start time %ld, end time %ld, that are both equal", + rd->rrdset->name, rd->name, new_point.id, new_point.start_time, new_point.end_time); - points_added++; - values_in_group = 0; - group_value_flags = RRDR_VALUE_NOTHING; - values_in_group_non_zero = 0; + new_point.start_time = new_point.end_time - ((time_t)ops.tier_ptr->tier_grouping * (time_t)ops.rd->update_every); } - } - now = db_now; - } - rd->state->query_ops.finalize(&handle); - r->internal.db_points_read += db_points_read; - r->internal.result_points_generated += points_added; + // check if the db is advancing the query + if(unlikely(new_point.end_time <= last1_point.end_time)) { + internal_error(true, "QUERY: next_metric(%s, %s) returned point %zu from %ld time %ld, before the last point %zu end time %ld, now is %ld to %ld", + rd->rrdset->name, rd->name, new_point.id, new_point.start_time, new_point.end_time, + last1_point.id, last1_point.end_time, now_start_time, now_end_time); - r->min = min; - r->max = max; - r->before = max_date; - r->after = min_date - (r->group - 1) * dt; - rrdr_done(r, rrdr_line); + count_same_end_time++; + continue; + } + count_same_end_time = 0; -#ifdef NETDATA_INTERNAL_CHECKS - if(unlikely(r->rows != points_added)) - error("INTERNAL ERROR: %s.%s added %zu rows, but RRDR says I added %zu.", r->st->name, rd->name, (size_t)points_added, (size_t)r->rows); -#endif + // decide how to use this point + if(likely(new_point.end_time < now_end_time)) { // likely to favor tier0 + // this db point ends before our now_end_time + + if(likely(new_point.end_time >= now_start_time)) { // likely to favor tier0 + // this db point ends after our now_start time + + query_add_point_to_group(r, new_point, ops); + } + else { + // we don't need this db point + // it is totally outside our current time-frame + + // this is desirable for the first point of the query + // because it allows us to interpolate the next point + // at exactly the time we will want + + // we only log if this is not point 1 + internal_error(new_point.end_time < after_wanted && new_point.id > 1, + "QUERY: next_metric(%s, %s) returned point %zu from %ld time %ld, which is entirely before our current timeframe %ld to %ld (and before the entire query, after %ld, before %ld)", + rd->rrdset->name, rd->name, + new_point.id, new_point.start_time, new_point.end_time, + now_start_time, now_end_time, + after_wanted, before_wanted); + } + + } + else { + // the point ends in the future + // so, we will interpolate it below, at the inner loop + break; + } + } + + if(unlikely(count_same_end_time)) { + internal_error(true, + "QUERY: the database does not advance the query, it returned an end time less or equal to the end time of the last point we got %ld, %zu times", + last1_point.end_time, count_same_end_time); + + if(unlikely(new_point.end_time <= last1_point.end_time)) + new_point.end_time = now_end_time; + } + + // the inner loop + // we have 3 points in memory: last2, last1, new + // we select the one to use based on their timestamps + + size_t iterations = 0; + for ( ; now_end_time <= new_point.end_time && (long)points_added < points_wanted ; + now_end_time += ops.view_update_every, iterations++) { + + // now_start_time is wrong in this loop + // but, we don't need it + + QUERY_POINT current_point; + + if(likely(now_end_time > new_point.start_time)) { + // it is time for our NEW point to be used + current_point = new_point; + query_interpolate_point(current_point, last1_point, now_end_time); + + internal_error(current_point.id > 0 && last1_point.id == 0 && current_point.end_time > after_wanted && current_point.end_time > now_end_time, + "QUERY: on '%s', dim '%s', after %ld, before %ld, view update every %ld, query granularity %ld," + " interpolating point %zu (from %ld to %ld) at %ld, but we could really favor by having last_point1 in this query.", + rd->rrdset->name, rd->name, after_wanted, before_wanted, ops.view_update_every, ops.query_granularity, + current_point.id, current_point.start_time, current_point.end_time, now_end_time); + } + else if(likely(now_end_time <= last1_point.end_time)) { + // our LAST point is still valid + current_point = last1_point; + query_interpolate_point(current_point, last2_point, now_end_time); + + internal_error(current_point.id > 0 && last2_point.id == 0 && current_point.end_time > after_wanted && current_point.end_time > now_end_time, + "QUERY: on '%s', dim '%s', after %ld, before %ld, view update every %ld, query granularity %ld," + " interpolating point %zu (from %ld to %ld) at %ld, but we could really favor by having last_point2 in this query.", + rd->rrdset->name, rd->name, after_wanted, before_wanted, ops.view_update_every, ops.query_granularity, + current_point.id, current_point.start_time, current_point.end_time, now_end_time); + } + else { + // a GAP, we don't have a value this time + current_point = QUERY_POINT_EMPTY; + } + + query_add_point_to_group(r, current_point, ops); + + rrdr_line = rrdr_line_init(r, now_end_time, rrdr_line); + size_t rrdr_o_v_index = rrdr_line * r->d + dim_id_in_rrdr; + + if(unlikely(!min_date)) min_date = now_end_time; + max_date = now_end_time; + + // find the place to store our values + RRDR_VALUE_FLAGS *rrdr_value_options_ptr = &r->o[rrdr_o_v_index]; + + // update the dimension options + if(likely(ops.group_points_non_zero)) + r->od[dim_id_in_rrdr] |= RRDR_DIMENSION_NONZERO; + + // store the specific point options + *rrdr_value_options_ptr = ops.group_value_flags; + + // store the group value + NETDATA_DOUBLE group_value = ops.grouping_flush(r, rrdr_value_options_ptr); + r->v[rrdr_o_v_index] = group_value; + + // we only store uint8_t anomaly rates, + // so let's get double precision by storing + // anomaly rates in the range 0 - 200 + r->ar[rrdr_o_v_index] = ops.group_anomaly_rate / (NETDATA_DOUBLE)ops.group_points_added; + + if(likely(points_added || dim_id_in_rrdr)) { + // find the min/max across all dimensions + + if(unlikely(group_value < min)) min = group_value; + if(unlikely(group_value > max)) max = group_value; + + } + else { + // runs only when dim_id_in_rrdr == 0 && points_added == 0 + // so, on the first point added for the query. + min = max = group_value; + } + + points_added++; + ops.group_points_added = 0; + ops.group_value_flags = RRDR_VALUE_NOTHING; + ops.group_points_non_zero = 0; + ops.group_anomaly_rate = 0; + } + // the loop above increased "now" by query_granularity, + // but the main loop will increase it too, + // so, let's undo the last iteration of this loop + if(iterations) + now_end_time -= ops.view_update_every; + } + ops.finalize(&ops.handle); + + r->internal.result_points_generated += points_added; + r->internal.db_points_read += ops.db_total_points_read; + for(int tr = 0; tr < storage_tiers ; tr++) + r->internal.tier_points_read[tr] += ops.db_points_read_per_tier[tr]; + + r->min = min; + r->max = max; + r->before = max_date; + r->after = min_date - ops.view_update_every + ops.query_granularity; + rrdr_done(r, rrdr_line); + + internal_error((long)points_added != points_wanted, + "QUERY: query on %s/%s requested %zu points, but RRDR added %zu (%zu db points read).", + r->st->name, rd->name, (size_t)points_wanted, (size_t)points_added, ops.db_total_points_read); +} + +// ---------------------------------------------------------------------------- +// fill the gap of a tier + +extern void store_metric_at_tier(RRDDIM *rd, struct rrddim_tier *t, STORAGE_POINT sp, usec_t now_ut); + +void rrdr_fill_tier_gap_from_smaller_tiers(RRDDIM *rd, int tier, time_t now) { + if(unlikely(tier < 0 || tier >= storage_tiers)) return; + if(storage_tiers_backfill[tier] == RRD_BACKFILL_NONE) return; + + struct rrddim_tier *t = rd->tiers[tier]; + if(unlikely(!t)) return; + + time_t latest_time_t = t->query_ops.latest_time(t->db_metric_handle); + time_t granularity = (time_t)t->tier_grouping * (time_t)rd->update_every; + time_t time_diff = now - latest_time_t; + + // if the user wants only NEW backfilling, and we don't have any data + if(storage_tiers_backfill[tier] == RRD_BACKFILL_NEW && latest_time_t <= 0) return; + + // there is really nothing we can do + if(now <= latest_time_t || time_diff < granularity) return; + + struct rrddim_query_handle handle; + + size_t all_points_read = 0; + + // for each lower tier + for(int tr = tier - 1; tr >= 0 ;tr--){ + time_t smaller_tier_first_time = rd->tiers[tr]->query_ops.oldest_time(rd->tiers[tr]->db_metric_handle); + time_t smaller_tier_last_time = rd->tiers[tr]->query_ops.latest_time(rd->tiers[tr]->db_metric_handle); + if(smaller_tier_last_time <= latest_time_t) continue; // it is as bad as we are + + long after_wanted = (latest_time_t < smaller_tier_first_time) ? smaller_tier_first_time : latest_time_t; + long before_wanted = smaller_tier_last_time; + + struct rrddim_tier *tmp = rd->tiers[tr]; + tmp->query_ops.init(tmp->db_metric_handle, &handle, after_wanted, before_wanted, TIER_QUERY_FETCH_AVERAGE); + + size_t points = 0; + + while(!tmp->query_ops.is_finished(&handle)) { + + STORAGE_POINT sp = tmp->query_ops.next_metric(&handle); + + if(sp.end_time > latest_time_t) { + latest_time_t = sp.end_time; + store_metric_at_tier(rd, t, sp, sp.end_time * USEC_PER_SEC); + points++; + } + } + + all_points_read += points; + tmp->query_ops.finalize(&handle); + + //internal_error(true, "DBENGINE: backfilled chart '%s', dimension '%s', tier %d, from %ld to %ld, with %zu points from tier %d", + // rd->rrdset->name, rd->name, tier, after_wanted, before_wanted, points, tr); + } + + rrdr_query_completed(all_points_read, all_points_read); } // ---------------------------------------------------------------------------- @@ -719,8 +1494,9 @@ static inline void do_dimension_fixedstep( #ifdef NETDATA_INTERNAL_CHECKS static void rrd2rrdr_log_request_response_metadata(RRDR *r + , RRDR_OPTIONS options __maybe_unused , RRDR_GROUPING group_method - , int aligned + , bool aligned , long group , long resampling_time , long resampling_group @@ -736,9 +1512,9 @@ static void rrd2rrdr_log_request_response_metadata(RRDR *r ) { netdata_rwlock_rdlock(&r->st->rrdset_rwlock); info("INTERNAL ERROR: rrd2rrdr() on %s update every %d with %s grouping %s (group: %ld, resampling_time: %ld, resampling_group: %ld), " - "after (got: %zu, want: %zu, req: %zu, db: %zu), " - "before (got: %zu, want: %zu, req: %zu, db: %zu), " - "duration (got: %zu, want: %zu, req: %zu, db: %zu), " + "after (got: %zu, want: %zu, req: %ld, db: %zu), " + "before (got: %zu, want: %zu, req: %ld, db: %zu), " + "duration (got: %zu, want: %zu, req: %ld, db: %zu), " //"slot (after: %zu, before: %zu, delta: %zu), " "points (got: %ld, want: %ld, req: %ld, db: %ld), " "%s" @@ -755,19 +1531,19 @@ static void rrd2rrdr_log_request_response_metadata(RRDR *r // after , (size_t)r->after , (size_t)after_wanted - , (size_t)after_requested + , after_requested , (size_t)rrdset_first_entry_t_nolock(r->st) // before , (size_t)r->before , (size_t)before_wanted - , (size_t)before_requested + , before_requested , (size_t)rrdset_last_entry_t_nolock(r->st) // duration , (size_t)(r->before - r->after + r->st->update_every) , (size_t)(before_wanted - after_wanted + r->st->update_every) - , (size_t)(before_requested - after_requested) + , before_requested - after_requested , (size_t)((rrdset_last_entry_t_nolock(r->st) - rrdset_first_entry_t_nolock(r->st)) + r->st->update_every) // slot @@ -791,79 +1567,88 @@ static void rrd2rrdr_log_request_response_metadata(RRDR *r #endif // NETDATA_INTERNAL_CHECKS // Returns 1 if an absolute period was requested or 0 if it was a relative period -static int rrdr_convert_before_after_to_absolute( - long long *after_requestedp - , long long *before_requestedp - , int update_every - , time_t first_entry_t - , time_t last_entry_t - , RRDR_OPTIONS options -) { +int rrdr_relative_window_to_absolute(long long *after, long long *before) { + time_t now = now_realtime_sec() - 1; + int absolute_period_requested = -1; long long after_requested, before_requested; - before_requested = *before_requestedp; - after_requested = *after_requestedp; - - if(before_requested == 0 && after_requested == 0) { - // dump the all the data - before_requested = last_entry_t; - after_requested = first_entry_t; - absolute_period_requested = 0; - } + before_requested = *before; + after_requested = *after; // allow relative for before (smaller than API_RELATIVE_TIME_MAX) if(ABS(before_requested) <= API_RELATIVE_TIME_MAX) { - if(ABS(before_requested) % update_every) { - // make sure it is multiple of st->update_every - if(before_requested < 0) before_requested = before_requested - update_every - - before_requested % update_every; - else before_requested = before_requested + update_every - before_requested % update_every; - } - if(before_requested > 0) before_requested = first_entry_t + before_requested; - else before_requested = last_entry_t + before_requested; //last_entry_t is not really now_t - //TODO: fix before_requested to be relative to now_t + // if the user asked for a positive relative time, + // flip it to a negative + if(before_requested > 0) + before_requested = -before_requested; + + before_requested = now + before_requested; absolute_period_requested = 0; } // allow relative for after (smaller than API_RELATIVE_TIME_MAX) if(ABS(after_requested) <= API_RELATIVE_TIME_MAX) { - if(after_requested == 0) after_requested = -update_every; - if(ABS(after_requested) % update_every) { - // make sure it is multiple of st->update_every - if(after_requested < 0) after_requested = after_requested - update_every - after_requested % update_every; - else after_requested = after_requested + update_every - after_requested % update_every; - } - after_requested = before_requested + after_requested; + if(after_requested > 0) + after_requested = -after_requested; + + // if the user didn't give an after, use the number of points + // to give a sane default + if(after_requested == 0) + after_requested = -600; + + // since the query engine now returns inclusive timestamps + // it is awkward to return 6 points when after=-5 is given + // so for relative queries we add 1 second, to give + // more predictable results to users. + after_requested = before_requested + after_requested + 1; absolute_period_requested = 0; } if(absolute_period_requested == -1) absolute_period_requested = 1; - // make sure they are within our timeframe - if(before_requested > last_entry_t) before_requested = last_entry_t; - if(before_requested < first_entry_t && !(options & RRDR_OPTION_ALLOW_PAST)) - before_requested = first_entry_t; - - if(after_requested > last_entry_t) after_requested = last_entry_t; - if(after_requested < first_entry_t && !(options & RRDR_OPTION_ALLOW_PAST)) - after_requested = first_entry_t; - - // check if they are reversed + // check if the parameters are flipped if(after_requested > before_requested) { - time_t tmp = before_requested; + long long t = before_requested; before_requested = after_requested; - after_requested = tmp; + after_requested = t; } - *before_requestedp = before_requested; - *after_requestedp = after_requested; + // if the query requests future data + // shift the query back to be in the present time + // (this may also happen because of the rules above) + if(before_requested > now) { + long long delta = before_requested - now; + before_requested -= delta; + after_requested -= delta; + } + + *before = before_requested; + *after = after_requested; return absolute_period_requested; } -static RRDR *rrd2rrdr_fixedstep( +// #define DEBUG_QUERY_LOGIC 1 + +#ifdef DEBUG_QUERY_LOGIC +#define query_debug_log_init() BUFFER *debug_log = buffer_create(1000) +#define query_debug_log(args...) buffer_sprintf(debug_log, ##args) +#define query_debug_log_fin() { \ + info("QUERY: chart '%s', after:%lld, before:%lld, duration:%lld, points:%ld, res:%ld - wanted => after:%lld, before:%lld, points:%ld, group:%ld, granularity:%ld, resgroup:%ld, resdiv:" NETDATA_DOUBLE_FORMAT_AUTO " %s", st->name, after_requested, before_requested, before_requested - after_requested, points_requested, resampling_time_requested, after_wanted, before_wanted, points_wanted, group, query_granularity, resampling_group, resampling_divisor, buffer_tostring(debug_log)); \ + buffer_free(debug_log); \ + debug_log = NULL; \ + } +#define query_debug_log_free() do { buffer_free(debug_log); } while(0) +#else +#define query_debug_log_init() debug_dummy() +#define query_debug_log(args...) debug_dummy() +#define query_debug_log_fin() debug_dummy() +#define query_debug_log_free() debug_dummy() +#endif + +RRDR *rrd2rrdr( ONEWAYALLOC *owa , RRDSET *st , long points_requested @@ -873,564 +1658,272 @@ static RRDR *rrd2rrdr_fixedstep( , long resampling_time_requested , RRDR_OPTIONS options , const char *dimensions - , int update_every - , time_t first_entry_t - , time_t last_entry_t - , int absolute_period_requested , struct context_param *context_param_list + , const char *group_options , int timeout + , int tier ) { - int aligned = !(options & RRDR_OPTION_NOT_ALIGNED); - - // the duration of the chart - time_t duration = before_requested - after_requested; - long available_points = duration / update_every; - - RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL; - - if(duration <= 0 || available_points <= 0) - return rrdr_create(owa, st, 1, context_param_list); - - // check the number of wanted points in the result - if(unlikely(points_requested < 0)) points_requested = -points_requested; - if(unlikely(points_requested > available_points)) points_requested = available_points; - if(unlikely(points_requested == 0)) points_requested = available_points; - - // calculate the desired grouping of source data points - long group = available_points / points_requested; - if(unlikely(group <= 0)) group = 1; - if(unlikely(available_points % points_requested > points_requested / 2)) group++; // rounding to the closest integer - - // resampling_time_requested enforces a certain grouping multiple - calculated_number resampling_divisor = 1.0; - long resampling_group = 1; - if(unlikely(resampling_time_requested > update_every)) { - if (unlikely(resampling_time_requested > duration)) { - // group_time is above the available duration - - #ifdef NETDATA_INTERNAL_CHECKS - info("INTERNAL CHECK: %s: requested gtime %ld secs, is greater than the desired duration %ld secs", st->id, resampling_time_requested, duration); - #endif - - after_requested = before_requested - resampling_time_requested; - duration = before_requested - after_requested; - available_points = duration / update_every; - group = available_points / points_requested; - } - - // if the duration is not aligned to resampling time - // extend the duration to the past, to avoid a gap at the chart - // only when the missing duration is above 1/10th of a point - if(duration % resampling_time_requested) { - time_t delta = duration % resampling_time_requested; - if(delta > resampling_time_requested / 10) { - after_requested -= resampling_time_requested - delta; - duration = before_requested - after_requested; - available_points = duration / update_every; - group = available_points / points_requested; - } - } - - // the points we should group to satisfy gtime - resampling_group = resampling_time_requested / update_every; - if(unlikely(resampling_time_requested % update_every)) { - #ifdef NETDATA_INTERNAL_CHECKS - info("INTERNAL CHECK: %s: requested gtime %ld secs, is not a multiple of the chart's data collection frequency %d secs", st->id, resampling_time_requested, update_every); - #endif - - resampling_group++; - } - - // adapt group according to resampling_group - if(unlikely(group < resampling_group)) group = resampling_group; // do not allow grouping below the desired one - if(unlikely(group % resampling_group)) group += resampling_group - (group % resampling_group); // make sure group is multiple of resampling_group - - //resampling_divisor = group / resampling_group; - resampling_divisor = (calculated_number)(group * update_every) / (calculated_number)resampling_time_requested; - } - - // now that we have group, - // align the requested timeframe to fit it. - - if(aligned) { - // alignment has been requested, so align the values - before_requested -= before_requested % (group * update_every); - after_requested -= after_requested % (group * update_every); + // RULES + // points_requested = 0 + // the user wants all the natural points the database has + // + // after_requested = 0 + // the user wants to start the query from the oldest point in our database + // + // before_requested = 0 + // the user wants the query to end to the latest point in our database + // + // when natural points are wanted, the query has to be aligned to the update_every + // of the database + + long points_wanted = points_requested; + long long after_wanted = after_requested; + long long before_wanted = before_requested; + int update_every = st->update_every; + + bool aligned = !(options & RRDR_OPTION_NOT_ALIGNED); + bool automatic_natural_points = (points_wanted == 0); + bool relative_period_requested = false; + bool natural_points = (options & RRDR_OPTION_NATURAL_POINTS) || automatic_natural_points; + bool before_is_aligned_to_db_end = false; + + query_debug_log_init(); + + // make sure points_wanted is positive + if(points_wanted < 0) { + points_wanted = -points_wanted; + query_debug_log(":-points_wanted %ld", points_wanted); } - // we align the request on requested_before - time_t before_wanted = before_requested; - if(likely(before_wanted > last_entry_t)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, before_wanted is after db max", st->name); - #endif - - before_wanted = last_entry_t - (last_entry_t % ( ((aligned)?group:1) * update_every )); + if(ABS(before_requested) <= API_RELATIVE_TIME_MAX || ABS(after_requested) <= API_RELATIVE_TIME_MAX) { + relative_period_requested = true; + natural_points = true; + options |= RRDR_OPTION_NATURAL_POINTS; + query_debug_log(":relative+natural"); } - //size_t before_slot = rrdset_time2slot(st, before_wanted); - // we need to estimate the number of points, for having - // an integer number of values per point - long points_wanted = (before_wanted - after_requested) / (update_every * group); + // if the user wants virtual points, make sure we do it + if(options & RRDR_OPTION_VIRTUAL_POINTS) + natural_points = false; - time_t after_wanted = before_wanted - (points_wanted * group * update_every) + update_every; - if(unlikely(after_wanted < first_entry_t)) { - // hm... we go to the past, calculate again points_wanted using all the db from before_wanted to the beginning - points_wanted = (before_wanted - first_entry_t) / group; + // set the right flag about natural and virtual points + if(natural_points) { + options |= RRDR_OPTION_NATURAL_POINTS; - // recalculate after wanted with the new number of points - after_wanted = before_wanted - (points_wanted * group * update_every) + update_every; - - if(unlikely(after_wanted < first_entry_t)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, after_wanted is before db min", st->name); - #endif - - after_wanted = first_entry_t - (first_entry_t % ( ((aligned)?group:1) * update_every )) + ( ((aligned)?group:1) * update_every ); - } - } - //size_t after_slot = rrdset_time2slot(st, after_wanted); - - // check if they are reversed - if(unlikely(after_wanted > before_wanted)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, reversed wanted after/before", st->name); - #endif - time_t tmp = before_wanted; - before_wanted = after_wanted; - after_wanted = tmp; + if(options & RRDR_OPTION_VIRTUAL_POINTS) + options &= ~RRDR_OPTION_VIRTUAL_POINTS; } + else { + options |= RRDR_OPTION_VIRTUAL_POINTS; - // recalculate points_wanted using the final time-frame - points_wanted = (before_wanted - after_wanted) / update_every / group + 1; - if(unlikely(points_wanted < 0)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, points_wanted is %ld", st->name, points_wanted); - #endif - points_wanted = 0; + if(options & RRDR_OPTION_NATURAL_POINTS) + options &= ~RRDR_OPTION_NATURAL_POINTS; } -#ifdef NETDATA_INTERNAL_CHECKS - duration = before_wanted - after_wanted; - - if(after_wanted < first_entry_t) - error("INTERNAL CHECK: after_wanted %u is too small, minimum %u", (uint32_t)after_wanted, (uint32_t)first_entry_t); - - if(after_wanted > last_entry_t) - error("INTERNAL CHECK: after_wanted %u is too big, maximum %u", (uint32_t)after_wanted, (uint32_t)last_entry_t); - - if(before_wanted < first_entry_t) - error("INTERNAL CHECK: before_wanted %u is too small, minimum %u", (uint32_t)before_wanted, (uint32_t)first_entry_t); - - if(before_wanted > last_entry_t) - error("INTERNAL CHECK: before_wanted %u is too big, maximum %u", (uint32_t)before_wanted, (uint32_t)last_entry_t); - -/* - if(before_slot >= (size_t)st->entries) - error("INTERNAL CHECK: before_slot is invalid %zu, expected 0 to %ld", before_slot, st->entries - 1); + if(after_wanted == 0 || before_wanted == 0) { + // for non-context queries we have to find the duration of the database + // for context queries we will assume 600 seconds duration - if(after_slot >= (size_t)st->entries) - error("INTERNAL CHECK: after_slot is invalid %zu, expected 0 to %ld", after_slot, st->entries - 1); -*/ + if(!context_param_list) { + relative_period_requested = true; - if(points_wanted > (before_wanted - after_wanted) / group / update_every + 1) - error("INTERNAL CHECK: points_wanted %ld is more than points %ld", points_wanted, (before_wanted - after_wanted) / group / update_every + 1); + rrdset_rdlock(st); + time_t first_entry_t = rrdset_first_entry_t_nolock(st); + time_t last_entry_t = rrdset_last_entry_t_nolock(st); + rrdset_unlock(st); - if(group < resampling_group) - error("INTERNAL CHECK: group %ld is less than the desired group points %ld", group, resampling_group); - - if(group > resampling_group && group % resampling_group) - error("INTERNAL CHECK: group %ld is not a multiple of the desired group points %ld", group, resampling_group); -#endif - - // ------------------------------------------------------------------------- - // initialize our result set - // this also locks the chart for us - - RRDR *r = rrdr_create(owa, st, points_wanted, context_param_list); - if(unlikely(!r)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL CHECK: Cannot create RRDR for %s, after=%u, before=%u, duration=%u, points=%ld", st->id, (uint32_t)after_wanted, (uint32_t)before_wanted, (uint32_t)duration, points_wanted); - #endif - return NULL; - } - - if(unlikely(!r->d || !points_wanted)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL CHECK: Returning empty RRDR (no dimensions in RRDSET) for %s, after=%u, before=%u, duration=%zu, points=%ld", st->id, (uint32_t)after_wanted, (uint32_t)before_wanted, (size_t)duration, points_wanted); - #endif - return r; - } - - if(unlikely(absolute_period_requested == 1)) - r->result_options |= RRDR_RESULT_OPTION_ABSOLUTE; - else - r->result_options |= RRDR_RESULT_OPTION_RELATIVE; - - // find how many dimensions we have - long dimensions_count = r->d; - - // ------------------------------------------------------------------------- - // initialize RRDR - - r->group = group; - r->update_every = (int)group * update_every; - r->before = before_wanted; - r->after = after_wanted; - r->internal.points_wanted = points_wanted; - r->internal.resampling_group = resampling_group; - r->internal.resampling_divisor = resampling_divisor; - - - // ------------------------------------------------------------------------- - // assign the processor functions - - { - int i, found = 0; - for(i = 0; !found && api_v1_data_groups[i].name ;i++) { - if(api_v1_data_groups[i].value == group_method) { - r->internal.grouping_create= api_v1_data_groups[i].create; - r->internal.grouping_reset = api_v1_data_groups[i].reset; - r->internal.grouping_free = api_v1_data_groups[i].free; - r->internal.grouping_add = api_v1_data_groups[i].add; - r->internal.grouping_flush = api_v1_data_groups[i].flush; - found = 1; + if(first_entry_t == 0 || last_entry_t == 0) { + internal_error(true, "QUERY: chart without data detected on '%s'", st->name); + query_debug_log_free(); + return NULL; } - } - if(!found) { - errno = 0; - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: grouping method %u not found for chart '%s'. Using 'average'", (unsigned int)group_method, r->st->name); - #endif - r->internal.grouping_create= grouping_create_average; - r->internal.grouping_reset = grouping_reset_average; - r->internal.grouping_free = grouping_free_average; - r->internal.grouping_add = grouping_add_average; - r->internal.grouping_flush = grouping_flush_average; - } - } - - // allocate any memory required by the grouping method - r->internal.grouping_create(r); - - - // ------------------------------------------------------------------------- - // disable the not-wanted dimensions - - if (context_param_list && !(context_param_list->flags & CONTEXT_FLAGS_ARCHIVE)) - rrdset_check_rdlock(st); - - if(dimensions) - rrdr_disable_not_selected_dimensions(r, options, dimensions, context_param_list); - - - // ------------------------------------------------------------------------- - // do the work for each dimension - - time_t max_after = 0, min_before = 0; - long max_rows = 0; - - RRDDIM *rd; - long c, dimensions_used = 0, dimensions_nonzero = 0; - struct timeval query_start_time; - struct timeval query_current_time; - if (timeout) - now_realtime_timeval(&query_start_time); - for(rd = temp_rd?temp_rd:st->dimensions, c = 0 ; rd && c < dimensions_count ; rd = rd->next, c++) { - - // if we need a percentage, we need to calculate all dimensions - if(unlikely(!(options & RRDR_OPTION_PERCENTAGE) && (r->od[c] & RRDR_DIMENSION_HIDDEN))) { - if(unlikely(r->od[c] & RRDR_DIMENSION_SELECTED)) r->od[c] &= ~RRDR_DIMENSION_SELECTED; - continue; - } - r->od[c] |= RRDR_DIMENSION_SELECTED; - - // reset the grouping for the new dimension - r->internal.grouping_reset(r); - do_dimension_fixedstep( - r - , points_wanted - , rd - , c - , after_wanted - , before_wanted - , options - ); - if (timeout) - now_realtime_timeval(&query_current_time); + query_debug_log(":first_entry_t %ld, last_entry_t %ld", first_entry_t, last_entry_t); - if(r->od[c] & RRDR_DIMENSION_NONZERO) - dimensions_nonzero++; - - // verify all dimensions are aligned - if(unlikely(!dimensions_used)) { - min_before = r->before; - max_after = r->after; - max_rows = r->rows; - } - else { - if(r->after != max_after) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: 'after' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", - st->name, (size_t)max_after, rd->name, (size_t)r->after); - #endif - r->after = (r->after > max_after) ? r->after : max_after; + if (after_wanted == 0) { + after_wanted = first_entry_t; + query_debug_log(":zero after_wanted %lld", after_wanted); } - if(r->before != min_before) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: 'before' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", - st->name, (size_t)min_before, rd->name, (size_t)r->before); - #endif - r->before = (r->before < min_before) ? r->before : min_before; + if (before_wanted == 0) { + before_wanted = last_entry_t; + before_is_aligned_to_db_end = true; + query_debug_log(":zero before_wanted %lld", before_wanted); } - if(r->rows != max_rows) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: 'rows' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", - st->name, (size_t)max_rows, rd->name, (size_t)r->rows); - #endif - r->rows = (r->rows > max_rows) ? r->rows : max_rows; + if(points_wanted == 0) { + points_wanted = (last_entry_t - first_entry_t) / update_every; + query_debug_log(":zero points_wanted %ld", points_wanted); } } - dimensions_used++; - if (timeout && (dt_usec(&query_start_time, &query_current_time) / 1000.0) > timeout) { - log_access("QUERY CANCELED RUNTIME EXCEEDED %0.2f ms (LIMIT %d ms)", - dt_usec(&query_start_time, &query_current_time) / 1000.0, timeout); - r->result_options |= RRDR_RESULT_OPTION_CANCEL; - break; + // if they are still zero, assume 600 + + if(after_wanted == 0) { + after_wanted = -600; + query_debug_log(":zero600 after_wanted %lld", after_wanted); } } - #ifdef NETDATA_INTERNAL_CHECKS - if (dimensions_used) { - if(r->internal.log) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ r->internal.log); + if(points_wanted == 0) { + points_wanted = 600; + query_debug_log(":zero600 points_wanted %ld", points_wanted); + } - if(r->rows != points_wanted) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "got 'points' is not wanted 'points'"); + // convert our before_wanted and after_wanted to absolute + rrdr_relative_window_to_absolute(&after_wanted, &before_wanted); + query_debug_log(":relative2absolute after %lld, before %lld", after_wanted, before_wanted); - if(aligned && (r->before % group) != 0) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "'before' is not aligned but alignment is required"); + if(natural_points && (options & RRDR_OPTION_SELECTED_TIER) && tier > 0 && storage_tiers > 1) { + update_every = rrdset_find_natural_update_every_for_timeframe(st, after_wanted, before_wanted, points_wanted, options, tier); + if(update_every <= 0) update_every = st->update_every; + query_debug_log(":natural update every %d", update_every); + } - // 'after' should not be aligned, since we start inside the first group - //if(aligned && (r->after % group) != 0) - // rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, after_slot, before_slot, "'after' is not aligned but alignment is required"); + // this is the update_every of the query + // it may be different to the update_every of the database + time_t query_granularity = (natural_points)?update_every:1; + if(query_granularity <= 0) query_granularity = 1; + query_debug_log(":query_granularity %ld", query_granularity); - if(r->before != before_requested) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "chart is not aligned to requested 'before'"); + // align before_wanted and after_wanted to query_granularity + if (before_wanted % query_granularity) { + before_wanted -= before_wanted % query_granularity; + query_debug_log(":granularity align before_wanted %lld", before_wanted); + } - if(r->before != before_wanted) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "got 'before' is not wanted 'before'"); + if (after_wanted % query_granularity) { + after_wanted -= after_wanted % query_granularity; + query_debug_log(":granularity align after_wanted %lld", after_wanted); + } - // reported 'after' varies, depending on group - if(r->after != after_wanted) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "got 'after' is not wanted 'after'"); + // automatic_natural_points is set when the user wants all the points available in the database + if(automatic_natural_points) { + points_wanted = (before_wanted - after_wanted + 1) / query_granularity; + if(unlikely(points_wanted <= 0)) points_wanted = 1; + query_debug_log(":auto natural points_wanted %ld", points_wanted); } - #endif - // free all resources used by the grouping method - r->internal.grouping_free(r); + time_t duration = before_wanted - after_wanted; - // when all the dimensions are zero, we should return all of them - if(unlikely(options & RRDR_OPTION_NONZERO && !dimensions_nonzero && !(r->result_options & RRDR_RESULT_OPTION_CANCEL))) { - // all the dimensions are zero - // mark them as NONZERO to send them all - for(rd = temp_rd?temp_rd:st->dimensions, c = 0 ; rd && c < dimensions_count ; rd = rd->next, c++) { - if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; - r->od[c] |= RRDR_DIMENSION_NONZERO; - } + // if the resampling time is too big, extend the duration to the past + if (unlikely(resampling_time_requested > duration)) { + after_wanted = before_wanted - resampling_time_requested; + duration = before_wanted - after_wanted; + query_debug_log(":resampling after_wanted %lld", after_wanted); } - rrdr_query_completed(r->internal.db_points_read, r->internal.result_points_generated); - return r; -} - -#ifdef ENABLE_DBENGINE -static RRDR *rrd2rrdr_variablestep( - ONEWAYALLOC *owa - , RRDSET *st - , long points_requested - , long long after_requested - , long long before_requested - , RRDR_GROUPING group_method - , long resampling_time_requested - , RRDR_OPTIONS options - , const char *dimensions - , int update_every - , time_t first_entry_t - , time_t last_entry_t - , int absolute_period_requested - , struct rrdeng_region_info *region_info_array - , struct context_param *context_param_list - , int timeout -) { - int aligned = !(options & RRDR_OPTION_NOT_ALIGNED); + // if the duration is not aligned to resampling time + // extend the duration to the past, to avoid a gap at the chart + // only when the missing duration is above 1/10th of a point + if(resampling_time_requested > query_granularity && duration % resampling_time_requested) { + time_t delta = duration % resampling_time_requested; + if(delta > resampling_time_requested / 10) { + after_wanted -= resampling_time_requested - delta; + duration = before_wanted - after_wanted; + query_debug_log(":resampling2 after_wanted %lld", after_wanted); + } + } - // the duration of the chart - time_t duration = before_requested - after_requested; - long available_points = duration / update_every; + // the available points of the query + long points_available = (duration + 1) / query_granularity; + if(unlikely(points_available <= 0)) points_available = 1; + query_debug_log(":points_available %ld", points_available); - RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL; - - if(duration <= 0 || available_points <= 0) { - freez(region_info_array); - return rrdr_create(owa, st, 1, context_param_list); + if(points_wanted > points_available) { + points_wanted = points_available; + query_debug_log(":max points_wanted %ld", points_wanted); } - // check the number of wanted points in the result - if(unlikely(points_requested < 0)) points_requested = -points_requested; - if(unlikely(points_requested > available_points)) points_requested = available_points; - if(unlikely(points_requested == 0)) points_requested = available_points; - // calculate the desired grouping of source data points - long group = available_points / points_requested; - if(unlikely(group <= 0)) group = 1; - if(unlikely(available_points % points_requested > points_requested / 2)) group++; // rounding to the closest integer - - // resampling_time_requested enforces a certain grouping multiple - calculated_number resampling_divisor = 1.0; - long resampling_group = 1; - if(unlikely(resampling_time_requested > update_every)) { - if (unlikely(resampling_time_requested > duration)) { - // group_time is above the available duration - - #ifdef NETDATA_INTERNAL_CHECKS - info("INTERNAL CHECK: %s: requested gtime %ld secs, is greater than the desired duration %ld secs", st->id, resampling_time_requested, duration); - #endif - - after_requested = before_requested - resampling_time_requested; - duration = before_requested - after_requested; - available_points = duration / update_every; - group = available_points / points_requested; - } - - // if the duration is not aligned to resampling time - // extend the duration to the past, to avoid a gap at the chart - // only when the missing duration is above 1/10th of a point - if(duration % resampling_time_requested) { - time_t delta = duration % resampling_time_requested; - if(delta > resampling_time_requested / 10) { - after_requested -= resampling_time_requested - delta; - duration = before_requested - after_requested; - available_points = duration / update_every; - group = available_points / points_requested; - } - } - - // the points we should group to satisfy gtime - resampling_group = resampling_time_requested / update_every; - if(unlikely(resampling_time_requested % update_every)) { - #ifdef NETDATA_INTERNAL_CHECKS - info("INTERNAL CHECK: %s: requested gtime %ld secs, is not a multiple of the chart's data collection frequency %d secs", st->id, resampling_time_requested, update_every); - #endif + long group = points_available / points_wanted; + if(group <= 0) group = 1; - resampling_group++; - } + // round "group" to the closest integer + if(points_available % points_wanted > points_wanted / 2) + group++; - // adapt group according to resampling_group - if(unlikely(group < resampling_group)) group = resampling_group; // do not allow grouping below the desired one - if(unlikely(group % resampling_group)) group += resampling_group - (group % resampling_group); // make sure group is multiple of resampling_group + query_debug_log(":group %ld", group); - //resampling_divisor = group / resampling_group; - resampling_divisor = (calculated_number)(group * update_every) / (calculated_number)resampling_time_requested; - } + if(points_wanted * group * query_granularity < duration) { + // the grouping we are going to do, is not enough + // to cover the entire duration requested, so + // we have to change the number of points, to make sure we will + // respect the timeframe as closely as possibly - // now that we have group, - // align the requested timeframe to fit it. + // let's see how many points are the optimal + points_wanted = points_available / group; - if(aligned) { - // alignment has been requested, so align the values - before_requested -= before_requested % (group * update_every); - after_requested -= after_requested % (group * update_every); - } + if(points_wanted * group < points_available) + points_wanted++; - // we align the request on requested_before - time_t before_wanted = before_requested; - if(likely(before_wanted > last_entry_t)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, before_wanted is after db max", st->name); - #endif + if(unlikely(points_wanted <= 0)) + points_wanted = 1; - before_wanted = last_entry_t - (last_entry_t % ( ((aligned)?group:1) * update_every )); + query_debug_log(":optimal points %ld", points_wanted); } - //size_t before_slot = rrdset_time2slot(st, before_wanted); - - // we need to estimate the number of points, for having - // an integer number of values per point - long points_wanted = (before_wanted - after_requested) / (update_every * group); - time_t after_wanted = before_wanted - (points_wanted * group * update_every) + update_every; - if(unlikely(after_wanted < first_entry_t)) { - // hm... we go to the past, calculate again points_wanted using all the db from before_wanted to the beginning - points_wanted = (before_wanted - first_entry_t) / group; - - // recalculate after wanted with the new number of points - after_wanted = before_wanted - (points_wanted * group * update_every) + update_every; + // resampling_time_requested enforces a certain grouping multiple + NETDATA_DOUBLE resampling_divisor = 1.0; + long resampling_group = 1; + if(unlikely(resampling_time_requested > query_granularity)) { + // the points we should group to satisfy gtime + resampling_group = resampling_time_requested / query_granularity; + if(unlikely(resampling_time_requested % query_granularity)) + resampling_group++; - if(unlikely(after_wanted < first_entry_t)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, after_wanted is before db min", st->name); - #endif + query_debug_log(":resampling group %ld", resampling_group); - after_wanted = first_entry_t - (first_entry_t % ( ((aligned)?group:1) * update_every )) + ( ((aligned)?group:1) * update_every ); + // adapt group according to resampling_group + if(unlikely(group < resampling_group)) { + group = resampling_group; // do not allow grouping below the desired one + query_debug_log(":group less res %ld", group); + } + if(unlikely(group % resampling_group)) { + group += resampling_group - (group % resampling_group); // make sure group is multiple of resampling_group + query_debug_log(":group mod res %ld", group); } - } - //size_t after_slot = rrdset_time2slot(st, after_wanted); - - // check if they are reversed - if(unlikely(after_wanted > before_wanted)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, reversed wanted after/before", st->name); - #endif - time_t tmp = before_wanted; - before_wanted = after_wanted; - after_wanted = tmp; - } - // recalculate points_wanted using the final time-frame - points_wanted = (before_wanted - after_wanted) / update_every / group + 1; - if(unlikely(points_wanted < 0)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: rrd2rrdr() on %s, points_wanted is %ld", st->name, points_wanted); - #endif - points_wanted = 0; + // resampling_divisor = group / resampling_group; + resampling_divisor = (NETDATA_DOUBLE)(group * query_granularity) / (NETDATA_DOUBLE)resampling_time_requested; + query_debug_log(":resampling divisor " NETDATA_DOUBLE_FORMAT, resampling_divisor); } -#ifdef NETDATA_INTERNAL_CHECKS - duration = before_wanted - after_wanted; - - if(after_wanted < first_entry_t) - error("INTERNAL CHECK: after_wanted %u is too small, minimum %u", (uint32_t)after_wanted, (uint32_t)first_entry_t); - - if(after_wanted > last_entry_t) - error("INTERNAL CHECK: after_wanted %u is too big, maximum %u", (uint32_t)after_wanted, (uint32_t)last_entry_t); + // now that we have group, align the requested timeframe to fit it. + if(aligned && before_wanted % (group * query_granularity)) { + if(before_is_aligned_to_db_end) + before_wanted -= before_wanted % (group * query_granularity); + else + before_wanted += (group * query_granularity) - before_wanted % (group * query_granularity); + query_debug_log(":align before_wanted %lld", before_wanted); + } - if(before_wanted < first_entry_t) - error("INTERNAL CHECK: before_wanted %u is too small, minimum %u", (uint32_t)before_wanted, (uint32_t)first_entry_t); + after_wanted = before_wanted - (points_wanted * group * query_granularity) + query_granularity; + query_debug_log(":final after_wanted %lld", after_wanted); - if(before_wanted > last_entry_t) - error("INTERNAL CHECK: before_wanted %u is too big, maximum %u", (uint32_t)before_wanted, (uint32_t)last_entry_t); + duration = before_wanted - after_wanted; + query_debug_log(":final duration %ld", duration + 1); -/* - if(before_slot >= (size_t)st->entries) - error("INTERNAL CHECK: before_slot is invalid %zu, expected 0 to %ld", before_slot, st->entries - 1); + // check the context query based on the starting time of the query + if (context_param_list && !(context_param_list->flags & CONTEXT_FLAGS_ARCHIVE)) { + rebuild_context_param_list(owa, context_param_list, after_wanted); + st = context_param_list->rd ? context_param_list->rd->rrdset : NULL; - if(after_slot >= (size_t)st->entries) - error("INTERNAL CHECK: after_slot is invalid %zu, expected 0 to %ld", after_slot, st->entries - 1); -*/ + if(unlikely(!st)) + return NULL; + } - if(points_wanted > (before_wanted - after_wanted) / group / update_every + 1) - error("INTERNAL CHECK: points_wanted %ld is more than points %ld", points_wanted, (before_wanted - after_wanted) / group / update_every + 1); + internal_error(points_wanted != duration / (query_granularity * group) + 1, + "QUERY: points_wanted %ld is not points %ld", + points_wanted, duration / (query_granularity * group) + 1); - if(group < resampling_group) - error("INTERNAL CHECK: group %ld is less than the desired group points %ld", group, resampling_group); + internal_error(group < resampling_group, + "QUERY: group %ld is less than the desired group points %ld", + group, resampling_group); - if(group > resampling_group && group % resampling_group) - error("INTERNAL CHECK: group %ld is not a multiple of the desired group points %ld", group, resampling_group); -#endif + internal_error(group > resampling_group && group % resampling_group, + "QUERY: group %ld is not a multiple of the desired group points %ld", + group, resampling_group); // ------------------------------------------------------------------------- // initialize our result set @@ -1438,26 +1931,21 @@ static RRDR *rrd2rrdr_variablestep( RRDR *r = rrdr_create(owa, st, points_wanted, context_param_list); if(unlikely(!r)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL CHECK: Cannot create RRDR for %s, after=%u, before=%u, duration=%u, points=%ld", st->id, (uint32_t)after_wanted, (uint32_t)before_wanted, (uint32_t)duration, points_wanted); - #endif - freez(region_info_array); + internal_error(true, "QUERY: cannot create RRDR for %s, after=%u, before=%u, duration=%u, points=%ld", + st->id, (uint32_t)after_wanted, (uint32_t)before_wanted, (uint32_t)duration, points_wanted); return NULL; } if(unlikely(!r->d || !points_wanted)) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL CHECK: Returning empty RRDR (no dimensions in RRDSET) for %s, after=%u, before=%u, duration=%zu, points=%ld", st->id, (uint32_t)after_wanted, (uint32_t)before_wanted, (size_t)duration, points_wanted); - #endif - freez(region_info_array); + internal_error(true, "QUERY: returning empty RRDR (no dimensions in RRDSET) for %s, after=%u, before=%u, duration=%zu, points=%ld", + st->id, (uint32_t)after_wanted, (uint32_t)before_wanted, (size_t)duration, points_wanted); return r; } - r->result_options |= RRDR_RESULT_OPTION_VARIABLE_STEP; - if(unlikely(absolute_period_requested == 1)) - r->result_options |= RRDR_RESULT_OPTION_ABSOLUTE; - else + if(relative_period_requested) r->result_options |= RRDR_RESULT_OPTION_RELATIVE; + else + r->result_options |= RRDR_RESULT_OPTION_ABSOLUTE; // find how many dimensions we have long dimensions_count = r->d; @@ -1466,48 +1954,26 @@ static RRDR *rrd2rrdr_variablestep( // initialize RRDR r->group = group; - r->update_every = (int)group * update_every; + r->update_every = (int)(group * query_granularity); r->before = before_wanted; r->after = after_wanted; r->internal.points_wanted = points_wanted; r->internal.resampling_group = resampling_group; r->internal.resampling_divisor = resampling_divisor; - + r->internal.query_options = options; + r->internal.query_tier = tier; // ------------------------------------------------------------------------- // assign the processor functions - - { - int i, found = 0; - for(i = 0; !found && api_v1_data_groups[i].name ;i++) { - if(api_v1_data_groups[i].value == group_method) { - r->internal.grouping_create= api_v1_data_groups[i].create; - r->internal.grouping_reset = api_v1_data_groups[i].reset; - r->internal.grouping_free = api_v1_data_groups[i].free; - r->internal.grouping_add = api_v1_data_groups[i].add; - r->internal.grouping_flush = api_v1_data_groups[i].flush; - found = 1; - } - } - if(!found) { - errno = 0; - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: grouping method %u not found for chart '%s'. Using 'average'", (unsigned int)group_method, r->st->name); - #endif - r->internal.grouping_create= grouping_create_average; - r->internal.grouping_reset = grouping_reset_average; - r->internal.grouping_free = grouping_free_average; - r->internal.grouping_add = grouping_add_average; - r->internal.grouping_flush = grouping_flush_average; - } - } + rrdr_set_grouping_function(r, group_method); // allocate any memory required by the grouping method - r->internal.grouping_create(r); + r->internal.grouping_create(r, group_options); // ------------------------------------------------------------------------- // disable the not-wanted dimensions + if (context_param_list && !(context_param_list->flags & CONTEXT_FLAGS_ARCHIVE)) rrdset_check_rdlock(st); @@ -1515,19 +1981,22 @@ static RRDR *rrd2rrdr_variablestep( rrdr_disable_not_selected_dimensions(r, options, dimensions, context_param_list); + query_debug_log_fin(); + // ------------------------------------------------------------------------- // do the work for each dimension time_t max_after = 0, min_before = 0; long max_rows = 0; + RRDDIM *first_rd = context_param_list ? context_param_list->rd : st->dimensions; RRDDIM *rd; long c, dimensions_used = 0, dimensions_nonzero = 0; struct timeval query_start_time; struct timeval query_current_time; - if (timeout) - now_realtime_timeval(&query_start_time); - for(rd = temp_rd?temp_rd:st->dimensions, c = 0 ; rd && c < dimensions_count ; rd = rd->next, c++) { + if (timeout) now_realtime_timeval(&query_start_time); + + for(rd = first_rd, c = 0 ; rd && c < dimensions_count ; rd = rd->next, c++) { // if we need a percentage, we need to calculate all dimensions if(unlikely(!(options & RRDR_OPTION_PERCENTAGE) && (r->od[c] & RRDR_DIMENSION_HIDDEN))) { @@ -1539,15 +2008,7 @@ static RRDR *rrd2rrdr_variablestep( // reset the grouping for the new dimension r->internal.grouping_reset(r); - do_dimension_variablestep( - r - , points_wanted - , rd - , c - , after_wanted - , before_wanted - , options - ); + rrd2rrdr_do_dimension(r, points_wanted, rd, c, after_wanted, before_wanted); if (timeout) now_realtime_timeval(&query_current_time); @@ -1562,66 +2023,81 @@ static RRDR *rrd2rrdr_variablestep( } else { if(r->after != max_after) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: 'after' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", - st->name, (size_t)max_after, rd->name, (size_t)r->after); - #endif + internal_error(true, "QUERY: 'after' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", + st->name, (size_t)max_after, rd->name, (size_t)r->after); + r->after = (r->after > max_after) ? r->after : max_after; } if(r->before != min_before) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: 'before' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", - st->name, (size_t)min_before, rd->name, (size_t)r->before); - #endif + internal_error(true, "QUERY: 'before' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", + st->name, (size_t)min_before, rd->name, (size_t)r->before); + r->before = (r->before < min_before) ? r->before : min_before; } if(r->rows != max_rows) { - #ifdef NETDATA_INTERNAL_CHECKS - error("INTERNAL ERROR: 'rows' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", - st->name, (size_t)max_rows, rd->name, (size_t)r->rows); - #endif + internal_error(true, "QUERY: 'rows' mismatch between dimensions for chart '%s': max is %zu, dimension '%s' has %zu", + st->name, (size_t)max_rows, rd->name, (size_t)r->rows); + r->rows = (r->rows > max_rows) ? r->rows : max_rows; } } dimensions_used++; - if (timeout && (dt_usec(&query_start_time, &query_current_time) / 1000.0) > timeout) { + if (timeout && ((NETDATA_DOUBLE)dt_usec(&query_start_time, &query_current_time) / 1000.0) > timeout) { log_access("QUERY CANCELED RUNTIME EXCEEDED %0.2f ms (LIMIT %d ms)", - dt_usec(&query_start_time, &query_current_time) / 1000.0, timeout); + (NETDATA_DOUBLE)dt_usec(&query_start_time, &query_current_time) / 1000.0, timeout); r->result_options |= RRDR_RESULT_OPTION_CANCEL; break; } } - #ifdef NETDATA_INTERNAL_CHECKS - +#ifdef NETDATA_INTERNAL_CHECKS if (dimensions_used) { if(r->internal.log) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ r->internal.log); + rrd2rrdr_log_request_response_metadata(r, options, group_method, aligned, group, resampling_time_requested, resampling_group, + after_wanted, after_requested, before_wanted, before_requested, + points_requested, points_wanted, /*after_slot, before_slot,*/ + r->internal.log); if(r->rows != points_wanted) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "got 'points' is not wanted 'points'"); + rrd2rrdr_log_request_response_metadata(r, options, group_method, aligned, group, resampling_time_requested, resampling_group, + after_wanted, after_requested, before_wanted, before_requested, + points_requested, points_wanted, /*after_slot, before_slot,*/ + "got 'points' is not wanted 'points'"); - if(aligned && (r->before % group) != 0) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "'before' is not aligned but alignment is required"); + if(aligned && (r->before % (group * query_granularity)) != 0) + rrd2rrdr_log_request_response_metadata(r, options, group_method, aligned, group, resampling_time_requested, resampling_group, + after_wanted, after_requested, before_wanted,before_wanted, + points_requested, points_wanted, /*after_slot, before_slot,*/ + "'before' is not aligned but alignment is required"); // 'after' should not be aligned, since we start inside the first group //if(aligned && (r->after % group) != 0) - // rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, after_slot, before_slot, "'after' is not aligned but alignment is required"); + // rrd2rrdr_log_request_response_metadata(r, options, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, after_slot, before_slot, "'after' is not aligned but alignment is required"); - if(r->before != before_requested) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "chart is not aligned to requested 'before'"); + if(r->before != before_wanted) + rrd2rrdr_log_request_response_metadata(r, options, group_method, aligned, group, resampling_time_requested, resampling_group, + after_wanted, after_requested, before_wanted, before_requested, + points_requested, points_wanted, /*after_slot, before_slot,*/ + "chart is not aligned to requested 'before'"); if(r->before != before_wanted) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "got 'before' is not wanted 'before'"); + rrd2rrdr_log_request_response_metadata(r, options, group_method, aligned, group, resampling_time_requested, resampling_group, + after_wanted, after_requested, before_wanted, before_requested, + points_requested, points_wanted, /*after_slot, before_slot,*/ + "got 'before' is not wanted 'before'"); // reported 'after' varies, depending on group if(r->after != after_wanted) - rrd2rrdr_log_request_response_metadata(r, group_method, aligned, group, resampling_time_requested, resampling_group, after_wanted, after_requested, before_wanted, before_requested, points_requested, points_wanted, /*after_slot, before_slot,*/ "got 'after' is not wanted 'after'"); + rrd2rrdr_log_request_response_metadata(r, options, group_method, aligned, group, resampling_time_requested, resampling_group, + after_wanted, after_requested, before_wanted, before_requested, + points_requested, points_wanted, /*after_slot, before_slot,*/ + "got 'after' is not wanted 'after'"); + } - #endif +#endif // free all resources used by the grouping method r->internal.grouping_free(r); @@ -1630,99 +2106,12 @@ static RRDR *rrd2rrdr_variablestep( if(unlikely(options & RRDR_OPTION_NONZERO && !dimensions_nonzero && !(r->result_options & RRDR_RESULT_OPTION_CANCEL))) { // all the dimensions are zero // mark them as NONZERO to send them all - for(rd = temp_rd?temp_rd:st->dimensions, c = 0 ; rd && c < dimensions_count ; rd = rd->next, c++) { + for(rd = first_rd, c = 0 ; rd && c < dimensions_count ; rd = rd->next, c++) { if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; r->od[c] |= RRDR_DIMENSION_NONZERO; } } rrdr_query_completed(r->internal.db_points_read, r->internal.result_points_generated); - freez(region_info_array); return r; } -#endif //#ifdef ENABLE_DBENGINE - -RRDR *rrd2rrdr( - ONEWAYALLOC *owa - , RRDSET *st - , long points_requested - , long long after_requested - , long long before_requested - , RRDR_GROUPING group_method - , long resampling_time_requested - , RRDR_OPTIONS options - , const char *dimensions - , struct context_param *context_param_list - , int timeout -) -{ - int rrd_update_every; - int absolute_period_requested; - - time_t first_entry_t; - time_t last_entry_t; - if (context_param_list) { - first_entry_t = context_param_list->first_entry_t; - last_entry_t = context_param_list->last_entry_t; - } else { - rrdset_rdlock(st); - first_entry_t = rrdset_first_entry_t_nolock(st); - last_entry_t = rrdset_last_entry_t_nolock(st); - rrdset_unlock(st); - } - - rrd_update_every = st->update_every; - absolute_period_requested = rrdr_convert_before_after_to_absolute(&after_requested, &before_requested, - rrd_update_every, first_entry_t, - last_entry_t, options); - if (options & RRDR_OPTION_ALLOW_PAST) - if (first_entry_t > after_requested) - first_entry_t = after_requested; - - if (context_param_list && !(context_param_list->flags & CONTEXT_FLAGS_ARCHIVE)) { - rebuild_context_param_list(owa, context_param_list, after_requested); - st = context_param_list->rd ? context_param_list->rd->rrdset : NULL; - if (unlikely(!st)) - return NULL; - } - -#ifdef ENABLE_DBENGINE - if (st->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) { - struct rrdeng_region_info *region_info_array; - unsigned regions, max_interval; - - /* This call takes the chart read-lock */ - regions = rrdeng_variable_step_boundaries(st, after_requested, before_requested, - ®ion_info_array, &max_interval, context_param_list); - if (1 == regions) { - if (region_info_array) { - if (rrd_update_every != region_info_array[0].update_every) { - rrd_update_every = region_info_array[0].update_every; - /* recalculate query alignment */ - absolute_period_requested = - rrdr_convert_before_after_to_absolute(&after_requested, &before_requested, rrd_update_every, - first_entry_t, last_entry_t, options); - } - freez(region_info_array); - } - return rrd2rrdr_fixedstep(owa, st, points_requested, after_requested, before_requested, group_method, - resampling_time_requested, options, dimensions, rrd_update_every, - first_entry_t, last_entry_t, absolute_period_requested, context_param_list, timeout); - } else { - if (rrd_update_every != (uint16_t)max_interval) { - rrd_update_every = (uint16_t) max_interval; - /* recalculate query alignment */ - absolute_period_requested = rrdr_convert_before_after_to_absolute(&after_requested, &before_requested, - rrd_update_every, first_entry_t, - last_entry_t, options); - } - return rrd2rrdr_variablestep(owa, st, points_requested, after_requested, before_requested, group_method, - resampling_time_requested, options, dimensions, rrd_update_every, - first_entry_t, last_entry_t, absolute_period_requested, region_info_array, context_param_list, timeout); - } - } -#endif - return rrd2rrdr_fixedstep(owa, st, points_requested, after_requested, before_requested, group_method, - resampling_time_requested, options, dimensions, - rrd_update_every, first_entry_t, last_entry_t, absolute_period_requested, context_param_list, timeout); -} diff --git a/web/api/queries/query.h b/web/api/queries/query.h index 6b8a51c58..df876d9ac 100644 --- a/web/api/queries/query.h +++ b/web/api/queries/query.h @@ -3,6 +3,10 @@ #ifndef NETDATA_API_DATA_QUERY_H #define NETDATA_API_DATA_QUERY_H +#ifdef __cplusplus +extern "C" { +#endif + typedef enum rrdr_grouping { RRDR_GROUPING_UNDEFINED = 0, RRDR_GROUPING_AVERAGE, @@ -10,15 +14,46 @@ typedef enum rrdr_grouping { RRDR_GROUPING_MAX, RRDR_GROUPING_SUM, RRDR_GROUPING_INCREMENTAL_SUM, + RRDR_GROUPING_TRIMMED_MEAN1, + RRDR_GROUPING_TRIMMED_MEAN2, + RRDR_GROUPING_TRIMMED_MEAN3, + RRDR_GROUPING_TRIMMED_MEAN5, + RRDR_GROUPING_TRIMMED_MEAN10, + RRDR_GROUPING_TRIMMED_MEAN15, + RRDR_GROUPING_TRIMMED_MEAN20, + RRDR_GROUPING_TRIMMED_MEAN25, RRDR_GROUPING_MEDIAN, + RRDR_GROUPING_TRIMMED_MEDIAN1, + RRDR_GROUPING_TRIMMED_MEDIAN2, + RRDR_GROUPING_TRIMMED_MEDIAN3, + RRDR_GROUPING_TRIMMED_MEDIAN5, + RRDR_GROUPING_TRIMMED_MEDIAN10, + RRDR_GROUPING_TRIMMED_MEDIAN15, + RRDR_GROUPING_TRIMMED_MEDIAN20, + RRDR_GROUPING_TRIMMED_MEDIAN25, + RRDR_GROUPING_PERCENTILE25, + RRDR_GROUPING_PERCENTILE50, + RRDR_GROUPING_PERCENTILE75, + RRDR_GROUPING_PERCENTILE80, + RRDR_GROUPING_PERCENTILE90, + RRDR_GROUPING_PERCENTILE95, + RRDR_GROUPING_PERCENTILE97, + RRDR_GROUPING_PERCENTILE98, + RRDR_GROUPING_PERCENTILE99, RRDR_GROUPING_STDDEV, RRDR_GROUPING_CV, RRDR_GROUPING_SES, RRDR_GROUPING_DES, + RRDR_GROUPING_COUNTIF, } RRDR_GROUPING; extern const char *group_method2string(RRDR_GROUPING group); extern void web_client_api_v1_init_grouping(void); extern RRDR_GROUPING web_client_api_request_v1_data_group(const char *name, RRDR_GROUPING def); +extern const char *web_client_api_request_v1_data_group_to_string(RRDR_GROUPING group); + +#ifdef __cplusplus +} +#endif #endif //NETDATA_API_DATA_QUERY_H diff --git a/web/api/queries/rrdr.c b/web/api/queries/rrdr.c index 4d05778c1..ecf4ca2ac 100644 --- a/web/api/queries/rrdr.c +++ b/web/api/queries/rrdr.c @@ -30,7 +30,7 @@ static void rrdr_dump(RRDR *r) // for each line in the array for(i = 0; i < r->rows ;i++) { - calculated_number *cn = &r->v[ i * r->d ]; + NETDATA_DOUBLE *cn = &r->v[ i * r->d ]; RRDR_DIMENSION_FLAGS *co = &r->o[ i * r->d ]; // print the id and the timestamp of the line @@ -44,7 +44,7 @@ static void rrdr_dump(RRDR *r) if(co[c] & RRDR_EMPTY) fprintf(stderr, "null "); else - fprintf(stderr, CALCULATED_NUMBER_FORMAT " %s%s%s%s " + fprintf(stderr, NETDATA_DOUBLE_FORMAT " %s%s%s%s " , cn[c] , (co[c] & RRDR_EMPTY)?"E":" " , (co[c] & RRDR_RESET)?"R":" " @@ -58,78 +58,65 @@ static void rrdr_dump(RRDR *r) } */ +inline void rrdr_free(ONEWAYALLOC *owa, RRDR *r) { + if(unlikely(!r)) return; - - -inline static void rrdr_lock_rrdset(RRDR *r) { - if(unlikely(!r)) { - error("NULL value given!"); - return; - } - - rrdset_rdlock(r->st); - r->has_st_lock = 1; -} - -inline static void rrdr_unlock_rrdset(RRDR *r) { - if(unlikely(!r)) { - error("NULL value given!"); - return; - } - - if(likely(r->has_st_lock)) { - r->has_st_lock = 0; + if(likely(r->st_locked_by_rrdr_create)) rrdset_unlock(r->st); - } -} - -inline void rrdr_free(ONEWAYALLOC *owa, RRDR *r) -{ - if(unlikely(!r)) { - error("NULL value given!"); - return; - } - rrdr_unlock_rrdset(r); onewayalloc_freez(owa, r->t); onewayalloc_freez(owa, r->v); onewayalloc_freez(owa, r->o); onewayalloc_freez(owa, r->od); + onewayalloc_freez(owa, r->ar); onewayalloc_freez(owa, r); } -RRDR *rrdr_create(ONEWAYALLOC *owa, struct rrdset *st, long n, struct context_param *context_param_list) -{ - if (unlikely(!st)) { - error("NULL value given!"); - return NULL; - } - +RRDR *rrdr_create_for_x_dimensions(ONEWAYALLOC *owa, int dimensions, long points) { RRDR *r = onewayalloc_callocz(owa, 1, sizeof(RRDR)); - r->st = st; + r->internal.owa = owa; + + r->d = dimensions; + r->n = points; + + r->t = onewayalloc_callocz(owa, points, sizeof(time_t)); + r->v = onewayalloc_mallocz(owa, points * dimensions * sizeof(NETDATA_DOUBLE)); + r->o = onewayalloc_mallocz(owa, points * dimensions * sizeof(RRDR_VALUE_FLAGS)); + r->ar = onewayalloc_mallocz(owa, points * dimensions * sizeof(NETDATA_DOUBLE)); + r->od = onewayalloc_mallocz(owa, dimensions * sizeof(RRDR_DIMENSION_FLAGS)); + r->group = 1; + r->update_every = 1; + + return r; +} + +RRDR *rrdr_create(ONEWAYALLOC *owa, struct rrdset *st, long n, struct context_param *context_param_list) { + if (unlikely(!st)) return NULL; + + bool st_locked_by_rrdr_create = false; if (!context_param_list || !(context_param_list->flags & CONTEXT_FLAGS_ARCHIVE)) { - rrdr_lock_rrdset(r); - r->st_needs_lock = 1; + rrdset_rdlock(st); + st_locked_by_rrdr_create = true; } + // count the number of dimensions + int dimensions = 0; RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL; RRDDIM *rd; if (temp_rd) { RRDDIM *t = temp_rd; while (t) { - r->d++; + dimensions++; t = t->next; } } else - rrddim_foreach_read(rd, st) r->d++; - - r->n = n; + rrddim_foreach_read(rd, st) dimensions++; - r->t = onewayalloc_callocz(owa, (size_t)n, sizeof(time_t)); - r->v = onewayalloc_mallocz(owa, n * r->d * sizeof(calculated_number)); - r->o = onewayalloc_mallocz(owa, n * r->d * sizeof(RRDR_VALUE_FLAGS)); - r->od = onewayalloc_mallocz(owa, r->d * sizeof(RRDR_DIMENSION_FLAGS)); + // create the rrdr + RRDR *r = rrdr_create_for_x_dimensions(owa, dimensions, n); + r->st = st; + r->st_locked_by_rrdr_create = st_locked_by_rrdr_create; // set the hidden flag on hidden dimensions int c; @@ -140,8 +127,5 @@ RRDR *rrdr_create(ONEWAYALLOC *owa, struct rrdset *st, long n, struct context_pa r->od[c] = RRDR_DIMENSION_DEFAULT; } - r->group = 1; - r->update_every = 1; - return r; } diff --git a/web/api/queries/rrdr.h b/web/api/queries/rrdr.h index 87ba6c86b..1c80e103f 100644 --- a/web/api/queries/rrdr.h +++ b/web/api/queries/rrdr.h @@ -4,27 +4,46 @@ #define NETDATA_QUERIES_RRDR_H #include "libnetdata/libnetdata.h" +#include "web/api/queries/query.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum tier_query_fetch { + TIER_QUERY_FETCH_SUM, + TIER_QUERY_FETCH_MIN, + TIER_QUERY_FETCH_MAX, + TIER_QUERY_FETCH_AVERAGE +} TIER_QUERY_FETCH; typedef enum rrdr_options { - RRDR_OPTION_NONZERO = 0x00000001, // don't output dimensions with just zero values - RRDR_OPTION_REVERSED = 0x00000002, // output the rows in reverse order (oldest to newest) - RRDR_OPTION_ABSOLUTE = 0x00000004, // values positive, for DATASOURCE_SSV before summing - RRDR_OPTION_MIN2MAX = 0x00000008, // when adding dimensions, use max - min, instead of sum - RRDR_OPTION_SECONDS = 0x00000010, // output seconds, instead of dates - RRDR_OPTION_MILLISECONDS = 0x00000020, // output milliseconds, instead of dates - RRDR_OPTION_NULL2ZERO = 0x00000040, // do not show nulls, convert them to zeros - RRDR_OPTION_OBJECTSROWS = 0x00000080, // each row of values should be an object, not an array - RRDR_OPTION_GOOGLE_JSON = 0x00000100, // comply with google JSON/JSONP specs - RRDR_OPTION_JSON_WRAP = 0x00000200, // wrap the response in a JSON header with info about the result - RRDR_OPTION_LABEL_QUOTES = 0x00000400, // in CSV output, wrap header labels in double quotes - RRDR_OPTION_PERCENTAGE = 0x00000800, // give values as percentage of total - RRDR_OPTION_NOT_ALIGNED = 0x00001000, // do not align charts for persistent timeframes - RRDR_OPTION_DISPLAY_ABS = 0x00002000, // for badges, display the absolute value, but calculate colors with sign - RRDR_OPTION_MATCH_IDS = 0x00004000, // when filtering dimensions, match only IDs - RRDR_OPTION_MATCH_NAMES = 0x00008000, // when filtering dimensions, match only names - RRDR_OPTION_CUSTOM_VARS = 0x00010000, // when wrapping response in a JSON, return custom variables in response - RRDR_OPTION_ALLOW_PAST = 0x00020000, // The after parameter can extend in the past before the first entry - RRDR_OPTION_ANOMALY_BIT = 0x00040000, // Return the anomaly bit stored in each collected_number + RRDR_OPTION_NONZERO = 0x00000001, // don't output dimensions with just zero values + RRDR_OPTION_REVERSED = 0x00000002, // output the rows in reverse order (oldest to newest) + RRDR_OPTION_ABSOLUTE = 0x00000004, // values positive, for DATASOURCE_SSV before summing + RRDR_OPTION_MIN2MAX = 0x00000008, // when adding dimensions, use max - min, instead of sum + RRDR_OPTION_SECONDS = 0x00000010, // output seconds, instead of dates + RRDR_OPTION_MILLISECONDS = 0x00000020, // output milliseconds, instead of dates + RRDR_OPTION_NULL2ZERO = 0x00000040, // do not show nulls, convert them to zeros + RRDR_OPTION_OBJECTSROWS = 0x00000080, // each row of values should be an object, not an array + RRDR_OPTION_GOOGLE_JSON = 0x00000100, // comply with google JSON/JSONP specs + RRDR_OPTION_JSON_WRAP = 0x00000200, // wrap the response in a JSON header with info about the result + RRDR_OPTION_LABEL_QUOTES = 0x00000400, // in CSV output, wrap header labels in double quotes + RRDR_OPTION_PERCENTAGE = 0x00000800, // give values as percentage of total + RRDR_OPTION_NOT_ALIGNED = 0x00001000, // do not align charts for persistent timeframes + RRDR_OPTION_DISPLAY_ABS = 0x00002000, // for badges, display the absolute value, but calculate colors with sign + RRDR_OPTION_MATCH_IDS = 0x00004000, // when filtering dimensions, match only IDs + RRDR_OPTION_MATCH_NAMES = 0x00008000, // when filtering dimensions, match only names + RRDR_OPTION_CUSTOM_VARS = 0x00010000, // when wrapping response in a JSON, return custom variables in response + RRDR_OPTION_NATURAL_POINTS = 0x00020000, // return the natural points of the database + RRDR_OPTION_VIRTUAL_POINTS = 0x00040000, // return virtual points + RRDR_OPTION_ANOMALY_BIT = 0x00080000, // Return the anomaly bit stored in each collected_number + RRDR_OPTION_RETURN_RAW = 0x00100000, // Return raw data for aggregating across multiple nodes + RRDR_OPTION_RETURN_JWAR = 0x00200000, // Return anomaly rates in jsonwrap + RRDR_OPTION_SELECTED_TIER = 0x00400000, // Use the selected tier for the query + + // internal ones - not to be exposed to the API + RRDR_OPTION_INTERNAL_AR = 0x10000000, // internal use only, to let the formatters we want to render the anomaly rate } RRDR_OPTIONS; typedef enum rrdr_value_flag { @@ -62,40 +81,46 @@ typedef struct rrdresult { RRDR_DIMENSION_FLAGS *od; // the options for the dimensions time_t *t; // array of n timestamps - calculated_number *v; // array n x d values + NETDATA_DOUBLE *v; // array n x d values RRDR_VALUE_FLAGS *o; // array n x d options for each value returned + NETDATA_DOUBLE *ar; // array n x d of anomaly rates (0 - 100) long group; // how many collected values were grouped for each row int update_every; // what is the suggested update frequency in seconds - calculated_number min; - calculated_number max; + NETDATA_DOUBLE min; + NETDATA_DOUBLE max; time_t before; time_t after; - int has_st_lock; // if st is read locked by us - uint8_t st_needs_lock; // if ST should be locked + bool st_locked_by_rrdr_create; // if st is read locked by us // internal rrd2rrdr() members below this point struct { + int query_tier; // the selected tier + RRDR_OPTIONS query_options; // RRDR_OPTION_* (as run by the query) + long points_wanted; long resampling_group; - calculated_number resampling_divisor; + NETDATA_DOUBLE resampling_divisor; - void (*grouping_create)(struct rrdresult *r); + void (*grouping_create)(struct rrdresult *r, const char *options); void (*grouping_reset)(struct rrdresult *r); void (*grouping_free)(struct rrdresult *r); - void (*grouping_add)(struct rrdresult *r, calculated_number value); - calculated_number (*grouping_flush)(struct rrdresult *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); + void (*grouping_add)(struct rrdresult *r, NETDATA_DOUBLE value); + NETDATA_DOUBLE (*grouping_flush)(struct rrdresult *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); void *grouping_data; + TIER_QUERY_FETCH tier_query_fetch; #ifdef NETDATA_INTERNAL_CHECKS const char *log; #endif size_t db_points_read; size_t result_points_generated; + size_t tier_points_read[RRD_STORAGE_TIERS]; + ONEWAYALLOC *owa; } internal; } RRDR; @@ -104,16 +129,21 @@ typedef struct rrdresult { #include "database/rrd.h" extern void rrdr_free(ONEWAYALLOC *owa, RRDR *r); extern RRDR *rrdr_create(ONEWAYALLOC *owa, struct rrdset *st, long n, struct context_param *context_param_list); +extern RRDR *rrdr_create_for_x_dimensions(ONEWAYALLOC *owa, int dimensions, long points); #include "../web_api_v1.h" #include "web/api/queries/query.h" extern RRDR *rrd2rrdr( ONEWAYALLOC *owa, - RRDSET *st, long points_requested, long long after_requested, long long before_requested, + RRDSET *st, long points_wanted, long long after_wanted, long long before_wanted, RRDR_GROUPING group_method, long resampling_time_requested, RRDR_OPTIONS options, const char *dimensions, - struct context_param *context_param_list, int timeout); + struct context_param *context_param_list, const char *group_options, int timeout, int tier); + +extern int rrdr_relative_window_to_absolute(long long *after, long long *before); -#include "query.h" +#ifdef __cplusplus +} +#endif #endif //NETDATA_QUERIES_RRDR_H diff --git a/web/api/queries/ses/ses.c b/web/api/queries/ses/ses.c index ae4a0fa0d..5e94002c3 100644 --- a/web/api/queries/ses/ses.c +++ b/web/api/queries/ses/ses.c @@ -7,9 +7,9 @@ // single exponential smoothing struct grouping_ses { - calculated_number alpha; - calculated_number alpha_other; - calculated_number level; + NETDATA_DOUBLE alpha; + NETDATA_DOUBLE alpha_other; + NETDATA_DOUBLE level; size_t count; }; @@ -25,20 +25,20 @@ void grouping_init_ses(void) { } } -static inline calculated_number window(RRDR *r, struct grouping_ses *g) { +static inline NETDATA_DOUBLE window(RRDR *r, struct grouping_ses *g) { (void)g; - calculated_number points; + NETDATA_DOUBLE points; if(r->group == 1) { // provide a running DES - points = r->internal.points_wanted; + points = (NETDATA_DOUBLE)r->internal.points_wanted; } else { // provide a SES with flush points - points = r->group; + points = (NETDATA_DOUBLE)r->group; } - return (points > max_window_size) ? max_window_size : points; + return (points > (NETDATA_DOUBLE)max_window_size) ? (NETDATA_DOUBLE)max_window_size : points; } static inline void set_alpha(RRDR *r, struct grouping_ses *g) { @@ -48,8 +48,8 @@ static inline void set_alpha(RRDR *r, struct grouping_ses *g) { g->alpha_other = 1.0 - g->alpha; } -void grouping_create_ses(RRDR *r) { - struct grouping_ses *g = (struct grouping_ses *)callocz(1, sizeof(struct grouping_ses)); +void grouping_create_ses(RRDR *r, const char *options __maybe_unused) { + struct grouping_ses *g = (struct grouping_ses *)onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_ses)); set_alpha(r, g); g->level = 0.0; r->internal.grouping_data = g; @@ -64,11 +64,11 @@ void grouping_reset_ses(RRDR *r) { } void grouping_free_ses(RRDR *r) { - freez(r->internal.grouping_data); + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_ses(RRDR *r, calculated_number value) { +void grouping_add_ses(RRDR *r, NETDATA_DOUBLE value) { struct grouping_ses *g = (struct grouping_ses *)r->internal.grouping_data; if(unlikely(!g->count)) @@ -78,10 +78,10 @@ void grouping_add_ses(RRDR *r, calculated_number value) { g->count++; } -calculated_number grouping_flush_ses(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_ses(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_ses *g = (struct grouping_ses *)r->internal.grouping_data; - if(unlikely(!g->count || !calculated_number_isnumber(g->level))) { + if(unlikely(!g->count || !netdata_double_isnumber(g->level))) { *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; return 0.0; } diff --git a/web/api/queries/ses/ses.h b/web/api/queries/ses/ses.h index c05f208f3..094b8de3f 100644 --- a/web/api/queries/ses/ses.h +++ b/web/api/queries/ses/ses.h @@ -8,10 +8,10 @@ extern void grouping_init_ses(void); -extern void grouping_create_ses(RRDR *r); +extern void grouping_create_ses(RRDR *r, const char *options __maybe_unused); extern void grouping_reset_ses(RRDR *r); extern void grouping_free_ses(RRDR *r); -extern void grouping_add_ses(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_ses(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_ses(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_ses(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERIES_SES_H diff --git a/web/api/queries/stddev/stddev.c b/web/api/queries/stddev/stddev.c index ffe7a47c0..92a67b42d 100644 --- a/web/api/queries/stddev/stddev.c +++ b/web/api/queries/stddev/stddev.c @@ -11,11 +11,11 @@ struct grouping_stddev { long count; - calculated_number m_oldM, m_newM, m_oldS, m_newS; + NETDATA_DOUBLE m_oldM, m_newM, m_oldS, m_newS; }; -void grouping_create_stddev(RRDR *r) { - r->internal.grouping_data = callocz(1, sizeof(struct grouping_stddev)); +void grouping_create_stddev(RRDR *r, const char *options __maybe_unused) { + r->internal.grouping_data = onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_stddev)); } // resets when switches dimensions @@ -26,11 +26,11 @@ void grouping_reset_stddev(RRDR *r) { } void grouping_free_stddev(RRDR *r) { - freez(r->internal.grouping_data); + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_stddev(RRDR *r, calculated_number value) { +void grouping_add_stddev(RRDR *r, NETDATA_DOUBLE value) { struct grouping_stddev *g = (struct grouping_stddev *)r->internal.grouping_data; g->count++; @@ -50,26 +50,26 @@ void grouping_add_stddev(RRDR *r, calculated_number value) { } } -static inline calculated_number mean(struct grouping_stddev *g) { +static inline NETDATA_DOUBLE mean(struct grouping_stddev *g) { return (g->count > 0) ? g->m_newM : 0.0; } -static inline calculated_number variance(struct grouping_stddev *g) { - return ( (g->count > 1) ? g->m_newS/(g->count - 1) : 0.0 ); +static inline NETDATA_DOUBLE variance(struct grouping_stddev *g) { + return ( (g->count > 1) ? g->m_newS/(NETDATA_DOUBLE)(g->count - 1) : 0.0 ); } -static inline calculated_number stddev(struct grouping_stddev *g) { - return sqrtl(variance(g)); +static inline NETDATA_DOUBLE stddev(struct grouping_stddev *g) { + return sqrtndd(variance(g)); } -calculated_number grouping_flush_stddev(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_stddev(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_stddev *g = (struct grouping_stddev *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(likely(g->count > 1)) { value = stddev(g); - if(!calculated_number_isnumber(value)) { + if(!netdata_double_isnumber(value)) { value = 0.0; *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; } @@ -88,16 +88,16 @@ calculated_number grouping_flush_stddev(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_op } // https://en.wikipedia.org/wiki/Coefficient_of_variation -calculated_number grouping_flush_coefficient_of_variation(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_coefficient_of_variation(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_stddev *g = (struct grouping_stddev *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(likely(g->count > 1)) { - calculated_number m = mean(g); + NETDATA_DOUBLE m = mean(g); value = 100.0 * stddev(g) / ((m < 0)? -m : m); - if(unlikely(!calculated_number_isnumber(value))) { + if(unlikely(!netdata_double_isnumber(value))) { value = 0.0; *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; } @@ -121,10 +121,10 @@ calculated_number grouping_flush_coefficient_of_variation(RRDR *r, RRDR_VALUE_FL /* * Mean = average * -calculated_number grouping_flush_mean(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_mean(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_stddev *g = (struct grouping_stddev *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(unlikely(!g->count)) { value = 0.0; @@ -148,10 +148,10 @@ calculated_number grouping_flush_mean(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_opti /* * It is not advised to use this version of variance directly * -calculated_number grouping_flush_variance(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_variance(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_stddev *g = (struct grouping_stddev *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(unlikely(!g->count)) { value = 0.0; diff --git a/web/api/queries/stddev/stddev.h b/web/api/queries/stddev/stddev.h index ab58fbe50..c5c91f88d 100644 --- a/web/api/queries/stddev/stddev.h +++ b/web/api/queries/stddev/stddev.h @@ -6,13 +6,13 @@ #include "../query.h" #include "../rrdr.h" -extern void grouping_create_stddev(RRDR *r); +extern void grouping_create_stddev(RRDR *r, const char *options __maybe_unused); extern void grouping_reset_stddev(RRDR *r); extern void grouping_free_stddev(RRDR *r); -extern void grouping_add_stddev(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_stddev(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); -extern calculated_number grouping_flush_coefficient_of_variation(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); -// extern calculated_number grouping_flush_mean(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); -// extern calculated_number grouping_flush_variance(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_stddev(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_stddev(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern NETDATA_DOUBLE grouping_flush_coefficient_of_variation(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +// extern NETDATA_DOUBLE grouping_flush_mean(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +// extern NETDATA_DOUBLE grouping_flush_variance(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERIES_STDDEV_H diff --git a/web/api/queries/sum/sum.c b/web/api/queries/sum/sum.c index 6bb012bb0..eec6e2ad0 100644 --- a/web/api/queries/sum/sum.c +++ b/web/api/queries/sum/sum.c @@ -6,12 +6,12 @@ // sum struct grouping_sum { - calculated_number sum; + NETDATA_DOUBLE sum; size_t count; }; -void grouping_create_sum(RRDR *r) { - r->internal.grouping_data = callocz(1, sizeof(struct grouping_sum)); +void grouping_create_sum(RRDR *r, const char *options __maybe_unused) { + r->internal.grouping_data = onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_sum)); } // resets when switches dimensions @@ -23,20 +23,20 @@ void grouping_reset_sum(RRDR *r) { } void grouping_free_sum(RRDR *r) { - freez(r->internal.grouping_data); + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); r->internal.grouping_data = NULL; } -void grouping_add_sum(RRDR *r, calculated_number value) { +void grouping_add_sum(RRDR *r, NETDATA_DOUBLE value) { struct grouping_sum *g = (struct grouping_sum *)r->internal.grouping_data; g->sum += value; g->count++; } -calculated_number grouping_flush_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { +NETDATA_DOUBLE grouping_flush_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { struct grouping_sum *g = (struct grouping_sum *)r->internal.grouping_data; - calculated_number value; + NETDATA_DOUBLE value; if(unlikely(!g->count)) { value = 0.0; diff --git a/web/api/queries/sum/sum.h b/web/api/queries/sum/sum.h index 05cb6185e..4e7e396e9 100644 --- a/web/api/queries/sum/sum.h +++ b/web/api/queries/sum/sum.h @@ -6,10 +6,10 @@ #include "../query.h" #include "../rrdr.h" -extern void grouping_create_sum(RRDR *r); +extern void grouping_create_sum(RRDR *r, const char *options __maybe_unused); extern void grouping_reset_sum(RRDR *r); extern void grouping_free_sum(RRDR *r); -extern void grouping_add_sum(RRDR *r, calculated_number value); -extern calculated_number grouping_flush_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); +extern void grouping_add_sum(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_sum(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); #endif //NETDATA_API_QUERY_SUM_H diff --git a/web/api/queries/trimmed_mean/Makefile.am b/web/api/queries/trimmed_mean/Makefile.am new file mode 100644 index 000000000..161784b8f --- /dev/null +++ b/web/api/queries/trimmed_mean/Makefile.am @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +AUTOMAKE_OPTIONS = subdir-objects +MAINTAINERCLEANFILES = $(srcdir)/Makefile.in + +dist_noinst_DATA = \ + README.md \ + $(NULL) diff --git a/web/api/queries/trimmed_mean/README.md b/web/api/queries/trimmed_mean/README.md new file mode 100644 index 000000000..71cdb85db --- /dev/null +++ b/web/api/queries/trimmed_mean/README.md @@ -0,0 +1,56 @@ + + +# Trimmed Mean + +The trimmed mean is the average value of a series excluding the smallest and biggest points. + +Netdata applies linear interpolation on the last point, if the percentage requested to be excluded does not give a +round number of points. + +The following percentile aliases are defined: + +- `trimmed-mean1` +- `trimmed-mean2` +- `trimmed-mean3` +- `trimmed-mean5` +- `trimmed-mean10` +- `trimmed-mean15` +- `trimmed-mean20` +- `trimmed-mean25` + +The default `trimmed-mean` is an alias for `trimmed-mean5`. +Any percentage may be requested using the `group_options` query parameter. + +## how to use + +Use it in alarms like this: + +``` + alarm: my_alarm + on: my_chart +lookup: trimmed-mean5 -1m unaligned of my_dimension + warn: $this > 1000 +``` + +`trimmed-mean` does not change the units. For example, if the chart units is `requests/sec`, the result +will be again expressed in the same units. + +It can also be used in APIs and badges as `&group=trimmed-mean` in the URL and the additional parameter `group_options` +may be used to request any percentage (e.g. `&group=trimmed-mean&group_options=29`). + +## Examples + +Examining last 1 minute `successful` web server responses: + +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=min&after=-60&label=min) +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=average&after=-60&label=average) +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=trimmed-mean5&after=-60&label=trimmed-mean5&value_color=orange) +- ![](https://registry.my-netdata.io/api/v1/badge.svg?chart=web_log_nginx.response_statuses&options=unaligned&dimensions=success&group=max&after=-60&label=max) + +## References + +- . diff --git a/web/api/queries/trimmed_mean/trimmed_mean.c b/web/api/queries/trimmed_mean/trimmed_mean.c new file mode 100644 index 000000000..2277208a7 --- /dev/null +++ b/web/api/queries/trimmed_mean/trimmed_mean.c @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "trimmed_mean.h" + +// ---------------------------------------------------------------------------- +// median + +struct grouping_trimmed_mean { + size_t series_size; + size_t next_pos; + NETDATA_DOUBLE percent; + + NETDATA_DOUBLE *series; +}; + +static void grouping_create_trimmed_mean_internal(RRDR *r, const char *options, NETDATA_DOUBLE def) { + long entries = r->group; + if(entries < 10) entries = 10; + + struct grouping_trimmed_mean *g = (struct grouping_trimmed_mean *)onewayalloc_callocz(r->internal.owa, 1, sizeof(struct grouping_trimmed_mean)); + g->series = onewayalloc_mallocz(r->internal.owa, entries * sizeof(NETDATA_DOUBLE)); + g->series_size = (size_t)entries; + + g->percent = def; + if(options && *options) { + g->percent = str2ndd(options, NULL); + if(!netdata_double_isnumber(g->percent)) g->percent = 0.0; + if(g->percent < 0.0) g->percent = 0.0; + if(g->percent > 50.0) g->percent = 50.0; + } + + g->percent = 1.0 - ((g->percent / 100.0) * 2.0); + r->internal.grouping_data = g; +} + +void grouping_create_trimmed_mean1(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 1.0); +} +void grouping_create_trimmed_mean2(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 2.0); +} +void grouping_create_trimmed_mean3(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 3.0); +} +void grouping_create_trimmed_mean5(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 5.0); +} +void grouping_create_trimmed_mean10(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 10.0); +} +void grouping_create_trimmed_mean15(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 15.0); +} +void grouping_create_trimmed_mean20(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 20.0); +} +void grouping_create_trimmed_mean25(RRDR *r, const char *options) { + grouping_create_trimmed_mean_internal(r, options, 25.0); +} + +// resets when switches dimensions +// so, clear everything to restart +void grouping_reset_trimmed_mean(RRDR *r) { + struct grouping_trimmed_mean *g = (struct grouping_trimmed_mean *)r->internal.grouping_data; + g->next_pos = 0; +} + +void grouping_free_trimmed_mean(RRDR *r) { + struct grouping_trimmed_mean *g = (struct grouping_trimmed_mean *)r->internal.grouping_data; + if(g) onewayalloc_freez(r->internal.owa, g->series); + + onewayalloc_freez(r->internal.owa, r->internal.grouping_data); + r->internal.grouping_data = NULL; +} + +void grouping_add_trimmed_mean(RRDR *r, NETDATA_DOUBLE value) { + struct grouping_trimmed_mean *g = (struct grouping_trimmed_mean *)r->internal.grouping_data; + + if(unlikely(g->next_pos >= g->series_size)) { + g->series = onewayalloc_doublesize( r->internal.owa, g->series, g->series_size * sizeof(NETDATA_DOUBLE)); + g->series_size *= 2; + } + + g->series[g->next_pos++] = value; +} + +NETDATA_DOUBLE grouping_flush_trimmed_mean(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr) { + struct grouping_trimmed_mean *g = (struct grouping_trimmed_mean *)r->internal.grouping_data; + + NETDATA_DOUBLE value; + size_t available_slots = g->next_pos; + + if(unlikely(!available_slots)) { + value = 0.0; + *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; + } + else if(available_slots == 1) { + value = g->series[0]; + } + else { + sort_series(g->series, available_slots); + + NETDATA_DOUBLE min = g->series[0]; + NETDATA_DOUBLE max = g->series[available_slots - 1]; + + if (min != max) { + size_t slots_to_use = (size_t)((NETDATA_DOUBLE)available_slots * g->percent); + if(!slots_to_use) slots_to_use = 1; + + NETDATA_DOUBLE percent_to_use = (NETDATA_DOUBLE)slots_to_use / (NETDATA_DOUBLE)available_slots; + NETDATA_DOUBLE percent_delta = g->percent - percent_to_use; + + NETDATA_DOUBLE percent_interpolation_slot = 0.0; + NETDATA_DOUBLE percent_last_slot = 0.0; + if(percent_delta > 0.0) { + NETDATA_DOUBLE percent_to_use_plus_1_slot = (NETDATA_DOUBLE)(slots_to_use + 1) / (NETDATA_DOUBLE)available_slots; + NETDATA_DOUBLE percent_1slot = percent_to_use_plus_1_slot - percent_to_use; + + percent_interpolation_slot = percent_delta / percent_1slot; + percent_last_slot = 1 - percent_interpolation_slot; + } + + int start_slot, stop_slot, step, last_slot, interpolation_slot; + if(min >= 0.0 && max >= 0.0) { + start_slot = (int)((available_slots - slots_to_use) / 2); + stop_slot = start_slot + (int)slots_to_use; + last_slot = stop_slot - 1; + interpolation_slot = stop_slot; + step = 1; + } + else { + start_slot = (int)available_slots - 1 - (int)((available_slots - slots_to_use) / 2); + stop_slot = start_slot - (int)slots_to_use; + last_slot = stop_slot + 1; + interpolation_slot = stop_slot; + step = -1; + } + + value = 0.0; + for(int slot = start_slot; slot != stop_slot ; slot += step) + value += g->series[slot]; + + size_t counted = slots_to_use; + if(percent_interpolation_slot > 0.0 && interpolation_slot >= 0 && interpolation_slot < (int)available_slots) { + value += g->series[interpolation_slot] * percent_interpolation_slot; + value += g->series[last_slot] * percent_last_slot; + counted++; + } + + value = value / (NETDATA_DOUBLE)counted; + } + else + value = min; + } + + if(unlikely(!netdata_double_isnumber(value))) { + value = 0.0; + *rrdr_value_options_ptr |= RRDR_VALUE_EMPTY; + } + + //log_series_to_stderr(g->series, g->next_pos, value, "trimmed_mean"); + + g->next_pos = 0; + + return value; +} diff --git a/web/api/queries/trimmed_mean/trimmed_mean.h b/web/api/queries/trimmed_mean/trimmed_mean.h new file mode 100644 index 000000000..1a4f63e9c --- /dev/null +++ b/web/api/queries/trimmed_mean/trimmed_mean.h @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_API_QUERIES_TRIMMED_MEAN_H +#define NETDATA_API_QUERIES_TRIMMED_MEAN_H + +#include "../query.h" +#include "../rrdr.h" + +extern void grouping_create_trimmed_mean1(RRDR *r, const char *options); +extern void grouping_create_trimmed_mean2(RRDR *r, const char *options); +extern void grouping_create_trimmed_mean3(RRDR *r, const char *options); +extern void grouping_create_trimmed_mean5(RRDR *r, const char *options); +extern void grouping_create_trimmed_mean10(RRDR *r, const char *options); +extern void grouping_create_trimmed_mean15(RRDR *r, const char *options); +extern void grouping_create_trimmed_mean20(RRDR *r, const char *options); +extern void grouping_create_trimmed_mean25(RRDR *r, const char *options); +extern void grouping_reset_trimmed_mean(RRDR *r); +extern void grouping_free_trimmed_mean(RRDR *r); +extern void grouping_add_trimmed_mean(RRDR *r, NETDATA_DOUBLE value); +extern NETDATA_DOUBLE grouping_flush_trimmed_mean(RRDR *r, RRDR_VALUE_FLAGS *rrdr_value_options_ptr); + +#endif //NETDATA_API_QUERIES_TRIMMED_MEAN_H diff --git a/web/api/queries/weights.c b/web/api/queries/weights.c new file mode 100644 index 000000000..97a00f91c --- /dev/null +++ b/web/api/queries/weights.c @@ -0,0 +1,1220 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#include "daemon/common.h" +#include "database/KolmogorovSmirnovDist.h" + +#define MAX_POINTS 10000 +int enable_metric_correlations = CONFIG_BOOLEAN_YES; +int metric_correlations_version = 1; +WEIGHTS_METHOD default_metric_correlations_method = WEIGHTS_METHOD_MC_KS2; + +typedef struct weights_stats { + NETDATA_DOUBLE max_base_high_ratio; + size_t db_points; + size_t result_points; + size_t db_queries; + size_t db_points_per_tier[RRD_STORAGE_TIERS]; + size_t binary_searches; +} WEIGHTS_STATS; + +// ---------------------------------------------------------------------------- +// parse and render metric correlations methods + +static struct { + const char *name; + WEIGHTS_METHOD value; +} weights_methods[] = { + { "ks2" , WEIGHTS_METHOD_MC_KS2} + , { "volume" , WEIGHTS_METHOD_MC_VOLUME} + , { "anomaly-rate" , WEIGHTS_METHOD_ANOMALY_RATE} + , { NULL , 0 } +}; + +WEIGHTS_METHOD weights_string_to_method(const char *method) { + for(int i = 0; weights_methods[i].name ;i++) + if(strcmp(method, weights_methods[i].name) == 0) + return weights_methods[i].value; + + return default_metric_correlations_method; +} + +const char *weights_method_to_string(WEIGHTS_METHOD method) { + for(int i = 0; weights_methods[i].name ;i++) + if(weights_methods[i].value == method) + return weights_methods[i].name; + + return "unknown"; +} + +// ---------------------------------------------------------------------------- +// The results per dimension are aggregated into a dictionary + +typedef enum { + RESULT_IS_BASE_HIGH_RATIO = (1 << 0), + RESULT_IS_PERCENTAGE_OF_TIME = (1 << 1), +} RESULT_FLAGS; + +struct register_result { + RESULT_FLAGS flags; + RRDSET *st; + const char *chart_id; + const char *context; + const char *dim_name; + NETDATA_DOUBLE value; + + struct register_result *next; // used to link contexts together +}; + +static void register_result_insert_callback(const char *name, void *value, void *data) { + (void)name; + (void)data; + + struct register_result *t = (struct register_result *)value; + + if(t->chart_id) t->chart_id = strdupz(t->chart_id); + if(t->context) t->context = strdupz(t->context); + if(t->dim_name) t->dim_name = strdupz(t->dim_name); +} + +static void register_result_delete_callback(const char *name, void *value, void *data) { + (void)name; + (void)data; + struct register_result *t = (struct register_result *)value; + + freez((void *)t->chart_id); + freez((void *)t->context); + freez((void *)t->dim_name); +} + +static DICTIONARY *register_result_init() { + DICTIONARY *results = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED); + dictionary_register_insert_callback(results, register_result_insert_callback, results); + dictionary_register_delete_callback(results, register_result_delete_callback, results); + return results; +} + +static void register_result_destroy(DICTIONARY *results) { + dictionary_destroy(results); +} + +static void register_result(DICTIONARY *results, + RRDSET *st, + RRDDIM *d, + NETDATA_DOUBLE value, + RESULT_FLAGS flags, + WEIGHTS_STATS *stats, + bool register_zero) { + + if(!netdata_double_isnumber(value)) return; + + // make it positive + NETDATA_DOUBLE v = fabsndd(value); + + // no need to store zero scored values + if(unlikely(fpclassify(v) == FP_ZERO && !register_zero)) + return; + + // keep track of the max of the baseline / highlight ratio + if(flags & RESULT_IS_BASE_HIGH_RATIO && v > stats->max_base_high_ratio) + stats->max_base_high_ratio = v; + + struct register_result t = { + .flags = flags, + .st = st, + .chart_id = st->id, + .context = st->context, + .dim_name = d->name, + .value = v + }; + + char buf[5000 + 1]; + snprintfz(buf, 5000, "%s:%s", st->id, d->name); + dictionary_set(results, buf, &t, sizeof(struct register_result)); +} + +// ---------------------------------------------------------------------------- +// Generation of JSON output for the results + +static void results_header_to_json(DICTIONARY *results __maybe_unused, BUFFER *wb, + long long after, long long before, + long long baseline_after, long long baseline_before, + long points, WEIGHTS_METHOD method, + RRDR_GROUPING group, RRDR_OPTIONS options, uint32_t shifts, + size_t examined_dimensions __maybe_unused, usec_t duration, + WEIGHTS_STATS *stats) { + + buffer_sprintf(wb, "{\n" + "\t\"after\": %lld,\n" + "\t\"before\": %lld,\n" + "\t\"duration\": %lld,\n" + "\t\"points\": %ld,\n", + after, + before, + before - after, + points + ); + + if(method == WEIGHTS_METHOD_MC_KS2 || method == WEIGHTS_METHOD_MC_VOLUME) + buffer_sprintf(wb, "" + "\t\"baseline_after\": %lld,\n" + "\t\"baseline_before\": %lld,\n" + "\t\"baseline_duration\": %lld,\n" + "\t\"baseline_points\": %ld,\n", + baseline_after, + baseline_before, + baseline_before - baseline_after, + points << shifts + ); + + buffer_sprintf(wb, "" + "\t\"statistics\": {\n" + "\t\t\"query_time_ms\": %f,\n" + "\t\t\"db_queries\": %zu,\n" + "\t\t\"query_result_points\": %zu,\n" + "\t\t\"binary_searches\": %zu,\n" + "\t\t\"db_points_read\": %zu,\n" + "\t\t\"db_points_per_tier\": [ ", + (double)duration / (double)USEC_PER_MS, + stats->db_queries, + stats->result_points, + stats->binary_searches, + stats->db_points + ); + + for(int tier = 0; tier < storage_tiers ;tier++) + buffer_sprintf(wb, "%s%zu", tier?", ":"", stats->db_points_per_tier[tier]); + + buffer_sprintf(wb, " ]\n" + "\t},\n" + "\t\"group\": \"%s\",\n" + "\t\"method\": \"%s\",\n" + "\t\"options\": \"", + web_client_api_request_v1_data_group_to_string(group), + weights_method_to_string(method) + ); + + web_client_api_request_v1_data_options_to_string(wb, options); +} + +static size_t registered_results_to_json_charts(DICTIONARY *results, BUFFER *wb, + long long after, long long before, + long long baseline_after, long long baseline_before, + long points, WEIGHTS_METHOD method, + RRDR_GROUPING group, RRDR_OPTIONS options, uint32_t shifts, + size_t examined_dimensions, usec_t duration, + WEIGHTS_STATS *stats) { + + results_header_to_json(results, wb, after, before, baseline_after, baseline_before, + points, method, group, options, shifts, examined_dimensions, duration, stats); + + buffer_strcat(wb, "\",\n\t\"correlated_charts\": {\n"); + + size_t charts = 0, chart_dims = 0, total_dimensions = 0; + struct register_result *t; + RRDSET *last_st = NULL; // never access this - we use it only for comparison + dfe_start_read(results, t) { + if(!last_st || t->st != last_st) { + last_st = t->st; + + if(charts) buffer_strcat(wb, "\n\t\t\t}\n\t\t},\n"); + buffer_strcat(wb, "\t\t\""); + buffer_strcat(wb, t->chart_id); + buffer_strcat(wb, "\": {\n"); + buffer_strcat(wb, "\t\t\t\"context\": \""); + buffer_strcat(wb, t->context); + buffer_strcat(wb, "\",\n\t\t\t\"dimensions\": {\n"); + charts++; + chart_dims = 0; + } + if (chart_dims) buffer_sprintf(wb, ",\n"); + buffer_sprintf(wb, "\t\t\t\t\"%s\": " NETDATA_DOUBLE_FORMAT, t->dim_name, t->value); + chart_dims++; + total_dimensions++; + } + dfe_done(t); + + // close dimensions and chart + if (total_dimensions) + buffer_strcat(wb, "\n\t\t\t}\n\t\t}\n"); + + // close correlated_charts + buffer_sprintf(wb, "\t},\n" + "\t\"correlated_dimensions\": %zu,\n" + "\t\"total_dimensions_count\": %zu\n" + "}\n", + total_dimensions, + examined_dimensions + ); + + return total_dimensions; +} + +static size_t registered_results_to_json_contexts(DICTIONARY *results, BUFFER *wb, + long long after, long long before, + long long baseline_after, long long baseline_before, + long points, WEIGHTS_METHOD method, + RRDR_GROUPING group, RRDR_OPTIONS options, uint32_t shifts, + size_t examined_dimensions, usec_t duration, + WEIGHTS_STATS *stats) { + + results_header_to_json(results, wb, after, before, baseline_after, baseline_before, + points, method, group, options, shifts, examined_dimensions, duration, stats); + + DICTIONARY *context_results = dictionary_create( + DICTIONARY_FLAG_SINGLE_THREADED + |DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE + |DICTIONARY_FLAG_NAME_LINK_DONT_CLONE + |DICTIONARY_FLAG_DONT_OVERWRITE_VALUE + ); + + struct register_result *t; + dfe_start_read(results, t) { + struct register_result *tc = dictionary_set(context_results, t->context, t, sizeof(*t)); + if(tc == t) + t->next = NULL; + else { + t->next = tc->next; + tc->next = t; + } + } + dfe_done(t); + + buffer_strcat(wb, "\",\n\t\"contexts\": {\n"); + + size_t contexts = 0, total_dimensions = 0, charts = 0, context_dims = 0, chart_dims = 0; + NETDATA_DOUBLE contexts_total_weight = 0.0, charts_total_weight = 0.0; + RRDSET *last_st = NULL; // never access this - we use it only for comparison + dfe_start_read(context_results, t) { + + if(contexts) + buffer_sprintf(wb, "\n\t\t\t\t\t},\n\t\t\t\t\t\"weight\":" NETDATA_DOUBLE_FORMAT "\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"weight\":" NETDATA_DOUBLE_FORMAT "\n\t\t},\n", charts_total_weight / chart_dims, contexts_total_weight / context_dims); + + contexts++; + context_dims = 0; + contexts_total_weight = 0.0; + + buffer_strcat(wb, "\t\t\""); + buffer_strcat(wb, t->context); + buffer_strcat(wb, "\": {\n\t\t\t\"charts\":{\n"); + + charts = 0; + chart_dims = 0; + struct register_result *tt; + for(tt = t; tt ; tt = tt->next) { + if(!last_st || tt->st != last_st) { + last_st = tt->st; + + if(charts) + buffer_sprintf(wb, "\n\t\t\t\t\t},\n\t\t\t\t\t\"weight\":" NETDATA_DOUBLE_FORMAT "\n\t\t\t\t},\n", charts_total_weight / chart_dims); + + buffer_strcat(wb, "\t\t\t\t\""); + buffer_strcat(wb, tt->chart_id); + buffer_strcat(wb, "\": {\n"); + buffer_strcat(wb, "\t\t\t\t\t\"dimensions\": {\n"); + charts++; + chart_dims = 0; + charts_total_weight = 0.0; + } + + if (chart_dims) buffer_sprintf(wb, ",\n"); + buffer_sprintf(wb, "\t\t\t\t\t\t\"%s\": " NETDATA_DOUBLE_FORMAT, tt->dim_name, tt->value); + charts_total_weight += tt->value; + contexts_total_weight += tt->value; + chart_dims++; + context_dims++; + total_dimensions++; + } + } + dfe_done(t); + + dictionary_destroy(context_results); + + // close dimensions and chart + if (total_dimensions) + buffer_sprintf(wb, "\n\t\t\t\t\t},\n\t\t\t\t\t\"weight\":" NETDATA_DOUBLE_FORMAT "\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"weight\":" NETDATA_DOUBLE_FORMAT "\n\t\t}\n", charts_total_weight / chart_dims, contexts_total_weight / context_dims); + + // close correlated_charts + buffer_sprintf(wb, "\t},\n" + "\t\"weighted_dimensions\": %zu,\n" + "\t\"total_dimensions_count\": %zu\n" + "}\n", + total_dimensions, + examined_dimensions + ); + + return total_dimensions; +} + +// ---------------------------------------------------------------------------- +// KS2 algorithm functions + +typedef long int DIFFS_NUMBERS; +#define DOUBLE_TO_INT_MULTIPLIER 100000 + +static inline int binary_search_bigger_than(const DIFFS_NUMBERS arr[], int left, int size, DIFFS_NUMBERS K) { + // binary search to find the index the smallest index + // of the first value in the array that is greater than K + + int right = size; + while(left < right) { + int middle = (int)(((unsigned int)(left + right)) >> 1); + + if(arr[middle] > K) + right = middle; + + else + left = middle + 1; + } + + return left; +} + +int compare_diffs(const void *left, const void *right) { + DIFFS_NUMBERS lt = *(DIFFS_NUMBERS *)left; + DIFFS_NUMBERS rt = *(DIFFS_NUMBERS *)right; + + // https://stackoverflow.com/a/3886497/1114110 + return (lt > rt) - (lt < rt); +} + +static size_t calculate_pairs_diff(DIFFS_NUMBERS *diffs, NETDATA_DOUBLE *arr, size_t size) { + NETDATA_DOUBLE *last = &arr[size - 1]; + size_t added = 0; + + while(last > arr) { + NETDATA_DOUBLE second = *last--; + NETDATA_DOUBLE first = *last; + *diffs++ = (DIFFS_NUMBERS)((first - second) * (NETDATA_DOUBLE)DOUBLE_TO_INT_MULTIPLIER); + added++; + } + + return added; +} + +static double ks_2samp(DIFFS_NUMBERS baseline_diffs[], int base_size, DIFFS_NUMBERS highlight_diffs[], int high_size, uint32_t base_shifts) { + + qsort(baseline_diffs, base_size, sizeof(DIFFS_NUMBERS), compare_diffs); + qsort(highlight_diffs, high_size, sizeof(DIFFS_NUMBERS), compare_diffs); + + // Now we should be calculating this: + // + // For each number in the diffs arrays, we should find the index of the + // number bigger than them in both arrays and calculate the % of this index + // vs the total array size. Once we have the 2 percentages, we should find + // the min and max across the delta of all of them. + // + // It should look like this: + // + // base_pcent = binary_search_bigger_than(...) / base_size; + // high_pcent = binary_search_bigger_than(...) / high_size; + // delta = base_pcent - high_pcent; + // if(delta < min) min = delta; + // if(delta > max) max = delta; + // + // This would require a lot of multiplications and divisions. + // + // To speed it up, we do the binary search to find the index of each number + // but then we divide the base index by the power of two number (shifts) it + // is bigger than high index. So the 2 indexes are now comparable. + // We also keep track of the original indexes with min and max, to properly + // calculate their percentages once the loops finish. + + + // initialize min and max using the first number of baseline_diffs + DIFFS_NUMBERS K = baseline_diffs[0]; + int base_idx = binary_search_bigger_than(baseline_diffs, 1, base_size, K); + int high_idx = binary_search_bigger_than(highlight_diffs, 0, high_size, K); + int delta = base_idx - (high_idx << base_shifts); + int min = delta, max = delta; + int base_min_idx = base_idx; + int base_max_idx = base_idx; + int high_min_idx = high_idx; + int high_max_idx = high_idx; + + // do the baseline_diffs starting from 1 (we did position 0 above) + for(int i = 1; i < base_size; i++) { + K = baseline_diffs[i]; + base_idx = binary_search_bigger_than(baseline_diffs, i + 1, base_size, K); // starting from i, since data1 is sorted + high_idx = binary_search_bigger_than(highlight_diffs, 0, high_size, K); + + delta = base_idx - (high_idx << base_shifts); + if(delta < min) { + min = delta; + base_min_idx = base_idx; + high_min_idx = high_idx; + } + else if(delta > max) { + max = delta; + base_max_idx = base_idx; + high_max_idx = high_idx; + } + } + + // do the highlight_diffs starting from 0 + for(int i = 0; i < high_size; i++) { + K = highlight_diffs[i]; + base_idx = binary_search_bigger_than(baseline_diffs, 0, base_size, K); + high_idx = binary_search_bigger_than(highlight_diffs, i + 1, high_size, K); // starting from i, since data2 is sorted + + delta = base_idx - (high_idx << base_shifts); + if(delta < min) { + min = delta; + base_min_idx = base_idx; + high_min_idx = high_idx; + } + else if(delta > max) { + max = delta; + base_max_idx = base_idx; + high_max_idx = high_idx; + } + } + + // now we have the min, max and their indexes + // properly calculate min and max as dmin and dmax + double dbase_size = (double)base_size; + double dhigh_size = (double)high_size; + double dmin = ((double)base_min_idx / dbase_size) - ((double)high_min_idx / dhigh_size); + double dmax = ((double)base_max_idx / dbase_size) - ((double)high_max_idx / dhigh_size); + + dmin = -dmin; + if(islessequal(dmin, 0.0)) dmin = 0.0; + else if(isgreaterequal(dmin, 1.0)) dmin = 1.0; + + double d; + if(isgreaterequal(dmin, dmax)) d = dmin; + else d = dmax; + + double en = round(dbase_size * dhigh_size / (dbase_size + dhigh_size)); + + // under these conditions, KSfbar() crashes + if(unlikely(isnan(en) || isinf(en) || en == 0.0 || isnan(d) || isinf(d))) + return NAN; + + return KSfbar((int)en, d); +} + +static double kstwo( + NETDATA_DOUBLE baseline[], int baseline_points, + NETDATA_DOUBLE highlight[], int highlight_points, uint32_t base_shifts) { + // -1 in size, since the calculate_pairs_diffs() returns one less point + DIFFS_NUMBERS baseline_diffs[baseline_points - 1]; + DIFFS_NUMBERS highlight_diffs[highlight_points - 1]; + + int base_size = (int)calculate_pairs_diff(baseline_diffs, baseline, baseline_points); + int high_size = (int)calculate_pairs_diff(highlight_diffs, highlight, highlight_points); + + if(unlikely(!base_size || !high_size)) + return NAN; + + if(unlikely(base_size != baseline_points - 1 || high_size != highlight_points - 1)) { + error("Metric correlations: internal error - calculate_pairs_diff() returns the wrong number of entries"); + return NAN; + } + + return ks_2samp(baseline_diffs, base_size, highlight_diffs, high_size, base_shifts); +} + + +static int rrdset_metric_correlations_ks2(RRDSET *st, DICTIONARY *results, + long long baseline_after, long long baseline_before, + long long after, long long before, + long long points, RRDR_OPTIONS options, + RRDR_GROUPING group, const char *group_options, int tier, + uint32_t shifts, int timeout, + WEIGHTS_STATS *stats, bool register_zero) { + options |= RRDR_OPTION_NATURAL_POINTS; + + long group_time = 0; + struct context_param *context_param_list = NULL; + + int examined_dimensions = 0; + + RRDR *high_rrdr = NULL; + RRDR *base_rrdr = NULL; + + // get first the highlight to find the number of points available + stats->db_queries++; + usec_t started_usec = now_realtime_usec(); + ONEWAYALLOC *owa = onewayalloc_create(0); + high_rrdr = rrd2rrdr(owa, st, points, + after, before, group, + group_time, options, NULL, context_param_list, group_options, + timeout, tier); + if(!high_rrdr) { + info("Metric correlations: rrd2rrdr() failed for the highlighted window on chart '%s'.", st->name); + goto cleanup; + } + + for(int i = 0; i < storage_tiers ;i++) + stats->db_points_per_tier[i] += high_rrdr->internal.tier_points_read[i]; + + stats->db_points += high_rrdr->internal.db_points_read; + stats->result_points += high_rrdr->internal.result_points_generated; + if(!high_rrdr->d) { + info("Metric correlations: rrd2rrdr() did not return any dimensions on chart '%s'.", st->name); + goto cleanup; + } + if(high_rrdr->result_options & RRDR_RESULT_OPTION_CANCEL) { + info("Metric correlations: rrd2rrdr() on highlighted window timed out '%s'.", st->name); + goto cleanup; + } + int high_points = rrdr_rows(high_rrdr); + + usec_t now_usec = now_realtime_usec(); + if(now_usec - started_usec > timeout * USEC_PER_MS) + goto cleanup; + + // get the baseline, requesting the same number of points as the highlight + stats->db_queries++; + base_rrdr = rrd2rrdr(owa, st,high_points << shifts, + baseline_after, baseline_before, group, + group_time, options, NULL, context_param_list, group_options, + (int)(timeout - ((now_usec - started_usec) / USEC_PER_MS)), tier); + if(!base_rrdr) { + info("Metric correlations: rrd2rrdr() failed for the baseline window on chart '%s'.", st->name); + goto cleanup; + } + + for(int i = 0; i < storage_tiers ;i++) + stats->db_points_per_tier[i] += base_rrdr->internal.tier_points_read[i]; + + stats->db_points += base_rrdr->internal.db_points_read; + stats->result_points += base_rrdr->internal.result_points_generated; + if(!base_rrdr->d) { + info("Metric correlations: rrd2rrdr() did not return any dimensions on chart '%s'.", st->name); + goto cleanup; + } + if (base_rrdr->d != high_rrdr->d) { + info("Cannot generate metric correlations for chart '%s' when the baseline and the highlight have different number of dimensions.", st->name); + goto cleanup; + } + if(base_rrdr->result_options & RRDR_RESULT_OPTION_CANCEL) { + info("Metric correlations: rrd2rrdr() on baseline window timed out '%s'.", st->name); + goto cleanup; + } + int base_points = rrdr_rows(base_rrdr); + + now_usec = now_realtime_usec(); + if(now_usec - started_usec > timeout * USEC_PER_MS) + goto cleanup; + + // we need at least 2 points to do the job + if(base_points < 2 || high_points < 2) + goto cleanup; + + // for each dimension + RRDDIM *d; + int i; + for(i = 0, d = base_rrdr->st->dimensions ; d && i < base_rrdr->d; i++, d = d->next) { + + // skip the not evaluated ones + if(unlikely(base_rrdr->od[i] & RRDR_DIMENSION_HIDDEN) || (high_rrdr->od[i] & RRDR_DIMENSION_HIDDEN)) + continue; + + examined_dimensions++; + + // skip the dimensions that are just zero for both the baseline and the highlight + if(unlikely(!(base_rrdr->od[i] & RRDR_DIMENSION_NONZERO) && !(high_rrdr->od[i] & RRDR_DIMENSION_NONZERO))) + continue; + + // copy the baseline points of the dimension to a contiguous array + // there is no need to check for empty values, since empty are already zero + NETDATA_DOUBLE baseline[base_points]; + for(int c = 0; c < base_points; c++) + baseline[c] = base_rrdr->v[ c * base_rrdr->d + i ]; + + // copy the highlight points of the dimension to a contiguous array + // there is no need to check for empty values, since empty values are already zero + // https://github.com/netdata/netdata/blob/6e3144683a73a2024d51425b20ecfd569034c858/web/api/queries/average/average.c#L41-L43 + NETDATA_DOUBLE highlight[high_points]; + for(int c = 0; c < high_points; c++) + highlight[c] = high_rrdr->v[ c * high_rrdr->d + i ]; + + stats->binary_searches += 2 * (base_points - 1) + 2 * (high_points - 1); + + double prob = kstwo(baseline, base_points, highlight, high_points, shifts); + if(!isnan(prob) && !isinf(prob)) { + + // these conditions should never happen, but still let's check + if(unlikely(prob < 0.0)) { + error("Metric correlations: kstwo() returned a negative number: %f", prob); + prob = -prob; + } + if(unlikely(prob > 1.0)) { + error("Metric correlations: kstwo() returned a number above 1.0: %f", prob); + prob = 1.0; + } + + // to spread the results evenly, 0.0 needs to be the less correlated and 1.0 the most correlated + // so we flip the result of kstwo() + register_result(results, base_rrdr->st, d, 1.0 - prob, RESULT_IS_BASE_HIGH_RATIO, stats, register_zero); + } + } + +cleanup: + rrdr_free(owa, high_rrdr); + rrdr_free(owa, base_rrdr); + onewayalloc_destroy(owa); + return examined_dimensions; +} + +// ---------------------------------------------------------------------------- +// VOLUME algorithm functions + +static int rrdset_metric_correlations_volume(RRDSET *st, DICTIONARY *results, + long long baseline_after, long long baseline_before, + long long after, long long before, + RRDR_OPTIONS options, RRDR_GROUPING group, const char *group_options, + int tier, int timeout, + WEIGHTS_STATS *stats, bool register_zero) { + + options |= RRDR_OPTION_MATCH_IDS | RRDR_OPTION_ABSOLUTE | RRDR_OPTION_NATURAL_POINTS; + long group_time = 0; + + int examined_dimensions = 0; + int ret, value_is_null; + usec_t started_usec = now_realtime_usec(); + + RRDDIM *d; + for(d = st->dimensions; d ; d = d->next) { + usec_t now_usec = now_realtime_usec(); + if(now_usec - started_usec > timeout * USEC_PER_MS) + return examined_dimensions; + + // we count how many metrics we evaluated + examined_dimensions++; + + // there is no point to pass a timeout to these queries + // since the query engine checks for a timeout between + // dimensions, and we query a single dimension at a time. + + stats->db_queries++; + NETDATA_DOUBLE baseline_average = NAN; + NETDATA_DOUBLE base_anomaly_rate = 0; + value_is_null = 1; + ret = rrdset2value_api_v1(st, NULL, &baseline_average, d->id, 1, + baseline_after, baseline_before, + group, group_options, group_time, options, + NULL, NULL, + &stats->db_points, stats->db_points_per_tier, + &stats->result_points, + &value_is_null, &base_anomaly_rate, 0, tier); + + if(ret != HTTP_RESP_OK || value_is_null || !netdata_double_isnumber(baseline_average)) { + // this means no data for the baseline window, but we may have data for the highlighted one - assume zero + baseline_average = 0.0; + } + + stats->db_queries++; + NETDATA_DOUBLE highlight_average = NAN; + NETDATA_DOUBLE high_anomaly_rate = 0; + value_is_null = 1; + ret = rrdset2value_api_v1(st, NULL, &highlight_average, d->id, 1, + after, before, + group, group_options, group_time, options, + NULL, NULL, + &stats->db_points, stats->db_points_per_tier, + &stats->result_points, + &value_is_null, &high_anomaly_rate, 0, tier); + + if(ret != HTTP_RESP_OK || value_is_null || !netdata_double_isnumber(highlight_average)) { + // this means no data for the highlighted duration - so skip it + continue; + } + + if(baseline_average == highlight_average) { + // they are the same - let's move on + continue; + } + + stats->db_queries++; + NETDATA_DOUBLE highlight_countif = NAN; + value_is_null = 1; + + char highlighted_countif_options[50 + 1]; + snprintfz(highlighted_countif_options, 50, "%s" NETDATA_DOUBLE_FORMAT, highlight_average < baseline_average ? "<":">", baseline_average); + + ret = rrdset2value_api_v1(st, NULL, &highlight_countif, d->id, 1, + after, before, + RRDR_GROUPING_COUNTIF,highlighted_countif_options, + group_time, options, + NULL, NULL, + &stats->db_points, stats->db_points_per_tier, + &stats->result_points, + &value_is_null, NULL, 0, tier); + + if(ret != HTTP_RESP_OK || value_is_null || !netdata_double_isnumber(highlight_countif)) { + info("MC: highlighted countif query failed, but highlighted average worked - strange..."); + continue; + } + + // this represents the percentage of time + // the highlighted window was above/below the baseline window + // (above or below depending on their averages) + highlight_countif = highlight_countif / 100.0; // countif returns 0 - 100.0 + + RESULT_FLAGS flags; + NETDATA_DOUBLE pcent = NAN; + if(isgreater(baseline_average, 0.0) || isless(baseline_average, 0.0)) { + flags = RESULT_IS_BASE_HIGH_RATIO; + pcent = (highlight_average - baseline_average) / baseline_average * highlight_countif; + } + else { + flags = RESULT_IS_PERCENTAGE_OF_TIME; + pcent = highlight_countif; + } + + register_result(results, st, d, pcent, flags, stats, register_zero); + } + + return examined_dimensions; +} + +// ---------------------------------------------------------------------------- +// ANOMALY RATE algorithm functions + +static int rrdset_weights_anomaly_rate(RRDSET *st, DICTIONARY *results, + long long after, long long before, + RRDR_OPTIONS options, RRDR_GROUPING group, const char *group_options, + int tier, int timeout, + WEIGHTS_STATS *stats, bool register_zero) { + + options |= RRDR_OPTION_MATCH_IDS | RRDR_OPTION_ANOMALY_BIT | RRDR_OPTION_NATURAL_POINTS; + long group_time = 0; + + int examined_dimensions = 0; + int ret, value_is_null; + usec_t started_usec = now_realtime_usec(); + + RRDDIM *d; + for(d = st->dimensions; d ; d = d->next) { + usec_t now_usec = now_realtime_usec(); + if(now_usec - started_usec > timeout * USEC_PER_MS) + return examined_dimensions; + + // we count how many metrics we evaluated + examined_dimensions++; + + // there is no point to pass a timeout to these queries + // since the query engine checks for a timeout between + // dimensions, and we query a single dimension at a time. + + stats->db_queries++; + NETDATA_DOUBLE average = NAN; + NETDATA_DOUBLE anomaly_rate = 0; + value_is_null = 1; + ret = rrdset2value_api_v1(st, NULL, &average, d->id, 1, + after, before, + group, group_options, group_time, options, + NULL, NULL, + &stats->db_points, stats->db_points_per_tier, + &stats->result_points, + &value_is_null, &anomaly_rate, 0, tier); + + if(ret == HTTP_RESP_OK || !value_is_null || netdata_double_isnumber(average)) + register_result(results, st, d, average, 0, stats, register_zero); + } + + return examined_dimensions; +} + +// ---------------------------------------------------------------------------- + +int compare_netdata_doubles(const void *left, const void *right) { + NETDATA_DOUBLE lt = *(NETDATA_DOUBLE *)left; + NETDATA_DOUBLE rt = *(NETDATA_DOUBLE *)right; + + // https://stackoverflow.com/a/3886497/1114110 + return (lt > rt) - (lt < rt); +} + +static inline int binary_search_bigger_than_netdata_double(const NETDATA_DOUBLE arr[], int left, int size, NETDATA_DOUBLE K) { + // binary search to find the index the smallest index + // of the first value in the array that is greater than K + + int right = size; + while(left < right) { + int middle = (int)(((unsigned int)(left + right)) >> 1); + + if(arr[middle] > K) + right = middle; + + else + left = middle + 1; + } + + return left; +} + +// ---------------------------------------------------------------------------- +// spread the results evenly according to their value + +static size_t spread_results_evenly(DICTIONARY *results, WEIGHTS_STATS *stats) { + struct register_result *t; + + // count the dimensions + size_t dimensions = dictionary_stats_entries(results); + if(!dimensions) return 0; + + if(stats->max_base_high_ratio == 0.0) + stats->max_base_high_ratio = 1.0; + + // create an array of the right size and copy all the values in it + NETDATA_DOUBLE slots[dimensions]; + dimensions = 0; + dfe_start_read(results, t) { + if(t->flags & (RESULT_IS_PERCENTAGE_OF_TIME)) + t->value = t->value * stats->max_base_high_ratio; + + slots[dimensions++] = t->value; + } + dfe_done(t); + + // sort the array with the values of all dimensions + qsort(slots, dimensions, sizeof(NETDATA_DOUBLE), compare_netdata_doubles); + + // skip the duplicates in the sorted array + NETDATA_DOUBLE last_value = NAN; + size_t unique_values = 0; + for(size_t i = 0; i < dimensions ;i++) { + if(likely(slots[i] != last_value)) + slots[unique_values++] = last_value = slots[i]; + } + + // this cannot happen, but coverity thinks otherwise... + if(!unique_values) + unique_values = dimensions; + + // calculate the weight of each slot, using the number of unique values + NETDATA_DOUBLE slot_weight = 1.0 / (NETDATA_DOUBLE)unique_values; + + dfe_start_read(results, t) { + int slot = binary_search_bigger_than_netdata_double(slots, 0, (int)unique_values, t->value); + NETDATA_DOUBLE v = slot * slot_weight; + if(unlikely(v > 1.0)) v = 1.0; + v = 1.0 - v; + t->value = v; + } + dfe_done(t); + + return dimensions; +} + +// ---------------------------------------------------------------------------- +// The main function + +int web_api_v1_weights(RRDHOST *host, BUFFER *wb, WEIGHTS_METHOD method, WEIGHTS_FORMAT format, + RRDR_GROUPING group, const char *group_options, + long long baseline_after, long long baseline_before, + long long after, long long before, + long long points, RRDR_OPTIONS options, SIMPLE_PATTERN *contexts, int tier, int timeout) { + WEIGHTS_STATS stats = {}; + + DICTIONARY *results = register_result_init(); + DICTIONARY *charts = dictionary_create(DICTIONARY_FLAG_SINGLE_THREADED|DICTIONARY_FLAG_VALUE_LINK_DONT_CLONE);; + char *error = NULL; + int resp = HTTP_RESP_OK; + + // if the user didn't give a timeout + // assume 60 seconds + if(!timeout) + timeout = 60 * MSEC_PER_SEC; + + // if the timeout is less than 1 second + // make it at least 1 second + if(timeout < (long)(1 * MSEC_PER_SEC)) + timeout = 1 * MSEC_PER_SEC; + + usec_t timeout_usec = timeout * USEC_PER_MS; + usec_t started_usec = now_realtime_usec(); + + if(!rrdr_relative_window_to_absolute(&after, &before)) + buffer_no_cacheable(wb); + + if (before <= after) { + resp = HTTP_RESP_BAD_REQUEST; + error = "Invalid selected time-range."; + goto cleanup; + } + + uint32_t shifts = 0; + if(method == WEIGHTS_METHOD_MC_KS2 || method == WEIGHTS_METHOD_MC_VOLUME) { + if(!points) points = 500; + + if(baseline_before <= API_RELATIVE_TIME_MAX) + baseline_before += after; + + rrdr_relative_window_to_absolute(&baseline_after, &baseline_before); + + if (baseline_before <= baseline_after) { + resp = HTTP_RESP_BAD_REQUEST; + error = "Invalid baseline time-range."; + goto cleanup; + } + + // baseline should be a power of two multiple of highlight + long long base_delta = baseline_before - baseline_after; + long long high_delta = before - after; + uint32_t multiplier = (uint32_t)round((double)base_delta / (double)high_delta); + + // check if the multiplier is a power of two + // https://stackoverflow.com/a/600306/1114110 + if((multiplier & (multiplier - 1)) != 0) { + // it is not power of two + // let's find the closest power of two + // https://stackoverflow.com/a/466242/1114110 + multiplier--; + multiplier |= multiplier >> 1; + multiplier |= multiplier >> 2; + multiplier |= multiplier >> 4; + multiplier |= multiplier >> 8; + multiplier |= multiplier >> 16; + multiplier++; + } + + // convert the multiplier to the number of shifts + // we need to do, to divide baseline numbers to match + // the highlight ones + while(multiplier > 1) { + shifts++; + multiplier = multiplier >> 1; + } + + // if the baseline size will not comply to MAX_POINTS + // lower the window of the baseline + while(shifts && (points << shifts) > MAX_POINTS) + shifts--; + + // if the baseline size still does not comply to MAX_POINTS + // lower the resolution of the highlight and the baseline + while((points << shifts) > MAX_POINTS) + points = points >> 1; + + if(points < 15) { + resp = HTTP_RESP_BAD_REQUEST; + error = "Too few points available, at least 15 are needed."; + goto cleanup; + } + + // adjust the baseline to be multiplier times bigger than the highlight + baseline_after = baseline_before - (high_delta << shifts); + } + + // dont lock here and wait for results + // get the charts and run mc after + RRDSET *st; + rrdhost_rdlock(host); + rrdset_foreach_read(st, host) { + if (rrdset_is_available_for_viewers(st)) { + if(!contexts || simple_pattern_matches(contexts, st->context)) + dictionary_set(charts, st->name, NULL, 0); + } + } + rrdhost_unlock(host); + + size_t examined_dimensions = 0; + void *ptr; + + bool register_zero = true; + if(options & RRDR_OPTION_NONZERO) { + register_zero = false; + options &= ~RRDR_OPTION_NONZERO; + } + + // for every chart in the dictionary + dfe_start_read(charts, ptr) { + usec_t now_usec = now_realtime_usec(); + if(now_usec - started_usec > timeout_usec) { + error = "timed out"; + resp = HTTP_RESP_GATEWAY_TIMEOUT; + goto cleanup; + } + + st = rrdset_find_byname(host, ptr_name); + if(!st) continue; + + rrdset_rdlock(st); + + switch(method) { + case WEIGHTS_METHOD_ANOMALY_RATE: + options |= RRDR_OPTION_ANOMALY_BIT; + points = 1; + examined_dimensions += rrdset_weights_anomaly_rate(st, results, + after, before, + options, group, group_options, tier, + (int)(timeout - ((now_usec - started_usec) / USEC_PER_MS)), + &stats, register_zero); + break; + + case WEIGHTS_METHOD_MC_VOLUME: + points = 1; + examined_dimensions += rrdset_metric_correlations_volume(st, results, + baseline_after, baseline_before, + after, before, + options, group, group_options, tier, + (int)(timeout - ((now_usec - started_usec) / USEC_PER_MS)), + &stats, register_zero); + break; + + default: + case WEIGHTS_METHOD_MC_KS2: + examined_dimensions += rrdset_metric_correlations_ks2(st, results, + baseline_after, baseline_before, + after, before, + points, options, group, group_options, tier, shifts, + (int)(timeout - ((now_usec - started_usec) / USEC_PER_MS)), + &stats, register_zero); + break; + } + + rrdset_unlock(st); + } + dfe_done(ptr); + + if(!register_zero) + options |= RRDR_OPTION_NONZERO; + + if(!(options & RRDR_OPTION_RETURN_RAW)) + spread_results_evenly(results, &stats); + + usec_t ended_usec = now_realtime_usec(); + + // generate the json output we need + buffer_flush(wb); + + size_t added_dimensions = 0; + switch(format) { + case WEIGHTS_FORMAT_CHARTS: + added_dimensions = registered_results_to_json_charts(results, wb, + after, before, + baseline_after, baseline_before, + points, method, group, options, shifts, + examined_dimensions, + ended_usec - started_usec, &stats); + break; + + default: + case WEIGHTS_FORMAT_CONTEXTS: + added_dimensions = registered_results_to_json_contexts(results, wb, + after, before, + baseline_after, baseline_before, + points, method, group, options, shifts, + examined_dimensions, + ended_usec - started_usec, &stats); + break; + } + + if(!added_dimensions) { + error = "no results produced."; + resp = HTTP_RESP_NOT_FOUND; + } + +cleanup: + if(charts) dictionary_destroy(charts); + if(results) register_result_destroy(results); + + if(error) { + buffer_flush(wb); + buffer_sprintf(wb, "{\"error\": \"%s\" }", error); + } + + return resp; +} + +// ---------------------------------------------------------------------------- +// unittest + +/* + +Unit tests against the output of this: + +https://github.com/scipy/scipy/blob/4cf21e753cf937d1c6c2d2a0e372fbc1dbbeea81/scipy/stats/_stats_py.py#L7275-L7449 + +import matplotlib.pyplot as plt +import pandas as pd +import numpy as np +import scipy as sp +from scipy import stats + +data1 = np.array([ 1111, -2222, 33, 100, 100, 15555, -1, 19999, 888, 755, -1, -730 ]) +data2 = np.array([365, -123, 0]) +data1 = np.sort(data1) +data2 = np.sort(data2) +n1 = data1.shape[0] +n2 = data2.shape[0] +data_all = np.concatenate([data1, data2]) +cdf1 = np.searchsorted(data1, data_all, side='right') / n1 +cdf2 = np.searchsorted(data2, data_all, side='right') / n2 +print(data_all) +print("\ndata1", data1, cdf1) +print("\ndata2", data2, cdf2) +cddiffs = cdf1 - cdf2 +print("\ncddiffs", cddiffs) +minS = np.clip(-np.min(cddiffs), 0, 1) +maxS = np.max(cddiffs) +print("\nmin", minS) +print("max", maxS) +m, n = sorted([float(n1), float(n2)], reverse=True) +en = m * n / (m + n) +d = max(minS, maxS) +prob = stats.distributions.kstwo.sf(d, np.round(en)) +print("\nprob", prob) + +*/ + +static int double_expect(double v, const char *str, const char *descr) { + char buf[100 + 1]; + snprintfz(buf, 100, "%0.6f", v); + int ret = strcmp(buf, str) ? 1 : 0; + + fprintf(stderr, "%s %s, expected %s, got %s\n", ret?"FAILED":"OK", descr, str, buf); + return ret; +} + +static int mc_unittest1(void) { + int bs = 3, hs = 3; + DIFFS_NUMBERS base[3] = { 1, 2, 3 }; + DIFFS_NUMBERS high[3] = { 3, 4, 6 }; + + double prob = ks_2samp(base, bs, high, hs, 0); + return double_expect(prob, "0.222222", "3x3"); +} + +static int mc_unittest2(void) { + int bs = 6, hs = 3; + DIFFS_NUMBERS base[6] = { 1, 2, 3, 10, 10, 15 }; + DIFFS_NUMBERS high[3] = { 3, 4, 6 }; + + double prob = ks_2samp(base, bs, high, hs, 1); + return double_expect(prob, "0.500000", "6x3"); +} + +static int mc_unittest3(void) { + int bs = 12, hs = 3; + DIFFS_NUMBERS base[12] = { 1, 2, 3, 10, 10, 15, 111, 19999, 8, 55, -1, -73 }; + DIFFS_NUMBERS high[3] = { 3, 4, 6 }; + + double prob = ks_2samp(base, bs, high, hs, 2); + return double_expect(prob, "0.347222", "12x3"); +} + +static int mc_unittest4(void) { + int bs = 12, hs = 3; + DIFFS_NUMBERS base[12] = { 1111, -2222, 33, 100, 100, 15555, -1, 19999, 888, 755, -1, -730 }; + DIFFS_NUMBERS high[3] = { 365, -123, 0 }; + + double prob = ks_2samp(base, bs, high, hs, 2); + return double_expect(prob, "0.777778", "12x3"); +} + +int mc_unittest(void) { + int errors = 0; + + errors += mc_unittest1(); + errors += mc_unittest2(); + errors += mc_unittest3(); + errors += mc_unittest4(); + + return errors; +} + diff --git a/web/api/queries/weights.h b/web/api/queries/weights.h new file mode 100644 index 000000000..f88a134f2 --- /dev/null +++ b/web/api/queries/weights.h @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +#ifndef NETDATA_API_WEIGHTS_H +#define NETDATA_API_WEIGHTS_H 1 + +#include "query.h" + +typedef enum { + WEIGHTS_METHOD_MC_KS2 = 1, + WEIGHTS_METHOD_MC_VOLUME = 2, + WEIGHTS_METHOD_ANOMALY_RATE = 3, +} WEIGHTS_METHOD; + +typedef enum { + WEIGHTS_FORMAT_CHARTS = 1, + WEIGHTS_FORMAT_CONTEXTS = 2, +} WEIGHTS_FORMAT; + +extern int enable_metric_correlations; +extern int metric_correlations_version; +extern WEIGHTS_METHOD default_metric_correlations_method; + +extern int web_api_v1_weights (RRDHOST *host, BUFFER *wb, WEIGHTS_METHOD method, WEIGHTS_FORMAT format, + RRDR_GROUPING group, const char *group_options, + long long baseline_after, long long baseline_before, + long long after, long long before, + long long points, RRDR_OPTIONS options, SIMPLE_PATTERN *contexts, int tier, int timeout); + +extern WEIGHTS_METHOD weights_string_to_method(const char *method); +extern const char *weights_method_to_string(WEIGHTS_METHOD method); +extern int mc_unittest(void); + +#endif //NETDATA_API_WEIGHTS_H diff --git a/web/api/web_api_v1.c b/web/api/web_api_v1.c index cb73f7c02..8bfc617fd 100644 --- a/web/api/web_api_v1.c +++ b/web/api/web_api_v1.c @@ -3,42 +3,45 @@ #include "web_api_v1.h" char *api_secret; -extern int aclk_use_new_cloud_arch; static struct { const char *name; uint32_t hash; RRDR_OPTIONS value; } api_v1_data_options[] = { - { "nonzero" , 0 , RRDR_OPTION_NONZERO} - , {"flip" , 0 , RRDR_OPTION_REVERSED} - , {"reversed" , 0 , RRDR_OPTION_REVERSED} - , {"reverse" , 0 , RRDR_OPTION_REVERSED} - , {"jsonwrap" , 0 , RRDR_OPTION_JSON_WRAP} - , {"min2max" , 0 , RRDR_OPTION_MIN2MAX} - , {"ms" , 0 , RRDR_OPTION_MILLISECONDS} - , {"milliseconds" , 0 , RRDR_OPTION_MILLISECONDS} - , {"abs" , 0 , RRDR_OPTION_ABSOLUTE} - , {"absolute" , 0 , RRDR_OPTION_ABSOLUTE} - , {"absolute_sum" , 0 , RRDR_OPTION_ABSOLUTE} - , {"absolute-sum" , 0 , RRDR_OPTION_ABSOLUTE} - , {"display_absolute", 0 , RRDR_OPTION_DISPLAY_ABS} - , {"display-absolute", 0 , RRDR_OPTION_DISPLAY_ABS} - , {"seconds" , 0 , RRDR_OPTION_SECONDS} - , {"null2zero" , 0 , RRDR_OPTION_NULL2ZERO} - , {"objectrows" , 0 , RRDR_OPTION_OBJECTSROWS} - , {"google_json" , 0 , RRDR_OPTION_GOOGLE_JSON} - , {"google-json" , 0 , RRDR_OPTION_GOOGLE_JSON} - , {"percentage" , 0 , RRDR_OPTION_PERCENTAGE} - , {"unaligned" , 0 , RRDR_OPTION_NOT_ALIGNED} - , {"match_ids" , 0 , RRDR_OPTION_MATCH_IDS} - , {"match-ids" , 0 , RRDR_OPTION_MATCH_IDS} - , {"match_names" , 0 , RRDR_OPTION_MATCH_NAMES} - , {"match-names" , 0 , RRDR_OPTION_MATCH_NAMES} - , {"showcustomvars" , 0 , RRDR_OPTION_CUSTOM_VARS} - , {"allow_past" , 0 , RRDR_OPTION_ALLOW_PAST} - , {"anomaly-bit" , 0 , RRDR_OPTION_ANOMALY_BIT} - , { NULL, 0, 0} + { "nonzero" , 0 , RRDR_OPTION_NONZERO} + , {"flip" , 0 , RRDR_OPTION_REVERSED} + , {"reversed" , 0 , RRDR_OPTION_REVERSED} + , {"reverse" , 0 , RRDR_OPTION_REVERSED} + , {"jsonwrap" , 0 , RRDR_OPTION_JSON_WRAP} + , {"min2max" , 0 , RRDR_OPTION_MIN2MAX} + , {"ms" , 0 , RRDR_OPTION_MILLISECONDS} + , {"milliseconds" , 0 , RRDR_OPTION_MILLISECONDS} + , {"abs" , 0 , RRDR_OPTION_ABSOLUTE} + , {"absolute" , 0 , RRDR_OPTION_ABSOLUTE} + , {"absolute_sum" , 0 , RRDR_OPTION_ABSOLUTE} + , {"absolute-sum" , 0 , RRDR_OPTION_ABSOLUTE} + , {"display_absolute" , 0 , RRDR_OPTION_DISPLAY_ABS} + , {"display-absolute" , 0 , RRDR_OPTION_DISPLAY_ABS} + , {"seconds" , 0 , RRDR_OPTION_SECONDS} + , {"null2zero" , 0 , RRDR_OPTION_NULL2ZERO} + , {"objectrows" , 0 , RRDR_OPTION_OBJECTSROWS} + , {"google_json" , 0 , RRDR_OPTION_GOOGLE_JSON} + , {"google-json" , 0 , RRDR_OPTION_GOOGLE_JSON} + , {"percentage" , 0 , RRDR_OPTION_PERCENTAGE} + , {"unaligned" , 0 , RRDR_OPTION_NOT_ALIGNED} + , {"match_ids" , 0 , RRDR_OPTION_MATCH_IDS} + , {"match-ids" , 0 , RRDR_OPTION_MATCH_IDS} + , {"match_names" , 0 , RRDR_OPTION_MATCH_NAMES} + , {"match-names" , 0 , RRDR_OPTION_MATCH_NAMES} + , {"showcustomvars" , 0 , RRDR_OPTION_CUSTOM_VARS} + , {"anomaly-bit" , 0 , RRDR_OPTION_ANOMALY_BIT} + , {"selected-tier" , 0 , RRDR_OPTION_SELECTED_TIER} + , {"raw" , 0 , RRDR_OPTION_RETURN_RAW} + , {"jw-anomaly-rates" , 0 , RRDR_OPTION_RETURN_JWAR} + , {"natural-points" , 0 , RRDR_OPTION_NATURAL_POINTS} + , {"virtual-points" , 0 , RRDR_OPTION_VIRTUAL_POINTS} + , {NULL , 0 , 0} }; static struct { @@ -162,8 +165,8 @@ void web_client_api_v1_management_init(void) { api_secret = get_mgmt_api_key(); } -inline uint32_t web_client_api_request_v1_data_options(char *o) { - uint32_t ret = 0x00000000; +inline RRDR_OPTIONS web_client_api_request_v1_data_options(char *o) { + RRDR_OPTIONS ret = 0x00000000; char *tok; while(o && *o && (tok = mystrsep(&o, ", |"))) { @@ -182,6 +185,19 @@ inline uint32_t web_client_api_request_v1_data_options(char *o) { return ret; } +void web_client_api_request_v1_data_options_to_string(BUFFER *wb, RRDR_OPTIONS options) { + RRDR_OPTIONS used = 0; // to prevent adding duplicates + int added = 0; + for(int i = 0; api_v1_data_options[i].name ; i++) { + if (unlikely((api_v1_data_options[i].value & options) && !(api_v1_data_options[i].value & used))) { + if(added) buffer_strcat(wb, ","); + buffer_strcat(wb, api_v1_data_options[i].name); + used |= api_v1_data_options[i].value; + added++; + } + } +} + inline uint32_t web_client_api_request_v1_data_format(char *name) { uint32_t hash = simple_hash(name); int i; @@ -358,6 +374,157 @@ inline int web_client_api_request_v1_alarm_variables(RRDHOST *host, struct web_c return web_client_api_request_single_chart(host, w, url, health_api_v1_chart_variables2json); } +static RRDCONTEXT_TO_JSON_OPTIONS rrdcontext_to_json_parse_options(char *o) { + RRDCONTEXT_TO_JSON_OPTIONS options = RRDCONTEXT_OPTION_NONE; + char *tok; + + while(o && *o && (tok = mystrsep(&o, ", |"))) { + if(!*tok) continue; + + if(!strcmp(tok, "full") || !strcmp(tok, "all")) + options |= RRDCONTEXT_OPTIONS_ALL; + else if(!strcmp(tok, "charts") || !strcmp(tok, "instances")) + options |= RRDCONTEXT_OPTION_SHOW_INSTANCES; + else if(!strcmp(tok, "dimensions") || !strcmp(tok, "metrics")) + options |= RRDCONTEXT_OPTION_SHOW_METRICS; + else if(!strcmp(tok, "queue")) + options |= RRDCONTEXT_OPTION_SHOW_QUEUED; + else if(!strcmp(tok, "flags")) + options |= RRDCONTEXT_OPTION_SHOW_FLAGS; + else if(!strcmp(tok, "uuids")) + options |= RRDCONTEXT_OPTION_SHOW_UUIDS; + else if(!strcmp(tok, "deleted")) + options |= RRDCONTEXT_OPTION_SHOW_DELETED; + else if(!strcmp(tok, "labels")) + options |= RRDCONTEXT_OPTION_SHOW_LABELS; + else if(!strcmp(tok, "deepscan")) + options |= RRDCONTEXT_OPTION_DEEPSCAN; + else if(!strcmp(tok, "hidden")) + options |= RRDCONTEXT_OPTION_SHOW_HIDDEN; + } + + return options; +} + +static int web_client_api_request_v1_context(RRDHOST *host, struct web_client *w, char *url) { + char *context = NULL; + RRDCONTEXT_TO_JSON_OPTIONS options = RRDCONTEXT_OPTION_NONE; + time_t after = 0, before = 0; + const char *chart_label_key = NULL, *chart_labels_filter = NULL; + BUFFER *dimensions = NULL; + + buffer_flush(w->response.data); + + while(url) { + char *value = mystrsep(&url, "&"); + if(!value || !*value) continue; + + char *name = mystrsep(&value, "="); + if(!name || !*name) continue; + if(!value || !*value) continue; + + // name and value are now the parameters + // they are not null and not empty + + if(!strcmp(name, "context") || !strcmp(name, "ctx")) context = value; + else if(!strcmp(name, "after")) after = str2l(value); + else if(!strcmp(name, "before")) before = str2l(value); + else if(!strcmp(name, "options")) options = rrdcontext_to_json_parse_options(value); + else if(!strcmp(name, "chart_label_key")) chart_label_key = value; + else if(!strcmp(name, "chart_labels_filter")) chart_labels_filter = value; + else if(!strcmp(name, "dimension") || !strcmp(name, "dim") || !strcmp(name, "dimensions") || !strcmp(name, "dims")) { + if(!dimensions) dimensions = buffer_create(100); + buffer_strcat(dimensions, "|"); + buffer_strcat(dimensions, value); + } + } + + if(!context || !*context) { + buffer_sprintf(w->response.data, "No context is given at the request."); + return HTTP_RESP_BAD_REQUEST; + } + + SIMPLE_PATTERN *chart_label_key_pattern = NULL; + SIMPLE_PATTERN *chart_labels_filter_pattern = NULL; + SIMPLE_PATTERN *chart_dimensions_pattern = NULL; + + if(chart_label_key) + chart_label_key_pattern = simple_pattern_create(chart_label_key, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + + if(chart_labels_filter) + chart_labels_filter_pattern = simple_pattern_create(chart_labels_filter, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + + if(dimensions) { + chart_dimensions_pattern = simple_pattern_create(buffer_tostring(dimensions), ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + buffer_free(dimensions); + } + + w->response.data->contenttype = CT_APPLICATION_JSON; + int ret = rrdcontext_to_json(host, w->response.data, after, before, options, context, chart_label_key_pattern, chart_labels_filter_pattern, chart_dimensions_pattern); + + simple_pattern_free(chart_label_key_pattern); + simple_pattern_free(chart_labels_filter_pattern); + simple_pattern_free(chart_dimensions_pattern); + + return ret; +} + +static int web_client_api_request_v1_contexts(RRDHOST *host, struct web_client *w, char *url) { + RRDCONTEXT_TO_JSON_OPTIONS options = RRDCONTEXT_OPTION_NONE; + time_t after = 0, before = 0; + const char *chart_label_key = NULL, *chart_labels_filter = NULL; + BUFFER *dimensions = NULL; + + buffer_flush(w->response.data); + + while(url) { + char *value = mystrsep(&url, "&"); + if(!value || !*value) continue; + + char *name = mystrsep(&value, "="); + if(!name || !*name) continue; + if(!value || !*value) continue; + + // name and value are now the parameters + // they are not null and not empty + + if(!strcmp(name, "after")) after = str2l(value); + else if(!strcmp(name, "before")) before = str2l(value); + else if(!strcmp(name, "options")) options = rrdcontext_to_json_parse_options(value); + else if(!strcmp(name, "chart_label_key")) chart_label_key = value; + else if(!strcmp(name, "chart_labels_filter")) chart_labels_filter = value; + else if(!strcmp(name, "dimension") || !strcmp(name, "dim") || !strcmp(name, "dimensions") || !strcmp(name, "dims")) { + if(!dimensions) dimensions = buffer_create(100); + buffer_strcat(dimensions, "|"); + buffer_strcat(dimensions, value); + } + } + + SIMPLE_PATTERN *chart_label_key_pattern = NULL; + SIMPLE_PATTERN *chart_labels_filter_pattern = NULL; + SIMPLE_PATTERN *chart_dimensions_pattern = NULL; + + if(chart_label_key) + chart_label_key_pattern = simple_pattern_create(chart_label_key, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + + if(chart_labels_filter) + chart_labels_filter_pattern = simple_pattern_create(chart_labels_filter, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + + if(dimensions) { + chart_dimensions_pattern = simple_pattern_create(buffer_tostring(dimensions), ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + buffer_free(dimensions); + } + + w->response.data->contenttype = CT_APPLICATION_JSON; + int ret = rrdcontexts_to_json(host, w->response.data, after, before, options, chart_label_key_pattern, chart_labels_filter_pattern, chart_dimensions_pattern); + + simple_pattern_free(chart_label_key_pattern); + simple_pattern_free(chart_labels_filter_pattern); + simple_pattern_free(chart_dimensions_pattern); + + return ret; +} + inline int web_client_api_request_v1_charts(RRDHOST *host, struct web_client *w, char *url) { (void)url; @@ -392,6 +559,7 @@ void fix_google_param(char *s) { } } + // returns the HTTP code inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, char *url) { debug(D_WEB_CLIENT, "%llu: API v1 data with URL '%s'", w->id, url); @@ -420,7 +588,8 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c char *context = NULL; char *chart_label_key = NULL; char *chart_labels_filter = NULL; - + char *group_options = NULL; + int tier = 0; int group = RRDR_GROUPING_AVERAGE; int show_dimensions = 0; uint32_t format = DATASOURCE_JSON; @@ -454,6 +623,7 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c else if(!strcmp(name, "points")) points_str = value; else if(!strcmp(name, "timeout")) timeout_str = value; else if(!strcmp(name, "gtime")) group_time_str = value; + else if(!strcmp(name, "group_options")) group_options = value; else if(!strcmp(name, "group")) { group = web_client_api_request_v1_data_group(value, RRDR_GROUPING_AVERAGE); } @@ -503,6 +673,11 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c else if(!strcmp(name, "max_anomaly_rates")) { max_anomaly_rates_str = value; } + else if(!strcmp(name, "tier")) { + tier = str2i(value); + if(tier >= 0 && tier < storage_tiers) + options |= RRDR_OPTION_SELECTED_TIER; + } } // validate the google parameters given @@ -528,18 +703,23 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c uint32_t context_hash = simple_hash(context); + SIMPLE_PATTERN *chart_label_key_pattern = NULL; + if(chart_label_key) + chart_label_key_pattern = simple_pattern_create(chart_label_key, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + + SIMPLE_PATTERN *chart_labels_filter_pattern = NULL; + if(chart_labels_filter) + chart_labels_filter_pattern = simple_pattern_create(chart_labels_filter, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT); + rrdhost_rdlock(host); - char *words[MAX_CHART_LABELS_FILTER]; - uint32_t hash_key_list[MAX_CHART_LABELS_FILTER]; - int word_count = 0; rrdset_foreach_read(st1, host) { if (st1->hash_context == context_hash && !strcmp(st1->context, context) && - (!chart_label_key || rrdset_contains_label_keylist(st1, chart_label_key)) && - (!chart_labels_filter || - rrdset_matches_label_keys(st1, chart_labels_filter, words, hash_key_list, &word_count, MAX_CHART_LABELS_FILTER))) + (!chart_label_key_pattern || rrdlabels_match_simple_pattern_parsed(st1->state->chart_labels, chart_label_key_pattern, ':')) && + (!chart_labels_filter_pattern || rrdlabels_match_simple_pattern_parsed(st1->state->chart_labels, chart_labels_filter_pattern, ':'))) build_context_param_list(owa, &context_param_list, st1); } rrdhost_unlock(host); + if (likely(context_param_list && context_param_list->rd)) // Just set the first one st = context_param_list->rd->rrdset; else { @@ -656,7 +836,7 @@ inline int web_client_api_request_v1_data(RRDHOST *host, struct web_client *w, c .wb = w->response.data}; ret = rrdset2anything_api_v1(owa, st, &query_params, dimensions, format, - points, after, before, group, group_time, options, &last_timestamp_in_data); + points, after, before, group, group_options, group_time, options, &last_timestamp_in_data, tier); free_context_param_list(owa, &context_param_list); @@ -903,8 +1083,6 @@ static inline void web_client_api_request_v1_info_mirrored_hosts(BUFFER *wb) { buffer_strcat(wb, "\t\"mirrored_hosts\": [\n"); rrd_rdlock(); rrdhost_foreach_read(host) { - if (rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) - continue; if (count > 0) buffer_strcat(wb, ",\n"); @@ -916,8 +1094,6 @@ static inline void web_client_api_request_v1_info_mirrored_hosts(BUFFER *wb) { count = 0; rrdhost_foreach_read(host) { - if (rrdhost_flag_check(host, RRDHOST_FLAG_ARCHIVED)) - continue; if (count > 0) buffer_strcat(wb, ",\n"); @@ -964,22 +1140,8 @@ inline void host_labels2json(RRDHOST *host, BUFFER *wb, size_t indentation) { indentation--; } - int count = 0; - rrdhost_rdlock(host); - netdata_rwlock_rdlock(&host->labels.labels_rwlock); - for (struct label *label = host->labels.head; label; label = label->next) { - if(count > 0) buffer_strcat(wb, ",\n"); - buffer_strcat(wb, tabs); - - char value[CONFIG_MAX_VALUE * 2 + 1]; - sanitize_json_string(value, label->value, CONFIG_MAX_VALUE * 2); - buffer_sprintf(wb, "\"%s\": \"%s\"", label->key, value); - - count++; - } + rrdlabels_to_buffer(host->host_labels, wb, tabs, ":", "\"", ",\n", NULL, NULL, NULL, NULL); buffer_strcat(wb, "\n"); - netdata_rwlock_unlock(&host->labels.labels_rwlock); - rrdhost_unlock(host); } extern int aclk_connected; @@ -1054,11 +1216,7 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb) #ifdef ENABLE_ACLK buffer_strcat(wb, "\t\"cloud-available\": true,\n"); buffer_strcat(wb, "\t\"aclk-ng-available\": true,\n"); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL buffer_strcat(wb, "\t\"aclk-ng-new-cloud-protocol\": true,\n"); -#else - buffer_strcat(wb, "\t\"aclk-ng-new-cloud-protocol\": false,\n"); -#endif buffer_strcat(wb, "\t\"aclk-legacy-available\": false,\n"); buffer_strcat(wb, "\t\"aclk-implementation\": \"Next Generation\",\n"); #else @@ -1066,7 +1224,7 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb) buffer_strcat(wb, "\t\"aclk-ng-available\": false,\n"); buffer_strcat(wb, "\t\"aclk-legacy-available\": false,\n"); #endif - char *agent_id = is_agent_claimed(); + char *agent_id = get_agent_claimid(); if (agent_id == NULL) buffer_strcat(wb, "\t\"agent-claimed\": false,\n"); else { @@ -1076,12 +1234,7 @@ inline int web_client_api_request_v1_info_fill_buffer(RRDHOST *host, BUFFER *wb) #ifdef ENABLE_ACLK if (aclk_connected) { buffer_strcat(wb, "\t\"aclk-available\": true,\n"); -#ifdef ENABLE_NEW_CLOUD_PROTOCOL - if (aclk_use_new_cloud_arch) - buffer_strcat(wb, "\t\"aclk-available-protocol\": \"New\",\n"); - else -#endif - buffer_strcat(wb, "\t\"aclk-available-protocol\": \"Legacy\",\n"); + buffer_strcat(wb, "\t\"aclk-available-protocol\": \"New\",\n"); } else #endif @@ -1323,12 +1476,18 @@ static int web_client_api_request_v1_aclk_state(RRDHOST *host, struct web_client return HTTP_RESP_OK; } -int web_client_api_request_v1_metric_correlations(RRDHOST *host, struct web_client *w, char *url) { +static int web_client_api_request_v1_weights_internal(RRDHOST *host, struct web_client *w, char *url, WEIGHTS_METHOD method, WEIGHTS_FORMAT format) { if (!netdata_ready) return HTTP_RESP_BACKEND_FETCH_FAILED; - long long baseline_after = 0, baseline_before = 0, highlight_after = 0, highlight_before = 0, max_points = 0; - + long long baseline_after = 0, baseline_before = 0, after = 0, before = 0, points = 0; + RRDR_OPTIONS options = RRDR_OPTION_NOT_ALIGNED | RRDR_OPTION_NONZERO | RRDR_OPTION_NULL2ZERO; + int options_count = 0; + RRDR_GROUPING group = RRDR_GROUPING_AVERAGE; + int timeout = 0; + int tier = 0; + const char *group_options = NULL, *contexts_str = NULL; + while (url) { char *value = mystrsep(&url, "&"); if (!value || !*value) @@ -1342,30 +1501,165 @@ int web_client_api_request_v1_metric_correlations(RRDHOST *host, struct web_clie if (!strcmp(name, "baseline_after")) baseline_after = (long long) strtoul(value, NULL, 0); + else if (!strcmp(name, "baseline_before")) baseline_before = (long long) strtoul(value, NULL, 0); - else if (!strcmp(name, "highlight_after")) - highlight_after = (long long) strtoul(value, NULL, 0); - else if (!strcmp(name, "highlight_before")) - highlight_before = (long long) strtoul(value, NULL, 0); - else if (!strcmp(name, "max_points")) - max_points = (long long) strtoul(value, NULL, 0); - + + else if (!strcmp(name, "after") || !strcmp(name, "highlight_after")) + after = (long long) strtoul(value, NULL, 0); + + else if (!strcmp(name, "before") || !strcmp(name, "highlight_before")) + before = (long long) strtoul(value, NULL, 0); + + else if (!strcmp(name, "points") || !strcmp(name, "max_points")) + points = (long long) strtoul(value, NULL, 0); + + else if (!strcmp(name, "timeout")) + timeout = (int) strtoul(value, NULL, 0); + + else if(!strcmp(name, "group")) + group = web_client_api_request_v1_data_group(value, RRDR_GROUPING_AVERAGE); + + else if(!strcmp(name, "options")) { + if(!options_count) options = RRDR_OPTION_NOT_ALIGNED | RRDR_OPTION_NULL2ZERO; + options |= web_client_api_request_v1_data_options(value); + options_count++; + } + + else if(!strcmp(name, "method")) + method = weights_string_to_method(value); + + else if(!strcmp(name, "context") || !strcmp(name, "contexts")) + contexts_str = value; + + else if(!strcmp(name, "tier")) { + tier = str2i(value); + if(tier >= 0 && tier < storage_tiers) + options |= RRDR_OPTION_SELECTED_TIER; + } } + BUFFER *wb = w->response.data; + buffer_flush(wb); + wb->contenttype = CT_APPLICATION_JSON; + + SIMPLE_PATTERN *contexts = (contexts_str) ? simple_pattern_create(contexts_str, ",|\t\r\n\f\v", SIMPLE_PATTERN_EXACT) : NULL; + + int ret = web_api_v1_weights(host, wb, method, format, group, group_options, baseline_after, baseline_before, after, before, points, options, contexts, tier, timeout); + + simple_pattern_free(contexts); + return ret; +} + +int web_client_api_request_v1_metric_correlations(RRDHOST *host, struct web_client *w, char *url) { + return web_client_api_request_v1_weights_internal(host, w, url, default_metric_correlations_method, WEIGHTS_FORMAT_CHARTS); +} + +int web_client_api_request_v1_weights(RRDHOST *host, struct web_client *w, char *url) { + return web_client_api_request_v1_weights_internal(host, w, url, WEIGHTS_METHOD_ANOMALY_RATE, WEIGHTS_FORMAT_CONTEXTS); +} + +#ifndef ENABLE_DBENGINE +int web_client_api_request_v1_dbengine_stats(RRDHOST *host, struct web_client *w, char *url) { + return HTTP_RESP_NOT_FOUND; +} +#else +static void web_client_api_v1_dbengine_stats_for_tier(BUFFER *wb, int tier) { + RRDENG_SIZE_STATS stats = rrdeng_size_statistics(multidb_ctx[tier]); + + buffer_sprintf(wb, + "\n\t\t\"default_granularity_secs\":%zu" + ",\n\t\t\"sizeof_metric\":%zu" + ",\n\t\t\"sizeof_metric_in_index\":%zu" + ",\n\t\t\"sizeof_page\":%zu" + ",\n\t\t\"sizeof_page_in_index\":%zu" + ",\n\t\t\"sizeof_extent\":%zu" + ",\n\t\t\"sizeof_page_in_extent\":%zu" + ",\n\t\t\"sizeof_datafile\":%zu" + ",\n\t\t\"sizeof_page_in_cache\":%zu" + ",\n\t\t\"sizeof_point_data\":%zu" + ",\n\t\t\"sizeof_page_data\":%zu" + ",\n\t\t\"pages_per_extent\":%zu" + ",\n\t\t\"datafiles\":%zu" + ",\n\t\t\"extents\":%zu" + ",\n\t\t\"extents_pages\":%zu" + ",\n\t\t\"points\":%zu" + ",\n\t\t\"metrics\":%zu" + ",\n\t\t\"metrics_pages\":%zu" + ",\n\t\t\"extents_compressed_bytes\":%zu" + ",\n\t\t\"pages_uncompressed_bytes\":%zu" + ",\n\t\t\"pages_duration_secs\":%ld" + ",\n\t\t\"single_point_pages\":%zu" + ",\n\t\t\"first_t\":%llu" + ",\n\t\t\"last_t\":%llu" + ",\n\t\t\"database_retention_secs\":%ld" + ",\n\t\t\"average_compression_savings\":%0.2f" + ",\n\t\t\"average_point_duration_secs\":%0.2f" + ",\n\t\t\"average_metric_retention_secs\":%0.2f" + ",\n\t\t\"ephemeral_metrics_per_day_percent\":%0.2f" + ",\n\t\t\"average_page_size_bytes\":%0.2f" + ",\n\t\t\"estimated_concurrently_collected_metrics\":%zu" + ",\n\t\t\"currently_collected_metrics\":%zu" + ",\n\t\t\"max_concurrently_collected_metrics\":%zu" + ",\n\t\t\"disk_space\":%zu" + ",\n\t\t\"max_disk_space\":%zu" + , stats.default_granularity_secs + , stats.sizeof_metric + , stats.sizeof_metric_in_index + , stats.sizeof_page + , stats.sizeof_page_in_index + , stats.sizeof_extent + , stats.sizeof_page_in_extent + , stats.sizeof_datafile + , stats.sizeof_page_in_cache + , stats.sizeof_point_data + , stats.sizeof_page_data + , stats.pages_per_extent + , stats.datafiles + , stats.extents + , stats.extents_pages + , stats.points + , stats.metrics + , stats.metrics_pages + , stats.extents_compressed_bytes + , stats.pages_uncompressed_bytes + , stats.pages_duration_secs + , stats.single_point_pages + , stats.first_t + , stats.last_t + , stats.database_retention_secs + , stats.average_compression_savings + , stats.average_point_duration_secs + , stats.average_metric_retention_secs + , stats.ephemeral_metrics_per_day_percent + , stats.average_page_size_bytes + , stats.estimated_concurrently_collected_metrics + , stats.currently_collected_metrics + , stats.max_concurrently_collected_metrics + , stats.disk_space + , stats.max_disk_space + ); +} +int web_client_api_request_v1_dbengine_stats(RRDHOST *host __maybe_unused, struct web_client *w, char *url __maybe_unused) { + if (!netdata_ready) + return HTTP_RESP_BACKEND_FETCH_FAILED; + BUFFER *wb = w->response.data; buffer_flush(wb); wb->contenttype = CT_APPLICATION_JSON; buffer_no_cacheable(wb); - if (!highlight_after || !highlight_before) - buffer_strcat(wb, "{\"error\": \"Missing or invalid required highlight after and before parameters.\" }"); - else { - metric_correlations(host, wb, baseline_after, baseline_before, highlight_after, highlight_before, max_points); + buffer_strcat(wb, "{"); + for(int tier = 0; tier < storage_tiers ;tier++) { + buffer_sprintf(wb, "%s\n\t\"tier%d\": {", tier?",":"", tier); + web_client_api_v1_dbengine_stats_for_tier(wb, tier); + buffer_strcat(wb, "\n\t}"); } + buffer_strcat(wb, "\n}"); return HTTP_RESP_OK; } +#endif static struct api_command { const char *command; @@ -1377,6 +1671,8 @@ static struct api_command { { "data", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_data }, { "chart", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_chart }, { "charts", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_charts }, + { "context", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_context }, + { "contexts", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_contexts }, { "archivedcharts", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_archivedcharts }, // registry checks the ACL by itself, so we allow everything @@ -1401,6 +1697,10 @@ static struct api_command { { "manage/health", 0, WEB_CLIENT_ACL_MGMT, web_client_api_request_v1_mgmt_health }, { "aclk", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_aclk_state }, { "metric_correlations", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_metric_correlations }, + { "weights", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_weights }, + + { "dbengine_stats", 0, WEB_CLIENT_ACL_DASHBOARD, web_client_api_request_v1_dbengine_stats }, + // terminator { NULL, 0, WEB_CLIENT_ACL_NONE, NULL }, }; diff --git a/web/api/web_api_v1.h b/web/api/web_api_v1.h index a88c511ad..544f1e574 100644 --- a/web/api/web_api_v1.h +++ b/web/api/web_api_v1.h @@ -7,9 +7,12 @@ #include "web/api/badges/web_buffer_svg.h" #include "web/api/formatters/rrd2json.h" #include "web/api/health/health_cmdapi.h" +#include "web/api/queries/weights.h" #define MAX_CHART_LABELS_FILTER (32) -extern uint32_t web_client_api_request_v1_data_options(char *o); +extern RRDR_OPTIONS web_client_api_request_v1_data_options(char *o); +extern void web_client_api_request_v1_data_options_to_string(BUFFER *wb, RRDR_OPTIONS options); + extern uint32_t web_client_api_request_v1_data_format(char *name); extern uint32_t web_client_api_request_v1_data_google_format(char *name); diff --git a/web/gui/dashboard/Makefile.am b/web/gui/dashboard/Makefile.am index 020bdf3d5..619bdaf91 100644 --- a/web/gui/dashboard/Makefile.am +++ b/web/gui/dashboard/Makefile.am @@ -26,7 +26,7 @@ dist_web_DATA = \ index.html \ infographic.html \ manifest.json \ - precache-manifest.b443acc162e1adddca46165b647e9f4b.js \ + precache-manifest.e95d658eed560f9e0189217cc6919238.js \ refresh-badges.js \ robots.txt \ service-worker.js \ @@ -61,6 +61,8 @@ dist_webimages_DATA = \ images/alert-128-red.png \ images/alert-multi-size-orange.ico \ images/alert-multi-size-red.ico \ + images/alerts.jpg \ + images/alerts.png \ images/android-icon-144x144.png \ images/android-icon-192x192.png \ images/android-icon-36x36.png \ @@ -82,12 +84,14 @@ dist_webimages_DATA = \ images/banner-icon-144x144.png \ images/check-mark-2-128-green.png \ images/check-mark-2-multi-size-green.ico \ + images/dashboards.png \ images/favicon-128.png \ images/favicon-16x16.png \ images/favicon-196x196.png \ images/favicon-32x32.png \ images/favicon-96x96.png \ images/favicon.ico \ + images/home.png \ images/ms-icon-144x144.png \ images/ms-icon-150x150.png \ images/ms-icon-310x150.png \ @@ -96,8 +100,12 @@ dist_webimages_DATA = \ images/ms-icon-70x70.png \ images/netdata-logomark.svg \ images/netdata.svg \ + images/nodeView.png \ + images/nodes.jpg \ + images/overview.png \ images/packaging-beta-tag.svg \ images/post.png \ + images/pricing.png \ images/seo-performance-128.png \ $(NULL) @@ -131,17 +139,17 @@ dist_webstaticcss_DATA = \ static/css/2.20fd0a40.chunk.css.map \ static/css/4.a36e3b73.chunk.css \ static/css/4.a36e3b73.chunk.css.map \ - static/css/main.102ce44c.chunk.css \ - static/css/main.102ce44c.chunk.css.map \ + static/css/main.53ba10f1.chunk.css \ + static/css/main.53ba10f1.chunk.css.map \ $(NULL) webstaticjsdir=$(webdir)/static/js dist_webstaticjs_DATA = \ static/js/10.44d9d40b.chunk.js \ static/js/10.44d9d40b.chunk.js.map \ - static/js/2.97b8fd9b.chunk.js \ - static/js/2.97b8fd9b.chunk.js.LICENSE \ - static/js/2.97b8fd9b.chunk.js.map \ + static/js/2.3123f37d.chunk.js \ + static/js/2.3123f37d.chunk.js.LICENSE \ + static/js/2.3123f37d.chunk.js.map \ static/js/3.d49f0857.chunk.js \ static/js/3.d49f0857.chunk.js.map \ static/js/4.8b70c754.chunk.js \ @@ -157,9 +165,9 @@ dist_webstaticjs_DATA = \ static/js/8.b1a4b595.chunk.js.map \ static/js/9.50358509.chunk.js \ static/js/9.50358509.chunk.js.map \ - static/js/main.2d23101e.chunk.js \ - static/js/main.2d23101e.chunk.js.LICENSE \ - static/js/main.2d23101e.chunk.js.map \ + static/js/main.cc0e57d1.chunk.js \ + static/js/main.cc0e57d1.chunk.js.LICENSE \ + static/js/main.cc0e57d1.chunk.js.map \ static/js/runtime-main.b352aa47.js \ static/js/runtime-main.b352aa47.js.map \ $(NULL) diff --git a/web/gui/dashboard/asset-manifest.json b/web/gui/dashboard/asset-manifest.json index 193ff6d52..03653fcf8 100644 --- a/web/gui/dashboard/asset-manifest.json +++ b/web/gui/dashboard/asset-manifest.json @@ -1,13 +1,13 @@ { "files": { - "main.css": "./static/css/main.102ce44c.chunk.css", - "main.js": "./static/js/main.2d23101e.chunk.js", - "main.js.map": "./static/js/main.2d23101e.chunk.js.map", + "main.css": "./static/css/main.53ba10f1.chunk.css", + "main.js": "./static/js/main.cc0e57d1.chunk.js", + "main.js.map": "./static/js/main.cc0e57d1.chunk.js.map", "runtime-main.js": "./static/js/runtime-main.b352aa47.js", "runtime-main.js.map": "./static/js/runtime-main.b352aa47.js.map", "static/css/2.20fd0a40.chunk.css": "./static/css/2.20fd0a40.chunk.css", - "static/js/2.97b8fd9b.chunk.js": "./static/js/2.97b8fd9b.chunk.js", - "static/js/2.97b8fd9b.chunk.js.map": "./static/js/2.97b8fd9b.chunk.js.map", + "static/js/2.3123f37d.chunk.js": "./static/js/2.3123f37d.chunk.js", + "static/js/2.3123f37d.chunk.js.map": "./static/js/2.3123f37d.chunk.js.map", "static/js/3.d49f0857.chunk.js": "./static/js/3.d49f0857.chunk.js", "static/js/3.d49f0857.chunk.js.map": "./static/js/3.d49f0857.chunk.js.map", "static/css/4.a36e3b73.chunk.css": "./static/css/4.a36e3b73.chunk.css", @@ -26,22 +26,22 @@ "static/js/10.44d9d40b.chunk.js": "./static/js/10.44d9d40b.chunk.js", "static/js/10.44d9d40b.chunk.js.map": "./static/js/10.44d9d40b.chunk.js.map", "index.html": "./index.html", - "precache-manifest.b443acc162e1adddca46165b647e9f4b.js": "./precache-manifest.b443acc162e1adddca46165b647e9f4b.js", + "precache-manifest.e95d658eed560f9e0189217cc6919238.js": "./precache-manifest.e95d658eed560f9e0189217cc6919238.js", "service-worker.js": "./service-worker.js", "static/css/2.20fd0a40.chunk.css.map": "./static/css/2.20fd0a40.chunk.css.map", "static/css/4.a36e3b73.chunk.css.map": "./static/css/4.a36e3b73.chunk.css.map", - "static/css/main.102ce44c.chunk.css.map": "./static/css/main.102ce44c.chunk.css.map", - "static/js/2.97b8fd9b.chunk.js.LICENSE": "./static/js/2.97b8fd9b.chunk.js.LICENSE", + "static/css/main.53ba10f1.chunk.css.map": "./static/css/main.53ba10f1.chunk.css.map", + "static/js/2.3123f37d.chunk.js.LICENSE": "./static/js/2.3123f37d.chunk.js.LICENSE", "static/js/5.29dab1cd.chunk.js.LICENSE": "./static/js/5.29dab1cd.chunk.js.LICENSE", - "static/js/main.2d23101e.chunk.js.LICENSE": "./static/js/main.2d23101e.chunk.js.LICENSE", + "static/js/main.cc0e57d1.chunk.js.LICENSE": "./static/js/main.cc0e57d1.chunk.js.LICENSE", "static/media/index.css": "./static/media/ibm-plex-sans-latin-700italic.72e9af40.woff", "static/media/fonts.css": "./static/media/material-icons.0509ab09.woff2" }, "entrypoints": [ "static/js/runtime-main.b352aa47.js", "static/css/2.20fd0a40.chunk.css", - "static/js/2.97b8fd9b.chunk.js", - "static/css/main.102ce44c.chunk.css", - "static/js/main.2d23101e.chunk.js" + "static/js/2.3123f37d.chunk.js", + "static/css/main.53ba10f1.chunk.css", + "static/js/main.cc0e57d1.chunk.js" ] } \ No newline at end of file diff --git a/web/gui/dashboard/css/dashboard.css b/web/gui/dashboard/css/dashboard.css index 71215a031..2d95a331e 100644 --- a/web/gui/dashboard/css/dashboard.css +++ b/web/gui/dashboard/css/dashboard.css @@ -770,7 +770,7 @@ body { .dygraph__history-tip { position: absolute; transform: translateY(-50%); - display: none; /* overriden in js */ + display: none; /* overridden in js */ margin-right: 25px; direction: rtl; overflow: hidden; diff --git a/web/gui/dashboard/css/dashboard.slate.css b/web/gui/dashboard/css/dashboard.slate.css index 22e37ada5..c4e5c65c9 100644 --- a/web/gui/dashboard/css/dashboard.slate.css +++ b/web/gui/dashboard/css/dashboard.slate.css @@ -788,7 +788,7 @@ code { position: absolute; top: 50%; transform: translateY(-50%); - display: none; /* overriden in js */ + display: none; /* overridden in js */ margin-right: 25px; direction: rtl; overflow: hidden; diff --git a/web/gui/dashboard/dashboard-react.js b/web/gui/dashboard/dashboard-react.js index 0b342c548..99f868f42 100644 --- a/web/gui/dashboard/dashboard-react.js +++ b/web/gui/dashboard/dashboard-react.js @@ -3,7 +3,7 @@ /** * after react-dashboard refractor, this file can be renamed to 'dashboard.js' * and it will: - * - setup global objects, so any assignements like 'NETDATA.options.current.destroy_on_hide = true' + * - setup global objects, so any assignments like 'NETDATA.options.current.destroy_on_hide = true' * will not break. we need to add it in places where 'dashboard.js' is * - create react root DOM node * - load react app diff --git a/web/gui/dashboard/dashboard.css b/web/gui/dashboard/dashboard.css index 71215a031..2d95a331e 100644 --- a/web/gui/dashboard/dashboard.css +++ b/web/gui/dashboard/dashboard.css @@ -770,7 +770,7 @@ body { .dygraph__history-tip { position: absolute; transform: translateY(-50%); - display: none; /* overriden in js */ + display: none; /* overridden in js */ margin-right: 25px; direction: rtl; overflow: hidden; diff --git a/web/gui/dashboard/dashboard.html b/web/gui/dashboard/dashboard.html index c550db390..be0febf7a 100644 --- a/web/gui/dashboard/dashboard.html +++ b/web/gui/dashboard/dashboard.html @@ -59,7 +59,7 @@ This is a template for building custom dashboards. To build a dashboard you just
  • You can use different chart libraries on the same page: peity, sparkline, dygraph, google
  • You can customize each chart to your preferences. For each chart library most of their attributes can be given in data- attributes.
  • Each chart can have each own duration - it is controlled with the data-after attribute to give that many seconds of data.
  • -
  • Depending on the width of the chart and data-after attribute, netdata will automatically refresh the chart when it needs to be updated. For example giving 600 pixels for width for -600 seconds of data, using a chart library that needs 3 pixels per point, will yeld in a chart updated once every 3 seconds.
  • +
  • Depending on the width of the chart and data-after attribute, netdata will automatically refresh the chart when it needs to be updated. For example giving 600 pixels for width for -600 seconds of data, using a chart library that needs 3 pixels per point, will yield in a chart updated once every 3 seconds.
  • @@ -518,7 +518,7 @@ Sparklines using dygraphs

    Google Charts

    -Netdata was originaly developed with Google Charts. +Netdata was originally developed with Google Charts. Netdata is a complete Google Visualization API provider.
    @@ -559,7 +559,7 @@ Netdata is a complete Google Visualization API provider.

    Morris Charts

    -Unfortunatelly, Morris Charts are very slow. Here we force them to lower their detail to get acceptable results. +Unfortunately, Morris Charts are very slow. Here we force them to lower their detail to get acceptable results.
  • extreme use of transitions (implemented with D3 instead of CSS, meaning they are javascript rendered) that cannot be disabled - even opacity is hardcoded in the javascript library
  • -
  • rendering is done with SVG instead of canvas, so they use DOM elements for every point, becomimg useless if more than 500 points are drawn
  • -
  • lack of a raw data format, so every time a chart is updated, data convertion in javascript is required
  • +
  • rendering is done with SVG instead of canvas, so they use DOM elements for every point, becoming useless if more than 500 points are drawn
  • +
  • lack of a raw data format, so every time a chart is updated, data conversion in javascript is required
  • lack of stacked charts support
  • So, to avoid flashing the charts, we destroy and re-create the charts on each update. Also, since they manipulate the data with javascript we were forced to lower the detail they render to get acceptable speeds. diff --git a/web/gui/dashboard/dashboard.js b/web/gui/dashboard/dashboard.js index b9d96d5c7..83f7b584b 100644 --- a/web/gui/dashboard/dashboard.js +++ b/web/gui/dashboard/dashboard.js @@ -63,7 +63,7 @@ * (default: null) */ /*global netdataAlarmsRecipients *//* array, an array of alarm recipients to show notifications for * (default: null) */ -/*global netdataAlarmsRemember *//* boolen, keep our position in the alarm log at browser local storage +/*global netdataAlarmsRemember *//* boolean, keep our position in the alarm log at browser local storage * (default: true) */ /*global netdataAlarmsActiveCallback *//* function, a hook for the alarm logs * (default: undefined) */ @@ -6618,7 +6618,7 @@ let chartState = function (element) { if (NETDATA.options.current.show_help) { if (this.element_legend_childs.toolbox !== null) { if (this.debug) { - this.log('hideChart(): hidding legend popovers'); + this.log('hideChart(): hiding legend popovers'); } $(this.element_legend_childs.toolbox_left).popover('hide'); @@ -8165,7 +8165,7 @@ let chartState = function (element) { } } - // create a hidden div to be used for hidding + // create a hidden div to be used for hiding // the original legend of the chart library let el = document.createElement('div'); if (this.element_legend !== null) { diff --git a/web/gui/dashboard/dashboard.slate.css b/web/gui/dashboard/dashboard.slate.css index 22e37ada5..c4e5c65c9 100644 --- a/web/gui/dashboard/dashboard.slate.css +++ b/web/gui/dashboard/dashboard.slate.css @@ -788,7 +788,7 @@ code { position: absolute; top: 50%; transform: translateY(-50%); - display: none; /* overriden in js */ + display: none; /* overridden in js */ margin-right: 25px; direction: rtl; overflow: hidden; diff --git a/web/gui/dashboard/images/alerts.jpg b/web/gui/dashboard/images/alerts.jpg new file mode 100644 index 000000000..6593c72d6 Binary files /dev/null and b/web/gui/dashboard/images/alerts.jpg differ diff --git a/web/gui/dashboard/images/alerts.png b/web/gui/dashboard/images/alerts.png new file mode 100644 index 000000000..fe9940d3e Binary files /dev/null and b/web/gui/dashboard/images/alerts.png differ diff --git a/web/gui/dashboard/images/dashboards.png b/web/gui/dashboard/images/dashboards.png new file mode 100644 index 000000000..46cdfbb2d Binary files /dev/null and b/web/gui/dashboard/images/dashboards.png differ diff --git a/web/gui/dashboard/images/home.png b/web/gui/dashboard/images/home.png new file mode 100644 index 000000000..cf7db9dba Binary files /dev/null and b/web/gui/dashboard/images/home.png differ diff --git a/web/gui/dashboard/images/nodeView.png b/web/gui/dashboard/images/nodeView.png new file mode 100644 index 000000000..e9b3e1b67 Binary files /dev/null and b/web/gui/dashboard/images/nodeView.png differ diff --git a/web/gui/dashboard/images/nodes.jpg b/web/gui/dashboard/images/nodes.jpg new file mode 100644 index 000000000..3e93c0d6c Binary files /dev/null and b/web/gui/dashboard/images/nodes.jpg differ diff --git a/web/gui/dashboard/images/overview.png b/web/gui/dashboard/images/overview.png new file mode 100644 index 000000000..6e54db6a9 Binary files /dev/null and b/web/gui/dashboard/images/overview.png differ diff --git a/web/gui/dashboard/images/pricing.png b/web/gui/dashboard/images/pricing.png new file mode 100644 index 000000000..d5406e8a6 Binary files /dev/null and b/web/gui/dashboard/images/pricing.png differ diff --git a/web/gui/dashboard/index.html b/web/gui/dashboard/index.html index 1c6448587..d6f0ca410 100644 --- a/web/gui/dashboard/index.html +++ b/web/gui/dashboard/index.html @@ -1,4 +1,4 @@ -netdata dashboard
    You must enable JavaScript in order to use Netdata!
    You can do this in your browser settings.
    \ No newline at end of file + overlayEl.style = theme == 'slate' ? "background-color: #272b30; color: #373b40;" : "background-color: #fff; color: #ddd;";
    \ No newline at end of file diff --git a/web/gui/dashboard/precache-manifest.b443acc162e1adddca46165b647e9f4b.js b/web/gui/dashboard/precache-manifest.b443acc162e1adddca46165b647e9f4b.js deleted file mode 100644 index b53957ceb..000000000 --- a/web/gui/dashboard/precache-manifest.b443acc162e1adddca46165b647e9f4b.js +++ /dev/null @@ -1,190 +0,0 @@ -self.__precacheManifest = (self.__precacheManifest || []).concat([ - { - "revision": "dd044efd6e6cf23b721944e8a68bdfff", - "url": "./index.html" - }, - { - "revision": "47f55ef3560e0793840c", - "url": "./static/css/2.20fd0a40.chunk.css" - }, - { - "revision": "212d45239fd5f6814421", - "url": "./static/css/4.a36e3b73.chunk.css" - }, - { - "revision": "de657e43a7860b3e88d4", - "url": "./static/css/main.102ce44c.chunk.css" - }, - { - "revision": "c45bd47abb091dfda126", - "url": "./static/js/10.44d9d40b.chunk.js" - }, - { - "revision": "47f55ef3560e0793840c", - "url": "./static/js/2.97b8fd9b.chunk.js" - }, - { - "revision": "766a5a832af1f575ad69e0e14fd2915f", - "url": "./static/js/2.97b8fd9b.chunk.js.LICENSE" - }, - { - "revision": "b7798b669b1966ed23ec", - "url": "./static/js/3.d49f0857.chunk.js" - }, - { - "revision": "212d45239fd5f6814421", - "url": "./static/js/4.8b70c754.chunk.js" - }, - { - "revision": "2555e37b8dd72102b21e", - "url": "./static/js/5.29dab1cd.chunk.js" - }, - { - "revision": "f05f27d89effd681fe0717b6a67b9a0d", - "url": "./static/js/5.29dab1cd.chunk.js.LICENSE" - }, - { - "revision": "a20d9477721b5236a011", - "url": "./static/js/6.7b15cdf3.chunk.js" - }, - { - "revision": "58e2d9966bc46cb2f6e7", - "url": "./static/js/7.cf6bc66f.chunk.js" - }, - { - "revision": "f58cbc2f5fd752800e1c", - "url": "./static/js/8.b1a4b595.chunk.js" - }, - { - "revision": "74e97210cbd08c0b3ff1", - "url": "./static/js/9.50358509.chunk.js" - }, - { - "revision": "de657e43a7860b3e88d4", - "url": "./static/js/main.2d23101e.chunk.js" - }, - { - "revision": "19356475904bddb45614eb6ff7f6cd44", - "url": "./static/js/main.2d23101e.chunk.js.LICENSE" - }, - { - "revision": "904a84c9f2c6baa9dabe", - "url": "./static/js/runtime-main.b352aa47.js" - }, - { - "revision": "245539db8ee56425757ef728eda8194e", - "url": "./static/media/ibm-plex-sans-latin-100.245539db.woff2" - }, - { - "revision": "9a582f3a304f421eca4027517706843c", - "url": "./static/media/ibm-plex-sans-latin-100.9a582f3a.woff" - }, - { - "revision": "1ea7c5d21b5956b602bdf9656cfb353f", - "url": "./static/media/ibm-plex-sans-latin-100italic.1ea7c5d2.woff" - }, - { - "revision": "3c34cf080b38f5fb1d4c59ffa45b3967", - "url": "./static/media/ibm-plex-sans-latin-100italic.3c34cf08.woff2" - }, - { - "revision": "67524c36348a323f78f2845e3aafc2d4", - "url": "./static/media/ibm-plex-sans-latin-200.67524c36.woff" - }, - { - "revision": "bf72c8412ab06c393f52efc5beb26ea7", - "url": "./static/media/ibm-plex-sans-latin-200.bf72c841.woff2" - }, - { - "revision": "52df25607ec284ca361ae50ba24b3580", - "url": "./static/media/ibm-plex-sans-latin-200italic.52df2560.woff" - }, - { - "revision": "bbc2d55223638ce450424a917e1104b2", - "url": "./static/media/ibm-plex-sans-latin-200italic.bbc2d552.woff2" - }, - { - "revision": "10bb6a0ae6dc8000d999ab622a45e281", - "url": "./static/media/ibm-plex-sans-latin-300.10bb6a0a.woff" - }, - { - "revision": "9e1c48af24191f6ea8aede14957c5d01", - "url": "./static/media/ibm-plex-sans-latin-300.9e1c48af.woff2" - }, - { - "revision": "c76f2ab53673e964b6e6734c1c455761", - "url": "./static/media/ibm-plex-sans-latin-300italic.c76f2ab5.woff2" - }, - { - "revision": "d3566d5bb4f31d86bfb9fda09563b416", - "url": "./static/media/ibm-plex-sans-latin-300italic.d3566d5b.woff" - }, - { - "revision": "263d6267533501f58c33b12b382e3abb", - "url": "./static/media/ibm-plex-sans-latin-400.263d6267.woff2" - }, - { - "revision": "a2c56f946488a9a267ba6ba21471a217", - "url": "./static/media/ibm-plex-sans-latin-400.a2c56f94.woff" - }, - { - "revision": "272f86114c980c52c131dfc3b4ae3276", - "url": "./static/media/ibm-plex-sans-latin-400italic.272f8611.woff" - }, - { - "revision": "89a93a1bdde48c7bb104150de88affce", - "url": "./static/media/ibm-plex-sans-latin-400italic.89a93a1b.woff2" - }, - { - "revision": "0866c24487514ad726738fb24f8e015b", - "url": "./static/media/ibm-plex-sans-latin-500.0866c244.woff2" - }, - { - "revision": "f6d5c5d5b849796d6a8f5a2953b60753", - "url": "./static/media/ibm-plex-sans-latin-500.f6d5c5d5.woff" - }, - { - "revision": "ccd41bd1a5bfa8bad2cd8d35fdaeb3d1", - "url": "./static/media/ibm-plex-sans-latin-500italic.ccd41bd1.woff" - }, - { - "revision": "ffd12d59339823b8cf53b9f99b47d87c", - "url": "./static/media/ibm-plex-sans-latin-500italic.ffd12d59.woff2" - }, - { - "revision": "337b16517a230dc830b84dc6e6167b68", - "url": "./static/media/ibm-plex-sans-latin-600.337b1651.woff" - }, - { - "revision": "7852d4dc26ef44df58e23dc0b9722d6f", - "url": "./static/media/ibm-plex-sans-latin-600.7852d4dc.woff2" - }, - { - "revision": "17e5379fd9a99b9bcb26ea983f391b6a", - "url": "./static/media/ibm-plex-sans-latin-600italic.17e5379f.woff2" - }, - { - "revision": "6f4ba6aa87fa99d5bc2b90a7b40a0ded", - "url": "./static/media/ibm-plex-sans-latin-600italic.6f4ba6aa.woff" - }, - { - "revision": "b8809d619a33eb825b0450281ff752e7", - "url": "./static/media/ibm-plex-sans-latin-700.b8809d61.woff" - }, - { - "revision": "c9983d3d04f3ed6c2eafee1db1d24e06", - "url": "./static/media/ibm-plex-sans-latin-700.c9983d3d.woff2" - }, - { - "revision": "02954beec9e742bb1f3ae27b7e7cb71f", - "url": "./static/media/ibm-plex-sans-latin-700italic.02954bee.woff2" - }, - { - "revision": "72e9af409ddafc63a5dd380e34758560", - "url": "./static/media/ibm-plex-sans-latin-700italic.72e9af40.woff" - }, - { - "revision": "0509ab09c1b0d2200a4135803c91d6ce", - "url": "./static/media/material-icons.0509ab09.woff2" - } -]); \ No newline at end of file diff --git a/web/gui/dashboard/precache-manifest.e95d658eed560f9e0189217cc6919238.js b/web/gui/dashboard/precache-manifest.e95d658eed560f9e0189217cc6919238.js new file mode 100644 index 000000000..24489d46d --- /dev/null +++ b/web/gui/dashboard/precache-manifest.e95d658eed560f9e0189217cc6919238.js @@ -0,0 +1,190 @@ +self.__precacheManifest = (self.__precacheManifest || []).concat([ + { + "revision": "fbc883e451c1a5b68d9e3a6be82c34b5", + "url": "./index.html" + }, + { + "revision": "5c3544e36e0c9c6041af", + "url": "./static/css/2.20fd0a40.chunk.css" + }, + { + "revision": "212d45239fd5f6814421", + "url": "./static/css/4.a36e3b73.chunk.css" + }, + { + "revision": "56020ad27dc4cda734dc", + "url": "./static/css/main.53ba10f1.chunk.css" + }, + { + "revision": "c45bd47abb091dfda126", + "url": "./static/js/10.44d9d40b.chunk.js" + }, + { + "revision": "5c3544e36e0c9c6041af", + "url": "./static/js/2.3123f37d.chunk.js" + }, + { + "revision": "766a5a832af1f575ad69e0e14fd2915f", + "url": "./static/js/2.3123f37d.chunk.js.LICENSE" + }, + { + "revision": "b7798b669b1966ed23ec", + "url": "./static/js/3.d49f0857.chunk.js" + }, + { + "revision": "212d45239fd5f6814421", + "url": "./static/js/4.8b70c754.chunk.js" + }, + { + "revision": "2555e37b8dd72102b21e", + "url": "./static/js/5.29dab1cd.chunk.js" + }, + { + "revision": "f05f27d89effd681fe0717b6a67b9a0d", + "url": "./static/js/5.29dab1cd.chunk.js.LICENSE" + }, + { + "revision": "a20d9477721b5236a011", + "url": "./static/js/6.7b15cdf3.chunk.js" + }, + { + "revision": "58e2d9966bc46cb2f6e7", + "url": "./static/js/7.cf6bc66f.chunk.js" + }, + { + "revision": "f58cbc2f5fd752800e1c", + "url": "./static/js/8.b1a4b595.chunk.js" + }, + { + "revision": "74e97210cbd08c0b3ff1", + "url": "./static/js/9.50358509.chunk.js" + }, + { + "revision": "56020ad27dc4cda734dc", + "url": "./static/js/main.cc0e57d1.chunk.js" + }, + { + "revision": "19356475904bddb45614eb6ff7f6cd44", + "url": "./static/js/main.cc0e57d1.chunk.js.LICENSE" + }, + { + "revision": "904a84c9f2c6baa9dabe", + "url": "./static/js/runtime-main.b352aa47.js" + }, + { + "revision": "245539db8ee56425757ef728eda8194e", + "url": "./static/media/ibm-plex-sans-latin-100.245539db.woff2" + }, + { + "revision": "9a582f3a304f421eca4027517706843c", + "url": "./static/media/ibm-plex-sans-latin-100.9a582f3a.woff" + }, + { + "revision": "1ea7c5d21b5956b602bdf9656cfb353f", + "url": "./static/media/ibm-plex-sans-latin-100italic.1ea7c5d2.woff" + }, + { + "revision": "3c34cf080b38f5fb1d4c59ffa45b3967", + "url": "./static/media/ibm-plex-sans-latin-100italic.3c34cf08.woff2" + }, + { + "revision": "67524c36348a323f78f2845e3aafc2d4", + "url": "./static/media/ibm-plex-sans-latin-200.67524c36.woff" + }, + { + "revision": "bf72c8412ab06c393f52efc5beb26ea7", + "url": "./static/media/ibm-plex-sans-latin-200.bf72c841.woff2" + }, + { + "revision": "52df25607ec284ca361ae50ba24b3580", + "url": "./static/media/ibm-plex-sans-latin-200italic.52df2560.woff" + }, + { + "revision": "bbc2d55223638ce450424a917e1104b2", + "url": "./static/media/ibm-plex-sans-latin-200italic.bbc2d552.woff2" + }, + { + "revision": "10bb6a0ae6dc8000d999ab622a45e281", + "url": "./static/media/ibm-plex-sans-latin-300.10bb6a0a.woff" + }, + { + "revision": "9e1c48af24191f6ea8aede14957c5d01", + "url": "./static/media/ibm-plex-sans-latin-300.9e1c48af.woff2" + }, + { + "revision": "c76f2ab53673e964b6e6734c1c455761", + "url": "./static/media/ibm-plex-sans-latin-300italic.c76f2ab5.woff2" + }, + { + "revision": "d3566d5bb4f31d86bfb9fda09563b416", + "url": "./static/media/ibm-plex-sans-latin-300italic.d3566d5b.woff" + }, + { + "revision": "263d6267533501f58c33b12b382e3abb", + "url": "./static/media/ibm-plex-sans-latin-400.263d6267.woff2" + }, + { + "revision": "a2c56f946488a9a267ba6ba21471a217", + "url": "./static/media/ibm-plex-sans-latin-400.a2c56f94.woff" + }, + { + "revision": "272f86114c980c52c131dfc3b4ae3276", + "url": "./static/media/ibm-plex-sans-latin-400italic.272f8611.woff" + }, + { + "revision": "89a93a1bdde48c7bb104150de88affce", + "url": "./static/media/ibm-plex-sans-latin-400italic.89a93a1b.woff2" + }, + { + "revision": "0866c24487514ad726738fb24f8e015b", + "url": "./static/media/ibm-plex-sans-latin-500.0866c244.woff2" + }, + { + "revision": "f6d5c5d5b849796d6a8f5a2953b60753", + "url": "./static/media/ibm-plex-sans-latin-500.f6d5c5d5.woff" + }, + { + "revision": "ccd41bd1a5bfa8bad2cd8d35fdaeb3d1", + "url": "./static/media/ibm-plex-sans-latin-500italic.ccd41bd1.woff" + }, + { + "revision": "ffd12d59339823b8cf53b9f99b47d87c", + "url": "./static/media/ibm-plex-sans-latin-500italic.ffd12d59.woff2" + }, + { + "revision": "337b16517a230dc830b84dc6e6167b68", + "url": "./static/media/ibm-plex-sans-latin-600.337b1651.woff" + }, + { + "revision": "7852d4dc26ef44df58e23dc0b9722d6f", + "url": "./static/media/ibm-plex-sans-latin-600.7852d4dc.woff2" + }, + { + "revision": "17e5379fd9a99b9bcb26ea983f391b6a", + "url": "./static/media/ibm-plex-sans-latin-600italic.17e5379f.woff2" + }, + { + "revision": "6f4ba6aa87fa99d5bc2b90a7b40a0ded", + "url": "./static/media/ibm-plex-sans-latin-600italic.6f4ba6aa.woff" + }, + { + "revision": "b8809d619a33eb825b0450281ff752e7", + "url": "./static/media/ibm-plex-sans-latin-700.b8809d61.woff" + }, + { + "revision": "c9983d3d04f3ed6c2eafee1db1d24e06", + "url": "./static/media/ibm-plex-sans-latin-700.c9983d3d.woff2" + }, + { + "revision": "02954beec9e742bb1f3ae27b7e7cb71f", + "url": "./static/media/ibm-plex-sans-latin-700italic.02954bee.woff2" + }, + { + "revision": "72e9af409ddafc63a5dd380e34758560", + "url": "./static/media/ibm-plex-sans-latin-700italic.72e9af40.woff" + }, + { + "revision": "0509ab09c1b0d2200a4135803c91d6ce", + "url": "./static/media/material-icons.0509ab09.woff2" + } +]); \ No newline at end of file diff --git a/web/gui/dashboard/service-worker.js b/web/gui/dashboard/service-worker.js index 19190cf31..3017de3cb 100644 --- a/web/gui/dashboard/service-worker.js +++ b/web/gui/dashboard/service-worker.js @@ -14,7 +14,7 @@ importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js"); importScripts( - "./precache-manifest.b443acc162e1adddca46165b647e9f4b.js" + "./precache-manifest.e95d658eed560f9e0189217cc6919238.js" ); self.addEventListener('message', (event) => { diff --git a/web/gui/dashboard/static/css/main.102ce44c.chunk.css b/web/gui/dashboard/static/css/main.102ce44c.chunk.css deleted file mode 100644 index ae00a0e22..000000000 --- a/web/gui/dashboard/static/css/main.102ce44c.chunk.css +++ /dev/null @@ -1,2 +0,0 @@ -.netdata-reset-button{padding:0;border:none;font:inherit;background-color:transparent;cursor:pointer}.netdata-reset-button:focus{outline:none}.netdata-reset-button::-moz-focus-inner{border:none}html{overflow-y:hidden;font-size:16px!important}body{padding-top:50px}.navbar-highlight{display:none;position:fixed;margin-top:10px;height:26px;width:100%;text-align:center;overflow:hidden;z-index:30;pointer-events:none!important}.navbar-highlight-content{position:relative;display:inline-block;margin:0 auto;height:26px;min-width:500px;background-color:rgba(0,0,0,.7);padding:2px 15px;border-radius:10px;color:#d3d3d3;pointer-events:auto!important}.navbar-highlight-bar{cursor:pointer}.navbar-highlight-button-right{cursor:pointer;padding-left:10px}.modal-wide .modal-dialog{width:80%}h1{z-index:-1}h1,h2{position:relative}h2{z-index:-2}h1:before,h2:before{display:block;content:" ";margin-top:-70px;height:70px;visibility:hidden}.p{display:block;margin-top:15px}.option-control,.option-row{vertical-align:top;padding:30px 10px 10px 30px}.option-info{padding:10px}.dashboard-context-info,.dashboard-submenu-info{display:block;margin-top:10px}.dashboard-context-info{color:#878b90;color:var(--color-border,#878b90)}.dashboard-context-info a{color:#00ab44;color:var(--color-primary,#00ab44)}#masthead h1{line-height:1;padding-top:30px}#masthead .well{margin-top:4%}body.modal-open{width:100%!important;padding-right:0!important;overflow:visible}.panel-title a{display:block;padding:10px 15px;margin:-10px -15px}.affix{position:static}.sidebar-body{margin-top:0}.dashboard-sidebar{max-height:calc(100% - 24px)!important;overflow-y:auto}.dashboard-sidebar.affix{position:static}.dashboard-sidenav{margin-top:20px;margin-bottom:20px}.dashboard-sidenav.affix{position:static}.dashboard-sidebar .nav>li>a{display:block;padding:4px 8px;font-size:13px;font-weight:500;color:#767676}.dashboard-sidebar .nav>li>.nav>li>a{padding:2px 12px}.dashboard-sidebar .nav>li>a>.svg-inline--fa{width:20px;text-align:center}.dashboard-sidebar .nav>li>a:focus,.dashboard-sidebar .nav>li>a:hover{padding-left:7px;color:#563d7c;text-decoration:none;background-color:transparent;border-left:1px solid #563d7c}.dashboard-sidebar .nav>.active:focus>a,.dashboard-sidebar .nav>.active:hover>a,.dashboard-sidebar .nav>.active>a{padding-left:6px;font-weight:700;color:#563d7c;background-color:transparent;border-left:2px solid #563d7c}.dashboard-sidebar .nav .nav{display:none;padding-bottom:10px}.dashboard-sidebar .nav .nav>li>a{padding-top:1px;padding-bottom:1px;font-size:12px;font-weight:400}.dashboard-sidebar .nav .nav>li>a:focus,.dashboard-sidebar .nav .nav>li>a:hover{padding-left:11px}.dashboard-sidebar .nav .nav>.active:focus>a,.dashboard-sidebar .nav .nav>.active:hover>a,.dashboard-sidebar .nav .nav>.active>a{padding-left:6px;font-weight:500}.multi-column-dropdown{list-style:none;padding:0}.multi-column-dropdown li a{display:inline-block;clear:both;line-height:1.428571429;white-space:normal}.multi-column-dropdown li a:hover{text-decoration:none;color:#f5f5f5;background-color:#262626}.scrollable-menu-50{height:auto;max-height:50vh;overflow-x:hidden}.container{width:calc(100% - 20px)!important}.charts-body{display:inline-block;width:100%}.sidebar-body{position:absolute;display:none;height:100vh}.terms-and-privacy a{color:inherit;text-decoration:underline;display:block}.dashboard-section-container{page-break-inside:auto}.dashboard-print-row,.dashboard-section-container{display:block;width:100%;page-break-before:auto;page-break-after:auto}.dashboard-print-row{page-break-inside:avoid}.netdata-chartblock-container{display:inline-block}.tooltip{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.action-button{position:relative;display:inline-block;color:grey;cursor:pointer;margin:0 auto;width:30px;height:30px;font-size:25px}.ripple{position:relative;-webkit-transform:translateZ(0);transform:translateZ(0)}.ripple:after{content:"";display:block;position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none;background-image:radial-gradient(circle,#000 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;-webkit-transform:scale(18);transform:scale(18);opacity:0;-webkit-transition:opacity 1s,-webkit-transform .5s;transition:opacity 1s,-webkit-transform .5s;transition:transform .5s,opacity 1s;transition:transform .5s,opacity 1s,-webkit-transform .5s}.ripple:active:after{-webkit-transform:scale(0);transform:scale(0);opacity:.2;-webkit-transition:0s;transition:0s}#alarms_log_table tbody tr{cursor:pointer}.agent-item--separated{border-top:1px solid #333}.agent-item--alternate a{color:#999}#sign-in-iframe{background-color:#fff;border:none}.filter-control{position:relative}.sign-in-btn{background-color:#1e2126}.sign-in-btn.theme-white{background-color:#e6e6e6}.sign-in-btn.theme-white span{color:#000}.beta{color:#fc0}@media (min-width:1360px){.container{padding-left:3%!important}.charts-body{width:calc(100% - 263px)!important;padding-left:1%!important;padding-right:2%!important}.sidebar-body{display:inline-block!important}.dashboard-sidebar.affix,.dashboard-sidebar.affix-bottom,.dashboard-sidebar.affix-top,.sidebar-body{width:263px!important}}@media (min-width:1200px){.container{padding-left:2%!important}.charts-body{width:calc(100% - 233px)!important;padding-left:1%!important;padding-right:1%!important}.sidebar-body{display:inline-block!important}.dashboard-sidebar.affix,.dashboard-sidebar.affix-bottom,.dashboard-sidebar.affix-top,.sidebar-body{width:233px!important}}@media (min-width:992px){.container{padding-left:0!important}.charts-body{width:calc(100% - 213px)!important;padding-left:1%!important;padding-right:0!important}.sidebar-body{display:inline-block!important;width:213px!important}.dashboard-sidebar .nav>.active>ul{display:block}.dashboard-sidebar.affix,.dashboard-sidebar.affix-bottom,.dashboard-sidebar.affix-top{width:213px!important}.dashboard-sidebar.affix{position:fixed}.dashboard-sidebar.affix-bottom{position:absolute}}@media (min-width:860px){.dashboard-sidebar{padding-left:20px}}@media (min-width:768px){.dashboard-sidebar{padding-left:20px}.charts-body{padding-left:0;padding-right:0}}@media print{body{overflow:visible!important;-webkit-print-color-adjust:exact}.dashboard-section,body{page-break-inside:auto;page-break-before:auto;page-break-after:auto}.dashboard-subsection{page-break-before:avoid}.charts-body,.dashboard-subsection{page-break-after:auto;page-break-inside:auto}.charts-body{padding-left:0;padding-right:0;display:block;page-break-before:auto}}#ssoifrm{display:none}@font-face{font-family:Material Icons;font-style:normal;font-weight:400;src:url(../../static/media/material-icons.0509ab09.woff2) format("woff2")}.material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:"liga";-webkit-font-smoothing:antialiased}.dygraph-chart__labels-hidden{display:none}.chart-container__loader{position:absolute}.print-modal__close-button--disabled{pointer-events:none}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;padding-left:74px;-webkit-transition:padding-left .2s ease-out;transition:padding-left .2s ease-out}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}@media (min-width:1200px){.with-panel{padding-left:372px}} -/*# sourceMappingURL=main.102ce44c.chunk.css.map */ \ No newline at end of file diff --git a/web/gui/dashboard/static/css/main.102ce44c.chunk.css.map b/web/gui/dashboard/static/css/main.102ce44c.chunk.css.map deleted file mode 100644 index fef4c77ed..000000000 --- a/web/gui/dashboard/static/css/main.102ce44c.chunk.css.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["button.css","main.css","fonts.css","dygraph-chart.css","chart-with-loader.css","print-modal.scss","index.css"],"names":[],"mappings":"AAAA,sBACE,SAAU,CACV,WAAY,CACZ,YAAa,CAEb,4BAA6B,CAG7B,cACF,CAEA,4BACE,YACF,CAGA,wCACE,WACF,CCjBA,KACI,iBAAkB,CAClB,wBACJ,CAGA,KACI,gBACJ,CAEA,kBACI,YAAa,CACb,cAAe,CACf,eAAgB,CAChB,WAAY,CACZ,UAAW,CACX,iBAAkB,CAClB,eAAgB,CAChB,UAAW,CACX,6BACJ,CAEA,0BACI,iBAAkB,CAClB,oBAAqB,CACrB,aAAc,CACd,WAAY,CACZ,eAAgB,CAChB,+BAAoC,CAIpC,gBAAmB,CACnB,kBAAmB,CACnB,aAAgB,CAChB,6BACJ,CAEA,sBACI,cACJ,CAEA,+BACI,cAAe,CACf,iBACJ,CAEA,0BACI,SACJ,CAKA,GAEI,UACJ,CAEA,MAJI,iBAOJ,CAHA,GAEI,UACJ,CAEA,oBAEI,aAAc,CACd,WAAY,CACZ,gBAAiB,CACjB,WAAY,CACZ,iBACJ,CAEA,GACI,aAAc,CACd,eACJ,CAEA,4BAEI,kBAAmB,CAGnB,2BACJ,CAEA,aACI,YACJ,CAOA,gDAJI,aAAc,CACd,eAOJ,CAJA,wBAGI,aAAmC,CAAnC,iCACJ,CAEA,0BACI,aAAoC,CAApC,kCACJ,CAEA,aAEI,aAAc,CACd,gBACJ,CAEA,gBACI,aACJ,CAIA,gBACI,oBAAsB,CACtB,yBAA2B,CAG3B,gBACJ,CAGA,eACI,aAAc,CACd,iBAAkB,CAClB,kBACJ,CASA,OACI,eAGJ,CAEA,cACI,YACJ,CAEA,mBACI,sCAAwC,CACxC,eAEJ,CAGA,yBACI,eACJ,CAGA,mBACI,eAAgB,CAChB,kBACJ,CAEA,yBACI,eACJ,CAGA,6BACI,aAAc,CACd,eAAgB,CAChB,cAAe,CACf,eAAgB,CAChB,aACJ,CAEA,qCACI,gBACJ,CAEA,6CACI,UAAW,CACX,iBACJ,CAEA,sEAEI,gBAAiB,CACjB,aAAc,CACd,oBAAqB,CACrB,4BAA6B,CAC7B,6BACJ,CAEA,kHAGI,gBAAiB,CACjB,eAAiB,CACjB,aAAc,CACd,4BAA6B,CAC7B,6BACJ,CAGA,6BACI,YAAa,CACb,mBACJ,CAEA,kCACI,eAAgB,CAChB,kBAAmB,CACnB,cAAe,CACf,eACJ,CAEA,gFAEI,iBACJ,CAEA,iIAGI,gBAAiB,CACjB,eACJ,CAEA,uBACI,eAAgB,CAChB,SACJ,CAEA,4BACI,oBAAqB,CACrB,UAAW,CACX,uBAAwB,CACxB,kBACJ,CAEA,kCACI,oBAAqB,CACrB,aAAc,CACd,wBACJ,CAEA,oBACI,WAAY,CACZ,eAAgB,CAChB,iBACJ,CAEA,WACI,iCACJ,CAEA,aACI,oBAAqB,CACrB,UACJ,CAEA,cACI,iBAAkB,CAClB,YAAa,CACb,YACJ,CAEA,qBACI,aAAc,CACd,yBAA0B,CAC1B,aACJ,CAEA,6BAKI,sBACJ,CAEA,kDAPI,aAAc,CACd,UAAW,CACX,sBAAuB,CACvB,qBAUJ,CANA,qBAKI,uBACJ,CAEA,8BACI,oBACJ,CAGA,SACI,wBAAyB,CACzB,qBAAsB,CACtB,oBAAqB,CACrB,gBACJ,CAEA,eACI,iBAAkB,CAClB,oBAAqB,CACrB,UAAW,CACX,cAAe,CACf,aAAc,CACd,UAAW,CACX,WAAY,CACZ,cACJ,CAEA,QACI,iBAAkB,CAElB,+BAA+B,CAA/B,uBACJ,CAEA,cACI,UAAW,CACX,aAAc,CACd,iBAAkB,CAClB,UAAW,CACX,WAAY,CACZ,KAAM,CACN,MAAO,CACP,mBAAoB,CACpB,oEAAuE,CACvE,2BAA4B,CAC5B,uBAAwB,CACxB,2BAAwB,CAAxB,mBAAwB,CACxB,SAAU,CACV,mDAAsC,CAAtC,2CAAsC,CAAtC,mCAAsC,CAAtC,yDACJ,CAEA,qBACI,0BAAsB,CAAtB,kBAAsB,CACtB,UAAY,CACZ,qBAAc,CAAd,aACJ,CAIA,2BACI,cACJ,CAEA,uBACI,yBACJ,CAEA,yBACI,UACJ,CAIA,gBACI,qBAAsB,CACtB,WACJ,CAEA,gBACI,iBACJ,CAEA,aACI,wBACJ,CAEA,yBACI,wBACJ,CAEA,8BACI,UACJ,CAEA,MACI,UACJ,CAEA,0BACI,WACI,yBACJ,CAEA,aACI,kCAAoC,CACpC,yBAA2B,CAC3B,0BACJ,CAEA,cACI,8BAEJ,CAGA,oGAJI,qBAQJ,CACJ,CAEA,0BACI,WACI,yBACJ,CAEA,aACI,kCAAoC,CACpC,yBAA2B,CAC3B,0BACJ,CAEA,cACI,8BAEJ,CAGA,oGAJI,qBAQJ,CACJ,CAEA,yBACI,WACI,wBACJ,CAEA,aACI,kCAAoC,CACpC,yBAA2B,CAC3B,yBACJ,CAEA,cACI,8BAAgC,CAChC,qBACJ,CAEA,mCACI,aACJ,CAGA,sFAGI,qBACJ,CAEA,yBACI,cAEJ,CAEA,gCACI,iBACJ,CACJ,CAEA,yBACI,mBACI,iBACJ,CACJ,CAEA,yBACI,mBACI,iBACJ,CAEA,aACI,cAAgB,CAChB,eACJ,CACJ,CAEA,aACI,KACI,0BAA4B,CAC5B,gCAIJ,CAEA,wBALI,sBAAuB,CACvB,sBAAuB,CACvB,qBAOJ,CAEA,sBACI,uBAGJ,CAEA,mCAJI,qBAAsB,CACtB,sBAUJ,CAPA,aACI,cAAgB,CAChB,eAAiB,CACjB,aAAc,CAEd,sBAEJ,CACJ,CAEA,SACI,YACJ,CCzgBA,WACE,0BAA6B,CAC7B,iBAAkB,CAClB,eAAgB,CAChB,yEACF,CAEA,gBACE,0BAA6B,CAC7B,eAAmB,CACnB,iBAAkB,CAClB,cAAe,CACf,aAAc,CACd,qBAAsB,CACtB,mBAAoB,CACpB,oBAAqB,CACrB,kBAAmB,CACnB,gBAAiB,CACjB,aAAc,CACd,oCAAqC,CACrC,kCACF,CCtBA,8BACE,YACF,CCFA,yBAIE,iBACF,CCHI,qCACE,mBAAoB,CCH1B,KACE,QAAS,CACT,mIACsE,CACtE,kCAAmC,CACnC,iCAAkC,CAClC,iBAAkB,CAClB,4CAAsC,CAAtC,oCACF,CAEA,KACE,uEACF,CAEA,0BACE,YACE,kBACF,CACF","file":"main.102ce44c.chunk.css","sourcesContent":[".netdata-reset-button {\n padding: 0;\n border: none;\n font: inherit;\n /*color: inherit;*/\n background-color: transparent;\n /* show a hand cursor on hover; some argue that we\n should keep the default arrow cursor for buttons */\n cursor: pointer;\n}\n\n.netdata-reset-button:focus {\n outline: none;\n}\n\n/* Firefox: remove the inner border shown on focus */\n.netdata-reset-button::-moz-focus-inner {\n border: none;\n}\n","/* force the vertical window scrollbar */\nhtml {\n overflow-y: hidden;\n font-size: 16px !important; /* To override nasty bootstrap.css default! */\n}\n\n/* prevent body from hiding under the navbar */\nbody {\n padding-top: 50px;\n}\n\n.navbar-highlight {\n display: none;\n position: fixed;\n margin-top: 10px;\n height: 26px;\n width: 100%;\n text-align: center;\n overflow: hidden;\n z-index: 30;\n pointer-events: none !important;\n}\n\n.navbar-highlight-content {\n position: relative;\n display: inline-block;\n margin: 0 auto;\n height: 26px;\n min-width: 500px;\n background-color: rgba(0, 0, 0, 0.7);\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 15px;\n padding-right: 15px;\n border-radius: 10px;\n color: lightgrey;\n pointer-events: auto !important;\n}\n\n.navbar-highlight-bar {\n cursor: pointer;\n}\n\n.navbar-highlight-button-right {\n cursor: pointer;\n padding-left: 10px;\n}\n\n.modal-wide .modal-dialog {\n width: 80%;\n}\n\n/* fix # anchors scrolling under the navbar\n https://github.com/twbs/bootstrap/issues/1768#issuecomment-46519033\n */\nh1 {\n position: relative;\n z-index: -1;\n}\n\nh2 {\n position: relative;\n z-index: -2;\n}\n\nh1:before,\nh2:before {\n display: block;\n content: \" \";\n margin-top: -70px;\n height: 70px;\n visibility: hidden;\n}\n\n.p {\n display: block;\n margin-top: 15px;\n}\n\n.option-row,\n.option-control {\n vertical-align: top;\n padding: 10px;\n padding-top: 30px;\n padding-left: 30px;\n}\n\n.option-info {\n padding: 10px;\n}\n\n.dashboard-submenu-info {\n display: block;\n margin-top: 10px;\n}\n\n.dashboard-context-info {\n display: block;\n margin-top: 10px;\n color: var(--color-border, #878b90);\n}\n\n.dashboard-context-info a {\n color: var(--color-primary, #00ab44);\n}\n\n#masthead h1 {\n /*font-size: 30px;*/\n line-height: 1;\n padding-top: 30px;\n}\n\n#masthead .well {\n margin-top: 4%;\n}\n\n/* fix the navbar shifting when a modal is open */\n/* https://github.com/twbs/bootstrap/issues/14040#issuecomment-159891033 */\nbody.modal-open {\n width: 100% !important;\n padding-right: 0 !important;\n /* overflow-y: scroll !important; */\n /* position: fixed !important;*/\n overflow: visible;\n}\n\n/* make accordion use the whole header bar for expand/collapse */\n.panel-title a {\n display: block;\n padding: 10px 15px;\n margin: -10px -15px;\n}\n\n/*\n * Side navigation\n *\n * Scrollspy and affixed enhanced navigation to highlight sections and secondary\n * sections of docs content.\n */\n\n.affix {\n position: static;\n /* top: 140px !important; */\n /*width: 220px;*/\n}\n\n.sidebar-body {\n margin-top: 0;\n}\n\n.dashboard-sidebar {\n max-height: calc(100% - 24px) !important;\n overflow-y: auto;\n /*width: 220px !important;*/\n}\n\n/* By default it's not affixed in mobile views, so undo that */\n.dashboard-sidebar.affix {\n position: static;\n}\n\n/* First level of nav */\n.dashboard-sidenav {\n margin-top: 20px;\n margin-bottom: 20px;\n}\n\n.dashboard-sidenav.affix {\n position: static;\n}\n\n/* All levels of nav */\n.dashboard-sidebar .nav > li > a {\n display: block;\n padding: 4px 8px;\n font-size: 13px;\n font-weight: 500;\n color: #767676;\n}\n\n.dashboard-sidebar .nav > li > .nav > li > a {\n padding: 2px 12px;\n}\n\n.dashboard-sidebar .nav > li > a > .svg-inline--fa {\n width: 20px;\n text-align: center;\n}\n\n.dashboard-sidebar .nav > li > a:hover,\n.dashboard-sidebar .nav > li > a:focus {\n padding-left: 7px;\n color: #563d7c;\n text-decoration: none;\n background-color: transparent;\n border-left: 1px solid #563d7c;\n}\n\n.dashboard-sidebar .nav > .active > a,\n.dashboard-sidebar .nav > .active:hover > a,\n.dashboard-sidebar .nav > .active:focus > a {\n padding-left: 6px;\n font-weight: bold;\n color: #563d7c;\n background-color: transparent;\n border-left: 2px solid #563d7c;\n}\n\n/* Nav: second level (shown on .active) */\n.dashboard-sidebar .nav .nav {\n display: none; /* Hide by default, but at >768px, show it */\n padding-bottom: 10px;\n}\n\n.dashboard-sidebar .nav .nav > li > a {\n padding-top: 1px;\n padding-bottom: 1px;\n font-size: 12px;\n font-weight: normal;\n}\n\n.dashboard-sidebar .nav .nav > li > a:hover,\n.dashboard-sidebar .nav .nav > li > a:focus {\n padding-left: 11px;\n}\n\n.dashboard-sidebar .nav .nav > .active > a,\n.dashboard-sidebar .nav .nav > .active:hover > a,\n.dashboard-sidebar .nav .nav > .active:focus > a {\n padding-left: 6px;\n font-weight: 500;\n}\n\n.multi-column-dropdown {\n list-style: none;\n padding: 0;\n}\n\n.multi-column-dropdown li a {\n display: inline-block;\n clear: both;\n line-height: 1.428571429;\n white-space: normal;\n}\n\n.multi-column-dropdown li a:hover {\n text-decoration: none;\n color: #f5f5f5;\n background-color: #262626;\n}\n\n.scrollable-menu-50 {\n height: auto;\n max-height: 50vh;\n overflow-x: hidden;\n}\n\n.container {\n width: calc(100% - 20px) !important;\n}\n\n.charts-body {\n display: inline-block;\n width: 100%;\n}\n\n.sidebar-body {\n position: absolute;\n display: none;\n height: 100vh;\n}\n\n.terms-and-privacy a {\n color: inherit;\n text-decoration: underline;\n display: block;\n}\n\n.dashboard-section-container {\n display: block;\n width: 100%;\n page-break-before: auto;\n page-break-after: auto;\n page-break-inside: auto;\n}\n\n.dashboard-print-row {\n display: block;\n width: 100%;\n page-break-before: auto;\n page-break-after: auto;\n page-break-inside: avoid;\n}\n\n.netdata-chartblock-container {\n display: inline-block;\n}\n\n/* https://github.com/seiyria/bootstrap-slider/issues/746 */\n.tooltip {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.action-button {\n position: relative;\n display: inline-block;\n color: gray;\n cursor: pointer;\n margin: 0 auto;\n width: 30px;\n height: 30px;\n font-size: 25px;\n}\n\n.ripple {\n position: relative;\n /*overflow: hidden;*/\n transform: translate3d(0, 0, 0);\n}\n\n.ripple:after {\n content: \"\";\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n pointer-events: none;\n background-image: radial-gradient(circle, #000 10%, transparent 10.01%);\n background-repeat: no-repeat;\n background-position: 50%;\n transform: scale(18, 18); /* the size of the ripple */\n opacity: 0;\n transition: transform 0.5s, opacity 1s;\n}\n\n.ripple:active:after {\n transform: scale(0, 0);\n opacity: 0.2;\n transition: 0s;\n}\n\n/* -------------------------------------------------------------------------- */\n\n#alarms_log_table tbody tr {\n cursor: pointer;\n}\n\n.agent-item--separated {\n border-top: 1px solid #333;\n}\n\n.agent-item--alternate a {\n color: #999;\n}\n\n/* white theme overrides */\n\n#sign-in-iframe {\n background-color: #fff;\n border: none;\n}\n\n.filter-control {\n position: relative;\n}\n\n.sign-in-btn {\n background-color: #1e2126;\n}\n\n.sign-in-btn.theme-white {\n background-color: #e6e6e6;\n}\n\n.sign-in-btn.theme-white span {\n color: #000;\n}\n\n.beta {\n color: #ffcc00;\n}\n\n@media (min-width: 1360px) {\n .container {\n padding-left: 3% !important;\n }\n\n .charts-body {\n width: calc(100% - 263px) !important;\n padding-left: 1% !important;\n padding-right: 2% !important;\n }\n\n .sidebar-body {\n display: inline-block !important;\n width: 263px !important;\n }\n\n /* Widen the fixed sidebar again */\n .dashboard-sidebar.affix,\n .dashboard-sidebar.affix-top,\n .dashboard-sidebar.affix-bottom {\n width: 263px !important;\n }\n}\n\n@media (min-width: 1200px) {\n .container {\n padding-left: 2% !important;\n }\n\n .charts-body {\n width: calc(100% - 233px) !important;\n padding-left: 1% !important;\n padding-right: 1% !important;\n }\n\n .sidebar-body {\n display: inline-block !important;\n width: 233px !important;\n }\n\n /* Widen the fixed sidebar again */\n .dashboard-sidebar.affix,\n .dashboard-sidebar.affix-top,\n .dashboard-sidebar.affix-bottom {\n width: 233px !important;\n }\n}\n\n@media (min-width: 992px) {\n .container {\n padding-left: 0% !important;\n }\n\n .charts-body {\n width: calc(100% - 213px) !important;\n padding-left: 1% !important;\n padding-right: 0% !important;\n }\n\n .sidebar-body {\n display: inline-block !important;\n width: 213px !important;\n }\n\n .dashboard-sidebar .nav > .active > ul {\n display: block;\n }\n\n /* Widen the fixed sidebar */\n .dashboard-sidebar.affix,\n .dashboard-sidebar.affix-top,\n .dashboard-sidebar.affix-bottom {\n width: 213px !important;\n }\n\n .dashboard-sidebar.affix {\n position: fixed; /* Undo the static from mobile first approach */\n /* top: 20px; */\n }\n\n .dashboard-sidebar.affix-bottom {\n position: absolute; /* Undo the static from mobile first approach */\n }\n}\n\n@media (min-width: 860px) {\n .dashboard-sidebar {\n padding-left: 20px;\n }\n}\n\n@media (min-width: 768px) {\n .dashboard-sidebar {\n padding-left: 20px;\n }\n\n .charts-body {\n padding-left: 0%;\n padding-right: 0%;\n }\n}\n\n@media print {\n body {\n overflow: visible !important;\n -webkit-print-color-adjust: exact;\n page-break-inside: auto;\n page-break-before: auto;\n page-break-after: auto;\n }\n\n .dashboard-section {\n page-break-inside: auto;\n page-break-before: auto;\n page-break-after: auto;\n }\n\n .dashboard-subsection {\n page-break-before: avoid;\n page-break-after: auto;\n page-break-inside: auto;\n }\n\n .charts-body {\n padding-left: 0%;\n padding-right: 0%;\n display: block;\n page-break-inside: auto;\n page-break-before: auto;\n page-break-after: auto;\n }\n}\n\n#ssoifrm {\n display: none;\n}\n","/* fallback */\n@font-face {\n font-family: 'Material Icons';\n font-style: normal;\n font-weight: 400;\n src: url(\"../fonts/material-icons.woff2\") format('woff2');\n}\n\n.material-icons {\n font-family: 'Material Icons';\n font-weight: normal;\n font-style: normal;\n font-size: 24px;\n line-height: 1;\n letter-spacing: normal;\n text-transform: none;\n display: inline-block;\n white-space: nowrap;\n word-wrap: normal;\n direction: ltr;\n -webkit-font-feature-settings: 'liga';\n -webkit-font-smoothing: antialiased;\n}\n",".dygraph-chart__labels-hidden {\n display: none;\n}\n",".chart-container__loader {\n /* absolute, because to create GaugeChart the height of container is calculated during loading of data\n and loader cannot have any impact on chart size\n */\n position: absolute;\n}\n",".print-modal {\n &__close-button {\n &--disabled {\n pointer-events: none;\n }\n }\n}\n","body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n padding-left: 74px;\n transition: padding-left 0.2s ease-out;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n\n@media (min-width: 1200px) {\n .with-panel {\n padding-left: 372px;\n }\n}\n"]} \ No newline at end of file diff --git a/web/gui/dashboard/static/css/main.53ba10f1.chunk.css b/web/gui/dashboard/static/css/main.53ba10f1.chunk.css new file mode 100644 index 000000000..5e4b9e86b --- /dev/null +++ b/web/gui/dashboard/static/css/main.53ba10f1.chunk.css @@ -0,0 +1,2 @@ +.netdata-reset-button{padding:0;border:none;font:inherit;background-color:transparent;cursor:pointer}.netdata-reset-button:focus{outline:none}.netdata-reset-button::-moz-focus-inner{border:none}html{overflow-y:hidden;font-size:16px!important}body{padding-top:50px}.navbar-highlight{display:none;position:fixed;margin-top:10px;height:26px;width:100%;text-align:center;overflow:hidden;z-index:30;pointer-events:none!important}.navbar-highlight-content{position:relative;display:inline-block;margin:0 auto;height:26px;min-width:500px;background-color:rgba(0,0,0,.7);padding:2px 15px;border-radius:10px;color:#d3d3d3;pointer-events:auto!important}.navbar-highlight-bar{cursor:pointer}.navbar-highlight-button-right{cursor:pointer;padding-left:10px}.modal-wide .modal-dialog{width:80%}h1{z-index:-1}h1,h2{position:relative}h2{z-index:-2}h1:before,h2:before{display:block;content:" ";margin-top:-70px;height:70px;visibility:hidden}.p{display:block;margin-top:15px}.option-control,.option-row{vertical-align:top;padding:30px 10px 10px 30px}.option-info{padding:10px}.dashboard-context-info,.dashboard-submenu-info{display:block;margin-top:10px}.dashboard-context-info{color:#878b90;color:var(--color-border,#878b90)}.dashboard-context-info a{color:#00ab44;color:var(--color-primary,#00ab44)}#masthead h1{line-height:1;padding-top:30px}#masthead .well{margin-top:4%}body.modal-open{width:100%!important;padding-right:0!important;overflow:visible}.panel-title a{display:block;padding:10px 15px;margin:-10px -15px}.affix{position:static}.sidebar-body{margin-top:0}.dashboard-sidebar{max-height:calc(100% - 24px)!important;overflow-y:auto}.dashboard-sidebar.affix{position:static}.dashboard-sidenav{margin-top:20px;margin-bottom:20px}.dashboard-sidenav.affix{position:static}.dashboard-sidebar .nav>li>a{display:block;padding:4px 8px;font-size:13px;font-weight:500;color:#767676}.dashboard-sidebar .nav>li>.nav>li>a{padding:2px 12px}.dashboard-sidebar .nav>li>a>.svg-inline--fa{width:20px;text-align:center}.dashboard-sidebar .nav>li>a:focus,.dashboard-sidebar .nav>li>a:hover{padding-left:7px;color:#563d7c;text-decoration:none;background-color:transparent;border-left:1px solid #563d7c}.dashboard-sidebar .nav>.active:focus>a,.dashboard-sidebar .nav>.active:hover>a,.dashboard-sidebar .nav>.active>a{padding-left:6px;font-weight:700;color:#563d7c;background-color:transparent;border-left:2px solid #563d7c}.dashboard-sidebar .nav .nav{display:none;padding-bottom:10px}.dashboard-sidebar .nav .nav>li>a{padding-top:1px;padding-bottom:1px;font-size:12px;font-weight:400}.dashboard-sidebar .nav .nav>li>a:focus,.dashboard-sidebar .nav .nav>li>a:hover{padding-left:11px}.dashboard-sidebar .nav .nav>.active:focus>a,.dashboard-sidebar .nav .nav>.active:hover>a,.dashboard-sidebar .nav .nav>.active>a{padding-left:6px;font-weight:500}.multi-column-dropdown{list-style:none;padding:0}.multi-column-dropdown li a{display:inline-block;clear:both;line-height:1.428571429;white-space:normal}.multi-column-dropdown li a:hover{text-decoration:none;color:#f5f5f5;background-color:#262626}.scrollable-menu-50{height:auto;max-height:50vh;overflow-x:hidden}.container{width:calc(100% - 20px)!important}.charts-body{display:inline-block;width:100%}.sidebar-body{position:absolute;display:none;height:100vh}.terms-and-privacy a{color:inherit;text-decoration:underline;display:block}.dashboard-section-container{page-break-inside:auto}.dashboard-print-row,.dashboard-section-container{display:block;width:100%;page-break-before:auto;page-break-after:auto}.dashboard-print-row{page-break-inside:avoid}.netdata-chartblock-container{display:inline-block;overflow:hidden}.tooltip{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.action-button{position:relative;display:inline-block;color:grey;cursor:pointer;margin:0 auto;width:30px;height:30px;font-size:25px}.ripple{position:relative;-webkit-transform:translateZ(0);transform:translateZ(0)}.ripple:after{content:"";display:block;position:absolute;width:100%;height:100%;top:0;left:0;pointer-events:none;background-image:radial-gradient(circle,#000 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;-webkit-transform:scale(18);transform:scale(18);opacity:0;-webkit-transition:opacity 1s,-webkit-transform .5s;transition:opacity 1s,-webkit-transform .5s;transition:transform .5s,opacity 1s;transition:transform .5s,opacity 1s,-webkit-transform .5s}.ripple:active:after{-webkit-transform:scale(0);transform:scale(0);opacity:.2;-webkit-transition:0s;transition:0s}#alarms_log_table tbody tr{cursor:pointer}.agent-item--separated{border-top:1px solid #333}.agent-item--alternate a{color:#999}#sign-in-iframe{background-color:#fff;border:none}.filter-control{position:relative}.sign-in-btn{background-color:#1e2126}.sign-in-btn.theme-white{background-color:#e6e6e6}.sign-in-btn.theme-white span{color:#000}.beta{color:#fc0}@media (min-width:1360px){.container{padding-left:3%!important}.charts-body{width:calc(100% - 263px)!important;padding-left:1%!important;padding-right:2%!important}.sidebar-body{display:inline-block!important}.dashboard-sidebar.affix,.dashboard-sidebar.affix-bottom,.dashboard-sidebar.affix-top,.sidebar-body{width:263px!important}}@media (min-width:1200px){.container{padding-left:2%!important}.charts-body{width:calc(100% - 233px)!important;padding-left:1%!important;padding-right:1%!important}.sidebar-body{display:inline-block!important}.dashboard-sidebar.affix,.dashboard-sidebar.affix-bottom,.dashboard-sidebar.affix-top,.sidebar-body{width:233px!important}}@media (min-width:992px){.container{padding-left:0!important}.charts-body{width:calc(100% - 213px)!important;padding-left:1%!important;padding-right:0!important}.sidebar-body{display:inline-block!important;width:213px!important}.dashboard-sidebar .nav>.active>ul{display:block}.dashboard-sidebar.affix,.dashboard-sidebar.affix-bottom,.dashboard-sidebar.affix-top{width:213px!important}.dashboard-sidebar.affix{position:fixed}.dashboard-sidebar.affix-bottom{position:absolute}}@media (min-width:860px){.dashboard-sidebar{padding-left:20px}}@media (min-width:768px){.dashboard-sidebar{padding-left:20px}.charts-body{padding-left:0;padding-right:0}}@media print{body{overflow:visible!important;-webkit-print-color-adjust:exact}.dashboard-section,body{page-break-inside:auto;page-break-before:auto;page-break-after:auto}.dashboard-subsection{page-break-before:avoid}.charts-body,.dashboard-subsection{page-break-after:auto;page-break-inside:auto}.charts-body{padding-left:0;padding-right:0;display:block;page-break-before:auto}}#ssoifrm{display:none}@font-face{font-family:Material Icons;font-style:normal;font-weight:400;src:url(../../static/media/material-icons.0509ab09.woff2) format("woff2")}.material-icons{font-family:Material Icons;font-weight:400;font-style:normal;font-size:24px;line-height:1;letter-spacing:normal;text-transform:none;display:inline-block;white-space:nowrap;word-wrap:normal;direction:ltr;-webkit-font-feature-settings:"liga";-webkit-font-smoothing:antialiased}.dygraph-chart__labels-hidden{display:none}.chart-container__loader{position:absolute}.print-modal__close-button--disabled{pointer-events:none}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;padding-left:74px;-webkit-transition:padding-left .2s ease-out;transition:padding-left .2s ease-out}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}@media (min-width:1200px){.with-panel{padding-left:372px}} +/*# sourceMappingURL=main.53ba10f1.chunk.css.map */ \ No newline at end of file diff --git a/web/gui/dashboard/static/css/main.53ba10f1.chunk.css.map b/web/gui/dashboard/static/css/main.53ba10f1.chunk.css.map new file mode 100644 index 000000000..73fd66cef --- /dev/null +++ b/web/gui/dashboard/static/css/main.53ba10f1.chunk.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["button.css","main.css","fonts.css","dygraph-chart.css","chart-with-loader.css","print-modal.scss","index.css"],"names":[],"mappings":"AAAA,sBACE,SAAU,CACV,WAAY,CACZ,YAAa,CAEb,4BAA6B,CAG7B,cACF,CAEA,4BACE,YACF,CAGA,wCACE,WACF,CCjBA,KACI,iBAAkB,CAClB,wBACJ,CAGA,KACI,gBACJ,CAEA,kBACI,YAAa,CACb,cAAe,CACf,eAAgB,CAChB,WAAY,CACZ,UAAW,CACX,iBAAkB,CAClB,eAAgB,CAChB,UAAW,CACX,6BACJ,CAEA,0BACI,iBAAkB,CAClB,oBAAqB,CACrB,aAAc,CACd,WAAY,CACZ,eAAgB,CAChB,+BAAoC,CAIpC,gBAAmB,CACnB,kBAAmB,CACnB,aAAgB,CAChB,6BACJ,CAEA,sBACI,cACJ,CAEA,+BACI,cAAe,CACf,iBACJ,CAEA,0BACI,SACJ,CAKA,GAEI,UACJ,CAEA,MAJI,iBAOJ,CAHA,GAEI,UACJ,CAEA,oBAEI,aAAc,CACd,WAAY,CACZ,gBAAiB,CACjB,WAAY,CACZ,iBACJ,CAEA,GACI,aAAc,CACd,eACJ,CAEA,4BAEI,kBAAmB,CAGnB,2BACJ,CAEA,aACI,YACJ,CAOA,gDAJI,aAAc,CACd,eAOJ,CAJA,wBAGI,aAAmC,CAAnC,iCACJ,CAEA,0BACI,aAAoC,CAApC,kCACJ,CAEA,aAEI,aAAc,CACd,gBACJ,CAEA,gBACI,aACJ,CAIA,gBACI,oBAAsB,CACtB,yBAA2B,CAG3B,gBACJ,CAGA,eACI,aAAc,CACd,iBAAkB,CAClB,kBACJ,CASA,OACI,eAGJ,CAEA,cACI,YACJ,CAEA,mBACI,sCAAwC,CACxC,eAEJ,CAGA,yBACI,eACJ,CAGA,mBACI,eAAgB,CAChB,kBACJ,CAEA,yBACI,eACJ,CAGA,6BACI,aAAc,CACd,eAAgB,CAChB,cAAe,CACf,eAAgB,CAChB,aACJ,CAEA,qCACI,gBACJ,CAEA,6CACI,UAAW,CACX,iBACJ,CAEA,sEAEI,gBAAiB,CACjB,aAAc,CACd,oBAAqB,CACrB,4BAA6B,CAC7B,6BACJ,CAEA,kHAGI,gBAAiB,CACjB,eAAiB,CACjB,aAAc,CACd,4BAA6B,CAC7B,6BACJ,CAGA,6BACI,YAAa,CACb,mBACJ,CAEA,kCACI,eAAgB,CAChB,kBAAmB,CACnB,cAAe,CACf,eACJ,CAEA,gFAEI,iBACJ,CAEA,iIAGI,gBAAiB,CACjB,eACJ,CAEA,uBACI,eAAgB,CAChB,SACJ,CAEA,4BACI,oBAAqB,CACrB,UAAW,CACX,uBAAwB,CACxB,kBACJ,CAEA,kCACI,oBAAqB,CACrB,aAAc,CACd,wBACJ,CAEA,oBACI,WAAY,CACZ,eAAgB,CAChB,iBACJ,CAEA,WACI,iCACJ,CAEA,aACI,oBAAqB,CACrB,UACJ,CAEA,cACI,iBAAkB,CAClB,YAAa,CACb,YACJ,CAEA,qBACI,aAAc,CACd,yBAA0B,CAC1B,aACJ,CAEA,6BAKI,sBACJ,CAEA,kDAPI,aAAc,CACd,UAAW,CACX,sBAAuB,CACvB,qBAUJ,CANA,qBAKI,uBACJ,CAEA,8BACI,oBAAqB,CACrB,eACJ,CAGA,SACI,wBAAyB,CACzB,qBAAsB,CACtB,oBAAqB,CACrB,gBACJ,CAEA,eACI,iBAAkB,CAClB,oBAAqB,CACrB,UAAW,CACX,cAAe,CACf,aAAc,CACd,UAAW,CACX,WAAY,CACZ,cACJ,CAEA,QACI,iBAAkB,CAElB,+BAA+B,CAA/B,uBACJ,CAEA,cACI,UAAW,CACX,aAAc,CACd,iBAAkB,CAClB,UAAW,CACX,WAAY,CACZ,KAAM,CACN,MAAO,CACP,mBAAoB,CACpB,oEAAuE,CACvE,2BAA4B,CAC5B,uBAAwB,CACxB,2BAAwB,CAAxB,mBAAwB,CACxB,SAAU,CACV,mDAAsC,CAAtC,2CAAsC,CAAtC,mCAAsC,CAAtC,yDACJ,CAEA,qBACI,0BAAsB,CAAtB,kBAAsB,CACtB,UAAY,CACZ,qBAAc,CAAd,aACJ,CAIA,2BACI,cACJ,CAEA,uBACI,yBACJ,CAEA,yBACI,UACJ,CAIA,gBACI,qBAAsB,CACtB,WACJ,CAEA,gBACI,iBACJ,CAEA,aACI,wBACJ,CAEA,yBACI,wBACJ,CAEA,8BACI,UACJ,CAEA,MACI,UACJ,CAEA,0BACI,WACI,yBACJ,CAEA,aACI,kCAAoC,CACpC,yBAA2B,CAC3B,0BACJ,CAEA,cACI,8BAEJ,CAGA,oGAJI,qBAQJ,CACJ,CAEA,0BACI,WACI,yBACJ,CAEA,aACI,kCAAoC,CACpC,yBAA2B,CAC3B,0BACJ,CAEA,cACI,8BAEJ,CAGA,oGAJI,qBAQJ,CACJ,CAEA,yBACI,WACI,wBACJ,CAEA,aACI,kCAAoC,CACpC,yBAA2B,CAC3B,yBACJ,CAEA,cACI,8BAAgC,CAChC,qBACJ,CAEA,mCACI,aACJ,CAGA,sFAGI,qBACJ,CAEA,yBACI,cAEJ,CAEA,gCACI,iBACJ,CACJ,CAEA,yBACI,mBACI,iBACJ,CACJ,CAEA,yBACI,mBACI,iBACJ,CAEA,aACI,cAAgB,CAChB,eACJ,CACJ,CAEA,aACI,KACI,0BAA4B,CAC5B,gCAIJ,CAEA,wBALI,sBAAuB,CACvB,sBAAuB,CACvB,qBAOJ,CAEA,sBACI,uBAGJ,CAEA,mCAJI,qBAAsB,CACtB,sBAUJ,CAPA,aACI,cAAgB,CAChB,eAAiB,CACjB,aAAc,CAEd,sBAEJ,CACJ,CAEA,SACI,YACJ,CC1gBA,WACE,0BAA6B,CAC7B,iBAAkB,CAClB,eAAgB,CAChB,yEACF,CAEA,gBACE,0BAA6B,CAC7B,eAAmB,CACnB,iBAAkB,CAClB,cAAe,CACf,aAAc,CACd,qBAAsB,CACtB,mBAAoB,CACpB,oBAAqB,CACrB,kBAAmB,CACnB,gBAAiB,CACjB,aAAc,CACd,oCAAqC,CACrC,kCACF,CCtBA,8BACE,YACF,CCFA,yBAIE,iBACF,CCHI,qCACE,mBAAoB,CCH1B,KACE,QAAS,CACT,mIACsE,CACtE,kCAAmC,CACnC,iCAAkC,CAClC,iBAAkB,CAClB,4CAAsC,CAAtC,oCACF,CAEA,KACE,uEACF,CAEA,0BACE,YACE,kBACF,CACF","file":"main.53ba10f1.chunk.css","sourcesContent":[".netdata-reset-button {\n padding: 0;\n border: none;\n font: inherit;\n /*color: inherit;*/\n background-color: transparent;\n /* show a hand cursor on hover; some argue that we\n should keep the default arrow cursor for buttons */\n cursor: pointer;\n}\n\n.netdata-reset-button:focus {\n outline: none;\n}\n\n/* Firefox: remove the inner border shown on focus */\n.netdata-reset-button::-moz-focus-inner {\n border: none;\n}\n","/* force the vertical window scrollbar */\nhtml {\n overflow-y: hidden;\n font-size: 16px !important; /* To override nasty bootstrap.css default! */\n}\n\n/* prevent body from hiding under the navbar */\nbody {\n padding-top: 50px;\n}\n\n.navbar-highlight {\n display: none;\n position: fixed;\n margin-top: 10px;\n height: 26px;\n width: 100%;\n text-align: center;\n overflow: hidden;\n z-index: 30;\n pointer-events: none !important;\n}\n\n.navbar-highlight-content {\n position: relative;\n display: inline-block;\n margin: 0 auto;\n height: 26px;\n min-width: 500px;\n background-color: rgba(0, 0, 0, 0.7);\n padding-top: 2px;\n padding-bottom: 2px;\n padding-left: 15px;\n padding-right: 15px;\n border-radius: 10px;\n color: lightgrey;\n pointer-events: auto !important;\n}\n\n.navbar-highlight-bar {\n cursor: pointer;\n}\n\n.navbar-highlight-button-right {\n cursor: pointer;\n padding-left: 10px;\n}\n\n.modal-wide .modal-dialog {\n width: 80%;\n}\n\n/* fix # anchors scrolling under the navbar\n https://github.com/twbs/bootstrap/issues/1768#issuecomment-46519033\n */\nh1 {\n position: relative;\n z-index: -1;\n}\n\nh2 {\n position: relative;\n z-index: -2;\n}\n\nh1:before,\nh2:before {\n display: block;\n content: \" \";\n margin-top: -70px;\n height: 70px;\n visibility: hidden;\n}\n\n.p {\n display: block;\n margin-top: 15px;\n}\n\n.option-row,\n.option-control {\n vertical-align: top;\n padding: 10px;\n padding-top: 30px;\n padding-left: 30px;\n}\n\n.option-info {\n padding: 10px;\n}\n\n.dashboard-submenu-info {\n display: block;\n margin-top: 10px;\n}\n\n.dashboard-context-info {\n display: block;\n margin-top: 10px;\n color: var(--color-border, #878b90);\n}\n\n.dashboard-context-info a {\n color: var(--color-primary, #00ab44);\n}\n\n#masthead h1 {\n /*font-size: 30px;*/\n line-height: 1;\n padding-top: 30px;\n}\n\n#masthead .well {\n margin-top: 4%;\n}\n\n/* fix the navbar shifting when a modal is open */\n/* https://github.com/twbs/bootstrap/issues/14040#issuecomment-159891033 */\nbody.modal-open {\n width: 100% !important;\n padding-right: 0 !important;\n /* overflow-y: scroll !important; */\n /* position: fixed !important;*/\n overflow: visible;\n}\n\n/* make accordion use the whole header bar for expand/collapse */\n.panel-title a {\n display: block;\n padding: 10px 15px;\n margin: -10px -15px;\n}\n\n/*\n * Side navigation\n *\n * Scrollspy and affixed enhanced navigation to highlight sections and secondary\n * sections of docs content.\n */\n\n.affix {\n position: static;\n /* top: 140px !important; */\n /*width: 220px;*/\n}\n\n.sidebar-body {\n margin-top: 0;\n}\n\n.dashboard-sidebar {\n max-height: calc(100% - 24px) !important;\n overflow-y: auto;\n /*width: 220px !important;*/\n}\n\n/* By default it's not affixed in mobile views, so undo that */\n.dashboard-sidebar.affix {\n position: static;\n}\n\n/* First level of nav */\n.dashboard-sidenav {\n margin-top: 20px;\n margin-bottom: 20px;\n}\n\n.dashboard-sidenav.affix {\n position: static;\n}\n\n/* All levels of nav */\n.dashboard-sidebar .nav > li > a {\n display: block;\n padding: 4px 8px;\n font-size: 13px;\n font-weight: 500;\n color: #767676;\n}\n\n.dashboard-sidebar .nav > li > .nav > li > a {\n padding: 2px 12px;\n}\n\n.dashboard-sidebar .nav > li > a > .svg-inline--fa {\n width: 20px;\n text-align: center;\n}\n\n.dashboard-sidebar .nav > li > a:hover,\n.dashboard-sidebar .nav > li > a:focus {\n padding-left: 7px;\n color: #563d7c;\n text-decoration: none;\n background-color: transparent;\n border-left: 1px solid #563d7c;\n}\n\n.dashboard-sidebar .nav > .active > a,\n.dashboard-sidebar .nav > .active:hover > a,\n.dashboard-sidebar .nav > .active:focus > a {\n padding-left: 6px;\n font-weight: bold;\n color: #563d7c;\n background-color: transparent;\n border-left: 2px solid #563d7c;\n}\n\n/* Nav: second level (shown on .active) */\n.dashboard-sidebar .nav .nav {\n display: none; /* Hide by default, but at >768px, show it */\n padding-bottom: 10px;\n}\n\n.dashboard-sidebar .nav .nav > li > a {\n padding-top: 1px;\n padding-bottom: 1px;\n font-size: 12px;\n font-weight: normal;\n}\n\n.dashboard-sidebar .nav .nav > li > a:hover,\n.dashboard-sidebar .nav .nav > li > a:focus {\n padding-left: 11px;\n}\n\n.dashboard-sidebar .nav .nav > .active > a,\n.dashboard-sidebar .nav .nav > .active:hover > a,\n.dashboard-sidebar .nav .nav > .active:focus > a {\n padding-left: 6px;\n font-weight: 500;\n}\n\n.multi-column-dropdown {\n list-style: none;\n padding: 0;\n}\n\n.multi-column-dropdown li a {\n display: inline-block;\n clear: both;\n line-height: 1.428571429;\n white-space: normal;\n}\n\n.multi-column-dropdown li a:hover {\n text-decoration: none;\n color: #f5f5f5;\n background-color: #262626;\n}\n\n.scrollable-menu-50 {\n height: auto;\n max-height: 50vh;\n overflow-x: hidden;\n}\n\n.container {\n width: calc(100% - 20px) !important;\n}\n\n.charts-body {\n display: inline-block;\n width: 100%;\n}\n\n.sidebar-body {\n position: absolute;\n display: none;\n height: 100vh;\n}\n\n.terms-and-privacy a {\n color: inherit;\n text-decoration: underline;\n display: block;\n}\n\n.dashboard-section-container {\n display: block;\n width: 100%;\n page-break-before: auto;\n page-break-after: auto;\n page-break-inside: auto;\n}\n\n.dashboard-print-row {\n display: block;\n width: 100%;\n page-break-before: auto;\n page-break-after: auto;\n page-break-inside: avoid;\n}\n\n.netdata-chartblock-container {\n display: inline-block;\n overflow: hidden;\n}\n\n/* https://github.com/seiyria/bootstrap-slider/issues/746 */\n.tooltip {\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.action-button {\n position: relative;\n display: inline-block;\n color: gray;\n cursor: pointer;\n margin: 0 auto;\n width: 30px;\n height: 30px;\n font-size: 25px;\n}\n\n.ripple {\n position: relative;\n /*overflow: hidden;*/\n transform: translate3d(0, 0, 0);\n}\n\n.ripple:after {\n content: \"\";\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n pointer-events: none;\n background-image: radial-gradient(circle, #000 10%, transparent 10.01%);\n background-repeat: no-repeat;\n background-position: 50%;\n transform: scale(18, 18); /* the size of the ripple */\n opacity: 0;\n transition: transform 0.5s, opacity 1s;\n}\n\n.ripple:active:after {\n transform: scale(0, 0);\n opacity: 0.2;\n transition: 0s;\n}\n\n/* -------------------------------------------------------------------------- */\n\n#alarms_log_table tbody tr {\n cursor: pointer;\n}\n\n.agent-item--separated {\n border-top: 1px solid #333;\n}\n\n.agent-item--alternate a {\n color: #999;\n}\n\n/* white theme overrides */\n\n#sign-in-iframe {\n background-color: #fff;\n border: none;\n}\n\n.filter-control {\n position: relative;\n}\n\n.sign-in-btn {\n background-color: #1e2126;\n}\n\n.sign-in-btn.theme-white {\n background-color: #e6e6e6;\n}\n\n.sign-in-btn.theme-white span {\n color: #000;\n}\n\n.beta {\n color: #ffcc00;\n}\n\n@media (min-width: 1360px) {\n .container {\n padding-left: 3% !important;\n }\n\n .charts-body {\n width: calc(100% - 263px) !important;\n padding-left: 1% !important;\n padding-right: 2% !important;\n }\n\n .sidebar-body {\n display: inline-block !important;\n width: 263px !important;\n }\n\n /* Widen the fixed sidebar again */\n .dashboard-sidebar.affix,\n .dashboard-sidebar.affix-top,\n .dashboard-sidebar.affix-bottom {\n width: 263px !important;\n }\n}\n\n@media (min-width: 1200px) {\n .container {\n padding-left: 2% !important;\n }\n\n .charts-body {\n width: calc(100% - 233px) !important;\n padding-left: 1% !important;\n padding-right: 1% !important;\n }\n\n .sidebar-body {\n display: inline-block !important;\n width: 233px !important;\n }\n\n /* Widen the fixed sidebar again */\n .dashboard-sidebar.affix,\n .dashboard-sidebar.affix-top,\n .dashboard-sidebar.affix-bottom {\n width: 233px !important;\n }\n}\n\n@media (min-width: 992px) {\n .container {\n padding-left: 0% !important;\n }\n\n .charts-body {\n width: calc(100% - 213px) !important;\n padding-left: 1% !important;\n padding-right: 0% !important;\n }\n\n .sidebar-body {\n display: inline-block !important;\n width: 213px !important;\n }\n\n .dashboard-sidebar .nav > .active > ul {\n display: block;\n }\n\n /* Widen the fixed sidebar */\n .dashboard-sidebar.affix,\n .dashboard-sidebar.affix-top,\n .dashboard-sidebar.affix-bottom {\n width: 213px !important;\n }\n\n .dashboard-sidebar.affix {\n position: fixed; /* Undo the static from mobile first approach */\n /* top: 20px; */\n }\n\n .dashboard-sidebar.affix-bottom {\n position: absolute; /* Undo the static from mobile first approach */\n }\n}\n\n@media (min-width: 860px) {\n .dashboard-sidebar {\n padding-left: 20px;\n }\n}\n\n@media (min-width: 768px) {\n .dashboard-sidebar {\n padding-left: 20px;\n }\n\n .charts-body {\n padding-left: 0%;\n padding-right: 0%;\n }\n}\n\n@media print {\n body {\n overflow: visible !important;\n -webkit-print-color-adjust: exact;\n page-break-inside: auto;\n page-break-before: auto;\n page-break-after: auto;\n }\n\n .dashboard-section {\n page-break-inside: auto;\n page-break-before: auto;\n page-break-after: auto;\n }\n\n .dashboard-subsection {\n page-break-before: avoid;\n page-break-after: auto;\n page-break-inside: auto;\n }\n\n .charts-body {\n padding-left: 0%;\n padding-right: 0%;\n display: block;\n page-break-inside: auto;\n page-break-before: auto;\n page-break-after: auto;\n }\n}\n\n#ssoifrm {\n display: none;\n}\n","/* fallback */\n@font-face {\n font-family: 'Material Icons';\n font-style: normal;\n font-weight: 400;\n src: url(\"../fonts/material-icons.woff2\") format('woff2');\n}\n\n.material-icons {\n font-family: 'Material Icons';\n font-weight: normal;\n font-style: normal;\n font-size: 24px;\n line-height: 1;\n letter-spacing: normal;\n text-transform: none;\n display: inline-block;\n white-space: nowrap;\n word-wrap: normal;\n direction: ltr;\n -webkit-font-feature-settings: 'liga';\n -webkit-font-smoothing: antialiased;\n}\n",".dygraph-chart__labels-hidden {\n display: none;\n}\n",".chart-container__loader {\n /* absolute, because to create GaugeChart the height of container is calculated during loading of data\n and loader cannot have any impact on chart size\n */\n position: absolute;\n}\n",".print-modal {\n &__close-button {\n &--disabled {\n pointer-events: none;\n }\n }\n}\n","body {\n margin: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\",\n \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n padding-left: 74px;\n transition: padding-left 0.2s ease-out;\n}\n\ncode {\n font-family: source-code-pro, Menlo, Monaco, Consolas, \"Courier New\", monospace;\n}\n\n@media (min-width: 1200px) {\n .with-panel {\n padding-left: 372px;\n }\n}\n"]} \ No newline at end of file diff --git a/web/gui/dashboard/static/js/2.3123f37d.chunk.js b/web/gui/dashboard/static/js/2.3123f37d.chunk.js new file mode 100644 index 000000000..8eea0842e --- /dev/null +++ b/web/gui/dashboard/static/js/2.3123f37d.chunk.js @@ -0,0 +1,3 @@ +/*! For license information please see 2.3123f37d.chunk.js.LICENSE */ +(this["webpackJsonp@netdata/dashboard"]=this["webpackJsonp@netdata/dashboard"]||[]).push([[2],[function(e,t,n){"use strict";e.exports=n(301)},function(e,t,n){(function(t){var n;n=function(){"use strict";var e=function(e){var t=e.id,n=e.viewBox,r=e.content;this.id=t,this.viewBox=n,this.content=r};function n(e,t){return e(t={exports:{}},t.exports),t.exports}e.prototype.stringify=function(){return this.content},e.prototype.toString=function(){return this.stringify()},e.prototype.destroy=function(){var e=this;["id","viewBox","content"].forEach((function(t){return delete e[t]}))},"undefined"!==typeof window?window:"undefined"!==typeof t||"undefined"!==typeof self&&self;var r=n((function(e,t){e.exports=function(){function e(e){return e&&"object"===typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function t(t,n){var i;return n&&!0===n.clone&&e(t)?r((i=t,Array.isArray(i)?[]:{}),t,n):t}function n(n,i,o){var a=n.slice();return i.forEach((function(i,c){"undefined"===typeof a[c]?a[c]=t(i,o):e(i)?a[c]=r(n[c],i,o):-1===n.indexOf(i)&&a.push(t(i,o))})),a}function r(i,o,a){var c=Array.isArray(o),s=(a||{arrayMerge:n}).arrayMerge||n;return c?Array.isArray(i)?s(i,o,a):t(o,a):function(n,i,o){var a={};return e(n)&&Object.keys(n).forEach((function(e){a[e]=t(n[e],o)})),Object.keys(i).forEach((function(c){e(i[c])&&n[c]?a[c]=r(n[c],i[c],o):a[c]=t(i[c],o)})),a}(i,o,a)}return r.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce((function(e,n){return r(e,n,t)}))},r}()})),i=n((function(e,t){t.default={svg:{name:"xmlns",uri:"http://www.w3.org/2000/svg"},xlink:{name:"xmlns:xlink",uri:"http://www.w3.org/1999/xlink"}},e.exports=t.default})),o=i.svg,a=i.xlink,c={};c[o.name]=o.uri,c[a.name]=a.uri;var s=function(e,t){return void 0===e&&(e=""),""+e+""};return function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={isMounted:{}};return n.isMounted.get=function(){return!!this.node},t.createFromExistingNode=function(e){return new t({id:e.getAttribute("id"),viewBox:e.getAttribute("viewBox"),content:e.outerHTML})},t.prototype.destroy=function(){this.isMounted&&this.unmount(),e.prototype.destroy.call(this)},t.prototype.mount=function(e){if(this.isMounted)return this.node;var t="string"===typeof e?document.querySelector(e):e,n=this.render();return this.node=n,t.appendChild(n),n},t.prototype.render=function(){var e=this.stringify();return function(e){var t=!!document.importNode,n=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;return t?document.importNode(n,!0):n}(s(e)).childNodes[0]},t.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},Object.defineProperties(t.prototype,n),t}(e)},e.exports=n()}).call(this,n(91))},function(e,t,n){(function(t){var n;n=function(){"use strict";function e(e,t){return e(t={exports:{}},t.exports),t.exports}"undefined"!==typeof window?window:"undefined"!==typeof t||"undefined"!==typeof self&&self;var n=e((function(e,t){e.exports=function(){function e(e){return e&&"object"===typeof e&&"[object RegExp]"!==Object.prototype.toString.call(e)&&"[object Date]"!==Object.prototype.toString.call(e)}function t(t,n){var i;return n&&!0===n.clone&&e(t)?r((i=t,Array.isArray(i)?[]:{}),t,n):t}function n(n,i,o){var a=n.slice();return i.forEach((function(i,c){"undefined"===typeof a[c]?a[c]=t(i,o):e(i)?a[c]=r(n[c],i,o):-1===n.indexOf(i)&&a.push(t(i,o))})),a}function r(i,o,a){var c=Array.isArray(o),s=(a||{arrayMerge:n}).arrayMerge||n;return c?Array.isArray(i)?s(i,o,a):t(o,a):function(n,i,o){var a={};return e(n)&&Object.keys(n).forEach((function(e){a[e]=t(n[e],o)})),Object.keys(i).forEach((function(c){e(i[c])&&n[c]?a[c]=r(n[c],i[c],o):a[c]=t(i[c],o)})),a}(i,o,a)}return r.all=function(e,t){if(!Array.isArray(e)||e.length<2)throw new Error("first argument should be an array with at least two elements");return e.reduce((function(e,n){return r(e,n,t)}))},r}()})),r=e((function(e,t){t.default={svg:{name:"xmlns",uri:"http://www.w3.org/2000/svg"},xlink:{name:"xmlns:xlink",uri:"http://www.w3.org/1999/xlink"}},e.exports=t.default})),i=r.svg,o=r.xlink,a={};a[i.name]=i.uri,a[o.name]=o.uri;var c,s=function(e,t){return void 0===e&&(e=""),""+e+""},l=r.svg,u=r.xlink,f={attrs:(c={style:["position: absolute","width: 0","height: 0"].join("; ")},c[l.name]=l.uri,c[u.name]=u.uri,c)},h=function(e){this.config=n(f,e||{}),this.symbols=[]};h.prototype.add=function(e){var t=this.symbols,n=this.find(e.id);return n?(t[t.indexOf(n)]=e,!1):(t.push(e),!0)},h.prototype.remove=function(e){var t=this.symbols,n=this.find(e);return!!n&&(t.splice(t.indexOf(n),1),n.destroy(),!0)},h.prototype.find=function(e){return this.symbols.filter((function(t){return t.id===e}))[0]||null},h.prototype.has=function(e){return null!==this.find(e)},h.prototype.stringify=function(){var e=this.config.attrs,t=this.symbols.map((function(e){return e.stringify()})).join("");return s(t,e)},h.prototype.toString=function(){return this.stringify()},h.prototype.destroy=function(){this.symbols.forEach((function(e){return e.destroy()}))};var d=function(e){var t=e.id,n=e.viewBox,r=e.content;this.id=t,this.viewBox=n,this.content=r};d.prototype.stringify=function(){return this.content},d.prototype.toString=function(){return this.stringify()},d.prototype.destroy=function(){var e=this;["id","viewBox","content"].forEach((function(t){return delete e[t]}))};var p=function(e){var t=!!document.importNode,n=(new DOMParser).parseFromString(e,"image/svg+xml").documentElement;return t?document.importNode(n,!0):n},z=function(e){function t(){e.apply(this,arguments)}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={isMounted:{}};return n.isMounted.get=function(){return!!this.node},t.createFromExistingNode=function(e){return new t({id:e.getAttribute("id"),viewBox:e.getAttribute("viewBox"),content:e.outerHTML})},t.prototype.destroy=function(){this.isMounted&&this.unmount(),e.prototype.destroy.call(this)},t.prototype.mount=function(e){if(this.isMounted)return this.node;var t="string"===typeof e?document.querySelector(e):e,n=this.render();return this.node=n,t.appendChild(n),n},t.prototype.render=function(){var e=this.stringify();return p(s(e)).childNodes[0]},t.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},Object.defineProperties(t.prototype,n),t}(d),v={autoConfigure:!0,mountTo:"body",syncUrlsWithBaseTag:!1,listenLocationChangeEvent:!0,locationChangeEvent:"locationChange",locationChangeAngularEmitter:!1,usagesToUpdate:"use[*|href]",moveGradientsOutsideSymbol:!1},g=function(e){return Array.prototype.slice.call(e,0)},m={isChrome:function(){return/chrome/i.test(navigator.userAgent)},isFirefox:function(){return/firefox/i.test(navigator.userAgent)},isIE:function(){return/msie/i.test(navigator.userAgent)||/trident/i.test(navigator.userAgent)},isEdge:function(){return/edge/i.test(navigator.userAgent)}},y=function(e){var t=[];return g(e.querySelectorAll("style")).forEach((function(e){e.textContent+="",t.push(e)})),t},b=function(e){return(e||window.location.href).split("#")[0]},w=function(e){angular.module("ng").run(["$rootScope",function(t){t.$on("$locationChangeSuccess",(function(t,n,r){!function(e,t){var n=document.createEvent("CustomEvent");n.initCustomEvent(e,!1,!1,t),window.dispatchEvent(n)}(e,{oldUrl:r,newUrl:n})}))}])},k=function(e,t){return void 0===t&&(t="linearGradient, radialGradient, pattern"),g(e.querySelectorAll("symbol")).forEach((function(e){g(e.querySelectorAll(t)).forEach((function(t){e.parentNode.insertBefore(t,e)}))})),e},x=r.xlink.uri,j="xlink:href",M=/[{}|\\\^\[\]`"<>]/g;function _(e){return e.replace(M,(function(e){return"%"+e[0].charCodeAt(0).toString(16).toUpperCase()}))}var C,q=["clipPath","colorProfile","src","cursor","fill","filter","marker","markerStart","markerMid","markerEnd","mask","stroke","style"],S=q.map((function(e){return"["+e+"]"})).join(","),O=function(e,t,n,r){var i=_(n),o=_(r);(function(e,t){return g(e).reduce((function(e,n){if(!n.attributes)return e;var r=g(n.attributes),i=t?r.filter(t):r;return e.concat(i)}),[])})(e.querySelectorAll(S),(function(e){var t=e.localName,n=e.value;return-1!==q.indexOf(t)&&-1!==n.indexOf("url("+i)})).forEach((function(e){return e.value=e.value.replace(new RegExp(i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),o)})),function(e,t,n){g(e).forEach((function(e){var r=e.getAttribute(j);if(r&&0===r.indexOf(t)){var i=r.replace(t,n);e.setAttributeNS(x,j,i)}}))}(t,i,o)},T={MOUNT:"mount",SYMBOL_MOUNT:"symbol_mount"},E=function(e){function t(t){var r=this;void 0===t&&(t={}),e.call(this,n(v,t));var i,o=(i=i||Object.create(null),{on:function(e,t){(i[e]||(i[e]=[])).push(t)},off:function(e,t){i[e]&&i[e].splice(i[e].indexOf(t)>>>0,1)},emit:function(e,t){(i[e]||[]).map((function(e){e(t)})),(i["*"]||[]).map((function(n){n(e,t)}))}});this._emitter=o,this.node=null;var a=this.config;if(a.autoConfigure&&this._autoConfigure(t),a.syncUrlsWithBaseTag){var c=document.getElementsByTagName("base")[0].getAttribute("href");o.on(T.MOUNT,(function(){return r.updateUrls("#",c)}))}var s=this._handleLocationChange.bind(this);this._handleLocationChange=s,a.listenLocationChangeEvent&&window.addEventListener(a.locationChangeEvent,s),a.locationChangeAngularEmitter&&w(a.locationChangeEvent),o.on(T.MOUNT,(function(e){a.moveGradientsOutsideSymbol&&k(e)})),o.on(T.SYMBOL_MOUNT,(function(e){a.moveGradientsOutsideSymbol&&k(e.parentNode),(m.isIE()||m.isEdge())&&y(e)}))}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var r={isMounted:{}};return r.isMounted.get=function(){return!!this.node},t.prototype._autoConfigure=function(e){var t=this.config;"undefined"===typeof e.syncUrlsWithBaseTag&&(t.syncUrlsWithBaseTag="undefined"!==typeof document.getElementsByTagName("base")[0]),"undefined"===typeof e.locationChangeAngularEmitter&&(t.locationChangeAngularEmitter="angular"in window),"undefined"===typeof e.moveGradientsOutsideSymbol&&(t.moveGradientsOutsideSymbol=m.isFirefox())},t.prototype._handleLocationChange=function(e){var t=e.detail,n=t.oldUrl,r=t.newUrl;this.updateUrls(n,r)},t.prototype.add=function(t){var n=e.prototype.add.call(this,t);return this.isMounted&&n&&(t.mount(this.node),this._emitter.emit(T.SYMBOL_MOUNT,t.node)),n},t.prototype.attach=function(e){var t=this,n=this;if(n.isMounted)return n.node;var r="string"===typeof e?document.querySelector(e):e;return n.node=r,this.symbols.forEach((function(e){e.mount(n.node),t._emitter.emit(T.SYMBOL_MOUNT,e.node)})),g(r.querySelectorAll("symbol")).forEach((function(e){var t=z.createFromExistingNode(e);t.node=e,n.add(t)})),this._emitter.emit(T.MOUNT,r),r},t.prototype.destroy=function(){var e=this.config,t=this.symbols,n=this._emitter;t.forEach((function(e){return e.destroy()})),n.off("*"),window.removeEventListener(e.locationChangeEvent,this._handleLocationChange),this.isMounted&&this.unmount()},t.prototype.mount=function(e,t){if(void 0===e&&(e=this.config.mountTo),void 0===t&&(t=!1),this.isMounted)return this.node;var n="string"===typeof e?document.querySelector(e):e,r=this.render();return this.node=r,t&&n.childNodes[0]?n.insertBefore(r,n.childNodes[0]):n.appendChild(r),this._emitter.emit(T.MOUNT,r),r},t.prototype.render=function(){return p(this.stringify())},t.prototype.unmount=function(){this.node.parentNode.removeChild(this.node)},t.prototype.updateUrls=function(e,t){if(!this.isMounted)return!1;var n=document.querySelectorAll(this.config.usagesToUpdate);return O(this.node,n,b(e)+"#",b(t)+"#"),!0},Object.defineProperties(t.prototype,r),t}(h),A=e((function(e){e.exports=function(){var e,t=[],n=document,r=n.documentElement.doScroll,i=(r?/^loaded|^c/:/^loaded|^i|^c/).test(n.readyState);return i||n.addEventListener("DOMContentLoaded",e=function(){for(n.removeEventListener("DOMContentLoaded",e),i=1;e=t.shift();)e()}),function(e){i?setTimeout(e,0):t.push(e)}}()}));window.__SVG_SPRITE__?C=window.__SVG_SPRITE__:(C=new E({attrs:{id:"__SVG_SPRITE_NODE__"}}),window.__SVG_SPRITE__=C);var H=function(){var e=document.getElementById("__SVG_SPRITE_NODE__");e?C.attach(e):C.mount(document.body,!0)};return document.body?H():A(H),C},e.exports=n()}).call(this,n(91))},function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"SIZE_SUB_UNIT",(function(){return d})),n.d(r,"SIZE_UNIT",(function(){return p})),n.d(r,"GUTTER_HEIGHT",(function(){return z}));var i={};n.r(i),n.d(i,"findFilterValues",(function(){return _y})),n.d(i,"removeSingleFilterValue",(function(){return Cy})),n.d(i,"markSelectedFacetValuesFromFilters",(function(){return qy})),n.d(i,"doFilterValuesMatch",(function(){return Sy})),n.d(i,"mergeFilters",(function(){return Oy})),n.d(i,"isFilterValueRange",(function(){return Ty}));var o={};n.r(o),n.d(o,"addFilter",(function(){return Cb})),n.d(o,"trackAutocompleteClickThrough",(function(){return qb})),n.d(o,"clearFilters",(function(){return Sb})),n.d(o,"removeFilter",(function(){return Ob})),n.d(o,"reset",(function(){return Tb})),n.d(o,"setCurrent",(function(){return Eb})),n.d(o,"setFilter",(function(){return Ab})),n.d(o,"setResultsPerPage",(function(){return Hb})),n.d(o,"setSearchTerm",(function(){return Lb})),n.d(o,"setSort",(function(){return Db})),n.d(o,"trackClickThrough",(function(){return Pb})),n.d(o,"a11yNotify",(function(){return Fb}));var a=n(0),c=n.n(a),s=n(4),l={transparent:{full:"rgba(255, 255, 255, 0.0)",semi:"rgba(255, 255, 255, 0.5)",popover:"rgba(18, 36, 50, 0.9)"},green:{chateau:"#42B861",netdata:"#00AB44",deyork:"#68C47D",vista:"#96D4A2",fringyFlower:"#BFE5C6",frostee:"#E5F5E8",limeGreen:"#48E499"},red:{pomegranate:"#FF4136",carnation:"#F95251",apricot:"#ED7374",wewak:"#F59B9B",pastelpink:"#FFCED3",lavender:"#FFEBEF"},yellow:{amber:"#FFC300",sunglow:"#FFCC26",seaBuckthorn:"#F9A825",mustard:"#FFD74F",salomie:"#FFE182",buttermilk:"#FFEDB3",ginfizz:"#FFF8E1"},neutral:{white:"#FFFFFF",black:"#000000",limedSpruce:"#35414A",regentgrey:"#8F9EAA",blackhaze:"#F7F8F8",iron:"#CFD5DA",porcelain:"#ECEEEF",bluebayoux:"#536775",shark:"#1C1E22",tuna:"#383B40",outerSpace:"#2B3136"},purple:{mauve:"#DB94F4",daisy:"#563D7C",lilac:"#B596F8"},blue:{aquamarine:"#19C89E",indigo:"#5790FF",cyan:"#00BAE2"}},u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n>16&255)+", "+(o>>8&255)+", "+(255&o)+", "+t+")"}},Z=function(e){return void 0===e&&(e=1),function(t){return(W(t)||0)*e+"px"}},$=function(e,t){return void 0===e&&(e="border"),void 0===t&&(t="disabled"),function(n){var r=n.theme,i=n.success,o=n.error,a=n.disabled;return i?G(["success"])({theme:r}):o?G(["error"])({theme:r}):a?G([t])({theme:r}):G([e])({theme:r})}},X=function(e,t){return"number"===typeof t?0===(n=e.constants.SIZE_SUB_UNIT*t)?"0":n+"px":"auto";var n},K=function(e,t){return t.map((function(t){return X(e,t)})).join(" ")},Q=function(e){var t=e.theme,n=e.margin;return n?Array.isArray(n)&&n.length>=1&&n.length<=4?"margin: "+K(t,n)+";":(console.error("Please provide an array (max 4 elements) for `margin` style helper."),""):""},J=function(e){var t=e.theme,n=e.padding;return n?Array.isArray(n)&&n.length>=1&&n.length<=4?"padding: "+K(t,n)+";":(console.error("Please provide an array (max 4 elements) for `padding` style helper."),""):""},ee={end:"flex-end",start:"flex-start",center:"center",stretch:"stretch"},te=function(e){var t=e.alignSelf;return t in ee&&"align-self: "+ee[t]+";"},ne={none:"none",capitalize:"capitalize",uppercase:"uppercase",lowercase:"lowercase",firstLetter:"firstLetter",fullWidth:"full-width"},re=function(e){var t=(void 0===e?{}:e).textTransform,n=void 0===t?"none":t;return n===ne.firstLetter?"text-transform: lowercase;\n &::first-letter {\n text-transform: uppercase;\n }\n":n in ne?"text-transform: "+ne[n]+";":"text-transform: "+ne.none+";"},ie=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},oe=function(){return(oe=Object.assign||function(e){for(var t,n=1,r=arguments.length;n span {\n ",";\n margin-left: ",";\n }\n\n &:hover {\n border-color: ",";\n background-color: ",";\n color: ",";\n text-decoration: none;\n\n .button-icon {\n fill: ",";\n }\n }\n\n &:active {\n ","\n }\n ","\n\n &:focus {\n outline: none;\n }\n\n .button-icon {\n height: ",";\n width: ",";\n fill: ",";\n }\n\n .ntd-spinner {\n fill: none;\n stroke-width: 17px;\n stroke-dasharray: 100;\n stroke-dashoffset: 100;\n animation: ntd-draw 1s linear infinite;\n stroke: ",";\n width: 24px;\n }\n\n .path {\n stroke: ",";\n }\n\n @keyframes ntd-draw {\n to {\n stroke-dashoffset: 0;\n }\n }\n }\n"],["\n && {\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n ",";\n\n width: ",";\n height: ",";\n\n font-weight: 500;\n font-size: ",";\n line-height: ",";\n white-space: nowrap;\n word-break: keep-all;\n\n cursor: pointer;\n opacity: ",";\n pointer-events: ",";\n\n ","\n ","\n transition: all 150ms;\n\n background-color: ",";\n color: ",";\n\n border-width: 1px;\n border-style: solid;\n border-color: ",";\n border-radius: 4px;\n box-sizing: border-box;\n\n text-decoration: none;\n & > span {\n ",";\n margin-left: ",";\n }\n\n &:hover {\n border-color: ",";\n background-color: ",";\n color: ",";\n text-decoration: none;\n\n .button-icon {\n fill: ",";\n }\n }\n\n &:active {\n ","\n }\n ","\n\n &:focus {\n outline: none;\n }\n\n .button-icon {\n height: ",";\n width: ",";\n fill: ",";\n }\n\n .ntd-spinner {\n fill: none;\n stroke-width: 17px;\n stroke-dasharray: 100;\n stroke-dashoffset: 100;\n animation: ntd-draw 1s linear infinite;\n stroke: ",";\n width: 24px;\n }\n\n .path {\n stroke: ",";\n }\n\n @keyframes ntd-draw {\n to {\n stroke-dashoffset: 0;\n }\n }\n }\n"])),te,(function(e){return e.width?e.width:e.hasLabel?Z(16):Z(e.tiny?2.75:e.small?3:4)}),(function(e){return e.hasLabel?Z(e.small?4:5):Z(e.tiny?2.75:e.small?3:4)}),(function(e){var t=e.small;return e.tiny?"10px":t?"12px":"14px"}),Z(2),(function(e){var t=e.disabled;return e.neutral?1:t?.4:1}),(function(e){return e.disabled?"none":"auto"}),Q,J,(function(e){return e.colors.bg(e)}),(function(e){return e.colors.color(e)}),(function(e){return e.colors.border(e)}),re,(function(e){return e.hasIcon?Z(1.5):"0px"}),(function(e){return e.colors.borderHover(e)}),(function(e){return e.colors.bgHover(e)}),(function(e){return e.colors.colorHover(e)}),(function(e){return e.colors.colorHover(e)}),ce,(function(e){return e.active&&"\n "+ce+"\n "}),Z(2),Z(2),(function(e){return e.colors.color(e)}),(function(e){return e.colors.color(e)}),(function(e){return e.colors.color(e)})),ge=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},me=s.d.svg.withConfig({displayName:"loader__StyledSvg",componentId:"sc-1mq98qd-0"})(A||(A=ge(["\n fill: none;\n stroke-width: 17px;\n stroke-dasharray: 100;\n stroke-dashoffset: 100;\n animation: ntd-draw 1s linear infinite;\n stroke: ",";\n width: 24px;\n .path {\n stroke: ",";\n }\n\n @keyframes ntd-draw {\n to {\n stroke-dashoffset: 0;\n }\n }\n"],["\n fill: none;\n stroke-width: 17px;\n stroke-dasharray: 100;\n stroke-dashoffset: 100;\n animation: ntd-draw 1s linear infinite;\n stroke: ",";\n width: 24px;\n .path {\n stroke: ",";\n }\n\n @keyframes ntd-draw {\n to {\n stroke-dashoffset: 0;\n }\n }\n"])),G("bright"),G("bright")),ye=function(e){var t=e.className;return c.a.createElement(me,{className:t,viewBox:"0 0 21 17",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},c.a.createElement("g",{className:"path",stroke:"none",strokeWidth:"1",fill:"none",fillRule:"evenodd"},c.a.createElement("path",{d:"M2,1 C8.25086152,1 11.9367136,1 13.0575562,1 C14.73882,1 19.6834591,2 19.9614325,7.72050108 C20.239406,13.4410022 15.7459591,15.1224845 13.6463763,15.1224845 C12.2466545,15.1224845 10.0279195,15.1224845 6.9901715,15.1224845 L2,1 Z",id:"Path-2",strokeWidth:"2"})))},be=n(1),we=n.n(be),ke=n(2),xe=n.n(ke),je=new we.a({id:"add_node",use:"add_node-usage",viewBox:"0 0 18 18",content:''}),Me=(xe.a.add(je),je),_e=new we.a({id:"add_user",use:"add_user-usage",viewBox:"0 0 15 16",content:''}),Ce=(xe.a.add(_e),_e),qe=new we.a({id:"aggregation_avg",use:"aggregation_avg-usage",viewBox:"0 0 16 12",content:''}),Se=(xe.a.add(qe),qe),Oe=new we.a({id:"aggregation_max",use:"aggregation_max-usage",viewBox:"0 0 15 16",content:''}),Te=(xe.a.add(Oe),Oe),Ee=new we.a({id:"aggregation_med",use:"aggregation_med-usage",viewBox:"0 0 14 14",content:''}),Ae=(xe.a.add(Ee),Ee),He=new we.a({id:"aggregation_min",use:"aggregation_min-usage",viewBox:"0 0 15 16",content:''}),Le=(xe.a.add(He),He),De=new we.a({id:"aggregation_sum",use:"aggregation_sum-usage",viewBox:"0 0 12 14",content:''}),Pe=(xe.a.add(De),De),Ve=new we.a({id:"aggregation_sum_abs",use:"aggregation_sum_abs-usage",viewBox:"0 0 14 14",content:''}),Ne=(xe.a.add(Ve),Ve),Ie=new we.a({id:"alarm",use:"alarm-usage",viewBox:"0 0 18 21",content:''}),Re=(xe.a.add(Ie),Ie),Be=new we.a({id:"alarm_c",use:"alarm_c-usage",viewBox:"0 0 24 24",content:''}),Fe=(xe.a.add(Be),Be),Ue=new we.a({id:"alarm_cw",use:"alarm_cw-usage",viewBox:"0 0 24 24",content:''}),We=(xe.a.add(Ue),Ue),Ge=new we.a({id:"alarm_w",use:"alarm_w-usage",viewBox:"0 0 24 24",content:''}),Ye=(xe.a.add(Ge),Ge),Ze=new we.a({id:"alarm_bell",use:"alarm_bell-usage",viewBox:"0 0 12 14",content:''}),$e=(xe.a.add(Ze),Ze),Xe=new we.a({id:"alarms_new",use:"alarms_new-usage",viewBox:"0 0 22 20",content:''}),Ke=(xe.a.add(Xe),Xe),Qe=new we.a({id:"anomalies_brain",use:"anomalies_brain-usage",viewBox:"0 0 18 18",content:''}),Je=(xe.a.add(Qe),Qe),et=new we.a({id:"anomalies_lens",use:"anomalies_lens-usage",viewBox:"0 0 18 18",content:''}),tt=(xe.a.add(et),et),nt=new we.a({id:"applications_hollow",use:"applications_hollow-usage",viewBox:"0 0 18 18",content:''}),rt=(xe.a.add(nt),nt),it=new we.a({id:"around_clock",use:"around_clock-usage",viewBox:"0 0 16 16",content:''}),ot=(xe.a.add(it),it),at=new we.a({id:"arrow_down",use:"arrow_down-usage",viewBox:"0 0 16 16",content:''}),ct=(xe.a.add(at),at),st=new we.a({id:"arrow_w_line_left",use:"arrow_w_line_left-usage",viewBox:"0 0 26 24",content:''}),lt=(xe.a.add(st),st),ut=new we.a({id:"arrow_w_line_right",use:"arrow_w_line_right-usage",viewBox:"0 0 24 13",content:''}),ft=(xe.a.add(ut),ut),ht=new we.a({id:"arrow_left",use:"arrow_left-usage",viewBox:"0 0 24 24",content:''}),dt=(xe.a.add(ht),ht),pt=new we.a({id:"arrow-s_down",use:"arrow-s_down-usage",viewBox:"0 0 8 9",content:''}),zt=(xe.a.add(pt),pt),vt=new we.a({id:"arrow-s_left",use:"arrow-s_left-usage",viewBox:"0 0 8 9",content:''}),gt=(xe.a.add(vt),vt),mt=new we.a({id:"arrows_vertical",use:"arrows_vertical-usage",viewBox:"0 0 6 10",content:''}),yt=(xe.a.add(mt),mt),bt=new we.a({id:"bookmark",use:"bookmark-usage",viewBox:"0 0 12 14",content:''}),wt=(xe.a.add(bt),bt),kt=new we.a({id:"bullet_one",use:"bullet_one-usage",viewBox:"0 0 10 10",content:''}),xt=(xe.a.add(kt),kt),jt=new we.a({id:"bullet_three",use:"bullet_three-usage",viewBox:"0 0 10 10",content:''}),Mt=(xe.a.add(jt),jt),_t=new we.a({id:"bullet_two",use:"bullet_two-usage",viewBox:"0 0 10 10",content:''}),Ct=(xe.a.add(_t),_t),qt=new we.a({id:"calendar_full",use:"calendar_full-usage",viewBox:"0 0 18 18",content:''}),St=(xe.a.add(qt),qt),Ot=new we.a({id:"calendar_full_press",use:"calendar_full_press-usage",viewBox:"0 0 18 18",content:''}),Tt=(xe.a.add(Ot),Ot),Et=new we.a({id:"chart_added",use:"chart_added-usage",viewBox:"0 0 17 17",content:''}),At=(xe.a.add(Et),Et),Ht=new we.a({id:"charts",use:"charts-usage",viewBox:"0 0 20 20",content:''}),Lt=(xe.a.add(Ht),Ht),Dt=new we.a({id:"check",use:"check-usage",viewBox:"0 0 24 24",content:''}),Pt=(xe.a.add(Dt),Dt),Vt=new we.a({id:"checkmark_partial_s",use:"checkmark_partial_s-usage",viewBox:"0 0 16 16",content:''}),Nt=(xe.a.add(Vt),Vt),It=new we.a({id:"checkmark_s",use:"checkmark_s-usage",viewBox:"0 0 16 16",content:''}),Rt=(xe.a.add(It),It),Bt=new we.a({id:"checkmark",use:"checkmark-usage",viewBox:"0 0 168 168",content:''}),Ft=(xe.a.add(Bt),Bt),Ut=new we.a({id:"chevron_double",use:"chevron_double-usage",viewBox:"0 0 6 10",content:''}),Wt=(xe.a.add(Ut),Ut),Gt=new we.a({id:"chevron_down",use:"chevron_down-usage",viewBox:"0 0 12 12",content:''}),Yt=(xe.a.add(Gt),Gt),Zt=new we.a({id:"chevron_left",use:"chevron_left-usage",viewBox:"0 0 24 24",content:''}),$t=(xe.a.add(Zt),Zt),Xt=new we.a({id:"chevron_right_s",use:"chevron_right_s-usage",viewBox:"0 0 5 6",content:''}),Kt=(xe.a.add(Xt),Xt),Qt=new we.a({id:"class_error",use:"class_error-usage",viewBox:"0 0 21 22",content:''}),Jt=(xe.a.add(Qt),Qt),en=new we.a({id:"class_latency",use:"class_latency-usage",viewBox:"0 0 21 20",content:''}),tn=(xe.a.add(en),en),nn=new we.a({id:"class_utilization",use:"class_utilization-usage",viewBox:"0 0 25 19",content:''}),rn=(xe.a.add(nn),nn),on=new we.a({id:"class_workload",use:"class_workload-usage",viewBox:"0 0 22 21",content:''}),an=(xe.a.add(on),on),cn=new we.a({id:"clock_hollow",use:"clock_hollow-usage",viewBox:"0 0 24 24",content:''}),sn=(xe.a.add(cn),cn),ln=new we.a({id:"clock_5_min",use:"clock_5_min-usage",viewBox:"0 0 18 18",content:''}),un=(xe.a.add(ln),ln),fn=new we.a({id:"clock_5_min_press",use:"clock_5_min_press-usage",viewBox:"0 0 18 18",content:''}),hn=(xe.a.add(fn),fn),dn=new we.a({id:"close_circle",use:"close_circle-usage",viewBox:"0 0 10 10",content:''}),pn=(xe.a.add(dn),dn),zn=new we.a({id:"cluster",use:"cluster-usage",viewBox:"0 0 22 22",content:''}),vn=(xe.a.add(zn),zn),gn=new we.a({id:"cluster_spaces",use:"cluster_spaces-usage",viewBox:"0 0 22 22",content:''}),mn=(xe.a.add(gn),gn),yn=new we.a({id:"code",use:"code-usage",viewBox:"0 0 16 16",content:''}),bn=(xe.a.add(yn),yn),wn=new we.a({id:"collapse",use:"collapse-usage",viewBox:"0 0 16 2",content:''}),kn=(xe.a.add(wn),wn),xn=new we.a({id:"community",use:"community-usage",viewBox:"0 0 18 18",content:''}),jn=(xe.a.add(xn),xn),Mn=new we.a({id:"connectivity_status_live",use:"connectivity_status_live-usage",viewBox:"0 0 18 18",content:''}),_n=(xe.a.add(Mn),Mn),Cn=new we.a({id:"connectivity_status_offline",use:"connectivity_status_offline-usage",viewBox:"0 0 18 18",content:''}),qn=(xe.a.add(Cn),Cn),Sn=new we.a({id:"connectivity_status_stale",use:"connectivity_status_stale-usage",viewBox:"0 0 18 18",content:''}),On=(xe.a.add(Sn),Sn),Tn=new we.a({id:"container",use:"container-usage",viewBox:"0 0 22 22",content:''}),En=(xe.a.add(Tn),Tn),An=new we.a({id:"controller_kind",use:"controller_kind-usage",viewBox:"0 0 22 22",content:''}),Hn=(xe.a.add(An),An),Ln=new we.a({id:"controller_name",use:"controller_name-usage",viewBox:"0 0 22 22",content:''}),Dn=(xe.a.add(Ln),Ln),Pn=new we.a({id:"copy",use:"copy-usage",viewBox:"0 0 14 14",content:''}),Vn=(xe.a.add(Pn),Pn),Nn=new we.a({id:"correlation",use:"correlation-usage",viewBox:"0 0 28 28",content:''}),In=(xe.a.add(Nn),Nn),Rn=new we.a({id:"correlation_inv",use:"correlation_inv-usage",viewBox:"0 0 24 24",content:''}),Bn=(xe.a.add(Rn),Rn),Fn=new we.a({id:"cpu",use:"cpu-usage",viewBox:"0 0 18 18",content:''}),Un=(xe.a.add(Fn),Fn),Wn=new we.a({id:"cross_s",use:"cross_s-usage",viewBox:"0 0 16 16",content:''}),Gn=(xe.a.add(Wn),Wn),Yn=new we.a({id:"data_retention",use:"data_retention-usage",viewBox:"0 0 18 18",content:''}),Zn=(xe.a.add(Yn),Yn),$n=new we.a({id:"database",use:"database-usage",viewBox:"0 0 24 24",content:''}),Xn=(xe.a.add($n),$n),Kn=new we.a({id:"dashboard",use:"dashboard-usage",viewBox:"0 0 22 18",content:''}),Qn=(xe.a.add(Kn),Kn),Jn=new we.a({id:"dashboard_add",use:"dashboard_add-usage",viewBox:"0 0 16 16",content:''}),er=(xe.a.add(Jn),Jn),tr=new we.a({id:"dashboards",use:"dashboards-usage",viewBox:"0 0 16 10",content:''}),nr=(xe.a.add(tr),tr),rr=new we.a({id:"disk",use:"disk-usage",viewBox:"0 0 18 18",content:''}),ir=(xe.a.add(rr),rr),or=new we.a({id:"documentation",use:"documentation-usage",viewBox:"0 0 24 24",content:''}),ar=(xe.a.add(or),or),cr=new we.a({id:"dot",use:"dot-usage",viewBox:"0 0 10 10",content:''}),sr=(xe.a.add(cr),cr),lr=new we.a({id:"dots_2x3",use:"dots_2x3-usage",viewBox:"0 0 6 10",content:''}),ur=(xe.a.add(lr),lr),fr=new we.a({id:"download",use:"download-usage",viewBox:"0 0 20 20",content:''}),hr=(xe.a.add(fr),fr),dr=new we.a({id:"error",use:"error-usage",viewBox:"0 0 24 24",content:''}),pr=(xe.a.add(dr),dr),zr=new we.a({id:"exclamation",use:"exclamation-usage",viewBox:"0 0 24 24",content:''}),vr=(xe.a.add(zr),zr),gr=new we.a({id:"expand",use:"expand-usage",viewBox:"0 0 24 24",content:''}),mr=(xe.a.add(gr),gr),yr=new we.a({id:"filterList",use:"filterList-usage",viewBox:"0 0 18 18",content:''}),br=(xe.a.add(yr),yr),wr=new we.a({id:"force_play",use:"force_play-usage",viewBox:"0 0 18 18",content:''}),kr=(xe.a.add(wr),wr),xr=new we.a({id:"force_play_outline",use:"force_play_outline-usage",viewBox:"0 0 18 18",content:''}),jr=(xe.a.add(xr),xr),Mr=new we.a({id:"gear",use:"gear-usage",viewBox:"0 0 20 20",content:''}),_r=(xe.a.add(Mr),Mr),Cr=new we.a({id:"github",use:"github-usage",viewBox:"0 0 24 24",content:''}),qr=(xe.a.add(Cr),Cr),Sr=new we.a({id:"go_to_node",use:"go_to_node-usage",viewBox:"0 0 18 18",content:''}),Or=(xe.a.add(Sr),Sr),Tr=new we.a({id:"google",use:"google-usage",viewBox:"0 0 24 24",content:''}),Er=(xe.a.add(Tr),Tr),Ar=new we.a({id:"group_by",use:"group_by-usage",viewBox:"0 0 18 18",content:''}),Hr=(xe.a.add(Ar),Ar),Lr=new we.a({id:"hamburger",use:"hamburger-usage",viewBox:"0 0 24 24",content:''}),Dr=(xe.a.add(Lr),Lr),Pr=new we.a({id:"help",use:"help-usage",viewBox:"0 0 20 21",content:''}),Vr=(xe.a.add(Pr),Pr),Nr=new we.a({id:"hide",use:"hide-usage",viewBox:"0 0 18 18",content:''}),Ir=(xe.a.add(Nr),Nr),Rr=new we.a({id:"highlight_area",use:"highlight_area-usage",viewBox:"0 0 16 16",content:''}),Br=(xe.a.add(Rr),Rr),Fr=new we.a({id:"holder",use:"holder-usage",viewBox:"0 0 24 24",content:''}),Ur=(xe.a.add(Fr),Fr),Wr=new we.a({id:"incident_manager",use:"incident_manager-usage",viewBox:"0 0 18 18",content:''}),Gr=(xe.a.add(Wr),Wr),Yr=new we.a({id:"information",use:"information-usage",viewBox:"0 0 18 18",content:''}),Zr=(xe.a.add(Yr),Yr),$r=new we.a({id:"information_press",use:"information_press-usage",viewBox:"0 0 18 18",content:''}),Xr=(xe.a.add($r),$r),Kr=new we.a({id:"insights",use:"insights-usage",viewBox:"0 0 18 18",content:''}),Qr=(xe.a.add(Kr),Kr),Jr=new we.a({id:"integrations",use:"integrations-usage",viewBox:"0 0 16 16",content:''}),ei=(xe.a.add(Jr),Jr),ti=new we.a({id:"ipNetworking",use:"ipNetworking-usage",viewBox:"0 0 16 16",content:''}),ni=(xe.a.add(ti),ti),ri=new we.a({id:"ipNetworkingPress",use:"ipNetworkingPress-usage",viewBox:"0 0 16 16",content:''}),ii=(xe.a.add(ri),ri),oi=new we.a({id:"last_week",use:"last_week-usage",viewBox:"0 0 18 18",content:''}),ai=(xe.a.add(oi),oi),ci=new we.a({id:"line_chart",use:"line_chart-usage",viewBox:"0 0 15 15",content:''}),si=(xe.a.add(ci),ci),li=new we.a({id:"logo_s",use:"logo_s-usage",viewBox:"0 0 14 13",content:''}),ui=(xe.a.add(li),li),fi=new we.a({id:"loading",use:"loading-usage",viewBox:"0 0 24 24",content:''}),hi=(xe.a.add(fi),fi),di=new we.a({id:"magnify",use:"magnify-usage",viewBox:"0 0 24 24",content:''}),pi=(xe.a.add(di),di),zi=new we.a({id:"metrics",use:"metrics-usage",viewBox:"0 0 24 24",content:''}),vi=(xe.a.add(zi),zi),gi=new we.a({id:"metrics_explorer",use:"metrics_explorer-usage",viewBox:"0 0 18 18",content:''}),mi=(xe.a.add(gi),gi),yi=new we.a({id:"monitoring",use:"monitoring-usage",viewBox:"0 0 20 20",content:''}),bi=(xe.a.add(yi),yi),wi=new we.a({id:"more",use:"more-usage",viewBox:"0 0 18 4",content:''}),ki=(xe.a.add(wi),wi),xi=new we.a({id:"nav_left",use:"nav_left-usage",viewBox:"0 0 8 10",content:''}),ji=(xe.a.add(xi),xi),Mi=new we.a({id:"nav_right",use:"nav_right-usage",viewBox:"0 0 8 10",content:''}),_i=(xe.a.add(Mi),Mi),Ci=new we.a({id:"nav_arrow_goto",use:"nav_arrow_goto-usage",viewBox:"0 0 10 10",content:''}),qi=(xe.a.add(Ci),Ci),Si=new we.a({id:"nav_dots",use:"nav_dots-usage",viewBox:"0 0 24 24",content:''}),Oi=(xe.a.add(Si),Si),Ti=new we.a({id:"netdata",use:"netdata-usage",viewBox:"0 0 24 24",content:''}),Ei=(xe.a.add(Ti),Ti),Ai=new we.a({id:"netdata-press",use:"netdata-press-usage",viewBox:"0 0 18 18",content:''}),Hi=(xe.a.add(Ai),Ai),Li=new we.a({id:"node",use:"node-usage",viewBox:"0 0 24 24",content:''}),Di=(xe.a.add(Li),Li),Pi=new we.a({id:"node_child",use:"node_child-usage",viewBox:"0 0 18 18",content:''}),Vi=(xe.a.add(Pi),Pi),Ni=new we.a({id:"node_default_l",use:"node_default_l-usage",viewBox:"0 0 40 40",content:''}),Ii=(xe.a.add(Ni),Ni),Ri=new we.a({id:"node_hollow",use:"node_hollow-usage",viewBox:"0 0 22 12",content:''}),Bi=(xe.a.add(Ri),Ri),Fi=new we.a({id:"node_import_export",use:"node_import_export-usage",viewBox:"0 0 24 24",content:''}),Ui=(xe.a.add(Fi),Fi),Wi=new we.a({id:"node_notification_l",use:"node_notification_l-usage",viewBox:"0 0 40 40",content:''}),Gi=(xe.a.add(Wi),Wi),Yi=new we.a({id:"node_parent",use:"node_parent-usage",viewBox:"0 0 18 18",content:''}),Zi=(xe.a.add(Yi),Yi),$i=new we.a({id:"node_selected_l",use:"node_selected_l-usage",viewBox:"0 0 40 40",content:''}),Xi=(xe.a.add($i),$i),Ki=new we.a({id:"nodes",use:"nodes-usage",viewBox:"0 0 16 16",content:''}),Qi=(xe.a.add(Ki),Ki),Ji=new we.a({id:"nodes_hollow",use:"nodes_hollow-usage",viewBox:"0 0 18 18",content:''}),eo=(xe.a.add(Ji),Ji),to=new we.a({id:"none_selected",use:"none_selected-usage",viewBox:"0 0 16 16",content:''}),no=(xe.a.add(to),to),ro=new we.a({id:"os",use:"os-usage",viewBox:"0 0 18 18",content:''}),io=(xe.a.add(ro),ro),oo=new we.a({id:"alpine_linux",use:"alpine_linux-usage",viewBox:"0 0 18 18",content:''}),ao=(xe.a.add(oo),oo),co=new we.a({id:"amazon_linux",use:"amazon_linux-usage",viewBox:"0 0 18 18",content:''}),so=(xe.a.add(co),co),lo=new we.a({id:"arch_linux",use:"arch_linux-usage",viewBox:"0 0 18 18",content:''}),uo=(xe.a.add(lo),lo),fo=new we.a({id:"celarOS",use:"celarOS-usage",viewBox:"0 0 18 18",content:''}),ho=(xe.a.add(fo),fo),po=new we.a({id:"centos",use:"centos-usage",viewBox:"0 0 18 18",content:''}),zo=(xe.a.add(po),po),vo=new we.a({id:"centos_color",use:"centos_color-usage",viewBox:"0 0 18 18",content:''}),go=(xe.a.add(vo),vo),mo=new we.a({id:"coreOS",use:"coreOS-usage",viewBox:"0 0 18 18",content:''}),yo=(xe.a.add(mo),mo),bo=new we.a({id:"debian",use:"debian-usage",viewBox:"0 0 18 18",content:''}),wo=(xe.a.add(bo),bo),ko=new we.a({id:"debian_color",use:"debian_color-usage",viewBox:"0 0 18 18",content:''}),xo=(xe.a.add(ko),ko),jo=new we.a({id:"fedora",use:"fedora-usage",viewBox:"0 0 18 18",content:''}),Mo=(xe.a.add(jo),jo),_o=new we.a({id:"freeBSD",use:"freeBSD-usage",viewBox:"0 0 18 18",content:''}),Co=(xe.a.add(_o),_o),qo=new we.a({id:"gentoo",use:"gentoo-usage",viewBox:"0 0 18 18",content:''}),So=(xe.a.add(qo),qo),Oo=new we.a({id:"linux",use:"linux-usage",viewBox:"0 0 18 18",content:''}),To=(xe.a.add(Oo),Oo),Eo=new we.a({id:"linux_color",use:"linux_color-usage",viewBox:"0 0 18 18",content:''}),Ao=(xe.a.add(Eo),Eo),Ho=new we.a({id:"macOSX",use:"macOSX-usage",viewBox:"0 0 18 18",content:''}),Lo=(xe.a.add(Ho),Ho),Do=new we.a({id:"oracle",use:"oracle-usage",viewBox:"0 0 18 18",content:''}),Po=(xe.a.add(Do),Do),Vo=new we.a({id:"oracle_color",use:"oracle_color-usage",viewBox:"0 0 18 18",content:''}),No=(xe.a.add(Vo),Vo),Io=new we.a({id:"os_press",use:"os_press-usage",viewBox:"0 0 18 18",content:''}),Ro=(xe.a.add(Io),Io),Bo=new we.a({id:"raspbian",use:"raspbian-usage",viewBox:"0 0 18 18",content:''}),Fo=(xe.a.add(Bo),Bo),Uo=new we.a({id:"red_hat",use:"red_hat-usage",viewBox:"0 0 18 18",content:''}),Wo=(xe.a.add(Uo),Uo),Go=new we.a({id:"suse_linux",use:"suse_linux-usage",viewBox:"0 0 18 18",content:''}),Yo=(xe.a.add(Go),Go),Zo=new we.a({id:"ubuntu",use:"ubuntu-usage",viewBox:"0 0 18 18",content:''}),$o=(xe.a.add(Zo),Zo),Xo=new we.a({id:"ubuntu_color",use:"ubuntu_color-usage",viewBox:"0 0 18 18",content:''}),Ko=(xe.a.add(Xo),Xo),Qo=new we.a({id:"notification",use:"notification-usage",viewBox:"0 0 40 24",content:''}),Jo=(xe.a.add(Qo),Qo),ea=new we.a({id:"padlock",use:"padlock-usage",viewBox:"0 0 18 18",content:''}),ta=(xe.a.add(ea),ea),na=new we.a({id:"pause_outline",use:"pause_outline-usage",viewBox:"0 0 18 18",content:''}),ra=(xe.a.add(na),na),ia=new we.a({id:"pause_solid",use:"pause_solid-usage",viewBox:"0 0 24 24",content:''}),oa=(xe.a.add(ia),ia),aa=new we.a({id:"pencil_outline",use:"pencil_outline-usage",viewBox:"0 0 14 14",content:''}),ca=(xe.a.add(aa),aa),sa=new we.a({id:"pencil_solid",use:"pencil_solid-usage",viewBox:"0 0 19 19",content:''}),la=(xe.a.add(sa),sa),ua=new we.a({id:"pie_chart_skeleton",use:"pie_chart_skeleton-usage",viewBox:"0 0 100 100",content:''}),fa=(xe.a.add(ua),ua),ha=new we.a({id:"pin_element",use:"pin_element-usage",viewBox:"0 0 14 14",content:''}),da=(xe.a.add(ha),ha),pa=new we.a({id:"play_outline",use:"play_outline-usage",viewBox:"0 0 18 18",content:''}),za=(xe.a.add(pa),pa),va=new we.a({id:"play_solid",use:"play_solid-usage",viewBox:"0 0 24 24",content:''}),ga=(xe.a.add(va),va),ma=new we.a({id:"plus",use:"plus-usage",viewBox:"0 0 24 24",content:''}),ya=(xe.a.add(ma),ma),ba=new we.a({id:"plus_mini_s",use:"plus_mini_s-usage",viewBox:"0 0 24 24",content:''}),wa=(xe.a.add(ba),ba),ka=new we.a({id:"pod",use:"pod-usage",viewBox:"0 0 22 22",content:''}),xa=(xe.a.add(ka),ka),ja=new we.a({id:"pricing",use:"pricing-usage",viewBox:"0 0 16 16",content:''}),Ma=(xe.a.add(ja),ja),_a=new we.a({id:"print",use:"print-usage",viewBox:"0 0 21 20",content:''}),Ca=(xe.a.add(_a),_a),qa=new we.a({id:"privacy",use:"privacy-usage",viewBox:"0 0 16 16",content:''}),Sa=(xe.a.add(qa),qa),Oa=new we.a({id:"question",use:"question-usage",viewBox:"0 0 20 20",content:''}),Ta=(xe.a.add(Oa),Oa),Ea=new we.a({id:"questionFilled",use:"questionFilled-usage",viewBox:"0 0 24 24",content:''}),Aa=(xe.a.add(Ea),Ea),Ha=new we.a({id:"ram",use:"ram-usage",viewBox:"0 0 18 18",content:''}),La=(xe.a.add(Ha),Ha),Da=new we.a({id:"refresh",use:"refresh-usage",viewBox:"0 0 18 19",content:''}),Pa=(xe.a.add(Da),Da),Va=new we.a({id:"reload",use:"reload-usage",viewBox:"0 0 24 24",content:''}),Na=(xe.a.add(Va),Va),Ia=new we.a({id:"remove_node",use:"remove_node-usage",viewBox:"0 0 18 18",content:''}),Ra=(xe.a.add(Ia),Ia),Ba=new we.a({id:"resize_handler",use:"resize_handler-usage",viewBox:"0 0 16 16",content:''}),Fa=(xe.a.add(Ba),Ba),Ua=new we.a({id:"room",use:"room-usage",viewBox:"0 0 24 24",content:''}),Wa=(xe.a.add(Ua),Ua),Ga=new we.a({id:"room_home",use:"room_home-usage",viewBox:"0 0 14 12",content:''}),Ya=(xe.a.add(Ga),Ga),Za=new we.a({id:"room_new",use:"room_new-usage",viewBox:"0 0 20 20",content:''}),$a=(xe.a.add(Za),Za),Xa=new we.a({id:"room_overview",use:"room_overview-usage",viewBox:"0 0 24 25",content:''}),Ka=(xe.a.add(Xa),Xa),Qa=new we.a({id:"sad",use:"sad-usage",viewBox:"0 0 24 24",content:''}),Ja=(xe.a.add(Qa),Qa),ec=new we.a({id:"save",use:"save-usage",viewBox:"0 0 14 14",content:''}),tc=(xe.a.add(ec),ec),nc=new we.a({id:"search",use:"search-usage",viewBox:"0 0 18 18",content:''}),rc=(xe.a.add(nc),nc),ic=new we.a({id:"search_s",use:"search_s-usage",viewBox:"0 0 14 14",content:''}),oc=(xe.a.add(ic),ic),ac=new we.a({id:"search_press",use:"search_press-usage",viewBox:"0 0 18 18",content:''}),cc=(xe.a.add(ac),ac),sc=new we.a({id:"apache",use:"apache-usage",viewBox:"0 0 18 18",content:''}),lc=(xe.a.add(sc),sc),uc=new we.a({id:"apache_tomcat",use:"apache_tomcat-usage",viewBox:"0 0 18 18",content:''}),fc=(xe.a.add(uc),uc),hc=new we.a({id:"beanstalk",use:"beanstalk-usage",viewBox:"0 0 18 18",content:''}),dc=(xe.a.add(hc),hc),pc=new we.a({id:"couchDB",use:"couchDB-usage",viewBox:"0 0 18 18",content:''}),zc=(xe.a.add(pc),pc),vc=new we.a({id:"database",use:"database-usage",viewBox:"0 0 18 18",content:''}),gc=(xe.a.add(vc),vc),mc=new we.a({id:"docker_hub",use:"docker_hub-usage",viewBox:"0 0 18 18",content:''}),yc=(xe.a.add(mc),mc),bc=new we.a({id:"docker_hub_press",use:"docker_hub_press-usage",viewBox:"0 0 18 18",content:''}),wc=(xe.a.add(bc),bc),kc=new we.a({id:"eBPF",use:"eBPF-usage",viewBox:"0 0 18 18",content:''}),xc=(xe.a.add(kc),kc),jc=new we.a({id:"elasticSearch",use:"elasticSearch-usage",viewBox:"0 0 18 18",content:''}),Mc=(xe.a.add(jc),jc),_c=new we.a({id:"freeNAS",use:"freeNAS-usage",viewBox:"0 0 18 18",content:''}),Cc=(xe.a.add(_c),_c),qc=new we.a({id:"haProxy",use:"haProxy-usage",viewBox:"0 0 18 18",content:''}),Sc=(xe.a.add(qc),qc),Oc=new we.a({id:"httpCheck",use:"httpCheck-usage",viewBox:"0 0 18 18",content:''}),Tc=(xe.a.add(Oc),Oc),Ec=new we.a({id:"iceCast",use:"iceCast-usage",viewBox:"0 0 18 18",content:''}),Ac=(xe.a.add(Ec),Ec),Hc=new we.a({id:"influxDB",use:"influxDB-usage",viewBox:"0 0 18 18",content:''}),Lc=(xe.a.add(Hc),Hc),Dc=new we.a({id:"ipfs",use:"ipfs-usage",viewBox:"0 0 18 18",content:''}),Pc=(xe.a.add(Dc),Dc),Vc=new we.a({id:"ipvs",use:"ipvs-usage",viewBox:"0 0 18 18",content:''}),Nc=(xe.a.add(Vc),Vc),Ic=new we.a({id:"kubermetes",use:"kubermetes-usage",viewBox:"0 0 18 18",content:''}),Rc=(xe.a.add(Ic),Ic),Bc=new we.a({id:"lighthttpd",use:"lighthttpd-usage",viewBox:"0 0 18 18",content:''}),Fc=(xe.a.add(Bc),Bc),Uc=new we.a({id:"lighthttpd2",use:"lighthttpd2-usage",viewBox:"0 0 18 18",content:''}),Wc=(xe.a.add(Uc),Uc),Gc=new we.a({id:"liteSpeed",use:"liteSpeed-usage",viewBox:"0 0 18 18",content:''}),Yc=(xe.a.add(Gc),Gc),Zc=new we.a({id:"lxc",use:"lxc-usage",viewBox:"0 0 18 18",content:''}),$c=(xe.a.add(Zc),Zc),Xc=new we.a({id:"mariaDB",use:"mariaDB-usage",viewBox:"0 0 18 18",content:''}),Kc=(xe.a.add(Xc),Xc),Qc=new we.a({id:"memCached",use:"memCached-usage",viewBox:"0 0 18 18",content:''}),Jc=(xe.a.add(Qc),Qc),es=new we.a({id:"mongoDB",use:"mongoDB-usage",viewBox:"0 0 18 18",content:''}),ts=(xe.a.add(es),es),ns=new we.a({id:"mySQL",use:"mySQL-usage",viewBox:"0 0 18 18",content:''}),rs=(xe.a.add(ns),ns),is=new we.a({id:"mySQL_press",use:"mySQL_press-usage",viewBox:"0 0 18 18",content:''}),os=(xe.a.add(is),is),as=new we.a({id:"nginx",use:"nginx-usage",viewBox:"0 0 18 18",content:''}),cs=(xe.a.add(as),as),ss=new we.a({id:"nginx_local",use:"nginx_local-usage",viewBox:"0 0 18 18",content:''}),ls=(xe.a.add(ss),ss),us=new we.a({id:"nginx_plus",use:"nginx_plus-usage",viewBox:"0 0 18 18",content:''}),fs=(xe.a.add(us),us),hs=new we.a({id:"ntpd",use:"ntpd-usage",viewBox:"0 0 18 18",content:''}),ds=(xe.a.add(hs),hs),ps=new we.a({id:"ntpd_press",use:"ntpd_press-usage",viewBox:"0 0 18 18",content:''}),zs=(xe.a.add(ps),ps),vs=new we.a({id:"openStack",use:"openStack-usage",viewBox:"0 0 18 18",content:''}),gs=(xe.a.add(vs),vs),ms=new we.a({id:"openWrt",use:"openWrt-usage",viewBox:"0 0 18 18",content:''}),ys=(xe.a.add(ms),ms),bs=new we.a({id:"pan",use:"pan-usage",viewBox:"0 0 18 18",content:''}),ws=(xe.a.add(bs),bs),ks=new we.a({id:"percona",use:"percona-usage",viewBox:"0 0 18 18",content:''}),xs=(xe.a.add(ks),ks),js=new we.a({id:"pfSense",use:"pfSense-usage",viewBox:"0 0 18 18",content:''}),Ms=(xe.a.add(js),js),_s=new we.a({id:"php_fpm",use:"php_fpm-usage",viewBox:"0 0 18 18",content:''}),Cs=(xe.a.add(_s),_s),qs=new we.a({id:"postgreSQL",use:"postgreSQL-usage",viewBox:"0 0 18 18",content:''}),Ss=(xe.a.add(qs),qs),Os=new we.a({id:"rabbitMQ",use:"rabbitMQ-usage",viewBox:"0 0 18 18",content:''}),Ts=(xe.a.add(Os),Os),Es=new we.a({id:"redis",use:"redis-usage",viewBox:"0 0 18 18",content:''}),As=(xe.a.add(Es),Es),Hs=new we.a({id:"rethinkDB",use:"rethinkDB-usage",viewBox:"0 0 18 18",content:''}),Ls=(xe.a.add(Hs),Hs),Ds=new we.a({id:"retroShare",use:"retroShare-usage",viewBox:"0 0 18 18",content:''}),Ps=(xe.a.add(Ds),Ds),Vs=new we.a({id:"services",use:"services-usage",viewBox:"0 0 18 18",content:''}),Ns=(xe.a.add(Vs),Vs),Is=new we.a({id:"selected_area",use:"selected_area-usage",viewBox:"0 0 18 18",content:''}),Rs=(xe.a.add(Is),Is),Bs=new we.a({id:"solr",use:"solr-usage",viewBox:"0 0 18 18",content:''}),Fs=(xe.a.add(Bs),Bs),Us=new we.a({id:"squid",use:"squid-usage",viewBox:"0 0 18 18",content:''}),Ws=(xe.a.add(Us),Us),Gs=new we.a({id:"summary_statistic",use:"summary_statistic-usage",viewBox:"0 0 18 18",content:''}),Ys=(xe.a.add(Gs),Gs),Zs=new we.a({id:"traefik",use:"traefik-usage",viewBox:"0 0 18 18",content:''}),$s=(xe.a.add(Zs),Zs),Xs=new we.a({id:"varnish",use:"varnish-usage",viewBox:"0 0 18 18",content:''}),Ks=(xe.a.add(Xs),Xs),Qs=new we.a({id:"webLog",use:"webLog-usage",viewBox:"0 0 18 18",content:''}),Js=(xe.a.add(Qs),Qs),el=new we.a({id:"webLog_nginx",use:"webLog_nginx-usage",viewBox:"0 0 18 18",content:''}),tl=(xe.a.add(el),el),nl=new we.a({id:"x509_check",use:"x509_check-usage",viewBox:"0 0 18 18",content:''}),rl=(xe.a.add(nl),nl),il=new we.a({id:"xen",use:"xen-usage",viewBox:"0 0 18 18",content:''}),ol=(xe.a.add(il),il),al=new we.a({id:"settings",use:"settings-usage",viewBox:"0 0 17 15",content:''}),cl=(xe.a.add(al),al),sl=new we.a({id:"settings_h",use:"settings_h-usage",viewBox:"0 0 14 14",content:''}),ll=(xe.a.add(sl),sl),ul=new we.a({id:"sorting_vertical",use:"sorting_vertical-usage",viewBox:"0 0 19 18",content:''}),fl=(xe.a.add(ul),ul),hl=new we.a({id:"space",use:"space-usage",viewBox:"0 0 24 24",content:''}),dl=(xe.a.add(hl),hl),pl=new we.a({id:"space_new",use:"space_new-usage",viewBox:"0 0 20 20",content:''}),zl=(xe.a.add(pl),pl),vl=new we.a({id:"switch_off",use:"switch_off-usage",viewBox:"0 0 14 15",content:''}),gl=(xe.a.add(vl),vl),ml=new we.a({id:"system_overview",use:"system_overview-usage",viewBox:"0 0 32 32",content:''}),yl=(xe.a.add(ml),ml),bl=new we.a({id:"text_add",use:"text_add-usage",viewBox:"0 0 16 16",content:''}),wl=(xe.a.add(bl),bl),kl=new we.a({id:"thumb_down",use:"thumb_down-usage",viewBox:"0 0 24 24",content:''}),xl=(xe.a.add(kl),kl),jl=new we.a({id:"thumb_up",use:"thumb_up-usage",viewBox:"0 0 24 24",content:''}),Ml=(xe.a.add(jl),jl),_l=new we.a({id:"tiny_buttons",use:"tiny_buttons-usage",viewBox:"0 0 22 22",content:''}),Cl=(xe.a.add(_l),_l),ql=new we.a({id:"training",use:"training-usage",viewBox:"0 0 16 16",content:''}),Sl=(xe.a.add(ql),ql),Ol=new we.a({id:"trashcan",use:"trashcan-usage",viewBox:"0 0 14 15",content:''}),Tl=(xe.a.add(Ol),Ol),El=new we.a({id:"triangle",use:"triangle-usage",viewBox:"0 0 24 24",content:''}),Al=(xe.a.add(El),El),Hl=new we.a({id:"triangle_down",use:"triangle_down-usage",viewBox:"0 0 10 5",content:''}),Ll=(xe.a.add(Hl),Hl),Dl=new we.a({id:"unknownError",use:"unknownError-usage",viewBox:"0 0 16 16",content:''}),Pl=(xe.a.add(Dl),Dl),Vl=new we.a({id:"universe",use:"universe-usage",viewBox:"0 0 18 18",content:''}),Nl=(xe.a.add(Vl),Vl),Il=new we.a({id:"unreachable",use:"unreachable-usage",viewBox:"0 0 12 14",content:''}),Rl=(xe.a.add(Il),Il),Bl=new we.a({id:"unreachableNode",use:"unreachableNode-usage",viewBox:"0 0 231 230",content:''}),Fl=(xe.a.add(Bl),Bl),Ul=new we.a({id:"update",use:"update-usage",viewBox:"0 0 20 20",content:''}),Wl=(xe.a.add(Ul),Ul),Gl=new we.a({id:"update_pending",use:"update_pending-usage",viewBox:"0 0 20 20",content:''}),Yl=(xe.a.add(Gl),Gl),Zl=new we.a({id:"upload",use:"upload-usage",viewBox:"0 0 20 21",content:''}),$l=(xe.a.add(Zl),Zl),Xl=new we.a({id:"user",use:"user-usage",viewBox:"0 0 16 18",content:''}),Kl=(xe.a.add(Xl),Xl),Ql=new we.a({id:"users",use:"users-usage",viewBox:"0 0 14 14",content:''}),Jl=(xe.a.add(Ql),Ql),eu=new we.a({id:"view_list",use:"view_list-usage",viewBox:"0 0 24 24",content:''}),tu=(xe.a.add(eu),eu),nu=new we.a({id:"single_node_view",use:"single_node_view-usage",viewBox:"0 0 18 18",content:''}),ru=(xe.a.add(nu),nu),iu=new we.a({id:"single_node_view_press",use:"single_node_view_press-usage",viewBox:"0 0 18 18",content:''}),ou=(xe.a.add(iu),iu),au=new we.a({id:"virtualization",use:"virtualization-usage",viewBox:"0 0 16 16",content:''}),cu=(xe.a.add(au),au),su=new we.a({id:"warning",use:"warning-usage",viewBox:"0 0 24 24",content:''}),lu=(xe.a.add(su),su),uu=new we.a({id:"warning_triangle",use:"warning_triangle-usage",viewBox:"0 0 12 10",content:''}),fu=(xe.a.add(uu),uu),hu=new we.a({id:"warning_triangle_hollow",use:"warning_triangle_hollow-usage",viewBox:"0 0 24 24",content:''}),du=(xe.a.add(hu),hu),pu=new we.a({id:"x",use:"x-usage",viewBox:"0 0 24 24",content:''}),zu=(xe.a.add(pu),pu),vu=new we.a({id:"firewall_solid",use:"firewall_solid-usage",viewBox:"0 0 24 24",content:''}),gu=(xe.a.add(vu),vu),mu=new we.a({id:"qualityOfService_solid",use:"qualityOfService_solid-usage",viewBox:"0 0 24 24",content:''}),yu=(xe.a.add(mu),mu),bu=new we.a({id:"applications_solid",use:"applications_solid-usage",viewBox:"0 0 24 24",content:''}),wu=(xe.a.add(bu),bu),ku=new we.a({id:"networking_stack",use:"networking_stack-usage",viewBox:"0 0 18 18",content:''}),xu=(xe.a.add(ku),ku),ju=new we.a({id:"charts_view",use:"charts_view-usage",viewBox:"0 0 16 15",content:''}),Mu=(xe.a.add(ju),ju),_u=new we.a({id:"nodes_update",use:"nodes_update-usage",viewBox:"0 0 40 40",content:''}),Cu=(xe.a.add(_u),{add_node:Me,add_user:Ce,aggregation_avg:Se,aggregation_max:Te,aggregation_med:Ae,aggregation_min:Le,aggregation_sum:Pe,aggregation_sum_abs:Ne,alarm:Re,alarmCritical:Fe,alarmCriticalWarning:We,alarmWarning:Ye,alarm_bell:$e,alarms_new:Ke,anomaliesBrain:Je,anomaliesLens:tt,applications_hollow:rt,applicationsSolid:wu,around_clock:ot,arrow_down:ct,arrow_w_line_left:lt,arrow_w_line_right:ft,arrow_left:dt,arrow_s_down:zt,arrow_s_left:gt,arrows_vertical:yt,bookmark:wt,bullet_one:xt,bullet_three:Mt,bullet_two:Ct,calendarFull:St,calendarFullPress:Tt,chart_added:At,charts:Lt,charts_view:Mu,check:Pt,checkmark_partial_s:Nt,checkmark_s:Rt,checkmark:Ft,chevron_double:Wt,chevron_down:Yt,chevron_left:$t,chevron_right_s:Kt,classError:Jt,classLatency:tn,classUtilization:rn,classWorkload:an,clock_hollow:sn,clock5Min:un,clock5MinPress:hn,close_circle:pn,cluster:vn,cluster_spaces:mn,code:bn,collapse:kn,community:jn,connectivityStatusLive:_n,connectivityStatusOffline:qn,connectivityStatusStale:On,container:En,controller_kind:Hn,controller_name:Dn,copy:Vn,correlation:In,correlation_inv:Bn,cpu:Un,cross_s:Gn,data_retention:Zn,database:Xn,dashboard:Qn,dashboard_add:er,dashboards:nr,disk:ir,documentation:ar,dot:sr,dots_2x3:ur,download:hr,error:pr,exclamation:vr,expand:mr,filterList:br,firewallSolid:gu,forcePlay:kr,forcePlayOutline:jr,gear:_r,github:qr,google:Er,goToNode:Or,group_by:Hr,hamburger:Dr,help:Vr,hide:Ir,highlightArea:Br,holder:Ur,incident_manager:Gr,information:Zr,informationPress:Xr,insights:Qr,integrations:ei,ipNetworking:ni,ipNetworkingPress:ii,last_week:ai,line_chart:si,logo_s:ui,loading:hi,magnify:pi,metrics:vi,metrics_explorer:mi,monitoring:bi,more:ki,navLeft:ji,navRight:_i,nav_arrow_goto:qi,nav_dots:Oi,networkingStack:xu,netdata:Ei,netdataPress:Hi,node:Di,node_child:Vi,node_default_l:Ii,node_hollow:Bi,node_import_export:Ui,node_notification_l:Gi,node_parent:Zi,node_selected_l:Xi,nodes:Qi,nodes_hollow:eo,none_selected:no,nodes_update:_u,notification:Jo,os:io,osAlpineLinux:ao,osAmazonLinux:so,osArchLinux:uo,osCelarOS:ho,osCentos:zo,osCentosColor:go,osCoreOS:yo,osDebian:wo,osDebianColor:xo,osFedora:Mo,osFreeBSD:Co,osGentoo:So,osLinux:To,osLinuxColor:Ao,osMacOSX:Lo,osOracle:Po,osOracleColor:No,osPress:Ro,osRaspbian:Fo,osRedHat:Wo,osSuseLinux:Yo,osUbuntu:$o,osUbuntuColor:Ko,padlock:ta,pauseOutline:ra,pauseSolid:oa,pencilSolid:la,pencilOutline:ca,pie_chart_skeleton:fa,pin_element:da,playOutline:za,playSolid:ga,plus:ya,plus_mini_s:wa,pod:xa,pricing:Ma,print:Ca,privacy:Sa,ram:La,qualityOfServiceSolid:yu,question:Ta,questionFilled:Aa,refresh:Pa,reload:Na,removeNode:Ra,resize_handler:Fa,room:Wa,room_home:Ya,room_new:$a,room_overview:Ka,sad:Ja,save:tc,search:rc,search_s:oc,searchPress:cc,serviceApache:lc,serviceApacheTomcat:fc,serviceBeanstalk:dc,serviceCouchDB:zc,serviceDatabase:gc,serviceDockerHub:yc,serviceDockerHubPress:wc,serviceEBPF:xc,serviceElasticSearch:Mc,serviceFreeNAS:Cc,serviceHAProxy:Sc,serviceHTTPCheck:Tc,serviceIceCast:Ac,serviceInfluxDB:Lc,serviceIPFS:Pc,serviceIPVS:Nc,serviceKubernetes:Rc,serviceLighthttpd:Fc,serviceLighthttpd2:Wc,serviceLiteSpeed:Yc,serviceLxc:$c,serviceMariaDB:Kc,serviceMemCached:Jc,serviceMongoDB:ts,serviceMySQL:rs,serviceMySQLPress:os,serviceNginx:cs,serviceNginxLocal:ls,serviceNginxPlus:fs,serviceNtpd:ds,serviceNtpdPress:zs,serviceOpenStack:gs,serviceOpenWrt:ys,servicePan:ws,servicePercona:xs,servicePfSense:Ms,servicePhpFpm:Cs,servicePostgreSQL:Ss,serviceProxySQL:Ss,serviceRabbitMQ:Ts,serviceRedis:As,serviceRethinkDB:Ls,serviceRetroShare:Ps,services:Ns,serviceSelectedArea:Rs,serviceSolr:Fs,serviceSquid:Ws,serviceSummaryStatistic:Ys,serviceTraefik:$s,serviceVarnish:Ks,serviceWebLog:Js,serviceWebLogNginx:tl,serviceX509Check:rl,serviceXen:ol,settings:cl,settings_h:ll,sorting_vertical:fl,space:dl,space_new:zl,switch_off:gl,system_overview:yl,text_add:wl,thumb_down:xl,thumb_up:Ml,tiny_buttons:Cl,training:Sl,trashcan:Tl,triangle:Al,triangle_down:Ll,unknownError:Pl,universe:Nl,unreachable:Rl,unreachableNode:Fl,update:Wl,update_pending:Yl,upload:$l,user:Kl,users:Jl,view_list:tu,viewSingleNode:ru,viewSingleNodePress:ou,virtualization:cu,warning:lu,warning_triangle:fu,warning_triangle_hollow:du,x:zu}),qu=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Su={small:"16px",medium:"24px",large:"40px"},Ou=s.d.svg.withConfig({displayName:"styled__StyledIcon",componentId:"sc-1pjn63w-0"})(H||(H=qu(["\n height: ",";\n width: ",";\n opacity: ",";\n pointer-events: ",";\n ","\n ","\n ","\n ","\n ","\n"],["\n height: ",";\n width: ",";\n opacity: ",";\n pointer-events: ",";\n ","\n ","\n ","\n ","\n ","\n"])),(function(e){var t=e.size;return e.height||Su[t]}),(function(e){var t=e.size;return e.width||Su[t]}),(function(e){return e.disabled?.3:1}),(function(e){return e.disabled?"none":"unset"}),(function(e){var t=e.rotate;return!isNaN(t)&&"transform: rotate("+90*t+"deg);"}),(function(e){var t=e.theme,n=e.color;return n&&"fill: "+G(n)({theme:t})+";"}),(function(e){var t=e.theme,n=e.hoverColor;return n&&"&:hover { fill: "+G(n)({theme:t})+"; }"}),Q,te),Tu=function(){return(Tu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n *:not(:last-child) {\n margin-"+(r||i?"bottom":"right")+": "+t*n+"px;\n }\n "},sf=function(e){return"flex-direction: "+function(e,t,n){return e?"column":t?"column-reverse":n?"row-reverse":"row"}(e.column,e.columnReverse,e.rowReverse)+";"},lf=function(){return(lf=Object.assign||function(e){for(var t,n=1,r=arguments.length;n &",_invalid:"&[aria-invalid=true]",_pressed:"&[aria-pressed=true]",_readOnly:"&[aria-readonly=true], &[readonly]",_first:"&:first-of-type",_last:"&:last-of-type",_expanded:"&[aria-expanded=true]",_grabbed:"&[aria-grabbed=true]",_notFirst:"&:not(:first-of-type)",_notLast:"&:not(:last-of-type)",_groupHover:"[role=group]:hover &",_autofill:"&:-webkit-autofill",_placeholder:"&::placeholder"},mf=function(e){var t=e.theme,n=zf(e,["theme"]),r="";for(var i in n)if(i in gf){var o=i,a=n[o],c=vf(df,hf,Ku)(pf({theme:t},a));r=r+"\n "+gf[o]+"{ \n "+c+" \n }"}return r.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm,"")};function yf(){return(yf=Object.assign||function(e){for(var t=1;t=0)return wf(e,t,t);var n=Math.abs(t),r=wf(e,n,n);return"string"===typeof r?"-"+r:-1*r},qf=["margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","top","bottom","left","right"].reduce((function(e,t){var n;return yf({},e,((n={})[t]=Cf,n))}),{}),Sf=function e(t){return function(n){void 0===n&&(n={});var r=yf({},xf,{},n.theme||n),i={},o=function(e){return function(t){var n={},r=wf(t,"breakpoints",kf),i=[null].concat(r.map((function(e){return"@media screen and (min-width: "+e+")"})));for(var o in e){var a="function"===typeof e[o]?e[o](t):e[o];if(null!=a)if(Array.isArray(a))for(var c=0;c=0&&"[object Array]"===Object.prototype.toString.call(e)},ep=j((function(e){return!!Jd(e)||!!e&&("object"===typeof e&&(!O(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))})),tp=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}();var np=M((function(e,t){return Kd(e.length,(function(){return e.apply(t,arguments)}))}));function rp(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function ip(e,t,n,r){return e["@@transducer/result"](n[r](np(e["@@transducer/step"],e),t))}var op="undefined"!==typeof Symbol?Symbol.iterator:"@@iterator";function ap(e,t,n){if("function"===typeof e&&(e=function(e){return new tp(e)}(e)),ep(n))return function(e,t,n){for(var r=0,i=n.length;r=arguments.length)?s=n[c]:(s=arguments[o],o+=1),i[c]=s,x(s)||(a-=1),c+=1}return a<=0?r.apply(this,i):Kd(a,e(t,i,r))}}(e,[],t))})),yp=Object.prototype.toString,bp=function(){return"[object Arguments]"===yp.call(arguments)?function(e){return"[object Arguments]"===yp.call(e)}:function(e){return C("callee",e)}}(),wp=!{toString:null}.propertyIsEnumerable("toString"),kp=["constructor","valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],xp=function(){return arguments.propertyIsEnumerable("length")}(),jp=function(e,t){for(var n=0;n=0;)C(t=kp[n],e)&&!jp(r,t)&&(r[r.length]=t),n-=1;return r})):j((function(e){return Object(e)!==e?[]:Object.keys(e)})),_p=M(hp(["fantasy-land/map","map"],gp,(function(e,t){switch(Object.prototype.toString.call(t)){case"[object Function]":return mp(t.length,(function(){return e.call(this,t.apply(this,arguments))}));case"[object Object]":return ap((function(n,r){return n[r]=e(t[r]),n}),{},Mp(t));default:return dp(e,t)}})));function Cp(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}function qp(e,t,n){for(var r=0,i=n.length;r=0;){if(n[o]===e)return r[o]===t;o-=1}switch(i){case"Map":return e.size===t.size&&Tp(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&Tp(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var a=Mp(e);if(a.length!==Mp(t).length)return!1;var c=n.concat([e]),s=r.concat([t]);for(o=a.length-1;o>=0;){var l=a[o];if(!C(l,t)||!Ep(t[l],e[l],c,s))return!1;o-=1}return!0}var Ap=M((function(e,t){return Ep(e,t,[],[])}));function Hp(e,t){return function(e,t,n){var r,i;if("function"===typeof e.indexOf)switch(typeof t){case"number":if(0===t){for(r=1/t;n=0}var Lp=function(e){return(e<10?"0":"")+e};Date.prototype.toISOString;var Dp,Pp,Vp,Np,Ip,Rp,Bp=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Fp=(s.d.tr.withConfig({displayName:"styled__StyledRow",componentId:"ssimnk-0"})(Dp||(Dp=Bp(["\n cursor: ",";\n position: ",";\n"],["\n cursor: ",";\n position: ",";\n"])),(function(e){return e.onClick?"pointer":"auto"}),(function(e){return e.hasStickyHeader?"static":"relative"})),s.d.div.withConfig({displayName:"styled__StyledBlockRow",componentId:"ssimnk-1"})(Pp||(Pp=Bp(["\n position: relative;\n"],["\n position: relative;\n"]))),function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}),Up=s.d.thead.withConfig({displayName:"styled__StyledThead",componentId:"sc-14orp2c-0"})(Vp||(Vp=Fp(["\n & > tr th {\n border-spacing: 0;\n border-bottom: 1px solid #aeb3b7;\n padding-bottom: 5px;\n }\n"],["\n & > tr th {\n border-spacing: 0;\n border-bottom: 1px solid #aeb3b7;\n padding-bottom: 5px;\n }\n"]))),Wp=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Gp=function(){return(Gp=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=t?e.call(null):r.id=requestAnimationFrame(i)}))};return r}var dz=null;function pz(e){if(void 0===e&&(e=!1),null===dz||e){var t=document.createElement("div"),n=t.style;n.width="50px",n.height="50px",n.overflow="scroll",n.direction="rtl";var r=document.createElement("div"),i=r.style;return i.width="100px",i.height="100px",t.appendChild(r),document.body.appendChild(t),t.scrollLeft>0?dz="positive-descending":(t.scrollLeft=1,dz=0===t.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(t),dz}return dz}var zz=150,vz=function(e,t){return e};function gz(e){var t,n=e.getItemOffset,r=e.getEstimatedTotalSize,i=e.getItemSize,o=e.getOffsetForIndexAndAlignment,c=e.getStartIndexForOffset,s=e.getStopIndexForStartIndex,l=e.initInstanceProps,u=e.shouldResetStyleCacheOnItemSizeChange,f=e.validateProps;return(t=function(e){function t(t){var r;return(r=e.call(this,t)||this)._instanceProps=l(r.props,Object(oz.a)(r)),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:Object(oz.a)(r),isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"===typeof r.props.initialScrollOffset?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=lz((function(e,t,n,i){return r.props.onItemsRendered({overscanStartIndex:e,overscanStopIndex:t,visibleStartIndex:n,visibleStopIndex:i})})),r._callOnScroll=void 0,r._callOnScroll=lz((function(e,t,n){return r.props.onScroll({scrollDirection:e,scrollOffset:t,scrollUpdateWasRequested:n})})),r._getItemStyle=void 0,r._getItemStyle=function(e){var t,o=r.props,a=o.direction,c=o.itemSize,s=o.layout,l=r._getItemStyleCache(u&&c,u&&s,u&&a);if(l.hasOwnProperty(e))t=l[e];else{var f=n(r.props,e,r._instanceProps),h=i(r.props,e,r._instanceProps),d="horizontal"===a||"horizontal"===s,p="rtl"===a,z=d?f:0;l[e]=t={position:"absolute",left:p?void 0:z,right:p?z:void 0,top:d?0:f,height:d?"100%":h,width:d?h:"100%"}}return t},r._getItemStyleCache=void 0,r._getItemStyleCache=lz((function(e,t,n){return{}})),r._onScrollHorizontal=function(e){var t=e.currentTarget,n=t.clientWidth,i=t.scrollLeft,o=t.scrollWidth;r.setState((function(e){if(e.scrollOffset===i)return null;var t=r.props.direction,a=i;if("rtl"===t)switch(pz()){case"negative":a=-i;break;case"positive-descending":a=o-n-i}return a=Math.max(0,Math.min(a,o-n)),{isScrolling:!0,scrollDirection:e.scrollOffset0)for(var C=j;C<=M;C++)_.push(Object(a.createElement)(t,{data:f,key:d(C,f),index:C,isScrolling:m?b:void 0,style:this._getItemStyle(C)}));var q=r(this.props,this._instanceProps);return Object(a.createElement)(z||v||"div",{className:n,onScroll:k,ref:this._outerRefSetter,style:Object(iz.a)({position:"relative",height:o,width:y,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:i},g)},Object(a.createElement)(s||l||"div",{children:_,ref:c,style:{height:w?"100%":q,pointerEvents:b?"none":void 0,width:w?q:"100%"}}))},h._callPropsCallbacks=function(){if("function"===typeof this.props.onItemsRendered&&this.props.itemCount>0){var e=this._getRangeToRender(),t=e[0],n=e[1],r=e[2],i=e[3];this._callOnItemsRendered(t,n,r,i)}if("function"===typeof this.props.onScroll){var o=this.state,a=o.scrollDirection,c=o.scrollOffset,s=o.scrollUpdateWasRequested;this._callOnScroll(a,c,s)}},h._getRangeToRender=function(){var e=this.props,t=e.itemCount,n=e.overscanCount,r=this.state,i=r.isScrolling,o=r.scrollDirection,a=r.scrollOffset;if(0===t)return[0,0,0,0];var l=c(this.props,a,this._instanceProps),u=s(this.props,l,a,this._instanceProps),f=i&&"backward"!==o?1:Math.max(1,n),h=i&&"forward"!==o?1:Math.max(1,n);return[Math.max(0,l-f),Math.max(0,Math.min(t-1,u+h)),l,u]},t}(a.PureComponent)).defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},t}var mz=function(e,t){e.children,e.direction,e.height,e.layout,e.innerTagName,e.outerTagName,e.width,t.instance},yz=function(e,t,n){var r=e.itemSize,i=n.itemMetadataMap,o=n.lastMeasuredIndex;if(t>o){var a=0;if(o>=0){var c=i[o];a=c.offset+c.size}for(var s=o+1;s<=t;s++){var l=r(s);i[s]={offset:a,size:l},a+=l}n.lastMeasuredIndex=t}return i[t]},bz=function(e,t,n,r,i){for(;r<=n;){var o=r+Math.floor((n-r)/2),a=yz(e,o,t).offset;if(a===i)return o;ai&&(n=o-1)}return r>0?r-1:0},wz=function(e,t,n,r){for(var i=e.itemCount,o=1;n=n&&(o=n-1),o>=0){var c=r[o];a=c.offset+c.size}return a+(n-o-1)*i},xz=gz({getItemOffset:function(e,t,n){return yz(e,t,n).offset},getItemSize:function(e,t,n){return n.itemMetadataMap[t].size},getEstimatedTotalSize:kz,getOffsetForIndexAndAlignment:function(e,t,n,r,i){var o=e.direction,a=e.height,c=e.layout,s=e.width,l="horizontal"===o||"horizontal"===c?s:a,u=yz(e,t,i),f=kz(e,i),h=Math.max(0,Math.min(f-l,u.offset)),d=Math.max(0,u.offset-l+u.size);switch("smart"===n&&(n=r>=d-l&&r<=h+l?"auto":"center"),n){case"start":return h;case"end":return d;case"center":return Math.round(d+(h-d)/2);case"auto":default:return r>=d&&r<=h?r:r0?r[i].offset:0)>=n?bz(e,t,i,0,n):wz(e,t,Math.max(0,i),n)}(e,n,t)},getStopIndexForStartIndex:function(e,t,n,r){for(var i=e.direction,o=e.height,a=e.itemCount,c=e.layout,s=e.width,l="horizontal"===i||"horizontal"===c?s:o,u=yz(e,t,r),f=n+l,h=u.offset+u.size,d=t;d=d-u&&r<=h+u?"auto":"center"),n){case"start":return h;case"end":return d;case"center":var p=Math.round(d+(h-d)/2);return pf+Math.floor(u/2)?f:p;case"auto":default:return r>=d&&r<=h?r:r span {\n font-weight: ",";\n }\n"],["\n border-bottom: "," solid\n ",";\n box-sizing: border-box;\n\n min-width: ",";\n max-width: ",";\n height: ",";\n color: ",";\n font-weight: ",";\n\n cursor: pointer;\n opacity: ",";\n pointer-events: ",";\n\n &:hover {\n border-bottom: "," solid ",";\n }\n\n & > span {\n font-weight: ",";\n }\n"])),(function(e){return e.small?"2px":"4px"}),(function(e){var t=e.active;return G(t?"accent":["transparent","full"])}),(function(e){var t=e.minWidth;return null!==t&&void 0!==t?t:Z(10)}),(function(e){var t=e.maxWidth;return null!==t&&void 0!==t?t:Z(26)}),(function(e){var t=e.small;return Z(t?4:6)}),G("text"),(function(e){return e.active?"bold":"normal"}),(function(e){return e.disabled?.4:1}),(function(e){return e.disabled?"none":"auto"}),(function(e){return e.small?"2px":"4px"}),G("primary"),(function(e){return e.active?"bold":"normal"})),tv=function(){return(tv=Object.assign||function(e){for(var t,n=1,r=arguments.length;ne.clientHeight}));return n.forEach((function(e){return e.addEventListener("scroll",t,{capture:!1,passive:!0})})),function(){return n.forEach((function(e){return e.removeEventListener("scroll",t)}))}};n=r();var i=function(){n(),n=r(),t()};return window.addEventListener("resize",i),function(){n(),window.removeEventListener("resize",i)}}),[e,t])}(i,b),Rv(m,f,i),Vv(h);var w=Pv();return Uf.a.createPortal(r?c.a.createElement(c.a.Fragment,null,c.a.createElement($v,Qv({ref:y,width:{max:"100%"},column:!0,"data-testid":"drop"},v),d),c.a.createElement(eg,null)):c.a.createElement($v,Qv({ref:y,width:{max:"100%"},column:!0,"data-testid":"drop"},v),d),w)})),rg=function(){return(rg=Object.assign||function(e){for(var t,n=1,r=arguments.length;n1&&i.forEach((function(n){var i;r[n]=e(((i={})[n]=t[n],i))})),r},Gg=function(e,t,n,r,i){var o={};return r.slice(0,e.length).forEach((function(r,a){var c,s=e[a],l=t(r,n,i);s?Ng()(o,((c={})[s]=Ng()({},o[s],l),c)):Ng()(o,l)})),o},Yg=function(e,t,n,r,i){var o={};for(var a in r){var c=e[a],s=t(r[a],n,i);if(c){var l,u=Bg(c);Ng()(o,((l={})[u]=Ng()({},o[u],s),l))}else Ng()(o,s)}return o},Zg=function(e){var t=e.properties,n=e.property,r=e.scale,i=e.transform,o=void 0===i?Fg:i,a=e.defaultScale;t=t||[n];var c=function(e,n,r){var i={},a=o(e,n,r);if(null!==a)return t.forEach((function(e){i[e]=a})),i};return c.scale=r,c.defaults=a,c},$g=function(e){void 0===e&&(e={});var t={};return Object.keys(e).forEach((function(n){var r=e[n];t[n]=!0!==r?"function"!==typeof r?Zg(r):r:Zg({property:n,scale:n})})),Wg(t)},Xg=$g({width:{property:"width",scale:"sizes",transform:function(e,t){return Ug(t,e,!function(e){return"number"===typeof e&&!isNaN(e)}(e)||e>1?e:100*e+"%")}},height:{property:"height",scale:"sizes"},minWidth:{property:"minWidth",scale:"sizes"},minHeight:{property:"minHeight",scale:"sizes"},maxWidth:{property:"maxWidth",scale:"sizes"},maxHeight:{property:"maxHeight",scale:"sizes"},size:{properties:["width","height"],scale:"sizes"},overflow:!0,overflowX:!0,overflowY:!0,display:!0,verticalAlign:!0}),Kg={color:{property:"color",scale:"colors"},backgroundColor:{property:"backgroundColor",scale:"colors"},opacity:!0};Kg.bg=Kg.backgroundColor;var Qg=$g(Kg),Jg=$g({fontFamily:{property:"fontFamily",scale:"fonts"},fontSize:{property:"fontSize",scale:"fontSizes",defaultScale:[12,14,16,20,24,32,48,64,72]},fontWeight:{property:"fontWeight",scale:"fontWeights"},lineHeight:{property:"lineHeight",scale:"lineHeights"},letterSpacing:{property:"letterSpacing",scale:"letterSpacings"},textAlign:!0,fontStyle:!0}),em=$g({alignItems:!0,alignContent:!0,justifyItems:!0,justifyContent:!0,flexWrap:!0,flexDirection:!0,flex:!0,flexGrow:!0,flexShrink:!0,flexBasis:!0,justifySelf:!0,alignSelf:!0,order:!0}),tm={space:[0,4,8,16,32,64,128,256,512]},nm=$g({gridGap:{property:"gridGap",scale:"space",defaultScale:tm.space},gridColumnGap:{property:"gridColumnGap",scale:"space",defaultScale:tm.space},gridRowGap:{property:"gridRowGap",scale:"space",defaultScale:tm.space},gridColumn:!0,gridRow:!0,gridAutoFlow:!0,gridAutoColumns:!0,gridAutoRows:!0,gridTemplateColumns:!0,gridTemplateRows:!0,gridTemplateAreas:!0,gridArea:!0}),rm={border:{property:"border",scale:"borders"},borderWidth:{property:"borderWidth",scale:"borderWidths"},borderStyle:{property:"borderStyle",scale:"borderStyles"},borderColor:{property:"borderColor",scale:"colors"},borderRadius:{property:"borderRadius",scale:"radii"},borderTop:{property:"borderTop",scale:"borders"},borderTopLeftRadius:{property:"borderTopLeftRadius",scale:"radii"},borderTopRightRadius:{property:"borderTopRightRadius",scale:"radii"},borderRight:{property:"borderRight",scale:"borders"},borderBottom:{property:"borderBottom",scale:"borders"},borderBottomLeftRadius:{property:"borderBottomLeftRadius",scale:"radii"},borderBottomRightRadius:{property:"borderBottomRightRadius",scale:"radii"},borderLeft:{property:"borderLeft",scale:"borders"},borderX:{properties:["borderLeft","borderRight"],scale:"borders"},borderY:{properties:["borderTop","borderBottom"],scale:"borders"},borderTopWidth:{property:"borderTopWidth",scale:"borderWidths"},borderTopColor:{property:"borderTopColor",scale:"colors"},borderTopStyle:{property:"borderTopStyle",scale:"borderStyles"}};rm.borderTopLeftRadius={property:"borderTopLeftRadius",scale:"radii"},rm.borderTopRightRadius={property:"borderTopRightRadius",scale:"radii"},rm.borderBottomWidth={property:"borderBottomWidth",scale:"borderWidths"},rm.borderBottomColor={property:"borderBottomColor",scale:"colors"},rm.borderBottomStyle={property:"borderBottomStyle",scale:"borderStyles"},rm.borderBottomLeftRadius={property:"borderBottomLeftRadius",scale:"radii"},rm.borderBottomRightRadius={property:"borderBottomRightRadius",scale:"radii"},rm.borderLeftWidth={property:"borderLeftWidth",scale:"borderWidths"},rm.borderLeftColor={property:"borderLeftColor",scale:"colors"},rm.borderLeftStyle={property:"borderLeftStyle",scale:"borderStyles"},rm.borderRightWidth={property:"borderRightWidth",scale:"borderWidths"},rm.borderRightColor={property:"borderRightColor",scale:"colors"},rm.borderRightStyle={property:"borderRightStyle",scale:"borderStyles"};var im=$g(rm),om={background:!0,backgroundImage:!0,backgroundSize:!0,backgroundPosition:!0,backgroundRepeat:!0};om.bgImage=om.backgroundImage,om.bgSize=om.backgroundSize,om.bgPosition=om.backgroundPosition,om.bgRepeat=om.backgroundRepeat;var am=$g(om),cm={space:[0,4,8,16,32,64,128,256,512]},sm=$g({position:!0,zIndex:{property:"zIndex",scale:"zIndices"},top:{property:"top",scale:"space",defaultScale:cm.space},right:{property:"right",scale:"space",defaultScale:cm.space},bottom:{property:"bottom",scale:"space",defaultScale:cm.space},left:{property:"left",scale:"space",defaultScale:cm.space}}),lm=sm,um={space:[0,4,8,16,32,64,128,256,512]},fm=function(e){return"number"===typeof e&&!isNaN(e)},hm=function(e,t){if(!fm(e))return Ug(t,e,e);var n=e<0,r=Math.abs(e),i=Ug(t,r,r);return fm(i)?i*(n?-1:1):n?"-"+i:i},dm={};dm.margin={margin:{property:"margin",scale:"space",transform:hm,defaultScale:um.space},marginTop:{property:"marginTop",scale:"space",transform:hm,defaultScale:um.space},marginRight:{property:"marginRight",scale:"space",transform:hm,defaultScale:um.space},marginBottom:{property:"marginBottom",scale:"space",transform:hm,defaultScale:um.space},marginLeft:{property:"marginLeft",scale:"space",transform:hm,defaultScale:um.space},marginX:{properties:["marginLeft","marginRight"],scale:"space",transform:hm,defaultScale:um.space},marginY:{properties:["marginTop","marginBottom"],scale:"space",transform:hm,defaultScale:um.space}},dm.margin.m=dm.margin.margin,dm.margin.mt=dm.margin.marginTop,dm.margin.mr=dm.margin.marginRight,dm.margin.mb=dm.margin.marginBottom,dm.margin.ml=dm.margin.marginLeft,dm.margin.mx=dm.margin.marginX,dm.margin.my=dm.margin.marginY,dm.padding={padding:{property:"padding",scale:"space",defaultScale:um.space},paddingTop:{property:"paddingTop",scale:"space",defaultScale:um.space},paddingRight:{property:"paddingRight",scale:"space",defaultScale:um.space},paddingBottom:{property:"paddingBottom",scale:"space",defaultScale:um.space},paddingLeft:{property:"paddingLeft",scale:"space",defaultScale:um.space},paddingX:{properties:["paddingLeft","paddingRight"],scale:"space",defaultScale:um.space},paddingY:{properties:["paddingTop","paddingBottom"],scale:"space",defaultScale:um.space}},dm.padding.p=dm.padding.padding,dm.padding.pt=dm.padding.paddingTop,dm.padding.pr=dm.padding.paddingRight,dm.padding.pb=dm.padding.paddingBottom,dm.padding.pl=dm.padding.paddingLeft,dm.padding.px=dm.padding.paddingX,dm.padding.py=dm.padding.paddingY;(function(){for(var e={},t=arguments.length,n=new Array(t),r=0;r4)return Mm;var n=t.map((function(t){return X(e,t)}));return 1===n.length?{top:n[0],right:n[0],bottom:n[0],left:n[0]}:2===n.length?{top:n[0],right:n[1],bottom:n[0],left:n[1]}:3===n.length?{top:n[0],right:n[1],bottom:n[2],left:n[1]}:{top:n[0],right:n[1],bottom:n[2],left:n[3]}},Cm=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},qm=function(e,t){return"0"!==e&&"0"!==t?"calc((100% - "+e+") - "+t+")":"0"===e&&"0"===t?"100%":"calc(100% - "+("0"===e?t:e)+")"},Sm=new Set(["top","center","bottom"]),Om=new Set(["bottom-left","left","top-left"]),Tm=new Set(["right","center","left"]),Em=new Set(["top-left","top","top-right"]),Am=new Set(["top-right","right","bottom-right"]),Hm=new Set(["bottom-right","bottom","bottom-left"]),Lm=s.d.div.attrs((function(e){var t=e.theme,n=e.margin;return{marginDimensions:_m(t,n)}})).withConfig({displayName:"container__Container",componentId:"sc-7g83tw-0"})(zm||(zm=Cm(["\n position: ",";\n display: flex;\n z-index: 35;\n outline: none;\n pointer-events: all;\n\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n\n ","\n"],["\n position: ",";\n display: flex;\n z-index: 35;\n outline: none;\n pointer-events: all;\n\n ","\n ","\n ","\n ","\n ","\n ","\n ","\n\n ","\n"])),(function(e){return e.isAbsolute?"absolute":"fixed"}),(function(e){var t=e.marginDimensions,n=t.top,r=t.bottom;return"max-height: "+qm(n,r)+";"}),(function(e){var t=e.marginDimensions,n=t.right,r=t.left;return"max-width: "+qm(r,n)+";"}),(function(e){var t=e.position,n=e.full,r=e.marginDimensions;return"vertical"===n||!0===n||Em.has(t)?"top: "+r.top+";":Tm.has(t)?"top: 50%;":""}),(function(e){var t=e.position,n=e.full,r=e.marginDimensions;return"horizontal"===n||!0===n||Am.has(t)?"right: "+r.right+";":""}),(function(e){var t=e.position,n=e.full,r=e.marginDimensions;return"vertical"===n||!0===n||Hm.has(t)?"bottom: "+r.bottom+";":""}),(function(e){var t=e.position,n=e.full,r=e.marginDimensions;return"horizontal"===n||!0===n||Om.has(t)?"left: "+r.left+";":Sm.has(t)?"left: 50%;":""}),(function(e){var t=e.full,n=e.position,r=function(){var e=!0!==t&&"horizontal"!==t&&Sm.has(n),r=!0!==t&&"vertical"!==t&&Tm.has(n);return e||r?e&&!r?"translateX(-50%)":!e&&r?"translateY(-50%)":"translate(-50%, -50%)":""}();return r&&"transform: "+r+";"}),(function(e){return e.borderShadow&&"box-shadow: 0px 2px 68px rgba(0, 0, 0, 0.288);"})),Dm=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Pm=function(){return(Pm=Object.assign||function(e){for(var t,n=1,r=arguments.length;n * {\n min-width: initial;\n max-width: initial;\n }\n"],["\n width: 100%;\n\n .tabs > * {\n min-width: initial;\n max-width: initial;\n }\n"]))),py=function(){return c.a.createElement(Af,{overflow:{vertical:"auto"},"data-testid":"dashboard"},c.a.createElement(dy,null,c.a.createElement(rv,{label:"Using a Mouse"},c.a.createElement(uy,null)),c.a.createElement(rv,{label:"Using Touch"},c.a.createElement(fy,null))))},zy=n(21),vy=n.n(zy);function gy(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function my(e,t){for(var n=0;n0?e.concat(Object.assign({field:o,values:l,type:c},s)):e}return e.concat(i)}),[])}function qy(e,t,n,r){var i=e.data,o=_y(t,n,r)||[];return Object.assign(Object.assign({},e),{data:i.map((function(e){return Object.assign(Object.assign({},e),{selected:o.some((function(t){return Sy(t,e.value)}))})}))})}function Sy(e,t){return!!(e&&e.name&&t&&t.name&&e.name===t.name)||jy()(e,t,{strict:!0})}function Oy(e,t){return t?t.reduce((function(e,t){return e.find((function(e){return e.type===t.type&&e.field===t.field}))?e:[].concat(Object(ky.a)(e),[t])}),e):e}function Ty(e){return void 0!==e.name}var Ey=Object.assign({},i),Ay=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i1)return console.warn("search-ui-site-search-connector: Cannot apply more than 1 none-value filters to a single field"),e;var i=r[0];if(Ey.isFilterValueRange(i)){i.name;var o=Ay(i,["name"]);return e[n]=Object.assign({type:"range"},o),e}return e}return e[n]=Object.assign(Object.assign({},"any"===t.type?{}:{type:"and"}),{values:r}),e}),{})}(void 0!==t.filters?t.filters:e.filters),l=void 0!==t.current?t.current:e.current,u=void 0!==t.resultsPerPage?t.resultsPerPage:e.resultsPerPage,f=void 0!==t.sortDirection?t.sortDirection:e.sortDirection,h=void 0!==t.sortField?t.sortField:e.sortField,d=void 0!==t.sortList?t.sortList:e.sortList,p=(o=t.result_fields)?[Object.keys(o),Object.entries(o).reduce((function(e,t){var n=Object(by.a)(t,2),r=n[0],i=n[1];return i.snippet?Object.assign(Object.assign({},e),Object(wy.a)({},r,i.snippet)):e}),{})]:[],z=Object(by.a)(p,2),v=z[0],g=z[1],m=(a=t.search_fields)?Object.keys(a):[],y=e.searchTerm;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},u&&{per_page:u}),l&&{page:l}),f&&{sort_direction:Object(wy.a)({},n,f)}),h&&{sort_field:Object(wy.a)({},n,h)}),d&&{sort_list:Object(wy.a)({},n,d)}),s&&{filters:Object(wy.a)({},n,s)}),c&&{facets:Object(wy.a)({},n,c)}),v&&{fetch_fields:Object(wy.a)({},n,v)}),g&&{highlight_fields:Object(wy.a)({},n,g)}),m&&!!m.length&&{search_fields:Object(wy.a)({},n,m)}),{q:y})}var Ly=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i0&&{facets:a})}var Vy=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(t){o(t)}}function c(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))};function Ny(e,t,n,r){return Vy(this,void 0,void 0,vy.a.mark((function i(){var o,a,c,s;return vy.a.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return o=new Headers({"Content-Type":"application/json"}),i.next=3,fetch("https://search-api.swiftype.com/api/v1/public/".concat(n),{method:t,headers:o,body:JSON.stringify(Object.assign({engine_key:e},r)),credentials:"include"});case 3:return a=i.sent,i.prev=4,i.next=7,a.json();case 7:c=i.sent,i.next=12;break;case 10:i.prev=10,i.t0=i.catch(4);case 12:if(!(a.status>=200&&a.status<300)){i.next=16;break}return i.abrupt("return",c);case 16:throw s=c&&c.errors&&Object.entries(c.errors).length>0?JSON.stringify(c.errors):a.status,new Error("".concat(s));case 18:case"end":return i.stop()}}),i,null,[[4,10]])})))}var Iy=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(t){o(t)}}function c(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))};function Ry(e,t,n){var r=Object.entries(Object.assign({engine_key:e},n)).map((function(e){var t=Object(by.a)(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(encodeURIComponent(r))})).join("&");return fetch("https://search-api.swiftype.com/api/v1/public/".concat(t,"?").concat(r),{method:"GET",credentials:"include"})}var By=function(){function e(t){var n=t.documentType,r=t.engineKey,i=t.beforeSearchCall,o=void 0===i?function(e,t){return t(e)}:i,a=t.beforeAutocompleteResultsCall,c=void 0===a?function(e,t){return t(e)}:a;gy(this,e),this.documentType=n,this.engineKey=r,this.beforeSearchCall=o,this.beforeAutocompleteResultsCall=c,this.request=Ny.bind(this,r),this._get=Ry.bind(this,r)}return yy(e,[{key:"onResultClick",value:function(e){var t=e.query,n=e.documentId,r=e.tags;r&&r.length>0&&console.warn("search-ui-site-search-connector: Site Search does not support tags on click"),this._get("analytics/pc",{t:(new Date).getTime(),q:t,doc_id:n})}},{key:"onAutocompleteResultClick",value:function(e){var t=e.query,n=e.documentId;e.tags&&console.warn("search-ui-site-search-connector: Site Search does not support tags on autocompleteClick"),this._get("analytics/pas",{t:(new Date).getTime(),q:t,doc_id:n})}},{key:"onSearch",value:function(e,t){var n=this,r=Hy(e,t,this.documentType);return this.beforeSearchCall(r,(function(e){return n.request("POST","engines/search.json",e).then((function(e){return Py(e,n.documentType)}))}))}},{key:"onAutocomplete",value:function(e,t){var n=e.searchTerm;return Iy(this,void 0,void 0,vy.a.mark((function e(){var r,i=this;return vy.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.results){e.next=3;break}return r=Hy({searchTerm:n},t.results,this.documentType),e.abrupt("return",this.beforeAutocompleteResultsCall(r,(function(e){return i.request("POST","engines/suggest.json",e).then((function(e){return{autocompletedResults:Py(e,i.documentType).results}}))})));case 3:t.suggestions&&console.warn("search-ui-site-search-connector: Site Search does support query suggestions on autocomplete");case 4:case"end":return e.stop()}}),e,this)})))}}]),e}();function Fy(e){return"/"===e.charAt(0)}function Uy(e,t){for(var n=t,r=n+1,i=e.length;r=0;u--){var f=i[u];"."===f?Uy(i,u):".."===f?(Uy(i,u),l++):l&&(Uy(i,u),l--)}if(!c)for(;l--;l)i.unshift("..");!c||""===i[0]||i[0]&&Fy(i[0])||i.unshift("");var h=i.join("/");return n&&"/"!==h.substr(-1)&&(h+="/"),h};var Gy=!0,Yy="Invariant failed";function Zy(e,t){if(!e){if(Gy)throw new Error(Yy);var n="function"===typeof t?t():t;throw new Error(n?Yy+": "+n:Yy)}}function $y(e){return"/"===e.charAt(0)?e:"/"+e}function Xy(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function Ky(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function Qy(e){var t=e.pathname,n=e.search,r=e.hash,i=t||"/";return n&&"?"!==n&&(i+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(i+="#"===r.charAt(0)?r:"#"+r),i}function Jy(e,t,n,r){var i;"string"===typeof e?(i=function(e){var t=e||"/",n="",r="",i=t.indexOf("#");-1!==i&&(r=t.substr(i),t=t.substr(0,i));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e)).state=t:(void 0===(i=Object(iz.a)({},e)).pathname&&(i.pathname=""),i.search?"?"!==i.search.charAt(0)&&(i.search="?"+i.search):i.search="",i.hash?"#"!==i.hash.charAt(0)&&(i.hash="#"+i.hash):i.hash="",void 0!==t&&void 0===i.state&&(i.state=t));try{i.pathname=decodeURI(i.pathname)}catch(o){throw o instanceof URIError?new URIError('Pathname "'+i.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):o}return n&&(i.key=n),r?i.pathname?"/"!==i.pathname.charAt(0)&&(i.pathname=Wy(i.pathname,r.pathname)):i.pathname=r.pathname:i.pathname||(i.pathname="/"),i}function eb(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,i){if(null!=e){var o="function"===typeof e?e(t,n):e;"string"===typeof o?"function"===typeof r?r(o,i):i(!0):i(!1!==o)}else i(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;r1&&(s.current=n),t&&(s.q=t),i&&(s.size=i),r&&r.length>0&&(s.filters=r),c&&c.length>0?s.sort=c:a&&(s["sort-field"]=a,s["sort-direction"]=o),s}(e))}var kb=function(){function e(){gy(this,e),this.history="undefined"!==typeof window?ab():function(e){void 0===e&&(e={});var t=e,n=t.getUserConfirmation,r=t.initialEntries,i=void 0===r?["/"]:r,o=t.initialIndex,a=void 0===o?0:o,c=t.keyLength,s=void 0===c?6:c,l=eb();function u(e){Object(iz.a)(v,e),v.length=v.entries.length,l.notifyListeners(v.location,v.action)}function f(){return Math.random().toString(36).substr(2,s)}var h=cb(a,0,i.length-1),d=i.map((function(e){return Jy(e,void 0,"string"===typeof e?f():e.key||f())})),p=Qy;function z(e){var t=cb(v.index+e,0,v.entries.length-1),r=v.entries[t];l.confirmTransitionTo(r,"POP",n,(function(e){e?u({action:"POP",location:r,index:t}):u()}))}var v={length:d.length,action:"POP",location:d[h],index:h,entries:d,createHref:p,push:function(e,t){var r=Jy(e,t,f(),v.location);l.confirmTransitionTo(r,"PUSH",n,(function(e){if(e){var t=v.index+1,n=v.entries.slice(0);n.length>t?n.splice(t,n.length-t,r):n.push(r),u({action:"PUSH",location:r,index:t,entries:n})}}))},replace:function(e,t){var r=Jy(e,t,f(),v.location);l.confirmTransitionTo(r,"REPLACE",n,(function(e){e&&(v.entries[v.index]=r,u({action:"REPLACE",location:r}))}))},go:z,goBack:function(){z(-1)},goForward:function(){z(1)},canGo:function(e){var t=v.index+e;return t>=0&&t1&&void 0!==arguments[1]?arguments[1]:{},n=t.replaceUrl,r=void 0!==n&&n,i=wb(e);this.lastPushSearchString=i;var o=r?this.history.replace:this.history.push;o({search:"?".concat(i)})}},{key:"onURLStateChange",value:function(e){var t=this;this.unlisten=this.history.listen((function(n){"?".concat(t.lastPushSearchString)!==n.search&&(t.lastPushSearchString="",e(bb(fb.parse(n.search))))}))}},{key:"tearDown",value:function(){this.unlisten()}}]),e}(),xb=function(){function e(){gy(this,e),this.requestSequence=0,this.lastCompleted=0}return yy(e,[{key:"next",value:function(){return++this.requestSequence}},{key:"isOldRequest",value:function(e){return e3?r-3:0),o=3;o2&&void 0!==arguments[2]?arguments[2]:"all";this.debug&&(n=console).log.apply(n,["Search UI: Action","addFilter"].concat(Array.prototype.slice.call(arguments)));var i=this.state.filters,o=i.find((function(t){return t.field===e&&t.type===r}))||{},a=i.filter((function(t){return t.field!==e||t.type!==r}))||[],c=o.values||[],s=c.find((function(e){return Sy(e,t)}))?c:c.concat(t);this._updateSearchResults({current:1,filters:[].concat(Object(ky.a)(a),[{field:e,values:s,type:r}])})}function qb(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.debug&&(t=console).log.apply(t,["Search UI: Action","trackAutocompleteClickThrough"].concat(Array.prototype.slice.call(arguments)));var r=this.state,i=r.autocompletedResultsRequestId,o=r.searchTerm,a=r.autocompletedResults,c=a.findIndex((function(t){return t._meta.id===e})),s=a[c];this.events.autocompleteResultClick({query:o,documentId:e,requestId:i,tags:n,result:s,resultIndex:c})}function Sb(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.debug&&(e=console).log.apply(e,["Search UI: Action","clearFilters"].concat(Array.prototype.slice.call(arguments)));var n=this.state.filters.filter((function(e){var n=e.field;return t.includes(n)}));this._updateSearchResults({current:1,filters:n})}function Ob(e,t,n){var r;this.debug&&(r=console).log.apply(r,["Search UI: Action","removeFilter"].concat(Array.prototype.slice.call(arguments)));var i=this.state.filters,o=i;o=!t&&n?i.filter((function(t){return!(t.field===e&&t.type===n)})):t?Cy(i,e,t,n):i.filter((function(t){return t.field!==e})),this._updateSearchResults({current:1,filters:o})}function Tb(){var e;this.debug&&(e=console).log.apply(e,["Search UI: Action","reset"].concat(Array.prototype.slice.call(arguments))),this._setState(this.startingState),this.trackUrlState&&this.URLManager.pushStateToURL(this.state)}function Eb(e){var t;this.debug&&(t=console).log.apply(t,["Search UI: Action","setCurrent"].concat(Array.prototype.slice.call(arguments))),this._updateSearchResults({current:e})}function Ab(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"all";this.debug&&(n=console).log.apply(n,["Search UI: Action","setFilter"].concat(Array.prototype.slice.call(arguments)));var i=this.state.filters;i=i.filter((function(t){return t.field!==e||t.type!==r})),this._updateSearchResults({current:1,filters:[].concat(Object(ky.a)(i),[{field:e,values:[t],type:r}])})}function Hb(e){var t;this.debug&&(t=console).log.apply(t,["Search UI: Action","setResultsPerPage"].concat(Array.prototype.slice.call(arguments))),this._updateSearchResults({current:1,resultsPerPage:e})}function Lb(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.autocompleteMinimumCharacters,i=void 0===r?0:r,o=n.autocompleteResults,a=void 0!==o&&o,c=n.autocompleteSuggestions,s=void 0!==c&&c,l=n.shouldClearFilters,u=void 0===l||l,f=n.refresh,h=void 0===f||f,d=n.debounce,p=void 0===d?0:d;this.debug&&(t=console).log.apply(t,["Search UI: Action","setSearchTerm"].concat(Array.prototype.slice.call(arguments))),this._setState({searchTerm:e}),h&&this.debounceManager.runWithDebounce(p,"_updateSearchResults",this._updateSearchResults,Object.assign({current:1},u&&{filters:[]})),(a||s)&&e.length>=i&&this.debounceManager.runWithDebounce(p,"_updateAutocomplete",this._updateAutocomplete,e,{autocompleteResults:a,autocompleteSuggestions:s})}function Db(e,t){var n;this.debug&&(n=console).log.apply(n,["Search UI: Action","setSort"].concat(Array.prototype.slice.call(arguments)));var r={current:1,sortList:null,sortField:null,sortDirection:null};Array.isArray(e)?r.sortList=e:(r.sortField=e,r.sortDirection=t),this._updateSearchResults(r)}function Pb(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];this.debug&&(t=console).log.apply(t,["Search UI: Action","trackClickThrough"].concat(Array.prototype.slice.call(arguments)));var r=this.state,i=r.requestId,o=r.searchTerm,a=r.results,c=r.current,s=r.resultsPerPage,l=a.findIndex((function(t){return t._meta.id===e})),u=a[l];this.events.resultClick({query:o,documentId:e,requestId:i,tags:n,result:u,page:c,resultsPerPage:s,resultIndexOnPage:l})}var Vb="search-ui-screen-reader-notifications",Nb="undefined"!==typeof document,Ib=function(){if(!Nb)return null;var e=document.getElementById(Vb);return e||((e=document.createElement("div")).id=Vb,e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.style.position="absolute",e.style.width="1px",e.style.height="1px",e.style.margin="-1px",e.style.padding="0",e.style.border="0",e.style.overflow="hidden",e.style.clip="rect(0 0 0 0)",document.body.appendChild(e),e)},Rb=function(e){var t=Ib();t&&(t.textContent=e)},Bb={searchResults:function(e){var t=e.start,n=e.end,r=e.totalResults,i=e.searchTerm,o="Showing ".concat(t," to ").concat(n," results out of ").concat(r);return i&&(o+=', searching for "'.concat(i,'".')),o}};function Fb(e,t){if(this.hasA11yNotifications){var n=this.a11yNotificationMessages[e];if(n){var r=n(t);Rb(r),this.debug&&console.log("Search UI: Action","a11yNotify",{messageFunc:e,messageArgs:t,message:r})}else{var i='Could not find corresponding message function in a11yNotificationMessages: "'.concat(e,'"');console.warn("Action","a11yNotify",i)}}}function Ub(e,t,n){if(n){if(t){var r=t[e].bind(t);return function(){for(var e=arguments.length,t=new Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:{},n=t.apiConnector,r=t.onSearch,i=t.onAutocomplete,o=t.onResultClick,a=t.onAutocompleteResultClick;gy(this,e),this.search=Ub("onSearch",n,r),this.autocomplete=Ub("onAutocomplete",n,i),this.resultClick=Ub("onResultClick",n,o),this.autocompleteResultClick=Ub("onAutocompleteResultClick",n,a)},Gb="Invalid credentials",Yb=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return Object.entries(e).reduce((function(e,r){var i=Object(by.a)(r,2),o=i[0],a=i[1];return t[o]&&"function"===typeof t[o]&&!t[o]({filters:n})?e:(e[o]=a,e)}),{})}var Kb=function(){function e(t){var n,r=this,i=t.apiConnector,a=t.autocompleteQuery,c=void 0===a?{}:a,s=t.debug,l=t.initialState,u=t.onSearch,f=t.onAutocomplete,h=t.onResultClick,d=t.onAutocompleteResultClick,p=t.searchQuery,z=void 0===p?{}:p,v=t.trackUrlState,g=void 0===v||v,m=t.urlPushDebounceLength,y=void 0===m?500:m,b=t.hasA11yNotifications,w=void 0!==b&&b,k=t.a11yNotificationMessages,x=void 0===k?{}:k,j=t.alwaysSearchOnInitialLoad,M=void 0!==j&&j;gy(this,e),this.state=$b,this._updateAutocomplete=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.autocompleteResults,i=t.autocompleteSuggestions,o=r.autocompleteRequestSequencer.next(),a=Object.assign(Object.assign({},n&&{results:r.autocompleteQuery.results||{}}),i&&{suggestions:r.autocompleteQuery.suggestions||{}});return r.events.autocomplete({searchTerm:e},a).then((function(e){r.autocompleteRequestSequencer.isOldRequest(o)||(r.autocompleteRequestSequencer.completed(o),r._setState(e))}))},this._updateSearchResults=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.skipPushToUrl,i=void 0!==n&&n,o=t.replaceUrl,a=void 0!==o&&o,c=Object.assign(Object.assign({},r.state),e),s=c.current,l=c.filters,u=c.resultsPerPage,f=c.searchTerm,h=c.sortDirection,d=c.sortField,p=c.sortList;r.debounceManager.cancelByName("_updateSearchResults"),r._setState({current:s,error:"",filters:l,resultsPerPage:u,searchTerm:f,sortDirection:h,sortField:d,sortList:p}),r._makeSearchRequest({skipPushToUrl:i,replaceUrl:a})},this._makeSearchRequest=_b.debounce(0,(function(e){var t=e.skipPushToUrl,n=e.replaceUrl,i=r.state,o=i.current,a=i.filters,c=i.resultsPerPage,s=i.searchTerm,l=i.sortDirection,u=i.sortField,f=i.sortList;r._setState({isLoading:!0});var h=r.searchRequestSequencer.next(),d=r.searchQuery,p=(d.filters,d.conditionalFacets),z=Yb(d,["filters","conditionalFacets"]),v=Object.assign(Object.assign({},z),{facets:Xb(r.searchQuery.facets,p,a)}),g=Object.assign(Object.assign({},Zb(r.state)),{filters:Oy(a,r.searchQuery.filters)});return r.events.search(g,v).then((function(e){if(!r.searchRequestSequencer.isOldRequest(h)){r.searchRequestSequencer.completed(h);var i=e.totalResults,d=0===i?0:(o-1)*c+1,p=i0||this.alwaysSearchOnInitialLoad)&&this._updateSearchResults(_,{replaceUrl:!0})}return yy(e,[{key:"_setState",value:function(e){var t=Object.assign(Object.assign({},this.state),e);this.debug&&console.log("Search UI: State Update",e,t),this.state=t,this.subscriptions.forEach((function(e){return e(t)}))}},{key:"setSearchQuery",value:function(e){this.searchQuery=e,this._updateSearchResults({})}},{key:"setAutocompleteQuery",value:function(e){this.autocompleteQuery=e}},{key:"subscribeToStateChanges",value:function(e){this.subscriptions.push(e)}},{key:"unsubscribeToStateChanges",value:function(e){this.subscriptions=this.subscriptions.filter((function(t){return t!==e}))}},{key:"tearDown",value:function(){this.subscriptions=[],this.URLManager&&this.URLManager.tearDown()}},{key:"getActions",value:function(){return this.actions}},{key:"getState",value:function(){return Object.assign({},this.state)}}]),e}(),Qb=c.a.createContext(null),Jb={moreFilters:function(e){var t=e.visibleOptionsCount,n=e.showingAll?"All ":"";return n+="".concat(t," options shown.")}},ew=function(e){var t=e.children,n=e.config,r=e.driver,i=Object(a.useState)(null),o=Object(by.a)(i,2),s=o[0],l=o[1];if(Object(a.useEffect)((function(){var e=r||new Kb(Object.assign(Object.assign({},n),{a11yNotificationMessages:Object.assign(Object.assign({},Jb),n.a11yNotificationMessages)}));return l(e),function(){e.tearDown()}}),[]),Object(a.useEffect)((function(){s&&s.setSearchQuery(n.searchQuery)}),[n.searchQuery]),Object(a.useEffect)((function(){s&&s.setAutocompleteQuery(n.autocompleteQuery)}),[n.autocompleteQuery]),!s)return null;var u={driver:s};return c.a.createElement(Qb.Provider,{value:u},t)};function tw(e){return(tw="function"===typeof Symbol&&"symbol"===typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function nw(e){return(nw="function"===typeof Symbol&&"symbol"===tw(Symbol.iterator)?function(e){return tw(e)}:function(e){return e&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":tw(e)})(e)}function rw(e,t){return!t||"object"!==nw(t)&&"function"!==typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function iw(e){return(iw=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ow(e,t){return(ow=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var aw=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"===typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]1&&e}));return e[n]=e[n]||[],e[n].push(t),e}),{})},qw=function(){return(qw=Object.assign||function(e){for(var t,n=1,r=arguments.length;n * {\n min-width: 160px;\n max-width: 100%;\n }\n"],["\n width: 100%;\n\n .tabs > * {\n min-width: 160px;\n max-width: 100%;\n }\n"]))),Nw=["learn","community"],Iw={learn:"learn.netdata",community:"discourse","github-cloud":"netdata-cloud","github-agent":"netdata"},Rw={learn:"Documentation",community:"Community","github-cloud":"Github / Cloud","github-agent":"Github / Agent"},Bw=function(e){var t=e.results;return c.a.createElement(Af,{overflow:{vertical:"auto"},"data-testid":"searchResults",flex:!0,width:"1000px",height:"60vh"},c.a.createElement(Vw,null,Nw.map((function(e){var n=t[Iw[e]],r=null===n||void 0===n?void 0:n.length;return c.a.createElement(rv,{key:e,label:Rw[e]+(r?" ("+r+")":"")},c.a.createElement(Pw,null,r?n.map((function(e){var t=e.id,n=e.url,r=e.title,i=e.description;return c.a.createElement(Dw,{key:t.raw,url:n.raw,title:r,description:i})})):c.a.createElement(Af,{padding:[4]},c.a.createElement(wh,{strong:!0},"No results"))))}))))},Fw=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Uw=Object(s.d)(Af).attrs({padding:[6],background:"dropdown",gap:6,column:!0,round:!0,overflow:{vertical:"auto"}}).withConfig({displayName:"documentation__Container",componentId:"sc-3qq6g2-0"})(hw||(hw=Fw(["\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);\n"],["\n box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);\n"]))),Ww=function(e){var t=e.children,n=e.onClose;return c.a.createElement(Af,{width:"100%",alignItems:"center",justifyContent:"between",padding:[0,0,4],border:{side:"bottom",color:"disabled"}},c.a.createElement(Af,{gap:2,alignItems:"center"},t),c.a.createElement(Df,{icon:"x",neutral:!0,small:!0,onClick:n,flavour:"borderless","data-testid":"documentation-help-close"}))},Gw="general",Yw="dashboard",Zw="search",$w={general:"Need help?",dashboard:"Need help?"},Xw=function(e){var t=e.app,n=void 0===t?"cloud":t,r=e.onCloseClick,i=e.onVisitDocumentClick,o=e.onOpenIssueClick,s=e.onOpenBugClick,l=e.onContributeClick,u=e.onSupportClick,f=e.children,h=Qm(),d=h[0],p=h[1],z=Object(a.useState)(Gw),v=z[0],g=z[1],m=v===Gw,y=Object(a.useCallback)((function(){return g(Yw)}),[]),b=Object(a.useCallback)((function(){return g(Gw)}),[]),w=Object(a.useCallback)((function(){return g(Zw)}),[]),k=Object(a.useCallback)((function(){p(),r&&r()}),[]);return c.a.createElement(a.Fragment,null,f(p,d),d&&c.a.createElement(Bm,{position:"bottom-left",backdrop:!0,margin:[5,17],onClickOutside:p,onEsc:p},c.a.createElement(Tw,null,(function(e){var t=e.searchTerm,r=e.setSearchTerm,f=e.results,h=e.reset;return c.a.createElement(a.Fragment,null,c.a.createElement(Uw,{width:{max:m?"325px":v===Yw?"600px":"100%"},"data-testid":"documentation-layer"},c.a.createElement(Ww,{onClose:k},m&&c.a.createElement(Au,{color:"text",name:"questionFilled",width:"18px",height:"18px"}),!m&&c.a.createElement(Df,{icon:"arrow_left",neutral:!0,small:!0,onClick:function(){b(),h()},flavour:"borderless","data-testid":"dashboard-back"}),c.a.createElement(vh,{margin:[0]},$w[v]||$w.general)),v!==Yw&&c.a.createElement(Ew,{defaultValue:t,setSearchTerm:r,setSearchView:w}),m&&c.a.createElement(Af,{gap:6,overflow:{vertical:"auto"},column:!0,padding:[1]},c.a.createElement(iy,{app:n,onDashboardClick:y,onVisitDocumentClick:i,onOpenIssueClick:o,onOpenBugClick:s,onContributeClick:l,onSupportClick:u})),v===Yw&&c.a.createElement(py,null),v===Zw&&c.a.createElement(Bw,{results:f})))}))))},Kw=n(268),Qw="object"===typeof window,Jw=(n.n(Kw).a,function(){}),ek=function(e,t,n){if(!Qw)return[t,Jw,Jw];if(!e)throw new Error("useLocalStorage key may not be falsy");var r=n?n.raw?function(e){return e}:n.deserializer:JSON.parse,i=Object(a.useState)((function(){try{var o=n?n.raw?String:n.serializer:JSON.stringify,a=localStorage.getItem(e);return null!==a?r(a):(t&&localStorage.setItem(e,o(t)),t)}catch(i){return t}})),o=i[0],c=i[1],s=Object(a.useCallback)((function(t){try{var a="function"===typeof t?t(o):t;if("undefined"===typeof a)return;var s=void 0;s=n?n.raw?"string"===typeof a?a:JSON.stringify(a):n.serializer?n.serializer(a):JSON.stringify(a):JSON.stringify(a),localStorage.setItem(e,s),c(r(s))}catch(i){}}),[e,c]),l=Object(a.useCallback)((function(){try{localStorage.removeItem(e),c(void 0)}catch(i){}}),[e,c]);return[o,s,l]},tk=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},nk=Object(s.d)(Af).attrs({overflow:{vertical:"auto"},padding:[0,4,0,0]}).withConfig({displayName:"container__Container",componentId:"sc-1v3y9uu-0"})(dw||(dw=tk(["\n ","\n"],["\n ","\n"])),vd),rk=function(e){var t=e.onClose;return c.a.createElement(Af,{border:{side:"bottom",color:"selected"},justifyContent:"between",alignItems:"center",padding:[0,0,4,0]},c.a.createElement(Af,{gap:2},c.a.createElement(Au,{color:"text",name:"insights"}),c.a.createElement(kh,{strong:!0},"Netdata News")),c.a.createElement(Df,{flavour:"borderless",neutral:!0,icon:"x",title:"close news",onClick:t}))},ik=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},ok=Object(s.d)(Af).attrs({as:"img"}).withConfig({displayName:"image__Image",componentId:"sc-1l0yjz3-0"})(pw||(pw=ik(["\n object-fit: cover;\n"],["\n object-fit: cover;\n"]))),ak=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},ck=Object(s.d)(Af).attrs({as:"a"}).withConfig({displayName:"anchor__Anchor",componentId:"sc-5t4sos-0"})(zw||(zw=ak(["\n text-decoration: none;\n & :hover {\n text-decoration: none;\n }\n"],["\n text-decoration: none;\n & :hover {\n text-decoration: none;\n }\n"]))),sk=function(e){var t=e.item,n=t.last_publication_date,r=t.data,i=r.title,o=r.description,a=r.url,s=r.image,l=r.label,u=s&&s.url,f=new Date(n);return c.a.createElement(Af,{column:!0,gap:2},c.a.createElement(Af,{gap:4},u&&c.a.createElement(ok,{src:u,width:"160px"}),c.a.createElement(Af,{column:!0,gap:2},c.a.createElement(wh,{strong:!0},i),c.a.createElement(wh,null,o))),c.a.createElement(Af,{justifyContent:"between",alignItems:"center"},c.a.createElement(bh,null,f.toLocaleDateString()),c.a.createElement(ck,{href:a,target:"_blank",rel:"noopener noreferrer",gap:1,alignItems:"center"},c.a.createElement(wh,{color:"success",strong:!0},l),c.a.createElement(Au,{color:"success",rotate:2,name:"arrow_left"}))))},lk=n(267),uk=function(e,t){return(uk=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};function fk(e,t){function n(){this.constructor=e}uk(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var hk=function(){return(hk=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0?this.running[0]:null},e.prototype.refFromCookie=function(e){if(!e||""===e.trim())return null;var t=e.trim().split(" ");if(t.length<2)return null;var n=t[0],r=parseInt(t[1],10),i=this.running.filter((function(e){return e.googleId()===n&&e.variations.length>r}))[0];return i?i.variations[r].ref():null},e}(),vk=function(){function e(e,t){for(var n in this.httpClient=t,this.form=e,this.data={},e.fields)e.fields[n].default&&(this.data[n]=[e.fields[n].default])}return e.prototype.set=function(e,t){var n=this.form.fields[e];if(!n)throw new Error("Unknown field "+e);var r=""===t||void 0===t?null:t,i=this.data[e]||[];i=n.multiple?r?i.concat([r]):i:r?[r]:i,this.data[e]=i},e.prototype.url=function(){var e=this.form.action;if(this.data){var t=e.indexOf("?")>-1?"&":"?";for(var n in this.data)if(Object.prototype.hasOwnProperty.call(this.data,n)){var r=this.data[n];if(r)for(var i=0;i0&&(this.url+=function(e){return e.indexOf("?")>-1?"&":"?"}(e)+n.join("&")),this.apiDataTTL=this.options.apiDataTTL||5,this.httpClient=new ox(this.options.requestHandler,this.options.apiCache,this.options.proxyAgent,this.options.timeoutInMs)}return e.prototype.get=function(e){var t=this;return this.httpClient.cachedRequest(this.url,{ttl:this.apiDataTTL}).then((function(n){var r=new tx(n,t.httpClient,t.options);return e&&e(null,r),r})).catch((function(t){throw e&&e(t),t}))},e}(),cx=function(){function e(e,t){this.id=e,this.api=t,this.fields={}}return e.prototype.set=function(e,t){return this.fields[e]=t,this},e.prototype.ref=function(e){return this.set("ref",e)},e.prototype.query=function(e){return this.set("q",e)},e.prototype.pageSize=function(e){return this.set("pageSize",e)},e.prototype.graphQuery=function(e){return this.set("graphQuery",e)},e.prototype.lang=function(e){return this.set("lang",e)},e.prototype.page=function(e){return this.set("page",e)},e.prototype.after=function(e){return this.set("after",e)},e.prototype.orderings=function(e){return this.set("orderings",e)},e.prototype.url=function(){var t=this;return this.api.get().then((function(n){return e.toSearchForm(t,n).url()}))},e.prototype.submit=function(t){var n=this;return this.api.get().then((function(r){return e.toSearchForm(n,r).submit(t)}))},e.toSearchForm=function(e,t){var n=t.searchForm(e.id);if(n)return Object.keys(e.fields).reduce((function(t,n){var r=e.fields[n];return"q"===n?t.query(r):"pageSize"===n?t.pageSize(r):"graphQuery"===n?t.graphQuery(r):"lang"===n?t.lang(r):"page"===n?t.page(r):"after"===n?t.after(r):"orderings"===n?t.orderings(r):t.set(n,r)}),n);throw new Error("Unable to access to form "+e.id)},e}(),sx=function(){function e(e,t){this.api=new ax(e,t)}return e.prototype.getApi=function(){return this.api.get()},e.prototype.everything=function(){return this.form("everything")},e.prototype.form=function(e){return new cx(e,this.api)},e.prototype.query=function(e,t,n){return this.getApi().then((function(r){return r.query(e,t,n)}))},e.prototype.queryFirst=function(e,t,n){return this.getApi().then((function(r){return r.queryFirst(e,t,n)}))},e.prototype.getByID=function(e,t,n){return this.getApi().then((function(r){return r.getByID(e,t,n)}))},e.prototype.getByIDs=function(e,t,n){return this.getApi().then((function(r){return r.getByIDs(e,t,n)}))},e.prototype.getByUID=function(e,t,n,r){return this.getApi().then((function(i){return i.getByUID(e,t,n,r)}))},e.prototype.getSingle=function(e,t,n){return this.getApi().then((function(r){return r.getSingle(e,t,n)}))},e.prototype.getBookmark=function(e,t,n){return this.getApi().then((function(r){return r.getBookmark(e,t,n)}))},e.prototype.getTags=function(){return this.getApi().then((function(e){return e.getTags()}))},e.prototype.getPreviewResolver=function(e,t){var n=this;return ex(e,t,(function(e,t){return n.getApi().then((function(n){return n.getByID(e,t)}))}))},e.getApi=function(e,t){return new ax(e,t).get()},e}();function lx(e,t){return sx.getApi(e,t)}var ux={experimentCookie:"io.prismic.experiment",previewCookie:"io.prismic.preview",Predicates:Kk,predicates:Kk,Experiments:zk,Api:ax,client:function(e,t){return new sx(e,t)},getApi:lx,api:function(e,t){return lx(e,t)}},fx=ux.client("https://netdata-news.cdn.prismic.io/api/v2"),hx=[],dx=function(e){var t=e.app,n=void 0===t?"cloud":t,r=e.onCloseClick,i=e.children,o=ek("news_last_seen"),s=o[0],l=o[1],u=Object(a.useState)(hx),f=u[0],h=u[1],d=Object(a.useState)(),p=d[0],z=d[1],v=Qm(),g=v[0],m=v[1];Object(a.useEffect)((function(){!function(e,t,n){fx.query(ux.Predicates.at("document.tags",[e]),{pageSize:100,orderings:"[document.last_publication_date desc]"}).then(t).catch(n)}(n,(function(e){var t=e.results;return h(t)}),(function(){return z(!0)}))}),[]);var y=Object(a.useMemo)((function(){if(!f.length)return!0;var e=f[0].last_publication_date;return new Date(s)>=new Date(e)}),[s,f]),b=Object(a.useCallback)((function(){m(),l(new Date),r&&r()}),[r]);return c.a.createElement(a.Fragment,null,i({toggle:m,isOpen:g,upToDate:y}),g&&c.a.createElement(Bm,{backdrop:!0,onClickOutside:b,onEsc:b},c.a.createElement(Af,{background:"dropdown",round:!0,padding:[6],width:"640px",height:{max:"640px"},gap:4,column:!0},c.a.createElement(rk,{onClose:b}),c.a.createElement(nk,{column:!0,gap:6},p&&c.a.createElement(bh,{textAlign:"center"},"Something went wrong \ud83d\ude14"),!p&&!f.length&&c.a.createElement(bh,{textAlign:"center"},"There are no latest news"),!p&&f.length>0&&f.map((function(e){return c.a.createElement(sk,{key:e.id,item:e})}))))))},px=function(){return(px=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=0||(i[n]=e[n]);return i}var Dx=n(214),Px=n.n(Dx),Vx=n(269),Nx=["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"],Ix=["reactReduxForwardedRef"],Rx=[],Bx=[null,null];function Fx(e,t){var n=e[1];return[t.payload,n+1]}function Ux(e,t,n){Ax((function(){return e.apply(void 0,t)}),n)}function Wx(e,t,n,r,i,o,a){e.current=r,t.current=i,n.current=!1,o.current&&(o.current=null,a())}function Gx(e,t,n,r,i,o,a,c,s,l){if(e){var u=!1,f=null,h=function(){if(!u){var e,n,h=t.getState();try{e=r(h,i.current)}catch(d){n=d,f=d}n||(f=null),e===o.current?a.current||s():(o.current=e,c.current=e,a.current=!0,l({type:"STORE_UPDATED",payload:{error:n}}))}};n.onStateChange=h,n.trySubscribe(),h();return function(){if(u=!0,n.tryUnsubscribe(),n.onStateChange=null,f)throw f}}}var Yx=function(){return[null,0]};function Zx(e,t){void 0===t&&(t={});var n=t,r=n.getDisplayName,i=void 0===r?function(e){return"ConnectAdvanced("+e+")"}:r,o=n.methodName,s=void 0===o?"connectAdvanced":o,l=n.renderCountProp,u=void 0===l?void 0:l,f=n.shouldHandleStateChanges,h=void 0===f||f,d=n.storeKey,p=void 0===d?"store":d,z=(n.withRef,n.forwardRef),v=void 0!==z&&z,g=n.context,m=void 0===g?qx:g,y=Lx(n,Nx),b=m;return function(t){var n=t.displayName||t.name||"Component",r=i(n),o=_x({},y,{getDisplayName:i,methodName:s,renderCountProp:u,shouldHandleStateChanges:h,storeKey:p,displayName:r,wrappedComponentName:n,WrappedComponent:t}),l=y.pure;var f=l?a.useMemo:function(e){return e()};function d(n){var r=Object(a.useMemo)((function(){var e=n.reactReduxForwardedRef,t=Lx(n,Ix);return[n.context,e,t]}),[n]),i=r[0],s=r[1],l=r[2],u=Object(a.useMemo)((function(){return i&&i.Consumer&&Object(Vx.isContextConsumer)(c.a.createElement(i.Consumer,null))?i:b}),[i,b]),d=Object(a.useContext)(u),p=Boolean(n.store)&&Boolean(n.store.getState)&&Boolean(n.store.dispatch);Boolean(d)&&Boolean(d.store);var z=p?n.store:d.store,v=Object(a.useMemo)((function(){return function(t){return e(t.dispatch,o)}(z)}),[z]),g=Object(a.useMemo)((function(){if(!h)return Bx;var e=Ex(z,p?null:d.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[z,p,d]),m=g[0],y=g[1],w=Object(a.useMemo)((function(){return p?d:_x({},d,{subscription:m})}),[p,d,m]),k=Object(a.useReducer)(Fx,Rx,Yx),x=k[0][0],j=k[1];if(x&&x.error)throw x.error;var M=Object(a.useRef)(),_=Object(a.useRef)(l),C=Object(a.useRef)(),q=Object(a.useRef)(!1),S=f((function(){return C.current&&l===_.current?C.current:v(z.getState(),l)}),[z,x,l]);Ux(Wx,[_,M,q,l,S,C,y]),Ux(Gx,[h,z,m,v,_,M,q,C,y,j],[z,m,v]);var O=Object(a.useMemo)((function(){return c.a.createElement(t,_x({},S,{ref:s}))}),[s,t,S]);return Object(a.useMemo)((function(){return h?c.a.createElement(u.Provider,{value:w},O):O}),[u,O,w])}var z=l?c.a.memo(d):d;if(z.WrappedComponent=t,z.displayName=d.displayName=r,v){var g=c.a.forwardRef((function(e,t){return c.a.createElement(z,_x({},e,{reactReduxForwardedRef:t}))}));return g.displayName=r,g.WrappedComponent=t,Px()(g,t)}return Px()(z,t)}}function $x(e,t){return e===t?0!==e||0!==t||1/e===1/t:e!==e&&t!==t}function Xx(e,t){if($x(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var i=0;i=0;r--){var i=t[r](e);if(i)return i}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function uj(e,t){return e===t}function fj(e){var t=void 0===e?{}:e,n=t.connectHOC,r=void 0===n?Zx:n,i=t.mapStateToPropsFactories,o=void 0===i?tj:i,a=t.mapDispatchToPropsFactories,c=void 0===a?ej:a,s=t.mergePropsFactories,l=void 0===s?rj:s,u=t.selectorFactory,f=void 0===u?cj:u;return function(e,t,n,i){void 0===i&&(i={});var a=i,s=a.pure,u=void 0===s||s,h=a.areStatesEqual,d=void 0===h?uj:h,p=a.areOwnPropsEqual,z=void 0===p?Xx:p,v=a.areStatePropsEqual,g=void 0===v?Xx:v,m=a.areMergedPropsEqual,y=void 0===m?Xx:m,b=Lx(a,sj),w=lj(e,o,"mapStateToProps"),k=lj(t,c,"mapDispatchToProps"),x=lj(n,l,"mergeProps");return r(f,_x({methodName:"connect",getDisplayName:function(e){return"Connect("+e+")"},shouldHandleStateChanges:Boolean(e),initMapStateToProps:w,initMapDispatchToProps:k,initMergeProps:x,pure:u,areStatesEqual:d,areOwnPropsEqual:z,areStatePropsEqual:g,areMergedPropsEqual:y},b))}}var hj=fj();var dj;function pj(e,t){var n=Object(a.useState)((function(){return{inputs:t,result:e()}}))[0],r=Object(a.useRef)(!0),i=Object(a.useRef)(n),o=r.current||Boolean(t&&i.current.inputs&&function(e,t){if(e.length!==t.length)return!1;for(var n=0;n");return t.callbacks},t.setCallbacks=function(e){t.callbacks=e},t}Mx(t,e);var n=t.prototype;return n.componentDidMount=function(){this.unbind=Pj(window,[{eventName:"error",fn:this.onWindowError}])},n.componentDidCatch=function(e){if(!(e instanceof Ij))throw e;this.setState({})},n.componentWillUnmount=function(){this.unbind()},n.render=function(){return this.props.children(this.setCallbacks)},t}(c.a.Component),Fj=function(e){return e+1},Uj=function(e,t){var n=e.droppableId===t.droppableId,r=Fj(e.index),i=Fj(t.index);return n?"\n You have moved the item from position "+r+"\n to position "+i+"\n ":"\n You have moved the item from position "+r+"\n in list "+e.droppableId+"\n to list "+t.droppableId+"\n in position "+i+"\n "},Wj=function(e,t,n){return t.droppableId===n.droppableId?"\n The item "+e+"\n has been combined with "+n.draggableId:"\n The item "+e+"\n in list "+t.droppableId+"\n has been combined with "+n.draggableId+"\n in list "+n.droppableId+"\n "},Gj=function(e){return"\n The item has returned to its starting position\n of "+Fj(e.index)+"\n"},Yj={dragHandleUsageInstructions:"\n Press space bar to start a drag.\n When dragging you can use the arrow keys to move the item around and escape to cancel.\n Some screen readers may require you to be in focus mode or to use your pass through key\n",onDragStart:function(e){return"\n You have lifted an item in position "+Fj(e.source.index)+"\n"},onDragUpdate:function(e){var t=e.destination;if(t)return Uj(e.source,t);var n=e.combine;return n?Wj(e.draggableId,e.source,n):"You are over an area that cannot be dropped on"},onDragEnd:function(e){if("CANCEL"===e.reason)return"\n Movement cancelled.\n "+Gj(e.source)+"\n ";var t=e.destination,n=e.combine;return t?"\n You have dropped the item.\n "+Uj(e.source,t)+"\n ":n?"\n You have dropped the item.\n "+Wj(e.draggableId,e.source,n)+"\n ":"\n The item has been dropped while not over a drop area.\n "+Gj(e.source)+"\n "}},Zj={x:0,y:0},$j=function(e,t){return{x:e.x+t.x,y:e.y+t.y}},Xj=function(e,t){return{x:e.x-t.x,y:e.y-t.y}},Kj=function(e,t){return e.x===t.x&&e.y===t.y},Qj=function(e){return{x:0!==e.x?-e.x:0,y:0!==e.y?-e.y:0}},Jj=function(e,t,n){var r;return void 0===n&&(n=0),(r={})[e]=t,r["x"===e?"y":"x"]=n,r},eM=function(e,t){return Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2))},tM=function(e,t){return Math.min.apply(Math,t.map((function(t){return eM(e,t)})))},nM=function(e){return function(t){return{x:e(t.x),y:e(t.y)}}},rM=function(e,t){return{top:e.top+t.y,left:e.left+t.x,bottom:e.bottom+t.y,right:e.right+t.x}},iM=function(e){return[{x:e.left,y:e.top},{x:e.right,y:e.top},{x:e.left,y:e.bottom},{x:e.right,y:e.bottom}]},oM=function(e,t){return t&&t.shouldClipSubject?function(e,t){var n=gj({top:Math.max(t.top,e.top),right:Math.min(t.right,e.right),bottom:Math.min(t.bottom,e.bottom),left:Math.max(t.left,e.left)});return n.width<=0||n.height<=0?null:n}(t.pageMarginBox,e):gj(e)},aM=function(e){var t=e.page,n=e.withPlaceholder,r=e.axis,i=e.frame,o=function(e,t,n){var r;return n&&n.increasedBy?_x({},e,((r={})[t.end]=e[t.end]+n.increasedBy[t.line],r)):e}(function(e,t){return t?rM(e,t.scroll.diff.displacement):e}(t.marginBox,i),r,n);return{page:t,withPlaceholder:n,active:oM(o,i)}},cM=function(e,t){e.frame||Rj(!1);var n=e.frame,r=Xj(t,n.scroll.initial),i=Qj(r),o=_x({},n,{scroll:{initial:n.scroll.initial,current:t,diff:{value:r,displacement:i},max:n.scroll.max}});return _x({},e,{frame:o,subject:aM({page:e.subject.page,withPlaceholder:e.subject.withPlaceholder,axis:e.axis,frame:o})})};function sM(e){return Object.values?Object.values(e):Object.keys(e).map((function(t){return e[t]}))}function lM(e,t){if(e.findIndex)return e.findIndex(t);for(var n=0;ne.bottom,c=r.lefte.right;return!(!a||!c)||(a&&o||c&&i)}},_M=function(e){var t=jM(e.top,e.bottom),n=jM(e.left,e.right);return function(e){return t(e.top)&&t(e.bottom)&&n(e.left)&&n(e.right)}},CM={direction:"vertical",line:"y",crossAxisLine:"x",start:"top",end:"bottom",size:"height",crossAxisStart:"left",crossAxisEnd:"right",crossAxisSize:"width"},qM={direction:"horizontal",line:"x",crossAxisLine:"y",start:"left",end:"right",size:"width",crossAxisStart:"top",crossAxisEnd:"bottom",crossAxisSize:"height"},SM=function(e){var t=e.target,n=e.destination,r=e.viewport,i=e.withDroppableDisplacement,o=e.isVisibleThroughFrameFn,a=i?function(e,t){var n=t.frame?t.frame.scroll.diff.displacement:Zj;return rM(e,n)}(t,n):t;return function(e,t,n){return!!t.subject.active&&n(t.subject.active)(e)}(a,n,o)&&function(e,t,n){return n(t)(e)}(a,r,o)},OM=function(e){return SM(_x({},e,{isVisibleThroughFrameFn:MM}))},TM=function(e){return SM(_x({},e,{isVisibleThroughFrameFn:_M}))},EM=function(e,t,n){if("boolean"===typeof n)return n;if(!t)return!0;var r=t.invisible,i=t.visible;if(r[e])return!1;var o=i[e];return!o||o.shouldAnimate};function AM(e){var t=e.afterDragging,n=e.destination,r=e.displacedBy,i=e.viewport,o=e.forceShouldAnimate,a=e.last;return t.reduce((function(e,t){var c=function(e,t){var n=e.page.marginBox,r={top:t.point.y,right:0,bottom:0,left:t.point.x};return gj(mj(n,r))}(t,r),s=t.descriptor.id;if(e.all.push(s),!OM({target:c,destination:n,viewport:i,withDroppableDisplacement:!0}))return e.invisible[t.descriptor.id]=!0,e;var l={draggableId:s,shouldAnimate:EM(s,a,o)};return e.visible[s]=l,e}),{all:[],visible:{},invisible:{}})}function HM(e){var t=e.insideDestination,n=e.inHomeList,r=e.displacedBy,i=e.destination,o=function(e,t){if(!e.length)return 0;var n=e[e.length-1].descriptor.index;return t.inHomeList?n:n+1}(t,{inHomeList:n});return{displaced:kM,displacedBy:r,at:{type:"REORDER",destination:{droppableId:i.descriptor.id,index:o}}}}function LM(e){var t=e.draggable,n=e.insideDestination,r=e.destination,i=e.viewport,o=e.displacedBy,a=e.last,c=e.index,s=e.forceShouldAnimate,l=bM(t,r);if(null==c)return HM({insideDestination:n,inHomeList:l,displacedBy:o,destination:r});var u=uM(n,(function(e){return e.descriptor.index===c}));if(!u)return HM({insideDestination:n,inHomeList:l,displacedBy:o,destination:r});var f=yM(t,n),h=n.indexOf(u);return{displaced:AM({afterDragging:f.slice(h),destination:r,displacedBy:o,last:a,viewport:i.frame,forceShouldAnimate:s}),displacedBy:o,at:{type:"REORDER",destination:{droppableId:r.descriptor.id,index:c}}}}function DM(e,t){return Boolean(t.effected[e])}var PM=function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.draggable,i=e.draggables,o=e.destination,a=e.insideDestination,c=e.previousImpact,s=e.viewport,l=e.afterCritical,u=c.at;if(u||Rj(!1),"REORDER"===u.type){var f=function(e){var t=e.isMovingForward,n=e.isInHomeList,r=e.insideDestination,i=e.location;if(!r.length)return null;var o=i.index,a=t?o+1:o-1,c=r[0].descriptor.index,s=r[r.length-1].descriptor.index;return a(n?s:s+1)?null:a}({isMovingForward:t,isInHomeList:n,location:u.destination,insideDestination:a});return null==f?null:LM({draggable:r,insideDestination:a,destination:o,viewport:s,last:c.displaced,displacedBy:c.displacedBy,index:f})}var h=function(e){var t=e.isMovingForward,n=e.destination,r=e.draggables,i=e.combine,o=e.afterCritical;if(!n.isCombineEnabled)return null;var a=i.draggableId,c=r[a].descriptor.index;return DM(a,o)?t?c:c-1:t?c+1:c}({isMovingForward:t,destination:o,displaced:c.displaced,draggables:i,combine:u.combine,afterCritical:l});return null==h?null:LM({draggable:r,insideDestination:a,destination:o,viewport:s,last:c.displaced,displacedBy:c.displacedBy,index:h})},VM=function(e){var t=e.afterCritical,n=e.impact,r=e.draggables,i=mM(n);i||Rj(!1);var o=i.draggableId,a=r[o].page.borderBox.center,c=function(e){var t=e.displaced,n=e.afterCritical,r=e.combineWith,i=e.displacedBy,o=Boolean(t.visible[r]||t.invisible[r]);return DM(r,n)?o?Zj:Qj(i.point):o?i.point:Zj}({displaced:n.displaced,afterCritical:t,combineWith:o,displacedBy:n.displacedBy});return $j(a,c)},NM=function(e,t){return t.margin[e.start]+t.borderBox[e.size]/2},IM=function(e,t,n){return t[e.crossAxisStart]+n.margin[e.crossAxisStart]+n.borderBox[e.crossAxisSize]/2},RM=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return Jj(t.line,n.marginBox[t.end]+NM(t,r),IM(t,n.marginBox,r))},BM=function(e){var t=e.axis,n=e.moveRelativeTo,r=e.isMoving;return Jj(t.line,n.marginBox[t.start]-function(e,t){return t.margin[e.end]+t.borderBox[e.size]/2}(t,r),IM(t,n.marginBox,r))},FM=function(e){var t=e.impact,n=e.draggable,r=e.draggables,i=e.droppable,o=e.afterCritical,a=vM(i.descriptor.id,r),c=n.page,s=i.axis;if(!a.length)return function(e){var t=e.axis,n=e.moveInto,r=e.isMoving;return Jj(t.line,n.contentBox[t.start]+NM(t,r),IM(t,n.contentBox,r))}({axis:s,moveInto:i.page,isMoving:c});var l=t.displaced,u=t.displacedBy,f=l.all[0];if(f){var h=r[f];if(DM(f,o))return BM({axis:s,moveRelativeTo:h.page,isMoving:c});var d=xj(h.page,u.point);return BM({axis:s,moveRelativeTo:d,isMoving:c})}var p=a[a.length-1];if(p.descriptor.id===n.descriptor.id)return c.borderBox.center;if(DM(p.descriptor.id,o)){var z=xj(p.page,Qj(o.displacedBy.point));return RM({axis:s,moveRelativeTo:z,isMoving:c})}return RM({axis:s,moveRelativeTo:p.page,isMoving:c})},UM=function(e,t){var n=e.frame;return n?$j(t,n.scroll.diff.displacement):t},WM=function(e){var t=function(e){var t=e.impact,n=e.draggable,r=e.droppable,i=e.draggables,o=e.afterCritical,a=n.page.borderBox.center,c=t.at;return r&&c?"REORDER"===c.type?FM({impact:t,draggable:n,draggables:i,droppable:r,afterCritical:o}):VM({impact:t,draggables:i,afterCritical:o}):a}(e),n=e.droppable;return n?UM(n,t):t},GM=function(e,t){var n=Xj(t,e.scroll.initial),r=Qj(n);return{frame:gj({top:t.y,bottom:t.y+e.frame.height,left:t.x,right:t.x+e.frame.width}),scroll:{initial:e.scroll.initial,max:e.scroll.max,current:t,diff:{value:n,displacement:r}}}};function YM(e,t){return e.map((function(e){return t[e]}))}var ZM=function(e){var t=e.pageBorderBoxCenter,n=e.draggable,r=function(e,t){return $j(e.scroll.diff.displacement,t)}(e.viewport,t),i=Xj(r,n.page.borderBox.center);return $j(n.client.borderBox.center,i)},$M=function(e){var t=e.draggable,n=e.destination,r=e.newPageBorderBoxCenter,i=e.viewport,o=e.withDroppableDisplacement,a=e.onlyOnMainAxis,c=void 0!==a&&a,s=Xj(r,t.page.borderBox.center),l={target:rM(t.page.borderBox,s),destination:n,withDroppableDisplacement:o,viewport:i};return c?function(e){return SM(_x({},e,{isVisibleThroughFrameFn:(t=e.destination.axis,function(e){var n=jM(e.top,e.bottom),r=jM(e.left,e.right);return function(e){return t===CM?n(e.top)&&n(e.bottom):r(e.left)&&r(e.right)}})}));var t}(l):TM(l)},XM=function(e){var t=e.isMovingForward,n=e.draggable,r=e.destination,i=e.draggables,o=e.previousImpact,a=e.viewport,c=e.previousPageBorderBoxCenter,s=e.previousClientSelection,l=e.afterCritical;if(!r.isEnabled)return null;var u=vM(r.descriptor.id,i),f=bM(n,r),h=function(e){var t=e.isMovingForward,n=e.draggable,r=e.destination,i=e.insideDestination,o=e.previousImpact;if(!r.isCombineEnabled)return null;if(!gM(o))return null;function a(e){var t={type:"COMBINE",combine:{draggableId:e,droppableId:r.descriptor.id}};return _x({},o,{at:t})}var c=o.displaced.all,s=c.length?c[0]:null;if(t)return s?a(s):null;var l=yM(n,i);if(!s)return l.length?a(l[l.length-1].descriptor.id):null;var u=lM(l,(function(e){return e.descriptor.id===s}));-1===u&&Rj(!1);var f=u-1;return f<0?null:a(l[f].descriptor.id)}({isMovingForward:t,draggable:n,destination:r,insideDestination:u,previousImpact:o})||PM({isMovingForward:t,isInHomeList:f,draggable:n,draggables:i,destination:r,insideDestination:u,previousImpact:o,viewport:a,afterCritical:l});if(!h)return null;var d=WM({impact:h,draggable:n,droppable:r,draggables:i,afterCritical:l});if($M({draggable:n,destination:r,newPageBorderBoxCenter:d,viewport:a.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0}))return{clientSelection:ZM({pageBorderBoxCenter:d,draggable:n,viewport:a}),impact:h,scrollJumpRequest:null};var p=Xj(d,c);return{clientSelection:s,impact:function(e){var t=e.impact,n=e.viewport,r=e.destination,i=e.draggables,o=e.maxScrollChange,a=GM(n,$j(n.scroll.current,o)),c=r.frame?cM(r,$j(r.frame.scroll.current,o)):r,s=t.displaced,l=AM({afterDragging:YM(s.all,i),destination:r,displacedBy:t.displacedBy,viewport:a.frame,last:s,forceShouldAnimate:!1}),u=AM({afterDragging:YM(s.all,i),destination:c,displacedBy:t.displacedBy,viewport:n.frame,last:s,forceShouldAnimate:!1}),f={},h={},d=[s,l,u];return s.all.forEach((function(e){var t=function(e,t){for(var n=0;n1?u.sort((function(e,t){return KM(e)[c.start]-KM(t)[c.start]}))[0]:l.sort((function(e,t){var r=tM(n,iM(KM(e))),i=tM(n,iM(KM(t)));return r!==i?r-i:KM(e)[c.start]-KM(t)[c.start]}))[0]}({isMovingForward:t,pageBorderBoxCenter:n,source:i,droppables:a,viewport:c});if(!l)return null;var u=vM(l.descriptor.id,o),f=function(e){var t=e.previousPageBorderBoxCenter,n=e.moveRelativeTo,r=e.insideDestination,i=e.draggable,o=e.draggables,a=e.destination,c=e.viewport,s=e.afterCritical;if(!n){if(r.length)return null;var l={displaced:kM,displacedBy:wM,at:{type:"REORDER",destination:{droppableId:a.descriptor.id,index:0}}},u=WM({impact:l,draggable:i,droppable:a,draggables:o,afterCritical:s}),f=bM(i,a)?a:n_(a,i,o);return $M({draggable:i,destination:f,newPageBorderBoxCenter:u,viewport:c.frame,withDroppableDisplacement:!1,onlyOnMainAxis:!0})?l:null}var h=Boolean(t[a.axis.line]<=n.page.borderBox.center[a.axis.line]),d=function(){var e=n.descriptor.index;return n.descriptor.id===i.descriptor.id?e:h?e:e+1}(),p=e_(a.axis,i.displaceBy);return LM({draggable:i,insideDestination:r,destination:a,viewport:c,displacedBy:p,last:kM,index:d})}({previousPageBorderBoxCenter:n,destination:l,draggable:r,draggables:o,moveRelativeTo:function(e){var t=e.pageBorderBoxCenter,n=e.viewport,r=e.destination,i=e.insideDestination,o=e.afterCritical;return i.filter((function(e){return TM({target:JM(e,o),destination:r,viewport:n.frame,withDroppableDisplacement:!0})})).sort((function(e,n){var i=eM(t,UM(r,QM(e,o))),a=eM(t,UM(r,QM(n,o)));return ir.left&&n.topr.top))return!1;if(c_(i)(t.center))return!0;var o=e.axis,a=i.center[o.crossAxisLine],c=t[o.crossAxisStart],s=t[o.crossAxisEnd],l=jM(i[o.crossAxisStart],i[o.crossAxisEnd]),u=l(c),f=l(s);return!u&&!f||(u?ca)}));return i.length?1===i.length?i[0].descriptor.id:function(e){var t=e.pageBorderBox,n=e.draggable,r=e.candidates,i=n.page.borderBox.center,o=r.map((function(e){var n=e.axis,r=Jj(e.axis.line,t.center[n.line],e.page.borderBox.center[n.crossAxisLine]);return{id:e.descriptor.id,distance:eM(i,r)}})).sort((function(e,t){return t.distance-e.distance}));return o[0]?o[0].id:null}({pageBorderBox:t,draggable:n,candidates:i}):null}var l_=function(e,t){return gj(rM(e,t))};function u_(e){var t=e.displaced,n=e.id;return Boolean(t.visible[n]||t.invisible[n])}var f_=function(e){var t=e.pageOffset,n=e.draggable,r=e.draggables,i=e.droppables,o=e.previousImpact,a=e.viewport,c=e.afterCritical,s=l_(n.page.borderBox,t),l=s_({pageBorderBox:s,draggable:n,droppables:i});if(!l)return xM;var u=i[l],f=vM(u.descriptor.id,r),h=function(e,t){var n=e.frame;return n?l_(t,n.scroll.diff.value):t}(u,s);return function(e){var t=e.draggable,n=e.pageBorderBoxWithDroppableScroll,r=e.previousImpact,i=e.destination,o=e.insideDestination,a=e.afterCritical;if(!i.isCombineEnabled)return null;var c=i.axis,s=e_(i.axis,t.displaceBy),l=s.value,u=n[c.start],f=n[c.end],h=uM(yM(t,o),(function(e){var t=e.descriptor.id,n=e.page.borderBox,i=n[c.size]/4,o=DM(t,a),s=u_({displaced:r.displaced,id:t});return o?s?f>n[c.start]+i&&fn[c.start]-l+i&&un[c.start]+l+i&&fn[c.start]+i&&ut.descriptor.index?n.descriptor.index-1:n.descriptor.index:null}({draggable:n,closest:uM(yM(n,i),(function(e){var t=e.descriptor.id,n=e.page.borderBox.center[s.line],r=DM(t,c),i=u_({displaced:o,id:t});return r?i?h<=n:f=1500)return K_;var o=X_+Q_*(i/1500);return Number(("CANCEL"===r?.6*o:o).toFixed(2))}({current:i.current.client.offset,destination:v,reason:o});n(function(e){return{type:"DROP_ANIMATE",payload:e}}({newHomeClientOffset:v,dropDuration:m,completed:g}))}else n(N_({completed:g}))}}else n(function(e){return{type:"DROP_PENDING",payload:e}}({reason:o}))}else e(r)}}},eC=function(){return{x:window.pageXOffset,y:window.pageYOffset}};function tC(e){var t=e.onWindowScroll;var n,r=Cj((function(){t(eC())})),i=(n=r,{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(e){e.target!==window&&e.target!==window.document||n()}}),o=Dj;function a(){return o!==Dj}return{start:function(){a()&&Rj(!1),o=Pj(window,[i])},stop:function(){a()||Rj(!1),r.cancel(),o(),o=Dj},isActive:a}}var nC=function(e){var t=tC({onWindowScroll:function(t){e.dispatch({type:"MOVE_BY_WINDOW_SCROLL",payload:{newScroll:t}})}});return function(e){return function(n){t.isActive()||"INITIAL_PUBLISH"!==n.type||t.start(),t.isActive()&&function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(n)&&t.stop(),e(n)}}},rC=function(){var e=[];return{add:function(t){var n=setTimeout((function(){return function(t){var n=lM(e,(function(e){return e.timerId===t}));-1===n&&Rj(!1),e.splice(n,1)[0].callback()}(n)})),r={timerId:n,callback:t};e.push(r)},flush:function(){if(e.length){var t=[].concat(e);e.length=0,t.forEach((function(e){clearTimeout(e.timerId),e.callback()}))}}}},iC=function(e,t){y_(),t(),b_()},oC=function(e,t){return{draggableId:e.draggable.id,type:e.droppable.type,source:{droppableId:e.droppable.id,index:e.draggable.index},mode:t}},aC=function(e,t,n,r){if(e){var i=function(e){var t=!1,n=!1,r=setTimeout((function(){n=!0})),i=function(i){t||n||(t=!0,e(i),clearTimeout(r))};return i.wasCalled=function(){return t},i}(n);e(t,{announce:i}),i.wasCalled()||n(r(t))}else n(r(t))},cC=function(e,t){var n=function(e,t){var n=rC(),r=null,i=function(n){r||Rj(!1),r=null,iC(0,(function(){return aC(e().onDragEnd,n,t,Yj.onDragEnd)}))};return{beforeCapture:function(t,n){r&&Rj(!1),iC(0,(function(){var r=e().onBeforeCapture;r&&r({draggableId:t,mode:n})}))},beforeStart:function(t,n){r&&Rj(!1),iC(0,(function(){var r=e().onBeforeDragStart;r&&r(oC(t,n))}))},start:function(i,o){r&&Rj(!1);var a=oC(i,o);r={mode:o,lastCritical:i,lastLocation:a.source,lastCombine:null},n.add((function(){iC(0,(function(){return aC(e().onDragStart,a,t,Yj.onDragStart)}))}))},update:function(i,o){var a=gM(o),c=mM(o);r||Rj(!1);var s=!function(e,t){if(e===t)return!0;var n=e.draggable.id===t.draggable.id&&e.draggable.droppableId===t.draggable.droppableId&&e.draggable.type===t.draggable.type&&e.draggable.index===t.draggable.index,r=e.droppable.id===t.droppable.id&&e.droppable.type===t.droppable.type;return n&&r}(i,r.lastCritical);s&&(r.lastCritical=i);var l,u,f=(l=r.lastLocation,u=a,!(null==l&&null==u||null!=l&&null!=u&&l.droppableId===u.droppableId&&l.index===u.index));f&&(r.lastLocation=a);var h=!function(e,t){return null==e&&null==t||null!=e&&null!=t&&(e.draggableId===t.draggableId&&e.droppableId===t.droppableId)}(r.lastCombine,c);if(h&&(r.lastCombine=c),s||f||h){var d=_x({},oC(i,r.mode),{combine:c,destination:a});n.add((function(){iC(0,(function(){return aC(e().onDragUpdate,d,t,Yj.onDragUpdate)}))}))}},flush:function(){r||Rj(!1),n.flush()},drop:i,abort:function(){if(r){var e=_x({},oC(r.lastCritical,r.mode),{combine:null,destination:null,reason:"CANCEL"});i(e)}}}}(e,t);return function(e){return function(t){return function(r){if("BEFORE_INITIAL_CAPTURE"!==r.type){if("INITIAL_PUBLISH"===r.type){var i=r.payload.critical;return n.beforeStart(i,r.payload.movementMode),t(r),void n.start(i,r.payload.movementMode)}if("DROP_COMPLETE"===r.type){var o=r.payload.completed.result;return n.flush(),t(r),void n.drop(o)}if(t(r),"FLUSH"!==r.type){var a=e.getState();"DRAGGING"===a.phase&&n.update(a.critical,a.impact)}else n.abort()}else n.beforeCapture(r.payload.draggableId,r.payload.movementMode)}}}},sC=function(e){return function(t){return function(n){if("DROP_ANIMATION_FINISHED"===n.type){var r=e.getState();"DROP_ANIMATING"!==r.phase&&Rj(!1),e.dispatch(N_({completed:r.completed}))}else t(n)}}},lC=function(e){var t=null,n=null;return function(r){return function(i){if("FLUSH"!==i.type&&"DROP_COMPLETE"!==i.type&&"DROP_ANIMATION_FINISHED"!==i.type||(n&&(cancelAnimationFrame(n),n=null),t&&(t(),t=null)),r(i),"DROP_ANIMATE"===i.type){var o={eventName:"scroll",options:{capture:!0,passive:!1,once:!0},fn:function(){"DROP_ANIMATING"===e.getState().phase&&e.dispatch({type:"DROP_ANIMATION_FINISHED",payload:null})}};n=requestAnimationFrame((function(){n=null,t=Pj(window,[o])}))}}}},uC=function(e){return function(t){return function(n){if(t(n),"PUBLISH_WHILE_DRAGGING"===n.type){var r=e.getState();"DROP_PENDING"===r.phase&&(r.isWaiting||e.dispatch(I_({reason:r.reason})))}}}},fC=Cx.d,hC=function(e){var t,n=e.dimensionMarshal,r=e.focusMarshal,i=e.styleMarshal,o=e.getResponders,a=e.announce,c=e.autoScroller;return Object(Cx.e)(__,fC(Object(Cx.a)((t=i,function(){return function(e){return function(n){"INITIAL_PUBLISH"===n.type&&t.dragging(),"DROP_ANIMATE"===n.type&&t.dropping(n.payload.completed.result.reason),"FLUSH"!==n.type&&"DROP_COMPLETE"!==n.type||t.resting(),e(n)}}}),function(e){return function(){return function(t){return function(n){"DROP_COMPLETE"!==n.type&&"FLUSH"!==n.type&&"DROP_ANIMATE"!==n.type||e.stopPublishing(),t(n)}}}}(n),function(e){return function(t){var n=t.getState,r=t.dispatch;return function(t){return function(i){if("LIFT"===i.type){var o=i.payload,a=o.id,c=o.clientSelection,s=o.movementMode,l=n();"DROP_ANIMATING"===l.phase&&r(N_({completed:l.completed})),"IDLE"!==n().phase&&Rj(!1),r(V_()),r({type:"BEFORE_INITIAL_CAPTURE",payload:{draggableId:a,movementMode:s}});var u={draggableId:a,scrollOptions:{shouldPublishImmediately:"SNAP"===s}},f=e.startPublishing(u),h=f.critical,d=f.dimensions,p=f.viewport;r(function(e){return{type:"INITIAL_PUBLISH",payload:e}}({critical:h,dimensions:d,clientSelection:c,movementMode:s,viewport:p}))}else t(i)}}}}(n),J_,sC,lC,uC,function(e){return function(t){return function(n){return function(r){if(function(e){return"DROP_COMPLETE"===e.type||"DROP_ANIMATE"===e.type||"FLUSH"===e.type}(r))return e.stop(),void n(r);if("INITIAL_PUBLISH"===r.type){n(r);var i=t.getState();return"DRAGGING"!==i.phase&&Rj(!1),void e.start(i)}n(r),e.scroll(t.getState())}}}}(c),nC,function(e){var t=!1;return function(){return function(n){return function(r){if("INITIAL_PUBLISH"===r.type)return t=!0,e.tryRecordFocus(r.payload.critical.draggable.id),n(r),void e.tryRestoreFocusRecorded();if(n(r),t){if("FLUSH"===r.type)return t=!1,void e.tryRestoreFocusRecorded();if("DROP_COMPLETE"===r.type){t=!1;var i=r.payload.completed.result;i.combine&&e.tryShiftRecord(i.draggableId,i.combine.draggableId),e.tryRestoreFocusRecorded()}}}}}}(r),cC(o,a))))},dC=function(){return{additions:{},removals:{},modified:{}}};var pC=function(e){var t=e.scrollHeight,n=e.scrollWidth,r=e.height,i=e.width,o=Xj({x:n,y:t},{x:i,y:r});return{x:Math.max(0,o.x),y:Math.max(0,o.y)}},zC=function(){var e=document.documentElement;return e||Rj(!1),e},vC=function(){var e=zC();return pC({scrollHeight:e.scrollHeight,scrollWidth:e.scrollWidth,width:e.clientWidth,height:e.clientHeight})},gC=function(e){var t=e.critical,n=e.scrollOptions,r=e.registry;y_();var i=function(){var e=eC(),t=vC(),n=e.y,r=e.x,i=zC(),o=i.clientWidth,a=i.clientHeight;return{frame:gj({top:n,left:r,right:r+o,bottom:n+a}),scroll:{initial:e,current:e,max:t,diff:{value:Zj,displacement:Zj}}}}(),o=i.scroll.current,a=t.droppable,c=r.droppable.getAllByType(a.type).map((function(e){return e.callbacks.getDimensionAndWatchScroll(o,n)})),s=r.draggable.getAllByType(t.draggable.type).map((function(e){return e.getDimension(o)})),l={draggables:dM(s),droppables:hM(c)};return b_(),{dimensions:l,critical:t,viewport:i}};function mC(e,t,n){return n.descriptor.id!==t.id&&(n.descriptor.type===t.type&&"virtual"===e.droppable.getById(n.descriptor.droppableId).descriptor.mode)}var yC=function(e,t){var n=null,r=function(e){var t=e.registry,n=e.callbacks,r=dC(),i=null,o=function(){i||(n.collectionStarting(),i=requestAnimationFrame((function(){i=null,y_();var e=r,o=e.additions,a=e.removals,c=e.modified,s=Object.keys(o).map((function(e){return t.draggable.getById(e).getDimension(Zj)})).sort((function(e,t){return e.descriptor.index-t.descriptor.index})),l=Object.keys(c).map((function(e){return{droppableId:e,scroll:t.droppable.getById(e).callbacks.getScrollWhileDragging()}})),u={additions:s,removals:Object.keys(a),modified:l};r=dC(),b_(),n.publish(u)})))};return{add:function(e){var t=e.descriptor.id;r.additions[t]=e,r.modified[e.descriptor.droppableId]=!0,r.removals[t]&&delete r.removals[t],o()},remove:function(e){var t=e.descriptor;r.removals[t.id]=!0,r.modified[t.droppableId]=!0,r.additions[t.id]&&delete r.additions[t.id],o()},stop:function(){i&&(cancelAnimationFrame(i),i=null,r=dC())}}}({callbacks:{publish:t.publishWhileDragging,collectionStarting:t.collectionStarting},registry:e}),i=function(t){n||Rj(!1);var i=n.critical.draggable;"ADDITION"===t.type&&mC(e,i,t.value)&&r.add(t.value),"REMOVAL"===t.type&&mC(e,i,t.value)&&r.remove(t.value)};return{updateDroppableIsEnabled:function(r,i){e.droppable.exists(r)||Rj(!1),n&&t.updateDroppableIsEnabled({id:r,isEnabled:i})},updateDroppableIsCombineEnabled:function(r,i){n&&(e.droppable.exists(r)||Rj(!1),t.updateDroppableIsCombineEnabled({id:r,isCombineEnabled:i}))},scrollDroppable:function(t,r){n&&e.droppable.getById(t).callbacks.scroll(r)},updateDroppableScroll:function(r,i){n&&(e.droppable.exists(r)||Rj(!1),t.updateDroppableScroll({id:r,newScroll:i}))},startPublishing:function(t){n&&Rj(!1);var r=e.draggable.getById(t.draggableId),o=e.droppable.getById(r.descriptor.droppableId),a={draggable:r.descriptor,droppable:o.descriptor},c=e.subscribe(i);return n={critical:a,unsubscribe:c},gC({critical:a,registry:e,scrollOptions:t.scrollOptions})},stopPublishing:function(){if(n){r.stop();var t=n.critical.droppable;e.droppable.getAllByType(t.type).forEach((function(e){return e.callbacks.dragStopped()})),n.unsubscribe(),n=null}}}},bC=function(e,t){return"IDLE"===e.phase||"DROP_ANIMATING"===e.phase&&(e.completed.result.draggableId!==t&&"DROP"===e.completed.result.reason)},wC=function(e){window.scrollBy(e.x,e.y)},kC=lz((function(e){return pM(e).filter((function(e){return!!e.isEnabled&&!!e.frame}))})),xC=function(e){var t=e.center,n=e.destination,r=e.droppables;if(n){var i=r[n];return i.frame?i:null}return function(e,t){return uM(kC(t),(function(t){return t.frame||Rj(!1),c_(t.frame.pageMarginBox)(e)}))}(t,r)},jC=.25,MC=.05,_C=28,CC=function(e){return Math.pow(e,2)},qC={stopDampeningAt:1200,accelerateAt:360},SC=function(e){var t=e.startOfRange,n=e.endOfRange,r=e.current,i=n-t;return 0===i?0:(r-t)/i},OC=qC.accelerateAt,TC=qC.stopDampeningAt,EC=function(e){var t=e.distanceToEdge,n=e.thresholds,r=e.dragStartTime,i=e.shouldUseTimeDampening,o=function(e,t){if(e>t.startScrollingFrom)return 0;if(e<=t.maxScrollValueAt)return _C;if(e===t.startScrollingFrom)return 1;var n=SC({startOfRange:t.maxScrollValueAt,endOfRange:t.startScrollingFrom,current:e}),r=_C*CC(1-n);return Math.ceil(r)}(t,n);return 0===o?0:i?Math.max(function(e,t){var n=t,r=TC,i=Date.now()-n;if(i>=TC)return e;if(it.height,o=n.width>t.width;return o||i?o&&i?null:{x:o?0:r.x,y:i?0:r.y}:r}({container:n,subject:r,proposedScroll:l});return u?Kj(u,Zj)?null:u:null},DC=nM((function(e){return 0===e?0:e>0?1:-1})),PC=function(){var e=function(e,t){return e<0?e:e>t?e-t:0};return function(t){var n=t.current,r=t.max,i=t.change,o=$j(n,i),a={x:e(o.x,r.x),y:e(o.y,r.y)};return Kj(a,Zj)?null:a}}(),VC=function(e){var t=e.max,n=e.current,r=e.change,i={x:Math.max(n.x,t.x),y:Math.max(n.y,t.y)},o=DC(r),a=PC({max:i,current:n,change:o});return!a||(0!==o.x&&0===a.x||0!==o.y&&0===a.y)},NC=function(e,t){return VC({current:e.scroll.current,max:e.scroll.max,change:t})},IC=function(e,t){var n=e.frame;return!!n&&VC({current:n.scroll.current,max:n.scroll.max,change:t})},RC=function(e){var t=e.state,n=e.dragStartTime,r=e.shouldUseTimeDampening,i=e.scrollWindow,o=e.scrollDroppable,a=t.current.page.borderBoxCenter,c=t.dimensions.draggables[t.critical.draggable.id].page.marginBox;if(t.isWindowScrollAllowed){var s=function(e){var t=e.viewport,n=e.subject,r=e.center,i=e.dragStartTime,o=e.shouldUseTimeDampening,a=LC({dragStartTime:i,container:t.frame,subject:n,center:r,shouldUseTimeDampening:o});return a&&NC(t,a)?a:null}({dragStartTime:n,viewport:t.viewport,subject:c,center:a,shouldUseTimeDampening:r});if(s)return void i(s)}var l=xC({center:a,destination:i_(t.impact),droppables:t.dimensions.droppables});if(l){var u=function(e){var t=e.droppable,n=e.subject,r=e.center,i=e.dragStartTime,o=e.shouldUseTimeDampening,a=t.frame;if(!a)return null;var c=LC({dragStartTime:i,container:a.pageMarginBox,subject:n,center:r,shouldUseTimeDampening:o});return c&&IC(t,c)?c:null}({dragStartTime:n,droppable:l,subject:c,center:a,shouldUseTimeDampening:r});u&&o(l.descriptor.id,u)}},BC=function(e){var t=e.move,n=e.scrollDroppable,r=e.scrollWindow,i=function(e,t){if(!IC(e,t))return t;var r=function(e,t){var n=e.frame;return n&&IC(e,t)?PC({current:n.scroll.current,max:n.scroll.max,change:t}):null}(e,t);if(!r)return n(e.descriptor.id,t),null;var i=Xj(t,r);return n(e.descriptor.id,i),Xj(t,i)},o=function(e,t,n){if(!e)return n;if(!NC(t,n))return n;var i=function(e,t){if(!NC(e,t))return null;var n=e.scroll.max,r=e.scroll.current;return PC({current:r,max:n,change:t})}(t,n);if(!i)return r(n),null;var o=Xj(n,i);return r(o),Xj(n,o)};return function(e){var n=e.scrollJumpRequest;if(n){var r=i_(e.impact);r||Rj(!1);var a=i(e.dimensions.droppables[r],n);if(a){var c=e.viewport,s=o(e.isWindowScrollAllowed,c,a);s&&function(e,n){var r=$j(e.current.client.selection,n);t({client:r})}(e,s)}}}},FC=function(e){var t=e.scrollDroppable,n=e.scrollWindow,r=e.move,i=function(e){var t=e.scrollWindow,n=e.scrollDroppable,r=Cj(t),i=Cj(n),o=null,a=function(e){o||Rj(!1);var t=o,n=t.shouldUseTimeDampening,a=t.dragStartTime;RC({state:e,scrollWindow:r,scrollDroppable:i,dragStartTime:a,shouldUseTimeDampening:n})};return{start:function(e){y_(),o&&Rj(!1);var t=Date.now(),n=!1,r=function(){n=!0};RC({state:e,dragStartTime:0,shouldUseTimeDampening:!1,scrollWindow:r,scrollDroppable:r}),o={dragStartTime:t,shouldUseTimeDampening:n},b_(),n&&a(e)},stop:function(){o&&(r.cancel(),i.cancel(),o=null)},scroll:a}}({scrollWindow:n,scrollDroppable:t}),o=BC({move:r,scrollWindow:n,scrollDroppable:t});return{scroll:function(e){"DRAGGING"===e.phase&&("FLUID"!==e.movementMode?e.scrollJumpRequest&&o(e):i.scroll(e))},start:i.start,stop:i.stop}},UC="data-rbd",WC=function(){var e=UC+"-drag-handle";return{base:e,draggableId:e+"-draggable-id",contextId:e+"-context-id"}}(),GC=function(){var e=UC+"-draggable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),YC=function(){var e=UC+"-droppable";return{base:e,contextId:e+"-context-id",id:e+"-id"}}(),ZC={contextId:UC+"-scroll-container-context-id"},$C=function(e,t){return e.map((function(e){var n=e.styles[t];return n?e.selector+" { "+n+" }":""})).join(" ")},XC=function(e){var t,n=(t=e,function(e){return"["+e+'="'+t+'"]'}),r=function(){var e="\n cursor: -webkit-grab;\n cursor: grab;\n ";return{selector:n(WC.contextId),styles:{always:"\n -webkit-touch-callout: none;\n -webkit-tap-highlight-color: rgba(0,0,0,0);\n touch-action: manipulation;\n ",resting:e,dragging:"pointer-events: none;",dropAnimating:e}}}(),i=[function(){var e="\n transition: "+Y_.outOfTheWay+";\n ";return{selector:n(GC.contextId),styles:{dragging:e,dropAnimating:e,userCancel:e}}}(),r,{selector:n(YC.contextId),styles:{always:"overflow-anchor: none;"}},{selector:"body",styles:{dragging:"\n cursor: grabbing;\n cursor: -webkit-grabbing;\n user-select: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n overflow-anchor: none;\n "}}];return{always:$C(i,"always"),resting:$C(i,"resting"),dragging:$C(i,"dragging"),dropAnimating:$C(i,"dropAnimating"),userCancel:$C(i,"userCancel")}},KC="undefined"!==typeof window&&"undefined"!==typeof window.document&&"undefined"!==typeof window.document.createElement?a.useLayoutEffect:a.useEffect,QC=function(){var e=document.querySelector("head");return e||Rj(!1),e},JC=function(e){var t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.type="text/css",t};var eq=function(e){return e&&e.ownerDocument?e.ownerDocument.defaultView:window};function tq(e){return e instanceof eq(e).HTMLElement}function nq(e,t){var n="["+WC.contextId+'="'+e+'"]',r=fM(document.querySelectorAll(n));if(!r.length)return null;var i=uM(r,(function(e){return e.getAttribute(WC.draggableId)===t}));return i&&tq(i)?i:null}function rq(){var e={draggables:{},droppables:{}},t=[];function n(e){t.length&&t.forEach((function(t){return t(e)}))}function r(t){return e.draggables[t]||null}function i(t){return e.droppables[t]||null}return{draggable:{register:function(t){e.draggables[t.descriptor.id]=t,n({type:"ADDITION",value:t})},update:function(t,n){var r=e.draggables[n.descriptor.id];r&&r.uniqueId===t.uniqueId&&(delete e.draggables[n.descriptor.id],e.draggables[t.descriptor.id]=t)},unregister:function(t){var i=t.descriptor.id,o=r(i);o&&t.uniqueId===o.uniqueId&&(delete e.draggables[i],n({type:"REMOVAL",value:t}))},getById:function(e){var t=r(e);return t||Rj(!1),t},findById:r,exists:function(e){return Boolean(r(e))},getAllByType:function(t){return sM(e.draggables).filter((function(e){return e.descriptor.type===t}))}},droppable:{register:function(t){e.droppables[t.descriptor.id]=t},unregister:function(t){var n=i(t.descriptor.id);n&&t.uniqueId===n.uniqueId&&delete e.droppables[t.descriptor.id]},getById:function(e){var t=i(e);return t||Rj(!1),t},findById:i,exists:function(e){return Boolean(i(e))},getAllByType:function(t){return sM(e.droppables).filter((function(e){return e.descriptor.type===t}))}},subscribe:function(e){return t.push(e),function(){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}},clean:function(){e.draggables={},e.droppables={},t.length=0}}}var iq=c.a.createContext(null),oq=function(){var e=document.body;return e||Rj(!1),e},aq={position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0 0 0 0)","clip-path":"inset(100%)"},cq=function(e){return"rbd-announcement-"+e};var sq=0,lq={separator:"::"};function uq(e,t){return void 0===t&&(t=lq),zj((function(){return""+e+t.separator+sq++}),[t.separator,e])}var fq=c.a.createContext(null);function hq(e){0}function dq(e,t){hq()}function pq(e){var t=Object(a.useRef)(e);return Object(a.useEffect)((function(){t.current=e})),t}var zq,vq=27,gq=32,mq=37,yq=38,bq=39,wq=40,kq=((zq={})[13]=!0,zq[9]=!0,zq),xq=function(e){kq[e.keyCode]&&e.preventDefault()},jq=function(){var e="visibilitychange";return"undefined"===typeof document?e:uM([e,"ms"+e,"webkit"+e,"moz"+e,"o"+e],(function(e){return"on"+e in document}))||e}(),Mq=0,_q=5;var Cq,qq={type:"IDLE"};function Sq(e){var t=e.cancel,n=e.completed,r=e.getPhase,i=e.setPhase;return[{eventName:"mousemove",fn:function(e){var t=e.button,n=e.clientX,o=e.clientY;if(t===Mq){var a={x:n,y:o},c=r();if("DRAGGING"===c.type)return e.preventDefault(),void c.actions.move(a);"PENDING"!==c.type&&Rj(!1);var s=c.point;if(l=s,u=a,Math.abs(u.x-l.x)>=_q||Math.abs(u.y-l.y)>=_q){var l,u;e.preventDefault();var f=c.actions.fluidLift(a);i({type:"DRAGGING",actions:f})}}}},{eventName:"mouseup",fn:function(e){var i=r();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),n()):t()}},{eventName:"mousedown",fn:function(e){"DRAGGING"===r().type&&e.preventDefault(),t()}},{eventName:"keydown",fn:function(e){if("PENDING"!==r().type)return e.keyCode===vq?(e.preventDefault(),void t()):void xq(e);t()}},{eventName:"resize",fn:t},{eventName:"scroll",options:{passive:!0,capture:!1},fn:function(){"PENDING"===r().type&&t()}},{eventName:"webkitmouseforcedown",fn:function(e){var n=r();"IDLE"===n.type&&Rj(!1),n.actions.shouldRespectForcePress()?t():e.preventDefault()}},{eventName:jq,fn:t}]}function Oq(){}var Tq=((Cq={})[34]=!0,Cq[33]=!0,Cq[36]=!0,Cq[35]=!0,Cq);function Eq(e,t){function n(){t(),e.cancel()}return[{eventName:"keydown",fn:function(r){return r.keyCode===vq?(r.preventDefault(),void n()):r.keyCode===gq?(r.preventDefault(),t(),void e.drop()):r.keyCode===wq?(r.preventDefault(),void e.moveDown()):r.keyCode===yq?(r.preventDefault(),void e.moveUp()):r.keyCode===bq?(r.preventDefault(),void e.moveRight()):r.keyCode===mq?(r.preventDefault(),void e.moveLeft()):void(Tq[r.keyCode]?r.preventDefault():xq(r))}},{eventName:"mousedown",fn:n},{eventName:"mouseup",fn:n},{eventName:"click",fn:n},{eventName:"touchstart",fn:n},{eventName:"resize",fn:n},{eventName:"wheel",fn:n,options:{passive:!0}},{eventName:jq,fn:n}]}var Aq={type:"IDLE"},Hq=120,Lq=.15;var Dq={input:!0,button:!0,textarea:!0,select:!0,option:!0,optgroup:!0,video:!0,audio:!0};function Pq(e,t){var n=t.target;return!!tq(n)&&function e(t,n){if(null==n)return!1;if(Boolean(Dq[n.tagName.toLowerCase()]))return!0;var r=n.getAttribute("contenteditable");return"true"===r||""===r||n!==t&&e(t,n.parentElement)}(e,n)}var Vq=function(e){return gj(e.getBoundingClientRect()).center};var Nq="undefined"===typeof document?"matches":uM(["matches","msMatchesSelector","webkitMatchesSelector"],(function(e){return e in Element.prototype}))||"matches";function Iq(e,t){return e.closest?e.closest(t):function e(t,n){return null==t?null:t[Nq](n)?t:e(t.parentElement,n)}(e,t)}function Rq(e,t){var n,r=t.target;if(!((n=r)instanceof eq(n).Element))return null;var i=Iq(r,function(e){return"["+WC.contextId+'="'+e+'"]'}(e));return i&&tq(i)?i:null}function Bq(e){e.preventDefault()}function Fq(e){var t=e.expected,n=e.phase,r=e.isLockActive;e.shouldWarn;return!!r()&&t===n}function Uq(e){var t=e.lockAPI,n=e.store,r=e.registry,i=e.draggableId;if(t.isClaimed())return!1;var o=r.draggable.findById(i);return!!o&&(!!o.options.isEnabled&&!!bC(n.getState(),i))}function Wq(e){var t=e.lockAPI,n=e.contextId,r=e.store,i=e.registry,o=e.draggableId,a=e.forceSensorStop,c=e.sourceEvent;if(!Uq({lockAPI:t,store:r,registry:i,draggableId:o}))return null;var s=i.draggable.getById(o),l=function(e,t){var n="["+GC.contextId+'="'+e+'"]',r=uM(fM(document.querySelectorAll(n)),(function(e){return e.getAttribute(GC.id)===t}));return r&&tq(r)?r:null}(n,s.descriptor.id);if(!l)return null;if(c&&!s.options.canDragInteractiveElements&&Pq(l,c))return null;var u=t.claim(a||Dj),f="PRE_DRAG";function h(){return s.options.shouldRespectForcePress}function d(){return t.isActive(u)}var p=function(e,t){Fq({expected:e,phase:f,isLockActive:d,shouldWarn:!0})&&r.dispatch(t())}.bind(null,"DRAGGING");function z(e){function n(){t.release(),f="COMPLETED"}function i(t,i){if(void 0===i&&(i={shouldBlockNextClick:!1}),e.cleanup(),i.shouldBlockNextClick){var o=Pj(window,[{eventName:"click",fn:Bq,options:{once:!0,passive:!1,capture:!0}}]);setTimeout(o)}n(),r.dispatch(I_({reason:t}))}return"PRE_DRAG"!==f&&(n(),"PRE_DRAG"!==f&&Rj(!1)),r.dispatch(C_(e.liftActionArgs)),f="DRAGGING",_x({isActive:function(){return Fq({expected:"DRAGGING",phase:f,isLockActive:d,shouldWarn:!1})},shouldRespectForcePress:h,drop:function(e){return i("DROP",e)},cancel:function(e){return i("CANCEL",e)}},e.actions)}return{isActive:function(){return Fq({expected:"PRE_DRAG",phase:f,isLockActive:d,shouldWarn:!1})},shouldRespectForcePress:h,fluidLift:function(e){var t=Cj((function(e){p((function(){return A_({client:e})}))}));return _x({},z({liftActionArgs:{id:o,clientSelection:e,movementMode:"FLUID"},cleanup:function(){return t.cancel()},actions:{move:t}}),{move:t})},snapLift:function(){var e={moveUp:function(){return p(H_)},moveRight:function(){return p(D_)},moveDown:function(){return p(L_)},moveLeft:function(){return p(P_)}};return z({liftActionArgs:{id:o,clientSelection:Vq(l),movementMode:"SNAP"},cleanup:Dj,actions:e})},abort:function(){Fq({expected:"PRE_DRAG",phase:f,isLockActive:d,shouldWarn:!0})&&t.release()}}}var Gq=[function(e){var t=Object(a.useRef)(qq),n=Object(a.useRef)(Dj),r=zj((function(){return{eventName:"mousedown",fn:function(t){if(!t.defaultPrevented&&t.button===Mq&&!(t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)){var r=e.findClosestDraggableId(t);if(r){var i=e.tryGetLock(r,c,{sourceEvent:t});if(i){t.preventDefault();var o={x:t.clientX,y:t.clientY};n.current(),u(i,o)}}}}}}),[e]),i=zj((function(){return{eventName:"webkitmouseforcewillbegin",fn:function(t){if(!t.defaultPrevented){var n=e.findClosestDraggableId(t);if(n){var r=e.findOptionsForDraggable(n);r&&(r.shouldRespectForcePress||e.canGetLock(n)&&t.preventDefault())}}}}}),[e]),o=vj((function(){n.current=Pj(window,[i,r],{passive:!1,capture:!0})}),[i,r]),c=vj((function(){"IDLE"!==t.current.type&&(t.current=qq,n.current(),o())}),[o]),s=vj((function(){var e=t.current;c(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[c]),l=vj((function(){var e=Sq({cancel:s,completed:c,getPhase:function(){return t.current},setPhase:function(e){t.current=e}});n.current=Pj(window,e,{capture:!0,passive:!1})}),[s,c]),u=vj((function(e,n){"IDLE"!==t.current.type&&Rj(!1),t.current={type:"PENDING",point:n,actions:e},l()}),[l]);KC((function(){return o(),function(){n.current()}}),[o])},function(e){var t=Object(a.useRef)(Oq),n=zj((function(){return{eventName:"keydown",fn:function(n){if(!n.defaultPrevented&&n.keyCode===gq){var i=e.findClosestDraggableId(n);if(i){var o=e.tryGetLock(i,s,{sourceEvent:n});if(o){n.preventDefault();var a=!0,c=o.snapLift();t.current(),t.current=Pj(window,Eq(c,s),{capture:!0,passive:!1})}}}function s(){a||Rj(!1),a=!1,t.current(),r()}}}}),[e]),r=vj((function(){t.current=Pj(window,[n],{passive:!1,capture:!0})}),[n]);KC((function(){return r(),function(){t.current()}}),[r])},function(e){var t=Object(a.useRef)(Aq),n=Object(a.useRef)(Dj),r=vj((function(){return t.current}),[]),i=vj((function(e){t.current=e}),[]),o=zj((function(){return{eventName:"touchstart",fn:function(t){if(!t.defaultPrevented){var r=e.findClosestDraggableId(t);if(r){var i=e.tryGetLock(r,s,{sourceEvent:t});if(i){var o=t.touches[0],a={x:o.clientX,y:o.clientY};n.current(),h(i,a)}}}}}}),[e]),c=vj((function(){n.current=Pj(window,[o],{capture:!0,passive:!1})}),[o]),s=vj((function(){var e=t.current;"IDLE"!==e.type&&("PENDING"===e.type&&clearTimeout(e.longPressTimerId),i(Aq),n.current(),c())}),[c,i]),l=vj((function(){var e=t.current;s(),"DRAGGING"===e.type&&e.actions.cancel({shouldBlockNextClick:!0}),"PENDING"===e.type&&e.actions.abort()}),[s]),u=vj((function(){var e={capture:!0,passive:!1},t={cancel:l,completed:s,getPhase:r},i=Pj(window,function(e){var t=e.cancel,n=e.completed,r=e.getPhase;return[{eventName:"touchmove",options:{capture:!1},fn:function(e){var n=r();if("DRAGGING"===n.type){n.hasMoved=!0;var i=e.touches[0],o={x:i.clientX,y:i.clientY};e.preventDefault(),n.actions.move(o)}else t()}},{eventName:"touchend",fn:function(e){var i=r();"DRAGGING"===i.type?(e.preventDefault(),i.actions.drop({shouldBlockNextClick:!0}),n()):t()}},{eventName:"touchcancel",fn:function(e){"DRAGGING"===r().type?(e.preventDefault(),t()):t()}},{eventName:"touchforcechange",fn:function(e){var n=r();"IDLE"===n.type&&Rj(!1);var i=e.touches[0];if(i&&i.force>=Lq){var o=n.actions.shouldRespectForcePress();if("PENDING"!==n.type)return o?n.hasMoved?void e.preventDefault():void t():void e.preventDefault();o&&t()}}},{eventName:jq,fn:t}]}(t),e),o=Pj(window,function(e){var t=e.cancel,n=e.getPhase;return[{eventName:"orientationchange",fn:t},{eventName:"resize",fn:t},{eventName:"contextmenu",fn:function(e){e.preventDefault()}},{eventName:"keydown",fn:function(e){"DRAGGING"===n().type?(e.keyCode===vq&&e.preventDefault(),t()):t()}},{eventName:jq,fn:t}]}(t),e);n.current=function(){i(),o()}}),[l,r,s]),f=vj((function(){var e=r();"PENDING"!==e.type&&Rj(!1);var t=e.actions.fluidLift(e.point);i({type:"DRAGGING",actions:t,hasMoved:!1})}),[r,i]),h=vj((function(e,t){"IDLE"!==r().type&&Rj(!1);var n=setTimeout(f,Hq);i({type:"PENDING",point:t,actions:e,longPressTimerId:n}),u()}),[u,r,i,f]);KC((function(){return c(),function(){n.current();var e=r();"PENDING"===e.type&&(clearTimeout(e.longPressTimerId),i(Aq))}}),[r,c,i]),KC((function(){return Pj(window,[{eventName:"touchmove",fn:function(){},options:{capture:!1,passive:!1}}])}),[])}];function Yq(e){var t=e.contextId,n=e.store,r=e.registry,i=e.customSensors,o=e.enableDefaultSensors,c=[].concat(o?Gq:[],i||[]),s=Object(a.useState)((function(){return function(){var e=null;function t(){e||Rj(!1),e=null}return{isClaimed:function(){return Boolean(e)},isActive:function(t){return t===e},claim:function(t){e&&Rj(!1);var n={abandon:t};return e=n,n},release:t,tryAbandon:function(){e&&(e.abandon(),t())}}}()}))[0],l=vj((function(e,t){e.isDragging&&!t.isDragging&&s.tryAbandon()}),[s]);KC((function(){var e=n.getState();return n.subscribe((function(){var t=n.getState();l(e,t),e=t}))}),[s,n,l]),KC((function(){return s.tryAbandon}),[s.tryAbandon]);var u=vj((function(e){return Uq({lockAPI:s,registry:r,store:n,draggableId:e})}),[s,r,n]),f=vj((function(e,i,o){return Wq({lockAPI:s,registry:r,contextId:t,store:n,draggableId:e,forceSensorStop:i,sourceEvent:o&&o.sourceEvent?o.sourceEvent:null})}),[t,s,r,n]),h=vj((function(e){return function(e,t){var n=Rq(e,t);return n?n.getAttribute(WC.draggableId):null}(t,e)}),[t]),d=vj((function(e){var t=r.draggable.findById(e);return t?t.options:null}),[r.draggable]),p=vj((function(){s.isClaimed()&&(s.tryAbandon(),"IDLE"!==n.getState().phase&&n.dispatch(V_()))}),[s,n]),z=vj(s.isClaimed,[s]),v=zj((function(){return{canGetLock:u,tryGetLock:f,findClosestDraggableId:h,findOptionsForDraggable:d,tryReleaseLock:p,isLockClaimed:z}}),[u,f,h,d,p,z]);hq();for(var g=0;gi))return o.current=FS(FS({},o.current),{width:i,tabRight:f,containerRight:s}),f>=s&&!o.current.collapse?(o.current.collapse=!0,r(!0)):f+hs&&u(!0),l<=s&&u(!1),a>0&&c(!0),0===a&&c(!1)}}}),[r,n])]}(l,u,n,s),d=h[0],p=h[1],z=h[2];Object(a.useEffect)((function(){if(l.current){var e=l.current,t=Object(BS.a)(300,(function(){f(),z()}));return t(),e.addEventListener("scroll",z),window.addEventListener("resize",t),function(){e.removeEventListener("scroll",z),window.removeEventListener("resize",t)}}}),[n,s]);var v=Object(a.useCallback)((function(e){if(e){var t=u.current;n.length>=t.length&&(u.current=QS(t,[e])),n.length0||(i.disconnect(),oO.delete(e),delete rO[r],delete iO[r])}}((function(e){i&&i(e),u(e)}),e,s)}}),[t,n,r,i]);return Object(a.useEffect)((function(){return function(){var e;null===(e=c.current)||void 0===e||e.call(c),c.current=null}}),[]),[f,o,l]},lO=function(){return(lO=Object.assign||function(e){for(var t,n=1,r=arguments.length;n1?t-1:0),r=1;r0?" Args: "+n.join(", "):""))}var M=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}var t=e.prototype;return t.indexOfGroup=function(e){for(var t=0,n=0;n=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,i=r;e>=i;)(i<<=1)<0&&j(16,""+e);this.groupSizes=new Uint32Array(i),this.groupSizes.set(n),this.length=i;for(var o=r;o=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),i=r+n,o=r;o=q&&(q=t+1),_.set(e,t),C.set(t,e)},E="style["+w+'][data-styled-version="5.3.5"]',A=new RegExp("^"+w+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),H=function(e,t,n){for(var r,i=n.split(","),o=0,a=i.length;o=0;n--){var r=t[n];if(r&&1===r.nodeType&&r.hasAttribute(w))return r}}(n),o=void 0!==i?i.nextSibling:null;r.setAttribute(w,"active"),r.setAttribute("data-styled-version","5.3.5");var a=D();return a&&r.setAttribute("nonce",a),n.insertBefore(r,o),r},V=function(){function e(e){var t=this.element=P(e);t.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n=0){var n=document.createTextNode(t),r=this.nodes[e];return this.element.insertBefore(n,r||null),this.length++,!0}return!1},t.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},t.getRule=function(e){return e0&&(l+=e+",")})),r+=""+c+s+'{content:"'+l+'"}/*!sc*/\n'}}}return r}(this)},e}(),U=/(a)(d)/gi,W=function(e){return String.fromCharCode(e+(e>25?39:97))};function G(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=W(t%52)+n;return(W(t%52)+n).replace(U,"$1-$2")}var Y=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Z=function(e){return Y(5381,e)};function $(e){for(var t=0;t>>0);if(!t.hasNameForId(r,a)){var c=n(o,"."+a,void 0,r);t.insertRules(r,a,c)}i.push(a),this.staticRulesId=a}else{for(var s=this.rules.length,l=Y(this.baseHash,n.hash),u="",f=0;f>>0);if(!t.hasNameForId(r,z)){var v=n(u,"."+z,void 0,r);t.insertRules(r,z,v)}i.push(z)}}return i.join(" ")},e}(),Q=/^\s*\/\/.*$/gm,J=[":","[",".","#"];function ee(e){var t,n,r,i,o=void 0===e?g:e,a=o.options,c=void 0===a?g:a,l=o.plugins,u=void 0===l?v:l,f=new s.a(c),h=[],d=function(e){function t(t){if(t)try{e(t+"}")}catch(e){}}return function(n,r,i,o,a,c,s,l,u,f){switch(n){case 1:if(0===u&&64===r.charCodeAt(0))return e(r+";"),"";break;case 2:if(0===l)return r+"/*|*/";break;case 3:switch(l){case 102:case 112:return e(i[0]+r),"";default:return r+(0===f?"/*|*/":"")}case-2:r.split("/*|*/}").forEach(t)}}}((function(e){h.push(e)})),p=function(e,r,o){return 0===r&&-1!==J.indexOf(o[n.length])||o.match(i)?e:"."+t};function z(e,o,a,c){void 0===c&&(c="&");var s=e.replace(Q,""),l=o&&a?a+" "+o+" { "+s+" }":s;return t=c,n=o,r=new RegExp("\\"+n+"\\b","g"),i=new RegExp("(\\"+n+"\\b){2,}"),f(a||!o?"":o,l)}return f.use([].concat(u,[function(e,t,i){2===e&&i.length&&i[0].lastIndexOf(n)>0&&(i[0]=i[0].replace(r,p))},d,function(e){if(-2===e){var t=h;return h=[],t}}])),z.hash=u.length?u.reduce((function(e,t){return t.name||j(15),Y(e,t.name)}),5381).toString():"",z}var te=o.a.createContext(),ne=(te.Consumer,o.a.createContext()),re=(ne.Consumer,new F),ie=ee();function oe(){return Object(i.useContext)(te)||re}function ae(){return Object(i.useContext)(ne)||ie}function ce(e){var t=Object(i.useState)(e.stylisPlugins),n=t[0],r=t[1],a=oe(),s=Object(i.useMemo)((function(){var t=a;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t}),[e.disableCSSOMInjection,e.sheet,e.target]),l=Object(i.useMemo)((function(){return ee({options:{prefix:!e.disableVendorPrefixes},plugins:n})}),[e.disableVendorPrefixes,n]);return Object(i.useEffect)((function(){c()(n,e.stylisPlugins)||r(e.stylisPlugins)}),[e.stylisPlugins]),o.a.createElement(te.Provider,{value:s},o.a.createElement(ne.Provider,{value:l},e.children))}var se=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=ie);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.toString=function(){return j(12,String(n.name))},this.name=e,this.id="sc-keyframes-"+e,this.rules=t}return e.prototype.getName=function(e){return void 0===e&&(e=ie),this.name+e.hash},e}(),le=/([A-Z])/,ue=/([A-Z])/g,fe=/^ms-/,he=function(e){return"-"+e.toLowerCase()};function de(e){return le.test(e)?e.replace(ue,he).replace(fe,"-ms-"):e}var pe=function(e){return null==e||!1===e||""===e};function ze(e,t,n,r){if(Array.isArray(e)){for(var i,o=[],a=0,c=e.length;a1?t-1:0),r=1;r?@[\\\]^`{|}~-]+/g,be=/(^-|-$)/g;function we(e){return e.replace(ye,"-").replace(be,"")}var ke=function(e){return G(Z(e)>>>0)};function xe(e){return"string"==typeof e&&!0}var je=function(e){return"function"==typeof e||"object"==typeof e&&null!==e&&!Array.isArray(e)},Me=function(e){return"__proto__"!==e&&"constructor"!==e&&"prototype"!==e};function _e(e,t,n){var r=e[n];je(t)&&je(r)?Ce(r,t):e[n]=t}function Ce(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r=0||(i[n]=e[n]);return i}(t,["componentId"]),o=r&&r+"-"+(xe(e)?e:we(y(e)));return Te(e,d({},i,{attrs:k,componentId:o}),n)},Object.defineProperty(j,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=r?Ce({},e.defaultProps,t):t}}),j.toString=function(){return"."+j.styledComponentId},a&&h()(j,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),j}var Ee=function(e){return function e(t,n,i){if(void 0===i&&(i=g),!Object(r.isValidElementType)(n))return j(1,String(n));var o=function(){return t(n,i,ge.apply(void 0,arguments))};return o.withConfig=function(r){return e(t,n,d({},i,{},r))},o.attrs=function(r){return e(t,n,d({},i,{attrs:Array.prototype.concat(i.attrs,r).filter(Boolean)}))},o}(Te,e)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach((function(e){Ee[e]=Ee(e)}));!function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=$(e),F.registerId(this.componentId+1)}var t=e.prototype;t.createStyles=function(e,t,n,r){var i=r(ze(this.rules,t,n,r).join(""),""),o=this.componentId+e;n.insertRules(o,o,i)},t.removeStyles=function(e,t){t.clearRules(this.componentId+e)},t.renderStyles=function(e,t,n,r){e>2&&F.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)}}();function Ae(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r"+t+""},this.getStyleTags=function(){return e.sealed?j(2):e._emitSheetCSS()},this.getStyleElement=function(){var t;if(e.sealed)return j(2);var n=((t={})[w]="",t["data-styled-version"]="5.3.5",t.dangerouslySetInnerHTML={__html:e.instance.toString()},t),r=D();return r&&(n.nonce=r),[o.a.createElement("style",d({},n,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new F({isServer:!0}),this.sealed=!1}var t=e.prototype;t.collectStyles=function(e){return this.sealed?j(2):o.a.createElement(ce,{sheet:this.instance},e)},t.interleaveWithNodeStream=function(e){return j(3)}}();t.d=Ee}).call(this,n(103))},function(e,t,n){"use strict";var r=n(158);var i=n(159);function o(e,t){return Object(r.a)(e)||function(e,t){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)){var n=[],r=!0,i=!1,o=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(s){i=!0,o=s}finally{try{r||null==c.return||c.return()}finally{if(i)throw o}}return n}}(e,t)||Object(i.a)()}n.d(t,"a",(function(){return o}))},function(e,t,n){"use strict";function r(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(14);function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0&&e.splice(n,1)}function p(e){var t=!1;return function(){t||(t=!0,e())}}var z=function(e){throw e},v=function(e){return{value:e,done:!0}};function g(e,t,n){void 0===t&&(t=z),void 0===n&&(n="iterator");var r={meta:{name:n},next:e,throw:t,return:v,isSagaIterator:!0};return"undefined"!==typeof Symbol&&(r[Symbol.iterator]=function(){return r}),r}function m(e,t){var n=t.sagaStack;console.error(e),console.error(n)}var y=function(e){return new Error("\n redux-saga: Error checking hooks detected an inconsistent state. This is likely a bug\n in redux-saga code and not yours. Thanks for reporting this in the project's github repo.\n Error: "+e+"\n")},b=function(e){return Array.apply(null,new Array(e))},w=function(e){return function(t){return e(Object.defineProperty(t,r.f,{value:!0}))}},k=function(e){return e===r.k},x=function(e){return e===r.j},j=function(e){return k(e)||x(e)};function M(e,t){var n=Object.keys(e),r=n.length;var i,a=0,c=Object(o.a)(e)?b(r):{},l={};return n.forEach((function(e){var n=function(n,o){i||(o||j(n)?(t.cancel(),t(n,o)):(c[e]=n,++a===r&&(i=!0,t(c))))};n.cancel=s,l[e]=n})),t.cancel=function(){i||(i=!0,n.forEach((function(e){return l[e].cancel()})))},l}function _(e){return{name:e.name||"anonymous",location:C(e)}}function C(e){return e[r.g]}var q="Channel's Buffer overflow!",S=1,O=3,T=4,E={isEmpty:c,put:s,take:s};function A(e,t){void 0===e&&(e=10);var n=new Array(e),r=0,i=0,o=0,a=function(t){n[i]=t,i=(i+1)%e,r++},c=function(){if(0!=r){var t=n[o];return n[o]=null,r--,o=(o+1)%e,t}},s=function(){for(var e=[];r;)e.push(c());return e};return{isEmpty:function(){return 0==r},put:function(c){var l;if(r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r1?t-1:0),r=1;r2?n-2:0),o=2;o2?n-2:0),o=2;o1?t-1:0),r=1;r1&&void 0!==arguments[1]?arguments[1]:r,n=null,o=null;return function(){return i(t,n,arguments)||(o=e.apply(null,arguments)),n=arguments,o}}))},,function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(30),i=n(38);function o(e){return function t(n,o){switch(arguments.length){case 0:return t;case 1:return Object(i.a)(n)?t:Object(r.a)((function(t){return e(n,t)}));default:return Object(i.a)(n)&&Object(i.a)(o)?t:Object(i.a)(n)?Object(r.a)((function(t){return e(t,o)})):Object(i.a)(o)?Object(r.a)((function(t){return e(n,t)})):e(n,o)}}}},function(e,t,n){"use strict";function r(e,t){if(t.length1?"s":"")+" required, but only "+t.length+" present")}n.d(t,"a",(function(){return r}))},function(e,t,n){e.exports=n(317)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"createAction",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"createReducer",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"assignAll",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"bindAll",{enumerable:!0,get:function(){return c.default}}),Object.defineProperty(t,"batch",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"disbatch",{enumerable:!0,get:function(){return l.default}}),Object.defineProperty(t,"loggers",{enumerable:!0,get:function(){return u.default}}),Object.defineProperty(t,"asError",{enumerable:!0,get:function(){return f.default}}),t.types=void 0;var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}(n(222)),i=h(n(223)),o=h(n(309)),a=h(n(310)),c=h(n(311)),s=h(n(148)),l=h(n(312)),u=h(n(313)),f=h(n(315));function h(e){return e&&e.__esModule?e:{default:e}}var d=r;t.types=d},function(e,t,n){"use strict";n.d(t,"a",(function(){return s})),n.d(t,"b",(function(){return d})),n.d(t,"c",(function(){return g})),n.d(t,"d",(function(){return a})),n.d(t,"e",(function(){return f})),n.d(t,"f",(function(){return v})),n.d(t,"g",(function(){return o})),n.d(t,"h",(function(){return l})),n.d(t,"i",(function(){return h})),n.d(t,"j",(function(){return u})),n.d(t,"k",(function(){return c})),n.d(t,"l",(function(){return p})),n.d(t,"m",(function(){return z})),n.d(t,"n",(function(){return i}));var r=n(33),i=function(e){return null===e||void 0===e},o=function(e){return null!==e&&void 0!==e},a=function(e){return"function"===typeof e},c=function(e){return"string"===typeof e},s=Array.isArray,l=function(e){return e&&!s(e)&&"object"===typeof e},u=function(e){return e&&a(e.then)},f=function(e){return e&&a(e.next)&&a(e.throw)},h=function e(t){return t&&(c(t)||z(t)||a(t)||s(t)&&t.every(e))},d=function(e){return e&&a(e.take)&&a(e.close)},p=function(e){return a(e)&&e.hasOwnProperty("toString")},z=function(e){return Boolean(e)&&"function"===typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype},v=function(e){return d(e)&&e[r.e]},g=function(e){return e&&e[r.c]}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(20);function i(e){Object(r.a)(1,arguments);var t=Object.prototype.toString.call(e);return e instanceof Date||"object"===typeof e&&"[object Date]"===t?new Date(e.getTime()):"number"===typeof e||"[object Number]"===t?new Date(e):("string"!==typeof e&&"[object String]"!==t||"undefined"===typeof console||(console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule"),console.warn((new Error).stack)),new Date(NaN))}},function(e,t,n){"use strict";function r(e){if(null===e||!0===e||!1===e)return NaN;var t=Number(e);return isNaN(t)?t:t<0?Math.ceil(t):Math.floor(t)}n.d(t,"a",(function(){return r}))},,,function(e,t,n){"use strict";var r=n(0),i=n.n(r),o=n(13),a=n.n(o),c=i.a.createContext(null);var s=function(e){e()},l=function(){return s},u=null,f={notify:function(){}};var h=function(){function e(e,t){this.store=e,this.parentSub=t,this.unsubscribe=null,this.listeners=f,this.handleChangeWrapper=this.handleChangeWrapper.bind(this)}var t=e.prototype;return t.addNestedSub=function(e){return this.trySubscribe(),this.listeners.subscribe(e)},t.notifyNestedSubs=function(){this.listeners.notify()},t.handleChangeWrapper=function(){this.onStateChange&&this.onStateChange()},t.isSubscribed=function(){return Boolean(this.unsubscribe)},t.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.handleChangeWrapper):this.store.subscribe(this.handleChangeWrapper),this.listeners=function(){var e=l(),t=[],n=[];return{clear:function(){n=u,t=u},notify:function(){var r=t=n;e((function(){for(var e=0;e. You may also pass a {context : MyContext} option to connect");var H=E;return function(t){var n=t.displayName||t.name||"Component",o=a(n),c=Object(z.a)({},A,{getDisplayName:a,methodName:l,renderCountProp:f,shouldHandleStateChanges:p,storeKey:y,displayName:o,wrappedComponentName:n,WrappedComponent:t}),s=A.pure;var u=s?r.useMemo:function(e){return e()};function d(n){var a=Object(r.useMemo)((function(){var e=n.forwardedRef,t=Object(v.a)(n,["forwardedRef"]);return[n.context,e,t]}),[n]),s=a[0],l=a[1],f=a[2],d=Object(r.useMemo)((function(){return s&&s.Consumer&&Object(w.isContextConsumer)(i.a.createElement(s.Consumer,null))?s:H}),[s,H]),g=Object(r.useContext)(d),m=Boolean(n.store)&&Boolean(n.store.getState)&&Boolean(n.store.dispatch),y=Boolean(g)&&Boolean(g.store);b()(m||y,'Could not find "store" in the context of "'+o+'". Either wrap the root component in a , or pass a custom React context provider to and the corresponding React context consumer to '+o+" in connect options.");var C=m?n.store:g.store,q=Object(r.useMemo)((function(){return function(t){return e(t.dispatch,c)}(C)}),[C]),S=Object(r.useMemo)((function(){if(!p)return j;var e=new h(C,m?null:g.subscription),t=e.notifyNestedSubs.bind(e);return[e,t]}),[C,m,g]),O=S[0],T=S[1],E=Object(r.useMemo)((function(){return m?g:Object(z.a)({},g,{subscription:O})}),[m,g,O]),A=Object(r.useReducer)(M,x,_),L=A[0][0],D=A[1];if(L&&L.error)throw L.error;var P=Object(r.useRef)(),V=Object(r.useRef)(f),N=Object(r.useRef)(),I=Object(r.useRef)(!1),R=u((function(){return N.current&&f===V.current?N.current:q(C.getState(),f)}),[C,L,f]);k((function(){V.current=f,P.current=R,I.current=!1,N.current&&(N.current=null,T())})),k((function(){if(p){var e=!1,t=null,n=function(){if(!e){var n,r,i=C.getState();try{n=q(i,V.current)}catch(o){r=o,t=o}r||(t=null),n===P.current?I.current||T():(P.current=n,N.current=n,I.current=!0,D({type:"STORE_UPDATED",payload:{error:r}}))}};O.onStateChange=n,O.trySubscribe(),n();return function(){if(e=!0,O.tryUnsubscribe(),O.onStateChange=null,t)throw t}}}),[C,O,q]);var B=Object(r.useMemo)((function(){return i.a.createElement(t,Object(z.a)({},R,{ref:l}))}),[l,t,R]);return Object(r.useMemo)((function(){return p?i.a.createElement(d.Provider,{value:E},B):B}),[d,B,E])}var g=s?i.a.memo(d):d;if(g.WrappedComponent=t,g.displayName=o,O){var C=i.a.forwardRef((function(e,t){return i.a.createElement(g,Object(z.a)({},e,{forwardedRef:t}))}));return C.displayName=o,C.WrappedComponent=t,m()(C,t)}return m()(g,t)}}var q=Object.prototype.hasOwnProperty;function S(e,t){return e===t?0!==e||0!==t||1/e===1/t:e!==e&&t!==t}function O(e,t){if(S(e,t))return!0;if("object"!==typeof e||null===e||"object"!==typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var i=0;i=0;r--){var i=t[r](e);if(i)return i}return function(t,r){throw new Error("Invalid value of type "+typeof e+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function F(e,t){return e===t}!function(e){var t=void 0===e?{}:e,n=t.connectHOC,r=void 0===n?C:n,i=t.mapStateToPropsFactories,o=void 0===i?D:i,a=t.mapDispatchToPropsFactories,c=void 0===a?L:a,s=t.mergePropsFactories,l=void 0===s?V:s,u=t.selectorFactory,f=void 0===u?R:u}();function U(){var e=Object(r.useContext)(c);return b()(e,"could not find react-redux context value; please ensure the component is wrapped in a "),e}function W(e){void 0===e&&(e=c);var t=e===c?U:function(){return Object(r.useContext)(e)};return function(){return t().store}}var G=W();function Y(e){void 0===e&&(e=c);var t=e===c?G:W(e);return function(){return t().dispatch}}var Z=Y(),$=function(e,t){return e===t};function X(e){void 0===e&&(e=c);var t=e===c?U:function(){return Object(r.useContext)(e)};return function(e,n){void 0===n&&(n=$),b()(e,"You must pass a selector to useSelectors");var i=t();return function(e,t,n,i){var o,a=Object(r.useReducer)((function(e){return e+1}),0)[1],c=Object(r.useMemo)((function(){return new h(n,i)}),[n,i]),s=Object(r.useRef)(),l=Object(r.useRef)(),u=Object(r.useRef)();try{o=e!==l.current||s.current?e(n.getState()):u.current}catch(d){var f="An error occurred while selecting the store state: "+d.message+".";throw s.current&&(f+="\nThe error may be correlated with this previous error:\n"+s.current.stack+"\n\nOriginal stack trace:"),new Error(f)}return k((function(){l.current=e,u.current=o,s.current=void 0})),k((function(){function e(){try{var e=l.current(n.getState());if(t(e,u.current))return;u.current=e}catch(d){s.current=d}a({})}return c.onStateChange=e,c.trySubscribe(),e(),function(){return c.tryUnsubscribe()}}),[n,c]),o}(e,n,i.store,i.subscription)}}var K,Q=X(),J=n(32);n.d(t,"a",(function(){return p})),n.d(t,"d",(function(){return Z})),n.d(t,"b",(function(){return Y})),n.d(t,"e",(function(){return Q})),n.d(t,"c",(function(){return X})),n.d(t,"f",(function(){return G})),K=J.unstable_batchedUpdates,s=K},function(e,t,n){"use strict";function r(){return(r=Object.assign||function(e){for(var t=1;t=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}},function(e,t,n){"use strict";!function e(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE){0;try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}}(),e.exports=n(302)},function(e,t,n){"use strict";n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return a})),n.d(t,"d",(function(){return c})),n.d(t,"e",(function(){return s})),n.d(t,"f",(function(){return l})),n.d(t,"g",(function(){return p})),n.d(t,"h",(function(){return u})),n.d(t,"i",(function(){return f})),n.d(t,"j",(function(){return h})),n.d(t,"k",(function(){return d}));var r=function(e){return"@@redux-saga/"+e},i=r("CANCEL_PROMISE"),o=r("CHANNEL_END"),a=r("IO"),c=r("MATCH"),s=r("MULTICAST"),l=r("SAGA_ACTION"),u=r("SELF_CANCELLATION"),f=r("TASK"),h=r("TASK_CANCEL"),d=r("TERMINATE"),p=r("LOCATION")},function(e,t,n){var r;!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";function r(e){return null!=e&&"object"===typeof e&&!0===e["@@functional/placeholder"]}n.d(t,"a",(function(){return r}))},,function(e,t,n){"use strict";n.d(t,"c",(function(){return o})),n.d(t,"e",(function(){return a})),n.d(t,"d",(function(){return c})),n.d(t,"b",(function(){return r})),n.d(t,"a",(function(){return i}));var r,i,o={ANCHOR:"mdc-menu-surface--anchor",ANIMATING_CLOSED:"mdc-menu-surface--animating-closed",ANIMATING_OPEN:"mdc-menu-surface--animating-open",FIXED:"mdc-menu-surface--fixed",OPEN:"mdc-menu-surface--open",ROOT:"mdc-menu-surface"},a={CLOSED_EVENT:"MDCMenuSurface:closed",OPENED_EVENT:"MDCMenuSurface:opened",FOCUSABLE_ELEMENTS:["button:not(:disabled)",'[href]:not([aria-disabled="true"])',"input:not(:disabled)","select:not(:disabled)","textarea:not(:disabled)",'[tabindex]:not([tabindex="-1"]):not([aria-disabled="true"])'].join(", ")},c={TRANSITION_OPEN_DURATION:120,TRANSITION_CLOSE_DURATION:75,MARGIN_TO_EDGE:32,ANCHOR_TO_MENU_SURFACE_WIDTH_RATIO:.67};!function(e){e[e.BOTTOM=1]="BOTTOM",e[e.CENTER=2]="CENTER",e[e.RIGHT=4]="RIGHT",e[e.FLIP_RTL=8]="FLIP_RTL"}(r||(r={})),function(e){e[e.TOP_LEFT=0]="TOP_LEFT",e[e.TOP_RIGHT=4]="TOP_RIGHT",e[e.BOTTOM_LEFT=1]="BOTTOM_LEFT",e[e.BOTTOM_RIGHT=5]="BOTTOM_RIGHT",e[e.TOP_START=8]="TOP_START",e[e.TOP_END=12]="TOP_END",e[e.BOTTOM_START=9]="BOTTOM_START",e[e.BOTTOM_END=13]="BOTTOM_END"}(i||(i={}))},,,function(e,t,n){"use strict";var r=n(52);var i=n(106),o=n(132);var a=n(77),c=n(76);function s(e){return e?1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}:c.a}var l=n(59);n.d(t,"a",(function(){return u}));var u=function(){function e(e){this._isScalar=!1,e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var a=this.operator,c=function(e,t,n){if(e){if(e instanceof r.a)return e;if(e[i.a])return e[i.a]()}return e||t||n?new r.a(e,t,n):new r.a(o.a)}(e,t,n);if(a?c.add(a.call(c,this.source)):c.add(this.source||l.a.useDeprecatedSynchronousErrorHandling&&!c.syncErrorThrowable?this._subscribe(c):this._trySubscribe(c)),l.a.useDeprecatedSynchronousErrorHandling&&c.syncErrorThrowable&&(c.syncErrorThrowable=!1,c.syncErrorThrown))throw c.syncErrorValue;return c},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){l.a.useDeprecatedSynchronousErrorHandling&&(e.syncErrorThrown=!0,e.syncErrorValue=t),!function(e){for(;e;){var t=e,n=t.closed,i=t.destination,o=t.isStopped;if(n||o)return!1;e=i&&i instanceof r.a?i:null}return!0}(e)?console.warn(t):e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=f(t))((function(t,r){var i;i=n.subscribe((function(t){try{e(t)}catch(n){r(n),i&&i.unsubscribe()}}),r,t)}))},e.prototype._subscribe=function(e){var t=this.source;return t&&t.subscribe(e)},e.prototype[a.a]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t=0||(i[n]=e[n]);return i}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return v})),n.d(t,"b",(function(){return f})),n.d(t,"c",(function(){return l})),n.d(t,"d",(function(){return z})),n.d(t,"e",(function(){return c}));var r=n(211),i=function(){return Math.random().toString(36).substring(7).split("").join(".")},o={INIT:"@@redux/INIT"+i(),REPLACE:"@@redux/REPLACE"+i(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+i()}};function a(e){if("object"!==typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function c(e,t,n){var i;if("function"===typeof t&&"function"===typeof n||"function"===typeof n&&"function"===typeof arguments[3])throw new Error("It looks like you are passing several store enhancers to createStore(). This is not supported. Instead, compose them together to a single function.");if("function"===typeof t&&"undefined"===typeof n&&(n=t,t=void 0),"undefined"!==typeof n){if("function"!==typeof n)throw new Error("Expected the enhancer to be a function.");return n(c)(e,t)}if("function"!==typeof e)throw new Error("Expected the reducer to be a function.");var s=e,l=t,u=[],f=u,h=!1;function d(){f===u&&(f=u.slice())}function p(){if(h)throw new Error("You may not call store.getState() while the reducer is executing. The reducer has already received the state as an argument. Pass it down from the top reducer instead of reading it from the store.");return l}function z(e){if("function"!==typeof e)throw new Error("Expected the listener to be a function.");if(h)throw new Error("You may not call store.subscribe() while the reducer is executing. If you would like to be notified after the store has been updated, subscribe from a component and invoke store.getState() in the callback to access the latest state. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");var t=!0;return d(),f.push(e),function(){if(t){if(h)throw new Error("You may not unsubscribe from a store listener while the reducer is executing. See https://redux.js.org/api-reference/store#subscribe(listener) for more details.");t=!1,d();var n=f.indexOf(e);f.splice(n,1)}}}function v(e){if(!a(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if("undefined"===typeof e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(h)throw new Error("Reducers may not dispatch actions.");try{h=!0,l=s(l,e)}finally{h=!1}for(var t=u=f,n=0;n=0;)t=c[n],Object(i.a)(t,e)&&!l(r,t)&&(r[r.length]=t),n-=1;return r})):Object(r.a)((function(e){return Object(e)!==e?[]:Object.keys(e)}));t.a=u},function(e,t,n){"use strict";var r=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function a(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(i){return!1}}()?Object.assign:function(e,t){for(var n,c,s=a(e),l=1;l8.64*1e15?NaN:function(e){var t=a(e);if(isNaN(t)||l(t,-0))return 0;if(isFinite(t))return t;var n=Math.floor(Math.abs(t));return t<0&&(n=-n),l(n,-0)?0:n}(e):NaN}function s(e){if(null==e)throw new TypeError("undefined/null cannot be converted to object");return Object(e)}function l(e,t){return Object.is?Object.is(e,t):e===t?0!==e||1/e===1/t:e!==e&&t!==t}function u(e){return new Array(e)}function f(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function h(e){return null===e?"Null":"undefined"===typeof e?"Undefined":"function"===typeof e||"object"===typeof e?"Object":"number"===typeof e?"Number":"boolean"===typeof e?"Boolean":"string"===typeof e?"String":"symbol"===typeof e?"Symbol":"bigint"===typeof e?"BigInt":void 0}n.r(t);var d=864e5;function p(e,t){return e-Math.floor(e/t)*t}function z(e){return Math.floor(e/d)}function v(e){return p(z(e)+4,7)}function g(e){return Date.UTC(e,0)/d}function m(e){return Date.UTC(e,0)}function y(e){return new Date(e).getUTCFullYear()}function b(e){return e%4!==0?365:e%100!==0?366:e%400!==0?365:366}function w(e){return z(e)-g(y(e))}function k(e){return 365===b(y(e))?0:1}function x(e){var t=w(e),n=k(e);if(t>=0&&t<31)return 0;if(t<59+n)return 1;if(t<90+n)return 2;if(t<120+n)return 3;if(t<151+n)return 4;if(t<181+n)return 5;if(t<212+n)return 6;if(t<243+n)return 7;if(t<273+n)return 8;if(t<304+n)return 9;if(t<334+n)return 10;if(t<365+n)return 11;throw new Error("Invalid time")}function j(e){var t=w(e),n=x(e),r=k(e);if(0===n)return t+1;if(1===n)return t-30;if(2===n)return t-58-r;if(3===n)return t-89-r;if(4===n)return t-119-r;if(5===n)return t-150-r;if(6===n)return t-180-r;if(7===n)return t-211-r;if(8===n)return t-242-r;if(9===n)return t-272-r;if(10===n)return t-303-r;if(11===n)return t-333-r;throw new Error("Invalid time")}var M=24,_=60,C=60,q=1e3,S=q*C,O=S*_;function T(e){return p(Math.floor(e/O),M)}function E(e){return p(Math.floor(e/S),_)}function A(e){return p(Math.floor(e/q),C)}function H(e,t,n){if("function"!==typeof e)return!1;if(null===n||void 0===n?void 0:n.boundTargetFunction)return t instanceof(null===n||void 0===n?void 0:n.boundTargetFunction);if("object"!==typeof t)return!1;var r=e.prototype;if("object"!==typeof r)throw new TypeError("OrdinaryHasInstance called on an object with an invalid prototype property.");return Object.prototype.isPrototypeOf.call(r,t)}function L(e){return p(e,q)}function D(e){return"undefined"===typeof e?Object.create(null):s(e)}function P(e,t,n,r){if(void 0!==e){if(e=Number(e),isNaN(e)||en)throw new RangeError(e+" is outside of range ["+t+", "+n+"]");return Math.floor(e)}return r}function V(e,t,n,r,i){return P(e[t],n,r,i)}function N(e,t,n,r,i){if("object"!==typeof e)throw new TypeError("Options must be an object");var a=e[t];if(void 0!==a){if("boolean"!==n&&"string"!==n)throw new TypeError("invalid type");if("boolean"===n&&(a=Boolean(a)),"string"===n&&(a=o(a)),void 0!==r&&!r.filter((function(e){return e==a})).length)throw new RangeError(a+" is not within "+r.join(", "));return a}return i}function I(e){if("undefined"===typeof e)return Object.create(null);if("object"===typeof e)return e;throw new TypeError("Options must be an object")}var R=["angle-degree","area-acre","area-hectare","concentr-percent","digital-bit","digital-byte","digital-gigabit","digital-gigabyte","digital-kilobit","digital-kilobyte","digital-megabit","digital-megabyte","digital-petabyte","digital-terabit","digital-terabyte","duration-day","duration-hour","duration-millisecond","duration-minute","duration-month","duration-second","duration-week","duration-year","length-centimeter","length-foot","length-inch","length-kilometer","length-meter","length-mile-scandinavian","length-mile","length-millimeter","length-yard","mass-gram","mass-kilogram","mass-ounce","mass-pound","mass-stone","temperature-celsius","temperature-fahrenheit","volume-fluid-ounce","volume-gallon","volume-liter","volume-milliliter"];function B(e){return e.slice(e.indexOf("-")+1)}var F=R.map(B);function U(e){return F.indexOf(e)>-1}function W(e,t){var n=t.tzData,r=t.uppercaseLinks,i=e.toUpperCase(),o=new Set,a=new Set;return Object.keys(n).map((function(e){return e.toUpperCase()})).forEach((function(e){return o.add(e)})),Object.keys(r).forEach((function(e){a.add(e.toUpperCase()),o.add(r[e].toUpperCase())})),o.has(i)||a.has(i)}var G=/[^A-Z]/;function Y(e){return 3===(e=e.replace(/([a-z])/g,(function(e,t){return t.toUpperCase()}))).length&&!G.test(e)}function Z(e){if(U(e=e.replace(/([A-Z])/g,(function(e,t){return t.toLowerCase()}))))return!0;var t=e.split("-per-");if(2!==t.length)return!1;var n=t[0],r=t[1];return!(!U(n)||!U(r))}function $(e){return Math.floor(Math.log(e)*Math.LOG10E)}function X(e,t){if("function"===typeof e.repeat)return e.repeat(t);for(var n=new Array(t),r=0;rd[d.length-1])return d[d.length-1].length-1;var p=d.indexOf(h);if(-1===p)return 0;var z=d[p];return"0"===u[z].other?0:z.length-u[z].other.match(/0+/)[0].length}}function oe(e,t,n){var r,i,o,a,c=n;if(0===e)r=X("0",c),i=0,o=0;else{var s=e.toString(),l=s.indexOf("e"),u=s.split("e"),f=u[0],h=u[1],d=f.replace(".","");if(l>=0&&d.length<=c)i=+h,r=d+X("0",c-d.length),o=e;else{var p=(i=$(e))-c+1,z=Math.round(g(e,p));g(z,c-1)>=10&&(i+=1,z=Math.floor(z/10)),r=z.toString(),o=g(z,c-1-i)}}if(i>=c-1?(r+=X("0",i-c+1),a=i+1):i>=0?(r=r.slice(0,i+1)+"."+r.slice(i+1),a=i+1):(r="0."+X("0",-i-1)+r,a=1),r.indexOf(".")>=0&&n>t){for(var v=n-t;v>0&&"0"===r[r.length-1];)r=r.slice(0,-1),v--;"."===r[r.length-1]&&(r=r.slice(0,-1))}return{formattedString:r,roundedNumber:o,integerDigitsCount:a};function g(e,t){return t<0?e*Math.pow(10,-t):e/Math.pow(10,t)}}function ae(e,t,n){var r,i,o=n,a=Math.round(e*Math.pow(10,o)),c=a/Math.pow(10,o);if(a<1e21)r=a.toString();else{var s=(r=a.toString()).split("e"),l=s[0],u=s[1];r=l.replace(".",""),r+=X("0",Math.max(+u-r.length+1,0))}if(0!==o){var f=r.length;if(f<=o)r=X("0",o+1-f)+r,f=o+1;var h=r.slice(0,f-o),d=r.slice(f-o);r=h+"."+d,i=h.length}else i=r.length;for(var p=n-t;p>0&&"0"===r[r.length-1];)r=r.slice(0,-1),p--;return"."===r[r.length-1]&&(r=r.slice(0,-1)),{formattedString:r,roundedNumber:c,integerDigitsCount:i}}function ce(e,t){var n,r=t<0||l(t,-0);switch(r&&(t=-t),e.roundingType){case"significantDigits":n=oe(t,e.minimumSignificantDigits,e.maximumSignificantDigits);break;case"fractionDigits":n=ae(t,e.minimumFractionDigits,e.maximumFractionDigits);break;default:(n=oe(t,1,2)).integerDigitsCount>1&&(n=ae(t,0,0))}t=n.roundedNumber;var i=n.formattedString,o=n.integerDigitsCount,a=e.minimumIntegerDigits;o\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/,he=new RegExp("^"+fe.source),de=new RegExp(fe.source+"$"),pe=/[#0](?:[\.,][#0]+)*/g;function ze(e,t,n,r){var i,o,a=e.sign,c=e.exponent,s=e.magnitude,l=r.notation,u=r.style,f=r.numberingSystem,h=t.numbers.nu[0],d=null;if("compact"===l&&s&&(d=function(e,t,n,r,i,o,a){var c,s,l=e.roundedNumber,u=e.sign,f=e.magnitude,h=String(Math.pow(10,f)),d=n.numbers.nu[0];if("currency"===r&&"name"!==o){var p=(v=n.numbers.currency)[a]||v[d],z=null===(c=p.short)||void 0===c?void 0:c[h];if(!z)return null;s=me(t,l,z)}else{var v,g=((v=n.numbers.decimal)[a]||v[d])[i][h];if(!g)return null;s=me(t,l,g)}if("0"===s)return null;return s=ge(s,u).replace(/([^\s;\-\+\d\xa4]+)/g,"{c:$1}").replace(/0+/,"0")}(e,n,t,u,r.compactDisplay,r.currencyDisplay,f)),"currency"===u&&"name"!==r.currencyDisplay){var p=t.currencies[r.currency];if(p)switch(r.currencyDisplay){case"code":i=r.currency;break;case"symbol":i=p.symbol;break;default:i=p.narrow}else i=r.currency}if(d)o=d;else if("decimal"===u||"unit"===u||"currency"===u&&"name"===r.currencyDisplay)o=ge((t.numbers.decimal[f]||t.numbers.decimal[h]).standard,a);else if("currency"===u){o=ge((v=t.numbers.currency[f]||t.numbers.currency[h])[r.currencySign],a)}else{o=ge(t.numbers.percent[f]||t.numbers.percent[h],a)}var z=pe.exec(o)[0];if(o=o.replace(pe,"{0}").replace(/'(.)'/g,"$1"),"currency"===u&&"name"!==r.currencyDisplay){var v,g=(v=t.numbers.currency[f]||t.numbers.currency[h]).currencySpacing.afterInsertBetween;g&&!de.test(i)&&(o=o.replace("\xa4{0}","\xa4"+g+"{0}"));var m=v.currencySpacing.beforeInsertBetween;m&&!he.test(i)&&(o=o.replace("{0}\xa4","{0}"+m+"\xa4"))}for(var y=o.split(/({c:[^}]+}|\{0\}|[\xa4%\-\+])/g),b=[],w=t.numbers.symbols[f]||t.numbers.symbols[h],k=0,x=y;k0?(f=s.slice(0,d),h=s.slice(d+1)):f=s,o&&("compact"!==n||l>=1e4)){var p=e.group,z=[],v=a.split(".")[0].split(","),g=3,m=3;v.length>1&&(g=v[v.length-1].length),v.length>2&&(m=v[v.length-2].length);var y=f.length-g;if(y>0){for(z.push(f.slice(y,y+g)),y-=m;y>0;y-=m)z.push(f.slice(y,y+m));z.push(f.slice(0,y+m))}else z.push(f);for(;z.length>0;){var b=z.pop();c.push({type:"integer",value:b}),z.length>0&&c.push({type:"group",value:p})}}else c.push({type:"integer",value:f});if(void 0!==h&&c.push({type:"decimal",value:e.decimal},{type:"fraction",value:h}),("scientific"===n||"engineering"===n)&&isFinite(l)){c.push({type:"exponentSeparator",value:e.exponential}),r<0&&(c.push({type:"exponentMinusSign",value:e.minusSign}),r=-r);var w=ae(r,0,0);c.push({type:"exponentInteger",value:w.formattedString})}return c}function ge(e,t){e.indexOf(";")<0&&(e=e+";-"+e);var n=e.split(";"),r=n[0],i=n[1];switch(t){case 0:return r;case-1:return i;default:return i.indexOf("-")>=0?i.replace(/-/g,"+"):"+"+r}}function me(e,t,n){return n[e.select(t)]||n.other}function ye(e,t,n){var r,i,o,a=n.getInternalSlots,c=a(e),s=c.pl,u=c.dataLocaleData,f=c.numberingSystem,h=u.numbers.symbols[f]||u.numbers.symbols[u.numbers.nu[0]],d=0,p=0;if(isNaN(t))i=h.nan;else if(isFinite(t)){"percent"===c.style&&(t*=100),p=(r=se(e,t,{getInternalSlots:a}))[0],d=r[1];var z=ce(c,t=p<0?t*Math.pow(10,-p):t/Math.pow(10,p));i=z.formattedString,t=z.roundedNumber}else i=h.infinity;switch(c.signDisplay){case"never":o=0;break;case"auto":o=l(t,0)||t>0||isNaN(t)?0:-1;break;case"always":o=l(t,0)||t>0||isNaN(t)?1:-1;break;default:o=0===t||isNaN(t)?0:t>0?1:-1}return ze({roundedNumber:t,formattedString:i,exponent:p,magnitude:d,sign:o},c.dataLocaleData,s,c)}function be(e,t,n){for(var r=ye(e,t,n),i=u(0),o=0,a=r;o-1;)re((r=e.indexOf("}",n))>n,"Invalid pattern "+e),n>i&&t.push({type:"literal",value:e.substring(i,n)}),t.push({type:e.substring(n+1,r),value:void 0}),i=r+1,n=e.indexOf("{",i);return iu)return-1;null!==s&&void 0!==s||(s=0);var f,h=function(e){return e>=0&&ea){if(s>0&&h(f=d-1)&&c[f]a)return d;e=a,t=c,n=s,r=d+1,i=u,o=!0,h=d=p=f=void 0}}},t.dateParser=function(e){var t,n;if((-1==e.search("-")||-1!=e.search("T")||-1!=e.search("Z"))&&(n=z(e))&&!isNaN(n))return n;if(-1!=e.search("-")){for(t=e.replace("-","/","g");-1!=t.search("-");)t=t.replace("-","/");n=z(t)}else 8==e.length?(t=e.substr(0,4)+"/"+e.substr(4,2)+"/"+e.substr(6,2),n=z(t)):n=z(e);n&&!isNaN(n)||console.error("Couldn't parse "+e+" as a date");return n},t.dateStrToMillis=z,t.update=function(e,t){if("undefined"!=typeof t&&null!==t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},t.updateDeep=function e(t,n){function r(e){return"object"===typeof Node?e instanceof Node:"object"===typeof e&&"number"===typeof e.nodeType&&"string"===typeof e.nodeName}if("undefined"!=typeof n&&null!==n)for(var i in n)n.hasOwnProperty(i)&&(null===n[i]?t[i]=null:v(n[i])?t[i]=n[i].slice():r(n[i])?t[i]=n[i]:"object"==typeof n[i]?("object"==typeof t[i]&&null!==t[i]||(t[i]={}),e(t[i],n[i])):t[i]=n[i]);return t},t.isArrayLike=v,t.isDateLike=function(e){if("object"!=typeof e||null===e||"function"!=typeof e.getTime)return!1;return!0},t.clone=function e(t){for(var n=[],r=0;r=t||m.call(window,(function(){var t=(new Date).getTime()-a;i=o;var l=(o=Math.floor(t/n))-i;o+l>c||o>=c?(e(c),r()):(0!==l&&e(o),s())}))}()},t.isPixelChangingOptionList=function(e,t){var n={};if(e)for(var r=1;r=r.Granularity.DECADAL)return""+o;if(t>=r.Granularity.MONTHLY)return q[a]+" "+o;if(0===3600*s+60*d+p+.001*z||t>=r.Granularity.DAILY)return l(c)+" "+q[a];if(tr.Granularity.MINUTELY?h(s,d,p,0):h(s,d,p,z)},t.dateValueFormatter=function(e,t){return d(e,t("labelsUTC"))};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(n(202));t.LOG_SCALE=10;var i=Math.log(10);t.LN_TEN=i;var o=function(e){return Math.log(e)/i};t.log10=o;t.logRangeFraction=function(e,t,n){var r=o(e),i=r+n*(o(t)-r);return Math.pow(10,i)};t.DOTTED_LINE=[2,2];t.DASHED_LINE=[7,3];t.DOT_DASH_LINE=[7,2,2,2];t.HORIZONTAL=1;t.VERTICAL=2;t.getContext=function(e){return e.getContext("2d")};function a(e){return!e.pageX||e.pageX<0?0:e.pageX}function c(e){return!e.pageY||e.pageY<0?0:e.pageY}function s(e,t){var n=Math.min(Math.max(1,t||2),21);return Math.abs(e)<.001&&0!==e?e.toExponential(n-1):e.toPrecision(n)}function l(e){return e<10?"0"+e:""+e}t.addEvent=function(e,t,n){e.addEventListener(t,n,!1)};var u={getFullYear:function(e){return e.getFullYear()},getMonth:function(e){return e.getMonth()},getDate:function(e){return e.getDate()},getHours:function(e){return e.getHours()},getMinutes:function(e){return e.getMinutes()},getSeconds:function(e){return e.getSeconds()},getMilliseconds:function(e){return e.getMilliseconds()},getDay:function(e){return e.getDay()},makeDate:function(e,t,n,r,i,o,a){return new Date(e,t,n,r,i,o,a)}};t.DateAccessorsLocal=u;var f={getFullYear:function(e){return e.getUTCFullYear()},getMonth:function(e){return e.getUTCMonth()},getDate:function(e){return e.getUTCDate()},getHours:function(e){return e.getUTCHours()},getMinutes:function(e){return e.getUTCMinutes()},getSeconds:function(e){return e.getUTCSeconds()},getMilliseconds:function(e){return e.getUTCMilliseconds()},getDay:function(e){return e.getUTCDay()},makeDate:function(e,t,n,r,i,o,a){return new Date(Date.UTC(e,t,n,r,i,o,a))}};function h(e,t,n,r){var i=l(e)+":"+l(t);if(n&&(i+=":"+l(n),r)){var o=""+r;i+="."+("000"+o).substring(o.length)}return i}function d(e,t){var n=t?f:u,r=new Date(e),i=n.getFullYear(r),o=n.getMonth(r),a=n.getDate(r),c=n.getHours(r),s=n.getMinutes(r),d=n.getSeconds(r),p=n.getMilliseconds(r),z=""+i+"/"+l(o+1)+"/"+l(a);return 3600*c+60*s+d+.001*p&&(z+=" "+h(c,s,d,p)),z}function p(e,t){var n=Math.pow(10,t);return Math.round(e*n)/n}function z(e){return new Date(e).getTime()}function v(e){var t=typeof e;return("object"==t||"function"==t&&"function"==typeof e.item)&&null!==e&&"number"==typeof e.length&&3!==e.nodeType}function g(e,t,n,r){t=t||0,n=n||e.length,this.hasNext=!0,this.peek=null,this.start_=t,this.array_=e,this.predicate_=r,this.end_=Math.min(e.length,t+n),this.nextIdx_=t-1,this.next()}t.DateAccessorsUTC=f,g.prototype.next=function(){if(!this.hasNext)return null;for(var e=this.peek,t=this.nextIdx_+1,n=!1;t=Math.pow(10,o)||Math.abs(e)=0;z--,d/=l)if(h>=d){r=p(e/d,i)+u[z];break}if(c){var v=String(e.toExponential()).split("e-");2===v.length&&v[1]>=3&&v[1]<=24&&(r=v[1]%3>0?p(v[0]/w(10,v[1]%3),i):Number(v[0]).toFixed(2),r+=f[Math.floor(v[1]/3)-1])}}return r}var q=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]},function(e,t,n){"use strict";t.a=Array.isArray||function(e){return null!=e&&e.length>=0&&"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){"use strict";function r(e){return"[object String]"===Object.prototype.toString.call(e)}n.d(t,"a",(function(){return r}))},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(25),i=n(24),o=n(20);function a(e,t){Object(o.a)(1,arguments);var n=t||{},a=n.locale,c=a&&a.options&&a.options.weekStartsOn,s=null==c?0:Object(r.a)(c),l=null==n.weekStartsOn?s:Object(r.a)(n.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=Object(i.a)(e),f=u.getUTCDay(),h=(f=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=Object(i.default)(e),f=u.getUTCDay(),h=(f0&&t.forEach((function(e){o.remove(e)})),o.appendTo(n.scrollbarXRail,e)),e.contains(n.scrollbarYRail)||((t=o.queryChildren(e,".ps-scrollbar-y-rail")).length>0&&t.forEach((function(e){o.remove(e)})),o.appendTo(n.scrollbarYRail,e)),!n.settings.suppressScrollX&&n.containerWidth+n.settings.scrollXMarginOffset=n.railXWidth-n.scrollbarXWidth&&(n.scrollbarXLeft=n.railXWidth-n.scrollbarXWidth),n.scrollbarYTop>=n.railYHeight-n.scrollbarYHeight&&(n.scrollbarYTop=n.railYHeight-n.scrollbarYHeight),function(e,t){var n={width:t.railXWidth};t.isRtl?n.left=t.negativeScrollAdjustment+e.scrollLeft+t.containerWidth-t.contentWidth:n.left=e.scrollLeft,t.isScrollbarXUsingBottom?n.bottom=t.scrollbarXBottom-e.scrollTop:n.top=t.scrollbarXTop+e.scrollTop,o.css(t.scrollbarXRail,n);var r={top:e.scrollTop,height:t.railYHeight};t.isScrollbarYUsingRight?t.isRtl?r.right=t.contentWidth-(t.negativeScrollAdjustment+e.scrollLeft)-t.scrollbarYRight-t.scrollbarYOuterWidth:r.right=t.scrollbarYRight-e.scrollLeft:t.isRtl?r.left=t.negativeScrollAdjustment+e.scrollLeft+2*t.containerWidth-t.contentWidth-t.scrollbarYLeft-t.scrollbarYOuterWidth:r.left=t.scrollbarYLeft+e.scrollLeft,o.css(t.scrollbarYRail,r),o.css(t.scrollbarX,{left:t.scrollbarXLeft,width:t.scrollbarXWidth-t.railBorderXWidth}),o.css(t.scrollbarY,{top:t.scrollbarYTop,height:t.scrollbarYHeight-t.railBorderYWidth})}(e,n),n.scrollbarXActive?i.add(e,"ps-active-x"):(i.remove(e,"ps-active-x"),n.scrollbarXWidth=0,n.scrollbarXLeft=0,c(e,"left",0)),n.scrollbarYActive?i.add(e,"ps-active-y"):(i.remove(e,"ps-active-y"),n.scrollbarYHeight=0,n.scrollbarYTop=0,c(e,"top",0))}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,i,o,a,c){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,i,o,a,c],u=0;(s=new Error(t.replace(/%s/g,(function(){return l[u++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},function(e,t,n){"use strict";function r(e){setTimeout((function(){throw e}),0)}n.d(t,"a",(function(){return r}))},,,function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(r){"object"===typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r,i,o=n(64),a=function(e){var t=document.createEvent("Event");return t.initEvent(e,!0,!0),t};e.exports=function(e,t,n){if("undefined"===typeof e)throw"You must provide an element to the update-scroll function";if("undefined"===typeof t)throw"You must provide an axis to the update-scroll function";if("undefined"===typeof n)throw"You must provide a value to the update-scroll function";"top"===t&&n<=0&&(e.scrollTop=n=0,e.dispatchEvent(a("ps-y-reach-start"))),"left"===t&&n<=0&&(e.scrollLeft=n=0,e.dispatchEvent(a("ps-x-reach-start")));var c=o.get(e);"top"===t&&n>=c.contentHeight-c.containerHeight&&((n=c.contentHeight-c.containerHeight)-e.scrollTop<=1?n=e.scrollTop:e.scrollTop=n,e.dispatchEvent(a("ps-y-reach-end"))),"left"===t&&n>=c.contentWidth-c.containerWidth&&((n=c.contentWidth-c.containerWidth)-e.scrollLeft<=1?n=e.scrollLeft:e.scrollLeft=n,e.dispatchEvent(a("ps-x-reach-end"))),r||(r=e.scrollTop),i||(i=e.scrollLeft),"top"===t&&nr&&e.dispatchEvent(a("ps-scroll-down")),"left"===t&&ni&&e.dispatchEvent(a("ps-scroll-right")),"top"===t&&(e.scrollTop=r=n,e.dispatchEvent(a("ps-scroll-y"))),"left"===t&&(e.scrollLeft=i=n,e.dispatchEvent(a("ps-scroll-x")))}},function(e,t,n){e.exports=n(318)},function(e,t,n){"use strict";function r(){return"function"===typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator"}n.d(t,"a",(function(){return i}));var i=r()},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(31),i=function(e){function t(t,n,r){var i=e.call(this)||this;return i.parent=t,i.outerValue=n,i.outerIndex=r,i.index=0,i}return r.b(t,e),t.prototype._next=function(e){this.parent.notifyNext(this.outerValue,e,this.outerIndex,this.index++,this)},t.prototype._error=function(e){this.parent.notifyError(e,this),this.unsubscribe()},t.prototype._complete=function(){this.parent.notifyComplete(this),this.unsubscribe()},t}(n(52).a)},function(e,t,n){"use strict";n.d(t,"a",(function(){return r}));var r=function(){function e(e){void 0===e&&(e={}),this.adapter_=e}return Object.defineProperty(e,"cssClasses",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"strings",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"numbers",{get:function(){return{}},enumerable:!0,configurable:!0}),Object.defineProperty(e,"defaultAdapter",{get:function(){return{}},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.destroy=function(){},e}()},function(e,t,n){"use strict";var r=n(30),i=n(69),o=n(70),a=Object(r.a)((function(e){return!!Object(i.a)(e)||!!e&&("object"===typeof e&&(!Object(o.a)(e)&&(1===e.nodeType?!!e.length:0===e.length||e.length>0&&(e.hasOwnProperty(0)&&e.hasOwnProperty(e.length-1)))))})),c=function(){function e(e){this.f=e}return e.prototype["@@transducer/init"]=function(){throw new Error("init not implemented on XWrap")},e.prototype["@@transducer/result"]=function(e){return e},e.prototype["@@transducer/step"]=function(e,t){return this.f(e,t)},e}();var s=n(67),l=n(19),u=Object(l.a)((function(e,t){return Object(s.a)(e.length,(function(){return e.apply(t,arguments)}))}));function f(e,t,n){for(var r=n.next();!r.done;){if((t=e["@@transducer/step"](t,r.value))&&t["@@transducer/reduced"]){t=t["@@transducer/value"];break}r=n.next()}return e["@@transducer/result"](t)}function h(e,t,n,r){return e["@@transducer/result"](n[r](u(e["@@transducer/step"],e),t))}n.d(t,"a",(function(){return p}));var d="undefined"!==typeof Symbol?Symbol.iterator:"@@iterator";function p(e,t,n){if("function"===typeof e&&(e=function(e){return new c(e)}(e)),a(n))return function(e,t,n){for(var r=0,i=n.length;r>>0;for(t=0;t0)for(n=0;n=0?n?"+":"":"-")+Math.pow(10,Math.max(0,i)).toString().substr(1)+r}r.suppressDeprecationWarnings=!1,r.deprecationHandler=null,j=Object.keys?Object.keys:function(e){var t,n=[];for(t in e)a(e,t)&&n.push(t);return n};var T=/(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,E=/(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,A={},H={};function L(e,t,n,r){var i=r;"string"===typeof r&&(i=function(){return this[r]()}),e&&(H[e]=i),t&&(H[t[0]]=function(){return O(i.apply(this,arguments),t[1],t[2])}),n&&(H[n]=function(){return this.localeData().ordinal(i.apply(this,arguments),e)})}function D(e,t){return e.isValid()?(t=P(t,e.localeData()),A[t]=A[t]||function(e){var t,n,r,i=e.match(T);for(t=0,n=i.length;t=0&&E.test(e);)e=e.replace(E,r),E.lastIndex=0,n-=1;return e}var V={};function N(e,t){var n=e.toLowerCase();V[n]=V[n+"s"]=V[t]=e}function I(e){return"string"===typeof e?V[e]||V[e.toLowerCase()]:void 0}function R(e){var t,n,r={};for(n in e)a(e,n)&&(t=I(n))&&(r[t]=e[n]);return r}var B={};function F(e,t){B[e]=t}function U(e){return e%4===0&&e%100!==0||e%400===0}function W(e){return e<0?Math.ceil(e)||0:Math.floor(e)}function G(e){var t=+e,n=0;return 0!==t&&isFinite(t)&&(n=W(t)),n}function Y(e,t){return function(n){return null!=n?($(this,e,n),r.updateOffset(this,t),this):Z(this,e)}}function Z(e,t){return e.isValid()?e._d["get"+(e._isUTC?"UTC":"")+t]():NaN}function $(e,t,n){e.isValid()&&!isNaN(n)&&("FullYear"===t&&U(e.year())&&1===e.month()&&29===e.date()?(n=G(n),e._d["set"+(e._isUTC?"UTC":"")+t](n,e.month(),Oe(n,e.month()))):e._d["set"+(e._isUTC?"UTC":"")+t](n))}var X,K=/\d/,Q=/\d\d/,J=/\d{3}/,ee=/\d{4}/,te=/[+-]?\d{6}/,ne=/\d\d?/,re=/\d\d\d\d?/,ie=/\d\d\d\d\d\d?/,oe=/\d{1,3}/,ae=/\d{1,4}/,ce=/[+-]?\d{1,6}/,se=/\d+/,le=/[+-]?\d+/,ue=/Z|[+-]\d\d:?\d\d/gi,fe=/Z|[+-]\d\d(?::?\d\d)?/gi,he=/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i;function de(e,t,n){X[e]=C(t)?t:function(e,r){return e&&n?n:t}}function pe(e,t){return a(X,e)?X[e](t._strict,t._locale):new RegExp(ze(e.replace("\\","").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,(function(e,t,n,r,i){return t||n||r||i}))))}function ze(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}X={};var ve={};function ge(e,t){var n,r=t;for("string"===typeof e&&(e=[e]),l(t)&&(r=function(e,n){n[t]=G(e)}),n=0;n68?1900:2e3)};var Re=Y("FullYear",!0);function Be(e,t,n,r,i,o,a){var c;return e<100&&e>=0?(c=new Date(e+400,t,n,r,i,o,a),isFinite(c.getFullYear())&&c.setFullYear(e)):c=new Date(e,t,n,r,i,o,a),c}function Fe(e){var t,n;return e<100&&e>=0?((n=Array.prototype.slice.call(arguments))[0]=e+400,t=new Date(Date.UTC.apply(null,n)),isFinite(t.getUTCFullYear())&&t.setUTCFullYear(e)):t=new Date(Date.UTC.apply(null,arguments)),t}function Ue(e,t,n){var r=7+t-n;return-(7+Fe(e,0,r).getUTCDay()-t)%7+r-1}function We(e,t,n,r,i){var o,a,c=1+7*(t-1)+(7+n-r)%7+Ue(e,r,i);return c<=0?a=Ie(o=e-1)+c:c>Ie(e)?(o=e+1,a=c-Ie(e)):(o=e,a=c),{year:o,dayOfYear:a}}function Ge(e,t,n){var r,i,o=Ue(e.year(),t,n),a=Math.floor((e.dayOfYear()-o-1)/7)+1;return a<1?r=a+Ye(i=e.year()-1,t,n):a>Ye(e.year(),t,n)?(r=a-Ye(e.year(),t,n),i=e.year()+1):(i=e.year(),r=a),{week:r,year:i}}function Ye(e,t,n){var r=Ue(e,t,n),i=Ue(e+1,t,n);return(Ie(e)-r+i)/7}function Ze(e,t){return e.slice(t,7).concat(e.slice(0,t))}L("w",["ww",2],"wo","week"),L("W",["WW",2],"Wo","isoWeek"),N("week","w"),N("isoWeek","W"),F("week",5),F("isoWeek",5),de("w",ne),de("ww",ne,Q),de("W",ne),de("WW",ne,Q),me(["w","ww","W","WW"],(function(e,t,n,r){t[r.substr(0,1)]=G(e)})),L("d",0,"do","day"),L("dd",0,0,(function(e){return this.localeData().weekdaysMin(this,e)})),L("ddd",0,0,(function(e){return this.localeData().weekdaysShort(this,e)})),L("dddd",0,0,(function(e){return this.localeData().weekdays(this,e)})),L("e",0,0,"weekday"),L("E",0,0,"isoWeekday"),N("day","d"),N("weekday","e"),N("isoWeekday","E"),F("day",11),F("weekday",11),F("isoWeekday",11),de("d",ne),de("e",ne),de("E",ne),de("dd",(function(e,t){return t.weekdaysMinRegex(e)})),de("ddd",(function(e,t){return t.weekdaysShortRegex(e)})),de("dddd",(function(e,t){return t.weekdaysRegex(e)})),me(["dd","ddd","dddd"],(function(e,t,n,r){var i=n._locale.weekdaysParse(e,r,n._strict);null!=i?t.d=i:p(n).invalidWeekday=e})),me(["d","e","E"],(function(e,t,n,r){t[r]=G(e)}));var $e="Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),Xe="Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),Ke="Su_Mo_Tu_We_Th_Fr_Sa".split("_"),Qe=he,Je=he,et=he;function tt(e,t,n){var r,i,o,a=e.toLocaleLowerCase();if(!this._weekdaysParse)for(this._weekdaysParse=[],this._shortWeekdaysParse=[],this._minWeekdaysParse=[],r=0;r<7;++r)o=d([2e3,1]).day(r),this._minWeekdaysParse[r]=this.weekdaysMin(o,"").toLocaleLowerCase(),this._shortWeekdaysParse[r]=this.weekdaysShort(o,"").toLocaleLowerCase(),this._weekdaysParse[r]=this.weekdays(o,"").toLocaleLowerCase();return n?"dddd"===t?-1!==(i=be.call(this._weekdaysParse,a))?i:null:"ddd"===t?-1!==(i=be.call(this._shortWeekdaysParse,a))?i:null:-1!==(i=be.call(this._minWeekdaysParse,a))?i:null:"dddd"===t?-1!==(i=be.call(this._weekdaysParse,a))?i:-1!==(i=be.call(this._shortWeekdaysParse,a))?i:-1!==(i=be.call(this._minWeekdaysParse,a))?i:null:"ddd"===t?-1!==(i=be.call(this._shortWeekdaysParse,a))?i:-1!==(i=be.call(this._weekdaysParse,a))?i:-1!==(i=be.call(this._minWeekdaysParse,a))?i:null:-1!==(i=be.call(this._minWeekdaysParse,a))?i:-1!==(i=be.call(this._weekdaysParse,a))?i:-1!==(i=be.call(this._shortWeekdaysParse,a))?i:null}function nt(){function e(e,t){return t.length-e.length}var t,n,r,i,o,a=[],c=[],s=[],l=[];for(t=0;t<7;t++)n=d([2e3,1]).day(t),r=ze(this.weekdaysMin(n,"")),i=ze(this.weekdaysShort(n,"")),o=ze(this.weekdays(n,"")),a.push(r),c.push(i),s.push(o),l.push(r),l.push(i),l.push(o);a.sort(e),c.sort(e),s.sort(e),l.sort(e),this._weekdaysRegex=new RegExp("^("+l.join("|")+")","i"),this._weekdaysShortRegex=this._weekdaysRegex,this._weekdaysMinRegex=this._weekdaysRegex,this._weekdaysStrictRegex=new RegExp("^("+s.join("|")+")","i"),this._weekdaysShortStrictRegex=new RegExp("^("+c.join("|")+")","i"),this._weekdaysMinStrictRegex=new RegExp("^("+a.join("|")+")","i")}function rt(){return this.hours()%12||12}function it(e,t){L(e,0,0,(function(){return this.localeData().meridiem(this.hours(),this.minutes(),t)}))}function ot(e,t){return t._meridiemParse}L("H",["HH",2],0,"hour"),L("h",["hh",2],0,rt),L("k",["kk",2],0,(function(){return this.hours()||24})),L("hmm",0,0,(function(){return""+rt.apply(this)+O(this.minutes(),2)})),L("hmmss",0,0,(function(){return""+rt.apply(this)+O(this.minutes(),2)+O(this.seconds(),2)})),L("Hmm",0,0,(function(){return""+this.hours()+O(this.minutes(),2)})),L("Hmmss",0,0,(function(){return""+this.hours()+O(this.minutes(),2)+O(this.seconds(),2)})),it("a",!0),it("A",!1),N("hour","h"),F("hour",13),de("a",ot),de("A",ot),de("H",ne),de("h",ne),de("k",ne),de("HH",ne,Q),de("hh",ne,Q),de("kk",ne,Q),de("hmm",re),de("hmmss",ie),de("Hmm",re),de("Hmmss",ie),ge(["H","HH"],je),ge(["k","kk"],(function(e,t,n){var r=G(e);t[je]=24===r?0:r})),ge(["a","A"],(function(e,t,n){n._isPm=n._locale.isPM(e),n._meridiem=e})),ge(["h","hh"],(function(e,t,n){t[je]=G(e),p(n).bigHour=!0})),ge("hmm",(function(e,t,n){var r=e.length-2;t[je]=G(e.substr(0,r)),t[Me]=G(e.substr(r)),p(n).bigHour=!0})),ge("hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[je]=G(e.substr(0,r)),t[Me]=G(e.substr(r,2)),t[_e]=G(e.substr(i)),p(n).bigHour=!0})),ge("Hmm",(function(e,t,n){var r=e.length-2;t[je]=G(e.substr(0,r)),t[Me]=G(e.substr(r))})),ge("Hmmss",(function(e,t,n){var r=e.length-4,i=e.length-2;t[je]=G(e.substr(0,r)),t[Me]=G(e.substr(r,2)),t[_e]=G(e.substr(i))}));var at,ct=Y("Hours",!0),st={calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},longDateFormat:{LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},invalidDate:"Invalid date",ordinal:"%d",dayOfMonthOrdinalParse:/\d{1,2}/,relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",ss:"%d seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",w:"a week",ww:"%d weeks",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},months:Te,monthsShort:Ee,week:{dow:0,doy:6},weekdays:$e,weekdaysMin:Ke,weekdaysShort:Xe,meridiemParse:/[ap]\.?m?\.?/i},lt={},ut={};function ft(e,t){var n,r=Math.min(e.length,t.length);for(n=0;n0;){if(r=dt(i.slice(0,t).join("-")))return r;if(n&&n.length>=t&&ft(i,n)>=t-1)break;t--}o++}return at}(e)}function gt(e){var t,n=e._a;return n&&-2===p(e).overflow&&(t=n[ke]<0||n[ke]>11?ke:n[xe]<1||n[xe]>Oe(n[we],n[ke])?xe:n[je]<0||n[je]>24||24===n[je]&&(0!==n[Me]||0!==n[_e]||0!==n[Ce])?je:n[Me]<0||n[Me]>59?Me:n[_e]<0||n[_e]>59?_e:n[Ce]<0||n[Ce]>999?Ce:-1,p(e)._overflowDayOfYear&&(txe)&&(t=xe),p(e)._overflowWeeks&&-1===t&&(t=qe),p(e)._overflowWeekday&&-1===t&&(t=Se),p(e).overflow=t),e}var mt=/^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,yt=/^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,bt=/Z|[+-]\d\d(?::?\d\d)?/,wt=[["YYYYYY-MM-DD",/[+-]\d{6}-\d\d-\d\d/],["YYYY-MM-DD",/\d{4}-\d\d-\d\d/],["GGGG-[W]WW-E",/\d{4}-W\d\d-\d/],["GGGG-[W]WW",/\d{4}-W\d\d/,!1],["YYYY-DDD",/\d{4}-\d{3}/],["YYYY-MM",/\d{4}-\d\d/,!1],["YYYYYYMMDD",/[+-]\d{10}/],["YYYYMMDD",/\d{8}/],["GGGG[W]WWE",/\d{4}W\d{3}/],["GGGG[W]WW",/\d{4}W\d{2}/,!1],["YYYYDDD",/\d{7}/],["YYYYMM",/\d{6}/,!1],["YYYY",/\d{4}/,!1]],kt=[["HH:mm:ss.SSSS",/\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss,SSSS",/\d\d:\d\d:\d\d,\d+/],["HH:mm:ss",/\d\d:\d\d:\d\d/],["HH:mm",/\d\d:\d\d/],["HHmmss.SSSS",/\d\d\d\d\d\d\.\d+/],["HHmmss,SSSS",/\d\d\d\d\d\d,\d+/],["HHmmss",/\d\d\d\d\d\d/],["HHmm",/\d\d\d\d/],["HH",/\d\d/]],xt=/^\/?Date\((-?\d+)/i,jt=/^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,Mt={UT:0,GMT:0,EDT:-240,EST:-300,CDT:-300,CST:-360,MDT:-360,MST:-420,PDT:-420,PST:-480};function _t(e){var t,n,r,i,o,a,c=e._i,s=mt.exec(c)||yt.exec(c);if(s){for(p(e).iso=!0,t=0,n=wt.length;t7)&&(s=!0)):(o=e._locale._week.dow,a=e._locale._week.doy,l=Ge(Ht(),o,a),n=St(t.gg,e._a[we],l.year),r=St(t.w,l.week),null!=t.d?((i=t.d)<0||i>6)&&(s=!0):null!=t.e?(i=t.e+o,(t.e<0||t.e>6)&&(s=!0)):i=o),r<1||r>Ye(n,o,a)?p(e)._overflowWeeks=!0:null!=s?p(e)._overflowWeekday=!0:(c=We(n,r,i,o,a),e._a[we]=c.year,e._dayOfYear=c.dayOfYear)}(e),null!=e._dayOfYear&&(a=St(e._a[we],i[we]),(e._dayOfYear>Ie(a)||0===e._dayOfYear)&&(p(e)._overflowDayOfYear=!0),n=Fe(a,0,e._dayOfYear),e._a[ke]=n.getUTCMonth(),e._a[xe]=n.getUTCDate()),t=0;t<3&&null==e._a[t];++t)e._a[t]=c[t]=i[t];for(;t<7;t++)e._a[t]=c[t]=null==e._a[t]?2===t?1:0:e._a[t];24===e._a[je]&&0===e._a[Me]&&0===e._a[_e]&&0===e._a[Ce]&&(e._nextDay=!0,e._a[je]=0),e._d=(e._useUTC?Fe:Be).apply(null,c),o=e._useUTC?e._d.getUTCDay():e._d.getDay(),null!=e._tzm&&e._d.setUTCMinutes(e._d.getUTCMinutes()-e._tzm),e._nextDay&&(e._a[je]=24),e._w&&"undefined"!==typeof e._w.d&&e._w.d!==o&&(p(e).weekdayMismatch=!0)}}function Tt(e){if(e._f!==r.ISO_8601)if(e._f!==r.RFC_2822){e._a=[],p(e).empty=!0;var t,n,i,o,a,c,s=""+e._i,l=s.length,u=0;for(i=P(e._f,e._locale).match(T)||[],t=0;t0&&p(e).unusedInput.push(a),s=s.slice(s.indexOf(n)+n.length),u+=n.length),H[o]?(n?p(e).empty=!1:p(e).unusedTokens.push(o),ye(o,n,e)):e._strict&&!n&&p(e).unusedTokens.push(o);p(e).charsLeftOver=l-u,s.length>0&&p(e).unusedInput.push(s),e._a[je]<=12&&!0===p(e).bigHour&&e._a[je]>0&&(p(e).bigHour=void 0),p(e).parsedDateParts=e._a.slice(0),p(e).meridiem=e._meridiem,e._a[je]=function(e,t,n){var r;return null==n?t:null!=e.meridiemHour?e.meridiemHour(t,n):null!=e.isPM?((r=e.isPM(n))&&t<12&&(t+=12),r||12!==t||(t=0),t):t}(e._locale,e._a[je],e._meridiem),null!==(c=p(e).era)&&(e._a[we]=e._locale.erasConvertYear(c,e._a[we])),Ot(e),gt(e)}else qt(e);else _t(e)}function Et(e){var t=e._i,n=e._f;return e._locale=e._locale||vt(e._l),null===t||void 0===n&&""===t?v({nullInput:!0}):("string"===typeof t&&(e._i=t=e._locale.preparse(t)),w(t)?new b(gt(t)):(u(t)?e._d=t:i(n)?function(e){var t,n,r,i,o,a,c=!1;if(0===e._f.length)return p(e).invalidFormat=!0,void(e._d=new Date(NaN));for(i=0;ithis?this:e:v()}));function Pt(e,t){var n,r;if(1===t.length&&i(t[0])&&(t=t[0]),!t.length)return Ht();for(n=t[0],r=1;r=0?new Date(e+400,t,n)-hn:new Date(e,t,n).valueOf()}function zn(e,t,n){return e<100&&e>=0?Date.UTC(e+400,t,n)-hn:Date.UTC(e,t,n)}function vn(e,t){return t.erasAbbrRegex(e)}function gn(){var e,t,n=[],r=[],i=[],o=[],a=this.eras();for(e=0,t=a.length;e(o=Ye(e,r,i))&&(t=o),bn.call(this,e,t,n,r,i))}function bn(e,t,n,r,i){var o=We(e,t,n,r,i),a=Fe(o.year,0,o.dayOfYear);return this.year(a.getUTCFullYear()),this.month(a.getUTCMonth()),this.date(a.getUTCDate()),this}L("N",0,0,"eraAbbr"),L("NN",0,0,"eraAbbr"),L("NNN",0,0,"eraAbbr"),L("NNNN",0,0,"eraName"),L("NNNNN",0,0,"eraNarrow"),L("y",["y",1],"yo","eraYear"),L("y",["yy",2],0,"eraYear"),L("y",["yyy",3],0,"eraYear"),L("y",["yyyy",4],0,"eraYear"),de("N",vn),de("NN",vn),de("NNN",vn),de("NNNN",(function(e,t){return t.erasNameRegex(e)})),de("NNNNN",(function(e,t){return t.erasNarrowRegex(e)})),ge(["N","NN","NNN","NNNN","NNNNN"],(function(e,t,n,r){var i=n._locale.erasParse(e,r,n._strict);i?p(n).era=i:p(n).invalidEra=e})),de("y",se),de("yy",se),de("yyy",se),de("yyyy",se),de("yo",(function(e,t){return t._eraYearOrdinalRegex||se})),ge(["y","yy","yyy","yyyy"],we),ge(["yo"],(function(e,t,n,r){var i;n._locale._eraYearOrdinalRegex&&(i=e.match(n._locale._eraYearOrdinalRegex)),n._locale.eraYearOrdinalParse?t[we]=n._locale.eraYearOrdinalParse(e,i):t[we]=parseInt(e,10)})),L(0,["gg",2],0,(function(){return this.weekYear()%100})),L(0,["GG",2],0,(function(){return this.isoWeekYear()%100})),mn("gggg","weekYear"),mn("ggggg","weekYear"),mn("GGGG","isoWeekYear"),mn("GGGGG","isoWeekYear"),N("weekYear","gg"),N("isoWeekYear","GG"),F("weekYear",1),F("isoWeekYear",1),de("G",le),de("g",le),de("GG",ne,Q),de("gg",ne,Q),de("GGGG",ae,ee),de("gggg",ae,ee),de("GGGGG",ce,te),de("ggggg",ce,te),me(["gggg","ggggg","GGGG","GGGGG"],(function(e,t,n,r){t[r.substr(0,2)]=G(e)})),me(["gg","GG"],(function(e,t,n,i){t[i]=r.parseTwoDigitYear(e)})),L("Q",0,"Qo","quarter"),N("quarter","Q"),F("quarter",7),de("Q",K),ge("Q",(function(e,t){t[ke]=3*(G(e)-1)})),L("D",["DD",2],"Do","date"),N("date","D"),F("date",9),de("D",ne),de("DD",ne,Q),de("Do",(function(e,t){return e?t._dayOfMonthOrdinalParse||t._ordinalParse:t._dayOfMonthOrdinalParseLenient})),ge(["D","DD"],xe),ge("Do",(function(e,t){t[xe]=G(e.match(ne)[0])}));var wn=Y("Date",!0);L("DDD",["DDDD",3],"DDDo","dayOfYear"),N("dayOfYear","DDD"),F("dayOfYear",4),de("DDD",oe),de("DDDD",J),ge(["DDD","DDDD"],(function(e,t,n){n._dayOfYear=G(e)})),L("m",["mm",2],0,"minute"),N("minute","m"),F("minute",14),de("m",ne),de("mm",ne,Q),ge(["m","mm"],Me);var kn=Y("Minutes",!1);L("s",["ss",2],0,"second"),N("second","s"),F("second",15),de("s",ne),de("ss",ne,Q),ge(["s","ss"],_e);var xn,jn,Mn=Y("Seconds",!1);for(L("S",0,0,(function(){return~~(this.millisecond()/100)})),L(0,["SS",2],0,(function(){return~~(this.millisecond()/10)})),L(0,["SSS",3],0,"millisecond"),L(0,["SSSS",4],0,(function(){return 10*this.millisecond()})),L(0,["SSSSS",5],0,(function(){return 100*this.millisecond()})),L(0,["SSSSSS",6],0,(function(){return 1e3*this.millisecond()})),L(0,["SSSSSSS",7],0,(function(){return 1e4*this.millisecond()})),L(0,["SSSSSSSS",8],0,(function(){return 1e5*this.millisecond()})),L(0,["SSSSSSSSS",9],0,(function(){return 1e6*this.millisecond()})),N("millisecond","ms"),F("millisecond",16),de("S",oe,K),de("SS",oe,Q),de("SSS",oe,J),xn="SSSS";xn.length<=9;xn+="S")de(xn,se);function _n(e,t){t[Ce]=G(1e3*("0."+e))}for(xn="S";xn.length<=9;xn+="S")ge(xn,_n);jn=Y("Milliseconds",!1),L("z",0,0,"zoneAbbr"),L("zz",0,0,"zoneName");var Cn=b.prototype;function qn(e){return e}Cn.add=tn,Cn.calendar=function(e,t){var n;1===arguments.length&&(arguments[0]?w(n=arguments[0])||u(n)||rn(n)||l(n)||function(e){var t=i(e),n=!1;return t&&(n=0===e.filter((function(t){return!l(t)&&rn(e)})).length),t&&n}(n)||function(e){var t,n,r=o(e)&&!c(e),i=!1,s=["years","year","y","months","month","M","days","day","d","dates","date","D","hours","hour","h","minutes","minute","m","seconds","second","s","milliseconds","millisecond","ms"];for(t=0;tn.valueOf():n.valueOf()9999?D(n,t?"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYYYY-MM-DD[T]HH:mm:ss.SSSZ"):C(Date.prototype.toISOString)?t?this.toDate().toISOString():new Date(this.valueOf()+60*this.utcOffset()*1e3).toISOString().replace("Z",D(n,"Z")):D(n,t?"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]":"YYYY-MM-DD[T]HH:mm:ss.SSSZ")},Cn.inspect=function(){if(!this.isValid())return"moment.invalid(/* "+this._i+" */)";var e,t,n,r="moment",i="";return this.isLocal()||(r=0===this.utcOffset()?"moment.utc":"moment.parseZone",i="Z"),e="["+r+'("]',t=0<=this.year()&&this.year()<=9999?"YYYY":"YYYYYY",n=i+'[")]',this.format(e+t+"-MM-DD[T]HH:mm:ss.SSS"+n)},"undefined"!==typeof Symbol&&null!=Symbol.for&&(Cn[Symbol.for("nodejs.util.inspect.custom")]=function(){return"Moment<"+this.format()+">"}),Cn.toJSON=function(){return this.isValid()?this.toISOString():null},Cn.toString=function(){return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},Cn.unix=function(){return Math.floor(this.valueOf()/1e3)},Cn.valueOf=function(){return this._d.valueOf()-6e4*(this._offset||0)},Cn.creationData=function(){return{input:this._i,format:this._f,locale:this._locale,isUTC:this._isUTC,strict:this._strict}},Cn.eraName=function(){var e,t,n,r=this.localeData().eras();for(e=0,t=r.length;ethis.clone().month(0).utcOffset()||this.utcOffset()>this.clone().month(5).utcOffset()},Cn.isLocal=function(){return!!this.isValid()&&!this._isUTC},Cn.isUtcOffset=function(){return!!this.isValid()&&this._isUTC},Cn.isUtc=Yt,Cn.isUTC=Yt,Cn.zoneAbbr=function(){return this._isUTC?"UTC":""},Cn.zoneName=function(){return this._isUTC?"Coordinated Universal Time":""},Cn.dates=x("dates accessor is deprecated. Use date instead.",wn),Cn.months=x("months accessor is deprecated. Use month instead",Ve),Cn.years=x("years accessor is deprecated. Use year instead",Re),Cn.zone=x("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/",(function(e,t){return null!=e?("string"!==typeof e&&(e=-e),this.utcOffset(e,t),this):-this.utcOffset()})),Cn.isDSTShifted=x("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information",(function(){if(!s(this._isDSTShifted))return this._isDSTShifted;var e,t={};return y(t,this),(t=Et(t))._a?(e=t._isUTC?d(t._a):Ht(t._a),this._isDSTShifted=this.isValid()&&function(e,t,n){var r,i=Math.min(e.length,t.length),o=Math.abs(e.length-t.length),a=0;for(r=0;r0):this._isDSTShifted=!1,this._isDSTShifted}));var Sn=S.prototype;function On(e,t,n,r){var i=vt(),o=d().set(r,t);return i[n](o,e)}function Tn(e,t,n){if(l(e)&&(t=e,e=void 0),e=e||"",null!=t)return On(e,t,n,"month");var r,i=[];for(r=0;r<12;r++)i[r]=On(e,r,n,"month");return i}function En(e,t,n,r){"boolean"===typeof e?(l(t)&&(n=t,t=void 0),t=t||""):(n=t=e,e=!1,l(t)&&(n=t,t=void 0),t=t||"");var i,o=vt(),a=e?o._week.dow:0,c=[];if(null!=n)return On(t,(n+a)%7,r,"day");for(i=0;i<7;i++)c[i]=On(t,(i+a)%7,r,"day");return c}Sn.calendar=function(e,t,n){var r=this._calendar[e]||this._calendar.sameElse;return C(r)?r.call(t,n):r},Sn.longDateFormat=function(e){var t=this._longDateFormat[e],n=this._longDateFormat[e.toUpperCase()];return t||!n?t:(this._longDateFormat[e]=n.match(T).map((function(e){return"MMMM"===e||"MM"===e||"DD"===e||"dddd"===e?e.slice(1):e})).join(""),this._longDateFormat[e])},Sn.invalidDate=function(){return this._invalidDate},Sn.ordinal=function(e){return this._ordinal.replace("%d",e)},Sn.preparse=qn,Sn.postformat=qn,Sn.relativeTime=function(e,t,n,r){var i=this._relativeTime[n];return C(i)?i(e,t,n,r):i.replace(/%d/i,e)},Sn.pastFuture=function(e,t){var n=this._relativeTime[e>0?"future":"past"];return C(n)?n(t):n.replace(/%s/i,t)},Sn.set=function(e){var t,n;for(n in e)a(e,n)&&(C(t=e[n])?this[n]=t:this["_"+n]=t);this._config=e,this._dayOfMonthOrdinalParseLenient=new RegExp((this._dayOfMonthOrdinalParse.source||this._ordinalParse.source)+"|"+/\d{1,2}/.source)},Sn.eras=function(e,t){var n,i,o,a=this._eras||vt("en")._eras;for(n=0,i=a.length;n=0)return s[r]},Sn.erasConvertYear=function(e,t){var n=e.since<=e.until?1:-1;return void 0===t?r(e.since).year():r(e.since).year()+(t-e.offset)*n},Sn.erasAbbrRegex=function(e){return a(this,"_erasAbbrRegex")||gn.call(this),e?this._erasAbbrRegex:this._erasRegex},Sn.erasNameRegex=function(e){return a(this,"_erasNameRegex")||gn.call(this),e?this._erasNameRegex:this._erasRegex},Sn.erasNarrowRegex=function(e){return a(this,"_erasNarrowRegex")||gn.call(this),e?this._erasNarrowRegex:this._erasRegex},Sn.months=function(e,t){return e?i(this._months)?this._months[e.month()]:this._months[(this._months.isFormat||Ae).test(t)?"format":"standalone"][e.month()]:i(this._months)?this._months:this._months.standalone},Sn.monthsShort=function(e,t){return e?i(this._monthsShort)?this._monthsShort[e.month()]:this._monthsShort[Ae.test(t)?"format":"standalone"][e.month()]:i(this._monthsShort)?this._monthsShort:this._monthsShort.standalone},Sn.monthsParse=function(e,t,n){var r,i,o;if(this._monthsParseExact)return De.call(this,e,t,n);for(this._monthsParse||(this._monthsParse=[],this._longMonthsParse=[],this._shortMonthsParse=[]),r=0;r<12;r++){if(i=d([2e3,r]),n&&!this._longMonthsParse[r]&&(this._longMonthsParse[r]=new RegExp("^"+this.months(i,"").replace(".","")+"$","i"),this._shortMonthsParse[r]=new RegExp("^"+this.monthsShort(i,"").replace(".","")+"$","i")),n||this._monthsParse[r]||(o="^"+this.months(i,"")+"|^"+this.monthsShort(i,""),this._monthsParse[r]=new RegExp(o.replace(".",""),"i")),n&&"MMMM"===t&&this._longMonthsParse[r].test(e))return r;if(n&&"MMM"===t&&this._shortMonthsParse[r].test(e))return r;if(!n&&this._monthsParse[r].test(e))return r}},Sn.monthsRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||Ne.call(this),e?this._monthsStrictRegex:this._monthsRegex):(a(this,"_monthsRegex")||(this._monthsRegex=Le),this._monthsStrictRegex&&e?this._monthsStrictRegex:this._monthsRegex)},Sn.monthsShortRegex=function(e){return this._monthsParseExact?(a(this,"_monthsRegex")||Ne.call(this),e?this._monthsShortStrictRegex:this._monthsShortRegex):(a(this,"_monthsShortRegex")||(this._monthsShortRegex=He),this._monthsShortStrictRegex&&e?this._monthsShortStrictRegex:this._monthsShortRegex)},Sn.week=function(e){return Ge(e,this._week.dow,this._week.doy).week},Sn.firstDayOfYear=function(){return this._week.doy},Sn.firstDayOfWeek=function(){return this._week.dow},Sn.weekdays=function(e,t){var n=i(this._weekdays)?this._weekdays:this._weekdays[e&&!0!==e&&this._weekdays.isFormat.test(t)?"format":"standalone"];return!0===e?Ze(n,this._week.dow):e?n[e.day()]:n},Sn.weekdaysMin=function(e){return!0===e?Ze(this._weekdaysMin,this._week.dow):e?this._weekdaysMin[e.day()]:this._weekdaysMin},Sn.weekdaysShort=function(e){return!0===e?Ze(this._weekdaysShort,this._week.dow):e?this._weekdaysShort[e.day()]:this._weekdaysShort},Sn.weekdaysParse=function(e,t,n){var r,i,o;if(this._weekdaysParseExact)return tt.call(this,e,t,n);for(this._weekdaysParse||(this._weekdaysParse=[],this._minWeekdaysParse=[],this._shortWeekdaysParse=[],this._fullWeekdaysParse=[]),r=0;r<7;r++){if(i=d([2e3,1]).day(r),n&&!this._fullWeekdaysParse[r]&&(this._fullWeekdaysParse[r]=new RegExp("^"+this.weekdays(i,"").replace(".","\\.?")+"$","i"),this._shortWeekdaysParse[r]=new RegExp("^"+this.weekdaysShort(i,"").replace(".","\\.?")+"$","i"),this._minWeekdaysParse[r]=new RegExp("^"+this.weekdaysMin(i,"").replace(".","\\.?")+"$","i")),this._weekdaysParse[r]||(o="^"+this.weekdays(i,"")+"|^"+this.weekdaysShort(i,"")+"|^"+this.weekdaysMin(i,""),this._weekdaysParse[r]=new RegExp(o.replace(".",""),"i")),n&&"dddd"===t&&this._fullWeekdaysParse[r].test(e))return r;if(n&&"ddd"===t&&this._shortWeekdaysParse[r].test(e))return r;if(n&&"dd"===t&&this._minWeekdaysParse[r].test(e))return r;if(!n&&this._weekdaysParse[r].test(e))return r}},Sn.weekdaysRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysStrictRegex:this._weekdaysRegex):(a(this,"_weekdaysRegex")||(this._weekdaysRegex=Qe),this._weekdaysStrictRegex&&e?this._weekdaysStrictRegex:this._weekdaysRegex)},Sn.weekdaysShortRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex):(a(this,"_weekdaysShortRegex")||(this._weekdaysShortRegex=Je),this._weekdaysShortStrictRegex&&e?this._weekdaysShortStrictRegex:this._weekdaysShortRegex)},Sn.weekdaysMinRegex=function(e){return this._weekdaysParseExact?(a(this,"_weekdaysRegex")||nt.call(this),e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex):(a(this,"_weekdaysMinRegex")||(this._weekdaysMinRegex=et),this._weekdaysMinStrictRegex&&e?this._weekdaysMinStrictRegex:this._weekdaysMinRegex)},Sn.isPM=function(e){return"p"===(e+"").toLowerCase().charAt(0)},Sn.meridiem=function(e,t,n){return e>11?n?"pm":"PM":n?"am":"AM"},pt("en",{eras:[{since:"0001-01-01",until:1/0,offset:1,name:"Anno Domini",narrow:"AD",abbr:"AD"},{since:"0000-12-31",until:-1/0,offset:1,name:"Before Christ",narrow:"BC",abbr:"BC"}],dayOfMonthOrdinalParse:/\d{1,2}(th|st|nd|rd)/,ordinal:function(e){var t=e%10;return e+(1===G(e%100/10)?"th":1===t?"st":2===t?"nd":3===t?"rd":"th")}}),r.lang=x("moment.lang is deprecated. Use moment.locale instead.",pt),r.langData=x("moment.langData is deprecated. Use moment.localeData instead.",vt);var An=Math.abs;function Hn(e,t,n,r){var i=Xt(t,n);return e._milliseconds+=r*i._milliseconds,e._days+=r*i._days,e._months+=r*i._months,e._bubble()}function Ln(e){return e<0?Math.floor(e):Math.ceil(e)}function Dn(e){return 4800*e/146097}function Pn(e){return 146097*e/4800}function Vn(e){return function(){return this.as(e)}}var Nn=Vn("ms"),In=Vn("s"),Rn=Vn("m"),Bn=Vn("h"),Fn=Vn("d"),Un=Vn("w"),Wn=Vn("M"),Gn=Vn("Q"),Yn=Vn("y");function Zn(e){return function(){return this.isValid()?this._data[e]:NaN}}var $n=Zn("milliseconds"),Xn=Zn("seconds"),Kn=Zn("minutes"),Qn=Zn("hours"),Jn=Zn("days"),er=Zn("months"),tr=Zn("years"),nr=Math.round,rr={ss:44,s:45,m:45,h:22,d:26,w:null,M:11};function ir(e,t,n,r,i){return i.relativeTime(t||1,!!n,e,r)}var or=Math.abs;function ar(e){return(e>0)-(e<0)||+e}function cr(){if(!this.isValid())return this.localeData().invalidDate();var e,t,n,r,i,o,a,c,s=or(this._milliseconds)/1e3,l=or(this._days),u=or(this._months),f=this.asSeconds();return f?(e=W(s/60),t=W(e/60),s%=60,e%=60,n=W(u/12),u%=12,r=s?s.toFixed(3).replace(/\.?0+$/,""):"",i=f<0?"-":"",o=ar(this._months)!==ar(f)?"-":"",a=ar(this._days)!==ar(f)?"-":"",c=ar(this._milliseconds)!==ar(f)?"-":"",i+"P"+(n?o+n+"Y":"")+(u?o+u+"M":"")+(l?a+l+"D":"")+(t||e||s?"T":"")+(t?c+t+"H":"")+(e?c+e+"M":"")+(s?c+r+"S":"")):"P0D"}var sr=Nt.prototype;return sr.isValid=function(){return this._isValid},sr.abs=function(){var e=this._data;return this._milliseconds=An(this._milliseconds),this._days=An(this._days),this._months=An(this._months),e.milliseconds=An(e.milliseconds),e.seconds=An(e.seconds),e.minutes=An(e.minutes),e.hours=An(e.hours),e.months=An(e.months),e.years=An(e.years),this},sr.add=function(e,t){return Hn(this,e,t,1)},sr.subtract=function(e,t){return Hn(this,e,t,-1)},sr.as=function(e){if(!this.isValid())return NaN;var t,n,r=this._milliseconds;if("month"===(e=I(e))||"quarter"===e||"year"===e)switch(t=this._days+r/864e5,n=this._months+Dn(t),e){case"month":return n;case"quarter":return n/3;case"year":return n/12}else switch(t=this._days+Math.round(Pn(this._months)),e){case"week":return t/7+r/6048e5;case"day":return t+r/864e5;case"hour":return 24*t+r/36e5;case"minute":return 1440*t+r/6e4;case"second":return 86400*t+r/1e3;case"millisecond":return Math.floor(864e5*t)+r;default:throw new Error("Unknown unit "+e)}},sr.asMilliseconds=Nn,sr.asSeconds=In,sr.asMinutes=Rn,sr.asHours=Bn,sr.asDays=Fn,sr.asWeeks=Un,sr.asMonths=Wn,sr.asQuarters=Gn,sr.asYears=Yn,sr.valueOf=function(){return this.isValid()?this._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*G(this._months/12):NaN},sr._bubble=function(){var e,t,n,r,i,o=this._milliseconds,a=this._days,c=this._months,s=this._data;return o>=0&&a>=0&&c>=0||o<=0&&a<=0&&c<=0||(o+=864e5*Ln(Pn(c)+a),a=0,c=0),s.milliseconds=o%1e3,e=W(o/1e3),s.seconds=e%60,t=W(e/60),s.minutes=t%60,n=W(t/60),s.hours=n%24,a+=W(n/24),i=W(Dn(a)),c+=i,a-=Ln(Pn(i)),r=W(c/12),c%=12,s.days=a,s.months=c,s.years=r,this},sr.clone=function(){return Xt(this)},sr.get=function(e){return e=I(e),this.isValid()?this[e+"s"]():NaN},sr.milliseconds=$n,sr.seconds=Xn,sr.minutes=Kn,sr.hours=Qn,sr.days=Jn,sr.weeks=function(){return W(this.days()/7)},sr.months=er,sr.years=tr,sr.humanize=function(e,t){if(!this.isValid())return this.localeData().invalidDate();var n,r,i=!1,o=rr;return"object"===typeof e&&(t=e,e=!1),"boolean"===typeof e&&(i=e),"object"===typeof t&&(o=Object.assign({},rr,t),null!=t.s&&null==t.ss&&(o.ss=t.s-1)),n=this.localeData(),r=function(e,t,n,r){var i=Xt(e).abs(),o=nr(i.as("s")),a=nr(i.as("m")),c=nr(i.as("h")),s=nr(i.as("d")),l=nr(i.as("M")),u=nr(i.as("w")),f=nr(i.as("y")),h=o<=n.ss&&["s",o]||o0,h[4]=r,ir.apply(null,h)}(this,!i,o,n),i&&(r=n.pastFuture(+this,r)),n.postformat(r)},sr.toISOString=cr,sr.toString=cr,sr.toJSON=cr,sr.locale=an,sr.localeData=sn,sr.toIsoString=x("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)",cr),sr.lang=cn,L("X",0,0,"unix"),L("x",0,0,"valueOf"),de("x",le),de("X",/[+-]?\d+(\.\d{1,3})?/),ge("X",(function(e,t,n){n._d=new Date(1e3*parseFloat(e))})),ge("x",(function(e,t,n){n._d=new Date(G(e))})),r.version="2.29.1",t=Ht,r.fn=Cn,r.min=function(){return Pt("isBefore",[].slice.call(arguments,0))},r.max=function(){return Pt("isAfter",[].slice.call(arguments,0))},r.now=function(){return Date.now?Date.now():+new Date},r.utc=d,r.unix=function(e){return Ht(1e3*e)},r.months=function(e,t){return Tn(e,t,"months")},r.isDate=u,r.locale=pt,r.invalid=v,r.duration=Xt,r.isMoment=w,r.weekdays=function(e,t,n){return En(e,t,n,"weekdays")},r.parseZone=function(){return Ht.apply(null,arguments).parseZone()},r.localeData=vt,r.isDuration=It,r.monthsShort=function(e,t){return Tn(e,t,"monthsShort")},r.weekdaysMin=function(e,t,n){return En(e,t,n,"weekdaysMin")},r.defineLocale=zt,r.updateLocale=function(e,t){if(null!=t){var n,r,i=st;null!=lt[e]&&null!=lt[e].parentLocale?lt[e].set(q(lt[e]._config,t)):(null!=(r=dt(e))&&(i=r._config),t=q(i,t),null==r&&(t.abbr=e),(n=new S(t)).parentLocale=lt[e],lt[e]=n),pt(e)}else null!=lt[e]&&(null!=lt[e].parentLocale?(lt[e]=lt[e].parentLocale,e===pt()&&pt(e)):null!=lt[e]&&delete lt[e]);return lt[e]},r.locales=function(){return j(lt)},r.weekdaysShort=function(e,t,n){return En(e,t,n,"weekdaysShort")},r.normalizeUnits=I,r.relativeTimeRounding=function(e){return void 0===e?nr:"function"===typeof e&&(nr=e,!0)},r.relativeTimeThreshold=function(e,t){return void 0!==rr[e]&&(void 0===t?rr[e]:(rr[e]=t,"s"===e&&(rr.ss=t-1),!0))},r.calendarFormat=function(e,t){var n=e.diff(t,"days",!0);return n<-6?"sameElse":n<-1?"lastWeek":n<0?"lastDay":n<1?"sameDay":n<2?"nextDay":n<7?"nextWeek":"sameElse"},r.prototype=Cn,r.HTML5_FMT={DATETIME_LOCAL:"YYYY-MM-DDTHH:mm",DATETIME_LOCAL_SECONDS:"YYYY-MM-DDTHH:mm:ss",DATETIME_LOCAL_MS:"YYYY-MM-DDTHH:mm:ss.SSS",DATE:"YYYY-MM-DD",TIME:"HH:mm",TIME_SECONDS:"HH:mm:ss",TIME_MS:"HH:mm:ss.SSS",WEEK:"GGGG-[W]WW",MONTH:"YYYY-MM"},r}()}).call(this,n(417)(e))},,,function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"===typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"===typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],u=!1,f=-1;function h(){u&&s&&(u=!1,s.length?l=s.concat(l):f=-1,l.length&&d())}function d(){if(!u){var e=c(h);u=!0;for(var t=l.length;t;){for(s=l,l=[];++f1)for(var n=1;n=0;c--)(i=e[c])&&(a=(o<3?i(a):o>3?i(t,n,a):i(t,n))||a);return o>3&&a&&Object.defineProperty(t,n,a),a}function s(e,t){return function(n,r){t(n,r,e)}}function l(e,t){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{s(r.next(e))}catch(t){o(t)}}function c(e){try{s(r.throw(e))}catch(t){o(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,c)}s((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"===typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(o){return function(c){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=(i=a.trys).length>0&&i[i.length-1])&&(6===o[0]||2===o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function z(e,t){var n="function"===typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(c){i={error:c}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function v(){for(var e=[],t=0;t1||c(e,t)}))})}function c(e,t){try{(n=i[e](t)).value instanceof y?Promise.resolve(n.value.v).then(s,l):u(o[0][2],n)}catch(r){u(o[0][3],r)}var n}function s(e){c("next",e)}function l(e){c("throw",e)}function u(e,t){e(t),o.shift(),o.length&&c(o[0][0],o[0][1])}}function w(e){var t,n;return t={},r("next"),r("throw",(function(e){throw e})),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:y(e[r](t)),done:"return"===r}:i?i(t):t}:i}}function k(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=p(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var j=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t};function M(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&h(t,e,n);return j(t,e),t}function _(e){return e&&e.__esModule?e:{default:e}}function C(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"===typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function q(e,t,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"===typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(e,n):i?i.value=n:t.set(e,n),n}},function(e,t,n){"use strict";e.exports=n(307)},,function(e,t,n){"use strict";var r=n(66),i=n(97),o=Object(r.a)(i.a);t.a=o},function(e,t,n){"use strict";var r=n(160),i=n(66),o=Object(i.a)(Object(r.a)("slice",(function(e,t,n){return Array.prototype.slice.call(n,e,t)})));t.a=o},function(e,t,n){"use strict";n.d(t,"a",(function(){return o}));var r=n(43),i=n(53);function o(e,t){return new r.a((function(n){var r=new i.a,o=0;return r.add(t.schedule((function(){o!==e.length?(n.next(e[o++]),n.closed||r.add(this.schedule())):n.complete()}))),r}))}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(95),i=n(185),o=n(43);function a(e,t,n,a,c){if(void 0===c&&(c=new r.a(e,n,a)),!c.closed)return t instanceof o.a?t.subscribe(c):Object(i.a)(t)(c)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return i}));var r=n(31),i=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.notifyNext=function(e,t,n,r,i){this.destination.next(t)},t.prototype.notifyError=function(e,t){this.destination.error(e)},t.prototype.notifyComplete=function(e){this.destination.complete()},t}(n(52).a)},function(e,t,n){var r,i;window,e.exports=(r=n(0),i=n(32),function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t,n){(function(e,r){var i;(function(){var o="Expected a function",a="__lodash_placeholder__",c=[["ary",128],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",32],["partialRight",64],["rearg",256]],s="[object Arguments]",l="[object Array]",u="[object Boolean]",f="[object Date]",h="[object Error]",d="[object Function]",p="[object GeneratorFunction]",z="[object Map]",v="[object Number]",g="[object Object]",m="[object RegExp]",y="[object Set]",b="[object String]",w="[object Symbol]",k="[object WeakMap]",x="[object ArrayBuffer]",j="[object DataView]",M="[object Float32Array]",_="[object Float64Array]",C="[object Int8Array]",q="[object Int16Array]",S="[object Int32Array]",O="[object Uint8Array]",T="[object Uint16Array]",E="[object Uint32Array]",A=/\b__p \+= '';/g,H=/\b(__p \+=) '' \+/g,L=/(__e\(.*?\)|\b__t\)) \+\n'';/g,D=/&(?:amp|lt|gt|quot|#39);/g,P=/[&<>"']/g,V=RegExp(D.source),N=RegExp(P.source),I=/<%-([\s\S]+?)%>/g,R=/<%([\s\S]+?)%>/g,B=/<%=([\s\S]+?)%>/g,F=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,U=/^\w*$/,W=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,G=/[\\^$.*+?()[\]{}|]/g,Y=RegExp(G.source),Z=/^\s+|\s+$/g,$=/^\s+/,X=/\s+$/,K=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Q=/\{\n\/\* \[wrapped with (.+)\] \*/,J=/,? & /,ee=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,te=/\\(\\)?/g,ne=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,re=/\w*$/,ie=/^[-+]0x[0-9a-f]+$/i,oe=/^0b[01]+$/i,ae=/^\[object .+?Constructor\]$/,ce=/^0o[0-7]+$/i,se=/^(?:0|[1-9]\d*)$/,le=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ue=/($^)/,fe=/['\n\r\u2028\u2029\\]/g,he="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",de="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",pe="["+de+"]",ze="["+he+"]",ve="\\d+",ge="[a-z\\xdf-\\xf6\\xf8-\\xff]",me="[^\\ud800-\\udfff"+de+ve+"\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde]",ye="\\ud83c[\\udffb-\\udfff]",be="[^\\ud800-\\udfff]",we="(?:\\ud83c[\\udde6-\\uddff]){2}",ke="[\\ud800-\\udbff][\\udc00-\\udfff]",xe="[A-Z\\xc0-\\xd6\\xd8-\\xde]",je="(?:"+ge+"|"+me+")",Me="(?:"+xe+"|"+me+")",_e="(?:"+ze+"|"+ye+")?",Ce="[\\ufe0e\\ufe0f]?"+_e+"(?:\\u200d(?:"+[be,we,ke].join("|")+")[\\ufe0e\\ufe0f]?"+_e+")*",qe="(?:"+["[\\u2700-\\u27bf]",we,ke].join("|")+")"+Ce,Se="(?:"+[be+ze+"?",ze,we,ke,"[\\ud800-\\udfff]"].join("|")+")",Oe=RegExp("['\u2019]","g"),Te=RegExp(ze,"g"),Ee=RegExp(ye+"(?="+ye+")|"+Se+Ce,"g"),Ae=RegExp([xe+"?"+ge+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?(?="+[pe,xe,"$"].join("|")+")",Me+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?(?="+[pe,xe+je,"$"].join("|")+")",xe+"?"+je+"+(?:['\u2019](?:d|ll|m|re|s|t|ve))?",xe+"+(?:['\u2019](?:D|LL|M|RE|S|T|VE))?","\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ve,qe].join("|"),"g"),He=RegExp("[\\u200d\\ud800-\\udfff"+he+"\\ufe0e\\ufe0f]"),Le=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,De=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Pe=-1,Ve={};Ve[M]=Ve[_]=Ve[C]=Ve[q]=Ve[S]=Ve[O]=Ve["[object Uint8ClampedArray]"]=Ve[T]=Ve[E]=!0,Ve[s]=Ve[l]=Ve[x]=Ve[u]=Ve[j]=Ve[f]=Ve[h]=Ve[d]=Ve[z]=Ve[v]=Ve[g]=Ve[m]=Ve[y]=Ve[b]=Ve[k]=!1;var Ne={};Ne[s]=Ne[l]=Ne[x]=Ne[j]=Ne[u]=Ne[f]=Ne[M]=Ne[_]=Ne[C]=Ne[q]=Ne[S]=Ne[z]=Ne[v]=Ne[g]=Ne[m]=Ne[y]=Ne[b]=Ne[w]=Ne[O]=Ne["[object Uint8ClampedArray]"]=Ne[T]=Ne[E]=!0,Ne[h]=Ne[d]=Ne[k]=!1;var Ie={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Re=parseFloat,Be=parseInt,Fe="object"==typeof e&&e&&e.Object===Object&&e,Ue="object"==typeof self&&self&&self.Object===Object&&self,We=Fe||Ue||Function("return this")(),Ge=t&&!t.nodeType&&t,Ye=Ge&&"object"==typeof r&&r&&!r.nodeType&&r,Ze=Ye&&Ye.exports===Ge,$e=Ze&&Fe.process,Xe=function(){try{return Ye&&Ye.require&&Ye.require("util").types||$e&&$e.binding&&$e.binding("util")}catch(e){}}(),Ke=Xe&&Xe.isArrayBuffer,Qe=Xe&&Xe.isDate,Je=Xe&&Xe.isMap,et=Xe&&Xe.isRegExp,tt=Xe&&Xe.isSet,nt=Xe&&Xe.isTypedArray;function rt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function it(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function ut(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function Et(e,t){for(var n=e.length;n--&&yt(t,e[n],0)>-1;);return n}function At(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Ht=jt({"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a","\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae","\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g","\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O","\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"}),Lt=jt({"&":"&","<":"<",">":">",'"':""","'":"'"});function Dt(e){return"\\"+Ie[e]}function Pt(e){return He.test(e)}function Vt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function Nt(e,t){return function(n){return e(t(n))}}function It(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),Wt=function e(t){var n,r=(t=null==t?We:Wt.defaults(We.Object(),t,Wt.pick(We,De))).Array,i=t.Date,he=t.Error,de=t.Function,pe=t.Math,ze=t.Object,ve=t.RegExp,ge=t.String,me=t.TypeError,ye=r.prototype,be=de.prototype,we=ze.prototype,ke=t["__core-js_shared__"],xe=be.toString,je=we.hasOwnProperty,Me=0,_e=(n=/[^.]+$/.exec(ke&&ke.keys&&ke.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",Ce=we.toString,qe=xe.call(ze),Se=We._,Ee=ve("^"+xe.call(je).replace(G,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),He=Ze?t.Buffer:void 0,Ie=t.Symbol,Fe=t.Uint8Array,Ue=He?He.allocUnsafe:void 0,Ge=Nt(ze.getPrototypeOf,ze),Ye=ze.create,$e=we.propertyIsEnumerable,Xe=ye.splice,vt=Ie?Ie.isConcatSpreadable:void 0,jt=Ie?Ie.iterator:void 0,Gt=Ie?Ie.toStringTag:void 0,Yt=function(){try{var e=Ki(ze,"defineProperty");return e({},"",{}),e}catch(e){}}(),Zt=t.clearTimeout!==We.clearTimeout&&t.clearTimeout,$t=i&&i.now!==We.Date.now&&i.now,Xt=t.setTimeout!==We.setTimeout&&t.setTimeout,Kt=pe.ceil,Qt=pe.floor,Jt=ze.getOwnPropertySymbols,en=He?He.isBuffer:void 0,tn=t.isFinite,nn=ye.join,rn=Nt(ze.keys,ze),on=pe.max,an=pe.min,cn=i.now,sn=t.parseInt,ln=pe.random,un=ye.reverse,fn=Ki(t,"DataView"),hn=Ki(t,"Map"),dn=Ki(t,"Promise"),pn=Ki(t,"Set"),zn=Ki(t,"WeakMap"),vn=Ki(ze,"create"),gn=zn&&new zn,mn={},yn=Mo(fn),bn=Mo(hn),wn=Mo(dn),kn=Mo(pn),xn=Mo(zn),jn=Ie?Ie.prototype:void 0,Mn=jn?jn.valueOf:void 0,_n=jn?jn.toString:void 0;function Cn(e){if(Ba(e)&&!Ta(e)&&!(e instanceof Tn)){if(e instanceof On)return e;if(je.call(e,"__wrapped__"))return _o(e)}return new On(e)}var qn=function(){function e(){}return function(t){if(!Ra(t))return{};if(Ye)return Ye(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function Sn(){}function On(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=void 0}function Tn(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function En(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function $n(e,t,n,r,i,o){var a,c=1&t,l=2&t,h=4&t;if(n&&(a=i?n(e,r,i,o):n(e)),void 0!==a)return a;if(!Ra(e))return e;var k=Ta(e);if(k){if(a=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&je.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return zi(e,a)}else{var A=eo(e),H=A==d||A==p;if(La(e))return li(e,c);if(A==g||A==s||H&&!i){if(a=l||H?{}:no(e),!c)return l?function(e,t){return vi(e,Ji(e),t)}(e,function(e,t){return e&&vi(t,yc(t),e)}(a,e)):function(e,t){return vi(e,Qi(e),t)}(e,Wn(a,e))}else{if(!Ne[A])return i?e:{};a=function(e,t,n){var r,i=e.constructor;switch(t){case x:return ui(e);case u:case f:return new i(+e);case j:return function(e,t){var n=t?ui(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case M:case _:case C:case q:case S:case O:case"[object Uint8ClampedArray]":case T:case E:return fi(e,n);case z:return new i;case v:case b:return new i(e);case m:return function(e){var t=new e.constructor(e.source,re.exec(e));return t.lastIndex=e.lastIndex,t}(e);case y:return new i;case w:return r=e,Mn?ze(Mn.call(r)):{}}}(e,A,c)}}o||(o=new Dn);var L=o.get(e);if(L)return L;o.set(e,a),Ya(e)?e.forEach((function(r){a.add($n(r,t,n,r,e,o))})):Fa(e)&&e.forEach((function(r,i){a.set(i,$n(r,t,n,i,e,o))}));var D=k?void 0:(h?l?Ui:Fi:l?yc:mc)(e);return ot(D||e,(function(r,i){D&&(r=e[i=r]),Bn(a,i,$n(r,t,n,i,e,o))})),a}function Xn(e,t,n){var r=n.length;if(null==e)return!r;for(e=ze(e);r--;){var i=n[r],o=t[i],a=e[i];if(void 0===a&&!(i in e)||!o(a))return!1}return!0}function Kn(e,t,n){if("function"!=typeof e)throw new me(o);return mo((function(){e.apply(void 0,n)}),t)}function Qn(e,t,n,r){var i=-1,o=lt,a=!0,c=e.length,s=[],l=t.length;if(!c)return s;n&&(t=ft(t,qt(n))),r?(o=ut,a=!1):t.length>=200&&(o=Ot,a=!1,t=new Ln(t));e:for(;++i-1},An.prototype.set=function(e,t){var n=this.__data__,r=Fn(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Hn.prototype.clear=function(){this.size=0,this.__data__={hash:new En,map:new(hn||An),string:new En}},Hn.prototype.delete=function(e){var t=$i(this,e).delete(e);return this.size-=t?1:0,t},Hn.prototype.get=function(e){return $i(this,e).get(e)},Hn.prototype.has=function(e){return $i(this,e).has(e)},Hn.prototype.set=function(e,t){var n=$i(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},Ln.prototype.add=Ln.prototype.push=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this},Ln.prototype.has=function(e){return this.__data__.has(e)},Dn.prototype.clear=function(){this.__data__=new An,this.size=0},Dn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Dn.prototype.get=function(e){return this.__data__.get(e)},Dn.prototype.has=function(e){return this.__data__.has(e)},Dn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof An){var r=n.__data__;if(!hn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Hn(r)}return n.set(e,t),this.size=n.size,this};var Jn=yi(cr),er=yi(sr,!0);function tr(e,t){var n=!0;return Jn(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function nr(e,t,n){for(var r=-1,i=e.length;++r0&&n(c)?t>1?ir(c,t-1,n,r,i):ht(i,c):r||(i[i.length]=c)}return i}var or=bi(),ar=bi(!0);function cr(e,t){return e&&or(e,t,mc)}function sr(e,t){return e&&ar(e,t,mc)}function lr(e,t){return st(t,(function(t){return Va(e[t])}))}function ur(e,t){for(var n=0,r=(t=oi(t,e)).length;null!=e&&nt}function pr(e,t){return null!=e&&je.call(e,t)}function zr(e,t){return null!=e&&t in ze(e)}function vr(e,t,n){for(var i=n?ut:lt,o=e[0].length,a=e.length,c=a,s=r(a),l=1/0,u=[];c--;){var f=e[c];c&&t&&(f=ft(f,qt(t))),l=an(f.length,l),s[c]=!n&&(t||o>=120&&f.length>=120)?new Ln(c&&f):void 0}f=e[0];var h=-1,d=s[0];e:for(;++h=c?s:s*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}))}function Tr(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)c!==e&&Xe.call(c,s,1),Xe.call(e,s,1);return e}function Ar(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;io(i)?Xe.call(e,i,1):Kr(e,i)}}return e}function Hr(e,t){return e+Qt(ln()*(t-e+1))}function Lr(e,t){var n="";if(!e||t<1||t>9007199254740991)return n;do{t%2&&(n+=e),(t=Qt(t/2))&&(e+=e)}while(t);return n}function Dr(e,t){return yo(ho(e,t,Uc),e+"")}function Pr(e){return Vn(Cc(e))}function Vr(e,t){var n=Cc(e);return ko(n,Zn(t,0,n.length))}function Nr(e,t,n,r){if(!Ra(e))return e;for(var i=-1,o=(t=oi(t,e)).length,a=o-1,c=e;null!=c&&++io?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!$a(a)&&(n?a<=t:a=200){var l=t?null:Li(e);if(l)return Rt(l);a=!1,i=Ot,s=new Ln}else s=t?[]:c;e:for(;++r=r?e:Fr(e,t,n)}var si=Zt||function(e){return We.clearTimeout(e)};function li(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function ui(e){var t=new e.constructor(e.byteLength);return new Fe(t).set(new Fe(e)),t}function fi(e,t){var n=t?ui(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function hi(e,t){if(e!==t){var n=void 0!==e,r=null===e,i=e==e,o=$a(e),a=void 0!==t,c=null===t,s=t==t,l=$a(t);if(!c&&!l&&!o&&e>t||o&&a&&s&&!c&&!l||r&&a&&s||!n&&s||!i)return 1;if(!r&&!o&&!l&&e1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=e.length>3&&"function"==typeof o?(i--,o):void 0,a&&oo(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),t=ze(t);++r-1?i[o?t[a]:a]:void 0}}function Mi(e){return Bi((function(t){var n=t.length,r=n,i=On.prototype.thru;for(e&&t.reverse();r--;){var a=t[r];if("function"!=typeof a)throw new me(o);if(i&&!c&&"wrapper"==Gi(a))var c=new On([],!0)}for(r=c?r:n;++r1&&y.reverse(),f&&lc))return!1;var l=o.get(e),u=o.get(t);if(l&&u)return l==t&&u==e;var f=-1,h=!0,d=2&n?new Ln:void 0;for(o.set(e,t),o.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(K,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return ot(c,(function(n){var r="_."+n[0];t&n[1]&&!lt(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(Q);return t?t[1].split(J):[]}(r),n)))}function wo(e){var t=0,n=0;return function(){var r=cn(),i=16-(r-n);if(n=r,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}function ko(e,t){var n=-1,r=e.length,i=r-1;for(t=void 0===t?r:t;++n1?e[t-1]:void 0;return n="function"==typeof n?(e.pop(),n):void 0,Go(e,n)}));function Jo(e){var t=Cn(e);return t.__chain__=!0,t}function ea(e,t){return t(e)}var ta=Bi((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,i=function(t){return Yn(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Tn&&io(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:ea,args:[i],thisArg:void 0}),new On(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(void 0),e}))):this.thru(i)})),na=gi((function(e,t,n){je.call(e,n)?++e[n]:Gn(e,n,1)})),ra=ji(Oo),ia=ji(To);function oa(e,t){return(Ta(e)?ot:Jn)(e,Zi(t,3))}function aa(e,t){return(Ta(e)?at:er)(e,Zi(t,3))}var ca=gi((function(e,t,n){je.call(e,n)?e[n].push(t):Gn(e,n,[t])})),sa=Dr((function(e,t,n){var i=-1,o="function"==typeof t,a=Aa(e)?r(e.length):[];return Jn(e,(function(e){a[++i]=o?rt(t,e,n):gr(e,t,n)})),a})),la=gi((function(e,t,n){Gn(e,n,t)}));function ua(e,t){return(Ta(e)?ft:Mr)(e,Zi(t,3))}var fa=gi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),ha=Dr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&oo(e,t[0],t[1])?t=[]:n>2&&oo(t[0],t[1],t[2])&&(t=[t[0]]),Or(e,ir(t,1),[])})),da=$t||function(){return We.Date.now()};function pa(e,t,n){return t=n?void 0:t,Pi(e,128,void 0,void 0,void 0,void 0,t=e&&null==t?e.length:t)}function za(e,t){var n;if("function"!=typeof t)throw new me(o);return e=tc(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=void 0),n}}var va=Dr((function(e,t,n){var r=1;if(n.length){var i=It(n,Yi(va));r|=32}return Pi(e,r,t,n,i)})),ga=Dr((function(e,t,n){var r=3;if(n.length){var i=It(n,Yi(ga));r|=32}return Pi(t,r,e,n,i)}));function ma(e,t,n){var r,i,a,c,s,l,u=0,f=!1,h=!1,d=!0;if("function"!=typeof e)throw new me(o);function p(t){var n=r,o=i;return r=i=void 0,u=t,c=e.apply(o,n)}function z(e){var n=e-l;return void 0===l||n>=t||n<0||h&&e-u>=a}function v(){var e=da();if(z(e))return g(e);s=mo(v,function(e){var n=t-(e-l);return h?an(n,a-(e-u)):n}(e))}function g(e){return s=void 0,d&&r?p(e):(r=i=void 0,c)}function m(){var e=da(),n=z(e);if(r=arguments,i=this,l=e,n){if(void 0===s)return function(e){return u=e,s=mo(v,t),f?p(e):c}(l);if(h)return si(s),s=mo(v,t),p(l)}return void 0===s&&(s=mo(v,t)),c}return t=rc(t)||0,Ra(n)&&(f=!!n.leading,a=(h="maxWait"in n)?on(rc(n.maxWait)||0,t):a,d="trailing"in n?!!n.trailing:d),m.cancel=function(){void 0!==s&&si(s),u=0,r=l=i=s=void 0},m.flush=function(){return void 0===s?c:g(da())},m}var ya=Dr((function(e,t){return Kn(e,1,t)})),ba=Dr((function(e,t,n){return Kn(e,rc(t)||0,n)}));function wa(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new me(o);var n=function n(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(wa.Cache||Hn),n}function ka(e){if("function"!=typeof e)throw new me(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}wa.Cache=Hn;var xa=ai((function(e,t){var n=(t=1==t.length&&Ta(t[0])?ft(t[0],qt(Zi())):ft(ir(t,1),qt(Zi()))).length;return Dr((function(r){for(var i=-1,o=an(r.length,n);++i=t})),Oa=mr(function(){return arguments}())?mr:function(e){return Ba(e)&&je.call(e,"callee")&&!$e.call(e,"callee")},Ta=r.isArray,Ea=Ke?qt(Ke):function(e){return Ba(e)&&hr(e)==x};function Aa(e){return null!=e&&Ia(e.length)&&!Va(e)}function Ha(e){return Ba(e)&&Aa(e)}var La=en||rs,Da=Qe?qt(Qe):function(e){return Ba(e)&&hr(e)==f};function Pa(e){if(!Ba(e))return!1;var t=hr(e);return t==h||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!Wa(e)}function Va(e){if(!Ra(e))return!1;var t=hr(e);return t==d||t==p||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Na(e){return"number"==typeof e&&e==tc(e)}function Ia(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ra(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ba(e){return null!=e&&"object"==typeof e}var Fa=Je?qt(Je):function(e){return Ba(e)&&eo(e)==z};function Ua(e){return"number"==typeof e||Ba(e)&&hr(e)==v}function Wa(e){if(!Ba(e)||hr(e)!=g)return!1;var t=Ge(e);if(null===t)return!0;var n=je.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&xe.call(n)==qe}var Ga=et?qt(et):function(e){return Ba(e)&&hr(e)==m},Ya=tt?qt(tt):function(e){return Ba(e)&&eo(e)==y};function Za(e){return"string"==typeof e||!Ta(e)&&Ba(e)&&hr(e)==b}function $a(e){return"symbol"==typeof e||Ba(e)&&hr(e)==w}var Xa=nt?qt(nt):function(e){return Ba(e)&&Ia(e.length)&&!!Ve[hr(e)]},Ka=Ei(jr),Qa=Ei((function(e,t){return e<=t}));function Ja(e){if(!e)return[];if(Aa(e))return Za(e)?Ft(e):zi(e);if(jt&&e[jt])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[jt]());var t=eo(e);return(t==z?Vt:t==y?Rt:Cc)(e)}function ec(e){return e?(e=rc(e))===1/0||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function tc(e){var t=ec(e),n=t%1;return t==t?n?t-n:t:0}function nc(e){return e?Zn(tc(e),0,4294967295):0}function rc(e){if("number"==typeof e)return e;if($a(e))return NaN;if(Ra(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=Ra(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(Z,"");var n=oe.test(e);return n||ce.test(e)?Be(e.slice(2),n?2:8):ie.test(e)?NaN:+e}function ic(e){return vi(e,yc(e))}function oc(e){return null==e?"":$r(e)}var ac=mi((function(e,t){if(lo(t)||Aa(t))vi(t,mc(t),e);else for(var n in t)je.call(t,n)&&Bn(e,n,t[n])})),cc=mi((function(e,t){vi(t,yc(t),e)})),sc=mi((function(e,t,n,r){vi(t,yc(t),e,r)})),lc=mi((function(e,t,n,r){vi(t,mc(t),e,r)})),uc=Bi(Yn),fc=Dr((function(e,t){e=ze(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&oo(t[0],t[1],i)&&(r=1);++n1),t})),vi(e,Ui(e),n),r&&(n=$n(n,7,Ii));for(var i=t.length;i--;)Kr(n,t[i]);return n})),xc=Bi((function(e,t){return null==e?{}:function(e,t){return Tr(e,t,(function(t,n){return pc(e,n)}))}(e,t)}));function jc(e,t){if(null==e)return{};var n=ft(Ui(e),(function(e){return[e]}));return t=Zi(t),Tr(e,n,(function(e,n){return t(e,n[0])}))}var Mc=Di(mc),_c=Di(yc);function Cc(e){return null==e?[]:St(e,mc(e))}var qc=ki((function(e,t,n){return t=t.toLowerCase(),e+(n?Sc(t):t)}));function Sc(e){return Pc(oc(e).toLowerCase())}function Oc(e){return(e=oc(e))&&e.replace(le,Ht).replace(Te,"")}var Tc=ki((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Ec=ki((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),Ac=wi("toLowerCase"),Hc=ki((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Lc=ki((function(e,t,n){return e+(n?" ":"")+Pc(t)})),Dc=ki((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Pc=wi("toUpperCase");function Vc(e,t,n){return e=oc(e),void 0===(t=n?void 0:t)?function(e){return Le.test(e)}(e)?function(e){return e.match(Ae)||[]}(e):function(e){return e.match(ee)||[]}(e):e.match(t)||[]}var Nc=Dr((function(e,t){try{return rt(e,void 0,t)}catch(e){return Pa(e)?e:new he(e)}})),Ic=Bi((function(e,t){return ot(t,(function(t){t=jo(t),Gn(e,t,va(e[t],e))})),e}));function Rc(e){return function(){return e}}var Bc=Mi(),Fc=Mi(!0);function Uc(e){return e}function Wc(e){return kr("function"==typeof e?e:$n(e,1))}var Gc=Dr((function(e,t){return function(n){return gr(n,e,t)}})),Yc=Dr((function(e,t){return function(n){return gr(e,n,t)}}));function Zc(e,t,n){var r=mc(t),i=lr(t,r);null!=n||Ra(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=lr(t,mc(t)));var o=!(Ra(n)&&"chain"in n&&!n.chain),a=Va(e);return ot(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=zi(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,ht([this.value()],arguments))})})),e}function $c(){}var Xc=Si(ft),Kc=Si(ct),Qc=Si(zt);function Jc(e){return ao(e)?xt(jo(e)):function(e){return function(t){return ur(t,e)}}(e)}var es=Ti(),ts=Ti(!0);function ns(){return[]}function rs(){return!1}var is,os=qi((function(e,t){return e+t}),0),as=Hi("ceil"),cs=qi((function(e,t){return e/t}),1),ss=Hi("floor"),ls=qi((function(e,t){return e*t}),1),us=Hi("round"),fs=qi((function(e,t){return e-t}),0);return Cn.after=function(e,t){if("function"!=typeof t)throw new me(o);return e=tc(e),function(){if(--e<1)return t.apply(this,arguments)}},Cn.ary=pa,Cn.assign=ac,Cn.assignIn=cc,Cn.assignInWith=sc,Cn.assignWith=lc,Cn.at=uc,Cn.before=za,Cn.bind=va,Cn.bindAll=Ic,Cn.bindKey=ga,Cn.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ta(e)?e:[e]},Cn.chain=Jo,Cn.chunk=function(e,t,n){t=(n?oo(e,t,n):void 0===t)?1:on(tc(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var o=0,a=0,c=r(Kt(i/t));oi?0:i+n),(r=void 0===r||r>i?i:tc(r))<0&&(r+=i),r=n>r?0:nc(r);n>>0)?(e=oc(e))&&("string"==typeof t||null!=t&&!Ga(t))&&!(t=$r(t))&&Pt(e)?ci(Ft(e),0,n):e.split(t,n):[]},Cn.spread=function(e,t){if("function"!=typeof e)throw new me(o);return t=null==t?0:on(tc(t),0),Dr((function(n){var r=n[t],i=ci(n,0,t);return r&&ht(i,r),rt(e,this,i)}))},Cn.tail=function(e){var t=null==e?0:e.length;return t?Fr(e,1,t):[]},Cn.take=function(e,t,n){return e&&e.length?Fr(e,0,(t=n||void 0===t?1:tc(t))<0?0:t):[]},Cn.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?Fr(e,(t=r-(t=n||void 0===t?1:tc(t)))<0?0:t,r):[]},Cn.takeRightWhile=function(e,t){return e&&e.length?Jr(e,Zi(t,3),!1,!0):[]},Cn.takeWhile=function(e,t){return e&&e.length?Jr(e,Zi(t,3)):[]},Cn.tap=function(e,t){return t(e),e},Cn.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new me(o);return Ra(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),ma(e,t,{leading:r,maxWait:t,trailing:i})},Cn.thru=ea,Cn.toArray=Ja,Cn.toPairs=Mc,Cn.toPairsIn=_c,Cn.toPath=function(e){return Ta(e)?ft(e,jo):$a(e)?[e]:zi(xo(oc(e)))},Cn.toPlainObject=ic,Cn.transform=function(e,t,n){var r=Ta(e),i=r||La(e)||Xa(e);if(t=Zi(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:Ra(e)&&Va(o)?qn(Ge(e)):{}}return(i?ot:cr)(e,(function(e,r,i){return t(n,e,r,i)})),n},Cn.unary=function(e){return pa(e,1)},Cn.union=Bo,Cn.unionBy=Fo,Cn.unionWith=Uo,Cn.uniq=function(e){return e&&e.length?Xr(e):[]},Cn.uniqBy=function(e,t){return e&&e.length?Xr(e,Zi(t,2)):[]},Cn.uniqWith=function(e,t){return t="function"==typeof t?t:void 0,e&&e.length?Xr(e,void 0,t):[]},Cn.unset=function(e,t){return null==e||Kr(e,t)},Cn.unzip=Wo,Cn.unzipWith=Go,Cn.update=function(e,t,n){return null==e?e:Qr(e,t,ii(n))},Cn.updateWith=function(e,t,n,r){return r="function"==typeof r?r:void 0,null==e?e:Qr(e,t,ii(n),r)},Cn.values=Cc,Cn.valuesIn=function(e){return null==e?[]:St(e,yc(e))},Cn.without=Yo,Cn.words=Vc,Cn.wrap=function(e,t){return ja(ii(t),e)},Cn.xor=Zo,Cn.xorBy=$o,Cn.xorWith=Xo,Cn.zip=Ko,Cn.zipObject=function(e,t){return ni(e||[],t||[],Bn)},Cn.zipObjectDeep=function(e,t){return ni(e||[],t||[],Nr)},Cn.zipWith=Qo,Cn.entries=Mc,Cn.entriesIn=_c,Cn.extend=cc,Cn.extendWith=sc,Zc(Cn,Cn),Cn.add=os,Cn.attempt=Nc,Cn.camelCase=qc,Cn.capitalize=Sc,Cn.ceil=as,Cn.clamp=function(e,t,n){return void 0===n&&(n=t,t=void 0),void 0!==n&&(n=(n=rc(n))==n?n:0),void 0!==t&&(t=(t=rc(t))==t?t:0),Zn(rc(e),t,n)},Cn.clone=function(e){return $n(e,4)},Cn.cloneDeep=function(e){return $n(e,5)},Cn.cloneDeepWith=function(e,t){return $n(e,5,t="function"==typeof t?t:void 0)},Cn.cloneWith=function(e,t){return $n(e,4,t="function"==typeof t?t:void 0)},Cn.conformsTo=function(e,t){return null==t||Xn(e,t,mc(t))},Cn.deburr=Oc,Cn.defaultTo=function(e,t){return null==e||e!=e?t:e},Cn.divide=cs,Cn.endsWith=function(e,t,n){e=oc(e),t=$r(t);var r=e.length,i=n=void 0===n?r:Zn(tc(n),0,r);return(n-=t.length)>=0&&e.slice(n,i)==t},Cn.eq=Ca,Cn.escape=function(e){return(e=oc(e))&&N.test(e)?e.replace(P,Lt):e},Cn.escapeRegExp=function(e){return(e=oc(e))&&Y.test(e)?e.replace(G,"\\$&"):e},Cn.every=function(e,t,n){var r=Ta(e)?ct:tr;return n&&oo(e,t,n)&&(t=void 0),r(e,Zi(t,3))},Cn.find=ra,Cn.findIndex=Oo,Cn.findKey=function(e,t){return gt(e,Zi(t,3),cr)},Cn.findLast=ia,Cn.findLastIndex=To,Cn.findLastKey=function(e,t){return gt(e,Zi(t,3),sr)},Cn.floor=ss,Cn.forEach=oa,Cn.forEachRight=aa,Cn.forIn=function(e,t){return null==e?e:or(e,Zi(t,3),yc)},Cn.forInRight=function(e,t){return null==e?e:ar(e,Zi(t,3),yc)},Cn.forOwn=function(e,t){return e&&cr(e,Zi(t,3))},Cn.forOwnRight=function(e,t){return e&&sr(e,Zi(t,3))},Cn.get=dc,Cn.gt=qa,Cn.gte=Sa,Cn.has=function(e,t){return null!=e&&to(e,t,pr)},Cn.hasIn=pc,Cn.head=Ao,Cn.identity=Uc,Cn.includes=function(e,t,n,r){e=Aa(e)?e:Cc(e),n=n&&!r?tc(n):0;var i=e.length;return n<0&&(n=on(i+n,0)),Za(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&yt(e,t,n)>-1},Cn.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:tc(n);return i<0&&(i=on(r+i,0)),yt(e,t,i)},Cn.inRange=function(e,t,n){return t=ec(t),void 0===n?(n=t,t=0):n=ec(n),function(e,t,n){return e>=an(t,n)&&e=-9007199254740991&&e<=9007199254740991},Cn.isSet=Ya,Cn.isString=Za,Cn.isSymbol=$a,Cn.isTypedArray=Xa,Cn.isUndefined=function(e){return void 0===e},Cn.isWeakMap=function(e){return Ba(e)&&eo(e)==k},Cn.isWeakSet=function(e){return Ba(e)&&"[object WeakSet]"==hr(e)},Cn.join=function(e,t){return null==e?"":nn.call(e,t)},Cn.kebabCase=Tc,Cn.last=Po,Cn.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=r;return void 0!==n&&(i=(i=tc(n))<0?on(r+i,0):an(i,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,i):mt(e,wt,i,!0)},Cn.lowerCase=Ec,Cn.lowerFirst=Ac,Cn.lt=Ka,Cn.lte=Qa,Cn.max=function(e){return e&&e.length?nr(e,Uc,dr):void 0},Cn.maxBy=function(e,t){return e&&e.length?nr(e,Zi(t,2),dr):void 0},Cn.mean=function(e){return kt(e,Uc)},Cn.meanBy=function(e,t){return kt(e,Zi(t,2))},Cn.min=function(e){return e&&e.length?nr(e,Uc,jr):void 0},Cn.minBy=function(e,t){return e&&e.length?nr(e,Zi(t,2),jr):void 0},Cn.stubArray=ns,Cn.stubFalse=rs,Cn.stubObject=function(){return{}},Cn.stubString=function(){return""},Cn.stubTrue=function(){return!0},Cn.multiply=ls,Cn.nth=function(e,t){return e&&e.length?Sr(e,tc(t)):void 0},Cn.noConflict=function(){return We._===this&&(We._=Se),this},Cn.noop=$c,Cn.now=da,Cn.pad=function(e,t,n){e=oc(e);var r=(t=tc(t))?Bt(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Oi(Qt(i),n)+e+Oi(Kt(i),n)},Cn.padEnd=function(e,t,n){e=oc(e);var r=(t=tc(t))?Bt(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var i=ln();return an(e+i*(t-e+Re("1e-"+((i+"").length-1))),t)}return Hr(e,t)},Cn.reduce=function(e,t,n){var r=Ta(e)?dt:Mt,i=arguments.length<3;return r(e,Zi(t,4),n,i,Jn)},Cn.reduceRight=function(e,t,n){var r=Ta(e)?pt:Mt,i=arguments.length<3;return r(e,Zi(t,4),n,i,er)},Cn.repeat=function(e,t,n){return t=(n?oo(e,t,n):void 0===t)?1:tc(t),Lr(oc(e),t)},Cn.replace=function(){var e=arguments,t=oc(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Cn.result=function(e,t,n){var r=-1,i=(t=oi(t,e)).length;for(i||(i=1,e=void 0);++r9007199254740991)return[];var n=4294967295,r=an(e,4294967295);e-=4294967295;for(var i=Ct(r,t=Zi(t));++n=o)return e;var c=n-Bt(r);if(c<1)return r;var s=a?ci(a,0,c).join(""):e.slice(0,c);if(void 0===i)return s+r;if(a&&(c+=s.length-c),Ga(i)){if(e.slice(c).search(i)){var l,u=s;for(i.global||(i=ve(i.source,oc(re.exec(i))+"g")),i.lastIndex=0;l=i.exec(u);)var f=l.index;s=s.slice(0,void 0===f?c:f)}}else if(e.indexOf($r(i),c)!=c){var h=s.lastIndexOf(i);h>-1&&(s=s.slice(0,h))}return s+r},Cn.unescape=function(e){return(e=oc(e))&&V.test(e)?e.replace(D,Ut):e},Cn.uniqueId=function(e){var t=++Me;return oc(e)+t},Cn.upperCase=Dc,Cn.upperFirst=Pc,Cn.each=oa,Cn.eachRight=aa,Cn.first=Ao,Zc(Cn,(is={},cr(Cn,(function(e,t){je.call(Cn.prototype,t)||(is[t]=e)})),is),{chain:!1}),Cn.VERSION="4.17.20",ot(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Cn[e].placeholder=Cn})),ot(["drop","take"],(function(e,t){Tn.prototype[e]=function(n){n=void 0===n?1:on(tc(n),0);var r=this.__filtered__&&!t?new Tn(this):this.clone();return r.__filtered__?r.__takeCount__=an(n,r.__takeCount__):r.__views__.push({size:an(n,4294967295),type:e+(r.__dir__<0?"Right":"")}),r},Tn.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),ot(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Tn.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:Zi(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),ot(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Tn.prototype[e]=function(){return this[n](1).value()[0]}})),ot(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Tn.prototype[e]=function(){return this.__filtered__?new Tn(this):this[n](1)}})),Tn.prototype.compact=function(){return this.filter(Uc)},Tn.prototype.find=function(e){return this.filter(e).head()},Tn.prototype.findLast=function(e){return this.reverse().find(e)},Tn.prototype.invokeMap=Dr((function(e,t){return"function"==typeof e?new Tn(this):this.map((function(n){return gr(n,e,t)}))})),Tn.prototype.reject=function(e){return this.filter(ka(Zi(e)))},Tn.prototype.slice=function(e,t){e=tc(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Tn(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),void 0!==t&&(n=(t=tc(t))<0?n.dropRight(-t):n.take(t-e)),n)},Tn.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Tn.prototype.toArray=function(){return this.take(4294967295)},cr(Tn.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),i=Cn[r?"take"+("last"==t?"Right":""):t],o=r||/^find/.test(t);i&&(Cn.prototype[t]=function(){var t=this.__wrapped__,a=r?[1]:arguments,c=t instanceof Tn,s=a[0],l=c||Ta(t),u=function(e){var t=i.apply(Cn,ht([e],a));return r&&f?t[0]:t};l&&n&&"function"==typeof s&&1!=s.length&&(c=l=!1);var f=this.__chain__,h=!!this.__actions__.length,d=o&&!f,p=c&&!h;if(!o&&l){t=p?t:new Tn(this);var z=e.apply(t,a);return z.__actions__.push({func:ea,args:[u],thisArg:void 0}),new On(z,f)}return d&&p?e.apply(this,a):(z=this.thru(u),d?r?z.value()[0]:z.value():z)})})),ot(["pop","push","shift","sort","splice","unshift"],(function(e){var t=ye[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Cn.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ta(i)?i:[],e)}return this[n]((function(n){return t.apply(Ta(n)?n:[],e)}))}})),cr(Tn.prototype,(function(e,t){var n=Cn[t];if(n){var r=n.name+"";je.call(mn,r)||(mn[r]=[]),mn[r].push({name:t,func:n})}})),mn[_i(void 0,2).name]=[{name:"wrapper",func:void 0}],Tn.prototype.clone=function(){var e=new Tn(this.__wrapped__);return e.__actions__=zi(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=zi(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=zi(this.__views__),e},Tn.prototype.reverse=function(){if(this.__filtered__){var e=new Tn(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Tn.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ta(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?void 0:this.__values__[this.__index__++]}},Cn.prototype.plant=function(e){for(var t,n=this;n instanceof Sn;){var r=_o(n);r.__index__=0,r.__values__=void 0,t?i.__wrapped__=r:t=r;var i=r;n=n.__wrapped__}return i.__wrapped__=e,t},Cn.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Tn){var t=e;return this.__actions__.length&&(t=new Tn(this)),(t=t.reverse()).__actions__.push({func:ea,args:[Ro],thisArg:void 0}),new On(t,this.__chain__)}return this.thru(Ro)},Cn.prototype.toJSON=Cn.prototype.valueOf=Cn.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},Cn.prototype.first=Cn.prototype.head,jt&&(Cn.prototype[jt]=function(){return this}),Cn}();We._=Wt,void 0===(i=function(){return Wt}.call(t,n,t,r))||(r.exports=i)}).call(this)}).call(this,n(7),n(21)(e))},function(e,t){e.exports=r},function(e,t,n){e.exports=function(){"use strict";var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,c=a&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),l=s&&/Qt\/\d+\.\d+/.test(e),u=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),h=/Apple Computer/.test(navigator.vendor),d=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),z=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),v=/Android/.test(e),g=z||v||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),m=z||/Mac/.test(t),y=/\bCrOS\b/.test(e),b=/win/i.test(t),w=f&&e.match(/Version\/(\d*\.\d*)/);w&&(w=Number(w[1])),w&&w>=15&&(f=!1,s=!0);var k=m&&(l||f&&(null==w||w<12.11)),x=n||a&&c>=9;function j(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}var M,_=function(e,t){var n=e.className,r=j(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}};function C(e){for(var t=e.childNodes.length;t>0;--t)e.removeChild(e.firstChild);return e}function q(e,t){return C(e).appendChild(t)}function S(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o=t)return a+(t-o);a+=c-o,a+=n-a%n,o=c+1}}z?L=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:a&&(L=function(e){try{e.select()}catch(e){}});var N=function(){this.id=null,this.f=null,this.time=0,this.handler=D(this.onTimeout,this)};function I(e,t){for(var n=0;n=t)return r+Math.min(a,t-i);if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var G=[""];function Y(e){for(;G.length<=e;)G.push(Z(G)+" ");return G[e]}function Z(e){return e[e.length-1]}function $(e,t){for(var n=[],r=0;r"\x80"&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}var ne=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function re(e){return e.charCodeAt(0)>=768&&ne.test(e)}function ie(e,t,n){for(;(n<0?t>0:tn?-1:1;;){if(t==n)return t;var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i);if(o==t)return e(o)?t:n;e(o)?n=o:t=o+r}}var ae=null;function ce(e,t,n){var r;ae=null;for(var i=0;it)return i;o.to==t&&(o.from!=o.to&&"before"==n?r=i:ae=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:ae=i)}return null!=r?r:ae}var se=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/;function o(e,t,n){this.level=e,this.from=t,this.to=n}return function(a,c){var s="ltr"==c?"L":"R";if(0==a.length||"ltr"==c&&!e.test(a))return!1;for(var l,u=a.length,f=[],h=0;h-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var n=he(e,t);if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i0}function me(e){e.prototype.on=function(e,t){fe(this,e,t)},e.prototype.off=function(e,t){de(this,e,t)}}function ye(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function be(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function we(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ke(e){ye(e),be(e)}function xe(e){return e.target||e.srcElement}function je(e){var t=e.which;return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),m&&e.ctrlKey&&1==t&&(t=3),t}var Me,_e,Ce=function(){if(a&&c<9)return!1;var e=S("div");return"draggable"in e||"dragDrop"in e}();function qe(e){if(null==Me){var t=S("span","\u200b");q(e,S("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Me=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&c<8))}var n=Me?S("span","\u200b"):S("span","\xa0",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Se(e){if(null!=_e)return _e;var t=q(e,document.createTextNode("A\u062eA")),n=M(t,0,1).getBoundingClientRect(),r=M(t,1,2).getBoundingClientRect();return C(e),!(!n||n.left==n.right)&&(_e=r.right-n.right<3)}var Oe,Te=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Ee=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t;try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ae="oncopy"in(Oe=S("div"))||(Oe.setAttribute("oncopy","return;"),"function"==typeof Oe.oncopy),He=null,Le={},De={};function Pe(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Le[e]=t}function Ve(e){if("string"==typeof e&&De.hasOwnProperty(e))e=De[e];else if(e&&"string"==typeof e.name&&De.hasOwnProperty(e.name)){var t=De[e.name];"string"==typeof t&&(t={name:t}),(e=K(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Ve("application/xml");if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Ve("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Ne(e,t){t=Ve(t);var n=Le[t.name];if(!n)return Ne(e,"text/plain");var r=n(e,t);if(Ie.hasOwnProperty(t.name)){var i=Ie[t.name];for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a];return r}var Ie={};function Re(e,t){P(t,Ie.hasOwnProperty(e)?Ie[e]:Ie[e]={})}function Be(e,t){if(!0===t)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Fe(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode;return n||{mode:e,state:t}}function Ue(e,t,n){return!e.startState||e.startState(t,n)}var We=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n};function Ge(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(t=e.first&&tn?et(n,Ge(e,n).text.length):function(e,t){var n=e.ch;return null==n||n>t?et(e.line,t):n<0?et(e.line,0):e}(t,Ge(e,t.line).text.length)}function st(e,t){for(var n=[],r=0;r=this.string.length},We.prototype.sol=function(){return this.pos==this.lineStart},We.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},We.prototype.next=function(){if(this.post},We.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},We.prototype.skipToEnd=function(){this.pos=this.string.length},We.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0},We.prototype.backUp=function(e){this.pos-=e},We.prototype.column=function(){return this.lastColumnPos0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e};if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},We.prototype.current=function(){return this.string.slice(this.start,this.pos)},We.prototype.hideFirstChars=function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}},We.prototype.lookAhead=function(e){var t=this.lineOracle;return t&&t.lookAhead(e)},We.prototype.baseToken=function(){var e=this.lineOracle;return e&&e.baseToken(this.pos)};var lt=function(e,t){this.state=e,this.lookAhead=t},ut=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1};function ft(e,t,n,r){var i=[e.state.modeGen],o={};bt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r);for(var a=n.state,c=function(r){n.baseTokens=i;var c=e.state.overlays[r],s=1,l=0;n.state=!0,bt(e,t.text,c.mode,n,(function(e,t){for(var n=s;le&&i.splice(s,1,e,i[s+1],r),s+=2,l=Math.min(e,r)}if(t)if(c.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2;else for(;ne.options.maxHighlightLength&&Be(e.doc.mode,r.state),o=ft(e,t,r);i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function dt(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return new ut(r,!0,t);var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),c=t;c>a;--c){if(c<=o.first)return o.first;var s=Ge(o,c-1),l=s.stateAfter;if(l&&(!n||c+(l instanceof lt?l.lookAhead:0)<=o.modeFrontier))return c;var u=V(s.text,null,e.options.tabSize);(null==i||r>u)&&(i=c-1,r=u)}return i}(e,t,n),a=o>r.first&&Ge(r,o-1).stateAfter,c=a?ut.fromSaved(r,a,o):new ut(r,Ue(r.mode),o);return r.iter(o,t,(function(n){pt(e,n.text,c);var r=c.line;n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&rt.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ut.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e);return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ut.prototype.baseToken=function(e){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2;var t=this.baseTokens[this.baseTokenPos+1];return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ut.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ut.fromSaved=function(e,t,n){return t instanceof lt?new ut(e,Be(e.mode,t.state),n,t.lookAhead):new ut(e,Be(e.mode,t),n)},ut.prototype.save=function(e){var t=!1!==e?Be(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new lt(t,this.maxLookAhead):t};var gt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n};function mt(e,t,n,r){var i,o,a=e.doc,c=a.mode,s=Ge(a,(t=ct(a,t)).line),l=dt(e,t.line,n),u=new We(s.text,e.options.tabSize,l);for(r&&(o=[]);(r||u.pose.options.maxHighlightLength?(c=!1,a&&pt(e,t,r,f.pos),f.pos=t.length,s=null):s=yt(vt(n,f,r.state,h),o),h){var d=h[0].name;d&&(s="m-"+(s?d+" "+s:d))}if(!c||u!=s){for(;l=t:o.to>t);(r||(r=[])).push(new xt(a,o.from,c?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r;if(e)for(var i=0;i=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var c=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&c)for(var y=0;yt)&&(!n||Et(n,o.marker)<0)&&(n=o.marker)}return n}function Pt(e,t,n,r,i){var o=Ge(e,t),a=kt&&o.markedSpans;if(a)for(var c=0;c=0&&f<=0||u<=0&&f>=0)&&(u<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(l.to,n)>=0:tt(l.to,n)>0)||u>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(l.from,r)<=0:tt(l.from,r)<0)))return!0}}}function Vt(e){for(var t;t=Ht(e);)e=t.find(-1,!0).line;return e}function Nt(e,t){var n=Ge(e,t),r=Vt(n);return n==r?t:Xe(r)}function It(e,t){if(t>e.lastLine())return t;var n,r=Ge(e,t);if(!Rt(e,r))return t;for(;n=Lt(r);)r=n.find(1,!0).line;return Xe(r)+1}function Rt(e,t){var n=kt&&t.markedSpans;if(n)for(var r=void 0,i=0;it.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Gt=function(e,t,n){this.text=e,St(this,t),this.height=n?n(this):1};function Yt(e){e.parent=null,qt(e)}Gt.prototype.lineNo=function(){return Xe(this)},me(Gt);var Zt={},$t={};function Xt(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?$t:Zt;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Kt(e,t){var n=O("span",null,null,s?"padding-right: .1px":null),r={pre:O("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0;r.pos=0,r.addToken=Jt,Se(e.display.measure)&&(a=le(o,e.doc.direction))&&(r.addToken=en(r.addToken,a)),r.map=[],nn(o,r,ht(e,o,t!=e.display.externalMeasured&&Xe(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=H(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=H(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(qe(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var c=r.content.lastChild;(/\bcm-tab\b/.test(c.className)||c.querySelector&&c.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=H(r.pre.className,r.textClass||"")),r}function Qt(e){var t=S("span","\u2022","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,n,r,i,o,s){if(t){var l,u=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e;for(var n=t,r="",i=0;il&&f.from<=l);h++);if(f.to>=u)return e(n,r,i,o,a,c,s);e(n,r.slice(0,f.to-l),i,o,null,c,s),o=null,r=r.slice(f.to-l),l=f.to}}}function tn(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function nn(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,c,s,l,u,f,h,d=i.length,p=0,z=1,v="",g=0;;){if(g==p){s=l=u=c="",h=null,f=null,g=1/0;for(var m=[],y=void 0,b=0;bp||k.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&g>w.to&&(g=w.to,l=""),k.className&&(s+=" "+k.className),k.css&&(c=(c?c+";":"")+k.css),k.startStyle&&w.from==p&&(u+=" "+k.startStyle),k.endStyle&&w.to==g&&(y||(y=[])).push(k.endStyle,w.to),k.title&&((h||(h={})).title=k.title),k.attributes)for(var x in k.attributes)(h||(h={}))[x]=k.attributes[x];k.collapsed&&(!f||Et(f.marker,k)<0)&&(f=w)}else w.from>p&&g>w.from&&(g=w.from)}if(y)for(var j=0;j=d)break;for(var _=Math.min(d,g);;){if(v){var C=p+v.length;if(!f){var q=C>_?v.slice(0,_-p):v;t.addToken(t,q,a?a+s:s,u,p+q.length==g?l:"",c,h)}if(C>=_){v=v.slice(_-p),p=_;break}p=C,u=""}v=i.slice(o,o=n[z++]),a=Xt(n[z++],t.cm.options)}}else for(var S=1;Sn)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function On(e,t,n,r){return An(e,En(e,t),n,r)}function Tn(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&t2&&o.push((s.bottom+l.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),(o=function(e,t,n,r){var i,o=Dn(t.map,n,r),s=o.node,l=o.start,u=o.end,f=o.collapse;if(3==s.nodeType){for(var h=0;h<4;h++){for(;l&&re(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+u1}(e))return t;var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI;return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var d;l>0&&(f=r="right"),i=e.options.lineWrapping&&(d=s.getClientRects()).length>1?d["right"==r?d.length-1:0]:s.getBoundingClientRect()}if(a&&c<9&&!l&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0];i=p?{left:p.left,right:p.left+ir(e.display),top:p.top,bottom:p.bottom}:Ln}for(var z=i.top-t.rect.top,v=i.bottom-t.rect.top,g=(z+v)/2,m=t.view.measure.heights,y=0;yt)&&(i=(o=s-c)-1,t>=s&&(a="right")),null!=i){if(r=e[l+2],c==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)r=e[2+(l-=3)],a="left";if("right"==n&&i==s-c)for(;l=0&&(n=e[i]).left==n.right;i--);return n}function Vn(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t=r.text.length?(s=r.text.length,l="before"):s<=0&&(s=0,l="after"),!c)return a("before"==l?s-1:s,"before"==l);function u(e,t,n){return a(n?e-1:e,1==c[t].level!=n)}var f=ce(c,s,l),h=ae,d=u(s,f,"before"==l);return null!=h&&(d.other=u(s,h,"before"!=l)),d}function Zn(e,t){var n=0;t=ct(e.doc,t),e.options.lineWrapping||(n=ir(e.display)*t.ch);var r=Ge(e.doc,t.line),i=Ft(r)+xn(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function $n(e,t,n,r,i){var o=et(e,t,n);return o.xRel=i,r&&(o.outside=r),o}function Xn(e,t,n){var r=e.doc;if((n+=e.display.viewOffset)<0)return $n(r.first,0,null,-1,-1);var i=Ke(r,n),o=r.first+r.size-1;if(i>o)return $n(r.first+r.size-1,Ge(r,o).text.length,null,1,1);t<0&&(t=0);for(var a=Ge(r,i);;){var c=er(e,a,i,t,n),s=Dt(a,c.ch+(c.xRel>0||c.outside>0?1:0));if(!s)return c;var l=s.find(1);if(l.line==i)return l;a=Ge(r,i=l.line)}}function Kn(e,t,n,r){r-=Fn(t);var i=t.text.length,o=oe((function(t){return An(e,n,t-1).bottom<=r}),i,0);return{begin:o,end:i=oe((function(t){return An(e,n,t).top>r}),o,i)}}function Qn(e,t,n,r){return n||(n=En(e,t)),Kn(e,t,n,Un(e,t,An(e,n,r),"line").top)}function Jn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function er(e,t,n,r,i){i-=Ft(t);var o=En(e,t),a=Fn(t),c=0,s=t.text.length,l=!0,u=le(t,e.doc.direction);if(u){var f=(e.options.lineWrapping?nr:tr)(e,t,n,o,u,r,i);c=(l=1!=f.level)?f.from:f.to-1,s=l?f.to:f.from-1}var h,d,p=null,z=null,v=oe((function(t){var n=An(e,o,t);return n.top+=a,n.bottom+=a,!!Jn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,z=n),!0)}),c,s),g=!1;if(z){var m=r-z.left=b.bottom?1:0}return $n(n,v=ie(t.text,v,1),d,g,r-h)}function tr(e,t,n,r,i,o,a){var c=oe((function(c){var s=i[c],l=1!=s.level;return Jn(Yn(e,et(n,l?s.to:s.from,l?"before":"after"),"line",t,r),o,a,!0)}),0,i.length-1),s=i[c];if(c>0){var l=1!=s.level,u=Yn(e,et(n,l?s.from:s.to,l?"after":"before"),"line",t,r);Jn(u,o,a,!0)&&u.top>a&&(s=i[c-1])}return s}function nr(e,t,n,r,i,o,a){var c=Kn(e,t,r,a),s=c.begin,l=c.end;/\s/.test(t.text.charAt(l-1))&&l--;for(var u=null,f=null,h=0;h=l||d.to<=s)){var p=An(e,r,1!=d.level?Math.min(l,d.to)-1:Math.max(s,d.from)).right,z=pz)&&(u=d,f=z)}}return u||(u=i[i.length-1]),u.froml&&(u={from:u.from,to:l,level:u.level}),u}function rr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Hn){Hn=S("pre",null,"CodeMirror-line-like");for(var t=0;t<49;++t)Hn.appendChild(document.createTextNode("x")),Hn.appendChild(S("br"));Hn.appendChild(document.createTextNode("x"))}q(e.measure,Hn);var n=Hn.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),C(e.measure),n||1}function ir(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=S("span","xxxxxxxxxx"),n=S("pre",[t],"CodeMirror-line-like");q(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function or(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var c=e.display.gutterSpecs[a].className;n[c]=o.offsetLeft+o.clientLeft+i,r[c]=o.clientWidth}return{fixedPos:ar(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ar(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function cr(e){var t=rr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/ir(e.display)-3);return function(i){if(Rt(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;a0&&(s=Ge(e.doc,l.line).text).length==l.ch){var u=V(s,s.length,e.options.tabSize)-s.length;l=et(l.line,Math.max(0,Math.round((o-Mn(e.display).left)/ir(e.display))-u))}return l}function ur(e,t){if(t>=e.display.viewTo)return null;if((t-=e.display.viewFrom)<0)return null;for(var n=e.display.view,r=0;rt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)kt&&Nt(e.doc,t)i.viewFrom?dr(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)dr(e);else if(t<=i.viewFrom){var o=pr(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):dr(e)}else if(n>=i.viewTo){var a=pr(e,t,t,-1);a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):dr(e)}else{var c=pr(e,t,t,-1),s=pr(e,n,n+r,1);c&&s?(i.view=i.view.slice(0,c.index).concat(on(e,c.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):dr(e)}var l=i.externalMeasured;l&&(n=i.lineN&&t=r.viewTo)){var o=r.view[ur(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==I(a,n)&&a.push(n)}}}function dr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pr(e,t,n,r){var i,o=ur(e,t),a=e.display.view;if(!kt||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var c=e.display.viewFrom,s=0;s0){if(o==a.length-1)return null;i=c+a[o].size-t,o++}else i=c-t;t+=i,n+=i}for(;Nt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null;n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function zr(e){for(var t=e.display.view,n=0,r=0;r=e.display.viewTo||c.to().linet||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(z,n||0,null==r?h:r,(function(e,t,i,f){var v="ltr"==i,g=d(e,v?"left":"right"),m=d(t-1,v?"right":"left"),y=null==n&&0==e,b=null==r&&t==h,w=0==f,k=!z||f==z.length-1;if(m.top-g.top<=3){var x=(l?b:y)&&k,j=(l?y:b)&&w?c:(v?g:m).left,M=x?s:(v?m:g).right;u(j,g.top,M-j,g.bottom)}else{var _,C,q,S;v?(_=l&&y&&w?c:g.left,C=l?s:p(e,i,"before"),q=l?c:p(t,i,"after"),S=l&&b&&k?s:m.right):(_=l?p(e,i,"before"):c,C=!l&&y&&w?s:g.right,q=!l&&b&&k?c:m.left,S=l?p(t,i,"after"):s),u(_,g.top,C-_,g.bottom),g.bottom0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function kr(e){e.state.focused||(e.display.input.focus(),jr(e))}function xr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Mr(e))}),100)}function jr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,A(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),wr(e))}function Mr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,_(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function _r(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r.005||h<-.005)&&($e(i.line,s),Cr(i.line),i.rest))for(var d=0;de.display.sizerWidth){var p=Math.ceil(l/ir(e.display));p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Cr(e){if(e.widgets)for(var t=0;t=a&&(o=Ke(t,Ft(Ge(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Sr(e,t){var n=e.display,r=rr(e.display);t.top<0&&(t.top=0);var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=qn(e),a={};t.bottom-t.top>o&&(t.bottom=t.top+o);var c=e.doc.height+jn(n),s=t.topc-r;if(t.topi+o){var u=Math.min(t.top,(l?c:t.bottom)-o);u!=i&&(a.scrollTop=u)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,h=Cn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),d=t.right-t.left>h;return d&&(t.right=t.left+h),t.left<10?a.scrollLeft=0:t.lefth+f-3&&(a.scrollLeft=t.right+(d?0:10)-h),a}function Or(e,t){null!=t&&(Ar(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Tr(e){Ar(e);var t=e.getCursor();e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Er(e,t,n){null==t&&null==n||Ar(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Ar(e){var t=e.curOp.scrollToPos;t&&(e.curOp.scrollToPos=null,Hr(e,Zn(e,t.from),Zn(e,t.to),t.margin))}function Hr(e,t,n,r){var i=Sr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r});Er(e,i.scrollLeft,i.scrollTop)}function Lr(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||si(e,{top:t}),Dr(e,t,!0),n&&si(e),ri(e,100))}function Dr(e,t,n){t=Math.max(0,Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t)),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Pr(e,t,n,r){t=Math.max(0,Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth)),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,fi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Vr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+jn(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+_n(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Nr=function(e,t,n){this.cm=n;var r=this.vert=S("div",[S("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=S("div",[S("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");r.tabIndex=i.tabIndex=-1,e(r),e(i),fe(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),fe(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&c<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};Nr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Nr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Nr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Nr.prototype.zeroWidthHack=function(){var e=m&&!d?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new N,this.disableVert=new N},Nr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function r(){var i=e.getBoundingClientRect();("vert"==n?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,r)}))},Nr.prototype.clear=function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)};var Ir=function(){};function Rr(e,t){t||(t=Vr(e));var n=e.display.barWidth,r=e.display.barHeight;Br(e,t);for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&_r(e),Br(e,Vr(e)),n=e.display.barWidth,r=e.display.barHeight}function Br(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}Ir.prototype.update=function(){return{bottom:0,right:0}},Ir.prototype.setScrollLeft=function(){},Ir.prototype.setScrollTop=function(){},Ir.prototype.clear=function(){};var Fr={native:Nr,null:Ir};function Ur(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&_(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Fr[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),fe(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?Pr(e,t):Lr(e,t)}),e),e.display.scrollbars.addClass&&A(e.display.wrapper,e.display.scrollbars.addClass)}var Wr=0;function Gr(e){var t;e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Wr},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function Yr(e){var t=e.curOp;t&&function(e,t){var n=e.ownsGroup;if(n)try{!function(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function $r(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Xr(e){var t=e.cm,n=t.display;e.updatedDisplay&&_r(t),e.barMeasure=Vr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=On(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+_n(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Cn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Kr(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=S("div","\u200b",null,"position: absolute;\n top: "+(t.top-n.viewOffset-xn(e.display))+"px;\n height: "+(t.bottom-t.top+_n(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,function(e,t,n,r){var i;null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t);for(var o=0;o<5;o++){var a=!1,c=Yn(e,t),s=n&&n!=t?Yn(e,n):c,l=Sr(e,i={left:Math.min(c.left,s.left),top:Math.min(c.top,s.top)-r,right:Math.max(c.left,s.left),bottom:Math.max(c.bottom,s.bottom)+r}),u=e.doc.scrollTop,f=e.doc.scrollLeft;if(null!=l.scrollTop&&(Lr(e,l.scrollTop),Math.abs(e.doc.scrollTop-u)>1&&(a=!0)),null!=l.scrollLeft&&(Pr(e,l.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(a=!0)),!a)break}return i}(t,ct(r,e.scrollToPos.from),ct(r,e.scrollToPos.to),e.scrollToPos.margin));var i=e.maybeHiddenMarkers,o=e.maybeUnhiddenMarkers;if(i)for(var a=0;a=e.display.viewTo)){var n=+new Date+e.options.workTime,r=dt(e,t.highlightFrontier),i=[];t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var a=o.styles,c=o.text.length>e.options.maxHighlightLength?Be(t.mode,r.state):null,s=ft(e,o,r,!0);c&&(r.state=c),o.styles=s.styles;var l=o.styleClasses,u=s.classes;u?o.styleClasses=u:l&&(o.styleClasses=null);for(var f=!a||a.length!=o.styles.length||l!=u&&(!l||!u||l.bgClass!=u.bgClass||l.textClass!=u.textClass),h=0;!f&&hn)return ri(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Jr(e,(function(){for(var t=0;t=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==zr(e))return!1;hi(e)&&(dr(e),t.dims=or(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),kt&&(o=Nt(e.doc,o),a=It(e.doc,a));var c=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;!function(e,t,n){var r=e.display;0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=on(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=on(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,ur(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=Ft(Ge(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var l=zr(e);if(!c&&0==l&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var u=function(e){if(e.hasFocus())return null;var t=E();if(!t||!T(e.display.lineDiv,t))return null;var n={activeElt:t};if(window.getSelection){var r=window.getSelection();r.anchorNode&&r.extend&&T(e.display.lineDiv,r.anchorNode)&&(n.anchorNode=r.anchorNode,n.anchorOffset=r.anchorOffset,n.focusNode=r.focusNode,n.focusOffset=r.focusOffset)}return n}(e);return l>4&&(n.lineDiv.style.display="none"),function(e,t,n){var r=e.display,i=e.options.lineNumbers,o=r.lineDiv,a=o.firstChild;function c(t){var n=t.nextSibling;return s&&m&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var l=r.view,u=r.viewFrom,f=0;f-1&&(d=!1),un(e,h,u,n)),d&&(C(h.lineNumber),h.lineNumber.appendChild(document.createTextNode(Je(e.options,u)))),a=h.node.nextSibling}else{var p=gn(e,h,u,n);o.insertBefore(p,a)}u+=h.size}for(;a;)a=c(a)}(e,n.updateLineNumbers,t.dims),l>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=E()&&(e.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(e.activeElt.nodeName)&&e.anchorNode&&T(document.body,e.anchorNode)&&T(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange();n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(u),C(n.cursorDiv),C(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,c&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function ci(e,t){for(var n=t.viewport,r=!0;;r=!1){if(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Cn(e))r&&(t.visible=qr(e.display,e.doc,n));else if(n&&null!=n.top&&(n={top:Math.min(e.doc.height+jn(e.display)-qn(e),n.top)}),t.visible=qr(e.display,e.doc,n),t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)break;if(!ai(e,t))break;_r(e);var i=Vr(e);vr(e),Rr(e,i),ui(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function si(e,t){var n=new oi(e,t);if(ai(e,n)){_r(e),ci(e,n);var r=Vr(e);vr(e),Rr(e,r),ui(e,r),n.finish()}}function li(e){var t=e.gutters.offsetWidth;e.sizer.style.marginLeft=t+"px"}function ui(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+_n(e)+"px"}function fi(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ar(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;ac.clientWidth,u=c.scrollHeight>c.clientHeight;if(i&&l||o&&u){if(o&&m&&s)e:for(var h=t.target,d=a.view;h!=c;h=h.parentNode)for(var p=0;p=0&&tt(e,r.to())<=0)return n}return-1};var xi=function(e,t){this.anchor=e,this.head=t};function ji(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n];t.sort((function(e,t){return tt(e.from(),t.from())})),n=I(t,i);for(var o=1;o0:s>=0){var l=ot(c.from(),a.from()),u=it(c.to(),a.to()),f=c.empty()?a.from()==a.head:c.from()==c.head;o<=n&&--n,t.splice(--o,2,new xi(f?u:l,f?l:u))}}return new ki(t,n)}function Mi(e,t){return new ki([new xi(e,t||e)],0)}function _i(e){return e.text?et(e.from.line+e.text.length-1,Z(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ci(e,t){if(tt(e,t.from)<0)return e;if(tt(e,t.to)<=0)return _i(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=_i(t).ch-t.to.ch),et(n,r)}function qi(e,t){for(var n=[],r=0;r1&&e.remove(c.line+1,p-1),e.insert(c.line+1,g)}sn(e,"change",e,t)}function Hi(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;ac-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Ni(e.done),Z(e.done)):e.done.length&&!Z(e.done).ranges?Z(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),Z(e.done)):void 0}(i,i.lastOp==r)))a=Z(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=_i(t):o.changes.push(Vi(e,t));else{var s=Z(i.done);for(s&&s.ranges||Ri(e.sel,i.done),o={changes:[Vi(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=c,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||pe(e,"historyAdded")}function Ri(e,t){var n=Z(t);n&&n.ranges&&n.equals(e)||t.push(e)}function Bi(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Fi(e){if(!e)return null;for(var t,n=0;n-1&&(Z(c)[f]=l[f],delete l[f])}}}return r}function Gi(e,t,n,r){if(r){var i=e.anchor;if(n){var o=tt(t,i)<0;o!=tt(n,i)<0?(i=t,t=n):o!=tt(t,n)<0&&(t=n)}return new xi(i,t)}return new xi(n||t,t)}function Yi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new ki([Gi(e.sel.primary(),t,n,i)],0),r)}function Zi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o=t.ch:c.to>t.ch))){if(i&&(pe(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var f=s.find(r<0?1:-1),h=void 0;if((r<0?u:l)&&(f=oo(e,f,-r,f&&f.line==t.line?o:null)),f&&f.line==t.line&&(h=tt(f,n))&&(r<0?h<0:h>0))return ro(e,f,t,r,i)}var d=s.find(r<0?-1:1);return(r<0?l:u)&&(d=oo(e,d,r,d.line==t.line?o:null)),d?ro(e,d,t,r,i):null}}return t}function io(e,t,n,r,i){var o=r||1;return ro(e,t,n,o,i)||!i&&ro(e,t,n,o,!0)||ro(e,t,n,-o,i)||!i&&ro(e,t,n,-o,!0)||(e.cantEdit=!0,et(e.first,0))}function oo(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?ct(e,et(t.line-1)):null:n>0&&t.ch==(r||Ge(e,t.line)).text.length?t.line0)){var u=[s,1],f=tt(l.from,c.from),h=tt(l.to,c.to);(f<0||!a.inclusiveLeft&&!f)&&u.push({from:l.from,to:c.from}),(h>0||!a.inclusiveRight&&!h)&&u.push({from:c.to,to:l.to}),i.splice.apply(i,u),s+=u.length-3}}return i}(e,t.from,t.to);if(r)for(var i=r.length-1;i>=0;--i)lo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin});else lo(e,t)}}function lo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var n=qi(e,t);Ii(e,t,n,e.cm?e.cm.curOp.id:NaN),ho(e,t,n,_t(e,t));var r=[];Hi(e,(function(e,n){n||-1!=I(r,e.history)||(go(e.history,t),r.push(e.history)),ho(e,t,null,_t(e,t))}))}}function uo(e,t,n){var r=e.cm&&e.cm.state.suppressEdits;if(!r||n){for(var i,o=e.history,a=e.sel,c="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,l=0;l=0;--d){var p=h(d);if(p)return p.v}}}}function fo(e,t){if(0!=t&&(e.first+=t,e.sel=new ki($(e.sel.ranges,(function(e){return new xi(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){fr(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:et(o,Ge(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Ye(e,t.from,t.to),n||(n=qi(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,c=!1,s=o.line;e.options.lineWrapping||(s=Xe(Vt(Ge(r,o.line))),r.iter(s,a.line+1,(function(e){if(e==i.maxLine)return c=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ve(e),Ai(r,t,n,cr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=Ut(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,c=!1)})),c&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontiern;r--){var i=Ge(e,r).stateAfter;if(i&&(!(i instanceof lt)||r+i.lookAhead1||!(this.children[0]instanceof yo))){var c=[];this.collapse(c),this.children=[new yo(c)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t50){for(var a=i.lines.length%25+25,c=a;c10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r0||0==a&&!1!==o.clearWhenEmpty)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Pt(e,t.line,t,n,o)||t.line!=n.line&&Pt(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");kt=!0}o.addToHistory&&Ii(e,{from:t,to:n,origin:"markText"},e.sel,NaN);var c,s=t.line,l=e.cm;if(e.iter(s,n.line+1,(function(e){l&&o.collapsed&&!l.options.lineWrapping&&Vt(e)==l.display.maxLine&&(c=!0),o.collapsed&&s!=t.line&&$e(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new xt(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){Rt(e,t)&&$e(t,0)})),o.clearOnEnter&&fe(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(wt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++xo,o.atomic=!0),l){if(c&&(l.curOp.updateMaxLine=!0),o.collapsed)fr(l,t.line,n.line+1);else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var u=t.line;u<=n.line;u++)hr(l,u,"text");o.atomic&&to(l.doc),sn(l,"markerAdded",l,o)}return o}jo.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&Gr(e),ge(this,"clear")){var n=this.find();n&&sn(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=l,e.display.maxLineLength=u,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&fr(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&to(e.doc)),e&&sn(e,"markerCleared",e,this,r,i),t&&Yr(e),this.parent&&this.parent.clear()}},jo.prototype.find=function(e,t){var n,r;null==e&&"bookmark"==this.type&&(e=1);for(var i=0;i=0;s--)so(this,r[s]);c?Ki(this,c):this.cm&&Tr(this.cm)})),undo:ni((function(){uo(this,"undo")})),redo:ni((function(){uo(this,"redo")})),undoSelection:ni((function(){uo(this,"undo",!0)})),redoSelection:ni((function(){uo(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ct(this,e),t=ct(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans;if(a)for(var c=0;c=s.to||null==s.from&&i!=e.line||null!=s.from&&i==t.line&&s.from>=t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i})),r},getAllMarks:function(){var e=[];return this.iter((function(t){var n=t.markedSpans;if(n)for(var r=0;re)return t=e,!0;e-=o,++n})),ct(this,et(n,t))},indexFromPos:function(e){var t=(e=ct(this,e)).ch;if(e.linet&&(t=e.from),null!=e.to&&e.to-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20);try{var f=e.dataTransfer.getData("Text");if(f){var h;if(t.state.draggingText&&!t.state.draggingText.copy&&(h=t.listSelections()),Ji(t.doc,Mi(n,n)),h)for(var d=0;d=0;t--)po(e.doc,"",r[t].from,r[t].to,"+delete");Tr(e)}))}function Xo(e,t,n){var r=ie(e.text,t+n,n);return r<0||r>e.text.length?null:r}function Ko(e,t,n){var r=Xo(e,t.ch,n);return null==r?null:new et(t.line,r,n<0?"after":"before")}function Qo(e,t,n,r,i){if(e){"rtl"==t.doc.direction&&(i=-i);var o=le(n,t.doc.direction);if(o){var a,c=i<0?Z(o):o[0],s=i<0==(1==c.level)?"after":"before";if(c.level>0||"rtl"==t.doc.direction){var l=En(t,n);a=i<0?n.text.length-1:0;var u=An(t,l,a).top;a=oe((function(e){return An(t,l,e).top==u}),i<0==(1==c.level)?c.from:c.to-1,a),"before"==s&&(a=Xo(n,a,1))}else a=i<0?c.to:c.from;return new et(r,a,s)}}return new et(r,i<0?n.text.length:0,i<0?"before":"after")}Ro.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},Ro.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},Ro.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},Ro.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},Ro.default=m?Ro.macDefault:Ro.pcDefault;var Jo={selectAll:ao,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),B)},killLine:function(e){return $o(e,(function(t){if(t.empty()){var n=Ge(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Ge(e.doc,i.line-1).text;a&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),et(i.line-1,a.length-1),i,"+transpose"))}n.push(new xi(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Jr(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input");t=e.listSelections();for(var r=0;r-1&&(tt((i=l.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,l=ei(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,de(i.wrapper.ownerDocument,"mouseup",l),de(i.wrapper.ownerDocument,"mousemove",u),de(i.scroller,"dragstart",f),de(i.scroller,"drop",l),o||(ye(t),r.addNew||Yi(e.doc,n,null,null,r.extend),s&&!h||a&&9==c?setTimeout((function(){i.wrapper.ownerDocument.body.focus({preventScroll:!0}),i.input.focus()}),20):i.input.focus())})),u=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},f=function(){return o=!0};s&&(i.scroller.draggable=!0),e.state.draggingText=l,l.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),fe(i.wrapper.ownerDocument,"mouseup",l),fe(i.wrapper.ownerDocument,"mousemove",u),fe(i.scroller,"dragstart",f),fe(i.scroller,"drop",l),xr(e),setTimeout((function(){return i.input.focus()}),20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc;ye(t);var a,c,s=o.sel,l=s.ranges;if(r.addNew&&!r.extend?(c=o.sel.contains(n),a=c>-1?l[c]:new xi(n,n)):(a=o.sel.primary(),c=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new xi(n,n)),n=lr(e,t,!0,!0),c=-1;else{var u=za(e,n,r.unit);a=r.extend?Gi(a,u.anchor,u.head,r.extend):u}r.addNew?-1==c?(c=l.length,Qi(o,ji(e,l.concat([a]),c),{scroll:!1,origin:"*mouse"})):l.length>1&&l[c].empty()&&"char"==r.unit&&!r.extend?(Qi(o,ji(e,l.slice(0,c).concat(l.slice(c+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):$i(o,c,a,F):(c=0,Qi(o,new ki([a],0),F),s=o.sel);var f=n;function h(t){if(0!=tt(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],l=e.options.tabSize,u=V(Ge(o,n.line).text,n.ch,l),h=V(Ge(o,t.line).text,t.ch,l),d=Math.min(u,h),p=Math.max(u,h),z=Math.min(n.line,t.line),v=Math.min(e.lastLine(),Math.max(n.line,t.line));z<=v;z++){var g=Ge(o,z).text,m=W(g,d,l);d==p?i.push(new xi(et(z,m),et(z,m))):g.length>m&&i.push(new xi(et(z,m),et(z,W(g,p,l))))}i.length||i.push(new xi(n,n)),Qi(o,ji(e,s.ranges.slice(0,c).concat(i),c),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var y,b=a,w=za(e,t,r.unit),k=b.anchor;tt(w.anchor,k)>0?(y=w.head,k=ot(b.from(),w.anchor)):(y=w.anchor,k=it(b.to(),w.head));var x=s.ranges.slice(0);x[c]=function(e,t){var n=t.anchor,r=t.head,i=Ge(e.doc,n.line);if(0==tt(n,r)&&n.sticky==r.sticky)return t;var o=le(i);if(!o)return t;var a=ce(o,n.ch,n.sticky),c=o[a];if(c.from!=n.ch&&c.to!=n.ch)return t;var s,l=a+(c.from==n.ch==(1!=c.level)?0:1);if(0==l||l==o.length)return t;if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0;else{var u=ce(o,r.ch,r.sticky),f=u-a||(r.ch-n.ch)*(1==c.level?-1:1);s=u==l-1||u==l?f<0:f>0}var h=o[l+(s?-1:0)],d=s==(1==h.level),p=d?h.from:h.to,z=d?"after":"before";return n.ch==p&&n.sticky==z?t:new xi(new et(n.line,p,z),r)}(e,new xi(ct(o,k),y)),Qi(o,ji(e,x,c),F)}}var d=i.wrapper.getBoundingClientRect(),p=0;function z(t){e.state.selectingText=!1,p=1/0,t&&(ye(t),i.input.focus()),de(i.wrapper.ownerDocument,"mousemove",v),de(i.wrapper.ownerDocument,"mouseup",g),o.history.lastSelOrigin=null}var v=ei(e,(function(t){0!==t.buttons&&je(t)?function t(n){var a=++p,c=lr(e,n,!0,"rectangle"==r.unit);if(c)if(0!=tt(c,f)){e.curOp.focus=E(),h(c);var s=qr(i,o);(c.line>=s.to||c.lined.bottom?20:0;l&&setTimeout(ei(e,(function(){p==a&&(i.scroller.scrollTop+=l,t(n))})),50)}}(t):z(t)})),g=ei(e,z);e.state.selectingText=g,fe(i.wrapper.ownerDocument,"mousemove",v),fe(i.wrapper.ownerDocument,"mouseup",g)}(e,r,t,o)}(t,r,o,e):xe(e)==n.scroller&&ye(e):2==i?(r&&Yi(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(x?t.display.input.onContextMenu(e):xr(t)))}}function za(e,t,n){if("char"==n)return new xi(t,t);if("word"==n)return e.findWordAt(t);if("line"==n)return new xi(et(t.line,0),ct(e.doc,et(t.line+1,0)));var r=n(e,t);return new xi(r.from,r.to)}function va(e,t,n,r){var i,o;if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY;else try{i=t.clientX,o=t.clientY}catch(e){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ye(t);var a=e.display,c=a.lineDiv.getBoundingClientRect();if(o>c.bottom||!ge(e,n))return we(t);o-=c.top-a.viewOffset;for(var s=0;s=i)return pe(e,n,e,Ke(e.doc,o),e.display.gutterSpecs[s].className,t),we(t)}}function ga(e,t){return va(e,t,"gutterClick",!0)}function ma(e,t){kn(e.display,t)||function(e,t){return!!ge(e,"gutterContextMenu")&&va(e,t,"gutterContextMenu",!1)}(e,t)||ze(e,t,"contextmenu")||x||e.display.input.onContextMenu(t)}function ya(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),In(e)}da.prototype.compare=function(e,t,n){return this.time+400>e&&0==tt(t,this.pos)&&n==this.button};var ba={toString:function(){return"CodeMirror.Init"}},wa={},ka={};function xa(e,t,n){if(!t!=!(n&&n!=ba)){var r=e.display.dragFunctions,i=t?fe:de;i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function ja(e){e.options.lineWrapping?(A(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(_(e.display.wrapper,"CodeMirror-wrap"),Wt(e)),sr(e),fr(e),In(e),setTimeout((function(){return Rr(e)}),100)}function Ma(e,t){var n=this;if(!(this instanceof Ma))return new Ma(e,t);this.options=t=t?P(t):{},P(wa,t,!1);var r=t.value;"string"==typeof r?r=new Oo(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r;var i=new Ma.inputStyles[t.inputStyle](this),o=this.display=new vi(e,r,i,t);for(var l in o.wrapper.CodeMirror=this,ya(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Ur(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new N,keySeq:null,specialChars:null},t.autofocus&&!g&&o.input.focus(),a&&c<11&&setTimeout((function(){return n.display.input.reset(!0)}),20),function(e){var t=e.display;fe(t.scroller,"mousedown",ei(e,pa)),fe(t.scroller,"dblclick",a&&c<11?ei(e,(function(t){if(!ze(e,t)){var n=lr(e,t);if(n&&!ga(e,t)&&!kn(e.display,t)){ye(t);var r=e.findWordAt(n);Yi(e.doc,r.anchor,r.head)}}})):function(t){return ze(e,t)||ye(t)}),fe(t.scroller,"contextmenu",(function(t){return ma(e,t)})),fe(t.input.getField(),"contextmenu",(function(n){t.scroller.contains(n.target)||ma(e,n)}));var n,r={end:0};function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(r=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0;var n=t.left-e.left,r=t.top-e.top;return n*n+r*r>400}fe(t.scroller,"touchstart",(function(i){if(!ze(e,i)&&!function(e){if(1!=e.touches.length)return!1;var t=e.touches[0];return t.radiusX<=1&&t.radiusY<=1}(i)&&!ga(e,i)){t.input.ensurePolled(),clearTimeout(n);var o=+new Date;t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),fe(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),fe(t.scroller,"touchend",(function(n){var r=t.activeTouch;if(r&&!kn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,c=e.coordsChar(t.activeTouch,"page");a=!r.prev||o(r,r.prev)?new xi(c,c):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(c):new xi(et(c.line,0),ct(e.doc,et(c.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),ye(n)}i()})),fe(t.scroller,"touchcancel",i),fe(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Lr(e,t.scroller.scrollTop),Pr(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),fe(t.scroller,"mousewheel",(function(t){return wi(e,t)})),fe(t.scroller,"DOMMouseScroll",(function(t){return wi(e,t)})),fe(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ze(e,t)||ke(t)},over:function(t){ze(e,t)||(function(e,t){var n=lr(e,t);if(n){var r=document.createDocumentFragment();mr(e,n,r),e.display.dragCursor||(e.display.dragCursor=S("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),q(e.display.dragCursor,r)}}(e,t),ke(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-To<100))ke(t);else if(!ze(e,t)&&!kn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!h)){var n=S("img",null,null,"position: fixed; left: 0; top: 0;");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}(e,t)},drop:ei(e,Eo),leave:function(t){ze(e,t)||Ao(e)}};var s=t.input.getField();fe(s,"keyup",(function(t){return la.call(e,t)})),fe(s,"keydown",ei(e,sa)),fe(s,"keypress",ei(e,ua)),fe(s,"focus",(function(t){return jr(e,t)})),fe(s,"blur",(function(t){return Mr(e,t)}))}(this),function(){var e;Lo||(fe(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Ho(Do)}),100))})),fe(window,"blur",(function(){return Ho(Mr)})),Lo=!0)}(),Gr(this),this.curOp.forceUpdate=!0,Li(this,r),t.autofocus&&!g||this.hasFocus()?setTimeout(D(jr,this),20):Mr(this),ka)ka.hasOwnProperty(l)&&ka[l](this,t[l],ba);hi(this),t.finishInit&&t.finishInit(this);for(var u=0;u<_a.length;++u)_a[u](this);Yr(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Ma.defaults=wa,Ma.optionHandlers=ka;var _a=[];function Ca(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=dt(e,t).state:n="prev");var a=e.options.tabSize,c=Ge(o,t),s=V(c.text,null,a);c.stateAfter&&(c.stateAfter=null);var l,u=c.text.match(/^\s*/)[0];if(r||/\S/.test(c.text)){if("smart"==n&&((l=o.mode.indent(i,c.text.slice(u.length),c.text))==R||l>150)){if(!r)return;n="prev"}}else l=0,n="not";"prev"==n?l=t>o.first?V(Ge(o,t-1).text,null,a):0:"add"==n?l=s+e.options.indentUnit:"subtract"==n?l=s-e.options.indentUnit:"number"==typeof n&&(l=s+n),l=Math.max(0,l);var f="",h=0;if(e.options.indentWithTabs)for(var d=Math.floor(l/a);d;--d)h+=a,f+="\t";if(ha,s=Te(t),l=null;if(c&&r.ranges.length>1)if(qa&&qa.text.join("\n")==t){if(r.ranges.length%qa.text.length==0){l=[];for(var u=0;u=0;h--){var d=r.ranges[h],p=d.from(),z=d.to();d.empty()&&(n&&n>0?p=et(p.line,p.ch-n):e.state.overwrite&&!c?z=et(z.line,Math.min(Ge(o,z.line).text.length,z.ch+Z(s).length)):c&&qa&&qa.lineWise&&qa.text.join("\n")==s.join("\n")&&(p=z=et(p.line,0)));var v={from:p,to:z,text:l?l[h%l.length]:s,origin:i||(c?"paste":e.state.cutIncoming>a?"cut":"+input")};so(e.doc,v),sn(e,"inputRead",e,v)}t&&!c&&Ea(e,t),Tr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ta(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text");if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Jr(t,(function(){return Oa(t,n,0,null,"paste")})),!0}function Ea(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var c=0;c-1){a=Ca(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Ge(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ca(e,i.head.line,"smart"));a&&sn(e,"electricInput",e,i.head.line)}}}function Aa(e){for(var t=[],n=[],r=0;r=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after");var o=ce(i,n.ch,n.sticky),a=i[o];if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from=a.from&&h>=u.begin)){var d=f?"before":"after";return new et(n.line,h,d)}}var p=function(e,t,r){for(var o=function(e,t){return t?new et(n.line,s(e,1),"before"):new et(n.line,e,"after")};e>=0&&e0==(1!=a.level),l=c?r.begin:s(r.end,-1);if(a.from<=l&&l0?u.end:s(u.begin,-1);return null==v||r>0&&v==t.text.length||!(z=p(r>0?0:i.length-1,r,l(v)))?null:z}(e.cm,c,t,n):Ko(c,t,n))){if(r||(a=t.line+s)=e.first+e.size||(t=new et(a,t.ch,t.sticky),!(c=Ge(e,a))))return!1;t=Qo(i,e.cm,c,t.line,s)}else t=o;return!0}if("char"==r)l();else if("column"==r)l(!0);else if("word"==r||"group"==r)for(var u=null,f="group"==r,h=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(n<0)||l(!d);d=!1){var p=c.text.charAt(t.ch)||"\n",z=ee(p,h)?"w":f&&"\n"==p?"n":!f||/\s/.test(p)?null:"p";if(!f||d||z||(z="s"),u&&u!=z){n<0&&(n=1,l(),t.sticky="after");break}if(z&&(u=z),n>0&&!l(!d))break}var v=io(e,t,o,a,!0);return nt(o,v)&&(v.hitSide=!0),v}function Pa(e,t,n,r){var i,o,a=e.doc,c=t.left;if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),l=Math.max(s-.5*rr(e.display),3);i=(n>0?t.bottom:t.top)+n*l}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;(o=Xn(e,c,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0;break}i+=5*n}return o}var Va=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new N,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function Na(e,t){var n=Tn(e,t.line);if(!n||n.hidden)return null;var r=Ge(e.doc,t.line),i=Sn(n,r,t.line),o=le(r,e.doc.direction),a="left";o&&(a=ce(o,t.ch)%2?"right":"left");var c=Dn(i.map,t.ch,a);return c.offset="right"==c.collapse?c.end:c.start,c}function Ia(e,t){return t&&(e.bad=!0),e}function Ra(e,t,n){var r;if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ia(e.clipPos(et(e.display.viewTo-1)),!0);t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null;if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i=t.display.viewTo||o.line=t.display.viewFrom&&Na(t,i)||{node:s[0].measure.map[2],offset:0},u=o.liner.firstLine()&&(a=et(a.line-1,Ge(r.doc,a.line-1).length)),c.ch==Ge(r.doc,c.line).text.length&&c.linei.viewTo-1)return!1;a.line==i.viewFrom||0==(e=ur(r,a.line))?(t=Xe(i.view[0].line),n=i.view[0].node):(t=Xe(i.view[e].line),n=i.view[e-1].node.nextSibling);var s,l,u=ur(r,c.line);if(u==i.view.length-1?(s=i.viewTo-1,l=i.lineDiv.lastChild):(s=Xe(i.view[u+1].line)-1,l=i.view[u+1].node.previousSibling),!n)return!1;for(var f=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,c=e.doc.lineSeparator(),s=!1;function l(){a&&(o+=c,s&&(o+=c),a=s=!1)}function u(e){e&&(l(),o+=e)}function f(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(n)return void u(n);var o,h=t.getAttribute("cm-marker");if(h){var d=e.findMarks(et(r,0),et(i+1,0),(v=+h,function(e){return e.id==v}));return void(d.length&&(o=d[0].find(0))&&u(Ye(e.doc,o.from,o.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName);if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return;p&&l();for(var z=0;z1&&h.length>1;)if(Z(f)==Z(h))f.pop(),h.pop(),s--;else{if(f[0]!=h[0])break;f.shift(),h.shift(),t++}for(var d=0,p=0,z=f[0],v=h[0],g=Math.min(z.length,v.length);da.ch&&m.charCodeAt(m.length-p-1)==y.charCodeAt(y.length-p-1);)d--,p++;f[f.length-1]=m.slice(0,m.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(d).replace(/\u200b+$/,"");var w=et(t,d),k=et(s,h.length?Z(h).length-p:0);return f.length>1||f[0]||tt(w,k)?(po(r.doc,f,w,k,"+input"),!0):void 0},Va.prototype.ensurePolled=function(){this.forceCompositionEnd()},Va.prototype.reset=function(){this.forceCompositionEnd()},Va.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Va.prototype.readFromDOMSoon=function(){var e=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return;e.composing=null}e.updateFromDOM()}),80))},Va.prototype.updateFromDOM=function(){var e=this;!this.cm.isReadOnly()&&this.pollContent()||Jr(this.cm,(function(){return fr(e.cm)}))},Va.prototype.setUneditable=function(e){e.contentEditable="false"},Va.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Oa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Va.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Va.prototype.onContextMenu=function(){},Va.prototype.resetPosition=function(){},Va.prototype.needsContentAttribute=!0;var Fa=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new N,this.hasSelection=!1,this.composing=null};Fa.prototype.init=function(e){var t=this,n=this,r=this.cm;this.createField(e);var i=this.textarea;function o(e){if(!ze(r,e)){if(r.somethingSelected())Sa({lineWise:!1,text:r.getSelections()});else{if(!r.options.lineWiseCopyCut)return;var t=Aa(r);Sa({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,B):(n.prevInput="",i.value=t.text.join("\n"),L(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),z&&(i.style.width="0px"),fe(i,"input",(function(){a&&c>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),fe(i,"paste",(function(e){ze(r,e)||Ta(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),fe(i,"cut",o),fe(i,"copy",o),fe(e.scroller,"paste",(function(t){if(!kn(e,t)&&!ze(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus();var o=new Event("paste");o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),fe(e.lineSpace,"selectstart",(function(t){kn(e,t)||ye(t)})),fe(i,"compositionstart",(function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),fe(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Fa.prototype.createField=function(e){this.wrapper=La(),this.textarea=this.wrapper.firstChild},Fa.prototype.screenReaderLabelChanged=function(e){e?this.textarea.setAttribute("aria-label",e):this.textarea.removeAttribute("aria-label")},Fa.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=gr(e);if(e.options.moveInputWithCursor){var i=Yn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Fa.prototype.showSelection=function(e){var t=this.cm.display;q(t.cursorDiv,e.cursors),q(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Fa.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm;if(t.somethingSelected()){this.prevInput="";var n=t.getSelection();this.textarea.value=n,t.state.focused&&L(this.textarea),a&&c>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&c>=9&&(this.hasSelection=null))}},Fa.prototype.getField=function(){return this.textarea},Fa.prototype.supportsTouch=function(){return!1},Fa.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!g||E()!=this.textarea))try{this.textarea.focus()}catch(e){}},Fa.prototype.blur=function(){this.textarea.blur()},Fa.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Fa.prototype.receivedFocus=function(){this.slowPoll()},Fa.prototype.slowPoll=function(){var e=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Fa.prototype.fastPoll=function(){var e=!1,t=this;t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},Fa.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput;if(this.contextMenuPending||!t.state.focused||Ee(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1;var i=n.value;if(i==r&&!t.somethingSelected())return!1;if(a&&c>=9&&this.hasSelection===i||m&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1;if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0);if(8203!=o||r||(r="\u200b"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,l=Math.min(r.length,i.length);s1e3||i.indexOf("\n")>-1?n.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Fa.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Fa.prototype.onKeyPress=function(){a&&c>=9&&(this.hasSelection=null),this.fastPoll()},Fa.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea;t.contextMenuPending&&t.contextMenuPending();var o=lr(n,e),l=r.scroller.scrollTop;if(o&&!f){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ei(n,Qi)(n.doc,Mi(o),B);var u,h=i.style.cssText,d=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect();t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(u=window.scrollY),r.input.focus(),s&&window.scrollTo(null,u),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&c>=9&&z(),x?(ke(e),fe(window,"mouseup",(function e(){de(window,"mouseup",e),setTimeout(v,20)}))):setTimeout(v,50)}function z(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="\u200b"+(e?i.value:"");i.value="\u21da",i.value=o,t.prevInput=e?"":"\u200b",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=d,i.style.cssText=h,a&&c<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=l),null!=i.selectionStart)){(!a||a&&c<9)&&z();var e=0;r.detectingSelectAll=setTimeout((function o(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"\u200b"==t.prevInput?ei(n,ao)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())}),200)}}},Fa.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Fa.prototype.setUneditable=function(){},Fa.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers;function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=ba&&i(e,t,n)}:i)}e.defineOption=n,e.Init=ba,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Oi(e)}),!0),n("indentUnit",2,Oi,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Ti(e),In(e),fr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(et(r,o))}r++}));for(var i=n.length-1;i>=0;i--)po(e.doc,t,n[i],et(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ba&&e.refresh()})),n("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",g?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!b),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){ya(e),zi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Zo(t),i=n!=ba&&Zo(n);i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,ja,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=di(t,e.options.lineNumbers),zi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ar(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return Rr(e)}),!0),n("scrollbarStyle","native",(function(e){Ur(e),Rr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=di(e.options.gutters,t),zi(e)}),!0),n("firstLineNumber",1,zi,!0),n("lineNumberFormatter",(function(e){return e}),zi,!0),n("showCursorWhenSelecting",!1,vr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Mr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("screenReaderLabel",null,(function(e,t){t=""===t?null:t,e.display.input.screenReaderLabelChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,xa),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vr,!0),n("singleCursorHeightPerLine",!0,vr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Ti,!0),n("addModeClass",!1,Ti,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,Ti,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(Ma),function(e){var t=e.optionHandlers,n=e.helpers={};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e];r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&ei(this,t[e])(this,n,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Zo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Ca(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Tr(this));else{var o=i.from(),a=i.to(),c=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=c;s0&&$i(this.doc,r,new xi(o,l[r].to()),B)}}})),getTokenAt:function(e,t){return mt(this,e,t)},getLineTokens:function(e,t){return mt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=ct(this.doc,e);var t,n=ht(this,Ge(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]o&&(e=o,i=!0),r=Ge(this.doc,e)}else r=e;return Un(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Ft(r):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,c=this.display,s=(e=Yn(this,ct(this.doc,e))).bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),c.sizer.appendChild(t),"over"==r)s=e.top;else if("above"==r||"near"==r){var u=Math.max(c.wrapper.clientHeight,this.doc.height),f=Math.max(c.sizer.clientWidth,c.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>u)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=u&&(s=e.bottom),l+t.offsetWidth>f&&(l=f-t.offsetWidth)}t.style.top=s+"px",t.style.left=t.style.right="","right"==i?(l=c.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(c.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&(null!=(a=Sr(o=this,{left:l,top:s,right:l+t.offsetWidth,bottom:s+t.offsetHeight})).scrollTop&&Lr(o,a.scrollTop),null!=a.scrollLeft&&Pr(o,a.scrollLeft))},triggerOnKeyDown:ti(sa),triggerOnKeyPress:ti(ua),triggerOnKeyUp:la,triggerOnMouseDown:ti(pa),execCommand:function(e){if(Jo.hasOwnProperty(e))return Jo[e].call(null,this)},triggerElectric:ti((function(e){Ea(this,e)})),findPosH:function(e,t,n,r){var i=1;t<0&&(i=-1,t=-t);for(var o=ct(this.doc,e),a=0;a0&&a(t.charAt(n-1));)--n;for(;r.5||this.options.lineWrapping)&&sr(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc;return t.cm=null,this.state.selectingText&&this.state.selectingText(),Li(this,e),In(this),this.display.input.reset(),Er(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases;return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},me(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(Ma);var Ua="iter insert remove copy getEditor constructor".split(" ");for(var Wa in Oo.prototype)Oo.prototype.hasOwnProperty(Wa)&&I(Ua,Wa)<0&&(Ma.prototype[Wa]=function(e){return function(){return e.apply(this.doc,arguments)}}(Oo.prototype[Wa]));return me(Oo),Ma.inputStyles={textarea:Fa,contenteditable:Va},Ma.defineMode=function(e){Ma.defaults.mode||"null"==e||(Ma.defaults.mode=e),Pe.apply(this,arguments)},Ma.defineMIME=function(e,t){De[e]=t},Ma.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Ma.defineMIME("text/plain","null"),Ma.defineExtension=function(e,t){Ma.prototype[e]=t},Ma.defineDocExtension=function(e,t){Oo.prototype[e]=t},Ma.fromTextArea=function(e,t){if((t=t?P(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=E();t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=c.getValue()}var i;if(e.form&&(fe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form;i=o.submit;try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(n){n.save=r,n.getTextArea=function(){return e},n.toTextArea=function(){n.toTextArea=isNaN,r(),e.parentNode.removeChild(n.getWrapperElement()),e.style.display="",e.form&&(de(e.form,"submit",r),t.leaveSubmitMethodAlone||"function"!=typeof e.form.submit||(e.form.submit=i))}},e.style.display="none";var c=Ma((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t);return c},function(e){e.off=de,e.on=fe,e.wheelEventPixels=bi,e.Doc=Oo,e.splitLines=Te,e.countColumn=V,e.findColumn=W,e.isWordChar=J,e.Pass=R,e.signal=pe,e.Line=Gt,e.changeEnd=_i,e.scrollbarModel=Fr,e.Pos=et,e.cmpPos=tt,e.modes=Le,e.mimeModes=De,e.resolveMode=Ve,e.getMode=Ne,e.modeExtensions=Ie,e.extendMode=Re,e.copyState=Be,e.startState=Ue,e.innerMode=Fe,e.commands=Jo,e.keyMap=Ro,e.keyName=Yo,e.isModifierKey=Wo,e.lookupKey=Uo,e.normalizeKeyMap=Fo,e.StringStream=We,e.SharedTextMarker=_o,e.TextMarker=jo,e.LineWidget=wo,e.e_preventDefault=ye,e.e_stopPropagation=be,e.e_stop=ke,e.addClass=A,e.contains=T,e.rmClass=_,e.keyNames=Po}(Ma),Ma.version="5.57.0",Ma}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(){}return e.prototype.isSeparator=function(e){return" "==e||"\r"==e||"\n"==e||"\t"==e||"("==e||")"==e},e.prototype.isWhiteSpace=function(e){return" "==e||"\r"==e||"\n"==e||"\t"==e},e.prototype.findLastSeparatorIndex=function(e){var t=this;return r.findLastIndex(e,(function(e){return t.isSeparator(e)}))},e.prototype.needSpaceAfter=function(e){return!("("==e)},e.prototype.isLastCharacterWhiteSpace=function(e){return!!e&&this.isWhiteSpace(e[e.length-1])},e.prototype.stripEndWithNonSeparatorCharacters=function(e){if(!e)return e;if(this.isSeparator(e[e.length-1]))return e;var t=this.findLastSeparatorIndex(e);return t<0?"":e.substr(0,t+1)},e.prototype.getEndNotSeparatorCharacers=function(e){if(!e)return e;if(this.isSeparator(e[e.length-1]))return"";var t=this.findLastSeparatorIndex(e);return t<0?e:e.substr(t+1)},e}();t.default=new i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),i=function(){function e(){}return e.prototype.quote=function(e){return/\s/g.test(e)?'"'+e+'"':e},e.prototype.buildDefaultObjOrGetOriginal=function(e,t){return r.isString(e)?{value:this.quote(e),type:t}:{value:e,type:t}},e.prototype.handleParseError=function(e,t,n){var i=this,o=t;return r.flatMap(n.expected,(function(e){var t=[];if("literal"==e.type&&(t=r.map([e.text||e.value],(function(e){return{value:e,type:"literal"}}))),"other"==e.type){var n=o.getLastTokenType()||"value";"value"==n&&(t=r.map(i.needCategories(),(function(e){return i.buildDefaultObjOrGetOriginal(e,"category")}))),"category"==n&&(t=r.map(i.needOperators(o.getLastCategory()),(function(e){return i.buildDefaultObjOrGetOriginal(e,"operator")}))),"operator"==n&&(t=r.map(i.needValues(o.getLastCategory(),o.getLastOperator()),(function(e){return i.buildDefaultObjOrGetOriginal(e,"value")})))}return t}))},e.prototype.hasCategory=function(e){return!1},e.prototype.hasOperator=function(e,t){return!1},e.prototype.needCategories=function(){return[]},e.prototype.needOperators=function(e){return[]},e.prototype.needValues=function(e,t){return[]},e}();t.default=i},function(e,t){e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n,r=e[1]||"",i=e[3];if(!i)return r;if(t&&"function"==typeof btoa){var o=(n=i,"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(n))))+" */"),a=i.sources.map((function(e){return"/*# sourceURL="+i.sourceRoot+e+" */"}));return[r].concat(a).concat([o]).join("\n")}return[r].join("\n")}(t,e);return t[2]?"@media "+t[2]+"{"+n+"}":n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i=0&&f.splice(t,1)}function g(e){var t=document.createElement("style");if(void 0===e.attrs.type&&(e.attrs.type="text/css"),void 0===e.attrs.nonce){var r=n.nc;r&&(e.attrs.nonce=r)}return m(t,e.attrs),z(e,t),t}function m(e,t){Object.keys(t).forEach((function(n){e.setAttribute(n,t[n])}))}function y(e,t){var n,r,i,o;if(t.transform&&e.css){if(!(o="function"==typeof t.transform?t.transform(e.css):t.transform.default(e.css)))return function(){};e.css=o}if(t.singleton){var a=u++;n=l||(l=g(t)),r=k.bind(null,n,a,!1),i=k.bind(null,n,a,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=function(e){var t=document.createElement("link");return void 0===e.attrs.type&&(e.attrs.type="text/css"),e.attrs.rel="stylesheet",m(t,e.attrs),z(e,t),t}(t),r=j.bind(null,n,t),i=function(){v(n),n.href&&URL.revokeObjectURL(n.href)}):(n=g(t),r=x.bind(null,n),i=function(){v(n)});return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){if("undefined"!=typeof DEBUG&&DEBUG&&"object"!=typeof document)throw new Error("The style-loader cannot be used in a non-browser environment");(t=t||{}).attrs="object"==typeof t.attrs?t.attrs:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=a()),t.insertInto||(t.insertInto="head"),t.insertAt||(t.insertAt="bottom");var n=p(e,t);return d(n,t),function(e){for(var r=[],i=0;i1)){if(this.somethingSelected()){if(!n.hint.supportsSelection)return;for(var i=0;il.clientHeight+1,T=a.getScrollInfo();if(S>0){var E=q.bottom-q.top;if(g.top-(g.bottom-q.top)-E>0)l.style.top=(y=g.top-E-k)+"px",b=!1;else if(E>C){l.style.height=C-5+"px",l.style.top=(y=g.bottom-q.top-k)+"px";var A=a.getCursor();n.from.ch!=A.ch&&(g=a.cursorCoords(A),l.style.left=(m=g.left-w)+"px",q=l.getBoundingClientRect())}}var H,L=q.right-_;if(L>0&&(q.right-q.left>_&&(l.style.width=_-5+"px",L-=q.right-q.left-_),l.style.left=(m=g.left-L-w)+"px"),O)for(var D=l.firstChild;D;D=D.nextSibling)D.style.paddingRight=a.display.nativeBarWidth+"px";return a.addKeyMap(this.keyMap=function(e,t){var n={Up:function(){t.moveFocus(-1)},Down:function(){t.moveFocus(1)},PageUp:function(){t.moveFocus(1-t.menuSize(),!0)},PageDown:function(){t.moveFocus(t.menuSize()-1,!0)},Home:function(){t.setFocus(0)},End:function(){t.setFocus(t.length-1)},Enter:t.pick,Tab:t.pick,Esc:t.close};/Mac/.test(navigator.platform)&&(n["Ctrl-P"]=function(){t.moveFocus(-1)},n["Ctrl-N"]=function(){t.moveFocus(1)});var r=e.options.customKeys,i=r?{}:n;function o(e,r){var o;o="string"!=typeof r?function(e){return r(e,t)}:n.hasOwnProperty(r)?n[r]:r,i[e]=o}if(r)for(var a in r)r.hasOwnProperty(a)&&o(a,r[a]);var c=e.options.extraKeys;if(c)for(var a in c)c.hasOwnProperty(a)&&o(a,c[a]);return i}(t,{moveFocus:function(e,t){r.changeActive(r.selectedHint+e,t)},setFocus:function(e){r.changeActive(e)},menuSize:function(){return r.screenAmount()},length:f.length,close:function(){t.close()},pick:function(){r.pick()},data:n})),t.options.closeOnUnfocus&&(a.on("blur",this.onBlur=function(){H=setTimeout((function(){t.close()}),100)}),a.on("focus",this.onFocus=function(){clearTimeout(H)})),a.on("scroll",this.onScroll=function(){var e=a.getScrollInfo(),n=a.getWrapperElement().getBoundingClientRect(),r=y+T.top-e.top,i=r-(s.pageYOffset||(c.documentElement||c.body).scrollTop);if(b||(i+=l.offsetHeight),i<=n.top||i>=n.bottom)return t.close();l.style.top=r+"px",l.style.left=m+T.left-e.left+"px"}),e.on(l,"dblclick",(function(e){var t=o(l,e.target||e.srcElement);t&&null!=t.hintId&&(r.changeActive(t.hintId),r.pick())})),e.on(l,"click",(function(e){var n=o(l,e.target||e.srcElement);n&&null!=n.hintId&&(r.changeActive(n.hintId),t.options.completeOnSingleClick&&r.pick())})),e.on(l,"mousedown",(function(){setTimeout((function(){a.focus()}),20)})),this.scrollToActive(),e.signal(n,"select",f[this.selectedHint],l.childNodes[this.selectedHint]),!0}function c(e,t,n,r){if(e.async)e(t,r,n);else{var i=e(t,n);i&&i.then?i.then(r):r(i)}}t.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&e.signal(this.data,"close"),this.widget&&this.widget.close(),e.signal(this.cm,"endCompletion",this.cm))},active:function(){return this.cm.state.completionActive==this},pick:function(t,n){var r=t.list[n],o=this;this.cm.operation((function(){r.hint?r.hint(o.cm,t,r):o.cm.replaceRange(i(r),r.from||t.from,r.to||t.to,"complete"),e.signal(t,"pick",r),o.cm.scrollIntoView()})),this.close()},cursorActivity:function(){this.debounce&&(r(this.debounce),this.debounce=0);var e=this.startPos;this.data&&(e=this.data.from);var t=this.cm.getCursor(),i=this.cm.getLine(t.line);if(t.line!=this.startPos.line||i.length-t.ch!=this.startLen-this.startPos.ch||t.ch=this.data.list.length?t=n?this.data.list.length-1:0:t<0&&(t=n?0:this.data.list.length-1),this.selectedHint!=t){var r=this.hints.childNodes[this.selectedHint];r&&(r.className=r.className.replace(" CodeMirror-hint-active","")),(r=this.hints.childNodes[this.selectedHint=t]).className+=" CodeMirror-hint-active",this.scrollToActive(),e.signal(this.data,"select",this.data.list[this.selectedHint],r)}},scrollToActive:function(){var e=this.completion.options.scrollMargin||0,t=this.hints.childNodes[Math.max(0,this.selectedHint-e)],n=this.hints.childNodes[Math.min(this.data.list.length-1,this.selectedHint+e)],r=this.hints.firstChild;t.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=n.offsetTop+n.offsetHeight-this.hints.clientHeight+r.offsetTop)},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},e.registerHelper("hint","auto",{resolve:function(t,n){var r,i=t.getHelpers(n,"hint");if(i.length){var o=function(e,t,n){var r=function(e,t){if(!e.somethingSelected())return t;for(var n=[],r=0;r0?t(e):i(o+1)}))}(0)};return o.async=!0,o.supportsSelection=!0,o}return(r=t.getHelper(t.getCursor(),"hintWords"))?function(t){return e.hint.fromList(t,{words:r})}:e.hint.anyword?function(t,n){return e.hint.anyword(t,n)}:function(){}}}),e.registerHelper("hint","fromList",(function(t,n){var r,i=t.getCursor(),o=t.getTokenAt(i),a=e.Pos(i.line,o.start),c=i;o.start,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};e.defineOption("hintOptions",null)}(n(2))},function(e,t,n){!function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function n(e){t(e);var n=e.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.style.direction=e.getOption("direction"),n.className="CodeMirror-placeholder CodeMirror-line-like";var r=e.getOption("placeholder");"string"==typeof r&&(r=document.createTextNode(r)),n.appendChild(r),e.display.lineSpace.insertBefore(n,e.display.lineSpace.firstChild)}function r(e){o(e)&&n(e)}function i(e){var r=e.getWrapperElement(),i=o(e);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",(function(n,o,a){var c=a&&a!=e.Init;if(o&&!c)n.on("blur",r),n.on("change",i),n.on("swapDoc",i),i(n);else if(!o&&c){n.off("blur",r),n.off("change",i),n.off("swapDoc",i),t(n);var s=n.getWrapperElement();s.className=s.className.replace(" CodeMirror-empty","")}o&&!n.hasFocus()&&r(n)}))}(n(2))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),n(2).defineMode("filter-mode",(function(e,t){function n(e){var t,n=(t=e.fieldState)==r.category?r.operator:t==r.operator?r.value:t==r.value?r.category:void 0,i=e.fieldState;return e.fieldState=n,i.toString()}return{startState:function(){return{inString:!1,fieldState:r.category}},token:function(e,t){return" "==(r=e.peek())||"\r"==r||"\n"==r||"\t"==r?(e.eatSpace(),null):"("==e.peek()||")"==e.peek()?(e.next(),"bracket"):e.match("AND",!0,!0)||e.match("OR",!0,!0)?"condition":(t.inString||'"'!=e.peek()||(e.next(),t.inString=!0),t.inString?(e.skipTo('"')?(e.next(),t.inString=!1):e.skipToEnd(),n(t)):(e.eatWhile(/[^\r\n\t\s\(\)]+/),n(t)));var r}}}));var r=function(){function e(){}return e.none="none",e.category="category",e.operator="operator",e.value="value",e}()},function(e,t,n){var r=n(16);"string"==typeof r&&(r=[[e.i,r,""]]),n(6)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(5)(!1)).push([e.i,".CodeMirror{font-family:monospace;height:300px;color:black;direction:ltr}.CodeMirror-lines{padding:4px 0}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{padding:0 4px}.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{background-color:white}.CodeMirror-gutters{border-right:1px solid #ddd;background-color:#f7f7f7;white-space:nowrap}.CodeMirror-linenumber{padding:0 3px 0 5px;min-width:20px;text-align:right;color:#999;white-space:nowrap}.CodeMirror-guttermarker{color:black}.CodeMirror-guttermarker-subtle{color:#999}.CodeMirror-cursor{border-left:1px solid black;border-right:none;width:0}.CodeMirror div.CodeMirror-secondarycursor{border-left:1px solid silver}.cm-fat-cursor .CodeMirror-cursor{width:auto;border:0 !important;background:#7e7}.cm-fat-cursor div.CodeMirror-cursors{z-index:1}.cm-fat-cursor-mark{background-color:rgba(20,255,20,0.5);-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite}.cm-animate-fat-cursor{width:auto;border:0;-webkit-animation:blink 1.06s steps(1) infinite;-moz-animation:blink 1.06s steps(1) infinite;animation:blink 1.06s steps(1) infinite;background-color:#7e7}@-moz-keyframes blink{50%{background-color:transparent}}@-webkit-keyframes blink{50%{background-color:transparent}}@keyframes blink{50%{background-color:transparent}}.cm-tab{display:inline-block;text-decoration:inherit}.CodeMirror-rulers{position:absolute;left:0;right:0;top:-50px;bottom:0;overflow:hidden}.CodeMirror-ruler{border-left:1px solid #ccc;top:0;bottom:0;position:absolute}.cm-s-default .cm-header{color:blue}.cm-s-default .cm-quote{color:#090}.cm-negative{color:#d44}.cm-positive{color:#292}.cm-header,.cm-strong{font-weight:bold}.cm-em{font-style:italic}.cm-link{text-decoration:underline}.cm-strikethrough{text-decoration:line-through}.cm-s-default .cm-keyword{color:#708}.cm-s-default .cm-atom{color:#219}.cm-s-default .cm-number{color:#164}.cm-s-default .cm-def{color:#00f}.cm-s-default .cm-variable-2{color:#05a}.cm-s-default .cm-variable-3,.cm-s-default .cm-type{color:#085}.cm-s-default .cm-comment{color:#a50}.cm-s-default .cm-string{color:#a11}.cm-s-default .cm-string-2{color:#f50}.cm-s-default .cm-meta{color:#555}.cm-s-default .cm-qualifier{color:#555}.cm-s-default .cm-builtin{color:#30a}.cm-s-default .cm-bracket{color:#997}.cm-s-default .cm-tag{color:#170}.cm-s-default .cm-attribute{color:#00c}.cm-s-default .cm-hr{color:#999}.cm-s-default .cm-link{color:#00c}.cm-s-default .cm-error{color:#f00}.cm-invalidchar{color:#f00}.CodeMirror-composing{border-bottom:2px solid}div.CodeMirror span.CodeMirror-matchingbracket{color:#0b0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#a22}.CodeMirror-matchingtag{background:rgba(255,150,0,0.3)}.CodeMirror-activeline-background{background:#e8f2ff}.CodeMirror{position:relative;overflow:hidden;background:white}.CodeMirror-scroll{overflow:scroll !important;margin-bottom:-50px;margin-right:-50px;padding-bottom:50px;height:100%;outline:none;position:relative}.CodeMirror-sizer{position:relative;border-right:50px solid transparent}.CodeMirror-vscrollbar,.CodeMirror-hscrollbar,.CodeMirror-scrollbar-filler,.CodeMirror-gutter-filler{position:absolute;z-index:6;display:none}.CodeMirror-vscrollbar{right:0;top:0;overflow-x:hidden;overflow-y:scroll}.CodeMirror-hscrollbar{bottom:0;left:0;overflow-y:hidden;overflow-x:scroll}.CodeMirror-scrollbar-filler{right:0;bottom:0}.CodeMirror-gutter-filler{left:0;bottom:0}.CodeMirror-gutters{position:absolute;left:0;top:0;min-height:100%;z-index:3}.CodeMirror-gutter{white-space:normal;height:100%;display:inline-block;vertical-align:top;margin-bottom:-50px}.CodeMirror-gutter-wrapper{position:absolute;z-index:4;background:none !important;border:none !important}.CodeMirror-gutter-background{position:absolute;top:0;bottom:0;z-index:4}.CodeMirror-gutter-elt{position:absolute;cursor:default;z-index:4}.CodeMirror-gutter-wrapper ::selection{background-color:transparent}.CodeMirror-gutter-wrapper ::-moz-selection{background-color:transparent}.CodeMirror-lines{cursor:text;min-height:1px}.CodeMirror pre.CodeMirror-line,.CodeMirror pre.CodeMirror-line-like{-moz-border-radius:0;-webkit-border-radius:0;border-radius:0;border-width:0;background:transparent;font-family:inherit;font-size:inherit;margin:0;white-space:pre;word-wrap:normal;line-height:inherit;color:inherit;z-index:2;position:relative;overflow:visible;-webkit-tap-highlight-color:transparent;-webkit-font-variant-ligatures:contextual;font-variant-ligatures:contextual}.CodeMirror-wrap pre.CodeMirror-line,.CodeMirror-wrap pre.CodeMirror-line-like{word-wrap:break-word;white-space:pre-wrap;word-break:normal}.CodeMirror-linebackground{position:absolute;left:0;right:0;top:0;bottom:0;z-index:0}.CodeMirror-linewidget{position:relative;z-index:2;padding:.1px}.CodeMirror-rtl pre{direction:rtl}.CodeMirror-code{outline:none}.CodeMirror-scroll,.CodeMirror-sizer,.CodeMirror-gutter,.CodeMirror-gutters,.CodeMirror-linenumber{-moz-box-sizing:content-box;box-sizing:content-box}.CodeMirror-measure{position:absolute;width:100%;height:0;overflow:hidden;visibility:hidden}.CodeMirror-cursor{position:absolute;pointer-events:none}.CodeMirror-measure pre{position:static}div.CodeMirror-cursors{visibility:hidden;position:relative;z-index:3}div.CodeMirror-dragcursors{visibility:visible}.CodeMirror-focused div.CodeMirror-cursors{visibility:visible}.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused .CodeMirror-selected{background:#d7d4f0}.CodeMirror-crosshair{cursor:crosshair}.CodeMirror-line::selection,.CodeMirror-line>span::selection,.CodeMirror-line>span>span::selection{background:#d7d4f0}.CodeMirror-line::-moz-selection,.CodeMirror-line>span::-moz-selection,.CodeMirror-line>span>span::-moz-selection{background:#d7d4f0}.cm-searching{background-color:#ffa;background-color:rgba(255,255,0,0.4)}.cm-force-border{padding-right:.1px}@media print{.CodeMirror div.CodeMirror-cursors{visibility:hidden}}.cm-tab-wrap-hack:after{content:''}span.CodeMirror-selectedtext{background:none}",""])},function(e,t){e.exports=function(e){var t="undefined"!=typeof window&&window.location;if(!t)throw new Error("fixUrls requires window.location");if(!e||"string"!=typeof e)return e;var n=t.protocol+"//"+t.host,r=n+t.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,(function(e,t){var i,o=t.trim().replace(/^"(.*)"$/,(function(e,t){return t})).replace(/^'(.*)'$/,(function(e,t){return t}));return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(o)?e:(i=0===o.indexOf("//")?o:0===o.indexOf("/")?n+o:r+o.replace(/^\.\//,""),"url("+JSON.stringify(i)+")")}))}},function(e,t,n){var r=n(19);"string"==typeof r&&(r=[[e.i,r,""]]),n(6)(r,{hmr:!0,transform:void 0,insertInto:void 0}),r.locals&&(e.exports=r.locals)},function(e,t,n){(e.exports=n(5)(!1)).push([e.i,".CodeMirror-hints{position:absolute;z-index:10;overflow:hidden;list-style:none;margin:0;padding:2px;-webkit-box-shadow:2px 3px 5px rgba(0,0,0,0.2);-moz-box-shadow:2px 3px 5px rgba(0,0,0,0.2);box-shadow:2px 3px 5px rgba(0,0,0,0.2);border-radius:3px;border:1px solid silver;background:white;font-size:90%;font-family:monospace;max-height:20em;overflow-y:auto}.CodeMirror-hint{margin:0;padding:0 4px;border-radius:2px;white-space:pre;color:black;cursor:pointer}li.CodeMirror-hint-active{background:#08f;color:white}",""])},function(e,t,n){"use strict";(function(e){var r,i=Object.assign||function(e){for(var t=1;t=0;case"!contains":return e[i].toLowerCase().indexOf(r.toLowerCase())<0}return!1},t}(n(8).default);t.default=a},function(e,t,n){"use strict";var r,i=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0});var o=n(4),a=n(0),c=function(e){function t(t,n){var r=e.call(this)||this;return r.data=t,r.options=n,r.cache={},r.parseResult=null,r.categories=a.map(r.options,(function(e){return e.columnText?e.columnText:e.columnField})),r}return i(t,e),t.prototype.hasCategory=function(e){return void 0!==a.find(this.options,(function(t){return e===t.columnField||e===t.columnText}))},t.prototype.hasOperator=function(e,t){return this.needOperators(e).indexOf(t)>=0},t.prototype.needCategories=function(){return this.categories},t.prototype.needOperators=function(e){var t=a.find(this.options,(function(t){return null!=t.customOperatorFunc&&(t.columnText==e||t.columnField==e)}));return t?t.customOperatorFunc(e):["==","!=","contains","!contains"]},t.prototype.needValues=function(e,t){var n=a.find(this.options,(function(t){return t.columnField==e||t.columnText==e}));return null!=n&&"selection"==n.type&&null!=this.data?(this.cache[e]||(this.cache[e]=a.chain(this.data).map((function(t){return t[e]})).uniq().value()),this.cache[e]):null!=n&&n.customValuesFunc?n.customValuesFunc(e,t):[]},t}(o.default);t.default=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(28),i=n(0),o=n(4),a=n(29),c=n(3),s=function(){function e(){this.autoCompleteHandler=new o.default,this.lastError=null,this.parseTrace=new a.default}return e.prototype.parse=function(e){if(e=i.trim(e),i.isEmpty(e))return[];try{return this.parseQuery(e)}catch(e){return e.isError=!0,e}},e.prototype.parseQuery=function(e){return this.parseTrace.clear(),r.parse(e,{parseTrace:this.parseTrace})},e.prototype.getSuggestions=function(e){e=c.default.stripEndWithNonSeparatorCharacters(e);try{return this.parseQuery(e),!e||c.default.isLastCharacterWhiteSpace(e)?i.map(["AND","OR"],(function(e){return{value:e,type:"literal"}})):[]}catch(e){return this.autoCompleteHandler.handleParseError(r,this.parseTrace,e)}},e.prototype.setAutoCompleteHandler=function(e){this.autoCompleteHandler=e},e}();t.default=s},function(e,t,n){"use strict";function r(e,t,n,i){this.message=e,this.expected=t,this.found=n,this.location=i,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,r)}!function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}(r,Error),r.buildMessage=function(e,t){var n={literal:function(e){return'"'+i(e.text)+'"'},class:function(e){var t,n="";for(t=0;t0){for(t=1,r=1;tM&&(M=k,_=[]),_.push(e))}function L(){var t,n,r,o,a,l,u,f;if(t=k,N()!==i)if((n=D())!==i){for(r=[],o=k,(a=V())!==i?("and"===e.substr(k,3).toLowerCase()?(l=e.substr(k,3),k+=3):(l=i,0===C&&H(c)),l===i&&("or"===e.substr(k,2).toLowerCase()?(l=e.substr(k,2),k+=2):(l=i,0===C&&H(s))),l!==i&&(u=V())!==i&&(f=D())!==i?o=a=[a,l,u,f]:(k=o,o=i)):(k=o,o=i);o!==i;)r.push(o),o=k,(a=V())!==i?("and"===e.substr(k,3).toLowerCase()?(l=e.substr(k,3),k+=3):(l=i,0===C&&H(c)),l===i&&("or"===e.substr(k,2).toLowerCase()?(l=e.substr(k,2),k+=2):(l=i,0===C&&H(s))),l!==i&&(u=V())!==i&&(f=D())!==i?o=a=[a,l,u,f]:(k=o,o=i)):(k=o,o=i);r!==i&&(o=N())!==i?(x=t,t=function(e,t){for(var n=[e],r=0;r=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=new Date(0);d.setUTCFullYear(c+1,0,h),d.setUTCHours(0,0,0,0);var p=Object(o.a)(d,t),z=new Date(0);z.setUTCFullYear(c,0,h),z.setUTCHours(0,0,0,0);var v=Object(o.a)(z,t);return n.getTime()>=p.getTime()?c+1:n.getTime()>=v.getTime()?c:c-1}},function(e,t,n){"use strict";n.d(t,"a",(function(){return a}));var r=n(15),i=n(10),o=n(6);function a(e,t){Object(o.a)(2,arguments);var n=Object(i.default)(e).getTime(),a=Object(r.a)(t);return new Date(n+a)}},function(e,t,n){"use strict";n.d(t,"a",(function(){return c}));var r=n(15),i=n(10),o=n(72),a=n(6);function c(e,t){Object(a.a)(1,arguments);var n=Object(i.default)(e,t),c=n.getUTCFullYear(),s=t||{},l=s.locale,u=l&&l.options&&l.options.firstWeekContainsDate,f=null==u?1:Object(r.a)(u),h=null==s.firstWeekContainsDate?f:Object(r.a)(s.firstWeekContainsDate);if(!(h>=1&&h<=7))throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");var d=new Date(0);d.setUTCFullYear(c+1,0,h),d.setUTCHours(0,0,0,0);var p=Object(o.a)(d,t),z=new Date(0);z.setUTCFullYear(c,0,h),z.setUTCHours(0,0,0,0);var v=Object(o.a)(z,t);return n.getTime()>=p.getTime()?c+1:n.getTime()>=v.getTime()?c:c-1}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return a}));var r=n(10),i=n(15),o=n(6);function a(e,t){Object(o.a)(1,arguments);var n=t||{},a=n.locale,c=a&&a.options&&a.options.weekStartsOn,s=null==c?0:Object(i.a)(c),l=null==n.weekStartsOn?s:Object(i.a)(n.weekStartsOn);if(!(l>=0&&l<=6))throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");var u=Object(r.default)(e),f=u.getDay(),h=(f0&&void 0!==arguments[0]?arguments[0]:{},n=t.width?String(t.width):e.defaultWidth,r=e.formats[n]||e.formats[e.defaultWidth];return r}}var o={date:i({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:i({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:i({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},a={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function c(e){return function(t,n){var r,i=n||{};if("formatting"===(i.context?String(i.context):"standalone")&&e.formattingValues){var o=e.defaultFormattingWidth||e.defaultWidth,a=i.width?String(i.width):o;r=e.formattingValues[a]||e.formattingValues[o]}else{var c=e.defaultWidth,s=i.width?String(i.width):e.defaultWidth;r=e.values[s]||e.values[c]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function s(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;var a,c=o[0],s=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],f=Array.isArray(s)?u(s,(function(e){return e.test(c)})):l(s,(function(e){return e.test(c)}));a=e.valueCallback?e.valueCallback(f):f,a=n.valueCallback?n.valueCallback(a):a;var h=t.slice(c.length);return{value:a,rest:h}}}function l(e,t){for(var n in e)if(e.hasOwnProperty(n)&&t(e[n]))return n}function u(e,t){for(var n=0;n0?"in "+i:i+" ago":i},formatLong:o,formatRelative:function(e,t,n,r){return a[e]},localize:{ordinalNumber:function(e,t){var n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},era:c({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:c({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:function(e){return Number(e)-1}}),month:c({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:c({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:c({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(f={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:function(e){return parseInt(e,10)}},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.match(f.matchPattern);if(!n)return null;var r=n[0],i=e.match(f.parsePattern);if(!i)return null;var o=f.valueCallback?f.valueCallback(i[0]):i[0];o=t.valueCallback?t.valueCallback(o):o;var a=e.slice(r.length);return{value:o,rest:a}}),era:s({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:s({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:function(e){return e+1}}),month:s({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:s({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:s({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};t.a=h},function(e,t,n){"use strict";var r=n(33),i=n(29),o=n(47),a=n(23),c=n(11),s=n(48);function l(){var e={};return e.promise=new Promise((function(t,n){e.resolve=t,e.reject=n})),e}var u=l,f=(n(151),[]),h=0;function d(e){try{v(),e()}finally{g()}}function p(e){f.push(e),h||(v(),m())}function z(e){try{return v(),e()}finally{m()}}function v(){h++}function g(){h--}function m(){var e;for(g();!h&&void 0!==(e=f.shift());)d(e)}var y=function(e){return function(t){return e.some((function(e){return j(e)(t)}))}},b=function(e){return function(t){return e(t)}},w=function(e){return function(t){return t.type===String(e)}},k=function(e){return function(t){return t.type===e}},x=function(){return c.H};function j(e){var t="*"===e?x:Object(a.k)(e)?w:Object(a.a)(e)?y:Object(a.l)(e)?w:Object(a.d)(e)?b:Object(a.m)(e)?k:null;if(null===t)throw new Error("invalid pattern: "+e);return t(e)}var M={type:r.b},_=function(e){return e&&e.type===r.b};function C(e){void 0===e&&(e=Object(c.B)());var t=!1,n=[];return{take:function(r){t&&e.isEmpty()?r(M):e.isEmpty()?(n.push(r),r.cancel=function(){Object(c.O)(n,r)}):r(e.take())},put:function(r){if(!t){if(0===n.length)return e.put(r);n.shift()(r)}},flush:function(n){t&&e.isEmpty()?n(M):n(e.flush())},close:function(){if(!t){t=!0;var e=n;n=[];for(var r=0,i=e.length;r2?p-2:0),g=2;g=arguments.length)?u=n[l]:(u=arguments[c],c+=1),o[l]=u,Object(a.a)(u)||(s-=1),l+=1}return s<=0?i.apply(this,o):Object(r.a)(s,e(t,o,i))}}(e,[],t))}));t.a=c},function(e,t,n){"use strict";var r=n(112),i={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},c={};function s(e){return r.isMemo(e)?a:c[e.$$typeof]||i}c[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var l=Object.defineProperty,u=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,h=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,p=Object.prototype;e.exports=function e(t,n,r){if("string"!==typeof n){if(p){var i=d(n);i&&i!==p&&e(t,i,r)}var a=u(n);f&&(a=a.concat(f(n)));for(var c=s(t),z=s(n),v=0;v=0;){if(n[o]===e)return r[o]===t;o-=1}switch(i){case"Map":return e.size===t.size&&f(e.entries(),t.entries(),n.concat([e]),r.concat([t]));case"Set":return e.size===t.size&&f(e.values(),t.values(),n.concat([e]),r.concat([t]));case"Arguments":case"Array":case"Object":case"Boolean":case"Number":case"String":case"Date":case"Error":case"RegExp":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float32Array":case"Float64Array":case"ArrayBuffer":break;default:return!1}var l=Object(s.a)(e);if(l.length!==Object(s.a)(t).length)return!1;var d=n.concat([e]),p=r.concat([t]);for(o=l.length-1;o>=0;){var z=l[o];if(!Object(a.a)(z,t)||!h(t[z],e[z],d,p))return!1;o-=1}return!0}var d=Object(r.a)((function(e,t){return h(e,t,[],[])}));t.a=d},function(e,t,n){"use strict";var r=n(30),i=n(145),o=n(131);function a(e){return'"'+e.replace(/\\/g,"\\\\").replace(/[\b]/g,"\\b").replace(/\f/g,"\\f").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\v/g,"\\v").replace(/\0/g,"\\0").replace(/"/g,'\\"')+'"'}var c=function(e){return(e<10?"0":"")+e},s="function"===typeof Date.prototype.toISOString?function(e){return e.toISOString()}:function(e){return e.getUTCFullYear()+"-"+c(e.getUTCMonth()+1)+"-"+c(e.getUTCDate())+"T"+c(e.getUTCHours())+":"+c(e.getUTCMinutes())+":"+c(e.getUTCSeconds())+"."+(e.getUTCMilliseconds()/1e3).toFixed(3).slice(2,5)+"Z"},l=n(57);var u=n(19),f=n(284),h=Object(u.a)((function(e,t){return Object(f.a)((n=e,function(){return!n.apply(this,arguments)}),t);var n}));var d=Object(r.a)((function(e){return function e(t,n){var r=function(r){var o=n.concat([t]);return Object(i.a)(r,o)?"":e(r,o)},c=function(e,t){return Object(o.a)((function(t){return a(t)+": "+r(e[t])}),t.slice().sort())};switch(Object.prototype.toString.call(t)){case"[object Arguments]":return"(function() { return arguments; }("+Object(o.a)(r,t).join(", ")+"))";case"[object Array]":return"["+Object(o.a)(r,t).concat(c(t,h((function(e){return/^\d+$/.test(e)}),Object(l.a)(t)))).join(", ")+"]";case"[object Boolean]":return"object"===typeof t?"new Boolean("+r(t.valueOf())+")":t.toString();case"[object Date]":return"new Date("+(isNaN(t.valueOf())?r(NaN):a(s(t)))+")";case"[object Null]":return"null";case"[object Number]":return"object"===typeof t?"new Number("+r(t.valueOf())+")":1/t===-1/0?"-0":t.toString(10);case"[object String]":return"object"===typeof t?"new String("+r(t.valueOf())+")":a(t);case"[object Undefined]":return"undefined";default:if("function"===typeof t.toString){var u=t.toString();if("[object Object]"!==u)return u}return"{"+c(t,Object(l.a)(t)).join(", ")+"}"}}(e,[])}));t.a=d},function(e,t,n){"use strict";var r=n(29),i=n(47),o=n(78),a=n(0),c=n.n(a),s=n(13),l=n.n(s),u=n(34),f=n.n(u),h=n(32),d=n.n(h),p=!1,z=c.a.createContext(null),v="unmounted",g="exited",m="entering",y="entered",b=function(e){function t(t,n){var r;r=e.call(this,t,n)||this;var i,o=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?o?(i=g,r.appearStatus=m):i=y:i=t.unmountOnExit||t.mountOnEnter?v:g,r.state={status:i},r.nextCallback=null,r}Object(o.a)(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===v?{status:g}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==m&&n!==y&&(t=m):n!==m&&n!==y||(t="exiting")}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!==typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t){this.cancelNextCallback();var n=d.a.findDOMNode(this);t===m?this.performEnter(n,e):this.performExit(n)}else this.props.unmountOnExit&&this.state.status===g&&this.setState({status:v})},n.performEnter=function(e,t){var n=this,r=this.props.enter,i=this.context?this.context.isMounting:t,o=this.getTimeouts(),a=i?o.appear:o.enter;!t&&!r||p?this.safeSetState({status:y},(function(){n.props.onEntered(e)})):(this.props.onEnter(e,i),this.safeSetState({status:m},(function(){n.props.onEntering(e,i),n.onTransitionEnd(e,a,(function(){n.safeSetState({status:y},(function(){n.props.onEntered(e,i)}))}))})))},n.performExit=function(e){var t=this,n=this.props.exit,r=this.getTimeouts();n&&!p?(this.props.onExit(e),this.safeSetState({status:"exiting"},(function(){t.props.onExiting(e),t.onTransitionEnd(e,r.exit,(function(){t.safeSetState({status:g},(function(){t.props.onExited(e)}))}))}))):this.safeSetState({status:g},(function(){t.props.onExited(e)}))},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t,n){this.setNextCallback(n);var r=null==t&&!this.props.addEndListener;e&&!r?(this.props.addEndListener&&this.props.addEndListener(e,this.nextCallback),null!=t&&setTimeout(this.nextCallback,t)):setTimeout(this.nextCallback,0)},n.render=function(){var e=this.state.status;if(e===v)return null;var t=this.props,n=t.children,r=Object(i.a)(t,["children"]);if(delete r.in,delete r.mountOnEnter,delete r.unmountOnExit,delete r.appear,delete r.enter,delete r.exit,delete r.timeout,delete r.addEndListener,delete r.onEnter,delete r.onEntering,delete r.onEntered,delete r.onExit,delete r.onExiting,delete r.onExited,"function"===typeof n)return c.a.createElement(z.Provider,{value:null},n(e,r));var o=c.a.Children.only(n);return(c.a.createElement(z.Provider,{value:null},c.a.cloneElement(o,r)))},t}(c.a.Component);function w(){}b.contextType=z,b.propTypes={},b.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:w,onEntering:w,onEntered:w,onExit:w,onExiting:w,onExited:w},b.UNMOUNTED=0,b.EXITED=1,b.ENTERING=2,b.ENTERED=3,b.EXITING=4;var k=b,x=n(99);function j(e,t){var n=Object.create(null);return e&&a.Children.map(e,(function(e){return e})).forEach((function(e){n[e.key]=function(e){return t&&Object(a.isValidElement)(e)?t(e):e}(e)})),n}function M(e,t,n){return null!=n[t]?n[t]:e.props[t]}function _(e,t,n){var r=j(e.children),i=function(e,t){function n(n){return n in t?t[n]:e[n]}e=e||{},t=t||{};var r,i=Object.create(null),o=[];for(var a in e)a in t?o.length&&(i[a]=o,o=[]):o.push(a);var c={};for(var s in t){if(i[s])for(r=0;r0}function D(e){return Object.keys(e).map((function(t){return e[t]}))}var P=!("undefined"===typeof window||!window.document||!window.document.createElement);var V,N=((V=function(e,t,n){var r=e[t];return!1===r||L(r)?null:new Error(n+" expect "+t+" \n to be a valid Number > 0 or equal to false. "+r+" given.")}).isRequired=function(e,t,n){if("undefined"===typeof e[t])return new Error("The prop "+t+" is marked as required in \n "+n+", but its value is undefined.");V(e,t,n)},V),I={list:new Map,emitQueue:new Map,on:function(e,t){return this.list.has(e)||this.list.set(e,[]),this.list.get(e).push(t),this},off:function(e){return this.list.delete(e),this},cancelEmit:function(e){var t=this.emitQueue.get(e);return t&&(t.forEach((function(e){return clearTimeout(e)})),this.emitQueue.delete(e)),this},emit:function(e){for(var t=this,n=arguments.length,r=new Array(n>1?n-1:0),i=1;i=1?"onTransitionEnd":"onAnimationEnd"]=d&&p<1?null:a,n);return c.a.createElement("div",Object(r.a)({className:g,style:v},m))}function F(e){return e.targetTouches&&e.targetTouches.length>=1?e.targetTouches[0].clientX:e.clientX}B.propTypes={delay:N.isRequired,isRunning:l.a.bool.isRequired,closeToast:l.a.func.isRequired,rtl:l.a.bool.isRequired,type:l.a.string,hide:l.a.bool,className:l.a.oneOfType([l.a.string,l.a.object]),progress:l.a.number,controlledProgress:l.a.bool},B.defaultProps={type:T.DEFAULT,hide:!1};var U=P&&/(msie|trident)/i.test(navigator.userAgent),W=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i=1?e.targetTouches[0].clientY:e.clientY}(e),t.drag.start!==t.drag.x&&(t.flag.canCloseOnClick=!1),t.ref.style.transform="translateX("+t.drag.deltaX+"px)",t.ref.style.opacity=1-Math.abs(t.drag.deltaX/t.drag.removalDistance))},t.onDragEnd=function(e){if(t.flag.canDrag){if(t.flag.canDrag=!1,Math.abs(t.drag.deltaX)>t.drag.removalDistance)return void t.setState({preventExitTransition:!0},t.props.closeToast);t.ref.style.transition="transform 0.2s, opacity 0.2s",t.ref.style.transform="translateX(0)",t.ref.style.opacity=1}},t.onDragTransitionEnd=function(){if(t.boundingRect){var e=t.boundingRect,n=e.top,r=e.bottom,i=e.left,o=e.right;t.props.pauseOnHover&&t.drag.x>=i&&t.drag.x<=o&&t.drag.y>=n&&t.drag.y<=r?t.pauseToast():t.playToast()}},t.onExitTransitionEnd=function(){if(U)t.props.onExited();else{var e=t.ref.scrollHeight,n=t.ref.style;requestAnimationFrame((function(){n.minHeight="initial",n.height=e+"px",n.transition="all 0.4s ",requestAnimationFrame((function(){n.height=0,n.padding=0,n.margin=0})),setTimeout((function(){return t.props.onExited()}),400)}))}},t}Object(o.a)(t,e);var n=t.prototype;return n.componentDidMount=function(){this.props.onOpen(this.props.children.props),this.props.draggable&&this.bindDragEvents(),this.props.pauseOnFocusLoss&&this.bindFocusEvents()},n.componentDidUpdate=function(e){e.draggable!==this.props.draggable&&(this.props.draggable?this.bindDragEvents():this.unbindDragEvents()),e.pauseOnFocusLoss!==this.props.pauseOnFocusLoss&&(this.props.pauseOnFocusLoss?this.bindFocusEvents():this.unbindFocusEvents())},n.componentWillUnmount=function(){this.props.onClose(this.props.children.props),this.props.draggable&&this.unbindDragEvents(),this.props.pauseOnFocusLoss&&this.unbindFocusEvents()},n.bindFocusEvents=function(){window.addEventListener("focus",this.playToast),window.addEventListener("blur",this.pauseToast)},n.unbindFocusEvents=function(){window.removeEventListener("focus",this.playToast),window.removeEventListener("blur",this.pauseToast)},n.bindDragEvents=function(){document.addEventListener("mousemove",this.onDragMove),document.addEventListener("mouseup",this.onDragEnd),document.addEventListener("touchmove",this.onDragMove),document.addEventListener("touchend",this.onDragEnd)},n.unbindDragEvents=function(){document.removeEventListener("mousemove",this.onDragMove),document.removeEventListener("mouseup",this.onDragEnd),document.removeEventListener("touchmove",this.onDragMove),document.removeEventListener("touchend",this.onDragEnd)},n.render=function(){var e,t=this,n=this.props,i=n.closeButton,o=n.children,a=n.autoClose,s=n.pauseOnHover,l=n.onClick,u=n.closeOnClick,h=n.type,d=n.hideProgressBar,p=n.closeToast,z=n.transition,v=n.position,g=n.className,m=n.bodyClassName,y=n.progressClassName,b=n.progressStyle,w=n.updateId,k=n.role,x=n.progress,j=n.rtl,M={className:f()(H+"__toast",H+"__toast--"+h,(e={},e[H+"__toast--rtl"]=j,e),g)};a&&s&&(M.onMouseEnter=this.pauseToast,M.onMouseLeave=this.playToast),u&&(M.onClick=function(e){l&&l(e),t.flag.canCloseOnClick&&p()});var _=parseFloat(x)===x;return c.a.createElement(z,{in:this.props.in,appear:!0,onExited:this.onExitTransitionEnd,position:v,preventExitTransition:this.state.preventExitTransition},c.a.createElement("div",Object(r.a)({onClick:l},M,{ref:function(e){return t.ref=e},onMouseDown:this.onDragStart,onTouchStart:this.onDragStart,onMouseUp:this.onDragTransitionEnd,onTouchEnd:this.onDragTransitionEnd}),c.a.createElement("div",Object(r.a)({},this.props.in&&{role:k},{className:f()(H+"__toast-body",m)}),o),i&&i,(a||_)&&c.a.createElement(B,Object(r.a)({},w&&!_?{key:"pb-"+w}:{},{rtl:j,delay:a,isRunning:this.state.isRunning,closeToast:p,hide:d,type:h,style:b,className:y,controlledProgress:_,progress:x}))))},t}(a.Component);function G(e){var t=e.closeToast,n=e.type,r=e.ariaLabel;return c.a.createElement("button",{className:H+"__close-button "+H+"__close-button--"+n,type:"button",onClick:function(e){e.stopPropagation(),t(e)},"aria-label":r},"\u2716\ufe0e")}W.propTypes={closeButton:l.a.oneOfType([l.a.node,l.a.bool]).isRequired,autoClose:N.isRequired,children:l.a.node.isRequired,closeToast:l.a.func.isRequired,position:l.a.oneOf(D(O)).isRequired,pauseOnHover:l.a.bool.isRequired,pauseOnFocusLoss:l.a.bool.isRequired,closeOnClick:l.a.bool.isRequired,transition:l.a.func.isRequired,rtl:l.a.bool.isRequired,hideProgressBar:l.a.bool.isRequired,draggable:l.a.bool.isRequired,draggablePercent:l.a.number.isRequired,in:l.a.bool,onExited:l.a.func,onOpen:l.a.func,onClose:l.a.func,type:l.a.oneOf(D(T)),className:l.a.oneOfType([l.a.string,l.a.object]),bodyClassName:l.a.oneOfType([l.a.string,l.a.object]),progressClassName:l.a.oneOfType([l.a.string,l.a.object]),progressStyle:l.a.object,progress:l.a.number,updateId:l.a.oneOfType([l.a.string,l.a.number]),ariaLabel:l.a.string,containerId:l.a.oneOfType([l.a.string,l.a.number]),role:l.a.string},W.defaultProps={type:T.DEFAULT,in:!0,onOpen:A,onClose:A,className:null,bodyClassName:null,progressClassName:null,updateId:null},G.propTypes={closeToast:l.a.func,arialLabel:l.a.string},G.defaultProps={ariaLabel:"close"};var Y=R({enter:H+"__bounce-enter",exit:H+"__bounce-exit",appendPosition:!0}),Z=(R({enter:H+"__slide-enter",exit:H+"__slide-exit",duration:[450,750],appendPosition:!0}),R({enter:H+"__zoom-enter",exit:H+"__zoom-exit"}),R({enter:H+"__flip-enter",exit:H+"__flip-exit"}),function(e){function t(){for(var t,n=arguments.length,r=new Array(n),i=0;i0}function ne(e,t){var n=function(e){return te()?e?$.get(e):$.get(X):null}(t.containerId);if(!n)return null;var r=n.collection[e];return"undefined"===typeof r?null:r}function re(e,t){return Object(r.a)({},e,{type:t,toastId:oe(e)})}function ie(){return(Math.random().toString(36)+Date.now().toString(36)).substr(2,10)}function oe(e){return e&&("string"===typeof e.toastId||"number"===typeof e.toastId&&!isNaN(e.toastId))?e.toastId:ie()}function ae(e,t){return te()?I.emit(E.SHOW,e,t):(J.push({action:E.SHOW,content:e,options:t}),ee&&P&&(ee=!1,K=document.createElement("div"),document.body.appendChild(K),Object(h.render)(c.a.createElement(Z,Q),K))),t.toastId}var ce=function(e,t){return ae(e,re(t,t&&t.type||T.DEFAULT))},se=function(e){T[e]!==T.DEFAULT&&(ce[T[e].toLowerCase()]=function(t,n){return ae(t,re(n,n&&n.type||T[e]))})};for(var le in T)se(le);ce.warn=ce.warning,ce.dismiss=function(e){return void 0===e&&(e=null),te()&&I.emit(E.CLEAR,e)},ce.isActive=function(e){var t=!1;return $.size>0&&$.forEach((function(n){n.isToastActive(e)&&(t=!0)})),t},ce.update=function(e,t){void 0===t&&(t={}),setTimeout((function(){var n=ne(e,t);if(n){var i=n.options,o=n.content,a=Object(r.a)({},i,{},t,{toastId:t.toastId||e});t.toastId&&t.toastId!==e?a.staleToastId=e:a.updateId=ie();var c="undefined"!==typeof a.render?a.render:o;delete a.render,ae(c,a)}}),0)},ce.done=function(e){ce.update(e,{progress:1})},ce.onChange=function(e){"function"===typeof e&&I.on(E.ON_CHANGE,e)},ce.configure=function(e){ee=!0,Q=e},ce.POSITION=O,ce.TYPE=T,I.on(E.DID_MOUNT,(function(e){X=e.props.containerId||e,$.set(X,e),J.forEach((function(e){I.emit(e.action,e.content,e.options)})),J=[]})).on(E.WILL_UNMOUNT,(function(e){e?$.delete(e.props.containerId||e):$.clear(),0===$.size&&I.off(E.SHOW).off(E.CLEAR),P&&K&&document.body.removeChild(K)}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.invariant=t.UNICODE_EXTENSION_SEQUENCE_REGEX=void 0,t.UNICODE_EXTENSION_SEQUENCE_REGEX=/-u(?:-[0-9a-z]{2,8})+/gi,t.invariant=function(e,t,n){if(void 0===n&&(n=Error),!e)throw new n(t)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shortMorePenalty=t.shortLessPenalty=t.longMorePenalty=t.longLessPenalty=t.differentNumericTypePenalty=t.additionPenalty=t.removalPenalty=t.DATE_TIME_PROPS=void 0,t.DATE_TIME_PROPS=["weekday","era","year","month","day","hour","minute","second","timeZoneName"],t.removalPenalty=120,t.additionPenalty=20,t.differentNumericTypePenalty=15,t.longLessPenalty=8,t.longMorePenalty=6,t.shortLessPenalty=6,t.shortMorePenalty=3},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return a}));var r=n(15),i=n(10),o=n(6);function a(e,t){Object(o.a)(2,arguments);var n=Object(i.default)(e),a=Object(r.a)(t);return isNaN(a)?new Date(NaN):a?(n.setDate(n.getDate()+a),n):n}},function(e,t,n){"use strict";n.r(t),n.d(t,"default",(function(){return a}));var r=n(15),i=n(10),o=n(6);function a(e,t){Object(o.a)(2,arguments);var n=Object(i.default)(e),a=Object(r.a)(t);if(isNaN(a))return new Date(NaN);if(!a)return n;var c=n.getDate(),s=new Date(n.getTime());return s.setMonth(n.getMonth()+a+1,0),c>=s.getDate()?s:(n.setFullYear(s.getFullYear(),s.getMonth(),c),n)}},,function(e,t,n){"use strict";function r(e){return"[object Function]"===Object.prototype.toString.call(e)}n.d(t,"a",(function(){return r}))},,function(e,t,n){"use strict";(function(e){n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o}));var r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;nt?1:e>=t?0:NaN},i=function(e){var t;return 1===e.length&&(t=e,e=function(e,n){return r(t(e),n)}),{left:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)<0?r=o+1:i=o}return r},right:function(t,n,r,i){for(null==r&&(r=0),null==i&&(i=t.length);r>>1;e(t[o],n)>0?i=o:r=o+1}return r}}};var o=i(r),a=o.right,c=o.left,s=a,l=function(e,t){null==t&&(t=u);for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);ne?1:t>=e?0:NaN},d=function(e){return null===e?NaN:+e},p=function(e,t){var n,r,i=e.length,o=0,a=-1,c=0,s=0;if(null==t)for(;++a1)return s/(o-1)},z=function(e,t){var n=p(e,t);return n?Math.sqrt(n):n},v=function(e,t){var n,r,i,o=e.length,a=-1;if(null==t){for(;++a=n)for(r=i=n;++an&&(r=n),i=n)for(r=i=n;++an&&(r=n),i0)return[e];if((r=t0)for(e=Math.ceil(e/a),t=Math.floor(t/a),o=new Array(i=Math.ceil(t-e+1));++c=0?(o>=x?10:o>=j?5:o>=M?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(o>=x?10:o>=j?5:o>=M?2:1)}function q(e,t,n){var r=Math.abs(t-e)/Math.max(0,n),i=Math.pow(10,Math.floor(Math.log(r)/Math.LN10)),o=r/i;return o>=x?i*=10:o>=j?i*=5:o>=M&&(i*=2),tf;)h.pop(),--d;var p,z=new Array(d+1);for(i=0;i<=d;++i)(p=z[i]=[]).x0=i>0?h[i-1]:u,p.x1=i=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),a=+n(e[o],o,e);return a+(+n(e[o+1],o+1,e)-a)*(i-o)}},E=function(e,t,n){return e=y.call(e,d).sort(r),Math.ceil((n-t)/(2*(T(e,.75)-T(e,.25))*Math.pow(e.length,-1/3)))},A=function(e,t,n){return Math.ceil((n-t)/(3.5*z(e)*Math.pow(e.length,-1/3)))},H=function(e,t){var n,r,i=e.length,o=-1;if(null==t){for(;++o=n)for(r=n;++or&&(r=n)}else for(;++o=n)for(r=n;++or&&(r=n);return r},L=function(e,t){var n,r=e.length,i=r,o=-1,a=0;if(null==t)for(;++o=0;)for(t=(r=e[i]).length;--t>=0;)n[--a]=r[t];return n},V=function(e,t){var n,r,i=e.length,o=-1;if(null==t){for(;++o=n)for(r=n;++on&&(r=n)}else for(;++o=n)for(r=n;++on&&(r=n);return r},N=function(e,t){for(var n=t.length,r=new Array(n);n--;)r[n]=e[t[n]];return r},I=function(e,t){if(n=e.length){var n,i,o=0,a=0,c=e[a];for(null==t&&(t=r);++o=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function de(e,t){for(var n,r=0,i=e.length;r0)for(var n,r,i=new Array(n),o=0;o=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ge.hasOwnProperty(t)?{space:ge[t],local:e}:e};function ye(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ve&&t.documentElement.namespaceURI===ve?t.createElement(e):t.createElementNS(n,e)}}function be(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}var we=function(e){var t=me(e);return(t.local?be:ye)(t)},ke=0;function xe(){return new je}function je(){this._="@"+(++ke).toString(36)}je.prototype=xe.prototype={constructor:je,get:function(e){for(var t=this._;!(t in e);)if(!(e=e.parentNode))return;return e[t]},set:function(e,t){return e[this._]=t},remove:function(e){return this._ in e&&delete e[this._]},toString:function(){return this._}};var Me=function(e){return function(){return this.matches(e)}};if("undefined"!==typeof document){var _e=document.documentElement;if(!_e.matches){var Ce=_e.webkitMatchesSelector||_e.msMatchesSelector||_e.mozMatchesSelector||_e.oMatchesSelector;Me=function(e){return function(){return Ce.call(this,e)}}}}var qe=Me,Se={},Oe=null;"undefined"!==typeof document&&("onmouseenter"in document.documentElement||(Se={mouseenter:"mouseover",mouseleave:"mouseout"}));function Te(e,t,n){return e=Ee(e,t,n),function(t){var n=t.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||e.call(this,t)}}function Ee(e,t,n){return function(r){var i=Oe;Oe=r;try{e.call(this,this.__data__,t,n)}finally{Oe=i}}}function Ae(e){return e.trim().split(/^|\s+/).map((function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}function He(e){return function(){var t=this.__on;if(t){for(var n,r=0,i=-1,o=t.length;rt?1:e>=t?0:NaN}function Xe(e){return function(){this.removeAttribute(e)}}function Ke(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qe(e,t){return function(){this.setAttribute(e,t)}}function Je(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function et(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function tt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}var nt=function(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView};function rt(e){return function(){this.style.removeProperty(e)}}function it(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ot(e,t,n){return function(){var r=t.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function at(e,t){return e.style.getPropertyValue(t)||nt(e).getComputedStyle(e,null).getPropertyValue(t)}function ct(e){return function(){delete this[e]}}function st(e,t){return function(){this[e]=t}}function lt(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function ut(e){return e.trim().split(/^|\s+/)}function ft(e){return e.classList||new ht(e)}function ht(e){this._node=e,this._names=ut(e.getAttribute("class")||"")}function dt(e,t){for(var n=ft(e),r=-1,i=t.length;++r=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function mt(){this.textContent=""}function yt(e){return function(){this.textContent=e}}function bt(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function wt(){this.innerHTML=""}function kt(e){return function(){this.innerHTML=e}}function xt(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function jt(){this.nextSibling&&this.parentNode.appendChild(this)}function Mt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function _t(){return null}function Ct(){var e=this.parentNode;e&&e.removeChild(this)}function qt(e,t,n){var r=nt(e),i=r.CustomEvent;"function"===typeof i?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function St(e,t){return function(){return qt(this,e,t)}}function Ot(e,t){return function(){return qt(this,e,t.apply(this,arguments))}}var Tt=[null];function Et(e,t){this._groups=e,this._parents=t}function At(){return new Et([[document.documentElement]],Tt)}Et.prototype=At.prototype={constructor:Et,select:function(e){"function"!==typeof e&&(e=Re(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i=w&&(w=b+1);!(y=g[w])&&++w=0;)(r=i[o])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=$e);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o1?this.each((null==t?rt:"function"===typeof t?ot:it)(e,t,null==n?"":n)):at(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?ct:"function"===typeof t?lt:st)(e,t)):this.node()[e]},classed:function(e,t){var n=ut(e+"");if(arguments.length<2){for(var r=ft(this.node()),i=-1,o=n.length;++if}s.mouse("drag")}function z(){Lt(Oe.view).on("mousemove.drag mouseup.drag",null),Bt(Oe.view,n),It(),s.mouse("end")}function v(){if(i.apply(this,arguments)){var e,t,n=Oe.changedTouches,r=o.apply(this,arguments),a=n.length;for(e=0;e>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):(t=rn.exec(e))?dn(parseInt(t[1],16)):(t=on.exec(e))?new gn(t[1],t[2],t[3],1):(t=an.exec(e))?new gn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=cn.exec(e))?pn(t[1],t[2],t[3],t[4]):(t=sn.exec(e))?pn(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=ln.exec(e))?mn(t[1],t[2]/100,t[3]/100,1):(t=un.exec(e))?mn(t[1],t[2]/100,t[3]/100,t[4]):fn.hasOwnProperty(e)?dn(fn[e]):"transparent"===e?new gn(NaN,NaN,NaN,0):null}function dn(e){return new gn(e>>16&255,e>>8&255,255&e,1)}function pn(e,t,n,r){return r<=0&&(e=t=n=NaN),new gn(e,t,n,r)}function zn(e){return e instanceof Qt||(e=hn(e)),e?new gn((e=e.rgb()).r,e.g,e.b,e.opacity):new gn}function vn(e,t,n,r){return 1===arguments.length?zn(e):new gn(e,t,n,null==r?1:r)}function gn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function mn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new bn(e,t,n,r)}function yn(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof bn)return new bn(e.h,e.s,e.l,e.opacity);if(e instanceof Qt||(e=hn(e)),!e)return new bn;if(e instanceof bn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),a=NaN,c=o-i,s=(o+i)/2;return c?(a=t===o?(n-r)/c+6*(n0&&s<1?0:a,new bn(a,c,s,e.opacity)}(e):new bn(e,t,n,null==r?1:r)}function bn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function wn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Xt(Qt,hn,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),Xt(gn,vn,Kt(Qt,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new gn(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new gn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}})),Xt(bn,yn,Kt(Qt,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new bn(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new bn(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new gn(wn(e>=240?e-240:e+120,i,r),wn(e,i,r),wn(e<120?e+240:e-120,i,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1}}));var kn=Math.PI/180,xn=180/Math.PI,jn=.95047,Mn=1,_n=1.08883,Cn=4/29,qn=6/29,Sn=3*qn*qn,On=qn*qn*qn;function Tn(e){if(e instanceof An)return new An(e.l,e.a,e.b,e.opacity);if(e instanceof Nn){var t=e.h*kn;return new An(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}e instanceof gn||(e=zn(e));var n=Pn(e.r),r=Pn(e.g),i=Pn(e.b),o=Hn((.4124564*n+.3575761*r+.1804375*i)/jn),a=Hn((.2126729*n+.7151522*r+.072175*i)/Mn);return new An(116*a-16,500*(o-a),200*(a-Hn((.0193339*n+.119192*r+.9503041*i)/_n)),e.opacity)}function En(e,t,n,r){return 1===arguments.length?Tn(e):new An(e,t,n,null==r?1:r)}function An(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}function Hn(e){return e>On?Math.pow(e,1/3):e/Sn+Cn}function Ln(e){return e>qn?e*e*e:Sn*(e-Cn)}function Dn(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Pn(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Vn(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Nn)return new Nn(e.h,e.c,e.l,e.opacity);e instanceof An||(e=Tn(e));var t=Math.atan2(e.b,e.a)*xn;return new Nn(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}(e):new Nn(e,t,n,null==r?1:r)}function Nn(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}Xt(An,En,Kt(Qt,{brighter:function(e){return new An(this.l+18*(null==e?1:e),this.a,this.b,this.opacity)},darker:function(e){return new An(this.l-18*(null==e?1:e),this.a,this.b,this.opacity)},rgb:function(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return e=Mn*Ln(e),new gn(Dn(3.2404542*(t=jn*Ln(t))-1.5371385*e-.4985314*(n=_n*Ln(n))),Dn(-.969266*t+1.8760108*e+.041556*n),Dn(.0556434*t-.2040259*e+1.0572252*n),this.opacity)}})),Xt(Nn,Vn,Kt(Qt,{brighter:function(e){return new Nn(this.h,this.c,this.l+18*(null==e?1:e),this.opacity)},darker:function(e){return new Nn(this.h,this.c,this.l-18*(null==e?1:e),this.opacity)},rgb:function(){return Tn(this).rgb()}}));var In=-.29227,Rn=-.90649,Bn=1.97294,Fn=Bn*Rn,Un=1.78277*Bn,Wn=1.78277*In- -.14861*Rn;function Gn(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Yn)return new Yn(e.h,e.s,e.l,e.opacity);e instanceof gn||(e=zn(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(Wn*r+Fn*t-Un*n)/(Wn+Fn-Un),o=r-i,a=(Bn*(n-i)-In*o)/Rn,c=Math.sqrt(a*a+o*o)/(Bn*i*(1-i)),s=c?Math.atan2(a,o)*xn-120:NaN;return new Yn(s<0?s+360:s,c,i,e.opacity)}(e):new Yn(e,t,n,null==r?1:r)}function Yn(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function Zn(e,t,n,r,i){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*n+(1+3*e+3*o-3*a)*r+a*i)/6}Xt(Yn,Gn,Kt(Qt,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new Yn(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Yn(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*kn,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new gn(255*(t+n*(-.14861*r+1.78277*i)),255*(t+n*(In*r+Rn*i)),255*(t+n*(Bn*r)),this.opacity)}}));var $n=function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],a=r>0?e[r-1]:2*i-o,c=r180||n<-180?n-360*Math.round(n/360):n):Kn(isNaN(e)?t:e)}function er(e){return 1===(e=+e)?tr:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}(t,n,e):Kn(isNaN(t)?n:t)}}function tr(e,t){var n=t-e;return n?Qn(e,n):Kn(isNaN(e)?t:e)}var nr=function e(t){var n=er(t);function r(e,t){var r=n((e=vn(e)).r,(t=vn(t)).r),i=n(e.g,t.g),o=n(e.b,t.b),a=tr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=o(t),e.opacity=a(t),e+""}}return r.gamma=e,r}(1);function rr(e){return function(t){var n,r,i=t.length,o=new Array(i),a=new Array(i),c=new Array(i);for(n=0;no&&(i=t.slice(o,i),c[a]?c[a]+=i:c[++a]=i),(n=n[0])===(r=r[0])?c[a]?c[a]+=r:c[++a]=r:(c[++a]=null,s.push({i:a,x:sr(n,r)})),o=fr.lastIndex;return o180?t+=360:t-e>180&&(e+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:sr(e,t)})):t&&n.push(i(n)+"rotate("+t+r)}(o.rotate,a.rotate,c,s),function(e,t,n,o){e!==t?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:sr(e,t)}):t&&n.push(i(n)+"skewX("+t+r)}(o.skewX,a.skewX,c,s),function(e,t,n,r,o,a){if(e!==n||t!==r){var c=o.push(i(o)+"scale(",null,",",null,")");a.push({i:c-4,x:sr(e,n)},{i:c-2,x:sr(t,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,c,s),o=a=null,function(e){for(var t,n=-1,r=s.length;++n=0&&t._call.call(null,e),t=t._next;--Rr}function ti(){Gr=(Wr=Zr.now())+Yr,Rr=Br=0;try{ei()}finally{Rr=0,function(){var e,t,n=Dr,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Dr=t);Pr=e,ri(r)}(),Gr=0}}function ni(){var e=Zr.now(),t=e-Wr;t>Ur&&(Yr-=t,Wr=e)}function ri(e){Rr||(Br&&(Br=clearTimeout(Br)),e-Gr>24?(e<1/0&&(Br=setTimeout(ti,e-Zr.now()-Yr)),Fr&&(Fr=clearInterval(Fr))):(Fr||(Wr=Zr.now(),Fr=setInterval(ni,Ur)),Rr=1,$r(ti)))}Qr.prototype=Jr.prototype={constructor:Qr,restart:function(e,t,n){if("function"!==typeof e)throw new TypeError("callback is not a function");n=(null==n?Xr():+n)+(null==t?0:+t),this._next||Pr===this||(Pr?Pr._next=this:Dr=this,Pr=this),this._call=e,this._time=n,ri()},stop:function(){this._call&&(this._call=null,this._time=1/0,ri())}};var ii=function(e,t,n){var r=new Qr;return t=null==t?0:+t,r.restart((function(n){r.stop(),e(n+t)}),t,n),r},oi=function(e,t,n){var r=new Qr,i=t;return null==t?(r.restart(e,t,n),r):(t=+t,n=null==n?Xr():+n,r.restart((function o(a){a+=i,r.restart(o,i+=t,n),e(a)}),t,n),r)},ai=ze("start","end","interrupt"),ci=[],si=0,li=1,ui=2,fi=3,hi=4,di=5,pi=6,zi=function(e,t,n,r,i,o){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var r,i=e.__transition;function o(s){var l,u,f,h;if(n.state!==li)return c();for(l in i)if((h=i[l]).name===n.name){if(h.state===fi)return ii(o);h.state===hi?(h.state=pi,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[l]):+lsi)throw new Error("too late; already scheduled");return n}function gi(e,t){var n=mi(e,t);if(n.state>ui)throw new Error("too late; already started");return n}function mi(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}var yi=function(e,t){var n,r,i,o=e.__transition,a=!0;if(o){for(i in t=null==t?null:t+"",o)(n=o[i]).name===t?(r=n.state>ui&&n.state=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?vi:gi;return function(){var a=o(this,e),c=a.on;c!==r&&(i=(r=c).copy()).on(t,n),a.on=i}}var Vi=Ht.prototype.constructor;function Ni(e,t,n){function r(){var r=this,i=t.apply(r,arguments);return i&&function(t){r.style.setProperty(e,i(t),n)}}return r._value=t,r}var Ii=0;function Ri(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Bi(e){return Ht().transition(e)}function Fi(){return++Ii}var Ui=Ht.prototype;function Wi(e){return+e}function Gi(e){return e*e}function Yi(e){return e*(2-e)}function Zi(e){return((e*=2)<=1?e*e:--e*(2-e)+1)/2}function $i(e){return e*e*e}function Xi(e){return--e*e*e+1}function Ki(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}Ri.prototype=Bi.prototype={constructor:Ri,select:function(e){var t=this._name,n=this._id;"function"!==typeof e&&(e=Re(e));for(var r=this._groups,i=r.length,o=new Array(i),a=0;ali&&n.name===t)return new Ri([[e]],Lo,t,+r);return null},Po=function(e){return function(){return e}},Vo=function(e,t,n){this.target=e,this.type=t,this.selection=n};function No(){Oe.stopImmediatePropagation()}var Io=function(){Oe.preventDefault(),Oe.stopImmediatePropagation()},Ro={name:"drag"},Bo={name:"space"},Fo={name:"handle"},Uo={name:"center"},Wo={name:"x",handles:["e","w"].map(Jo),input:function(e,t){return e&&[[e[0],t[0][1]],[e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},Go={name:"y",handles:["n","s"].map(Jo),input:function(e,t){return e&&[[t[0][0],e[0]],[t[1][0],e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},Yo={name:"xy",handles:["n","e","s","w","nw","ne","se","sw"].map(Jo),input:function(e){return e},output:function(e){return e}},Zo={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},$o={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},Xo={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},Ko={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},Qo={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Jo(e){return{type:e}}function ea(){return!Oe.button}function ta(){var e=this.ownerSVGElement||this;return[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function na(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function ra(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function ia(e){var t=e.__brush;return t?t.dim.output(t.selection):null}function oa(){return sa(Wo)}function aa(){return sa(Go)}var ca=function(){return sa(Yo)};function sa(e){var t,n=ta,r=ea,i=ze(a,"start","brush","end"),o=6;function a(t){var n=t.property("__brush",f).selectAll(".overlay").data([Jo("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Zo.overlay).merge(n).each((function(){var e=na(this).extent;Lt(this).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1])})),t.selectAll(".selection").data([Jo("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Zo.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=t.selectAll(".handle").data(e.handles,(function(e){return e.type}));r.exit().remove(),r.enter().append("rect").attr("class",(function(e){return"handle handle--"+e.type})).attr("cursor",(function(e){return Zo[e.type]})),t.each(c).attr("fill","none").attr("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush touchstart.brush",u)}function c(){var e=Lt(this),t=na(this).selection;t?(e.selectAll(".selection").style("display",null).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1]),e.selectAll(".handle").style("display",null).attr("x",(function(e){return"e"===e.type[e.type.length-1]?t[1][0]-o/2:t[0][0]-o/2})).attr("y",(function(e){return"s"===e.type[0]?t[1][1]-o/2:t[0][1]-o/2})).attr("width",(function(e){return"n"===e.type||"s"===e.type?t[1][0]-t[0][0]+o:o})).attr("height",(function(e){return"e"===e.type||"w"===e.type?t[1][1]-t[0][1]+o:o}))):e.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function s(e,t){return e.__brush.emitter||new l(e,t)}function l(e,t){this.that=e,this.args=t,this.state=e.__brush,this.active=0}function u(){if(Oe.touches){if(Oe.changedTouches.length0&&(n=i-d),k<0?f=h-p:k>0&&(o=a-p),b=Bo,L.attr("cursor",Zo.selection),V());break;default:return}Io()}),!0).on("keyup.brush",(function(){switch(Oe.keyCode){case 16:O&&(v=g=O=!1,V());break;case 18:b===Uo&&(w<0?l=u:w>0&&(n=i),k<0?f=h:k>0&&(o=a),b=Fo,V());break;case 32:b===Bo&&(Oe.altKey?(w&&(l=u-d*w,n=i+d*w),k&&(f=h-p*k,o=a+p*k),b=Uo):(w<0?l=u:w>0&&(n=i),k<0?f=h:k>0&&(o=a),b=Fo),L.attr("cursor",Zo[y]),V());break;default:return}Io()}),!0).on("mousemove.brush",P,!0).on("mouseup.brush",N,!0);Rt(Oe.view)}No(),yi(m),c.call(m),A.start()}function P(){var e=Ne(m);!O||v||g||(Math.abs(e[0]-E[0])>Math.abs(e[1]-E[1])?g=!0:v=!0),E=e,z=!0,Io(),V()}function V(){var e;switch(d=E[0]-T[0],p=E[1]-T[1],b){case Bo:case Ro:w&&(d=Math.max(_-n,Math.min(q-l,d)),i=n+d,u=l+d),k&&(p=Math.max(C-o,Math.min(S-f,p)),a=o+p,h=f+p);break;case Fo:w<0?(d=Math.max(_-n,Math.min(q-n,d)),i=n+d,u=l):w>0&&(d=Math.max(_-l,Math.min(q-l,d)),i=n,u=l+d),k<0?(p=Math.max(C-o,Math.min(S-o,p)),a=o+p,h=f):k>0&&(p=Math.max(C-f,Math.min(S-f,p)),a=o,h=f+p);break;case Uo:w&&(i=Math.max(_,Math.min(q,n-d*w)),u=Math.max(_,Math.min(q,l+d*w))),k&&(a=Math.max(C,Math.min(S,o-p*k)),h=Math.max(C,Math.min(S,f+p*k)))}u1e-6)if(Math.abs(u*c-s*l)>1e-6&&i){var h=n-o,d=r-a,p=c*c+s*s,z=h*h+d*d,v=Math.sqrt(p),g=Math.sqrt(f),m=i*Math.tan((ya-Math.acos((p+f-z)/(2*v*g)))/2),y=m/g,b=m/v;Math.abs(y-1)>1e-6&&(this._+="L"+(e+y*l)+","+(t+y*u)),this._+="A"+i+","+i+",0,0,"+ +(u*h>l*d)+","+(this._x1=e+b*c)+","+(this._y1=t+b*s)}else this._+="L"+(this._x1=e)+","+(this._y1=t);else;},arc:function(e,t,n,r,i,o){e=+e,t=+t;var a=(n=+n)*Math.cos(r),c=n*Math.sin(r),s=e+a,l=t+c,u=1^o,f=o?r-i:i-r;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+s+","+l:(Math.abs(this._x1-s)>1e-6||Math.abs(this._y1-l)>1e-6)&&(this._+="L"+s+","+l),n&&(f<0&&(f=f%ba+ba),f>wa?this._+="A"+n+","+n+",0,1,"+u+","+(e-a)+","+(t-c)+"A"+n+","+n+",0,1,"+u+","+(this._x1=s)+","+(this._y1=l):f>1e-6&&(this._+="A"+n+","+n+",0,"+ +(f>=ya)+","+u+","+(this._x1=e+n*Math.cos(i))+","+(this._y1=t+n*Math.sin(i))))},rect:function(e,t,n,r){this._+="M"+(this._x0=this._x1=+e)+","+(this._y0=this._y1=+t)+"h"+ +n+"v"+ +r+"h"+-n+"Z"},toString:function(){return this._}};var ja=xa;function Ma(e){return e.source}function _a(e){return e.target}function Ca(e){return e.radius}function qa(e){return e.startAngle}function Sa(e){return e.endAngle}var Oa=function(){var e=Ma,t=_a,n=Ca,r=qa,i=Sa,o=null;function a(){var a,c=ga.call(arguments),s=e.apply(this,c),l=t.apply(this,c),u=+n.apply(this,(c[0]=s,c)),f=r.apply(this,c)-ha,h=i.apply(this,c)-ha,d=u*la(f),p=u*ua(f),z=+n.apply(this,(c[0]=l,c)),v=r.apply(this,c)-ha,g=i.apply(this,c)-ha;if(o||(o=a=ja()),o.moveTo(d,p),o.arc(0,0,u,f,h),f===v&&h===g||(o.quadraticCurveTo(0,0,z*la(v),z*ua(v)),o.arc(0,0,z,v,g)),o.quadraticCurveTo(0,0,d,p),o.closePath(),a)return o=null,a+""||null}return a.radius=function(e){return arguments.length?(n="function"===typeof e?e:ma(+e),a):n},a.startAngle=function(e){return arguments.length?(r="function"===typeof e?e:ma(+e),a):r},a.endAngle=function(e){return arguments.length?(i="function"===typeof e?e:ma(+e),a):i},a.source=function(t){return arguments.length?(e=t,a):e},a.target=function(e){return arguments.length?(t=e,a):t},a.context=function(e){return arguments.length?(o=null==e?null:e,a):o},a};function Ta(){}function Ea(e,t){var n=new Ta;if(e instanceof Ta)e.each((function(e,t){n.set(t,e)}));else if(Array.isArray(e)){var r,i=-1,o=e.length;if(null==t)for(;++i=r.length)return null!=e&&n.sort(e),null!=t?t(n):n;for(var s,l,u,f=-1,h=n.length,d=r[i++],p=Aa(),z=a();++fr.length)return n;var a,c=i[o-1];return null!=t&&o>=r.length?a=n.entries():(a=[],n.each((function(t,n){a.push({key:n,values:e(t,o)})}))),null!=c?a.sort((function(e,t){return c(e.key,t.key)})):a}(o(e,0,Pa,Va),0)},key:function(e){return r.push(e),n},sortKeys:function(e){return i[r.length-1]=e,n},sortValues:function(t){return e=t,n},rollup:function(e){return t=e,n}}};function La(){return{}}function Da(e,t,n){e[t]=n}function Pa(){return Aa()}function Va(e,t,n){e.set(t,n)}function Na(){}var Ia=Aa.prototype;function Ra(e,t){var n=new Na;if(e instanceof Na)e.each((function(e){n.add(e)}));else if(e){var r=-1,i=e.length;if(null==t)for(;++r=o?s=!0:(r=e.charCodeAt(a++))===$a?l=!0:r===Xa&&(l=!0,e.charCodeAt(a)===$a&&++a),e.slice(i+1,t-1).replace(/""/g,'"')}for(;a=(o=(z+g)/2))?z=o:g=o,(u=n>=(a=(v+m)/2))?v=a:m=a,i=d,!(d=d[f=u<<1|l]))return i[f]=p,e;if(c=+e._x.call(null,d.data),s=+e._y.call(null,d.data),t===c&&n===s)return p.next=d,i?i[f]=p:e._root=p,e;do{i=i?i[f]=new Array(4):e._root=new Array(4),(l=t>=(o=(z+g)/2))?z=o:g=o,(u=n>=(a=(v+m)/2))?v=a:m=a}while((f=u<<1|l)===(h=(s>=a)<<1|c>=o));return i[h]=d,i[f]=p,e}var dc=function(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i};function pc(e){return e[0]}function zc(e){return e[1]}function vc(e,t,n){var r=new gc(null==t?pc:t,null==n?zc:n,NaN,NaN,NaN,NaN);return null==e?r:r.addAll(e)}function gc(e,t,n,r,i,o){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function mc(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var yc=vc.prototype=gc.prototype;function bc(e){return e.x+e.vx}function wc(e){return e.y+e.vy}yc.copy=function(){var e,t,n=new gc(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=mc(r),n;for(e=[{source:r,target:n._root=new Array(4)}];r=e.pop();)for(var i=0;i<4;++i)(t=r.source[i])&&(t.length?e.push({source:t,target:r.target[i]=new Array(4)}):r.target[i]=mc(t));return n},yc.add=function(e){var t=+this._x.call(null,e),n=+this._y.call(null,e);return hc(this.cover(t,n),t,n,e)},yc.addAll=function(e){var t,n,r,i,o=e.length,a=new Array(o),c=new Array(o),s=1/0,l=1/0,u=-1/0,f=-1/0;for(n=0;nu&&(u=r),if&&(f=i));for(ue||e>i||r>t||t>o))return this;var a,c,s=i-n,l=this._root;switch(c=(t<(r+o)/2)<<1|e<(n+i)/2){case 0:do{(a=new Array(4))[c]=l,l=a}while(o=r+(s*=2),e>(i=n+s)||t>o);break;case 1:do{(a=new Array(4))[c]=l,l=a}while(o=r+(s*=2),(n=i-s)>e||t>o);break;case 2:do{(a=new Array(4))[c]=l,l=a}while(r=o-(s*=2),e>(i=n+s)||r>t);break;case 3:do{(a=new Array(4))[c]=l,l=a}while(r=o-(s*=2),(n=i-s)>e||r>t)}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},yc.data=function(){var e=[];return this.visit((function(t){if(!t.length)do{e.push(t.data)}while(t=t.next)})),e},yc.extent=function(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},yc.find=function(e,t,n){var r,i,o,a,c,s,l,u=this._x0,f=this._y0,h=this._x1,d=this._y1,p=[],z=this._root;for(z&&p.push(new dc(z,u,f,h,d)),null==n?n=1/0:(u=e-n,f=t-n,h=e+n,d=t+n,n*=n);s=p.pop();)if(!(!(z=s.node)||(i=s.x0)>h||(o=s.y0)>d||(a=s.x1)=g)<<1|e>=v)&&(s=p[p.length-1],p[p.length-1]=p[p.length-1-l],p[p.length-1-l]=s)}else{var m=e-+this._x.call(null,z.data),y=t-+this._y.call(null,z.data),b=m*m+y*y;if(b=(c=(p+v)/2))?p=c:v=c,(u=a>=(s=(z+g)/2))?z=s:g=s,t=d,!(d=d[f=u<<1|l]))return this;if(!d.length)break;(t[f+1&3]||t[f+2&3]||t[f+3&3])&&(n=t,h=f)}for(;d.data!==e;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):t?(i?t[f]=i:delete t[f],(d=t[0]||t[1]||t[2]||t[3])&&d===(t[3]||t[2]||t[1]||t[0])&&!d.length&&(n?n[h]=d:this._root=d),this):(this._root=i,this)},yc.removeAll=function(e){for(var t=0,n=e.length;ts+d||il+d||oc.index){var p=s-a.x-a.vx,z=l-a.y-a.vy,v=p*p+z*z;ve.r&&(e.r=e[t].r)}function c(){if(t){var r,i,o=t.length;for(n=new Array(o),r=0;r1?(null==n?c.remove(e):c.set(e,d(n)),t):c.get(e)},find:function(t,n,r){var i,o,a,c,s,l=0,u=e.length;for(null==r?r=1/0:r*=r,l=0;l1?(l.on(e,n),t):l.on(e)}}},Ec=function(){var e,t,n,r,i=uc(-30),o=1,a=1/0,c=.81;function s(r){var i,o=e.length,a=vc(e,_c,Cc).visitAfter(u);for(n=r,i=0;i=a)){(e.data!==t||e.next)&&(0===u&&(d+=(u=fc())*u),0===f&&(d+=(f=fc())*f),d1?r[0]+r.slice(2):r,+e.slice(n+1)]},Pc=function(e){return(e=Dc(Math.abs(e)))?e[1]:NaN},Vc=function(e,t){var n=Dc(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")},Nc={"":function(e,t){e:for(var n,r=(e=e.toPrecision(t)).length,i=1,o=-1;i0&&(o=0)}return o>0?e.slice(0,o)+e.slice(n+1):e},"%":function(e,t){return(100*e).toFixed(t)},b:function(e){return Math.round(e).toString(2)},c:function(e){return e+""},d:function(e){return Math.round(e).toString(10)},e:function(e,t){return e.toExponential(t)},f:function(e,t){return e.toFixed(t)},g:function(e,t){return e.toPrecision(t)},o:function(e){return Math.round(e).toString(8)},p:function(e,t){return Vc(100*e,t)},r:Vc,s:function(e,t){var n=Dc(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(qc=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,a=r.length;return o===a?r:o>a?r+new Array(o-a+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Dc(e,Math.max(0,t+o-1))[0]},X:function(e){return Math.round(e).toString(16).toUpperCase()},x:function(e){return Math.round(e).toString(16)}},Ic=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;function Rc(e){return new Bc(e)}function Bc(e){if(!(t=Ic.exec(e)))throw new Error("invalid format: "+e);var t,n=t[1]||" ",r=t[2]||">",i=t[3]||"-",o=t[4]||"",a=!!t[5],c=t[6]&&+t[6],s=!!t[7],l=t[8]&&+t[8].slice(1),u=t[9]||"";"n"===u?(s=!0,u="g"):Nc[u]||(u=""),(a||"0"===n&&"="===r)&&(a=!0,n="0",r="="),this.fill=n,this.align=r,this.sign=i,this.symbol=o,this.zero=a,this.width=c,this.comma=s,this.precision=l,this.type=u}Rc.prototype=Bc.prototype,Bc.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var Fc,Uc,Wc,Gc=function(e){return e},Yc=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"],Zc=function(e){var t,n,r=e.grouping&&e.thousands?(t=e.grouping,n=e.thousands,function(e,r){for(var i=e.length,o=[],a=0,c=t[0],s=0;i>0&&c>0&&(s+c+1>r&&(c=Math.max(1,r-s)),o.push(e.substring(i-=c,i+c)),!((s+=c+1)>r));)c=t[a=(a+1)%t.length];return o.reverse().join(n)}):Gc,i=e.currency,o=e.decimal,a=e.numerals?function(e){return function(t){return t.replace(/[0-9]/g,(function(t){return e[+t]}))}}(e.numerals):Gc,c=e.percent||"%";function s(e){var t=(e=Rc(e)).fill,n=e.align,s=e.sign,l=e.symbol,u=e.zero,f=e.width,h=e.comma,d=e.precision,p=e.type,z="$"===l?i[0]:"#"===l&&/[boxX]/.test(p)?"0"+p.toLowerCase():"",v="$"===l?i[1]:/[%p]/.test(p)?c:"",g=Nc[p],m=!p||/[defgprs%]/.test(p);function y(e){var i,c,l,y=z,b=v;if("c"===p)b=g(e)+b,e="";else{var w=(e=+e)<0;if(e=g(Math.abs(e),d),w&&0===+e&&(w=!1),y=(w?"("===s?s:"-":"-"===s||"("===s?"":s)+y,b=b+("s"===p?Yc[8+qc/3]:"")+(w&&"("===s?")":""),m)for(i=-1,c=e.length;++i(l=e.charCodeAt(i))||l>57){b=(46===l?o+e.slice(i+1):e.slice(i))+b,e=e.slice(0,i);break}}h&&!u&&(e=r(e,1/0));var k=y.length+e.length+b.length,x=k>1)+y+e+b+x.slice(k);break;default:e=x+y+e+b}return a(e)}return d=null==d?p?6:12:/[gprs]/.test(p)?Math.max(1,Math.min(21,d)):Math.max(0,Math.min(20,d)),y.toString=function(){return e+""},y}return{format:s,formatPrefix:function(e,t){var n=s(((e=Rc(e)).type="f",e)),r=3*Math.max(-8,Math.min(8,Math.floor(Pc(t)/3))),i=Math.pow(10,-r),o=Yc[8+r/3];return function(e){return n(i*e)+o}}}};function $c(e){return Fc=Zc(e),Uc=Fc.format,Wc=Fc.formatPrefix,Fc}$c({decimal:".",thousands:",",grouping:[3],currency:["$",""]});var Xc=function(e){return Math.max(0,-Pc(Math.abs(e)))},Kc=function(e,t){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Pc(t)/3)))-Pc(Math.abs(e)))},Qc=function(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Pc(t)-Pc(e))+1},Jc=function(){return new es};function es(){this.reset()}es.prototype={constructor:es,reset:function(){this.s=this.t=0},add:function(e){ns(ts,e,this.t),ns(this,ts.s,this.s),this.s?this.t+=ts.t:this.s=ts.t},valueOf:function(){return this.s}};var ts=new es;function ns(e,t,n){var r=e.s=t+n,i=r-t,o=r-i;e.t=t-o+(n-i)}var rs=1e-6,is=Math.PI,os=is/2,as=is/4,cs=2*is,ss=180/is,ls=is/180,us=Math.abs,fs=Math.atan,hs=Math.atan2,ds=Math.cos,ps=Math.ceil,zs=Math.exp,vs=(Math.floor,Math.log),gs=Math.pow,ms=Math.sin,ys=Math.sign||function(e){return e>0?1:e<0?-1:0},bs=Math.sqrt,ws=Math.tan;function ks(e){return e>1?0:e<-1?is:Math.acos(e)}function xs(e){return e>1?os:e<-1?-os:Math.asin(e)}function js(e){return(e=ms(e/2))*e}function Ms(){}function _s(e,t){e&&qs.hasOwnProperty(e.type)&&qs[e.type](e,t)}var Cs={Feature:function(e,t){_s(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r=0?1:-1,i=r*n,o=ds(t=(t*=ls)/2+as),a=ms(t),c=Ls*a,s=Hs*o+c*ds(i),l=c*r*ms(i);Ps.add(hs(l,s)),As=e,Hs=o,Ls=a}var Us=function(e){return Vs.reset(),Ds(e,Ns),2*Vs};function Ws(e){return[hs(e[1],e[0]),xs(e[2])]}function Gs(e){var t=e[0],n=e[1],r=ds(n);return[r*ds(t),r*ms(t),ms(n)]}function Ys(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Zs(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function $s(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Xs(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Ks(e){var t=bs(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Qs,Js,el,tl,nl,rl,il,ol,al,cl,sl=Jc(),ll={point:ul,lineStart:hl,lineEnd:dl,polygonStart:function(){ll.point=pl,ll.lineStart=zl,ll.lineEnd=vl,sl.reset(),Ns.polygonStart()},polygonEnd:function(){Ns.polygonEnd(),ll.point=ul,ll.lineStart=hl,ll.lineEnd=dl,Ps<0?(Qs=-(el=180),Js=-(tl=90)):sl>rs?tl=90:sl<-rs&&(Js=-90),cl[0]=Qs,cl[1]=el}};function ul(e,t){al.push(cl=[Qs=e,el=e]),ttl&&(tl=t)}function fl(e,t){var n=Gs([e*ls,t*ls]);if(ol){var r=Zs(ol,n),i=Zs([r[1],-r[0],0],r);Ks(i),i=Ws(i);var o,a=e-nl,c=a>0?1:-1,s=i[0]*ss*c,l=us(a)>180;l^(c*nltl&&(tl=o):l^(c*nl<(s=(s+360)%360-180)&&stl&&(tl=t)),l?egl(Qs,el)&&(el=e):gl(e,el)>gl(Qs,el)&&(Qs=e):el>=Qs?(eel&&(el=e)):e>nl?gl(Qs,e)>gl(Qs,el)&&(el=e):gl(e,el)>gl(Qs,el)&&(Qs=e)}else al.push(cl=[Qs=e,el=e]);ttl&&(tl=t),ol=n,nl=e}function hl(){ll.point=fl}function dl(){cl[0]=Qs,cl[1]=el,ll.point=ul,ol=null}function pl(e,t){if(ol){var n=e-nl;sl.add(us(n)>180?n+(n>0?360:-360):n)}else rl=e,il=t;Ns.point(e,t),fl(e,t)}function zl(){Ns.lineStart()}function vl(){pl(rl,il),Ns.lineEnd(),us(sl)>rs&&(Qs=-(el=180)),cl[0]=Qs,cl[1]=el,ol=null}function gl(e,t){return(t-=e)<0?t+360:t}function ml(e,t){return e[0]-t[0]}function yl(e,t){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:tgl(r[0],r[1])&&(r[1]=i[1]),gl(i[0],r[1])>gl(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,t=0,r=o[n=o.length-1];t<=n;r=i,++t)i=o[t],(c=gl(r[1],i[0]))>a&&(a=c,Qs=i[0],el=r[1])}return al=cl=null,Qs===1/0||Js===1/0?[[NaN,NaN],[NaN,NaN]]:[[Qs,Js],[el,tl]]},Pl={sphere:Ms,point:Vl,lineStart:Il,lineEnd:Fl,polygonStart:function(){Pl.lineStart=Ul,Pl.lineEnd=Wl},polygonEnd:function(){Pl.lineStart=Il,Pl.lineEnd=Fl}};function Vl(e,t){e*=ls;var n=ds(t*=ls);Nl(n*ds(e),n*ms(e),ms(t))}function Nl(e,t,n){++bl,kl+=(e-kl)/bl,xl+=(t-xl)/bl,jl+=(n-jl)/bl}function Il(){Pl.point=Rl}function Rl(e,t){e*=ls;var n=ds(t*=ls);Al=n*ds(e),Hl=n*ms(e),Ll=ms(t),Pl.point=Bl,Nl(Al,Hl,Ll)}function Bl(e,t){e*=ls;var n=ds(t*=ls),r=n*ds(e),i=n*ms(e),o=ms(t),a=hs(bs((a=Hl*o-Ll*i)*a+(a=Ll*r-Al*o)*a+(a=Al*i-Hl*r)*a),Al*r+Hl*i+Ll*o);wl+=a,Ml+=a*(Al+(Al=r)),_l+=a*(Hl+(Hl=i)),Cl+=a*(Ll+(Ll=o)),Nl(Al,Hl,Ll)}function Fl(){Pl.point=Vl}function Ul(){Pl.point=Gl}function Wl(){Yl(Tl,El),Pl.point=Vl}function Gl(e,t){Tl=e,El=t,e*=ls,t*=ls,Pl.point=Yl;var n=ds(t);Al=n*ds(e),Hl=n*ms(e),Ll=ms(t),Nl(Al,Hl,Ll)}function Yl(e,t){e*=ls;var n=ds(t*=ls),r=n*ds(e),i=n*ms(e),o=ms(t),a=Hl*o-Ll*i,c=Ll*r-Al*o,s=Al*i-Hl*r,l=bs(a*a+c*c+s*s),u=xs(l),f=l&&-u/l;ql+=f*a,Sl+=f*c,Ol+=f*s,wl+=u,Ml+=u*(Al+(Al=r)),_l+=u*(Hl+(Hl=i)),Cl+=u*(Ll+(Ll=o)),Nl(Al,Hl,Ll)}var Zl=function(e){bl=wl=kl=xl=jl=Ml=_l=Cl=ql=Sl=Ol=0,Ds(e,Pl);var t=ql,n=Sl,r=Ol,i=t*t+n*n+r*r;return i<1e-12&&(t=Ml,n=_l,r=Cl,wlis?e-cs:e<-is?e+cs:e,t]}function Ql(e,t,n){return(e%=cs)?t||n?Xl(eu(e),tu(t,n)):eu(e):t||n?tu(t,n):Kl}function Jl(e){return function(t,n){return[(t+=e)>is?t-cs:t<-is?t+cs:t,n]}}function eu(e){var t=Jl(e);return t.invert=Jl(-e),t}function tu(e,t){var n=ds(e),r=ms(e),i=ds(t),o=ms(t);function a(e,t){var a=ds(t),c=ds(e)*a,s=ms(e)*a,l=ms(t),u=l*n+c*r;return[hs(s*i-u*o,c*n-l*r),xs(u*i+s*o)]}return a.invert=function(e,t){var a=ds(t),c=ds(e)*a,s=ms(e)*a,l=ms(t),u=l*i-s*o;return[hs(s*i+l*o,c*n+u*r),xs(u*n-c*r)]},a}Kl.invert=Kl;var nu=function(e){function t(t){return(t=e(t[0]*ls,t[1]*ls))[0]*=ss,t[1]*=ss,t}return e=Ql(e[0]*ls,e[1]*ls,e.length>2?e[2]*ls:0),t.invert=function(t){return(t=e.invert(t[0]*ls,t[1]*ls))[0]*=ss,t[1]*=ss,t},t};function ru(e,t,n,r,i,o){if(n){var a=ds(t),c=ms(t),s=r*n;null==i?(i=t+r*cs,o=t-s/2):(i=iu(a,i),o=iu(a,o),(r>0?io)&&(i+=r*cs));for(var l,u=i;r>0?u>o:u1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}},cu=function(e,t){return us(e[0]-t[0])=0;--o)i.point((u=l[o])[0],u[1]);else r(h.x,h.p.x,-1,i);h=h.p}l=(h=h.o).z,d=!d}while(!h.v);i.lineEnd()}}};function uu(e){if(t=e.length){for(var t,n,r=0,i=e[0];++r=0?1:-1,j=x*k,M=j>is,_=p*b;if(fu.add(hs(_*x*ms(j),z*w+_*ds(j))),o+=M?k+x*cs:k,M^h>=n^m>=n){var C=Zs(Gs(f),Gs(g));Ks(C);var q=Zs(i,C);Ks(q);var S=(M^k>=0?-1:1)*xs(q[2]);(r>S||r===S&&(C[0]||C[1]))&&(a+=M^k>=0?1:-1)}}return(o<-rs||o0){for(f||(i.polygonStart(),f=!0),i.lineStart(),e=0;e1&&2&s&&h.push(h.pop().concat(h.shift())),a.push(h.filter(pu))}return h}};function pu(e){return e.length>1}function zu(e,t){return((e=e.x)[0]<0?e[1]-os-rs:os-e[1])-((t=t.x)[0]<0?t[1]-os-rs:os-t[1])}var vu=du((function(){return!0}),(function(e){var t,n=NaN,r=NaN,i=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(o,a){var c=o>0?is:-is,s=us(o-n);us(s-is)0?os:-os),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(c,r),e.point(o,r),t=0):i!==c&&s>=is&&(us(n-i)rs?fs((ms(t)*(o=ds(r))*ms(n)-ms(r)*(i=ds(t))*ms(e))/(i*o*a)):(t+r)/2}(n,r,o,a),e.point(i,r),e.lineEnd(),e.lineStart(),e.point(c,r),t=0),e.point(n=o,r=a),i=c},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}}),(function(e,t,n,r){var i;if(null==e)i=n*os,r.point(-is,i),r.point(0,i),r.point(is,i),r.point(is,0),r.point(is,-i),r.point(0,-i),r.point(-is,-i),r.point(-is,0),r.point(-is,i);else if(us(e[0]-t[0])>rs){var o=e[0]0,i=us(t)>rs;function o(e,n){return ds(e)*ds(n)>t}function a(e,n,r){var i=[1,0,0],o=Zs(Gs(e),Gs(n)),a=Ys(o,o),c=o[0],s=a-c*c;if(!s)return!r&&e;var l=t*a/s,u=-t*c/s,f=Zs(i,o),h=Xs(i,l);$s(h,Xs(o,u));var d=f,p=Ys(h,d),z=Ys(d,d),v=p*p-z*(Ys(h,h)-1);if(!(v<0)){var g=bs(v),m=Xs(d,(-p-g)/z);if($s(m,h),m=Ws(m),!r)return m;var y,b=e[0],w=n[0],k=e[1],x=n[1];w0^m[1]<(us(m[0]-b)is^(b<=m[0]&&m[0]<=w)){var _=Xs(d,(-p+g)/z);return $s(_,h),[m,Ws(_)]}}}function c(t,n){var i=r?e:is-e,o=0;return t<-i?o|=1:t>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return du(o,(function(e){var t,n,s,l,u;return{lineStart:function(){l=s=!1,u=1},point:function(f,h){var d,p=[f,h],z=o(f,h),v=r?z?0:c(f,h):z?c(f+(f<0?is:-is),h):0;if(!t&&(l=s=z)&&e.lineStart(),z!==s&&(!(d=a(t,p))||cu(t,d)||cu(p,d))&&(p[0]+=rs,p[1]+=rs,z=o(p[0],p[1])),z!==s)u=0,z?(e.lineStart(),d=a(p,t),e.point(d[0],d[1])):(d=a(t,p),e.point(d[0],d[1]),e.lineEnd()),t=d;else if(i&&t&&r^z){var g;v&n||!(g=a(p,t,!0))||(u=0,r?(e.lineStart(),e.point(g[0][0],g[0][1]),e.point(g[1][0],g[1][1]),e.lineEnd()):(e.point(g[1][0],g[1][1]),e.lineEnd(),e.lineStart(),e.point(g[0][0],g[0][1])))}!z||t&&cu(t,p)||e.point(p[0],p[1]),t=p,s=z,n=v},lineEnd:function(){s&&e.lineEnd(),t=null},clean:function(){return u|(l&&s)<<1}}}),(function(t,r,i,o){ru(o,e,n,i,t,r)}),r?[0,-e]:[-is,e-is])},mu=function(e,t,n,r,i,o){var a,c=e[0],s=e[1],l=0,u=1,f=t[0]-c,h=t[1]-s;if(a=n-c,f||!(a>0)){if(a/=f,f<0){if(a0){if(a>u)return;a>l&&(l=a)}if(a=i-c,f||!(a<0)){if(a/=f,f<0){if(a>u)return;a>l&&(l=a)}else if(f>0){if(a0)){if(a/=h,h<0){if(a0){if(a>u)return;a>l&&(l=a)}if(a=o-s,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>l&&(l=a)}else if(h>0){if(a0&&(e[0]=c+l*f,e[1]=s+l*h),u<1&&(t[0]=c+u*f,t[1]=s+u*h),!0}}}}},yu=1e9,bu=-yu;function wu(e,t,n,r){function i(i,o){return e<=i&&i<=n&&t<=o&&o<=r}function o(i,o,c,l){var u=0,f=0;if(null==i||(u=a(i,c))!==(f=a(o,c))||s(i,o)<0^c>0)do{l.point(0===u||3===u?e:n,u>1?r:t)}while((u=(u+c+4)%4)!==f);else l.point(o[0],o[1])}function a(r,i){return us(r[0]-e)0?0:3:us(r[0]-n)0?2:1:us(r[1]-t)0?1:0:i>0?3:2}function c(e,t){return s(e.x,t.x)}function s(e,t){var n=a(e,1),r=a(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(a){var s,l,u,f,h,d,p,z,v,g,m,y=a,b=au(),w={point:k,lineStart:function(){w.point=x,l&&l.push(u=[]);g=!0,v=!1,p=z=NaN},lineEnd:function(){s&&(x(f,h),d&&v&&b.rejoin(),s.push(b.result()));w.point=k,v&&y.lineEnd()},polygonStart:function(){y=b,s=[],l=[],m=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,i=l.length;nr&&(h-o)*(r-a)>(d-a)*(e-o)&&++t:d<=r&&(h-o)*(r-a)<(d-a)*(e-o)&&--t;return t}(),n=m&&t,i=(s=P(s)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&lu(s,c,t,o,a),a.polygonEnd());y=a,s=l=u=null}};function k(e,t){i(e,t)&&y.point(e,t)}function x(o,a){var c=i(o,a);if(l&&u.push([o,a]),g)f=o,h=a,d=c,g=!1,c&&(y.lineStart(),y.point(o,a));else if(c&&v)y.point(o,a);else{var s=[p=Math.max(bu,Math.min(yu,p)),z=Math.max(bu,Math.min(yu,z))],b=[o=Math.max(bu,Math.min(yu,o)),a=Math.max(bu,Math.min(yu,a))];mu(s,b,e,t,n,r)?(v||(y.lineStart(),y.point(s[0],s[1])),y.point(b[0],b[1]),c||y.lineEnd(),m=!1):c&&(y.lineStart(),y.point(o,a),m=!1)}p=o,z=a,v=c}return w}}var ku,xu,ju,Mu=function(){var e,t,n,r=0,i=0,o=960,a=500;return n={stream:function(n){return e&&t===n?e:e=wu(r,i,o,a)(t=n)},extent:function(c){return arguments.length?(r=+c[0][0],i=+c[0][1],o=+c[1][0],a=+c[1][1],e=t=null,n):[[r,i],[o,a]]}}},_u=Jc(),Cu={sphere:Ms,point:Ms,lineStart:function(){Cu.point=Su,Cu.lineEnd=qu},lineEnd:Ms,polygonStart:Ms,polygonEnd:Ms};function qu(){Cu.point=Cu.lineEnd=Ms}function Su(e,t){ku=e*=ls,xu=ms(t*=ls),ju=ds(t),Cu.point=Ou}function Ou(e,t){e*=ls;var n=ms(t*=ls),r=ds(t),i=us(e-ku),o=ds(i),a=r*ms(i),c=ju*n-xu*r*o,s=xu*n+ju*r*o;_u.add(hs(bs(a*a+c*c),s)),ku=e,xu=n,ju=r}var Tu=function(e){return _u.reset(),Ds(e,Cu),+_u},Eu=[null,null],Au={type:"LineString",coordinates:Eu},Hu=function(e,t){return Eu[0]=e,Eu[1]=t,Tu(Au)},Lu={Feature:function(e,t){return Pu(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++rrs})).map(s)).concat(k(ps(o/d)*d,i,d).filter((function(e){return us(e%z)>rs})).map(l))}return g.lines=function(){return m().map((function(e){return{type:"LineString",coordinates:e}}))},g.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(f(a).slice(1),u(n).reverse().slice(1),f(c).reverse().slice(1))]}},g.extent=function(e){return arguments.length?g.extentMajor(e).extentMinor(e):g.extentMinor()},g.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],c=+e[0][1],a=+e[1][1],r>n&&(e=r,r=n,n=e),c>a&&(e=c,c=a,a=e),g.precision(v)):[[r,c],[n,a]]},g.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],o=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),o>i&&(n=o,o=i,i=n),g.precision(v)):[[t,o],[e,i]]},g.step=function(e){return arguments.length?g.stepMajor(e).stepMinor(e):g.stepMinor()},g.stepMajor=function(e){return arguments.length?(p=+e[0],z=+e[1],g):[p,z]},g.stepMinor=function(e){return arguments.length?(h=+e[0],d=+e[1],g):[h,d]},g.precision=function(h){return arguments.length?(v=+h,s=Uu(o,i,90),l=Wu(t,e,v),u=Uu(c,a,90),f=Wu(r,n,v),g):v},g.extentMajor([[-180,-90+rs],[180,90-rs]]).extentMinor([[-180,-80-rs],[180,80+rs]])}function Yu(){return Gu()()}var Zu,$u,Xu,Ku,Qu=function(e,t){var n=e[0]*ls,r=e[1]*ls,i=t[0]*ls,o=t[1]*ls,a=ds(r),c=ms(r),s=ds(o),l=ms(o),u=a*ds(n),f=a*ms(n),h=s*ds(i),d=s*ms(i),p=2*xs(bs(js(o-r)+a*s*js(i-n))),z=ms(p),v=p?function(e){var t=ms(e*=p)/z,n=ms(p-e)/z,r=n*u+t*h,i=n*f+t*d,o=n*c+t*l;return[hs(i,r)*ss,hs(o,bs(r*r+i*i))*ss]}:function(){return[n*ss,r*ss]};return v.distance=p,v},Ju=function(e){return e},ef=Jc(),tf=Jc(),nf={point:Ms,lineStart:Ms,lineEnd:Ms,polygonStart:function(){nf.lineStart=rf,nf.lineEnd=cf},polygonEnd:function(){nf.lineStart=nf.lineEnd=nf.point=Ms,ef.add(us(tf)),tf.reset()},result:function(){var e=ef/2;return ef.reset(),e}};function rf(){nf.point=of}function of(e,t){nf.point=af,Zu=Xu=e,$u=Ku=t}function af(e,t){tf.add(Ku*e-Xu*t),Xu=e,Ku=t}function cf(){af(Zu,$u)}var sf=nf,lf=1/0,uf=lf,ff=-lf,hf=ff;var df,pf,zf,vf,gf={point:function(e,t){eff&&(ff=e);thf&&(hf=t)},lineStart:Ms,lineEnd:Ms,polygonStart:Ms,polygonEnd:Ms,result:function(){var e=[[lf,uf],[ff,hf]];return ff=hf=-(uf=lf=1/0),e}},mf=0,yf=0,bf=0,wf=0,kf=0,xf=0,jf=0,Mf=0,_f=0,Cf={point:qf,lineStart:Sf,lineEnd:Ef,polygonStart:function(){Cf.lineStart=Af,Cf.lineEnd=Hf},polygonEnd:function(){Cf.point=qf,Cf.lineStart=Sf,Cf.lineEnd=Ef},result:function(){var e=_f?[jf/_f,Mf/_f]:xf?[wf/xf,kf/xf]:bf?[mf/bf,yf/bf]:[NaN,NaN];return mf=yf=bf=wf=kf=xf=jf=Mf=_f=0,e}};function qf(e,t){mf+=e,yf+=t,++bf}function Sf(){Cf.point=Of}function Of(e,t){Cf.point=Tf,qf(zf=e,vf=t)}function Tf(e,t){var n=e-zf,r=t-vf,i=bs(n*n+r*r);wf+=i*(zf+e)/2,kf+=i*(vf+t)/2,xf+=i,qf(zf=e,vf=t)}function Ef(){Cf.point=qf}function Af(){Cf.point=Lf}function Hf(){Df(df,pf)}function Lf(e,t){Cf.point=Df,qf(df=zf=e,pf=vf=t)}function Df(e,t){var n=e-zf,r=t-vf,i=bs(n*n+r*r);wf+=i*(zf+e)/2,kf+=i*(vf+t)/2,xf+=i,jf+=(i=vf*e-zf*t)*(zf+e),Mf+=i*(vf+t),_f+=3*i,qf(zf=e,vf=t)}var Pf=Cf;function Vf(e){this._context=e}Vf.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,cs)}},result:Ms};var Nf,If,Rf,Bf,Ff,Uf=Jc(),Wf={point:Ms,lineStart:function(){Wf.point=Gf},lineEnd:function(){Nf&&Yf(If,Rf),Wf.point=Ms},polygonStart:function(){Nf=!0},polygonEnd:function(){Nf=null},result:function(){var e=+Uf;return Uf.reset(),e}};function Gf(e,t){Wf.point=Yf,If=Bf=e,Rf=Ff=t}function Yf(e,t){Bf-=e,Ff-=t,Uf.add(bs(Bf*Bf+Ff*Ff)),Bf=e,Ff=t}var Zf=Wf;function $f(){this._string=[]}function Xf(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}$f.prototype={_radius:4.5,_circle:Xf(4.5),pointRadius:function(e){return(e=+e)!==this._radius&&(this._radius=e,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._string.push("M",e,",",t),this._point=1;break;case 1:this._string.push("L",e,",",t);break;default:null==this._circle&&(this._circle=Xf(this._radius)),this._string.push("M",e,",",t,this._circle)}},result:function(){if(this._string.length){var e=this._string.join("");return this._string=[],e}return null}};var Kf=function(e,t){var n,r,i=4.5;function o(e){return e&&("function"===typeof i&&r.pointRadius(+i.apply(this,arguments)),Ds(e,n(r))),r.result()}return o.area=function(e){return Ds(e,n(sf)),sf.result()},o.measure=function(e){return Ds(e,n(Zf)),Zf.result()},o.bounds=function(e){return Ds(e,n(gf)),gf.result()},o.centroid=function(e){return Ds(e,n(Pf)),Pf.result()},o.projection=function(t){return arguments.length?(n=null==t?(e=null,Ju):(e=t).stream,o):e},o.context=function(e){return arguments.length?(r=null==e?(t=null,new $f):new Vf(t=e),"function"!==typeof i&&r.pointRadius(i),o):t},o.pointRadius=function(e){return arguments.length?(i="function"===typeof e?e:(r.pointRadius(+e),+e),o):i},o.projection(e).context(t)},Qf=function(e){return{stream:Jf(e)}};function Jf(e){return function(t){var n=new eh;for(var r in e)n[r]=e[r];return n.stream=t,n}}function eh(){}function th(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),Ds(n,e.stream(gf)),t(gf.result()),null!=r&&e.clipExtent(r),e}function nh(e,t,n){return th(e,(function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+t[0][0]+(r-o*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([a,c])}),n)}function rh(e,t,n){return nh(e,[[0,0],t],n)}function ih(e,t,n){return th(e,(function(n){var r=+t,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];e.scale(150*i).translate([o,a])}),n)}function oh(e,t,n){return th(e,(function(n){var r=+t,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([o,a])}),n)}eh.prototype={constructor:eh,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var ah=16,ch=ds(30*ls),sh=function(e,t){return+t?function(e,t){function n(r,i,o,a,c,s,l,u,f,h,d,p,z,v){var g=l-r,m=u-i,y=g*g+m*m;if(y>4*t&&z--){var b=a+h,w=c+d,k=s+p,x=bs(b*b+w*w+k*k),j=xs(k/=x),M=us(us(k)-1)t||us((g*S+m*O)/y-.5)>.3||a*h+c*d+s*p2?e[2]%360*ls:0,q()):[v*ss,g*ss,m*ss]},M.precision=function(e){return arguments.length?(j=sh(C,x=e*e),S()):bs(x)},M.fitExtent=function(e,t){return nh(M,e,t)},M.fitSize=function(e,t){return rh(M,e,t)},M.fitWidth=function(e,t){return ih(M,e,t)},M.fitHeight=function(e,t){return oh(M,e,t)},function(){return t=e.apply(this,arguments),M.invert=t.invert&&_,q()}}function hh(e){var t=0,n=is/3,r=fh(e),i=r(t,n);return i.parallels=function(e){return arguments.length?r(t=e[0]*ls,n=e[1]*ls):[t*ss,n*ss]},i}function dh(e,t){var n=ms(e),r=(n+ms(t))/2;if(us(r)=.12&&i<.234&&r>=-.425&&r<-.214?c:i>=.166&&i<.234&&r>=-.214&&r<-.115?s:a).invert(e)},u.stream=function(n){return e&&t===n?e:e=function(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i0?t<-os+rs&&(t=-os+rs):t>os-rs&&(t=os-rs);var n=i/gs(_h(t),r);return[n*ms(r*e),i-n*ds(r*e)]}return o.invert=function(e,t){var n=i-t,o=ys(r)*bs(e*e+n*n);return[hs(e,us(n))/r*ys(n),2*fs(gs(i/o,1/r))-os]},o}var qh=function(){return hh(Ch).scale(109.5).parallels([30,30])};function Sh(e,t){return[e,t]}Sh.invert=Sh;var Oh=function(){return uh(Sh).scale(152.63)};function Th(e,t){var n=ds(e),r=e===t?ms(e):(n-ds(t))/(t-e),i=n/r+e;if(us(r)rs&&--i>0);return[e/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]};var Vh=function(){return uh(Ph).scale(175.295)};function Nh(e,t){return[ds(t)*ms(e),ms(t)]}Nh.invert=mh(xs);var Ih=function(){return uh(Nh).scale(249.5).clipAngle(90+rs)};function Rh(e,t){var n=ds(t),r=1+ds(e)*n;return[n*ms(e)/r,ms(t)/r]}Rh.invert=mh((function(e){return 2*fs(e)}));var Bh=function(){return uh(Rh).scale(250).clipAngle(142)};function Fh(e,t){return[vs(ws((os+t)/2)),-e]}Fh.invert=function(e,t){return[-t,2*fs(zs(e))-os]};var Uh=function(){var e=Mh(Fh),t=e.center,n=e.rotate;return e.center=function(e){return arguments.length?t([-e[1],e[0]]):[(e=t())[1],-e[0]]},e.rotate=function(e){return arguments.length?n([e[0],e[1],e.length>2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)};function Wh(e,t){return e.parent===t.parent?1:2}function Gh(e,t){return e+t.x}function Yh(e,t){return Math.max(e,t.y)}var Zh=function(){var e=Wh,t=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter((function(t){var n=t.children;n?(t.x=function(e){return e.reduce(Gh,0)/e.length}(n),t.y=function(e){return 1+e.reduce(Yh,0)}(n)):(t.x=o?a+=e(t,o):0,t.y=0,o=t)}));var c=function(e){for(var t;t=e.children;)e=t[0];return e}(i),s=function(e){for(var t;t=e.children;)e=t[t.length-1];return e}(i),l=c.x-e(c,s)/2,u=s.x+e(s,c)/2;return i.eachAfter(r?function(e){e.x=(e.x-i.x)*t,e.y=(i.y-e.y)*n}:function(e){e.x=(e.x-l)/(u-l)*t,e.y=(1-(i.y?e.y/i.y:1))*n})}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i};function $h(e){var t=0,n=e.children,r=n&&n.length;if(r)for(;--r>=0;)t+=n[r].value;else t=1;e.value=t}function Xh(e,t){var n,r,i,o,a,c=new ed(e),s=+e.value&&(c.value=e.value),l=[c];for(null==t&&(t=Kh);n=l.pop();)if(s&&(n.value=+n.data.value),(i=t(n.data))&&(a=i.length))for(n.children=new Array(a),o=a-1;o>=0;--o)l.push(r=n.children[o]=new ed(i[o])),r.parent=n,r.depth=n.depth+1;return c.eachBefore(Jh)}function Kh(e){return e.children}function Qh(e){e.data=e.data.data}function Jh(e){var t=0;do{e.height=t}while((e=e.parent)&&e.height<++t)}function ed(e){this.data=e,this.depth=this.height=0,this.parent=null}ed.prototype=Xh.prototype={constructor:ed,count:function(){return this.eachAfter($h)},each:function(e){var t,n,r,i,o=this,a=[o];do{for(t=a.reverse(),a=[];o=t.pop();)if(e(o),n=o.children)for(r=0,i=n.length;r=0;--n)i.push(t[n]);return this},sum:function(e){return this.eachAfter((function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n}))},sort:function(e){return this.eachBefore((function(t){t.children&&t.children.sort(e)}))},path:function(e){for(var t=this,n=function(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;e=n.pop(),t=r.pop();for(;e===t;)i=e,e=n.pop(),t=r.pop();return i}(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r},ancestors:function(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t},descendants:function(){var e=[];return this.each((function(t){e.push(t)})),e},leaves:function(){var e=[];return this.eachBefore((function(t){t.children||e.push(t)})),e},links:function(){var e=this,t=[];return e.each((function(n){n!==e&&t.push({source:n.parent,target:n})})),t},copy:function(){return Xh(this).eachBefore(Qh)}};var td=Array.prototype.slice;var nd=function(e){for(var t,n,r=0,i=(e=function(e){for(var t,n,r=e.length;r;)n=Math.random()*r--|0,t=e[r],e[r]=e[n],e[n]=t;return e}(td.call(e))).length,o=[];r0&&n*n>r*r+i*i}function ad(e,t){for(var n=0;nn*n+r*r}function hd(e){var t=e._,n=e.next._,r=t.r+n.r,i=(t.x*n.r+n.x*t.r)/r,o=(t.y*n.r+n.y*t.r)/r;return i*i+o*o}function dd(e){this._=e,this.next=null,this.previous=null}function pd(e){if(!(i=e.length))return 0;var t,n,r,i,o,a,c,s,l,u,f;if((t=e[0]).x=0,t.y=0,!(i>1))return t.r;if(n=e[1],t.x=-n.r,n.x=t.r,n.y=0,!(i>2))return t.r+n.r;ud(n,t,r=e[2]),t=new dd(t),n=new dd(n),r=new dd(r),t.next=r.previous=n,n.next=t.previous=r,r.next=n.previous=t;e:for(c=3;c0)throw new Error("cycle");return o}return n.id=function(t){return arguments.length?(e=gd(t),n):e},n.parentId=function(e){return arguments.length?(t=gd(e),n):t},n};function Hd(e,t){return e.parent===t.parent?1:2}function Ld(e){var t=e.children;return t?t[0]:e.t}function Dd(e){var t=e.children;return t?t[t.length-1]:e.t}function Pd(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function Vd(e,t,n){return e.a.parent===t.parent?e.a:n}function Nd(e,t){this._=e,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=t}Nd.prototype=Object.create(ed.prototype);var Id=function(){var e=Hd,t=1,n=1,r=null;function i(i){var s=function(e){for(var t,n,r,i,o,a=new Nd(e,0),c=[a];t=c.pop();)if(r=t._.children)for(t.children=new Array(o=r.length),i=o-1;i>=0;--i)c.push(n=t.children[i]=new Nd(r[i],i)),n.parent=t;return(a.parent=new Nd(null,0)).children=[a],a}(i);if(s.eachAfter(o),s.parent.m=-s.z,s.eachBefore(a),r)i.eachBefore(c);else{var l=i,u=i,f=i;i.eachBefore((function(e){e.xu.x&&(u=e),e.depth>f.depth&&(f=e)}));var h=l===u?1:e(l,u)/2,d=h-l.x,p=t/(u.x+h+d),z=n/(f.depth||1);i.eachBefore((function(e){e.x=(e.x+d)*p,e.y=e.depth*z}))}return i}function o(t){var n=t.children,r=t.parent.children,i=t.i?r[t.i-1]:null;if(n){!function(e){for(var t,n=0,r=0,i=e.children,o=i.length;--o>=0;)(t=i[o]).z+=n,t.m+=n,n+=t.s+(r+=t.c)}(t);var o=(n[0].z+n[n.length-1].z)/2;i?(t.z=i.z+e(t._,i._),t.m=t.z-o):t.z=o}else i&&(t.z=i.z+e(t._,i._));t.parent.A=function(t,n,r){if(n){for(var i,o=t,a=t,c=n,s=o.parent.children[0],l=o.m,u=a.m,f=c.m,h=s.m;c=Dd(c),o=Ld(o),c&&o;)s=Ld(s),(a=Dd(a)).a=t,(i=c.z+f-o.z-l+e(c._,o._))>0&&(Pd(Vd(c,t,r),t,i),l+=i,u+=i),f+=c.m,l+=o.m,h+=s.m,u+=a.m;c&&!Dd(a)&&(a.t=c,a.m+=f-u),o&&!Ld(s)&&(s.t=o,s.m+=l-h,r=t)}return r}(t,i,t.parent.A||r[0])}function a(e){e._.x=e.z+e.parent.m,e.m+=e.parent.m}function c(e){e.x*=t,e.y=e.depth*n}return i.separation=function(t){return arguments.length?(e=t,i):e},i.size=function(e){return arguments.length?(r=!1,t=+e[0],n=+e[1],i):r?null:[t,n]},i.nodeSize=function(e){return arguments.length?(r=!0,t=+e[0],n=+e[1],i):r?[t,n]:null},i},Rd=function(e,t,n,r,i){for(var o,a=e.children,c=-1,s=a.length,l=e.value&&(i-n)/e.value;++ch&&(h=c),v=u*u*z,(d=Math.max(h/v,v/f))>p){u-=c;break}p=d}g.push(a={value:u,dice:s1?t:1)},n}(Bd),Wd=function(){var e=Ud,t=!1,n=1,r=1,i=[0],o=md,a=md,c=md,s=md,l=md;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(f),i=[0],t&&e.eachBefore(Md),e}function f(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,f=t.x1-n,h=t.y1-n;f=n-1){var u=c[t];return u.x0=i,u.y0=o,u.x1=a,void(u.y1=s)}var f=l[t],h=r/2+f,d=t+1,p=n-1;for(;d>>1;l[z]s-o){var m=(i*g+a*v)/r;e(t,d,v,i,o,m,s),e(d,n,g,m,o,a,s)}else{var y=(o*g+s*v)/r;e(t,d,v,i,o,a,y),e(d,n,g,i,y,a,s)}}(0,s,e.value,t,n,r,i)},Yd=function(e,t,n,r,i){(1&e.depth?Rd:_d)(e,t,n,r,i)},Zd=function e(t){function n(e,n,r,i,o){if((a=e._squarify)&&a.ratio===t)for(var a,c,s,l,u,f=-1,h=a.length,d=e.value;++f1?t:1)},n}(Bd),$d=function(e){for(var t,n=-1,r=e.length,i=e[r-1],o=0;++n1&&Kd(e[n[r-2]],e[n[r-1]],e[i])<=0;)--r;n[r++]=i}return n.slice(0,r)}var ep=function(e){if((n=e.length)<3)return null;var t,n,r=new Array(n),i=new Array(n);for(t=0;t=0;--t)l.push(e[r[o[t]][2]]);for(t=+c;tc!==l>c&&a<(s-n)*(c-r)/(l-r)+n&&(u=!u),s=n,l=r;return u},np=function(e){for(var t,n,r=-1,i=e.length,o=e[i-1],a=o[0],c=o[1],s=0;++r=0;)if((n=e._tasks[r])&&(e._tasks[r]=null,n.abort))try{n.abort()}catch(t){}e._active=NaN,lp(e)}function lp(e){if(!e._active&&e._call){var t=e._data;e._data=void 0,e._call(e._error,t)}}function up(e){if(null==e)e=1/0;else if(!((e=+e)>=1))throw new Error("invalid concurrency");return new op(e)}op.prototype=up.prototype={constructor:op,defer:function(e){if("function"!==typeof e)throw new Error("invalid callback");if(this._call)throw new Error("defer after await");if(null!=this._error)return this;var t=rp.call(arguments,1);return t.push(e),++this._waiting,this._tasks.push(t),ap(this),this},abort:function(){return null==this._error&&sp(this,new Error("abort")),this},await:function(e){if("function"!==typeof e)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=function(t,n){e.apply(null,[t].concat(n))},lp(this),this},awaitAll:function(e){if("function"!==typeof e)throw new Error("invalid callback");if(this._call)throw new Error("multiple await");return this._call=e,lp(this),this}};var fp=function(){return Math.random()},hp=function e(t){function n(e,n){return e=null==e?0:+e,n=null==n?1:+n,1===arguments.length?(n=e,e=0):n-=e,function(){return t()*n+e}}return n.source=e,n}(fp),dp=function e(t){function n(e,n){var r,i;return e=null==e?0:+e,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*t()-1,o=2*t()-1,i=r*r+o*o}while(!i||i>1);return e+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=e,n}(fp),pp=function e(t){function n(){var e=dp.source(t).apply(this,arguments);return function(){return Math.exp(e())}}return n.source=e,n}(fp),zp=function e(t){function n(e){return function(){for(var n=0,r=0;r=200&&r<300||304===r){if(i)try{t=i.call(n,s)}catch(o){return void a.call("error",n,o)}else t=s;a.call("load",n,t)}else a.call("error",n,e)}if("undefined"===typeof XDomainRequest||"withCredentials"in s||!/^(http(s)?:)?\/\//.test(e)||(s=new XDomainRequest),"onload"in s?s.onload=s.onerror=s.ontimeout=h:s.onreadystatechange=function(e){s.readyState>3&&h(e)},s.onprogress=function(e){a.call("progress",n,e)},n={header:function(e,t){return e=(e+"").toLowerCase(),arguments.length<2?c.get(e):(null==t?c.remove(e):c.set(e,t+""),n)},mimeType:function(e){return arguments.length?(r=null==e?null:e+"",n):r},responseType:function(e){return arguments.length?(o=e,n):o},timeout:function(e){return arguments.length?(f=+e,n):f},user:function(e){return arguments.length<1?l:(l=null==e?null:e+"",n)},password:function(e){return arguments.length<1?u:(u=null==e?null:e+"",n)},response:function(e){return i=e,n},get:function(e,t){return n.send("GET",e,t)},post:function(e,t){return n.send("POST",e,t)},send:function(t,i,h){return s.open(t,e,!0,l,u),null==r||c.has("accept")||c.set("accept",r+",*/*"),s.setRequestHeader&&c.each((function(e,t){s.setRequestHeader(t,e)})),null!=r&&s.overrideMimeType&&s.overrideMimeType(r),null!=o&&(s.responseType=o),f>0&&(s.timeout=f),null==h&&"function"===typeof i&&(h=i,i=null),null!=h&&1===h.length&&(h=function(e){return function(t,n){e(null==t?n:null)}}(h)),null!=h&&n.on("error",h).on("load",(function(e){h(null,e)})),a.call("beforesend",n,s),s.send(null==i?null:i),n},abort:function(){return s.abort(),n},on:function(){var e=a.on.apply(a,arguments);return e===a?n:e}},null!=t){if("function"!==typeof t)throw new Error("invalid callback: "+t);return n.get(t)}return n};var yp=function(e,t){return function(n,r){var i=mp(n).mimeType(e).response(t);if(null!=r){if("function"!==typeof r)throw new Error("invalid callback: "+r);return i.get(r)}return i}},bp=yp("text/html",(function(e){return document.createRange().createContextualFragment(e.responseText)})),wp=yp("application/json",(function(e){return JSON.parse(e.responseText)})),kp=yp("text/plain",(function(e){return e.responseText})),xp=yp("application/xml",(function(e){var t=e.responseXML;if(!t)throw new Error("parse error");return t})),jp=function(e,t){return function(n,r,i){arguments.length<3&&(i=r,r=null);var o=mp(n).mimeType(e);return o.row=function(e){return arguments.length?o.response(Mp(t,r=e)):r},o.row(r),i?o.get(i):o}};function Mp(e,t){return function(n){return e(n.responseText,t)}}var _p=jp("text/csv",ec),Cp=jp("text/tab-separated-values",oc),qp=Array.prototype,Sp=qp.map,Op=qp.slice,Tp={name:"implicit"};function Ep(e){var t=Aa(),n=[],r=Tp;function i(i){var o=i+"",a=t.get(o);if(!a){if(r!==Tp)return r;t.set(o,a=n.push(i))}return e[(a-1)%e.length]}return e=null==e?[]:Op.call(e),i.domain=function(e){if(!arguments.length)return n.slice();n=[],t=Aa();for(var r,o,a=-1,c=e.length;++a2?Ip:Np,r=i=null,u}function u(t){return(r||(r=n(o,a,s?function(e){return function(t,n){var r=e(t=+t,n=+n);return function(e){return e<=t?0:e>=n?1:r(e)}}}(e):e,c)))(+t)}return u.invert=function(e){return(i||(i=n(a,o,Vp,s?function(e){return function(t,n){var r=e(t=+t,n=+n);return function(e){return e<=0?t:e>=1?n:r(e)}}}(t):t)))(+e)},u.domain=function(e){return arguments.length?(o=Sp.call(e,Dp),l()):o.slice()},u.range=function(e){return arguments.length?(a=Op.call(e),l()):a.slice()},u.rangeRound=function(e){return a=Op.call(e),c=mr,l()},u.clamp=function(e){return arguments.length?(s=!!e,l()):s},u.interpolate=function(e){return arguments.length?(c=e,l()):c},l()}var Fp=function(e,t,n){var r,i=e[0],o=e[e.length-1],a=q(i,o,null==t?10:t);switch((n=Rc(null==n?",f":n)).type){case"s":var c=Math.max(Math.abs(i),Math.abs(o));return null!=n.precision||isNaN(r=Kc(a,c))||(n.precision=r),Wc(n,c);case"":case"e":case"g":case"p":case"r":null!=n.precision||isNaN(r=Qc(a,Math.max(Math.abs(i),Math.abs(o))))||(n.precision=r-("e"===n.type));break;case"f":case"%":null!=n.precision||isNaN(r=Xc(a))||(n.precision=r-2*("%"===n.type))}return Uc(n)};function Up(e){var t=e.domain;return e.ticks=function(e){var n=t();return _(n[0],n[n.length-1],null==e?10:e)},e.tickFormat=function(e,n){return Fp(t(),e,n)},e.nice=function(n){null==n&&(n=10);var r,i=t(),o=0,a=i.length-1,c=i[o],s=i[a];return s0?r=C(c=Math.floor(c/r)*r,s=Math.ceil(s/r)*r,n):r<0&&(r=C(c=Math.ceil(c*r)/r,s=Math.floor(s*r)/r,n)),r>0?(i[o]=Math.floor(c/r)*r,i[a]=Math.ceil(s/r)*r,t(i)):r<0&&(i[o]=Math.ceil(c*r)/r,i[a]=Math.floor(s*r)/r,t(i)),e},e}function Wp(){var e=Bp(Vp,sr);return e.copy=function(){return Rp(e,Wp())},Up(e)}function Gp(){var e=[0,1];function t(e){return+e}return t.invert=t,t.domain=t.range=function(n){return arguments.length?(e=Sp.call(n,Dp),t):e.slice()},t.copy=function(){return Gp().domain(e)},Up(t)}var Yp=function(e,t){var n,r=0,i=(e=e.slice()).length-1,o=e[r],a=e[i];return a0){for(;hs)break;z.push(f)}}else for(;h=1;--u)if(!((f=l*u)s)break;z.push(f)}}else z=_(h,d,Math.min(d-h,p)).map(i);return o?z.reverse():z},e.tickFormat=function(t,o){if(null==o&&(o=10===n?".0e":","),"function"!==typeof o&&(o=Uc(o)),t===1/0)return o;null==t&&(t=10);var a=Math.max(1,n*t/e.ticks().length);return function(e){var t=e/i(Math.round(r(e)));return t*n0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[a-1],r[a]]},o.copy=function(){return oz().domain([e,t]).range(i)},Up(o)}function az(){var e=[.5],t=[0,1],n=1;function r(r){if(r<=r)return t[s(e,r,0,n)]}return r.domain=function(i){return arguments.length?(e=Op.call(i),n=Math.min(e.length,t.length-1),r):e.slice()},r.range=function(i){return arguments.length?(t=Op.call(i),n=Math.min(e.length,t.length-1),r):t.slice()},r.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},r.copy=function(){return az().domain(e).range(t)},r}var cz=new Date,sz=new Date;function lz(e,t,n,r){function i(t){return e(t=new Date(+t)),t}return i.floor=i,i.ceil=function(n){return e(n=new Date(n-1)),t(n,1),e(n),n},i.round=function(e){var t=i(e),n=i.ceil(e);return e-t0))return c;do{c.push(a=new Date(+n)),t(n,o),e(n)}while(a=t)for(;e(t),!n(t);)t.setTime(t-1)}),(function(e,r){if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}))},n&&(i.count=function(t,r){return cz.setTime(+t),sz.setTime(+r),e(cz),e(sz),Math.floor(n(cz,sz))},i.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?i.filter(r?function(t){return r(t)%e===0}:function(t){return i.count(0,t)%e===0}):i:null}),i}var uz=lz((function(){}),(function(e,t){e.setTime(+e+t)}),(function(e,t){return t-e}));uz.every=function(e){return e=Math.floor(e),isFinite(e)&&e>0?e>1?lz((function(t){t.setTime(Math.floor(t/e)*e)}),(function(t,n){t.setTime(+t+n*e)}),(function(t,n){return(n-t)/e})):uz:null};var fz=uz,hz=uz.range,dz=6e4,pz=6048e5,zz=lz((function(e){e.setTime(1e3*Math.floor(e/1e3))}),(function(e,t){e.setTime(+e+1e3*t)}),(function(e,t){return(t-e)/1e3}),(function(e){return e.getUTCSeconds()})),vz=zz,gz=zz.range,mz=lz((function(e){e.setTime(Math.floor(e/dz)*dz)}),(function(e,t){e.setTime(+e+t*dz)}),(function(e,t){return(t-e)/dz}),(function(e){return e.getMinutes()})),yz=mz,bz=mz.range,wz=lz((function(e){var t=e.getTimezoneOffset()*dz%36e5;t<0&&(t+=36e5),e.setTime(36e5*Math.floor((+e-t)/36e5)+t)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getHours()})),kz=wz,xz=wz.range,jz=lz((function(e){e.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*dz)/864e5}),(function(e){return e.getDate()-1})),Mz=jz,_z=jz.range;function Cz(e){return lz((function(t){t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)}),(function(e,t){e.setDate(e.getDate()+7*t)}),(function(e,t){return(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*dz)/pz}))}var qz=Cz(0),Sz=Cz(1),Oz=Cz(2),Tz=Cz(3),Ez=Cz(4),Az=Cz(5),Hz=Cz(6),Lz=qz.range,Dz=Sz.range,Pz=Oz.range,Vz=Tz.range,Nz=Ez.range,Iz=Az.range,Rz=Hz.range,Bz=lz((function(e){e.setDate(1),e.setHours(0,0,0,0)}),(function(e,t){e.setMonth(e.getMonth()+t)}),(function(e,t){return t.getMonth()-e.getMonth()+12*(t.getFullYear()-e.getFullYear())}),(function(e){return e.getMonth()})),Fz=Bz,Uz=Bz.range,Wz=lz((function(e){e.setMonth(0,1),e.setHours(0,0,0,0)}),(function(e,t){e.setFullYear(e.getFullYear()+t)}),(function(e,t){return t.getFullYear()-e.getFullYear()}),(function(e){return e.getFullYear()}));Wz.every=function(e){return isFinite(e=Math.floor(e))&&e>0?lz((function(t){t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)}),(function(t,n){t.setFullYear(t.getFullYear()+n*e)})):null};var Gz=Wz,Yz=Wz.range,Zz=lz((function(e){e.setUTCSeconds(0,0)}),(function(e,t){e.setTime(+e+t*dz)}),(function(e,t){return(t-e)/dz}),(function(e){return e.getUTCMinutes()})),$z=Zz,Xz=Zz.range,Kz=lz((function(e){e.setUTCMinutes(0,0,0)}),(function(e,t){e.setTime(+e+36e5*t)}),(function(e,t){return(t-e)/36e5}),(function(e){return e.getUTCHours()})),Qz=Kz,Jz=Kz.range,ev=lz((function(e){e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+t)}),(function(e,t){return(t-e)/864e5}),(function(e){return e.getUTCDate()-1})),tv=ev,nv=ev.range;function rv(e){return lz((function(t){t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCDate(e.getUTCDate()+7*t)}),(function(e,t){return(t-e)/pz}))}var iv=rv(0),ov=rv(1),av=rv(2),cv=rv(3),sv=rv(4),lv=rv(5),uv=rv(6),fv=iv.range,hv=ov.range,dv=av.range,pv=cv.range,zv=sv.range,vv=lv.range,gv=uv.range,mv=lz((function(e){e.setUTCDate(1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCMonth(e.getUTCMonth()+t)}),(function(e,t){return t.getUTCMonth()-e.getUTCMonth()+12*(t.getUTCFullYear()-e.getUTCFullYear())}),(function(e){return e.getUTCMonth()})),yv=mv,bv=mv.range,wv=lz((function(e){e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)}),(function(e,t){e.setUTCFullYear(e.getUTCFullYear()+t)}),(function(e,t){return t.getUTCFullYear()-e.getUTCFullYear()}),(function(e){return e.getUTCFullYear()}));wv.every=function(e){return isFinite(e=Math.floor(e))&&e>0?lz((function(t){t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)}),(function(t,n){t.setUTCFullYear(t.getUTCFullYear()+n*e)})):null};var kv=wv,xv=wv.range;function jv(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function Mv(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function _v(e){return{y:e,m:0,d:1,H:0,M:0,S:0,L:0}}function Cv(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,a=e.shortDays,c=e.months,s=e.shortMonths,l=Nv(i),u=Iv(i),f=Nv(o),h=Iv(o),d=Nv(a),p=Iv(a),z=Nv(c),v=Iv(c),g=Nv(s),m=Iv(s),y={a:function(e){return a[e.getDay()]},A:function(e){return o[e.getDay()]},b:function(e){return s[e.getMonth()]},B:function(e){return c[e.getMonth()]},c:null,d:ag,e:ag,f:fg,H:cg,I:sg,j:lg,L:ug,m:hg,M:dg,p:function(e){return i[+(e.getHours()>=12)]},Q:Rg,s:Bg,S:pg,u:zg,U:vg,V:gg,w:mg,W:yg,x:null,X:null,y:bg,Y:wg,Z:kg,"%":Ig},b={a:function(e){return a[e.getUTCDay()]},A:function(e){return o[e.getUTCDay()]},b:function(e){return s[e.getUTCMonth()]},B:function(e){return c[e.getUTCMonth()]},c:null,d:xg,e:xg,f:qg,H:jg,I:Mg,j:_g,L:Cg,m:Sg,M:Og,p:function(e){return i[+(e.getUTCHours()>=12)]},Q:Rg,s:Bg,S:Tg,u:Eg,U:Ag,V:Hg,w:Lg,W:Dg,x:null,X:null,y:Pg,Y:Vg,Z:Ng,"%":Ig},w={a:function(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=p[r[0].toLowerCase()],n+r[0].length):-1},A:function(e,t,n){var r=f.exec(t.slice(n));return r?(e.w=h[r[0].toLowerCase()],n+r[0].length):-1},b:function(e,t,n){var r=g.exec(t.slice(n));return r?(e.m=m[r[0].toLowerCase()],n+r[0].length):-1},B:function(e,t,n){var r=z.exec(t.slice(n));return r?(e.m=v[r[0].toLowerCase()],n+r[0].length):-1},c:function(e,n,r){return j(e,t,n,r)},d:Xv,e:Xv,f:ng,H:Qv,I:Qv,j:Kv,L:tg,m:$v,M:Jv,p:function(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u[r[0].toLowerCase()],n+r[0].length):-1},Q:ig,s:og,S:eg,u:Bv,U:Fv,V:Uv,w:Rv,W:Wv,x:function(e,t,r){return j(e,n,t,r)},X:function(e,t,n){return j(e,r,t,n)},y:Yv,Y:Gv,Z:Zv,"%":rg};function k(e,t){return function(n){var r,i,o,a=[],c=-1,s=0,l=e.length;for(n instanceof Date||(n=new Date(+n));++c53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=Mv(_v(o.y))).getUTCDay(),r=i>4||0===i?ov.ceil(r):ov(r),r=tv.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=t(_v(o.y))).getDay(),r=i>4||0===i?Sz.ceil(r):Sz(r),r=Mz.offset(r,7*(o.V-1)),o.y=r.getFullYear(),o.m=r.getMonth(),o.d=r.getDate()+(o.w+6)%7)}else("W"in o||"U"in o)&&("w"in o||(o.w="u"in o?o.u%7:"W"in o?1:0),i="Z"in o?Mv(_v(o.y)).getUTCDay():t(_v(o.y)).getDay(),o.m=0,o.d="W"in o?(o.w+6)%7+7*o.W-(i+5)%7:o.w+7*o.U-(i+6)%7);return"Z"in o?(o.H+=o.Z/100|0,o.M+=o.Z%100,Mv(o)):t(o)}}function j(e,t,n,r){for(var i,o,a=0,c=t.length,s=n.length;a=s)return-1;if(37===(i=t.charCodeAt(a++))){if(i=t.charAt(a++),!(o=w[i in Av?t.charAt(a++):i])||(r=o(e,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return(y.x=k(n,y),y.X=k(r,y),y.c=k(t,y),b.x=k(n,b),b.X=k(r,b),b.c=k(t,b),{format:function(e){var t=k(e+="",y);return t.toString=function(){return e},t},parse:function(e){var t=x(e+="",jv);return t.toString=function(){return e},t},utcFormat:function(e){var t=k(e+="",b);return t.toString=function(){return e},t},utcParse:function(e){var t=x(e,Mv);return t.toString=function(){return e},t}})}var qv,Sv,Ov,Tv,Ev,Av={"-":"",_:" ",0:"0"},Hv=/^\s*\d+/,Lv=/^%/,Dv=/[\\^$*+?|[\]().{}]/g;function Pv(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o68?1900:2e3),n+r[0].length):-1}function Zv(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function $v(e,t,n){var r=Hv.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Xv(e,t,n){var r=Hv.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Kv(e,t,n){var r=Hv.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Qv(e,t,n){var r=Hv.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function Jv(e,t,n){var r=Hv.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function eg(e,t,n){var r=Hv.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function tg(e,t,n){var r=Hv.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function ng(e,t,n){var r=Hv.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function rg(e,t,n){var r=Lv.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function ig(e,t,n){var r=Hv.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function og(e,t,n){var r=Hv.exec(t.slice(n));return r?(e.Q=1e3*+r[0],n+r[0].length):-1}function ag(e,t){return Pv(e.getDate(),t,2)}function cg(e,t){return Pv(e.getHours(),t,2)}function sg(e,t){return Pv(e.getHours()%12||12,t,2)}function lg(e,t){return Pv(1+Mz.count(Gz(e),e),t,3)}function ug(e,t){return Pv(e.getMilliseconds(),t,3)}function fg(e,t){return ug(e,t)+"000"}function hg(e,t){return Pv(e.getMonth()+1,t,2)}function dg(e,t){return Pv(e.getMinutes(),t,2)}function pg(e,t){return Pv(e.getSeconds(),t,2)}function zg(e){var t=e.getDay();return 0===t?7:t}function vg(e,t){return Pv(qz.count(Gz(e),e),t,2)}function gg(e,t){var n=e.getDay();return e=n>=4||0===n?Ez(e):Ez.ceil(e),Pv(Ez.count(Gz(e),e)+(4===Gz(e).getDay()),t,2)}function mg(e){return e.getDay()}function yg(e,t){return Pv(Sz.count(Gz(e),e),t,2)}function bg(e,t){return Pv(e.getFullYear()%100,t,2)}function wg(e,t){return Pv(e.getFullYear()%1e4,t,4)}function kg(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Pv(t/60|0,"0",2)+Pv(t%60,"0",2)}function xg(e,t){return Pv(e.getUTCDate(),t,2)}function jg(e,t){return Pv(e.getUTCHours(),t,2)}function Mg(e,t){return Pv(e.getUTCHours()%12||12,t,2)}function _g(e,t){return Pv(1+tv.count(kv(e),e),t,3)}function Cg(e,t){return Pv(e.getUTCMilliseconds(),t,3)}function qg(e,t){return Cg(e,t)+"000"}function Sg(e,t){return Pv(e.getUTCMonth()+1,t,2)}function Og(e,t){return Pv(e.getUTCMinutes(),t,2)}function Tg(e,t){return Pv(e.getUTCSeconds(),t,2)}function Eg(e){var t=e.getUTCDay();return 0===t?7:t}function Ag(e,t){return Pv(iv.count(kv(e),e),t,2)}function Hg(e,t){var n=e.getUTCDay();return e=n>=4||0===n?sv(e):sv.ceil(e),Pv(sv.count(kv(e),e)+(4===kv(e).getUTCDay()),t,2)}function Lg(e){return e.getUTCDay()}function Dg(e,t){return Pv(ov.count(kv(e),e),t,2)}function Pg(e,t){return Pv(e.getUTCFullYear()%100,t,2)}function Vg(e,t){return Pv(e.getUTCFullYear()%1e4,t,4)}function Ng(){return"+0000"}function Ig(){return"%"}function Rg(e){return+e}function Bg(e){return Math.floor(+e/1e3)}function Fg(e){return qv=Cv(e),Sv=qv.format,Ov=qv.parse,Tv=qv.utcFormat,Ev=qv.utcParse,qv}Fg({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Ug=Date.prototype.toISOString?function(e){return e.toISOString()}:Tv("%Y-%m-%dT%H:%M:%S.%LZ");var Wg=+new Date("2000-01-01T00:00:00.000Z")?function(e){var t=new Date(e);return isNaN(t)?null:t}:Ev("%Y-%m-%dT%H:%M:%S.%LZ"),Gg=1e3,Yg=60*Gg,Zg=60*Yg,$g=24*Zg,Xg=7*$g,Kg=30*$g,Qg=365*$g;function Jg(e){return new Date(e)}function em(e){return e instanceof Date?+e:+new Date(+e)}function tm(e,t,n,r,o,a,c,s,l){var u=Bp(Vp,sr),f=u.invert,h=u.domain,d=l(".%L"),p=l(":%S"),z=l("%I:%M"),v=l("%I %p"),g=l("%a %d"),m=l("%b %d"),y=l("%B"),b=l("%Y"),w=[[c,1,Gg],[c,5,5*Gg],[c,15,15*Gg],[c,30,30*Gg],[a,1,Yg],[a,5,5*Yg],[a,15,15*Yg],[a,30,30*Yg],[o,1,Zg],[o,3,3*Zg],[o,6,6*Zg],[o,12,12*Zg],[r,1,$g],[r,2,2*$g],[n,1,Xg],[t,1,Kg],[t,3,3*Kg],[e,1,Qg]];function k(i){return(c(i)1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return hm.h=360*e-100,hm.s=1.5-1.5*t,hm.l=.8-.9*t,hm+""};function pm(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var zm=pm(im("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),vm=pm(im("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),gm=pm(im("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),mm=pm(im("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function ym(e){var t=0,n=1,r=!1;function i(i){var o=(i-t)/(n-t);return e(r?Math.max(0,Math.min(1,o)):o)}return i.domain=function(e){return arguments.length?(t=+e[0],n=+e[1],i):[t,n]},i.clamp=function(e){return arguments.length?(r=!!e,i):r},i.interpolator=function(t){return arguments.length?(e=t,i):e},i.copy=function(){return ym(e).domain([t,n]).clamp(r)},Up(i)}var bm=function(e){return function(){return e}},wm=Math.abs,km=Math.atan2,xm=Math.cos,jm=Math.max,Mm=Math.min,_m=Math.sin,Cm=Math.sqrt,qm=1e-12,Sm=Math.PI,Om=Sm/2,Tm=2*Sm;function Em(e){return e>=1?Om:e<=-1?-Om:Math.asin(e)}function Am(e){return e.innerRadius}function Hm(e){return e.outerRadius}function Lm(e){return e.startAngle}function Dm(e){return e.endAngle}function Pm(e){return e&&e.padAngle}function Vm(e,t,n,r,i,o,a){var c=e-n,s=t-r,l=(a?o:-o)/Cm(c*c+s*s),u=l*s,f=-l*c,h=e+u,d=t+f,p=n+u,z=r+f,v=(h+p)/2,g=(d+z)/2,m=p-h,y=z-d,b=m*m+y*y,w=i-o,k=h*z-p*d,x=(y<0?-1:1)*Cm(jm(0,w*w*b-k*k)),j=(k*y-m*x)/b,M=(-k*m-y*x)/b,_=(k*y+m*x)/b,C=(-k*m+y*x)/b,q=j-v,S=M-g,O=_-v,T=C-g;return q*q+S*S>O*O+T*T&&(j=_,M=C),{cx:j,cy:M,x01:-u,y01:-f,x11:j*(i/w-1),y11:M*(i/w-1)}}var Nm=function(){var e=Am,t=Hm,n=bm(0),r=null,i=Lm,o=Dm,a=Pm,c=null;function s(){var s,l,u,f=+e.apply(this,arguments),h=+t.apply(this,arguments),d=i.apply(this,arguments)-Om,p=o.apply(this,arguments)-Om,z=wm(p-d),v=p>d;if(c||(c=s=ja()),hqm)if(z>Tm-qm)c.moveTo(h*xm(d),h*_m(d)),c.arc(0,0,h,d,p,!v),f>qm&&(c.moveTo(f*xm(p),f*_m(p)),c.arc(0,0,f,p,d,v));else{var g,m,y=d,b=p,w=d,k=p,x=z,j=z,M=a.apply(this,arguments)/2,_=M>qm&&(r?+r.apply(this,arguments):Cm(f*f+h*h)),C=Mm(wm(h-f)/2,+n.apply(this,arguments)),q=C,S=C;if(_>qm){var O=Em(_/f*_m(M)),T=Em(_/h*_m(M));(x-=2*O)>qm?(w+=O*=v?1:-1,k-=O):(x=0,w=k=(d+p)/2),(j-=2*T)>qm?(y+=T*=v?1:-1,b-=T):(j=0,y=b=(d+p)/2)}var E=h*xm(y),A=h*_m(y),H=f*xm(k),L=f*_m(k);if(C>qm){var D=h*xm(b),P=h*_m(b),V=f*xm(w),N=f*_m(w);if(zqm?function(e,t,n,r,i,o,a,c){var s=n-e,l=r-t,u=a-i,f=c-o,h=(u*(t-o)-f*(e-i))/(f*s-u*l);return[e+h*s,t+h*l]}(E,A,V,N,D,P,H,L):[H,L],R=E-I[0],B=A-I[1],F=D-I[0],U=P-I[1],W=1/_m(((u=(R*F+B*U)/(Cm(R*R+B*B)*Cm(F*F+U*U)))>1?0:u<-1?Sm:Math.acos(u))/2),G=Cm(I[0]*I[0]+I[1]*I[1]);q=Mm(C,(f-G)/(W-1)),S=Mm(C,(h-G)/(W+1))}}j>qm?S>qm?(g=Vm(V,N,E,A,h,S,v),m=Vm(D,P,H,L,h,S,v),c.moveTo(g.cx+g.x01,g.cy+g.y01),Sqm&&x>qm?q>qm?(g=Vm(H,L,D,P,f,-q,v),m=Vm(E,A,V,N,f,-q,v),c.lineTo(g.cx+g.x01,g.cy+g.y01),q=u;--f)c.point(v[f],g[f]);c.lineEnd(),c.areaEnd()}z&&(v[l]=+e(h,l,s),g[l]=+n(h,l,s),c.point(t?+t(h,l,s):v[l],r?+r(h,l,s):g[l]))}if(d)return c=null,d+""||null}function l(){return Um().defined(i).curve(a).context(o)}return s.x=function(n){return arguments.length?(e="function"===typeof n?n:bm(+n),t=null,s):e},s.x0=function(t){return arguments.length?(e="function"===typeof t?t:bm(+t),s):e},s.x1=function(e){return arguments.length?(t=null==e?null:"function"===typeof e?e:bm(+e),s):t},s.y=function(e){return arguments.length?(n="function"===typeof e?e:bm(+e),r=null,s):n},s.y0=function(e){return arguments.length?(n="function"===typeof e?e:bm(+e),s):n},s.y1=function(e){return arguments.length?(r=null==e?null:"function"===typeof e?e:bm(+e),s):r},s.lineX0=s.lineY0=function(){return l().x(e).y(n)},s.lineY1=function(){return l().x(e).y(r)},s.lineX1=function(){return l().x(t).y(n)},s.defined=function(e){return arguments.length?(i="function"===typeof e?e:bm(!!e),s):i},s.curve=function(e){return arguments.length?(a=e,null!=o&&(c=a(o)),s):a},s.context=function(e){return arguments.length?(null==e?o=c=null:c=a(o=e),s):o},s},Gm=function(e,t){return te?1:t>=e?0:NaN},Ym=function(e){return e},Zm=function(){var e=Ym,t=Gm,n=null,r=bm(0),i=bm(Tm),o=bm(0);function a(a){var c,s,l,u,f,h=a.length,d=0,p=new Array(h),z=new Array(h),v=+r.apply(this,arguments),g=Math.min(Tm,Math.max(-Tm,i.apply(this,arguments)-v)),m=Math.min(Math.abs(g)/h,o.apply(this,arguments)),y=m*(g<0?-1:1);for(c=0;c0&&(d+=f);for(null!=t?p.sort((function(e,n){return t(z[e],z[n])})):null!=n&&p.sort((function(e,t){return n(a[e],a[t])})),c=0,l=d?(g-h*y)/d:0;c0?f*l:0)+y,z[s]={data:a[s],index:c,value:f,startAngle:v,endAngle:u,padAngle:m};return z}return a.value=function(t){return arguments.length?(e="function"===typeof t?t:bm(+t),a):e},a.sortValues=function(e){return arguments.length?(t=e,n=null,a):t},a.sort=function(e){return arguments.length?(n=e,t=null,a):n},a.startAngle=function(e){return arguments.length?(r="function"===typeof e?e:bm(+e),a):r},a.endAngle=function(e){return arguments.length?(i="function"===typeof e?e:bm(+e),a):i},a.padAngle=function(e){return arguments.length?(o="function"===typeof e?e:bm(+e),a):o},a},$m=Km(Rm);function Xm(e){this._curve=e}function Km(e){function t(t){return new Xm(e(t))}return t._curve=e,t}function Qm(e){var t=e.curve;return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e.curve=function(e){return arguments.length?t(Km(e)):t()._curve},e}Xm.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(e,t){this._curve.point(t*Math.sin(e),t*-Math.cos(e))}};var Jm=function(){return Qm(Um().curve($m))},ey=function(){var e=Wm().curve($m),t=e.curve,n=e.lineX0,r=e.lineX1,i=e.lineY0,o=e.lineY1;return e.angle=e.x,delete e.x,e.startAngle=e.x0,delete e.x0,e.endAngle=e.x1,delete e.x1,e.radius=e.y,delete e.y,e.innerRadius=e.y0,delete e.y0,e.outerRadius=e.y1,delete e.y1,e.lineStartAngle=function(){return Qm(n())},delete e.lineX0,e.lineEndAngle=function(){return Qm(r())},delete e.lineX1,e.lineInnerRadius=function(){return Qm(i())},delete e.lineY0,e.lineOuterRadius=function(){return Qm(o())},delete e.lineY1,e.curve=function(e){return arguments.length?t(Km(e)):t()._curve},e},ty=function(e,t){return[(t=+t)*Math.cos(e-=Math.PI/2),t*Math.sin(e)]},ny=Array.prototype.slice;function ry(e){return e.source}function iy(e){return e.target}function oy(e){var t=ry,n=iy,r=Bm,i=Fm,o=null;function a(){var a,c=ny.call(arguments),s=t.apply(this,c),l=n.apply(this,c);if(o||(o=a=ja()),e(o,+r.apply(this,(c[0]=s,c)),+i.apply(this,c),+r.apply(this,(c[0]=l,c)),+i.apply(this,c)),a)return o=null,a+""||null}return a.source=function(e){return arguments.length?(t=e,a):t},a.target=function(e){return arguments.length?(n=e,a):n},a.x=function(e){return arguments.length?(r="function"===typeof e?e:bm(+e),a):r},a.y=function(e){return arguments.length?(i="function"===typeof e?e:bm(+e),a):i},a.context=function(e){return arguments.length?(o=null==e?null:e,a):o},a}function ay(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t=(t+r)/2,n,t,i,r,i)}function cy(e,t,n,r,i){e.moveTo(t,n),e.bezierCurveTo(t,n=(n+i)/2,r,n,r,i)}function sy(e,t,n,r,i){var o=ty(t,n),a=ty(t,n=(n+i)/2),c=ty(r,n),s=ty(r,i);e.moveTo(o[0],o[1]),e.bezierCurveTo(a[0],a[1],c[0],c[1],s[0],s[1])}function ly(){return oy(ay)}function uy(){return oy(cy)}function fy(){var e=oy(sy);return e.angle=e.x,delete e.x,e.radius=e.y,delete e.y,e}var hy={draw:function(e,t){var n=Math.sqrt(t/Sm);e.moveTo(n,0),e.arc(0,0,n,0,Tm)}},dy={draw:function(e,t){var n=Math.sqrt(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},py=Math.sqrt(1/3),zy=2*py,vy={draw:function(e,t){var n=Math.sqrt(t/zy),r=n*py;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},gy=Math.sin(Sm/10)/Math.sin(7*Sm/10),my=Math.sin(Tm/10)*gy,yy=-Math.cos(Tm/10)*gy,by={draw:function(e,t){var n=Math.sqrt(.8908130915292852*t),r=my*n,i=yy*n;e.moveTo(0,-n),e.lineTo(r,i);for(var o=1;o<5;++o){var a=Tm*o/5,c=Math.cos(a),s=Math.sin(a);e.lineTo(s*n,-c*n),e.lineTo(c*r-s*i,s*r+c*i)}e.closePath()}},wy={draw:function(e,t){var n=Math.sqrt(t),r=-n/2;e.rect(r,r,n,n)}},ky=Math.sqrt(3),xy={draw:function(e,t){var n=-Math.sqrt(t/(3*ky));e.moveTo(0,2*n),e.lineTo(-ky*n,-n),e.lineTo(ky*n,-n),e.closePath()}},jy=Math.sqrt(3)/2,My=1/Math.sqrt(12),_y=3*(My/2+1),Cy={draw:function(e,t){var n=Math.sqrt(t/_y),r=n/2,i=n*My,o=r,a=n*My+n,c=-o,s=a;e.moveTo(r,i),e.lineTo(o,a),e.lineTo(c,s),e.lineTo(-.5*r-jy*i,jy*r+-.5*i),e.lineTo(-.5*o-jy*a,jy*o+-.5*a),e.lineTo(-.5*c-jy*s,jy*c+-.5*s),e.lineTo(-.5*r+jy*i,-.5*i-jy*r),e.lineTo(-.5*o+jy*a,-.5*a-jy*o),e.lineTo(-.5*c+jy*s,-.5*s-jy*c),e.closePath()}},qy=[hy,dy,vy,wy,by,xy,Cy],Sy=function(){var e=bm(hy),t=bm(64),n=null;function r(){var r;if(n||(n=r=ja()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),r)return n=null,r+""||null}return r.type=function(t){return arguments.length?(e="function"===typeof t?t:bm(t),r):e},r.size=function(e){return arguments.length?(t="function"===typeof e?e:bm(+e),r):t},r.context=function(e){return arguments.length?(n=null==e?null:e,r):n},r},Oy=function(){};function Ty(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Ey(e){this._context=e}Ey.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Ty(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ty(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var Ay=function(e){return new Ey(e)};function Hy(e){this._context=e}Hy.prototype={areaStart:Oy,areaEnd:Oy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Ty(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var Ly=function(e){return new Hy(e)};function Dy(e){this._context=e}Dy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ty(this,e,t)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};var Py=function(e){return new Dy(e)};function Vy(e,t){this._basis=new Ey(e),this._beta=t}Vy.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r,i=e[0],o=t[0],a=e[n]-i,c=t[n]-o,s=-1;++s<=n;)r=s/n,this._basis.point(this._beta*e[s]+(1-this._beta)*(i+r*a),this._beta*t[s]+(1-this._beta)*(o+r*c));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var Ny=function e(t){function n(e){return 1===t?new Ey(e):new Vy(e,t)}return n.beta=function(t){return e(+t)},n}(.85);function Iy(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function Ry(e,t){this._context=e,this._k=(1-t)/6}Ry.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Iy(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:Iy(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var By=function e(t){function n(e){return new Ry(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Fy(e,t){this._context=e,this._k=(1-t)/6}Fy.prototype={areaStart:Oy,areaEnd:Oy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Iy(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Uy=function e(t){function n(e){return new Fy(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Wy(e,t){this._context=e,this._k=(1-t)/6}Wy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Iy(this,e,t)}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Gy=function e(t){function n(e){return new Wy(e,t)}return n.tension=function(t){return e(+t)},n}(0);function Yy(e,t,n){var r=e._x1,i=e._y1,o=e._x2,a=e._y2;if(e._l01_a>qm){var c=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,s=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*c-e._x0*e._l12_2a+e._x2*e._l01_2a)/s,i=(i*c-e._y0*e._l12_2a+e._y2*e._l01_2a)/s}if(e._l23_a>qm){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,a=(a*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,a,e._x2,e._y2)}function Zy(e,t){this._context=e,this._alpha=t}Zy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Yy(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var $y=function e(t){function n(e){return t?new Zy(e,t):new Ry(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Xy(e,t){this._context=e,this._alpha=t}Xy.prototype={areaStart:Oy,areaEnd:Oy,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Yy(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Ky=function e(t){function n(e){return t?new Xy(e,t):new Fy(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function Qy(e,t){this._context=e,this._alpha=t}Qy.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Yy(this,e,t)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var Jy=function e(t){function n(e){return t?new Qy(e,t):new Wy(e,0)}return n.alpha=function(t){return e(+t)},n}(.5);function eb(e){this._context=e}eb.prototype={areaStart:Oy,areaEnd:Oy,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};var tb=function(e){return new eb(e)};function nb(e){return e<0?-1:1}function rb(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),a=(n-e._y1)/(i||r<0&&-0),c=(o*i+a*r)/(r+i);return(nb(o)+nb(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(c))||0}function ib(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function ob(e,t,n){var r=e._x0,i=e._y0,o=e._x1,a=e._y1,c=(o-r)/3;e._context.bezierCurveTo(r+c,i+c*t,o-c,a-c*n,o,a)}function ab(e){this._context=e}function cb(e){this._context=new sb(e)}function sb(e){this._context=e}function lb(e){return new ab(e)}function ub(e){return new cb(e)}function fb(e){this._context=e}function hb(e){var t,n,r=e.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=e[0]+2*e[1],t=1;t=0;--t)i[t]=(a[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}}this._x=e,this._y=t}};var zb=function(e){return new pb(e,.5)};function vb(e){return new pb(e,0)}function gb(e){return new pb(e,1)}var mb=function(e,t){if((i=e.length)>1)for(var n,r,i,o=1,a=e[t[0]],c=a.length;o=0;)n[t]=t;return n};function bb(e,t){return e[t]}var wb=function(){var e=bm([]),t=yb,n=mb,r=bb;function i(i){var o,a,c=e.apply(this,arguments),s=i.length,l=c.length,u=new Array(l);for(o=0;o0){for(var n,r,i,o=0,a=e[0].length;o1)for(var n,r,i,o,a,c,s=0,l=e[t[0]].length;s=0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):r[0]=o},jb=function(e,t){if((n=e.length)>0){for(var n,r=0,i=e[t[0]],o=i.length;r0&&(r=(n=e[t[0]]).length)>0){for(var n,r,i,o=0,a=1;a0)){if(o/=h,h<0){if(o0){if(o>f)return;o>u&&(u=o)}if(o=r-s,h||!(o<0)){if(o/=h,h<0){if(o>f)return;o>u&&(u=o)}else if(h>0){if(o0)){if(o/=d,d<0){if(o0){if(o>f)return;o>u&&(u=o)}if(o=i-l,d||!(o<0)){if(o/=d,d<0){if(o>f)return;o>u&&(u=o)}else if(d>0){if(o0||f<1)||(u>0&&(e[0]=[s+u*h,l+u*d]),f<1&&(e[1]=[s+f*h,l+f*d]),!0)}}}}}function Ub(e,t,n,r,i){var o=e[1];if(o)return!0;var a,c,s=e[0],l=e.left,u=e.right,f=l[0],h=l[1],d=u[0],p=u[1],z=(f+d)/2,v=(h+p)/2;if(p===h){if(z=r)return;if(f>d){if(s){if(s[1]>=i)return}else s=[z,n];o=[z,i]}else{if(s){if(s[1]1)if(f>d){if(s){if(s[1]>=i)return}else s=[(n-c)/a,n];o=[(i-c)/a,i]}else{if(s){if(s[1]=r)return}else s=[t,a*t+c];o=[r,a*r+c]}else{if(s){if(s[0]=-hw)){var d=s*s+l*l,p=u*u+f*f,z=(f*d-l*p)/h,v=(s*p-u*d)/h,g=$b.pop()||new Xb;g.arc=e,g.site=i,g.x=z+a,g.y=(g.cy=v+c)+Math.sqrt(z*z+v*v),e.circle=g;for(var m=null,y=lw._;y;)if(g.yfw)c=c.L;else{if(!((i=o-aw(c,a))>fw)){r>-fw?(t=c.P,n=c):i>-fw?(t=c,n=c.N):t=n=c;break}if(!c.R){t=c;break}c=c.R}!function(e){sw[e.index]={site:e,halfedges:[]}}(e);var s=tw(e);if(cw.insert(t,s),t||n){if(t===n)return Qb(t),n=tw(t.site),cw.insert(s,n),s.edge=n.edge=Ib(t.site,s.site),Kb(t),void Kb(n);if(n){Qb(t),Qb(n);var l=t.site,u=l[0],f=l[1],h=e[0]-u,d=e[1]-f,p=n.site,z=p[0]-u,v=p[1]-f,g=2*(h*v-d*z),m=h*h+d*d,y=z*z+v*v,b=[(v*m-d*y)/g+u,(h*y-z*m)/g+f];Bb(n.edge,l,p,b),s.edge=Ib(l,e,null,b),n.edge=Ib(e,p,null,b),Kb(t),Kb(n)}else s.edge=Ib(t.site,s.site)}}function ow(e,t){var n=e.site,r=n[0],i=n[1],o=i-t;if(!o)return r;var a=e.P;if(!a)return-1/0;var c=(n=a.site)[0],s=n[1],l=s-t;if(!l)return c;var u=c-r,f=1/o-1/l,h=u/l;return f?(-h+Math.sqrt(h*h-2*f*(u*u/(-2*l)-s+l/2+i-o/2)))/f+r:(r+c)/2}function aw(e,t){var n=e.N;if(n)return ow(n,t);var r=e.site;return r[1]===t?r[0]:1/0}var cw,sw,lw,uw,fw=1e-6,hw=1e-12;function dw(e,t){return t[1]-e[1]||t[0]-e[0]}function pw(e,t){var n,r,i,o=e.sort(dw).pop();for(uw=[],sw=new Array(e.length),cw=new Nb,lw=new Nb;;)if(i=Zb,o&&(!i||o[1]fw||Math.abs(i[0][1]-i[1][1])>fw)||delete uw[o]}(a,c,s,l),function(e,t,n,r){var i,o,a,c,s,l,u,f,h,d,p,z,v=sw.length,g=!0;for(i=0;ifw||Math.abs(z-h)>fw)&&(s.splice(c,0,uw.push(Rb(a,d,Math.abs(p-e)fw?[e,Math.abs(f-e)fw?[Math.abs(h-r)fw?[n,Math.abs(f-n)fw?[Math.abs(h-t)=c)return null;var s=e-i.site[0],l=t-i.site[1],u=s*s+l*l;do{i=o.cells[r=a],a=null,i.halfedges.forEach((function(n){var r=o.edges[n],c=r.left;if(c!==i.site&&c||(c=r.right)){var s=e-c[0],l=t-c[1],f=s*s+l*l;fr?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}var Sw=function(){var e,t,n=xw,r=jw,i=qw,o=_w,a=Cw,c=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,u=Cr,f=[],h=ze("start","zoom","end"),d=500,p=150,z=0;function v(e){e.property("__zoom",Mw).on("wheel.zoom",x).on("mousedown.zoom",j).on("dblclick.zoom",M).filter(a).on("touchstart.zoom",_).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",q).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new mw(t,e.x,e.y)}function m(e,t,n){var r=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return r===e.x&&i===e.y?e:new mw(e.k,r,i)}function y(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,t,n){e.on("start.zoom",(function(){w(this,arguments).start()})).on("interrupt.zoom end.zoom",(function(){w(this,arguments).end()})).tween("zoom",(function(){var e=this,i=arguments,o=w(e,i),a=r.apply(e,i),c=n||y(a),s=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),l=e.__zoom,f="function"===typeof t?t.apply(e,i):t,h=u(l.invert(c).concat(s/l.k),f.invert(c).concat(s/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=s/t[2];e=new mw(n,c[0]-t[0]*n,c[1]-t[1]*n)}o.zoom(null,e)}}))}function w(e,t){for(var n,r=0,i=f.length;rz}e.zoom("mouse",i(m(e.that.__zoom,e.mouse[0]=Ne(e.that),e.mouse[1]),e.extent,s))}),!0).on("mouseup.zoom",(function(){r.on("mousemove.zoom mouseup.zoom",null),Bt(Oe.view,e.moved),kw(),e.end()}),!0),o=Ne(this),a=Oe.clientX,c=Oe.clientY;Rt(Oe.view),ww(),e.mouse=[o,this.__zoom.invert(o)],yi(this),e.start()}}function M(){if(n.apply(this,arguments)){var e=this.__zoom,t=Ne(this),o=e.invert(t),a=e.k*(Oe.shiftKey?.5:2),c=i(m(g(e,a),t,o),r.apply(this,arguments),s);kw(),l>0?Lt(this).transition().duration(l).call(b,c,t):Lt(this).call(v.transform,c)}}function _(){if(n.apply(this,arguments)){var t,r,i,o,a=w(this,arguments),c=Oe.changedTouches,s=c.length;for(ww(),r=0;r=0}n.d(t,"a",(function(){return i}))},function(e,t,n){"use strict";var r=n(30);function i(e){return e}var o=Object(r.a)(i);t.a=o},,function(e,t,n){"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=(0,((r=n(223))&&r.__esModule?r:{default:r}).default)("Batch",(function(){for(var e=arguments.length,t=new Array(e),n=0;n=0&&n.splice(r,1),e.className=n.join(" ")}(e,t)},t.list=function(e){return e.classList?Array.prototype.slice.apply(e.classList):e.className.split(" ")}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(204)),o=r(n(246)),a=function(){i.default.call(this)};(a.prototype=new i.default).extractSeries=function(e,t,n){},a.prototype.rollingAverage=function(e,t,n){},a.prototype.onPointsCreated_=function(e,t){for(var n=0;nr&&(s=r),lo)&&(o=l),(null===i||s0&&t-1 in e)}x.fn=x.prototype={jquery:"3.6.0",constructor:x,length:0,toArray:function(){return c.call(this)},get:function(e){return null==e?c.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=x.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return x.each(this,e)},map:function(e){return this.pushStack(x.map(this,(function(t,n){return e.call(t,n,t)})))},slice:function(){return this.pushStack(c.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(x.grep(this,(function(e,t){return(t+1)%2})))},odd:function(){return this.pushStack(x.grep(this,(function(e,t){return t%2})))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n+~]|"+P+")"+P+"*"),W=new RegExp(P+"|>"),G=new RegExp(I),Y=new RegExp("^"+V+"$"),Z={ID:new RegExp("^#("+V+")"),CLASS:new RegExp("^\\.("+V+")"),TAG:new RegExp("^("+V+"|[*])"),ATTR:new RegExp("^"+N),PSEUDO:new RegExp("^"+I),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+P+"*(even|odd|(([+-]|)(\\d*)n|)"+P+"*(?:([+-]|)"+P+"*(\\d+)|))"+P+"*\\)|)","i"),bool:new RegExp("^(?:"+D+")$","i"),needsContext:new RegExp("^"+P+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+P+"*((?:-\\d)?\\d*)"+P+"*\\)|)(?=[^-]|$)","i")},$=/HTML$/i,X=/^(?:input|select|textarea|button)$/i,K=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+P+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){h()},ae=be((function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()}),{dir:"parentNode",next:"legend"});try{A.apply(O=H.call(w.childNodes),w.childNodes),O[w.childNodes.length].nodeType}catch(Me){A={apply:O.length?function(e,t){E.apply(e,H.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}function ce(e,t,r,i){var o,c,l,u,f,p,g,m=t&&t.ownerDocument,w=t?t.nodeType:9;if(r=r||[],"string"!==typeof e||!e||1!==w&&9!==w&&11!==w)return r;if(!i&&(h(t),t=t||d,z)){if(11!==w&&(f=J.exec(e)))if(o=f[1]){if(9===w){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&y(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return A.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return A.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!C[e+" "]&&(!v||!v.test(e))&&(1!==w||"object"!==t.nodeName.toLowerCase())){if(g=e,m=t,1===w&&(W.test(e)||U.test(e))){for((m=ee.test(e)&&ge(t.parentNode)||t)===t&&n.scope||((u=t.getAttribute("id"))?u=u.replace(re,ie):t.setAttribute("id",u=b)),c=(p=a(e)).length;c--;)p[c]=(u?"#"+u:":scope")+" "+ye(p[c]);g=p.join(",")}try{return A.apply(r,m.querySelectorAll(g)),r}catch(k){C(e,!0)}finally{u===b&&t.removeAttribute("id")}}}return s(e.replace(B,"$1"),t,r,i)}function se(){var e=[];return function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}}function le(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(Me){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){for(var n=e.split("|"),i=n.length;i--;)r.attrHandle[n[i]]=t}function he(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function de(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function ze(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ae(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function ve(e){return le((function(t){return t=+t,le((function(n,r){for(var i,o=e([],n.length,t),a=o.length;a--;)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))}))}))}function ge(e){return e&&"undefined"!==typeof e.getElementsByTagName&&e}for(t in n=ce.support={},o=ce.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!$.test(t||n&&n.nodeName||"HTML")},h=ce.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!=d&&9===a.nodeType&&a.documentElement?(p=(d=a).documentElement,z=!o(d),w!=d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",oe,!1):i.attachEvent&&i.attachEvent("onunload",oe)),n.scope=ue((function(e){return p.appendChild(e).appendChild(d.createElement("div")),"undefined"!==typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length})),n.attributes=ue((function(e){return e.className="i",!e.getAttribute("className")})),n.getElementsByTagName=ue((function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length})),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue((function(e){return p.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length})),n.getById?(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!==typeof t.getElementById&&z){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(te,ne);return function(e){var n="undefined"!==typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!==typeof t.getElementById&&z){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];for(i=t.getElementsByName(e),r=0;o=i[r++];)if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!==typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){for(;n=o[i++];)1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!==typeof t.getElementsByClassName&&z)return t.getElementsByClassName(e)},g=[],v=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue((function(e){var t;p.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+P+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+P+"*(?:value|"+D+")"),e.querySelectorAll("[id~="+b+"-]").length||v.push("~="),(t=d.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+P+"*name"+P+"*="+P+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")})),ue((function(e){e.innerHTML="";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+P+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),p.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")}))),(n.matchesSelector=Q.test(m=p.matches||p.webkitMatchesSelector||p.mozMatchesSelector||p.oMatchesSelector||p.msMatchesSelector))&&ue((function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),g.push("!=",I)})),v=v.length&&new RegExp(v.join("|")),g=g.length&&new RegExp(g.join("|")),t=Q.test(p.compareDocumentPosition),y=t||Q.test(p.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},q=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e==d||e.ownerDocument==w&&y(w,e)?-1:t==d||t.ownerDocument==w&&y(w,t)?1:u?L(u,e)-L(u,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],c=[t];if(!i||!o)return e==d?-1:t==d?1:i?-1:o?1:u?L(u,e)-L(u,t):0;if(i===o)return he(e,t);for(n=e;n=n.parentNode;)a.unshift(n);for(n=t;n=n.parentNode;)c.unshift(n);for(;a[r]===c[r];)r++;return r?he(a[r],c[r]):a[r]==w?-1:c[r]==w?1:0},d):d},ce.matches=function(e,t){return ce(e,null,null,t)},ce.matchesSelector=function(e,t){if(h(e),n.matchesSelector&&z&&!C[t+" "]&&(!g||!g.test(t))&&(!v||!v.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(Me){C(t,!0)}return ce(t,d,null,[e]).length>0},ce.contains=function(e,t){return(e.ownerDocument||e)!=d&&h(e),y(e,t)},ce.attr=function(e,t){(e.ownerDocument||e)!=d&&h(e);var i=r.attrHandle[t.toLowerCase()],o=i&&S.call(r.attrHandle,t.toLowerCase())?i(e,t,!z):void 0;return void 0!==o?o:n.attributes||!z?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},ce.escape=function(e){return(e+"").replace(re,ie)},ce.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},ce.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,u=!n.sortStable&&e.slice(0),e.sort(q),f){for(;t=e[o++];)t===e[o]&&(i=r.push(o));for(;i--;)e.splice(r[i],1)}return u=null,e},i=ce.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"===typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=i(t);return n},(r=ce.selectors={cacheLength:50,createPseudo:le,match:Z,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||ce.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&ce.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return Z.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&G.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=j[e+" "];return t||(t=new RegExp("(^|"+P+")"+e+"("+P+"|$)"))&&j(e,(function(e){return t.test("string"===typeof e.className&&e.className||"undefined"!==typeof e.getAttribute&&e.getAttribute("class")||"")}))},ATTR:function(e,t,n){return function(r){var i=ce.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace(R," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),c="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,s){var l,u,f,h,d,p,z=o!==a?"nextSibling":"previousSibling",v=t.parentNode,g=c&&t.nodeName.toLowerCase(),m=!s&&!c,y=!1;if(v){if(o){for(;z;){for(h=t;h=h[z];)if(c?h.nodeName.toLowerCase()===g:1===h.nodeType)return!1;p=z="only"===e&&!p&&"nextSibling"}return!0}if(p=[a?v.firstChild:v.lastChild],a&&m){for(y=(d=(l=(u=(f=(h=v)[b]||(h[b]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]||[])[0]===k&&l[1])&&l[2],h=d&&v.childNodes[d];h=++d&&h&&h[z]||(y=d=0)||p.pop();)if(1===h.nodeType&&++y&&h===t){u[e]=[k,d,y];break}}else if(m&&(y=d=(l=(u=(f=(h=t)[b]||(h[b]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]||[])[0]===k&&l[1]),!1===y)for(;(h=++d&&h&&h[z]||(y=d=0)||p.pop())&&((c?h.nodeName.toLowerCase()!==g:1!==h.nodeType)||!++y||(m&&((u=(f=h[b]||(h[b]={}))[h.uniqueID]||(f[h.uniqueID]={}))[e]=[k,y]),h!==t)););return(y-=i)===r||y%r===0&&y/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||ce.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?le((function(e,n){for(var r,o=i(e,t),a=o.length;a--;)e[r=L(e,o[a])]=!(n[r]=o[a])})):function(e){return i(e,0,n)}):i}},pseudos:{not:le((function(e){var t=[],n=[],r=c(e.replace(B,"$1"));return r[b]?le((function(e,t,n,i){for(var o,a=r(e,null,i,[]),c=e.length;c--;)(o=a[c])&&(e[c]=!(t[c]=o))})):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}})),has:le((function(e){return function(t){return ce(e,t).length>0}})),contains:le((function(e){return e=e.replace(te,ne),function(t){return(t.textContent||i(t)).indexOf(e)>-1}})),lang:le((function(e){return Y.test(e||"")||ce.error("unsupported lang: "+e),e=e.replace(te,ne).toLowerCase(),function(t){var n;do{if(n=z?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}})),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===p},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ze(!1),disabled:ze(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return K.test(e.nodeName)},input:function(e){return X.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve((function(){return[0]})),last:ve((function(e,t){return[t-1]})),eq:ve((function(e,t,n){return[n<0?n+t:n]})),even:ve((function(e,t){for(var n=0;nt?t:n;--r>=0;)e.push(r);return e})),gt:ve((function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){for(var i=e.length;i--;)if(!e[i](t,n,r))return!1;return!0}:e[0]}function ke(e,t,n,r,i){for(var o,a=[],c=0,s=e.length,l=null!=t;c-1&&(o[l]=!(a[l]=f))}}else g=ke(g===a?g.splice(p,g.length):g),i?i(null,a,g,s):A.apply(a,g)}))}function je(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],c=a||r.relative[" "],s=a?1:0,u=be((function(e){return e===t}),c,!0),f=be((function(e){return L(t,e)>-1}),c,!0),h=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?u(e,n,r):f(e,n,r));return t=null,i}];s1&&we(h),s>1&&ye(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(B,"$1"),n,s0,i=e.length>0,o=function(o,a,c,s,u){var f,p,v,g=0,m="0",y=o&&[],b=[],w=l,x=o||i&&r.find.TAG("*",u),j=k+=null==w?1:Math.random()||.1,M=x.length;for(u&&(l=a==d||a||u);m!==M&&null!=(f=x[m]);m++){if(i&&f){for(p=0,a||f.ownerDocument==d||(h(f),c=!z);v=e[p++];)if(v(f,a||d,c)){s.push(f);break}u&&(k=j)}n&&((f=!v&&f)&&g--,o&&y.push(f))}if(g+=m,n&&m!==g){for(p=0;v=t[p++];)v(y,b,a,c);if(o){if(g>0)for(;m--;)y[m]||b[m]||(b[m]=T.call(s));b=ke(b)}A.apply(s,b),u&&!o&&b.length>0&&g+t.length>1&&ce.uniqueSort(s)}return u&&(k=j,l=w),y};return n?le(o):o}(o,i))).selector=e}return c},s=ce.select=function(e,t,n,i){var o,s,l,u,f,h="function"===typeof e&&e,d=!i&&a(e=h.selector||e);if(n=n||[],1===d.length){if((s=d[0]=d[0].slice(0)).length>2&&"ID"===(l=s[0]).type&&9===t.nodeType&&z&&r.relative[s[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(te,ne),t)||[])[0]))return n;h&&(t=t.parentNode),e=e.slice(s.shift().value.length)}for(o=Z.needsContext.test(e)?0:s.length;o--&&(l=s[o],!r.relative[u=l.type]);)if((f=r.find[u])&&(i=f(l.matches[0].replace(te,ne),ee.test(s[0].type)&&ge(t.parentNode)||t))){if(s.splice(o,1),!(e=i.length&&ye(s)))return A.apply(n,i),n;break}}return(h||c(e,d))(i,t,!z,n,!t||ee.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(q).join("")===b,n.detectDuplicates=!!f,h(),n.sortDetached=ue((function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))})),ue((function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")}))||fe("type|href|height|width",(function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)})),n.attributes&&ue((function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")}))||fe("value",(function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue})),ue((function(e){return null==e.getAttribute("disabled")}))||fe(D,(function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null})),ce}(n);x.find=M,x.expr=M.selectors,x.expr[":"]=x.expr.pseudos,x.uniqueSort=x.unique=M.uniqueSort,x.text=M.getText,x.isXMLDoc=M.isXML,x.contains=M.contains,x.escapeSelector=M.escape;var _=function(e,t,n){for(var r=[],i=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(i&&x(e).is(n))break;r.push(e)}return r},C=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},q=x.expr.match.needsContext;function S(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var O=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function T(e,t,n){return g(t)?x.grep(e,(function(e,r){return!!t.call(e,r,e)!==n})):t.nodeType?x.grep(e,(function(e){return e===t!==n})):"string"!==typeof t?x.grep(e,(function(e){return u.call(t,e)>-1!==n})):x.filter(t,e,n)}x.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?x.find.matchesSelector(r,e)?[r]:[]:x.find.matches(e,x.grep(t,(function(e){return 1===e.nodeType})))},x.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!==typeof e)return this.pushStack(x(e).filter((function(){for(t=0;t1?x.uniqueSort(n):n},filter:function(e){return this.pushStack(T(this,e||[],!1))},not:function(e){return this.pushStack(T(this,e||[],!0))},is:function(e){return!!T(this,"string"===typeof e&&q.test(e)?x(e):e||[],!1).length}});var E,A=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(x.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||E,"string"===typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:A.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof x?t[0]:t,x.merge(this,x.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:y,!0)),O.test(r[1])&&x.isPlainObject(t))for(r in t)g(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=y.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(x):x.makeArray(e,this)}).prototype=x.fn,E=x(y);var H=/^(?:parents|prev(?:Until|All))/,L={children:!0,contents:!0,next:!0,prev:!0};function D(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}x.fn.extend({has:function(e){var t=x(e,this),n=t.length;return this.filter((function(){for(var e=0;e-1:1===n.nodeType&&x.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?x.uniqueSort(o):o)},index:function(e){return e?"string"===typeof e?u.call(x(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(x.uniqueSort(x.merge(this.get(),x(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),x.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return _(e,"parentNode")},parentsUntil:function(e,t,n){return _(e,"parentNode",n)},next:function(e){return D(e,"nextSibling")},prev:function(e){return D(e,"previousSibling")},nextAll:function(e){return _(e,"nextSibling")},prevAll:function(e){return _(e,"previousSibling")},nextUntil:function(e,t,n){return _(e,"nextSibling",n)},prevUntil:function(e,t,n){return _(e,"previousSibling",n)},siblings:function(e){return C((e.parentNode||{}).firstChild,e)},children:function(e){return C(e.firstChild)},contents:function(e){return null!=e.contentDocument&&a(e.contentDocument)?e.contentDocument:(S(e,"template")&&(e=e.content||e),x.merge([],e.childNodes))}},(function(e,t){x.fn[e]=function(n,r){var i=x.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"===typeof r&&(i=x.filter(r,i)),this.length>1&&(L[e]||x.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}}));var P=/[^\x20\t\r\n\f]+/g;function V(e){return e}function N(e){throw e}function I(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}x.Callbacks=function(e){e="string"===typeof e?function(e){var t={};return x.each(e.match(P)||[],(function(e,n){t[n]=!0})),t}(e):x.extend({},e);var t,n,r,i,o=[],a=[],c=-1,s=function(){for(i=i||e.once,r=t=!0;a.length;c=-1)for(n=a.shift();++c-1;)o.splice(n,1),n<=c&&c--})),this},has:function(e){return e?x.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||s()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},x.extend({Deferred:function(e){var t=[["notify","progress",x.Callbacks("memory"),x.Callbacks("memory"),2],["resolve","done",x.Callbacks("once memory"),x.Callbacks("once memory"),0,"resolved"],["reject","fail",x.Callbacks("once memory"),x.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},catch:function(e){return i.then(null,e)},pipe:function(){var e=arguments;return x.Deferred((function(n){x.each(t,(function(t,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]]((function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,i?[e]:arguments)}))})),e=null})).promise()},then:function(e,r,i){var o=0;function a(e,t,r,i){return function(){var c=this,s=arguments,l=function(){var n,l;if(!(e=o&&(r!==N&&(c=void 0,s=[n]),t.rejectWith(c,s))}};e?u():(x.Deferred.getStackHook&&(u.stackTrace=x.Deferred.getStackHook()),n.setTimeout(u))}}return x.Deferred((function(n){t[0][3].add(a(0,n,g(i)?i:V,n.notifyWith)),t[1][3].add(a(0,n,g(e)?e:V)),t[2][3].add(a(0,n,g(r)?r:N))})).promise()},promise:function(e){return null!=e?x.extend(e,i):i}},o={};return x.each(t,(function(e,n){var a=n[2],c=n[5];i[n[1]]=a.add,c&&a.add((function(){r=c}),t[3-e][2].disable,t[3-e][3].disable,t[0][2].lock,t[0][3].lock),a.add(n[3].fire),o[n[0]]=function(){return o[n[0]+"With"](this===o?void 0:this,arguments),this},o[n[0]+"With"]=a.fireWith})),i.promise(o),e&&e.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=c.call(arguments),o=x.Deferred(),a=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?c.call(arguments):n,--t||o.resolveWith(r,i)}};if(t<=1&&(I(e,o.done(a(n)).resolve,o.reject,!t),"pending"===o.state()||g(i[n]&&i[n].then)))return o.then();for(;n--;)I(i[n],a(n),o.reject);return o.promise()}});var R=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;x.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&R.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},x.readyException=function(e){n.setTimeout((function(){throw e}))};var B=x.Deferred();function F(){y.removeEventListener("DOMContentLoaded",F),n.removeEventListener("load",F),x.ready()}x.fn.ready=function(e){return B.then(e).catch((function(e){x.readyException(e)})),this},x.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--x.readyWait:x.isReady)||(x.isReady=!0,!0!==e&&--x.readyWait>0||B.resolveWith(y,[x]))}}),x.ready.then=B.then,"complete"===y.readyState||"loading"!==y.readyState&&!y.documentElement.doScroll?n.setTimeout(x.ready):(y.addEventListener("DOMContentLoaded",F),n.addEventListener("load",F));var U=function e(t,n,r,i,o,a,c){var s=0,l=t.length,u=null==r;if("object"===k(r))for(s in o=!0,r)e(t,n,s,r[s],!0,a,c);else if(void 0!==i&&(o=!0,g(i)||(c=!0),u&&(c?(n.call(t,i),n=null):(u=n,n=function(e,t,n){return u.call(x(e),n)})),n))for(;s1,null,!0)},removeData:function(e){return this.each((function(){Q.remove(this,e)}))}}),x.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=K.get(e,t),n&&(!r||Array.isArray(n)?r=K.access(e,t,x.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=x.queue(e,t),r=n.length,i=n.shift(),o=x._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,(function(){x.dequeue(e,t)}),o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return K.get(e,n)||K.access(e,n,{empty:x.Callbacks("once memory").add((function(){K.remove(e,[t+"queue",n])}))})}}),x.fn.extend({queue:function(e,t){var n=2;return"string"!==typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]*)/i,ze=/^$|^module$|\/(?:java|ecma)script/i;!function(){var e=y.createDocumentFragment().appendChild(y.createElement("div")),t=y.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),v.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",v.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue,e.innerHTML="",v.option=!!e.lastChild}();var ve={thead:[1,"","
    "],col:[2,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],_default:[0,"",""]};function ge(e,t){var n;return n="undefined"!==typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!==typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&S(e,t)?x.merge([e],n):n}function me(e,t){for(var n=0,r=e.length;n",""]);var ye=/<|&#?\w+;/;function be(e,t,n,r,i){for(var o,a,c,s,l,u,f=t.createDocumentFragment(),h=[],d=0,p=e.length;d-1)i&&i.push(o);else if(l=ae(o),a=ge(f.appendChild(o),"script"),l&&me(a),n)for(u=0;o=a[u++];)ze.test(o.type||"")&&n.push(o);return f}var we=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function xe(){return!1}function je(e,t){return e===function(){try{return y.activeElement}catch(e){}}()===("focus"===t)}function Me(e,t,n,r,i,o){var a,c;if("object"===typeof t){for(c in"string"!==typeof n&&(r=r||n,n=void 0),t)Me(e,c,n,r,t[c],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"===typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=xe;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return x().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=x.guid++)),e.each((function(){x.event.add(this,t,i,r,n)}))}function _e(e,t,n){n?(K.set(e,t,!1),x.event.add(e,t,{namespace:!1,handler:function(e){var r,i,o=K.get(this,t);if(1&e.isTrigger&&this[t]){if(o.length)(x.event.special[t]||{}).delegateType&&e.stopPropagation();else if(o=c.call(arguments),K.set(this,t,o),r=n(this,t),this[t](),o!==(i=K.get(this,t))||r?K.set(this,t,!1):i={},o!==i)return e.stopImmediatePropagation(),e.preventDefault(),i&&i.value}else o.length&&(K.set(this,t,{value:x.event.trigger(x.extend(o[0],x.Event.prototype),o.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===K.get(e,t)&&x.event.add(e,t,ke)}x.event={global:{},add:function(e,t,n,r,i){var o,a,c,s,l,u,f,h,d,p,z,v=K.get(e);if($(e))for(n.handler&&(n=(o=n).handler,i=o.selector),i&&x.find.matchesSelector(oe,i),n.guid||(n.guid=x.guid++),(s=v.events)||(s=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(t){return"undefined"!==typeof x&&x.event.triggered!==t.type?x.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(P)||[""]).length;l--;)d=z=(c=we.exec(t[l])||[])[1],p=(c[2]||"").split(".").sort(),d&&(f=x.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=x.event.special[d]||{},u=x.extend({type:d,origType:z,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&x.expr.match.needsContext.test(i),namespace:p.join(".")},o),(h=s[d])||((h=s[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,p,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,u),u.handler.guid||(u.handler.guid=n.guid)),i?h.splice(h.delegateCount++,0,u):h.push(u),x.event.global[d]=!0)},remove:function(e,t,n,r,i){var o,a,c,s,l,u,f,h,d,p,z,v=K.hasData(e)&&K.get(e);if(v&&(s=v.events)){for(l=(t=(t||"").match(P)||[""]).length;l--;)if(d=z=(c=we.exec(t[l])||[])[1],p=(c[2]||"").split(".").sort(),d){for(f=x.event.special[d]||{},h=s[d=(r?f.delegateType:f.bindType)||d]||[],c=c[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=h.length;o--;)u=h[o],!i&&z!==u.origType||n&&n.guid!==u.guid||c&&!c.test(u.namespace)||r&&r!==u.selector&&("**"!==r||!u.selector)||(h.splice(o,1),u.selector&&h.delegateCount--,f.remove&&f.remove.call(e,u));a&&!h.length&&(f.teardown&&!1!==f.teardown.call(e,p,v.handle)||x.removeEvent(e,d,v.handle),delete s[d])}else for(d in s)x.event.remove(e,d+t[l],n,r,!0);x.isEmptyObject(s)&&K.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,c=new Array(arguments.length),s=x.event.fix(e),l=(K.get(this,"events")||Object.create(null))[s.type]||[],u=x.event.special[s.type]||{};for(c[0]=s,t=1;t=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:x.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&c.push({elem:l,handlers:o})}return l=this,s\s*$/g;function Oe(e,t){return S(e,"table")&&S(11!==t.nodeType?t:t.firstChild,"tr")&&x(e).children("tbody")[0]||e}function Te(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Ee(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Ae(e,t){var n,r,i,o,a,c;if(1===t.nodeType){if(K.hasData(e)&&(c=K.get(e).events))for(i in K.remove(t,"handle events"),c)for(n=0,r=c[i].length;n1&&"string"===typeof p&&!v.checkClone&&qe.test(p))return e.each((function(i){var o=e.eq(i);z&&(t[0]=p.call(this,i,o.html())),Le(o,t,n,r)}));if(h&&(o=(i=be(t,e[0].ownerDocument,!1,e,r)).firstChild,1===i.childNodes.length&&(i=o),o||r)){for(c=(a=x.map(ge(i,"script"),Te)).length;f0&&me(a,!s&&ge(e,"script")),c},cleanData:function(e){for(var t,n,r,i=x.event.special,o=0;void 0!==(n=e[o]);o++)if($(n)){if(t=n[K.expando]){if(t.events)for(r in t.events)i[r]?x.event.remove(n,r):x.removeEvent(n,r,t.handle);n[K.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),x.fn.extend({detach:function(e){return De(this,e,!0)},remove:function(e){return De(this,e)},text:function(e){return U(this,(function(e){return void 0===e?x.text(this):this.empty().each((function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)}))}),null,e,arguments.length)},append:function(){return Le(this,arguments,(function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Oe(this,e).appendChild(e)}))},prepend:function(){return Le(this,arguments,(function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Oe(this,e);t.insertBefore(e,t.firstChild)}}))},before:function(){return Le(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this)}))},after:function(){return Le(this,arguments,(function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)}))},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(x.cleanData(ge(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map((function(){return x.clone(this,e,t)}))},html:function(e){return U(this,(function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"===typeof e&&!Ce.test(e)&&!ve[(pe.exec(e)||["",""])[1].toLowerCase()]){e=x.htmlPrefilter(e);try{for(;n=0&&(s+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-s-c-.5))||0),s}function Je(e,t,n){var r=Ve(e),i=(!v.boxSizingReliable()||n)&&"border-box"===x.css(e,"boxSizing",!1,r),o=i,a=Re(e,t,r),c="offset"+t[0].toUpperCase()+t.slice(1);if(Pe.test(a)){if(!n)return a;a="auto"}return(!v.boxSizingReliable()&&i||!v.reliableTrDimensions()&&S(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===x.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===x.css(e,"boxSizing",!1,r),(o=c in e)&&(a=e[c])),(a=parseFloat(a)||0)+Qe(e,t,n||(i?"border":"content"),o,r,a)+"px"}function et(e,t,n,r,i){return new et.prototype.init(e,t,n,r,i)}x.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Re(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,c=Z(t),s=Ze.test(t),l=e.style;if(s||(t=Ge(c)),a=x.cssHooks[t]||x.cssHooks[c],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=re.exec(n))&&i[1]&&(n=le(e,t,i),o="number"),null!=n&&n===n&&("number"!==o||s||(n+=i&&i[3]||(x.cssNumber[c]?"":"px")),v.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(s?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,c=Z(t);return Ze.test(t)||(t=Ge(c)),(a=x.cssHooks[t]||x.cssHooks[c])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Re(e,t,r)),"normal"===i&&t in Xe&&(i=Xe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),x.each(["height","width"],(function(e,t){x.cssHooks[t]={get:function(e,n,r){if(n)return!Ye.test(x.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Je(e,t,r):Ne(e,$e,(function(){return Je(e,t,r)}))},set:function(e,n,r){var i,o=Ve(e),a=!v.scrollboxSize()&&"absolute"===o.position,c=(a||r)&&"border-box"===x.css(e,"boxSizing",!1,o),s=r?Qe(e,t,r,c,o):0;return c&&a&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Qe(e,t,"border",!1,o)-.5)),s&&(i=re.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=x.css(e,t)),Ke(0,n,s)}}})),x.cssHooks.marginLeft=Be(v.reliableMarginLeft,(function(e,t){if(t)return(parseFloat(Re(e,"marginLeft"))||e.getBoundingClientRect().left-Ne(e,{marginLeft:0},(function(){return e.getBoundingClientRect().left})))+"px"})),x.each({margin:"",padding:"",border:"Width"},(function(e,t){x.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"===typeof n?n.split(" "):[n];r<4;r++)i[e+ie[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(x.cssHooks[e+t].set=Ke)})),x.fn.extend({css:function(e,t){return U(this,(function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Ve(e),i=t.length;a1)}}),x.Tween=et,et.prototype={constructor:et,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||x.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(x.cssNumber[n]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,n=et.propHooks[this.prop];return this.options.duration?this.pos=t=x.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):et.propHooks._default.set(this),this}},et.prototype.init.prototype=et.prototype,et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=x.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){x.fx.step[e.prop]?x.fx.step[e.prop](e):1!==e.elem.nodeType||!x.cssHooks[e.prop]&&null==e.elem.style[Ge(e.prop)]?e.elem[e.prop]=e.now:x.style(e.elem,e.prop,e.now+e.unit)}}},et.propHooks.scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},x.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},x.fx=et.prototype.init,x.fx.step={};var tt,nt,rt=/^(?:toggle|show|hide)$/,it=/queueHooks$/;function ot(){nt&&(!1===y.hidden&&n.requestAnimationFrame?n.requestAnimationFrame(ot):n.setTimeout(ot,x.fx.interval),x.fx.tick())}function at(){return n.setTimeout((function(){tt=void 0})),tt=Date.now()}function ct(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ie[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function st(e,t,n){for(var r,i=(lt.tweeners[t]||[]).concat(lt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each((function(){x.removeAttr(this,e)}))}}),x.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"===typeof e.getAttribute?x.prop(e,t,n):(1===o&&x.isXMLDoc(e)||(i=x.attrHooks[t.toLowerCase()]||(x.expr.match.bool.test(t)?ut:void 0)),void 0!==n?null===n?void x.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=x.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!v.radioValue&&"radio"===t&&S(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)for(;n=i[r++];)e.removeAttribute(n)}}),ut={set:function(e,t,n){return!1===t?x.removeAttr(e,n):e.setAttribute(n,n),n}},x.each(x.expr.match.bool.source.match(/\w+/g),(function(e,t){var n=ft[t]||x.find.attr;ft[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ft[a],ft[a]=i,i=null!=n(e,t,r)?a:null,ft[a]=o),i}}));var ht=/^(?:input|select|textarea|button)$/i,dt=/^(?:a|area)$/i;function pt(e){return(e.match(P)||[]).join(" ")}function zt(e){return e.getAttribute&&e.getAttribute("class")||""}function vt(e){return Array.isArray(e)?e:"string"===typeof e&&e.match(P)||[]}x.fn.extend({prop:function(e,t){return U(this,x.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each((function(){delete this[x.propFix[e]||e]}))}}),x.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&x.isXMLDoc(e)||(t=x.propFix[t]||t,i=x.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=x.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||dt.test(e.nodeName)&&e.href?0:-1}}},propFix:{for:"htmlFor",class:"className"}}),v.optSelected||(x.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),x.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],(function(){x.propFix[this.toLowerCase()]=this})),x.fn.extend({addClass:function(e){var t,n,r,i,o,a,c,s=0;if(g(e))return this.each((function(t){x(this).addClass(e.call(this,t,zt(this)))}));if((t=vt(e)).length)for(;n=this[s++];)if(i=zt(n),r=1===n.nodeType&&" "+pt(i)+" "){for(a=0;o=t[a++];)r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(c=pt(r))&&n.setAttribute("class",c)}return this},removeClass:function(e){var t,n,r,i,o,a,c,s=0;if(g(e))return this.each((function(t){x(this).removeClass(e.call(this,t,zt(this)))}));if(!arguments.length)return this.attr("class","");if((t=vt(e)).length)for(;n=this[s++];)if(i=zt(n),r=1===n.nodeType&&" "+pt(i)+" "){for(a=0;o=t[a++];)for(;r.indexOf(" "+o+" ")>-1;)r=r.replace(" "+o+" "," ");i!==(c=pt(r))&&n.setAttribute("class",c)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"===typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each((function(n){x(this).toggleClass(e.call(this,n,zt(this),t),t)})):this.each((function(){var t,i,o,a;if(r)for(i=0,o=x(this),a=vt(e);t=a[i++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||((t=zt(this))&&K.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":K.get(this,"__className__")||""))}))},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+pt(zt(n))+" ").indexOf(t)>-1)return!0;return!1}});var gt=/\r/g;x.fn.extend({val:function(e){var t,n,r,i=this[0];return arguments.length?(r=g(e),this.each((function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,x(this).val()):e)?i="":"number"===typeof i?i+="":Array.isArray(i)&&(i=x.map(i,(function(e){return null==e?"":e+""}))),(t=x.valHooks[this.type]||x.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))}))):i?(t=x.valHooks[i.type]||x.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"===typeof(n=i.value)?n.replace(gt,""):null==n?"":n:void 0}}),x.extend({valHooks:{option:{get:function(e){var t=x.find.attr(e,"value");return null!=t?t:pt(x.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,c=a?null:[],s=a?o+1:i.length;for(r=o<0?s:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),x.each(["radio","checkbox"],(function(){x.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=x.inArray(x(e).val(),t)>-1}},v.checkOn||(x.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})})),v.focusin="onfocusin"in n;var mt=/^(?:focusinfocus|focusoutblur)$/,yt=function(e){e.stopPropagation()};x.extend(x.event,{trigger:function(e,t,r,i){var o,a,c,s,l,u,f,h,p=[r||y],z=d.call(e,"type")?e.type:e,v=d.call(e,"namespace")?e.namespace.split("."):[];if(a=h=c=r=r||y,3!==r.nodeType&&8!==r.nodeType&&!mt.test(z+x.event.triggered)&&(z.indexOf(".")>-1&&(v=z.split("."),z=v.shift(),v.sort()),l=z.indexOf(":")<0&&"on"+z,(e=e[x.expando]?e:new x.Event(z,"object"===typeof e&&e)).isTrigger=i?2:3,e.namespace=v.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+v.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:x.makeArray(t,[e]),f=x.event.special[z]||{},i||!f.trigger||!1!==f.trigger.apply(r,t))){if(!i&&!f.noBubble&&!m(r)){for(s=f.delegateType||z,mt.test(s+z)||(a=a.parentNode);a;a=a.parentNode)p.push(a),c=a;c===(r.ownerDocument||y)&&p.push(c.defaultView||c.parentWindow||n)}for(o=0;(a=p[o++])&&!e.isPropagationStopped();)h=a,e.type=o>1?s:f.bindType||z,(u=(K.get(a,"events")||Object.create(null))[e.type]&&K.get(a,"handle"))&&u.apply(a,t),(u=l&&a[l])&&u.apply&&$(a)&&(e.result=u.apply(a,t),!1===e.result&&e.preventDefault());return e.type=z,i||e.isDefaultPrevented()||f._default&&!1!==f._default.apply(p.pop(),t)||!$(r)||l&&g(r[z])&&!m(r)&&((c=r[l])&&(r[l]=null),x.event.triggered=z,e.isPropagationStopped()&&h.addEventListener(z,yt),r[z](),e.isPropagationStopped()&&h.removeEventListener(z,yt),x.event.triggered=void 0,c&&(r[l]=c)),e.result}},simulate:function(e,t,n){var r=x.extend(new x.Event,n,{type:e,isSimulated:!0});x.event.trigger(r,null,t)}}),x.fn.extend({trigger:function(e,t){return this.each((function(){x.event.trigger(e,t,this)}))},triggerHandler:function(e,t){var n=this[0];if(n)return x.event.trigger(e,t,n,!0)}}),v.focusin||x.each({focus:"focusin",blur:"focusout"},(function(e,t){var n=function(e){x.event.simulate(t,e.target,x.event.fix(e))};x.event.special[t]={setup:function(){var r=this.ownerDocument||this.document||this,i=K.access(r,t);i||r.addEventListener(e,n,!0),K.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this.document||this,i=K.access(r,t)-1;i?K.access(r,t,i):(r.removeEventListener(e,n,!0),K.remove(r,t))}}}));var bt=n.location,wt={guid:Date.now()},kt=/\?/;x.parseXML=function(e){var t,r;if(!e||"string"!==typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(i){}return r=t&&t.getElementsByTagName("parsererror")[0],t&&!r||x.error("Invalid XML: "+(r?x.map(r.childNodes,(function(e){return e.textContent})).join("\n"):e)),t};var xt=/\[\]$/,jt=/\r?\n/g,Mt=/^(?:submit|button|image|reset|file)$/i,_t=/^(?:input|select|textarea|keygen)/i;function Ct(e,t,n,r){var i;if(Array.isArray(t))x.each(t,(function(t,i){n||xt.test(e)?r(e,i):Ct(e+"["+("object"===typeof i&&null!=i?t:"")+"]",i,n,r)}));else if(n||"object"!==k(t))r(e,t);else for(i in t)Ct(e+"["+i+"]",t[i],n,r)}x.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!x.isPlainObject(e))x.each(e,(function(){i(this.name,this.value)}));else for(n in e)Ct(n,e[n],t,i);return r.join("&")},x.fn.extend({serialize:function(){return x.param(this.serializeArray())},serializeArray:function(){return this.map((function(){var e=x.prop(this,"elements");return e?x.makeArray(e):this})).filter((function(){var e=this.type;return this.name&&!x(this).is(":disabled")&&_t.test(this.nodeName)&&!Mt.test(e)&&(this.checked||!de.test(e))})).map((function(e,t){var n=x(this).val();return null==n?null:Array.isArray(n)?x.map(n,(function(e){return{name:t.name,value:e.replace(jt,"\r\n")}})):{name:t.name,value:n.replace(jt,"\r\n")}})).get()}});var qt=/%20/g,St=/#.*$/,Ot=/([?&])_=[^&]*/,Tt=/^(.*?):[ \t]*([^\r\n]*)$/gm,Et=/^(?:GET|HEAD)$/,At=/^\/\//,Ht={},Lt={},Dt="*/".concat("*"),Pt=y.createElement("a");function Vt(e){return function(t,n){"string"!==typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(P)||[];if(g(n))for(;r=o[i++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function Nt(e,t,n,r){var i={},o=e===Lt;function a(c){var s;return i[c]=!0,x.each(e[c]||[],(function(e,c){var l=c(t,n,r);return"string"!==typeof l||o||i[l]?o?!(s=l):void 0:(t.dataTypes.unshift(l),a(l),!1)})),s}return a(t.dataTypes[0])||!i["*"]&&a("*")}function It(e,t){var n,r,i=x.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&x.extend(!0,e,r),e}Pt.href=bt.href,x.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:bt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(bt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Dt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":x.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?It(It(e,x.ajaxSettings),t):It(x.ajaxSettings,e)},ajaxPrefilter:Vt(Ht),ajaxTransport:Vt(Lt),ajax:function(e,t){"object"===typeof e&&(t=e,e=void 0),t=t||{};var r,i,o,a,c,s,l,u,f,h,d=x.ajaxSetup({},t),p=d.context||d,z=d.context&&(p.nodeType||p.jquery)?x(p):x.event,v=x.Deferred(),g=x.Callbacks("once memory"),m=d.statusCode||{},b={},w={},k="canceled",j={readyState:0,getResponseHeader:function(e){var t;if(l){if(!a)for(a={};t=Tt.exec(o);)a[t[1].toLowerCase()+" "]=(a[t[1].toLowerCase()+" "]||[]).concat(t[2]);t=a[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return l?o:null},setRequestHeader:function(e,t){return null==l&&(e=w[e.toLowerCase()]=w[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==l&&(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(l)j.always(e[j.status]);else for(t in e)m[t]=[m[t],e[t]];return this},abort:function(e){var t=e||k;return r&&r.abort(t),M(0,t),this}};if(v.promise(j),d.url=((e||d.url||bt.href)+"").replace(At,bt.protocol+"//"),d.type=t.method||t.type||d.method||d.type,d.dataTypes=(d.dataType||"*").toLowerCase().match(P)||[""],null==d.crossDomain){s=y.createElement("a");try{s.href=d.url,s.href=s.href,d.crossDomain=Pt.protocol+"//"+Pt.host!==s.protocol+"//"+s.host}catch(_){d.crossDomain=!0}}if(d.data&&d.processData&&"string"!==typeof d.data&&(d.data=x.param(d.data,d.traditional)),Nt(Ht,d,t,j),l)return j;for(f in(u=x.event&&d.global)&&0===x.active++&&x.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Et.test(d.type),i=d.url.replace(St,""),d.hasContent?d.data&&d.processData&&0===(d.contentType||"").indexOf("application/x-www-form-urlencoded")&&(d.data=d.data.replace(qt,"+")):(h=d.url.slice(i.length),d.data&&(d.processData||"string"===typeof d.data)&&(i+=(kt.test(i)?"&":"?")+d.data,delete d.data),!1===d.cache&&(i=i.replace(Ot,"$1"),h=(kt.test(i)?"&":"?")+"_="+wt.guid+++h),d.url=i+h),d.ifModified&&(x.lastModified[i]&&j.setRequestHeader("If-Modified-Since",x.lastModified[i]),x.etag[i]&&j.setRequestHeader("If-None-Match",x.etag[i])),(d.data&&d.hasContent&&!1!==d.contentType||t.contentType)&&j.setRequestHeader("Content-Type",d.contentType),j.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Dt+"; q=0.01":""):d.accepts["*"]),d.headers)j.setRequestHeader(f,d.headers[f]);if(d.beforeSend&&(!1===d.beforeSend.call(p,j,d)||l))return j.abort();if(k="abort",g.add(d.complete),j.done(d.success),j.fail(d.error),r=Nt(Lt,d,t,j)){if(j.readyState=1,u&&z.trigger("ajaxSend",[j,d]),l)return j;d.async&&d.timeout>0&&(c=n.setTimeout((function(){j.abort("timeout")}),d.timeout));try{l=!1,r.send(b,M)}catch(_){if(l)throw _;M(-1,_)}}else M(-1,"No Transport");function M(e,t,a,s){var f,h,y,b,w,k=t;l||(l=!0,c&&n.clearTimeout(c),r=void 0,o=s||"",j.readyState=e>0?4:0,f=e>=200&&e<300||304===e,a&&(b=function(e,t,n){for(var r,i,o,a,c=e.contents,s=e.dataTypes;"*"===s[0];)s.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in c)if(c[i]&&c[i].test(r)){s.unshift(i);break}if(s[0]in n)o=s[0];else{for(i in n){if(!s[0]||e.converters[i+" "+s[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==s[0]&&s.unshift(o),n[o]}(d,j,a)),!f&&x.inArray("script",d.dataTypes)>-1&&x.inArray("json",d.dataTypes)<0&&(d.converters["text script"]=function(){}),b=function(e,t,n,r){var i,o,a,c,s,l={},u=e.dataTypes.slice();if(u[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];for(o=u.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!s&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),s=o,o=u.shift())if("*"===o)o=s;else if("*"!==s&&s!==o){if(!(a=l[s+" "+o]||l["* "+o]))for(i in l)if((c=i.split(" "))[1]===o&&(a=l[s+" "+c[0]]||l["* "+c[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=c[0],u.unshift(c[1]));break}if(!0!==a)if(a&&e.throws)t=a(t);else try{t=a(t)}catch(_){return{state:"parsererror",error:a?_:"No conversion from "+s+" to "+o}}}return{state:"success",data:t}}(d,b,j,f),f?(d.ifModified&&((w=j.getResponseHeader("Last-Modified"))&&(x.lastModified[i]=w),(w=j.getResponseHeader("etag"))&&(x.etag[i]=w)),204===e||"HEAD"===d.type?k="nocontent":304===e?k="notmodified":(k=b.state,h=b.data,f=!(y=b.error))):(y=k,!e&&k||(k="error",e<0&&(e=0))),j.status=e,j.statusText=(t||k)+"",f?v.resolveWith(p,[h,k,j]):v.rejectWith(p,[j,k,y]),j.statusCode(m),m=void 0,u&&z.trigger(f?"ajaxSuccess":"ajaxError",[j,d,f?h:y]),g.fireWith(p,[j,k]),u&&(z.trigger("ajaxComplete",[j,d]),--x.active||x.event.trigger("ajaxStop")))}return j},getJSON:function(e,t,n){return x.get(e,t,n,"json")},getScript:function(e,t){return x.get(e,void 0,t,"script")}}),x.each(["get","post"],(function(e,t){x[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),x.ajax(x.extend({url:e,type:t,dataType:i,data:n,success:r},x.isPlainObject(e)&&e))}})),x.ajaxPrefilter((function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")})),x._evalUrl=function(e,t,n){return x.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){x.globalEval(e,t,n)}})},x.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=x(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map((function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e})).append(this)),this},wrapInner:function(e){return g(e)?this.each((function(t){x(this).wrapInner(e.call(this,t))})):this.each((function(){var t=x(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)}))},wrap:function(e){var t=g(e);return this.each((function(n){x(this).wrapAll(t?e.call(this,n):e)}))},unwrap:function(e){return this.parent(e).not("body").each((function(){x(this).replaceWith(this.childNodes)})),this}}),x.expr.pseudos.hidden=function(e){return!x.expr.pseudos.visible(e)},x.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},x.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Rt={0:200,1223:204},Bt=x.ajaxSettings.xhr();v.cors=!!Bt&&"withCredentials"in Bt,v.ajax=Bt=!!Bt,x.ajaxTransport((function(e){var t,r;if(v.cors||Bt&&!e.crossDomain)return{send:function(i,o){var a,c=e.xhr();if(c.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(a in e.xhrFields)c[a]=e.xhrFields[a];for(a in e.mimeType&&c.overrideMimeType&&c.overrideMimeType(e.mimeType),e.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest"),i)c.setRequestHeader(a,i[a]);t=function(e){return function(){t&&(t=r=c.onload=c.onerror=c.onabort=c.ontimeout=c.onreadystatechange=null,"abort"===e?c.abort():"error"===e?"number"!==typeof c.status?o(0,"error"):o(c.status,c.statusText):o(Rt[c.status]||c.status,c.statusText,"text"!==(c.responseType||"text")||"string"!==typeof c.responseText?{binary:c.response}:{text:c.responseText},c.getAllResponseHeaders()))}},c.onload=t(),r=c.onerror=c.ontimeout=t("error"),void 0!==c.onabort?c.onabort=r:c.onreadystatechange=function(){4===c.readyState&&n.setTimeout((function(){t&&r()}))},t=t("abort");try{c.send(e.hasContent&&e.data||null)}catch(s){if(t)throw s}},abort:function(){t&&t()}}})),x.ajaxPrefilter((function(e){e.crossDomain&&(e.contents.script=!1)})),x.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return x.globalEval(e),e}}}),x.ajaxPrefilter("script",(function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")})),x.ajaxTransport("script",(function(e){var t,n;if(e.crossDomain||e.scriptAttrs)return{send:function(r,i){t=x("\n\n The CSV file is of the form\n\n Date,SeriesA,SeriesB,SeriesC\n YYYYMMDD,A1,B1,C1\n YYYYMMDD,A2,B2,C2\n\n If the 'errorBars' option is set in the constructor, the input should be of\n the form\n Date,SeriesA,SeriesB,...\n YYYYMMDD,A1,sigmaA1,B1,sigmaB1,...\n YYYYMMDD,A2,sigmaA2,B2,sigmaB2,...\n\n If the 'fractions' option is set, the input should be of the form:\n\n Date,SeriesA,SeriesB,...\n YYYYMMDD,A1/B1,A2/B2,...\n YYYYMMDD,A1/B1,A2/B2,...\n\n And error bars will be calculated automatically using a binomial distribution.\n\n For further documentation and examples, see http://dygraphs.com/\n */\n\n'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nvar _slicedToArray = (function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i['return']) _i['return'](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError('Invalid attempt to destructure non-iterable instance'); } }; })();\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar _dygraphLayout = require('./dygraph-layout');\n\nvar _dygraphLayout2 = _interopRequireDefault(_dygraphLayout);\n\nvar _dygraphCanvas = require('./dygraph-canvas');\n\nvar _dygraphCanvas2 = _interopRequireDefault(_dygraphCanvas);\n\nvar _dygraphOptions = require('./dygraph-options');\n\nvar _dygraphOptions2 = _interopRequireDefault(_dygraphOptions);\n\nvar _dygraphInteractionModel = require('./dygraph-interaction-model');\n\nvar _dygraphInteractionModel2 = _interopRequireDefault(_dygraphInteractionModel);\n\nvar _dygraphTickers = require('./dygraph-tickers');\n\nvar DygraphTickers = _interopRequireWildcard(_dygraphTickers);\n\nvar _dygraphUtils = require('./dygraph-utils');\n\nvar utils = _interopRequireWildcard(_dygraphUtils);\n\nvar _dygraphDefaultAttrs = require('./dygraph-default-attrs');\n\nvar _dygraphDefaultAttrs2 = _interopRequireDefault(_dygraphDefaultAttrs);\n\nvar _dygraphOptionsReference = require('./dygraph-options-reference');\n\nvar _dygraphOptionsReference2 = _interopRequireDefault(_dygraphOptionsReference);\n\nvar _iframeTarp = require('./iframe-tarp');\n\nvar _iframeTarp2 = _interopRequireDefault(_iframeTarp);\n\nvar _datahandlerDefault = require('./datahandler/default');\n\nvar _datahandlerDefault2 = _interopRequireDefault(_datahandlerDefault);\n\nvar _datahandlerBarsError = require('./datahandler/bars-error');\n\nvar _datahandlerBarsError2 = _interopRequireDefault(_datahandlerBarsError);\n\nvar _datahandlerBarsCustom = require('./datahandler/bars-custom');\n\nvar _datahandlerBarsCustom2 = _interopRequireDefault(_datahandlerBarsCustom);\n\nvar _datahandlerDefaultFractions = require('./datahandler/default-fractions');\n\nvar _datahandlerDefaultFractions2 = _interopRequireDefault(_datahandlerDefaultFractions);\n\nvar _datahandlerBarsFractions = require('./datahandler/bars-fractions');\n\nvar _datahandlerBarsFractions2 = _interopRequireDefault(_datahandlerBarsFractions);\n\nvar _datahandlerBars = require('./datahandler/bars');\n\nvar _datahandlerBars2 = _interopRequireDefault(_datahandlerBars);\n\nvar _pluginsAnnotations = require('./plugins/annotations');\n\nvar _pluginsAnnotations2 = _interopRequireDefault(_pluginsAnnotations);\n\nvar _pluginsAxes = require('./plugins/axes');\n\nvar _pluginsAxes2 = _interopRequireDefault(_pluginsAxes);\n\nvar _pluginsChartLabels = require('./plugins/chart-labels');\n\nvar _pluginsChartLabels2 = _interopRequireDefault(_pluginsChartLabels);\n\nvar _pluginsGrid = require('./plugins/grid');\n\nvar _pluginsGrid2 = _interopRequireDefault(_pluginsGrid);\n\nvar _pluginsLegend = require('./plugins/legend');\n\nvar _pluginsLegend2 = _interopRequireDefault(_pluginsLegend);\n\nvar _pluginsRangeSelector = require('./plugins/range-selector');\n\nvar _pluginsRangeSelector2 = _interopRequireDefault(_pluginsRangeSelector);\n\nvar _dygraphGviz = require('./dygraph-gviz');\n\nvar _dygraphGviz2 = _interopRequireDefault(_dygraphGviz);\n\n\"use strict\";\n\n/**\n * Creates an interactive, zoomable chart.\n *\n * @constructor\n * @param {div | String} div A div or the id of a div into which to construct\n * the chart.\n * @param {String | Function} file A file containing CSV data or a function\n * that returns this data. The most basic expected format for each line is\n * \"YYYY/MM/DD,val1,val2,...\". For more information, see\n * http://dygraphs.com/data.html.\n * @param {Object} attrs Various other attributes, e.g. errorBars determines\n * whether the input data contains error ranges. For a complete list of\n * options, see http://dygraphs.com/options.html.\n */\nvar Dygraph = function Dygraph(div, data, opts) {\n this.__init__(div, data, opts);\n};\n\nDygraph.NAME = \"Dygraph\";\nDygraph.VERSION = \"2.0.0\";\n\n// Various default values\nDygraph.DEFAULT_ROLL_PERIOD = 1;\nDygraph.DEFAULT_WIDTH = 480;\nDygraph.DEFAULT_HEIGHT = 320;\n\n// For max 60 Hz. animation:\nDygraph.ANIMATION_STEPS = 12;\nDygraph.ANIMATION_DURATION = 200;\n\n/**\n * Standard plotters. These may be used by clients.\n * Available plotters are:\n * - Dygraph.Plotters.linePlotter: draws central lines (most common)\n * - Dygraph.Plotters.errorPlotter: draws error bars\n * - Dygraph.Plotters.fillPlotter: draws fills under lines (used with fillGraph)\n *\n * By default, the plotter is [fillPlotter, errorPlotter, linePlotter].\n * This causes all the lines to be drawn over all the fills/error bars.\n */\nDygraph.Plotters = _dygraphCanvas2['default']._Plotters;\n\n// Used for initializing annotation CSS rules only once.\nDygraph.addedAnnotationCSS = false;\n\n/**\n * Initializes the Dygraph. This creates a new DIV and constructs the PlotKit\n * and context <canvas> inside of it. See the constructor for details.\n * on the parameters.\n * @param {Element} div the Element to render the graph into.\n * @param {string | Function} file Source data\n * @param {Object} attrs Miscellaneous other options\n * @private\n */\nDygraph.prototype.__init__ = function (div, file, attrs) {\n this.is_initial_draw_ = true;\n this.readyFns_ = [];\n\n // Support two-argument constructor\n if (attrs === null || attrs === undefined) {\n attrs = {};\n }\n\n attrs = Dygraph.copyUserAttrs_(attrs);\n\n if (typeof div == 'string') {\n div = document.getElementById(div);\n }\n\n if (!div) {\n throw new Error('Constructing dygraph with a non-existent div!');\n }\n\n // Copy the important bits into the object\n // TODO(danvk): most of these should just stay in the attrs_ dictionary.\n this.maindiv_ = div;\n this.file_ = file;\n this.rollPeriod_ = attrs.rollPeriod || Dygraph.DEFAULT_ROLL_PERIOD;\n this.previousVerticalX_ = -1;\n this.fractions_ = attrs.fractions || false;\n this.dateWindow_ = attrs.dateWindow || null;\n\n this.annotations_ = [];\n\n // Clear the div. This ensure that, if multiple dygraphs are passed the same\n // div, then only one will be drawn.\n div.innerHTML = \"\";\n\n // For historical reasons, the 'width' and 'height' options trump all CSS\n // rules _except_ for an explicit 'width' or 'height' on the div.\n // As an added convenience, if the div has zero height (like
    does\n // without any styles), then we use a default height/width.\n if (div.style.width === '' && attrs.width) {\n div.style.width = attrs.width + \"px\";\n }\n if (div.style.height === '' && attrs.height) {\n div.style.height = attrs.height + \"px\";\n }\n if (div.style.height === '' && div.clientHeight === 0) {\n div.style.height = Dygraph.DEFAULT_HEIGHT + \"px\";\n if (div.style.width === '') {\n div.style.width = Dygraph.DEFAULT_WIDTH + \"px\";\n }\n }\n // These will be zero if the dygraph's div is hidden. In that case,\n // use the user-specified attributes if present. If not, use zero\n // and assume the user will call resize to fix things later.\n this.width_ = div.clientWidth || attrs.width || 0;\n this.height_ = div.clientHeight || attrs.height || 0;\n\n // TODO(danvk): set fillGraph to be part of attrs_ here, not user_attrs_.\n if (attrs.stackedGraph) {\n attrs.fillGraph = true;\n // TODO(nikhilk): Add any other stackedGraph checks here.\n }\n\n // DEPRECATION WARNING: All option processing should be moved from\n // attrs_ and user_attrs_ to options_, which holds all this information.\n //\n // Dygraphs has many options, some of which interact with one another.\n // To keep track of everything, we maintain two sets of options:\n //\n // this.user_attrs_ only options explicitly set by the user.\n // this.attrs_ defaults, options derived from user_attrs_, data.\n //\n // Options are then accessed this.attr_('attr'), which first looks at\n // user_attrs_ and then computed attrs_. This way Dygraphs can set intelligent\n // defaults without overriding behavior that the user specifically asks for.\n this.user_attrs_ = {};\n utils.update(this.user_attrs_, attrs);\n\n // This sequence ensures that Dygraph.DEFAULT_ATTRS is never modified.\n this.attrs_ = {};\n utils.updateDeep(this.attrs_, _dygraphDefaultAttrs2['default']);\n\n this.boundaryIds_ = [];\n this.setIndexByName_ = {};\n this.datasetIndex_ = [];\n\n this.registeredEvents_ = [];\n this.eventListeners_ = {};\n\n this.attributes_ = new _dygraphOptions2['default'](this);\n\n // Create the containing DIV and other interactive elements\n this.createInterface_();\n\n // Activate plugins.\n this.plugins_ = [];\n var plugins = Dygraph.PLUGINS.concat(this.getOption('plugins'));\n for (var i = 0; i < plugins.length; i++) {\n // the plugins option may contain either plugin classes or instances.\n // Plugin instances contain an activate method.\n var Plugin = plugins[i]; // either a constructor or an instance.\n var pluginInstance;\n if (typeof Plugin.activate !== 'undefined') {\n pluginInstance = Plugin;\n } else {\n pluginInstance = new Plugin();\n }\n\n var pluginDict = {\n plugin: pluginInstance,\n events: {},\n options: {},\n pluginOptions: {}\n };\n\n var handlers = pluginInstance.activate(this);\n for (var eventName in handlers) {\n if (!handlers.hasOwnProperty(eventName)) continue;\n // TODO(danvk): validate eventName.\n pluginDict.events[eventName] = handlers[eventName];\n }\n\n this.plugins_.push(pluginDict);\n }\n\n // At this point, plugins can no longer register event handlers.\n // Construct a map from event -> ordered list of [callback, plugin].\n for (var i = 0; i < this.plugins_.length; i++) {\n var plugin_dict = this.plugins_[i];\n for (var eventName in plugin_dict.events) {\n if (!plugin_dict.events.hasOwnProperty(eventName)) continue;\n var callback = plugin_dict.events[eventName];\n\n var pair = [plugin_dict.plugin, callback];\n if (!(eventName in this.eventListeners_)) {\n this.eventListeners_[eventName] = [pair];\n } else {\n this.eventListeners_[eventName].push(pair);\n }\n }\n }\n\n this.createDragInterface_();\n\n this.start_();\n};\n\n/**\n * Triggers a cascade of events to the various plugins which are interested in them.\n * Returns true if the \"default behavior\" should be prevented, i.e. if one\n * of the event listeners called event.preventDefault().\n * @private\n */\nDygraph.prototype.cascadeEvents_ = function (name, extra_props) {\n if (!(name in this.eventListeners_)) return false;\n\n // QUESTION: can we use objects & prototypes to speed this up?\n var e = {\n dygraph: this,\n cancelable: false,\n defaultPrevented: false,\n preventDefault: function preventDefault() {\n if (!e.cancelable) throw \"Cannot call preventDefault on non-cancelable event.\";\n e.defaultPrevented = true;\n },\n propagationStopped: false,\n stopPropagation: function stopPropagation() {\n e.propagationStopped = true;\n }\n };\n utils.update(e, extra_props);\n\n var callback_plugin_pairs = this.eventListeners_[name];\n if (callback_plugin_pairs) {\n for (var i = callback_plugin_pairs.length - 1; i >= 0; i--) {\n var plugin = callback_plugin_pairs[i][0];\n var callback = callback_plugin_pairs[i][1];\n callback.call(plugin, e);\n if (e.propagationStopped) break;\n }\n }\n return e.defaultPrevented;\n};\n\n/**\n * Fetch a plugin instance of a particular class. Only for testing.\n * @private\n * @param {!Class} type The type of the plugin.\n * @return {Object} Instance of the plugin, or null if there is none.\n */\nDygraph.prototype.getPluginInstance_ = function (type) {\n for (var i = 0; i < this.plugins_.length; i++) {\n var p = this.plugins_[i];\n if (p.plugin instanceof type) {\n return p.plugin;\n }\n }\n return null;\n};\n\n/**\n * Returns the zoomed status of the chart for one or both axes.\n *\n * Axis is an optional parameter. Can be set to 'x' or 'y'.\n *\n * The zoomed status for an axis is set whenever a user zooms using the mouse\n * or when the dateWindow or valueRange are updated. Double-clicking or calling\n * resetZoom() resets the zoom status for the chart.\n */\nDygraph.prototype.isZoomed = function (axis) {\n var isZoomedX = !!this.dateWindow_;\n if (axis === 'x') return isZoomedX;\n\n var isZoomedY = this.axes_.map(function (axis) {\n return !!axis.valueRange;\n }).indexOf(true) >= 0;\n if (axis === null || axis === undefined) {\n return isZoomedX || isZoomedY;\n }\n if (axis === 'y') return isZoomedY;\n\n throw new Error('axis parameter is [' + axis + '] must be null, \\'x\\' or \\'y\\'.');\n};\n\n/**\n * Returns information about the Dygraph object, including its containing ID.\n */\nDygraph.prototype.toString = function () {\n var maindiv = this.maindiv_;\n var id = maindiv && maindiv.id ? maindiv.id : maindiv;\n return \"[Dygraph \" + id + \"]\";\n};\n\n/**\n * @private\n * Returns the value of an option. This may be set by the user (either in the\n * constructor or by calling updateOptions) or by dygraphs, and may be set to a\n * per-series value.\n * @param {string} name The name of the option, e.g. 'rollPeriod'.\n * @param {string} [seriesName] The name of the series to which the option\n * will be applied. If no per-series value of this option is available, then\n * the global value is returned. This is optional.\n * @return { ... } The value of the option.\n */\nDygraph.prototype.attr_ = function (name, seriesName) {\n // For \"production\" code, this gets removed by uglifyjs.\n if (typeof process !== 'undefined') {\n if (process.env.NODE_ENV != 'production') {\n if (typeof _dygraphOptionsReference2['default'] === 'undefined') {\n console.error('Must include options reference JS for testing');\n } else if (!_dygraphOptionsReference2['default'].hasOwnProperty(name)) {\n console.error('Dygraphs is using property ' + name + ', which has no ' + 'entry in the Dygraphs.OPTIONS_REFERENCE listing.');\n // Only log this error once.\n _dygraphOptionsReference2['default'][name] = true;\n }\n }\n }\n return seriesName ? this.attributes_.getForSeries(name, seriesName) : this.attributes_.get(name);\n};\n\n/**\n * Returns the current value for an option, as set in the constructor or via\n * updateOptions. You may pass in an (optional) series name to get per-series\n * values for the option.\n *\n * All values returned by this method should be considered immutable. If you\n * modify them, there is no guarantee that the changes will be honored or that\n * dygraphs will remain in a consistent state. If you want to modify an option,\n * use updateOptions() instead.\n *\n * @param {string} name The name of the option (e.g. 'strokeWidth')\n * @param {string=} opt_seriesName Series name to get per-series values.\n * @return {*} The value of the option.\n */\nDygraph.prototype.getOption = function (name, opt_seriesName) {\n return this.attr_(name, opt_seriesName);\n};\n\n/**\n * Like getOption(), but specifically returns a number.\n * This is a convenience function for working with the Closure Compiler.\n * @param {string} name The name of the option (e.g. 'strokeWidth')\n * @param {string=} opt_seriesName Series name to get per-series values.\n * @return {number} The value of the option.\n * @private\n */\nDygraph.prototype.getNumericOption = function (name, opt_seriesName) {\n return (/** @type{number} */this.getOption(name, opt_seriesName)\n );\n};\n\n/**\n * Like getOption(), but specifically returns a string.\n * This is a convenience function for working with the Closure Compiler.\n * @param {string} name The name of the option (e.g. 'strokeWidth')\n * @param {string=} opt_seriesName Series name to get per-series values.\n * @return {string} The value of the option.\n * @private\n */\nDygraph.prototype.getStringOption = function (name, opt_seriesName) {\n return (/** @type{string} */this.getOption(name, opt_seriesName)\n );\n};\n\n/**\n * Like getOption(), but specifically returns a boolean.\n * This is a convenience function for working with the Closure Compiler.\n * @param {string} name The name of the option (e.g. 'strokeWidth')\n * @param {string=} opt_seriesName Series name to get per-series values.\n * @return {boolean} The value of the option.\n * @private\n */\nDygraph.prototype.getBooleanOption = function (name, opt_seriesName) {\n return (/** @type{boolean} */this.getOption(name, opt_seriesName)\n );\n};\n\n/**\n * Like getOption(), but specifically returns a function.\n * This is a convenience function for working with the Closure Compiler.\n * @param {string} name The name of the option (e.g. 'strokeWidth')\n * @param {string=} opt_seriesName Series name to get per-series values.\n * @return {function(...)} The value of the option.\n * @private\n */\nDygraph.prototype.getFunctionOption = function (name, opt_seriesName) {\n return (/** @type{function(...)} */this.getOption(name, opt_seriesName)\n );\n};\n\nDygraph.prototype.getOptionForAxis = function (name, axis) {\n return this.attributes_.getForAxis(name, axis);\n};\n\n/**\n * @private\n * @param {string} axis The name of the axis (i.e. 'x', 'y' or 'y2')\n * @return { ... } A function mapping string -> option value\n */\nDygraph.prototype.optionsViewForAxis_ = function (axis) {\n var self = this;\n return function (opt) {\n var axis_opts = self.user_attrs_.axes;\n if (axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)) {\n return axis_opts[axis][opt];\n }\n\n // I don't like that this is in a second spot.\n if (axis === 'x' && opt === 'logscale') {\n // return the default value.\n // TODO(konigsberg): pull the default from a global default.\n return false;\n }\n\n // user-specified attributes always trump defaults, even if they're less\n // specific.\n if (typeof self.user_attrs_[opt] != 'undefined') {\n return self.user_attrs_[opt];\n }\n\n axis_opts = self.attrs_.axes;\n if (axis_opts && axis_opts[axis] && axis_opts[axis].hasOwnProperty(opt)) {\n return axis_opts[axis][opt];\n }\n // check old-style axis options\n // TODO(danvk): add a deprecation warning if either of these match.\n if (axis == 'y' && self.axes_[0].hasOwnProperty(opt)) {\n return self.axes_[0][opt];\n } else if (axis == 'y2' && self.axes_[1].hasOwnProperty(opt)) {\n return self.axes_[1][opt];\n }\n return self.attr_(opt);\n };\n};\n\n/**\n * Returns the current rolling period, as set by the user or an option.\n * @return {number} The number of points in the rolling window\n */\nDygraph.prototype.rollPeriod = function () {\n return this.rollPeriod_;\n};\n\n/**\n * Returns the currently-visible x-range. This can be affected by zooming,\n * panning or a call to updateOptions.\n * Returns a two-element array: [left, right].\n * If the Dygraph has dates on the x-axis, these will be millis since epoch.\n */\nDygraph.prototype.xAxisRange = function () {\n return this.dateWindow_ ? this.dateWindow_ : this.xAxisExtremes();\n};\n\n/**\n * Returns the lower- and upper-bound x-axis values of the data set.\n */\nDygraph.prototype.xAxisExtremes = function () {\n var pad = this.getNumericOption('xRangePad') / this.plotter_.area.w;\n if (this.numRows() === 0) {\n return [0 - pad, 1 + pad];\n }\n var left = this.rawData_[0][0];\n var right = this.rawData_[this.rawData_.length - 1][0];\n if (pad) {\n // Must keep this in sync with dygraph-layout _evaluateLimits()\n var range = right - left;\n left -= range * pad;\n right += range * pad;\n }\n return [left, right];\n};\n\n/**\n * Returns the lower- and upper-bound y-axis values for each axis. These are\n * the ranges you'll get if you double-click to zoom out or call resetZoom().\n * The return value is an array of [low, high] tuples, one for each y-axis.\n */\nDygraph.prototype.yAxisExtremes = function () {\n // TODO(danvk): this is pretty inefficient\n var packed = this.gatherDatasets_(this.rolledSeries_, null);\n var extremes = packed.extremes;\n\n var saveAxes = this.axes_;\n this.computeYAxisRanges_(extremes);\n var newAxes = this.axes_;\n this.axes_ = saveAxes;\n return newAxes.map(function (axis) {\n return axis.extremeRange;\n });\n};\n\n/**\n * Returns the currently-visible y-range for an axis. This can be affected by\n * zooming, panning or a call to updateOptions. Axis indices are zero-based. If\n * called with no arguments, returns the range of the first axis.\n * Returns a two-element array: [bottom, top].\n */\nDygraph.prototype.yAxisRange = function (idx) {\n if (typeof idx == \"undefined\") idx = 0;\n if (idx < 0 || idx >= this.axes_.length) {\n return null;\n }\n var axis = this.axes_[idx];\n return [axis.computedValueRange[0], axis.computedValueRange[1]];\n};\n\n/**\n * Returns the currently-visible y-ranges for each axis. This can be affected by\n * zooming, panning, calls to updateOptions, etc.\n * Returns an array of [bottom, top] pairs, one for each y-axis.\n */\nDygraph.prototype.yAxisRanges = function () {\n var ret = [];\n for (var i = 0; i < this.axes_.length; i++) {\n ret.push(this.yAxisRange(i));\n }\n return ret;\n};\n\n// TODO(danvk): use these functions throughout dygraphs.\n/**\n * Convert from data coordinates to canvas/div X/Y coordinates.\n * If specified, do this conversion for the coordinate system of a particular\n * axis. Uses the first axis by default.\n * Returns a two-element array: [X, Y]\n *\n * Note: use toDomXCoord instead of toDomCoords(x, null) and use toDomYCoord\n * instead of toDomCoords(null, y, axis).\n */\nDygraph.prototype.toDomCoords = function (x, y, axis) {\n return [this.toDomXCoord(x), this.toDomYCoord(y, axis)];\n};\n\n/**\n * Convert from data x coordinates to canvas/div X coordinate.\n * If specified, do this conversion for the coordinate system of a particular\n * axis.\n * Returns a single value or null if x is null.\n */\nDygraph.prototype.toDomXCoord = function (x) {\n if (x === null) {\n return null;\n }\n\n var area = this.plotter_.area;\n var xRange = this.xAxisRange();\n return area.x + (x - xRange[0]) / (xRange[1] - xRange[0]) * area.w;\n};\n\n/**\n * Convert from data x coordinates to canvas/div Y coordinate and optional\n * axis. Uses the first axis by default.\n *\n * returns a single value or null if y is null.\n */\nDygraph.prototype.toDomYCoord = function (y, axis) {\n var pct = this.toPercentYCoord(y, axis);\n\n if (pct === null) {\n return null;\n }\n var area = this.plotter_.area;\n return area.y + pct * area.h;\n};\n\n/**\n * Convert from canvas/div coords to data coordinates.\n * If specified, do this conversion for the coordinate system of a particular\n * axis. Uses the first axis by default.\n * Returns a two-element array: [X, Y].\n *\n * Note: use toDataXCoord instead of toDataCoords(x, null) and use toDataYCoord\n * instead of toDataCoords(null, y, axis).\n */\nDygraph.prototype.toDataCoords = function (x, y, axis) {\n return [this.toDataXCoord(x), this.toDataYCoord(y, axis)];\n};\n\n/**\n * Convert from canvas/div x coordinate to data coordinate.\n *\n * If x is null, this returns null.\n */\nDygraph.prototype.toDataXCoord = function (x) {\n if (x === null) {\n return null;\n }\n\n var area = this.plotter_.area;\n var xRange = this.xAxisRange();\n\n if (!this.attributes_.getForAxis(\"logscale\", 'x')) {\n return xRange[0] + (x - area.x) / area.w * (xRange[1] - xRange[0]);\n } else {\n var pct = (x - area.x) / area.w;\n return utils.logRangeFraction(xRange[0], xRange[1], pct);\n }\n};\n\n/**\n * Convert from canvas/div y coord to value.\n *\n * If y is null, this returns null.\n * if axis is null, this uses the first axis.\n */\nDygraph.prototype.toDataYCoord = function (y, axis) {\n if (y === null) {\n return null;\n }\n\n var area = this.plotter_.area;\n var yRange = this.yAxisRange(axis);\n\n if (typeof axis == \"undefined\") axis = 0;\n if (!this.attributes_.getForAxis(\"logscale\", axis)) {\n return yRange[0] + (area.y + area.h - y) / area.h * (yRange[1] - yRange[0]);\n } else {\n // Computing the inverse of toDomCoord.\n var pct = (y - area.y) / area.h;\n // Note reversed yRange, y1 is on top with pct==0.\n return utils.logRangeFraction(yRange[1], yRange[0], pct);\n }\n};\n\n/**\n * Converts a y for an axis to a percentage from the top to the\n * bottom of the drawing area.\n *\n * If the coordinate represents a value visible on the canvas, then\n * the value will be between 0 and 1, where 0 is the top of the canvas.\n * However, this method will return values outside the range, as\n * values can fall outside the canvas.\n *\n * If y is null, this returns null.\n * if axis is null, this uses the first axis.\n *\n * @param {number} y The data y-coordinate.\n * @param {number} [axis] The axis number on which the data coordinate lives.\n * @return {number} A fraction in [0, 1] where 0 = the top edge.\n */\nDygraph.prototype.toPercentYCoord = function (y, axis) {\n if (y === null) {\n return null;\n }\n if (typeof axis == \"undefined\") axis = 0;\n\n var yRange = this.yAxisRange(axis);\n\n var pct;\n var logscale = this.attributes_.getForAxis(\"logscale\", axis);\n if (logscale) {\n var logr0 = utils.log10(yRange[0]);\n var logr1 = utils.log10(yRange[1]);\n pct = (logr1 - utils.log10(y)) / (logr1 - logr0);\n } else {\n // yRange[1] - y is unit distance from the bottom.\n // yRange[1] - yRange[0] is the scale of the range.\n // (yRange[1] - y) / (yRange[1] - yRange[0]) is the % from the bottom.\n pct = (yRange[1] - y) / (yRange[1] - yRange[0]);\n }\n return pct;\n};\n\n/**\n * Converts an x value to a percentage from the left to the right of\n * the drawing area.\n *\n * If the coordinate represents a value visible on the canvas, then\n * the value will be between 0 and 1, where 0 is the left of the canvas.\n * However, this method will return values outside the range, as\n * values can fall outside the canvas.\n *\n * If x is null, this returns null.\n * @param {number} x The data x-coordinate.\n * @return {number} A fraction in [0, 1] where 0 = the left edge.\n */\nDygraph.prototype.toPercentXCoord = function (x) {\n if (x === null) {\n return null;\n }\n\n var xRange = this.xAxisRange();\n var pct;\n var logscale = this.attributes_.getForAxis(\"logscale\", 'x');\n if (logscale === true) {\n // logscale can be null so we test for true explicitly.\n var logr0 = utils.log10(xRange[0]);\n var logr1 = utils.log10(xRange[1]);\n pct = (utils.log10(x) - logr0) / (logr1 - logr0);\n } else {\n // x - xRange[0] is unit distance from the left.\n // xRange[1] - xRange[0] is the scale of the range.\n // The full expression below is the % from the left.\n pct = (x - xRange[0]) / (xRange[1] - xRange[0]);\n }\n return pct;\n};\n\n/**\n * Returns the number of columns (including the independent variable).\n * @return {number} The number of columns.\n */\nDygraph.prototype.numColumns = function () {\n if (!this.rawData_) return 0;\n return this.rawData_[0] ? this.rawData_[0].length : this.attr_(\"labels\").length;\n};\n\n/**\n * Returns the number of rows (excluding any header/label row).\n * @return {number} The number of rows, less any header.\n */\nDygraph.prototype.numRows = function () {\n if (!this.rawData_) return 0;\n return this.rawData_.length;\n};\n\n/**\n * Returns the value in the given row and column. If the row and column exceed\n * the bounds on the data, returns null. Also returns null if the value is\n * missing.\n * @param {number} row The row number of the data (0-based). Row 0 is the\n * first row of data, not a header row.\n * @param {number} col The column number of the data (0-based)\n * @return {number} The value in the specified cell or null if the row/col\n * were out of range.\n */\nDygraph.prototype.getValue = function (row, col) {\n if (row < 0 || row > this.rawData_.length) return null;\n if (col < 0 || col > this.rawData_[row].length) return null;\n\n return this.rawData_[row][col];\n};\n\n/**\n * Generates interface elements for the Dygraph: a containing div, a div to\n * display the current point, and a textbox to adjust the rolling average\n * period. Also creates the Renderer/Layout elements.\n * @private\n */\nDygraph.prototype.createInterface_ = function () {\n // Create the all-enclosing graph div\n var enclosing = this.maindiv_;\n\n this.graphDiv = document.createElement(\"div\");\n\n // TODO(danvk): any other styles that are useful to set here?\n this.graphDiv.style.textAlign = 'left'; // This is a CSS \"reset\"\n this.graphDiv.style.position = 'relative';\n enclosing.appendChild(this.graphDiv);\n\n // Create the canvas for interactive parts of the chart.\n this.canvas_ = utils.createCanvas();\n this.canvas_.style.position = \"absolute\";\n\n // ... and for static parts of the chart.\n this.hidden_ = this.createPlotKitCanvas_(this.canvas_);\n\n this.canvas_ctx_ = utils.getContext(this.canvas_);\n this.hidden_ctx_ = utils.getContext(this.hidden_);\n\n this.resizeElements_();\n\n // The interactive parts of the graph are drawn on top of the chart.\n this.graphDiv.appendChild(this.hidden_);\n this.graphDiv.appendChild(this.canvas_);\n this.mouseEventElement_ = this.createMouseEventElement_();\n\n // Create the grapher\n this.layout_ = new _dygraphLayout2['default'](this);\n\n var dygraph = this;\n\n this.mouseMoveHandler_ = function (e) {\n dygraph.mouseMove_(e);\n };\n\n this.mouseOutHandler_ = function (e) {\n // The mouse has left the chart if:\n // 1. e.target is inside the chart\n // 2. e.relatedTarget is outside the chart\n var target = e.target || e.fromElement;\n var relatedTarget = e.relatedTarget || e.toElement;\n if (utils.isNodeContainedBy(target, dygraph.graphDiv) && !utils.isNodeContainedBy(relatedTarget, dygraph.graphDiv)) {\n dygraph.mouseOut_(e);\n }\n };\n\n this.addAndTrackEvent(window, 'mouseout', this.mouseOutHandler_);\n this.addAndTrackEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);\n\n // Don't recreate and register the resize handler on subsequent calls.\n // This happens when the graph is resized.\n if (!this.resizeHandler_) {\n this.resizeHandler_ = function (e) {\n dygraph.resize();\n };\n\n // Update when the window is resized.\n // TODO(danvk): drop frames depending on complexity of the chart.\n this.addAndTrackEvent(window, 'resize', this.resizeHandler_);\n }\n};\n\nDygraph.prototype.resizeElements_ = function () {\n this.graphDiv.style.width = this.width_ + \"px\";\n this.graphDiv.style.height = this.height_ + \"px\";\n\n var pixelRatioOption = this.getNumericOption('pixelRatio');\n\n var canvasScale = pixelRatioOption || utils.getContextPixelRatio(this.canvas_ctx_);\n this.canvas_.width = this.width_ * canvasScale;\n this.canvas_.height = this.height_ * canvasScale;\n this.canvas_.style.width = this.width_ + \"px\"; // for IE\n this.canvas_.style.height = this.height_ + \"px\"; // for IE\n if (canvasScale !== 1) {\n this.canvas_ctx_.scale(canvasScale, canvasScale);\n }\n\n var hiddenScale = pixelRatioOption || utils.getContextPixelRatio(this.hidden_ctx_);\n this.hidden_.width = this.width_ * hiddenScale;\n this.hidden_.height = this.height_ * hiddenScale;\n this.hidden_.style.width = this.width_ + \"px\"; // for IE\n this.hidden_.style.height = this.height_ + \"px\"; // for IE\n if (hiddenScale !== 1) {\n this.hidden_ctx_.scale(hiddenScale, hiddenScale);\n }\n};\n\n/**\n * Detach DOM elements in the dygraph and null out all data references.\n * Calling this when you're done with a dygraph can dramatically reduce memory\n * usage. See, e.g., the tests/perf.html example.\n */\nDygraph.prototype.destroy = function () {\n this.canvas_ctx_.restore();\n this.hidden_ctx_.restore();\n\n // Destroy any plugins, in the reverse order that they were registered.\n for (var i = this.plugins_.length - 1; i >= 0; i--) {\n var p = this.plugins_.pop();\n if (p.plugin.destroy) p.plugin.destroy();\n }\n\n var removeRecursive = function removeRecursive(node) {\n while (node.hasChildNodes()) {\n removeRecursive(node.firstChild);\n node.removeChild(node.firstChild);\n }\n };\n\n this.removeTrackedEvents_();\n\n // remove mouse event handlers (This may not be necessary anymore)\n utils.removeEvent(window, 'mouseout', this.mouseOutHandler_);\n utils.removeEvent(this.mouseEventElement_, 'mousemove', this.mouseMoveHandler_);\n\n // remove window handlers\n utils.removeEvent(window, 'resize', this.resizeHandler_);\n this.resizeHandler_ = null;\n\n removeRecursive(this.maindiv_);\n\n var nullOut = function nullOut(obj) {\n for (var n in obj) {\n if (typeof obj[n] === 'object') {\n obj[n] = null;\n }\n }\n };\n // These may not all be necessary, but it can't hurt...\n nullOut(this.layout_);\n nullOut(this.plotter_);\n nullOut(this);\n};\n\n/**\n * Creates the canvas on which the chart will be drawn. Only the Renderer ever\n * draws on this particular canvas. All Dygraph work (i.e. drawing hover dots\n * or the zoom rectangles) is done on this.canvas_.\n * @param {Object} canvas The Dygraph canvas over which to overlay the plot\n * @return {Object} The newly-created canvas\n * @private\n */\nDygraph.prototype.createPlotKitCanvas_ = function (canvas) {\n var h = utils.createCanvas();\n h.style.position = \"absolute\";\n // TODO(danvk): h should be offset from canvas. canvas needs to include\n // some extra area to make it easier to zoom in on the far left and far\n // right. h needs to be precisely the plot area, so that clipping occurs.\n h.style.top = canvas.style.top;\n h.style.left = canvas.style.left;\n h.width = this.width_;\n h.height = this.height_;\n h.style.width = this.width_ + \"px\"; // for IE\n h.style.height = this.height_ + \"px\"; // for IE\n return h;\n};\n\n/**\n * Creates an overlay element used to handle mouse events.\n * @return {Object} The mouse event element.\n * @private\n */\nDygraph.prototype.createMouseEventElement_ = function () {\n return this.canvas_;\n};\n\n/**\n * Generate a set of distinct colors for the data series. This is done with a\n * color wheel. Saturation/Value are customizable, and the hue is\n * equally-spaced around the color wheel. If a custom set of colors is\n * specified, that is used instead.\n * @private\n */\nDygraph.prototype.setColors_ = function () {\n var labels = this.getLabels();\n var num = labels.length - 1;\n this.colors_ = [];\n this.colorsMap_ = {};\n\n // These are used for when no custom colors are specified.\n var sat = this.getNumericOption('colorSaturation') || 1.0;\n var val = this.getNumericOption('colorValue') || 0.5;\n var half = Math.ceil(num / 2);\n\n var colors = this.getOption('colors');\n var visibility = this.visibility();\n for (var i = 0; i < num; i++) {\n if (!visibility[i]) {\n continue;\n }\n var label = labels[i + 1];\n var colorStr = this.attributes_.getForSeries('color', label);\n if (!colorStr) {\n if (colors) {\n colorStr = colors[i % colors.length];\n } else {\n // alternate colors for high contrast.\n var idx = i % 2 ? half + (i + 1) / 2 : Math.ceil((i + 1) / 2);\n var hue = 1.0 * idx / (1 + num);\n colorStr = utils.hsvToRGB(hue, sat, val);\n }\n }\n this.colors_.push(colorStr);\n this.colorsMap_[label] = colorStr;\n }\n};\n\n/**\n * Return the list of colors. This is either the list of colors passed in the\n * attributes or the autogenerated list of rgb(r,g,b) strings.\n * This does not return colors for invisible series.\n * @return {Array.} The list of colors.\n */\nDygraph.prototype.getColors = function () {\n return this.colors_;\n};\n\n/**\n * Returns a few attributes of a series, i.e. its color, its visibility, which\n * axis it's assigned to, and its column in the original data.\n * Returns null if the series does not exist.\n * Otherwise, returns an object with column, visibility, color and axis properties.\n * The \"axis\" property will be set to 1 for y1 and 2 for y2.\n * The \"column\" property can be fed back into getValue(row, column) to get\n * values for this series.\n */\nDygraph.prototype.getPropertiesForSeries = function (series_name) {\n var idx = -1;\n var labels = this.getLabels();\n for (var i = 1; i < labels.length; i++) {\n if (labels[i] == series_name) {\n idx = i;\n break;\n }\n }\n if (idx == -1) return null;\n\n return {\n name: series_name,\n column: idx,\n visible: this.visibility()[idx - 1],\n color: this.colorsMap_[series_name],\n axis: 1 + this.attributes_.axisForSeries(series_name)\n };\n};\n\n/**\n * Create the text box to adjust the averaging period\n * @private\n */\nDygraph.prototype.createRollInterface_ = function () {\n var _this = this;\n\n // Create a roller if one doesn't exist already.\n var roller = this.roller_;\n if (!roller) {\n this.roller_ = roller = document.createElement(\"input\");\n roller.type = \"text\";\n roller.style.display = \"none\";\n roller.className = 'dygraph-roller';\n this.graphDiv.appendChild(roller);\n }\n\n var display = this.getBooleanOption('showRoller') ? 'block' : 'none';\n\n var area = this.getArea();\n var textAttr = {\n \"top\": area.y + area.h - 25 + \"px\",\n \"left\": area.x + 1 + \"px\",\n \"display\": display\n };\n roller.size = \"2\";\n roller.value = this.rollPeriod_;\n utils.update(roller.style, textAttr);\n\n roller.onchange = function () {\n return _this.adjustRoll(roller.value);\n };\n};\n\n/**\n * Set up all the mouse handlers needed to capture dragging behavior for zoom\n * events.\n * @private\n */\nDygraph.prototype.createDragInterface_ = function () {\n var context = {\n // Tracks whether the mouse is down right now\n isZooming: false,\n isPanning: false, // is this drag part of a pan?\n is2DPan: false, // if so, is that pan 1- or 2-dimensional?\n dragStartX: null, // pixel coordinates\n dragStartY: null, // pixel coordinates\n dragEndX: null, // pixel coordinates\n dragEndY: null, // pixel coordinates\n dragDirection: null,\n prevEndX: null, // pixel coordinates\n prevEndY: null, // pixel coordinates\n prevDragDirection: null,\n cancelNextDblclick: false, // see comment in dygraph-interaction-model.js\n\n // The value on the left side of the graph when a pan operation starts.\n initialLeftmostDate: null,\n\n // The number of units each pixel spans. (This won't be valid for log\n // scales)\n xUnitsPerPixel: null,\n\n // TODO(danvk): update this comment\n // The range in second/value units that the viewport encompasses during a\n // panning operation.\n dateRange: null,\n\n // Top-left corner of the canvas, in DOM coords\n // TODO(konigsberg): Rename topLeftCanvasX, topLeftCanvasY.\n px: 0,\n py: 0,\n\n // Values for use with panEdgeFraction, which limit how far outside the\n // graph's data boundaries it can be panned.\n boundedDates: null, // [minDate, maxDate]\n boundedValues: null, // [[minValue, maxValue] ...]\n\n // We cover iframes during mouse interactions. See comments in\n // dygraph-utils.js for more info on why this is a good idea.\n tarp: new _iframeTarp2['default'](),\n\n // contextB is the same thing as this context object but renamed.\n initializeMouseDown: function initializeMouseDown(event, g, contextB) {\n // prevents mouse drags from selecting page text.\n if (event.preventDefault) {\n event.preventDefault(); // Firefox, Chrome, etc.\n } else {\n event.returnValue = false; // IE\n event.cancelBubble = true;\n }\n\n var canvasPos = utils.findPos(g.canvas_);\n contextB.px = canvasPos.x;\n contextB.py = canvasPos.y;\n contextB.dragStartX = utils.dragGetX_(event, contextB);\n contextB.dragStartY = utils.dragGetY_(event, contextB);\n contextB.cancelNextDblclick = false;\n contextB.tarp.cover();\n },\n destroy: function destroy() {\n var context = this;\n if (context.isZooming || context.isPanning) {\n context.isZooming = false;\n context.dragStartX = null;\n context.dragStartY = null;\n }\n\n if (context.isPanning) {\n context.isPanning = false;\n context.draggingDate = null;\n context.dateRange = null;\n for (var i = 0; i < self.axes_.length; i++) {\n delete self.axes_[i].draggingValue;\n delete self.axes_[i].dragValueRange;\n }\n }\n\n context.tarp.uncover();\n }\n };\n\n var interactionModel = this.getOption(\"interactionModel\");\n\n // Self is the graph.\n var self = this;\n\n // Function that binds the graph and context to the handler.\n var bindHandler = function bindHandler(handler) {\n return function (event) {\n handler(event, self, context);\n };\n };\n\n for (var eventName in interactionModel) {\n if (!interactionModel.hasOwnProperty(eventName)) continue;\n this.addAndTrackEvent(this.mouseEventElement_, eventName, bindHandler(interactionModel[eventName]));\n }\n\n // If the user releases the mouse button during a drag, but not over the\n // canvas, then it doesn't count as a zooming action.\n if (!interactionModel.willDestroyContextMyself) {\n var mouseUpHandler = function mouseUpHandler(event) {\n context.destroy();\n };\n\n this.addAndTrackEvent(document, 'mouseup', mouseUpHandler);\n }\n};\n\n/**\n * Draw a gray zoom rectangle over the desired area of the canvas. Also clears\n * up any previous zoom rectangles that were drawn. This could be optimized to\n * avoid extra redrawing, but it's tricky to avoid interactions with the status\n * dots.\n *\n * @param {number} direction the direction of the zoom rectangle. Acceptable\n * values are utils.HORIZONTAL and utils.VERTICAL.\n * @param {number} startX The X position where the drag started, in canvas\n * coordinates.\n * @param {number} endX The current X position of the drag, in canvas coords.\n * @param {number} startY The Y position where the drag started, in canvas\n * coordinates.\n * @param {number} endY The current Y position of the drag, in canvas coords.\n * @param {number} prevDirection the value of direction on the previous call to\n * this function. Used to avoid excess redrawing\n * @param {number} prevEndX The value of endX on the previous call to this\n * function. Used to avoid excess redrawing\n * @param {number} prevEndY The value of endY on the previous call to this\n * function. Used to avoid excess redrawing\n * @private\n */\nDygraph.prototype.drawZoomRect_ = function (direction, startX, endX, startY, endY, prevDirection, prevEndX, prevEndY) {\n var ctx = this.canvas_ctx_;\n\n // Clean up from the previous rect if necessary\n if (prevDirection == utils.HORIZONTAL) {\n ctx.clearRect(Math.min(startX, prevEndX), this.layout_.getPlotArea().y, Math.abs(startX - prevEndX), this.layout_.getPlotArea().h);\n } else if (prevDirection == utils.VERTICAL) {\n ctx.clearRect(this.layout_.getPlotArea().x, Math.min(startY, prevEndY), this.layout_.getPlotArea().w, Math.abs(startY - prevEndY));\n }\n\n // Draw a light-grey rectangle to show the new viewing area\n if (direction == utils.HORIZONTAL) {\n if (endX && startX) {\n ctx.fillStyle = \"rgba(128,128,128,0.33)\";\n ctx.fillRect(Math.min(startX, endX), this.layout_.getPlotArea().y, Math.abs(endX - startX), this.layout_.getPlotArea().h);\n }\n } else if (direction == utils.VERTICAL) {\n if (endY && startY) {\n ctx.fillStyle = \"rgba(128,128,128,0.33)\";\n ctx.fillRect(this.layout_.getPlotArea().x, Math.min(startY, endY), this.layout_.getPlotArea().w, Math.abs(endY - startY));\n }\n }\n};\n\n/**\n * Clear the zoom rectangle (and perform no zoom).\n * @private\n */\nDygraph.prototype.clearZoomRect_ = function () {\n this.currentZoomRectArgs_ = null;\n this.canvas_ctx_.clearRect(0, 0, this.width_, this.height_);\n};\n\n/**\n * Zoom to something containing [lowX, highX]. These are pixel coordinates in\n * the canvas. The exact zoom window may be slightly larger if there are no data\n * points near lowX or highX. Don't confuse this function with doZoomXDates,\n * which accepts dates that match the raw data. This function redraws the graph.\n *\n * @param {number} lowX The leftmost pixel value that should be visible.\n * @param {number} highX The rightmost pixel value that should be visible.\n * @private\n */\nDygraph.prototype.doZoomX_ = function (lowX, highX) {\n this.currentZoomRectArgs_ = null;\n // Find the earliest and latest dates contained in this canvasx range.\n // Convert the call to date ranges of the raw data.\n var minDate = this.toDataXCoord(lowX);\n var maxDate = this.toDataXCoord(highX);\n this.doZoomXDates_(minDate, maxDate);\n};\n\n/**\n * Zoom to something containing [minDate, maxDate] values. Don't confuse this\n * method with doZoomX which accepts pixel coordinates. This function redraws\n * the graph.\n *\n * @param {number} minDate The minimum date that should be visible.\n * @param {number} maxDate The maximum date that should be visible.\n * @private\n */\nDygraph.prototype.doZoomXDates_ = function (minDate, maxDate) {\n var _this2 = this;\n\n // TODO(danvk): when xAxisRange is null (i.e. \"fit to data\", the animation\n // can produce strange effects. Rather than the x-axis transitioning slowly\n // between values, it can jerk around.)\n var old_window = this.xAxisRange();\n var new_window = [minDate, maxDate];\n var zoomCallback = this.getFunctionOption('zoomCallback');\n this.doAnimatedZoom(old_window, new_window, null, null, function () {\n if (zoomCallback) {\n zoomCallback.call(_this2, minDate, maxDate, _this2.yAxisRanges());\n }\n });\n};\n\n/**\n * Zoom to something containing [lowY, highY]. These are pixel coordinates in\n * the canvas. This function redraws the graph.\n *\n * @param {number} lowY The topmost pixel value that should be visible.\n * @param {number} highY The lowest pixel value that should be visible.\n * @private\n */\nDygraph.prototype.doZoomY_ = function (lowY, highY) {\n var _this3 = this;\n\n this.currentZoomRectArgs_ = null;\n // Find the highest and lowest values in pixel range for each axis.\n // Note that lowY (in pixels) corresponds to the max Value (in data coords).\n // This is because pixels increase as you go down on the screen, whereas data\n // coordinates increase as you go up the screen.\n var oldValueRanges = this.yAxisRanges();\n var newValueRanges = [];\n for (var i = 0; i < this.axes_.length; i++) {\n var hi = this.toDataYCoord(lowY, i);\n var low = this.toDataYCoord(highY, i);\n newValueRanges.push([low, hi]);\n }\n\n var zoomCallback = this.getFunctionOption('zoomCallback');\n this.doAnimatedZoom(null, null, oldValueRanges, newValueRanges, function () {\n if (zoomCallback) {\n var _xAxisRange = _this3.xAxisRange();\n\n var _xAxisRange2 = _slicedToArray(_xAxisRange, 2);\n\n var minX = _xAxisRange2[0];\n var maxX = _xAxisRange2[1];\n\n zoomCallback.call(_this3, minX, maxX, _this3.yAxisRanges());\n }\n });\n};\n\n/**\n * Transition function to use in animations. Returns values between 0.0\n * (totally old values) and 1.0 (totally new values) for each frame.\n * @private\n */\nDygraph.zoomAnimationFunction = function (frame, numFrames) {\n var k = 1.5;\n return (1.0 - Math.pow(k, -frame)) / (1.0 - Math.pow(k, -numFrames));\n};\n\n/**\n * Reset the zoom to the original view coordinates. This is the same as\n * double-clicking on the graph.\n */\nDygraph.prototype.resetZoom = function () {\n var _this4 = this;\n\n var dirtyX = this.isZoomed('x');\n var dirtyY = this.isZoomed('y');\n var dirty = dirtyX || dirtyY;\n\n // Clear any selection, since it's likely to be drawn in the wrong place.\n this.clearSelection();\n\n if (!dirty) return;\n\n // Calculate extremes to avoid lack of padding on reset.\n\n var _xAxisExtremes = this.xAxisExtremes();\n\n var _xAxisExtremes2 = _slicedToArray(_xAxisExtremes, 2);\n\n var minDate = _xAxisExtremes2[0];\n var maxDate = _xAxisExtremes2[1];\n\n var animatedZooms = this.getBooleanOption('animatedZooms');\n var zoomCallback = this.getFunctionOption('zoomCallback');\n\n // TODO(danvk): merge this block w/ the code below.\n // TODO(danvk): factor out a generic, public zoomTo method.\n if (!animatedZooms) {\n this.dateWindow_ = null;\n this.axes_.forEach(function (axis) {\n if (axis.valueRange) delete axis.valueRange;\n });\n\n this.drawGraph_();\n if (zoomCallback) {\n zoomCallback.call(this, minDate, maxDate, this.yAxisRanges());\n }\n return;\n }\n\n var oldWindow = null,\n newWindow = null,\n oldValueRanges = null,\n newValueRanges = null;\n if (dirtyX) {\n oldWindow = this.xAxisRange();\n newWindow = [minDate, maxDate];\n }\n\n if (dirtyY) {\n oldValueRanges = this.yAxisRanges();\n newValueRanges = this.yAxisExtremes();\n }\n\n this.doAnimatedZoom(oldWindow, newWindow, oldValueRanges, newValueRanges, function () {\n _this4.dateWindow_ = null;\n _this4.axes_.forEach(function (axis) {\n if (axis.valueRange) delete axis.valueRange;\n });\n if (zoomCallback) {\n zoomCallback.call(_this4, minDate, maxDate, _this4.yAxisRanges());\n }\n });\n};\n\n/**\n * Combined animation logic for all zoom functions.\n * either the x parameters or y parameters may be null.\n * @private\n */\nDygraph.prototype.doAnimatedZoom = function (oldXRange, newXRange, oldYRanges, newYRanges, callback) {\n var _this5 = this;\n\n var steps = this.getBooleanOption(\"animatedZooms\") ? Dygraph.ANIMATION_STEPS : 1;\n\n var windows = [];\n var valueRanges = [];\n var step, frac;\n\n if (oldXRange !== null && newXRange !== null) {\n for (step = 1; step <= steps; step++) {\n frac = Dygraph.zoomAnimationFunction(step, steps);\n windows[step - 1] = [oldXRange[0] * (1 - frac) + frac * newXRange[0], oldXRange[1] * (1 - frac) + frac * newXRange[1]];\n }\n }\n\n if (oldYRanges !== null && newYRanges !== null) {\n for (step = 1; step <= steps; step++) {\n frac = Dygraph.zoomAnimationFunction(step, steps);\n var thisRange = [];\n for (var j = 0; j < this.axes_.length; j++) {\n thisRange.push([oldYRanges[j][0] * (1 - frac) + frac * newYRanges[j][0], oldYRanges[j][1] * (1 - frac) + frac * newYRanges[j][1]]);\n }\n valueRanges[step - 1] = thisRange;\n }\n }\n\n utils.repeatAndCleanup(function (step) {\n if (valueRanges.length) {\n for (var i = 0; i < _this5.axes_.length; i++) {\n var w = valueRanges[step][i];\n _this5.axes_[i].valueRange = [w[0], w[1]];\n }\n }\n if (windows.length) {\n _this5.dateWindow_ = windows[step];\n }\n _this5.drawGraph_();\n }, steps, Dygraph.ANIMATION_DURATION / steps, callback);\n};\n\n/**\n * Get the current graph's area object.\n *\n * Returns: {x, y, w, h}\n */\nDygraph.prototype.getArea = function () {\n return this.plotter_.area;\n};\n\n/**\n * Convert a mouse event to DOM coordinates relative to the graph origin.\n *\n * Returns a two-element array: [X, Y].\n */\nDygraph.prototype.eventToDomCoords = function (event) {\n if (event.offsetX && event.offsetY) {\n return [event.offsetX, event.offsetY];\n } else {\n var eventElementPos = utils.findPos(this.mouseEventElement_);\n var canvasx = utils.pageX(event) - eventElementPos.x;\n var canvasy = utils.pageY(event) - eventElementPos.y;\n return [canvasx, canvasy];\n }\n};\n\n/**\n * Given a canvas X coordinate, find the closest row.\n * @param {number} domX graph-relative DOM X coordinate\n * Returns {number} row number.\n * @private\n */\nDygraph.prototype.findClosestRow = function (domX) {\n var minDistX = Infinity;\n var closestRow = -1;\n var sets = this.layout_.points;\n for (var i = 0; i < sets.length; i++) {\n var points = sets[i];\n var len = points.length;\n for (var j = 0; j < len; j++) {\n var point = points[j];\n if (!utils.isValidPoint(point, true)) continue;\n var dist = Math.abs(point.canvasx - domX);\n if (dist < minDistX) {\n minDistX = dist;\n closestRow = point.idx;\n }\n }\n }\n\n return closestRow;\n};\n\n/**\n * Given canvas X,Y coordinates, find the closest point.\n *\n * This finds the individual data point across all visible series\n * that's closest to the supplied DOM coordinates using the standard\n * Euclidean X,Y distance.\n *\n * @param {number} domX graph-relative DOM X coordinate\n * @param {number} domY graph-relative DOM Y coordinate\n * Returns: {row, seriesName, point}\n * @private\n */\nDygraph.prototype.findClosestPoint = function (domX, domY) {\n var minDist = Infinity;\n var dist, dx, dy, point, closestPoint, closestSeries, closestRow;\n for (var setIdx = this.layout_.points.length - 1; setIdx >= 0; --setIdx) {\n var points = this.layout_.points[setIdx];\n for (var i = 0; i < points.length; ++i) {\n point = points[i];\n if (!utils.isValidPoint(point)) continue;\n dx = point.canvasx - domX;\n dy = point.canvasy - domY;\n dist = dx * dx + dy * dy;\n if (dist < minDist) {\n minDist = dist;\n closestPoint = point;\n closestSeries = setIdx;\n closestRow = point.idx;\n }\n }\n }\n var name = this.layout_.setNames[closestSeries];\n return {\n row: closestRow,\n seriesName: name,\n point: closestPoint\n };\n};\n\n/**\n * Given canvas X,Y coordinates, find the touched area in a stacked graph.\n *\n * This first finds the X data point closest to the supplied DOM X coordinate,\n * then finds the series which puts the Y coordinate on top of its filled area,\n * using linear interpolation between adjacent point pairs.\n *\n * @param {number} domX graph-relative DOM X coordinate\n * @param {number} domY graph-relative DOM Y coordinate\n * Returns: {row, seriesName, point}\n * @private\n */\nDygraph.prototype.findStackedPoint = function (domX, domY) {\n var row = this.findClosestRow(domX);\n var closestPoint, closestSeries;\n for (var setIdx = 0; setIdx < this.layout_.points.length; ++setIdx) {\n var boundary = this.getLeftBoundary_(setIdx);\n var rowIdx = row - boundary;\n var points = this.layout_.points[setIdx];\n if (rowIdx >= points.length) continue;\n var p1 = points[rowIdx];\n if (!utils.isValidPoint(p1)) continue;\n var py = p1.canvasy;\n if (domX > p1.canvasx && rowIdx + 1 < points.length) {\n // interpolate series Y value using next point\n var p2 = points[rowIdx + 1];\n if (utils.isValidPoint(p2)) {\n var dx = p2.canvasx - p1.canvasx;\n if (dx > 0) {\n var r = (domX - p1.canvasx) / dx;\n py += r * (p2.canvasy - p1.canvasy);\n }\n }\n } else if (domX < p1.canvasx && rowIdx > 0) {\n // interpolate series Y value using previous point\n var p0 = points[rowIdx - 1];\n if (utils.isValidPoint(p0)) {\n var dx = p1.canvasx - p0.canvasx;\n if (dx > 0) {\n var r = (p1.canvasx - domX) / dx;\n py += r * (p0.canvasy - p1.canvasy);\n }\n }\n }\n // Stop if the point (domX, py) is above this series' upper edge\n if (setIdx === 0 || py < domY) {\n closestPoint = p1;\n closestSeries = setIdx;\n }\n }\n var name = this.layout_.setNames[closestSeries];\n return {\n row: row,\n seriesName: name,\n point: closestPoint\n };\n};\n\n/**\n * When the mouse moves in the canvas, display information about a nearby data\n * point and draw dots over those points in the data series. This function\n * takes care of cleanup of previously-drawn dots.\n * @param {Object} event The mousemove event from the browser.\n * @private\n */\nDygraph.prototype.mouseMove_ = function (event) {\n // This prevents JS errors when mousing over the canvas before data loads.\n var points = this.layout_.points;\n if (points === undefined || points === null) return;\n\n var canvasCoords = this.eventToDomCoords(event);\n var canvasx = canvasCoords[0];\n var canvasy = canvasCoords[1];\n\n var highlightSeriesOpts = this.getOption(\"highlightSeriesOpts\");\n var selectionChanged = false;\n if (highlightSeriesOpts && !this.isSeriesLocked()) {\n var closest;\n if (this.getBooleanOption(\"stackedGraph\")) {\n closest = this.findStackedPoint(canvasx, canvasy);\n } else {\n closest = this.findClosestPoint(canvasx, canvasy);\n }\n selectionChanged = this.setSelection(closest.row, closest.seriesName);\n } else {\n var idx = this.findClosestRow(canvasx);\n selectionChanged = this.setSelection(idx);\n }\n\n var callback = this.getFunctionOption(\"highlightCallback\");\n if (callback && selectionChanged) {\n callback.call(this, event, this.lastx_, this.selPoints_, this.lastRow_, this.highlightSet_);\n }\n};\n\n/**\n * Fetch left offset from the specified set index or if not passed, the\n * first defined boundaryIds record (see bug #236).\n * @private\n */\nDygraph.prototype.getLeftBoundary_ = function (setIdx) {\n if (this.boundaryIds_[setIdx]) {\n return this.boundaryIds_[setIdx][0];\n } else {\n for (var i = 0; i < this.boundaryIds_.length; i++) {\n if (this.boundaryIds_[i] !== undefined) {\n return this.boundaryIds_[i][0];\n }\n }\n return 0;\n }\n};\n\nDygraph.prototype.animateSelection_ = function (direction) {\n var totalSteps = 10;\n var millis = 30;\n if (this.fadeLevel === undefined) this.fadeLevel = 0;\n if (this.animateId === undefined) this.animateId = 0;\n var start = this.fadeLevel;\n var steps = direction < 0 ? start : totalSteps - start;\n if (steps <= 0) {\n if (this.fadeLevel) {\n this.updateSelection_(1.0);\n }\n return;\n }\n\n var thisId = ++this.animateId;\n var that = this;\n var cleanupIfClearing = function cleanupIfClearing() {\n // if we haven't reached fadeLevel 0 in the max frame time,\n // ensure that the clear happens and just go to 0\n if (that.fadeLevel !== 0 && direction < 0) {\n that.fadeLevel = 0;\n that.clearSelection();\n }\n };\n utils.repeatAndCleanup(function (n) {\n // ignore simultaneous animations\n if (that.animateId != thisId) return;\n\n that.fadeLevel += direction;\n if (that.fadeLevel === 0) {\n that.clearSelection();\n } else {\n that.updateSelection_(that.fadeLevel / totalSteps);\n }\n }, steps, millis, cleanupIfClearing);\n};\n\n/**\n * Draw dots over the selectied points in the data series. This function\n * takes care of cleanup of previously-drawn dots.\n * @private\n */\nDygraph.prototype.updateSelection_ = function (opt_animFraction) {\n /*var defaultPrevented = */\n this.cascadeEvents_('select', {\n selectedRow: this.lastRow_ === -1 ? undefined : this.lastRow_,\n selectedX: this.lastx_ === -1 ? undefined : this.lastx_,\n selectedPoints: this.selPoints_\n });\n // TODO(danvk): use defaultPrevented here?\n\n // Clear the previously drawn vertical, if there is one\n var i;\n var ctx = this.canvas_ctx_;\n if (this.getOption('highlightSeriesOpts')) {\n ctx.clearRect(0, 0, this.width_, this.height_);\n var alpha = 1.0 - this.getNumericOption('highlightSeriesBackgroundAlpha');\n var backgroundColor = utils.toRGB_(this.getOption('highlightSeriesBackgroundColor'));\n\n if (alpha) {\n // Activating background fade includes an animation effect for a gradual\n // fade. TODO(klausw): make this independently configurable if it causes\n // issues? Use a shared preference to control animations?\n var animateBackgroundFade = true;\n if (animateBackgroundFade) {\n if (opt_animFraction === undefined) {\n // start a new animation\n this.animateSelection_(1);\n return;\n }\n alpha *= opt_animFraction;\n }\n ctx.fillStyle = 'rgba(' + backgroundColor.r + ',' + backgroundColor.g + ',' + backgroundColor.b + ',' + alpha + ')';\n ctx.fillRect(0, 0, this.width_, this.height_);\n }\n\n // Redraw only the highlighted series in the interactive canvas (not the\n // static plot canvas, which is where series are usually drawn).\n this.plotter_._renderLineChart(this.highlightSet_, ctx);\n } else if (this.previousVerticalX_ >= 0) {\n // Determine the maximum highlight circle size.\n var maxCircleSize = 0;\n var labels = this.attr_('labels');\n for (i = 1; i < labels.length; i++) {\n var r = this.getNumericOption('highlightCircleSize', labels[i]);\n if (r > maxCircleSize) maxCircleSize = r;\n }\n var px = this.previousVerticalX_;\n ctx.clearRect(px - maxCircleSize - 1, 0, 2 * maxCircleSize + 2, this.height_);\n }\n\n if (this.selPoints_.length > 0) {\n // Draw colored circles over the center of each selected point\n var canvasx = this.selPoints_[0].canvasx;\n ctx.save();\n for (i = 0; i < this.selPoints_.length; i++) {\n var pt = this.selPoints_[i];\n if (isNaN(pt.canvasy)) continue;\n\n var circleSize = this.getNumericOption('highlightCircleSize', pt.name);\n var callback = this.getFunctionOption(\"drawHighlightPointCallback\", pt.name);\n var color = this.plotter_.colors[pt.name];\n if (!callback) {\n callback = utils.Circles.DEFAULT;\n }\n ctx.lineWidth = this.getNumericOption('strokeWidth', pt.name);\n ctx.strokeStyle = color;\n ctx.fillStyle = color;\n callback.call(this, this, pt.name, ctx, canvasx, pt.canvasy, color, circleSize, pt.idx);\n }\n ctx.restore();\n\n this.previousVerticalX_ = canvasx;\n }\n};\n\n/**\n * Manually set the selected points and display information about them in the\n * legend. The selection can be cleared using clearSelection() and queried\n * using getSelection().\n *\n * To set a selected series but not a selected point, call setSelection with\n * row=false and the selected series name.\n *\n * @param {number} row Row number that should be highlighted (i.e. appear with\n * hover dots on the chart).\n * @param {seriesName} optional series name to highlight that series with the\n * the highlightSeriesOpts setting.\n * @param { locked } optional If true, keep seriesName selected when mousing\n * over the graph, disabling closest-series highlighting. Call clearSelection()\n * to unlock it.\n */\nDygraph.prototype.setSelection = function (row, opt_seriesName, opt_locked) {\n // Extract the points we've selected\n this.selPoints_ = [];\n\n var changed = false;\n if (row !== false && row >= 0) {\n if (row != this.lastRow_) changed = true;\n this.lastRow_ = row;\n for (var setIdx = 0; setIdx < this.layout_.points.length; ++setIdx) {\n var points = this.layout_.points[setIdx];\n // Check if the point at the appropriate index is the point we're looking\n // for. If it is, just use it, otherwise search the array for a point\n // in the proper place.\n var setRow = row - this.getLeftBoundary_(setIdx);\n if (setRow >= 0 && setRow < points.length && points[setRow].idx == row) {\n var point = points[setRow];\n if (point.yval !== null) this.selPoints_.push(point);\n } else {\n for (var pointIdx = 0; pointIdx < points.length; ++pointIdx) {\n var point = points[pointIdx];\n if (point.idx == row) {\n if (point.yval !== null) {\n this.selPoints_.push(point);\n }\n break;\n }\n }\n }\n }\n } else {\n if (this.lastRow_ >= 0) changed = true;\n this.lastRow_ = -1;\n }\n\n if (this.selPoints_.length) {\n this.lastx_ = this.selPoints_[0].xval;\n } else {\n this.lastx_ = -1;\n }\n\n if (opt_seriesName !== undefined) {\n if (this.highlightSet_ !== opt_seriesName) changed = true;\n this.highlightSet_ = opt_seriesName;\n }\n\n if (opt_locked !== undefined) {\n this.lockedSet_ = opt_locked;\n }\n\n if (changed) {\n this.updateSelection_(undefined);\n }\n return changed;\n};\n\n/**\n * The mouse has left the canvas. Clear out whatever artifacts remain\n * @param {Object} event the mouseout event from the browser.\n * @private\n */\nDygraph.prototype.mouseOut_ = function (event) {\n if (this.getFunctionOption(\"unhighlightCallback\")) {\n this.getFunctionOption(\"unhighlightCallback\").call(this, event);\n }\n\n if (this.getBooleanOption(\"hideOverlayOnMouseOut\") && !this.lockedSet_) {\n this.clearSelection();\n }\n};\n\n/**\n * Clears the current selection (i.e. points that were highlighted by moving\n * the mouse over the chart).\n */\nDygraph.prototype.clearSelection = function () {\n this.cascadeEvents_('deselect', {});\n\n this.lockedSet_ = false;\n // Get rid of the overlay data\n if (this.fadeLevel) {\n this.animateSelection_(-1);\n return;\n }\n this.canvas_ctx_.clearRect(0, 0, this.width_, this.height_);\n this.fadeLevel = 0;\n this.selPoints_ = [];\n this.lastx_ = -1;\n this.lastRow_ = -1;\n this.highlightSet_ = null;\n};\n\n/**\n * Returns the number of the currently selected row. To get data for this row,\n * you can use the getValue method.\n * @return {number} row number, or -1 if nothing is selected\n */\nDygraph.prototype.getSelection = function () {\n if (!this.selPoints_ || this.selPoints_.length < 1) {\n return -1;\n }\n\n for (var setIdx = 0; setIdx < this.layout_.points.length; setIdx++) {\n var points = this.layout_.points[setIdx];\n for (var row = 0; row < points.length; row++) {\n if (points[row].x == this.selPoints_[0].x) {\n return points[row].idx;\n }\n }\n }\n return -1;\n};\n\n/**\n * Returns the name of the currently-highlighted series.\n * Only available when the highlightSeriesOpts option is in use.\n */\nDygraph.prototype.getHighlightSeries = function () {\n return this.highlightSet_;\n};\n\n/**\n * Returns true if the currently-highlighted series was locked\n * via setSelection(..., seriesName, true).\n */\nDygraph.prototype.isSeriesLocked = function () {\n return this.lockedSet_;\n};\n\n/**\n * Fires when there's data available to be graphed.\n * @param {string} data Raw CSV data to be plotted\n * @private\n */\nDygraph.prototype.loadedEvent_ = function (data) {\n this.rawData_ = this.parseCSV_(data);\n this.cascadeDataDidUpdateEvent_();\n this.predraw_();\n};\n\n/**\n * Add ticks on the x-axis representing years, months, quarters, weeks, or days\n * @private\n */\nDygraph.prototype.addXTicks_ = function () {\n // Determine the correct ticks scale on the x-axis: quarterly, monthly, ...\n var range;\n if (this.dateWindow_) {\n range = [this.dateWindow_[0], this.dateWindow_[1]];\n } else {\n range = this.xAxisExtremes();\n }\n\n var xAxisOptionsView = this.optionsViewForAxis_('x');\n var xTicks = xAxisOptionsView('ticker')(range[0], range[1], this.plotter_.area.w, // TODO(danvk): should be area.width\n xAxisOptionsView, this);\n // var msg = 'ticker(' + range[0] + ', ' + range[1] + ', ' + this.width_ + ', ' + this.attr_('pixelsPerXLabel') + ') -> ' + JSON.stringify(xTicks);\n // console.log(msg);\n this.layout_.setXTicks(xTicks);\n};\n\n/**\n * Returns the correct handler class for the currently set options.\n * @private\n */\nDygraph.prototype.getHandlerClass_ = function () {\n var handlerClass;\n if (this.attr_('dataHandler')) {\n handlerClass = this.attr_('dataHandler');\n } else if (this.fractions_) {\n if (this.getBooleanOption('errorBars')) {\n handlerClass = _datahandlerBarsFractions2['default'];\n } else {\n handlerClass = _datahandlerDefaultFractions2['default'];\n }\n } else if (this.getBooleanOption('customBars')) {\n handlerClass = _datahandlerBarsCustom2['default'];\n } else if (this.getBooleanOption('errorBars')) {\n handlerClass = _datahandlerBarsError2['default'];\n } else {\n handlerClass = _datahandlerDefault2['default'];\n }\n return handlerClass;\n};\n\n/**\n * @private\n * This function is called once when the chart's data is changed or the options\n * dictionary is updated. It is _not_ called when the user pans or zooms. The\n * idea is that values derived from the chart's data can be computed here,\n * rather than every time the chart is drawn. This includes things like the\n * number of axes, rolling averages, etc.\n */\nDygraph.prototype.predraw_ = function () {\n var start = new Date();\n\n // Create the correct dataHandler\n this.dataHandler_ = new (this.getHandlerClass_())();\n\n this.layout_.computePlotArea();\n\n // TODO(danvk): move more computations out of drawGraph_ and into here.\n this.computeYAxes_();\n\n if (!this.is_initial_draw_) {\n this.canvas_ctx_.restore();\n this.hidden_ctx_.restore();\n }\n\n this.canvas_ctx_.save();\n this.hidden_ctx_.save();\n\n // Create a new plotter.\n this.plotter_ = new _dygraphCanvas2['default'](this, this.hidden_, this.hidden_ctx_, this.layout_);\n\n // The roller sits in the bottom left corner of the chart. We don't know where\n // this will be until the options are available, so it's positioned here.\n this.createRollInterface_();\n\n this.cascadeEvents_('predraw');\n\n // Convert the raw data (a 2D array) into the internal format and compute\n // rolling averages.\n this.rolledSeries_ = [null]; // x-axis is the first series and it's special\n for (var i = 1; i < this.numColumns(); i++) {\n // var logScale = this.attr_('logscale', i); // TODO(klausw): this looks wrong // konigsberg thinks so too.\n var series = this.dataHandler_.extractSeries(this.rawData_, i, this.attributes_);\n if (this.rollPeriod_ > 1) {\n series = this.dataHandler_.rollingAverage(series, this.rollPeriod_, this.attributes_);\n }\n\n this.rolledSeries_.push(series);\n }\n\n // If the data or options have changed, then we'd better redraw.\n this.drawGraph_();\n\n // This is used to determine whether to do various animations.\n var end = new Date();\n this.drawingTimeMs_ = end - start;\n};\n\n/**\n * Point structure.\n *\n * xval_* and yval_* are the original unscaled data values,\n * while x_* and y_* are scaled to the range (0.0-1.0) for plotting.\n * yval_stacked is the cumulative Y value used for stacking graphs,\n * and bottom/top/minus/plus are used for error bar graphs.\n *\n * @typedef {{\n * idx: number,\n * name: string,\n * x: ?number,\n * xval: ?number,\n * y_bottom: ?number,\n * y: ?number,\n * y_stacked: ?number,\n * y_top: ?number,\n * yval_minus: ?number,\n * yval: ?number,\n * yval_plus: ?number,\n * yval_stacked\n * }}\n */\nDygraph.PointType = undefined;\n\n/**\n * Calculates point stacking for stackedGraph=true.\n *\n * For stacking purposes, interpolate or extend neighboring data across\n * NaN values based on stackedGraphNaNFill settings. This is for display\n * only, the underlying data value as shown in the legend remains NaN.\n *\n * @param {Array.} points Point array for a single series.\n * Updates each Point's yval_stacked property.\n * @param {Array.} cumulativeYval Accumulated top-of-graph stacked Y\n * values for the series seen so far. Index is the row number. Updated\n * based on the current series's values.\n * @param {Array.} seriesExtremes Min and max values, updated\n * to reflect the stacked values.\n * @param {string} fillMethod Interpolation method, one of 'all', 'inside', or\n * 'none'.\n * @private\n */\nDygraph.stackPoints_ = function (points, cumulativeYval, seriesExtremes, fillMethod) {\n var lastXval = null;\n var prevPoint = null;\n var nextPoint = null;\n var nextPointIdx = -1;\n\n // Find the next stackable point starting from the given index.\n var updateNextPoint = function updateNextPoint(idx) {\n // If we've previously found a non-NaN point and haven't gone past it yet,\n // just use that.\n if (nextPointIdx >= idx) return;\n\n // We haven't found a non-NaN point yet or have moved past it,\n // look towards the right to find a non-NaN point.\n for (var j = idx; j < points.length; ++j) {\n // Clear out a previously-found point (if any) since it's no longer\n // valid, we shouldn't use it for interpolation anymore.\n nextPoint = null;\n if (!isNaN(points[j].yval) && points[j].yval !== null) {\n nextPointIdx = j;\n nextPoint = points[j];\n break;\n }\n }\n };\n\n for (var i = 0; i < points.length; ++i) {\n var point = points[i];\n var xval = point.xval;\n if (cumulativeYval[xval] === undefined) {\n cumulativeYval[xval] = 0;\n }\n\n var actualYval = point.yval;\n if (isNaN(actualYval) || actualYval === null) {\n if (fillMethod == 'none') {\n actualYval = 0;\n } else {\n // Interpolate/extend for stacking purposes if possible.\n updateNextPoint(i);\n if (prevPoint && nextPoint && fillMethod != 'none') {\n // Use linear interpolation between prevPoint and nextPoint.\n actualYval = prevPoint.yval + (nextPoint.yval - prevPoint.yval) * ((xval - prevPoint.xval) / (nextPoint.xval - prevPoint.xval));\n } else if (prevPoint && fillMethod == 'all') {\n actualYval = prevPoint.yval;\n } else if (nextPoint && fillMethod == 'all') {\n actualYval = nextPoint.yval;\n } else {\n actualYval = 0;\n }\n }\n } else {\n prevPoint = point;\n }\n\n var stackedYval = cumulativeYval[xval];\n if (lastXval != xval) {\n // If an x-value is repeated, we ignore the duplicates.\n stackedYval += actualYval;\n cumulativeYval[xval] = stackedYval;\n }\n lastXval = xval;\n\n point.yval_stacked = stackedYval;\n\n if (stackedYval > seriesExtremes[1]) {\n seriesExtremes[1] = stackedYval;\n }\n if (stackedYval < seriesExtremes[0]) {\n seriesExtremes[0] = stackedYval;\n }\n }\n};\n\n/**\n * Loop over all fields and create datasets, calculating extreme y-values for\n * each series and extreme x-indices as we go.\n *\n * dateWindow is passed in as an explicit parameter so that we can compute\n * extreme values \"speculatively\", i.e. without actually setting state on the\n * dygraph.\n *\n * @param {Array.)>>} rolledSeries, where\n * rolledSeries[seriesIndex][row] = raw point, where\n * seriesIndex is the column number starting with 1, and\n * rawPoint is [x,y] or [x, [y, err]] or [x, [y, yminus, yplus]].\n * @param {?Array.} dateWindow [xmin, xmax] pair, or null.\n * @return {{\n * points: Array.>,\n * seriesExtremes: Array.>,\n * boundaryIds: Array.}}\n * @private\n */\nDygraph.prototype.gatherDatasets_ = function (rolledSeries, dateWindow) {\n var boundaryIds = [];\n var points = [];\n var cumulativeYval = []; // For stacked series.\n var extremes = {}; // series name -> [low, high]\n var seriesIdx, sampleIdx;\n var firstIdx, lastIdx;\n var axisIdx;\n\n // Loop over the fields (series). Go from the last to the first,\n // because if they're stacked that's how we accumulate the values.\n var num_series = rolledSeries.length - 1;\n var series;\n for (seriesIdx = num_series; seriesIdx >= 1; seriesIdx--) {\n if (!this.visibility()[seriesIdx - 1]) continue;\n\n // Prune down to the desired range, if necessary (for zooming)\n // Because there can be lines going to points outside of the visible area,\n // we actually prune to visible points, plus one on either side.\n if (dateWindow) {\n series = rolledSeries[seriesIdx];\n var low = dateWindow[0];\n var high = dateWindow[1];\n\n // TODO(danvk): do binary search instead of linear search.\n // TODO(danvk): pass firstIdx and lastIdx directly to the renderer.\n firstIdx = null;\n lastIdx = null;\n for (sampleIdx = 0; sampleIdx < series.length; sampleIdx++) {\n if (series[sampleIdx][0] >= low && firstIdx === null) {\n firstIdx = sampleIdx;\n }\n if (series[sampleIdx][0] <= high) {\n lastIdx = sampleIdx;\n }\n }\n\n if (firstIdx === null) firstIdx = 0;\n var correctedFirstIdx = firstIdx;\n var isInvalidValue = true;\n while (isInvalidValue && correctedFirstIdx > 0) {\n correctedFirstIdx--;\n // check if the y value is null.\n isInvalidValue = series[correctedFirstIdx][1] === null;\n }\n\n if (lastIdx === null) lastIdx = series.length - 1;\n var correctedLastIdx = lastIdx;\n isInvalidValue = true;\n while (isInvalidValue && correctedLastIdx < series.length - 1) {\n correctedLastIdx++;\n isInvalidValue = series[correctedLastIdx][1] === null;\n }\n\n if (correctedFirstIdx !== firstIdx) {\n firstIdx = correctedFirstIdx;\n }\n if (correctedLastIdx !== lastIdx) {\n lastIdx = correctedLastIdx;\n }\n\n boundaryIds[seriesIdx - 1] = [firstIdx, lastIdx];\n\n // .slice's end is exclusive, we want to include lastIdx.\n series = series.slice(firstIdx, lastIdx + 1);\n } else {\n series = rolledSeries[seriesIdx];\n boundaryIds[seriesIdx - 1] = [0, series.length - 1];\n }\n\n var seriesName = this.attr_(\"labels\")[seriesIdx];\n var seriesExtremes = this.dataHandler_.getExtremeYValues(series, dateWindow, this.getBooleanOption(\"stepPlot\", seriesName));\n\n var seriesPoints = this.dataHandler_.seriesToPoints(series, seriesName, boundaryIds[seriesIdx - 1][0]);\n\n if (this.getBooleanOption(\"stackedGraph\")) {\n axisIdx = this.attributes_.axisForSeries(seriesName);\n if (cumulativeYval[axisIdx] === undefined) {\n cumulativeYval[axisIdx] = [];\n }\n Dygraph.stackPoints_(seriesPoints, cumulativeYval[axisIdx], seriesExtremes, this.getBooleanOption(\"stackedGraphNaNFill\"));\n }\n\n extremes[seriesName] = seriesExtremes;\n points[seriesIdx] = seriesPoints;\n }\n\n return { points: points, extremes: extremes, boundaryIds: boundaryIds };\n};\n\n/**\n * Update the graph with new data. This method is called when the viewing area\n * has changed. If the underlying data or options have changed, predraw_ will\n * be called before drawGraph_ is called.\n *\n * @private\n */\nDygraph.prototype.drawGraph_ = function () {\n var start = new Date();\n\n // This is used to set the second parameter to drawCallback, below.\n var is_initial_draw = this.is_initial_draw_;\n this.is_initial_draw_ = false;\n\n this.layout_.removeAllDatasets();\n this.setColors_();\n this.attrs_.pointSize = 0.5 * this.getNumericOption('highlightCircleSize');\n\n var packed = this.gatherDatasets_(this.rolledSeries_, this.dateWindow_);\n var points = packed.points;\n var extremes = packed.extremes;\n this.boundaryIds_ = packed.boundaryIds;\n\n this.setIndexByName_ = {};\n var labels = this.attr_(\"labels\");\n var dataIdx = 0;\n for (var i = 1; i < points.length; i++) {\n if (!this.visibility()[i - 1]) continue;\n this.layout_.addDataset(labels[i], points[i]);\n this.datasetIndex_[i] = dataIdx++;\n }\n for (var i = 0; i < labels.length; i++) {\n this.setIndexByName_[labels[i]] = i;\n }\n\n this.computeYAxisRanges_(extremes);\n this.layout_.setYAxes(this.axes_);\n\n this.addXTicks_();\n\n // Tell PlotKit to use this new data and render itself\n this.layout_.evaluate();\n this.renderGraph_(is_initial_draw);\n\n if (this.getStringOption(\"timingName\")) {\n var end = new Date();\n console.log(this.getStringOption(\"timingName\") + \" - drawGraph: \" + (end - start) + \"ms\");\n }\n};\n\n/**\n * This does the work of drawing the chart. It assumes that the layout and axis\n * scales have already been set (e.g. by predraw_).\n *\n * @private\n */\nDygraph.prototype.renderGraph_ = function (is_initial_draw) {\n this.cascadeEvents_('clearChart');\n this.plotter_.clear();\n\n var underlayCallback = this.getFunctionOption('underlayCallback');\n if (underlayCallback) {\n // NOTE: we pass the dygraph object to this callback twice to avoid breaking\n // users who expect a deprecated form of this callback.\n underlayCallback.call(this, this.hidden_ctx_, this.layout_.getPlotArea(), this, this);\n }\n\n var e = {\n canvas: this.hidden_,\n drawingContext: this.hidden_ctx_\n };\n this.cascadeEvents_('willDrawChart', e);\n this.plotter_.render();\n this.cascadeEvents_('didDrawChart', e);\n this.lastRow_ = -1; // because plugins/legend.js clears the legend\n\n // TODO(danvk): is this a performance bottleneck when panning?\n // The interaction canvas should already be empty in that situation.\n this.canvas_.getContext('2d').clearRect(0, 0, this.width_, this.height_);\n\n var drawCallback = this.getFunctionOption(\"drawCallback\");\n if (drawCallback !== null) {\n drawCallback.call(this, this, is_initial_draw);\n }\n if (is_initial_draw) {\n this.readyFired_ = true;\n while (this.readyFns_.length > 0) {\n var fn = this.readyFns_.pop();\n fn(this);\n }\n }\n};\n\n/**\n * @private\n * Determine properties of the y-axes which are independent of the data\n * currently being displayed. This includes things like the number of axes and\n * the style of the axes. It does not include the range of each axis and its\n * tick marks.\n * This fills in this.axes_.\n * axes_ = [ { options } ]\n * indices are into the axes_ array.\n */\nDygraph.prototype.computeYAxes_ = function () {\n var axis, index, opts, v;\n\n // this.axes_ doesn't match this.attributes_.axes_.options. It's used for\n // data computation as well as options storage.\n // Go through once and add all the axes.\n this.axes_ = [];\n\n for (axis = 0; axis < this.attributes_.numAxes(); axis++) {\n // Add a new axis, making a copy of its per-axis options.\n opts = { g: this };\n utils.update(opts, this.attributes_.axisOptions(axis));\n this.axes_[axis] = opts;\n }\n\n for (axis = 0; axis < this.axes_.length; axis++) {\n if (axis === 0) {\n opts = this.optionsViewForAxis_('y' + (axis ? '2' : ''));\n v = opts(\"valueRange\");\n if (v) this.axes_[axis].valueRange = v;\n } else {\n // To keep old behavior\n var axes = this.user_attrs_.axes;\n if (axes && axes.y2) {\n v = axes.y2.valueRange;\n if (v) this.axes_[axis].valueRange = v;\n }\n }\n }\n};\n\n/**\n * Returns the number of y-axes on the chart.\n * @return {number} the number of axes.\n */\nDygraph.prototype.numAxes = function () {\n return this.attributes_.numAxes();\n};\n\n/**\n * @private\n * Returns axis properties for the given series.\n * @param {string} setName The name of the series for which to get axis\n * properties, e.g. 'Y1'.\n * @return {Object} The axis properties.\n */\nDygraph.prototype.axisPropertiesForSeries = function (series) {\n // TODO(danvk): handle errors.\n return this.axes_[this.attributes_.axisForSeries(series)];\n};\n\n/**\n * @private\n * Determine the value range and tick marks for each axis.\n * @param {Object} extremes A mapping from seriesName -> [low, high]\n * This fills in the valueRange and ticks fields in each entry of this.axes_.\n */\nDygraph.prototype.computeYAxisRanges_ = function (extremes) {\n var isNullUndefinedOrNaN = function isNullUndefinedOrNaN(num) {\n return isNaN(parseFloat(num));\n };\n var numAxes = this.attributes_.numAxes();\n var ypadCompat, span, series, ypad;\n\n var p_axis;\n\n // Compute extreme values, a span and tick marks for each axis.\n for (var i = 0; i < numAxes; i++) {\n var axis = this.axes_[i];\n var logscale = this.attributes_.getForAxis(\"logscale\", i);\n var includeZero = this.attributes_.getForAxis(\"includeZero\", i);\n var independentTicks = this.attributes_.getForAxis(\"independentTicks\", i);\n series = this.attributes_.seriesForAxis(i);\n\n // Add some padding. This supports two Y padding operation modes:\n //\n // - backwards compatible (yRangePad not set):\n // 10% padding for automatic Y ranges, but not for user-supplied\n // ranges, and move a close-to-zero edge to zero, since drawing at the edge\n // results in invisible lines. Unfortunately lines drawn at the edge of a\n // user-supplied range will still be invisible. If logscale is\n // set, add a variable amount of padding at the top but\n // none at the bottom.\n //\n // - new-style (yRangePad set by the user):\n // always add the specified Y padding.\n //\n ypadCompat = true;\n ypad = 0.1; // add 10%\n var yRangePad = this.getNumericOption('yRangePad');\n if (yRangePad !== null) {\n ypadCompat = false;\n // Convert pixel padding to ratio\n ypad = yRangePad / this.plotter_.area.h;\n }\n\n if (series.length === 0) {\n // If no series are defined or visible then use a reasonable default\n axis.extremeRange = [0, 1];\n } else {\n // Calculate the extremes of extremes.\n var minY = Infinity; // extremes[series[0]][0];\n var maxY = -Infinity; // extremes[series[0]][1];\n var extremeMinY, extremeMaxY;\n\n for (var j = 0; j < series.length; j++) {\n // this skips invisible series\n if (!extremes.hasOwnProperty(series[j])) continue;\n\n // Only use valid extremes to stop null data series' from corrupting the scale.\n extremeMinY = extremes[series[j]][0];\n if (extremeMinY !== null) {\n minY = Math.min(extremeMinY, minY);\n }\n extremeMaxY = extremes[series[j]][1];\n if (extremeMaxY !== null) {\n maxY = Math.max(extremeMaxY, maxY);\n }\n }\n\n // Include zero if requested by the user.\n if (includeZero && !logscale) {\n if (minY > 0) minY = 0;\n if (maxY < 0) maxY = 0;\n }\n\n // Ensure we have a valid scale, otherwise default to [0, 1] for safety.\n if (minY == Infinity) minY = 0;\n if (maxY == -Infinity) maxY = 1;\n\n span = maxY - minY;\n // special case: if we have no sense of scale, center on the sole value.\n if (span === 0) {\n if (maxY !== 0) {\n span = Math.abs(maxY);\n } else {\n // ... and if the sole value is zero, use range 0-1.\n maxY = 1;\n span = 1;\n }\n }\n\n var maxAxisY = maxY,\n minAxisY = minY;\n if (ypadCompat) {\n if (logscale) {\n maxAxisY = maxY + ypad * span;\n minAxisY = minY;\n } else {\n maxAxisY = maxY + ypad * span;\n minAxisY = minY - ypad * span;\n\n // Backwards-compatible behavior: Move the span to start or end at zero if it's\n // close to zero.\n if (minAxisY < 0 && minY >= 0) minAxisY = 0;\n if (maxAxisY > 0 && maxY <= 0) maxAxisY = 0;\n }\n }\n axis.extremeRange = [minAxisY, maxAxisY];\n }\n if (axis.valueRange) {\n // This is a user-set value range for this axis.\n var y0 = isNullUndefinedOrNaN(axis.valueRange[0]) ? axis.extremeRange[0] : axis.valueRange[0];\n var y1 = isNullUndefinedOrNaN(axis.valueRange[1]) ? axis.extremeRange[1] : axis.valueRange[1];\n axis.computedValueRange = [y0, y1];\n } else {\n axis.computedValueRange = axis.extremeRange;\n }\n if (!ypadCompat) {\n // When using yRangePad, adjust the upper/lower bounds to add\n // padding unless the user has zoomed/panned the Y axis range.\n if (logscale) {\n y0 = axis.computedValueRange[0];\n y1 = axis.computedValueRange[1];\n var y0pct = ypad / (2 * ypad - 1);\n var y1pct = (ypad - 1) / (2 * ypad - 1);\n axis.computedValueRange[0] = utils.logRangeFraction(y0, y1, y0pct);\n axis.computedValueRange[1] = utils.logRangeFraction(y0, y1, y1pct);\n } else {\n y0 = axis.computedValueRange[0];\n y1 = axis.computedValueRange[1];\n span = y1 - y0;\n axis.computedValueRange[0] = y0 - span * ypad;\n axis.computedValueRange[1] = y1 + span * ypad;\n }\n }\n\n if (independentTicks) {\n axis.independentTicks = independentTicks;\n var opts = this.optionsViewForAxis_('y' + (i ? '2' : ''));\n var ticker = opts('ticker');\n axis.ticks = ticker(axis.computedValueRange[0], axis.computedValueRange[1], this.plotter_.area.h, opts, this);\n // Define the first independent axis as primary axis.\n if (!p_axis) p_axis = axis;\n }\n }\n if (p_axis === undefined) {\n throw \"Configuration Error: At least one axis has to have the \\\"independentTicks\\\" option activated.\";\n }\n // Add ticks. By default, all axes inherit the tick positions of the\n // primary axis. However, if an axis is specifically marked as having\n // independent ticks, then that is permissible as well.\n for (var i = 0; i < numAxes; i++) {\n var axis = this.axes_[i];\n\n if (!axis.independentTicks) {\n var opts = this.optionsViewForAxis_('y' + (i ? '2' : ''));\n var ticker = opts('ticker');\n var p_ticks = p_axis.ticks;\n var p_scale = p_axis.computedValueRange[1] - p_axis.computedValueRange[0];\n var scale = axis.computedValueRange[1] - axis.computedValueRange[0];\n var tick_values = [];\n for (var k = 0; k < p_ticks.length; k++) {\n var y_frac = (p_ticks[k].v - p_axis.computedValueRange[0]) / p_scale;\n var y_val = axis.computedValueRange[0] + y_frac * scale;\n tick_values.push(y_val);\n }\n\n axis.ticks = ticker(axis.computedValueRange[0], axis.computedValueRange[1], this.plotter_.area.h, opts, this, tick_values);\n }\n }\n};\n\n/**\n * Detects the type of the str (date or numeric) and sets the various\n * formatting attributes in this.attrs_ based on this type.\n * @param {string} str An x value.\n * @private\n */\nDygraph.prototype.detectTypeFromString_ = function (str) {\n var isDate = false;\n var dashPos = str.indexOf('-'); // could be 2006-01-01 _or_ 1.0e-2\n if (dashPos > 0 && str[dashPos - 1] != 'e' && str[dashPos - 1] != 'E' || str.indexOf('/') >= 0 || isNaN(parseFloat(str))) {\n isDate = true;\n } else if (str.length == 8 && str > '19700101' && str < '20371231') {\n // TODO(danvk): remove support for this format.\n isDate = true;\n }\n\n this.setXAxisOptions_(isDate);\n};\n\nDygraph.prototype.setXAxisOptions_ = function (isDate) {\n if (isDate) {\n this.attrs_.xValueParser = utils.dateParser;\n this.attrs_.axes.x.valueFormatter = utils.dateValueFormatter;\n this.attrs_.axes.x.ticker = DygraphTickers.dateTicker;\n this.attrs_.axes.x.axisLabelFormatter = utils.dateAxisLabelFormatter;\n } else {\n /** @private (shut up, jsdoc!) */\n this.attrs_.xValueParser = function (x) {\n return parseFloat(x);\n };\n // TODO(danvk): use Dygraph.numberValueFormatter here?\n /** @private (shut up, jsdoc!) */\n this.attrs_.axes.x.valueFormatter = function (x) {\n return x;\n };\n this.attrs_.axes.x.ticker = DygraphTickers.numericTicks;\n this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter;\n }\n};\n\n/**\n * @private\n * Parses a string in a special csv format. We expect a csv file where each\n * line is a date point, and the first field in each line is the date string.\n * We also expect that all remaining fields represent series.\n * if the errorBars attribute is set, then interpret the fields as:\n * date, series1, stddev1, series2, stddev2, ...\n * @param {[Object]} data See above.\n *\n * @return [Object] An array with one entry for each row. These entries\n * are an array of cells in that row. The first entry is the parsed x-value for\n * the row. The second, third, etc. are the y-values. These can take on one of\n * three forms, depending on the CSV and constructor parameters:\n * 1. numeric value\n * 2. [ value, stddev ]\n * 3. [ low value, center value, high value ]\n */\nDygraph.prototype.parseCSV_ = function (data) {\n var ret = [];\n var line_delimiter = utils.detectLineDelimiter(data);\n var lines = data.split(line_delimiter || \"\\n\");\n var vals, j;\n\n // Use the default delimiter or fall back to a tab if that makes sense.\n var delim = this.getStringOption('delimiter');\n if (lines[0].indexOf(delim) == -1 && lines[0].indexOf('\\t') >= 0) {\n delim = '\\t';\n }\n\n var start = 0;\n if (!('labels' in this.user_attrs_)) {\n // User hasn't explicitly set labels, so they're (presumably) in the CSV.\n start = 1;\n this.attrs_.labels = lines[0].split(delim); // NOTE: _not_ user_attrs_.\n this.attributes_.reparseSeries();\n }\n var line_no = 0;\n\n var xParser;\n var defaultParserSet = false; // attempt to auto-detect x value type\n var expectedCols = this.attr_(\"labels\").length;\n var outOfOrder = false;\n for (var i = start; i < lines.length; i++) {\n var line = lines[i];\n line_no = i;\n if (line.length === 0) continue; // skip blank lines\n if (line[0] == '#') continue; // skip comment lines\n var inFields = line.split(delim);\n if (inFields.length < 2) continue;\n\n var fields = [];\n if (!defaultParserSet) {\n this.detectTypeFromString_(inFields[0]);\n xParser = this.getFunctionOption(\"xValueParser\");\n defaultParserSet = true;\n }\n fields[0] = xParser(inFields[0], this);\n\n // If fractions are expected, parse the numbers as \"A/B\"\n if (this.fractions_) {\n for (j = 1; j < inFields.length; j++) {\n // TODO(danvk): figure out an appropriate way to flag parse errors.\n vals = inFields[j].split(\"/\");\n if (vals.length != 2) {\n console.error('Expected fractional \"num/den\" values in CSV data ' + \"but found a value '\" + inFields[j] + \"' on line \" + (1 + i) + \" ('\" + line + \"') which is not of this form.\");\n fields[j] = [0, 0];\n } else {\n fields[j] = [utils.parseFloat_(vals[0], i, line), utils.parseFloat_(vals[1], i, line)];\n }\n }\n } else if (this.getBooleanOption(\"errorBars\")) {\n // If there are error bars, values are (value, stddev) pairs\n if (inFields.length % 2 != 1) {\n console.error('Expected alternating (value, stdev.) pairs in CSV data ' + 'but line ' + (1 + i) + ' has an odd number of values (' + (inFields.length - 1) + \"): '\" + line + \"'\");\n }\n for (j = 1; j < inFields.length; j += 2) {\n fields[(j + 1) / 2] = [utils.parseFloat_(inFields[j], i, line), utils.parseFloat_(inFields[j + 1], i, line)];\n }\n } else if (this.getBooleanOption(\"customBars\")) {\n // Bars are a low;center;high tuple\n for (j = 1; j < inFields.length; j++) {\n var val = inFields[j];\n if (/^ *$/.test(val)) {\n fields[j] = [null, null, null];\n } else {\n vals = val.split(\";\");\n if (vals.length == 3) {\n fields[j] = [utils.parseFloat_(vals[0], i, line), utils.parseFloat_(vals[1], i, line), utils.parseFloat_(vals[2], i, line)];\n } else {\n console.warn('When using customBars, values must be either blank ' + 'or \"low;center;high\" tuples (got \"' + val + '\" on line ' + (1 + i));\n }\n }\n }\n } else {\n // Values are just numbers\n for (j = 1; j < inFields.length; j++) {\n fields[j] = utils.parseFloat_(inFields[j], i, line);\n }\n }\n if (ret.length > 0 && fields[0] < ret[ret.length - 1][0]) {\n outOfOrder = true;\n }\n\n if (fields.length != expectedCols) {\n console.error(\"Number of columns in line \" + i + \" (\" + fields.length + \") does not agree with number of labels (\" + expectedCols + \") \" + line);\n }\n\n // If the user specified the 'labels' option and none of the cells of the\n // first row parsed correctly, then they probably double-specified the\n // labels. We go with the values set in the option, discard this row and\n // log a warning to the JS console.\n if (i === 0 && this.attr_('labels')) {\n var all_null = true;\n for (j = 0; all_null && j < fields.length; j++) {\n if (fields[j]) all_null = false;\n }\n if (all_null) {\n console.warn(\"The dygraphs 'labels' option is set, but the first row \" + \"of CSV data ('\" + line + \"') appears to also contain \" + \"labels. Will drop the CSV labels and use the option \" + \"labels.\");\n continue;\n }\n }\n ret.push(fields);\n }\n\n if (outOfOrder) {\n console.warn(\"CSV is out of order; order it correctly to speed loading.\");\n ret.sort(function (a, b) {\n return a[0] - b[0];\n });\n }\n\n return ret;\n};\n\n// In native format, all values must be dates or numbers.\n// This check isn't perfect but will catch most mistaken uses of strings.\nfunction validateNativeFormat(data) {\n var firstRow = data[0];\n var firstX = firstRow[0];\n if (typeof firstX !== 'number' && !utils.isDateLike(firstX)) {\n throw new Error('Expected number or date but got ' + typeof firstX + ': ' + firstX + '.');\n }\n for (var i = 1; i < firstRow.length; i++) {\n var val = firstRow[i];\n if (val === null || val === undefined) continue;\n if (typeof val === 'number') continue;\n if (utils.isArrayLike(val)) continue; // e.g. error bars or custom bars.\n throw new Error('Expected number or array but got ' + typeof val + ': ' + val + '.');\n }\n}\n\n/**\n * The user has provided their data as a pre-packaged JS array. If the x values\n * are numeric, this is the same as dygraphs' internal format. If the x values\n * are dates, we need to convert them from Date objects to ms since epoch.\n * @param {!Array} data\n * @return {Object} data with numeric x values.\n * @private\n */\nDygraph.prototype.parseArray_ = function (data) {\n // Peek at the first x value to see if it's numeric.\n if (data.length === 0) {\n console.error(\"Can't plot empty data set\");\n return null;\n }\n if (data[0].length === 0) {\n console.error(\"Data set cannot contain an empty row\");\n return null;\n }\n\n validateNativeFormat(data);\n\n var i;\n if (this.attr_(\"labels\") === null) {\n console.warn(\"Using default labels. Set labels explicitly via 'labels' \" + \"in the options parameter\");\n this.attrs_.labels = [\"X\"];\n for (i = 1; i < data[0].length; i++) {\n this.attrs_.labels.push(\"Y\" + i); // Not user_attrs_.\n }\n this.attributes_.reparseSeries();\n } else {\n var num_labels = this.attr_(\"labels\");\n if (num_labels.length != data[0].length) {\n console.error(\"Mismatch between number of labels (\" + num_labels + \")\" + \" and number of columns in array (\" + data[0].length + \")\");\n return null;\n }\n }\n\n if (utils.isDateLike(data[0][0])) {\n // Some intelligent defaults for a date x-axis.\n this.attrs_.axes.x.valueFormatter = utils.dateValueFormatter;\n this.attrs_.axes.x.ticker = DygraphTickers.dateTicker;\n this.attrs_.axes.x.axisLabelFormatter = utils.dateAxisLabelFormatter;\n\n // Assume they're all dates.\n var parsedData = utils.clone(data);\n for (i = 0; i < data.length; i++) {\n if (parsedData[i].length === 0) {\n console.error(\"Row \" + (1 + i) + \" of data is empty\");\n return null;\n }\n if (parsedData[i][0] === null || typeof parsedData[i][0].getTime != 'function' || isNaN(parsedData[i][0].getTime())) {\n console.error(\"x value in row \" + (1 + i) + \" is not a Date\");\n return null;\n }\n parsedData[i][0] = parsedData[i][0].getTime();\n }\n return parsedData;\n } else {\n // Some intelligent defaults for a numeric x-axis.\n /** @private (shut up, jsdoc!) */\n this.attrs_.axes.x.valueFormatter = function (x) {\n return x;\n };\n this.attrs_.axes.x.ticker = DygraphTickers.numericTicks;\n this.attrs_.axes.x.axisLabelFormatter = utils.numberAxisLabelFormatter;\n return data;\n }\n};\n\n/**\n * Parses a DataTable object from gviz.\n * The data is expected to have a first column that is either a date or a\n * number. All subsequent columns must be numbers. If there is a clear mismatch\n * between this.xValueParser_ and the type of the first column, it will be\n * fixed. Fills out rawData_.\n * @param {!google.visualization.DataTable} data See above.\n * @private\n */\nDygraph.prototype.parseDataTable_ = function (data) {\n var shortTextForAnnotationNum = function shortTextForAnnotationNum(num) {\n // converts [0-9]+ [A-Z][a-z]*\n // example: 0=A, 1=B, 25=Z, 26=Aa, 27=Ab\n // and continues like.. Ba Bb .. Za .. Zz..Aaa...Zzz Aaaa Zzzz\n var shortText = String.fromCharCode(65 /* A */ + num % 26);\n num = Math.floor(num / 26);\n while (num > 0) {\n shortText = String.fromCharCode(65 /* A */ + (num - 1) % 26) + shortText.toLowerCase();\n num = Math.floor((num - 1) / 26);\n }\n return shortText;\n };\n\n var cols = data.getNumberOfColumns();\n var rows = data.getNumberOfRows();\n\n var indepType = data.getColumnType(0);\n if (indepType == 'date' || indepType == 'datetime') {\n this.attrs_.xValueParser = utils.dateParser;\n this.attrs_.axes.x.valueFormatter = utils.dateValueFormatter;\n this.attrs_.axes.x.ticker = DygraphTickers.dateTicker;\n this.attrs_.axes.x.axisLabelFormatter = utils.dateAxisLabelFormatter;\n } else if (indepType == 'number') {\n this.attrs_.xValueParser = function (x) {\n return parseFloat(x);\n };\n this.attrs_.axes.x.valueFormatter = function (x) {\n return x;\n };\n this.attrs_.axes.x.ticker = DygraphTickers.numericTicks;\n this.attrs_.axes.x.axisLabelFormatter = this.attrs_.axes.x.valueFormatter;\n } else {\n throw new Error(\"only 'date', 'datetime' and 'number' types are supported \" + \"for column 1 of DataTable input (Got '\" + indepType + \"')\");\n }\n\n // Array of the column indices which contain data (and not annotations).\n var colIdx = [];\n var annotationCols = {}; // data index -> [annotation cols]\n var hasAnnotations = false;\n var i, j;\n for (i = 1; i < cols; i++) {\n var type = data.getColumnType(i);\n if (type == 'number') {\n colIdx.push(i);\n } else if (type == 'string' && this.getBooleanOption('displayAnnotations')) {\n // This is OK -- it's an annotation column.\n var dataIdx = colIdx[colIdx.length - 1];\n if (!annotationCols.hasOwnProperty(dataIdx)) {\n annotationCols[dataIdx] = [i];\n } else {\n annotationCols[dataIdx].push(i);\n }\n hasAnnotations = true;\n } else {\n throw new Error(\"Only 'number' is supported as a dependent type with Gviz.\" + \" 'string' is only supported if displayAnnotations is true\");\n }\n }\n\n // Read column labels\n // TODO(danvk): add support back for errorBars\n var labels = [data.getColumnLabel(0)];\n for (i = 0; i < colIdx.length; i++) {\n labels.push(data.getColumnLabel(colIdx[i]));\n if (this.getBooleanOption(\"errorBars\")) i += 1;\n }\n this.attrs_.labels = labels;\n cols = labels.length;\n\n var ret = [];\n var outOfOrder = false;\n var annotations = [];\n for (i = 0; i < rows; i++) {\n var row = [];\n if (typeof data.getValue(i, 0) === 'undefined' || data.getValue(i, 0) === null) {\n console.warn(\"Ignoring row \" + i + \" of DataTable because of undefined or null first column.\");\n continue;\n }\n\n if (indepType == 'date' || indepType == 'datetime') {\n row.push(data.getValue(i, 0).getTime());\n } else {\n row.push(data.getValue(i, 0));\n }\n if (!this.getBooleanOption(\"errorBars\")) {\n for (j = 0; j < colIdx.length; j++) {\n var col = colIdx[j];\n row.push(data.getValue(i, col));\n if (hasAnnotations && annotationCols.hasOwnProperty(col) && data.getValue(i, annotationCols[col][0]) !== null) {\n var ann = {};\n ann.series = data.getColumnLabel(col);\n ann.xval = row[0];\n ann.shortText = shortTextForAnnotationNum(annotations.length);\n ann.text = '';\n for (var k = 0; k < annotationCols[col].length; k++) {\n if (k) ann.text += \"\\n\";\n ann.text += data.getValue(i, annotationCols[col][k]);\n }\n annotations.push(ann);\n }\n }\n\n // Strip out infinities, which give dygraphs problems later on.\n for (j = 0; j < row.length; j++) {\n if (!isFinite(row[j])) row[j] = null;\n }\n } else {\n for (j = 0; j < cols - 1; j++) {\n row.push([data.getValue(i, 1 + 2 * j), data.getValue(i, 2 + 2 * j)]);\n }\n }\n if (ret.length > 0 && row[0] < ret[ret.length - 1][0]) {\n outOfOrder = true;\n }\n ret.push(row);\n }\n\n if (outOfOrder) {\n console.warn(\"DataTable is out of order; order it correctly to speed loading.\");\n ret.sort(function (a, b) {\n return a[0] - b[0];\n });\n }\n this.rawData_ = ret;\n\n if (annotations.length > 0) {\n this.setAnnotations(annotations, true);\n }\n this.attributes_.reparseSeries();\n};\n\n/**\n * Signals to plugins that the chart data has updated.\n * This happens after the data has updated but before the chart has redrawn.\n * @private\n */\nDygraph.prototype.cascadeDataDidUpdateEvent_ = function () {\n // TODO(danvk): there are some issues checking xAxisRange() and using\n // toDomCoords from handlers of this event. The visible range should be set\n // when the chart is drawn, not derived from the data.\n this.cascadeEvents_('dataDidUpdate', {});\n};\n\n/**\n * Get the CSV data. If it's in a function, call that function. If it's in a\n * file, do an XMLHttpRequest to get it.\n * @private\n */\nDygraph.prototype.start_ = function () {\n var data = this.file_;\n\n // Functions can return references of all other types.\n if (typeof data == 'function') {\n data = data();\n }\n\n if (utils.isArrayLike(data)) {\n this.rawData_ = this.parseArray_(data);\n this.cascadeDataDidUpdateEvent_();\n this.predraw_();\n } else if (typeof data == 'object' && typeof data.getColumnRange == 'function') {\n // must be a DataTable from gviz.\n this.parseDataTable_(data);\n this.cascadeDataDidUpdateEvent_();\n this.predraw_();\n } else if (typeof data == 'string') {\n // Heuristic: a newline means it's CSV data. Otherwise it's an URL.\n var line_delimiter = utils.detectLineDelimiter(data);\n if (line_delimiter) {\n this.loadedEvent_(data);\n } else {\n // REMOVE_FOR_IE\n var req;\n if (window.XMLHttpRequest) {\n // Firefox, Opera, IE7, and other browsers will use the native object\n req = new XMLHttpRequest();\n } else {\n // IE 5 and 6 will use the ActiveX control\n req = new ActiveXObject(\"Microsoft.XMLHTTP\");\n }\n\n var caller = this;\n req.onreadystatechange = function () {\n if (req.readyState == 4) {\n if (req.status === 200 || // Normal http\n req.status === 0) {\n // Chrome w/ --allow-file-access-from-files\n caller.loadedEvent_(req.responseText);\n }\n }\n };\n\n req.open(\"GET\", data, true);\n req.send(null);\n }\n } else {\n console.error(\"Unknown data format: \" + typeof data);\n }\n};\n\n/**\n * Changes various properties of the graph. These can include:\n *
      \n *
    • file: changes the source data for the graph
    • \n *
    • errorBars: changes whether the data contains stddev
    • \n *
    \n *\n * There's a huge variety of options that can be passed to this method. For a\n * full list, see http://dygraphs.com/options.html.\n *\n * @param {Object} input_attrs The new properties and values\n * @param {boolean} block_redraw Usually the chart is redrawn after every\n * call to updateOptions(). If you know better, you can pass true to\n * explicitly block the redraw. This can be useful for chaining\n * updateOptions() calls, avoiding the occasional infinite loop and\n * preventing redraws when it's not necessary (e.g. when updating a\n * callback).\n */\nDygraph.prototype.updateOptions = function (input_attrs, block_redraw) {\n if (typeof block_redraw == 'undefined') block_redraw = false;\n\n // copyUserAttrs_ drops the \"file\" parameter as a convenience to us.\n var file = input_attrs.file;\n var attrs = Dygraph.copyUserAttrs_(input_attrs);\n\n // TODO(danvk): this is a mess. Move these options into attr_.\n if ('rollPeriod' in attrs) {\n this.rollPeriod_ = attrs.rollPeriod;\n }\n if ('dateWindow' in attrs) {\n this.dateWindow_ = attrs.dateWindow;\n }\n\n // TODO(danvk): validate per-series options.\n // Supported:\n // strokeWidth\n // pointSize\n // drawPoints\n // highlightCircleSize\n\n // Check if this set options will require new points.\n var requiresNewPoints = utils.isPixelChangingOptionList(this.attr_(\"labels\"), attrs);\n\n utils.updateDeep(this.user_attrs_, attrs);\n\n this.attributes_.reparseSeries();\n\n if (file) {\n // This event indicates that the data is about to change, but hasn't yet.\n // TODO(danvk): support cancellation of the update via this event.\n this.cascadeEvents_('dataWillUpdate', {});\n\n this.file_ = file;\n if (!block_redraw) this.start_();\n } else {\n if (!block_redraw) {\n if (requiresNewPoints) {\n this.predraw_();\n } else {\n this.renderGraph_(false);\n }\n }\n }\n};\n\n/**\n * Make a copy of input attributes, removing file as a convenience.\n * @private\n */\nDygraph.copyUserAttrs_ = function (attrs) {\n var my_attrs = {};\n for (var k in attrs) {\n if (!attrs.hasOwnProperty(k)) continue;\n if (k == 'file') continue;\n if (attrs.hasOwnProperty(k)) my_attrs[k] = attrs[k];\n }\n return my_attrs;\n};\n\n/**\n * Resizes the dygraph. If no parameters are specified, resizes to fill the\n * containing div (which has presumably changed size since the dygraph was\n * instantiated. If the width/height are specified, the div will be resized.\n *\n * This is far more efficient than destroying and re-instantiating a\n * Dygraph, since it doesn't have to reparse the underlying data.\n *\n * @param {number} width Width (in pixels)\n * @param {number} height Height (in pixels)\n */\nDygraph.prototype.resize = function (width, height) {\n if (this.resize_lock) {\n return;\n }\n this.resize_lock = true;\n\n if (width === null != (height === null)) {\n console.warn(\"Dygraph.resize() should be called with zero parameters or \" + \"two non-NULL parameters. Pretending it was zero.\");\n width = height = null;\n }\n\n var old_width = this.width_;\n var old_height = this.height_;\n\n if (width) {\n this.maindiv_.style.width = width + \"px\";\n this.maindiv_.style.height = height + \"px\";\n this.width_ = width;\n this.height_ = height;\n } else {\n this.width_ = this.maindiv_.clientWidth;\n this.height_ = this.maindiv_.clientHeight;\n }\n\n if (old_width != this.width_ || old_height != this.height_) {\n // Resizing a canvas erases it, even when the size doesn't change, so\n // any resize needs to be followed by a redraw.\n this.resizeElements_();\n this.predraw_();\n }\n\n this.resize_lock = false;\n};\n\n/**\n * Adjusts the number of points in the rolling average. Updates the graph to\n * reflect the new averaging period.\n * @param {number} length Number of points over which to average the data.\n */\nDygraph.prototype.adjustRoll = function (length) {\n this.rollPeriod_ = length;\n this.predraw_();\n};\n\n/**\n * Returns a boolean array of visibility statuses.\n */\nDygraph.prototype.visibility = function () {\n // Do lazy-initialization, so that this happens after we know the number of\n // data series.\n if (!this.getOption(\"visibility\")) {\n this.attrs_.visibility = [];\n }\n // TODO(danvk): it looks like this could go into an infinite loop w/ user_attrs.\n while (this.getOption(\"visibility\").length < this.numColumns() - 1) {\n this.attrs_.visibility.push(true);\n }\n return this.getOption(\"visibility\");\n};\n\n/**\n * Changes the visibility of one or more series.\n *\n * @param {number|number[]|object} num the series index or an array of series indices\n * or a boolean array of visibility states by index\n * or an object mapping series numbers, as keys, to\n * visibility state (boolean values)\n * @param {boolean} value the visibility state expressed as a boolean\n */\nDygraph.prototype.setVisibility = function (num, value) {\n var x = this.visibility();\n var numIsObject = false;\n\n if (!Array.isArray(num)) {\n if (num !== null && typeof num === 'object') {\n numIsObject = true;\n } else {\n num = [num];\n }\n }\n\n if (numIsObject) {\n for (var i in num) {\n if (num.hasOwnProperty(i)) {\n if (i < 0 || i >= x.length) {\n console.warn(\"Invalid series number in setVisibility: \" + i);\n } else {\n x[i] = num[i];\n }\n }\n }\n } else {\n for (var i = 0; i < num.length; i++) {\n if (typeof num[i] === 'boolean') {\n if (i >= x.length) {\n console.warn(\"Invalid series number in setVisibility: \" + i);\n } else {\n x[i] = num[i];\n }\n } else {\n if (num[i] < 0 || num[i] >= x.length) {\n console.warn(\"Invalid series number in setVisibility: \" + num[i]);\n } else {\n x[num[i]] = value;\n }\n }\n }\n }\n\n this.predraw_();\n};\n\n/**\n * How large of an area will the dygraph render itself in?\n * This is used for testing.\n * @return A {width: w, height: h} object.\n * @private\n */\nDygraph.prototype.size = function () {\n return { width: this.width_, height: this.height_ };\n};\n\n/**\n * Update the list of annotations and redraw the chart.\n * See dygraphs.com/annotations.html for more info on how to use annotations.\n * @param ann {Array} An array of annotation objects.\n * @param suppressDraw {Boolean} Set to \"true\" to block chart redraw (optional).\n */\nDygraph.prototype.setAnnotations = function (ann, suppressDraw) {\n // Only add the annotation CSS rule once we know it will be used.\n this.annotations_ = ann;\n if (!this.layout_) {\n console.warn(\"Tried to setAnnotations before dygraph was ready. \" + \"Try setting them in a ready() block. See \" + \"dygraphs.com/tests/annotation.html\");\n return;\n }\n\n this.layout_.setAnnotations(this.annotations_);\n if (!suppressDraw) {\n this.predraw_();\n }\n};\n\n/**\n * Return the list of annotations.\n */\nDygraph.prototype.annotations = function () {\n return this.annotations_;\n};\n\n/**\n * Get the list of label names for this graph. The first column is the\n * x-axis, so the data series names start at index 1.\n *\n * Returns null when labels have not yet been defined.\n */\nDygraph.prototype.getLabels = function () {\n var labels = this.attr_(\"labels\");\n return labels ? labels.slice() : null;\n};\n\n/**\n * Get the index of a series (column) given its name. The first column is the\n * x-axis, so the data series start with index 1.\n */\nDygraph.prototype.indexFromSetName = function (name) {\n return this.setIndexByName_[name];\n};\n\n/**\n * Find the row number corresponding to the given x-value.\n * Returns null if there is no such x-value in the data.\n * If there are multiple rows with the same x-value, this will return the\n * first one.\n * @param {number} xVal The x-value to look for (e.g. millis since epoch).\n * @return {?number} The row number, which you can pass to getValue(), or null.\n */\nDygraph.prototype.getRowForX = function (xVal) {\n var low = 0,\n high = this.numRows() - 1;\n\n while (low <= high) {\n var idx = high + low >> 1;\n var x = this.getValue(idx, 0);\n if (x < xVal) {\n low = idx + 1;\n } else if (x > xVal) {\n high = idx - 1;\n } else if (low != idx) {\n // equal, but there may be an earlier match.\n high = idx;\n } else {\n return idx;\n }\n }\n\n return null;\n};\n\n/**\n * Trigger a callback when the dygraph has drawn itself and is ready to be\n * manipulated. This is primarily useful when dygraphs has to do an XHR for the\n * data (i.e. a URL is passed as the data source) and the chart is drawn\n * asynchronously. If the chart has already drawn, the callback will fire\n * immediately.\n *\n * This is a good place to call setAnnotation().\n *\n * @param {function(!Dygraph)} callback The callback to trigger when the chart\n * is ready.\n */\nDygraph.prototype.ready = function (callback) {\n if (this.is_initial_draw_) {\n this.readyFns_.push(callback);\n } else {\n callback.call(this, this);\n }\n};\n\n/**\n * Add an event handler. This event handler is kept until the graph is\n * destroyed with a call to graph.destroy().\n *\n * @param {!Node} elem The element to add the event to.\n * @param {string} type The type of the event, e.g. 'click' or 'mousemove'.\n * @param {function(Event):(boolean|undefined)} fn The function to call\n * on the event. The function takes one parameter: the event object.\n * @private\n */\nDygraph.prototype.addAndTrackEvent = function (elem, type, fn) {\n utils.addEvent(elem, type, fn);\n this.registeredEvents_.push({ elem: elem, type: type, fn: fn });\n};\n\nDygraph.prototype.removeTrackedEvents_ = function () {\n if (this.registeredEvents_) {\n for (var idx = 0; idx < this.registeredEvents_.length; idx++) {\n var reg = this.registeredEvents_[idx];\n utils.removeEvent(reg.elem, reg.type, reg.fn);\n }\n }\n\n this.registeredEvents_ = [];\n};\n\n// Installed plugins, in order of precedence (most-general to most-specific).\nDygraph.PLUGINS = [_pluginsLegend2['default'], _pluginsAxes2['default'], _pluginsRangeSelector2['default'], // Has to be before ChartLabels so that its callbacks are called after ChartLabels' callbacks.\n_pluginsChartLabels2['default'], _pluginsAnnotations2['default'], _pluginsGrid2['default']];\n\n// There are many symbols which have historically been available through the\n// Dygraph class. These are exported here for backwards compatibility.\nDygraph.GVizChart = _dygraphGviz2['default'];\nDygraph.DASHED_LINE = utils.DASHED_LINE;\nDygraph.DOT_DASH_LINE = utils.DOT_DASH_LINE;\nDygraph.dateAxisLabelFormatter = utils.dateAxisLabelFormatter;\nDygraph.toRGB_ = utils.toRGB_;\nDygraph.findPos = utils.findPos;\nDygraph.pageX = utils.pageX;\nDygraph.pageY = utils.pageY;\nDygraph.dateString_ = utils.dateString_;\nDygraph.defaultInteractionModel = _dygraphInteractionModel2['default'].defaultModel;\nDygraph.nonInteractiveModel = Dygraph.nonInteractiveModel_ = _dygraphInteractionModel2['default'].nonInteractiveModel_;\nDygraph.Circles = utils.Circles;\n\nDygraph.Plugins = {\n Legend: _pluginsLegend2['default'],\n Axes: _pluginsAxes2['default'],\n Annotations: _pluginsAnnotations2['default'],\n ChartLabels: _pluginsChartLabels2['default'],\n Grid: _pluginsGrid2['default'],\n RangeSelector: _pluginsRangeSelector2['default']\n};\n\nDygraph.DataHandlers = {\n DefaultHandler: _datahandlerDefault2['default'],\n BarsHandler: _datahandlerBars2['default'],\n CustomBarsHandler: _datahandlerBarsCustom2['default'],\n DefaultFractionHandler: _datahandlerDefaultFractions2['default'],\n ErrorBarsHandler: _datahandlerBarsError2['default'],\n FractionsBarsHandler: _datahandlerBarsFractions2['default']\n};\n\nDygraph.startPan = _dygraphInteractionModel2['default'].startPan;\nDygraph.startZoom = _dygraphInteractionModel2['default'].startZoom;\nDygraph.movePan = _dygraphInteractionModel2['default'].movePan;\nDygraph.moveZoom = _dygraphInteractionModel2['default'].moveZoom;\nDygraph.endPan = _dygraphInteractionModel2['default'].endPan;\nDygraph.endZoom = _dygraphInteractionModel2['default'].endZoom;\n\nDygraph.numericLinearTicks = DygraphTickers.numericLinearTicks;\nDygraph.numericTicks = DygraphTickers.numericTicks;\nDygraph.dateTicker = DygraphTickers.dateTicker;\nDygraph.Granularity = DygraphTickers.Granularity;\nDygraph.getDateAxis = DygraphTickers.getDateAxis;\nDygraph.floatFormat = utils.floatFormat;\n\nexports['default'] = Dygraph;\nmodule.exports = exports['default'];","/**\n * @license\n * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)\n * MIT-licensed (http://opensource.org/licenses/MIT)\n */\n\n/**\n * @fileoverview Description of this file.\n * @author danvk@google.com (Dan Vanderkam)\n *\n * A ticker is a function with the following interface:\n *\n * function(a, b, pixels, options_view, dygraph, forced_values);\n * -> [ { v: tick1_v, label: tick1_label[, label_v: label_v1] },\n * { v: tick2_v, label: tick2_label[, label_v: label_v2] },\n * ...\n * ]\n *\n * The returned value is called a \"tick list\".\n *\n * Arguments\n * ---------\n *\n * [a, b] is the range of the axis for which ticks are being generated. For a\n * numeric axis, these will simply be numbers. For a date axis, these will be\n * millis since epoch (convertable to Date objects using \"new Date(a)\" and \"new\n * Date(b)\").\n *\n * opts provides access to chart- and axis-specific options. It can be used to\n * access number/date formatting code/options, check for a log scale, etc.\n *\n * pixels is the length of the axis in pixels. opts('pixelsPerLabel') is the\n * minimum amount of space to be allotted to each label. For instance, if\n * pixels=400 and opts('pixelsPerLabel')=40 then the ticker should return\n * between zero and ten (400/40) ticks.\n *\n * dygraph is the Dygraph object for which an axis is being constructed.\n *\n * forced_values is used for secondary y-axes. The tick positions are typically\n * set by the primary y-axis, so the secondary y-axis has no choice in where to\n * put these. It simply has to generate labels for these data values.\n *\n * Tick lists\n * ----------\n * Typically a tick will have both a grid/tick line and a label at one end of\n * that line (at the bottom for an x-axis, at left or right for the y-axis).\n *\n * A tick may be missing one of these two components:\n * - If \"label_v\" is specified instead of \"v\", then there will be no tick or\n * gridline, just a label.\n * - Similarly, if \"label\" is not specified, then there will be a gridline\n * without a label.\n *\n * This flexibility is useful in a few situations:\n * - For log scales, some of the tick lines may be too close to all have labels.\n * - For date scales where years are being displayed, it is desirable to display\n * tick marks at the beginnings of years but labels (e.g. \"2006\") in the\n * middle of the years.\n */\n\n/*jshint sub:true */\n/*global Dygraph:false */\n\"use strict\";\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nvar _dygraphUtils = require('./dygraph-utils');\n\nvar utils = _interopRequireWildcard(_dygraphUtils);\n\n/** @typedef {Array.<{v:number, label:string, label_v:(string|undefined)}>} */\nvar TickList = undefined; // the ' = undefined' keeps jshint happy.\n\n/** @typedef {function(\n * number,\n * number,\n * number,\n * function(string):*,\n * Dygraph=,\n * Array.=\n * ): TickList}\n */\nvar Ticker = undefined; // the ' = undefined' keeps jshint happy.\n\n/** @type {Ticker} */\nvar numericLinearTicks = function numericLinearTicks(a, b, pixels, opts, dygraph, vals) {\n var nonLogscaleOpts = function nonLogscaleOpts(opt) {\n if (opt === 'logscale') return false;\n return opts(opt);\n };\n return numericTicks(a, b, pixels, nonLogscaleOpts, dygraph, vals);\n};\n\nexports.numericLinearTicks = numericLinearTicks;\n/** @type {Ticker} */\nvar numericTicks = function numericTicks(a, b, pixels, opts, dygraph, vals) {\n var pixels_per_tick = /** @type{number} */opts('pixelsPerLabel');\n var ticks = [];\n var i, j, tickV, nTicks;\n if (vals) {\n for (i = 0; i < vals.length; i++) {\n ticks.push({ v: vals[i] });\n }\n } else {\n // TODO(danvk): factor this log-scale block out into a separate function.\n if (opts(\"logscale\")) {\n nTicks = Math.floor(pixels / pixels_per_tick);\n var minIdx = utils.binarySearch(a, PREFERRED_LOG_TICK_VALUES, 1);\n var maxIdx = utils.binarySearch(b, PREFERRED_LOG_TICK_VALUES, -1);\n if (minIdx == -1) {\n minIdx = 0;\n }\n if (maxIdx == -1) {\n maxIdx = PREFERRED_LOG_TICK_VALUES.length - 1;\n }\n // Count the number of tick values would appear, if we can get at least\n // nTicks / 4 accept them.\n var lastDisplayed = null;\n if (maxIdx - minIdx >= nTicks / 4) {\n for (var idx = maxIdx; idx >= minIdx; idx--) {\n var tickValue = PREFERRED_LOG_TICK_VALUES[idx];\n var pixel_coord = Math.log(tickValue / a) / Math.log(b / a) * pixels;\n var tick = { v: tickValue };\n if (lastDisplayed === null) {\n lastDisplayed = {\n tickValue: tickValue,\n pixel_coord: pixel_coord\n };\n } else {\n if (Math.abs(pixel_coord - lastDisplayed.pixel_coord) >= pixels_per_tick) {\n lastDisplayed = {\n tickValue: tickValue,\n pixel_coord: pixel_coord\n };\n } else {\n tick.label = \"\";\n }\n }\n ticks.push(tick);\n }\n // Since we went in backwards order.\n ticks.reverse();\n }\n }\n\n // ticks.length won't be 0 if the log scale function finds values to insert.\n if (ticks.length === 0) {\n // Basic idea:\n // Try labels every 1, 2, 5, 10, 20, 50, 100, etc.\n // Calculate the resulting tick spacing (i.e. this.height_ / nTicks).\n // The first spacing greater than pixelsPerYLabel is what we use.\n // TODO(danvk): version that works on a log scale.\n var kmg2 = opts(\"labelsKMG2\");\n var mults, base;\n if (kmg2) {\n mults = [1, 2, 4, 8, 16, 32, 64, 128, 256];\n base = 16;\n } else {\n mults = [1, 2, 5, 10, 20, 50, 100];\n base = 10;\n }\n\n // Get the maximum number of permitted ticks based on the\n // graph's pixel size and pixels_per_tick setting.\n var max_ticks = Math.ceil(pixels / pixels_per_tick);\n\n // Now calculate the data unit equivalent of this tick spacing.\n // Use abs() since graphs may have a reversed Y axis.\n var units_per_tick = Math.abs(b - a) / max_ticks;\n\n // Based on this, get a starting scale which is the largest\n // integer power of the chosen base (10 or 16) that still remains\n // below the requested pixels_per_tick spacing.\n var base_power = Math.floor(Math.log(units_per_tick) / Math.log(base));\n var base_scale = Math.pow(base, base_power);\n\n // Now try multiples of the starting scale until we find one\n // that results in tick marks spaced sufficiently far apart.\n // The \"mults\" array should cover the range 1 .. base^2 to\n // adjust for rounding and edge effects.\n var scale, low_val, high_val, spacing;\n for (j = 0; j < mults.length; j++) {\n scale = base_scale * mults[j];\n low_val = Math.floor(a / scale) * scale;\n high_val = Math.ceil(b / scale) * scale;\n nTicks = Math.abs(high_val - low_val) / scale;\n spacing = pixels / nTicks;\n if (spacing > pixels_per_tick) break;\n }\n\n // Construct the set of ticks.\n // Allow reverse y-axis if it's explicitly requested.\n if (low_val > high_val) scale *= -1;\n for (i = 0; i <= nTicks; i++) {\n tickV = low_val + i * scale;\n ticks.push({ v: tickV });\n }\n }\n }\n\n var formatter = /**@type{AxisLabelFormatter}*/opts('axisLabelFormatter');\n\n // Add labels to the ticks.\n for (i = 0; i < ticks.length; i++) {\n if (ticks[i].label !== undefined) continue; // Use current label.\n // TODO(danvk): set granularity to something appropriate here.\n ticks[i].label = formatter.call(dygraph, ticks[i].v, 0, opts, dygraph);\n }\n\n return ticks;\n};\n\nexports.numericTicks = numericTicks;\n/** @type {Ticker} */\nvar dateTicker = function dateTicker(a, b, pixels, opts, dygraph, vals) {\n var chosen = pickDateTickGranularity(a, b, pixels, opts);\n\n if (chosen >= 0) {\n return getDateAxis(a, b, chosen, opts, dygraph);\n } else {\n // this can happen if self.width_ is zero.\n return [];\n }\n};\n\nexports.dateTicker = dateTicker;\n// Time granularity enumeration\nvar Granularity = {\n MILLISECONDLY: 0,\n TWO_MILLISECONDLY: 1,\n FIVE_MILLISECONDLY: 2,\n TEN_MILLISECONDLY: 3,\n FIFTY_MILLISECONDLY: 4,\n HUNDRED_MILLISECONDLY: 5,\n FIVE_HUNDRED_MILLISECONDLY: 6,\n SECONDLY: 7,\n TWO_SECONDLY: 8,\n FIVE_SECONDLY: 9,\n TEN_SECONDLY: 10,\n THIRTY_SECONDLY: 11,\n MINUTELY: 12,\n TWO_MINUTELY: 13,\n FIVE_MINUTELY: 14,\n TEN_MINUTELY: 15,\n THIRTY_MINUTELY: 16,\n HOURLY: 17,\n TWO_HOURLY: 18,\n SIX_HOURLY: 19,\n DAILY: 20,\n TWO_DAILY: 21,\n WEEKLY: 22,\n MONTHLY: 23,\n QUARTERLY: 24,\n BIANNUAL: 25,\n ANNUAL: 26,\n DECADAL: 27,\n CENTENNIAL: 28,\n NUM_GRANULARITIES: 29\n};\n\nexports.Granularity = Granularity;\n// Date components enumeration (in the order of the arguments in Date)\n// TODO: make this an @enum\nvar DateField = {\n DATEFIELD_Y: 0,\n DATEFIELD_M: 1,\n DATEFIELD_D: 2,\n DATEFIELD_HH: 3,\n DATEFIELD_MM: 4,\n DATEFIELD_SS: 5,\n DATEFIELD_MS: 6,\n NUM_DATEFIELDS: 7\n};\n\n/**\n * The value of datefield will start at an even multiple of \"step\", i.e.\n * if datefield=SS and step=5 then the first tick will be on a multiple of 5s.\n *\n * For granularities <= HOURLY, ticks are generated every `spacing` ms.\n *\n * At coarser granularities, ticks are generated by incrementing `datefield` by\n * `step`. In this case, the `spacing` value is only used to estimate the\n * number of ticks. It should roughly correspond to the spacing between\n * adjacent ticks.\n *\n * @type {Array.<{datefield:number, step:number, spacing:number}>}\n */\nvar TICK_PLACEMENT = [];\nTICK_PLACEMENT[Granularity.MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 1, spacing: 1 };\nTICK_PLACEMENT[Granularity.TWO_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 2, spacing: 2 };\nTICK_PLACEMENT[Granularity.FIVE_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 5, spacing: 5 };\nTICK_PLACEMENT[Granularity.TEN_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 10, spacing: 10 };\nTICK_PLACEMENT[Granularity.FIFTY_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 50, spacing: 50 };\nTICK_PLACEMENT[Granularity.HUNDRED_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 100, spacing: 100 };\nTICK_PLACEMENT[Granularity.FIVE_HUNDRED_MILLISECONDLY] = { datefield: DateField.DATEFIELD_MS, step: 500, spacing: 500 };\nTICK_PLACEMENT[Granularity.SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 1, spacing: 1000 * 1 };\nTICK_PLACEMENT[Granularity.TWO_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 2, spacing: 1000 * 2 };\nTICK_PLACEMENT[Granularity.FIVE_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 5, spacing: 1000 * 5 };\nTICK_PLACEMENT[Granularity.TEN_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 10, spacing: 1000 * 10 };\nTICK_PLACEMENT[Granularity.THIRTY_SECONDLY] = { datefield: DateField.DATEFIELD_SS, step: 30, spacing: 1000 * 30 };\nTICK_PLACEMENT[Granularity.MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 1, spacing: 1000 * 60 };\nTICK_PLACEMENT[Granularity.TWO_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 2, spacing: 1000 * 60 * 2 };\nTICK_PLACEMENT[Granularity.FIVE_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 5, spacing: 1000 * 60 * 5 };\nTICK_PLACEMENT[Granularity.TEN_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 10, spacing: 1000 * 60 * 10 };\nTICK_PLACEMENT[Granularity.THIRTY_MINUTELY] = { datefield: DateField.DATEFIELD_MM, step: 30, spacing: 1000 * 60 * 30 };\nTICK_PLACEMENT[Granularity.HOURLY] = { datefield: DateField.DATEFIELD_HH, step: 1, spacing: 1000 * 3600 };\nTICK_PLACEMENT[Granularity.TWO_HOURLY] = { datefield: DateField.DATEFIELD_HH, step: 2, spacing: 1000 * 3600 * 2 };\nTICK_PLACEMENT[Granularity.SIX_HOURLY] = { datefield: DateField.DATEFIELD_HH, step: 6, spacing: 1000 * 3600 * 6 };\nTICK_PLACEMENT[Granularity.DAILY] = { datefield: DateField.DATEFIELD_D, step: 1, spacing: 1000 * 86400 };\nTICK_PLACEMENT[Granularity.TWO_DAILY] = { datefield: DateField.DATEFIELD_D, step: 2, spacing: 1000 * 86400 * 2 };\nTICK_PLACEMENT[Granularity.WEEKLY] = { datefield: DateField.DATEFIELD_D, step: 7, spacing: 1000 * 604800 };\nTICK_PLACEMENT[Granularity.MONTHLY] = { datefield: DateField.DATEFIELD_M, step: 1, spacing: 1000 * 7200 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 / 12\nTICK_PLACEMENT[Granularity.QUARTERLY] = { datefield: DateField.DATEFIELD_M, step: 3, spacing: 1000 * 21600 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 / 4\nTICK_PLACEMENT[Granularity.BIANNUAL] = { datefield: DateField.DATEFIELD_M, step: 6, spacing: 1000 * 43200 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 / 2\nTICK_PLACEMENT[Granularity.ANNUAL] = { datefield: DateField.DATEFIELD_Y, step: 1, spacing: 1000 * 86400 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 * 1\nTICK_PLACEMENT[Granularity.DECADAL] = { datefield: DateField.DATEFIELD_Y, step: 10, spacing: 1000 * 864000 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 * 10\nTICK_PLACEMENT[Granularity.CENTENNIAL] = { datefield: DateField.DATEFIELD_Y, step: 100, spacing: 1000 * 8640000 * 365.2524 }; // 1e3 * 60 * 60 * 24 * 365.2524 * 100\n\n/**\n * This is a list of human-friendly values at which to show tick marks on a log\n * scale. It is k * 10^n, where k=1..9 and n=-39..+39, so:\n * ..., 1, 2, 3, 4, 5, ..., 9, 10, 20, 30, ..., 90, 100, 200, 300, ...\n * NOTE: this assumes that utils.LOG_SCALE = 10.\n * @type {Array.}\n */\nvar PREFERRED_LOG_TICK_VALUES = (function () {\n var vals = [];\n for (var power = -39; power <= 39; power++) {\n var range = Math.pow(10, power);\n for (var mult = 1; mult <= 9; mult++) {\n var val = range * mult;\n vals.push(val);\n }\n }\n return vals;\n})();\n\n/**\n * Determine the correct granularity of ticks on a date axis.\n *\n * @param {number} a Left edge of the chart (ms)\n * @param {number} b Right edge of the chart (ms)\n * @param {number} pixels Size of the chart in the relevant dimension (width).\n * @param {function(string):*} opts Function mapping from option name -> value.\n * @return {number} The appropriate axis granularity for this chart. See the\n * enumeration of possible values in dygraph-tickers.js.\n */\nvar pickDateTickGranularity = function pickDateTickGranularity(a, b, pixels, opts) {\n var pixels_per_tick = /** @type{number} */opts('pixelsPerLabel');\n for (var i = 0; i < Granularity.NUM_GRANULARITIES; i++) {\n var num_ticks = numDateTicks(a, b, i);\n if (pixels / num_ticks >= pixels_per_tick) {\n return i;\n }\n }\n return -1;\n};\n\n/**\n * Compute the number of ticks on a date axis for a given granularity.\n * @param {number} start_time\n * @param {number} end_time\n * @param {number} granularity (one of the granularities enumerated above)\n * @return {number} (Approximate) number of ticks that would result.\n */\nvar numDateTicks = function numDateTicks(start_time, end_time, granularity) {\n var spacing = TICK_PLACEMENT[granularity].spacing;\n return Math.round(1.0 * (end_time - start_time) / spacing);\n};\n\n/**\n * Compute the positions and labels of ticks on a date axis for a given granularity.\n * @param {number} start_time\n * @param {number} end_time\n * @param {number} granularity (one of the granularities enumerated above)\n * @param {function(string):*} opts Function mapping from option name -> value.\n * @param {Dygraph=} dg\n * @return {!TickList}\n */\nvar getDateAxis = function getDateAxis(start_time, end_time, granularity, opts, dg) {\n var formatter = /** @type{AxisLabelFormatter} */opts(\"axisLabelFormatter\");\n var utc = opts(\"labelsUTC\");\n var accessors = utc ? utils.DateAccessorsUTC : utils.DateAccessorsLocal;\n\n var datefield = TICK_PLACEMENT[granularity].datefield;\n var step = TICK_PLACEMENT[granularity].step;\n var spacing = TICK_PLACEMENT[granularity].spacing;\n\n // Choose a nice tick position before the initial instant.\n // Currently, this code deals properly with the existent daily granularities:\n // DAILY (with step of 1) and WEEKLY (with step of 7 but specially handled).\n // Other daily granularities (say TWO_DAILY) should also be handled specially\n // by setting the start_date_offset to 0.\n var start_date = new Date(start_time);\n var date_array = [];\n date_array[DateField.DATEFIELD_Y] = accessors.getFullYear(start_date);\n date_array[DateField.DATEFIELD_M] = accessors.getMonth(start_date);\n date_array[DateField.DATEFIELD_D] = accessors.getDate(start_date);\n date_array[DateField.DATEFIELD_HH] = accessors.getHours(start_date);\n date_array[DateField.DATEFIELD_MM] = accessors.getMinutes(start_date);\n date_array[DateField.DATEFIELD_SS] = accessors.getSeconds(start_date);\n date_array[DateField.DATEFIELD_MS] = accessors.getMilliseconds(start_date);\n\n var start_date_offset = date_array[datefield] % step;\n if (granularity == Granularity.WEEKLY) {\n // This will put the ticks on Sundays.\n start_date_offset = accessors.getDay(start_date);\n }\n\n date_array[datefield] -= start_date_offset;\n for (var df = datefield + 1; df < DateField.NUM_DATEFIELDS; df++) {\n // The minimum value is 1 for the day of month, and 0 for all other fields.\n date_array[df] = df === DateField.DATEFIELD_D ? 1 : 0;\n }\n\n // Generate the ticks.\n // For granularities not coarser than HOURLY we use the fact that:\n // the number of milliseconds between ticks is constant\n // and equal to the defined spacing.\n // Otherwise we rely on the 'roll over' property of the Date functions:\n // when some date field is set to a value outside of its logical range,\n // the excess 'rolls over' the next (more significant) field.\n // However, when using local time with DST transitions,\n // there are dates that do not represent any time value at all\n // (those in the hour skipped at the 'spring forward'),\n // and the JavaScript engines usually return an equivalent value.\n // Hence we have to check that the date is properly increased at each step,\n // returning a date at a nice tick position.\n var ticks = [];\n var tick_date = accessors.makeDate.apply(null, date_array);\n var tick_time = tick_date.getTime();\n if (granularity <= Granularity.HOURLY) {\n if (tick_time < start_time) {\n tick_time += spacing;\n tick_date = new Date(tick_time);\n }\n while (tick_time <= end_time) {\n ticks.push({ v: tick_time,\n label: formatter.call(dg, tick_date, granularity, opts, dg)\n });\n tick_time += spacing;\n tick_date = new Date(tick_time);\n }\n } else {\n if (tick_time < start_time) {\n date_array[datefield] += step;\n tick_date = accessors.makeDate.apply(null, date_array);\n tick_time = tick_date.getTime();\n }\n while (tick_time <= end_time) {\n if (granularity >= Granularity.DAILY || accessors.getHours(tick_date) % step === 0) {\n ticks.push({ v: tick_time,\n label: formatter.call(dg, tick_date, granularity, opts, dg)\n });\n }\n date_array[datefield] += step;\n tick_date = accessors.makeDate.apply(null, date_array);\n tick_time = tick_date.getTime();\n }\n }\n return ticks;\n};\nexports.getDateAxis = getDateAxis;","/**\n * @license\n * Copyright 2011 Robert Konigsberg (konigsberg@google.com)\n * MIT-licensed (http://opensource.org/licenses/MIT)\n */\n\n/**\n * @fileoverview The default interaction model for Dygraphs. This is kept out\n * of dygraph.js for better navigability.\n * @author Robert Konigsberg (konigsberg@google.com)\n */\n\n/*global Dygraph:false */\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj[\"default\"] = obj; return newObj; } }\n\nvar _dygraphUtils = require('./dygraph-utils');\n\nvar utils = _interopRequireWildcard(_dygraphUtils);\n\n/**\n * You can drag this many pixels past the edge of the chart and still have it\n * be considered a zoom. This makes it easier to zoom to the exact edge of the\n * chart, a fairly common operation.\n */\nvar DRAG_EDGE_MARGIN = 100;\n\n/**\n * A collection of functions to facilitate build custom interaction models.\n * @class\n */\nvar DygraphInteraction = {};\n\n/**\n * Checks whether the beginning & ending of an event were close enough that it\n * should be considered a click. If it should, dispatch appropriate events.\n * Returns true if the event was treated as a click.\n *\n * @param {Event} event\n * @param {Dygraph} g\n * @param {Object} context\n */\nDygraphInteraction.maybeTreatMouseOpAsClick = function (event, g, context) {\n context.dragEndX = utils.dragGetX_(event, context);\n context.dragEndY = utils.dragGetY_(event, context);\n var regionWidth = Math.abs(context.dragEndX - context.dragStartX);\n var regionHeight = Math.abs(context.dragEndY - context.dragStartY);\n\n if (regionWidth < 2 && regionHeight < 2 && g.lastx_ !== undefined && g.lastx_ != -1) {\n DygraphInteraction.treatMouseOpAsClick(g, event, context);\n }\n\n context.regionWidth = regionWidth;\n context.regionHeight = regionHeight;\n};\n\n/**\n * Called in response to an interaction model operation that\n * should start the default panning behavior.\n *\n * It's used in the default callback for \"mousedown\" operations.\n * Custom interaction model builders can use it to provide the default\n * panning behavior.\n *\n * @param {Event} event the event object which led to the startPan call.\n * @param {Dygraph} g The dygraph on which to act.\n * @param {Object} context The dragging context object (with\n * dragStartX/dragStartY/etc. properties). This function modifies the\n * context.\n */\nDygraphInteraction.startPan = function (event, g, context) {\n var i, axis;\n context.isPanning = true;\n var xRange = g.xAxisRange();\n\n if (g.getOptionForAxis(\"logscale\", \"x\")) {\n context.initialLeftmostDate = utils.log10(xRange[0]);\n context.dateRange = utils.log10(xRange[1]) - utils.log10(xRange[0]);\n } else {\n context.initialLeftmostDate = xRange[0];\n context.dateRange = xRange[1] - xRange[0];\n }\n context.xUnitsPerPixel = context.dateRange / (g.plotter_.area.w - 1);\n\n if (g.getNumericOption(\"panEdgeFraction\")) {\n var maxXPixelsToDraw = g.width_ * g.getNumericOption(\"panEdgeFraction\");\n var xExtremes = g.xAxisExtremes(); // I REALLY WANT TO CALL THIS xTremes!\n\n var boundedLeftX = g.toDomXCoord(xExtremes[0]) - maxXPixelsToDraw;\n var boundedRightX = g.toDomXCoord(xExtremes[1]) + maxXPixelsToDraw;\n\n var boundedLeftDate = g.toDataXCoord(boundedLeftX);\n var boundedRightDate = g.toDataXCoord(boundedRightX);\n context.boundedDates = [boundedLeftDate, boundedRightDate];\n\n var boundedValues = [];\n var maxYPixelsToDraw = g.height_ * g.getNumericOption(\"panEdgeFraction\");\n\n for (i = 0; i < g.axes_.length; i++) {\n axis = g.axes_[i];\n var yExtremes = axis.extremeRange;\n\n var boundedTopY = g.toDomYCoord(yExtremes[0], i) + maxYPixelsToDraw;\n var boundedBottomY = g.toDomYCoord(yExtremes[1], i) - maxYPixelsToDraw;\n\n var boundedTopValue = g.toDataYCoord(boundedTopY, i);\n var boundedBottomValue = g.toDataYCoord(boundedBottomY, i);\n\n boundedValues[i] = [boundedTopValue, boundedBottomValue];\n }\n context.boundedValues = boundedValues;\n }\n\n // Record the range of each y-axis at the start of the drag.\n // If any axis has a valueRange, then we want a 2D pan.\n // We can't store data directly in g.axes_, because it does not belong to us\n // and could change out from under us during a pan (say if there's a data\n // update).\n context.is2DPan = false;\n context.axes = [];\n for (i = 0; i < g.axes_.length; i++) {\n axis = g.axes_[i];\n var axis_data = {};\n var yRange = g.yAxisRange(i);\n // TODO(konigsberg): These values should be in |context|.\n // In log scale, initialTopValue, dragValueRange and unitsPerPixel are log scale.\n var logscale = g.attributes_.getForAxis(\"logscale\", i);\n if (logscale) {\n axis_data.initialTopValue = utils.log10(yRange[1]);\n axis_data.dragValueRange = utils.log10(yRange[1]) - utils.log10(yRange[0]);\n } else {\n axis_data.initialTopValue = yRange[1];\n axis_data.dragValueRange = yRange[1] - yRange[0];\n }\n axis_data.unitsPerPixel = axis_data.dragValueRange / (g.plotter_.area.h - 1);\n context.axes.push(axis_data);\n\n // While calculating axes, set 2dpan.\n if (axis.valueRange) context.is2DPan = true;\n }\n};\n\n/**\n * Called in response to an interaction model operation that\n * responds to an event that pans the view.\n *\n * It's used in the default callback for \"mousemove\" operations.\n * Custom interaction model builders can use it to provide the default\n * panning behavior.\n *\n * @param {Event} event the event object which led to the movePan call.\n * @param {Dygraph} g The dygraph on which to act.\n * @param {Object} context The dragging context object (with\n * dragStartX/dragStartY/etc. properties). This function modifies the\n * context.\n */\nDygraphInteraction.movePan = function (event, g, context) {\n context.dragEndX = utils.dragGetX_(event, context);\n context.dragEndY = utils.dragGetY_(event, context);\n\n var minDate = context.initialLeftmostDate - (context.dragEndX - context.dragStartX) * context.xUnitsPerPixel;\n if (context.boundedDates) {\n minDate = Math.max(minDate, context.boundedDates[0]);\n }\n var maxDate = minDate + context.dateRange;\n if (context.boundedDates) {\n if (maxDate > context.boundedDates[1]) {\n // Adjust minDate, and recompute maxDate.\n minDate = minDate - (maxDate - context.boundedDates[1]);\n maxDate = minDate + context.dateRange;\n }\n }\n\n if (g.getOptionForAxis(\"logscale\", \"x\")) {\n g.dateWindow_ = [Math.pow(utils.LOG_SCALE, minDate), Math.pow(utils.LOG_SCALE, maxDate)];\n } else {\n g.dateWindow_ = [minDate, maxDate];\n }\n\n // y-axis scaling is automatic unless this is a full 2D pan.\n if (context.is2DPan) {\n\n var pixelsDragged = context.dragEndY - context.dragStartY;\n\n // Adjust each axis appropriately.\n for (var i = 0; i < g.axes_.length; i++) {\n var axis = g.axes_[i];\n var axis_data = context.axes[i];\n var unitsDragged = pixelsDragged * axis_data.unitsPerPixel;\n\n var boundedValue = context.boundedValues ? context.boundedValues[i] : null;\n\n // In log scale, maxValue and minValue are the logs of those values.\n var maxValue = axis_data.initialTopValue + unitsDragged;\n if (boundedValue) {\n maxValue = Math.min(maxValue, boundedValue[1]);\n }\n var minValue = maxValue - axis_data.dragValueRange;\n if (boundedValue) {\n if (minValue < boundedValue[0]) {\n // Adjust maxValue, and recompute minValue.\n maxValue = maxValue - (minValue - boundedValue[0]);\n minValue = maxValue - axis_data.dragValueRange;\n }\n }\n if (g.attributes_.getForAxis(\"logscale\", i)) {\n axis.valueRange = [Math.pow(utils.LOG_SCALE, minValue), Math.pow(utils.LOG_SCALE, maxValue)];\n } else {\n axis.valueRange = [minValue, maxValue];\n }\n }\n }\n\n g.drawGraph_(false);\n};\n\n/**\n * Called in response to an interaction model operation that\n * responds to an event that ends panning.\n *\n * It's used in the default callback for \"mouseup\" operations.\n * Custom interaction model builders can use it to provide the default\n * panning behavior.\n *\n * @param {Event} event the event object which led to the endPan call.\n * @param {Dygraph} g The dygraph on which to act.\n * @param {Object} context The dragging context object (with\n * dragStartX/dragStartY/etc. properties). This function modifies the\n * context.\n */\nDygraphInteraction.endPan = DygraphInteraction.maybeTreatMouseOpAsClick;\n\n/**\n * Called in response to an interaction model operation that\n * responds to an event that starts zooming.\n *\n * It's used in the default callback for \"mousedown\" operations.\n * Custom interaction model builders can use it to provide the default\n * zooming behavior.\n *\n * @param {Event} event the event object which led to the startZoom call.\n * @param {Dygraph} g The dygraph on which to act.\n * @param {Object} context The dragging context object (with\n * dragStartX/dragStartY/etc. properties). This function modifies the\n * context.\n */\nDygraphInteraction.startZoom = function (event, g, context) {\n context.isZooming = true;\n context.zoomMoved = false;\n};\n\n/**\n * Called in response to an interaction model operation that\n * responds to an event that defines zoom boundaries.\n *\n * It's used in the default callback for \"mousemove\" operations.\n * Custom interaction model builders can use it to provide the default\n * zooming behavior.\n *\n * @param {Event} event the event object which led to the moveZoom call.\n * @param {Dygraph} g The dygraph on which to act.\n * @param {Object} context The dragging context object (with\n * dragStartX/dragStartY/etc. properties). This function modifies the\n * context.\n */\nDygraphInteraction.moveZoom = function (event, g, context) {\n context.zoomMoved = true;\n context.dragEndX = utils.dragGetX_(event, context);\n context.dragEndY = utils.dragGetY_(event, context);\n\n var xDelta = Math.abs(context.dragStartX - context.dragEndX);\n var yDelta = Math.abs(context.dragStartY - context.dragEndY);\n\n // drag direction threshold for y axis is twice as large as x axis\n context.dragDirection = xDelta < yDelta / 2 ? utils.VERTICAL : utils.HORIZONTAL;\n\n g.drawZoomRect_(context.dragDirection, context.dragStartX, context.dragEndX, context.dragStartY, context.dragEndY, context.prevDragDirection, context.prevEndX, context.prevEndY);\n\n context.prevEndX = context.dragEndX;\n context.prevEndY = context.dragEndY;\n context.prevDragDirection = context.dragDirection;\n};\n\n/**\n * TODO(danvk): move this logic into dygraph.js\n * @param {Dygraph} g\n * @param {Event} event\n * @param {Object} context\n */\nDygraphInteraction.treatMouseOpAsClick = function (g, event, context) {\n var clickCallback = g.getFunctionOption('clickCallback');\n var pointClickCallback = g.getFunctionOption('pointClickCallback');\n\n var selectedPoint = null;\n\n // Find out if the click occurs on a point.\n var closestIdx = -1;\n var closestDistance = Number.MAX_VALUE;\n\n // check if the click was on a particular point.\n for (var i = 0; i < g.selPoints_.length; i++) {\n var p = g.selPoints_[i];\n var distance = Math.pow(p.canvasx - context.dragEndX, 2) + Math.pow(p.canvasy - context.dragEndY, 2);\n if (!isNaN(distance) && (closestIdx == -1 || distance < closestDistance)) {\n closestDistance = distance;\n closestIdx = i;\n }\n }\n\n // Allow any click within two pixels of the dot.\n var radius = g.getNumericOption('highlightCircleSize') + 2;\n if (closestDistance <= radius * radius) {\n selectedPoint = g.selPoints_[closestIdx];\n }\n\n if (selectedPoint) {\n var e = {\n cancelable: true,\n point: selectedPoint,\n canvasx: context.dragEndX,\n canvasy: context.dragEndY\n };\n var defaultPrevented = g.cascadeEvents_('pointClick', e);\n if (defaultPrevented) {\n // Note: this also prevents click / clickCallback from firing.\n return;\n }\n if (pointClickCallback) {\n pointClickCallback.call(g, event, selectedPoint);\n }\n }\n\n var e = {\n cancelable: true,\n xval: g.lastx_, // closest point by x value\n pts: g.selPoints_,\n canvasx: context.dragEndX,\n canvasy: context.dragEndY\n };\n if (!g.cascadeEvents_('click', e)) {\n if (clickCallback) {\n // TODO(danvk): pass along more info about the points, e.g. 'x'\n clickCallback.call(g, event, g.lastx_, g.selPoints_);\n }\n }\n};\n\n/**\n * Called in response to an interaction model operation that\n * responds to an event that performs a zoom based on previously defined\n * bounds..\n *\n * It's used in the default callback for \"mouseup\" operations.\n * Custom interaction model builders can use it to provide the default\n * zooming behavior.\n *\n * @param {Event} event the event object which led to the endZoom call.\n * @param {Dygraph} g The dygraph on which to end the zoom.\n * @param {Object} context The dragging context object (with\n * dragStartX/dragStartY/etc. properties). This function modifies the\n * context.\n */\nDygraphInteraction.endZoom = function (event, g, context) {\n g.clearZoomRect_();\n context.isZooming = false;\n DygraphInteraction.maybeTreatMouseOpAsClick(event, g, context);\n\n // The zoom rectangle is visibly clipped to the plot area, so its behavior\n // should be as well.\n // See http://code.google.com/p/dygraphs/issues/detail?id=280\n var plotArea = g.getArea();\n if (context.regionWidth >= 10 && context.dragDirection == utils.HORIZONTAL) {\n var left = Math.min(context.dragStartX, context.dragEndX),\n right = Math.max(context.dragStartX, context.dragEndX);\n left = Math.max(left, plotArea.x);\n right = Math.min(right, plotArea.x + plotArea.w);\n if (left < right) {\n g.doZoomX_(left, right);\n }\n context.cancelNextDblclick = true;\n } else if (context.regionHeight >= 10 && context.dragDirection == utils.VERTICAL) {\n var top = Math.min(context.dragStartY, context.dragEndY),\n bottom = Math.max(context.dragStartY, context.dragEndY);\n top = Math.max(top, plotArea.y);\n bottom = Math.min(bottom, plotArea.y + plotArea.h);\n if (top < bottom) {\n g.doZoomY_(top, bottom);\n }\n context.cancelNextDblclick = true;\n }\n context.dragStartX = null;\n context.dragStartY = null;\n};\n\n/**\n * @private\n */\nDygraphInteraction.startTouch = function (event, g, context) {\n event.preventDefault(); // touch browsers are all nice.\n if (event.touches.length > 1) {\n // If the user ever puts two fingers down, it's not a double tap.\n context.startTimeForDoubleTapMs = null;\n }\n\n var touches = [];\n for (var i = 0; i < event.touches.length; i++) {\n var t = event.touches[i];\n // we dispense with 'dragGetX_' because all touchBrowsers support pageX\n touches.push({\n pageX: t.pageX,\n pageY: t.pageY,\n dataX: g.toDataXCoord(t.pageX),\n dataY: g.toDataYCoord(t.pageY)\n // identifier: t.identifier\n });\n }\n context.initialTouches = touches;\n\n if (touches.length == 1) {\n // This is just a swipe.\n context.initialPinchCenter = touches[0];\n context.touchDirections = { x: true, y: true };\n } else if (touches.length >= 2) {\n // It's become a pinch!\n // In case there are 3+ touches, we ignore all but the \"first\" two.\n\n // only screen coordinates can be averaged (data coords could be log scale).\n context.initialPinchCenter = {\n pageX: 0.5 * (touches[0].pageX + touches[1].pageX),\n pageY: 0.5 * (touches[0].pageY + touches[1].pageY),\n\n // TODO(danvk): remove\n dataX: 0.5 * (touches[0].dataX + touches[1].dataX),\n dataY: 0.5 * (touches[0].dataY + touches[1].dataY)\n };\n\n // Make pinches in a 45-degree swath around either axis 1-dimensional zooms.\n var initialAngle = 180 / Math.PI * Math.atan2(context.initialPinchCenter.pageY - touches[0].pageY, touches[0].pageX - context.initialPinchCenter.pageX);\n\n // use symmetry to get it into the first quadrant.\n initialAngle = Math.abs(initialAngle);\n if (initialAngle > 90) initialAngle = 90 - initialAngle;\n\n context.touchDirections = {\n x: initialAngle < 90 - 45 / 2,\n y: initialAngle > 45 / 2\n };\n }\n\n // save the full x & y ranges.\n context.initialRange = {\n x: g.xAxisRange(),\n y: g.yAxisRange()\n };\n};\n\n/**\n * @private\n */\nDygraphInteraction.moveTouch = function (event, g, context) {\n // If the tap moves, then it's definitely not part of a double-tap.\n context.startTimeForDoubleTapMs = null;\n\n var i,\n touches = [];\n for (i = 0; i < event.touches.length; i++) {\n var t = event.touches[i];\n touches.push({\n pageX: t.pageX,\n pageY: t.pageY\n });\n }\n var initialTouches = context.initialTouches;\n\n var c_now;\n\n // old and new centers.\n var c_init = context.initialPinchCenter;\n if (touches.length == 1) {\n c_now = touches[0];\n } else {\n c_now = {\n pageX: 0.5 * (touches[0].pageX + touches[1].pageX),\n pageY: 0.5 * (touches[0].pageY + touches[1].pageY)\n };\n }\n\n // this is the \"swipe\" component\n // we toss it out for now, but could use it in the future.\n var swipe = {\n pageX: c_now.pageX - c_init.pageX,\n pageY: c_now.pageY - c_init.pageY\n };\n var dataWidth = context.initialRange.x[1] - context.initialRange.x[0];\n var dataHeight = context.initialRange.y[0] - context.initialRange.y[1];\n swipe.dataX = swipe.pageX / g.plotter_.area.w * dataWidth;\n swipe.dataY = swipe.pageY / g.plotter_.area.h * dataHeight;\n var xScale, yScale;\n\n // The residual bits are usually split into scale & rotate bits, but we split\n // them into x-scale and y-scale bits.\n if (touches.length == 1) {\n xScale = 1.0;\n yScale = 1.0;\n } else if (touches.length >= 2) {\n var initHalfWidth = initialTouches[1].pageX - c_init.pageX;\n xScale = (touches[1].pageX - c_now.pageX) / initHalfWidth;\n\n var initHalfHeight = initialTouches[1].pageY - c_init.pageY;\n yScale = (touches[1].pageY - c_now.pageY) / initHalfHeight;\n }\n\n // Clip scaling to [1/8, 8] to prevent too much blowup.\n xScale = Math.min(8, Math.max(0.125, xScale));\n yScale = Math.min(8, Math.max(0.125, yScale));\n\n var didZoom = false;\n if (context.touchDirections.x) {\n g.dateWindow_ = [c_init.dataX - swipe.dataX + (context.initialRange.x[0] - c_init.dataX) / xScale, c_init.dataX - swipe.dataX + (context.initialRange.x[1] - c_init.dataX) / xScale];\n didZoom = true;\n }\n\n if (context.touchDirections.y) {\n for (i = 0; i < 1 /*g.axes_.length*/; i++) {\n var axis = g.axes_[i];\n var logscale = g.attributes_.getForAxis(\"logscale\", i);\n if (logscale) {\n // TODO(danvk): implement\n } else {\n axis.valueRange = [c_init.dataY - swipe.dataY + (context.initialRange.y[0] - c_init.dataY) / yScale, c_init.dataY - swipe.dataY + (context.initialRange.y[1] - c_init.dataY) / yScale];\n didZoom = true;\n }\n }\n }\n\n g.drawGraph_(false);\n\n // We only call zoomCallback on zooms, not pans, to mirror desktop behavior.\n if (didZoom && touches.length > 1 && g.getFunctionOption('zoomCallback')) {\n var viewWindow = g.xAxisRange();\n g.getFunctionOption(\"zoomCallback\").call(g, viewWindow[0], viewWindow[1], g.yAxisRanges());\n }\n};\n\n/**\n * @private\n */\nDygraphInteraction.endTouch = function (event, g, context) {\n if (event.touches.length !== 0) {\n // this is effectively a \"reset\"\n DygraphInteraction.startTouch(event, g, context);\n } else if (event.changedTouches.length == 1) {\n // Could be part of a \"double tap\"\n // The heuristic here is that it's a double-tap if the two touchend events\n // occur within 500ms and within a 50x50 pixel box.\n var now = new Date().getTime();\n var t = event.changedTouches[0];\n if (context.startTimeForDoubleTapMs && now - context.startTimeForDoubleTapMs < 500 && context.doubleTapX && Math.abs(context.doubleTapX - t.screenX) < 50 && context.doubleTapY && Math.abs(context.doubleTapY - t.screenY) < 50) {\n g.resetZoom();\n } else {\n context.startTimeForDoubleTapMs = now;\n context.doubleTapX = t.screenX;\n context.doubleTapY = t.screenY;\n }\n }\n};\n\n// Determine the distance from x to [left, right].\nvar distanceFromInterval = function distanceFromInterval(x, left, right) {\n if (x < left) {\n return left - x;\n } else if (x > right) {\n return x - right;\n } else {\n return 0;\n }\n};\n\n/**\n * Returns the number of pixels by which the event happens from the nearest\n * edge of the chart. For events in the interior of the chart, this returns zero.\n */\nvar distanceFromChart = function distanceFromChart(event, g) {\n var chartPos = utils.findPos(g.canvas_);\n var box = {\n left: chartPos.x,\n right: chartPos.x + g.canvas_.offsetWidth,\n top: chartPos.y,\n bottom: chartPos.y + g.canvas_.offsetHeight\n };\n\n var pt = {\n x: utils.pageX(event),\n y: utils.pageY(event)\n };\n\n var dx = distanceFromInterval(pt.x, box.left, box.right),\n dy = distanceFromInterval(pt.y, box.top, box.bottom);\n return Math.max(dx, dy);\n};\n\n/**\n * Default interation model for dygraphs. You can refer to specific elements of\n * this when constructing your own interaction model, e.g.:\n * g.updateOptions( {\n * interactionModel: {\n * mousedown: DygraphInteraction.defaultInteractionModel.mousedown\n * }\n * } );\n */\nDygraphInteraction.defaultModel = {\n // Track the beginning of drag events\n mousedown: function mousedown(event, g, context) {\n // Right-click should not initiate a zoom.\n if (event.button && event.button == 2) return;\n\n context.initializeMouseDown(event, g, context);\n\n if (event.altKey || event.shiftKey) {\n DygraphInteraction.startPan(event, g, context);\n } else {\n DygraphInteraction.startZoom(event, g, context);\n }\n\n // Note: we register mousemove/mouseup on document to allow some leeway for\n // events to move outside of the chart. Interaction model events get\n // registered on the canvas, which is too small to allow this.\n var mousemove = function mousemove(event) {\n if (context.isZooming) {\n // When the mouse moves >200px from the chart edge, cancel the zoom.\n var d = distanceFromChart(event, g);\n if (d < DRAG_EDGE_MARGIN) {\n DygraphInteraction.moveZoom(event, g, context);\n } else {\n if (context.dragEndX !== null) {\n context.dragEndX = null;\n context.dragEndY = null;\n g.clearZoomRect_();\n }\n }\n } else if (context.isPanning) {\n DygraphInteraction.movePan(event, g, context);\n }\n };\n var mouseup = function mouseup(event) {\n if (context.isZooming) {\n if (context.dragEndX !== null) {\n DygraphInteraction.endZoom(event, g, context);\n } else {\n DygraphInteraction.maybeTreatMouseOpAsClick(event, g, context);\n }\n } else if (context.isPanning) {\n DygraphInteraction.endPan(event, g, context);\n }\n\n utils.removeEvent(document, 'mousemove', mousemove);\n utils.removeEvent(document, 'mouseup', mouseup);\n context.destroy();\n };\n\n g.addAndTrackEvent(document, 'mousemove', mousemove);\n g.addAndTrackEvent(document, 'mouseup', mouseup);\n },\n willDestroyContextMyself: true,\n\n touchstart: function touchstart(event, g, context) {\n DygraphInteraction.startTouch(event, g, context);\n },\n touchmove: function touchmove(event, g, context) {\n DygraphInteraction.moveTouch(event, g, context);\n },\n touchend: function touchend(event, g, context) {\n DygraphInteraction.endTouch(event, g, context);\n },\n\n // Disable zooming out if panning.\n dblclick: function dblclick(event, g, context) {\n if (context.cancelNextDblclick) {\n context.cancelNextDblclick = false;\n return;\n }\n\n // Give plugins a chance to grab this event.\n var e = {\n canvasx: context.dragEndX,\n canvasy: context.dragEndY,\n cancelable: true\n };\n if (g.cascadeEvents_('dblclick', e)) {\n return;\n }\n\n if (event.altKey || event.shiftKey) {\n return;\n }\n g.resetZoom();\n }\n};\n\n/*\nDygraph.DEFAULT_ATTRS.interactionModel = DygraphInteraction.defaultModel;\n\n// old ways of accessing these methods/properties\nDygraph.defaultInteractionModel = DygraphInteraction.defaultModel;\nDygraph.endZoom = DygraphInteraction.endZoom;\nDygraph.moveZoom = DygraphInteraction.moveZoom;\nDygraph.startZoom = DygraphInteraction.startZoom;\nDygraph.endPan = DygraphInteraction.endPan;\nDygraph.movePan = DygraphInteraction.movePan;\nDygraph.startPan = DygraphInteraction.startPan;\n*/\n\nDygraphInteraction.nonInteractiveModel_ = {\n mousedown: function mousedown(event, g, context) {\n context.initializeMouseDown(event, g, context);\n },\n mouseup: DygraphInteraction.maybeTreatMouseOpAsClick\n};\n\n// Default interaction model when using the range selector.\nDygraphInteraction.dragIsPanInteractionModel = {\n mousedown: function mousedown(event, g, context) {\n context.initializeMouseDown(event, g, context);\n DygraphInteraction.startPan(event, g, context);\n },\n mousemove: function mousemove(event, g, context) {\n if (context.isPanning) {\n DygraphInteraction.movePan(event, g, context);\n }\n },\n mouseup: function mouseup(event, g, context) {\n if (context.isPanning) {\n DygraphInteraction.endPan(event, g, context);\n }\n }\n};\n\nexports[\"default\"] = DygraphInteraction;\nmodule.exports = exports[\"default\"];","/**\n * @license\n * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com)\n * MIT-licensed (http://opensource.org/licenses/MIT)\n */\n\n/**\n * @fileoverview This file contains the managment of data handlers\n * @author David Eberlein (david.eberlein@ch.sauter-bc.com)\n *\n * The idea is to define a common, generic data format that works for all data\n * structures supported by dygraphs. To make this possible, the DataHandler\n * interface is introduced. This makes it possible, that dygraph itself can work\n * with the same logic for every data type independent of the actual format and\n * the DataHandler takes care of the data format specific jobs.\n * DataHandlers are implemented for all data types supported by Dygraphs and\n * return Dygraphs compliant formats.\n * By default the correct DataHandler is chosen based on the options set.\n * Optionally the user may use his own DataHandler (similar to the plugin\n * system).\n *\n *\n * The unified data format returend by each handler is defined as so:\n * series[n][point] = [x,y,(extras)]\n *\n * This format contains the common basis that is needed to draw a simple line\n * series extended by optional extras for more complex graphing types. It\n * contains a primitive x value as first array entry, a primitive y value as\n * second array entry and an optional extras object for additional data needed.\n *\n * x must always be a number.\n * y must always be a number, NaN of type number or null.\n * extras is optional and must be interpreted by the DataHandler. It may be of\n * any type.\n *\n * In practice this might look something like this:\n * default: [x, yVal]\n * errorBar / customBar: [x, yVal, [yTopVariance, yBottomVariance] ]\n *\n */\n/*global Dygraph:false */\n/*global DygraphLayout:false */\n\n\"use strict\";\n\n/**\n *\n * The data handler is responsible for all data specific operations. All of the\n * series data it receives and returns is always in the unified data format.\n * Initially the unified data is created by the extractSeries method\n * @constructor\n */\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar DygraphDataHandler = function DygraphDataHandler() {};\n\nvar handler = DygraphDataHandler;\n\n/**\n * X-value array index constant for unified data samples.\n * @const\n * @type {number}\n */\nhandler.X = 0;\n\n/**\n * Y-value array index constant for unified data samples.\n * @const\n * @type {number}\n */\nhandler.Y = 1;\n\n/**\n * Extras-value array index constant for unified data samples.\n * @const\n * @type {number}\n */\nhandler.EXTRAS = 2;\n\n/**\n * Extracts one series from the raw data (a 2D array) into an array of the\n * unified data format.\n * This is where undesirable points (i.e. negative values on log scales and\n * missing values through which we wish to connect lines) are dropped.\n * TODO(danvk): the \"missing values\" bit above doesn't seem right.\n *\n * @param {!Array.} rawData The raw data passed into dygraphs where\n * rawData[i] = [x,ySeries1,...,ySeriesN].\n * @param {!number} seriesIndex Index of the series to extract. All other\n * series should be ignored.\n * @param {!DygraphOptions} options Dygraph options.\n * @return {Array.<[!number,?number,?]>} The series in the unified data format\n * where series[i] = [x,y,{extras}].\n */\nhandler.prototype.extractSeries = function (rawData, seriesIndex, options) {};\n\n/**\n * Converts a series to a Point array. The resulting point array must be\n * returned in increasing order of idx property.\n *\n * @param {!Array.<[!number,?number,?]>} series The series in the unified\n * data format where series[i] = [x,y,{extras}].\n * @param {!string} setName Name of the series.\n * @param {!number} boundaryIdStart Index offset of the first point, equal to the\n * number of skipped points left of the date window minimum (if any).\n * @return {!Array.} List of points for this series.\n */\nhandler.prototype.seriesToPoints = function (series, setName, boundaryIdStart) {\n // TODO(bhs): these loops are a hot-spot for high-point-count charts. In\n // fact,\n // on chrome+linux, they are 6 times more expensive than iterating through\n // the\n // points and drawing the lines. The brunt of the cost comes from allocating\n // the |point| structures.\n var points = [];\n for (var i = 0; i < series.length; ++i) {\n var item = series[i];\n var yraw = item[1];\n var yval = yraw === null ? null : handler.parseFloat(yraw);\n var point = {\n x: NaN,\n y: NaN,\n xval: handler.parseFloat(item[0]),\n yval: yval,\n name: setName, // TODO(danvk): is this really necessary?\n idx: i + boundaryIdStart\n };\n points.push(point);\n }\n this.onPointsCreated_(series, points);\n return points;\n};\n\n/**\n * Callback called for each series after the series points have been generated\n * which will later be used by the plotters to draw the graph.\n * Here data may be added to the seriesPoints which is needed by the plotters.\n * The indexes of series and points are in sync meaning the original data\n * sample for series[i] is points[i].\n *\n * @param {!Array.<[!number,?number,?]>} series The series in the unified\n * data format where series[i] = [x,y,{extras}].\n * @param {!Array.} points The corresponding points passed\n * to the plotter.\n * @protected\n */\nhandler.prototype.onPointsCreated_ = function (series, points) {};\n\n/**\n * Calculates the rolling average of a data set.\n *\n * @param {!Array.<[!number,?number,?]>} series The series in the unified\n * data format where series[i] = [x,y,{extras}].\n * @param {!number} rollPeriod The number of points over which to average the data\n * @param {!DygraphOptions} options The dygraph options.\n * @return {!Array.<[!number,?number,?]>} the rolled series.\n */\nhandler.prototype.rollingAverage = function (series, rollPeriod, options) {};\n\n/**\n * Computes the range of the data series (including confidence intervals).\n *\n * @param {!Array.<[!number,?number,?]>} series The series in the unified\n * data format where series[i] = [x, y, {extras}].\n * @param {!Array.} dateWindow The x-value range to display with\n * the format: [min, max].\n * @param {!DygraphOptions} options The dygraph options.\n * @return {Array.} The low and high extremes of the series in the\n * given window with the format: [low, high].\n */\nhandler.prototype.getExtremeYValues = function (series, dateWindow, options) {};\n\n/**\n * Callback called for each series after the layouting data has been\n * calculated before the series is drawn. Here normalized positioning data\n * should be calculated for the extras of each point.\n *\n * @param {!Array.} points The points passed to\n * the plotter.\n * @param {!Object} axis The axis on which the series will be plotted.\n * @param {!boolean} logscale Weather or not to use a logscale.\n */\nhandler.prototype.onLineEvaluated = function (points, axis, logscale) {};\n\n/**\n * Optimized replacement for parseFloat, which was way too slow when almost\n * all values were type number, with few edge cases, none of which were strings.\n * @param {?number} val\n * @return {number}\n * @protected\n */\nhandler.parseFloat = function (val) {\n // parseFloat(null) is NaN\n if (val === null) {\n return NaN;\n }\n\n // Assume it's a number or NaN. If it's something else, I'll be shocked.\n return val;\n};\n\nexports[\"default\"] = DygraphDataHandler;\nmodule.exports = exports[\"default\"];","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name isValid\n * @category Common Helpers\n * @summary Is the given date valid?\n *\n * @description\n * Returns false if argument is Invalid Date and true otherwise.\n * Argument is converted to Date using `toDate`. See [toDate]{@link https://date-fns.org/docs/toDate}\n * Invalid Date is a Date, whose time value is NaN.\n *\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - Now `isValid` doesn't throw an exception\n * if the first argument is not an instance of Date.\n * Instead, argument is converted beforehand using `toDate`.\n *\n * Examples:\n *\n * | `isValid` argument | Before v2.0.0 | v2.0.0 onward |\n * |---------------------------|---------------|---------------|\n * | `new Date()` | `true` | `true` |\n * | `new Date('2016-01-01')` | `true` | `true` |\n * | `new Date('')` | `false` | `false` |\n * | `new Date(1488370835081)` | `true` | `true` |\n * | `new Date(NaN)` | `false` | `false` |\n * | `'2016-01-01'` | `TypeError` | `false` |\n * | `''` | `TypeError` | `false` |\n * | `1488370835081` | `TypeError` | `true` |\n * | `NaN` | `TypeError` | `false` |\n *\n * We introduce this change to make *date-fns* consistent with ECMAScript behavior\n * that try to coerce arguments to the expected type\n * (which is also the case with other *date-fns* functions).\n *\n * @param {*} date - the date to check\n * @returns {Boolean} the date is valid\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // For the valid date:\n * var result = isValid(new Date(2014, 1, 31))\n * //=> true\n *\n * @example\n * // For the value, convertable into a date:\n * var result = isValid(1393804800000)\n * //=> true\n *\n * @example\n * // For the invalid date:\n * var result = isValid(new Date(''))\n * //=> false\n */\n\nexport default function isValid(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n return !isNaN(date);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_MINUTE = 60000;\n/**\n * @name addMinutes\n * @category Minute Helpers\n * @summary Add the specified number of minutes to the given date.\n *\n * @description\n * Add the specified number of minutes to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of minutes to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the minutes added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 30 minutes to 10 July 2014 12:00:00:\n * const result = addMinutes(new Date(2014, 6, 10, 12, 0), 30)\n * //=> Thu Jul 10 2014 12:30:00\n */\n\nexport default function addMinutes(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_MINUTE);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMilliseconds from \"../addMilliseconds/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar MILLISECONDS_IN_HOUR = 3600000;\n/**\n * @name addHours\n * @category Hour Helpers\n * @summary Add the specified number of hours to the given date.\n *\n * @description\n * Add the specified number of hours to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of hours to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the hours added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 2 hours to 10 July 2014 23:00:00:\n * const result = addHours(new Date(2014, 6, 10, 23, 0), 2)\n * //=> Fri Jul 11 2014 01:00:00\n */\n\nexport default function addHours(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMilliseconds(dirtyDate, amount * MILLISECONDS_IN_HOUR);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addDays from \"../addDays/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addWeeks\n * @category Week Helpers\n * @summary Add the specified number of weeks to the given date.\n *\n * @description\n * Add the specified number of week to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of weeks to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the weeks added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 4 weeks to 1 September 2014:\n * const result = addWeeks(new Date(2014, 8, 1), 4)\n * //=> Mon Sep 29 2014 00:00:00\n */\n\nexport default function addWeeks(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n var days = amount * 7;\n return addDays(dirtyDate, days);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport addMonths from \"../addMonths/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name addYears\n * @category Year Helpers\n * @summary Add the specified number of years to the given date.\n *\n * @description\n * Add the specified number of years to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} amount - the amount of years to be added. Positive decimals will be rounded using `Math.floor`, decimals less than zero will be rounded using `Math.ceil`.\n * @returns {Date} the new date with the years added\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Add 5 years to 1 September 2014:\n * const result = addYears(new Date(2014, 8, 1), 5)\n * //=> Sun Sep 01 2019 00:00:00\n */\n\nexport default function addYears(dirtyDate, dirtyAmount) {\n requiredArgs(2, arguments);\n var amount = toInteger(dirtyAmount);\n return addMonths(dirtyDate, amount * 12);\n}","import toInteger from \"../_lib/toInteger/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport getDaysInMonth from \"../getDaysInMonth/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name setMonth\n * @category Month Helpers\n * @summary Set the month to the given date.\n *\n * @description\n * Set the month to the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the date to be changed\n * @param {Number} month - the month of the new date\n * @returns {Date} the new date with the month set\n * @throws {TypeError} 2 arguments required\n *\n * @example\n * // Set February to 1 September 2014:\n * const result = setMonth(new Date(2014, 8, 1), 1)\n * //=> Sat Feb 01 2014 00:00:00\n */\n\nexport default function setMonth(dirtyDate, dirtyMonth) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var month = toInteger(dirtyMonth);\n var year = date.getFullYear();\n var day = date.getDate();\n var dateWithDesiredMonth = new Date(0);\n dateWithDesiredMonth.setFullYear(year, month, 15);\n dateWithDesiredMonth.setHours(0, 0, 0, 0);\n var daysInMonth = getDaysInMonth(dateWithDesiredMonth); // Set the last day of the new month\n // if the original date was the last day of the longer month\n\n date.setMonth(month, Math.min(day, daysInMonth));\n return date;\n}","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getDaysInMonth\n * @category Month Helpers\n * @summary Get the number of days in a month of the given date.\n *\n * @description\n * Get the number of days in a month of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the number of days in a month\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // How many days are in February 2000?\n * const result = getDaysInMonth(new Date(2000, 1))\n * //=> 29\n */\n\nexport default function getDaysInMonth(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var year = date.getFullYear();\n var monthIndex = date.getMonth();\n var lastDayOfMonth = new Date(0);\n lastDayOfMonth.setFullYear(year, monthIndex + 1, 0);\n lastDayOfMonth.setHours(0, 0, 0, 0);\n return lastDayOfMonth.getDate();\n}","/* global window */\nimport ponyfill from './ponyfill.js';\n\nvar root;\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = ponyfill(root);\nexport default result;\n","import _curry2 from './internal/_curry2.js';\n\n/**\n * Retrieve the value at a given path.\n *\n * @func\n * @memberOf R\n * @since v0.2.0\n * @category Object\n * @typedefn Idx = String | Int\n * @sig [Idx] -> {a} -> a | Undefined\n * @param {Array} path The path to use.\n * @param {Object} obj The object to retrieve the nested property from.\n * @return {*} The data at `path`.\n * @see R.prop\n * @example\n *\n * R.path(['a', 'b'], {a: {b: 2}}); //=> 2\n * R.path(['a', 'b'], {c: {b: 2}}); //=> undefined\n */\nvar path = /*#__PURE__*/_curry2(function path(paths, obj) {\n var val = obj;\n var idx = 0;\n while (idx < paths.length) {\n if (val == null) {\n return;\n }\n val = val[paths[idx]];\n idx += 1;\n }\n return val;\n});\nexport default path;","'use strict';\n\nvar stringify = require('./stringify');\nvar parse = require('./parse');\nvar formats = require('./formats');\n\nmodule.exports = {\n formats: formats,\n parse: parse,\n stringify: stringify\n};\n","'use strict';\n\nvar reactIs = require('react-is');\n\n/**\n * Copyright 2015, Yahoo! Inc.\n * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.\n */\nvar REACT_STATICS = {\n childContextTypes: true,\n contextType: true,\n contextTypes: true,\n defaultProps: true,\n displayName: true,\n getDefaultProps: true,\n getDerivedStateFromError: true,\n getDerivedStateFromProps: true,\n mixins: true,\n propTypes: true,\n type: true\n};\nvar KNOWN_STATICS = {\n name: true,\n length: true,\n prototype: true,\n caller: true,\n callee: true,\n arguments: true,\n arity: true\n};\nvar FORWARD_REF_STATICS = {\n '$$typeof': true,\n render: true,\n defaultProps: true,\n displayName: true,\n propTypes: true\n};\nvar MEMO_STATICS = {\n '$$typeof': true,\n compare: true,\n defaultProps: true,\n displayName: true,\n propTypes: true,\n type: true\n};\nvar TYPE_STATICS = {};\nTYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;\nTYPE_STATICS[reactIs.Memo] = MEMO_STATICS;\n\nfunction getStatics(component) {\n // React v16.11 and below\n if (reactIs.isMemo(component)) {\n return MEMO_STATICS;\n } // React v16.12 and above\n\n\n return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;\n}\n\nvar defineProperty = Object.defineProperty;\nvar getOwnPropertyNames = Object.getOwnPropertyNames;\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;\nvar getPrototypeOf = Object.getPrototypeOf;\nvar objectPrototype = Object.prototype;\nfunction hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {\n if (typeof sourceComponent !== 'string') {\n // don't hoist over string (html) components\n if (objectPrototype) {\n var inheritedComponent = getPrototypeOf(sourceComponent);\n\n if (inheritedComponent && inheritedComponent !== objectPrototype) {\n hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);\n }\n }\n\n var keys = getOwnPropertyNames(sourceComponent);\n\n if (getOwnPropertySymbols) {\n keys = keys.concat(getOwnPropertySymbols(sourceComponent));\n }\n\n var targetStatics = getStatics(targetComponent);\n var sourceStatics = getStatics(sourceComponent);\n\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n\n if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {\n var descriptor = getOwnPropertyDescriptor(sourceComponent, key);\n\n try {\n // Avoid failures from read-only properties\n defineProperty(targetComponent, key, descriptor);\n } catch (e) {}\n }\n }\n }\n\n return targetComponent;\n}\n\nmodule.exports = hoistNonReactStatics;\n","'use strict';\n\nvar colorString = require('color-string');\nvar convert = require('color-convert');\n\nvar _slice = [].slice;\n\nvar skippedModels = [\n\t// to be honest, I don't really feel like keyword belongs in color convert, but eh.\n\t'keyword',\n\n\t// gray conflicts with some method names, and has its own method defined.\n\t'gray',\n\n\t// shouldn't really be in color-convert either...\n\t'hex'\n];\n\nvar hashedModelKeys = {};\nObject.keys(convert).forEach(function (model) {\n\thashedModelKeys[_slice.call(convert[model].labels).sort().join('')] = model;\n});\n\nvar limiters = {};\n\nfunction Color(obj, model) {\n\tif (!(this instanceof Color)) {\n\t\treturn new Color(obj, model);\n\t}\n\n\tif (model && model in skippedModels) {\n\t\tmodel = null;\n\t}\n\n\tif (model && !(model in convert)) {\n\t\tthrow new Error('Unknown model: ' + model);\n\t}\n\n\tvar i;\n\tvar channels;\n\n\tif (obj == null) { // eslint-disable-line no-eq-null,eqeqeq\n\t\tthis.model = 'rgb';\n\t\tthis.color = [0, 0, 0];\n\t\tthis.valpha = 1;\n\t} else if (obj instanceof Color) {\n\t\tthis.model = obj.model;\n\t\tthis.color = obj.color.slice();\n\t\tthis.valpha = obj.valpha;\n\t} else if (typeof obj === 'string') {\n\t\tvar result = colorString.get(obj);\n\t\tif (result === null) {\n\t\t\tthrow new Error('Unable to parse color from string: ' + obj);\n\t\t}\n\n\t\tthis.model = result.model;\n\t\tchannels = convert[this.model].channels;\n\t\tthis.color = result.value.slice(0, channels);\n\t\tthis.valpha = typeof result.value[channels] === 'number' ? result.value[channels] : 1;\n\t} else if (obj.length) {\n\t\tthis.model = model || 'rgb';\n\t\tchannels = convert[this.model].channels;\n\t\tvar newArr = _slice.call(obj, 0, channels);\n\t\tthis.color = zeroArray(newArr, channels);\n\t\tthis.valpha = typeof obj[channels] === 'number' ? obj[channels] : 1;\n\t} else if (typeof obj === 'number') {\n\t\t// this is always RGB - can be converted later on.\n\t\tobj &= 0xFFFFFF;\n\t\tthis.model = 'rgb';\n\t\tthis.color = [\n\t\t\t(obj >> 16) & 0xFF,\n\t\t\t(obj >> 8) & 0xFF,\n\t\t\tobj & 0xFF\n\t\t];\n\t\tthis.valpha = 1;\n\t} else {\n\t\tthis.valpha = 1;\n\n\t\tvar keys = Object.keys(obj);\n\t\tif ('alpha' in obj) {\n\t\t\tkeys.splice(keys.indexOf('alpha'), 1);\n\t\t\tthis.valpha = typeof obj.alpha === 'number' ? obj.alpha : 0;\n\t\t}\n\n\t\tvar hashedKeys = keys.sort().join('');\n\t\tif (!(hashedKeys in hashedModelKeys)) {\n\t\t\tthrow new Error('Unable to parse color from object: ' + JSON.stringify(obj));\n\t\t}\n\n\t\tthis.model = hashedModelKeys[hashedKeys];\n\n\t\tvar labels = convert[this.model].labels;\n\t\tvar color = [];\n\t\tfor (i = 0; i < labels.length; i++) {\n\t\t\tcolor.push(obj[labels[i]]);\n\t\t}\n\n\t\tthis.color = zeroArray(color);\n\t}\n\n\t// perform limitations (clamping, etc.)\n\tif (limiters[this.model]) {\n\t\tchannels = convert[this.model].channels;\n\t\tfor (i = 0; i < channels; i++) {\n\t\t\tvar limit = limiters[this.model][i];\n\t\t\tif (limit) {\n\t\t\t\tthis.color[i] = limit(this.color[i]);\n\t\t\t}\n\t\t}\n\t}\n\n\tthis.valpha = Math.max(0, Math.min(1, this.valpha));\n\n\tif (Object.freeze) {\n\t\tObject.freeze(this);\n\t}\n}\n\nColor.prototype = {\n\ttoString: function () {\n\t\treturn this.string();\n\t},\n\n\ttoJSON: function () {\n\t\treturn this[this.model]();\n\t},\n\n\tstring: function (places) {\n\t\tvar self = this.model in colorString.to ? this : this.rgb();\n\t\tself = self.round(typeof places === 'number' ? places : 1);\n\t\tvar args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);\n\t\treturn colorString.to[self.model](args);\n\t},\n\n\tpercentString: function (places) {\n\t\tvar self = this.rgb().round(typeof places === 'number' ? places : 1);\n\t\tvar args = self.valpha === 1 ? self.color : self.color.concat(this.valpha);\n\t\treturn colorString.to.rgb.percent(args);\n\t},\n\n\tarray: function () {\n\t\treturn this.valpha === 1 ? this.color.slice() : this.color.concat(this.valpha);\n\t},\n\n\tobject: function () {\n\t\tvar result = {};\n\t\tvar channels = convert[this.model].channels;\n\t\tvar labels = convert[this.model].labels;\n\n\t\tfor (var i = 0; i < channels; i++) {\n\t\t\tresult[labels[i]] = this.color[i];\n\t\t}\n\n\t\tif (this.valpha !== 1) {\n\t\t\tresult.alpha = this.valpha;\n\t\t}\n\n\t\treturn result;\n\t},\n\n\tunitArray: function () {\n\t\tvar rgb = this.rgb().color;\n\t\trgb[0] /= 255;\n\t\trgb[1] /= 255;\n\t\trgb[2] /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.push(this.valpha);\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tunitObject: function () {\n\t\tvar rgb = this.rgb().object();\n\t\trgb.r /= 255;\n\t\trgb.g /= 255;\n\t\trgb.b /= 255;\n\n\t\tif (this.valpha !== 1) {\n\t\t\trgb.alpha = this.valpha;\n\t\t}\n\n\t\treturn rgb;\n\t},\n\n\tround: function (places) {\n\t\tplaces = Math.max(places || 0, 0);\n\t\treturn new Color(this.color.map(roundToPlace(places)).concat(this.valpha), this.model);\n\t},\n\n\talpha: function (val) {\n\t\tif (arguments.length) {\n\t\t\treturn new Color(this.color.concat(Math.max(0, Math.min(1, val))), this.model);\n\t\t}\n\n\t\treturn this.valpha;\n\t},\n\n\t// rgb\n\tred: getset('rgb', 0, maxfn(255)),\n\tgreen: getset('rgb', 1, maxfn(255)),\n\tblue: getset('rgb', 2, maxfn(255)),\n\n\thue: getset(['hsl', 'hsv', 'hsl', 'hwb', 'hcg'], 0, function (val) { return ((val % 360) + 360) % 360; }), // eslint-disable-line brace-style\n\n\tsaturationl: getset('hsl', 1, maxfn(100)),\n\tlightness: getset('hsl', 2, maxfn(100)),\n\n\tsaturationv: getset('hsv', 1, maxfn(100)),\n\tvalue: getset('hsv', 2, maxfn(100)),\n\n\tchroma: getset('hcg', 1, maxfn(100)),\n\tgray: getset('hcg', 2, maxfn(100)),\n\n\twhite: getset('hwb', 1, maxfn(100)),\n\twblack: getset('hwb', 2, maxfn(100)),\n\n\tcyan: getset('cmyk', 0, maxfn(100)),\n\tmagenta: getset('cmyk', 1, maxfn(100)),\n\tyellow: getset('cmyk', 2, maxfn(100)),\n\tblack: getset('cmyk', 3, maxfn(100)),\n\n\tx: getset('xyz', 0, maxfn(100)),\n\ty: getset('xyz', 1, maxfn(100)),\n\tz: getset('xyz', 2, maxfn(100)),\n\n\tl: getset('lab', 0, maxfn(100)),\n\ta: getset('lab', 1),\n\tb: getset('lab', 2),\n\n\tkeyword: function (val) {\n\t\tif (arguments.length) {\n\t\t\treturn new Color(val);\n\t\t}\n\n\t\treturn convert[this.model].keyword(this.color);\n\t},\n\n\thex: function (val) {\n\t\tif (arguments.length) {\n\t\t\treturn new Color(val);\n\t\t}\n\n\t\treturn colorString.to.hex(this.rgb().round().color);\n\t},\n\n\trgbNumber: function () {\n\t\tvar rgb = this.rgb().color;\n\t\treturn ((rgb[0] & 0xFF) << 16) | ((rgb[1] & 0xFF) << 8) | (rgb[2] & 0xFF);\n\t},\n\n\tluminosity: function () {\n\t\t// http://www.w3.org/TR/WCAG20/#relativeluminancedef\n\t\tvar rgb = this.rgb().color;\n\n\t\tvar lum = [];\n\t\tfor (var i = 0; i < rgb.length; i++) {\n\t\t\tvar chan = rgb[i] / 255;\n\t\t\tlum[i] = (chan <= 0.03928) ? chan / 12.92 : Math.pow(((chan + 0.055) / 1.055), 2.4);\n\t\t}\n\n\t\treturn 0.2126 * lum[0] + 0.7152 * lum[1] + 0.0722 * lum[2];\n\t},\n\n\tcontrast: function (color2) {\n\t\t// http://www.w3.org/TR/WCAG20/#contrast-ratiodef\n\t\tvar lum1 = this.luminosity();\n\t\tvar lum2 = color2.luminosity();\n\n\t\tif (lum1 > lum2) {\n\t\t\treturn (lum1 + 0.05) / (lum2 + 0.05);\n\t\t}\n\n\t\treturn (lum2 + 0.05) / (lum1 + 0.05);\n\t},\n\n\tlevel: function (color2) {\n\t\tvar contrastRatio = this.contrast(color2);\n\t\tif (contrastRatio >= 7.1) {\n\t\t\treturn 'AAA';\n\t\t}\n\n\t\treturn (contrastRatio >= 4.5) ? 'AA' : '';\n\t},\n\n\tisDark: function () {\n\t\t// YIQ equation from http://24ways.org/2010/calculating-color-contrast\n\t\tvar rgb = this.rgb().color;\n\t\tvar yiq = (rgb[0] * 299 + rgb[1] * 587 + rgb[2] * 114) / 1000;\n\t\treturn yiq < 128;\n\t},\n\n\tisLight: function () {\n\t\treturn !this.isDark();\n\t},\n\n\tnegate: function () {\n\t\tvar rgb = this.rgb();\n\t\tfor (var i = 0; i < 3; i++) {\n\t\t\trgb.color[i] = 255 - rgb.color[i];\n\t\t}\n\t\treturn rgb;\n\t},\n\n\tlighten: function (ratio) {\n\t\tvar hsl = this.hsl();\n\t\thsl.color[2] += hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdarken: function (ratio) {\n\t\tvar hsl = this.hsl();\n\t\thsl.color[2] -= hsl.color[2] * ratio;\n\t\treturn hsl;\n\t},\n\n\tsaturate: function (ratio) {\n\t\tvar hsl = this.hsl();\n\t\thsl.color[1] += hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\tdesaturate: function (ratio) {\n\t\tvar hsl = this.hsl();\n\t\thsl.color[1] -= hsl.color[1] * ratio;\n\t\treturn hsl;\n\t},\n\n\twhiten: function (ratio) {\n\t\tvar hwb = this.hwb();\n\t\thwb.color[1] += hwb.color[1] * ratio;\n\t\treturn hwb;\n\t},\n\n\tblacken: function (ratio) {\n\t\tvar hwb = this.hwb();\n\t\thwb.color[2] += hwb.color[2] * ratio;\n\t\treturn hwb;\n\t},\n\n\tgrayscale: function () {\n\t\t// http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale\n\t\tvar rgb = this.rgb().color;\n\t\tvar val = rgb[0] * 0.3 + rgb[1] * 0.59 + rgb[2] * 0.11;\n\t\treturn Color.rgb(val, val, val);\n\t},\n\n\tfade: function (ratio) {\n\t\treturn this.alpha(this.valpha - (this.valpha * ratio));\n\t},\n\n\topaquer: function (ratio) {\n\t\treturn this.alpha(this.valpha + (this.valpha * ratio));\n\t},\n\n\trotate: function (degrees) {\n\t\tvar hsl = this.hsl();\n\t\tvar hue = hsl.color[0];\n\t\thue = (hue + degrees) % 360;\n\t\thue = hue < 0 ? 360 + hue : hue;\n\t\thsl.color[0] = hue;\n\t\treturn hsl;\n\t},\n\n\tmix: function (mixinColor, weight) {\n\t\t// ported from sass implementation in C\n\t\t// https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209\n\t\tif (!mixinColor || !mixinColor.rgb) {\n\t\t\tthrow new Error('Argument to \"mix\" was not a Color instance, but rather an instance of ' + typeof mixinColor);\n\t\t}\n\t\tvar color1 = mixinColor.rgb();\n\t\tvar color2 = this.rgb();\n\t\tvar p = weight === undefined ? 0.5 : weight;\n\n\t\tvar w = 2 * p - 1;\n\t\tvar a = color1.alpha() - color2.alpha();\n\n\t\tvar w1 = (((w * a === -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;\n\t\tvar w2 = 1 - w1;\n\n\t\treturn Color.rgb(\n\t\t\t\tw1 * color1.red() + w2 * color2.red(),\n\t\t\t\tw1 * color1.green() + w2 * color2.green(),\n\t\t\t\tw1 * color1.blue() + w2 * color2.blue(),\n\t\t\t\tcolor1.alpha() * p + color2.alpha() * (1 - p));\n\t}\n};\n\n// model conversion methods and static constructors\nObject.keys(convert).forEach(function (model) {\n\tif (skippedModels.indexOf(model) !== -1) {\n\t\treturn;\n\t}\n\n\tvar channels = convert[model].channels;\n\n\t// conversion methods\n\tColor.prototype[model] = function () {\n\t\tif (this.model === model) {\n\t\t\treturn new Color(this);\n\t\t}\n\n\t\tif (arguments.length) {\n\t\t\treturn new Color(arguments, model);\n\t\t}\n\n\t\tvar newAlpha = typeof arguments[channels] === 'number' ? channels : this.valpha;\n\t\treturn new Color(assertArray(convert[this.model][model].raw(this.color)).concat(newAlpha), model);\n\t};\n\n\t// 'static' construction methods\n\tColor[model] = function (color) {\n\t\tif (typeof color === 'number') {\n\t\t\tcolor = zeroArray(_slice.call(arguments), channels);\n\t\t}\n\t\treturn new Color(color, model);\n\t};\n});\n\nfunction roundTo(num, places) {\n\treturn Number(num.toFixed(places));\n}\n\nfunction roundToPlace(places) {\n\treturn function (num) {\n\t\treturn roundTo(num, places);\n\t};\n}\n\nfunction getset(model, channel, modifier) {\n\tmodel = Array.isArray(model) ? model : [model];\n\n\tmodel.forEach(function (m) {\n\t\t(limiters[m] || (limiters[m] = []))[channel] = modifier;\n\t});\n\n\tmodel = model[0];\n\n\treturn function (val) {\n\t\tvar result;\n\n\t\tif (arguments.length) {\n\t\t\tif (modifier) {\n\t\t\t\tval = modifier(val);\n\t\t\t}\n\n\t\t\tresult = this[model]();\n\t\t\tresult.color[channel] = val;\n\t\t\treturn result;\n\t\t}\n\n\t\tresult = this[model]().color[channel];\n\t\tif (modifier) {\n\t\t\tresult = modifier(result);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nfunction maxfn(max) {\n\treturn function (v) {\n\t\treturn Math.max(0, Math.min(max, v));\n\t};\n}\n\nfunction assertArray(val) {\n\treturn Array.isArray(val) ? val : [val];\n}\n\nfunction zeroArray(arr, length) {\n\tfor (var i = 0; i < length; i++) {\n\t\tif (typeof arr[i] !== 'number') {\n\t\t\tarr[i] = 0;\n\t\t}\n\t}\n\n\treturn arr;\n}\n\nmodule.exports = Color;\n","function memoize(fn) {\n var cache = Object.create(null);\n return function (arg) {\n if (cache[arg] === undefined) cache[arg] = fn(arg);\n return cache[arg];\n };\n}\n\nexport default memoize;\n","import memoize from '@emotion/memoize';\n\nvar reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23\n\nvar isPropValid = /* #__PURE__ */memoize(function (prop) {\n return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111\n /* o */\n && prop.charCodeAt(1) === 110\n /* n */\n && prop.charCodeAt(2) < 91;\n}\n/* Z+1 */\n);\n\nexport default isPropValid;\n","import _objectAssign from './internal/_objectAssign.js';\nimport _curry1 from './internal/_curry1.js';\n\n/**\n * Merges a list of objects together into one object.\n *\n * @func\n * @memberOf R\n * @since v0.10.0\n * @category List\n * @sig [{k: v}] -> {k: v}\n * @param {Array} list An array of objects\n * @return {Object} A merged object.\n * @see R.reduce\n * @example\n *\n * R.mergeAll([{foo:1},{bar:2},{baz:3}]); //=> {foo:1,bar:2,baz:3}\n * R.mergeAll([{foo:1},{foo:2},{bar:2}]); //=> {foo:2,bar:2}\n * @symb R.mergeAll([{ x: 1 }, { y: 2 }, { z: 3 }]) = { x: 1, y: 2, z: 3 }\n */\nvar mergeAll = /*#__PURE__*/_curry1(function mergeAll(list) {\n return _objectAssign.apply(null, [{}].concat(list));\n});\nexport default mergeAll;","import nth from './nth.js';\n\n/**\n * Returns the last element of the given list or string.\n *\n * @func\n * @memberOf R\n * @since v0.1.4\n * @category List\n * @sig [a] -> a | Undefined\n * @sig String -> String\n * @param {*} list\n * @return {*}\n * @see R.init, R.head, R.tail\n * @example\n *\n * R.last(['fi', 'fo', 'fum']); //=> 'fum'\n * R.last([]); //=> undefined\n *\n * R.last('abc'); //=> 'c'\n * R.last(''); //=> ''\n */\nvar last = /*#__PURE__*/nth(-1);\nexport default last;","import _curry2 from './internal/_curry2.js';\nimport _isString from './internal/_isString.js';\n\n/**\n * Returns the nth element of the given list or string. If n is negative the\n * element at index length + n is returned.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category List\n * @sig Number -> [a] -> a | Undefined\n * @sig Number -> String -> String\n * @param {Number} offset\n * @param {*} list\n * @return {*}\n * @example\n *\n * const list = ['foo', 'bar', 'baz', 'quux'];\n * R.nth(1, list); //=> 'bar'\n * R.nth(-1, list); //=> 'quux'\n * R.nth(-99, list); //=> undefined\n *\n * R.nth(2, 'abc'); //=> 'c'\n * R.nth(3, 'abc'); //=> ''\n * @symb R.nth(-1, [a, b, c]) = c\n * @symb R.nth(0, [a, b, c]) = a\n * @symb R.nth(1, [a, b, c]) = b\n */\nvar nth = /*#__PURE__*/_curry2(function nth(offset, list) {\n var idx = offset < 0 ? list.length + offset : offset;\n return _isString(list) ? list.charAt(idx) : list[idx];\n});\nexport default nth;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.add = add;\nexports.remove = remove;\nexports.has = has;\nexports.check = check;\nexports.all = all;\nexports.clear = clear;\nexports.enableChecking = enableChecking;\nexports.disableChecking = disableChecking;\nvar types = {};\nvar config = {\n checkExisting: true\n};\n\nfunction add(name) {\n types[name] = true;\n}\n\nfunction remove(name) {\n types[name] = false;\n}\n\nfunction has(name) {\n return !!types[name];\n}\n\nfunction check(name) {\n if (config.checkExisting && has(name)) {\n throw new TypeError(\"Duplicate action type: \".concat(name));\n }\n}\n\nfunction all() {\n return Object.keys(types).filter(has);\n}\n\nfunction clear() {\n all().forEach(remove);\n}\n\nfunction enableChecking() {\n config.checkExisting = true;\n}\n\nfunction disableChecking() {\n config.checkExisting = false;\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = createAction;\n\nvar _types = require(\"./types\");\n\nvar id = 0;\n\nvar identity = function identity(arg) {\n return arg;\n};\n\nvar normalize = function normalize(dispatchOrStore) {\n if (dispatchOrStore && typeof dispatchOrStore.dispatch === 'function') {\n return dispatchOrStore.dispatch;\n } else {\n return dispatchOrStore;\n }\n};\n\nvar normalizeAll = function normalizeAll(dispatchOrStores) {\n if (Array.isArray(dispatchOrStores)) {\n return dispatchOrStores.map(normalize);\n } else {\n return normalize(dispatchOrStores);\n }\n};\n\nfunction createAction(description, payloadReducer, metaReducer) {\n if (typeof description === 'function') {\n metaReducer = payloadReducer;\n payloadReducer = description;\n description = undefined;\n }\n\n if (typeof payloadReducer !== 'function') {\n payloadReducer = identity;\n }\n\n if (typeof metaReducer !== 'function') {\n metaReducer = undefined;\n }\n\n var isSerializable = typeof description === 'string' && /^[0-9A-Z_]+$/.test(description);\n\n if (isSerializable) {\n (0, _types.check)(description);\n (0, _types.add)(description);\n } else {\n ++id;\n }\n\n var type = isSerializable ? description : \"[\".concat(id, \"]\").concat(description ? ' ' + description : '');\n var dispatchFunctions = undefined;\n\n function makeAction() {\n var payload = payloadReducer.apply(void 0, arguments);\n\n if (metaReducer) {\n return {\n type: type,\n payload: payload,\n error: payload instanceof Error,\n meta: metaReducer.apply(void 0, arguments)\n };\n }\n\n return {\n type: type,\n payload: payload,\n error: payload instanceof Error\n };\n }\n\n var makeAndDispatch = function makeAndDispatch(dispatchs, isError) {\n return function () {\n var payloadedAction = makeAction.apply(void 0, arguments);\n\n if (!payloadedAction.error) {\n payloadedAction.error = isError;\n }\n\n if (Array.isArray(dispatchs)) {\n return dispatchs.map(function (dispatch) {\n return dispatch(payloadedAction);\n });\n } else if (dispatchs) {\n return dispatchs(payloadedAction);\n } else {\n return payloadedAction;\n }\n };\n };\n\n function actionCreator() {\n return makeAndDispatch(dispatchFunctions, false).apply(void 0, arguments);\n }\n\n actionCreator.asError = function () {\n return makeAndDispatch(dispatchFunctions, true).apply(void 0, arguments);\n };\n\n actionCreator.getType = function () {\n return type;\n };\n\n actionCreator.toString = function () {\n return type;\n };\n\n actionCreator.raw = makeAction;\n\n actionCreator.assignTo = function (dispatchOrStores) {\n dispatchFunctions = normalizeAll(dispatchOrStores);\n return actionCreator;\n };\n\n actionCreator.assigned = function () {\n return !!dispatchFunctions;\n };\n\n actionCreator.bound = function () {\n return false;\n };\n\n actionCreator.dispatched = actionCreator.assigned;\n\n actionCreator.bindTo = function (dispatchOrStores) {\n var boundActionCreator = makeAndDispatch(normalizeAll(dispatchOrStores, false));\n boundActionCreator.asError = makeAndDispatch(normalizeAll(dispatchOrStores, true));\n boundActionCreator.raw = makeAction;\n boundActionCreator.getType = actionCreator.getType;\n boundActionCreator.toString = actionCreator.toString;\n\n boundActionCreator.assignTo = function () {\n return boundActionCreator;\n };\n\n boundActionCreator.bindTo = function () {\n return boundActionCreator;\n };\n\n boundActionCreator.assigned = function () {\n return false;\n };\n\n boundActionCreator.bound = function () {\n return true;\n };\n\n boundActionCreator.dispatched = boundActionCreator.bound;\n return boundActionCreator;\n };\n\n return actionCreator;\n}\n\n;","'use strict';\n\nmodule.exports = function bind(fn, thisArg) {\n return function wrap() {\n var args = new Array(arguments.length);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i];\n }\n return fn.apply(thisArg, args);\n };\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction encode(val) {\n return encodeURIComponent(val).\n replace(/%3A/gi, ':').\n replace(/%24/g, '$').\n replace(/%2C/gi, ',').\n replace(/%20/g, '+').\n replace(/%5B/gi, '[').\n replace(/%5D/gi, ']');\n}\n\n/**\n * Build a URL by appending params to the end\n *\n * @param {string} url The base of the url (e.g., http://www.google.com)\n * @param {object} [params] The params to be appended\n * @returns {string} The formatted url\n */\nmodule.exports = function buildURL(url, params, paramsSerializer) {\n /*eslint no-param-reassign:0*/\n if (!params) {\n return url;\n }\n\n var serializedParams;\n if (paramsSerializer) {\n serializedParams = paramsSerializer(params);\n } else if (utils.isURLSearchParams(params)) {\n serializedParams = params.toString();\n } else {\n var parts = [];\n\n utils.forEach(params, function serialize(val, key) {\n if (val === null || typeof val === 'undefined') {\n return;\n }\n\n if (utils.isArray(val)) {\n key = key + '[]';\n } else {\n val = [val];\n }\n\n utils.forEach(val, function parseValue(v) {\n if (utils.isDate(v)) {\n v = v.toISOString();\n } else if (utils.isObject(v)) {\n v = JSON.stringify(v);\n }\n parts.push(encode(key) + '=' + encode(v));\n });\n });\n\n serializedParams = parts.join('&');\n }\n\n if (serializedParams) {\n var hashmarkIndex = url.indexOf('#');\n if (hashmarkIndex !== -1) {\n url = url.slice(0, hashmarkIndex);\n }\n\n url += (url.indexOf('?') === -1 ? '?' : '&') + serializedParams;\n }\n\n return url;\n};\n","'use strict';\n\n/**\n * Update an Error with the specified config, error code, and response.\n *\n * @param {Error} error The error to update.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The error.\n */\nmodule.exports = function enhanceError(error, config, code, request, response) {\n error.config = config;\n if (code) {\n error.code = code;\n }\n\n error.request = request;\n error.response = response;\n error.isAxiosError = true;\n\n error.toJSON = function toJSON() {\n return {\n // Standard\n message: this.message,\n name: this.name,\n // Microsoft\n description: this.description,\n number: this.number,\n // Mozilla\n fileName: this.fileName,\n lineNumber: this.lineNumber,\n columnNumber: this.columnNumber,\n stack: this.stack,\n // Axios\n config: this.config,\n code: this.code\n };\n };\n return error;\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar settle = require('./../core/settle');\nvar cookies = require('./../helpers/cookies');\nvar buildURL = require('./../helpers/buildURL');\nvar buildFullPath = require('../core/buildFullPath');\nvar parseHeaders = require('./../helpers/parseHeaders');\nvar isURLSameOrigin = require('./../helpers/isURLSameOrigin');\nvar createError = require('../core/createError');\n\nmodule.exports = function xhrAdapter(config) {\n return new Promise(function dispatchXhrRequest(resolve, reject) {\n var requestData = config.data;\n var requestHeaders = config.headers;\n var responseType = config.responseType;\n\n if (utils.isFormData(requestData)) {\n delete requestHeaders['Content-Type']; // Let the browser set it\n }\n\n var request = new XMLHttpRequest();\n\n // HTTP basic authentication\n if (config.auth) {\n var username = config.auth.username || '';\n var password = config.auth.password ? unescape(encodeURIComponent(config.auth.password)) : '';\n requestHeaders.Authorization = 'Basic ' + btoa(username + ':' + password);\n }\n\n var fullPath = buildFullPath(config.baseURL, config.url);\n request.open(config.method.toUpperCase(), buildURL(fullPath, config.params, config.paramsSerializer), true);\n\n // Set the request timeout in MS\n request.timeout = config.timeout;\n\n function onloadend() {\n if (!request) {\n return;\n }\n // Prepare the response\n var responseHeaders = 'getAllResponseHeaders' in request ? parseHeaders(request.getAllResponseHeaders()) : null;\n var responseData = !responseType || responseType === 'text' || responseType === 'json' ?\n request.responseText : request.response;\n var response = {\n data: responseData,\n status: request.status,\n statusText: request.statusText,\n headers: responseHeaders,\n config: config,\n request: request\n };\n\n settle(resolve, reject, response);\n\n // Clean up request\n request = null;\n }\n\n if ('onloadend' in request) {\n // Use onloadend if available\n request.onloadend = onloadend;\n } else {\n // Listen for ready state to emulate onloadend\n request.onreadystatechange = function handleLoad() {\n if (!request || request.readyState !== 4) {\n return;\n }\n\n // The request errored out and we didn't get a response, this will be\n // handled by onerror instead\n // With one exception: request that using file: protocol, most browsers\n // will return status as 0 even though it's a successful request\n if (request.status === 0 && !(request.responseURL && request.responseURL.indexOf('file:') === 0)) {\n return;\n }\n // readystate handler is calling before onerror or ontimeout handlers,\n // so we should call onloadend on the next 'tick'\n setTimeout(onloadend);\n };\n }\n\n // Handle browser request cancellation (as opposed to a manual cancellation)\n request.onabort = function handleAbort() {\n if (!request) {\n return;\n }\n\n reject(createError('Request aborted', config, 'ECONNABORTED', request));\n\n // Clean up request\n request = null;\n };\n\n // Handle low level network errors\n request.onerror = function handleError() {\n // Real errors are hidden from us by the browser\n // onerror should only fire if it's a network error\n reject(createError('Network Error', config, null, request));\n\n // Clean up request\n request = null;\n };\n\n // Handle timeout\n request.ontimeout = function handleTimeout() {\n var timeoutErrorMessage = 'timeout of ' + config.timeout + 'ms exceeded';\n if (config.timeoutErrorMessage) {\n timeoutErrorMessage = config.timeoutErrorMessage;\n }\n reject(createError(\n timeoutErrorMessage,\n config,\n config.transitional && config.transitional.clarifyTimeoutError ? 'ETIMEDOUT' : 'ECONNABORTED',\n request));\n\n // Clean up request\n request = null;\n };\n\n // Add xsrf header\n // This is only done if running in a standard browser environment.\n // Specifically not if we're in a web worker, or react-native.\n if (utils.isStandardBrowserEnv()) {\n // Add xsrf header\n var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName ?\n cookies.read(config.xsrfCookieName) :\n undefined;\n\n if (xsrfValue) {\n requestHeaders[config.xsrfHeaderName] = xsrfValue;\n }\n }\n\n // Add headers to the request\n if ('setRequestHeader' in request) {\n utils.forEach(requestHeaders, function setRequestHeader(val, key) {\n if (typeof requestData === 'undefined' && key.toLowerCase() === 'content-type') {\n // Remove Content-Type if data is undefined\n delete requestHeaders[key];\n } else {\n // Otherwise add header to the request\n request.setRequestHeader(key, val);\n }\n });\n }\n\n // Add withCredentials to request if needed\n if (!utils.isUndefined(config.withCredentials)) {\n request.withCredentials = !!config.withCredentials;\n }\n\n // Add responseType to request if needed\n if (responseType && responseType !== 'json') {\n request.responseType = config.responseType;\n }\n\n // Handle progress if needed\n if (typeof config.onDownloadProgress === 'function') {\n request.addEventListener('progress', config.onDownloadProgress);\n }\n\n // Not all browsers support upload events\n if (typeof config.onUploadProgress === 'function' && request.upload) {\n request.upload.addEventListener('progress', config.onUploadProgress);\n }\n\n if (config.cancelToken) {\n // Handle cancellation\n config.cancelToken.promise.then(function onCanceled(cancel) {\n if (!request) {\n return;\n }\n\n request.abort();\n reject(cancel);\n // Clean up request\n request = null;\n });\n }\n\n if (!requestData) {\n requestData = null;\n }\n\n // Send the request\n request.send(requestData);\n });\n};\n","'use strict';\n\nvar enhanceError = require('./enhanceError');\n\n/**\n * Create an Error with the specified message, config, error code, request and response.\n *\n * @param {string} message The error message.\n * @param {Object} config The config.\n * @param {string} [code] The error code (for example, 'ECONNABORTED').\n * @param {Object} [request] The request.\n * @param {Object} [response] The response.\n * @returns {Error} The created error.\n */\nmodule.exports = function createError(message, config, code, request, response) {\n var error = new Error(message);\n return enhanceError(error, config, code, request, response);\n};\n","'use strict';\n\nmodule.exports = function isCancel(value) {\n return !!(value && value.__CANCEL__);\n};\n","'use strict';\n\nvar utils = require('../utils');\n\n/**\n * Config-specific merge-function which creates a new config-object\n * by merging two configuration objects together.\n *\n * @param {Object} config1\n * @param {Object} config2\n * @returns {Object} New object resulting from merging config2 to config1\n */\nmodule.exports = function mergeConfig(config1, config2) {\n // eslint-disable-next-line no-param-reassign\n config2 = config2 || {};\n var config = {};\n\n var valueFromConfig2Keys = ['url', 'method', 'data'];\n var mergeDeepPropertiesKeys = ['headers', 'auth', 'proxy', 'params'];\n var defaultToConfig2Keys = [\n 'baseURL', 'transformRequest', 'transformResponse', 'paramsSerializer',\n 'timeout', 'timeoutMessage', 'withCredentials', 'adapter', 'responseType', 'xsrfCookieName',\n 'xsrfHeaderName', 'onUploadProgress', 'onDownloadProgress', 'decompress',\n 'maxContentLength', 'maxBodyLength', 'maxRedirects', 'transport', 'httpAgent',\n 'httpsAgent', 'cancelToken', 'socketPath', 'responseEncoding'\n ];\n var directMergeKeys = ['validateStatus'];\n\n function getMergedValue(target, source) {\n if (utils.isPlainObject(target) && utils.isPlainObject(source)) {\n return utils.merge(target, source);\n } else if (utils.isPlainObject(source)) {\n return utils.merge({}, source);\n } else if (utils.isArray(source)) {\n return source.slice();\n }\n return source;\n }\n\n function mergeDeepProperties(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n }\n\n utils.forEach(valueFromConfig2Keys, function valueFromConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n }\n });\n\n utils.forEach(mergeDeepPropertiesKeys, mergeDeepProperties);\n\n utils.forEach(defaultToConfig2Keys, function defaultToConfig2(prop) {\n if (!utils.isUndefined(config2[prop])) {\n config[prop] = getMergedValue(undefined, config2[prop]);\n } else if (!utils.isUndefined(config1[prop])) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n utils.forEach(directMergeKeys, function merge(prop) {\n if (prop in config2) {\n config[prop] = getMergedValue(config1[prop], config2[prop]);\n } else if (prop in config1) {\n config[prop] = getMergedValue(undefined, config1[prop]);\n }\n });\n\n var axiosKeys = valueFromConfig2Keys\n .concat(mergeDeepPropertiesKeys)\n .concat(defaultToConfig2Keys)\n .concat(directMergeKeys);\n\n var otherKeys = Object\n .keys(config1)\n .concat(Object.keys(config2))\n .filter(function filterAxiosKeys(key) {\n return axiosKeys.indexOf(key) === -1;\n });\n\n utils.forEach(otherKeys, mergeDeepProperties);\n\n return config;\n};\n","'use strict';\n\n/**\n * A `Cancel` is an object that is thrown when an operation is canceled.\n *\n * @class\n * @param {string=} message The message.\n */\nfunction Cancel(message) {\n this.message = message;\n}\n\nCancel.prototype.toString = function toString() {\n return 'Cancel' + (this.message ? ': ' + this.message : '');\n};\n\nCancel.prototype.__CANCEL__ = true;\n\nmodule.exports = Cancel;\n","'use strict';\n\nvar slice = Array.prototype.slice;\nvar isArgs = require('./isArguments');\n\nvar origKeys = Object.keys;\nvar keysShim = origKeys ? function keys(o) { return origKeys(o); } : require('./implementation');\n\nvar originalKeys = Object.keys;\n\nkeysShim.shim = function shimObjectKeys() {\n\tif (Object.keys) {\n\t\tvar keysWorksWithArguments = (function () {\n\t\t\t// Safari 5.0 bug\n\t\t\tvar args = Object.keys(arguments);\n\t\t\treturn args && args.length === arguments.length;\n\t\t}(1, 2));\n\t\tif (!keysWorksWithArguments) {\n\t\t\tObject.keys = function keys(object) { // eslint-disable-line func-name-matching\n\t\t\t\tif (isArgs(object)) {\n\t\t\t\t\treturn originalKeys(slice.call(object));\n\t\t\t\t}\n\t\t\t\treturn originalKeys(object);\n\t\t\t};\n\t\t}\n\t} else {\n\t\tObject.keys = keysShim;\n\t}\n\treturn Object.keys || keysShim;\n};\n\nmodule.exports = keysShim;\n","'use strict';\n\nvar toStr = Object.prototype.toString;\n\nmodule.exports = function isArguments(value) {\n\tvar str = toStr.call(value);\n\tvar isArgs = str === '[object Arguments]';\n\tif (!isArgs) {\n\t\tisArgs = str !== '[object Array]' &&\n\t\t\tvalue !== null &&\n\t\t\ttypeof value === 'object' &&\n\t\t\ttypeof value.length === 'number' &&\n\t\t\tvalue.length >= 0 &&\n\t\t\ttoStr.call(value.callee) === '[object Function]';\n\t}\n\treturn isArgs;\n};\n","'use strict';\n\nvar bind = require('function-bind');\n\nmodule.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);\n","'use strict';\n\nvar toObject = Object;\nvar TypeErr = TypeError;\n\nmodule.exports = function flags() {\n\tif (this != null && this !== toObject(this)) {\n\t\tthrow new TypeErr('RegExp.prototype.flags getter called on non-object');\n\t}\n\tvar result = '';\n\tif (this.global) {\n\t\tresult += 'g';\n\t}\n\tif (this.ignoreCase) {\n\t\tresult += 'i';\n\t}\n\tif (this.multiline) {\n\t\tresult += 'm';\n\t}\n\tif (this.dotAll) {\n\t\tresult += 's';\n\t}\n\tif (this.unicode) {\n\t\tresult += 'u';\n\t}\n\tif (this.sticky) {\n\t\tresult += 'y';\n\t}\n\treturn result;\n};\n","'use strict';\n\nvar implementation = require('./implementation');\n\nvar supportsDescriptors = require('define-properties').supportsDescriptors;\nvar gOPD = Object.getOwnPropertyDescriptor;\nvar TypeErr = TypeError;\n\nmodule.exports = function getPolyfill() {\n\tif (!supportsDescriptors) {\n\t\tthrow new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');\n\t}\n\tif (/a/mig.flags === 'gim') {\n\t\tvar descriptor = gOPD(RegExp.prototype, 'flags');\n\t\tif (descriptor && typeof descriptor.get === 'function' && typeof (/a/).dotAll === 'boolean') {\n\t\t\treturn descriptor.get;\n\t\t}\n\t}\n\treturn implementation;\n};\n","'use strict';\n\nvar formats = require('./formats');\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar hexTable = (function () {\n var array = [];\n for (var i = 0; i < 256; ++i) {\n array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());\n }\n\n return array;\n}());\n\nvar compactQueue = function compactQueue(queue) {\n while (queue.length > 1) {\n var item = queue.pop();\n var obj = item.obj[item.prop];\n\n if (isArray(obj)) {\n var compacted = [];\n\n for (var j = 0; j < obj.length; ++j) {\n if (typeof obj[j] !== 'undefined') {\n compacted.push(obj[j]);\n }\n }\n\n item.obj[item.prop] = compacted;\n }\n }\n};\n\nvar arrayToObject = function arrayToObject(source, options) {\n var obj = options && options.plainObjects ? Object.create(null) : {};\n for (var i = 0; i < source.length; ++i) {\n if (typeof source[i] !== 'undefined') {\n obj[i] = source[i];\n }\n }\n\n return obj;\n};\n\nvar merge = function merge(target, source, options) {\n /* eslint no-param-reassign: 0 */\n if (!source) {\n return target;\n }\n\n if (typeof source !== 'object') {\n if (isArray(target)) {\n target.push(source);\n } else if (target && typeof target === 'object') {\n if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) {\n target[source] = true;\n }\n } else {\n return [target, source];\n }\n\n return target;\n }\n\n if (!target || typeof target !== 'object') {\n return [target].concat(source);\n }\n\n var mergeTarget = target;\n if (isArray(target) && !isArray(source)) {\n mergeTarget = arrayToObject(target, options);\n }\n\n if (isArray(target) && isArray(source)) {\n source.forEach(function (item, i) {\n if (has.call(target, i)) {\n var targetItem = target[i];\n if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {\n target[i] = merge(targetItem, item, options);\n } else {\n target.push(item);\n }\n } else {\n target[i] = item;\n }\n });\n return target;\n }\n\n return Object.keys(source).reduce(function (acc, key) {\n var value = source[key];\n\n if (has.call(acc, key)) {\n acc[key] = merge(acc[key], value, options);\n } else {\n acc[key] = value;\n }\n return acc;\n }, mergeTarget);\n};\n\nvar assign = function assignSingleSource(target, source) {\n return Object.keys(source).reduce(function (acc, key) {\n acc[key] = source[key];\n return acc;\n }, target);\n};\n\nvar decode = function (str, decoder, charset) {\n var strWithoutPlus = str.replace(/\\+/g, ' ');\n if (charset === 'iso-8859-1') {\n // unescape never throws, no try...catch needed:\n return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);\n }\n // utf-8\n try {\n return decodeURIComponent(strWithoutPlus);\n } catch (e) {\n return strWithoutPlus;\n }\n};\n\nvar encode = function encode(str, defaultEncoder, charset, kind, format) {\n // This code was originally written by Brian White (mscdex) for the io.js core querystring library.\n // It has been adapted here for stricter adherence to RFC 3986\n if (str.length === 0) {\n return str;\n }\n\n var string = str;\n if (typeof str === 'symbol') {\n string = Symbol.prototype.toString.call(str);\n } else if (typeof str !== 'string') {\n string = String(str);\n }\n\n if (charset === 'iso-8859-1') {\n return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {\n return '%26%23' + parseInt($0.slice(2), 16) + '%3B';\n });\n }\n\n var out = '';\n for (var i = 0; i < string.length; ++i) {\n var c = string.charCodeAt(i);\n\n if (\n c === 0x2D // -\n || c === 0x2E // .\n || c === 0x5F // _\n || c === 0x7E // ~\n || (c >= 0x30 && c <= 0x39) // 0-9\n || (c >= 0x41 && c <= 0x5A) // a-z\n || (c >= 0x61 && c <= 0x7A) // A-Z\n || (format === formats.RFC1738 && (c === 0x28 || c === 0x29)) // ( )\n ) {\n out += string.charAt(i);\n continue;\n }\n\n if (c < 0x80) {\n out = out + hexTable[c];\n continue;\n }\n\n if (c < 0x800) {\n out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n if (c < 0xD800 || c >= 0xE000) {\n out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]);\n continue;\n }\n\n i += 1;\n c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF));\n /* eslint operator-linebreak: [2, \"before\"] */\n out += hexTable[0xF0 | (c >> 18)]\n + hexTable[0x80 | ((c >> 12) & 0x3F)]\n + hexTable[0x80 | ((c >> 6) & 0x3F)]\n + hexTable[0x80 | (c & 0x3F)];\n }\n\n return out;\n};\n\nvar compact = function compact(value) {\n var queue = [{ obj: { o: value }, prop: 'o' }];\n var refs = [];\n\n for (var i = 0; i < queue.length; ++i) {\n var item = queue[i];\n var obj = item.obj[item.prop];\n\n var keys = Object.keys(obj);\n for (var j = 0; j < keys.length; ++j) {\n var key = keys[j];\n var val = obj[key];\n if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {\n queue.push({ obj: obj, prop: key });\n refs.push(val);\n }\n }\n }\n\n compactQueue(queue);\n\n return value;\n};\n\nvar isRegExp = function isRegExp(obj) {\n return Object.prototype.toString.call(obj) === '[object RegExp]';\n};\n\nvar isBuffer = function isBuffer(obj) {\n if (!obj || typeof obj !== 'object') {\n return false;\n }\n\n return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));\n};\n\nvar combine = function combine(a, b) {\n return [].concat(a, b);\n};\n\nvar maybeMap = function maybeMap(val, fn) {\n if (isArray(val)) {\n var mapped = [];\n for (var i = 0; i < val.length; i += 1) {\n mapped.push(fn(val[i]));\n }\n return mapped;\n }\n return fn(val);\n};\n\nmodule.exports = {\n arrayToObject: arrayToObject,\n assign: assign,\n combine: combine,\n compact: compact,\n decode: decode,\n encode: encode,\n isBuffer: isBuffer,\n isRegExp: isRegExp,\n maybeMap: maybeMap,\n merge: merge\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DateTimeFormat = void 0;\nvar tslib_1 = require(\"tslib\");\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar get_internal_slots_1 = tslib_1.__importDefault(require(\"./get_internal_slots\"));\nvar links_1 = tslib_1.__importDefault(require(\"./data/links\"));\nvar packer_1 = require(\"./packer\");\nvar FormatDateTime_1 = require(\"./abstract/FormatDateTime\");\nvar InitializeDateTimeFormat_1 = require(\"./abstract/InitializeDateTimeFormat\");\nvar utils_1 = require(\"./abstract/utils\");\nvar FormatDateTimeToParts_1 = require(\"./abstract/FormatDateTimeToParts\");\nvar FormatDateTimeRangeToParts_1 = require(\"./abstract/FormatDateTimeRangeToParts\");\nvar FormatDateTimeRange_1 = require(\"./abstract/FormatDateTimeRange\");\nvar skeleton_1 = require(\"./abstract/skeleton\");\nvar UPPERCASED_LINKS = Object.keys(links_1.default).reduce(function (all, l) {\n all[l.toUpperCase()] = links_1.default[l];\n return all;\n}, {});\nvar RESOLVED_OPTIONS_KEYS = [\n 'locale',\n 'calendar',\n 'numberingSystem',\n 'dateStyle',\n 'timeStyle',\n 'timeZone',\n 'hourCycle',\n 'weekday',\n 'era',\n 'year',\n 'month',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'timeZoneName',\n];\nvar formatDescriptor = {\n enumerable: false,\n configurable: true,\n get: function () {\n if (typeof this !== 'object' ||\n !ecma402_abstract_1.OrdinaryHasInstance(exports.DateTimeFormat, this)) {\n throw TypeError('Intl.DateTimeFormat format property accessor called on incompatible receiver');\n }\n var internalSlots = get_internal_slots_1.default(this);\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var dtf = this;\n var boundFormat = internalSlots.boundFormat;\n if (boundFormat === undefined) {\n // https://tc39.es/proposal-unified-intl-numberformat/section11/numberformat_diff_out.html#sec-number-format-functions\n boundFormat = function (date) {\n var x;\n if (date === undefined) {\n x = Date.now();\n }\n else {\n x = Number(date);\n }\n return FormatDateTime_1.FormatDateTime(dtf, x, {\n getInternalSlots: get_internal_slots_1.default,\n localeData: exports.DateTimeFormat.localeData,\n tzData: exports.DateTimeFormat.tzData,\n getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,\n });\n };\n try {\n // https://github.com/tc39/test262/blob/master/test/intl402/NumberFormat/prototype/format/format-function-name.js\n Object.defineProperty(boundFormat, 'name', {\n configurable: true,\n enumerable: false,\n writable: false,\n value: '',\n });\n }\n catch (e) {\n // In older browser (e.g Chrome 36 like polyfill.io)\n // TypeError: Cannot redefine property: name\n }\n internalSlots.boundFormat = boundFormat;\n }\n return boundFormat;\n },\n};\ntry {\n // https://github.com/tc39/test262/blob/master/test/intl402/NumberFormat/prototype/format/name.js\n Object.defineProperty(formatDescriptor.get, 'name', {\n configurable: true,\n enumerable: false,\n writable: false,\n value: 'get format',\n });\n}\ncatch (e) {\n // In older browser (e.g Chrome 36 like polyfill.io)\n // TypeError: Cannot redefine property: name\n}\nexports.DateTimeFormat = function (locales, options) {\n // Cannot use `new.target` bc of IE11 & TS transpiles it to something else\n if (!this || !ecma402_abstract_1.OrdinaryHasInstance(exports.DateTimeFormat, this)) {\n return new exports.DateTimeFormat(locales, options);\n }\n InitializeDateTimeFormat_1.InitializeDateTimeFormat(this, locales, options, {\n tzData: exports.DateTimeFormat.tzData,\n uppercaseLinks: UPPERCASED_LINKS,\n availableLocales: exports.DateTimeFormat.availableLocales,\n relevantExtensionKeys: exports.DateTimeFormat.relevantExtensionKeys,\n getDefaultLocale: exports.DateTimeFormat.getDefaultLocale,\n getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,\n getInternalSlots: get_internal_slots_1.default,\n localeData: exports.DateTimeFormat.localeData,\n });\n /** IMPL START */\n var internalSlots = get_internal_slots_1.default(this);\n var dataLocale = internalSlots.dataLocale;\n var dataLocaleData = exports.DateTimeFormat.localeData[dataLocale];\n ecma402_abstract_1.invariant(dataLocaleData !== undefined, \"Cannot load locale-dependent data for \" + dataLocale + \".\");\n /** IMPL END */\n};\n// Static properties\necma402_abstract_1.defineProperty(exports.DateTimeFormat, 'supportedLocalesOf', {\n value: function supportedLocalesOf(locales, options) {\n return ecma402_abstract_1.SupportedLocales(exports.DateTimeFormat.availableLocales, ecma402_abstract_1.CanonicalizeLocaleList(locales), options);\n },\n});\necma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'resolvedOptions', {\n value: function resolvedOptions() {\n if (typeof this !== 'object' ||\n !ecma402_abstract_1.OrdinaryHasInstance(exports.DateTimeFormat, this)) {\n throw TypeError('Method Intl.DateTimeFormat.prototype.resolvedOptions called on incompatible receiver');\n }\n var internalSlots = get_internal_slots_1.default(this);\n var ro = {};\n for (var _i = 0, RESOLVED_OPTIONS_KEYS_1 = RESOLVED_OPTIONS_KEYS; _i < RESOLVED_OPTIONS_KEYS_1.length; _i++) {\n var key = RESOLVED_OPTIONS_KEYS_1[_i];\n var value = internalSlots[key];\n if (key === 'hourCycle') {\n var hour12 = value === 'h11' || value === 'h12'\n ? true\n : value === 'h23' || value === 'h24'\n ? false\n : undefined;\n if (hour12 !== undefined) {\n ro.hour12 = hour12;\n }\n }\n if (utils_1.DATE_TIME_PROPS.indexOf(key) > -1) {\n if (internalSlots.dateStyle !== undefined ||\n internalSlots.timeStyle !== undefined) {\n value = undefined;\n }\n }\n if (value !== undefined) {\n ro[key] = value;\n }\n }\n return ro;\n },\n});\necma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatToParts', {\n value: function formatToParts(date) {\n if (date === undefined) {\n date = Date.now();\n }\n else {\n date = ecma402_abstract_1.ToNumber(date);\n }\n return FormatDateTimeToParts_1.FormatDateTimeToParts(this, date, {\n getInternalSlots: get_internal_slots_1.default,\n localeData: exports.DateTimeFormat.localeData,\n tzData: exports.DateTimeFormat.tzData,\n getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,\n });\n },\n});\necma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatRangeToParts', {\n value: function formatRangeToParts(startDate, endDate) {\n var dtf = this;\n if (typeof dtf !== 'object') {\n throw new TypeError();\n }\n if (startDate === undefined || endDate === undefined) {\n throw new TypeError('startDate/endDate cannot be undefined');\n }\n var x = ecma402_abstract_1.ToNumber(startDate);\n var y = ecma402_abstract_1.ToNumber(endDate);\n return FormatDateTimeRangeToParts_1.FormatDateTimeRangeToParts(dtf, x, y, {\n getInternalSlots: get_internal_slots_1.default,\n localeData: exports.DateTimeFormat.localeData,\n tzData: exports.DateTimeFormat.tzData,\n getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,\n });\n },\n});\necma402_abstract_1.defineProperty(exports.DateTimeFormat.prototype, 'formatRange', {\n value: function formatRange(startDate, endDate) {\n var dtf = this;\n if (typeof dtf !== 'object') {\n throw new TypeError();\n }\n if (startDate === undefined || endDate === undefined) {\n throw new TypeError('startDate/endDate cannot be undefined');\n }\n var x = ecma402_abstract_1.ToNumber(startDate);\n var y = ecma402_abstract_1.ToNumber(endDate);\n return FormatDateTimeRange_1.FormatDateTimeRange(dtf, x, y, {\n getInternalSlots: get_internal_slots_1.default,\n localeData: exports.DateTimeFormat.localeData,\n tzData: exports.DateTimeFormat.tzData,\n getDefaultTimeZone: exports.DateTimeFormat.getDefaultTimeZone,\n });\n },\n});\nvar DEFAULT_TIMEZONE = 'UTC';\nexports.DateTimeFormat.__setDefaultTimeZone = function (timeZone) {\n if (timeZone !== undefined) {\n timeZone = String(timeZone);\n if (!ecma402_abstract_1.IsValidTimeZoneName(timeZone, {\n tzData: exports.DateTimeFormat.tzData,\n uppercaseLinks: UPPERCASED_LINKS,\n })) {\n throw new RangeError('Invalid timeZoneName');\n }\n timeZone = ecma402_abstract_1.CanonicalizeTimeZoneName(timeZone, {\n tzData: exports.DateTimeFormat.tzData,\n uppercaseLinks: UPPERCASED_LINKS,\n });\n }\n else {\n timeZone = DEFAULT_TIMEZONE;\n }\n exports.DateTimeFormat.__defaultTimeZone = timeZone;\n};\nexports.DateTimeFormat.relevantExtensionKeys = ['nu', 'ca', 'hc'];\nexports.DateTimeFormat.__defaultTimeZone = DEFAULT_TIMEZONE;\nexports.DateTimeFormat.getDefaultTimeZone = function () { return exports.DateTimeFormat.__defaultTimeZone; };\nexports.DateTimeFormat.__addLocaleData = function __addLocaleData() {\n var data = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n data[_i] = arguments[_i];\n }\n var _loop_1 = function (d, locale) {\n var dateFormat = d.dateFormat, timeFormat = d.timeFormat, dateTimeFormat = d.dateTimeFormat, formats = d.formats, intervalFormats = d.intervalFormats, rawData = tslib_1.__rest(d, [\"dateFormat\", \"timeFormat\", \"dateTimeFormat\", \"formats\", \"intervalFormats\"]);\n var processedData = tslib_1.__assign(tslib_1.__assign({}, rawData), { dateFormat: {\n full: skeleton_1.parseDateTimeSkeleton(dateFormat.full),\n long: skeleton_1.parseDateTimeSkeleton(dateFormat.long),\n medium: skeleton_1.parseDateTimeSkeleton(dateFormat.medium),\n short: skeleton_1.parseDateTimeSkeleton(dateFormat.short),\n }, timeFormat: {\n full: skeleton_1.parseDateTimeSkeleton(timeFormat.full),\n long: skeleton_1.parseDateTimeSkeleton(timeFormat.long),\n medium: skeleton_1.parseDateTimeSkeleton(timeFormat.medium),\n short: skeleton_1.parseDateTimeSkeleton(timeFormat.short),\n }, dateTimeFormat: {\n full: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.full).pattern,\n long: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.long).pattern,\n medium: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.medium).pattern,\n short: skeleton_1.parseDateTimeSkeleton(dateTimeFormat.short).pattern,\n }, formats: {} });\n var _loop_2 = function (calendar) {\n processedData.formats[calendar] = Object.keys(formats[calendar]).map(function (skeleton) {\n return skeleton_1.parseDateTimeSkeleton(skeleton, formats[calendar][skeleton], intervalFormats[skeleton], intervalFormats.intervalFormatFallback);\n });\n };\n for (var calendar in formats) {\n _loop_2(calendar);\n }\n var minimizedLocale = new Intl.Locale(locale)\n .minimize()\n .toString();\n exports.DateTimeFormat.localeData[locale] = exports.DateTimeFormat.localeData[minimizedLocale] = processedData;\n exports.DateTimeFormat.availableLocales.add(locale);\n exports.DateTimeFormat.availableLocales.add(minimizedLocale);\n if (!exports.DateTimeFormat.__defaultLocale) {\n exports.DateTimeFormat.__defaultLocale = minimizedLocale;\n }\n };\n for (var _a = 0, data_1 = data; _a < data_1.length; _a++) {\n var _b = data_1[_a], d = _b.data, locale = _b.locale;\n _loop_1(d, locale);\n }\n};\nObject.defineProperty(exports.DateTimeFormat.prototype, 'format', formatDescriptor);\nexports.DateTimeFormat.__defaultLocale = '';\nexports.DateTimeFormat.localeData = {};\nexports.DateTimeFormat.availableLocales = new Set();\nexports.DateTimeFormat.getDefaultLocale = function () {\n return exports.DateTimeFormat.__defaultLocale;\n};\nexports.DateTimeFormat.polyfilled = true;\nexports.DateTimeFormat.tzData = {};\nexports.DateTimeFormat.__addTZData = function (d) {\n exports.DateTimeFormat.tzData = packer_1.unpack(d);\n};\ntry {\n if (typeof Symbol !== 'undefined') {\n Object.defineProperty(exports.DateTimeFormat.prototype, Symbol.toStringTag, {\n value: 'Intl.DateTimeFormat',\n writable: false,\n enumerable: false,\n configurable: true,\n });\n }\n Object.defineProperty(exports.DateTimeFormat.prototype.constructor, 'length', {\n value: 1,\n writable: false,\n enumerable: false,\n configurable: true,\n });\n}\ncatch (e) {\n // Meta fix so we're test262-compliant, not important\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ResolveLocale = void 0;\nvar LookupMatcher_1 = require(\"./LookupMatcher\");\nvar BestFitMatcher_1 = require(\"./BestFitMatcher\");\nvar utils_1 = require(\"./utils\");\nvar UnicodeExtensionValue_1 = require(\"./UnicodeExtensionValue\");\n/**\n * https://tc39.es/ecma402/#sec-resolvelocale\n */\nfunction ResolveLocale(availableLocales, requestedLocales, options, relevantExtensionKeys, localeData, getDefaultLocale) {\n var matcher = options.localeMatcher;\n var r;\n if (matcher === 'lookup') {\n r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);\n }\n else {\n r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);\n }\n var foundLocale = r.locale;\n var result = { locale: '', dataLocale: foundLocale };\n var supportedExtension = '-u';\n for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {\n var key = relevantExtensionKeys_1[_i];\n utils_1.invariant(foundLocale in localeData, \"Missing locale data for \" + foundLocale);\n var foundLocaleData = localeData[foundLocale];\n utils_1.invariant(typeof foundLocaleData === 'object' && foundLocaleData !== null, \"locale data \" + key + \" must be an object\");\n var keyLocaleData = foundLocaleData[key];\n utils_1.invariant(Array.isArray(keyLocaleData), \"keyLocaleData for \" + key + \" must be an array\");\n var value = keyLocaleData[0];\n utils_1.invariant(typeof value === 'string' || value === null, \"value must be string or null but got \" + typeof value + \" in key \" + key);\n var supportedExtensionAddition = '';\n if (r.extension) {\n var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);\n if (requestedValue !== undefined) {\n if (requestedValue !== '') {\n if (~keyLocaleData.indexOf(requestedValue)) {\n value = requestedValue;\n supportedExtensionAddition = \"-\" + key + \"-\" + value;\n }\n }\n else if (~requestedValue.indexOf('true')) {\n value = 'true';\n supportedExtensionAddition = \"-\" + key;\n }\n }\n }\n if (key in options) {\n var optionsValue = options[key];\n utils_1.invariant(typeof optionsValue === 'string' ||\n typeof optionsValue === 'undefined' ||\n optionsValue === null, 'optionsValue must be String, Undefined or Null');\n if (~keyLocaleData.indexOf(optionsValue)) {\n if (optionsValue !== value) {\n value = optionsValue;\n supportedExtensionAddition = '';\n }\n }\n }\n result[key] = value;\n supportedExtension += supportedExtensionAddition;\n }\n if (supportedExtension.length > 2) {\n var privateIndex = foundLocale.indexOf('-x-');\n if (privateIndex === -1) {\n foundLocale = foundLocale + supportedExtension;\n }\n else {\n var preExtension = foundLocale.slice(0, privateIndex);\n var postExtension = foundLocale.slice(privateIndex, foundLocale.length);\n foundLocale = preExtension + supportedExtension + postExtension;\n }\n foundLocale = Intl.getCanonicalLocales(foundLocale)[0];\n }\n result.locale = foundLocale;\n return result;\n}\nexports.ResolveLocale = ResolveLocale;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PartitionDateTimePattern = void 0;\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar FormatDateTimePattern_1 = require(\"./FormatDateTimePattern\");\n/**\n * https://tc39.es/ecma402/#sec-partitiondatetimepattern\n * @param dtf\n * @param x\n */\nfunction PartitionDateTimePattern(dtf, x, implDetails) {\n x = ecma402_abstract_1.TimeClip(x);\n if (isNaN(x)) {\n throw new RangeError('invalid time');\n }\n /** IMPL START */\n var getInternalSlots = implDetails.getInternalSlots;\n var internalSlots = getInternalSlots(dtf);\n /** IMPL END */\n var pattern = internalSlots.pattern;\n return FormatDateTimePattern_1.FormatDateTimePattern(dtf, ecma402_abstract_1.PartitionPattern(pattern), x, implDetails);\n}\nexports.PartitionDateTimePattern = PartitionDateTimePattern;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FormatDateTimePattern = void 0;\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar utils_1 = require(\"./utils\");\nvar ToLocalTime_1 = require(\"./ToLocalTime\");\nfunction pad(n) {\n if (n < 10) {\n return \"0\" + n;\n }\n return String(n);\n}\nfunction offsetToGmtString(gmtFormat, hourFormat, offsetInMs, style) {\n var offsetInMinutes = Math.floor(offsetInMs / 60000);\n var mins = Math.abs(offsetInMinutes) % 60;\n var hours = Math.floor(Math.abs(offsetInMinutes) / 60);\n var _a = hourFormat.split(';'), positivePattern = _a[0], negativePattern = _a[1];\n var offsetStr = '';\n var pattern = offsetInMs < 0 ? negativePattern : positivePattern;\n if (style === 'long') {\n offsetStr = pattern\n .replace('HH', pad(hours))\n .replace('H', String(hours))\n .replace('mm', pad(mins))\n .replace('m', String(mins));\n }\n else if (mins || hours) {\n if (!mins) {\n pattern = pattern.replace(/:?m+/, '');\n }\n offsetStr = pattern.replace(/H+/, String(hours)).replace(/m+/, String(mins));\n }\n return gmtFormat.replace('{0}', offsetStr);\n}\n/**\n * https://tc39.es/ecma402/#sec-partitiondatetimepattern\n * @param dtf\n * @param x\n */\nfunction FormatDateTimePattern(dtf, patternParts, x, _a) {\n var getInternalSlots = _a.getInternalSlots, localeData = _a.localeData, getDefaultTimeZone = _a.getDefaultTimeZone, tzData = _a.tzData;\n x = ecma402_abstract_1.TimeClip(x);\n /** IMPL START */\n var internalSlots = getInternalSlots(dtf);\n var dataLocale = internalSlots.dataLocale;\n var dataLocaleData = localeData[dataLocale];\n /** IMPL END */\n var locale = internalSlots.locale;\n var nfOptions = Object.create(null);\n nfOptions.useGrouping = false;\n var nf = new Intl.NumberFormat(locale, nfOptions);\n var nf2Options = Object.create(null);\n nf2Options.minimumIntegerDigits = 2;\n nf2Options.useGrouping = false;\n var nf2 = new Intl.NumberFormat(locale, nf2Options);\n var fractionalSecondDigits = internalSlots.fractionalSecondDigits;\n var nf3;\n if (fractionalSecondDigits !== undefined) {\n var nf3Options = Object.create(null);\n nf3Options.minimumIntegerDigits = fractionalSecondDigits;\n nf3Options.useGrouping = false;\n nf3 = new Intl.NumberFormat(locale, nf3Options);\n }\n var tm = ToLocalTime_1.ToLocalTime(x, \n // @ts-ignore\n internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });\n var result = [];\n for (var _i = 0, patternParts_1 = patternParts; _i < patternParts_1.length; _i++) {\n var patternPart = patternParts_1[_i];\n var p = patternPart.type;\n if (p === 'literal') {\n result.push({\n type: 'literal',\n value: patternPart.value,\n });\n }\n else if (p === 'fractionalSecondDigits') {\n var v = Math.floor(tm.millisecond * Math.pow(10, ((fractionalSecondDigits || 0) - 3)));\n result.push({\n // @ts-expect-error Spec is not there yet\n type: 'fractionalSecond',\n value: nf3.format(v),\n });\n }\n else if (p === 'dayPeriod') {\n // TODO\n }\n else if (utils_1.DATE_TIME_PROPS.indexOf(p) > -1) {\n var fv = '';\n var f = internalSlots[p];\n // @ts-ignore\n var v = tm[p];\n if (p === 'year' && v <= 0) {\n v = 1 - v;\n }\n if (p === 'month') {\n v++;\n }\n var hourCycle = internalSlots.hourCycle;\n if (p === 'hour' && (hourCycle === 'h11' || hourCycle === 'h12')) {\n v = v % 12;\n if (v === 0 && hourCycle === 'h12') {\n v = 12;\n }\n }\n if (p === 'hour' && hourCycle === 'h24') {\n if (v === 0) {\n v = 24;\n }\n }\n if (f === 'numeric') {\n fv = nf.format(v);\n }\n else if (f === '2-digit') {\n fv = nf2.format(v);\n if (fv.length > 2) {\n fv = fv.slice(fv.length - 2, fv.length);\n }\n }\n else if (f === 'narrow' || f === 'short' || f === 'long') {\n if (p === 'era') {\n fv = dataLocaleData[p][f][v];\n }\n else if (p === 'timeZoneName') {\n var timeZoneName = dataLocaleData.timeZoneName, gmtFormat = dataLocaleData.gmtFormat, hourFormat = dataLocaleData.hourFormat;\n var timeZone = internalSlots.timeZone || getDefaultTimeZone();\n var timeZoneData = timeZoneName[timeZone];\n if (timeZoneData && timeZoneData[f]) {\n fv = timeZoneData[f][+tm.inDST];\n }\n else {\n // Fallback to gmtFormat\n fv = offsetToGmtString(gmtFormat, hourFormat, tm.timeZoneOffset, f);\n }\n }\n else if (p === 'month') {\n fv = dataLocaleData.month[f][v - 1];\n }\n else {\n fv = dataLocaleData[p][f][v];\n }\n }\n result.push({\n type: p,\n value: fv,\n });\n }\n else if (p === 'ampm') {\n var v = tm.hour;\n var fv = void 0;\n if (v > 11) {\n fv = dataLocaleData.pm;\n }\n else {\n fv = dataLocaleData.am;\n }\n result.push({\n type: 'dayPeriod',\n value: fv,\n });\n }\n else if (p === 'relatedYear') {\n var v = tm.relatedYear;\n // @ts-ignore\n var fv = nf.format(v);\n result.push({\n // @ts-ignore TODO: Fix TS type\n type: 'relatedYear',\n value: fv,\n });\n }\n else if (p === 'yearName') {\n var v = tm.yearName;\n // @ts-ignore\n var fv = nf.format(v);\n result.push({\n // @ts-ignore TODO: Fix TS type\n type: 'yearName',\n value: fv,\n });\n }\n }\n return result;\n}\nexports.FormatDateTimePattern = FormatDateTimePattern;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ToLocalTime = void 0;\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nfunction getApplicableZoneData(t, timeZone, tzData) {\n var _a;\n var zoneData = tzData[timeZone];\n // We don't have data for this so just say it's UTC\n if (!zoneData) {\n return [0, false];\n }\n var i = 0;\n var offset = 0;\n var dst = false;\n for (; i <= zoneData.length; i++) {\n if (i === zoneData.length || zoneData[i][0] * 1e3 > t) {\n ;\n _a = zoneData[i - 1], offset = _a[2], dst = _a[3];\n break;\n }\n }\n return [offset * 1e3, dst];\n}\n/**\n * https://tc39.es/ecma402/#sec-tolocaltime\n * @param t\n * @param calendar\n * @param timeZone\n */\nfunction ToLocalTime(t, calendar, timeZone, _a) {\n var tzData = _a.tzData;\n ecma402_abstract_1.invariant(ecma402_abstract_1.Type(t) === 'Number', 'invalid time');\n ecma402_abstract_1.invariant(calendar === 'gregory', 'We only support Gregory calendar right now');\n var _b = getApplicableZoneData(t, timeZone, tzData), timeZoneOffset = _b[0], inDST = _b[1];\n var tz = t + timeZoneOffset;\n var year = ecma402_abstract_1.YearFromTime(tz);\n return {\n weekday: ecma402_abstract_1.WeekDay(tz),\n era: year < 0 ? 'BC' : 'AD',\n year: year,\n relatedYear: undefined,\n yearName: undefined,\n month: ecma402_abstract_1.MonthFromTime(tz),\n day: ecma402_abstract_1.DateFromTime(tz),\n hour: ecma402_abstract_1.HourFromTime(tz),\n minute: ecma402_abstract_1.MinFromTime(tz),\n second: ecma402_abstract_1.SecFromTime(tz),\n millisecond: ecma402_abstract_1.msFromTime(tz),\n inDST: inDST,\n // IMPORTANT: Not in spec\n timeZoneOffset: timeZoneOffset,\n };\n}\nexports.ToLocalTime = ToLocalTime;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.splitRangePattern = exports.splitFallbackRangePattern = exports.parseDateTimeSkeleton = exports.processDateTimePattern = void 0;\nvar tslib_1 = require(\"tslib\");\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\n/**\n * https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * Credit: https://github.com/caridy/intl-datetimeformat-pattern/blob/master/index.js\n * with some tweaks\n */\nvar DATE_TIME_REGEX = /(?:[Eec]{1,6}|G{1,5}|[Qq]{1,5}|(?:[yYur]+|U{1,5})|[ML]{1,5}|d{1,2}|D{1,3}|F{1}|[abB]{1,5}|[hkHK]{1,2}|w{1,2}|W{1}|m{1,2}|s{1,2}|[zZOvVxX]{1,4})(?=([^']*'[^']*')*[^']*$)/g;\n// trim patterns after transformations\nvar expPatternTrimmer = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g;\nfunction matchSkeletonPattern(match, result) {\n var len = match.length;\n switch (match[0]) {\n // Era\n case 'G':\n result.era = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n return '{era}';\n // Year\n case 'y':\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n result.year = len === 2 ? '2-digit' : 'numeric';\n return '{year}';\n // Quarter\n case 'q':\n case 'Q':\n throw new RangeError('`w/Q` (quarter) patterns are not supported');\n // Month\n case 'M':\n case 'L':\n result.month = ['numeric', '2-digit', 'short', 'long', 'narrow'][len - 1];\n return '{month}';\n // Week\n case 'w':\n case 'W':\n throw new RangeError('`w/W` (week of year) patterns are not supported');\n case 'd':\n result.day = ['numeric', '2-digit'][len - 1];\n return '{day}';\n case 'D':\n case 'F':\n case 'g':\n result.day = 'numeric';\n return '{day}';\n // Weekday\n case 'E':\n result.weekday = len === 4 ? 'long' : len === 5 ? 'narrow' : 'short';\n return '{weekday}';\n case 'e':\n result.weekday = [\n undefined,\n undefined,\n 'short',\n 'long',\n 'narrow',\n 'short',\n ][len - 1];\n return '{weekday}';\n case 'c':\n result.weekday = [\n undefined,\n undefined,\n 'short',\n 'long',\n 'narrow',\n 'short',\n ][len - 1];\n return '{weekday}';\n // Period\n case 'a': // AM, PM\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n result.hour12 = true;\n return '{ampm}';\n // Hour\n case 'h':\n result.hour = ['numeric', '2-digit'][len - 1];\n result.hour12 = true;\n return '{hour}';\n case 'H':\n result.hour = ['numeric', '2-digit'][len - 1];\n return '{hour}';\n case 'K':\n result.hour = ['numeric', '2-digit'][len - 1];\n result.hour12 = true;\n return '{hour}';\n case 'k':\n result.hour = ['numeric', '2-digit'][len - 1];\n return '{hour}';\n case 'j':\n case 'J':\n case 'C':\n throw new RangeError('`j/J/C` (hour) patterns are not supported, use `h/H/K/k` instead');\n // Minute\n case 'm':\n result.minute = ['numeric', '2-digit'][len - 1];\n return '{minute}';\n // Second\n case 's':\n result.second = ['numeric', '2-digit'][len - 1];\n return '{second}';\n case 'S':\n case 'A':\n result.second = 'numeric';\n return '{second}';\n // Zone\n case 'z': // 1..3, 4: specific non-location format\n case 'Z': // 1..3, 4, 5: The ISO8601 varios formats\n case 'O': // 1, 4: miliseconds in day short, long\n case 'v': // 1, 4: generic non-location format\n case 'V': // 1, 2, 3, 4: time zone ID or city\n case 'X': // 1, 2, 3, 4: The ISO8601 varios formats\n case 'x': // 1, 2, 3, 4: The ISO8601 varios formats\n result.timeZoneName = len < 4 ? 'short' : 'long';\n return '{timeZoneName}';\n }\n return '';\n}\nfunction skeletonTokenToTable2(c) {\n switch (c) {\n // Era\n case 'G':\n return 'era';\n // Year\n case 'y':\n case 'Y':\n case 'u':\n case 'U':\n case 'r':\n return 'year';\n // Month\n case 'M':\n case 'L':\n return 'month';\n // Day\n case 'd':\n case 'D':\n case 'F':\n case 'g':\n return 'day';\n // Period\n case 'a': // AM, PM\n case 'b': // am, pm, noon, midnight\n case 'B': // flexible day periods\n return 'ampm';\n // Hour\n case 'h':\n case 'H':\n case 'K':\n case 'k':\n return 'hour';\n // Minute\n case 'm':\n return 'minute';\n // Second\n case 's':\n case 'S':\n case 'A':\n return 'second';\n default:\n throw new RangeError('Invalid range pattern token');\n }\n}\nfunction processDateTimePattern(pattern, result) {\n var literals = [];\n // Use skeleton to populate result, but use mapped pattern to populate pattern\n var pattern12 = pattern\n // Double apostrophe\n .replace(/'{2}/g, '{apostrophe}')\n // Apostrophe-escaped\n .replace(/'(.*?)'/g, function (_, literal) {\n literals.push(literal);\n return \"$$\" + (literals.length - 1) + \"$$\";\n })\n .replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result || {}); });\n //Restore literals\n if (literals.length) {\n pattern12 = pattern12\n .replace(/\\$\\$(\\d+)\\$\\$/g, function (_, i) {\n return literals[+i];\n })\n .replace(/\\{apostrophe\\}/g, \"'\");\n }\n // Handle apostrophe-escaped things\n return [\n pattern12\n .replace(/([\\s\\uFEFF\\xA0])\\{ampm\\}([\\s\\uFEFF\\xA0])/, '$1')\n .replace('{ampm}', '')\n .replace(expPatternTrimmer, ''),\n pattern12,\n ];\n}\nexports.processDateTimePattern = processDateTimePattern;\n/**\n * Parse Date time skeleton into Intl.DateTimeFormatOptions\n * Ref: https://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * @public\n * @param skeleton skeleton string\n */\nfunction parseDateTimeSkeleton(skeleton, rawPattern, rangePatterns, intervalFormatFallback) {\n if (rawPattern === void 0) { rawPattern = skeleton; }\n var result = {\n pattern: '',\n pattern12: '',\n skeleton: skeleton,\n rawPattern: rawPattern,\n rangePatterns: {},\n rangePatterns12: {},\n };\n if (rangePatterns) {\n for (var k in rangePatterns) {\n var key = skeletonTokenToTable2(k);\n var rawPattern_1 = rangePatterns[k];\n var intervalResult = {\n patternParts: [],\n };\n var _a = processDateTimePattern(rawPattern_1, intervalResult), pattern_1 = _a[0], pattern12_1 = _a[1];\n result.rangePatterns[key] = tslib_1.__assign(tslib_1.__assign({}, intervalResult), { patternParts: splitRangePattern(pattern_1) });\n result.rangePatterns12[key] = tslib_1.__assign(tslib_1.__assign({}, intervalResult), { patternParts: splitRangePattern(pattern12_1) });\n }\n }\n if (intervalFormatFallback) {\n var patternParts = splitFallbackRangePattern(intervalFormatFallback);\n result.rangePatterns.default = {\n patternParts: patternParts,\n };\n result.rangePatterns12.default = {\n patternParts: patternParts,\n };\n }\n // Process skeleton\n skeleton.replace(DATE_TIME_REGEX, function (m) { return matchSkeletonPattern(m, result); });\n var _b = processDateTimePattern(rawPattern), pattern = _b[0], pattern12 = _b[1];\n result.pattern = pattern;\n result.pattern12 = pattern12;\n return result;\n}\nexports.parseDateTimeSkeleton = parseDateTimeSkeleton;\nfunction splitFallbackRangePattern(pattern) {\n var parts = pattern.split(/(\\{[0|1]\\})/g).filter(Boolean);\n return parts.map(function (pattern) {\n switch (pattern) {\n case '{0}':\n return {\n source: ecma402_abstract_1.RangePatternType.startRange,\n pattern: pattern,\n };\n case '{1}':\n return {\n source: ecma402_abstract_1.RangePatternType.endRange,\n pattern: pattern,\n };\n default:\n return {\n source: ecma402_abstract_1.RangePatternType.shared,\n pattern: pattern,\n };\n }\n });\n}\nexports.splitFallbackRangePattern = splitFallbackRangePattern;\nfunction splitRangePattern(pattern) {\n var PART_REGEX = /\\{(.*?)\\}/g;\n // Map of part and index within the string\n var parts = {};\n var match;\n var splitIndex = 0;\n while ((match = PART_REGEX.exec(pattern))) {\n if (!(match[0] in parts)) {\n parts[match[0]] = match.index;\n }\n else {\n splitIndex = match.index;\n break;\n }\n }\n if (!splitIndex) {\n return [\n {\n source: ecma402_abstract_1.RangePatternType.startRange,\n pattern: pattern,\n },\n ];\n }\n return [\n {\n source: ecma402_abstract_1.RangePatternType.startRange,\n pattern: pattern.slice(0, splitIndex),\n },\n {\n source: ecma402_abstract_1.RangePatternType.endRange,\n pattern: pattern.slice(splitIndex),\n },\n ];\n}\nexports.splitRangePattern = splitRangePattern;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ToDateTimeOptions = void 0;\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\n/**\n * https://tc39.es/ecma402/#sec-todatetimeoptions\n * @param options\n * @param required\n * @param defaults\n */\nfunction ToDateTimeOptions(options, required, defaults) {\n if (options === undefined) {\n options = null;\n }\n else {\n options = ecma402_abstract_1.ToObject(options);\n }\n options = Object.create(options);\n var needDefaults = true;\n if (required === 'date' || required === 'any') {\n for (var _i = 0, _a = ['weekday', 'year', 'month', 'day']; _i < _a.length; _i++) {\n var prop = _a[_i];\n var value = options[prop];\n if (value !== undefined) {\n needDefaults = false;\n }\n }\n }\n if (required === 'time' || required === 'any') {\n for (var _b = 0, _c = [\n 'dayPeriod',\n 'hour',\n 'minute',\n 'second',\n 'fractionalSecondDigits',\n ]; _b < _c.length; _b++) {\n var prop = _c[_b];\n var value = options[prop];\n if (value !== undefined) {\n needDefaults = false;\n }\n }\n }\n if (options.dateStyle !== undefined || options.timeStyle !== undefined) {\n needDefaults = false;\n }\n if (required === 'date' && options.timeStyle) {\n throw new TypeError('Intl.DateTimeFormat date was required but timeStyle was included');\n }\n if (required === 'time' && options.dateStyle) {\n throw new TypeError('Intl.DateTimeFormat time was required but dateStyle was included');\n }\n if (needDefaults && (defaults === 'date' || defaults === 'all')) {\n for (var _d = 0, _e = ['year', 'month', 'day']; _d < _e.length; _d++) {\n var prop = _e[_d];\n options[prop] = 'numeric';\n }\n }\n if (needDefaults && (defaults === 'time' || defaults === 'all')) {\n for (var _f = 0, _g = ['hour', 'minute', 'second']; _f < _g.length; _f++) {\n var prop = _g[_f];\n options[prop] = 'numeric';\n }\n }\n return options;\n}\nexports.ToDateTimeOptions = ToDateTimeOptions;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PartitionDateTimeRangePattern = void 0;\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar ToLocalTime_1 = require(\"./ToLocalTime\");\nvar FormatDateTimePattern_1 = require(\"./FormatDateTimePattern\");\nvar TABLE_2_FIELDS = [\n 'era',\n 'year',\n 'month',\n 'day',\n 'dayPeriod',\n 'ampm',\n 'hour',\n 'minute',\n 'second',\n 'fractionalSecondDigits',\n];\nfunction PartitionDateTimeRangePattern(dtf, x, y, implDetails) {\n x = ecma402_abstract_1.TimeClip(x);\n if (isNaN(x)) {\n throw new RangeError('Invalid start time');\n }\n y = ecma402_abstract_1.TimeClip(y);\n if (isNaN(y)) {\n throw new RangeError('Invalid end time');\n }\n /** IMPL START */\n var getInternalSlots = implDetails.getInternalSlots, tzData = implDetails.tzData;\n var internalSlots = getInternalSlots(dtf);\n /** IMPL END */\n var tm1 = ToLocalTime_1.ToLocalTime(x, \n // @ts-ignore\n internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });\n var tm2 = ToLocalTime_1.ToLocalTime(y, \n // @ts-ignore\n internalSlots.calendar, internalSlots.timeZone, { tzData: tzData });\n var pattern = internalSlots.pattern, rangePatterns = internalSlots.rangePatterns;\n var rangePattern;\n var dateFieldsPracticallyEqual = true;\n var patternContainsLargerDateField = false;\n for (var _i = 0, TABLE_2_FIELDS_1 = TABLE_2_FIELDS; _i < TABLE_2_FIELDS_1.length; _i++) {\n var fieldName = TABLE_2_FIELDS_1[_i];\n if (dateFieldsPracticallyEqual && !patternContainsLargerDateField) {\n var rp = fieldName in rangePatterns ? rangePatterns[fieldName] : undefined;\n if (rangePattern !== undefined && rp === undefined) {\n patternContainsLargerDateField = true;\n }\n else {\n rangePattern = rp;\n if (fieldName === 'ampm') {\n var v1 = tm1.hour;\n var v2 = tm2.hour;\n if ((v1 > 11 && v2 < 11) || (v1 < 11 && v2 > 11)) {\n dateFieldsPracticallyEqual = false;\n }\n }\n else if (fieldName === 'dayPeriod') {\n // TODO\n }\n else if (fieldName === 'fractionalSecondDigits') {\n var fractionalSecondDigits = internalSlots.fractionalSecondDigits;\n if (fractionalSecondDigits === undefined) {\n fractionalSecondDigits = 3;\n }\n var v1 = Math.floor(tm1.millisecond * Math.pow(10, (fractionalSecondDigits - 3)));\n var v2 = Math.floor(tm2.millisecond * Math.pow(10, (fractionalSecondDigits - 3)));\n if (!ecma402_abstract_1.SameValue(v1, v2)) {\n dateFieldsPracticallyEqual = false;\n }\n }\n else {\n var v1 = tm1[fieldName];\n var v2 = tm2[fieldName];\n if (!ecma402_abstract_1.SameValue(v1, v2)) {\n dateFieldsPracticallyEqual = false;\n }\n }\n }\n }\n }\n if (dateFieldsPracticallyEqual) {\n var result_2 = FormatDateTimePattern_1.FormatDateTimePattern(dtf, ecma402_abstract_1.PartitionPattern(pattern), x, implDetails);\n for (var _a = 0, result_1 = result_2; _a < result_1.length; _a++) {\n var r = result_1[_a];\n r.source = ecma402_abstract_1.RangePatternType.shared;\n }\n return result_2;\n }\n var result = [];\n if (rangePattern === undefined) {\n rangePattern = rangePatterns.default;\n /** IMPL DETAILS */\n // Now we have to replace {0} & {1} with actual pattern\n for (var _b = 0, _c = rangePattern.patternParts; _b < _c.length; _b++) {\n var patternPart = _c[_b];\n if (patternPart.pattern === '{0}' || patternPart.pattern === '{1}') {\n patternPart.pattern = pattern;\n }\n }\n }\n for (var _d = 0, _e = rangePattern.patternParts; _d < _e.length; _d++) {\n var rangePatternPart = _e[_d];\n var source = rangePatternPart.source, pattern_1 = rangePatternPart.pattern;\n var z = void 0;\n if (source === ecma402_abstract_1.RangePatternType.startRange ||\n source === ecma402_abstract_1.RangePatternType.shared) {\n z = x;\n }\n else {\n z = y;\n }\n var patternParts = ecma402_abstract_1.PartitionPattern(pattern_1);\n var partResult = FormatDateTimePattern_1.FormatDateTimePattern(dtf, patternParts, z, implDetails);\n for (var _f = 0, partResult_1 = partResult; _f < partResult_1.length; _f++) {\n var r = partResult_1[_f];\n r.source = source;\n }\n result = result.concat(partResult);\n }\n return result;\n}\nexports.PartitionDateTimeRangePattern = PartitionDateTimeRangePattern;\n","/**\n * @license\n * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)\n * MIT-licensed (http://opensource.org/licenses/MIT)\n */\n\n/**\n * @fileoverview Based on PlotKitLayout, but modified to meet the needs of\n * dygraphs.\n */\n\n/*global Dygraph:false */\n\"use strict\";\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nvar _dygraphUtils = require('./dygraph-utils');\n\nvar utils = _interopRequireWildcard(_dygraphUtils);\n\n/**\n * Creates a new DygraphLayout object.\n *\n * This class contains all the data to be charted.\n * It uses data coordinates, but also records the chart range (in data\n * coordinates) and hence is able to calculate percentage positions ('In this\n * view, Point A lies 25% down the x-axis.')\n *\n * Two things that it does not do are:\n * 1. Record pixel coordinates for anything.\n * 2. (oddly) determine anything about the layout of chart elements.\n *\n * The naming is a vestige of Dygraph's original PlotKit roots.\n *\n * @constructor\n */\nvar DygraphLayout = function DygraphLayout(dygraph) {\n this.dygraph_ = dygraph;\n /**\n * Array of points for each series.\n *\n * [series index][row index in series] = |Point| structure,\n * where series index refers to visible series only, and the\n * point index is for the reduced set of points for the current\n * zoom region (including one point just outside the window).\n * All points in the same row index share the same X value.\n *\n * @type {Array.>}\n */\n this.points = [];\n this.setNames = [];\n this.annotations = [];\n this.yAxes_ = null;\n\n // TODO(danvk): it's odd that xTicks_ and yTicks_ are inputs, but xticks and\n // yticks are outputs. Clean this up.\n this.xTicks_ = null;\n this.yTicks_ = null;\n};\n\n/**\n * Add points for a single series.\n *\n * @param {string} setname Name of the series.\n * @param {Array.} set_xy Points for the series.\n */\nDygraphLayout.prototype.addDataset = function (setname, set_xy) {\n this.points.push(set_xy);\n this.setNames.push(setname);\n};\n\n/**\n * Returns the box which the chart should be drawn in. This is the canvas's\n * box, less space needed for the axis and chart labels.\n *\n * @return {{x: number, y: number, w: number, h: number}}\n */\nDygraphLayout.prototype.getPlotArea = function () {\n return this.area_;\n};\n\n// Compute the box which the chart should be drawn in. This is the canvas's\n// box, less space needed for axis, chart labels, and other plug-ins.\n// NOTE: This should only be called by Dygraph.predraw_().\nDygraphLayout.prototype.computePlotArea = function () {\n var area = {\n // TODO(danvk): per-axis setting.\n x: 0,\n y: 0\n };\n\n area.w = this.dygraph_.width_ - area.x - this.dygraph_.getOption('rightGap');\n area.h = this.dygraph_.height_;\n\n // Let plugins reserve space.\n var e = {\n chart_div: this.dygraph_.graphDiv,\n reserveSpaceLeft: function reserveSpaceLeft(px) {\n var r = {\n x: area.x,\n y: area.y,\n w: px,\n h: area.h\n };\n area.x += px;\n area.w -= px;\n return r;\n },\n reserveSpaceRight: function reserveSpaceRight(px) {\n var r = {\n x: area.x + area.w - px,\n y: area.y,\n w: px,\n h: area.h\n };\n area.w -= px;\n return r;\n },\n reserveSpaceTop: function reserveSpaceTop(px) {\n var r = {\n x: area.x,\n y: area.y,\n w: area.w,\n h: px\n };\n area.y += px;\n area.h -= px;\n return r;\n },\n reserveSpaceBottom: function reserveSpaceBottom(px) {\n var r = {\n x: area.x,\n y: area.y + area.h - px,\n w: area.w,\n h: px\n };\n area.h -= px;\n return r;\n },\n chartRect: function chartRect() {\n return { x: area.x, y: area.y, w: area.w, h: area.h };\n }\n };\n this.dygraph_.cascadeEvents_('layout', e);\n\n this.area_ = area;\n};\n\nDygraphLayout.prototype.setAnnotations = function (ann) {\n // The Dygraph object's annotations aren't parsed. We parse them here and\n // save a copy. If there is no parser, then the user must be using raw format.\n this.annotations = [];\n var parse = this.dygraph_.getOption('xValueParser') || function (x) {\n return x;\n };\n for (var i = 0; i < ann.length; i++) {\n var a = {};\n if (!ann[i].xval && ann[i].x === undefined) {\n console.error(\"Annotations must have an 'x' property\");\n return;\n }\n if (ann[i].icon && !(ann[i].hasOwnProperty('width') && ann[i].hasOwnProperty('height'))) {\n console.error(\"Must set width and height when setting \" + \"annotation.icon property\");\n return;\n }\n utils.update(a, ann[i]);\n if (!a.xval) a.xval = parse(a.x);\n this.annotations.push(a);\n }\n};\n\nDygraphLayout.prototype.setXTicks = function (xTicks) {\n this.xTicks_ = xTicks;\n};\n\n// TODO(danvk): add this to the Dygraph object's API or move it into Layout.\nDygraphLayout.prototype.setYAxes = function (yAxes) {\n this.yAxes_ = yAxes;\n};\n\nDygraphLayout.prototype.evaluate = function () {\n this._xAxis = {};\n this._evaluateLimits();\n this._evaluateLineCharts();\n this._evaluateLineTicks();\n this._evaluateAnnotations();\n};\n\nDygraphLayout.prototype._evaluateLimits = function () {\n var xlimits = this.dygraph_.xAxisRange();\n this._xAxis.minval = xlimits[0];\n this._xAxis.maxval = xlimits[1];\n var xrange = xlimits[1] - xlimits[0];\n this._xAxis.scale = xrange !== 0 ? 1 / xrange : 1.0;\n\n if (this.dygraph_.getOptionForAxis(\"logscale\", 'x')) {\n this._xAxis.xlogrange = utils.log10(this._xAxis.maxval) - utils.log10(this._xAxis.minval);\n this._xAxis.xlogscale = this._xAxis.xlogrange !== 0 ? 1.0 / this._xAxis.xlogrange : 1.0;\n }\n for (var i = 0; i < this.yAxes_.length; i++) {\n var axis = this.yAxes_[i];\n axis.minyval = axis.computedValueRange[0];\n axis.maxyval = axis.computedValueRange[1];\n axis.yrange = axis.maxyval - axis.minyval;\n axis.yscale = axis.yrange !== 0 ? 1.0 / axis.yrange : 1.0;\n\n if (this.dygraph_.getOption(\"logscale\")) {\n axis.ylogrange = utils.log10(axis.maxyval) - utils.log10(axis.minyval);\n axis.ylogscale = axis.ylogrange !== 0 ? 1.0 / axis.ylogrange : 1.0;\n if (!isFinite(axis.ylogrange) || isNaN(axis.ylogrange)) {\n console.error('axis ' + i + ' of graph at ' + axis.g + ' can\\'t be displayed in log scale for range [' + axis.minyval + ' - ' + axis.maxyval + ']');\n }\n }\n }\n};\n\nDygraphLayout.calcXNormal_ = function (value, xAxis, logscale) {\n if (logscale) {\n return (utils.log10(value) - utils.log10(xAxis.minval)) * xAxis.xlogscale;\n } else {\n return (value - xAxis.minval) * xAxis.scale;\n }\n};\n\n/**\n * @param {DygraphAxisType} axis\n * @param {number} value\n * @param {boolean} logscale\n * @return {number}\n */\nDygraphLayout.calcYNormal_ = function (axis, value, logscale) {\n if (logscale) {\n var x = 1.0 - (utils.log10(value) - utils.log10(axis.minyval)) * axis.ylogscale;\n return isFinite(x) ? x : NaN; // shim for v8 issue; see pull request 276\n } else {\n return 1.0 - (value - axis.minyval) * axis.yscale;\n }\n};\n\nDygraphLayout.prototype._evaluateLineCharts = function () {\n var isStacked = this.dygraph_.getOption(\"stackedGraph\");\n var isLogscaleForX = this.dygraph_.getOptionForAxis(\"logscale\", 'x');\n\n for (var setIdx = 0; setIdx < this.points.length; setIdx++) {\n var points = this.points[setIdx];\n var setName = this.setNames[setIdx];\n var connectSeparated = this.dygraph_.getOption('connectSeparatedPoints', setName);\n var axis = this.dygraph_.axisPropertiesForSeries(setName);\n // TODO (konigsberg): use optionsForAxis instead.\n var logscale = this.dygraph_.attributes_.getForSeries(\"logscale\", setName);\n\n for (var j = 0; j < points.length; j++) {\n var point = points[j];\n\n // Range from 0-1 where 0 represents left and 1 represents right.\n point.x = DygraphLayout.calcXNormal_(point.xval, this._xAxis, isLogscaleForX);\n // Range from 0-1 where 0 represents top and 1 represents bottom\n var yval = point.yval;\n if (isStacked) {\n point.y_stacked = DygraphLayout.calcYNormal_(axis, point.yval_stacked, logscale);\n if (yval !== null && !isNaN(yval)) {\n yval = point.yval_stacked;\n }\n }\n if (yval === null) {\n yval = NaN;\n if (!connectSeparated) {\n point.yval = NaN;\n }\n }\n point.y = DygraphLayout.calcYNormal_(axis, yval, logscale);\n }\n\n this.dygraph_.dataHandler_.onLineEvaluated(points, axis, logscale);\n }\n};\n\nDygraphLayout.prototype._evaluateLineTicks = function () {\n var i, tick, label, pos, v, has_tick;\n this.xticks = [];\n for (i = 0; i < this.xTicks_.length; i++) {\n tick = this.xTicks_[i];\n label = tick.label;\n has_tick = !('label_v' in tick);\n v = has_tick ? tick.v : tick.label_v;\n pos = this.dygraph_.toPercentXCoord(v);\n if (pos >= 0.0 && pos < 1.0) {\n this.xticks.push({ pos: pos, label: label, has_tick: has_tick });\n }\n }\n\n this.yticks = [];\n for (i = 0; i < this.yAxes_.length; i++) {\n var axis = this.yAxes_[i];\n for (var j = 0; j < axis.ticks.length; j++) {\n tick = axis.ticks[j];\n label = tick.label;\n has_tick = !('label_v' in tick);\n v = has_tick ? tick.v : tick.label_v;\n pos = this.dygraph_.toPercentYCoord(v, i);\n if (pos > 0.0 && pos <= 1.0) {\n this.yticks.push({ axis: i, pos: pos, label: label, has_tick: has_tick });\n }\n }\n }\n};\n\nDygraphLayout.prototype._evaluateAnnotations = function () {\n // Add the annotations to the point to which they belong.\n // Make a map from (setName, xval) to annotation for quick lookups.\n var i;\n var annotations = {};\n for (i = 0; i < this.annotations.length; i++) {\n var a = this.annotations[i];\n annotations[a.xval + \",\" + a.series] = a;\n }\n\n this.annotated_points = [];\n\n // Exit the function early if there are no annotations.\n if (!this.annotations || !this.annotations.length) {\n return;\n }\n\n // TODO(antrob): loop through annotations not points.\n for (var setIdx = 0; setIdx < this.points.length; setIdx++) {\n var points = this.points[setIdx];\n for (i = 0; i < points.length; i++) {\n var p = points[i];\n var k = p.xval + \",\" + p.name;\n if (k in annotations) {\n p.annotation = annotations[k];\n this.annotated_points.push(p);\n }\n }\n }\n};\n\n/**\n * Convenience function to remove all the data sets from a graph\n */\nDygraphLayout.prototype.removeAllDatasets = function () {\n delete this.points;\n delete this.setNames;\n delete this.setPointsLengths;\n delete this.setPointsOffsets;\n this.points = [];\n this.setNames = [];\n this.setPointsLengths = [];\n this.setPointsOffsets = [];\n};\n\nexports['default'] = DygraphLayout;\nmodule.exports = exports['default'];","/**\n * @license\n * Copyright 2006 Dan Vanderkam (danvdk@gmail.com)\n * MIT-licensed (http://opensource.org/licenses/MIT)\n */\n\n/**\n * @fileoverview Based on PlotKit.CanvasRenderer, but modified to meet the\n * needs of dygraphs.\n *\n * In particular, support for:\n * - grid overlays\n * - error bars\n * - dygraphs attribute system\n */\n\n/**\n * The DygraphCanvasRenderer class does the actual rendering of the chart onto\n * a canvas. It's based on PlotKit.CanvasRenderer.\n * @param {Object} element The canvas to attach to\n * @param {Object} elementContext The 2d context of the canvas (injected so it\n * can be mocked for testing.)\n * @param {Layout} layout The DygraphLayout object for this graph.\n * @constructor\n */\n\n/*global Dygraph:false */\n\"use strict\";\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nvar _dygraphUtils = require('./dygraph-utils');\n\nvar utils = _interopRequireWildcard(_dygraphUtils);\n\nvar _dygraph = require('./dygraph');\n\nvar _dygraph2 = _interopRequireDefault(_dygraph);\n\n/**\n * @constructor\n *\n * This gets called when there are \"new points\" to chart. This is generally the\n * case when the underlying data being charted has changed. It is _not_ called\n * in the common case that the user has zoomed or is panning the view.\n *\n * The chart canvas has already been created by the Dygraph object. The\n * renderer simply gets a drawing context.\n *\n * @param {Dygraph} dygraph The chart to which this renderer belongs.\n * @param {HTMLCanvasElement} element The <canvas> DOM element on which to draw.\n * @param {CanvasRenderingContext2D} elementContext The drawing context.\n * @param {DygraphLayout} layout The chart's DygraphLayout object.\n *\n * TODO(danvk): remove the elementContext property.\n */\nvar DygraphCanvasRenderer = function DygraphCanvasRenderer(dygraph, element, elementContext, layout) {\n this.dygraph_ = dygraph;\n\n this.layout = layout;\n this.element = element;\n this.elementContext = elementContext;\n\n this.height = dygraph.height_;\n this.width = dygraph.width_;\n\n // --- check whether everything is ok before we return\n if (!utils.isCanvasSupported(this.element)) {\n throw \"Canvas is not supported.\";\n }\n\n // internal state\n this.area = layout.getPlotArea();\n\n // Set up a clipping area for the canvas (and the interaction canvas).\n // This ensures that we don't overdraw.\n var ctx = this.dygraph_.canvas_ctx_;\n ctx.beginPath();\n ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h);\n ctx.clip();\n\n ctx = this.dygraph_.hidden_ctx_;\n ctx.beginPath();\n ctx.rect(this.area.x, this.area.y, this.area.w, this.area.h);\n ctx.clip();\n};\n\n/**\n * Clears out all chart content and DOM elements.\n * This is called immediately before render() on every frame, including\n * during zooms and pans.\n * @private\n */\nDygraphCanvasRenderer.prototype.clear = function () {\n this.elementContext.clearRect(0, 0, this.width, this.height);\n};\n\n/**\n * This method is responsible for drawing everything on the chart, including\n * lines, error bars, fills and axes.\n * It is called immediately after clear() on every frame, including during pans\n * and zooms.\n * @private\n */\nDygraphCanvasRenderer.prototype.render = function () {\n // attaches point.canvas{x,y}\n this._updatePoints();\n\n // actually draws the chart.\n this._renderLineChart();\n};\n\n/**\n * Returns a predicate to be used with an iterator, which will\n * iterate over points appropriately, depending on whether\n * connectSeparatedPoints is true. When it's false, the predicate will\n * skip over points with missing yVals.\n */\nDygraphCanvasRenderer._getIteratorPredicate = function (connectSeparatedPoints) {\n return connectSeparatedPoints ? DygraphCanvasRenderer._predicateThatSkipsEmptyPoints : null;\n};\n\nDygraphCanvasRenderer._predicateThatSkipsEmptyPoints = function (array, idx) {\n return array[idx].yval !== null;\n};\n\n/**\n * Draws a line with the styles passed in and calls all the drawPointCallbacks.\n * @param {Object} e The dictionary passed to the plotter function.\n * @private\n */\nDygraphCanvasRenderer._drawStyledLine = function (e, color, strokeWidth, strokePattern, drawPoints, drawPointCallback, pointSize) {\n var g = e.dygraph;\n // TODO(konigsberg): Compute attributes outside this method call.\n var stepPlot = g.getBooleanOption(\"stepPlot\", e.setName);\n\n if (!utils.isArrayLike(strokePattern)) {\n strokePattern = null;\n }\n\n var drawGapPoints = g.getBooleanOption('drawGapEdgePoints', e.setName);\n\n var points = e.points;\n var setName = e.setName;\n var iter = utils.createIterator(points, 0, points.length, DygraphCanvasRenderer._getIteratorPredicate(g.getBooleanOption(\"connectSeparatedPoints\", setName)));\n\n var stroking = strokePattern && strokePattern.length >= 2;\n\n var ctx = e.drawingContext;\n ctx.save();\n if (stroking) {\n if (ctx.setLineDash) ctx.setLineDash(strokePattern);\n }\n\n var pointsOnLine = DygraphCanvasRenderer._drawSeries(e, iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color);\n DygraphCanvasRenderer._drawPointsOnLine(e, pointsOnLine, drawPointCallback, color, pointSize);\n\n if (stroking) {\n if (ctx.setLineDash) ctx.setLineDash([]);\n }\n\n ctx.restore();\n};\n\n/**\n * This does the actual drawing of lines on the canvas, for just one series.\n * Returns a list of [canvasx, canvasy] pairs for points for which a\n * drawPointCallback should be fired. These include isolated points, or all\n * points if drawPoints=true.\n * @param {Object} e The dictionary passed to the plotter function.\n * @private\n */\nDygraphCanvasRenderer._drawSeries = function (e, iter, strokeWidth, pointSize, drawPoints, drawGapPoints, stepPlot, color) {\n\n var prevCanvasX = null;\n var prevCanvasY = null;\n var nextCanvasY = null;\n var isIsolated; // true if this point is isolated (no line segments)\n var point; // the point being processed in the while loop\n var pointsOnLine = []; // Array of [canvasx, canvasy] pairs.\n var first = true; // the first cycle through the while loop\n\n var ctx = e.drawingContext;\n ctx.beginPath();\n ctx.strokeStyle = color;\n ctx.lineWidth = strokeWidth;\n\n // NOTE: we break the iterator's encapsulation here for about a 25% speedup.\n var arr = iter.array_;\n var limit = iter.end_;\n var predicate = iter.predicate_;\n\n for (var i = iter.start_; i < limit; i++) {\n point = arr[i];\n if (predicate) {\n while (i < limit && !predicate(arr, i)) {\n i++;\n }\n if (i == limit) break;\n point = arr[i];\n }\n\n // FIXME: The 'canvasy != canvasy' test here catches NaN values but the test\n // doesn't catch Infinity values. Could change this to\n // !isFinite(point.canvasy), but I assume it avoids isNaN for performance?\n if (point.canvasy === null || point.canvasy != point.canvasy) {\n if (stepPlot && prevCanvasX !== null) {\n // Draw a horizontal line to the start of the missing data\n ctx.moveTo(prevCanvasX, prevCanvasY);\n ctx.lineTo(point.canvasx, prevCanvasY);\n }\n prevCanvasX = prevCanvasY = null;\n } else {\n isIsolated = false;\n if (drawGapPoints || prevCanvasX === null) {\n iter.nextIdx_ = i;\n iter.next();\n nextCanvasY = iter.hasNext ? iter.peek.canvasy : null;\n\n var isNextCanvasYNullOrNaN = nextCanvasY === null || nextCanvasY != nextCanvasY;\n isIsolated = prevCanvasX === null && isNextCanvasYNullOrNaN;\n if (drawGapPoints) {\n // Also consider a point to be \"isolated\" if it's adjacent to a\n // null point, excluding the graph edges.\n if (!first && prevCanvasX === null || iter.hasNext && isNextCanvasYNullOrNaN) {\n isIsolated = true;\n }\n }\n }\n\n if (prevCanvasX !== null) {\n if (strokeWidth) {\n if (stepPlot) {\n ctx.moveTo(prevCanvasX, prevCanvasY);\n ctx.lineTo(point.canvasx, prevCanvasY);\n }\n\n ctx.lineTo(point.canvasx, point.canvasy);\n }\n } else {\n ctx.moveTo(point.canvasx, point.canvasy);\n }\n if (drawPoints || isIsolated) {\n pointsOnLine.push([point.canvasx, point.canvasy, point.idx]);\n }\n prevCanvasX = point.canvasx;\n prevCanvasY = point.canvasy;\n }\n first = false;\n }\n ctx.stroke();\n return pointsOnLine;\n};\n\n/**\n * This fires the drawPointCallback functions, which draw dots on the points by\n * default. This gets used when the \"drawPoints\" option is set, or when there\n * are isolated points.\n * @param {Object} e The dictionary passed to the plotter function.\n * @private\n */\nDygraphCanvasRenderer._drawPointsOnLine = function (e, pointsOnLine, drawPointCallback, color, pointSize) {\n var ctx = e.drawingContext;\n for (var idx = 0; idx < pointsOnLine.length; idx++) {\n var cb = pointsOnLine[idx];\n ctx.save();\n drawPointCallback.call(e.dygraph, e.dygraph, e.setName, ctx, cb[0], cb[1], color, pointSize, cb[2]);\n ctx.restore();\n }\n};\n\n/**\n * Attaches canvas coordinates to the points array.\n * @private\n */\nDygraphCanvasRenderer.prototype._updatePoints = function () {\n // Update Points\n // TODO(danvk): here\n //\n // TODO(bhs): this loop is a hot-spot for high-point-count charts. These\n // transformations can be pushed into the canvas via linear transformation\n // matrices.\n // NOTE(danvk): this is trickier than it sounds at first. The transformation\n // needs to be done before the .moveTo() and .lineTo() calls, but must be\n // undone before the .stroke() call to ensure that the stroke width is\n // unaffected. An alternative is to reduce the stroke width in the\n // transformed coordinate space, but you can't specify different values for\n // each dimension (as you can with .scale()). The speedup here is ~12%.\n var sets = this.layout.points;\n for (var i = sets.length; i--;) {\n var points = sets[i];\n for (var j = points.length; j--;) {\n var point = points[j];\n point.canvasx = this.area.w * point.x + this.area.x;\n point.canvasy = this.area.h * point.y + this.area.y;\n }\n }\n};\n\n/**\n * Add canvas Actually draw the lines chart, including error bars.\n *\n * This function can only be called if DygraphLayout's points array has been\n * updated with canvas{x,y} attributes, i.e. by\n * DygraphCanvasRenderer._updatePoints.\n *\n * @param {string=} opt_seriesName when specified, only that series will\n * be drawn. (This is used for expedited redrawing with highlightSeriesOpts)\n * @param {CanvasRenderingContext2D} opt_ctx when specified, the drawing\n * context. However, lines are typically drawn on the object's\n * elementContext.\n * @private\n */\nDygraphCanvasRenderer.prototype._renderLineChart = function (opt_seriesName, opt_ctx) {\n var ctx = opt_ctx || this.elementContext;\n var i;\n\n var sets = this.layout.points;\n var setNames = this.layout.setNames;\n var setName;\n\n this.colors = this.dygraph_.colorsMap_;\n\n // Determine which series have specialized plotters.\n var plotter_attr = this.dygraph_.getOption(\"plotter\");\n var plotters = plotter_attr;\n if (!utils.isArrayLike(plotters)) {\n plotters = [plotters];\n }\n\n var setPlotters = {}; // series name -> plotter fn.\n for (i = 0; i < setNames.length; i++) {\n setName = setNames[i];\n var setPlotter = this.dygraph_.getOption(\"plotter\", setName);\n if (setPlotter == plotter_attr) continue; // not specialized.\n\n setPlotters[setName] = setPlotter;\n }\n\n for (i = 0; i < plotters.length; i++) {\n var plotter = plotters[i];\n var is_last = i == plotters.length - 1;\n\n for (var j = 0; j < sets.length; j++) {\n setName = setNames[j];\n if (opt_seriesName && setName != opt_seriesName) continue;\n\n var points = sets[j];\n\n // Only throw in the specialized plotters on the last iteration.\n var p = plotter;\n if (setName in setPlotters) {\n if (is_last) {\n p = setPlotters[setName];\n } else {\n // Don't use the standard plotters in this case.\n continue;\n }\n }\n\n var color = this.colors[setName];\n var strokeWidth = this.dygraph_.getOption(\"strokeWidth\", setName);\n\n ctx.save();\n ctx.strokeStyle = color;\n ctx.lineWidth = strokeWidth;\n p({\n points: points,\n setName: setName,\n drawingContext: ctx,\n color: color,\n strokeWidth: strokeWidth,\n dygraph: this.dygraph_,\n axis: this.dygraph_.axisPropertiesForSeries(setName),\n plotArea: this.area,\n seriesIndex: j,\n seriesCount: sets.length,\n singleSeriesName: opt_seriesName,\n allSeriesPoints: sets\n });\n ctx.restore();\n }\n }\n};\n\n/**\n * Standard plotters. These may be used by clients via Dygraph.Plotters.\n * See comments there for more details.\n */\nDygraphCanvasRenderer._Plotters = {\n linePlotter: function linePlotter(e) {\n DygraphCanvasRenderer._linePlotter(e);\n },\n\n fillPlotter: function fillPlotter(e) {\n DygraphCanvasRenderer._fillPlotter(e);\n },\n\n errorPlotter: function errorPlotter(e) {\n DygraphCanvasRenderer._errorPlotter(e);\n }\n};\n\n/**\n * Plotter which draws the central lines for a series.\n * @private\n */\nDygraphCanvasRenderer._linePlotter = function (e) {\n var g = e.dygraph;\n var setName = e.setName;\n var strokeWidth = e.strokeWidth;\n\n // TODO(danvk): Check if there's any performance impact of just calling\n // getOption() inside of _drawStyledLine. Passing in so many parameters makes\n // this code a bit nasty.\n var borderWidth = g.getNumericOption(\"strokeBorderWidth\", setName);\n var drawPointCallback = g.getOption(\"drawPointCallback\", setName) || utils.Circles.DEFAULT;\n var strokePattern = g.getOption(\"strokePattern\", setName);\n var drawPoints = g.getBooleanOption(\"drawPoints\", setName);\n var pointSize = g.getNumericOption(\"pointSize\", setName);\n\n if (borderWidth && strokeWidth) {\n DygraphCanvasRenderer._drawStyledLine(e, g.getOption(\"strokeBorderColor\", setName), strokeWidth + 2 * borderWidth, strokePattern, drawPoints, drawPointCallback, pointSize);\n }\n\n DygraphCanvasRenderer._drawStyledLine(e, e.color, strokeWidth, strokePattern, drawPoints, drawPointCallback, pointSize);\n};\n\n/**\n * Draws the shaded error bars/confidence intervals for each series.\n * This happens before the center lines are drawn, since the center lines\n * need to be drawn on top of the error bars for all series.\n * @private\n */\nDygraphCanvasRenderer._errorPlotter = function (e) {\n var g = e.dygraph;\n var setName = e.setName;\n var errorBars = g.getBooleanOption(\"errorBars\") || g.getBooleanOption(\"customBars\");\n if (!errorBars) return;\n\n var fillGraph = g.getBooleanOption(\"fillGraph\", setName);\n if (fillGraph) {\n console.warn(\"Can't use fillGraph option with error bars\");\n }\n\n var ctx = e.drawingContext;\n var color = e.color;\n var fillAlpha = g.getNumericOption('fillAlpha', setName);\n var stepPlot = g.getBooleanOption(\"stepPlot\", setName);\n var points = e.points;\n\n var iter = utils.createIterator(points, 0, points.length, DygraphCanvasRenderer._getIteratorPredicate(g.getBooleanOption(\"connectSeparatedPoints\", setName)));\n\n var newYs;\n\n // setup graphics context\n var prevX = NaN;\n var prevY = NaN;\n var prevYs = [-1, -1];\n // should be same color as the lines but only 15% opaque.\n var rgb = utils.toRGB_(color);\n var err_color = 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')';\n ctx.fillStyle = err_color;\n ctx.beginPath();\n\n var isNullUndefinedOrNaN = function isNullUndefinedOrNaN(x) {\n return x === null || x === undefined || isNaN(x);\n };\n\n while (iter.hasNext) {\n var point = iter.next();\n if (!stepPlot && isNullUndefinedOrNaN(point.y) || stepPlot && !isNaN(prevY) && isNullUndefinedOrNaN(prevY)) {\n prevX = NaN;\n continue;\n }\n\n newYs = [point.y_bottom, point.y_top];\n if (stepPlot) {\n prevY = point.y;\n }\n\n // The documentation specifically disallows nulls inside the point arrays,\n // but in case it happens we should do something sensible.\n if (isNaN(newYs[0])) newYs[0] = point.y;\n if (isNaN(newYs[1])) newYs[1] = point.y;\n\n newYs[0] = e.plotArea.h * newYs[0] + e.plotArea.y;\n newYs[1] = e.plotArea.h * newYs[1] + e.plotArea.y;\n if (!isNaN(prevX)) {\n if (stepPlot) {\n ctx.moveTo(prevX, prevYs[0]);\n ctx.lineTo(point.canvasx, prevYs[0]);\n ctx.lineTo(point.canvasx, prevYs[1]);\n } else {\n ctx.moveTo(prevX, prevYs[0]);\n ctx.lineTo(point.canvasx, newYs[0]);\n ctx.lineTo(point.canvasx, newYs[1]);\n }\n ctx.lineTo(prevX, prevYs[1]);\n ctx.closePath();\n }\n prevYs = newYs;\n prevX = point.canvasx;\n }\n ctx.fill();\n};\n\n/**\n * Proxy for CanvasRenderingContext2D which drops moveTo/lineTo calls which are\n * superfluous. It accumulates all movements which haven't changed the x-value\n * and only applies the two with the most extreme y-values.\n *\n * Calls to lineTo/moveTo must have non-decreasing x-values.\n */\nDygraphCanvasRenderer._fastCanvasProxy = function (context) {\n var pendingActions = []; // array of [type, x, y] tuples\n var lastRoundedX = null;\n var lastFlushedX = null;\n\n var LINE_TO = 1,\n MOVE_TO = 2;\n\n var actionCount = 0; // number of moveTos and lineTos passed to context.\n\n // Drop superfluous motions\n // Assumes all pendingActions have the same (rounded) x-value.\n var compressActions = function compressActions(opt_losslessOnly) {\n if (pendingActions.length <= 1) return;\n\n // Lossless compression: drop inconsequential moveTos.\n for (var i = pendingActions.length - 1; i > 0; i--) {\n var action = pendingActions[i];\n if (action[0] == MOVE_TO) {\n var prevAction = pendingActions[i - 1];\n if (prevAction[1] == action[1] && prevAction[2] == action[2]) {\n pendingActions.splice(i, 1);\n }\n }\n }\n\n // Lossless compression: ... drop consecutive moveTos ...\n for (var i = 0; i < pendingActions.length - 1;) /* incremented internally */{\n var action = pendingActions[i];\n if (action[0] == MOVE_TO && pendingActions[i + 1][0] == MOVE_TO) {\n pendingActions.splice(i, 1);\n } else {\n i++;\n }\n }\n\n // Lossy compression: ... drop all but the extreme y-values ...\n if (pendingActions.length > 2 && !opt_losslessOnly) {\n // keep an initial moveTo, but drop all others.\n var startIdx = 0;\n if (pendingActions[0][0] == MOVE_TO) startIdx++;\n var minIdx = null,\n maxIdx = null;\n for (var i = startIdx; i < pendingActions.length; i++) {\n var action = pendingActions[i];\n if (action[0] != LINE_TO) continue;\n if (minIdx === null && maxIdx === null) {\n minIdx = i;\n maxIdx = i;\n } else {\n var y = action[2];\n if (y < pendingActions[minIdx][2]) {\n minIdx = i;\n } else if (y > pendingActions[maxIdx][2]) {\n maxIdx = i;\n }\n }\n }\n var minAction = pendingActions[minIdx],\n maxAction = pendingActions[maxIdx];\n pendingActions.splice(startIdx, pendingActions.length - startIdx);\n if (minIdx < maxIdx) {\n pendingActions.push(minAction);\n pendingActions.push(maxAction);\n } else if (minIdx > maxIdx) {\n pendingActions.push(maxAction);\n pendingActions.push(minAction);\n } else {\n pendingActions.push(minAction);\n }\n }\n };\n\n var flushActions = function flushActions(opt_noLossyCompression) {\n compressActions(opt_noLossyCompression);\n for (var i = 0, len = pendingActions.length; i < len; i++) {\n var action = pendingActions[i];\n if (action[0] == LINE_TO) {\n context.lineTo(action[1], action[2]);\n } else if (action[0] == MOVE_TO) {\n context.moveTo(action[1], action[2]);\n }\n }\n if (pendingActions.length) {\n lastFlushedX = pendingActions[pendingActions.length - 1][1];\n }\n actionCount += pendingActions.length;\n pendingActions = [];\n };\n\n var addAction = function addAction(action, x, y) {\n var rx = Math.round(x);\n if (lastRoundedX === null || rx != lastRoundedX) {\n // if there are large gaps on the x-axis, it's essential to keep the\n // first and last point as well.\n var hasGapOnLeft = lastRoundedX - lastFlushedX > 1,\n hasGapOnRight = rx - lastRoundedX > 1,\n hasGap = hasGapOnLeft || hasGapOnRight;\n flushActions(hasGap);\n lastRoundedX = rx;\n }\n pendingActions.push([action, x, y]);\n };\n\n return {\n moveTo: function moveTo(x, y) {\n addAction(MOVE_TO, x, y);\n },\n lineTo: function lineTo(x, y) {\n addAction(LINE_TO, x, y);\n },\n\n // for major operations like stroke/fill, we skip compression to ensure\n // that there are no artifacts at the right edge.\n stroke: function stroke() {\n flushActions(true);context.stroke();\n },\n fill: function fill() {\n flushActions(true);context.fill();\n },\n beginPath: function beginPath() {\n flushActions(true);context.beginPath();\n },\n closePath: function closePath() {\n flushActions(true);context.closePath();\n },\n\n _count: function _count() {\n return actionCount;\n }\n };\n};\n\n/**\n * Draws the shaded regions when \"fillGraph\" is set. Not to be confused with\n * error bars.\n *\n * For stacked charts, it's more convenient to handle all the series\n * simultaneously. So this plotter plots all the points on the first series\n * it's asked to draw, then ignores all the other series.\n *\n * @private\n */\nDygraphCanvasRenderer._fillPlotter = function (e) {\n // Skip if we're drawing a single series for interactive highlight overlay.\n if (e.singleSeriesName) return;\n\n // We'll handle all the series at once, not one-by-one.\n if (e.seriesIndex !== 0) return;\n\n var g = e.dygraph;\n var setNames = g.getLabels().slice(1); // remove x-axis\n\n // getLabels() includes names for invisible series, which are not included in\n // allSeriesPoints. We remove those to make the two match.\n // TODO(danvk): provide a simpler way to get this information.\n for (var i = setNames.length; i >= 0; i--) {\n if (!g.visibility()[i]) setNames.splice(i, 1);\n }\n\n var anySeriesFilled = (function () {\n for (var i = 0; i < setNames.length; i++) {\n if (g.getBooleanOption(\"fillGraph\", setNames[i])) return true;\n }\n return false;\n })();\n\n if (!anySeriesFilled) return;\n\n var area = e.plotArea;\n var sets = e.allSeriesPoints;\n var setCount = sets.length;\n\n var stackedGraph = g.getBooleanOption(\"stackedGraph\");\n var colors = g.getColors();\n\n // For stacked graphs, track the baseline for filling.\n //\n // The filled areas below graph lines are trapezoids with two\n // vertical edges. The top edge is the line segment being drawn, and\n // the baseline is the bottom edge. Each baseline corresponds to the\n // top line segment from the previous stacked line. In the case of\n // step plots, the trapezoids are rectangles.\n var baseline = {};\n var currBaseline;\n var prevStepPlot; // for different line drawing modes (line/step) per series\n\n // Helper function to trace a line back along the baseline.\n var traceBackPath = function traceBackPath(ctx, baselineX, baselineY, pathBack) {\n ctx.lineTo(baselineX, baselineY);\n if (stackedGraph) {\n for (var i = pathBack.length - 1; i >= 0; i--) {\n var pt = pathBack[i];\n ctx.lineTo(pt[0], pt[1]);\n }\n }\n };\n\n // process sets in reverse order (needed for stacked graphs)\n for (var setIdx = setCount - 1; setIdx >= 0; setIdx--) {\n var ctx = e.drawingContext;\n var setName = setNames[setIdx];\n if (!g.getBooleanOption('fillGraph', setName)) continue;\n\n var fillAlpha = g.getNumericOption('fillAlpha', setName);\n var stepPlot = g.getBooleanOption('stepPlot', setName);\n var color = colors[setIdx];\n var axis = g.axisPropertiesForSeries(setName);\n var axisY = 1.0 + axis.minyval * axis.yscale;\n if (axisY < 0.0) axisY = 0.0;else if (axisY > 1.0) axisY = 1.0;\n axisY = area.h * axisY + area.y;\n\n var points = sets[setIdx];\n var iter = utils.createIterator(points, 0, points.length, DygraphCanvasRenderer._getIteratorPredicate(g.getBooleanOption(\"connectSeparatedPoints\", setName)));\n\n // setup graphics context\n var prevX = NaN;\n var prevYs = [-1, -1];\n var newYs;\n // should be same color as the lines but only 15% opaque.\n var rgb = utils.toRGB_(color);\n var err_color = 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + fillAlpha + ')';\n ctx.fillStyle = err_color;\n ctx.beginPath();\n var last_x,\n is_first = true;\n\n // If the point density is high enough, dropping segments on their way to\n // the canvas justifies the overhead of doing so.\n if (points.length > 2 * g.width_ || _dygraph2['default'].FORCE_FAST_PROXY) {\n ctx = DygraphCanvasRenderer._fastCanvasProxy(ctx);\n }\n\n // For filled charts, we draw points from left to right, then back along\n // the x-axis to complete a shape for filling.\n // For stacked plots, this \"back path\" is a more complex shape. This array\n // stores the [x, y] values needed to trace that shape.\n var pathBack = [];\n\n // TODO(danvk): there are a lot of options at play in this loop.\n // The logic would be much clearer if some (e.g. stackGraph and\n // stepPlot) were split off into separate sub-plotters.\n var point;\n while (iter.hasNext) {\n point = iter.next();\n if (!utils.isOK(point.y) && !stepPlot) {\n traceBackPath(ctx, prevX, prevYs[1], pathBack);\n pathBack = [];\n prevX = NaN;\n if (point.y_stacked !== null && !isNaN(point.y_stacked)) {\n baseline[point.canvasx] = area.h * point.y_stacked + area.y;\n }\n continue;\n }\n if (stackedGraph) {\n if (!is_first && last_x == point.xval) {\n continue;\n } else {\n is_first = false;\n last_x = point.xval;\n }\n\n currBaseline = baseline[point.canvasx];\n var lastY;\n if (currBaseline === undefined) {\n lastY = axisY;\n } else {\n if (prevStepPlot) {\n lastY = currBaseline[0];\n } else {\n lastY = currBaseline;\n }\n }\n newYs = [point.canvasy, lastY];\n\n if (stepPlot) {\n // Step plots must keep track of the top and bottom of\n // the baseline at each point.\n if (prevYs[0] === -1) {\n baseline[point.canvasx] = [point.canvasy, axisY];\n } else {\n baseline[point.canvasx] = [point.canvasy, prevYs[0]];\n }\n } else {\n baseline[point.canvasx] = point.canvasy;\n }\n } else {\n if (isNaN(point.canvasy) && stepPlot) {\n newYs = [area.y + area.h, axisY];\n } else {\n newYs = [point.canvasy, axisY];\n }\n }\n if (!isNaN(prevX)) {\n // Move to top fill point\n if (stepPlot) {\n ctx.lineTo(point.canvasx, prevYs[0]);\n ctx.lineTo(point.canvasx, newYs[0]);\n } else {\n ctx.lineTo(point.canvasx, newYs[0]);\n }\n\n // Record the baseline for the reverse path.\n if (stackedGraph) {\n pathBack.push([prevX, prevYs[1]]);\n if (prevStepPlot && currBaseline) {\n // Draw to the bottom of the baseline\n pathBack.push([point.canvasx, currBaseline[1]]);\n } else {\n pathBack.push([point.canvasx, newYs[1]]);\n }\n }\n } else {\n ctx.moveTo(point.canvasx, newYs[1]);\n ctx.lineTo(point.canvasx, newYs[0]);\n }\n prevYs = newYs;\n prevX = point.canvasx;\n }\n prevStepPlot = stepPlot;\n if (newYs && point) {\n traceBackPath(ctx, point.canvasx, newYs[1], pathBack);\n pathBack = [];\n }\n ctx.fill();\n }\n};\n\nexports['default'] = DygraphCanvasRenderer;\nmodule.exports = exports['default'];","'use strict';\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj['default'] = obj; return newObj; } }\n\nvar _dygraphTickers = require('./dygraph-tickers');\n\nvar DygraphTickers = _interopRequireWildcard(_dygraphTickers);\n\nvar _dygraphInteractionModel = require('./dygraph-interaction-model');\n\nvar _dygraphInteractionModel2 = _interopRequireDefault(_dygraphInteractionModel);\n\nvar _dygraphCanvas = require('./dygraph-canvas');\n\nvar _dygraphCanvas2 = _interopRequireDefault(_dygraphCanvas);\n\nvar _dygraphUtils = require('./dygraph-utils');\n\nvar utils = _interopRequireWildcard(_dygraphUtils);\n\n// Default attribute values.\nvar DEFAULT_ATTRS = {\n highlightCircleSize: 3,\n highlightSeriesOpts: null,\n highlightSeriesBackgroundAlpha: 0.5,\n highlightSeriesBackgroundColor: 'rgb(255, 255, 255)',\n\n labelsSeparateLines: false,\n labelsShowZeroValues: true,\n labelsKMB: false,\n labelsKMG2: false,\n showLabelsOnHighlight: true,\n\n digitsAfterDecimal: 2,\n maxNumberWidth: 6,\n sigFigs: null,\n\n strokeWidth: 1.0,\n strokeBorderWidth: 0,\n strokeBorderColor: \"white\",\n\n axisTickSize: 3,\n axisLabelFontSize: 14,\n rightGap: 5,\n\n showRoller: false,\n xValueParser: undefined,\n\n delimiter: ',',\n\n sigma: 2.0,\n errorBars: false,\n fractions: false,\n wilsonInterval: true, // only relevant if fractions is true\n customBars: false,\n fillGraph: false,\n fillAlpha: 0.15,\n connectSeparatedPoints: false,\n\n stackedGraph: false,\n stackedGraphNaNFill: 'all',\n hideOverlayOnMouseOut: true,\n\n legend: 'onmouseover',\n stepPlot: false,\n xRangePad: 0,\n yRangePad: null,\n drawAxesAtZero: false,\n\n // Sizes of the various chart labels.\n titleHeight: 28,\n xLabelHeight: 18,\n yLabelWidth: 18,\n\n axisLineColor: \"black\",\n axisLineWidth: 0.3,\n gridLineWidth: 0.3,\n axisLabelWidth: 50,\n gridLineColor: \"rgb(128,128,128)\",\n\n interactionModel: _dygraphInteractionModel2['default'].defaultModel,\n animatedZooms: false, // (for now)\n\n // Range selector options\n showRangeSelector: false,\n rangeSelectorHeight: 40,\n rangeSelectorPlotStrokeColor: \"#808FAB\",\n rangeSelectorPlotFillGradientColor: \"white\",\n rangeSelectorPlotFillColor: \"#A7B1C4\",\n rangeSelectorBackgroundStrokeColor: \"gray\",\n rangeSelectorBackgroundLineWidth: 1,\n rangeSelectorPlotLineWidth: 1.5,\n rangeSelectorForegroundStrokeColor: \"black\",\n rangeSelectorForegroundLineWidth: 1,\n rangeSelectorAlpha: 0.6,\n showInRangeSelector: null,\n\n // The ordering here ensures that central lines always appear above any\n // fill bars/error bars.\n plotter: [_dygraphCanvas2['default']._fillPlotter, _dygraphCanvas2['default']._errorPlotter, _dygraphCanvas2['default']._linePlotter],\n\n plugins: [],\n\n // per-axis options\n axes: {\n x: {\n pixelsPerLabel: 70,\n axisLabelWidth: 60,\n axisLabelFormatter: utils.dateAxisLabelFormatter,\n valueFormatter: utils.dateValueFormatter,\n drawGrid: true,\n drawAxis: true,\n independentTicks: true,\n ticker: DygraphTickers.dateTicker\n },\n y: {\n axisLabelWidth: 50,\n pixelsPerLabel: 30,\n valueFormatter: utils.numberValueFormatter,\n axisLabelFormatter: utils.numberAxisLabelFormatter,\n drawGrid: true,\n drawAxis: true,\n independentTicks: true,\n ticker: DygraphTickers.numericTicks\n },\n y2: {\n axisLabelWidth: 50,\n pixelsPerLabel: 30,\n valueFormatter: utils.numberValueFormatter,\n axisLabelFormatter: utils.numberAxisLabelFormatter,\n drawAxis: true, // only applies when there are two axes of data.\n drawGrid: false,\n independentTicks: false,\n ticker: DygraphTickers.numericTicks\n }\n }\n};\n\nexports['default'] = DEFAULT_ATTRS;\nmodule.exports = exports['default'];","/**\n * @license\n * Copyright 2011 Dan Vanderkam (danvdk@gmail.com)\n * MIT-licensed (http://opensource.org/licenses/MIT)\n */\n\n\"use strict\";\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\nvar OPTIONS_REFERENCE = null;\n\n// For \"production\" code, this gets removed by uglifyjs.\nif (typeof process !== 'undefined') {\n if (process.env.NODE_ENV != 'production') {\n\n // NOTE: in addition to parsing as JS, this snippet is expected to be valid\n // JSON. This assumption cannot be checked in JS, but it will be checked when\n // documentation is generated by the generate-documentation.py script. For the\n // most part, this just means that you should always use double quotes.\n OPTIONS_REFERENCE = // \n {\n \"xValueParser\": {\n \"default\": \"parseFloat() or Date.parse()*\",\n \"labels\": [\"CSV parsing\"],\n \"type\": \"function(str) -> number\",\n \"description\": \"A function which parses x-values (i.e. the dependent series). Must return a number, even when the values are dates. In this case, millis since epoch are used. This is used primarily for parsing CSV data. *=Dygraphs is slightly more accepting in the dates which it will parse. See code for details.\"\n },\n \"stackedGraph\": {\n \"default\": \"false\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"boolean\",\n \"description\": \"If set, stack series on top of one another rather than drawing them independently. The first series specified in the input data will wind up on top of the chart and the last will be on bottom. NaN values are drawn as white areas without a line on top, see stackedGraphNaNFill for details.\"\n },\n \"stackedGraphNaNFill\": {\n \"default\": \"all\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"string\",\n \"description\": \"Controls handling of NaN values inside a stacked graph. NaN values are interpolated/extended for stacking purposes, but the actual point value remains NaN in the legend display. Valid option values are \\\"all\\\" (interpolate internally, repeat leftmost and rightmost value as needed), \\\"inside\\\" (interpolate internally only, use zero outside leftmost and rightmost value), and \\\"none\\\" (treat NaN as zero everywhere).\"\n },\n \"pointSize\": {\n \"default\": \"1\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"integer\",\n \"description\": \"The size of the dot to draw on each point in pixels (see drawPoints). A dot is always drawn when a point is \\\"isolated\\\", i.e. there is a missing point on either side of it. This also controls the size of those dots.\"\n },\n \"drawPoints\": {\n \"default\": \"false\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"boolean\",\n \"description\": \"Draw a small dot at each point, in addition to a line going through the point. This makes the individual data points easier to see, but can increase visual clutter in the chart. The small dot can be replaced with a custom rendering by supplying a drawPointCallback.\"\n },\n \"drawGapEdgePoints\": {\n \"default\": \"false\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"boolean\",\n \"description\": \"Draw points at the edges of gaps in the data. This improves visibility of small data segments or other data irregularities.\"\n },\n \"drawPointCallback\": {\n \"default\": \"null\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"function(g, seriesName, canvasContext, cx, cy, color, pointSize)\",\n \"parameters\": [[\"g\", \"the reference graph\"], [\"seriesName\", \"the name of the series\"], [\"canvasContext\", \"the canvas to draw on\"], [\"cx\", \"center x coordinate\"], [\"cy\", \"center y coordinate\"], [\"color\", \"series color\"], [\"pointSize\", \"the radius of the image.\"], [\"idx\", \"the row-index of the point in the data.\"]],\n \"description\": \"Draw a custom item when drawPoints is enabled. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy). Also see drawHighlightPointCallback\"\n },\n \"height\": {\n \"default\": \"320\",\n \"labels\": [\"Overall display\"],\n \"type\": \"integer\",\n \"description\": \"Height, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored.\"\n },\n \"zoomCallback\": {\n \"default\": \"null\",\n \"labels\": [\"Callbacks\"],\n \"type\": \"function(minDate, maxDate, yRanges)\",\n \"parameters\": [[\"minDate\", \"milliseconds since epoch\"], [\"maxDate\", \"milliseconds since epoch.\"], [\"yRanges\", \"is an array of [bottom, top] pairs, one for each y-axis.\"]],\n \"description\": \"A function to call when the zoom window is changed (either by zooming in or out). When animatedZooms is set, zoomCallback is called once at the end of the transition (it will not be called for intermediate frames).\"\n },\n \"pointClickCallback\": {\n \"snippet\": \"function(e, point){
      alert(point);
    }\",\n \"default\": \"null\",\n \"labels\": [\"Callbacks\", \"Interactive Elements\"],\n \"type\": \"function(e, point)\",\n \"parameters\": [[\"e\", \"the event object for the click\"], [\"point\", \"the point that was clicked See Point properties for details\"]],\n \"description\": \"A function to call when a data point is clicked. and the point that was clicked.\"\n },\n \"color\": {\n \"default\": \"(see description)\",\n \"labels\": [\"Data Series Colors\"],\n \"type\": \"string\",\n \"example\": \"red\",\n \"description\": \"A per-series color definition. Used in conjunction with, and overrides, the colors option.\"\n },\n \"colors\": {\n \"default\": \"(see description)\",\n \"labels\": [\"Data Series Colors\"],\n \"type\": \"array\",\n \"example\": \"['red', '#00FF00']\",\n \"description\": \"List of colors for the data series. These can be of the form \\\"#AABBCC\\\" or \\\"rgb(255,100,200)\\\" or \\\"yellow\\\", etc. If not specified, equally-spaced points around a color wheel are used. Overridden by the 'color' option.\"\n },\n \"connectSeparatedPoints\": {\n \"default\": \"false\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"boolean\",\n \"description\": \"Usually, when Dygraphs encounters a missing value in a data series, it interprets this as a gap and draws it as such. If, instead, the missing values represents an x-value for which only a different series has data, then you'll want to connect the dots by setting this to true. To explicitly include a gap with this option set, use a value of NaN.\"\n },\n \"highlightCallback\": {\n \"default\": \"null\",\n \"labels\": [\"Callbacks\"],\n \"type\": \"function(event, x, points, row, seriesName)\",\n \"description\": \"When set, this callback gets called every time a new point is highlighted.\",\n \"parameters\": [[\"event\", \"the JavaScript mousemove event\"], [\"x\", \"the x-coordinate of the highlighted points\"], [\"points\", \"an array of highlighted points: [ {name: 'series', yval: y-value}, … ]\"], [\"row\", \"integer index of the highlighted row in the data table, starting from 0\"], [\"seriesName\", \"name of the highlighted series, only present if highlightSeriesOpts is set.\"]]\n },\n \"drawHighlightPointCallback\": {\n \"default\": \"null\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"function(g, seriesName, canvasContext, cx, cy, color, pointSize)\",\n \"parameters\": [[\"g\", \"the reference graph\"], [\"seriesName\", \"the name of the series\"], [\"canvasContext\", \"the canvas to draw on\"], [\"cx\", \"center x coordinate\"], [\"cy\", \"center y coordinate\"], [\"color\", \"series color\"], [\"pointSize\", \"the radius of the image.\"], [\"idx\", \"the row-index of the point in the data.\"]],\n \"description\": \"Draw a custom item when a point is highlighted. Default is a small dot matching the series color. This method should constrain drawing to within pointSize pixels from (cx, cy) Also see drawPointCallback\"\n },\n \"highlightSeriesOpts\": {\n \"default\": \"null\",\n \"labels\": [\"Interactive Elements\"],\n \"type\": \"Object\",\n \"description\": \"When set, the options from this object are applied to the timeseries closest to the mouse pointer for interactive highlighting. See also 'highlightCallback'. Example: highlightSeriesOpts: { strokeWidth: 3 }.\"\n },\n \"highlightSeriesBackgroundAlpha\": {\n \"default\": \"0.5\",\n \"labels\": [\"Interactive Elements\"],\n \"type\": \"float\",\n \"description\": \"Fade the background while highlighting series. 1=fully visible background (disable fading), 0=hiddden background (show highlighted series only).\"\n },\n \"highlightSeriesBackgroundColor\": {\n \"default\": \"rgb(255, 255, 255)\",\n \"labels\": [\"Interactive Elements\"],\n \"type\": \"string\",\n \"description\": \"Sets the background color used to fade out the series in conjunction with 'highlightSeriesBackgroundAlpha'.\"\n },\n \"includeZero\": {\n \"default\": \"false\",\n \"labels\": [\"Axis display\"],\n \"type\": \"boolean\",\n \"description\": \"Usually, dygraphs will use the range of the data plus some padding to set the range of the y-axis. If this option is set, the y-axis will always include zero, typically as the lowest value. This can be used to avoid exaggerating the variance in the data\"\n },\n \"rollPeriod\": {\n \"default\": \"1\",\n \"labels\": [\"Error Bars\", \"Rolling Averages\"],\n \"type\": \"integer >= 1\",\n \"description\": \"Number of days over which to average data. Discussed extensively above.\"\n },\n \"unhighlightCallback\": {\n \"default\": \"null\",\n \"labels\": [\"Callbacks\"],\n \"type\": \"function(event)\",\n \"parameters\": [[\"event\", \"the mouse event\"]],\n \"description\": \"When set, this callback gets called every time the user stops highlighting any point by mousing out of the graph.\"\n },\n \"axisTickSize\": {\n \"default\": \"3.0\",\n \"labels\": [\"Axis display\"],\n \"type\": \"number\",\n \"description\": \"The size of the line to display next to each tick mark on x- or y-axes.\"\n },\n \"labelsSeparateLines\": {\n \"default\": \"false\",\n \"labels\": [\"Legend\"],\n \"type\": \"boolean\",\n \"description\": \"Put <br/> between lines in the label string. Often used in conjunction with labelsDiv.\"\n },\n \"valueFormatter\": {\n \"default\": \"Depends on the type of your data.\",\n \"labels\": [\"Legend\", \"Value display/formatting\"],\n \"type\": \"function(num or millis, opts, seriesName, dygraph, row, col)\",\n \"description\": \"Function to provide a custom display format for the values displayed on mouseover. This does not affect the values that appear on tick marks next to the axes. To format those, see axisLabelFormatter. This is usually set on a per-axis basis. .\",\n \"parameters\": [[\"num_or_millis\", \"The value to be formatted. This is always a number. For date axes, it's millis since epoch. You can call new Date(millis) to get a Date object.\"], [\"opts\", \"This is a function you can call to access various options (e.g. opts('labelsKMB')). It returns per-axis values for the option when available.\"], [\"seriesName\", \"The name of the series from which the point came, e.g. 'X', 'Y', 'A', etc.\"], [\"dygraph\", \"The dygraph object for which the formatting is being done\"], [\"row\", \"The row of the data from which this point comes. g.getValue(row, 0) will return the x-value for this point.\"], [\"col\", \"The column of the data from which this point comes. g.getValue(row, col) will return the original y-value for this point. This can be used to get the full confidence interval for the point, or access un-rolled values for the point.\"]]\n },\n \"annotationMouseOverHandler\": {\n \"default\": \"null\",\n \"labels\": [\"Annotations\"],\n \"type\": \"function(annotation, point, dygraph, event)\",\n \"description\": \"If provided, this function is called whenever the user mouses over an annotation.\"\n },\n \"annotationMouseOutHandler\": {\n \"default\": \"null\",\n \"labels\": [\"Annotations\"],\n \"type\": \"function(annotation, point, dygraph, event)\",\n \"parameters\": [[\"annotation\", \"the annotation left\"], [\"point\", \"the point associated with the annotation\"], [\"dygraph\", \"the reference graph\"], [\"event\", \"the mouse event\"]],\n \"description\": \"If provided, this function is called whenever the user mouses out of an annotation.\"\n },\n \"annotationClickHandler\": {\n \"default\": \"null\",\n \"labels\": [\"Annotations\"],\n \"type\": \"function(annotation, point, dygraph, event)\",\n \"parameters\": [[\"annotation\", \"the annotation left\"], [\"point\", \"the point associated with the annotation\"], [\"dygraph\", \"the reference graph\"], [\"event\", \"the mouse event\"]],\n \"description\": \"If provided, this function is called whenever the user clicks on an annotation.\"\n },\n \"annotationDblClickHandler\": {\n \"default\": \"null\",\n \"labels\": [\"Annotations\"],\n \"type\": \"function(annotation, point, dygraph, event)\",\n \"parameters\": [[\"annotation\", \"the annotation left\"], [\"point\", \"the point associated with the annotation\"], [\"dygraph\", \"the reference graph\"], [\"event\", \"the mouse event\"]],\n \"description\": \"If provided, this function is called whenever the user double-clicks on an annotation.\"\n },\n \"drawCallback\": {\n \"default\": \"null\",\n \"labels\": [\"Callbacks\"],\n \"type\": \"function(dygraph, is_initial)\",\n \"parameters\": [[\"dygraph\", \"The graph being drawn\"], [\"is_initial\", \"True if this is the initial draw, false for subsequent draws.\"]],\n \"description\": \"When set, this callback gets called every time the dygraph is drawn. This includes the initial draw, after zooming and repeatedly while panning.\"\n },\n \"labelsKMG2\": {\n \"default\": \"false\",\n \"labels\": [\"Value display/formatting\"],\n \"type\": \"boolean\",\n \"description\": \"Show k/M/G for kilo/Mega/Giga on y-axis. This is different than labelsKMB in that it uses base 2, not 10.\"\n },\n \"delimiter\": {\n \"default\": \",\",\n \"labels\": [\"CSV parsing\"],\n \"type\": \"string\",\n \"description\": \"The delimiter to look for when separating fields of a CSV file. Setting this to a tab is not usually necessary, since tab-delimited data is auto-detected.\"\n },\n \"axisLabelFontSize\": {\n \"default\": \"14\",\n \"labels\": [\"Axis display\"],\n \"type\": \"integer\",\n \"description\": \"Size of the font (in pixels) to use in the axis labels, both x- and y-axis.\"\n },\n \"underlayCallback\": {\n \"default\": \"null\",\n \"labels\": [\"Callbacks\"],\n \"type\": \"function(context, area, dygraph)\",\n \"parameters\": [[\"context\", \"the canvas drawing context on which to draw\"], [\"area\", \"An object with {x,y,w,h} properties describing the drawing area.\"], [\"dygraph\", \"the reference graph\"]],\n \"description\": \"When set, this callback gets called before the chart is drawn. It details on how to use this.\"\n },\n \"width\": {\n \"default\": \"480\",\n \"labels\": [\"Overall display\"],\n \"type\": \"integer\",\n \"description\": \"Width, in pixels, of the chart. If the container div has been explicitly sized, this will be ignored.\"\n },\n \"pixelRatio\": {\n \"default\": \"(devicePixelRatio / context.backingStoreRatio)\",\n \"labels\": [\"Overall display\"],\n \"type\": \"float\",\n \"description\": \"Overrides the pixel ratio scaling factor for the canvas's 2d context. Ordinarily, this is set to the devicePixelRatio / (context.backingStoreRatio || 1), so on mobile devices, where the devicePixelRatio can be somewhere around 3, performance can be improved by overriding this value to something less precise, like 1, at the expense of resolution.\"\n },\n \"interactionModel\": {\n \"default\": \"...\",\n \"labels\": [\"Interactive Elements\"],\n \"type\": \"Object\",\n \"description\": \"TODO(konigsberg): document this\"\n },\n \"ticker\": {\n \"default\": \"Dygraph.dateTicker or Dygraph.numericTicks\",\n \"labels\": [\"Axis display\"],\n \"type\": \"function(min, max, pixels, opts, dygraph, vals) -> [{v: ..., label: ...}, ...]\",\n \"parameters\": [[\"min\", \"\"], [\"max\", \"\"], [\"pixels\", \"\"], [\"opts\", \"\"], [\"dygraph\", \"the reference graph\"], [\"vals\", \"\"]],\n \"description\": \"This lets you specify an arbitrary function to generate tick marks on an axis. The tick marks are an array of (value, label) pairs. The built-in functions go to great lengths to choose good tick marks so, if you set this option, you'll most likely want to call one of them and modify the result. See dygraph-tickers.js for an extensive discussion. This is set on a per-axis basis.\"\n },\n \"xAxisHeight\": {\n \"default\": \"(null)\",\n \"labels\": [\"Axis display\"],\n \"type\": \"integer\",\n \"description\": \"Height, in pixels, of the x-axis. If not set explicitly, this is computed based on axisLabelFontSize and axisTickSize.\"\n },\n \"showLabelsOnHighlight\": {\n \"default\": \"true\",\n \"labels\": [\"Interactive Elements\", \"Legend\"],\n \"type\": \"boolean\",\n \"description\": \"Whether to show the legend upon mouseover.\"\n },\n \"axis\": {\n \"default\": \"(none)\",\n \"labels\": [\"Axis display\"],\n \"type\": \"string\",\n \"description\": \"Set to either 'y1' or 'y2' to assign a series to a y-axis (primary or secondary). Must be set per-series.\"\n },\n \"pixelsPerLabel\": {\n \"default\": \"70 (x-axis) or 30 (y-axes)\",\n \"labels\": [\"Axis display\", \"Grid\"],\n \"type\": \"integer\",\n \"description\": \"Number of pixels to require between each x- and y-label. Larger values will yield a sparser axis with fewer ticks. This is set on a per-axis basis.\"\n },\n \"labelsDiv\": {\n \"default\": \"null\",\n \"labels\": [\"Legend\"],\n \"type\": \"DOM element or string\",\n \"example\": \"document.getElementById('foo')or'foo'\",\n \"description\": \"Show data labels in an external div, rather than on the graph. This value can either be a div element or a div id.\"\n },\n \"fractions\": {\n \"default\": \"false\",\n \"labels\": [\"CSV parsing\", \"Error Bars\"],\n \"type\": \"boolean\",\n \"description\": \"When set, attempt to parse each cell in the CSV file as \\\"a/b\\\", where a and b are integers. The ratio will be plotted. This allows computation of Wilson confidence intervals (see below).\"\n },\n \"logscale\": {\n \"default\": \"false\",\n \"labels\": [\"Axis display\"],\n \"type\": \"boolean\",\n \"description\": \"When set for the y-axis or x-axis, the graph shows that axis in log scale. Any values less than or equal to zero are not displayed. Showing log scale with ranges that go below zero will result in an unviewable graph.\\n\\n Not compatible with showZero. connectSeparatedPoints is ignored. This is ignored for date-based x-axes.\"\n },\n \"strokeWidth\": {\n \"default\": \"1.0\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"float\",\n \"example\": \"0.5, 2.0\",\n \"description\": \"The width of the lines connecting data points. This can be used to increase the contrast or some graphs.\"\n },\n \"strokePattern\": {\n \"default\": \"null\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"array\",\n \"example\": \"[10, 2, 5, 2]\",\n \"description\": \"A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed lines.\"\n },\n \"strokeBorderWidth\": {\n \"default\": \"null\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"float\",\n \"example\": \"1.0\",\n \"description\": \"Draw a border around graph lines to make crossing lines more easily distinguishable. Useful for graphs with many lines.\"\n },\n \"strokeBorderColor\": {\n \"default\": \"white\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"string\",\n \"example\": \"red, #ccffdd\",\n \"description\": \"Color for the line border used if strokeBorderWidth is set.\"\n },\n \"wilsonInterval\": {\n \"default\": \"true\",\n \"labels\": [\"Error Bars\"],\n \"type\": \"boolean\",\n \"description\": \"Use in conjunction with the \\\"fractions\\\" option. Instead of plotting +/- N standard deviations, dygraphs will compute a Wilson confidence interval and plot that. This has more reasonable behavior for ratios close to 0 or 1.\"\n },\n \"fillGraph\": {\n \"default\": \"false\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"boolean\",\n \"description\": \"Should the area underneath the graph be filled? This option is not compatible with error bars. This may be set on a per-series basis.\"\n },\n \"highlightCircleSize\": {\n \"default\": \"3\",\n \"labels\": [\"Interactive Elements\"],\n \"type\": \"integer\",\n \"description\": \"The size in pixels of the dot drawn over highlighted points.\"\n },\n \"gridLineColor\": {\n \"default\": \"rgb(128,128,128)\",\n \"labels\": [\"Grid\"],\n \"type\": \"red, blue\",\n \"description\": \"The color of the gridlines. This may be set on a per-axis basis to define each axis' grid separately.\"\n },\n \"gridLinePattern\": {\n \"default\": \"null\",\n \"labels\": [\"Grid\"],\n \"type\": \"array\",\n \"example\": \"[10, 2, 5, 2]\",\n \"description\": \"A custom pattern array where the even index is a draw and odd is a space in pixels. If null then it draws a solid line. The array should have a even length as any odd lengthed array could be expressed as a smaller even length array. This is used to create dashed gridlines.\"\n },\n \"visibility\": {\n \"default\": \"[true, true, ...]\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"Array of booleans\",\n \"description\": \"Which series should initially be visible? Once the Dygraph has been constructed, you can access and modify the visibility of each series using the visibility and setVisibility methods.\"\n },\n \"valueRange\": {\n \"default\": \"Full range of the input is shown\",\n \"labels\": [\"Axis display\"],\n \"type\": \"Array of two numbers\",\n \"example\": \"[10, 110]\",\n \"description\": \"Explicitly set the vertical range of the graph to [low, high]. This may be set on a per-axis basis to define each y-axis separately. If either limit is unspecified, it will be calculated automatically (e.g. [null, 30] to automatically calculate just the lower bound)\"\n },\n \"colorSaturation\": {\n \"default\": \"1.0\",\n \"labels\": [\"Data Series Colors\"],\n \"type\": \"float (0.0 - 1.0)\",\n \"description\": \"If colors is not specified, saturation of the automatically-generated data series colors.\"\n },\n \"hideOverlayOnMouseOut\": {\n \"default\": \"true\",\n \"labels\": [\"Interactive Elements\", \"Legend\"],\n \"type\": \"boolean\",\n \"description\": \"Whether to hide the legend when the mouse leaves the chart area.\"\n },\n \"legend\": {\n \"default\": \"onmouseover\",\n \"labels\": [\"Legend\"],\n \"type\": \"string\",\n \"description\": \"When to display the legend. By default, it only appears when a user mouses over the chart. Set it to \\\"always\\\" to always display a legend of some sort. When set to \\\"follow\\\", legend follows highlighted points.\"\n },\n \"legendFormatter\": {\n \"default\": \"null\",\n \"labels\": [\"Legend\"],\n \"type\": \"function(data): string\",\n \"params\": [[\"data\", \"An object containing information about the selection (or lack of a selection). This includes formatted values and series information. See here for sample values.\"]],\n \"description\": \"Set this to supply a custom formatter for the legend. See this comment and the legendFormatter demo for usage.\"\n },\n \"labelsShowZeroValues\": {\n \"default\": \"true\",\n \"labels\": [\"Legend\"],\n \"type\": \"boolean\",\n \"description\": \"Show zero value labels in the labelsDiv.\"\n },\n \"stepPlot\": {\n \"default\": \"false\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"boolean\",\n \"description\": \"When set, display the graph as a step plot instead of a line plot. This option may either be set for the whole graph or for single series.\"\n },\n \"labelsUTC\": {\n \"default\": \"false\",\n \"labels\": [\"Value display/formatting\", \"Axis display\"],\n \"type\": \"boolean\",\n \"description\": \"Show date/time labels according to UTC (instead of local time).\"\n },\n \"labelsKMB\": {\n \"default\": \"false\",\n \"labels\": [\"Value display/formatting\"],\n \"type\": \"boolean\",\n \"description\": \"Show K/M/B for thousands/millions/billions on y-axis.\"\n },\n \"rightGap\": {\n \"default\": \"5\",\n \"labels\": [\"Overall display\"],\n \"type\": \"integer\",\n \"description\": \"Number of pixels to leave blank at the right edge of the Dygraph. This makes it easier to highlight the right-most data point.\"\n },\n \"drawAxesAtZero\": {\n \"default\": \"false\",\n \"labels\": [\"Axis display\"],\n \"type\": \"boolean\",\n \"description\": \"When set, draw the X axis at the Y=0 position and the Y axis at the X=0 position if those positions are inside the graph's visible area. Otherwise, draw the axes at the bottom or left graph edge as usual.\"\n },\n \"xRangePad\": {\n \"default\": \"0\",\n \"labels\": [\"Axis display\"],\n \"type\": \"float\",\n \"description\": \"Add the specified amount of extra space (in pixels) around the X-axis value range to ensure points at the edges remain visible.\"\n },\n \"yRangePad\": {\n \"default\": \"null\",\n \"labels\": [\"Axis display\"],\n \"type\": \"float\",\n \"description\": \"If set, add the specified amount of extra space (in pixels) around the Y-axis value range to ensure points at the edges remain visible. If unset, use the traditional Y padding algorithm.\"\n },\n \"axisLabelFormatter\": {\n \"default\": \"Depends on the data type\",\n \"labels\": [\"Axis display\"],\n \"type\": \"function(number or Date, granularity, opts, dygraph)\",\n \"parameters\": [[\"number or date\", \"Either a number (for a numeric axis) or a Date object (for a date axis)\"], [\"granularity\", \"specifies how fine-grained the axis is. For date axes, this is a reference to the time granularity enumeration, defined in dygraph-tickers.js, e.g. Dygraph.WEEKLY.\"], [\"opts\", \"a function which provides access to various options on the dygraph, e.g. opts('labelsKMB').\"], [\"dygraph\", \"the referenced graph\"]],\n \"description\": \"Function to call to format the tick values that appear along an axis. This is usually set on a per-axis basis.\"\n },\n \"clickCallback\": {\n \"snippet\": \"function(e, date_millis){
      alert(new Date(date_millis));
    }\",\n \"default\": \"null\",\n \"labels\": [\"Callbacks\"],\n \"type\": \"function(e, x, points)\",\n \"parameters\": [[\"e\", \"The event object for the click\"], [\"x\", \"The x value that was clicked (for dates, this is milliseconds since epoch)\"], [\"points\", \"The closest points along that date. See Point properties for details.\"]],\n \"description\": \"A function to call when the canvas is clicked.\"\n },\n \"labels\": {\n \"default\": \"[\\\"X\\\", \\\"Y1\\\", \\\"Y2\\\", ...]*\",\n \"labels\": [\"Legend\"],\n \"type\": \"array\",\n \"description\": \"A name for each data series, including the independent (X) series. For CSV files and DataTable objections, this is determined by context. For raw data, this must be specified. If it is not, default values are supplied and a warning is logged.\"\n },\n \"dateWindow\": {\n \"default\": \"Full range of the input is shown\",\n \"labels\": [\"Axis display\"],\n \"type\": \"Array of two numbers\",\n \"example\": \"[
      Date.parse('2006-01-01'),
      (new Date()).valueOf()
    ]\",\n \"description\": \"Initially zoom in on a section of the graph. Is of the form [earliest, latest], where earliest/latest are milliseconds since epoch. If the data for the x-axis is numeric, the values in dateWindow must also be numbers.\"\n },\n \"showRoller\": {\n \"default\": \"false\",\n \"labels\": [\"Interactive Elements\", \"Rolling Averages\"],\n \"type\": \"boolean\",\n \"description\": \"If the rolling average period text box should be shown.\"\n },\n \"sigma\": {\n \"default\": \"2.0\",\n \"labels\": [\"Error Bars\"],\n \"type\": \"float\",\n \"description\": \"When errorBars is set, shade this many standard deviations above/below each point.\"\n },\n \"customBars\": {\n \"default\": \"false\",\n \"labels\": [\"CSV parsing\", \"Error Bars\"],\n \"type\": \"boolean\",\n \"description\": \"When set, parse each CSV cell as \\\"low;middle;high\\\". Error bars will be drawn for each point between low and high, with the series itself going through middle.\"\n },\n \"colorValue\": {\n \"default\": \"1.0\",\n \"labels\": [\"Data Series Colors\"],\n \"type\": \"float (0.0 - 1.0)\",\n \"description\": \"If colors is not specified, value of the data series colors, as in hue/saturation/value. (0.0-1.0, default 0.5)\"\n },\n \"errorBars\": {\n \"default\": \"false\",\n \"labels\": [\"CSV parsing\", \"Error Bars\"],\n \"type\": \"boolean\",\n \"description\": \"Does the data contain standard deviations? Setting this to true alters the input format (see above).\"\n },\n \"displayAnnotations\": {\n \"default\": \"false\",\n \"labels\": [\"Annotations\"],\n \"type\": \"boolean\",\n \"description\": \"Only applies when Dygraphs is used as a GViz chart. Causes string columns following a data series to be interpreted as annotations on points in that series. This is the same format used by Google's AnnotatedTimeLine chart.\"\n },\n \"panEdgeFraction\": {\n \"default\": \"null\",\n \"labels\": [\"Axis display\", \"Interactive Elements\"],\n \"type\": \"float\",\n \"description\": \"A value representing the farthest a graph may be panned, in percent of the display. For example, a value of 0.1 means that the graph can only be panned 10% passed the edges of the displayed values. null means no bounds.\"\n },\n \"title\": {\n \"labels\": [\"Chart labels\"],\n \"type\": \"string\",\n \"default\": \"null\",\n \"description\": \"Text to display above the chart. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-title' classes.\"\n },\n \"titleHeight\": {\n \"default\": \"18\",\n \"labels\": [\"Chart labels\"],\n \"type\": \"integer\",\n \"description\": \"Height of the chart title, in pixels. This also controls the default font size of the title. If you style the title on your own, this controls how much space is set aside above the chart for the title's div.\"\n },\n \"xlabel\": {\n \"labels\": [\"Chart labels\"],\n \"type\": \"string\",\n \"default\": \"null\",\n \"description\": \"Text to display below the chart's x-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-xlabel' classes.\"\n },\n \"xLabelHeight\": {\n \"labels\": [\"Chart labels\"],\n \"type\": \"integer\",\n \"default\": \"18\",\n \"description\": \"Height of the x-axis label, in pixels. This also controls the default font size of the x-axis label. If you style the label on your own, this controls how much space is set aside below the chart for the x-axis label's div.\"\n },\n \"ylabel\": {\n \"labels\": [\"Chart labels\"],\n \"type\": \"string\",\n \"default\": \"null\",\n \"description\": \"Text to display to the left of the chart's y-axis. You can supply any HTML for this value, not just text. If you wish to style it using CSS, use the 'dygraph-label' or 'dygraph-ylabel' classes. The text will be rotated 90 degrees by default, so CSS rules may behave in unintuitive ways. No additional space is set aside for a y-axis label. If you need more space, increase the width of the y-axis tick labels using the yAxisLabelWidth option. If you need a wider div for the y-axis label, either style it that way with CSS (but remember that it's rotated, so width is controlled by the 'height' property) or set the yLabelWidth option.\"\n },\n \"y2label\": {\n \"labels\": [\"Chart labels\"],\n \"type\": \"string\",\n \"default\": \"null\",\n \"description\": \"Text to display to the right of the chart's secondary y-axis. This label is only displayed if a secondary y-axis is present. See this test for an example of how to do this. The comments for the 'ylabel' option generally apply here as well. This label gets a 'dygraph-y2label' instead of a 'dygraph-ylabel' class.\"\n },\n \"yLabelWidth\": {\n \"labels\": [\"Chart labels\"],\n \"type\": \"integer\",\n \"default\": \"18\",\n \"description\": \"Width of the div which contains the y-axis label. Since the y-axis label appears rotated 90 degrees, this actually affects the height of its div.\"\n },\n \"drawGrid\": {\n \"default\": \"true for x and y, false for y2\",\n \"labels\": [\"Grid\"],\n \"type\": \"boolean\",\n \"description\": \"Whether to display gridlines in the chart. This may be set on a per-axis basis to define the visibility of each axis' grid separately.\"\n },\n \"independentTicks\": {\n \"default\": \"true for y, false for y2\",\n \"labels\": [\"Axis display\", \"Grid\"],\n \"type\": \"boolean\",\n \"description\": \"Only valid for y and y2, has no effect on x: This option defines whether the y axes should align their ticks or if they should be independent. Possible combinations: 1.) y=true, y2=false (default): y is the primary axis and the y2 ticks are aligned to the the ones of y. (only 1 grid) 2.) y=false, y2=true: y2 is the primary axis and the y ticks are aligned to the the ones of y2. (only 1 grid) 3.) y=true, y2=true: Both axis are independent and have their own ticks. (2 grids) 4.) y=false, y2=false: Invalid configuration causes an error.\"\n },\n \"drawAxis\": {\n \"default\": \"true for x and y, false for y2\",\n \"labels\": [\"Axis display\"],\n \"type\": \"boolean\",\n \"description\": \"Whether to draw the specified axis. This may be set on a per-axis basis to define the visibility of each axis separately. Setting this to false also prevents axis ticks from being drawn and reclaims the space for the chart grid/lines.\"\n },\n \"gridLineWidth\": {\n \"default\": \"0.3\",\n \"labels\": [\"Grid\"],\n \"type\": \"float\",\n \"description\": \"Thickness (in pixels) of the gridlines drawn under the chart. The vertical/horizontal gridlines can be turned off entirely by using the drawGrid option. This may be set on a per-axis basis to define each axis' grid separately.\"\n },\n \"axisLineWidth\": {\n \"default\": \"0.3\",\n \"labels\": [\"Axis display\"],\n \"type\": \"float\",\n \"description\": \"Thickness (in pixels) of the x- and y-axis lines.\"\n },\n \"axisLineColor\": {\n \"default\": \"black\",\n \"labels\": [\"Axis display\"],\n \"type\": \"string\",\n \"description\": \"Color of the x- and y-axis lines. Accepts any value which the HTML canvas strokeStyle attribute understands, e.g. 'black' or 'rgb(0, 100, 255)'.\"\n },\n \"fillAlpha\": {\n \"default\": \"0.15\",\n \"labels\": [\"Error Bars\", \"Data Series Colors\"],\n \"type\": \"float (0.0 - 1.0)\",\n \"description\": \"Error bars (or custom bars) for each series are drawn in the same color as the series, but with partial transparency. This sets the transparency. A value of 0.0 means that the error bars will not be drawn, whereas a value of 1.0 means that the error bars will be as dark as the line for the series itself. This can be used to produce chart lines whose thickness varies at each point.\"\n },\n \"axisLabelWidth\": {\n \"default\": \"50 (y-axis), 60 (x-axis)\",\n \"labels\": [\"Axis display\", \"Chart labels\"],\n \"type\": \"integer\",\n \"description\": \"Width (in pixels) of the containing divs for x- and y-axis labels. For the y-axis, this also controls the width of the y-axis. Note that for the x-axis, this is independent from pixelsPerLabel, which controls the spacing between labels.\"\n },\n \"sigFigs\": {\n \"default\": \"null\",\n \"labels\": [\"Value display/formatting\"],\n \"type\": \"integer\",\n \"description\": \"By default, dygraphs displays numbers with a fixed number of digits after the decimal point. If you'd prefer to have a fixed number of significant figures, set this option to that number of sig figs. A value of 2, for instance, would cause 1 to be display as 1.0 and 1234 to be displayed as 1.23e+3.\"\n },\n \"digitsAfterDecimal\": {\n \"default\": \"2\",\n \"labels\": [\"Value display/formatting\"],\n \"type\": \"integer\",\n \"description\": \"Unless it's run in scientific mode (see the sigFigs option), dygraphs displays numbers with digitsAfterDecimal digits after the decimal point. Trailing zeros are not displayed, so with a value of 2 you'll get '0', '0.1', '0.12', '123.45' but not '123.456' (it will be rounded to '123.46'). Numbers with absolute value less than 0.1^digitsAfterDecimal (i.e. those which would show up as '0.00') will be displayed in scientific notation.\"\n },\n \"maxNumberWidth\": {\n \"default\": \"6\",\n \"labels\": [\"Value display/formatting\"],\n \"type\": \"integer\",\n \"description\": \"When displaying numbers in normal (not scientific) mode, large numbers will be displayed with many trailing zeros (e.g. 100000000 instead of 1e9). This can lead to unwieldy y-axis labels. If there are more than maxNumberWidth digits to the left of the decimal in a number, dygraphs will switch to scientific notation, even when not operating in scientific mode. If you'd like to see all those digits, set this to something large, like 20 or 30.\"\n },\n \"file\": {\n \"default\": \"(set when constructed)\",\n \"labels\": [\"Data\"],\n \"type\": \"string (URL of CSV or CSV), GViz DataTable or 2D Array\",\n \"description\": \"Sets the data being displayed in the chart. This can only be set when calling updateOptions; it cannot be set from the constructor. For a full description of valid data formats, see the Data Formats page.\"\n },\n \"timingName\": {\n \"default\": \"null\",\n \"labels\": [\"Debugging\", \"Deprecated\"],\n \"type\": \"string\",\n \"description\": \"Set this option to log timing information. The value of the option will be logged along with the timimg, so that you can distinguish multiple dygraphs on the same page.\"\n },\n \"showRangeSelector\": {\n \"default\": \"false\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"boolean\",\n \"description\": \"Show or hide the range selector widget.\"\n },\n \"rangeSelectorHeight\": {\n \"default\": \"40\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"integer\",\n \"description\": \"Height, in pixels, of the range selector widget. This option can only be specified at Dygraph creation time.\"\n },\n \"rangeSelectorPlotStrokeColor\": {\n \"default\": \"#808FAB\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"string\",\n \"description\": \"The range selector mini plot stroke color. This can be of the form \\\"#AABBCC\\\" or \\\"rgb(255,100,200)\\\" or \\\"yellow\\\". You can also specify null or \\\"\\\" to turn off stroke.\"\n },\n \"rangeSelectorPlotFillColor\": {\n \"default\": \"#A7B1C4\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"string\",\n \"description\": \"The range selector mini plot fill color. This can be of the form \\\"#AABBCC\\\" or \\\"rgb(255,100,200)\\\" or \\\"yellow\\\". You can also specify null or \\\"\\\" to turn off fill.\"\n },\n \"rangeSelectorPlotFillGradientColor\": {\n \"default\": \"white\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"string\",\n \"description\": \"The top color for the range selector mini plot fill color gradient. This can be of the form \\\"#AABBCC\\\" or \\\"rgb(255,100,200)\\\" or \\\"rgba(255,100,200,42)\\\" or \\\"yellow\\\". You can also specify null or \\\"\\\" to disable the gradient and fill with one single color.\"\n },\n \"rangeSelectorBackgroundStrokeColor\": {\n \"default\": \"gray\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"string\",\n \"description\": \"The color of the lines below and on both sides of the range selector mini plot. This can be of the form \\\"#AABBCC\\\" or \\\"rgb(255,100,200)\\\" or \\\"yellow\\\".\"\n },\n \"rangeSelectorBackgroundLineWidth\": {\n \"default\": \"1\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"float\",\n \"description\": \"The width of the lines below and on both sides of the range selector mini plot.\"\n },\n \"rangeSelectorPlotLineWidth\": {\n \"default\": \"1.5\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"float\",\n \"description\": \"The width of the range selector mini plot line.\"\n },\n \"rangeSelectorForegroundStrokeColor\": {\n \"default\": \"black\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"string\",\n \"description\": \"The color of the lines in the interactive layer of the range selector. This can be of the form \\\"#AABBCC\\\" or \\\"rgb(255,100,200)\\\" or \\\"yellow\\\".\"\n },\n \"rangeSelectorForegroundLineWidth\": {\n \"default\": \"1\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"float\",\n \"description\": \"The width the lines in the interactive layer of the range selector.\"\n },\n \"rangeSelectorAlpha\": {\n \"default\": \"0.6\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"float (0.0 - 1.0)\",\n \"description\": \"The transparency of the veil that is drawn over the unselected portions of the range selector mini plot. A value of 0 represents full transparency and the unselected portions of the mini plot will appear as normal. A value of 1 represents full opacity and the unselected portions of the mini plot will be hidden.\"\n },\n \"showInRangeSelector\": {\n \"default\": \"null\",\n \"labels\": [\"Range Selector\"],\n \"type\": \"boolean\",\n \"description\": \"Mark this series for inclusion in the range selector. The mini plot curve will be an average of all such series. If this is not specified for any series, the default behavior is to average all the visible series. Setting it for one series will result in that series being charted alone in the range selector. Once it's set for a single series, it needs to be set for all series which should be included (regardless of visibility).\"\n },\n \"animatedZooms\": {\n \"default\": \"false\",\n \"labels\": [\"Interactive Elements\"],\n \"type\": \"boolean\",\n \"description\": \"Set this option to animate the transition between zoom windows. Applies to programmatic and interactive zooms. Note that if you also set a drawCallback, it will be called several times on each zoom. If you set a zoomCallback, it will only be called after the animation is complete.\"\n },\n \"plotter\": {\n \"default\": \"[DygraphCanvasRenderer.Plotters.fillPlotter, DygraphCanvasRenderer.Plotters.errorPlotter, DygraphCanvasRenderer.Plotters.linePlotter]\",\n \"labels\": [\"Data Line display\"],\n \"type\": \"array or function\",\n \"description\": \"A function (or array of functions) which plot each data series on the chart. TODO(danvk): more details! May be set per-series.\"\n },\n \"axes\": {\n \"default\": \"null\",\n \"labels\": [\"Configuration\"],\n \"type\": \"Object\",\n \"description\": \"Defines per-axis options. Valid keys are 'x', 'y' and 'y2'. Only some options may be set on a per-axis basis. If an option may be set in this way, it will be noted on this page. See also documentation on per-series and per-axis options.\"\n },\n \"series\": {\n \"default\": \"null\",\n \"labels\": [\"Series\"],\n \"type\": \"Object\",\n \"description\": \"Defines per-series options. Its keys match the y-axis label names, and the values are dictionaries themselves that contain options specific to that series.\"\n },\n \"plugins\": {\n \"default\": \"[]\",\n \"labels\": [\"Configuration\"],\n \"type\": \"Array\",\n \"description\": \"Defines per-graph plugins. Useful for per-graph customization\"\n },\n \"dataHandler\": {\n \"default\": \"(depends on data)\",\n \"labels\": [\"Data\"],\n \"type\": \"Dygraph.DataHandler\",\n \"description\": \"Custom DataHandler. This is an advanced customization. See http://bit.ly/151E7Aq.\"\n }\n }; //
    \n // NOTE: in addition to parsing as JS, this snippet is expected to be valid\n // JSON. This assumption cannot be checked in JS, but it will be checked when\n // documentation is generated by the generate-documentation.py script. For the\n // most part, this just means that you should always use double quotes.\n\n // Do a quick sanity check on the options reference.\n var warn = function warn(msg) {\n if (window.console) window.console.warn(msg);\n };\n var flds = ['type', 'default', 'description'];\n var valid_cats = ['Annotations', 'Axis display', 'Chart labels', 'CSV parsing', 'Callbacks', 'Data', 'Data Line display', 'Data Series Colors', 'Error Bars', 'Grid', 'Interactive Elements', 'Range Selector', 'Legend', 'Overall display', 'Rolling Averages', 'Series', 'Value display/formatting', 'Zooming', 'Debugging', 'Configuration', 'Deprecated'];\n var i;\n var cats = {};\n for (i = 0; i < valid_cats.length; i++) cats[valid_cats[i]] = true;\n\n for (var k in OPTIONS_REFERENCE) {\n if (!OPTIONS_REFERENCE.hasOwnProperty(k)) continue;\n var op = OPTIONS_REFERENCE[k];\n for (i = 0; i < flds.length; i++) {\n if (!op.hasOwnProperty(flds[i])) {\n warn('Option ' + k + ' missing \"' + flds[i] + '\" property');\n } else if (typeof op[flds[i]] != 'string') {\n warn(k + '.' + flds[i] + ' must be of type string');\n }\n }\n var labels = op.labels;\n if (typeof labels !== 'object') {\n warn('Option \"' + k + '\" is missing a \"labels\": [...] option');\n } else {\n for (i = 0; i < labels.length; i++) {\n if (!cats.hasOwnProperty(labels[i])) {\n warn('Option \"' + k + '\" has label \"' + labels[i] + '\", which is invalid.');\n }\n }\n }\n }\n }\n}\n\nexports['default'] = OPTIONS_REFERENCE;\nmodule.exports = exports['default'];","/**\n * To create a \"drag\" interaction, you typically register a mousedown event\n * handler on the element where the drag begins. In that handler, you register a\n * mouseup handler on the window to determine when the mouse is released,\n * wherever that release happens. This works well, except when the user releases\n * the mouse over an off-domain iframe. In that case, the mouseup event is\n * handled by the iframe and never bubbles up to the window handler.\n *\n * To deal with this issue, we cover iframes with high z-index divs to make sure\n * they don't capture mouseup.\n *\n * Usage:\n * element.addEventListener('mousedown', function() {\n * var tarper = new IFrameTarp();\n * tarper.cover();\n * var mouseUpHandler = function() {\n * ...\n * window.removeEventListener(mouseUpHandler);\n * tarper.uncover();\n * };\n * window.addEventListener('mouseup', mouseUpHandler);\n * };\n *\n * @constructor\n */\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj[\"default\"] = obj; return newObj; } }\n\nvar _dygraphUtils = require('./dygraph-utils');\n\nvar utils = _interopRequireWildcard(_dygraphUtils);\n\nfunction IFrameTarp() {\n /** @type {Array.} */\n this.tarps = [];\n};\n\n/**\n * Find all the iframes in the document and cover them with high z-index\n * transparent divs.\n */\nIFrameTarp.prototype.cover = function () {\n var iframes = document.getElementsByTagName(\"iframe\");\n for (var i = 0; i < iframes.length; i++) {\n var iframe = iframes[i];\n var pos = utils.findPos(iframe),\n x = pos.x,\n y = pos.y,\n width = iframe.offsetWidth,\n height = iframe.offsetHeight;\n\n var div = document.createElement(\"div\");\n div.style.position = \"absolute\";\n div.style.left = x + 'px';\n div.style.top = y + 'px';\n div.style.width = width + 'px';\n div.style.height = height + 'px';\n div.style.zIndex = 999;\n document.body.appendChild(div);\n this.tarps.push(div);\n }\n};\n\n/**\n * Remove all the iframe covers. You should call this in a mouseup handler.\n */\nIFrameTarp.prototype.uncover = function () {\n for (var i = 0; i < this.tarps.length; i++) {\n this.tarps[i].parentNode.removeChild(this.tarps[i]);\n }\n this.tarps = [];\n};\n\nexports[\"default\"] = IFrameTarp;\nmodule.exports = exports[\"default\"];","/**\n * @license\n * Copyright 2013 David Eberlein (david.eberlein@ch.sauter-bc.com)\n * MIT-licensed (http://opensource.org/licenses/MIT)\n */\n\n/**\n * @fileoverview DataHandler default implementation used for simple line charts.\n * @author David Eberlein (david.eberlein@ch.sauter-bc.com)\n */\n\n/*global Dygraph:false */\n\"use strict\";\n\nObject.defineProperty(exports, '__esModule', {\n value: true\n});\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar _datahandler = require('./datahandler');\n\nvar _datahandler2 = _interopRequireDefault(_datahandler);\n\n/**\n * @constructor\n * @extends Dygraph.DataHandler\n */\nvar DefaultHandler = function DefaultHandler() {};\n\nDefaultHandler.prototype = new _datahandler2['default']();\n\n/** @inheritDoc */\nDefaultHandler.prototype.extractSeries = function (rawData, i, options) {\n // TODO(danvk): pre-allocate series here.\n var series = [];\n var logScale = options.get('logscale');\n for (var j = 0; j < rawData.length; j++) {\n var x = rawData[j][0];\n var point = rawData[j][i];\n if (logScale) {\n // On the log scale, points less than zero do not exist.\n // This will create a gap in the chart.\n if (point <= 0) {\n point = null;\n }\n }\n series.push([x, point]);\n }\n return series;\n};\n\n/** @inheritDoc */\nDefaultHandler.prototype.rollingAverage = function (originalData, rollPeriod, options) {\n rollPeriod = Math.min(rollPeriod, originalData.length);\n var rollingData = [];\n\n var i, j, y, sum, num_ok;\n // Calculate the rolling average for the first rollPeriod - 1 points\n // where\n // there is not enough data to roll over the full number of points\n if (rollPeriod == 1) {\n return originalData;\n }\n for (i = 0; i < originalData.length; i++) {\n sum = 0;\n num_ok = 0;\n for (j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) {\n y = originalData[j][1];\n if (y === null || isNaN(y)) continue;\n num_ok++;\n sum += originalData[j][1];\n }\n if (num_ok) {\n rollingData[i] = [originalData[i][0], sum / num_ok];\n } else {\n rollingData[i] = [originalData[i][0], null];\n }\n }\n\n return rollingData;\n};\n\n/** @inheritDoc */\nDefaultHandler.prototype.getExtremeYValues = function (series, dateWindow, options) {\n var minY = null,\n maxY = null,\n y;\n var firstIdx = 0,\n lastIdx = series.length - 1;\n\n for (var j = firstIdx; j <= lastIdx; j++) {\n y = series[j][1];\n if (y === null || isNaN(y)) continue;\n if (maxY === null || y > maxY) {\n maxY = y;\n }\n if (minY === null || y < minY) {\n minY = y;\n }\n }\n return [minY, maxY];\n};\n\nexports['default'] = DefaultHandler;\nmodule.exports = exports['default'];","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","/* MIT license */\nvar cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n// values that give correct `typeof` results).\n// do not use box values types (i.e. Number(), String(), etc.)\n\nvar reverseKeywords = {};\nfor (var key in cssKeywords) {\n\tif (cssKeywords.hasOwnProperty(key)) {\n\t\treverseKeywords[cssKeywords[key]] = key;\n\t}\n}\n\nvar convert = module.exports = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\n// hide .channels and .labels properties\nfor (var model in convert) {\n\tif (convert.hasOwnProperty(model)) {\n\t\tif (!('channels' in convert[model])) {\n\t\t\tthrow new Error('missing channels property: ' + model);\n\t\t}\n\n\t\tif (!('labels' in convert[model])) {\n\t\t\tthrow new Error('missing channel labels property: ' + model);\n\t\t}\n\n\t\tif (convert[model].labels.length !== convert[model].channels) {\n\t\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t\t}\n\n\t\tvar channels = convert[model].channels;\n\t\tvar labels = convert[model].labels;\n\t\tdelete convert[model].channels;\n\t\tdelete convert[model].labels;\n\t\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\t\tObject.defineProperty(convert[model], 'labels', {value: labels});\n\t}\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar min = Math.min(r, g, b);\n\tvar max = Math.max(r, g, b);\n\tvar delta = max - min;\n\tvar h;\n\tvar s;\n\tvar l;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tl = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tvar rdif;\n\tvar gdif;\n\tvar bdif;\n\tvar h;\n\tvar s;\n\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar v = Math.max(r, g, b);\n\tvar diff = v - Math.min(r, g, b);\n\tvar diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = s = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tvar r = rgb[0];\n\tvar g = rgb[1];\n\tvar b = rgb[2];\n\tvar h = convert.rgb.hsl(rgb)[0];\n\tvar w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar c;\n\tvar m;\n\tvar y;\n\tvar k;\n\n\tk = Math.min(1 - r, 1 - g, 1 - b);\n\tc = (1 - r - k) / (1 - k) || 0;\n\tm = (1 - g - k) / (1 - k) || 0;\n\ty = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\n/**\n * See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n * */\nfunction comparativeDistance(x, y) {\n\treturn (\n\t\tMath.pow(x[0] - y[0], 2) +\n\t\tMath.pow(x[1] - y[1], 2) +\n\t\tMath.pow(x[2] - y[2], 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tvar reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tvar currentClosestDistance = Infinity;\n\tvar currentClosestKeyword;\n\n\tfor (var keyword in cssKeywords) {\n\t\tif (cssKeywords.hasOwnProperty(keyword)) {\n\t\t\tvar value = cssKeywords[keyword];\n\n\t\t\t// Compute comparative distance\n\t\t\tvar distance = comparativeDistance(rgb, value);\n\n\t\t\t// Check if its less, if so set as closest\n\t\t\tif (distance < currentClosestDistance) {\n\t\t\t\tcurrentClosestDistance = distance;\n\t\t\t\tcurrentClosestKeyword = keyword;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\n\t// assume sRGB\n\tr = r > 0.04045 ? Math.pow(((r + 0.055) / 1.055), 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? Math.pow(((g + 0.055) / 1.055), 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? Math.pow(((b + 0.055) / 1.055), 2.4) : (b / 12.92);\n\n\tvar x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tvar y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tvar z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tvar xyz = convert.rgb.xyz(rgb);\n\tvar x = xyz[0];\n\tvar y = xyz[1];\n\tvar z = xyz[2];\n\tvar l;\n\tvar a;\n\tvar b;\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);\n\n\tl = (116 * y) - 16;\n\ta = 500 * (x - y);\n\tb = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tvar h = hsl[0] / 360;\n\tvar s = hsl[1] / 100;\n\tvar l = hsl[2] / 100;\n\tvar t1;\n\tvar t2;\n\tvar t3;\n\tvar rgb;\n\tvar val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tt1 = 2 * l - t2;\n\n\trgb = [0, 0, 0];\n\tfor (var i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tvar h = hsl[0];\n\tvar s = hsl[1] / 100;\n\tvar l = hsl[2] / 100;\n\tvar smin = s;\n\tvar lmin = Math.max(l, 0.01);\n\tvar sv;\n\tvar v;\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tv = (l + s) / 2;\n\tsv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tvar h = hsv[0] / 60;\n\tvar s = hsv[1] / 100;\n\tvar v = hsv[2] / 100;\n\tvar hi = Math.floor(h) % 6;\n\n\tvar f = h - Math.floor(h);\n\tvar p = 255 * v * (1 - s);\n\tvar q = 255 * v * (1 - (s * f));\n\tvar t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tvar h = hsv[0];\n\tvar s = hsv[1] / 100;\n\tvar v = hsv[2] / 100;\n\tvar vmin = Math.max(v, 0.01);\n\tvar lmin;\n\tvar sl;\n\tvar l;\n\n\tl = (2 - s) * v;\n\tlmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tvar h = hwb[0] / 360;\n\tvar wh = hwb[1] / 100;\n\tvar bl = hwb[2] / 100;\n\tvar ratio = wh + bl;\n\tvar i;\n\tvar v;\n\tvar f;\n\tvar n;\n\n\t// wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\ti = Math.floor(6 * h);\n\tv = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tn = wh + f * (v - wh); // linear interpolation\n\n\tvar r;\n\tvar g;\n\tvar b;\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v; g = n; b = wh; break;\n\t\tcase 1: r = n; g = v; b = wh; break;\n\t\tcase 2: r = wh; g = v; b = n; break;\n\t\tcase 3: r = wh; g = n; b = v; break;\n\t\tcase 4: r = n; g = wh; b = v; break;\n\t\tcase 5: r = v; g = wh; b = n; break;\n\t}\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tvar c = cmyk[0] / 100;\n\tvar m = cmyk[1] / 100;\n\tvar y = cmyk[2] / 100;\n\tvar k = cmyk[3] / 100;\n\tvar r;\n\tvar g;\n\tvar b;\n\n\tr = 1 - Math.min(1, c * (1 - k) + k);\n\tg = 1 - Math.min(1, m * (1 - k) + k);\n\tb = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tvar x = xyz[0] / 100;\n\tvar y = xyz[1] / 100;\n\tvar z = xyz[2] / 100;\n\tvar r;\n\tvar g;\n\tvar b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * Math.pow(r, 1.0 / 2.4)) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * Math.pow(g, 1.0 / 2.4)) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * Math.pow(b, 1.0 / 2.4)) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tvar x = xyz[0];\n\tvar y = xyz[1];\n\tvar z = xyz[2];\n\tvar l;\n\tvar a;\n\tvar b;\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);\n\n\tl = (116 * y) - 16;\n\ta = 500 * (x - y);\n\tb = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tvar l = lab[0];\n\tvar a = lab[1];\n\tvar b = lab[2];\n\tvar x;\n\tvar y;\n\tvar z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tvar y2 = Math.pow(y, 3);\n\tvar x2 = Math.pow(x, 3);\n\tvar z2 = Math.pow(z, 3);\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tvar l = lab[0];\n\tvar a = lab[1];\n\tvar b = lab[2];\n\tvar hr;\n\tvar h;\n\tvar c;\n\n\thr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tc = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tvar l = lch[0];\n\tvar c = lch[1];\n\tvar h = lch[2];\n\tvar a;\n\tvar b;\n\tvar hr;\n\n\thr = h / 360 * 2 * Math.PI;\n\ta = c * Math.cos(hr);\n\tb = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args) {\n\tvar r = args[0];\n\tvar g = args[1];\n\tvar b = args[2];\n\tvar value = 1 in arguments ? arguments[1] : convert.rgb.hsv(args)[2]; // hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tvar ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tvar r = args[0];\n\tvar g = args[1];\n\tvar b = args[2];\n\n\t// we use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tvar ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tvar color = args % 10;\n\n\t// handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tvar mult = (~~(args > 50) + 1) * 0.5;\n\tvar r = ((color & 1) * mult) * 255;\n\tvar g = (((color >> 1) & 1) * mult) * 255;\n\tvar b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// handle greyscale\n\tif (args >= 232) {\n\t\tvar c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tvar rem;\n\tvar r = Math.floor(args / 36) / 5 * 255;\n\tvar g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tvar b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tvar integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tvar string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tvar match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tvar colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(function (char) {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tvar integer = parseInt(colorString, 16);\n\tvar r = (integer >> 16) & 0xFF;\n\tvar g = (integer >> 8) & 0xFF;\n\tvar b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tvar r = rgb[0] / 255;\n\tvar g = rgb[1] / 255;\n\tvar b = rgb[2] / 255;\n\tvar max = Math.max(Math.max(r, g), b);\n\tvar min = Math.min(Math.min(r, g), b);\n\tvar chroma = (max - min);\n\tvar grayscale;\n\tvar hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma + 4;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tvar s = hsl[1] / 100;\n\tvar l = hsl[2] / 100;\n\tvar c = 1;\n\tvar f = 0;\n\n\tif (l < 0.5) {\n\t\tc = 2.0 * s * l;\n\t} else {\n\t\tc = 2.0 * s * (1.0 - l);\n\t}\n\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tvar s = hsv[1] / 100;\n\tvar v = hsv[2] / 100;\n\n\tvar c = s * v;\n\tvar f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tvar h = hcg[0] / 360;\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tvar pure = [0, 0, 0];\n\tvar hi = (h % 1) * 6;\n\tvar v = hi % 1;\n\tvar w = 1 - v;\n\tvar mg = 0;\n\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\n\tvar v = c + g * (1.0 - c);\n\tvar f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\n\tvar l = g * (1.0 - c) + 0.5 * c;\n\tvar s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tvar c = hcg[1] / 100;\n\tvar g = hcg[2] / 100;\n\tvar v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tvar w = hwb[1] / 100;\n\tvar b = hwb[2] / 100;\n\tvar v = 1 - b;\n\tvar c = v - w;\n\tvar g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = convert.gray.hsv = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tvar val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tvar integer = (val << 16) + (val << 8) + val;\n\n\tvar string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tvar val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n","/**\n*\n* jquery.sparkline.js\n*\n* v2.4.1\n* (c) Splunk, Inc\n* Contact: Gareth Watts (gareth@splunk.com)\n* http://omnipotent.net/jquery.sparkline/\n*\n* Generates inline sparkline charts from data supplied either to the method\n* or inline in HTML\n*\n* Compatible with Internet Explorer 6.0+ and modern browsers equipped with the canvas tag\n* (Firefox 2.0+, Safari, Opera, etc)\n*\n* License: New BSD License\n*\n* Copyright (c) 2012, Splunk Inc.\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without modification,\n* are permitted provided that the following conditions are met:\n*\n* * Redistributions of source code must retain the above copyright notice,\n* this list of conditions and the following disclaimer.\n* * Redistributions in binary form must reproduce the above copyright notice,\n* this list of conditions and the following disclaimer in the documentation\n* and/or other materials provided with the distribution.\n* * Neither the name of Splunk Inc nor the names of its contributors may\n* be used to endorse or promote products derived from this software without\n* specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY\n* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\n* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\n* SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT\n* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*\n*\n* Usage:\n* $(selector).sparkline(values, options)\n*\n* If values is undefined or set to 'html' then the data values are read from the specified tag:\n*

    Sparkline: 1,4,6,6,8,5,3,5

    \n* $('.sparkline').sparkline();\n* There must be no spaces in the enclosed data set\n*\n* Otherwise values must be an array of numbers or null values\n*

    Sparkline: This text replaced if the browser is compatible

    \n* $('#sparkline1').sparkline([1,4,6,6,8,5,3,5])\n* $('#sparkline2').sparkline([1,4,6,null,null,5,3,5])\n*\n* Values can also be specified in an HTML comment, or as a values attribute:\n*

    Sparkline:

    \n*

    Sparkline:

    \n* $('.sparkline').sparkline();\n*\n* For line charts, x values can also be specified:\n*

    Sparkline: 1:1,2.7:4,3.4:6,5:6,6:8,8.7:5,9:3,10:5

    \n* $('#sparkline1').sparkline([ [1,1], [2.7,4], [3.4,6], [5,6], [6,8], [8.7,5], [9,3], [10,5] ])\n*\n* By default, options should be passed in as the second argument to the sparkline function:\n* $('.sparkline').sparkline([1,2,3,4], {type: 'bar'})\n*\n* Options can also be set by passing them on the tag itself. This feature is disabled by default though\n* as there's a slight performance overhead:\n* $('.sparkline').sparkline([1,2,3,4], {enableTagOptions: true})\n*

    Sparkline: loading

    \n* Prefix all options supplied as tag attribute with \"spark\" (configurable by setting tagOptionsPrefix)\n*\n* Supported options:\n* lineColor - Color of the line used for the chart\n* fillColor - Color used to fill in the chart - Set to '' or false for a transparent chart\n* width - Width of the chart - Defaults to 3 times the number of values in pixels\n* height - Height of the chart - Defaults to the height of the containing element\n* chartRangeMin - Specify the minimum value to use for the Y range of the chart - Defaults to the minimum value supplied\n* chartRangeMax - Specify the maximum value to use for the Y range of the chart - Defaults to the maximum value supplied\n* chartRangeClip - Clip out of range values to the max/min specified by chartRangeMin and chartRangeMax\n* chartRangeMinX - Specify the minimum value to use for the X range of the chart - Defaults to the minimum value supplied\n* chartRangeMaxX - Specify the maximum value to use for the X range of the chart - Defaults to the maximum value supplied\n* composite - If true then don't erase any existing chart attached to the tag, but draw\n* another chart over the top - Note that width and height are ignored if an\n* existing chart is detected.\n* tagValuesAttribute - Name of tag attribute to check for data values - Defaults to 'values'\n* enableTagOptions - Whether to check tags for sparkline options\n* tagOptionsPrefix - Prefix used for options supplied as tag attributes - Defaults to 'spark'\n* disableHiddenCheck - If set to true, then the plugin will assume that charts will never be drawn into a\n* hidden dom element, avoding a browser reflow\n* disableInteraction - If set to true then all mouseover/click interaction behaviour will be disabled,\n* making the plugin perform much like it did in 1.x\n* disableTooltips - If set to true then tooltips will be disabled - Defaults to false (tooltips enabled)\n* disableHighlight - If set to true then highlighting of selected chart elements on mouseover will be disabled\n* defaults to false (highlights enabled)\n* highlightLighten - Factor to lighten/darken highlighted chart values by - Defaults to 1.4 for a 40% increase\n* tooltipContainer - Specify which DOM element the tooltip should be rendered into - defaults to document.body\n* tooltipClassname - Optional CSS classname to apply to tooltips - If not specified then a default style will be applied\n* tooltipOffsetX - How many pixels away from the mouse pointer to render the tooltip on the X axis\n* tooltipOffsetY - How many pixels away from the mouse pointer to render the tooltip on the r axis\n* tooltipFormatter - Optional callback that allows you to override the HTML displayed in the tooltip\n* callback is given arguments of (sparkline, options, fields)\n* tooltipChartTitle - If specified then the tooltip uses the string specified by this setting as a title\n* tooltipFormat - A format string or SPFormat object (or an array thereof for multiple entries)\n* to control the format of the tooltip\n* tooltipPrefix - A string to prepend to each field displayed in a tooltip\n* tooltipSuffix - A string to append to each field displayed in a tooltip\n* tooltipSkipNull - If true then null values will not have a tooltip displayed (defaults to true)\n* tooltipValueLookups - An object or range map to map field values to tooltip strings\n* (eg. to map -1 to \"Lost\", 0 to \"Draw\", and 1 to \"Win\")\n* numberFormatter - Optional callback for formatting numbers in tooltips\n* numberDigitGroupSep - Character to use for group separator in numbers \"1,234\" - Defaults to \",\"\n* numberDecimalMark - Character to use for the decimal point when formatting numbers - Defaults to \".\"\n* numberDigitGroupCount - Number of digits between group separator - Defaults to 3\n*\n* There are 7 types of sparkline, selected by supplying a \"type\" option of 'line' (default),\n* 'bar', 'tristate', 'bullet', 'discrete', 'pie' or 'box'\n* line - Line chart. Options:\n* spotColor - Set to '' to not end each line in a circular spot\n* minSpotColor - If set, color of spot at minimum value\n* maxSpotColor - If set, color of spot at maximum value\n* spotRadius - Radius in pixels\n* lineWidth - Width of line in pixels\n* normalRangeMin\n* normalRangeMax - If set draws a filled horizontal bar between these two values marking the \"normal\"\n* or expected range of values\n* normalRangeColor - Color to use for the above bar\n* drawNormalOnTop - Draw the normal range above the chart fill color if true\n* defaultPixelsPerValue - Defaults to 3 pixels of width for each value in the chart\n* highlightSpotColor - The color to use for drawing a highlight spot on mouseover - Set to null to disable\n* highlightLineColor - The color to use for drawing a highlight line on mouseover - Set to null to disable\n* valueSpots - Specify which points to draw spots on, and in which color. Accepts a range map\n*\n* bar - Bar chart. Options:\n* barColor - Color of bars for postive values\n* negBarColor - Color of bars for negative values\n* zeroColor - Color of bars with zero values\n* nullColor - Color of bars with null values - Defaults to omitting the bar entirely\n* barWidth - Width of bars in pixels\n* colorMap - Optional mappnig of values to colors to override the *BarColor values above\n* can be an Array of values to control the color of individual bars or a range map\n* to specify colors for individual ranges of values\n* barSpacing - Gap between bars in pixels\n* zeroAxis - Centers the y-axis around zero if true\n*\n* tristate - Charts values of win (>0), lose (<0) or draw (=0)\n* posBarColor - Color of win values\n* negBarColor - Color of lose values\n* zeroBarColor - Color of draw values\n* barWidth - Width of bars in pixels\n* barSpacing - Gap between bars in pixels\n* colorMap - Optional mappnig of values to colors to override the *BarColor values above\n* can be an Array of values to control the color of individual bars or a range map\n* to specify colors for individual ranges of values\n*\n* discrete - Options:\n* lineHeight - Height of each line in pixels - Defaults to 30% of the graph height\n* thesholdValue - Values less than this value will be drawn using thresholdColor instead of lineColor\n* thresholdColor\n*\n* bullet - Values for bullet graphs msut be in the order: target, performance, range1, range2, range3, ...\n* options:\n* targetColor - The color of the vertical target marker\n* targetWidth - The width of the target marker in pixels\n* performanceColor - The color of the performance measure horizontal bar\n* rangeColors - Colors to use for each qualitative range background color\n*\n* pie - Pie chart. Options:\n* sliceColors - An array of colors to use for pie slices\n* offset - Angle in degrees to offset the first slice - Try -90 or +90\n* borderWidth - Width of border to draw around the pie chart, in pixels - Defaults to 0 (no border)\n* borderColor - Color to use for the pie chart border - Defaults to #000\n*\n* box - Box plot. Options:\n* raw - Set to true to supply pre-computed plot points as values\n* values should be: low_outlier, low_whisker, q1, median, q3, high_whisker, high_outlier\n* When set to false you can supply any number of values and the box plot will\n* be computed for you. Default is false.\n* showOutliers - Set to true (default) to display outliers as circles\n* outlierIQR - Interquartile range used to determine outliers. Default 1.5\n* boxLineColor - Outline color of the box\n* boxFillColor - Fill color for the box\n* whiskerColor - Line color used for whiskers\n* outlierLineColor - Outline color of outlier circles\n* outlierFillColor - Fill color of the outlier circles\n* spotRadius - Radius of outlier circles\n* medianColor - Line color of the median line\n* target - Draw a target cross hair at the supplied value (default undefined)\n*\n*\n*\n* Examples:\n* $('#sparkline1').sparkline(myvalues, { lineColor: '#f00', fillColor: false });\n* $('.barsparks').sparkline('html', { type:'bar', height:'40px', barWidth:5 });\n* $('#tristate').sparkline([1,1,-1,1,0,0,-1], { type:'tristate' }):\n* $('#discrete').sparkline([1,3,4,5,5,3,4,5], { type:'discrete' });\n* $('#bullet').sparkline([10,12,12,9,7], { type:'bullet' });\n* $('#pie').sparkline([1,1,2], { type:'pie' });\n*/\n\n/*jslint regexp: true, browser: true, jquery: true, white: true, nomen: false, plusplus: false, maxerr: 500, indent: 4 */\n\n(function(document, Math, undefined) { // performance/minified-size optimization\n(function(factory) {\n if(typeof define === 'function' && define.amd) {\n define(['jquery'], factory);\n } else if (jQuery && !jQuery.fn.sparkline) {\n factory(jQuery);\n }\n}\n(function($) {\n 'use strict';\n\n var UNSET_OPTION = {},\n getDefaults, createClass, SPFormat, clipval, quartile, normalizeValue, normalizeValues,\n remove, isNumber, all, sum, addCSS, ensureArray, formatNumber, RangeMap,\n MouseHandler, Tooltip, barHighlightMixin,\n line, bar, tristate, discrete, bullet, pie, box, defaultStyles, initStyles,\n VShape, VCanvas_base, VCanvas_canvas, VCanvas_vml, pending, shapeCount = 0;\n\n /**\n * Default configuration settings\n */\n getDefaults = function () {\n return {\n // Settings common to most/all chart types\n common: {\n type: 'line',\n lineColor: '#00f',\n fillColor: '#cdf',\n defaultPixelsPerValue: 3,\n width: 'auto',\n height: 'auto',\n composite: false,\n tagValuesAttribute: 'values',\n tagOptionsPrefix: 'spark',\n enableTagOptions: false,\n enableHighlight: true,\n highlightLighten: 1.4,\n tooltipSkipNull: true,\n tooltipPrefix: '',\n tooltipSuffix: '',\n disableHiddenCheck: false,\n numberFormatter: false,\n numberDigitGroupCount: 3,\n numberDigitGroupSep: ',',\n numberDecimalMark: '.',\n disableTooltips: false,\n disableInteraction: false\n },\n // Defaults for line charts\n line: {\n spotColor: '#f80',\n highlightSpotColor: '#5f5',\n highlightLineColor: '#f22',\n spotRadius: 1.5,\n minSpotColor: '#f80',\n maxSpotColor: '#f80',\n lineWidth: 1,\n normalRangeMin: undefined,\n normalRangeMax: undefined,\n normalRangeColor: '#ccc',\n drawNormalOnTop: false,\n chartRangeMin: undefined,\n chartRangeMax: undefined,\n chartRangeMinX: undefined,\n chartRangeMaxX: undefined,\n tooltipFormat: new SPFormat(' {{prefix}}{{y}}{{suffix}}')\n },\n // Defaults for bar charts\n bar: {\n barColor: '#3366cc',\n negBarColor: '#f44',\n stackedBarColor: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00',\n '#dd4477', '#0099c6', '#990099'],\n zeroColor: undefined,\n nullColor: undefined,\n zeroAxis: true,\n barWidth: 4,\n barSpacing: 1,\n chartRangeMax: undefined,\n chartRangeMin: undefined,\n chartRangeClip: false,\n colorMap: undefined,\n tooltipFormat: new SPFormat(' {{prefix}}{{value}}{{suffix}}')\n },\n // Defaults for tristate charts\n tristate: {\n barWidth: 4,\n barSpacing: 1,\n posBarColor: '#6f6',\n negBarColor: '#f44',\n zeroBarColor: '#999',\n colorMap: {},\n tooltipFormat: new SPFormat(' {{value:map}}'),\n tooltipValueLookups: { map: { '-1': 'Loss', '0': 'Draw', '1': 'Win' } }\n },\n // Defaults for discrete charts\n discrete: {\n lineHeight: 'auto',\n thresholdColor: undefined,\n thresholdValue: 0,\n chartRangeMax: undefined,\n chartRangeMin: undefined,\n chartRangeClip: false,\n tooltipFormat: new SPFormat('{{prefix}}{{value}}{{suffix}}')\n },\n // Defaults for bullet charts\n bullet: {\n targetColor: '#f33',\n targetWidth: 3, // width of the target bar in pixels\n performanceColor: '#33f',\n rangeColors: ['#d3dafe', '#a8b6ff', '#7f94ff'],\n base: undefined, // set this to a number to change the base start number\n tooltipFormat: new SPFormat('{{fieldkey:fields}} - {{value}}'),\n tooltipValueLookups: { fields: {r: 'Range', p: 'Performance', t: 'Target'} }\n },\n // Defaults for pie charts\n pie: {\n offset: 0,\n sliceColors: ['#3366cc', '#dc3912', '#ff9900', '#109618', '#66aa00',\n '#dd4477', '#0099c6', '#990099'],\n borderWidth: 0,\n borderColor: '#000',\n tooltipFormat: new SPFormat(' {{value}} ({{percent.1}}%)')\n },\n // Defaults for box plots\n box: {\n raw: false,\n boxLineColor: '#000',\n boxFillColor: '#cdf',\n whiskerColor: '#000',\n outlierLineColor: '#333',\n outlierFillColor: '#fff',\n medianColor: '#f00',\n showOutliers: true,\n outlierIQR: 1.5,\n spotRadius: 1.5,\n target: undefined,\n targetColor: '#4a2',\n chartRangeMax: undefined,\n chartRangeMin: undefined,\n tooltipFormat: new SPFormat('{{field:fields}}: {{value}}'),\n tooltipFormatFieldlistKey: 'field',\n tooltipValueLookups: { fields: { lq: 'Lower Quartile', med: 'Median',\n uq: 'Upper Quartile', lo: 'Left Outlier', ro: 'Right Outlier',\n lw: 'Left Whisker', rw: 'Right Whisker'} }\n }\n };\n };\n\n // You can have tooltips use a css class other than jqstooltip by specifying tooltipClassname\n defaultStyles = '.jqstooltip { ' +\n 'position: absolute;' +\n 'left: 0px;' +\n 'top: 0px;' +\n 'visibility: hidden;' +\n 'background: rgb(0, 0, 0) transparent;' +\n 'background-color: rgba(0,0,0,0.6);' +\n 'filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000);' +\n '-ms-filter: \"progid:DXImageTransform.Microsoft.gradient(startColorstr=#99000000, endColorstr=#99000000)\";' +\n 'color: white;' +\n 'font: 10px arial, san serif;' +\n 'text-align: left;' +\n 'white-space: nowrap;' +\n 'padding: 5px;' +\n 'border: 1px solid white;' +\n 'box-sizing: content-box;' +\n 'z-index: 10000;' +\n '}' +\n '.jqsfield { ' +\n 'color: white;' +\n 'font: 10px arial, san serif;' +\n 'text-align: left;' +\n '}';\n\n /**\n * Utilities\n */\n\n createClass = function (/* [baseclass, [mixin, ...]], definition */) {\n var Class, args;\n Class = function () {\n this.init.apply(this, arguments);\n };\n if (arguments.length > 1) {\n if (arguments[0]) {\n Class.prototype = $.extend(new arguments[0](), arguments[arguments.length - 1]);\n Class._super = arguments[0].prototype;\n } else {\n Class.prototype = arguments[arguments.length - 1];\n }\n if (arguments.length > 2) {\n args = Array.prototype.slice.call(arguments, 1, -1);\n args.unshift(Class.prototype);\n $.extend.apply($, args);\n }\n } else {\n Class.prototype = arguments[0];\n }\n Class.prototype.cls = Class;\n return Class;\n };\n\n /**\n * Wraps a format string for tooltips\n * {{x}}\n * {{x.2}\n * {{x:months}}\n */\n $.SPFormatClass = SPFormat = createClass({\n fre: /\\{\\{([\\w.]+?)(:(.+?))?\\}\\}/g,\n precre: /(\\w+)\\.(\\d+)/,\n\n init: function (format, fclass) {\n this.format = format;\n this.fclass = fclass;\n },\n\n render: function (fieldset, lookups, options) {\n var self = this,\n fields = fieldset,\n match, token, lookupkey, fieldvalue, prec;\n return this.format.replace(this.fre, function () {\n var lookup;\n token = arguments[1];\n lookupkey = arguments[3];\n match = self.precre.exec(token);\n if (match) {\n prec = match[2];\n token = match[1];\n } else {\n prec = false;\n }\n fieldvalue = fields[token];\n if (fieldvalue === undefined) {\n return '';\n }\n if (lookupkey && lookups && lookups[lookupkey]) {\n lookup = lookups[lookupkey];\n if (lookup.get) { // RangeMap\n return lookups[lookupkey].get(fieldvalue) || fieldvalue;\n } else {\n return lookups[lookupkey][fieldvalue] || fieldvalue;\n }\n }\n if (isNumber(fieldvalue)) {\n if (options.get('numberFormatter')) {\n fieldvalue = options.get('numberFormatter')(fieldvalue);\n } else {\n fieldvalue = formatNumber(fieldvalue, prec,\n options.get('numberDigitGroupCount'),\n options.get('numberDigitGroupSep'),\n options.get('numberDecimalMark'));\n }\n }\n return fieldvalue;\n });\n }\n });\n\n // convience method to avoid needing the new operator\n $.spformat = function(format, fclass) {\n return new SPFormat(format, fclass);\n };\n\n clipval = function (val, min, max) {\n if (val < min) {\n return min;\n }\n if (val > max) {\n return max;\n }\n return val;\n };\n\n quartile = function (values, q) {\n var vl;\n if (q === 2) {\n vl = Math.floor(values.length / 2);\n return values.length % 2 ? values[vl] : (values[vl-1] + values[vl]) / 2;\n } else {\n if (values.length % 2 ) { // odd\n vl = (values.length * q + q) / 4;\n return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl-1];\n } else { //even\n vl = (values.length * q + 2) / 4;\n return vl % 1 ? (values[Math.floor(vl)] + values[Math.floor(vl) - 1]) / 2 : values[vl-1];\n\n }\n }\n };\n\n normalizeValue = function (val) {\n var nf;\n switch (val) {\n case 'undefined':\n val = undefined;\n break;\n case 'null':\n val = null;\n break;\n case 'true':\n val = true;\n break;\n case 'false':\n val = false;\n break;\n default:\n nf = parseFloat(val);\n if (val == nf) {\n val = nf;\n }\n }\n return val;\n };\n\n normalizeValues = function (vals) {\n var i, result = [];\n for (i = vals.length; i--;) {\n result[i] = normalizeValue(vals[i]);\n }\n return result;\n };\n\n remove = function (vals, filter) {\n var i, vl, result = [];\n for (i = 0, vl = vals.length; i < vl; i++) {\n if (vals[i] !== filter) {\n result.push(vals[i]);\n }\n }\n return result;\n };\n\n isNumber = function (num) {\n return !isNaN(parseFloat(num)) && isFinite(num);\n };\n\n formatNumber = function (num, prec, groupsize, groupsep, decsep) {\n var p, i;\n num = (prec === false ? parseFloat(num).toString() : num.toFixed(prec)).split('');\n p = (p = $.inArray('.', num)) < 0 ? num.length : p;\n if (p < num.length) {\n num[p] = decsep;\n }\n for (i = p - groupsize; i > 0; i -= groupsize) {\n num.splice(i, 0, groupsep);\n }\n return num.join('');\n };\n\n // determine if all values of an array match a value\n // returns true if the array is empty\n all = function (val, arr, ignoreNull) {\n var i;\n for (i = arr.length; i--; ) {\n if (ignoreNull && arr[i] === null) continue;\n if (arr[i] !== val) {\n return false;\n }\n }\n return true;\n };\n\n // sums the numeric values in an array, ignoring other values\n sum = function (vals) {\n var total = 0, i;\n for (i = vals.length; i--;) {\n total += typeof vals[i] === 'number' ? vals[i] : 0;\n }\n return total;\n };\n\n ensureArray = function (val) {\n return $.isArray(val) ? val : [val];\n };\n\n // http://paulirish.com/2008/bookmarklet-inject-new-css-rules/\n addCSS = function(css) {\n var tag, iefail;\n if (document.createStyleSheet) {\n try {\n document.createStyleSheet().cssText = css;\n return;\n } catch (e) {\n // IE <= 9 maxes out at 31 stylesheets; inject into page instead.\n iefail = true;\n }\n }\n tag = document.createElement('style');\n tag.type = 'text/css';\n document.getElementsByTagName('head')[0].appendChild(tag);\n if (iefail) {\n document.styleSheets[document.styleSheets.length - 1].cssText = css;\n } else {\n tag[(typeof document.body.style.WebkitAppearance == 'string') /* webkit only */ ? 'innerText' : 'innerHTML'] = css;\n }\n };\n\n // Provide a cross-browser interface to a few simple drawing primitives\n $.fn.simpledraw = function (width, height, useExisting, interact) {\n var target, mhandler;\n if (useExisting && (target = this.data('_jqs_vcanvas'))) {\n return target;\n }\n\n if ($.fn.sparkline.canvas === false) {\n // We've already determined that neither Canvas nor VML are available\n return false;\n\n } else if ($.fn.sparkline.canvas === undefined) {\n // No function defined yet -- need to see if we support Canvas or VML\n var el = document.createElement('canvas');\n if (!!(el.getContext && el.getContext('2d'))) {\n // Canvas is available\n $.fn.sparkline.canvas = function(width, height, target, interact) {\n return new VCanvas_canvas(width, height, target, interact);\n };\n } else if (document.namespaces && !document.namespaces.v) {\n // VML is available\n document.namespaces.add('v', 'urn:schemas-microsoft-com:vml', '#default#VML');\n $.fn.sparkline.canvas = function(width, height, target, interact) {\n return new VCanvas_vml(width, height, target);\n };\n } else {\n // Neither Canvas nor VML are available\n $.fn.sparkline.canvas = false;\n return false;\n }\n }\n\n if (width === undefined) {\n width = $(this).innerWidth();\n }\n if (height === undefined) {\n height = $(this).innerHeight();\n }\n\n target = $.fn.sparkline.canvas(width, height, this, interact);\n\n mhandler = $(this).data('_jqs_mhandler');\n if (mhandler) {\n mhandler.registerCanvas(target);\n }\n return target;\n };\n\n $.fn.cleardraw = function () {\n var target = this.data('_jqs_vcanvas');\n if (target) {\n target.reset();\n }\n };\n\n $.RangeMapClass = RangeMap = createClass({\n init: function (map) {\n var key, range, rangelist = [];\n for (key in map) {\n if (map.hasOwnProperty(key) && typeof key === 'string' && key.indexOf(':') > -1) {\n range = key.split(':');\n range[0] = range[0].length === 0 ? -Infinity : parseFloat(range[0]);\n range[1] = range[1].length === 0 ? Infinity : parseFloat(range[1]);\n range[2] = map[key];\n rangelist.push(range);\n }\n }\n this.map = map;\n this.rangelist = rangelist || false;\n },\n\n get: function (value) {\n var rangelist = this.rangelist,\n i, range, result;\n if ((result = this.map[value]) !== undefined) {\n return result;\n }\n if (rangelist) {\n for (i = rangelist.length; i--;) {\n range = rangelist[i];\n if (range[0] <= value && range[1] >= value) {\n return range[2];\n }\n }\n }\n return undefined;\n }\n });\n\n // Convenience function\n $.range_map = function(map) {\n return new RangeMap(map);\n };\n\n MouseHandler = createClass({\n init: function (el, options) {\n var $el = $(el);\n this.$el = $el;\n this.options = options;\n this.currentPageX = 0;\n this.currentPageY = 0;\n this.el = el;\n this.splist = [];\n this.tooltip = null;\n this.over = false;\n this.displayTooltips = !options.get('disableTooltips');\n this.highlightEnabled = !options.get('disableHighlight');\n },\n\n registerSparkline: function (sp) {\n this.splist.push(sp);\n if (this.over) {\n this.updateDisplay();\n }\n },\n\n registerCanvas: function (canvas) {\n var $canvas = $(canvas.canvas);\n this.canvas = canvas;\n this.$canvas = $canvas;\n $canvas.mouseenter($.proxy(this.mouseenter, this));\n $canvas.mouseleave($.proxy(this.mouseleave, this));\n $canvas.click($.proxy(this.mouseclick, this));\n },\n\n reset: function (removeTooltip) {\n this.splist = [];\n if (this.tooltip && removeTooltip) {\n this.tooltip.remove();\n this.tooltip = undefined;\n }\n },\n\n mouseclick: function (e) {\n var clickEvent = $.Event('sparklineClick');\n clickEvent.originalEvent = e;\n clickEvent.sparklines = this.splist;\n this.$el.trigger(clickEvent);\n },\n\n mouseenter: function (e) {\n $(document.body).unbind('mousemove.jqs');\n $(document.body).bind('mousemove.jqs', $.proxy(this.mousemove, this));\n this.over = true;\n this.currentPageX = e.pageX;\n this.currentPageY = e.pageY;\n this.currentEl = e.target;\n if (!this.tooltip && this.displayTooltips) {\n this.tooltip = new Tooltip(this.options);\n this.tooltip.updatePosition(e.pageX, e.pageY);\n }\n this.updateDisplay();\n },\n\n mouseleave: function () {\n $(document.body).unbind('mousemove.jqs');\n var splist = this.splist,\n spcount = splist.length,\n needsRefresh = false,\n sp, i;\n this.over = false;\n this.currentEl = null;\n\n if (this.tooltip) {\n this.tooltip.remove();\n this.tooltip = null;\n }\n\n for (i = 0; i < spcount; i++) {\n sp = splist[i];\n if (sp.clearRegionHighlight()) {\n needsRefresh = true;\n }\n }\n\n if (needsRefresh) {\n this.canvas.render();\n }\n },\n\n mousemove: function (e) {\n this.currentPageX = e.pageX;\n this.currentPageY = e.pageY;\n this.currentEl = e.target;\n if (this.tooltip) {\n this.tooltip.updatePosition(e.pageX, e.pageY);\n }\n this.updateDisplay();\n },\n\n updateDisplay: function () {\n var splist = this.splist,\n spcount = splist.length,\n needsRefresh = false,\n offset = this.$canvas.offset(),\n localX = this.currentPageX - offset.left,\n localY = this.currentPageY - offset.top,\n tooltiphtml, sp, i, result, changeEvent;\n if (!this.over) {\n return;\n }\n for (i = 0; i < spcount; i++) {\n sp = splist[i];\n result = sp.setRegionHighlight(this.currentEl, localX, localY);\n if (result) {\n needsRefresh = true;\n }\n }\n if (needsRefresh) {\n changeEvent = $.Event('sparklineRegionChange');\n changeEvent.sparklines = this.splist;\n this.$el.trigger(changeEvent);\n if (this.tooltip) {\n tooltiphtml = '';\n for (i = 0; i < spcount; i++) {\n sp = splist[i];\n tooltiphtml += sp.getCurrentRegionTooltip();\n }\n this.tooltip.setContent(tooltiphtml);\n }\n if (!this.disableHighlight) {\n this.canvas.render();\n }\n }\n if (result === null) {\n this.mouseleave();\n }\n }\n });\n\n\n Tooltip = createClass({\n sizeStyle: 'position: static !important;' +\n 'display: block !important;' +\n 'visibility: hidden !important;' +\n 'float: left !important;',\n\n init: function (options) {\n var tooltipClassname = options.get('tooltipClassname', 'jqstooltip'),\n sizetipStyle = this.sizeStyle,\n offset;\n this.container = options.get('tooltipContainer') || document.body;\n this.tooltipOffsetX = options.get('tooltipOffsetX', 10);\n this.tooltipOffsetY = options.get('tooltipOffsetY', 12);\n // remove any previous lingering tooltip\n $('#jqssizetip').remove();\n $('#jqstooltip').remove();\n this.sizetip = $('
    ', {\n id: 'jqssizetip',\n style: sizetipStyle,\n 'class': tooltipClassname\n });\n this.tooltip = $('
    ', {\n id: 'jqstooltip',\n 'class': tooltipClassname\n }).appendTo(this.container);\n // account for the container's location\n offset = this.tooltip.offset();\n this.offsetLeft = offset.left;\n this.offsetTop = offset.top;\n this.hidden = true;\n $(window).unbind('resize.jqs scroll.jqs');\n $(window).bind('resize.jqs scroll.jqs', $.proxy(this.updateWindowDims, this));\n this.updateWindowDims();\n },\n\n updateWindowDims: function () {\n this.scrollTop = $(window).scrollTop();\n this.scrollLeft = $(window).scrollLeft();\n this.scrollRight = this.scrollLeft + $(window).width();\n this.updatePosition();\n },\n\n getSize: function (content) {\n this.sizetip.html(content).appendTo(this.container);\n this.width = this.sizetip.width() + 1;\n this.height = this.sizetip.height();\n this.sizetip.remove();\n },\n\n setContent: function (content) {\n if (!content) {\n this.tooltip.css('visibility', 'hidden');\n this.hidden = true;\n return;\n }\n this.getSize(content);\n this.tooltip.html(content)\n .css({\n 'width': this.width,\n 'height': this.height,\n 'visibility': 'visible'\n });\n if (this.hidden) {\n this.hidden = false;\n this.updatePosition();\n }\n },\n\n updatePosition: function (x, y) {\n if (x === undefined) {\n if (this.mousex === undefined) {\n return;\n }\n x = this.mousex - this.offsetLeft;\n y = this.mousey - this.offsetTop;\n\n } else {\n this.mousex = x = x - this.offsetLeft;\n this.mousey = y = y - this.offsetTop;\n }\n if (!this.height || !this.width || this.hidden) {\n return;\n }\n\n y -= this.height + this.tooltipOffsetY;\n x += this.tooltipOffsetX;\n\n if (y < this.scrollTop) {\n y = this.scrollTop;\n }\n if (x < this.scrollLeft) {\n x = this.scrollLeft;\n } else if (x + this.width > this.scrollRight) {\n x = this.scrollRight - this.width;\n }\n\n this.tooltip.css({\n 'left': x,\n 'top': y\n });\n },\n\n remove: function () {\n this.tooltip.remove();\n this.sizetip.remove();\n this.sizetip = this.tooltip = undefined;\n $(window).unbind('resize.jqs scroll.jqs');\n }\n });\n\n initStyles = function() {\n addCSS(defaultStyles);\n };\n\n $(initStyles);\n\n pending = [];\n $.fn.sparkline = function (userValues, userOptions) {\n return this.each(function () {\n var options = new $.fn.sparkline.options(this, userOptions),\n $this = $(this),\n render, i;\n render = function () {\n var values, width, height, tmp, mhandler, sp, vals;\n if (userValues === 'html' || userValues === undefined) {\n vals = this.getAttribute(options.get('tagValuesAttribute'));\n if (vals === undefined || vals === null) {\n vals = $this.html();\n }\n values = vals.replace(/(^\\s*\\s*$)|\\s+/g, '').split(',');\n } else {\n values = userValues;\n }\n\n width = options.get('width') === 'auto' ? values.length * options.get('defaultPixelsPerValue') : options.get('width');\n if (options.get('height') === 'auto') {\n if (!options.get('composite') || !$.data(this, '_jqs_vcanvas')) {\n // must be a better way to get the line height\n tmp = document.createElement('span');\n tmp.innerHTML = 'a';\n $this.html(tmp);\n height = $(tmp).innerHeight() || $(tmp).height();\n $(tmp).remove();\n tmp = null;\n }\n } else {\n height = options.get('height');\n }\n\n if (!options.get('disableInteraction')) {\n mhandler = $.data(this, '_jqs_mhandler');\n if (!mhandler) {\n mhandler = new MouseHandler(this, options);\n $.data(this, '_jqs_mhandler', mhandler);\n } else if (!options.get('composite')) {\n mhandler.reset();\n }\n } else {\n mhandler = false;\n }\n\n if (options.get('composite') && !$.data(this, '_jqs_vcanvas')) {\n if (!$.data(this, '_jqs_errnotify')) {\n alert('Attempted to attach a composite sparkline to an element with no existing sparkline');\n $.data(this, '_jqs_errnotify', true);\n }\n return;\n }\n\n sp = new $.fn.sparkline[options.get('type')](this, values, options, width, height);\n\n sp.render();\n\n if (mhandler) {\n mhandler.registerSparkline(sp);\n }\n };\n if (($(this).html() && !options.get('disableHiddenCheck') && $(this).is(':hidden')) || !$(this).parents('body').length) {\n if (!options.get('composite') && $.data(this, '_jqs_pending')) {\n // remove any existing references to the element\n for (i = pending.length; i; i--) {\n if (pending[i - 1][0] == this) {\n pending.splice(i - 1, 1);\n }\n }\n }\n pending.push([this, render]);\n $.data(this, '_jqs_pending', true);\n } else {\n render.call(this);\n }\n });\n };\n\n $.fn.sparkline.defaults = getDefaults();\n\n\n $.sparkline_display_visible = function () {\n var el, i, pl;\n var done = [];\n for (i = 0, pl = pending.length; i < pl; i++) {\n el = pending[i][0];\n if ($(el).is(':visible') && !$(el).parents().is(':hidden')) {\n pending[i][1].call(el);\n $.data(pending[i][0], '_jqs_pending', false);\n done.push(i);\n } else if (!$(el).closest('html').length && !$.data(el, '_jqs_pending')) {\n // element has been inserted and removed from the DOM\n // If it was not yet inserted into the dom then the .data request\n // will return true.\n // removing from the dom causes the data to be removed.\n $.data(pending[i][0], '_jqs_pending', false);\n done.push(i);\n }\n }\n for (i = done.length; i; i--) {\n pending.splice(done[i - 1], 1);\n }\n };\n\n\n /**\n * User option handler\n */\n $.fn.sparkline.options = createClass({\n init: function (tag, userOptions) {\n var extendedOptions, defaults, base, tagOptionType;\n this.userOptions = userOptions = userOptions || {};\n this.tag = tag;\n this.tagValCache = {};\n defaults = $.fn.sparkline.defaults;\n base = defaults.common;\n this.tagOptionsPrefix = userOptions.enableTagOptions && (userOptions.tagOptionsPrefix || base.tagOptionsPrefix);\n\n tagOptionType = this.getTagSetting('type');\n if (tagOptionType === UNSET_OPTION) {\n extendedOptions = defaults[userOptions.type || base.type];\n } else {\n extendedOptions = defaults[tagOptionType];\n }\n this.mergedOptions = $.extend({}, base, extendedOptions, userOptions);\n },\n\n\n getTagSetting: function (key) {\n var prefix = this.tagOptionsPrefix,\n val, i, pairs, keyval;\n if (prefix === false || prefix === undefined) {\n return UNSET_OPTION;\n }\n if (this.tagValCache.hasOwnProperty(key)) {\n val = this.tagValCache.key;\n } else {\n val = this.tag.getAttribute(prefix + key);\n if (val === undefined || val === null) {\n val = UNSET_OPTION;\n } else if (val.substr(0, 1) === '[') {\n val = val.substr(1, val.length - 2).split(',');\n for (i = val.length; i--;) {\n val[i] = normalizeValue(val[i].replace(/(^\\s*)|(\\s*$)/g, ''));\n }\n } else if (val.substr(0, 1) === '{') {\n pairs = val.substr(1, val.length - 2).split(',');\n val = {};\n for (i = pairs.length; i--;) {\n keyval = pairs[i].split(':', 2);\n val[keyval[0].replace(/(^\\s*)|(\\s*$)/g, '')] = normalizeValue(keyval[1].replace(/(^\\s*)|(\\s*$)/g, ''));\n }\n } else {\n val = normalizeValue(val);\n }\n this.tagValCache.key = val;\n }\n return val;\n },\n\n get: function (key, defaultval) {\n var tagOption = this.getTagSetting(key),\n result;\n if (tagOption !== UNSET_OPTION) {\n return tagOption;\n }\n return (result = this.mergedOptions[key]) === undefined ? defaultval : result;\n }\n });\n\n\n $.fn.sparkline._base = createClass({\n disabled: false,\n\n init: function (el, values, options, width, height) {\n this.el = el;\n this.$el = $(el);\n this.values = values;\n this.options = options;\n this.width = width;\n this.height = height;\n this.currentRegion = undefined;\n },\n\n /**\n * Setup the canvas\n */\n initTarget: function () {\n var interactive = !this.options.get('disableInteraction');\n if (!(this.target = this.$el.simpledraw(this.width, this.height, this.options.get('composite'), interactive))) {\n this.disabled = true;\n } else {\n this.canvasWidth = this.target.pixelWidth;\n this.canvasHeight = this.target.pixelHeight;\n }\n },\n\n /**\n * Actually render the chart to the canvas\n */\n render: function () {\n if (this.disabled) {\n this.el.innerHTML = '';\n return false;\n }\n return true;\n },\n\n /**\n * Return a region id for a given x/y co-ordinate\n */\n getRegion: function (x, y) {\n },\n\n /**\n * Highlight an item based on the moused-over x,y co-ordinate\n */\n setRegionHighlight: function (el, x, y) {\n var currentRegion = this.currentRegion,\n highlightEnabled = !this.options.get('disableHighlight'),\n newRegion;\n if (x > this.canvasWidth || y > this.canvasHeight || x < 0 || y < 0) {\n return null;\n }\n newRegion = this.getRegion(el, x, y);\n if (currentRegion !== newRegion) {\n if (currentRegion !== undefined && highlightEnabled) {\n this.removeHighlight();\n }\n this.currentRegion = newRegion;\n if (newRegion !== undefined && highlightEnabled) {\n this.renderHighlight();\n }\n return true;\n }\n return false;\n },\n\n /**\n * Reset any currently highlighted item\n */\n clearRegionHighlight: function () {\n if (this.currentRegion !== undefined) {\n this.removeHighlight();\n this.currentRegion = undefined;\n return true;\n }\n return false;\n },\n\n renderHighlight: function () {\n this.changeHighlight(true);\n },\n\n removeHighlight: function () {\n this.changeHighlight(false);\n },\n\n changeHighlight: function (highlight) {},\n\n /**\n * Fetch the HTML to display as a tooltip\n */\n getCurrentRegionTooltip: function () {\n var options = this.options,\n header = '',\n entries = [],\n fields, formats, formatlen, fclass, text, i,\n showFields, showFieldsKey, newFields, fv,\n formatter, format, fieldlen, j;\n if (this.currentRegion === undefined) {\n return '';\n }\n fields = this.getCurrentRegionFields();\n formatter = options.get('tooltipFormatter');\n if (formatter) {\n return formatter(this, options, fields);\n }\n if (options.get('tooltipChartTitle')) {\n header += '
    ' + options.get('tooltipChartTitle') + '
    \\n';\n }\n formats = this.options.get('tooltipFormat');\n if (!formats) {\n return '';\n }\n if (!$.isArray(formats)) {\n formats = [formats];\n }\n if (!$.isArray(fields)) {\n fields = [fields];\n }\n showFields = this.options.get('tooltipFormatFieldlist');\n showFieldsKey = this.options.get('tooltipFormatFieldlistKey');\n if (showFields && showFieldsKey) {\n // user-selected ordering of fields\n newFields = [];\n for (i = fields.length; i--;) {\n fv = fields[i][showFieldsKey];\n if ((j = $.inArray(fv, showFields)) != -1) {\n newFields[j] = fields[i];\n }\n }\n fields = newFields;\n }\n formatlen = formats.length;\n fieldlen = fields.length;\n for (i = 0; i < formatlen; i++) {\n format = formats[i];\n if (typeof format === 'string') {\n format = new SPFormat(format);\n }\n fclass = format.fclass || 'jqsfield';\n for (j = 0; j < fieldlen; j++) {\n if (!fields[j].isNull || !options.get('tooltipSkipNull')) {\n $.extend(fields[j], {\n prefix: options.get('tooltipPrefix'),\n suffix: options.get('tooltipSuffix')\n });\n text = format.render(fields[j], options.get('tooltipValueLookups'), options);\n entries.push('
    ' + text + '
    ');\n }\n }\n }\n if (entries.length) {\n return header + entries.join('\\n');\n }\n return '';\n },\n\n getCurrentRegionFields: function () {},\n\n calcHighlightColor: function (color, options) {\n var highlightColor = options.get('highlightColor'),\n lighten = options.get('highlightLighten'),\n parse, mult, rgbnew, i;\n if (highlightColor) {\n return highlightColor;\n }\n if (lighten) {\n // extract RGB values\n parse = /^#([0-9a-f])([0-9a-f])([0-9a-f])$/i.exec(color) || /^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(color);\n if (parse) {\n rgbnew = [];\n mult = color.length === 4 ? 16 : 1;\n for (i = 0; i < 3; i++) {\n rgbnew[i] = clipval(Math.round(parseInt(parse[i + 1], 16) * mult * lighten), 0, 255);\n }\n return 'rgb(' + rgbnew.join(',') + ')';\n }\n\n }\n return color;\n }\n\n });\n\n barHighlightMixin = {\n changeHighlight: function (highlight) {\n var currentRegion = this.currentRegion,\n target = this.target,\n shapeids = this.regionShapes[currentRegion],\n newShapes;\n // will be null if the region value was null\n if (shapeids) {\n newShapes = this.renderRegion(currentRegion, highlight);\n if ($.isArray(newShapes) || $.isArray(shapeids)) {\n target.replaceWithShapes(shapeids, newShapes);\n this.regionShapes[currentRegion] = $.map(newShapes, function (newShape) {\n return newShape.id;\n });\n } else {\n target.replaceWithShape(shapeids, newShapes);\n this.regionShapes[currentRegion] = newShapes.id;\n }\n }\n },\n\n render: function () {\n var values = this.values,\n target = this.target,\n regionShapes = this.regionShapes,\n shapes, ids, i, j;\n\n if (!this.cls._super.render.call(this)) {\n return;\n }\n for (i = values.length; i--;) {\n shapes = this.renderRegion(i);\n if (shapes) {\n if ($.isArray(shapes)) {\n ids = [];\n for (j = shapes.length; j--;) {\n shapes[j].append();\n ids.push(shapes[j].id);\n }\n regionShapes[i] = ids;\n } else {\n shapes.append();\n regionShapes[i] = shapes.id; // store just the shapeid\n }\n } else {\n // null value\n regionShapes[i] = null;\n }\n }\n target.render();\n }\n };\n\n /**\n * Line charts\n */\n $.fn.sparkline.line = line = createClass($.fn.sparkline._base, {\n type: 'line',\n\n init: function (el, values, options, width, height) {\n line._super.init.call(this, el, values, options, width, height);\n this.vertices = [];\n this.regionMap = [];\n this.xvalues = [];\n this.yvalues = [];\n this.yminmax = [];\n this.hightlightSpotId = null;\n this.lastShapeId = null;\n this.initTarget();\n },\n\n getRegion: function (el, x, y) {\n var i,\n regionMap = this.regionMap; // maps regions to value positions\n for (i = regionMap.length; i--;) {\n if (regionMap[i] !== null && x >= regionMap[i][0] && x <= regionMap[i][1]) {\n return regionMap[i][2];\n }\n }\n return undefined;\n },\n\n getCurrentRegionFields: function () {\n var currentRegion = this.currentRegion;\n return {\n isNull: this.yvalues[currentRegion] === null,\n x: this.xvalues[currentRegion],\n y: this.yvalues[currentRegion],\n color: this.options.get('lineColor'),\n fillColor: this.options.get('fillColor'),\n offset: currentRegion\n };\n },\n\n renderHighlight: function () {\n var currentRegion = this.currentRegion,\n target = this.target,\n vertex = this.vertices[currentRegion],\n options = this.options,\n spotRadius = options.get('spotRadius'),\n highlightSpotColor = options.get('highlightSpotColor'),\n highlightLineColor = options.get('highlightLineColor'),\n highlightSpot, highlightLine;\n\n if (!vertex) {\n return;\n }\n if (spotRadius && highlightSpotColor) {\n highlightSpot = target.drawCircle(vertex[0], vertex[1],\n spotRadius, undefined, highlightSpotColor);\n this.highlightSpotId = highlightSpot.id;\n target.insertAfterShape(this.lastShapeId, highlightSpot);\n }\n if (highlightLineColor) {\n highlightLine = target.drawLine(vertex[0], this.canvasTop, vertex[0],\n this.canvasTop + this.canvasHeight, highlightLineColor);\n this.highlightLineId = highlightLine.id;\n target.insertAfterShape(this.lastShapeId, highlightLine);\n }\n },\n\n removeHighlight: function () {\n var target = this.target;\n if (this.highlightSpotId) {\n target.removeShapeId(this.highlightSpotId);\n this.highlightSpotId = null;\n }\n if (this.highlightLineId) {\n target.removeShapeId(this.highlightLineId);\n this.highlightLineId = null;\n }\n },\n\n scanValues: function () {\n var values = this.values,\n valcount = values.length,\n xvalues = this.xvalues,\n yvalues = this.yvalues,\n yminmax = this.yminmax,\n i, val, isStr, isArray, sp;\n for (i = 0; i < valcount; i++) {\n val = values[i];\n isStr = typeof(values[i]) === 'string';\n isArray = typeof(values[i]) === 'object' && values[i] instanceof Array;\n sp = isStr && values[i].split(':');\n if (isStr && sp.length === 2) { // x:y\n xvalues.push(Number(sp[0]));\n yvalues.push(Number(sp[1]));\n yminmax.push(Number(sp[1]));\n } else if (isArray) {\n xvalues.push(val[0]);\n yvalues.push(val[1]);\n yminmax.push(val[1]);\n } else {\n xvalues.push(i);\n if (values[i] === null || values[i] === 'null') {\n yvalues.push(null);\n } else {\n yvalues.push(Number(val));\n yminmax.push(Number(val));\n }\n }\n }\n if (this.options.get('xvalues')) {\n xvalues = this.options.get('xvalues');\n }\n\n this.maxy = this.maxyorg = Math.max.apply(Math, yminmax);\n this.miny = this.minyorg = Math.min.apply(Math, yminmax);\n\n this.maxx = Math.max.apply(Math, xvalues);\n this.minx = Math.min.apply(Math, xvalues);\n\n this.xvalues = xvalues;\n this.yvalues = yvalues;\n this.yminmax = yminmax;\n\n },\n\n processRangeOptions: function () {\n var options = this.options,\n normalRangeMin = options.get('normalRangeMin'),\n normalRangeMax = options.get('normalRangeMax');\n\n if (normalRangeMin !== undefined) {\n if (normalRangeMin < this.miny) {\n this.miny = normalRangeMin;\n }\n if (normalRangeMax > this.maxy) {\n this.maxy = normalRangeMax;\n }\n }\n if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < this.miny)) {\n this.miny = options.get('chartRangeMin');\n }\n if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > this.maxy)) {\n this.maxy = options.get('chartRangeMax');\n }\n if (options.get('chartRangeMinX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMinX') < this.minx)) {\n this.minx = options.get('chartRangeMinX');\n }\n if (options.get('chartRangeMaxX') !== undefined && (options.get('chartRangeClipX') || options.get('chartRangeMaxX') > this.maxx)) {\n this.maxx = options.get('chartRangeMaxX');\n }\n\n },\n\n drawNormalRange: function (canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey) {\n var normalRangeMin = this.options.get('normalRangeMin'),\n normalRangeMax = this.options.get('normalRangeMax'),\n ytop = canvasTop + Math.round(canvasHeight - (canvasHeight * ((normalRangeMax - this.miny) / rangey))),\n height = Math.round((canvasHeight * (normalRangeMax - normalRangeMin)) / rangey);\n this.target.drawRect(canvasLeft, ytop, canvasWidth, height, undefined, this.options.get('normalRangeColor')).append();\n },\n\n render: function () {\n var options = this.options,\n target = this.target,\n canvasWidth = this.canvasWidth,\n canvasHeight = this.canvasHeight,\n vertices = this.vertices,\n spotRadius = options.get('spotRadius'),\n regionMap = this.regionMap,\n rangex, rangey, yvallast,\n canvasTop, canvasLeft,\n vertex, path, paths, x, y, xnext, xpos, xposnext,\n last, next, yvalcount, lineShapes, fillShapes, plen,\n valueSpots, hlSpotsEnabled, color, xvalues, yvalues, i;\n\n if (!line._super.render.call(this)) {\n return;\n }\n\n this.scanValues();\n this.processRangeOptions();\n\n xvalues = this.xvalues;\n yvalues = this.yvalues;\n\n if (!this.yminmax.length || this.yvalues.length < 2) {\n // empty or all null valuess\n return;\n }\n\n canvasTop = canvasLeft = 0;\n\n rangex = this.maxx - this.minx === 0 ? 1 : this.maxx - this.minx;\n rangey = this.maxy - this.miny === 0 ? 1 : this.maxy - this.miny;\n yvallast = this.yvalues.length - 1;\n\n if (spotRadius && (canvasWidth < (spotRadius * 4) || canvasHeight < (spotRadius * 4))) {\n spotRadius = 0;\n }\n if (spotRadius) {\n // adjust the canvas size as required so that spots will fit\n hlSpotsEnabled = options.get('highlightSpotColor') && !options.get('disableInteraction');\n if (hlSpotsEnabled || options.get('minSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.miny)) {\n canvasHeight -= Math.ceil(spotRadius);\n }\n if (hlSpotsEnabled || options.get('maxSpotColor') || (options.get('spotColor') && yvalues[yvallast] === this.maxy)) {\n canvasHeight -= Math.ceil(spotRadius);\n canvasTop += Math.ceil(spotRadius);\n }\n if (hlSpotsEnabled ||\n ((options.get('minSpotColor') || options.get('maxSpotColor')) && (yvalues[0] === this.miny || yvalues[0] === this.maxy))) {\n canvasLeft += Math.ceil(spotRadius);\n canvasWidth -= Math.ceil(spotRadius);\n }\n if (hlSpotsEnabled || options.get('spotColor') ||\n (options.get('minSpotColor') || options.get('maxSpotColor') &&\n (yvalues[yvallast] === this.miny || yvalues[yvallast] === this.maxy))) {\n canvasWidth -= Math.ceil(spotRadius);\n }\n }\n\n\n canvasHeight--;\n\n if (options.get('normalRangeMin') !== undefined && !options.get('drawNormalOnTop')) {\n this.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey);\n }\n\n path = [];\n paths = [path];\n last = next = null;\n yvalcount = yvalues.length;\n for (i = 0; i < yvalcount; i++) {\n x = xvalues[i];\n xnext = xvalues[i + 1];\n y = yvalues[i];\n xpos = canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex));\n xposnext = i < yvalcount - 1 ? canvasLeft + Math.round((xnext - this.minx) * (canvasWidth / rangex)) : canvasWidth;\n next = xpos + ((xposnext - xpos) / 2);\n regionMap[i] = [last || 0, next, i];\n last = next;\n if (y === null) {\n if (i) {\n if (yvalues[i - 1] !== null) {\n path = [];\n paths.push(path);\n }\n vertices.push(null);\n }\n } else {\n if (y < this.miny) {\n y = this.miny;\n }\n if (y > this.maxy) {\n y = this.maxy;\n }\n if (!path.length) {\n // previous value was null\n path.push([xpos, canvasTop + canvasHeight]);\n }\n vertex = [xpos, canvasTop + Math.round(canvasHeight - (canvasHeight * ((y - this.miny) / rangey)))];\n path.push(vertex);\n vertices.push(vertex);\n }\n }\n\n lineShapes = [];\n fillShapes = [];\n plen = paths.length;\n for (i = 0; i < plen; i++) {\n path = paths[i];\n if (path.length) {\n if (options.get('fillColor')) {\n path.push([path[path.length - 1][0], (canvasTop + canvasHeight)]);\n fillShapes.push(path.slice(0));\n path.pop();\n }\n // if there's only a single point in this path, then we want to display it\n // as a vertical line which means we keep path[0] as is\n if (path.length > 2) {\n // else we want the first value\n path[0] = [path[0][0], path[1][1]];\n }\n lineShapes.push(path);\n }\n }\n\n // draw the fill first, then optionally the normal range, then the line on top of that\n plen = fillShapes.length;\n for (i = 0; i < plen; i++) {\n target.drawShape(fillShapes[i],\n options.get('fillColor'), options.get('fillColor')).append();\n }\n\n if (options.get('normalRangeMin') !== undefined && options.get('drawNormalOnTop')) {\n this.drawNormalRange(canvasLeft, canvasTop, canvasHeight, canvasWidth, rangey);\n }\n\n plen = lineShapes.length;\n for (i = 0; i < plen; i++) {\n target.drawShape(lineShapes[i], options.get('lineColor'), undefined,\n options.get('lineWidth')).append();\n }\n\n if (spotRadius && options.get('valueSpots')) {\n valueSpots = options.get('valueSpots');\n if (valueSpots.get === undefined) {\n valueSpots = new RangeMap(valueSpots);\n }\n for (i = 0; i < yvalcount; i++) {\n color = valueSpots.get(yvalues[i]);\n if (color) {\n target.drawCircle(canvasLeft + Math.round((xvalues[i] - this.minx) * (canvasWidth / rangex)),\n canvasTop + Math.round(canvasHeight - (canvasHeight * ((yvalues[i] - this.miny) / rangey))),\n spotRadius, undefined,\n color).append();\n }\n }\n\n }\n if (spotRadius && options.get('spotColor') && yvalues[yvallast] !== null) {\n target.drawCircle(canvasLeft + Math.round((xvalues[xvalues.length - 1] - this.minx) * (canvasWidth / rangex)),\n canvasTop + Math.round(canvasHeight - (canvasHeight * ((yvalues[yvallast] - this.miny) / rangey))),\n spotRadius, undefined,\n options.get('spotColor')).append();\n }\n if (this.maxy !== this.minyorg) {\n if (spotRadius && options.get('minSpotColor')) {\n x = xvalues[$.inArray(this.minyorg, yvalues)];\n target.drawCircle(canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex)),\n canvasTop + Math.round(canvasHeight - (canvasHeight * ((this.minyorg - this.miny) / rangey))),\n spotRadius, undefined,\n options.get('minSpotColor')).append();\n }\n if (spotRadius && options.get('maxSpotColor')) {\n x = xvalues[$.inArray(this.maxyorg, yvalues)];\n target.drawCircle(canvasLeft + Math.round((x - this.minx) * (canvasWidth / rangex)),\n canvasTop + Math.round(canvasHeight - (canvasHeight * ((this.maxyorg - this.miny) / rangey))),\n spotRadius, undefined,\n options.get('maxSpotColor')).append();\n }\n }\n\n this.lastShapeId = target.getLastShapeId();\n this.canvasTop = canvasTop;\n target.render();\n }\n });\n\n /**\n * Bar charts\n */\n $.fn.sparkline.bar = bar = createClass($.fn.sparkline._base, barHighlightMixin, {\n type: 'bar',\n\n init: function (el, values, options, width, height) {\n var barWidth = parseInt(options.get('barWidth'), 10),\n barSpacing = parseInt(options.get('barSpacing'), 10),\n chartRangeMin = options.get('chartRangeMin'),\n chartRangeMax = options.get('chartRangeMax'),\n chartRangeClip = options.get('chartRangeClip'),\n stackMin = Infinity,\n stackMax = -Infinity,\n isStackString, groupMin, groupMax, stackRanges,\n numValues, i, vlen, range, zeroAxis, xaxisOffset, min, max, clipMin, clipMax,\n stacked, vlist, j, slen, svals, val, yoffset, yMaxCalc, canvasHeightEf;\n bar._super.init.call(this, el, values, options, width, height);\n\n // scan values to determine whether to stack bars\n for (i = 0, vlen = values.length; i < vlen; i++) {\n val = values[i];\n isStackString = typeof(val) === 'string' && val.indexOf(':') > -1;\n if (isStackString || $.isArray(val)) {\n stacked = true;\n if (isStackString) {\n val = values[i] = normalizeValues(val.split(':'));\n }\n val = remove(val, null); // min/max will treat null as zero\n groupMin = Math.min.apply(Math, val);\n groupMax = Math.max.apply(Math, val);\n if (groupMin < stackMin) {\n stackMin = groupMin;\n }\n if (groupMax > stackMax) {\n stackMax = groupMax;\n }\n }\n }\n\n this.stacked = stacked;\n this.regionShapes = {};\n this.barWidth = barWidth;\n this.barSpacing = barSpacing;\n this.totalBarWidth = barWidth + barSpacing;\n this.width = width = (values.length * barWidth) + ((values.length - 1) * barSpacing);\n\n this.initTarget();\n\n if (chartRangeClip) {\n clipMin = chartRangeMin === undefined ? -Infinity : chartRangeMin;\n clipMax = chartRangeMax === undefined ? Infinity : chartRangeMax;\n }\n\n numValues = [];\n stackRanges = stacked ? [] : numValues;\n var stackTotals = [];\n var stackRangesNeg = [];\n for (i = 0, vlen = values.length; i < vlen; i++) {\n if (stacked) {\n vlist = values[i];\n values[i] = svals = [];\n stackTotals[i] = 0;\n stackRanges[i] = stackRangesNeg[i] = 0;\n for (j = 0, slen = vlist.length; j < slen; j++) {\n val = svals[j] = chartRangeClip ? clipval(vlist[j], clipMin, clipMax) : vlist[j];\n if (val !== null) {\n if (val > 0) {\n stackTotals[i] += val;\n }\n if (stackMin < 0 && stackMax > 0) {\n if (val < 0) {\n stackRangesNeg[i] += Math.abs(val);\n } else {\n stackRanges[i] += val;\n }\n } else {\n stackRanges[i] += Math.abs(val - (val < 0 ? stackMax : stackMin));\n }\n numValues.push(val);\n }\n }\n } else {\n val = chartRangeClip ? clipval(values[i], clipMin, clipMax) : values[i];\n val = values[i] = normalizeValue(val);\n if (val !== null) {\n numValues.push(val);\n }\n }\n }\n this.max = max = Math.max.apply(Math, numValues);\n this.min = min = Math.min.apply(Math, numValues);\n this.stackMax = stackMax = stacked ? Math.max.apply(Math, stackTotals) : max;\n this.stackMin = stackMin = stacked ? Math.min.apply(Math, numValues) : min;\n\n if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < min)) {\n min = options.get('chartRangeMin');\n }\n if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > max)) {\n max = options.get('chartRangeMax');\n }\n\n this.zeroAxis = zeroAxis = options.get('zeroAxis', true);\n if (min <= 0 && max >= 0 && zeroAxis) {\n xaxisOffset = 0;\n } else if (zeroAxis == false) {\n xaxisOffset = min;\n } else if (min > 0) {\n xaxisOffset = min;\n } else {\n xaxisOffset = max;\n }\n this.xaxisOffset = xaxisOffset;\n\n range = stacked ? (Math.max.apply(Math, stackRanges) + Math.max.apply(Math, stackRangesNeg)) : max - min;\n\n // as we plot zero/min values a single pixel line, we add a pixel to all other\n // values - Reduce the effective canvas size to suit\n this.canvasHeightEf = (zeroAxis && min < 0) ? this.canvasHeight - 2 : this.canvasHeight - 1;\n\n if (min < xaxisOffset) {\n yMaxCalc = (stacked && max >= 0) ? stackMax : max;\n yoffset = (yMaxCalc - xaxisOffset) / range * this.canvasHeight;\n if (yoffset !== Math.ceil(yoffset)) {\n this.canvasHeightEf -= 2;\n yoffset = Math.ceil(yoffset);\n }\n } else {\n yoffset = this.canvasHeight;\n }\n this.yoffset = yoffset;\n\n if ($.isArray(options.get('colorMap'))) {\n this.colorMapByIndex = options.get('colorMap');\n this.colorMapByValue = null;\n } else {\n this.colorMapByIndex = null;\n this.colorMapByValue = options.get('colorMap');\n if (this.colorMapByValue && this.colorMapByValue.get === undefined) {\n this.colorMapByValue = new RangeMap(this.colorMapByValue);\n }\n }\n\n this.range = range;\n },\n\n getRegion: function (el, x, y) {\n var result = Math.floor(x / this.totalBarWidth);\n return (result < 0 || result >= this.values.length) ? undefined : result;\n },\n\n getCurrentRegionFields: function () {\n var currentRegion = this.currentRegion,\n values = ensureArray(this.values[currentRegion]),\n result = [],\n value, i;\n for (i = values.length; i--;) {\n value = values[i];\n result.push({\n isNull: value === null,\n value: value,\n color: this.calcColor(i, value, currentRegion),\n offset: currentRegion\n });\n }\n return result;\n },\n\n calcColor: function (stacknum, value, valuenum) {\n var colorMapByIndex = this.colorMapByIndex,\n colorMapByValue = this.colorMapByValue,\n options = this.options,\n color, newColor;\n if (this.stacked) {\n color = options.get('stackedBarColor');\n } else {\n color = (value < 0) ? options.get('negBarColor') : options.get('barColor');\n }\n if (value === 0 && options.get('zeroColor') !== undefined) {\n color = options.get('zeroColor');\n }\n if (colorMapByValue && (newColor = colorMapByValue.get(value))) {\n color = newColor;\n } else if (colorMapByIndex && colorMapByIndex.length > valuenum) {\n color = colorMapByIndex[valuenum];\n }\n return $.isArray(color) ? color[stacknum % color.length] : color;\n },\n\n /**\n * Render bar(s) for a region\n */\n renderRegion: function (valuenum, highlight) {\n var vals = this.values[valuenum],\n options = this.options,\n xaxisOffset = this.xaxisOffset,\n result = [],\n range = this.range,\n stacked = this.stacked,\n target = this.target,\n x = valuenum * this.totalBarWidth,\n canvasHeightEf = this.canvasHeightEf,\n yoffset = this.yoffset,\n y, height, color, isNull, yoffsetNeg, i, valcount, val, minPlotted, allMin;\n\n vals = $.isArray(vals) ? vals : [vals];\n valcount = vals.length;\n val = vals[0];\n isNull = all(null, vals);\n allMin = all(xaxisOffset, vals, true);\n\n if (isNull) {\n if (options.get('nullColor')) {\n color = highlight ? options.get('nullColor') : this.calcHighlightColor(options.get('nullColor'), options);\n y = (yoffset > 0) ? yoffset - 1 : yoffset;\n return target.drawRect(x, y, this.barWidth - 1, 0, color, color);\n } else {\n return undefined;\n }\n }\n yoffsetNeg = yoffset;\n for (i = 0; i < valcount; i++) {\n val = vals[i];\n\n if (stacked && val === xaxisOffset) {\n if (!allMin || minPlotted) {\n continue;\n }\n minPlotted = true;\n }\n\n if (range > 0) {\n height = Math.floor(canvasHeightEf * ((Math.abs(val - xaxisOffset) / range))) + 1;\n } else {\n height = 1;\n }\n if (val < xaxisOffset || (val === xaxisOffset && yoffset === 0)) {\n y = yoffsetNeg;\n yoffsetNeg += height;\n } else {\n y = yoffset - height;\n yoffset -= height;\n }\n color = this.calcColor(i, val, valuenum);\n if (highlight) {\n color = this.calcHighlightColor(color, options);\n }\n result.push(target.drawRect(x, y, this.barWidth - 1, height - 1, color, color));\n }\n if (result.length === 1) {\n return result[0];\n }\n return result;\n }\n });\n\n /**\n * Tristate charts\n */\n $.fn.sparkline.tristate = tristate = createClass($.fn.sparkline._base, barHighlightMixin, {\n type: 'tristate',\n\n init: function (el, values, options, width, height) {\n var barWidth = parseInt(options.get('barWidth'), 10),\n barSpacing = parseInt(options.get('barSpacing'), 10);\n tristate._super.init.call(this, el, values, options, width, height);\n\n this.regionShapes = {};\n this.barWidth = barWidth;\n this.barSpacing = barSpacing;\n this.totalBarWidth = barWidth + barSpacing;\n this.values = $.map(values, Number);\n this.width = width = (values.length * barWidth) + ((values.length - 1) * barSpacing);\n\n if ($.isArray(options.get('colorMap'))) {\n this.colorMapByIndex = options.get('colorMap');\n this.colorMapByValue = null;\n } else {\n this.colorMapByIndex = null;\n this.colorMapByValue = options.get('colorMap');\n if (this.colorMapByValue && this.colorMapByValue.get === undefined) {\n this.colorMapByValue = new RangeMap(this.colorMapByValue);\n }\n }\n this.initTarget();\n },\n\n getRegion: function (el, x, y) {\n return Math.floor(x / this.totalBarWidth);\n },\n\n getCurrentRegionFields: function () {\n var currentRegion = this.currentRegion;\n return {\n isNull: this.values[currentRegion] === undefined,\n value: this.values[currentRegion],\n color: this.calcColor(this.values[currentRegion], currentRegion),\n offset: currentRegion\n };\n },\n\n calcColor: function (value, valuenum) {\n var values = this.values,\n options = this.options,\n colorMapByIndex = this.colorMapByIndex,\n colorMapByValue = this.colorMapByValue,\n color, newColor;\n\n if (colorMapByValue && (newColor = colorMapByValue.get(value))) {\n color = newColor;\n } else if (colorMapByIndex && colorMapByIndex.length > valuenum) {\n color = colorMapByIndex[valuenum];\n } else if (values[valuenum] < 0) {\n color = options.get('negBarColor');\n } else if (values[valuenum] > 0) {\n color = options.get('posBarColor');\n } else {\n color = options.get('zeroBarColor');\n }\n return color;\n },\n\n renderRegion: function (valuenum, highlight) {\n var values = this.values,\n options = this.options,\n target = this.target,\n canvasHeight, height, halfHeight,\n x, y, color;\n\n canvasHeight = target.pixelHeight;\n halfHeight = Math.round(canvasHeight / 2);\n\n x = valuenum * this.totalBarWidth;\n if (values[valuenum] < 0) {\n y = halfHeight;\n height = halfHeight - 1;\n } else if (values[valuenum] > 0) {\n y = 0;\n height = halfHeight - 1;\n } else {\n y = halfHeight - 1;\n height = 2;\n }\n color = this.calcColor(values[valuenum], valuenum);\n if (color === null) {\n return;\n }\n if (highlight) {\n color = this.calcHighlightColor(color, options);\n }\n return target.drawRect(x, y, this.barWidth - 1, height - 1, color, color);\n }\n });\n\n /**\n * Discrete charts\n */\n $.fn.sparkline.discrete = discrete = createClass($.fn.sparkline._base, barHighlightMixin, {\n type: 'discrete',\n\n init: function (el, values, options, width, height) {\n discrete._super.init.call(this, el, values, options, width, height);\n\n this.regionShapes = {};\n this.values = values = $.map(values, Number);\n this.min = Math.min.apply(Math, values);\n this.max = Math.max.apply(Math, values);\n this.range = this.max - this.min;\n this.width = width = options.get('width') === 'auto' ? values.length * 2 : this.width;\n this.interval = Math.floor(width / values.length);\n this.itemWidth = width / values.length;\n if (options.get('chartRangeMin') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMin') < this.min)) {\n this.min = options.get('chartRangeMin');\n }\n if (options.get('chartRangeMax') !== undefined && (options.get('chartRangeClip') || options.get('chartRangeMax') > this.max)) {\n this.max = options.get('chartRangeMax');\n }\n this.initTarget();\n if (this.target) {\n this.lineHeight = options.get('lineHeight') === 'auto' ? Math.round(this.canvasHeight * 0.3) : options.get('lineHeight');\n }\n },\n\n getRegion: function (el, x, y) {\n return Math.floor(x / this.itemWidth);\n },\n\n getCurrentRegionFields: function () {\n var currentRegion = this.currentRegion;\n return {\n isNull: this.values[currentRegion] === undefined,\n value: this.values[currentRegion],\n offset: currentRegion\n };\n },\n\n renderRegion: function (valuenum, highlight) {\n var values = this.values,\n options = this.options,\n min = this.min,\n max = this.max,\n range = this.range,\n interval = this.interval,\n target = this.target,\n canvasHeight = this.canvasHeight,\n lineHeight = this.lineHeight,\n pheight = canvasHeight - lineHeight,\n ytop, val, color, x;\n\n val = clipval(values[valuenum], min, max);\n x = valuenum * interval;\n ytop = Math.round(pheight - pheight * ((val - min) / range));\n color = (options.get('thresholdColor') && val < options.get('thresholdValue')) ? options.get('thresholdColor') : options.get('lineColor');\n if (highlight) {\n color = this.calcHighlightColor(color, options);\n }\n return target.drawLine(x, ytop, x, ytop + lineHeight, color);\n }\n });\n\n /**\n * Bullet charts\n */\n $.fn.sparkline.bullet = bullet = createClass($.fn.sparkline._base, {\n type: 'bullet',\n\n init: function (el, values, options, width, height) {\n var min, max, vals;\n bullet._super.init.call(this, el, values, options, width, height);\n\n // values: target, performance, range1, range2, range3\n this.values = values = normalizeValues(values);\n // target or performance could be null\n vals = values.slice();\n vals[0] = vals[0] === null ? vals[2] : vals[0];\n vals[1] = values[1] === null ? vals[2] : vals[1];\n min = Math.min.apply(Math, values);\n max = Math.max.apply(Math, values);\n if (options.get('base') === undefined) {\n min = min < 0 ? min : 0;\n } else {\n min = options.get('base');\n }\n this.min = min;\n this.max = max;\n this.range = max - min;\n this.shapes = {};\n this.valueShapes = {};\n this.regiondata = {};\n this.width = width = options.get('width') === 'auto' ? '4.0em' : width;\n this.target = this.$el.simpledraw(width, height, options.get('composite'));\n if (!values.length) {\n this.disabled = true;\n }\n this.initTarget();\n },\n\n getRegion: function (el, x, y) {\n var shapeid = this.target.getShapeAt(el, x, y);\n return (shapeid !== undefined && this.shapes[shapeid] !== undefined) ? this.shapes[shapeid] : undefined;\n },\n\n getCurrentRegionFields: function () {\n var currentRegion = this.currentRegion;\n return {\n fieldkey: currentRegion.substr(0, 1),\n value: this.values[currentRegion.substr(1)],\n region: currentRegion\n };\n },\n\n changeHighlight: function (highlight) {\n var currentRegion = this.currentRegion,\n shapeid = this.valueShapes[currentRegion],\n shape;\n delete this.shapes[shapeid];\n switch (currentRegion.substr(0, 1)) {\n case 'r':\n shape = this.renderRange(currentRegion.substr(1), highlight);\n break;\n case 'p':\n shape = this.renderPerformance(highlight);\n break;\n case 't':\n shape = this.renderTarget(highlight);\n break;\n }\n this.valueShapes[currentRegion] = shape.id;\n this.shapes[shape.id] = currentRegion;\n this.target.replaceWithShape(shapeid, shape);\n },\n\n renderRange: function (rn, highlight) {\n var rangeval = this.values[rn],\n rangewidth = Math.round(this.canvasWidth * ((rangeval - this.min) / this.range)),\n color = this.options.get('rangeColors')[rn - 2];\n if (highlight) {\n color = this.calcHighlightColor(color, this.options);\n }\n return this.target.drawRect(0, 0, rangewidth - 1, this.canvasHeight - 1, color, color);\n },\n\n renderPerformance: function (highlight) {\n var perfval = this.values[1],\n perfwidth = Math.round(this.canvasWidth * ((perfval - this.min) / this.range)),\n color = this.options.get('performanceColor');\n if (highlight) {\n color = this.calcHighlightColor(color, this.options);\n }\n return this.target.drawRect(0, Math.round(this.canvasHeight * 0.3), perfwidth - 1,\n Math.round(this.canvasHeight * 0.4) - 1, color, color);\n },\n\n renderTarget: function (highlight) {\n var targetval = this.values[0],\n x = Math.round(this.canvasWidth * ((targetval - this.min) / this.range) - (this.options.get('targetWidth') / 2)),\n targettop = Math.round(this.canvasHeight * 0.10),\n targetheight = this.canvasHeight - (targettop * 2),\n color = this.options.get('targetColor');\n if (highlight) {\n color = this.calcHighlightColor(color, this.options);\n }\n return this.target.drawRect(x, targettop, this.options.get('targetWidth') - 1, targetheight - 1, color, color);\n },\n\n render: function () {\n var vlen = this.values.length,\n target = this.target,\n i, shape;\n if (!bullet._super.render.call(this)) {\n return;\n }\n for (i = 2; i < vlen; i++) {\n shape = this.renderRange(i).append();\n this.shapes[shape.id] = 'r' + i;\n this.valueShapes['r' + i] = shape.id;\n }\n if (this.values[1] !== null) {\n shape = this.renderPerformance().append();\n this.shapes[shape.id] = 'p1';\n this.valueShapes.p1 = shape.id;\n }\n if (this.values[0] !== null) {\n shape = this.renderTarget().append();\n this.shapes[shape.id] = 't0';\n this.valueShapes.t0 = shape.id;\n }\n target.render();\n }\n });\n\n /**\n * Pie charts\n */\n $.fn.sparkline.pie = pie = createClass($.fn.sparkline._base, {\n type: 'pie',\n\n init: function (el, values, options, width, height) {\n var total = 0, i;\n\n pie._super.init.call(this, el, values, options, width, height);\n\n this.shapes = {}; // map shape ids to value offsets\n this.valueShapes = {}; // maps value offsets to shape ids\n this.values = values = $.map(values, Number);\n\n if (options.get('width') === 'auto') {\n this.width = this.height;\n }\n\n if (values.length > 0) {\n for (i = values.length; i--;) {\n total += values[i];\n }\n }\n this.total = total;\n this.initTarget();\n this.radius = Math.floor(Math.min(this.canvasWidth, this.canvasHeight) / 2);\n },\n\n getRegion: function (el, x, y) {\n var shapeid = this.target.getShapeAt(el, x, y);\n return (shapeid !== undefined && this.shapes[shapeid] !== undefined) ? this.shapes[shapeid] : undefined;\n },\n\n getCurrentRegionFields: function () {\n var currentRegion = this.currentRegion;\n return {\n isNull: this.values[currentRegion] === undefined,\n value: this.values[currentRegion],\n percent: this.values[currentRegion] / this.total * 100,\n color: this.options.get('sliceColors')[currentRegion % this.options.get('sliceColors').length],\n offset: currentRegion\n };\n },\n\n changeHighlight: function (highlight) {\n var currentRegion = this.currentRegion,\n newslice = this.renderSlice(currentRegion, highlight),\n shapeid = this.valueShapes[currentRegion];\n delete this.shapes[shapeid];\n this.target.replaceWithShape(shapeid, newslice);\n this.valueShapes[currentRegion] = newslice.id;\n this.shapes[newslice.id] = currentRegion;\n },\n\n renderSlice: function (valuenum, highlight) {\n var target = this.target,\n options = this.options,\n radius = this.radius,\n borderWidth = options.get('borderWidth'),\n offset = options.get('offset'),\n circle = 2 * Math.PI,\n values = this.values,\n total = this.total,\n next = offset ? (2*Math.PI)*(offset/360) : 0,\n start, end, i, vlen, color;\n\n vlen = values.length;\n for (i = 0; i < vlen; i++) {\n start = next;\n end = next;\n if (total > 0) { // avoid divide by zero\n end = next + (circle * (values[i] / total));\n }\n if (valuenum === i) {\n color = options.get('sliceColors')[i % options.get('sliceColors').length];\n if (highlight) {\n color = this.calcHighlightColor(color, options);\n }\n\n return target.drawPieSlice(radius, radius, radius - borderWidth, start, end, undefined, color);\n }\n next = end;\n }\n },\n\n render: function () {\n var target = this.target,\n values = this.values,\n options = this.options,\n radius = this.radius,\n borderWidth = options.get('borderWidth'),\n donutWidth = options.get('donutWidth'),\n shape, i;\n\n if (!pie._super.render.call(this)) {\n return;\n }\n if (borderWidth) {\n target.drawCircle(radius, radius, Math.floor(radius - (borderWidth / 2)),\n options.get('borderColor'), undefined, borderWidth).append();\n }\n for (i = values.length; i--;) {\n if (values[i]) { // don't render zero values\n shape = this.renderSlice(i).append();\n this.valueShapes[i] = shape.id; // store just the shapeid\n this.shapes[shape.id] = i;\n }\n }\n if (donutWidth) {\n target.drawCircle(radius, radius, radius - donutWidth, options.get('donutColor'), \n options.get('donutColor'), 0).append();\n }\n target.render();\n }\n });\n\n /**\n * Box plots\n */\n $.fn.sparkline.box = box = createClass($.fn.sparkline._base, {\n type: 'box',\n\n init: function (el, values, options, width, height) {\n box._super.init.call(this, el, values, options, width, height);\n this.values = $.map(values, Number);\n this.width = options.get('width') === 'auto' ? '4.0em' : width;\n this.initTarget();\n if (!this.values.length) {\n this.disabled = 1;\n }\n },\n\n /**\n * Simulate a single region\n */\n getRegion: function () {\n return 1;\n },\n\n getCurrentRegionFields: function () {\n var result = [\n { field: 'lq', value: this.quartiles[0] },\n { field: 'med', value: this.quartiles[1] },\n { field: 'uq', value: this.quartiles[2] }\n ];\n if (this.loutlier !== undefined) {\n result.push({ field: 'lo', value: this.loutlier});\n }\n if (this.routlier !== undefined) {\n result.push({ field: 'ro', value: this.routlier});\n }\n if (this.lwhisker !== undefined) {\n result.push({ field: 'lw', value: this.lwhisker});\n }\n if (this.rwhisker !== undefined) {\n result.push({ field: 'rw', value: this.rwhisker});\n }\n return result;\n },\n\n render: function () {\n var target = this.target,\n values = this.values,\n vlen = values.length,\n options = this.options,\n canvasWidth = this.canvasWidth,\n canvasHeight = this.canvasHeight,\n minValue = options.get('chartRangeMin') === undefined ? Math.min.apply(Math, values) : options.get('chartRangeMin'),\n maxValue = options.get('chartRangeMax') === undefined ? Math.max.apply(Math, values) : options.get('chartRangeMax'),\n canvasLeft = 0,\n lwhisker, loutlier, iqr, q1, q2, q3, rwhisker, routlier, i,\n size, unitSize;\n\n if (!box._super.render.call(this)) {\n return;\n }\n\n if (options.get('raw')) {\n if (options.get('showOutliers') && values.length > 5) {\n loutlier = values[0];\n lwhisker = values[1];\n q1 = values[2];\n q2 = values[3];\n q3 = values[4];\n rwhisker = values[5];\n routlier = values[6];\n } else {\n lwhisker = values[0];\n q1 = values[1];\n q2 = values[2];\n q3 = values[3];\n rwhisker = values[4];\n }\n } else {\n values.sort(function (a, b) { return a - b; });\n q1 = quartile(values, 1);\n q2 = quartile(values, 2);\n q3 = quartile(values, 3);\n iqr = q3 - q1;\n if (options.get('showOutliers')) {\n lwhisker = rwhisker = undefined;\n for (i = 0; i < vlen; i++) {\n if (lwhisker === undefined && values[i] > q1 - (iqr * options.get('outlierIQR'))) {\n lwhisker = values[i];\n }\n if (values[i] < q3 + (iqr * options.get('outlierIQR'))) {\n rwhisker = values[i];\n }\n }\n loutlier = values[0];\n routlier = values[vlen - 1];\n } else {\n lwhisker = values[0];\n rwhisker = values[vlen - 1];\n }\n }\n this.quartiles = [q1, q2, q3];\n this.lwhisker = lwhisker;\n this.rwhisker = rwhisker;\n this.loutlier = loutlier;\n this.routlier = routlier;\n\n unitSize = canvasWidth / (maxValue - minValue + 1);\n if (options.get('showOutliers')) {\n canvasLeft = Math.ceil(options.get('spotRadius'));\n canvasWidth -= 2 * Math.ceil(options.get('spotRadius'));\n unitSize = canvasWidth / (maxValue - minValue + 1);\n if (loutlier < lwhisker) {\n target.drawCircle((loutlier - minValue) * unitSize + canvasLeft,\n canvasHeight / 2,\n options.get('spotRadius'),\n options.get('outlierLineColor'),\n options.get('outlierFillColor')).append();\n }\n if (routlier > rwhisker) {\n target.drawCircle((routlier - minValue) * unitSize + canvasLeft,\n canvasHeight / 2,\n options.get('spotRadius'),\n options.get('outlierLineColor'),\n options.get('outlierFillColor')).append();\n }\n }\n\n // box\n target.drawRect(\n Math.round((q1 - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight * 0.1),\n Math.round((q3 - q1) * unitSize),\n Math.round(canvasHeight * 0.8),\n options.get('boxLineColor'),\n options.get('boxFillColor')).append();\n // left whisker\n target.drawLine(\n Math.round((lwhisker - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight / 2),\n Math.round((q1 - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight / 2),\n options.get('lineColor')).append();\n target.drawLine(\n Math.round((lwhisker - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight / 4),\n Math.round((lwhisker - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight - canvasHeight / 4),\n options.get('whiskerColor')).append();\n // right whisker\n target.drawLine(Math.round((rwhisker - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight / 2),\n Math.round((q3 - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight / 2),\n options.get('lineColor')).append();\n target.drawLine(\n Math.round((rwhisker - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight / 4),\n Math.round((rwhisker - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight - canvasHeight / 4),\n options.get('whiskerColor')).append();\n // median line\n target.drawLine(\n Math.round((q2 - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight * 0.1),\n Math.round((q2 - minValue) * unitSize + canvasLeft),\n Math.round(canvasHeight * 0.9),\n options.get('medianColor')).append();\n if (options.get('target')) {\n size = Math.ceil(options.get('spotRadius'));\n target.drawLine(\n Math.round((options.get('target') - minValue) * unitSize + canvasLeft),\n Math.round((canvasHeight / 2) - size),\n Math.round((options.get('target') - minValue) * unitSize + canvasLeft),\n Math.round((canvasHeight / 2) + size),\n options.get('targetColor')).append();\n target.drawLine(\n Math.round((options.get('target') - minValue) * unitSize + canvasLeft - size),\n Math.round(canvasHeight / 2),\n Math.round((options.get('target') - minValue) * unitSize + canvasLeft + size),\n Math.round(canvasHeight / 2),\n options.get('targetColor')).append();\n }\n target.render();\n }\n });\n\n // Setup a very simple \"virtual canvas\" to make drawing the few shapes we need easier\n // This is accessible as $(foo).simpledraw()\n\n VShape = createClass({\n init: function (target, id, type, args) {\n this.target = target;\n this.id = id;\n this.type = type;\n this.args = args;\n },\n append: function () {\n this.target.appendShape(this);\n return this;\n }\n });\n\n VCanvas_base = createClass({\n _pxregex: /(\\d+)(px)?\\s*$/i,\n\n init: function (width, height, target) {\n if (!width) {\n return;\n }\n this.width = width;\n this.height = height;\n this.target = target;\n this.lastShapeId = null;\n if (target[0]) {\n target = target[0];\n }\n $.data(target, '_jqs_vcanvas', this);\n },\n\n drawLine: function (x1, y1, x2, y2, lineColor, lineWidth) {\n return this.drawShape([[x1, y1], [x2, y2]], lineColor, lineWidth);\n },\n\n drawShape: function (path, lineColor, fillColor, lineWidth) {\n return this._genShape('Shape', [path, lineColor, fillColor, lineWidth]);\n },\n\n drawCircle: function (x, y, radius, lineColor, fillColor, lineWidth) {\n return this._genShape('Circle', [x, y, radius, lineColor, fillColor, lineWidth]);\n },\n\n drawPieSlice: function (x, y, radius, startAngle, endAngle, lineColor, fillColor) {\n return this._genShape('PieSlice', [x, y, radius, startAngle, endAngle, lineColor, fillColor]);\n },\n\n drawRect: function (x, y, width, height, lineColor, fillColor) {\n return this._genShape('Rect', [x, y, width, height, lineColor, fillColor]);\n },\n\n getElement: function () {\n return this.canvas;\n },\n\n /**\n * Return the most recently inserted shape id\n */\n getLastShapeId: function () {\n return this.lastShapeId;\n },\n\n /**\n * Clear and reset the canvas\n */\n reset: function () {\n alert('reset not implemented');\n },\n\n _insert: function (el, target) {\n $(target).html(el);\n },\n\n /**\n * Calculate the pixel dimensions of the canvas\n */\n _calculatePixelDims: function (width, height, canvas) {\n // XXX This should probably be a configurable option\n var match;\n match = this._pxregex.exec(height);\n if (match) {\n this.pixelHeight = match[1];\n } else {\n this.pixelHeight = $(canvas).height();\n }\n match = this._pxregex.exec(width);\n if (match) {\n this.pixelWidth = match[1];\n } else {\n this.pixelWidth = $(canvas).width();\n }\n },\n\n /**\n * Generate a shape object and id for later rendering\n */\n _genShape: function (shapetype, shapeargs) {\n var id = shapeCount++;\n shapeargs.unshift(id);\n return new VShape(this, id, shapetype, shapeargs);\n },\n\n /**\n * Add a shape to the end of the render queue\n */\n appendShape: function (shape) {\n alert('appendShape not implemented');\n },\n\n /**\n * Replace one shape with another\n */\n replaceWithShape: function (shapeid, shape) {\n alert('replaceWithShape not implemented');\n },\n\n /**\n * Insert one shape after another in the render queue\n */\n insertAfterShape: function (shapeid, shape) {\n alert('insertAfterShape not implemented');\n },\n\n /**\n * Remove a shape from the queue\n */\n removeShapeId: function (shapeid) {\n alert('removeShapeId not implemented');\n },\n\n /**\n * Find a shape at the specified x/y co-ordinates\n */\n getShapeAt: function (el, x, y) {\n alert('getShapeAt not implemented');\n },\n\n /**\n * Render all queued shapes onto the canvas\n */\n render: function () {\n alert('render not implemented');\n }\n });\n\n VCanvas_canvas = createClass(VCanvas_base, {\n init: function (width, height, target, interact) {\n VCanvas_canvas._super.init.call(this, width, height, target);\n this.canvas = document.createElement('canvas');\n if (target[0]) {\n target = target[0];\n }\n $.data(target, '_jqs_vcanvas', this);\n $(this.canvas).css({ display: 'inline-block', width: width, height: height, verticalAlign: 'top' });\n this._insert(this.canvas, target);\n this._calculatePixelDims(width, height, this.canvas);\n this.canvas.width = this.pixelWidth;\n this.canvas.height = this.pixelHeight;\n this.interact = interact;\n this.shapes = {};\n this.shapeseq = [];\n this.currentTargetShapeId = undefined;\n $(this.canvas).css({width: this.pixelWidth, height: this.pixelHeight});\n },\n\n _getContext: function (lineColor, fillColor, lineWidth) {\n var context = this.canvas.getContext('2d');\n if (lineColor !== undefined) {\n context.strokeStyle = lineColor;\n }\n context.lineWidth = lineWidth === undefined ? 1 : lineWidth;\n if (fillColor !== undefined) {\n context.fillStyle = fillColor;\n }\n return context;\n },\n\n reset: function () {\n var context = this._getContext();\n context.clearRect(0, 0, this.pixelWidth, this.pixelHeight);\n this.shapes = {};\n this.shapeseq = [];\n this.currentTargetShapeId = undefined;\n },\n\n _drawShape: function (shapeid, path, lineColor, fillColor, lineWidth) {\n var context = this._getContext(lineColor, fillColor, lineWidth),\n i, plen;\n context.beginPath();\n context.moveTo(path[0][0] + 0.5, path[0][1] + 0.5);\n for (i = 1, plen = path.length; i < plen; i++) {\n context.lineTo(path[i][0] + 0.5, path[i][1] + 0.5); // the 0.5 offset gives us crisp pixel-width lines\n }\n if (lineColor !== undefined) {\n context.stroke();\n }\n if (fillColor !== undefined) {\n context.fill();\n }\n if (this.targetX !== undefined && this.targetY !== undefined &&\n context.isPointInPath(this.targetX, this.targetY)) {\n this.currentTargetShapeId = shapeid;\n }\n },\n\n _drawCircle: function (shapeid, x, y, radius, lineColor, fillColor, lineWidth) {\n var context = this._getContext(lineColor, fillColor, lineWidth);\n context.beginPath();\n context.arc(x, y, radius, 0, 2 * Math.PI, false);\n if (this.targetX !== undefined && this.targetY !== undefined &&\n context.isPointInPath(this.targetX, this.targetY)) {\n this.currentTargetShapeId = shapeid;\n }\n if (lineColor !== undefined) {\n context.stroke();\n }\n if (fillColor !== undefined) {\n context.fill();\n }\n },\n\n _drawPieSlice: function (shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) {\n var context = this._getContext(lineColor, fillColor);\n context.beginPath();\n context.moveTo(x, y);\n context.arc(x, y, radius, startAngle, endAngle, false);\n context.lineTo(x, y);\n context.closePath();\n if (lineColor !== undefined) {\n context.stroke();\n }\n if (fillColor) {\n context.fill();\n }\n if (this.targetX !== undefined && this.targetY !== undefined &&\n context.isPointInPath(this.targetX, this.targetY)) {\n this.currentTargetShapeId = shapeid;\n }\n },\n\n _drawRect: function (shapeid, x, y, width, height, lineColor, fillColor) {\n return this._drawShape(shapeid, [[x, y], [x + width, y], [x + width, y + height], [x, y + height], [x, y]], lineColor, fillColor);\n },\n\n appendShape: function (shape) {\n this.shapes[shape.id] = shape;\n this.shapeseq.push(shape.id);\n this.lastShapeId = shape.id;\n return shape.id;\n },\n\n replaceWithShape: function (shapeid, shape) {\n var shapeseq = this.shapeseq,\n i;\n this.shapes[shape.id] = shape;\n for (i = shapeseq.length; i--;) {\n if (shapeseq[i] == shapeid) {\n shapeseq[i] = shape.id;\n }\n }\n delete this.shapes[shapeid];\n },\n\n replaceWithShapes: function (shapeids, shapes) {\n var shapeseq = this.shapeseq,\n shapemap = {},\n sid, i, first;\n\n for (i = shapeids.length; i--;) {\n shapemap[shapeids[i]] = true;\n }\n for (i = shapeseq.length; i--;) {\n sid = shapeseq[i];\n if (shapemap[sid]) {\n shapeseq.splice(i, 1);\n delete this.shapes[sid];\n first = i;\n }\n }\n for (i = shapes.length; i--;) {\n shapeseq.splice(first, 0, shapes[i].id);\n this.shapes[shapes[i].id] = shapes[i];\n }\n\n },\n\n insertAfterShape: function (shapeid, shape) {\n var shapeseq = this.shapeseq,\n i;\n for (i = shapeseq.length; i--;) {\n if (shapeseq[i] === shapeid) {\n shapeseq.splice(i + 1, 0, shape.id);\n this.shapes[shape.id] = shape;\n return;\n }\n }\n },\n\n removeShapeId: function (shapeid) {\n var shapeseq = this.shapeseq,\n i;\n for (i = shapeseq.length; i--;) {\n if (shapeseq[i] === shapeid) {\n shapeseq.splice(i, 1);\n break;\n }\n }\n delete this.shapes[shapeid];\n },\n\n getShapeAt: function (el, x, y) {\n this.targetX = x;\n this.targetY = y;\n this.render();\n return this.currentTargetShapeId;\n },\n\n render: function () {\n var shapeseq = this.shapeseq,\n shapes = this.shapes,\n shapeCount = shapeseq.length,\n context = this._getContext(),\n shapeid, shape, i;\n context.clearRect(0, 0, this.pixelWidth, this.pixelHeight);\n for (i = 0; i < shapeCount; i++) {\n shapeid = shapeseq[i];\n shape = shapes[shapeid];\n this['_draw' + shape.type].apply(this, shape.args);\n }\n if (!this.interact) {\n // not interactive so no need to keep the shapes array\n this.shapes = {};\n this.shapeseq = [];\n }\n }\n\n });\n\n VCanvas_vml = createClass(VCanvas_base, {\n init: function (width, height, target) {\n var groupel;\n VCanvas_vml._super.init.call(this, width, height, target);\n if (target[0]) {\n target = target[0];\n }\n $.data(target, '_jqs_vcanvas', this);\n this.canvas = document.createElement('span');\n $(this.canvas).css({ display: 'inline-block', position: 'relative', overflow: 'hidden', width: width, height: height, margin: '0px', padding: '0px', verticalAlign: 'top'});\n this._insert(this.canvas, target);\n this._calculatePixelDims(width, height, this.canvas);\n this.canvas.width = this.pixelWidth;\n this.canvas.height = this.pixelHeight;\n groupel = '';\n this.canvas.insertAdjacentHTML('beforeEnd', groupel);\n this.group = $(this.canvas).children()[0];\n this.rendered = false;\n this.prerender = '';\n },\n\n _drawShape: function (shapeid, path, lineColor, fillColor, lineWidth) {\n var vpath = [],\n initial, stroke, fill, closed, vel, plen, i;\n for (i = 0, plen = path.length; i < plen; i++) {\n vpath[i] = '' + (path[i][0]) + ',' + (path[i][1]);\n }\n initial = vpath.splice(0, 1);\n lineWidth = lineWidth === undefined ? 1 : lineWidth;\n stroke = lineColor === undefined ? ' stroked=\"false\" ' : ' strokeWeight=\"' + lineWidth + 'px\" strokeColor=\"' + lineColor + '\" ';\n fill = fillColor === undefined ? ' filled=\"false\"' : ' fillColor=\"' + fillColor + '\" filled=\"true\" ';\n closed = vpath[0] === vpath[vpath.length - 1] ? 'x ' : '';\n vel = '' +\n ' ';\n return vel;\n },\n\n _drawCircle: function (shapeid, x, y, radius, lineColor, fillColor, lineWidth) {\n var stroke, fill, vel;\n x -= radius;\n y -= radius;\n stroke = lineColor === undefined ? ' stroked=\"false\" ' : ' strokeWeight=\"' + lineWidth + 'px\" strokeColor=\"' + lineColor + '\" ';\n fill = fillColor === undefined ? ' filled=\"false\"' : ' fillColor=\"' + fillColor + '\" filled=\"true\" ';\n vel = '';\n return vel;\n\n },\n\n _drawPieSlice: function (shapeid, x, y, radius, startAngle, endAngle, lineColor, fillColor) {\n var vpath, startx, starty, endx, endy, stroke, fill, vel;\n if (startAngle === endAngle) {\n return ''; // VML seems to have problem when start angle equals end angle.\n }\n if ((endAngle - startAngle) === (2 * Math.PI)) {\n startAngle = 0.0; // VML seems to have a problem when drawing a full circle that doesn't start 0\n endAngle = (2 * Math.PI);\n }\n\n startx = x + Math.round(Math.cos(startAngle) * radius);\n starty = y + Math.round(Math.sin(startAngle) * radius);\n endx = x + Math.round(Math.cos(endAngle) * radius);\n endy = y + Math.round(Math.sin(endAngle) * radius);\n\n if (startx === endx && starty === endy) {\n if ((endAngle - startAngle) < Math.PI) {\n // Prevent very small slices from being mistaken as a whole pie\n return '';\n }\n // essentially going to be the entire circle, so ignore startAngle\n startx = endx = x + radius;\n starty = endy = y;\n }\n\n if (startx === endx && starty === endy && (endAngle - startAngle) < Math.PI) {\n return '';\n }\n\n vpath = [x - radius, y - radius, x + radius, y + radius, startx, starty, endx, endy];\n stroke = lineColor === undefined ? ' stroked=\"false\" ' : ' strokeWeight=\"1px\" strokeColor=\"' + lineColor + '\" ';\n fill = fillColor === undefined ? ' filled=\"false\"' : ' fillColor=\"' + fillColor + '\" filled=\"true\" ';\n vel = '' +\n ' ';\n return vel;\n },\n\n _drawRect: function (shapeid, x, y, width, height, lineColor, fillColor) {\n return this._drawShape(shapeid, [[x, y], [x, y + height], [x + width, y + height], [x + width, y], [x, y]], lineColor, fillColor);\n },\n\n reset: function () {\n this.group.innerHTML = '';\n },\n\n appendShape: function (shape) {\n var vel = this['_draw' + shape.type].apply(this, shape.args);\n if (this.rendered) {\n this.group.insertAdjacentHTML('beforeEnd', vel);\n } else {\n this.prerender += vel;\n }\n this.lastShapeId = shape.id;\n return shape.id;\n },\n\n replaceWithShape: function (shapeid, shape) {\n var existing = $('#jqsshape' + shapeid),\n vel = this['_draw' + shape.type].apply(this, shape.args);\n existing[0].outerHTML = vel;\n },\n\n replaceWithShapes: function (shapeids, shapes) {\n // replace the first shapeid with all the new shapes then toast the remaining old shapes\n var existing = $('#jqsshape' + shapeids[0]),\n replace = '',\n slen = shapes.length,\n i;\n for (i = 0; i < slen; i++) {\n replace += this['_draw' + shapes[i].type].apply(this, shapes[i].args);\n }\n existing[0].outerHTML = replace;\n for (i = 1; i < shapeids.length; i++) {\n $('#jqsshape' + shapeids[i]).remove();\n }\n },\n\n insertAfterShape: function (shapeid, shape) {\n var existing = $('#jqsshape' + shapeid),\n vel = this['_draw' + shape.type].apply(this, shape.args);\n existing[0].insertAdjacentHTML('afterEnd', vel);\n },\n\n removeShapeId: function (shapeid) {\n var existing = $('#jqsshape' + shapeid);\n this.group.removeChild(existing[0]);\n },\n\n getShapeAt: function (el, x, y) {\n var shapeid = el.id.substr(8);\n return shapeid;\n },\n\n render: function () {\n if (!this.rendered) {\n // batch the intial render into a single repaint\n this.group.innerHTML = this.prerender;\n this.rendered = true;\n }\n }\n });\n\n}))}(document, Math));\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nimport * as React from 'react';\nimport classNamesFunc from 'classnames';\nimport { parseThemeOptions } from './with-theme';\nimport { handleDeprecations } from './utils/deprecation';\n// ALL OF THESE FUNCTIONS MUTATE THE COPY OF PROPS\n// this is intentional and done for speed and memory\nvar handleClassNames = function (props, classNames, className, theme) {\n var finalClassNames = classNamesFunc.apply(void 0, __spread([className], (!!theme ? parseThemeOptions(theme) : []), (typeof classNames === 'function' ? classNames(props) : classNames)));\n props.className = finalClassNames;\n};\nvar handleTag = function (props, defaultTag, tag) {\n // Handle the case where we are extending a component but passing\n // a string as a tag. For instance, extending an Icon but rendering a span\n if (typeof defaultTag !== 'string') {\n props.tag = tag;\n return defaultTag;\n }\n return tag || defaultTag;\n};\nvar handleConsumeProps = function (props, consumeProps) {\n consumeProps.forEach(function (p) {\n delete props[p];\n });\n};\nexport var componentFactory = function (_a) {\n var displayName = _a.displayName, _b = _a.classNames, classNames = _b === void 0 ? [] : _b, _c = _a.tag, defaultTag = _c === void 0 ? 'div' : _c, deprecate = _a.deprecate, defaultProps = _a.defaultProps, _d = _a.consumeProps, consumeProps = _d === void 0 ? [] : _d, render = _a.render;\n var Component = React.forwardRef(function (props, ref) {\n var className = props.className, theme = props.theme, tag = props.tag, rest = __rest(props, [\"className\", \"theme\", \"tag\"]);\n var newProps = rest;\n handleClassNames(newProps, classNames, className, theme);\n var Tag = handleTag(newProps, defaultTag, tag);\n if (deprecate) {\n newProps = handleDeprecations(newProps, deprecate, displayName);\n }\n handleConsumeProps(newProps, consumeProps);\n var finalProps = newProps;\n // @ts-ignore\n return render ? (render(finalProps, ref, Tag)) : (React.createElement(Tag, __assign({}, finalProps, { ref: ref })));\n });\n Component.displayName = displayName;\n Component.defaultProps = defaultProps;\n return Component;\n};\n","/* istanbul ignore file */\nexport var eventsMap = {\n blur: 'onBlur',\n cancel: 'onCancel',\n click: 'onClick',\n close: 'onClose',\n contextmenu: 'onContextMenu',\n copy: 'onCopy',\n cut: 'onCut',\n auxclick: 'onAuxClick',\n doubleclick: 'onDoubleClick',\n dragend: 'onDragEnd',\n dragstart: 'onDragStart',\n drop: 'onDrop',\n focus: 'onFocus',\n input: 'onInput',\n invalid: 'onInvalid',\n keydown: 'onKeyDown',\n keypress: 'onKeyPress',\n keyup: 'onKeyUp',\n mousedown: 'onMouseDown',\n mouseup: 'onMouseUp',\n paste: 'onPaste',\n pause: 'onPause',\n play: 'onPlay',\n pointercancel: 'onPointerCancel',\n pointerdown: 'onPointerDown',\n pointerup: 'onPointerUp',\n ratechange: 'onRateChange',\n reset: 'onReset',\n seeked: 'onSeeked',\n submit: 'onSubmit',\n touchcancel: 'onTouchCancel',\n touchend: 'onTouchEnd',\n touchstart: 'onTouchStart',\n volumechange: 'onVolumeChange',\n abort: 'onAbort',\n animationend: 'onAnimationEnd',\n animationiteration: 'onAnimationIteration',\n animationstart: 'onAnimationStart',\n canplay: 'onCanPlay',\n canplaythrough: 'onCanPlayThrough',\n drag: 'onDrag',\n dragenter: 'onDragEnter',\n dragexit: 'onDragExit',\n dragleave: 'onDragLeave',\n dragover: 'onDragOver',\n durationchange: 'onDurationChange',\n emptied: 'onEmptied',\n encrypted: 'onEncrypted',\n ended: 'onEnded',\n error: 'onError',\n gotpointercapture: 'onGotPointerCapture',\n load: 'onLoad',\n loadeddata: 'onLoadedData',\n loadedmetadata: 'onLoadedMetadata',\n loadstart: 'onLoadStart',\n lostpointercapture: 'onLostPointerCapture',\n mousemove: 'onMouseMove',\n mouseout: 'onMouseOut',\n mouseover: 'onMouseOver',\n playing: 'onPlaying',\n pointermove: 'onPointerMove',\n pointerout: 'onPointerOut',\n pointerover: 'onPointerOver',\n progress: 'onProgress',\n scroll: 'onScroll',\n seeking: 'onSeeking',\n stalled: 'onStalled',\n suspend: 'onSuspend',\n timeupdate: 'onTimeUpdate',\n toggle: 'onToggle',\n touchmove: 'onTouchMove',\n transitionend: 'onTransitionEnd',\n waiting: 'onWaiting',\n wheel: 'onWheel',\n mouseenter: 'onMouseEnter',\n mouseleave: 'onMouseLeave',\n pointerenter: 'onPointerEnter',\n pointerleave: 'onPointerLeave',\n change: 'onChange',\n select: 'onSelect',\n beforeinput: 'onBeforeInput',\n compositionend: 'onCompositionEnd',\n compositionstart: 'onCompositionStart',\n compositionupdate: 'onCompositionUpdate'\n};\n","export var debounce = function (func, wait) {\n var timeout;\n return function () {\n // @ts-ignore\n var context = this, args = arguments;\n var later = function () {\n timeout = null;\n func.apply(context, args);\n };\n timeout !== null && clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n };\n};\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nvar __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n};\nvar __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n};\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { eventsMap } from './utils/events-map';\nimport { debounce } from './utils/debounce';\nimport { toCamel } from './utils/strings';\nvar reactPropFromEventName = function (evtName) {\n return eventsMap[evtName] || evtName;\n};\nvar FoundationElement = /** @class */ (function () {\n function FoundationElement(onChange) {\n this._classes = new Set();\n this._events = {};\n this._style = {};\n this._props = {};\n this._ref = null;\n this._onChange = null;\n this._onChange = onChange;\n this.onChange = this.onChange.bind(this);\n this.addClass = this.addClass.bind(this);\n this.removeClass = this.removeClass.bind(this);\n this.hasClass = this.hasClass.bind(this);\n this.setProp = this.setProp.bind(this);\n this.getProp = this.getProp.bind(this);\n this.removeProp = this.removeProp.bind(this);\n this.setStyle = this.setStyle.bind(this);\n this.addEventListener = this.addEventListener.bind(this);\n this.removeEventListener = this.removeEventListener.bind(this);\n this.setRef = this.setRef.bind(this);\n }\n FoundationElement.prototype.onChange = function () {\n this._onChange && this._onChange();\n };\n FoundationElement.prototype.destroy = function () {\n this._onChange = null;\n this._ref = null;\n this._events = {};\n this._style = {};\n this._props = {};\n this._classes = new Set();\n };\n /**************************************************\n * Classes\n **************************************************/\n FoundationElement.prototype.addClass = function (className) {\n if (!this._classes.has(className)) {\n this._classes.add(className);\n this.onChange();\n }\n };\n FoundationElement.prototype.removeClass = function (className) {\n if (this._classes.has(className)) {\n this._classes.delete(className);\n this.onChange();\n }\n };\n FoundationElement.prototype.hasClass = function (className) {\n return this._classes.has(className);\n };\n /**************************************************\n * Props\n **************************************************/\n FoundationElement.prototype.setProp = function (propName, value) {\n if (this._props[propName] !== value) {\n this._props[propName] = value;\n this.onChange();\n }\n };\n FoundationElement.prototype.getProp = function (propName) {\n return this._props[propName];\n };\n FoundationElement.prototype.removeProp = function (propName) {\n if (this._props[propName] !== undefined) {\n delete this._props[propName];\n this.onChange();\n }\n };\n FoundationElement.prototype.props = function (propsToMerge) {\n var _this = this;\n var _a = propsToMerge.className, className = _a === void 0 ? '' : _a, _b = propsToMerge.style, style = _b === void 0 ? {} : _b;\n // handle merging events\n // the foundation should be able to pass something onClick as well as a user\n // This wraps them in a function that calls both\n var mergedEvents = Object.entries(propsToMerge).reduce(function (acc, _a) {\n var _b = __read(_a, 2), key = _b[0], possibleCallback = _b[1];\n var existingCallback = _this._events[key];\n if (typeof possibleCallback === 'function' &&\n typeof existingCallback === 'function') {\n var wrappedCallback = function (evt) {\n existingCallback(evt);\n return possibleCallback(evt);\n };\n acc[key] = wrappedCallback;\n }\n return acc;\n }, __assign({}, this._events));\n // handle className\n var mergedClasses = classNames(className, __spread(this._classes));\n // handle styles\n var mergedStyles = __assign({}, this._style, style);\n return __assign({}, propsToMerge, this._props, mergedEvents, { style: mergedStyles, className: mergedClasses });\n };\n /**************************************************\n * Styles\n **************************************************/\n FoundationElement.prototype.setStyle = function (propertyName, value) {\n propertyName = propertyName.startsWith('--')\n ? propertyName\n : toCamel(propertyName);\n if (this._style[propertyName] !== value) {\n this._style[propertyName] = value;\n this.onChange();\n }\n };\n /**************************************************\n * Events\n **************************************************/\n FoundationElement.prototype.addEventListener = function (evtName, callback) {\n var propName = reactPropFromEventName(evtName);\n if (this._events[propName] !== callback) {\n this._events[propName] = callback;\n this.onChange();\n }\n };\n FoundationElement.prototype.removeEventListener = function (evtName, callback) {\n var propName = reactPropFromEventName(evtName);\n if (this._events[propName]) {\n delete this._events[propName];\n this.onChange();\n }\n };\n /**************************************************\n * Refs\n **************************************************/\n FoundationElement.prototype.setRef = function (el) {\n if (el) {\n this._ref = el;\n }\n };\n Object.defineProperty(FoundationElement.prototype, \"ref\", {\n get: function () {\n return this._ref;\n },\n enumerable: true,\n configurable: true\n });\n return FoundationElement;\n}());\nexport { FoundationElement };\nvar FoundationComponent = /** @class */ (function (_super) {\n __extends(FoundationComponent, _super);\n function FoundationComponent(props) {\n var _this = _super.call(this, props) || this;\n _this.elements = {};\n //@ts-ignore\n if (_this.constructor.shouldDebounce) {\n _this.update = debounce(_this.update.bind(_this), 0);\n }\n else {\n _this.update = _this.update.bind(_this);\n }\n return _this;\n }\n FoundationComponent.prototype.componentDidMount = function () {\n this.foundation = this.getDefaultFoundation();\n this.foundation.init();\n this.sync(this.props, {});\n };\n FoundationComponent.prototype.componentDidUpdate = function (prevProps) {\n this.sync(this.props, prevProps);\n };\n FoundationComponent.prototype.componentWillUnmount = function () {\n this.foundation && this.foundation.destroy();\n // @ts-ignore\n this.foundation = undefined;\n Object.values(this.elements).forEach(function (el) { return el.destroy(); });\n };\n FoundationComponent.prototype.createElement = function (elementName) {\n var el = new FoundationElement(this.update);\n this.elements[elementName] = el;\n return el;\n };\n FoundationComponent.prototype.update = function () {\n this.foundation && this.setState({});\n };\n FoundationComponent.prototype.sync = function (props, prevProps) { };\n FoundationComponent.prototype.syncProp = function (prop, prevProp, callback) {\n if ((prop !== undefined || (prevProp !== undefined && prop === undefined)) &&\n prop !== prevProp) {\n callback();\n }\n };\n FoundationComponent.prototype.getDefaultFoundation = function () {\n return {\n init: function () { },\n destroy: function () { }\n };\n };\n /**\n * Fires a cross-browser-compatible custom event from the component root of the given type,\n */\n FoundationComponent.prototype.emit = function (evtType, evtData, shouldBubble) {\n if (shouldBubble === void 0) { shouldBubble = false; }\n var evt;\n evt = new CustomEvent(evtType, {\n detail: evtData,\n bubbles: shouldBubble\n });\n // bugfix for events coming from form elements\n // and also fits with reacts form pattern better...\n // This should always otherwise be null since there is no target\n // for Custom Events\n Object.defineProperty(evt, 'target', {\n value: evtData,\n writable: false\n });\n Object.defineProperty(evt, 'currentTarget', {\n value: evtData,\n writable: false\n });\n // Custom handling for React\n var propName = evtType;\n // check to see if the foundation still exists. If not, we are\n // probably unmounted or destroyed and dont want to call any more handlers\n // This happens when MDC broadcasts certain events on timers\n if (this.foundation) {\n //@ts-ignore\n this.props[propName] && this.props[propName](evt);\n }\n return evt;\n };\n FoundationComponent.shouldDebounce = false;\n return FoundationComponent;\n}(React.Component));\nexport { FoundationComponent };\n","export default function symbolObservablePonyfill(root) {\n\tvar result;\n\tvar Symbol = root.Symbol;\n\n\tif (typeof Symbol === 'function') {\n\t\tif (Symbol.observable) {\n\t\t\tresult = Symbol.observable;\n\t\t} else {\n\t\t\tresult = Symbol('observable');\n\t\t\tSymbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n","import _checkForMethod from './internal/_checkForMethod.js';\nimport _curry1 from './internal/_curry1.js';\nimport slice from './slice.js';\n\n/**\n * Returns all but the first element of the given list or string (or object\n * with a `tail` method).\n *\n * Dispatches to the `slice` method of the first argument, if present.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category List\n * @sig [a] -> [a]\n * @sig String -> String\n * @param {*} list\n * @return {*}\n * @see R.head, R.init, R.last\n * @example\n *\n * R.tail([1, 2, 3]); //=> [2, 3]\n * R.tail([1, 2]); //=> [2]\n * R.tail([1]); //=> []\n * R.tail([]); //=> []\n *\n * R.tail('abc'); //=> 'bc'\n * R.tail('ab'); //=> 'b'\n * R.tail('a'); //=> ''\n * R.tail(''); //=> ''\n */\nvar tail = /*#__PURE__*/_curry1( /*#__PURE__*/_checkForMethod('tail', /*#__PURE__*/slice(1, Infinity)));\nexport default tail;","/** PURE_IMPORTS_START tslib,_util_subscribeToResult,_OuterSubscriber,_InnerSubscriber,_map,_observable_from PURE_IMPORTS_END */\nimport * as tslib_1 from \"tslib\";\nimport { subscribeToResult } from '../util/subscribeToResult';\nimport { OuterSubscriber } from '../OuterSubscriber';\nimport { InnerSubscriber } from '../InnerSubscriber';\nimport { map } from './map';\nimport { from } from '../observable/from';\nexport function mergeMap(project, resultSelector, concurrent) {\n if (concurrent === void 0) {\n concurrent = Number.POSITIVE_INFINITY;\n }\n if (typeof resultSelector === 'function') {\n return function (source) { return source.pipe(mergeMap(function (a, i) { return from(project(a, i)).pipe(map(function (b, ii) { return resultSelector(a, b, i, ii); })); }, concurrent)); };\n }\n else if (typeof resultSelector === 'number') {\n concurrent = resultSelector;\n }\n return function (source) { return source.lift(new MergeMapOperator(project, concurrent)); };\n}\nvar MergeMapOperator = /*@__PURE__*/ (function () {\n function MergeMapOperator(project, concurrent) {\n if (concurrent === void 0) {\n concurrent = Number.POSITIVE_INFINITY;\n }\n this.project = project;\n this.concurrent = concurrent;\n }\n MergeMapOperator.prototype.call = function (observer, source) {\n return source.subscribe(new MergeMapSubscriber(observer, this.project, this.concurrent));\n };\n return MergeMapOperator;\n}());\nexport { MergeMapOperator };\nvar MergeMapSubscriber = /*@__PURE__*/ (function (_super) {\n tslib_1.__extends(MergeMapSubscriber, _super);\n function MergeMapSubscriber(destination, project, concurrent) {\n if (concurrent === void 0) {\n concurrent = Number.POSITIVE_INFINITY;\n }\n var _this = _super.call(this, destination) || this;\n _this.project = project;\n _this.concurrent = concurrent;\n _this.hasCompleted = false;\n _this.buffer = [];\n _this.active = 0;\n _this.index = 0;\n return _this;\n }\n MergeMapSubscriber.prototype._next = function (value) {\n if (this.active < this.concurrent) {\n this._tryNext(value);\n }\n else {\n this.buffer.push(value);\n }\n };\n MergeMapSubscriber.prototype._tryNext = function (value) {\n var result;\n var index = this.index++;\n try {\n result = this.project(value, index);\n }\n catch (err) {\n this.destination.error(err);\n return;\n }\n this.active++;\n this._innerSub(result, value, index);\n };\n MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {\n var innerSubscriber = new InnerSubscriber(this, value, index);\n var destination = this.destination;\n destination.add(innerSubscriber);\n var innerSubscription = subscribeToResult(this, ish, undefined, undefined, innerSubscriber);\n if (innerSubscription !== innerSubscriber) {\n destination.add(innerSubscription);\n }\n };\n MergeMapSubscriber.prototype._complete = function () {\n this.hasCompleted = true;\n if (this.active === 0 && this.buffer.length === 0) {\n this.destination.complete();\n }\n this.unsubscribe();\n };\n MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {\n this.destination.next(innerValue);\n };\n MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {\n var buffer = this.buffer;\n this.remove(innerSub);\n this.active--;\n if (buffer.length > 0) {\n this._next(buffer.shift());\n }\n else if (this.active === 0 && this.hasCompleted) {\n this.destination.complete();\n }\n };\n return MergeMapSubscriber;\n}(OuterSubscriber));\nexport { MergeMapSubscriber };\n//# sourceMappingURL=mergeMap.js.map\n","\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = math;\n\nvar _defaultSymbols = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require(\"./presets/defaultSymbols\"));\n\nvar _errors = /*#__PURE__*/_interopRequireDefault( /*#__PURE__*/require(\"../internalHelpers/_errors\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nvar unitRegExp = /((?!\\w)a|na|hc|mc|dg|me[r]?|xe|ni(?![a-zA-Z])|mm|cp|tp|xp|q(?!s)|hv|xamv|nimv|wv|sm|s(?!\\D|$)|ged|darg?|nrut)/g; // Merges additional math functionality into the defaults.\n\nfunction mergeSymbolMaps(additionalSymbols) {\n var symbolMap = {};\n symbolMap.symbols = additionalSymbols ? _extends({}, _defaultSymbols[\"default\"].symbols, additionalSymbols.symbols) : _extends({}, _defaultSymbols[\"default\"].symbols);\n return symbolMap;\n}\n\nfunction exec(operators, values) {\n var _ref;\n\n var op = operators.pop();\n values.push(op.f.apply(op, (_ref = []).concat.apply(_ref, values.splice(-op.argCount))));\n return op.precedence;\n}\n\nfunction calculate(expression, additionalSymbols) {\n var symbolMap = mergeSymbolMaps(additionalSymbols);\n var match;\n var operators = [symbolMap.symbols['('].prefix];\n var values = [];\n var pattern = new RegExp( // Pattern for numbers\n \"\\\\d+(?:\\\\.\\\\d+)?|\" + // ...and patterns for individual operators/function names\n Object.keys(symbolMap.symbols).map(function (key) {\n return symbolMap.symbols[key];\n }) // longer symbols should be listed first\n // $FlowFixMe\n .sort(function (a, b) {\n return b.symbol.length - a.symbol.length;\n }) // $FlowFixMe\n .map(function (val) {\n return val.regSymbol;\n }).join('|') + \"|(\\\\S)\", 'g');\n pattern.lastIndex = 0; // Reset regular expression object\n\n var afterValue = false;\n\n do {\n match = pattern.exec(expression);\n\n var _ref2 = match || [')', undefined],\n token = _ref2[0],\n bad = _ref2[1];\n\n var notNumber = symbolMap.symbols[token];\n var notNewValue = notNumber && !notNumber.prefix && !notNumber.func;\n var notAfterValue = !notNumber || !notNumber.postfix && !notNumber.infix; // Check for syntax errors:\n\n if (bad || (afterValue ? notAfterValue : notNewValue)) {\n throw new _errors[\"default\"](37, match ? match.index : expression.length, expression);\n }\n\n if (afterValue) {\n // We either have an infix or postfix operator (they should be mutually exclusive)\n var curr = notNumber.postfix || notNumber.infix;\n\n do {\n var prev = operators[operators.length - 1];\n if ((curr.precedence - prev.precedence || prev.rightToLeft) > 0) break; // Apply previous operator, since it has precedence over current one\n } while (exec(operators, values)); // Exit loop after executing an opening parenthesis or function\n\n\n afterValue = curr.notation === 'postfix';\n\n if (curr.symbol !== ')') {\n operators.push(curr); // Postfix always has precedence over any operator that follows after it\n\n if (afterValue) exec(operators, values);\n }\n } else if (notNumber) {\n // prefix operator or function\n operators.push(notNumber.prefix || notNumber.func);\n\n if (notNumber.func) {\n // Require an opening parenthesis\n match = pattern.exec(expression);\n\n if (!match || match[0] !== '(') {\n throw new _errors[\"default\"](38, match ? match.index : expression.length, expression);\n }\n }\n } else {\n // number\n values.push(+token);\n afterValue = true;\n }\n } while (match && operators.length);\n\n if (operators.length) {\n throw new _errors[\"default\"](39, match ? match.index : expression.length, expression);\n } else if (match) {\n throw new _errors[\"default\"](40, match ? match.index : expression.length, expression);\n } else {\n return values.pop();\n }\n}\n\nfunction reverseString(str) {\n return str.split('').reverse().join('');\n}\n/**\n * Helper for doing math with CSS Units. Accepts a formula as a string. All values in the formula must have the same unit (or be unitless). Supports complex formulas utliziing addition, subtraction, multiplication, division, square root, powers, factorial, min, max, as well as parentheses for order of operation.\n *\n *In cases where you need to do calculations with mixed units where one unit is a [relative length unit](https://developer.mozilla.org/en-US/docs/Web/CSS/length#Relative_length_units), you will want to use [CSS Calc](https://developer.mozilla.org/en-US/docs/Web/CSS/calc).\n *\n * *warning* While we've done everything possible to ensure math safely evalutes formulas expressed as strings, you should always use extreme caution when passing `math` user provided values.\n * @example\n * // Styles as object usage\n * const styles = {\n * fontSize: math('12rem + 8rem'),\n * fontSize: math('(12px + 2px) * 3'),\n * fontSize: math('3px^2 + sqrt(4)'),\n * }\n *\n * // styled-components usage\n * const div = styled.div`\n * fontSize: ${math('12rem + 8rem')};\n * fontSize: ${math('(12px + 2px) * 3')};\n * fontSize: ${math('3px^2 + sqrt(4)')};\n * `\n *\n * // CSS as JS Output\n *\n * div: {\n * fontSize: '20rem',\n * fontSize: '42px',\n * fontSize: '11px',\n * }\n */\n\n\nfunction math(formula, additionalSymbols) {\n var reversedFormula = reverseString(formula);\n var formulaMatch = reversedFormula.match(unitRegExp); // Check that all units are the same\n\n if (formulaMatch && !formulaMatch.every(function (unit) {\n return unit === formulaMatch[0];\n })) {\n throw new _errors[\"default\"](41);\n }\n\n var cleanFormula = reverseString(reversedFormula.replace(unitRegExp, ''));\n return \"\" + calculate(cleanFormula, additionalSymbols) + (formulaMatch ? reverseString(formulaMatch[0]) : '');\n}\n\nmodule.exports = exports.default;","//\n\nmodule.exports = function shallowEqual(objA, objB, compare, compareContext) {\n var ret = compare ? compare.call(compareContext, objA, objB) : void 0;\n\n if (ret !== void 0) {\n return !!ret;\n }\n\n if (objA === objB) {\n return true;\n }\n\n if (typeof objA !== \"object\" || !objA || typeof objB !== \"object\" || !objB) {\n return false;\n }\n\n var keysA = Object.keys(objA);\n var keysB = Object.keys(objB);\n\n if (keysA.length !== keysB.length) {\n return false;\n }\n\n var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);\n\n // Test for A's keys different from B.\n for (var idx = 0; idx < keysA.length; idx++) {\n var key = keysA[idx];\n\n if (!bHasOwnProperty(key)) {\n return false;\n }\n\n var valueA = objA[key];\n var valueB = objB[key];\n\n ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;\n\n if (ret === false || (ret === void 0 && valueA !== valueB)) {\n return false;\n }\n }\n\n return true;\n};\n","function stylis_min (W) {\n function M(d, c, e, h, a) {\n for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) {\n g = e.charCodeAt(l);\n l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++);\n\n if (0 === b + n + v + m) {\n if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) {\n switch (g) {\n case 32:\n case 9:\n case 59:\n case 13:\n case 10:\n break;\n\n default:\n f += e.charAt(l);\n }\n\n g = 59;\n }\n\n switch (g) {\n case 123:\n f = f.trim();\n q = f.charCodeAt(0);\n k = 1;\n\n for (t = ++l; l < B;) {\n switch (g = e.charCodeAt(l)) {\n case 123:\n k++;\n break;\n\n case 125:\n k--;\n break;\n\n case 47:\n switch (g = e.charCodeAt(l + 1)) {\n case 42:\n case 47:\n a: {\n for (u = l + 1; u < J; ++u) {\n switch (e.charCodeAt(u)) {\n case 47:\n if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) {\n l = u + 1;\n break a;\n }\n\n break;\n\n case 10:\n if (47 === g) {\n l = u + 1;\n break a;\n }\n\n }\n }\n\n l = u;\n }\n\n }\n\n break;\n\n case 91:\n g++;\n\n case 40:\n g++;\n\n case 34:\n case 39:\n for (; l++ < J && e.charCodeAt(l) !== g;) {\n }\n\n }\n\n if (0 === k) break;\n l++;\n }\n\n k = e.substring(t, l);\n 0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0));\n\n switch (q) {\n case 64:\n 0 < r && (f = f.replace(N, ''));\n g = f.charCodeAt(1);\n\n switch (g) {\n case 100:\n case 109:\n case 115:\n case 45:\n r = c;\n break;\n\n default:\n r = O;\n }\n\n k = M(c, r, k, g, a + 1);\n t = k.length;\n 0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = ''));\n if (0 < t) switch (g) {\n case 115:\n f = f.replace(da, ea);\n\n case 100:\n case 109:\n case 45:\n k = f + '{' + k + '}';\n break;\n\n case 107:\n f = f.replace(fa, '$1 $2');\n k = f + '{' + k + '}';\n k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k;\n break;\n\n default:\n k = f + k, 112 === h && (k = (p += k, ''));\n } else k = '';\n break;\n\n default:\n k = M(c, X(c, f, I), k, h, a + 1);\n }\n\n F += k;\n k = I = r = u = q = 0;\n f = '';\n g = e.charCodeAt(++l);\n break;\n\n case 125:\n case 59:\n f = (0 < r ? f.replace(N, '') : f).trim();\n if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\\x00\\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) {\n case 0:\n break;\n\n case 64:\n if (105 === g || 99 === g) {\n G += f + e.charAt(l);\n break;\n }\n\n default:\n 58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2)));\n }\n I = r = u = q = 0;\n f = '';\n g = e.charCodeAt(++l);\n }\n }\n\n switch (g) {\n case 13:\n case 10:\n 47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\\x00');\n 0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h);\n z = 1;\n D++;\n break;\n\n case 59:\n case 125:\n if (0 === b + n + v + m) {\n z++;\n break;\n }\n\n default:\n z++;\n y = e.charAt(l);\n\n switch (g) {\n case 9:\n case 32:\n if (0 === n + m + b) switch (x) {\n case 44:\n case 58:\n case 9:\n case 32:\n y = '';\n break;\n\n default:\n 32 !== g && (y = ' ');\n }\n break;\n\n case 0:\n y = '\\\\0';\n break;\n\n case 12:\n y = '\\\\f';\n break;\n\n case 11:\n y = '\\\\v';\n break;\n\n case 38:\n 0 === n + b + m && (r = I = 1, y = '\\f' + y);\n break;\n\n case 108:\n if (0 === n + b + m + E && 0 < u) switch (l - u) {\n case 2:\n 112 === x && 58 === e.charCodeAt(l - 3) && (E = x);\n\n case 8:\n 111 === K && (E = K);\n }\n break;\n\n case 58:\n 0 === n + b + m && (u = l);\n break;\n\n case 44:\n 0 === b + v + n + m && (r = 1, y += '\\r');\n break;\n\n case 34:\n case 39:\n 0 === b && (n = n === g ? 0 : 0 === n ? g : n);\n break;\n\n case 91:\n 0 === n + b + v && m++;\n break;\n\n case 93:\n 0 === n + b + v && m--;\n break;\n\n case 41:\n 0 === n + b + m && v--;\n break;\n\n case 40:\n if (0 === n + b + m) {\n if (0 === q) switch (2 * x + 3 * K) {\n case 533:\n break;\n\n default:\n q = 1;\n }\n v++;\n }\n\n break;\n\n case 64:\n 0 === b + v + n + m + u + k && (k = 1);\n break;\n\n case 42:\n case 47:\n if (!(0 < n + m + v)) switch (b) {\n case 0:\n switch (2 * g + 3 * e.charCodeAt(l + 1)) {\n case 235:\n b = 47;\n break;\n\n case 220:\n t = l, b = 42;\n }\n\n break;\n\n case 42:\n 47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0);\n }\n }\n\n 0 === b && (f += y);\n }\n\n K = x;\n x = g;\n l++;\n }\n\n t = p.length;\n\n if (0 < t) {\n r = c;\n if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F;\n p = r.join(',') + '{' + p + '}';\n\n if (0 !== w * E) {\n 2 !== w || L(p, 2) || (E = 0);\n\n switch (E) {\n case 111:\n p = p.replace(ha, ':-moz-$1') + p;\n break;\n\n case 112:\n p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p;\n }\n\n E = 0;\n }\n }\n\n return G + p + F;\n }\n\n function X(d, c, e) {\n var h = c.trim().split(ia);\n c = h;\n var a = h.length,\n m = d.length;\n\n switch (m) {\n case 0:\n case 1:\n var b = 0;\n\n for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) {\n c[b] = Z(d, c[b], e).trim();\n }\n\n break;\n\n default:\n var v = b = 0;\n\n for (c = []; b < a; ++b) {\n for (var n = 0; n < m; ++n) {\n c[v++] = Z(d[n] + ' ', h[b], e).trim();\n }\n }\n\n }\n\n return c;\n }\n\n function Z(d, c, e) {\n var h = c.charCodeAt(0);\n 33 > h && (h = (c = c.trim()).charCodeAt(0));\n\n switch (h) {\n case 38:\n return c.replace(F, '$1' + d.trim());\n\n case 58:\n return d.trim() + c.replace(F, '$1' + d.trim());\n\n default:\n if (0 < 1 * e && 0 < c.indexOf('\\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim());\n }\n\n return d + c;\n }\n\n function P(d, c, e, h) {\n var a = d + ';',\n m = 2 * c + 3 * e + 4 * h;\n\n if (944 === m) {\n d = a.indexOf(':', 9) + 1;\n var b = a.substring(d, a.length - 1).trim();\n b = a.substring(0, d).trim() + b + ';';\n return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b;\n }\n\n if (0 === w || 2 === w && !L(a, 1)) return a;\n\n switch (m) {\n case 1015:\n return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a;\n\n case 951:\n return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a;\n\n case 963:\n return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a;\n\n case 1009:\n if (100 !== a.charCodeAt(4)) break;\n\n case 969:\n case 942:\n return '-webkit-' + a + a;\n\n case 978:\n return '-webkit-' + a + '-moz-' + a + a;\n\n case 1019:\n case 983:\n return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a;\n\n case 883:\n if (45 === a.charCodeAt(8)) return '-webkit-' + a + a;\n if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a;\n break;\n\n case 932:\n if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) {\n case 103:\n return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a;\n\n case 115:\n return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a;\n\n case 98:\n return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a;\n }\n return '-webkit-' + a + '-ms-' + a + a;\n\n case 964:\n return '-webkit-' + a + '-ms-flex-' + a + a;\n\n case 1023:\n if (99 !== a.charCodeAt(8)) break;\n b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify');\n return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a;\n\n case 1005:\n return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a;\n\n case 1e3:\n b = a.substring(13).trim();\n c = b.indexOf('-') + 1;\n\n switch (b.charCodeAt(0) + b.charCodeAt(c)) {\n case 226:\n b = a.replace(G, 'tb');\n break;\n\n case 232:\n b = a.replace(G, 'tb-rl');\n break;\n\n case 220:\n b = a.replace(G, 'lr');\n break;\n\n default:\n return a;\n }\n\n return '-webkit-' + a + '-ms-' + b + a;\n\n case 1017:\n if (-1 === a.indexOf('sticky', 9)) break;\n\n case 975:\n c = (a = d).length - 10;\n b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim();\n\n switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) {\n case 203:\n if (111 > b.charCodeAt(8)) break;\n\n case 115:\n a = a.replace(b, '-webkit-' + b) + ';' + a;\n break;\n\n case 207:\n case 102:\n a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a;\n }\n\n return a + ';';\n\n case 938:\n if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) {\n case 105:\n return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a;\n\n case 115:\n return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a;\n\n default:\n return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a;\n }\n break;\n\n case 973:\n case 989:\n if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break;\n\n case 931:\n case 953:\n if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a;\n break;\n\n case 962:\n if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a;\n }\n\n return a;\n }\n\n function L(d, c) {\n var e = d.indexOf(1 === c ? ':' : '{'),\n h = d.substring(0, 3 !== c ? e : 10);\n e = d.substring(e + 1, d.length - 1);\n return R(2 !== c ? h : h.replace(na, '$1'), e, c);\n }\n\n function ea(d, c) {\n var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2));\n return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')';\n }\n\n function H(d, c, e, h, a, m, b, v, n, q) {\n for (var g = 0, x = c, w; g < A; ++g) {\n switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) {\n case void 0:\n case !1:\n case !0:\n case null:\n break;\n\n default:\n x = w;\n }\n }\n\n if (x !== c) return x;\n }\n\n function T(d) {\n switch (d) {\n case void 0:\n case null:\n A = S.length = 0;\n break;\n\n default:\n if ('function' === typeof d) S[A++] = d;else if ('object' === typeof d) for (var c = 0, e = d.length; c < e; ++c) {\n T(d[c]);\n } else Y = !!d | 0;\n }\n\n return T;\n }\n\n function U(d) {\n d = d.prefix;\n void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0);\n return U;\n }\n\n function B(d, c) {\n var e = d;\n 33 > e.charCodeAt(0) && (e = e.trim());\n V = e;\n e = [V];\n\n if (0 < A) {\n var h = H(-1, c, e, e, D, z, 0, 0, 0, 0);\n void 0 !== h && 'string' === typeof h && (c = h);\n }\n\n var a = M(O, e, c, 0, 0);\n 0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h));\n V = '';\n E = 0;\n z = D = 1;\n return a;\n }\n\n var ca = /^\\0+/g,\n N = /[\\0\\r\\f]/g,\n aa = /: */g,\n ka = /zoo|gra/,\n ma = /([,: ])(transform)/g,\n ia = /,\\r+?/g,\n F = /([\\t\\r\\n ])*\\f?&/g,\n fa = /@(k\\w+)\\s*(\\S*)\\s*/,\n Q = /::(place)/g,\n ha = /:(read-only)/g,\n G = /[svh]\\w+-[tblr]{2}/,\n da = /\\(\\s*(.*)\\s*\\)/g,\n oa = /([\\s\\S]*?);/g,\n ba = /-self|flex-/g,\n na = /[^]*?(:[rp][el]a[\\w-]+)[^]*/,\n la = /stretch|:\\s*\\w+\\-(?:conte|avail)/,\n ja = /([^-])(image-set\\()/,\n z = 1,\n D = 1,\n E = 0,\n w = 1,\n O = [],\n S = [],\n A = 0,\n R = null,\n Y = 0,\n V = '';\n B.use = T;\n B.set = U;\n void 0 !== W && U(W);\n return B;\n}\n\nexport default stylis_min;\n","var unitlessKeys = {\n animationIterationCount: 1,\n borderImageOutset: 1,\n borderImageSlice: 1,\n borderImageWidth: 1,\n boxFlex: 1,\n boxFlexGroup: 1,\n boxOrdinalGroup: 1,\n columnCount: 1,\n columns: 1,\n flex: 1,\n flexGrow: 1,\n flexPositive: 1,\n flexShrink: 1,\n flexNegative: 1,\n flexOrder: 1,\n gridRow: 1,\n gridRowEnd: 1,\n gridRowSpan: 1,\n gridRowStart: 1,\n gridColumn: 1,\n gridColumnEnd: 1,\n gridColumnSpan: 1,\n gridColumnStart: 1,\n msGridRow: 1,\n msGridRowSpan: 1,\n msGridColumn: 1,\n msGridColumnSpan: 1,\n fontWeight: 1,\n lineHeight: 1,\n opacity: 1,\n order: 1,\n orphans: 1,\n tabSize: 1,\n widows: 1,\n zIndex: 1,\n zoom: 1,\n WebkitLineClamp: 1,\n // SVG-related properties\n fillOpacity: 1,\n floodOpacity: 1,\n stopOpacity: 1,\n strokeDasharray: 1,\n strokeDashoffset: 1,\n strokeMiterlimit: 1,\n strokeOpacity: 1,\n strokeWidth: 1\n};\n\nexport default unitlessKeys;\n","var objectKeys = require('object-keys');\nvar isArguments = require('is-arguments');\nvar is = require('object-is');\nvar isRegex = require('is-regex');\nvar flags = require('regexp.prototype.flags');\nvar isDate = require('is-date-object');\n\nvar getTime = Date.prototype.getTime;\n\nfunction deepEqual(actual, expected, options) {\n var opts = options || {};\n\n // 7.1. All identical values are equivalent, as determined by ===.\n if (opts.strict ? is(actual, expected) : actual === expected) {\n return true;\n }\n\n // 7.3. Other pairs that do not both pass typeof value == 'object', equivalence is determined by ==.\n if (!actual || !expected || (typeof actual !== 'object' && typeof expected !== 'object')) {\n return opts.strict ? is(actual, expected) : actual == expected;\n }\n\n /*\n * 7.4. For all other Object pairs, including Array objects, equivalence is\n * determined by having the same number of owned properties (as verified\n * with Object.prototype.hasOwnProperty.call), the same set of keys\n * (although not necessarily the same order), equivalent values for every\n * corresponding key, and an identical 'prototype' property. Note: this\n * accounts for both named and indexed properties on Arrays.\n */\n // eslint-disable-next-line no-use-before-define\n return objEquiv(actual, expected, opts);\n}\n\nfunction isUndefinedOrNull(value) {\n return value === null || value === undefined;\n}\n\nfunction isBuffer(x) {\n if (!x || typeof x !== 'object' || typeof x.length !== 'number') {\n return false;\n }\n if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {\n return false;\n }\n if (x.length > 0 && typeof x[0] !== 'number') {\n return false;\n }\n return true;\n}\n\nfunction objEquiv(a, b, opts) {\n /* eslint max-statements: [2, 50] */\n var i, key;\n if (typeof a !== typeof b) { return false; }\n if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) { return false; }\n\n // an identical 'prototype' property.\n if (a.prototype !== b.prototype) { return false; }\n\n if (isArguments(a) !== isArguments(b)) { return false; }\n\n var aIsRegex = isRegex(a);\n var bIsRegex = isRegex(b);\n if (aIsRegex !== bIsRegex) { return false; }\n if (aIsRegex || bIsRegex) {\n return a.source === b.source && flags(a) === flags(b);\n }\n\n if (isDate(a) && isDate(b)) {\n return getTime.call(a) === getTime.call(b);\n }\n\n var aIsBuffer = isBuffer(a);\n var bIsBuffer = isBuffer(b);\n if (aIsBuffer !== bIsBuffer) { return false; }\n if (aIsBuffer || bIsBuffer) { // && would work too, because both are true or both false here\n if (a.length !== b.length) { return false; }\n for (i = 0; i < a.length; i++) {\n if (a[i] !== b[i]) { return false; }\n }\n return true;\n }\n\n if (typeof a !== typeof b) { return false; }\n\n try {\n var ka = objectKeys(a);\n var kb = objectKeys(b);\n } catch (e) { // happens when one is a string literal and the other isn't\n return false;\n }\n // having the same number of owned properties (keys incorporates hasOwnProperty)\n if (ka.length !== kb.length) { return false; }\n\n // the same set of keys (although not necessarily the same order),\n ka.sort();\n kb.sort();\n // ~~~cheap key test\n for (i = ka.length - 1; i >= 0; i--) {\n if (ka[i] != kb[i]) { return false; }\n }\n // equivalent values for every corresponding key, and ~~~possibly expensive deep test\n for (i = ka.length - 1; i >= 0; i--) {\n key = ka[i];\n if (!deepEqual(a[key], b[key], opts)) { return false; }\n }\n\n return true;\n}\n\nmodule.exports = deepEqual;\n","var global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n})({});\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","'use strict';\n\n// do not edit .js files directly - edit src/index.jst\n\n\n\nmodule.exports = function equal(a, b) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n if (a.constructor !== b.constructor) return false;\n\n var length, i, keys;\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (!equal(a[i], b[i])) return false;\n return true;\n }\n\n\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n\n for (i = length; i-- !== 0;) {\n var key = keys[i];\n\n if (key === '_owner' && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner.\n // _owner contains circular references\n // and is not needed when comparing the actual elements (and not their owners)\n continue;\n }\n\n if (!equal(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a!==a && b!==b;\n};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","'use strict';\n\nmodule.exports = require('./src/js/main');\n","/**\r\n * A collection of shims that provide minimal functionality of the ES6 collections.\r\n *\r\n * These implementations are not meant to be used outside of the ResizeObserver\r\n * modules as they cover only a limited range of use cases.\r\n */\r\n/* eslint-disable require-jsdoc, valid-jsdoc */\r\nvar MapShim = (function () {\r\n if (typeof Map !== 'undefined') {\r\n return Map;\r\n }\r\n /**\r\n * Returns index in provided array that matches the specified key.\r\n *\r\n * @param {Array} arr\r\n * @param {*} key\r\n * @returns {number}\r\n */\r\n function getIndex(arr, key) {\r\n var result = -1;\r\n arr.some(function (entry, index) {\r\n if (entry[0] === key) {\r\n result = index;\r\n return true;\r\n }\r\n return false;\r\n });\r\n return result;\r\n }\r\n return /** @class */ (function () {\r\n function class_1() {\r\n this.__entries__ = [];\r\n }\r\n Object.defineProperty(class_1.prototype, \"size\", {\r\n /**\r\n * @returns {boolean}\r\n */\r\n get: function () {\r\n return this.__entries__.length;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * @param {*} key\r\n * @returns {*}\r\n */\r\n class_1.prototype.get = function (key) {\r\n var index = getIndex(this.__entries__, key);\r\n var entry = this.__entries__[index];\r\n return entry && entry[1];\r\n };\r\n /**\r\n * @param {*} key\r\n * @param {*} value\r\n * @returns {void}\r\n */\r\n class_1.prototype.set = function (key, value) {\r\n var index = getIndex(this.__entries__, key);\r\n if (~index) {\r\n this.__entries__[index][1] = value;\r\n }\r\n else {\r\n this.__entries__.push([key, value]);\r\n }\r\n };\r\n /**\r\n * @param {*} key\r\n * @returns {void}\r\n */\r\n class_1.prototype.delete = function (key) {\r\n var entries = this.__entries__;\r\n var index = getIndex(entries, key);\r\n if (~index) {\r\n entries.splice(index, 1);\r\n }\r\n };\r\n /**\r\n * @param {*} key\r\n * @returns {void}\r\n */\r\n class_1.prototype.has = function (key) {\r\n return !!~getIndex(this.__entries__, key);\r\n };\r\n /**\r\n * @returns {void}\r\n */\r\n class_1.prototype.clear = function () {\r\n this.__entries__.splice(0);\r\n };\r\n /**\r\n * @param {Function} callback\r\n * @param {*} [ctx=null]\r\n * @returns {void}\r\n */\r\n class_1.prototype.forEach = function (callback, ctx) {\r\n if (ctx === void 0) { ctx = null; }\r\n for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {\r\n var entry = _a[_i];\r\n callback.call(ctx, entry[1], entry[0]);\r\n }\r\n };\r\n return class_1;\r\n }());\r\n})();\n\n/**\r\n * Detects whether window and document objects are available in current environment.\r\n */\r\nvar isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;\n\n// Returns global object of a current environment.\r\nvar global$1 = (function () {\r\n if (typeof global !== 'undefined' && global.Math === Math) {\r\n return global;\r\n }\r\n if (typeof self !== 'undefined' && self.Math === Math) {\r\n return self;\r\n }\r\n if (typeof window !== 'undefined' && window.Math === Math) {\r\n return window;\r\n }\r\n // eslint-disable-next-line no-new-func\r\n return Function('return this')();\r\n})();\n\n/**\r\n * A shim for the requestAnimationFrame which falls back to the setTimeout if\r\n * first one is not supported.\r\n *\r\n * @returns {number} Requests' identifier.\r\n */\r\nvar requestAnimationFrame$1 = (function () {\r\n if (typeof requestAnimationFrame === 'function') {\r\n // It's required to use a bounded function because IE sometimes throws\r\n // an \"Invalid calling object\" error if rAF is invoked without the global\r\n // object on the left hand side.\r\n return requestAnimationFrame.bind(global$1);\r\n }\r\n return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };\r\n})();\n\n// Defines minimum timeout before adding a trailing call.\r\nvar trailingTimeout = 2;\r\n/**\r\n * Creates a wrapper function which ensures that provided callback will be\r\n * invoked only once during the specified delay period.\r\n *\r\n * @param {Function} callback - Function to be invoked after the delay period.\r\n * @param {number} delay - Delay after which to invoke callback.\r\n * @returns {Function}\r\n */\r\nfunction throttle (callback, delay) {\r\n var leadingCall = false, trailingCall = false, lastCallTime = 0;\r\n /**\r\n * Invokes the original callback function and schedules new invocation if\r\n * the \"proxy\" was called during current request.\r\n *\r\n * @returns {void}\r\n */\r\n function resolvePending() {\r\n if (leadingCall) {\r\n leadingCall = false;\r\n callback();\r\n }\r\n if (trailingCall) {\r\n proxy();\r\n }\r\n }\r\n /**\r\n * Callback invoked after the specified delay. It will further postpone\r\n * invocation of the original function delegating it to the\r\n * requestAnimationFrame.\r\n *\r\n * @returns {void}\r\n */\r\n function timeoutCallback() {\r\n requestAnimationFrame$1(resolvePending);\r\n }\r\n /**\r\n * Schedules invocation of the original function.\r\n *\r\n * @returns {void}\r\n */\r\n function proxy() {\r\n var timeStamp = Date.now();\r\n if (leadingCall) {\r\n // Reject immediately following calls.\r\n if (timeStamp - lastCallTime < trailingTimeout) {\r\n return;\r\n }\r\n // Schedule new call to be in invoked when the pending one is resolved.\r\n // This is important for \"transitions\" which never actually start\r\n // immediately so there is a chance that we might miss one if change\r\n // happens amids the pending invocation.\r\n trailingCall = true;\r\n }\r\n else {\r\n leadingCall = true;\r\n trailingCall = false;\r\n setTimeout(timeoutCallback, delay);\r\n }\r\n lastCallTime = timeStamp;\r\n }\r\n return proxy;\r\n}\n\n// Minimum delay before invoking the update of observers.\r\nvar REFRESH_DELAY = 20;\r\n// A list of substrings of CSS properties used to find transition events that\r\n// might affect dimensions of observed elements.\r\nvar transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];\r\n// Check if MutationObserver is available.\r\nvar mutationObserverSupported = typeof MutationObserver !== 'undefined';\r\n/**\r\n * Singleton controller class which handles updates of ResizeObserver instances.\r\n */\r\nvar ResizeObserverController = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of ResizeObserverController.\r\n *\r\n * @private\r\n */\r\n function ResizeObserverController() {\r\n /**\r\n * Indicates whether DOM listeners have been added.\r\n *\r\n * @private {boolean}\r\n */\r\n this.connected_ = false;\r\n /**\r\n * Tells that controller has subscribed for Mutation Events.\r\n *\r\n * @private {boolean}\r\n */\r\n this.mutationEventsAdded_ = false;\r\n /**\r\n * Keeps reference to the instance of MutationObserver.\r\n *\r\n * @private {MutationObserver}\r\n */\r\n this.mutationsObserver_ = null;\r\n /**\r\n * A list of connected observers.\r\n *\r\n * @private {Array}\r\n */\r\n this.observers_ = [];\r\n this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);\r\n this.refresh = throttle(this.refresh.bind(this), REFRESH_DELAY);\r\n }\r\n /**\r\n * Adds observer to observers list.\r\n *\r\n * @param {ResizeObserverSPI} observer - Observer to be added.\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.addObserver = function (observer) {\r\n if (!~this.observers_.indexOf(observer)) {\r\n this.observers_.push(observer);\r\n }\r\n // Add listeners if they haven't been added yet.\r\n if (!this.connected_) {\r\n this.connect_();\r\n }\r\n };\r\n /**\r\n * Removes observer from observers list.\r\n *\r\n * @param {ResizeObserverSPI} observer - Observer to be removed.\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.removeObserver = function (observer) {\r\n var observers = this.observers_;\r\n var index = observers.indexOf(observer);\r\n // Remove observer if it's present in registry.\r\n if (~index) {\r\n observers.splice(index, 1);\r\n }\r\n // Remove listeners if controller has no connected observers.\r\n if (!observers.length && this.connected_) {\r\n this.disconnect_();\r\n }\r\n };\r\n /**\r\n * Invokes the update of observers. It will continue running updates insofar\r\n * it detects changes.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.refresh = function () {\r\n var changesDetected = this.updateObservers_();\r\n // Continue running updates if changes have been detected as there might\r\n // be future ones caused by CSS transitions.\r\n if (changesDetected) {\r\n this.refresh();\r\n }\r\n };\r\n /**\r\n * Updates every observer from observers list and notifies them of queued\r\n * entries.\r\n *\r\n * @private\r\n * @returns {boolean} Returns \"true\" if any observer has detected changes in\r\n * dimensions of it's elements.\r\n */\r\n ResizeObserverController.prototype.updateObservers_ = function () {\r\n // Collect observers that have active observations.\r\n var activeObservers = this.observers_.filter(function (observer) {\r\n return observer.gatherActive(), observer.hasActive();\r\n });\r\n // Deliver notifications in a separate cycle in order to avoid any\r\n // collisions between observers, e.g. when multiple instances of\r\n // ResizeObserver are tracking the same element and the callback of one\r\n // of them changes content dimensions of the observed target. Sometimes\r\n // this may result in notifications being blocked for the rest of observers.\r\n activeObservers.forEach(function (observer) { return observer.broadcastActive(); });\r\n return activeObservers.length > 0;\r\n };\r\n /**\r\n * Initializes DOM listeners.\r\n *\r\n * @private\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.connect_ = function () {\r\n // Do nothing if running in a non-browser environment or if listeners\r\n // have been already added.\r\n if (!isBrowser || this.connected_) {\r\n return;\r\n }\r\n // Subscription to the \"Transitionend\" event is used as a workaround for\r\n // delayed transitions. This way it's possible to capture at least the\r\n // final state of an element.\r\n document.addEventListener('transitionend', this.onTransitionEnd_);\r\n window.addEventListener('resize', this.refresh);\r\n if (mutationObserverSupported) {\r\n this.mutationsObserver_ = new MutationObserver(this.refresh);\r\n this.mutationsObserver_.observe(document, {\r\n attributes: true,\r\n childList: true,\r\n characterData: true,\r\n subtree: true\r\n });\r\n }\r\n else {\r\n document.addEventListener('DOMSubtreeModified', this.refresh);\r\n this.mutationEventsAdded_ = true;\r\n }\r\n this.connected_ = true;\r\n };\r\n /**\r\n * Removes DOM listeners.\r\n *\r\n * @private\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.disconnect_ = function () {\r\n // Do nothing if running in a non-browser environment or if listeners\r\n // have been already removed.\r\n if (!isBrowser || !this.connected_) {\r\n return;\r\n }\r\n document.removeEventListener('transitionend', this.onTransitionEnd_);\r\n window.removeEventListener('resize', this.refresh);\r\n if (this.mutationsObserver_) {\r\n this.mutationsObserver_.disconnect();\r\n }\r\n if (this.mutationEventsAdded_) {\r\n document.removeEventListener('DOMSubtreeModified', this.refresh);\r\n }\r\n this.mutationsObserver_ = null;\r\n this.mutationEventsAdded_ = false;\r\n this.connected_ = false;\r\n };\r\n /**\r\n * \"Transitionend\" event handler.\r\n *\r\n * @private\r\n * @param {TransitionEvent} event\r\n * @returns {void}\r\n */\r\n ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {\r\n var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;\r\n // Detect whether transition may affect dimensions of an element.\r\n var isReflowProperty = transitionKeys.some(function (key) {\r\n return !!~propertyName.indexOf(key);\r\n });\r\n if (isReflowProperty) {\r\n this.refresh();\r\n }\r\n };\r\n /**\r\n * Returns instance of the ResizeObserverController.\r\n *\r\n * @returns {ResizeObserverController}\r\n */\r\n ResizeObserverController.getInstance = function () {\r\n if (!this.instance_) {\r\n this.instance_ = new ResizeObserverController();\r\n }\r\n return this.instance_;\r\n };\r\n /**\r\n * Holds reference to the controller's instance.\r\n *\r\n * @private {ResizeObserverController}\r\n */\r\n ResizeObserverController.instance_ = null;\r\n return ResizeObserverController;\r\n}());\n\n/**\r\n * Defines non-writable/enumerable properties of the provided target object.\r\n *\r\n * @param {Object} target - Object for which to define properties.\r\n * @param {Object} props - Properties to be defined.\r\n * @returns {Object} Target object.\r\n */\r\nvar defineConfigurable = (function (target, props) {\r\n for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n Object.defineProperty(target, key, {\r\n value: props[key],\r\n enumerable: false,\r\n writable: false,\r\n configurable: true\r\n });\r\n }\r\n return target;\r\n});\n\n/**\r\n * Returns the global object associated with provided element.\r\n *\r\n * @param {Object} target\r\n * @returns {Object}\r\n */\r\nvar getWindowOf = (function (target) {\r\n // Assume that the element is an instance of Node, which means that it\r\n // has the \"ownerDocument\" property from which we can retrieve a\r\n // corresponding global object.\r\n var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;\r\n // Return the local global object if it's not possible extract one from\r\n // provided element.\r\n return ownerGlobal || global$1;\r\n});\n\n// Placeholder of an empty content rectangle.\r\nvar emptyRect = createRectInit(0, 0, 0, 0);\r\n/**\r\n * Converts provided string to a number.\r\n *\r\n * @param {number|string} value\r\n * @returns {number}\r\n */\r\nfunction toFloat(value) {\r\n return parseFloat(value) || 0;\r\n}\r\n/**\r\n * Extracts borders size from provided styles.\r\n *\r\n * @param {CSSStyleDeclaration} styles\r\n * @param {...string} positions - Borders positions (top, right, ...)\r\n * @returns {number}\r\n */\r\nfunction getBordersSize(styles) {\r\n var positions = [];\r\n for (var _i = 1; _i < arguments.length; _i++) {\r\n positions[_i - 1] = arguments[_i];\r\n }\r\n return positions.reduce(function (size, position) {\r\n var value = styles['border-' + position + '-width'];\r\n return size + toFloat(value);\r\n }, 0);\r\n}\r\n/**\r\n * Extracts paddings sizes from provided styles.\r\n *\r\n * @param {CSSStyleDeclaration} styles\r\n * @returns {Object} Paddings box.\r\n */\r\nfunction getPaddings(styles) {\r\n var positions = ['top', 'right', 'bottom', 'left'];\r\n var paddings = {};\r\n for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {\r\n var position = positions_1[_i];\r\n var value = styles['padding-' + position];\r\n paddings[position] = toFloat(value);\r\n }\r\n return paddings;\r\n}\r\n/**\r\n * Calculates content rectangle of provided SVG element.\r\n *\r\n * @param {SVGGraphicsElement} target - Element content rectangle of which needs\r\n * to be calculated.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction getSVGContentRect(target) {\r\n var bbox = target.getBBox();\r\n return createRectInit(0, 0, bbox.width, bbox.height);\r\n}\r\n/**\r\n * Calculates content rectangle of provided HTMLElement.\r\n *\r\n * @param {HTMLElement} target - Element for which to calculate the content rectangle.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction getHTMLElementContentRect(target) {\r\n // Client width & height properties can't be\r\n // used exclusively as they provide rounded values.\r\n var clientWidth = target.clientWidth, clientHeight = target.clientHeight;\r\n // By this condition we can catch all non-replaced inline, hidden and\r\n // detached elements. Though elements with width & height properties less\r\n // than 0.5 will be discarded as well.\r\n //\r\n // Without it we would need to implement separate methods for each of\r\n // those cases and it's not possible to perform a precise and performance\r\n // effective test for hidden elements. E.g. even jQuery's ':visible' filter\r\n // gives wrong results for elements with width & height less than 0.5.\r\n if (!clientWidth && !clientHeight) {\r\n return emptyRect;\r\n }\r\n var styles = getWindowOf(target).getComputedStyle(target);\r\n var paddings = getPaddings(styles);\r\n var horizPad = paddings.left + paddings.right;\r\n var vertPad = paddings.top + paddings.bottom;\r\n // Computed styles of width & height are being used because they are the\r\n // only dimensions available to JS that contain non-rounded values. It could\r\n // be possible to utilize the getBoundingClientRect if only it's data wasn't\r\n // affected by CSS transformations let alone paddings, borders and scroll bars.\r\n var width = toFloat(styles.width), height = toFloat(styles.height);\r\n // Width & height include paddings and borders when the 'border-box' box\r\n // model is applied (except for IE).\r\n if (styles.boxSizing === 'border-box') {\r\n // Following conditions are required to handle Internet Explorer which\r\n // doesn't include paddings and borders to computed CSS dimensions.\r\n //\r\n // We can say that if CSS dimensions + paddings are equal to the \"client\"\r\n // properties then it's either IE, and thus we don't need to subtract\r\n // anything, or an element merely doesn't have paddings/borders styles.\r\n if (Math.round(width + horizPad) !== clientWidth) {\r\n width -= getBordersSize(styles, 'left', 'right') + horizPad;\r\n }\r\n if (Math.round(height + vertPad) !== clientHeight) {\r\n height -= getBordersSize(styles, 'top', 'bottom') + vertPad;\r\n }\r\n }\r\n // Following steps can't be applied to the document's root element as its\r\n // client[Width/Height] properties represent viewport area of the window.\r\n // Besides, it's as well not necessary as the itself neither has\r\n // rendered scroll bars nor it can be clipped.\r\n if (!isDocumentElement(target)) {\r\n // In some browsers (only in Firefox, actually) CSS width & height\r\n // include scroll bars size which can be removed at this step as scroll\r\n // bars are the only difference between rounded dimensions + paddings\r\n // and \"client\" properties, though that is not always true in Chrome.\r\n var vertScrollbar = Math.round(width + horizPad) - clientWidth;\r\n var horizScrollbar = Math.round(height + vertPad) - clientHeight;\r\n // Chrome has a rather weird rounding of \"client\" properties.\r\n // E.g. for an element with content width of 314.2px it sometimes gives\r\n // the client width of 315px and for the width of 314.7px it may give\r\n // 314px. And it doesn't happen all the time. So just ignore this delta\r\n // as a non-relevant.\r\n if (Math.abs(vertScrollbar) !== 1) {\r\n width -= vertScrollbar;\r\n }\r\n if (Math.abs(horizScrollbar) !== 1) {\r\n height -= horizScrollbar;\r\n }\r\n }\r\n return createRectInit(paddings.left, paddings.top, width, height);\r\n}\r\n/**\r\n * Checks whether provided element is an instance of the SVGGraphicsElement.\r\n *\r\n * @param {Element} target - Element to be checked.\r\n * @returns {boolean}\r\n */\r\nvar isSVGGraphicsElement = (function () {\r\n // Some browsers, namely IE and Edge, don't have the SVGGraphicsElement\r\n // interface.\r\n if (typeof SVGGraphicsElement !== 'undefined') {\r\n return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };\r\n }\r\n // If it's so, then check that element is at least an instance of the\r\n // SVGElement and that it has the \"getBBox\" method.\r\n // eslint-disable-next-line no-extra-parens\r\n return function (target) { return (target instanceof getWindowOf(target).SVGElement &&\r\n typeof target.getBBox === 'function'); };\r\n})();\r\n/**\r\n * Checks whether provided element is a document element ().\r\n *\r\n * @param {Element} target - Element to be checked.\r\n * @returns {boolean}\r\n */\r\nfunction isDocumentElement(target) {\r\n return target === getWindowOf(target).document.documentElement;\r\n}\r\n/**\r\n * Calculates an appropriate content rectangle for provided html or svg element.\r\n *\r\n * @param {Element} target - Element content rectangle of which needs to be calculated.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction getContentRect(target) {\r\n if (!isBrowser) {\r\n return emptyRect;\r\n }\r\n if (isSVGGraphicsElement(target)) {\r\n return getSVGContentRect(target);\r\n }\r\n return getHTMLElementContentRect(target);\r\n}\r\n/**\r\n * Creates rectangle with an interface of the DOMRectReadOnly.\r\n * Spec: https://drafts.fxtf.org/geometry/#domrectreadonly\r\n *\r\n * @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.\r\n * @returns {DOMRectReadOnly}\r\n */\r\nfunction createReadOnlyRect(_a) {\r\n var x = _a.x, y = _a.y, width = _a.width, height = _a.height;\r\n // If DOMRectReadOnly is available use it as a prototype for the rectangle.\r\n var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;\r\n var rect = Object.create(Constr.prototype);\r\n // Rectangle's properties are not writable and non-enumerable.\r\n defineConfigurable(rect, {\r\n x: x, y: y, width: width, height: height,\r\n top: y,\r\n right: x + width,\r\n bottom: height + y,\r\n left: x\r\n });\r\n return rect;\r\n}\r\n/**\r\n * Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.\r\n * Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit\r\n *\r\n * @param {number} x - X coordinate.\r\n * @param {number} y - Y coordinate.\r\n * @param {number} width - Rectangle's width.\r\n * @param {number} height - Rectangle's height.\r\n * @returns {DOMRectInit}\r\n */\r\nfunction createRectInit(x, y, width, height) {\r\n return { x: x, y: y, width: width, height: height };\r\n}\n\n/**\r\n * Class that is responsible for computations of the content rectangle of\r\n * provided DOM element and for keeping track of it's changes.\r\n */\r\nvar ResizeObservation = /** @class */ (function () {\r\n /**\r\n * Creates an instance of ResizeObservation.\r\n *\r\n * @param {Element} target - Element to be observed.\r\n */\r\n function ResizeObservation(target) {\r\n /**\r\n * Broadcasted width of content rectangle.\r\n *\r\n * @type {number}\r\n */\r\n this.broadcastWidth = 0;\r\n /**\r\n * Broadcasted height of content rectangle.\r\n *\r\n * @type {number}\r\n */\r\n this.broadcastHeight = 0;\r\n /**\r\n * Reference to the last observed content rectangle.\r\n *\r\n * @private {DOMRectInit}\r\n */\r\n this.contentRect_ = createRectInit(0, 0, 0, 0);\r\n this.target = target;\r\n }\r\n /**\r\n * Updates content rectangle and tells whether it's width or height properties\r\n * have changed since the last broadcast.\r\n *\r\n * @returns {boolean}\r\n */\r\n ResizeObservation.prototype.isActive = function () {\r\n var rect = getContentRect(this.target);\r\n this.contentRect_ = rect;\r\n return (rect.width !== this.broadcastWidth ||\r\n rect.height !== this.broadcastHeight);\r\n };\r\n /**\r\n * Updates 'broadcastWidth' and 'broadcastHeight' properties with a data\r\n * from the corresponding properties of the last observed content rectangle.\r\n *\r\n * @returns {DOMRectInit} Last observed content rectangle.\r\n */\r\n ResizeObservation.prototype.broadcastRect = function () {\r\n var rect = this.contentRect_;\r\n this.broadcastWidth = rect.width;\r\n this.broadcastHeight = rect.height;\r\n return rect;\r\n };\r\n return ResizeObservation;\r\n}());\n\nvar ResizeObserverEntry = /** @class */ (function () {\r\n /**\r\n * Creates an instance of ResizeObserverEntry.\r\n *\r\n * @param {Element} target - Element that is being observed.\r\n * @param {DOMRectInit} rectInit - Data of the element's content rectangle.\r\n */\r\n function ResizeObserverEntry(target, rectInit) {\r\n var contentRect = createReadOnlyRect(rectInit);\r\n // According to the specification following properties are not writable\r\n // and are also not enumerable in the native implementation.\r\n //\r\n // Property accessors are not being used as they'd require to define a\r\n // private WeakMap storage which may cause memory leaks in browsers that\r\n // don't support this type of collections.\r\n defineConfigurable(this, { target: target, contentRect: contentRect });\r\n }\r\n return ResizeObserverEntry;\r\n}());\n\nvar ResizeObserverSPI = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of ResizeObserver.\r\n *\r\n * @param {ResizeObserverCallback} callback - Callback function that is invoked\r\n * when one of the observed elements changes it's content dimensions.\r\n * @param {ResizeObserverController} controller - Controller instance which\r\n * is responsible for the updates of observer.\r\n * @param {ResizeObserver} callbackCtx - Reference to the public\r\n * ResizeObserver instance which will be passed to callback function.\r\n */\r\n function ResizeObserverSPI(callback, controller, callbackCtx) {\r\n /**\r\n * Collection of resize observations that have detected changes in dimensions\r\n * of elements.\r\n *\r\n * @private {Array}\r\n */\r\n this.activeObservations_ = [];\r\n /**\r\n * Registry of the ResizeObservation instances.\r\n *\r\n * @private {Map}\r\n */\r\n this.observations_ = new MapShim();\r\n if (typeof callback !== 'function') {\r\n throw new TypeError('The callback provided as parameter 1 is not a function.');\r\n }\r\n this.callback_ = callback;\r\n this.controller_ = controller;\r\n this.callbackCtx_ = callbackCtx;\r\n }\r\n /**\r\n * Starts observing provided element.\r\n *\r\n * @param {Element} target - Element to be observed.\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.observe = function (target) {\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n // Do nothing if current environment doesn't have the Element interface.\r\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\r\n return;\r\n }\r\n if (!(target instanceof getWindowOf(target).Element)) {\r\n throw new TypeError('parameter 1 is not of type \"Element\".');\r\n }\r\n var observations = this.observations_;\r\n // Do nothing if element is already being observed.\r\n if (observations.has(target)) {\r\n return;\r\n }\r\n observations.set(target, new ResizeObservation(target));\r\n this.controller_.addObserver(this);\r\n // Force the update of observations.\r\n this.controller_.refresh();\r\n };\r\n /**\r\n * Stops observing provided element.\r\n *\r\n * @param {Element} target - Element to stop observing.\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.unobserve = function (target) {\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n // Do nothing if current environment doesn't have the Element interface.\r\n if (typeof Element === 'undefined' || !(Element instanceof Object)) {\r\n return;\r\n }\r\n if (!(target instanceof getWindowOf(target).Element)) {\r\n throw new TypeError('parameter 1 is not of type \"Element\".');\r\n }\r\n var observations = this.observations_;\r\n // Do nothing if element is not being observed.\r\n if (!observations.has(target)) {\r\n return;\r\n }\r\n observations.delete(target);\r\n if (!observations.size) {\r\n this.controller_.removeObserver(this);\r\n }\r\n };\r\n /**\r\n * Stops observing all elements.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.disconnect = function () {\r\n this.clearActive();\r\n this.observations_.clear();\r\n this.controller_.removeObserver(this);\r\n };\r\n /**\r\n * Collects observation instances the associated element of which has changed\r\n * it's content rectangle.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.gatherActive = function () {\r\n var _this = this;\r\n this.clearActive();\r\n this.observations_.forEach(function (observation) {\r\n if (observation.isActive()) {\r\n _this.activeObservations_.push(observation);\r\n }\r\n });\r\n };\r\n /**\r\n * Invokes initial callback function with a list of ResizeObserverEntry\r\n * instances collected from active resize observations.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.broadcastActive = function () {\r\n // Do nothing if observer doesn't have active observations.\r\n if (!this.hasActive()) {\r\n return;\r\n }\r\n var ctx = this.callbackCtx_;\r\n // Create ResizeObserverEntry instance for every active observation.\r\n var entries = this.activeObservations_.map(function (observation) {\r\n return new ResizeObserverEntry(observation.target, observation.broadcastRect());\r\n });\r\n this.callback_.call(ctx, entries, ctx);\r\n this.clearActive();\r\n };\r\n /**\r\n * Clears the collection of active observations.\r\n *\r\n * @returns {void}\r\n */\r\n ResizeObserverSPI.prototype.clearActive = function () {\r\n this.activeObservations_.splice(0);\r\n };\r\n /**\r\n * Tells whether observer has active observations.\r\n *\r\n * @returns {boolean}\r\n */\r\n ResizeObserverSPI.prototype.hasActive = function () {\r\n return this.activeObservations_.length > 0;\r\n };\r\n return ResizeObserverSPI;\r\n}());\n\n// Registry of internal observers. If WeakMap is not available use current shim\r\n// for the Map collection as it has all required methods and because WeakMap\r\n// can't be fully polyfilled anyway.\r\nvar observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();\r\n/**\r\n * ResizeObserver API. Encapsulates the ResizeObserver SPI implementation\r\n * exposing only those methods and properties that are defined in the spec.\r\n */\r\nvar ResizeObserver = /** @class */ (function () {\r\n /**\r\n * Creates a new instance of ResizeObserver.\r\n *\r\n * @param {ResizeObserverCallback} callback - Callback that is invoked when\r\n * dimensions of the observed elements change.\r\n */\r\n function ResizeObserver(callback) {\r\n if (!(this instanceof ResizeObserver)) {\r\n throw new TypeError('Cannot call a class as a function.');\r\n }\r\n if (!arguments.length) {\r\n throw new TypeError('1 argument required, but only 0 present.');\r\n }\r\n var controller = ResizeObserverController.getInstance();\r\n var observer = new ResizeObserverSPI(callback, controller, this);\r\n observers.set(this, observer);\r\n }\r\n return ResizeObserver;\r\n}());\r\n// Expose public methods of ResizeObserver.\r\n[\r\n 'observe',\r\n 'unobserve',\r\n 'disconnect'\r\n].forEach(function (method) {\r\n ResizeObserver.prototype[method] = function () {\r\n var _a;\r\n return (_a = observers.get(this))[method].apply(_a, arguments);\r\n };\r\n});\n\nvar index = (function () {\r\n // Export existing implementation if available.\r\n if (typeof global$1.ResizeObserver !== 'undefined') {\r\n return global$1.ResizeObserver;\r\n }\r\n return ResizeObserver;\r\n})();\n\nexport default index;\n","import arrayWithHoles from \"./arrayWithHoles\";\nimport iterableToArray from \"./iterableToArray\";\nimport nonIterableRest from \"./nonIterableRest\";\nexport default function _toArray(arr) {\n return arrayWithHoles(arr) || iterableToArray(arr) || nonIterableRest();\n}","import { useRef } from 'react';\nimport useEffectOnce from './useEffectOnce';\nvar useUnmount = function (fn) {\n var fnRef = useRef(fn);\n // update the ref each render so if it change the newest callback will be invoked\n fnRef.current = fn;\n useEffectOnce(function () { return function () { return fnRef.current(); }; });\n};\nexport default useUnmount;\n","/**!\n * easy-pie-chart\n * Lightweight plugin to render simple, animated and retina optimized pie charts\n *\n * @license \n * @author Robert Fleischmann (http://robert-fleischmann.de)\n * @version 2.1.7\n **/\n\n(function (root, factory) {\n if (typeof define === 'function' && define.amd) {\n // AMD. Register as an anonymous module unless amdModuleId is set\n define([], function () {\n return (root['EasyPieChart'] = factory());\n });\n } else if (typeof exports === 'object') {\n // Node. Does not work with strict CommonJS, but\n // only CommonJS-like environments that support module.exports,\n // like Node.\n module.exports = factory();\n } else {\n root['EasyPieChart'] = factory();\n }\n}(this, function () {\n\n/**\n * Renderer to render the chart on a canvas object\n * @param {DOMElement} el DOM element to host the canvas (root of the plugin)\n * @param {object} options options object of the plugin\n */\nvar CanvasRenderer = function(el, options) {\n\tvar cachedBackground;\n\tvar canvas = document.createElement('canvas');\n\n\tel.appendChild(canvas);\n\n\tif (typeof(G_vmlCanvasManager) === 'object') {\n\t\tG_vmlCanvasManager.initElement(canvas);\n\t}\n\n\tvar ctx = canvas.getContext('2d');\n\n\tcanvas.width = canvas.height = options.size;\n\n\t// canvas on retina devices\n\tvar scaleBy = 1;\n\tif (window.devicePixelRatio > 1) {\n\t\tscaleBy = window.devicePixelRatio;\n\t\tcanvas.style.width = canvas.style.height = [options.size, 'px'].join('');\n\t\tcanvas.width = canvas.height = options.size * scaleBy;\n\t\tctx.scale(scaleBy, scaleBy);\n\t}\n\n\t// move 0,0 coordinates to the center\n\tctx.translate(options.size / 2, options.size / 2);\n\n\t// rotate canvas -90deg\n\tctx.rotate((-1 / 2 + options.rotate / 180) * Math.PI);\n\n\tvar radius = (options.size - options.lineWidth) / 2;\n\tif (options.scaleColor && options.scaleLength) {\n\t\tradius -= options.scaleLength + 2; // 2 is the distance between scale and bar\n\t}\n\n\t// IE polyfill for Date\n\tDate.now = Date.now || function() {\n\t\treturn +(new Date());\n\t};\n\n\t/**\n\t * Draw a circle around the center of the canvas\n\t * @param {strong} color Valid CSS color string\n\t * @param {number} lineWidth Width of the line in px\n\t * @param {number} percent Percentage to draw (float between -1 and 1)\n\t */\n\tvar drawCircle = function(color, lineWidth, percent) {\n\t\tpercent = Math.min(Math.max(-1, percent || 0), 1);\n\t\tvar isNegative = percent <= 0 ? true : false;\n\n\t\tctx.beginPath();\n\t\tctx.arc(0, 0, radius, 0, Math.PI * 2 * percent, isNegative);\n\n\t\tctx.strokeStyle = color;\n\t\tctx.lineWidth = lineWidth;\n\n\t\tctx.stroke();\n\t};\n\n\t/**\n\t * Draw the scale of the chart\n\t */\n\tvar drawScale = function() {\n\t\tvar offset;\n\t\tvar length;\n\n\t\tctx.lineWidth = 1;\n\t\tctx.fillStyle = options.scaleColor;\n\n\t\tctx.save();\n\t\tfor (var i = 24; i > 0; --i) {\n\t\t\tif (i % 6 === 0) {\n\t\t\t\tlength = options.scaleLength;\n\t\t\t\toffset = 0;\n\t\t\t} else {\n\t\t\t\tlength = options.scaleLength * 0.6;\n\t\t\t\toffset = options.scaleLength - length;\n\t\t\t}\n\t\t\tctx.fillRect(-options.size/2 + offset, 0, length, 1);\n\t\t\tctx.rotate(Math.PI / 12);\n\t\t}\n\t\tctx.restore();\n\t};\n\n\t/**\n\t * Request animation frame wrapper with polyfill\n\t * @return {function} Request animation frame method or timeout fallback\n\t */\n\tvar reqAnimationFrame = (function() {\n\t\treturn window.requestAnimationFrame ||\n\t\t\t\twindow.webkitRequestAnimationFrame ||\n\t\t\t\twindow.mozRequestAnimationFrame ||\n\t\t\t\tfunction(callback) {\n\t\t\t\t\twindow.setTimeout(callback, 1000 / 60);\n\t\t\t\t};\n\t}());\n\n\t/**\n\t * Draw the background of the plugin including the scale and the track\n\t */\n\tvar drawBackground = function() {\n\t\tif(options.scaleColor) drawScale();\n\t\tif(options.trackColor) drawCircle(options.trackColor, options.trackWidth || options.lineWidth, 1);\n\t};\n\n /**\n * Canvas accessor\n */\n this.getCanvas = function() {\n return canvas;\n };\n\n /**\n * Canvas 2D context 'ctx' accessor\n */\n this.getCtx = function() {\n return ctx;\n };\n\n\t/**\n\t * Clear the complete canvas\n\t */\n\tthis.clear = function() {\n\t\tctx.clearRect(options.size / -2, options.size / -2, options.size, options.size);\n\t};\n\n\t/**\n\t * Draw the complete chart\n\t * @param {number} percent Percent shown by the chart between -100 and 100\n\t */\n\tthis.draw = function(percent) {\n\t\t// do we need to render a background\n\t\tif (!!options.scaleColor || !!options.trackColor) {\n\t\t\t// getImageData and putImageData are supported\n\t\t\tif (ctx.getImageData && ctx.putImageData) {\n\t\t\t\tif (!cachedBackground) {\n\t\t\t\t\tdrawBackground();\n\t\t\t\t\tcachedBackground = ctx.getImageData(0, 0, options.size * scaleBy, options.size * scaleBy);\n\t\t\t\t} else {\n\t\t\t\t\tctx.putImageData(cachedBackground, 0, 0);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthis.clear();\n\t\t\t\tdrawBackground();\n\t\t\t}\n\t\t} else {\n\t\t\tthis.clear();\n\t\t}\n\n\t\tctx.lineCap = options.lineCap;\n\n\t\t// if barcolor is a function execute it and pass the percent as a value\n\t\tvar color;\n\t\tif (typeof(options.barColor) === 'function') {\n\t\t\tcolor = options.barColor(percent);\n\t\t} else {\n\t\t\tcolor = options.barColor;\n\t\t}\n\n\t\t// draw bar\n\t\tdrawCircle(color, options.lineWidth, percent / 100);\n\t}.bind(this);\n\n\t/**\n\t * Animate from some percent to some other percentage\n\t * @param {number} from Starting percentage\n\t * @param {number} to Final percentage\n\t */\n\tthis.animate = function(from, to) {\n\t\tvar startTime = Date.now();\n\t\toptions.onStart(from, to);\n\t\tvar animation = function() {\n\t\t\tvar process = Math.min(Date.now() - startTime, options.animate.duration);\n\t\t\tvar currentValue = options.easing(this, process, from, to - from, options.animate.duration);\n\t\t\tthis.draw(currentValue);\n\t\t\toptions.onStep(from, to, currentValue);\n\t\t\tif (process >= options.animate.duration) {\n\t\t\t\toptions.onStop(from, to);\n\t\t\t} else {\n\t\t\t\treqAnimationFrame(animation);\n\t\t\t}\n\t\t}.bind(this);\n\n\t\treqAnimationFrame(animation);\n\t}.bind(this);\n};\n\nvar EasyPieChart = function(el, opts) {\n\tvar defaultOptions = {\n\t\tbarColor: '#ef1e25',\n\t\ttrackColor: '#f9f9f9',\n\t\tscaleColor: '#dfe0e0',\n\t\tscaleLength: 5,\n\t\tlineCap: 'round',\n\t\tlineWidth: 3,\n\t\ttrackWidth: undefined,\n\t\tsize: 110,\n\t\trotate: 0,\n\t\tanimate: {\n\t\t\tduration: 1000,\n\t\t\tenabled: true\n\t\t},\n\t\teasing: function (x, t, b, c, d) { // more can be found here: http://gsgd.co.uk/sandbox/jquery/easing/\n\t\t\tt = t / (d/2);\n\t\t\tif (t < 1) {\n\t\t\t\treturn c / 2 * t * t + b;\n\t\t\t}\n\t\t\treturn -c/2 * ((--t)*(t-2) - 1) + b;\n\t\t},\n\t\tonStart: function(from, to) {\n\t\t\treturn;\n\t\t},\n\t\tonStep: function(from, to, currentValue) {\n\t\t\treturn;\n\t\t},\n\t\tonStop: function(from, to) {\n\t\t\treturn;\n\t\t}\n\t};\n\n\t// detect present renderer\n\tif (typeof(CanvasRenderer) !== 'undefined') {\n\t\tdefaultOptions.renderer = CanvasRenderer;\n\t} else if (typeof(SVGRenderer) !== 'undefined') {\n\t\tdefaultOptions.renderer = SVGRenderer;\n\t} else {\n\t\tthrow new Error('Please load either the SVG- or the CanvasRenderer');\n\t}\n\n\tvar options = {};\n\tvar currentValue = 0;\n\n\t/**\n\t * Initialize the plugin by creating the options object and initialize rendering\n\t */\n\tvar init = function() {\n\t\tthis.el = el;\n\t\tthis.options = options;\n\n\t\t// merge user options into default options\n\t\tfor (var i in defaultOptions) {\n\t\t\tif (defaultOptions.hasOwnProperty(i)) {\n\t\t\t\toptions[i] = opts && typeof(opts[i]) !== 'undefined' ? opts[i] : defaultOptions[i];\n\t\t\t\tif (typeof(options[i]) === 'function') {\n\t\t\t\t\toptions[i] = options[i].bind(this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// check for jQuery easing\n\t\tif (typeof(options.easing) === 'string' && typeof(jQuery) !== 'undefined' && jQuery.isFunction(jQuery.easing[options.easing])) {\n\t\t\toptions.easing = jQuery.easing[options.easing];\n\t\t} else {\n\t\t\toptions.easing = defaultOptions.easing;\n\t\t}\n\n\t\t// process earlier animate option to avoid bc breaks\n\t\tif (typeof(options.animate) === 'number') {\n\t\t\toptions.animate = {\n\t\t\t\tduration: options.animate,\n\t\t\t\tenabled: true\n\t\t\t};\n\t\t}\n\n\t\tif (typeof(options.animate) === 'boolean' && !options.animate) {\n\t\t\toptions.animate = {\n\t\t\t\tduration: 1000,\n\t\t\t\tenabled: options.animate\n\t\t\t};\n\t\t}\n\n\t\t// create renderer\n\t\tthis.renderer = new options.renderer(el, options);\n\n\t\t// initial draw\n\t\tthis.renderer.draw(currentValue);\n\n\t\t// initial update\n\t\tif (el.dataset && el.dataset.percent) {\n\t\t\tthis.update(parseFloat(el.dataset.percent));\n\t\t} else if (el.getAttribute && el.getAttribute('data-percent')) {\n\t\t\tthis.update(parseFloat(el.getAttribute('data-percent')));\n\t\t}\n\t}.bind(this);\n\n\t/**\n\t * Update the value of the chart\n\t * @param {number} newValue Number between 0 and 100\n\t * @return {object} Instance of the plugin for method chaining\n\t */\n\tthis.update = function(newValue) {\n\t\tnewValue = parseFloat(newValue);\n\t\tif (options.animate.enabled) {\n\t\t\tthis.renderer.animate(currentValue, newValue);\n\t\t} else {\n\t\t\tthis.renderer.draw(newValue);\n\t\t}\n\t\tcurrentValue = newValue;\n\t\treturn this;\n\t}.bind(this);\n\n\t/**\n\t * Disable animation\n\t * @return {object} Instance of the plugin for method chaining\n\t */\n\tthis.disableAnimation = function() {\n\t\toptions.animate.enabled = false;\n\t\treturn this;\n\t};\n\n\t/**\n\t * Enable animation\n\t * @return {object} Instance of the plugin for method chaining\n\t */\n\tthis.enableAnimation = function() {\n\t\toptions.animate.enabled = true;\n\t\treturn this;\n\t};\n\n\tinit();\n};\n\nreturn EasyPieChart;\n\n}));\n","// Generated by CoffeeScript 1.10.0\n(function() {\n var AnimatedText, AnimatedTextFactory, Bar, BaseDonut, BaseGauge, Donut, Gauge, GaugePointer, TextRenderer, ValueUpdater, addCommas, cutHex, formatNumber, mergeObjects, secondsToString,\n slice = [].slice,\n hasProp = {}.hasOwnProperty,\n extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };\n\n (function() {\n var browserRequestAnimationFrame, isCancelled, j, lastId, len, vendor, vendors;\n vendors = ['ms', 'moz', 'webkit', 'o'];\n for (j = 0, len = vendors.length; j < len; j++) {\n vendor = vendors[j];\n if (window.requestAnimationFrame) {\n break;\n }\n window.requestAnimationFrame = window[vendor + 'RequestAnimationFrame'];\n window.cancelAnimationFrame = window[vendor + 'CancelAnimationFrame'] || window[vendor + 'CancelRequestAnimationFrame'];\n }\n browserRequestAnimationFrame = null;\n lastId = 0;\n isCancelled = {};\n if (!requestAnimationFrame) {\n window.requestAnimationFrame = function(callback, element) {\n var currTime, id, lastTime, timeToCall;\n currTime = new Date().getTime();\n timeToCall = Math.max(0, 16 - (currTime - lastTime));\n id = window.setTimeout(function() {\n return callback(currTime + timeToCall);\n }, timeToCall);\n lastTime = currTime + timeToCall;\n return id;\n };\n return window.cancelAnimationFrame = function(id) {\n return clearTimeout(id);\n };\n } else if (!window.cancelAnimationFrame) {\n browserRequestAnimationFrame = window.requestAnimationFrame;\n window.requestAnimationFrame = function(callback, element) {\n var myId;\n myId = ++lastId;\n browserRequestAnimationFrame(function() {\n if (!isCancelled[myId]) {\n return callback();\n }\n }, element);\n return myId;\n };\n return window.cancelAnimationFrame = function(id) {\n return isCancelled[id] = true;\n };\n }\n })();\n\n secondsToString = function(sec) {\n var hr, min;\n hr = Math.floor(sec / 3600);\n min = Math.floor((sec - (hr * 3600)) / 60);\n sec -= (hr * 3600) + (min * 60);\n sec += '';\n min += '';\n while (min.length < 2) {\n min = '0' + min;\n }\n while (sec.length < 2) {\n sec = '0' + sec;\n }\n hr = hr ? hr + ':' : '';\n return hr + min + ':' + sec;\n };\n\n formatNumber = function() {\n var digits, num, value;\n num = 1 <= arguments.length ? slice.call(arguments, 0) : [];\n value = num[0];\n digits = 0 || num[1];\n return addCommas(value.toFixed(digits));\n };\n\n mergeObjects = function(obj1, obj2) {\n var key, out, val;\n out = {};\n for (key in obj1) {\n if (!hasProp.call(obj1, key)) continue;\n val = obj1[key];\n out[key] = val;\n }\n for (key in obj2) {\n if (!hasProp.call(obj2, key)) continue;\n val = obj2[key];\n out[key] = val;\n }\n return out;\n };\n\n addCommas = function(nStr) {\n var rgx, x, x1, x2;\n nStr += '';\n x = nStr.split('.');\n x1 = x[0];\n x2 = '';\n if (x.length > 1) {\n x2 = '.' + x[1];\n }\n rgx = /(\\d+)(\\d{3})/;\n while (rgx.test(x1)) {\n x1 = x1.replace(rgx, '$1' + ',' + '$2');\n }\n return x1 + x2;\n };\n\n cutHex = function(nStr) {\n if (nStr.charAt(0) === \"#\") {\n return nStr.substring(1, 7);\n }\n return nStr;\n };\n\n ValueUpdater = (function() {\n ValueUpdater.prototype.animationSpeed = 32;\n\n function ValueUpdater(addToAnimationQueue, clear) {\n if (addToAnimationQueue == null) {\n addToAnimationQueue = true;\n }\n this.clear = clear != null ? clear : true;\n if (addToAnimationQueue) {\n AnimationUpdater.add(this);\n }\n }\n\n ValueUpdater.prototype.update = function(force) {\n var diff;\n if (force == null) {\n force = false;\n }\n if (force || this.displayedValue !== this.value) {\n if (this.ctx && this.clear) {\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n }\n diff = this.value - this.displayedValue;\n if (Math.abs(diff / this.animationSpeed) <= 0.001) {\n this.displayedValue = this.value;\n } else {\n this.displayedValue = this.displayedValue + diff / this.animationSpeed;\n }\n this.render();\n return true;\n }\n return false;\n };\n\n return ValueUpdater;\n\n })();\n\n BaseGauge = (function(superClass) {\n extend(BaseGauge, superClass);\n\n function BaseGauge() {\n return BaseGauge.__super__.constructor.apply(this, arguments);\n }\n\n BaseGauge.prototype.displayScale = 1;\n\n BaseGauge.prototype.forceUpdate = true;\n\n BaseGauge.prototype.setTextField = function(textField, fractionDigits) {\n return this.textField = textField instanceof TextRenderer ? textField : new TextRenderer(textField, fractionDigits);\n };\n\n BaseGauge.prototype.setMinValue = function(minValue, updateStartValue) {\n var gauge, j, len, ref, results;\n this.minValue = minValue;\n if (updateStartValue == null) {\n updateStartValue = true;\n }\n if (updateStartValue) {\n this.displayedValue = this.minValue;\n ref = this.gp || [];\n results = [];\n for (j = 0, len = ref.length; j < len; j++) {\n gauge = ref[j];\n results.push(gauge.displayedValue = this.minValue);\n }\n return results;\n }\n };\n\n BaseGauge.prototype.setOptions = function(options) {\n if (options == null) {\n options = null;\n }\n this.options = mergeObjects(this.options, options);\n if (this.textField) {\n this.textField.el.style.fontSize = options.fontSize + 'px';\n }\n if (this.options.angle > .5) {\n this.options.angle = .5;\n }\n this.configDisplayScale();\n return this;\n };\n\n BaseGauge.prototype.configDisplayScale = function() {\n var backingStorePixelRatio, devicePixelRatio, height, prevDisplayScale, width;\n prevDisplayScale = this.displayScale;\n if (this.options.highDpiSupport === false) {\n delete this.displayScale;\n } else {\n devicePixelRatio = window.devicePixelRatio || 1;\n backingStorePixelRatio = this.ctx.webkitBackingStorePixelRatio || this.ctx.mozBackingStorePixelRatio || this.ctx.msBackingStorePixelRatio || this.ctx.oBackingStorePixelRatio || this.ctx.backingStorePixelRatio || 1;\n this.displayScale = devicePixelRatio / backingStorePixelRatio;\n }\n if (this.displayScale !== prevDisplayScale) {\n width = this.canvas.G__width || this.canvas.width;\n height = this.canvas.G__height || this.canvas.height;\n this.canvas.width = width * this.displayScale;\n this.canvas.height = height * this.displayScale;\n this.canvas.style.width = width + \"px\";\n this.canvas.style.height = height + \"px\";\n this.canvas.G__width = width;\n this.canvas.G__height = height;\n }\n return this;\n };\n\n BaseGauge.prototype.parseValue = function(value) {\n value = parseFloat(value) || Number(value);\n if (isFinite(value)) {\n return value;\n } else {\n return 0;\n }\n };\n\n return BaseGauge;\n\n })(ValueUpdater);\n\n TextRenderer = (function() {\n function TextRenderer(el, fractionDigits1) {\n this.el = el;\n this.fractionDigits = fractionDigits1;\n }\n\n TextRenderer.prototype.render = function(gauge) {\n return this.el.innerHTML = formatNumber(gauge.displayedValue, this.fractionDigits);\n };\n\n return TextRenderer;\n\n })();\n\n AnimatedText = (function(superClass) {\n extend(AnimatedText, superClass);\n\n AnimatedText.prototype.displayedValue = 0;\n\n AnimatedText.prototype.value = 0;\n\n AnimatedText.prototype.setVal = function(value) {\n return this.value = 1 * value;\n };\n\n function AnimatedText(elem1, text) {\n this.elem = elem1;\n this.text = text != null ? text : false;\n AnimatedText.__super__.constructor.call(this);\n if (this.elem === void 0) {\n throw new Error('The element isn\\'t defined.');\n }\n this.value = 1 * this.elem.innerHTML;\n if (this.text) {\n this.value = 0;\n }\n }\n\n AnimatedText.prototype.render = function() {\n var textVal;\n if (this.text) {\n textVal = secondsToString(this.displayedValue.toFixed(0));\n } else {\n textVal = addCommas(formatNumber(this.displayedValue));\n }\n return this.elem.innerHTML = textVal;\n };\n\n return AnimatedText;\n\n })(ValueUpdater);\n\n AnimatedTextFactory = {\n create: function(objList) {\n var elem, j, len, out;\n out = [];\n for (j = 0, len = objList.length; j < len; j++) {\n elem = objList[j];\n out.push(new AnimatedText(elem));\n }\n return out;\n }\n };\n\n GaugePointer = (function(superClass) {\n extend(GaugePointer, superClass);\n\n GaugePointer.prototype.displayedValue = 0;\n\n GaugePointer.prototype.value = 0;\n\n GaugePointer.prototype.options = {\n strokeWidth: 0.035,\n length: 0.1,\n color: \"#000000\",\n iconPath: null,\n iconScale: 1.0,\n iconAngle: 0\n };\n\n GaugePointer.prototype.img = null;\n\n function GaugePointer(gauge1) {\n this.gauge = gauge1;\n if (this.gauge === void 0) {\n throw new Error('The element isn\\'t defined.');\n }\n this.ctx = this.gauge.ctx;\n this.canvas = this.gauge.canvas;\n GaugePointer.__super__.constructor.call(this, false, false);\n this.setOptions();\n }\n\n GaugePointer.prototype.setOptions = function(options) {\n if (options == null) {\n options = null;\n }\n this.options = mergeObjects(this.options, options);\n this.length = 2 * this.gauge.radius * this.gauge.options.radiusScale * this.options.length;\n this.strokeWidth = this.canvas.height * this.options.strokeWidth;\n this.maxValue = this.gauge.maxValue;\n this.minValue = this.gauge.minValue;\n this.animationSpeed = this.gauge.animationSpeed;\n this.options.angle = this.gauge.options.angle;\n if (this.options.iconPath) {\n this.img = new Image();\n return this.img.src = this.options.iconPath;\n }\n };\n\n GaugePointer.prototype.render = function() {\n var angle, endX, endY, imgX, imgY, startX, startY, x, y;\n angle = this.gauge.getAngle.call(this, this.displayedValue);\n x = Math.round(this.length * Math.cos(angle));\n y = Math.round(this.length * Math.sin(angle));\n startX = Math.round(this.strokeWidth * Math.cos(angle - Math.PI / 2));\n startY = Math.round(this.strokeWidth * Math.sin(angle - Math.PI / 2));\n endX = Math.round(this.strokeWidth * Math.cos(angle + Math.PI / 2));\n endY = Math.round(this.strokeWidth * Math.sin(angle + Math.PI / 2));\n this.ctx.beginPath();\n this.ctx.fillStyle = this.options.color;\n this.ctx.arc(0, 0, this.strokeWidth, 0, Math.PI * 2, false);\n this.ctx.fill();\n this.ctx.beginPath();\n this.ctx.moveTo(startX, startY);\n this.ctx.lineTo(x, y);\n this.ctx.lineTo(endX, endY);\n this.ctx.fill();\n if (this.img) {\n imgX = Math.round(this.img.width * this.options.iconScale);\n imgY = Math.round(this.img.height * this.options.iconScale);\n this.ctx.save();\n this.ctx.translate(x, y);\n this.ctx.rotate(angle + Math.PI / 180.0 * (90 + this.options.iconAngle));\n this.ctx.drawImage(this.img, -imgX / 2, -imgY / 2, imgX, imgY);\n return this.ctx.restore();\n }\n };\n\n return GaugePointer;\n\n })(ValueUpdater);\n\n Bar = (function() {\n function Bar(elem1) {\n this.elem = elem1;\n }\n\n Bar.prototype.updateValues = function(arrValues) {\n this.value = arrValues[0];\n this.maxValue = arrValues[1];\n this.avgValue = arrValues[2];\n return this.render();\n };\n\n Bar.prototype.render = function() {\n var avgPercent, valPercent;\n if (this.textField) {\n this.textField.text(formatNumber(this.value));\n }\n if (this.maxValue === 0) {\n this.maxValue = this.avgValue * 2;\n }\n valPercent = (this.value / this.maxValue) * 100;\n avgPercent = (this.avgValue / this.maxValue) * 100;\n $(\".bar-value\", this.elem).css({\n \"width\": valPercent + \"%\"\n });\n return $(\".typical-value\", this.elem).css({\n \"width\": avgPercent + \"%\"\n });\n };\n\n return Bar;\n\n })();\n\n Gauge = (function(superClass) {\n extend(Gauge, superClass);\n\n Gauge.prototype.elem = null;\n\n Gauge.prototype.value = [20];\n\n Gauge.prototype.maxValue = 80;\n\n Gauge.prototype.minValue = 0;\n\n Gauge.prototype.displayedAngle = 0;\n\n Gauge.prototype.displayedValue = 0;\n\n Gauge.prototype.lineWidth = 40;\n\n Gauge.prototype.paddingTop = 0.1;\n\n Gauge.prototype.paddingBottom = 0.1;\n\n Gauge.prototype.percentColors = null;\n\n Gauge.prototype.options = {\n colorStart: \"#6fadcf\",\n colorStop: void 0,\n gradientType: 0,\n strokeColor: \"#e0e0e0\",\n pointer: {\n length: 0.8,\n strokeWidth: 0.035,\n iconScale: 1.0\n },\n angle: 0.15,\n lineWidth: 0.44,\n radiusScale: 1.0,\n fontSize: 40,\n limitMax: false,\n limitMin: false\n };\n\n function Gauge(canvas) {\n var h, w;\n this.canvas = canvas;\n Gauge.__super__.constructor.call(this);\n this.percentColors = null;\n if (typeof G_vmlCanvasManager !== 'undefined') {\n this.canvas = window.G_vmlCanvasManager.initElement(this.canvas);\n }\n this.ctx = this.canvas.getContext('2d');\n h = this.canvas.clientHeight;\n w = this.canvas.clientWidth;\n this.canvas.height = h;\n this.canvas.width = w;\n this.gp = [new GaugePointer(this)];\n this.setOptions();\n }\n\n Gauge.prototype.setOptions = function(options) {\n var gauge, j, len, phi, ref;\n if (options == null) {\n options = null;\n }\n Gauge.__super__.setOptions.call(this, options);\n this.configPercentColors();\n this.extraPadding = 0;\n if (this.options.angle < 0) {\n phi = Math.PI * (1 + this.options.angle);\n this.extraPadding = Math.sin(phi);\n }\n this.availableHeight = this.canvas.height * (1 - this.paddingTop - this.paddingBottom);\n this.lineWidth = this.availableHeight * this.options.lineWidth;\n this.radius = (this.availableHeight - this.lineWidth / 2) / (1.0 + this.extraPadding);\n this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);\n ref = this.gp;\n for (j = 0, len = ref.length; j < len; j++) {\n gauge = ref[j];\n gauge.setOptions(this.options.pointer);\n gauge.render();\n }\n this.render();\n return this;\n };\n\n Gauge.prototype.configPercentColors = function() {\n var bval, gval, i, j, ref, results, rval;\n this.percentColors = null;\n if (this.options.percentColors !== void 0) {\n this.percentColors = new Array();\n results = [];\n for (i = j = 0, ref = this.options.percentColors.length - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {\n rval = parseInt((cutHex(this.options.percentColors[i][1])).substring(0, 2), 16);\n gval = parseInt((cutHex(this.options.percentColors[i][1])).substring(2, 4), 16);\n bval = parseInt((cutHex(this.options.percentColors[i][1])).substring(4, 6), 16);\n results.push(this.percentColors[i] = {\n pct: this.options.percentColors[i][0],\n color: {\n r: rval,\n g: gval,\n b: bval\n }\n });\n }\n return results;\n }\n };\n\n Gauge.prototype.set = function(value) {\n var gp, i, j, k, l, len, ref, ref1, val;\n if (!(value instanceof Array)) {\n value = [value];\n }\n for (i = j = 0, ref = value.length - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {\n value[i] = this.parseValue(value[i]);\n }\n if (value.length > this.gp.length) {\n for (i = k = 0, ref1 = value.length - this.gp.length; 0 <= ref1 ? k < ref1 : k > ref1; i = 0 <= ref1 ? ++k : --k) {\n gp = new GaugePointer(this);\n gp.setOptions(this.options.pointer);\n this.gp.push(gp);\n }\n } else if (value.length < this.gp.length) {\n this.gp = this.gp.slice(this.gp.length - value.length);\n }\n i = 0;\n for (l = 0, len = value.length; l < len; l++) {\n val = value[l];\n if (val > this.maxValue) {\n if (this.options.limitMax) {\n val = this.maxValue;\n } else {\n this.maxValue = val + 1;\n }\n } else if (val < this.minValue) {\n if (this.options.limitMin) {\n val = this.minValue;\n } else {\n this.minValue = val - 1;\n }\n }\n this.gp[i].value = val;\n this.gp[i++].setOptions({\n minValue: this.minValue,\n maxValue: this.maxValue,\n angle: this.options.angle\n });\n }\n this.value = Math.max(Math.min(value[value.length - 1], this.maxValue), this.minValue);\n AnimationUpdater.run(this.forceUpdate);\n return this.forceUpdate = false;\n };\n\n Gauge.prototype.getAngle = function(value) {\n return (1 + this.options.angle) * Math.PI + ((value - this.minValue) / (this.maxValue - this.minValue)) * (1 - this.options.angle * 2) * Math.PI;\n };\n\n Gauge.prototype.getColorForPercentage = function(pct, grad) {\n var color, endColor, i, j, rangePct, ref, startColor;\n if (pct === 0) {\n color = this.percentColors[0].color;\n } else {\n color = this.percentColors[this.percentColors.length - 1].color;\n for (i = j = 0, ref = this.percentColors.length - 1; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {\n if (pct <= this.percentColors[i].pct) {\n if (grad === true) {\n startColor = this.percentColors[i - 1] || this.percentColors[0];\n endColor = this.percentColors[i];\n rangePct = (pct - startColor.pct) / (endColor.pct - startColor.pct);\n color = {\n r: Math.floor(startColor.color.r * (1 - rangePct) + endColor.color.r * rangePct),\n g: Math.floor(startColor.color.g * (1 - rangePct) + endColor.color.g * rangePct),\n b: Math.floor(startColor.color.b * (1 - rangePct) + endColor.color.b * rangePct)\n };\n } else {\n color = this.percentColors[i].color;\n }\n break;\n }\n }\n }\n return 'rgb(' + [color.r, color.g, color.b].join(',') + ')';\n };\n\n Gauge.prototype.getColorForValue = function(val, grad) {\n var pct;\n pct = (val - this.minValue) / (this.maxValue - this.minValue);\n return this.getColorForPercentage(pct, grad);\n };\n\n Gauge.prototype.renderStaticLabels = function(staticLabels, w, h, radius) {\n var font, fontsize, j, len, match, re, ref, rest, rotationAngle, value;\n this.ctx.save();\n this.ctx.translate(w, h);\n font = staticLabels.font || \"10px Times\";\n re = /\\d+\\.?\\d?/;\n match = font.match(re)[0];\n rest = font.slice(match.length);\n fontsize = parseFloat(match) * this.displayScale;\n this.ctx.font = fontsize + rest;\n this.ctx.fillStyle = staticLabels.color || \"#000000\";\n this.ctx.textBaseline = \"bottom\";\n this.ctx.textAlign = \"center\";\n ref = staticLabels.labels;\n for (j = 0, len = ref.length; j < len; j++) {\n value = ref[j];\n if (value.label !== void 0) {\n if ((!this.options.limitMin || value >= this.minValue) && (!this.options.limitMax || value <= this.maxValue)) {\n font = value.font || staticLabels.font;\n match = font.match(re)[0];\n rest = font.slice(match.length);\n fontsize = parseFloat(match) * this.displayScale;\n this.ctx.font = fontsize + rest;\n rotationAngle = this.getAngle(value.label) - 3 * Math.PI / 2;\n this.ctx.rotate(rotationAngle);\n this.ctx.fillText(formatNumber(value.label, staticLabels.fractionDigits), 0, -radius - this.lineWidth / 2);\n this.ctx.rotate(-rotationAngle);\n }\n } else {\n if ((!this.options.limitMin || value >= this.minValue) && (!this.options.limitMax || value <= this.maxValue)) {\n rotationAngle = this.getAngle(value) - 3 * Math.PI / 2;\n this.ctx.rotate(rotationAngle);\n this.ctx.fillText(formatNumber(value, staticLabels.fractionDigits), 0, -radius - this.lineWidth / 2);\n this.ctx.rotate(-rotationAngle);\n }\n }\n }\n return this.ctx.restore();\n };\n\n Gauge.prototype.renderTicks = function(ticksOptions, w, h, radius) {\n var currentDivision, currentSubDivision, divColor, divLength, divWidth, divisionCount, j, lineWidth, range, rangeDivisions, ref, results, scaleMutate, st, subColor, subDivisions, subLength, subWidth, subdivisionCount, t, tmpRadius;\n if (ticksOptions !== {}) {\n divisionCount = ticksOptions.divisions || 0;\n subdivisionCount = ticksOptions.subDivisions || 0;\n divColor = ticksOptions.divColor || '#fff';\n subColor = ticksOptions.subColor || '#fff';\n divLength = ticksOptions.divLength || 0.7;\n subLength = ticksOptions.subLength || 0.2;\n range = parseFloat(this.maxValue) - parseFloat(this.minValue);\n rangeDivisions = parseFloat(range) / parseFloat(ticksOptions.divisions);\n subDivisions = parseFloat(rangeDivisions) / parseFloat(ticksOptions.subDivisions);\n currentDivision = parseFloat(this.minValue);\n currentSubDivision = 0.0 + subDivisions;\n lineWidth = range / 400;\n divWidth = lineWidth * (ticksOptions.divWidth || 1);\n subWidth = lineWidth * (ticksOptions.subWidth || 1);\n results = [];\n for (t = j = 0, ref = divisionCount + 1; j < ref; t = j += 1) {\n this.ctx.lineWidth = this.lineWidth * divLength;\n scaleMutate = (this.lineWidth / 2) * (1 - divLength);\n tmpRadius = (this.radius * this.options.radiusScale) + scaleMutate;\n this.ctx.strokeStyle = divColor;\n this.ctx.beginPath();\n this.ctx.arc(0, 0, tmpRadius, this.getAngle(currentDivision - divWidth), this.getAngle(currentDivision + divWidth), false);\n this.ctx.stroke();\n currentSubDivision = currentDivision + subDivisions;\n currentDivision += rangeDivisions;\n if (t !== ticksOptions.divisions && subdivisionCount > 0) {\n results.push((function() {\n var k, ref1, results1;\n results1 = [];\n for (st = k = 0, ref1 = subdivisionCount - 1; k < ref1; st = k += 1) {\n this.ctx.lineWidth = this.lineWidth * subLength;\n scaleMutate = (this.lineWidth / 2) * (1 - subLength);\n tmpRadius = (this.radius * this.options.radiusScale) + scaleMutate;\n this.ctx.strokeStyle = subColor;\n this.ctx.beginPath();\n this.ctx.arc(0, 0, tmpRadius, this.getAngle(currentSubDivision - subWidth), this.getAngle(currentSubDivision + subWidth), false);\n this.ctx.stroke();\n results1.push(currentSubDivision += subDivisions);\n }\n return results1;\n }).call(this));\n } else {\n results.push(void 0);\n }\n }\n return results;\n }\n };\n\n Gauge.prototype.render = function() {\n var displayedAngle, fillStyle, gauge, h, j, k, len, len1, max, min, radius, ref, ref1, scaleMutate, tmpRadius, w, zone;\n w = this.canvas.width / 2;\n h = (this.canvas.height * this.paddingTop + this.availableHeight) - ((this.radius + this.lineWidth / 2) * this.extraPadding);\n displayedAngle = this.getAngle(this.displayedValue);\n if (this.textField) {\n this.textField.render(this);\n }\n this.ctx.lineCap = \"butt\";\n radius = this.radius * this.options.radiusScale;\n if (this.options.staticLabels) {\n this.renderStaticLabels(this.options.staticLabels, w, h, radius);\n }\n if (this.options.staticZones) {\n this.ctx.save();\n this.ctx.translate(w, h);\n this.ctx.lineWidth = this.lineWidth;\n ref = this.options.staticZones;\n for (j = 0, len = ref.length; j < len; j++) {\n zone = ref[j];\n min = zone.min;\n if (this.options.limitMin && min < this.minValue) {\n min = this.minValue;\n }\n max = zone.max;\n if (this.options.limitMax && max > this.maxValue) {\n max = this.maxValue;\n }\n tmpRadius = this.radius * this.options.radiusScale;\n if (zone.height) {\n this.ctx.lineWidth = this.lineWidth * zone.height;\n scaleMutate = (this.lineWidth / 2) * (zone.offset || 1 - zone.height);\n tmpRadius = (this.radius * this.options.radiusScale) + scaleMutate;\n }\n this.ctx.strokeStyle = zone.strokeStyle;\n this.ctx.beginPath();\n this.ctx.arc(0, 0, tmpRadius, this.getAngle(min), this.getAngle(max), false);\n this.ctx.stroke();\n }\n } else {\n if (this.options.customFillStyle !== void 0) {\n fillStyle = this.options.customFillStyle(this);\n } else if (this.percentColors !== null) {\n fillStyle = this.getColorForValue(this.displayedValue, this.options.generateGradient);\n } else if (this.options.colorStop !== void 0) {\n if (this.options.gradientType === 0) {\n fillStyle = this.ctx.createRadialGradient(w, h, 9, w, h, 70);\n } else {\n fillStyle = this.ctx.createLinearGradient(0, 0, w, 0);\n }\n fillStyle.addColorStop(0, this.options.colorStart);\n fillStyle.addColorStop(1, this.options.colorStop);\n } else {\n fillStyle = this.options.colorStart;\n }\n this.ctx.strokeStyle = fillStyle;\n this.ctx.beginPath();\n this.ctx.arc(w, h, radius, (1 + this.options.angle) * Math.PI, displayedAngle, false);\n this.ctx.lineWidth = this.lineWidth;\n this.ctx.stroke();\n this.ctx.strokeStyle = this.options.strokeColor;\n this.ctx.beginPath();\n this.ctx.arc(w, h, radius, displayedAngle, (2 - this.options.angle) * Math.PI, false);\n this.ctx.stroke();\n this.ctx.save();\n this.ctx.translate(w, h);\n }\n if (this.options.renderTicks) {\n this.renderTicks(this.options.renderTicks, w, h, radius);\n }\n this.ctx.restore();\n this.ctx.translate(w, h);\n ref1 = this.gp;\n for (k = 0, len1 = ref1.length; k < len1; k++) {\n gauge = ref1[k];\n gauge.update(true);\n }\n return this.ctx.translate(-w, -h);\n };\n\n return Gauge;\n\n })(BaseGauge);\n\n BaseDonut = (function(superClass) {\n extend(BaseDonut, superClass);\n\n BaseDonut.prototype.lineWidth = 15;\n\n BaseDonut.prototype.displayedValue = 0;\n\n BaseDonut.prototype.value = 33;\n\n BaseDonut.prototype.maxValue = 80;\n\n BaseDonut.prototype.minValue = 0;\n\n BaseDonut.prototype.options = {\n lineWidth: 0.10,\n colorStart: \"#6f6ea0\",\n colorStop: \"#c0c0db\",\n strokeColor: \"#eeeeee\",\n shadowColor: \"#d5d5d5\",\n angle: 0.35,\n radiusScale: 1.0\n };\n\n function BaseDonut(canvas) {\n this.canvas = canvas;\n BaseDonut.__super__.constructor.call(this);\n if (typeof G_vmlCanvasManager !== 'undefined') {\n this.canvas = window.G_vmlCanvasManager.initElement(this.canvas);\n }\n this.ctx = this.canvas.getContext('2d');\n this.setOptions();\n this.render();\n }\n\n BaseDonut.prototype.getAngle = function(value) {\n return (1 - this.options.angle) * Math.PI + ((value - this.minValue) / (this.maxValue - this.minValue)) * ((2 + this.options.angle) - (1 - this.options.angle)) * Math.PI;\n };\n\n BaseDonut.prototype.setOptions = function(options) {\n if (options == null) {\n options = null;\n }\n BaseDonut.__super__.setOptions.call(this, options);\n this.lineWidth = this.canvas.height * this.options.lineWidth;\n this.radius = this.options.radiusScale * (this.canvas.height / 2 - this.lineWidth / 2);\n return this;\n };\n\n BaseDonut.prototype.set = function(value) {\n this.value = this.parseValue(value);\n if (this.value > this.maxValue) {\n if (this.options.limitMax) {\n this.value = this.maxValue;\n } else {\n this.maxValue = this.value;\n }\n } else if (this.value < this.minValue) {\n if (this.options.limitMin) {\n this.value = this.minValue;\n } else {\n this.minValue = this.value;\n }\n }\n AnimationUpdater.run(this.forceUpdate);\n return this.forceUpdate = false;\n };\n\n BaseDonut.prototype.render = function() {\n var displayedAngle, grdFill, h, start, stop, w;\n displayedAngle = this.getAngle(this.displayedValue);\n w = this.canvas.width / 2;\n h = this.canvas.height / 2;\n if (this.textField) {\n this.textField.render(this);\n }\n grdFill = this.ctx.createRadialGradient(w, h, 39, w, h, 70);\n grdFill.addColorStop(0, this.options.colorStart);\n grdFill.addColorStop(1, this.options.colorStop);\n start = this.radius - this.lineWidth / 2;\n stop = this.radius + this.lineWidth / 2;\n this.ctx.strokeStyle = this.options.strokeColor;\n this.ctx.beginPath();\n this.ctx.arc(w, h, this.radius, (1 - this.options.angle) * Math.PI, (2 + this.options.angle) * Math.PI, false);\n this.ctx.lineWidth = this.lineWidth;\n this.ctx.lineCap = \"round\";\n this.ctx.stroke();\n this.ctx.strokeStyle = grdFill;\n this.ctx.beginPath();\n this.ctx.arc(w, h, this.radius, (1 - this.options.angle) * Math.PI, displayedAngle, false);\n return this.ctx.stroke();\n };\n\n return BaseDonut;\n\n })(BaseGauge);\n\n Donut = (function(superClass) {\n extend(Donut, superClass);\n\n function Donut() {\n return Donut.__super__.constructor.apply(this, arguments);\n }\n\n Donut.prototype.strokeGradient = function(w, h, start, stop) {\n var grd;\n grd = this.ctx.createRadialGradient(w, h, start, w, h, stop);\n grd.addColorStop(0, this.options.shadowColor);\n grd.addColorStop(0.12, this.options._orgStrokeColor);\n grd.addColorStop(0.88, this.options._orgStrokeColor);\n grd.addColorStop(1, this.options.shadowColor);\n return grd;\n };\n\n Donut.prototype.setOptions = function(options) {\n var h, start, stop, w;\n if (options == null) {\n options = null;\n }\n Donut.__super__.setOptions.call(this, options);\n w = this.canvas.width / 2;\n h = this.canvas.height / 2;\n start = this.radius - this.lineWidth / 2;\n stop = this.radius + this.lineWidth / 2;\n this.options._orgStrokeColor = this.options.strokeColor;\n this.options.strokeColor = this.strokeGradient(w, h, start, stop);\n return this;\n };\n\n return Donut;\n\n })(BaseDonut);\n\n window.AnimationUpdater = {\n elements: [],\n animId: null,\n addAll: function(list) {\n var elem, j, len, results;\n results = [];\n for (j = 0, len = list.length; j < len; j++) {\n elem = list[j];\n results.push(AnimationUpdater.elements.push(elem));\n }\n return results;\n },\n add: function(object) {\n return AnimationUpdater.elements.push(object);\n },\n run: function(force) {\n var elem, finished, isCallback, j, len, ref;\n if (force == null) {\n force = false;\n }\n isCallback = isFinite(parseFloat(force));\n if (isCallback || force === true) {\n finished = true;\n ref = AnimationUpdater.elements;\n for (j = 0, len = ref.length; j < len; j++) {\n elem = ref[j];\n if (elem.update(force === true)) {\n finished = false;\n }\n }\n return AnimationUpdater.animId = finished ? null : requestAnimationFrame(AnimationUpdater.run);\n } else if (force === false) {\n if (AnimationUpdater.animId === !null) {\n cancelAnimationFrame(AnimationUpdater.animId);\n }\n return AnimationUpdater.animId = requestAnimationFrame(AnimationUpdater.run);\n }\n }\n };\n\n if (typeof window.define === 'function' && (window.define.amd != null)) {\n define(function() {\n return {\n Gauge: Gauge,\n Donut: Donut,\n BaseDonut: BaseDonut,\n TextRenderer: TextRenderer\n };\n });\n } else if (typeof module !== 'undefined' && (module.exports != null)) {\n module.exports = {\n Gauge: Gauge,\n Donut: Donut,\n BaseDonut: BaseDonut,\n TextRenderer: TextRenderer\n };\n } else {\n window.Gauge = Gauge;\n window.Donut = Donut;\n window.BaseDonut = BaseDonut;\n window.TextRenderer = TextRenderer;\n }\n\n}).call(this);\n","var tabbable = require('tabbable');\nvar xtend = require('xtend');\n\nvar activeFocusDelay;\n\nvar activeFocusTraps = (function() {\n var trapQueue = [];\n return {\n activateTrap: function(trap) {\n if (trapQueue.length > 0) {\n var activeTrap = trapQueue[trapQueue.length - 1];\n if (activeTrap !== trap) {\n activeTrap.pause();\n }\n }\n\n var trapIndex = trapQueue.indexOf(trap);\n if (trapIndex === -1) {\n trapQueue.push(trap);\n } else {\n // move this existing trap to the front of the queue\n trapQueue.splice(trapIndex, 1);\n trapQueue.push(trap);\n }\n },\n\n deactivateTrap: function(trap) {\n var trapIndex = trapQueue.indexOf(trap);\n if (trapIndex !== -1) {\n trapQueue.splice(trapIndex, 1);\n }\n\n if (trapQueue.length > 0) {\n trapQueue[trapQueue.length - 1].unpause();\n }\n }\n };\n})();\n\nfunction focusTrap(element, userOptions) {\n var doc = document;\n var container =\n typeof element === 'string' ? doc.querySelector(element) : element;\n\n var config = xtend(\n {\n returnFocusOnDeactivate: true,\n escapeDeactivates: true\n },\n userOptions\n );\n\n var state = {\n firstTabbableNode: null,\n lastTabbableNode: null,\n nodeFocusedBeforeActivation: null,\n mostRecentlyFocusedNode: null,\n active: false,\n paused: false\n };\n\n var trap = {\n activate: activate,\n deactivate: deactivate,\n pause: pause,\n unpause: unpause\n };\n\n return trap;\n\n function activate(activateOptions) {\n if (state.active) return;\n\n updateTabbableNodes();\n\n state.active = true;\n state.paused = false;\n state.nodeFocusedBeforeActivation = doc.activeElement;\n\n var onActivate =\n activateOptions && activateOptions.onActivate\n ? activateOptions.onActivate\n : config.onActivate;\n if (onActivate) {\n onActivate();\n }\n\n addListeners();\n return trap;\n }\n\n function deactivate(deactivateOptions) {\n if (!state.active) return;\n\n clearTimeout(activeFocusDelay);\n\n removeListeners();\n state.active = false;\n state.paused = false;\n\n activeFocusTraps.deactivateTrap(trap);\n\n var onDeactivate =\n deactivateOptions && deactivateOptions.onDeactivate !== undefined\n ? deactivateOptions.onDeactivate\n : config.onDeactivate;\n if (onDeactivate) {\n onDeactivate();\n }\n\n var returnFocus =\n deactivateOptions && deactivateOptions.returnFocus !== undefined\n ? deactivateOptions.returnFocus\n : config.returnFocusOnDeactivate;\n if (returnFocus) {\n delay(function() {\n tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));\n });\n }\n\n return trap;\n }\n\n function pause() {\n if (state.paused || !state.active) return;\n state.paused = true;\n removeListeners();\n }\n\n function unpause() {\n if (!state.paused || !state.active) return;\n state.paused = false;\n updateTabbableNodes();\n addListeners();\n }\n\n function addListeners() {\n if (!state.active) return;\n\n // There can be only one listening focus trap at a time\n activeFocusTraps.activateTrap(trap);\n\n // Delay ensures that the focused element doesn't capture the event\n // that caused the focus trap activation.\n activeFocusDelay = delay(function() {\n tryFocus(getInitialFocusNode());\n });\n\n doc.addEventListener('focusin', checkFocusIn, true);\n doc.addEventListener('mousedown', checkPointerDown, {\n capture: true,\n passive: false\n });\n doc.addEventListener('touchstart', checkPointerDown, {\n capture: true,\n passive: false\n });\n doc.addEventListener('click', checkClick, {\n capture: true,\n passive: false\n });\n doc.addEventListener('keydown', checkKey, {\n capture: true,\n passive: false\n });\n\n return trap;\n }\n\n function removeListeners() {\n if (!state.active) return;\n\n doc.removeEventListener('focusin', checkFocusIn, true);\n doc.removeEventListener('mousedown', checkPointerDown, true);\n doc.removeEventListener('touchstart', checkPointerDown, true);\n doc.removeEventListener('click', checkClick, true);\n doc.removeEventListener('keydown', checkKey, true);\n\n return trap;\n }\n\n function getNodeForOption(optionName) {\n var optionValue = config[optionName];\n var node = optionValue;\n if (!optionValue) {\n return null;\n }\n if (typeof optionValue === 'string') {\n node = doc.querySelector(optionValue);\n if (!node) {\n throw new Error('`' + optionName + '` refers to no known node');\n }\n }\n if (typeof optionValue === 'function') {\n node = optionValue();\n if (!node) {\n throw new Error('`' + optionName + '` did not return a node');\n }\n }\n return node;\n }\n\n function getInitialFocusNode() {\n var node;\n if (getNodeForOption('initialFocus') !== null) {\n node = getNodeForOption('initialFocus');\n } else if (container.contains(doc.activeElement)) {\n node = doc.activeElement;\n } else {\n node = state.firstTabbableNode || getNodeForOption('fallbackFocus');\n }\n\n if (!node) {\n throw new Error(\n 'Your focus-trap needs to have at least one focusable element'\n );\n }\n\n return node;\n }\n\n function getReturnFocusNode(previousActiveElement) {\n var node = getNodeForOption('setReturnFocus');\n return node ? node : previousActiveElement;\n }\n\n // This needs to be done on mousedown and touchstart instead of click\n // so that it precedes the focus event.\n function checkPointerDown(e) {\n if (container.contains(e.target)) return;\n if (config.clickOutsideDeactivates) {\n deactivate({\n returnFocus: !tabbable.isFocusable(e.target)\n });\n return;\n }\n // This is needed for mobile devices.\n // (If we'll only let `click` events through,\n // then on mobile they will be blocked anyways if `touchstart` is blocked.)\n if (config.allowOutsideClick && config.allowOutsideClick(e)) {\n return;\n }\n e.preventDefault();\n }\n\n // In case focus escapes the trap for some strange reason, pull it back in.\n function checkFocusIn(e) {\n // In Firefox when you Tab out of an iframe the Document is briefly focused.\n if (container.contains(e.target) || e.target instanceof Document) {\n return;\n }\n e.stopImmediatePropagation();\n tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());\n }\n\n function checkKey(e) {\n if (config.escapeDeactivates !== false && isEscapeEvent(e)) {\n e.preventDefault();\n deactivate();\n return;\n }\n if (isTabEvent(e)) {\n checkTab(e);\n return;\n }\n }\n\n // Hijack Tab events on the first and last focusable nodes of the trap,\n // in order to prevent focus from escaping. If it escapes for even a\n // moment it can end up scrolling the page and causing confusion so we\n // kind of need to capture the action at the keydown phase.\n function checkTab(e) {\n updateTabbableNodes();\n if (e.shiftKey && e.target === state.firstTabbableNode) {\n e.preventDefault();\n tryFocus(state.lastTabbableNode);\n return;\n }\n if (!e.shiftKey && e.target === state.lastTabbableNode) {\n e.preventDefault();\n tryFocus(state.firstTabbableNode);\n return;\n }\n }\n\n function checkClick(e) {\n if (config.clickOutsideDeactivates) return;\n if (container.contains(e.target)) return;\n if (config.allowOutsideClick && config.allowOutsideClick(e)) {\n return;\n }\n e.preventDefault();\n e.stopImmediatePropagation();\n }\n\n function updateTabbableNodes() {\n var tabbableNodes = tabbable(container);\n state.firstTabbableNode = tabbableNodes[0] || getInitialFocusNode();\n state.lastTabbableNode =\n tabbableNodes[tabbableNodes.length - 1] || getInitialFocusNode();\n }\n\n function tryFocus(node) {\n if (node === doc.activeElement) return;\n if (!node || !node.focus) {\n tryFocus(getInitialFocusNode());\n return;\n }\n node.focus();\n state.mostRecentlyFocusedNode = node;\n if (isSelectableInput(node)) {\n node.select();\n }\n }\n}\n\nfunction isSelectableInput(node) {\n return (\n node.tagName &&\n node.tagName.toLowerCase() === 'input' &&\n typeof node.select === 'function'\n );\n}\n\nfunction isEscapeEvent(e) {\n return e.key === 'Escape' || e.key === 'Esc' || e.keyCode === 27;\n}\n\nfunction isTabEvent(e) {\n return e.key === 'Tab' || e.keyCode === 9;\n}\n\nfunction delay(fn) {\n return setTimeout(fn, 0);\n}\n\nmodule.exports = focusTrap;\n","import toDate from \"../toDate/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\n/**\n * @name getTime\n * @category Timestamp Helpers\n * @summary Get the milliseconds timestamp of the given date.\n *\n * @description\n * Get the milliseconds timestamp of the given date.\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * @param {Date|Number} date - the given date\n * @returns {Number} the timestamp\n * @throws {TypeError} 1 argument required\n *\n * @example\n * // Get the timestamp of 29 February 2012 11:45:05.123:\n * const result = getTime(new Date(2012, 1, 29, 11, 45, 5, 123))\n * //=> 1330515905123\n */\n\nexport default function getTime(dirtyDate) {\n requiredArgs(1, arguments);\n var date = toDate(dirtyDate);\n var timestamp = date.getTime();\n return timestamp;\n}","!function(e,t){\"object\"==typeof exports&&\"undefined\"!=typeof module?t(exports,require(\"react\"),require(\"prop-types\"),require(\"classnames\"),require(\"date-fns/isDate\"),require(\"date-fns/isValid\"),require(\"date-fns/format\"),require(\"date-fns/addMinutes\"),require(\"date-fns/addHours\"),require(\"date-fns/addDays\"),require(\"date-fns/addWeeks\"),require(\"date-fns/addMonths\"),require(\"date-fns/addYears\"),require(\"date-fns/subMinutes\"),require(\"date-fns/subHours\"),require(\"date-fns/subDays\"),require(\"date-fns/subWeeks\"),require(\"date-fns/subMonths\"),require(\"date-fns/subYears\"),require(\"date-fns/getSeconds\"),require(\"date-fns/getMinutes\"),require(\"date-fns/getHours\"),require(\"date-fns/getDay\"),require(\"date-fns/getDate\"),require(\"date-fns/getISOWeek\"),require(\"date-fns/getMonth\"),require(\"date-fns/getQuarter\"),require(\"date-fns/getYear\"),require(\"date-fns/getTime\"),require(\"date-fns/setSeconds\"),require(\"date-fns/setMinutes\"),require(\"date-fns/setHours\"),require(\"date-fns/setMonth\"),require(\"date-fns/setQuarter\"),require(\"date-fns/setYear\"),require(\"date-fns/min\"),require(\"date-fns/max\"),require(\"date-fns/differenceInCalendarDays\"),require(\"date-fns/differenceInCalendarMonths\"),require(\"date-fns/differenceInCalendarWeeks\"),require(\"date-fns/differenceInCalendarYears\"),require(\"date-fns/startOfDay\"),require(\"date-fns/startOfWeek\"),require(\"date-fns/startOfMonth\"),require(\"date-fns/startOfQuarter\"),require(\"date-fns/startOfYear\"),require(\"date-fns/endOfDay\"),require(\"date-fns/endOfWeek\"),require(\"date-fns/endOfMonth\"),require(\"date-fns/isEqual\"),require(\"date-fns/isSameDay\"),require(\"date-fns/isSameMonth\"),require(\"date-fns/isSameYear\"),require(\"date-fns/isSameQuarter\"),require(\"date-fns/isAfter\"),require(\"date-fns/isBefore\"),require(\"date-fns/isWithinInterval\"),require(\"date-fns/toDate\"),require(\"date-fns/parse\"),require(\"date-fns/parseISO\"),require(\"react-onclickoutside\"),require(\"react-dom\"),require(\"react-popper\")):\"function\"==typeof define&&define.amd?define([\"exports\",\"react\",\"prop-types\",\"classnames\",\"date-fns/isDate\",\"date-fns/isValid\",\"date-fns/format\",\"date-fns/addMinutes\",\"date-fns/addHours\",\"date-fns/addDays\",\"date-fns/addWeeks\",\"date-fns/addMonths\",\"date-fns/addYears\",\"date-fns/subMinutes\",\"date-fns/subHours\",\"date-fns/subDays\",\"date-fns/subWeeks\",\"date-fns/subMonths\",\"date-fns/subYears\",\"date-fns/getSeconds\",\"date-fns/getMinutes\",\"date-fns/getHours\",\"date-fns/getDay\",\"date-fns/getDate\",\"date-fns/getISOWeek\",\"date-fns/getMonth\",\"date-fns/getQuarter\",\"date-fns/getYear\",\"date-fns/getTime\",\"date-fns/setSeconds\",\"date-fns/setMinutes\",\"date-fns/setHours\",\"date-fns/setMonth\",\"date-fns/setQuarter\",\"date-fns/setYear\",\"date-fns/min\",\"date-fns/max\",\"date-fns/differenceInCalendarDays\",\"date-fns/differenceInCalendarMonths\",\"date-fns/differenceInCalendarWeeks\",\"date-fns/differenceInCalendarYears\",\"date-fns/startOfDay\",\"date-fns/startOfWeek\",\"date-fns/startOfMonth\",\"date-fns/startOfQuarter\",\"date-fns/startOfYear\",\"date-fns/endOfDay\",\"date-fns/endOfWeek\",\"date-fns/endOfMonth\",\"date-fns/isEqual\",\"date-fns/isSameDay\",\"date-fns/isSameMonth\",\"date-fns/isSameYear\",\"date-fns/isSameQuarter\",\"date-fns/isAfter\",\"date-fns/isBefore\",\"date-fns/isWithinInterval\",\"date-fns/toDate\",\"date-fns/parse\",\"date-fns/parseISO\",\"react-onclickoutside\",\"react-dom\",\"react-popper\"],t):t((e=\"undefined\"!=typeof globalThis?globalThis:e||self).DatePicker={},e.React,e.PropTypes,e.classNames,e.isDate,e.isValidDate,e.format,e.addMinutes,e.addHours,e.addDays,e.addWeeks,e.addMonths,e.addYears,null,null,e.subDays,e.subWeeks,e.subMonths,e.subYears,e.getSeconds,e.getMinutes,e.getHours,e.getDay,e.getDate,e.getISOWeek,e.getMonth,e.getQuarter,e.getYear,e.getTime,e.setSeconds,e.setMinutes,e.setHours,e.setMonth,e.setQuarter,e.setYear,e.min,e.max,e.differenceInCalendarDays,e.differenceInCalendarMonths,null,e.differenceInCalendarYears,e.startOfDay,e.startOfWeek,e.startOfMonth,e.startOfQuarter,e.startOfYear,e.endOfDay,null,null,e.dfIsEqual,e.dfIsSameDay,e.dfIsSameMonth,e.dfIsSameYear,e.dfIsSameQuarter,e.isAfter,e.isBefore,e.isWithinInterval,e.toDate,e.parse,e.parseISO,e.onClickOutside,e.ReactDOM,e.ReactPopper)}(this,(function(e,t,r,a,n,o,s,i,p,l,d,c,u,f,h,m,y,D,v,w,g,k,b,C,S,_,M,P,E,N,O,Y,x,T,I,L,F,R,q,A,W,K,B,j,H,Q,V,U,$,z,G,J,X,Z,ee,te,re,ae,ne,oe,se,ie,pe){\"use strict\";function le(e){return e&&\"object\"==typeof e&&\"default\"in e?e:{default:e}}var de=le(t),ce=le(a),ue=le(n),fe=le(o),he=le(s),me=le(i),ye=le(p),De=le(l),ve=le(d),we=le(c),ge=le(u),ke=le(m),be=le(y),Ce=le(D),Se=le(v),_e=le(w),Me=le(g),Pe=le(k),Ee=le(b),Ne=le(C),Oe=le(S),Ye=le(_),xe=le(M),Te=le(P),Ie=le(E),Le=le(N),Fe=le(O),Re=le(Y),qe=le(x),Ae=le(T),We=le(I),Ke=le(L),Be=le(F),je=le(R),He=le(q),Qe=le(W),Ve=le(K),Ue=le(B),$e=le(j),ze=le(H),Ge=le(Q),Je=le(V),Xe=le(z),Ze=le(G),et=le(J),tt=le(X),rt=le(Z),at=le(ee),nt=le(te),ot=le(re),st=le(ae),it=le(ne),pt=le(oe),lt=le(se),dt=le(ie);function ct(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function ut(e){for(var t=1;te.length)&&(t=e.length);for(var r=0,a=new Array(t);r0&&(o=it.default(e,t.slice(0,e.length),new Date)),It(o)||(o=new Date(e))),It(o)&&i?o:null)}function It(e,t){return t=t||new Date(\"1/1/1000\"),fe.default(e)&&at.default(e,t)}function Lt(e,t,r){if(\"en\"===r)return he.default(e,t,{awareOfUnicodeTokens:!0});var a=Xt(r);return r&&!a&&console.warn('A locale object was not found for the provided string [\"'.concat(r,'\"].')),!a&&Jt()&&Xt(Jt())&&(a=Xt(Jt())),he.default(e,t,{locale:a||null,awareOfUnicodeTokens:!0})}function Ft(e,t){var r=t.dateFormat,a=t.locale;return e&&Lt(e,Array.isArray(r)?r[0]:r,a)||\"\"}function Rt(e,t){var r=t.hour,a=void 0===r?0:r,n=t.minute,o=void 0===n?0:n,s=t.second,i=void 0===s?0:s;return Re.default(Fe.default(Le.default(e,i),o),a)}function qt(e,t){var r=t&&Xt(t)||Jt()&&Xt(Jt());return Oe.default(e,r?{locale:r}:null)}function At(e,t){return Lt(e,\"ddd\",t)}function Wt(e){return Ve.default(e)}function Kt(e,t,r){var a=Xt(t||Jt());return Ue.default(e,{locale:a,weekStartsOn:r})}function Bt(e){return $e.default(e)}function jt(e){return Ge.default(e)}function Ht(e){return ze.default(e)}function Qt(e,t){return e&&t?tt.default(e,t):!e&&!t}function Vt(e,t){return e&&t?et.default(e,t):!e&&!t}function Ut(e,t){return e&&t?rt.default(e,t):!e&&!t}function $t(e,t){return e&&t?Ze.default(e,t):!e&&!t}function zt(e,t){return e&&t?Xe.default(e,t):!e&&!t}function Gt(e,t,r){var a,n=Ve.default(t),o=Je.default(r);try{a=ot.default(e,{start:n,end:o})}catch(e){a=!1}return a}function Jt(){return(\"undefined\"!=typeof window?window:global).__localeId__}function Xt(e){if(\"string\"==typeof e){var t=\"undefined\"!=typeof window?window:global;return t.__localeData__?t.__localeData__[e]:null}return e}function Zt(e,t){return Lt(qe.default(xt(),e),\"LLLL\",t)}function er(e,t){return Lt(qe.default(xt(),e),\"LLL\",t)}function tr(e,t){return Lt(Ae.default(xt(),e),\"QQQ\",t)}function rr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.maxDate,n=t.excludeDates,o=t.includeDates,s=t.filterDate;return lr(e,{minDate:r,maxDate:a})||n&&n.some((function(t){return $t(e,t)}))||o&&!o.some((function(t){return $t(e,t)}))||s&&!s(xt(e))||!1}function ar(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.excludeDates;return r&&r.some((function(t){return $t(e,t)}))||!1}function nr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.maxDate,n=t.excludeDates,o=t.includeDates,s=t.filterDate;return lr(e,{minDate:r,maxDate:a})||n&&n.some((function(t){return Vt(e,t)}))||o&&!o.some((function(t){return Vt(e,t)}))||s&&!s(xt(e))||!1}function or(e,t,r,a){var n=Te.default(e),o=Ye.default(e),s=Te.default(t),i=Ye.default(t),p=Te.default(a);return n===s&&n===p?o<=r&&r<=i:n=r||pn:void 0}function sr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.maxDate,n=t.excludeDates,o=t.includeDates,s=t.filterDate;return lr(e,{minDate:r,maxDate:a})||n&&n.some((function(t){return Ut(e,t)}))||o&&!o.some((function(t){return Ut(e,t)}))||s&&!s(xt(e))||!1}function ir(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.maxDate,n=new Date(e,0,1);return lr(n,{minDate:r,maxDate:a})||!1}function pr(e,t,r,a){var n=Te.default(e),o=xe.default(e),s=Te.default(t),i=xe.default(t),p=Te.default(a);return n===s&&n===p?o<=r&&r<=i:n=r||pn:void 0}function lr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.maxDate;return r&&je.default(e,r)<0||a&&je.default(e,a)>0}function dr(e,t){return t.some((function(t){return Pe.default(t)===Pe.default(e)&&Me.default(t)===Me.default(e)}))}function cr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.excludeTimes,a=t.includeTimes,n=t.filterTime;return r&&dr(e,r)||a&&!dr(e,a)||n&&!n(e)||!1}function ur(e,t){var r=t.minTime,a=t.maxTime;if(!r||!a)throw new Error(\"Both minTime and maxTime props required\");var n,o=xt(),s=Re.default(Fe.default(o,Me.default(e)),Pe.default(e)),i=Re.default(Fe.default(o,Me.default(r)),Pe.default(r)),p=Re.default(Fe.default(o,Me.default(a)),Pe.default(a));try{n=!ot.default(s,{start:i,end:p})}catch(e){n=!1}return n}function fr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.includeDates,n=Ce.default(e,1);return r&&He.default(r,n)>0||a&&a.every((function(e){return He.default(e,n)>0}))||!1}function hr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxDate,a=t.includeDates,n=we.default(e,1);return r&&He.default(n,r)>0||a&&a.every((function(e){return He.default(n,e)>0}))||!1}function mr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.includeDates,n=Se.default(e,1);return r&&Qe.default(r,n)>0||a&&a.every((function(e){return Qe.default(e,n)>0}))||!1}function yr(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxDate,a=t.includeDates,n=ge.default(e,1);return r&&Qe.default(n,r)>0||a&&a.every((function(e){return Qe.default(n,e)>0}))||!1}function Dr(e){var t=e.minDate,r=e.includeDates;if(r&&t){var a=r.filter((function(e){return je.default(e,t)>=0}));return Ke.default(a)}return r?Ke.default(r):t}function vr(e){var t=e.maxDate,r=e.includeDates;if(r&&t){var a=r.filter((function(e){return je.default(e,t)<=0}));return Be.default(a)}return r?Be.default(r):t}function wr(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"react-datepicker__day--highlighted\",r=new Map,a=0,n=e.length;a1&&void 0!==arguments[1]?arguments[1]:Ot,r=Math.ceil(Te.default(e)/t)*t,a=r-(t-1);return{startPeriod:a,endPeriod:r}}function Cr(e,t,r,a){for(var n=[],o=0;o<2*t+1;o++){var s=e+t-o,i=!0;r&&(i=Te.default(r)<=s),a&&i&&(i=Te.default(a)>=s),i&&n.push(s)}return n}var Sr=function(e){wt(r,e);var t=St(r);function r(e){var a;ht(this,r),Dt(bt(a=t.call(this,e)),\"renderOptions\",(function(){var e=a.props.year,t=a.state.yearsList.map((function(t){return de.default.createElement(\"div\",{className:e===t?\"react-datepicker__year-option react-datepicker__year-option--selected_year\":\"react-datepicker__year-option\",key:t,onClick:a.onChange.bind(bt(a),t)},e===t?de.default.createElement(\"span\",{className:\"react-datepicker__year-option--selected\"},\"✓\"):\"\",t)})),r=a.props.minDate?Te.default(a.props.minDate):null,n=a.props.maxDate?Te.default(a.props.maxDate):null;return n&&a.state.yearsList.find((function(e){return e===n}))||t.unshift(de.default.createElement(\"div\",{className:\"react-datepicker__year-option\",key:\"upcoming\",onClick:a.incrementYears},de.default.createElement(\"a\",{className:\"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-upcoming\"}))),r&&a.state.yearsList.find((function(e){return e===r}))||t.push(de.default.createElement(\"div\",{className:\"react-datepicker__year-option\",key:\"previous\",onClick:a.decrementYears},de.default.createElement(\"a\",{className:\"react-datepicker__navigation react-datepicker__navigation--years react-datepicker__navigation--years-previous\"}))),t})),Dt(bt(a),\"onChange\",(function(e){a.props.onChange(e)})),Dt(bt(a),\"handleClickOutside\",(function(){a.props.onCancel()})),Dt(bt(a),\"shiftYears\",(function(e){var t=a.state.yearsList.map((function(t){return t+e}));a.setState({yearsList:t})})),Dt(bt(a),\"incrementYears\",(function(){return a.shiftYears(1)})),Dt(bt(a),\"decrementYears\",(function(){return a.shiftYears(-1)}));var n=e.yearDropdownItemNumber,o=e.scrollableYearDropdown,s=n||(o?10:5);return a.state={yearsList:Cr(a.props.year,s,a.props.minDate,a.props.maxDate)},a}return yt(r,[{key:\"render\",value:function(){var e=ce.default({\"react-datepicker__year-dropdown\":!0,\"react-datepicker__year-dropdown--scrollable\":this.props.scrollableYearDropdown});return de.default.createElement(\"div\",{className:e},this.renderOptions())}}]),r}(de.default.Component),_r=lt.default(Sr),Mr=function(e){wt(r,e);var t=St(r);function r(){var e;ht(this,r);for(var a=arguments.length,n=new Array(a),o=0;o0&&void 0!==arguments[0]?arguments[0]:{},r=!1;0===e.getTabIndex()&&!t.isInputFocused&&e.isSameDay(e.props.preSelection)&&(document.activeElement&&document.activeElement!==document.body||(r=!0),e.props.inline&&!e.props.shouldFocusDayInline&&(r=!1),e.props.containerRef&&e.props.containerRef.current&&e.props.containerRef.current.contains(document.activeElement)&&document.activeElement.classList.contains(\"react-datepicker__day\")&&(r=!0)),r&&e.dayEl.current.focus({preventScroll:!0})})),Dt(bt(e),\"renderDayContents\",(function(){if(e.isOutsideMonth()){if(e.props.monthShowsDuplicateDaysEnd&&Ne.default(e.props.day)<10)return null;if(e.props.monthShowsDuplicateDaysStart&&Ne.default(e.props.day)>20)return null}return e.props.renderDayContents?e.props.renderDayContents(Ne.default(e.props.day),e.props.day):Ne.default(e.props.day)})),Dt(bt(e),\"render\",(function(){return de.default.createElement(\"div\",{ref:e.dayEl,className:e.getClassNames(e.props.day),onKeyDown:e.handleOnKeyDown,onClick:e.handleClick,onMouseEnter:e.handleMouseEnter,tabIndex:e.getTabIndex(),\"aria-label\":e.getAriaLabel(),role:\"button\",\"aria-disabled\":e.isDisabled()},e.renderDayContents())})),e}return yt(r,[{key:\"componentDidMount\",value:function(){this.handleFocusDay()}},{key:\"componentDidUpdate\",value:function(e){this.handleFocusDay(e)}}]),r}(de.default.Component),Lr=function(e){wt(r,e);var t=St(r);function r(){var e;ht(this,r);for(var a=arguments.length,n=new Array(a),o=0;o=6,i=!r&&!e.isWeekInMonth(o);if(s||i){if(!e.props.peekNextMonth)break;n=!0}}return t})),Dt(bt(e),\"onMonthClick\",(function(t,r){e.handleDayClick(Bt(qe.default(e.props.day,r)),t)})),Dt(bt(e),\"handleMonthNavigation\",(function(t,r){e.isDisabled(r)||e.isExcluded(r)||(e.props.setPreSelection(r),e.MONTH_REFS[t].current&&e.MONTH_REFS[t].current.focus())})),Dt(bt(e),\"onMonthKeyDown\",(function(t,r){var a=t.key;if(!e.props.disabledKeyboardNavigation)switch(a){case\"Enter\":e.onMonthClick(t,r),e.props.setPreSelection(e.props.selected);break;case\"ArrowRight\":e.handleMonthNavigation(11===r?0:r+1,we.default(e.props.preSelection,1));break;case\"ArrowLeft\":e.handleMonthNavigation(0===r?11:r-1,Ce.default(e.props.preSelection,1))}})),Dt(bt(e),\"onQuarterClick\",(function(t,r){e.handleDayClick(Ht(Ae.default(e.props.day,r)),t)})),Dt(bt(e),\"getMonthClassNames\",(function(t){var r=e.props,a=r.day,n=r.startDate,o=r.endDate,s=r.selected,i=r.minDate,p=r.maxDate,l=r.preSelection,d=r.monthClassName,c=d?d(a):void 0;return ce.default(\"react-datepicker__month-text\",\"react-datepicker__month-\".concat(t),c,{\"react-datepicker__month--disabled\":(i||p)&&nr(qe.default(a,t),e.props),\"react-datepicker__month--selected\":Ye.default(a)===t&&Te.default(a)===Te.default(s),\"react-datepicker__month-text--keyboard-selected\":Ye.default(l)===t,\"react-datepicker__month--in-range\":or(n,o,t,a),\"react-datepicker__month--range-start\":e.isRangeStartMonth(t),\"react-datepicker__month--range-end\":e.isRangeEndMonth(t)})})),Dt(bt(e),\"getTabIndex\",(function(t){var r=Ye.default(e.props.preSelection);return e.props.disabledKeyboardNavigation||t!==r?\"-1\":\"0\"})),Dt(bt(e),\"getAriaLabel\",(function(t){var r=e.props,a=r.ariaLabelPrefix,n=void 0===a?\"Choose\":a,o=r.disabledDayAriaLabelPrefix,s=void 0===o?\"Not available\":o,i=r.day,p=qe.default(i,t),l=e.isDisabled(p)||e.isExcluded(p)?s:n;return\"\".concat(l,\" \").concat(Lt(p,\"MMMM yyyy\"))})),Dt(bt(e),\"getQuarterClassNames\",(function(t){var r=e.props,a=r.day,n=r.startDate,o=r.endDate,s=r.selected,i=r.minDate,p=r.maxDate;return ce.default(\"react-datepicker__quarter-text\",\"react-datepicker__quarter-\".concat(t),{\"react-datepicker__quarter--disabled\":(i||p)&&sr(Ae.default(a,t),e.props),\"react-datepicker__quarter--selected\":xe.default(a)===t&&Te.default(a)===Te.default(s),\"react-datepicker__quarter--in-range\":pr(n,o,t,a),\"react-datepicker__quarter--range-start\":e.isRangeStartQuarter(t),\"react-datepicker__quarter--range-end\":e.isRangeEndQuarter(t)})})),Dt(bt(e),\"renderMonths\",(function(){var t=e.props,r=t.showFullMonthYearPicker,a=t.showTwoColumnMonthYearPicker,n=t.showFourColumnMonthYearPicker,o=t.locale;return(n?[[0,1,2,3],[4,5,6,7],[8,9,10,11]]:a?[[0,1],[2,3],[4,5],[6,7],[8,9],[10,11]]:[[0,1,2],[3,4,5],[6,7,8],[9,10,11]]).map((function(t,a){return de.default.createElement(\"div\",{className:\"react-datepicker__month-wrapper\",key:a},t.map((function(t,a){return de.default.createElement(\"div\",{ref:e.MONTH_REFS[t],key:a,onClick:function(r){e.onMonthClick(r,t)},onKeyDown:function(r){e.onMonthKeyDown(r,t)},tabIndex:e.getTabIndex(t),className:e.getMonthClassNames(t),role:\"button\",\"aria-label\":e.getAriaLabel(t)},r?Zt(t,o):er(t,o))})))}))})),Dt(bt(e),\"renderQuarters\",(function(){return de.default.createElement(\"div\",{className:\"react-datepicker__quarter-wrapper\"},[1,2,3,4].map((function(t,r){return de.default.createElement(\"div\",{key:r,onClick:function(r){e.onQuarterClick(r,t)},className:e.getQuarterClassNames(t)},tr(t,e.props.locale))})))})),Dt(bt(e),\"getClassNames\",(function(){var t=e.props;t.day;var r=t.selectingDate,a=t.selectsStart,n=t.selectsEnd,o=t.showMonthYearPicker,s=t.showQuarterYearPicker;return ce.default(\"react-datepicker__month\",{\"react-datepicker__month--selecting-range\":r&&(a||n)},{\"react-datepicker__monthPicker\":o},{\"react-datepicker__quarterPicker\":s})})),e}return yt(r,[{key:\"render\",value:function(){var e=this.props,t=e.showMonthYearPicker,r=e.showQuarterYearPicker,a=e.day,n=e.ariaLabelPrefix,o=void 0===n?\"month \":n;return de.default.createElement(\"div\",{className:this.getClassNames(),onMouseLeave:this.handleMouseLeave,\"aria-label\":\"\".concat(o,\" \").concat(Lt(a,\"yyyy-MM\"))},t?this.renderMonths():r?this.renderQuarters():this.renderWeeks())}}]),r}(de.default.Component),qr=function(e){wt(r,e);var t=St(r);function r(){var e;ht(this,r);for(var a=arguments.length,n=new Array(a),o=0;o0&&void 0!==arguments[0]?arguments[0]:{}).className||\"\").split(/\\s+/);return Br.some((function(t){return e.indexOf(t)>=0}))})(e.target)&&a.props.onDropdownFocus()})),Dt(bt(a),\"getDateInView\",(function(){var e=a.props,t=e.preSelection,r=e.selected,n=e.openToDate,o=Dr(a.props),s=vr(a.props),i=xt(),p=n||r||t;return p||(o&&nt.default(i,o)?o:s&&at.default(i,s)?s:i)})),Dt(bt(a),\"increaseMonth\",(function(){a.setState((function(e){var t=e.date;return{date:we.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),Dt(bt(a),\"decreaseMonth\",(function(){a.setState((function(e){var t=e.date;return{date:Ce.default(t,1)}}),(function(){return a.handleMonthChange(a.state.date)}))})),Dt(bt(a),\"handleDayClick\",(function(e,t,r){a.props.onSelect(e,t,r),a.props.setPreSelection&&a.props.setPreSelection(e)})),Dt(bt(a),\"handleDayMouseEnter\",(function(e){a.setState({selectingDate:e}),a.props.onDayMouseEnter&&a.props.onDayMouseEnter(e)})),Dt(bt(a),\"handleMonthMouseLeave\",(function(){a.setState({selectingDate:null}),a.props.onMonthMouseLeave&&a.props.onMonthMouseLeave()})),Dt(bt(a),\"handleYearChange\",(function(e){a.props.onYearChange&&a.props.onYearChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),Dt(bt(a),\"handleMonthChange\",(function(e){a.props.onMonthChange&&a.props.onMonthChange(e),a.props.adjustDateOnChange&&(a.props.onSelect&&a.props.onSelect(e),a.props.setOpen&&a.props.setOpen(!0)),a.props.setPreSelection&&a.props.setPreSelection(e)})),Dt(bt(a),\"handleMonthYearChange\",(function(e){a.handleYearChange(e),a.handleMonthChange(e)})),Dt(bt(a),\"changeYear\",(function(e){a.setState((function(t){var r=t.date;return{date:We.default(r,e)}}),(function(){return a.handleYearChange(a.state.date)}))})),Dt(bt(a),\"changeMonth\",(function(e){a.setState((function(t){var r=t.date;return{date:qe.default(r,e)}}),(function(){return a.handleMonthChange(a.state.date)}))})),Dt(bt(a),\"changeMonthYear\",(function(e){a.setState((function(t){var r=t.date;return{date:We.default(qe.default(r,Ye.default(e)),Te.default(e))}}),(function(){return a.handleMonthYearChange(a.state.date)}))})),Dt(bt(a),\"header\",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.state.date,t=Kt(e,a.props.locale,a.props.calendarStartDay),r=[];return a.props.showWeekNumbers&&r.push(de.default.createElement(\"div\",{key:\"W\",className:\"react-datepicker__day-name\"},a.props.weekLabel||\"#\")),r.concat([0,1,2,3,4,5,6].map((function(e){var r=De.default(t,e),n=a.formatWeekday(r,a.props.locale),o=a.props.weekDayClassName?a.props.weekDayClassName(r):void 0;return de.default.createElement(\"div\",{key:e,className:ce.default(\"react-datepicker__day-name\",o)},n)})))})),Dt(bt(a),\"formatWeekday\",(function(e,t){return a.props.formatWeekDay?function(e,t,r){return t(Lt(e,\"EEEE\",r))}(e,a.props.formatWeekDay,t):a.props.useWeekdaysShort?function(e,t){return Lt(e,\"EEE\",t)}(e,t):function(e,t){return Lt(e,\"EEEEEE\",t)}(e,t)})),Dt(bt(a),\"decreaseYear\",(function(){a.setState((function(e){var t=e.date;return{date:Se.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),Dt(bt(a),\"renderPreviousButton\",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=mr(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minDate,a=t.yearItemNumber,n=void 0===a?Ot:a,o=br(jt(Se.default(e,n)),n).endPeriod,s=r&&Te.default(r);return s&&s>o||!1}(a.state.date,a.props);break;default:e=fr(a.state.date,a.props)}if((a.props.forceShowMonthNavigation||a.props.showDisabledMonthNavigation||!e)&&!a.props.showTimeSelectOnly){var t=[\"react-datepicker__navigation\",\"react-datepicker__navigation--previous\"],r=a.decreaseMonth;(a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker)&&(r=a.decreaseYear),e&&a.props.showDisabledMonthNavigation&&(t.push(\"react-datepicker__navigation--previous--disabled\"),r=null);var n=a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker,o=a.props,s=o.previousMonthAriaLabel,i=void 0===s?\"Previous Month\":s,p=o.previousYearAriaLabel,l=void 0===p?\"Previous Year\":p;return de.default.createElement(\"button\",{type:\"button\",className:t.join(\" \"),onClick:r,onKeyDown:a.props.handleOnKeyDown,\"aria-label\":n?l:i},de.default.createElement(\"span\",{className:[\"react-datepicker__navigation-icon\",\"react-datepicker__navigation-icon--previous\"].join(\" \")},n?a.props.previousYearButtonLabel:a.props.previousMonthButtonLabel))}}})),Dt(bt(a),\"increaseYear\",(function(){a.setState((function(e){var t=e.date;return{date:ge.default(t,a.props.showYearPicker?a.props.yearItemNumber:1)}}),(function(){return a.handleYearChange(a.state.date)}))})),Dt(bt(a),\"renderNextButton\",(function(){if(!a.props.renderCustomHeader){var e;switch(!0){case a.props.showMonthYearPicker:e=yr(a.state.date,a.props);break;case a.props.showYearPicker:e=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.maxDate,a=t.yearItemNumber,n=void 0===a?Ot:a,o=br(ge.default(e,n),n).startPeriod,s=r&&Te.default(r);return s&&s0&&void 0!==arguments[0]?arguments[0]:a.state.date,t=[\"react-datepicker__current-month\"];return a.props.showYearDropdown&&t.push(\"react-datepicker__current-month--hasYearDropdown\"),a.props.showMonthDropdown&&t.push(\"react-datepicker__current-month--hasMonthDropdown\"),a.props.showMonthYearDropdown&&t.push(\"react-datepicker__current-month--hasMonthYearDropdown\"),de.default.createElement(\"div\",{className:t.join(\" \")},Lt(e,a.props.dateFormat,a.props.locale))})),Dt(bt(a),\"renderYearDropdown\",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showYearDropdown&&!e)return de.default.createElement(Mr,{adjustDateOnChange:a.props.adjustDateOnChange,date:a.state.date,onSelect:a.props.onSelect,setOpen:a.props.setOpen,dropdownMode:a.props.dropdownMode,onChange:a.changeYear,minDate:a.props.minDate,maxDate:a.props.maxDate,year:Te.default(a.state.date),scrollableYearDropdown:a.props.scrollableYearDropdown,yearDropdownItemNumber:a.props.yearDropdownItemNumber})})),Dt(bt(a),\"renderMonthDropdown\",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthDropdown&&!e)return de.default.createElement(Nr,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,onChange:a.changeMonth,month:Ye.default(a.state.date),useShortMonthInDropdown:a.props.useShortMonthInDropdown})})),Dt(bt(a),\"renderMonthYearDropdown\",(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(a.props.showMonthYearDropdown&&!e)return de.default.createElement(Tr,{dropdownMode:a.props.dropdownMode,locale:a.props.locale,dateFormat:a.props.dateFormat,onChange:a.changeMonthYear,minDate:a.props.minDate,maxDate:a.props.maxDate,date:a.state.date,scrollableMonthYearDropdown:a.props.scrollableMonthYearDropdown})})),Dt(bt(a),\"renderTodayButton\",(function(){if(a.props.todayButton&&!a.props.showTimeSelectOnly)return de.default.createElement(\"div\",{className:\"react-datepicker__today-button\",onClick:function(e){return a.props.onSelect(Ve.default(xt()),e)}},a.props.todayButton)})),Dt(bt(a),\"renderDefaultHeader\",(function(e){var t=e.monthDate,r=e.i;return de.default.createElement(\"div\",{className:\"react-datepicker__header \".concat(a.props.showTimeSelect?\"react-datepicker__header--has-time-select\":\"\")},a.renderCurrentMonth(t),de.default.createElement(\"div\",{className:\"react-datepicker__header__dropdown react-datepicker__header__dropdown--\".concat(a.props.dropdownMode),onFocus:a.handleDropdownFocus},a.renderMonthDropdown(0!==r),a.renderMonthYearDropdown(0!==r),a.renderYearDropdown(0!==r)),de.default.createElement(\"div\",{className:\"react-datepicker__day-names\"},a.header(t)))})),Dt(bt(a),\"renderCustomHeader\",(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.monthDate,r=e.i;if(a.props.showTimeSelect&&!a.state.monthContainer||a.props.showTimeSelectOnly)return null;var n=fr(a.state.date,a.props),o=hr(a.state.date,a.props),s=mr(a.state.date,a.props),i=yr(a.state.date,a.props),p=!a.props.showMonthYearPicker&&!a.props.showQuarterYearPicker&&!a.props.showYearPicker;return de.default.createElement(\"div\",{className:\"react-datepicker__header react-datepicker__header--custom\",onFocus:a.props.onDropdownFocus},a.props.renderCustomHeader(ut(ut({},a.state),{},{customHeaderCount:r,monthDate:t,changeMonth:a.changeMonth,changeYear:a.changeYear,decreaseMonth:a.decreaseMonth,increaseMonth:a.increaseMonth,decreaseYear:a.decreaseYear,increaseYear:a.increaseYear,prevMonthButtonDisabled:n,nextMonthButtonDisabled:o,prevYearButtonDisabled:s,nextYearButtonDisabled:i})),p&&de.default.createElement(\"div\",{className:\"react-datepicker__day-names\"},a.header(t)))})),Dt(bt(a),\"renderYearHeader\",(function(){var e=a.state.date,t=a.props,r=t.showYearPicker,n=br(e,t.yearItemNumber),o=n.startPeriod,s=n.endPeriod;return de.default.createElement(\"div\",{className:\"react-datepicker__header react-datepicker-year-header\"},r?\"\".concat(o,\" - \").concat(s):Te.default(e))})),Dt(bt(a),\"renderHeader\",(function(e){switch(!0){case void 0!==a.props.renderCustomHeader:return a.renderCustomHeader(e);case a.props.showMonthYearPicker||a.props.showQuarterYearPicker||a.props.showYearPicker:return a.renderYearHeader(e);default:return a.renderDefaultHeader(e)}})),Dt(bt(a),\"renderMonths\",(function(){if(!a.props.showTimeSelectOnly&&!a.props.showYearPicker){for(var e=[],t=a.props.showPreviousMonths?a.props.monthsShown-1:0,r=Ce.default(a.state.date,t),n=0;n0;e.push(de.default.createElement(\"div\",{key:i,ref:function(e){a.monthContainer=e},className:\"react-datepicker__month-container\"},a.renderHeader({monthDate:s,i:n}),de.default.createElement(Rr,{chooseDayAriaLabelPrefix:a.props.chooseDayAriaLabelPrefix,disabledDayAriaLabelPrefix:a.props.disabledDayAriaLabelPrefix,weekAriaLabelPrefix:a.props.weekAriaLabelPrefix,onChange:a.changeMonthYear,day:s,dayClassName:a.props.dayClassName,calendarStartDay:a.props.calendarStartDay,monthClassName:a.props.monthClassName,onDayClick:a.handleDayClick,handleOnKeyDown:a.props.handleOnDayKeyDown,onDayMouseEnter:a.handleDayMouseEnter,onMouseLeave:a.handleMonthMouseLeave,onWeekSelect:a.props.onWeekSelect,orderInDisplay:n,formatWeekNumber:a.props.formatWeekNumber,locale:a.props.locale,minDate:a.props.minDate,maxDate:a.props.maxDate,excludeDates:a.props.excludeDates,highlightDates:a.props.highlightDates,selectingDate:a.state.selectingDate,includeDates:a.props.includeDates,inline:a.props.inline,shouldFocusDayInline:a.props.shouldFocusDayInline,fixedHeight:a.props.fixedHeight,filterDate:a.props.filterDate,preSelection:a.props.preSelection,setPreSelection:a.props.setPreSelection,selected:a.props.selected,selectsStart:a.props.selectsStart,selectsEnd:a.props.selectsEnd,selectsRange:a.props.selectsRange,showWeekNumbers:a.props.showWeekNumbers,startDate:a.props.startDate,endDate:a.props.endDate,peekNextMonth:a.props.peekNextMonth,setOpen:a.props.setOpen,shouldCloseOnSelect:a.props.shouldCloseOnSelect,renderDayContents:a.props.renderDayContents,disabledKeyboardNavigation:a.props.disabledKeyboardNavigation,showMonthYearPicker:a.props.showMonthYearPicker,showFullMonthYearPicker:a.props.showFullMonthYearPicker,showTwoColumnMonthYearPicker:a.props.showTwoColumnMonthYearPicker,showFourColumnMonthYearPicker:a.props.showFourColumnMonthYearPicker,showYearPicker:a.props.showYearPicker,showQuarterYearPicker:a.props.showQuarterYearPicker,isInputFocused:a.props.isInputFocused,containerRef:a.containerRef,monthShowsDuplicateDaysEnd:p,monthShowsDuplicateDaysStart:l})))}return e}})),Dt(bt(a),\"renderYears\",(function(){if(!a.props.showTimeSelectOnly)return a.props.showYearPicker?de.default.createElement(\"div\",{className:\"react-datepicker__year--container\"},a.renderHeader(),de.default.createElement(Ar,vt({onDayClick:a.handleDayClick,date:a.state.date},a.props))):void 0})),Dt(bt(a),\"renderTimeSection\",(function(){if(a.props.showTimeSelect&&(a.state.monthContainer||a.props.showTimeSelectOnly))return de.default.createElement(qr,{selected:a.props.selected,openToDate:a.props.openToDate,onChange:a.props.onTimeChange,timeClassName:a.props.timeClassName,format:a.props.timeFormat,includeTimes:a.props.includeTimes,intervals:a.props.timeIntervals,minTime:a.props.minTime,maxTime:a.props.maxTime,excludeTimes:a.props.excludeTimes,filterTime:a.props.filterTime,timeCaption:a.props.timeCaption,todayButton:a.props.todayButton,showMonthDropdown:a.props.showMonthDropdown,showMonthYearDropdown:a.props.showMonthYearDropdown,showYearDropdown:a.props.showYearDropdown,withPortal:a.props.withPortal,monthRef:a.state.monthContainer,injectTimes:a.props.injectTimes,locale:a.props.locale,handleOnKeyDown:a.props.handleOnKeyDown,showTimeSelectOnly:a.props.showTimeSelectOnly})})),Dt(bt(a),\"renderInputTimeSection\",(function(){var e=new Date(a.props.selected),t=It(e)&&Boolean(a.props.selected)?\"\".concat(kr(e.getHours()),\":\").concat(kr(e.getMinutes())):\"\";if(a.props.showTimeInput)return de.default.createElement(Wr,{date:e,timeString:t,timeInputLabel:a.props.timeInputLabel,onChange:a.props.onTimeChange,customTimeInput:a.props.customTimeInput})})),a.containerRef=de.default.createRef(),a.state={date:a.getDateInView(),selectingDate:null,monthContainer:null},a}return yt(r,[{key:\"componentDidMount\",value:function(){var e=this;this.props.showTimeSelect&&(this.assignMonthContainer=void e.setState({monthContainer:e.monthContainer}))}},{key:\"componentDidUpdate\",value:function(e){this.props.preSelection&&!$t(this.props.preSelection,e.preSelection)?this.setState({date:this.props.preSelection}):this.props.openToDate&&!$t(this.props.openToDate,e.openToDate)&&this.setState({date:this.props.openToDate})}},{key:\"render\",value:function(){var e=this.props.container||Kr;return de.default.createElement(\"div\",{ref:this.containerRef},de.default.createElement(e,{className:ce.default(\"react-datepicker\",this.props.className,{\"react-datepicker--time-only\":this.props.showTimeSelectOnly}),showPopperArrow:this.props.showPopperArrow,arrowProps:this.props.arrowProps},this.renderPreviousButton(),this.renderNextButton(),this.renderMonths(),this.renderYears(),this.renderTodayButton(),this.renderTimeSection(),this.renderInputTimeSection(),this.props.children))}}],[{key:\"defaultProps\",get:function(){return{onDropdownFocus:function(){},monthsShown:1,monthSelectedIn:0,forceShowMonthNavigation:!1,timeCaption:\"Time\",previousYearButtonLabel:\"Previous Year\",nextYearButtonLabel:\"Next Year\",previousMonthButtonLabel:\"Previous Month\",nextMonthButtonLabel:\"Next Month\",customTimeInput:null,yearItemNumber:Ot}}}]),r}(de.default.Component),Hr=function(e){wt(r,e);var t=St(r);function r(e){var a;return ht(this,r),(a=t.call(this,e)).el=document.createElement(\"div\"),a}return yt(r,[{key:\"componentDidMount\",value:function(){this.portalRoot=document.getElementById(this.props.portalId),this.portalRoot||(this.portalRoot=document.createElement(\"div\"),this.portalRoot.setAttribute(\"id\",this.props.portalId),document.body.appendChild(this.portalRoot)),this.portalRoot.appendChild(this.el)}},{key:\"componentWillUnmount\",value:function(){this.portalRoot.removeChild(this.el)}},{key:\"render\",value:function(){return dt.default.createPortal(this.props.children,this.el)}}]),r}(de.default.Component),Qr=function(e){return!e.disabled&&-1!==e.tabIndex},Vr=function(e){wt(r,e);var t=St(r);function r(e){var a;return ht(this,r),Dt(bt(a=t.call(this,e)),\"getTabChildren\",(function(){return Array.prototype.slice.call(a.tabLoopRef.current.querySelectorAll(\"[tabindex], a, button, input, select, textarea\"),1,-1).filter(Qr)})),Dt(bt(a),\"handleFocusStart\",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[t.length-1].focus()})),Dt(bt(a),\"handleFocusEnd\",(function(e){var t=a.getTabChildren();t&&t.length>1&&t[0].focus()})),a.tabLoopRef=de.default.createRef(),a}return yt(r,[{key:\"render\",value:function(){return this.props.enableTabLoop?de.default.createElement(\"div\",{className:\"react-datepicker__tab-loop\",ref:this.tabLoopRef},de.default.createElement(\"div\",{className:\"react-datepicker__tab-loop__start\",tabIndex:\"0\",onFocus:this.handleFocusStart}),this.props.children,de.default.createElement(\"div\",{className:\"react-datepicker__tab-loop__end\",tabIndex:\"0\",onFocus:this.handleFocusEnd})):this.props.children}}],[{key:\"defaultProps\",get:function(){return{enableTabLoop:!0}}}]),r}(de.default.Component),Ur=function(e){wt(r,e);var t=St(r);function r(){return ht(this,r),t.apply(this,arguments)}return yt(r,[{key:\"render\",value:function(){var e,t=this.props,r=t.className,a=t.wrapperClassName,n=t.hidePopper,o=t.popperComponent,s=t.popperModifiers,i=t.popperPlacement,p=t.popperProps,l=t.targetComponent,d=t.enableTabLoop,c=t.popperOnKeyDown,u=t.portalId;if(!n){var f=ce.default(\"react-datepicker-popper\",r);e=de.default.createElement(pe.Popper,vt({modifiers:s,placement:i},p),(function(e){var t=e.ref,r=e.style,a=e.placement,n=e.arrowProps;return de.default.createElement(Vr,{enableTabLoop:d},de.default.createElement(\"div\",{ref:t,style:r,className:f,\"data-placement\":a,onKeyDown:c},de.default.cloneElement(o,{arrowProps:n})))}))}this.props.popperContainer&&(e=de.default.createElement(this.props.popperContainer,{},e)),u&&!n&&(e=de.default.createElement(Hr,{portalId:u},e));var h=ce.default(\"react-datepicker-wrapper\",a);return de.default.createElement(pe.Manager,{className:\"react-datepicker-manager\"},de.default.createElement(pe.Reference,null,(function(e){var t=e.ref;return de.default.createElement(\"div\",{ref:t,className:h},l)})),e)}}],[{key:\"defaultProps\",get:function(){return{hidePopper:!0,popperModifiers:[],popperProps:{},popperPlacement:\"bottom-start\"}}}]),r}(de.default.Component),$r=\"react-datepicker-ignore-onclickoutside\",zr=lt.default(jr);var Gr=\"Date input not valid.\",Jr=function(e){wt(r,e);var t=St(r);function r(e){var a;return ht(this,r),Dt(bt(a=t.call(this,e)),\"getPreSelection\",(function(){return a.props.openToDate?a.props.openToDate:a.props.selectsEnd&&a.props.startDate?a.props.startDate:a.props.selectsStart&&a.props.endDate?a.props.endDate:xt()})),Dt(bt(a),\"calcInitialState\",(function(){var e,t=a.getPreSelection(),r=Dr(a.props),n=vr(a.props),o=r&&nt.default(t,Ve.default(r))?r:n&&at.default(t,Je.default(n))?n:t;return{open:a.props.startOpen||!1,preventFocus:!1,preSelection:null!==(e=a.props.selectsRange?a.props.startDate:a.props.selected)&&void 0!==e?e:o,highlightDates:wr(a.props.highlightDates),focused:!1,shouldFocusDayInline:!1}})),Dt(bt(a),\"clearPreventFocusTimeout\",(function(){a.preventFocusTimeout&&clearTimeout(a.preventFocusTimeout)})),Dt(bt(a),\"setFocus\",(function(){a.input&&a.input.focus&&a.input.focus({preventScroll:!0})})),Dt(bt(a),\"setBlur\",(function(){a.input&&a.input.blur&&a.input.blur(),a.cancelFocusInput()})),Dt(bt(a),\"setOpen\",(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];a.setState({open:e,preSelection:e&&a.state.open?a.state.preSelection:a.calcInitialState().preSelection,lastPreSelectChange:Zr},(function(){e||a.setState((function(e){return{focused:!!t&&e.focused}}),(function(){!t&&a.setBlur(),a.setState({inputValue:null})}))}))})),Dt(bt(a),\"inputOk\",(function(){return ue.default(a.state.preSelection)})),Dt(bt(a),\"isCalendarOpen\",(function(){return void 0===a.props.open?a.state.open&&!a.props.disabled&&!a.props.readOnly:a.props.open})),Dt(bt(a),\"handleFocus\",(function(e){a.state.preventFocus||(a.props.onFocus(e),a.props.preventOpenOnFocus||a.props.readOnly||a.setOpen(!0)),a.setState({focused:!0})})),Dt(bt(a),\"cancelFocusInput\",(function(){clearTimeout(a.inputFocusTimeout),a.inputFocusTimeout=null})),Dt(bt(a),\"deferFocusInput\",(function(){a.cancelFocusInput(),a.inputFocusTimeout=setTimeout((function(){return a.setFocus()}),1)})),Dt(bt(a),\"handleDropdownFocus\",(function(){a.cancelFocusInput()})),Dt(bt(a),\"handleBlur\",(function(e){(!a.state.open||a.props.withPortal||a.props.showTimeInput)&&a.props.onBlur(e),a.setState({focused:!1})})),Dt(bt(a),\"handleCalendarClickOutside\",(function(e){a.props.inline||a.setOpen(!1),a.props.onClickOutside(e),a.props.withPortal&&e.preventDefault()})),Dt(bt(a),\"handleChange\",(function(){for(var e=arguments.length,t=new Array(e),r=0;r &&` helpers in initial condition allow es6 code\n // to co-exist with es5.\n // 2. Replace `for of` with es5 compliant iteration using `for`.\n // Basically, take:\n //\n // ```js\n // for (i of a.entries())\n // if (!b.has(i[0])) return false;\n // ```\n //\n // ... and convert to:\n //\n // ```js\n // it = a.entries();\n // while (!(i = it.next()).done)\n // if (!b.has(i.value[0])) return false;\n // ```\n //\n // **Note**: `i` access switches to `i.value`.\n var it;\n if (hasMap && (a instanceof Map) && (b instanceof Map)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!equal(i.value[1], b.get(i.value[0]))) return false;\n return true;\n }\n\n if (hasSet && (a instanceof Set) && (b instanceof Set)) {\n if (a.size !== b.size) return false;\n it = a.entries();\n while (!(i = it.next()).done)\n if (!b.has(i.value[0])) return false;\n return true;\n }\n // END: Modifications\n\n if (hasArrayBuffer && ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0;)\n if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();\n\n keys = Object.keys(a);\n length = keys.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0;)\n if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;\n // END: fast-deep-equal\n\n // START: react-fast-compare\n // custom handling for DOM elements\n if (hasElementType && a instanceof Element) return false;\n\n // custom handling for React/Preact\n for (i = length; i-- !== 0;) {\n if ((keys[i] === '_owner' || keys[i] === '__v' || keys[i] === '__o') && a.$$typeof) {\n // React-specific: avoid traversing React elements' _owner\n // Preact-specific: avoid traversing Preact elements' __v and __o\n // __v = $_original / $_vnode\n // __o = $_owner\n // These properties contain circular references and are not needed when\n // comparing the actual elements (and not their owners)\n // .$$typeof and ._store on just reasonable markers of elements\n\n continue;\n }\n\n // all other properties should be traversed as usual\n if (!equal(a[keys[i]], b[keys[i]])) return false;\n }\n // END: react-fast-compare\n\n // START: fast-deep-equal\n return true;\n }\n\n return a !== a && b !== b;\n}\n// end fast-deep-equal\n\nmodule.exports = function isEqual(a, b) {\n try {\n return equal(a, b);\n } catch (error) {\n if (((error.message || '').match(/stack|recursion/i))) {\n // warn on circular references, don't crash\n // browsers give this different errors name and messages:\n // chrome/safari: \"RangeError\", \"Maximum call stack size exceeded\"\n // firefox: \"InternalError\", too much recursion\"\n // edge: \"Error\", \"Out of stack space\"\n console.warn('react-fast-compare cannot handle circular refs');\n return false;\n }\n // some other error. we should definitely know about these\n throw error;\n }\n};\n","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\n/**\n * Similar to invariant but only logs a warning if the condition is not met.\n * This can be used to log issues in development environments in critical\n * paths. Removing the logging code for production environments will keep the\n * same logic and follow the same code paths.\n */\n\nvar __DEV__ = process.env.NODE_ENV !== 'production';\n\nvar warning = function() {};\n\nif (__DEV__) {\n var printWarning = function printWarning(format, args) {\n var len = arguments.length;\n args = new Array(len > 1 ? len - 1 : 0);\n for (var key = 1; key < len; key++) {\n args[key - 1] = arguments[key];\n }\n var argIndex = 0;\n var message = 'Warning: ' +\n format.replace(/%s/g, function() {\n return args[argIndex++];\n });\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n }\n\n warning = function(condition, format, args) {\n var len = arguments.length;\n args = new Array(len > 2 ? len - 2 : 0);\n for (var key = 2; key < len; key++) {\n args[key - 2] = arguments[key];\n }\n if (format === undefined) {\n throw new Error(\n '`warning(condition, format, ...args)` requires a warning ' +\n 'message argument'\n );\n }\n if (!condition) {\n printWarning.apply(null, [format].concat(args));\n }\n };\n}\n\nmodule.exports = warning;\n","import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\"; // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\nexport default function setUTCDay(dirtyDate, dirtyDay, dirtyOptions) {\n requiredArgs(2, arguments);\n var options = dirtyOptions || {};\n var locale = options.locale;\n var localeWeekStartsOn = locale && locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n var date = toDate(dirtyDate);\n var day = toInteger(dirtyDay);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}","import getUTCWeekYear from \"../../../_lib/getUTCWeekYear/index.js\";\nimport setUTCDay from \"../../../_lib/setUTCDay/index.js\";\nimport setUTCISODay from \"../../../_lib/setUTCISODay/index.js\";\nimport setUTCISOWeek from \"../../../_lib/setUTCISOWeek/index.js\";\nimport setUTCWeek from \"../../../_lib/setUTCWeek/index.js\";\nimport startOfUTCISOWeek from \"../../../_lib/startOfUTCISOWeek/index.js\";\nimport startOfUTCWeek from \"../../../_lib/startOfUTCWeek/index.js\";\nvar MILLISECONDS_IN_HOUR = 3600000;\nvar MILLISECONDS_IN_MINUTE = 60000;\nvar MILLISECONDS_IN_SECOND = 1000;\nvar numericPatterns = {\n month: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n date: /^(3[0-1]|[0-2]?\\d)/,\n // 0 to 31\n dayOfYear: /^(36[0-6]|3[0-5]\\d|[0-2]?\\d?\\d)/,\n // 0 to 366\n week: /^(5[0-3]|[0-4]?\\d)/,\n // 0 to 53\n hour23h: /^(2[0-3]|[0-1]?\\d)/,\n // 0 to 23\n hour24h: /^(2[0-4]|[0-1]?\\d)/,\n // 0 to 24\n hour11h: /^(1[0-1]|0?\\d)/,\n // 0 to 11\n hour12h: /^(1[0-2]|0?\\d)/,\n // 0 to 12\n minute: /^[0-5]?\\d/,\n // 0 to 59\n second: /^[0-5]?\\d/,\n // 0 to 59\n singleDigit: /^\\d/,\n // 0 to 9\n twoDigits: /^\\d{1,2}/,\n // 0 to 99\n threeDigits: /^\\d{1,3}/,\n // 0 to 999\n fourDigits: /^\\d{1,4}/,\n // 0 to 9999\n anyDigitsSigned: /^-?\\d+/,\n singleDigitSigned: /^-?\\d/,\n // 0 to 9, -0 to -9\n twoDigitsSigned: /^-?\\d{1,2}/,\n // 0 to 99, -0 to -99\n threeDigitsSigned: /^-?\\d{1,3}/,\n // 0 to 999, -0 to -999\n fourDigitsSigned: /^-?\\d{1,4}/ // 0 to 9999, -0 to -9999\n\n};\nvar timezonePatterns = {\n basicOptionalMinutes: /^([+-])(\\d{2})(\\d{2})?|Z/,\n basic: /^([+-])(\\d{2})(\\d{2})|Z/,\n basicOptionalSeconds: /^([+-])(\\d{2})(\\d{2})((\\d{2}))?|Z/,\n extended: /^([+-])(\\d{2}):(\\d{2})|Z/,\n extendedOptionalSeconds: /^([+-])(\\d{2}):(\\d{2})(:(\\d{2}))?|Z/\n};\n\nfunction parseNumericPattern(pattern, string, valueCallback) {\n var matchResult = string.match(pattern);\n\n if (!matchResult) {\n return null;\n }\n\n var value = parseInt(matchResult[0], 10);\n return {\n value: valueCallback ? valueCallback(value) : value,\n rest: string.slice(matchResult[0].length)\n };\n}\n\nfunction parseTimezonePattern(pattern, string) {\n var matchResult = string.match(pattern);\n\n if (!matchResult) {\n return null;\n } // Input is 'Z'\n\n\n if (matchResult[0] === 'Z') {\n return {\n value: 0,\n rest: string.slice(1)\n };\n }\n\n var sign = matchResult[1] === '+' ? 1 : -1;\n var hours = matchResult[2] ? parseInt(matchResult[2], 10) : 0;\n var minutes = matchResult[3] ? parseInt(matchResult[3], 10) : 0;\n var seconds = matchResult[5] ? parseInt(matchResult[5], 10) : 0;\n return {\n value: sign * (hours * MILLISECONDS_IN_HOUR + minutes * MILLISECONDS_IN_MINUTE + seconds * MILLISECONDS_IN_SECOND),\n rest: string.slice(matchResult[0].length)\n };\n}\n\nfunction parseAnyDigitsSigned(string, valueCallback) {\n return parseNumericPattern(numericPatterns.anyDigitsSigned, string, valueCallback);\n}\n\nfunction parseNDigits(n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigit, string, valueCallback);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigits, string, valueCallback);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigits, string, valueCallback);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigits, string, valueCallback);\n\n default:\n return parseNumericPattern(new RegExp('^\\\\d{1,' + n + '}'), string, valueCallback);\n }\n}\n\nfunction parseNDigitsSigned(n, string, valueCallback) {\n switch (n) {\n case 1:\n return parseNumericPattern(numericPatterns.singleDigitSigned, string, valueCallback);\n\n case 2:\n return parseNumericPattern(numericPatterns.twoDigitsSigned, string, valueCallback);\n\n case 3:\n return parseNumericPattern(numericPatterns.threeDigitsSigned, string, valueCallback);\n\n case 4:\n return parseNumericPattern(numericPatterns.fourDigitsSigned, string, valueCallback);\n\n default:\n return parseNumericPattern(new RegExp('^-?\\\\d{1,' + n + '}'), string, valueCallback);\n }\n}\n\nfunction dayPeriodEnumToHours(enumValue) {\n switch (enumValue) {\n case 'morning':\n return 4;\n\n case 'evening':\n return 17;\n\n case 'pm':\n case 'noon':\n case 'afternoon':\n return 12;\n\n case 'am':\n case 'midnight':\n case 'night':\n default:\n return 0;\n }\n}\n\nfunction normalizeTwoDigitYear(twoDigitYear, currentYear) {\n var isCommonEra = currentYear > 0; // Absolute number of the current year:\n // 1 -> 1 AC\n // 0 -> 1 BC\n // -1 -> 2 BC\n\n var absCurrentYear = isCommonEra ? currentYear : 1 - currentYear;\n var result;\n\n if (absCurrentYear <= 50) {\n result = twoDigitYear || 100;\n } else {\n var rangeEnd = absCurrentYear + 50;\n var rangeEndCentury = Math.floor(rangeEnd / 100) * 100;\n var isPreviousCentury = twoDigitYear >= rangeEnd % 100;\n result = twoDigitYear + rangeEndCentury - (isPreviousCentury ? 100 : 0);\n }\n\n return isCommonEra ? result : 1 - result;\n}\n\nvar DAYS_IN_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\nvar DAYS_IN_MONTH_LEAP_YEAR = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; // User for validation\n\nfunction isLeapYearIndex(year) {\n return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0;\n}\n/*\n * | | Unit | | Unit |\n * |-----|--------------------------------|-----|--------------------------------|\n * | a | AM, PM | A* | Milliseconds in day |\n * | b | AM, PM, noon, midnight | B | Flexible day period |\n * | c | Stand-alone local day of week | C* | Localized hour w/ day period |\n * | d | Day of month | D | Day of year |\n * | e | Local day of week | E | Day of week |\n * | f | | F* | Day of week in month |\n * | g* | Modified Julian day | G | Era |\n * | h | Hour [1-12] | H | Hour [0-23] |\n * | i! | ISO day of week | I! | ISO week of year |\n * | j* | Localized hour w/ day period | J* | Localized hour w/o day period |\n * | k | Hour [1-24] | K | Hour [0-11] |\n * | l* | (deprecated) | L | Stand-alone month |\n * | m | Minute | M | Month |\n * | n | | N | |\n * | o! | Ordinal number modifier | O* | Timezone (GMT) |\n * | p | | P | |\n * | q | Stand-alone quarter | Q | Quarter |\n * | r* | Related Gregorian year | R! | ISO week-numbering year |\n * | s | Second | S | Fraction of second |\n * | t! | Seconds timestamp | T! | Milliseconds timestamp |\n * | u | Extended year | U* | Cyclic year |\n * | v* | Timezone (generic non-locat.) | V* | Timezone (location) |\n * | w | Local week of year | W* | Week of month |\n * | x | Timezone (ISO-8601 w/o Z) | X | Timezone (ISO-8601) |\n * | y | Year (abs) | Y | Local week-numbering year |\n * | z* | Timezone (specific non-locat.) | Z* | Timezone (aliases) |\n *\n * Letters marked by * are not implemented but reserved by Unicode standard.\n *\n * Letters marked by ! are non-standard, but implemented by date-fns:\n * - `o` modifies the previous token to turn it into an ordinal (see `parse` docs)\n * - `i` is ISO day of week. For `i` and `ii` is returns numeric ISO week days,\n * i.e. 7 for Sunday, 1 for Monday, etc.\n * - `I` is ISO week of year, as opposed to `w` which is local week of year.\n * - `R` is ISO week-numbering year, as opposed to `Y` which is local week-numbering year.\n * `R` is supposed to be used in conjunction with `I` and `i`\n * for universal ISO week-numbering date, whereas\n * `Y` is supposed to be used in conjunction with `w` and `e`\n * for week-numbering date specific to the locale.\n */\n\n\nvar parsers = {\n // Era\n G: {\n priority: 140,\n parse: function (string, token, match, _options) {\n switch (token) {\n // AD, BC\n case 'G':\n case 'GG':\n case 'GGG':\n return match.era(string, {\n width: 'abbreviated'\n }) || match.era(string, {\n width: 'narrow'\n });\n // A, B\n\n case 'GGGGG':\n return match.era(string, {\n width: 'narrow'\n });\n // Anno Domini, Before Christ\n\n case 'GGGG':\n default:\n return match.era(string, {\n width: 'wide'\n }) || match.era(string, {\n width: 'abbreviated'\n }) || match.era(string, {\n width: 'narrow'\n });\n }\n },\n set: function (date, flags, value, _options) {\n flags.era = value;\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['R', 'u', 't', 'T']\n },\n // Year\n y: {\n // From http://www.unicode.org/reports/tr35/tr35-31/tr35-dates.html#Date_Format_Patterns\n // | Year | y | yy | yyy | yyyy | yyyyy |\n // |----------|-------|----|-------|-------|-------|\n // | AD 1 | 1 | 01 | 001 | 0001 | 00001 |\n // | AD 12 | 12 | 12 | 012 | 0012 | 00012 |\n // | AD 123 | 123 | 23 | 123 | 0123 | 00123 |\n // | AD 1234 | 1234 | 34 | 1234 | 1234 | 01234 |\n // | AD 12345 | 12345 | 45 | 12345 | 12345 | 12345 |\n priority: 130,\n parse: function (string, token, match, _options) {\n var valueCallback = function (year) {\n return {\n year: year,\n isTwoDigitYear: token === 'yy'\n };\n };\n\n switch (token) {\n case 'y':\n return parseNDigits(4, string, valueCallback);\n\n case 'yo':\n return match.ordinalNumber(string, {\n unit: 'year',\n valueCallback: valueCallback\n });\n\n default:\n return parseNDigits(token.length, string, valueCallback);\n }\n },\n validate: function (_date, value, _options) {\n return value.isTwoDigitYear || value.year > 0;\n },\n set: function (date, flags, value, _options) {\n var currentYear = date.getUTCFullYear();\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['Y', 'R', 'u', 'w', 'I', 'i', 'e', 'c', 't', 'T']\n },\n // Local week-numbering year\n Y: {\n priority: 130,\n parse: function (string, token, match, _options) {\n var valueCallback = function (year) {\n return {\n year: year,\n isTwoDigitYear: token === 'YY'\n };\n };\n\n switch (token) {\n case 'Y':\n return parseNDigits(4, string, valueCallback);\n\n case 'Yo':\n return match.ordinalNumber(string, {\n unit: 'year',\n valueCallback: valueCallback\n });\n\n default:\n return parseNDigits(token.length, string, valueCallback);\n }\n },\n validate: function (_date, value, _options) {\n return value.isTwoDigitYear || value.year > 0;\n },\n set: function (date, flags, value, options) {\n var currentYear = getUTCWeekYear(date, options);\n\n if (value.isTwoDigitYear) {\n var normalizedTwoDigitYear = normalizeTwoDigitYear(value.year, currentYear);\n date.setUTCFullYear(normalizedTwoDigitYear, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n }\n\n var year = !('era' in flags) || flags.era === 1 ? value.year : 1 - value.year;\n date.setUTCFullYear(year, 0, options.firstWeekContainsDate);\n date.setUTCHours(0, 0, 0, 0);\n return startOfUTCWeek(date, options);\n },\n incompatibleTokens: ['y', 'R', 'u', 'Q', 'q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']\n },\n // ISO week-numbering year\n R: {\n priority: 130,\n parse: function (string, token, _match, _options) {\n if (token === 'R') {\n return parseNDigitsSigned(4, string);\n }\n\n return parseNDigitsSigned(token.length, string);\n },\n set: function (_date, _flags, value, _options) {\n var firstWeekOfYear = new Date(0);\n firstWeekOfYear.setUTCFullYear(value, 0, 4);\n firstWeekOfYear.setUTCHours(0, 0, 0, 0);\n return startOfUTCISOWeek(firstWeekOfYear);\n },\n incompatibleTokens: ['G', 'y', 'Y', 'u', 'Q', 'q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']\n },\n // Extended year\n u: {\n priority: 130,\n parse: function (string, token, _match, _options) {\n if (token === 'u') {\n return parseNDigitsSigned(4, string);\n }\n\n return parseNDigitsSigned(token.length, string);\n },\n set: function (date, _flags, value, _options) {\n date.setUTCFullYear(value, 0, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['G', 'y', 'Y', 'R', 'w', 'I', 'i', 'e', 'c', 't', 'T']\n },\n // Quarter\n Q: {\n priority: 120,\n parse: function (string, token, match, _options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'Q':\n case 'QQ':\n // 01, 02, 03, 04\n return parseNDigits(token.length, string);\n // 1st, 2nd, 3rd, 4th\n\n case 'Qo':\n return match.ordinalNumber(string, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'QQQ':\n return match.quarter(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'QQQQQ':\n return match.quarter(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'QQQQ':\n default:\n return match.quarter(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.quarter(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 1 && value <= 4;\n },\n set: function (date, _flags, value, _options) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['Y', 'R', 'q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']\n },\n // Stand-alone quarter\n q: {\n priority: 120,\n parse: function (string, token, match, _options) {\n switch (token) {\n // 1, 2, 3, 4\n case 'q':\n case 'qq':\n // 01, 02, 03, 04\n return parseNDigits(token.length, string);\n // 1st, 2nd, 3rd, 4th\n\n case 'qo':\n return match.ordinalNumber(string, {\n unit: 'quarter'\n });\n // Q1, Q2, Q3, Q4\n\n case 'qqq':\n return match.quarter(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1, 2, 3, 4 (narrow quarter; could be not numerical)\n\n case 'qqqqq':\n return match.quarter(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // 1st quarter, 2nd quarter, ...\n\n case 'qqqq':\n default:\n return match.quarter(string, {\n width: 'wide',\n context: 'standalone'\n }) || match.quarter(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.quarter(string, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 1 && value <= 4;\n },\n set: function (date, _flags, value, _options) {\n date.setUTCMonth((value - 1) * 3, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['Y', 'R', 'Q', 'M', 'L', 'w', 'I', 'd', 'D', 'i', 'e', 'c', 't', 'T']\n },\n // Month\n M: {\n priority: 110,\n parse: function (string, token, match, _options) {\n var valueCallback = function (value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'M':\n return parseNumericPattern(numericPatterns.month, string, valueCallback);\n // 01, 02, ..., 12\n\n case 'MM':\n return parseNDigits(2, string, valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Mo':\n return match.ordinalNumber(string, {\n unit: 'month',\n valueCallback: valueCallback\n });\n // Jan, Feb, ..., Dec\n\n case 'MMM':\n return match.month(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // J, F, ..., D\n\n case 'MMMMM':\n return match.month(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // January, February, ..., December\n\n case 'MMMM':\n default:\n return match.month(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.month(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.month(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 11;\n },\n set: function (date, _flags, value, _options) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['Y', 'R', 'q', 'Q', 'L', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']\n },\n // Stand-alone month\n L: {\n priority: 110,\n parse: function (string, token, match, _options) {\n var valueCallback = function (value) {\n return value - 1;\n };\n\n switch (token) {\n // 1, 2, ..., 12\n case 'L':\n return parseNumericPattern(numericPatterns.month, string, valueCallback);\n // 01, 02, ..., 12\n\n case 'LL':\n return parseNDigits(2, string, valueCallback);\n // 1st, 2nd, ..., 12th\n\n case 'Lo':\n return match.ordinalNumber(string, {\n unit: 'month',\n valueCallback: valueCallback\n });\n // Jan, Feb, ..., Dec\n\n case 'LLL':\n return match.month(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // J, F, ..., D\n\n case 'LLLLL':\n return match.month(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // January, February, ..., December\n\n case 'LLLL':\n default:\n return match.month(string, {\n width: 'wide',\n context: 'standalone'\n }) || match.month(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.month(string, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 11;\n },\n set: function (date, _flags, value, _options) {\n date.setUTCMonth(value, 1);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['Y', 'R', 'q', 'Q', 'M', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']\n },\n // Local week of year\n w: {\n priority: 100,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'w':\n return parseNumericPattern(numericPatterns.week, string);\n\n case 'wo':\n return match.ordinalNumber(string, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 1 && value <= 53;\n },\n set: function (date, _flags, value, options) {\n return startOfUTCWeek(setUTCWeek(date, value, options), options);\n },\n incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'i', 't', 'T']\n },\n // ISO week of year\n I: {\n priority: 100,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'I':\n return parseNumericPattern(numericPatterns.week, string);\n\n case 'Io':\n return match.ordinalNumber(string, {\n unit: 'week'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 1 && value <= 53;\n },\n set: function (date, _flags, value, options) {\n return startOfUTCISOWeek(setUTCISOWeek(date, value, options), options);\n },\n incompatibleTokens: ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'e', 'c', 't', 'T']\n },\n // Day of the month\n d: {\n priority: 90,\n subPriority: 1,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'd':\n return parseNumericPattern(numericPatterns.date, string);\n\n case 'do':\n return match.ordinalNumber(string, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (date, value, _options) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n var month = date.getUTCMonth();\n\n if (isLeapYear) {\n return value >= 1 && value <= DAYS_IN_MONTH_LEAP_YEAR[month];\n } else {\n return value >= 1 && value <= DAYS_IN_MONTH[month];\n }\n },\n set: function (date, _flags, value, _options) {\n date.setUTCDate(value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['Y', 'R', 'q', 'Q', 'w', 'I', 'D', 'i', 'e', 'c', 't', 'T']\n },\n // Day of year\n D: {\n priority: 90,\n subPriority: 1,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'D':\n case 'DD':\n return parseNumericPattern(numericPatterns.dayOfYear, string);\n\n case 'Do':\n return match.ordinalNumber(string, {\n unit: 'date'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (date, value, _options) {\n var year = date.getUTCFullYear();\n var isLeapYear = isLeapYearIndex(year);\n\n if (isLeapYear) {\n return value >= 1 && value <= 366;\n } else {\n return value >= 1 && value <= 365;\n }\n },\n set: function (date, _flags, value, _options) {\n date.setUTCMonth(0, value);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['Y', 'R', 'q', 'Q', 'M', 'L', 'w', 'I', 'd', 'E', 'i', 'e', 'c', 't', 'T']\n },\n // Day of week\n E: {\n priority: 90,\n parse: function (string, token, match, _options) {\n switch (token) {\n // Tue\n case 'E':\n case 'EE':\n case 'EEE':\n return match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'EEEEE':\n return match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'EEEEEE':\n return match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'EEEE':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 6;\n },\n set: function (date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['D', 'i', 'e', 'c', 't', 'T']\n },\n // Local day of week\n e: {\n priority: 90,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'e':\n case 'ee':\n // 03\n return parseNDigits(token.length, string, valueCallback);\n // 3rd\n\n case 'eo':\n return match.ordinalNumber(string, {\n unit: 'day',\n valueCallback: valueCallback\n });\n // Tue\n\n case 'eee':\n return match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // T\n\n case 'eeeee':\n return match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tu\n\n case 'eeeeee':\n return match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n // Tuesday\n\n case 'eeee':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.day(string, {\n width: 'short',\n context: 'formatting'\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 6;\n },\n set: function (date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'c', 't', 'T']\n },\n // Stand-alone local day of week\n c: {\n priority: 90,\n parse: function (string, token, match, options) {\n var valueCallback = function (value) {\n var wholeWeekDays = Math.floor((value - 1) / 7) * 7;\n return (value + options.weekStartsOn + 6) % 7 + wholeWeekDays;\n };\n\n switch (token) {\n // 3\n case 'c':\n case 'cc':\n // 03\n return parseNDigits(token.length, string, valueCallback);\n // 3rd\n\n case 'co':\n return match.ordinalNumber(string, {\n unit: 'day',\n valueCallback: valueCallback\n });\n // Tue\n\n case 'ccc':\n return match.day(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(string, {\n width: 'short',\n context: 'standalone'\n }) || match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // T\n\n case 'ccccc':\n return match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tu\n\n case 'cccccc':\n return match.day(string, {\n width: 'short',\n context: 'standalone'\n }) || match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n // Tuesday\n\n case 'cccc':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'standalone'\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'standalone'\n }) || match.day(string, {\n width: 'short',\n context: 'standalone'\n }) || match.day(string, {\n width: 'narrow',\n context: 'standalone'\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 6;\n },\n set: function (date, _flags, value, options) {\n date = setUTCDay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['y', 'R', 'u', 'q', 'Q', 'M', 'L', 'I', 'd', 'D', 'E', 'i', 'e', 't', 'T']\n },\n // ISO day of week\n i: {\n priority: 90,\n parse: function (string, token, match, _options) {\n var valueCallback = function (value) {\n if (value === 0) {\n return 7;\n }\n\n return value;\n };\n\n switch (token) {\n // 2\n case 'i':\n case 'ii':\n // 02\n return parseNDigits(token.length, string);\n // 2nd\n\n case 'io':\n return match.ordinalNumber(string, {\n unit: 'day'\n });\n // Tue\n\n case 'iii':\n return match.day(string, {\n width: 'abbreviated',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n // T\n\n case 'iiiii':\n return match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n // Tu\n\n case 'iiiiii':\n return match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n // Tuesday\n\n case 'iiii':\n default:\n return match.day(string, {\n width: 'wide',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'abbreviated',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'short',\n context: 'formatting',\n valueCallback: valueCallback\n }) || match.day(string, {\n width: 'narrow',\n context: 'formatting',\n valueCallback: valueCallback\n });\n }\n },\n validate: function (_date, value, _options) {\n return value >= 1 && value <= 7;\n },\n set: function (date, _flags, value, options) {\n date = setUTCISODay(date, value, options);\n date.setUTCHours(0, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['y', 'Y', 'u', 'q', 'Q', 'M', 'L', 'w', 'd', 'D', 'E', 'e', 'c', 't', 'T']\n },\n // AM or PM\n a: {\n priority: 80,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'a':\n case 'aa':\n case 'aaa':\n return match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaaa':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'aaaa':\n default:\n return match.dayPeriod(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n set: function (date, _flags, value, _options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['b', 'B', 'H', 'K', 'k', 't', 'T']\n },\n // AM, PM, midnight\n b: {\n priority: 80,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'b':\n case 'bb':\n case 'bbb':\n return match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbbb':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'bbbb':\n default:\n return match.dayPeriod(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n set: function (date, _flags, value, _options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['a', 'B', 'H', 'K', 'k', 't', 'T']\n },\n // in the morning, in the afternoon, in the evening, at night\n B: {\n priority: 80,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'B':\n case 'BB':\n case 'BBB':\n return match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBBB':\n return match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n\n case 'BBBB':\n default:\n return match.dayPeriod(string, {\n width: 'wide',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'abbreviated',\n context: 'formatting'\n }) || match.dayPeriod(string, {\n width: 'narrow',\n context: 'formatting'\n });\n }\n },\n set: function (date, _flags, value, _options) {\n date.setUTCHours(dayPeriodEnumToHours(value), 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['a', 'b', 't', 'T']\n },\n // Hour [1-12]\n h: {\n priority: 70,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'h':\n return parseNumericPattern(numericPatterns.hour12h, string);\n\n case 'ho':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 1 && value <= 12;\n },\n set: function (date, _flags, value, _options) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else if (!isPM && value === 12) {\n date.setUTCHours(0, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n },\n incompatibleTokens: ['H', 'K', 'k', 't', 'T']\n },\n // Hour [0-23]\n H: {\n priority: 70,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'H':\n return parseNumericPattern(numericPatterns.hour23h, string);\n\n case 'Ho':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 23;\n },\n set: function (date, _flags, value, _options) {\n date.setUTCHours(value, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['a', 'b', 'h', 'K', 'k', 't', 'T']\n },\n // Hour [0-11]\n K: {\n priority: 70,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'K':\n return parseNumericPattern(numericPatterns.hour11h, string);\n\n case 'Ko':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 11;\n },\n set: function (date, _flags, value, _options) {\n var isPM = date.getUTCHours() >= 12;\n\n if (isPM && value < 12) {\n date.setUTCHours(value + 12, 0, 0, 0);\n } else {\n date.setUTCHours(value, 0, 0, 0);\n }\n\n return date;\n },\n incompatibleTokens: ['a', 'b', 'h', 'H', 'k', 't', 'T']\n },\n // Hour [1-24]\n k: {\n priority: 70,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'k':\n return parseNumericPattern(numericPatterns.hour24h, string);\n\n case 'ko':\n return match.ordinalNumber(string, {\n unit: 'hour'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 1 && value <= 24;\n },\n set: function (date, _flags, value, _options) {\n var hours = value <= 24 ? value % 24 : value;\n date.setUTCHours(hours, 0, 0, 0);\n return date;\n },\n incompatibleTokens: ['a', 'b', 'h', 'H', 'K', 't', 'T']\n },\n // Minute\n m: {\n priority: 60,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 'm':\n return parseNumericPattern(numericPatterns.minute, string);\n\n case 'mo':\n return match.ordinalNumber(string, {\n unit: 'minute'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 59;\n },\n set: function (date, _flags, value, _options) {\n date.setUTCMinutes(value, 0, 0);\n return date;\n },\n incompatibleTokens: ['t', 'T']\n },\n // Second\n s: {\n priority: 50,\n parse: function (string, token, match, _options) {\n switch (token) {\n case 's':\n return parseNumericPattern(numericPatterns.second, string);\n\n case 'so':\n return match.ordinalNumber(string, {\n unit: 'second'\n });\n\n default:\n return parseNDigits(token.length, string);\n }\n },\n validate: function (_date, value, _options) {\n return value >= 0 && value <= 59;\n },\n set: function (date, _flags, value, _options) {\n date.setUTCSeconds(value, 0);\n return date;\n },\n incompatibleTokens: ['t', 'T']\n },\n // Fraction of second\n S: {\n priority: 30,\n parse: function (string, token, _match, _options) {\n var valueCallback = function (value) {\n return Math.floor(value * Math.pow(10, -token.length + 3));\n };\n\n return parseNDigits(token.length, string, valueCallback);\n },\n set: function (date, _flags, value, _options) {\n date.setUTCMilliseconds(value);\n return date;\n },\n incompatibleTokens: ['t', 'T']\n },\n // Timezone (ISO-8601. +00:00 is `'Z'`)\n X: {\n priority: 10,\n parse: function (string, token, _match, _options) {\n switch (token) {\n case 'X':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);\n\n case 'XX':\n return parseTimezonePattern(timezonePatterns.basic, string);\n\n case 'XXXX':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);\n\n case 'XXXXX':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);\n\n case 'XXX':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string);\n }\n },\n set: function (date, flags, value, _options) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n },\n incompatibleTokens: ['t', 'T', 'x']\n },\n // Timezone (ISO-8601)\n x: {\n priority: 10,\n parse: function (string, token, _match, _options) {\n switch (token) {\n case 'x':\n return parseTimezonePattern(timezonePatterns.basicOptionalMinutes, string);\n\n case 'xx':\n return parseTimezonePattern(timezonePatterns.basic, string);\n\n case 'xxxx':\n return parseTimezonePattern(timezonePatterns.basicOptionalSeconds, string);\n\n case 'xxxxx':\n return parseTimezonePattern(timezonePatterns.extendedOptionalSeconds, string);\n\n case 'xxx':\n default:\n return parseTimezonePattern(timezonePatterns.extended, string);\n }\n },\n set: function (date, flags, value, _options) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n return new Date(date.getTime() - value);\n },\n incompatibleTokens: ['t', 'T', 'X']\n },\n // Seconds timestamp\n t: {\n priority: 40,\n parse: function (string, _token, _match, _options) {\n return parseAnyDigitsSigned(string);\n },\n set: function (_date, _flags, value, _options) {\n return [new Date(value * 1000), {\n timestampIsSet: true\n }];\n },\n incompatibleTokens: '*'\n },\n // Milliseconds timestamp\n T: {\n priority: 20,\n parse: function (string, _token, _match, _options) {\n return parseAnyDigitsSigned(string);\n },\n set: function (_date, _flags, value, _options) {\n return [new Date(value), {\n timestampIsSet: true\n }];\n },\n incompatibleTokens: '*'\n }\n};\nexport default parsers;","import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCWeek from \"../getUTCWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\"; // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\nexport default function setUTCWeek(dirtyDate, dirtyWeek, options) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var week = toInteger(dirtyWeek);\n var diff = getUTCWeek(date, options) - week;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}","import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport getUTCISOWeek from \"../getUTCISOWeek/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\"; // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\nexport default function setUTCISOWeek(dirtyDate, dirtyISOWeek) {\n requiredArgs(2, arguments);\n var date = toDate(dirtyDate);\n var isoWeek = toInteger(dirtyISOWeek);\n var diff = getUTCISOWeek(date) - isoWeek;\n date.setUTCDate(date.getUTCDate() - diff * 7);\n return date;\n}","import toInteger from \"../toInteger/index.js\";\nimport toDate from \"../../toDate/index.js\";\nimport requiredArgs from \"../requiredArgs/index.js\"; // This function will be a part of public API when UTC function will be implemented.\n// See issue: https://github.com/date-fns/date-fns/issues/376\n\nexport default function setUTCISODay(dirtyDate, dirtyDay) {\n requiredArgs(2, arguments);\n var day = toInteger(dirtyDay);\n\n if (day % 7 === 0) {\n day = day - 7;\n }\n\n var weekStartsOn = 1;\n var date = toDate(dirtyDate);\n var currentDay = date.getUTCDay();\n var remainder = day % 7;\n var dayIndex = (remainder + 7) % 7;\n var diff = (dayIndex < weekStartsOn ? 7 : 0) + day - currentDay;\n date.setUTCDate(date.getUTCDate() + diff);\n return date;\n}","import defaultLocale from \"../locale/en-US/index.js\";\nimport subMilliseconds from \"../subMilliseconds/index.js\";\nimport toDate from \"../toDate/index.js\";\nimport assign from \"../_lib/assign/index.js\";\nimport longFormatters from \"../_lib/format/longFormatters/index.js\";\nimport getTimezoneOffsetInMilliseconds from \"../_lib/getTimezoneOffsetInMilliseconds/index.js\";\nimport { isProtectedDayOfYearToken, isProtectedWeekYearToken, throwProtectedError } from \"../_lib/protectedTokens/index.js\";\nimport toInteger from \"../_lib/toInteger/index.js\";\nimport parsers from \"./_lib/parsers/index.js\";\nimport requiredArgs from \"../_lib/requiredArgs/index.js\";\nvar TIMEZONE_UNIT_PRIORITY = 10; // This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\n\nvar formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g; // This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\n\nvar longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\nvar escapedStringRegExp = /^'([^]*?)'?$/;\nvar doubleQuoteRegExp = /''/g;\nvar notWhitespaceRegExp = /\\S/;\nvar unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n/**\n * @name parse\n * @category Common Helpers\n * @summary Parse the date.\n *\n * @description\n * Return the date parsed from string using the given format string.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://git.io/fxCyr\n *\n * The characters in the format string wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n *\n * Format of the format string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 5 below the table).\n *\n * Not all tokens are compatible. Combinations that don't make sense or could lead to bugs are prohibited\n * and will throw `RangeError`. For example usage of 24-hour format token with AM/PM token will throw an exception:\n *\n * ```javascript\n * parse('23 AM', 'HH a', new Date())\n * //=> RangeError: The format string mustn't contain `HH` and `a` at the same time\n * ```\n *\n * See the compatibility table: https://docs.google.com/spreadsheets/d/e/2PACX-1vQOPU3xUhplll6dyoMmVUXHKl_8CRDs6_ueLmex3SoqwhuolkuN3O05l4rqx5h1dKX8eb46Ul-CCSrq/pubhtml?gid=0&single=true\n *\n * Accepted format string patterns:\n * | Unit |Prior| Pattern | Result examples | Notes |\n * |---------------------------------|-----|---------|-----------------------------------|-------|\n * | Era | 140 | G..GGG | AD, BC | |\n * | | | GGGG | Anno Domini, Before Christ | 2 |\n * | | | GGGGG | A, B | |\n * | Calendar year | 130 | y | 44, 1, 1900, 2017, 9999 | 4 |\n * | | | yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | yy | 44, 01, 00, 17 | 4 |\n * | | | yyy | 044, 001, 123, 999 | 4 |\n * | | | yyyy | 0044, 0001, 1900, 2017 | 4 |\n * | | | yyyyy | ... | 2,4 |\n * | Local week-numbering year | 130 | Y | 44, 1, 1900, 2017, 9000 | 4 |\n * | | | Yo | 44th, 1st, 1900th, 9999999th | 4,5 |\n * | | | YY | 44, 01, 00, 17 | 4,6 |\n * | | | YYY | 044, 001, 123, 999 | 4 |\n * | | | YYYY | 0044, 0001, 1900, 2017 | 4,6 |\n * | | | YYYYY | ... | 2,4 |\n * | ISO week-numbering year | 130 | R | -43, 1, 1900, 2017, 9999, -9999 | 4,5 |\n * | | | RR | -43, 01, 00, 17 | 4,5 |\n * | | | RRR | -043, 001, 123, 999, -999 | 4,5 |\n * | | | RRRR | -0043, 0001, 2017, 9999, -9999 | 4,5 |\n * | | | RRRRR | ... | 2,4,5 |\n * | Extended year | 130 | u | -43, 1, 1900, 2017, 9999, -999 | 4 |\n * | | | uu | -43, 01, 99, -99 | 4 |\n * | | | uuu | -043, 001, 123, 999, -999 | 4 |\n * | | | uuuu | -0043, 0001, 2017, 9999, -9999 | 4 |\n * | | | uuuuu | ... | 2,4 |\n * | Quarter (formatting) | 120 | Q | 1, 2, 3, 4 | |\n * | | | Qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | QQ | 01, 02, 03, 04 | |\n * | | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | 120 | q | 1, 2, 3, 4 | |\n * | | | qo | 1st, 2nd, 3rd, 4th | 5 |\n * | | | qq | 01, 02, 03, 04 | |\n * | | | qqq | Q1, Q2, Q3, Q4 | |\n * | | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | | qqqqq | 1, 2, 3, 4 | 3 |\n * | Month (formatting) | 110 | M | 1, 2, ..., 12 | |\n * | | | Mo | 1st, 2nd, ..., 12th | 5 |\n * | | | MM | 01, 02, ..., 12 | |\n * | | | MMM | Jan, Feb, ..., Dec | |\n * | | | MMMM | January, February, ..., December | 2 |\n * | | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | 110 | L | 1, 2, ..., 12 | |\n * | | | Lo | 1st, 2nd, ..., 12th | 5 |\n * | | | LL | 01, 02, ..., 12 | |\n * | | | LLL | Jan, Feb, ..., Dec | |\n * | | | LLLL | January, February, ..., December | 2 |\n * | | | LLLLL | J, F, ..., D | |\n * | Local week of year | 100 | w | 1, 2, ..., 53 | |\n * | | | wo | 1st, 2nd, ..., 53th | 5 |\n * | | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | 100 | I | 1, 2, ..., 53 | 5 |\n * | | | Io | 1st, 2nd, ..., 53th | 5 |\n * | | | II | 01, 02, ..., 53 | 5 |\n * | Day of month | 90 | d | 1, 2, ..., 31 | |\n * | | | do | 1st, 2nd, ..., 31st | 5 |\n * | | | dd | 01, 02, ..., 31 | |\n * | Day of year | 90 | D | 1, 2, ..., 365, 366 | 7 |\n * | | | Do | 1st, 2nd, ..., 365th, 366th | 5 |\n * | | | DD | 01, 02, ..., 365, 366 | 7 |\n * | | | DDD | 001, 002, ..., 365, 366 | |\n * | | | DDDD | ... | 2 |\n * | Day of week (formatting) | 90 | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | | EEEEE | M, T, W, T, F, S, S | |\n * | | | EEEEEE | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | ISO day of week (formatting) | 90 | i | 1, 2, 3, ..., 7 | 5 |\n * | | | io | 1st, 2nd, ..., 7th | 5 |\n * | | | ii | 01, 02, ..., 07 | 5 |\n * | | | iii | Mon, Tue, Wed, ..., Sun | 5 |\n * | | | iiii | Monday, Tuesday, ..., Sunday | 2,5 |\n * | | | iiiii | M, T, W, T, F, S, S | 5 |\n * | | | iiiiii | Mo, Tu, We, Th, Fr, Su, Sa | 5 |\n * | Local day of week (formatting) | 90 | e | 2, 3, 4, ..., 1 | |\n * | | | eo | 2nd, 3rd, ..., 1st | 5 |\n * | | | ee | 02, 03, ..., 01 | |\n * | | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | | eeeee | M, T, W, T, F, S, S | |\n * | | | eeeeee | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | Local day of week (stand-alone) | 90 | c | 2, 3, 4, ..., 1 | |\n * | | | co | 2nd, 3rd, ..., 1st | 5 |\n * | | | cc | 02, 03, ..., 01 | |\n * | | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | | ccccc | M, T, W, T, F, S, S | |\n * | | | cccccc | Mo, Tu, We, Th, Fr, Su, Sa | |\n * | AM, PM | 80 | a..aaa | AM, PM | |\n * | | | aaaa | a.m., p.m. | 2 |\n * | | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | 80 | b..bbb | AM, PM, noon, midnight | |\n * | | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | | bbbbb | a, p, n, mi | |\n * | Flexible day period | 80 | B..BBB | at night, in the morning, ... | |\n * | | | BBBB | at night, in the morning, ... | 2 |\n * | | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | 70 | h | 1, 2, ..., 11, 12 | |\n * | | | ho | 1st, 2nd, ..., 11th, 12th | 5 |\n * | | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | 70 | H | 0, 1, 2, ..., 23 | |\n * | | | Ho | 0th, 1st, 2nd, ..., 23rd | 5 |\n * | | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | 70 | K | 1, 2, ..., 11, 0 | |\n * | | | Ko | 1st, 2nd, ..., 11th, 0th | 5 |\n * | | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | 70 | k | 24, 1, 2, ..., 23 | |\n * | | | ko | 24th, 1st, 2nd, ..., 23rd | 5 |\n * | | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | 60 | m | 0, 1, ..., 59 | |\n * | | | mo | 0th, 1st, ..., 59th | 5 |\n * | | | mm | 00, 01, ..., 59 | |\n * | Second | 50 | s | 0, 1, ..., 59 | |\n * | | | so | 0th, 1st, ..., 59th | 5 |\n * | | | ss | 00, 01, ..., 59 | |\n * | Seconds timestamp | 40 | t | 512969520 | |\n * | | | tt | ... | 2 |\n * | Fraction of second | 30 | S | 0, 1, ..., 9 | |\n * | | | SS | 00, 01, ..., 99 | |\n * | | | SSS | 000, 0001, ..., 999 | |\n * | | | SSSS | ... | 2 |\n * | Milliseconds timestamp | 20 | T | 512969520900 | |\n * | | | TT | ... | 2 |\n * | Timezone (ISO-8601 w/ Z) | 10 | X | -08, +0530, Z | |\n * | | | XX | -0800, +0530, Z | |\n * | | | XXX | -08:00, +05:30, Z | |\n * | | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | 10 | x | -08, +0530, +00 | |\n * | | | xx | -0800, +0530, +0000 | |\n * | | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Long localized date | NA | P | 05/29/1453 | 5,8 |\n * | | | PP | May 29, 1453 | |\n * | | | PPP | May 29th, 1453 | |\n * | | | PPPP | Sunday, May 29th, 1453 | 2,5,8 |\n * | Long localized time | NA | p | 12:00 AM | 5,8 |\n * | | | pp | 12:00:00 AM | |\n * | Combination of date and time | NA | Pp | 05/29/1453, 12:00 AM | |\n * | | | PPpp | May 29, 1453, 12:00:00 AM | |\n * | | | PPPpp | May 29th, 1453 at ... | |\n * | | | PPPPpp | Sunday, May 29th, 1453 at ... | 2,5,8 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular.\n * In `format` function, they will produce different result:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * `parse` will try to match both formatting and stand-alone units interchangably.\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table:\n * - for numerical units (`yyyyyyyy`) `parse` will try to match a number\n * as wide as the sequence\n * - for text units (`MMMMMMMM`) `parse` will try to match the widest variation of the unit.\n * These variations are marked with \"2\" in the last column of the table.\n *\n * 3. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 4. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` will try to guess the century of two digit year by proximity with `referenceDate`:\n *\n * `parse('50', 'yy', new Date(2018, 0, 1)) //=> Sat Jan 01 2050 00:00:00`\n *\n * `parse('75', 'yy', new Date(2018, 0, 1)) //=> Wed Jan 01 1975 00:00:00`\n *\n * while `uu` will just assign the year as is:\n *\n * `parse('50', 'uu', new Date(2018, 0, 1)) //=> Sat Jan 01 0050 00:00:00`\n *\n * `parse('75', 'uu', new Date(2018, 0, 1)) //=> Tue Jan 01 0075 00:00:00`\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [setISOWeekYear]{@link https://date-fns.org/docs/setISOWeekYear}\n * and [setWeekYear]{@link https://date-fns.org/docs/setWeekYear}).\n *\n * 5. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 6. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://git.io/fxCyr\n *\n * 7. `D` and `DD` tokens represent days of the year but they are ofthen confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://git.io/fxCyr\n *\n * 8. `P+` tokens do not have a defined priority since they are merely aliases to other tokens based\n * on the given locale.\n *\n * using `en-US` locale: `P` => `MM/dd/yyyy`\n * using `en-US` locale: `p` => `hh:mm a`\n * using `pt-BR` locale: `P` => `dd/MM/yyyy`\n * using `pt-BR` locale: `p` => `HH:mm`\n *\n * Values will be assigned to the date in the descending order of its unit's priority.\n * Units of an equal priority overwrite each other in the order of appearance.\n *\n * If no values of higher priority are parsed (e.g. when parsing string 'January 1st' without a year),\n * the values will be taken from 3rd argument `referenceDate` which works as a context of parsing.\n *\n * `referenceDate` must be passed for correct work of the function.\n * If you're not sure which `referenceDate` to supply, create a new instance of Date:\n * `parse('02/11/2014', 'MM/dd/yyyy', new Date())`\n * In this case parsing will be done in the context of the current date.\n * If `referenceDate` is `Invalid Date` or a value not convertible to valid `Date`,\n * then `Invalid Date` will be returned.\n *\n * The result may vary by locale.\n *\n * If `formatString` matches with `dateString` but does not provides tokens, `referenceDate` will be returned.\n *\n * If parsing failed, `Invalid Date` will be returned.\n * Invalid Date is a Date, whose time value is NaN.\n * Time value of Date: http://es5.github.io/#x15.9.1.1\n *\n * ### v2.0.0 breaking changes:\n *\n * - [Changes that are common for the whole library](https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#Common-Changes).\n *\n * - Old `parse` was renamed to `toDate`.\n * Now `parse` is a new function which parses a string using a provided format.\n *\n * ```javascript\n * // Before v2.0.0\n * parse('2016-01-01')\n *\n * // v2.0.0 onward (toDate no longer accepts a string)\n * toDate(1392098430000) // Unix to timestamp\n * toDate(new Date(2014, 1, 11, 11, 30, 30)) // Cloning the date\n * parse('2016-01-01', 'yyyy-MM-dd', new Date())\n * ```\n *\n * @param {String} dateString - the string to parse\n * @param {String} formatString - the string of tokens\n * @param {Date|Number} referenceDate - defines values missing from the parsed dateString\n * @param {Object} [options] - an object with options.\n * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}\n * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)\n * @param {1|2|3|4|5|6|7} [options.firstWeekContainsDate=1] - the day of January, which is always in the first week of the year\n * @param {Boolean} [options.useAdditionalWeekYearTokens=false] - if true, allows usage of the week-numbering year tokens `YY` and `YYYY`;\n * see: https://git.io/fxCyr\n * @param {Boolean} [options.useAdditionalDayOfYearTokens=false] - if true, allows usage of the day of year tokens `D` and `DD`;\n * see: https://git.io/fxCyr\n * @returns {Date} the parsed date\n * @throws {TypeError} 3 arguments required\n * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6\n * @throws {RangeError} `options.firstWeekContainsDate` must be between 1 and 7\n * @throws {RangeError} `options.locale` must contain `match` property\n * @throws {RangeError} use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr\n * @throws {RangeError} use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://git.io/fxCyr\n * @throws {RangeError} use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr\n * @throws {RangeError} use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://git.io/fxCyr\n * @throws {RangeError} format string contains an unescaped latin alphabet character\n *\n * @example\n * // Parse 11 February 2014 from middle-endian format:\n * var result = parse('02/11/2014', 'MM/dd/yyyy', new Date())\n * //=> Tue Feb 11 2014 00:00:00\n *\n * @example\n * // Parse 28th of February in Esperanto locale in the context of 2010 year:\n * import eo from 'date-fns/locale/eo'\n * var result = parse('28-a de februaro', \"do 'de' MMMM\", new Date(2010, 0, 1), {\n * locale: eo\n * })\n * //=> Sun Feb 28 2010 00:00:00\n */\n\nexport default function parse(dirtyDateString, dirtyFormatString, dirtyReferenceDate, dirtyOptions) {\n requiredArgs(3, arguments);\n var dateString = String(dirtyDateString);\n var formatString = String(dirtyFormatString);\n var options = dirtyOptions || {};\n var locale = options.locale || defaultLocale;\n\n if (!locale.match) {\n throw new RangeError('locale must contain match property');\n }\n\n var localeFirstWeekContainsDate = locale.options && locale.options.firstWeekContainsDate;\n var defaultFirstWeekContainsDate = localeFirstWeekContainsDate == null ? 1 : toInteger(localeFirstWeekContainsDate);\n var firstWeekContainsDate = options.firstWeekContainsDate == null ? defaultFirstWeekContainsDate : toInteger(options.firstWeekContainsDate); // Test if weekStartsOn is between 1 and 7 _and_ is not NaN\n\n if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {\n throw new RangeError('firstWeekContainsDate must be between 1 and 7 inclusively');\n }\n\n var localeWeekStartsOn = locale.options && locale.options.weekStartsOn;\n var defaultWeekStartsOn = localeWeekStartsOn == null ? 0 : toInteger(localeWeekStartsOn);\n var weekStartsOn = options.weekStartsOn == null ? defaultWeekStartsOn : toInteger(options.weekStartsOn); // Test if weekStartsOn is between 0 and 6 _and_ is not NaN\n\n if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {\n throw new RangeError('weekStartsOn must be between 0 and 6 inclusively');\n }\n\n if (formatString === '') {\n if (dateString === '') {\n return toDate(dirtyReferenceDate);\n } else {\n return new Date(NaN);\n }\n }\n\n var subFnOptions = {\n firstWeekContainsDate: firstWeekContainsDate,\n weekStartsOn: weekStartsOn,\n locale: locale\n }; // If timezone isn't specified, it will be set to the system timezone\n\n var setters = [{\n priority: TIMEZONE_UNIT_PRIORITY,\n subPriority: -1,\n set: dateToSystemTimezone,\n index: 0\n }];\n var i;\n var tokens = formatString.match(longFormattingTokensRegExp).map(function (substring) {\n var firstCharacter = substring[0];\n\n if (firstCharacter === 'p' || firstCharacter === 'P') {\n var longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong, subFnOptions);\n }\n\n return substring;\n }).join('').match(formattingTokensRegExp);\n var usedTokens = [];\n\n for (i = 0; i < tokens.length; i++) {\n var token = tokens[i];\n\n if (!options.useAdditionalWeekYearTokens && isProtectedWeekYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n if (!options.useAdditionalDayOfYearTokens && isProtectedDayOfYearToken(token)) {\n throwProtectedError(token, formatString, dirtyDateString);\n }\n\n var firstCharacter = token[0];\n var parser = parsers[firstCharacter];\n\n if (parser) {\n var incompatibleTokens = parser.incompatibleTokens;\n\n if (Array.isArray(incompatibleTokens)) {\n var incompatibleToken = void 0;\n\n for (var _i = 0; _i < usedTokens.length; _i++) {\n var usedToken = usedTokens[_i].token;\n\n if (incompatibleTokens.indexOf(usedToken) !== -1 || usedToken === firstCharacter) {\n incompatibleToken = usedTokens[_i];\n break;\n }\n }\n\n if (incompatibleToken) {\n throw new RangeError(\"The format string mustn't contain `\".concat(incompatibleToken.fullToken, \"` and `\").concat(token, \"` at the same time\"));\n }\n } else if (parser.incompatibleTokens === '*' && usedTokens.length) {\n throw new RangeError(\"The format string mustn't contain `\".concat(token, \"` and any other token at the same time\"));\n }\n\n usedTokens.push({\n token: firstCharacter,\n fullToken: token\n });\n var parseResult = parser.parse(dateString, token, locale.match, subFnOptions);\n\n if (!parseResult) {\n return new Date(NaN);\n }\n\n setters.push({\n priority: parser.priority,\n subPriority: parser.subPriority || 0,\n set: parser.set,\n validate: parser.validate,\n value: parseResult.value,\n index: setters.length\n });\n dateString = parseResult.rest;\n } else {\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError('Format string contains an unescaped latin alphabet character `' + firstCharacter + '`');\n } // Replace two single quote characters with one single quote character\n\n\n if (token === \"''\") {\n token = \"'\";\n } else if (firstCharacter === \"'\") {\n token = cleanEscapedString(token);\n } // Cut token from string, or, if string doesn't match the token, return Invalid Date\n\n\n if (dateString.indexOf(token) === 0) {\n dateString = dateString.slice(token.length);\n } else {\n return new Date(NaN);\n }\n }\n } // Check if the remaining input contains something other than whitespace\n\n\n if (dateString.length > 0 && notWhitespaceRegExp.test(dateString)) {\n return new Date(NaN);\n }\n\n var uniquePrioritySetters = setters.map(function (setter) {\n return setter.priority;\n }).sort(function (a, b) {\n return b - a;\n }).filter(function (priority, index, array) {\n return array.indexOf(priority) === index;\n }).map(function (priority) {\n return setters.filter(function (setter) {\n return setter.priority === priority;\n }).sort(function (a, b) {\n return b.subPriority - a.subPriority;\n });\n }).map(function (setterArray) {\n return setterArray[0];\n });\n var date = toDate(dirtyReferenceDate);\n\n if (isNaN(date)) {\n return new Date(NaN);\n } // Convert the date in system timezone to the same date in UTC+00:00 timezone.\n // This ensures that when UTC functions will be implemented, locales will be compatible with them.\n // See an issue about UTC functions: https://github.com/date-fns/date-fns/issues/37\n\n\n var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));\n var flags = {};\n\n for (i = 0; i < uniquePrioritySetters.length; i++) {\n var setter = uniquePrioritySetters[i];\n\n if (setter.validate && !setter.validate(utcDate, setter.value, subFnOptions)) {\n return new Date(NaN);\n }\n\n var result = setter.set(utcDate, flags, setter.value, subFnOptions); // Result is tuple (date, flags)\n\n if (result[0]) {\n utcDate = result[0];\n assign(flags, result[1]); // Result is date\n } else {\n utcDate = result;\n }\n }\n\n return utcDate;\n}\n\nfunction dateToSystemTimezone(date, flags) {\n if (flags.timestampIsSet) {\n return date;\n }\n\n var convertedDate = new Date(0);\n convertedDate.setFullYear(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n convertedDate.setHours(date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds());\n return convertedDate;\n}\n\nfunction cleanEscapedString(input) {\n return input.match(escapedStringRegExp)[1].replace(doubleQuoteRegExp, \"'\");\n}","import _curry2 from './_curry2.js';\nimport _xfBase from './_xfBase.js';\n\nvar XFilter = /*#__PURE__*/function () {\n function XFilter(f, xf) {\n this.xf = xf;\n this.f = f;\n }\n XFilter.prototype['@@transducer/init'] = _xfBase.init;\n XFilter.prototype['@@transducer/result'] = _xfBase.result;\n XFilter.prototype['@@transducer/step'] = function (result, input) {\n return this.f(input) ? this.xf['@@transducer/step'](result, input) : result;\n };\n\n return XFilter;\n}();\n\nvar _xfilter = /*#__PURE__*/_curry2(function _xfilter(f, xf) {\n return new XFilter(f, xf);\n});\nexport default _xfilter;","import _curry2 from './internal/_curry2.js';\nimport _dispatchable from './internal/_dispatchable.js';\nimport _filter from './internal/_filter.js';\nimport _isObject from './internal/_isObject.js';\nimport _reduce from './internal/_reduce.js';\nimport _xfilter from './internal/_xfilter.js';\nimport keys from './keys.js';\n\n/**\n * Takes a predicate and a `Filterable`, and returns a new filterable of the\n * same type containing the members of the given filterable which satisfy the\n * given predicate. Filterable objects include plain objects or any object\n * that has a filter method such as `Array`.\n *\n * Dispatches to the `filter` method of the second argument, if present.\n *\n * Acts as a transducer if a transformer is given in list position.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category List\n * @sig Filterable f => (a -> Boolean) -> f a -> f a\n * @param {Function} pred\n * @param {Array} filterable\n * @return {Array} Filterable\n * @see R.reject, R.transduce, R.addIndex\n * @example\n *\n * const isEven = n => n % 2 === 0;\n *\n * R.filter(isEven, [1, 2, 3, 4]); //=> [2, 4]\n *\n * R.filter(isEven, {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, d: 4}\n */\nvar filter = /*#__PURE__*/_curry2( /*#__PURE__*/_dispatchable(['filter'], _xfilter, function (pred, filterable) {\n return _isObject(filterable) ? _reduce(function (acc, key) {\n if (pred(filterable[key])) {\n acc[key] = filterable[key];\n }\n return acc;\n }, {}, keys(filterable)) :\n // else\n _filter(pred, filterable);\n}));\nexport default filter;","export default function _filter(fn, list) {\n var idx = 0;\n var len = list.length;\n var result = [];\n\n while (idx < len) {\n if (fn(list[idx])) {\n result[result.length] = list[idx];\n }\n idx += 1;\n }\n return result;\n}","\n\n/**\n * A function that always returns `true`. Any passed in parameters are ignored.\n *\n * @func\n * @memberOf R\n * @since v0.9.0\n * @category Function\n * @sig * -> Boolean\n * @param {*}\n * @return {Boolean}\n * @see R.F\n * @example\n *\n * R.T(); //=> true\n */\nvar T = function () {\n return true;\n};\nexport default T;","import _curry2 from './internal/_curry2.js';\n\n/**\n * Returns a partial copy of an object omitting the keys specified.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Object\n * @sig [String] -> {String: *} -> {String: *}\n * @param {Array} names an array of String property names to omit from the new object\n * @param {Object} obj The object to copy from\n * @return {Object} A new object with properties from `names` not on it.\n * @see R.pick\n * @example\n *\n * R.omit(['a', 'd'], {a: 1, b: 2, c: 3, d: 4}); //=> {b: 2, c: 3}\n */\nvar omit = /*#__PURE__*/_curry2(function omit(names, obj) {\n var result = {};\n var index = {};\n var idx = 0;\n var len = names.length;\n\n while (idx < len) {\n index[names[idx]] = 1;\n idx += 1;\n }\n\n for (var prop in obj) {\n if (!index.hasOwnProperty(prop)) {\n result[prop] = obj[prop];\n }\n }\n return result;\n});\nexport default omit;","import _curry2 from './internal/_curry2.js';\n\n/**\n * Returns the larger of its two arguments.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Relation\n * @sig Ord a => a -> a -> a\n * @param {*} a\n * @param {*} b\n * @return {*}\n * @see R.maxBy, R.min\n * @example\n *\n * R.max(789, 123); //=> 789\n * R.max('a', 'b'); //=> 'b'\n */\nvar max = /*#__PURE__*/_curry2(function max(a, b) {\n return b > a ? b : a;\n});\nexport default max;","import _arity from './internal/_arity.js';\nimport _curry1 from './internal/_curry1.js';\nimport map from './map.js';\nimport max from './max.js';\nimport reduce from './reduce.js';\n\n/**\n * Returns a function, `fn`, which encapsulates `if/else, if/else, ...` logic.\n * `R.cond` takes a list of [predicate, transformer] pairs. All of the arguments\n * to `fn` are applied to each of the predicates in turn until one returns a\n * \"truthy\" value, at which point `fn` returns the result of applying its\n * arguments to the corresponding transformer. If none of the predicates\n * matches, `fn` returns undefined.\n *\n * @func\n * @memberOf R\n * @since v0.6.0\n * @category Logic\n * @sig [[(*... -> Boolean),(*... -> *)]] -> (*... -> *)\n * @param {Array} pairs A list of [predicate, transformer]\n * @return {Function}\n * @see R.ifElse, R.unless, R.when\n * @example\n *\n * const fn = R.cond([\n * [R.equals(0), R.always('water freezes at 0°C')],\n * [R.equals(100), R.always('water boils at 100°C')],\n * [R.T, temp => 'nothing special happens at ' + temp + '°C']\n * ]);\n * fn(0); //=> 'water freezes at 0°C'\n * fn(50); //=> 'nothing special happens at 50°C'\n * fn(100); //=> 'water boils at 100°C'\n */\nvar cond = /*#__PURE__*/_curry1(function cond(pairs) {\n var arity = reduce(max, 0, map(function (pair) {\n return pair[0].length;\n }, pairs));\n return _arity(arity, function () {\n var idx = 0;\n while (idx < pairs.length) {\n if (pairs[idx][0].apply(this, arguments)) {\n return pairs[idx][1].apply(this, arguments);\n }\n idx += 1;\n }\n });\n});\nexport default cond;","export default function _pipe(f, g) {\n return function () {\n return g.call(this, f.apply(this, arguments));\n };\n}","import _arity from './internal/_arity.js';\nimport _pipe from './internal/_pipe.js';\nimport reduce from './reduce.js';\nimport tail from './tail.js';\n\n/**\n * Performs left-to-right function composition. The leftmost function may have\n * any arity; the remaining functions must be unary.\n *\n * In some libraries this function is named `sequence`.\n *\n * **Note:** The result of pipe is not automatically curried.\n *\n * @func\n * @memberOf R\n * @since v0.1.0\n * @category Function\n * @sig (((a, b, ..., n) -> o), (o -> p), ..., (x -> y), (y -> z)) -> ((a, b, ..., n) -> z)\n * @param {...Function} functions\n * @return {Function}\n * @see R.compose\n * @example\n *\n * const f = R.pipe(Math.pow, R.negate, R.inc);\n *\n * f(3, 4); // -(3^4) + 1\n * @symb R.pipe(f, g, h)(a, b) = h(g(f(a, b)))\n */\nexport default function pipe() {\n if (arguments.length === 0) {\n throw new Error('pipe requires at least one argument');\n }\n return _arity(arguments[0].length, reduce(_pipe, arguments[0], tail(arguments)));\n}","/** @license React v16.12.0\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var h=require(\"object-assign\"),n=\"function\"===typeof Symbol&&Symbol.for,p=n?Symbol.for(\"react.element\"):60103,q=n?Symbol.for(\"react.portal\"):60106,r=n?Symbol.for(\"react.fragment\"):60107,t=n?Symbol.for(\"react.strict_mode\"):60108,u=n?Symbol.for(\"react.profiler\"):60114,v=n?Symbol.for(\"react.provider\"):60109,w=n?Symbol.for(\"react.context\"):60110,x=n?Symbol.for(\"react.forward_ref\"):60112,y=n?Symbol.for(\"react.suspense\"):60113;n&&Symbol.for(\"react.suspense_list\");\nvar z=n?Symbol.for(\"react.memo\"):60115,aa=n?Symbol.for(\"react.lazy\"):60116;n&&Symbol.for(\"react.fundamental\");n&&Symbol.for(\"react.responder\");n&&Symbol.for(\"react.scope\");var A=\"function\"===typeof Symbol&&Symbol.iterator;\nfunction B(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cP.length&&P.push(a)}\nfunction S(a,b,c,e){var d=typeof a;if(\"undefined\"===d||\"boolean\"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case \"string\":case \"number\":g=!0;break;case \"object\":switch(a.$$typeof){case p:case q:g=!0}}if(g)return c(e,a,\"\"===b?\".\"+T(a,0):b),1;g=0;b=\"\"===b?\".\":b+\":\";if(Array.isArray(a))for(var l=0;lb}return!1}function B(a,b,c,d,e,f){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f}var D={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){D[a]=new B(a,0,!1,a,null,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];D[b]=new B(b,1,!1,a[1],null,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){D[a]=new B(a,2,!1,a.toLowerCase(),null,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){D[a]=new B(a,2,!1,a,null,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){D[a]=new B(a,3,!1,a.toLowerCase(),null,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){D[a]=new B(a,3,!0,a,null,!1)});[\"capture\",\"download\"].forEach(function(a){D[a]=new B(a,4,!1,a,null,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){D[a]=new B(a,6,!1,a,null,!1)});[\"rowSpan\",\"start\"].forEach(function(a){D[a]=new B(a,5,!1,a.toLowerCase(),null,!1)});var sb=/[\\-:]([a-z])/g;function tb(a){return a[1].toUpperCase()}\n\"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(a){var b=a.replace(sb,\ntb);D[b]=new B(b,1,!1,a,null,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(sb,tb);D[b]=new B(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(sb,tb);D[b]=new B(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!1)});\nD.xlinkHref=new B(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){D[a]=new B(a,1,!1,a.toLowerCase(),null,!0)});function ub(a){switch(typeof a){case \"boolean\":case \"number\":case \"object\":case \"string\":case \"undefined\":return a;default:return\"\"}}\nfunction vb(a,b,c,d){var e=D.hasOwnProperty(b)?D[b]:null;var f=null!==e?0===e.type:d?!1:!(2=b.length))throw Error(u(93));b=b[0]}c=b}null==c&&(c=\"\")}a._wrapperState={initialValue:ub(c)}}\nfunction Mb(a,b){var c=ub(b.value),d=ub(b.defaultValue);null!=c&&(c=\"\"+c,c!==a.value&&(a.value=c),null==b.defaultValue&&a.defaultValue!==c&&(a.defaultValue=c));null!=d&&(a.defaultValue=\"\"+d)}function Nb(a){var b=a.textContent;b===a._wrapperState.initialValue&&\"\"!==b&&null!==b&&(a.value=b)}var Ob={html:\"http://www.w3.org/1999/xhtml\",mathml:\"http://www.w3.org/1998/Math/MathML\",svg:\"http://www.w3.org/2000/svg\"};\nfunction Pb(a){switch(a){case \"svg\":return\"http://www.w3.org/2000/svg\";case \"math\":return\"http://www.w3.org/1998/Math/MathML\";default:return\"http://www.w3.org/1999/xhtml\"}}function Qb(a,b){return null==a||\"http://www.w3.org/1999/xhtml\"===a?Pb(b):\"http://www.w3.org/2000/svg\"===a&&\"foreignObject\"===b?\"http://www.w3.org/1999/xhtml\":a}\nvar Rb,Sb=function(a){return\"undefined\"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(b,c,d,e){MSApp.execUnsafeLocalFunction(function(){return a(b,c,d,e)})}:a}(function(a,b){if(a.namespaceURI!==Ob.svg||\"innerHTML\"in a)a.innerHTML=b;else{Rb=Rb||document.createElement(\"div\");Rb.innerHTML=\"\"+b.valueOf().toString()+\"\";for(b=Rb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction Tb(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}function Ub(a,b){var c={};c[a.toLowerCase()]=b.toLowerCase();c[\"Webkit\"+a]=\"webkit\"+b;c[\"Moz\"+a]=\"moz\"+b;return c}var Vb={animationend:Ub(\"Animation\",\"AnimationEnd\"),animationiteration:Ub(\"Animation\",\"AnimationIteration\"),animationstart:Ub(\"Animation\",\"AnimationStart\"),transitionend:Ub(\"Transition\",\"TransitionEnd\")},Wb={},Xb={};\nYa&&(Xb=document.createElement(\"div\").style,\"AnimationEvent\"in window||(delete Vb.animationend.animation,delete Vb.animationiteration.animation,delete Vb.animationstart.animation),\"TransitionEvent\"in window||delete Vb.transitionend.transition);function Yb(a){if(Wb[a])return Wb[a];if(!Vb[a])return a;var b=Vb[a],c;for(c in b)if(b.hasOwnProperty(c)&&c in Xb)return Wb[a]=b[c];return a}var Zb=Yb(\"animationend\"),$b=Yb(\"animationiteration\"),ac=Yb(\"animationstart\"),bc=Yb(\"transitionend\"),cc=\"abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting\".split(\" \");\nfunction ec(a){var b=a,c=a;if(a.alternate)for(;b.return;)b=b.return;else{a=b;do b=a,0!==(b.effectTag&1026)&&(c=b.return),a=b.return;while(a)}return 3===b.tag?c:null}function fc(a){if(13===a.tag){var b=a.memoizedState;null===b&&(a=a.alternate,null!==a&&(b=a.memoizedState));if(null!==b)return b.dehydrated}return null}function gc(a){if(ec(a)!==a)throw Error(u(188));}\nfunction hc(a){var b=a.alternate;if(!b){b=ec(a);if(null===b)throw Error(u(188));return b!==a?null:a}for(var c=a,d=b;;){var e=c.return;if(null===e)break;var f=e.alternate;if(null===f){d=e.return;if(null!==d){c=d;continue}break}if(e.child===f.child){for(f=e.child;f;){if(f===c)return gc(e),a;if(f===d)return gc(e),b;f=f.sibling}throw Error(u(188));}if(c.return!==d.return)c=e,d=f;else{for(var g=!1,h=e.child;h;){if(h===c){g=!0;c=e;d=f;break}if(h===d){g=!0;d=e;c=f;break}h=h.sibling}if(!g){for(h=f.child;h;){if(h===\nc){g=!0;c=f;d=e;break}if(h===d){g=!0;d=f;c=e;break}h=h.sibling}if(!g)throw Error(u(189));}}if(c.alternate!==d)throw Error(u(190));}if(3!==c.tag)throw Error(u(188));return c.stateNode.current===c?a:b}function ic(a){a=hc(a);if(!a)return null;for(var b=a;;){if(5===b.tag||6===b.tag)return b;if(b.child)b.child.return=b,b=b.child;else{if(b===a)break;for(;!b.sibling;){if(!b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}}return null}\nvar jc,kc,lc,mc=!1,nc=[],oc=null,pc=null,qc=null,rc=new Map,sc=new Map,tc=[],uc=\"mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput close cancel copy cut paste click change contextmenu reset submit\".split(\" \"),vc=\"focus blur dragenter dragleave mouseover mouseout pointerover pointerout gotpointercapture lostpointercapture\".split(\" \");\nfunction wc(a){var b=xc(a);uc.forEach(function(c){yc(c,a,b)});vc.forEach(function(c){yc(c,a,b)})}function zc(a,b,c,d){return{blockedOn:a,topLevelType:b,eventSystemFlags:c|32,nativeEvent:d}}function Ac(a,b){switch(a){case \"focus\":case \"blur\":oc=null;break;case \"dragenter\":case \"dragleave\":pc=null;break;case \"mouseover\":case \"mouseout\":qc=null;break;case \"pointerover\":case \"pointerout\":rc.delete(b.pointerId);break;case \"gotpointercapture\":case \"lostpointercapture\":sc.delete(b.pointerId)}}\nfunction Bc(a,b,c,d,e){if(null===a||a.nativeEvent!==e)return a=zc(b,c,d,e),null!==b&&(b=Cc(b),null!==b&&kc(b)),a;a.eventSystemFlags|=d;return a}function Dc(a,b,c,d){switch(b){case \"focus\":return oc=Bc(oc,a,b,c,d),!0;case \"dragenter\":return pc=Bc(pc,a,b,c,d),!0;case \"mouseover\":return qc=Bc(qc,a,b,c,d),!0;case \"pointerover\":var e=d.pointerId;rc.set(e,Bc(rc.get(e)||null,a,b,c,d));return!0;case \"gotpointercapture\":return e=d.pointerId,sc.set(e,Bc(sc.get(e)||null,a,b,c,d)),!0}return!1}\nfunction Ec(a){var b=Fc(a.target);if(null!==b){var c=ec(b);if(null!==c)if(b=c.tag,13===b){if(b=fc(c),null!==b){a.blockedOn=b;q.unstable_runWithPriority(a.priority,function(){lc(c)});return}}else if(3===b&&c.stateNode.hydrate){a.blockedOn=3===c.tag?c.stateNode.containerInfo:null;return}}a.blockedOn=null}function Gc(a){if(null!==a.blockedOn)return!1;var b=Hc(a.topLevelType,a.eventSystemFlags,a.nativeEvent);if(null!==b){var c=Cc(b);null!==c&&kc(c);a.blockedOn=b;return!1}return!0}\nfunction Ic(a,b,c){Gc(a)&&c.delete(b)}function Jc(){for(mc=!1;0this.eventPool.length&&this.eventPool.push(a)}function Vc(a){a.eventPool=[];a.getPooled=Wc;a.release=Xc}var Yc=E.extend({animationName:null,elapsedTime:null,pseudoElement:null}),Zc=E.extend({clipboardData:function(a){return\"clipboardData\"in a?a.clipboardData:window.clipboardData}}),$c=E.extend({view:null,detail:null}),ad=$c.extend({relatedTarget:null});\nfunction bd(a){var b=a.keyCode;\"charCode\"in a?(a=a.charCode,0===a&&13===b&&(a=13)):a=b;10===a&&(a=13);return 32<=a||13===a?a:0}\nvar cd={Esc:\"Escape\",Spacebar:\" \",Left:\"ArrowLeft\",Up:\"ArrowUp\",Right:\"ArrowRight\",Down:\"ArrowDown\",Del:\"Delete\",Win:\"OS\",Menu:\"ContextMenu\",Apps:\"ContextMenu\",Scroll:\"ScrollLock\",MozPrintableKey:\"Unidentified\"},dd={8:\"Backspace\",9:\"Tab\",12:\"Clear\",13:\"Enter\",16:\"Shift\",17:\"Control\",18:\"Alt\",19:\"Pause\",20:\"CapsLock\",27:\"Escape\",32:\" \",33:\"PageUp\",34:\"PageDown\",35:\"End\",36:\"Home\",37:\"ArrowLeft\",38:\"ArrowUp\",39:\"ArrowRight\",40:\"ArrowDown\",45:\"Insert\",46:\"Delete\",112:\"F1\",113:\"F2\",114:\"F3\",115:\"F4\",\n116:\"F5\",117:\"F6\",118:\"F7\",119:\"F8\",120:\"F9\",121:\"F10\",122:\"F11\",123:\"F12\",144:\"NumLock\",145:\"ScrollLock\",224:\"Meta\"},ed={Alt:\"altKey\",Control:\"ctrlKey\",Meta:\"metaKey\",Shift:\"shiftKey\"};function gd(a){var b=this.nativeEvent;return b.getModifierState?b.getModifierState(a):(a=ed[a])?!!b[a]:!1}function hd(){return gd}\nvar id=$c.extend({key:function(a){if(a.key){var b=cd[a.key]||a.key;if(\"Unidentified\"!==b)return b}return\"keypress\"===a.type?(a=bd(a),13===a?\"Enter\":String.fromCharCode(a)):\"keydown\"===a.type||\"keyup\"===a.type?dd[a.keyCode]||\"Unidentified\":\"\"},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:hd,charCode:function(a){return\"keypress\"===a.type?bd(a):0},keyCode:function(a){return\"keydown\"===a.type||\"keyup\"===a.type?a.keyCode:0},which:function(a){return\"keypress\"===\na.type?bd(a):\"keydown\"===a.type||\"keyup\"===a.type?a.keyCode:0}}),jd=0,kd=0,ld=!1,md=!1,nd=$c.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:hd,button:null,buttons:null,relatedTarget:function(a){return a.relatedTarget||(a.fromElement===a.srcElement?a.toElement:a.fromElement)},movementX:function(a){if(\"movementX\"in a)return a.movementX;var b=jd;jd=a.screenX;return ld?\"mousemove\"===a.type?a.screenX-\nb:0:(ld=!0,0)},movementY:function(a){if(\"movementY\"in a)return a.movementY;var b=kd;kd=a.screenY;return md?\"mousemove\"===a.type?a.screenY-b:0:(md=!0,0)}}),od=nd.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),pd=nd.extend({dataTransfer:null}),qd=$c.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:hd}),rd=E.extend({propertyName:null,\nelapsedTime:null,pseudoElement:null}),sd=nd.extend({deltaX:function(a){return\"deltaX\"in a?a.deltaX:\"wheelDeltaX\"in a?-a.wheelDeltaX:0},deltaY:function(a){return\"deltaY\"in a?a.deltaY:\"wheelDeltaY\"in a?-a.wheelDeltaY:\"wheelDelta\"in a?-a.wheelDelta:0},deltaZ:null,deltaMode:null}),td=[[\"blur\",\"blur\",0],[\"cancel\",\"cancel\",0],[\"click\",\"click\",0],[\"close\",\"close\",0],[\"contextmenu\",\"contextMenu\",0],[\"copy\",\"copy\",0],[\"cut\",\"cut\",0],[\"auxclick\",\"auxClick\",0],[\"dblclick\",\"doubleClick\",0],[\"dragend\",\"dragEnd\",\n0],[\"dragstart\",\"dragStart\",0],[\"drop\",\"drop\",0],[\"focus\",\"focus\",0],[\"input\",\"input\",0],[\"invalid\",\"invalid\",0],[\"keydown\",\"keyDown\",0],[\"keypress\",\"keyPress\",0],[\"keyup\",\"keyUp\",0],[\"mousedown\",\"mouseDown\",0],[\"mouseup\",\"mouseUp\",0],[\"paste\",\"paste\",0],[\"pause\",\"pause\",0],[\"play\",\"play\",0],[\"pointercancel\",\"pointerCancel\",0],[\"pointerdown\",\"pointerDown\",0],[\"pointerup\",\"pointerUp\",0],[\"ratechange\",\"rateChange\",0],[\"reset\",\"reset\",0],[\"seeked\",\"seeked\",0],[\"submit\",\"submit\",0],[\"touchcancel\",\"touchCancel\",\n0],[\"touchend\",\"touchEnd\",0],[\"touchstart\",\"touchStart\",0],[\"volumechange\",\"volumeChange\",0],[\"drag\",\"drag\",1],[\"dragenter\",\"dragEnter\",1],[\"dragexit\",\"dragExit\",1],[\"dragleave\",\"dragLeave\",1],[\"dragover\",\"dragOver\",1],[\"mousemove\",\"mouseMove\",1],[\"mouseout\",\"mouseOut\",1],[\"mouseover\",\"mouseOver\",1],[\"pointermove\",\"pointerMove\",1],[\"pointerout\",\"pointerOut\",1],[\"pointerover\",\"pointerOver\",1],[\"scroll\",\"scroll\",1],[\"toggle\",\"toggle\",1],[\"touchmove\",\"touchMove\",1],[\"wheel\",\"wheel\",1],[\"abort\",\"abort\",\n2],[Zb,\"animationEnd\",2],[$b,\"animationIteration\",2],[ac,\"animationStart\",2],[\"canplay\",\"canPlay\",2],[\"canplaythrough\",\"canPlayThrough\",2],[\"durationchange\",\"durationChange\",2],[\"emptied\",\"emptied\",2],[\"encrypted\",\"encrypted\",2],[\"ended\",\"ended\",2],[\"error\",\"error\",2],[\"gotpointercapture\",\"gotPointerCapture\",2],[\"load\",\"load\",2],[\"loadeddata\",\"loadedData\",2],[\"loadedmetadata\",\"loadedMetadata\",2],[\"loadstart\",\"loadStart\",2],[\"lostpointercapture\",\"lostPointerCapture\",2],[\"playing\",\"playing\",2],[\"progress\",\n\"progress\",2],[\"seeking\",\"seeking\",2],[\"stalled\",\"stalled\",2],[\"suspend\",\"suspend\",2],[\"timeupdate\",\"timeUpdate\",2],[bc,\"transitionEnd\",2],[\"waiting\",\"waiting\",2]],ud={},vd={},wd=0;for(;wd=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=ce(c)}}\nfunction ee(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?ee(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}function fe(){for(var a=window,b=be();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=be(a.document)}return b}\nfunction ge(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}var he=\"$\",ie=\"/$\",je=\"$?\",ke=\"$!\",le=null,me=null;function ne(a,b){switch(a){case \"button\":case \"input\":case \"select\":case \"textarea\":return!!b.autoFocus}return!1}\nfunction oe(a,b){return\"textarea\"===a||\"option\"===a||\"noscript\"===a||\"string\"===typeof b.children||\"number\"===typeof b.children||\"object\"===typeof b.dangerouslySetInnerHTML&&null!==b.dangerouslySetInnerHTML&&null!=b.dangerouslySetInnerHTML.__html}var pe=\"function\"===typeof setTimeout?setTimeout:void 0,qe=\"function\"===typeof clearTimeout?clearTimeout:void 0;function re(a){for(;null!=a;a=a.nextSibling){var b=a.nodeType;if(1===b||3===b)break}return a}\nfunction se(a){a=a.previousSibling;for(var b=0;a;){if(8===a.nodeType){var c=a.data;if(c===he||c===ke||c===je){if(0===b)return a;b--}else c===ie&&b++}a=a.previousSibling}return null}var te=Math.random().toString(36).slice(2),ue=\"__reactInternalInstance$\"+te,ve=\"__reactEventHandlers$\"+te,we=\"__reactContainere$\"+te;\nfunction Fc(a){var b=a[ue];if(b)return b;for(var c=a.parentNode;c;){if(b=c[we]||c[ue]){c=b.alternate;if(null!==b.child||null!==c&&null!==c.child)for(a=se(a);null!==a;){if(c=a[ue])return c;a=se(a)}return b}a=c;c=a.parentNode}return null}function Cc(a){a=a[ue]||a[we];return!a||5!==a.tag&&6!==a.tag&&13!==a.tag&&3!==a.tag?null:a}function xe(a){if(5===a.tag||6===a.tag)return a.stateNode;throw Error(u(33));}function ye(a){return a[ve]||null}var ze=null,Ae=null,Be=null;\nfunction Ce(){if(Be)return Be;var a,b=Ae,c=b.length,d,e=\"value\"in ze?ze.value:ze.textContent,f=e.length;for(a=0;a=He),Ke=String.fromCharCode(32),Le={beforeInput:{phasedRegistrationNames:{bubbled:\"onBeforeInput\",captured:\"onBeforeInputCapture\"},dependencies:[\"compositionend\",\"keypress\",\"textInput\",\"paste\"]},compositionEnd:{phasedRegistrationNames:{bubbled:\"onCompositionEnd\",captured:\"onCompositionEndCapture\"},dependencies:\"blur compositionend keydown keypress keyup mousedown\".split(\" \")},compositionStart:{phasedRegistrationNames:{bubbled:\"onCompositionStart\",\ncaptured:\"onCompositionStartCapture\"},dependencies:\"blur compositionstart keydown keypress keyup mousedown\".split(\" \")},compositionUpdate:{phasedRegistrationNames:{bubbled:\"onCompositionUpdate\",captured:\"onCompositionUpdateCapture\"},dependencies:\"blur compositionupdate keydown keypress keyup mousedown\".split(\" \")}},Me=!1;\nfunction Ne(a,b){switch(a){case \"keyup\":return-1!==Fe.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"blur\":return!0;default:return!1}}function Oe(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var Pe=!1;function Qe(a,b){switch(a){case \"compositionend\":return Oe(b);case \"keypress\":if(32!==b.which)return null;Me=!0;return Ke;case \"textInput\":return a=b.data,a===Ke&&Me?null:a;default:return null}}\nfunction Re(a,b){if(Pe)return\"compositionend\"===a||!Ge&&Ne(a,b)?(a=Ce(),Be=Ae=ze=null,Pe=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=document.documentMode,sf={select:{phasedRegistrationNames:{bubbled:\"onSelect\",captured:\"onSelectCapture\"},dependencies:\"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange\".split(\" \")}},tf=null,uf=null,vf=null,wf=!1;\nfunction xf(a,b){var c=b.window===b?b.document:9===b.nodeType?b:b.ownerDocument;if(wf||null==tf||tf!==be(c))return null;c=tf;\"selectionStart\"in c&&ge(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset});return vf&&qf(vf,c)?null:(vf=c,a=E.getPooled(sf.select,uf,a,b),a.type=\"select\",a.target=tf,Sc(a),a)}\nvar yf={eventTypes:sf,extractEvents:function(a,b,c,d){var e=d.window===d?d.document:9===d.nodeType?d:d.ownerDocument,f;if(!(f=!e)){a:{e=xc(e);f=ja.onSelect;for(var g=0;gBf||(a.current=Af[Bf],Af[Bf]=null,Bf--)}\nfunction I(a,b){Bf++;Af[Bf]=a.current;a.current=b}var Cf={},J={current:Cf},K={current:!1},Df=Cf;function Ef(a,b){var c=a.type.contextTypes;if(!c)return Cf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}function L(a){a=a.childContextTypes;return null!==a&&void 0!==a}\nfunction Ff(a){G(K,a);G(J,a)}function Gf(a){G(K,a);G(J,a)}function Hf(a,b,c){if(J.current!==Cf)throw Error(u(168));I(J,b,a);I(K,c,a)}function If(a,b,c){var d=a.stateNode;a=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in a))throw Error(u(108,Wa(b)||\"Unknown\",e));return n({},c,{},d)}function Jf(a){var b=a.stateNode;b=b&&b.__reactInternalMemoizedMergedChildContext||Cf;Df=J.current;I(J,b,a);I(K,K.current,a);return!0}\nfunction Kf(a,b,c){var d=a.stateNode;if(!d)throw Error(u(169));c?(b=If(a,b,Df),d.__reactInternalMemoizedMergedChildContext=b,G(K,a),G(J,a),I(J,b,a)):G(K,a);I(K,c,a)}\nvar Lf=q.unstable_runWithPriority,Mf=q.unstable_scheduleCallback,Nf=q.unstable_cancelCallback,Of=q.unstable_shouldYield,Pf=q.unstable_requestPaint,Qf=q.unstable_now,Rf=q.unstable_getCurrentPriorityLevel,Sf=q.unstable_ImmediatePriority,Tf=q.unstable_UserBlockingPriority,Uf=q.unstable_NormalPriority,Vf=q.unstable_LowPriority,Wf=q.unstable_IdlePriority,Xf={},Yf=void 0!==Pf?Pf:function(){},Zf=null,$f=null,ag=!1,bg=Qf(),cg=1E4>bg?Qf:function(){return Qf()-bg};\nfunction dg(){switch(Rf()){case Sf:return 99;case Tf:return 98;case Uf:return 97;case Vf:return 96;case Wf:return 95;default:throw Error(u(332));}}function eg(a){switch(a){case 99:return Sf;case 98:return Tf;case 97:return Uf;case 96:return Vf;case 95:return Wf;default:throw Error(u(332));}}function fg(a,b){a=eg(a);return Lf(a,b)}function gg(a,b,c){a=eg(a);return Mf(a,b,c)}function hg(a){null===Zf?(Zf=[a],$f=Mf(Sf,ig)):Zf.push(a);return Xf}function jg(){if(null!==$f){var a=$f;$f=null;Nf(a)}ig()}\nfunction ig(){if(!ag&&null!==Zf){ag=!0;var a=0;try{var b=Zf;fg(99,function(){for(;a=b&&(wg=!0),a.firstContext=null)}function xg(a,b){if(qg!==a&&!1!==b&&0!==b){if(\"number\"!==typeof b||1073741823===b)qg=a,b=1073741823;b={context:a,observedBits:b,next:null};if(null===pg){if(null===og)throw Error(u(308));pg=b;og.dependencies={expirationTime:0,firstContext:b,responders:null}}else pg=pg.next=b}return a._currentValue}var yg=!1;\nfunction zg(a){return{baseState:a,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Ag(a){return{baseState:a.baseState,firstUpdate:a.firstUpdate,lastUpdate:a.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}\nfunction Bg(a,b){return{expirationTime:a,suspenseConfig:b,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Cg(a,b){null===a.lastUpdate?a.firstUpdate=a.lastUpdate=b:(a.lastUpdate.next=b,a.lastUpdate=b)}\nfunction Dg(a,b){var c=a.alternate;if(null===c){var d=a.updateQueue;var e=null;null===d&&(d=a.updateQueue=zg(a.memoizedState))}else d=a.updateQueue,e=c.updateQueue,null===d?null===e?(d=a.updateQueue=zg(a.memoizedState),e=c.updateQueue=zg(c.memoizedState)):d=a.updateQueue=Ag(e):null===e&&(e=c.updateQueue=Ag(d));null===e||d===e?Cg(d,b):null===d.lastUpdate||null===e.lastUpdate?(Cg(d,b),Cg(e,b)):(Cg(d,b),e.lastUpdate=b)}\nfunction Eg(a,b){var c=a.updateQueue;c=null===c?a.updateQueue=zg(a.memoizedState):Fg(a,c);null===c.lastCapturedUpdate?c.firstCapturedUpdate=c.lastCapturedUpdate=b:(c.lastCapturedUpdate.next=b,c.lastCapturedUpdate=b)}function Fg(a,b){var c=a.alternate;null!==c&&b===c.updateQueue&&(b=a.updateQueue=Ag(b));return b}\nfunction Gg(a,b,c,d,e,f){switch(c.tag){case 1:return a=c.payload,\"function\"===typeof a?a.call(f,d,e):a;case 3:a.effectTag=a.effectTag&-4097|64;case 0:a=c.payload;e=\"function\"===typeof a?a.call(f,d,e):a;if(null===e||void 0===e)break;return n({},d,e);case 2:yg=!0}return d}\nfunction Hg(a,b,c,d,e){yg=!1;b=Fg(a,b);for(var f=b.baseState,g=null,h=0,k=b.firstUpdate,l=f;null!==k;){var m=k.expirationTime;mx?(A=r,r=null):A=r.sibling;var p=y(e,r,h[x],k);if(null===p){null===r&&(r=A);break}a&&\nr&&null===p.alternate&&b(e,r);g=f(p,g,x);null===m?l=p:m.sibling=p;m=p;r=A}if(x===h.length)return c(e,r),l;if(null===r){for(;xx?(A=r,r=null):A=r.sibling;var z=y(e,r,p.value,k);if(null===z){null===r&&(r=A);break}a&&r&&null===z.alternate&&b(e,r);g=f(z,g,x);null===m?l=z:m.sibling=z;m=z;r=A}if(p.done)return c(e,r),l;if(null===r){for(;!p.done;x++,p=h.next())p=C(e,p.value,k),null!==p&&(g=f(p,g,x),null===m?l=p:m.sibling=p,m=p);return l}for(r=d(e,r);!p.done;x++,p=h.next())p=H(r,e,x,p.value,k),null!==p&&(a&&null!==\np.alternate&&r.delete(null===p.key?x:p.key),g=f(p,g,x),null===m?l=p:m.sibling=p,m=p);a&&r.forEach(function(a){return b(e,a)});return l}return function(a,d,f,h){var k=\"object\"===typeof f&&null!==f&&f.type===Ia&&null===f.key;k&&(f=f.props.children);var l=\"object\"===typeof f&&null!==f;if(l)switch(f.$$typeof){case Ga:a:{l=f.key;for(k=d;null!==k;){if(k.key===l)if(7===k.tag?f.type===Ia:k.elementType===f.type){c(a,k.sibling);d=e(k,f.type===Ia?f.props.children:f.props,h);d.ref=Yg(a,k,f);d.return=a;a=d;break a}else{c(a,\nk);break}else b(a,k);k=k.sibling}f.type===Ia?(d=eh(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=ch(f.type,f.key,f.props,null,a.mode,h),h.ref=Yg(a,d,f),h.return=a,a=h)}return g(a);case Ha:a:{for(k=f.key;null!==d;){if(d.key===k)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[],h);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=dh(f,a.mode,h);d.return=a;a=d}return g(a)}if(\"string\"===\ntypeof f||\"number\"===typeof f)return f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f,h),d.return=a,a=d):(c(a,d),d=bh(f,a.mode,h),d.return=a,a=d),g(a);if(Xg(f))return z(a,d,f,h);if(Ua(f))return ta(a,d,f,h);l&&Zg(a,f);if(\"undefined\"===typeof f&&!k)switch(a.tag){case 1:case 0:throw a=a.type,Error(u(152,a.displayName||a.name||\"Component\"));}return c(a,d)}}var fh=$g(!0),gh=$g(!1),hh={},ih={current:hh},jh={current:hh},kh={current:hh};function lh(a){if(a===hh)throw Error(u(174));return a}\nfunction mh(a,b){I(kh,b,a);I(jh,a,a);I(ih,hh,a);var c=b.nodeType;switch(c){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:Qb(null,\"\");break;default:c=8===c?b.parentNode:b,b=c.namespaceURI||null,c=c.tagName,b=Qb(b,c)}G(ih,a);I(ih,b,a)}function nh(a){G(ih,a);G(jh,a);G(kh,a)}function oh(a){lh(kh.current);var b=lh(ih.current);var c=Qb(b,a.type);b!==c&&(I(jh,a,a),I(ih,c,a))}function ph(a){jh.current===a&&(G(ih,a),G(jh,a))}var M={current:0};\nfunction qh(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||c.data===je||c.data===ke))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.effectTag&64))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}function rh(a,b){return{responder:a,props:b}}\nvar sh=Ea.ReactCurrentDispatcher,N=Ea.ReactCurrentBatchConfig,th=0,uh=null,O=null,vh=null,wh=null,P=null,xh=null,yh=0,zh=null,Ah=0,Bh=!1,Ch=null,Gh=0;function Q(){throw Error(u(321));}function Hh(a,b){if(null===b)return!1;for(var c=0;cyh&&(yh=m,Jg(yh))):(Ig(m,k.suspenseConfig),f=k.eagerReducer===a?k.eagerState:a(f,k.action));g=k;k=k.next}while(null!==k&&k!==d);l||(h=g,e=f);of(f,b.memoizedState)||(wg=!0);b.memoizedState=f;b.baseUpdate=h;b.baseState=e;c.lastRenderedState=f}return[b.memoizedState,c.dispatch]}\nfunction Rh(a){var b=Nh();\"function\"===typeof a&&(a=a());b.memoizedState=b.baseState=a;a=b.queue={last:null,dispatch:null,lastRenderedReducer:Ph,lastRenderedState:a};a=a.dispatch=Sh.bind(null,uh,a);return[b.memoizedState,a]}function Th(a){return Qh(Ph,a)}function Uh(a,b,c,d){a={tag:a,create:b,destroy:c,deps:d,next:null};null===zh?(zh={lastEffect:null},zh.lastEffect=a.next=a):(b=zh.lastEffect,null===b?zh.lastEffect=a.next=a:(c=b.next,b.next=a,a.next=c,zh.lastEffect=a));return a}\nfunction Vh(a,b,c,d){var e=Nh();Ah|=a;e.memoizedState=Uh(b,c,void 0,void 0===d?null:d)}function Wh(a,b,c,d){var e=Oh();d=void 0===d?null:d;var f=void 0;if(null!==O){var g=O.memoizedState;f=g.destroy;if(null!==d&&Hh(d,g.deps)){Uh(0,c,f,d);return}}Ah|=a;e.memoizedState=Uh(b,c,f,d)}function Xh(a,b){return Vh(516,192,a,b)}function Yh(a,b){return Wh(516,192,a,b)}\nfunction Zh(a,b){if(\"function\"===typeof b)return a=a(),b(a),function(){b(null)};if(null!==b&&void 0!==b)return a=a(),b.current=a,function(){b.current=null}}function $h(){}function ai(a,b){Nh().memoizedState=[a,void 0===b?null:b];return a}function bi(a,b){var c=Oh();b=void 0===b?null:b;var d=c.memoizedState;if(null!==d&&null!==b&&Hh(b,d[1]))return d[0];c.memoizedState=[a,b];return a}\nfunction Sh(a,b,c){if(!(25>Gh))throw Error(u(301));var d=a.alternate;if(a===uh||null!==d&&d===uh)if(Bh=!0,a={expirationTime:th,suspenseConfig:null,action:c,eagerReducer:null,eagerState:null,next:null},null===Ch&&(Ch=new Map),c=Ch.get(b),void 0===c)Ch.set(b,a);else{for(b=c;null!==b.next;)b=b.next;b.next=a}else{var e=Pg(),f=Mg.suspense;e=Qg(e,a,f);f={expirationTime:e,suspenseConfig:f,action:c,eagerReducer:null,eagerState:null,next:null};var g=b.last;if(null===g)f.next=f;else{var h=g.next;null!==h&&\n(f.next=h);g.next=f}b.last=f;if(0===a.expirationTime&&(null===d||0===d.expirationTime)&&(d=b.lastRenderedReducer,null!==d))try{var k=b.lastRenderedState,l=d(k,c);f.eagerReducer=d;f.eagerState=l;if(of(l,k))return}catch(m){}finally{}Rg(a,e)}}\nvar Lh={readContext:xg,useCallback:Q,useContext:Q,useEffect:Q,useImperativeHandle:Q,useLayoutEffect:Q,useMemo:Q,useReducer:Q,useRef:Q,useState:Q,useDebugValue:Q,useResponder:Q,useDeferredValue:Q,useTransition:Q},Jh={readContext:xg,useCallback:ai,useContext:xg,useEffect:Xh,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return Vh(4,36,Zh.bind(null,b,a),c)},useLayoutEffect:function(a,b){return Vh(4,36,a,b)},useMemo:function(a,b){var c=Nh();b=void 0===b?null:b;a=a();c.memoizedState=\n[a,b];return a},useReducer:function(a,b,c){var d=Nh();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a=d.queue={last:null,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};a=a.dispatch=Sh.bind(null,uh,a);return[d.memoizedState,a]},useRef:function(a){var b=Nh();a={current:a};return b.memoizedState=a},useState:Rh,useDebugValue:$h,useResponder:rh,useDeferredValue:function(a,b){var c=Rh(a),d=c[0],e=c[1];Xh(function(){q.unstable_next(function(){var c=N.suspense;N.suspense=void 0===b?null:b;try{e(a)}finally{N.suspense=\nc}})},[a,b]);return d},useTransition:function(a){var b=Rh(!1),c=b[0],d=b[1];return[ai(function(b){d(!0);q.unstable_next(function(){var c=N.suspense;N.suspense=void 0===a?null:a;try{d(!1),b()}finally{N.suspense=c}})},[a,c]),c]}},Kh={readContext:xg,useCallback:bi,useContext:xg,useEffect:Yh,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return Wh(4,36,Zh.bind(null,b,a),c)},useLayoutEffect:function(a,b){return Wh(4,36,a,b)},useMemo:function(a,b){var c=Oh();b=void 0===b?\nnull:b;var d=c.memoizedState;if(null!==d&&null!==b&&Hh(b,d[1]))return d[0];a=a();c.memoizedState=[a,b];return a},useReducer:Qh,useRef:function(){return Oh().memoizedState},useState:Th,useDebugValue:$h,useResponder:rh,useDeferredValue:function(a,b){var c=Th(a),d=c[0],e=c[1];Yh(function(){q.unstable_next(function(){var c=N.suspense;N.suspense=void 0===b?null:b;try{e(a)}finally{N.suspense=c}})},[a,b]);return d},useTransition:function(a){var b=Th(!1),c=b[0],d=b[1];return[bi(function(b){d(!0);q.unstable_next(function(){var c=\nN.suspense;N.suspense=void 0===a?null:a;try{d(!1),b()}finally{N.suspense=c}})},[a,c]),c]}},ci=null,di=null,ei=!1;function fi(a,b){var c=gi(5,null,null,0);c.elementType=\"DELETED\";c.type=\"DELETED\";c.stateNode=b;c.return=a;c.effectTag=8;null!==a.lastEffect?(a.lastEffect.nextEffect=c,a.lastEffect=c):a.firstEffect=a.lastEffect=c}\nfunction hi(a,b){switch(a.tag){case 5:var c=a.type;b=1!==b.nodeType||c.toLowerCase()!==b.nodeName.toLowerCase()?null:b;return null!==b?(a.stateNode=b,!0):!1;case 6:return b=\"\"===a.pendingProps||3!==b.nodeType?null:b,null!==b?(a.stateNode=b,!0):!1;case 13:return!1;default:return!1}}\nfunction ii(a){if(ei){var b=di;if(b){var c=b;if(!hi(a,b)){b=re(c.nextSibling);if(!b||!hi(a,b)){a.effectTag=a.effectTag&-1025|2;ei=!1;ci=a;return}fi(ci,c)}ci=a;di=re(b.firstChild)}else a.effectTag=a.effectTag&-1025|2,ei=!1,ci=a}}function ji(a){for(a=a.return;null!==a&&5!==a.tag&&3!==a.tag&&13!==a.tag;)a=a.return;ci=a}\nfunction ki(a){if(a!==ci)return!1;if(!ei)return ji(a),ei=!0,!1;var b=a.type;if(5!==a.tag||\"head\"!==b&&\"body\"!==b&&!oe(b,a.memoizedProps))for(b=di;b;)fi(a,b),b=re(b.nextSibling);ji(a);if(13===a.tag){a=a.memoizedState;a=null!==a?a.dehydrated:null;if(!a)throw Error(u(317));a:{a=a.nextSibling;for(b=0;a;){if(8===a.nodeType){var c=a.data;if(c===ie){if(0===b){di=re(a.nextSibling);break a}b--}else c!==he&&c!==ke&&c!==je||b++}a=a.nextSibling}di=null}}else di=ci?re(a.stateNode.nextSibling):null;return!0}\nfunction li(){di=ci=null;ei=!1}var mi=Ea.ReactCurrentOwner,wg=!1;function R(a,b,c,d){b.child=null===a?gh(b,null,c,d):fh(b,a.child,c,d)}function ni(a,b,c,d,e){c=c.render;var f=b.ref;vg(b,e);d=Ih(a,b,c,d,f,e);if(null!==a&&!wg)return b.updateQueue=a.updateQueue,b.effectTag&=-517,a.expirationTime<=e&&(a.expirationTime=0),oi(a,b,e);b.effectTag|=1;R(a,b,d,e);return b.child}\nfunction pi(a,b,c,d,e,f){if(null===a){var g=c.type;if(\"function\"===typeof g&&!qi(g)&&void 0===g.defaultProps&&null===c.compare&&void 0===c.defaultProps)return b.tag=15,b.type=g,ri(a,b,g,d,e,f);a=ch(c.type,null,d,null,b.mode,f);a.ref=b.ref;a.return=b;return b.child=a}g=a.child;if(eb)&&Gj.set(a,b)))}}\nfunction Kj(a,b){a.expirationTimea?b:a}\nfunction Z(a){if(0!==a.lastExpiredTime)a.callbackExpirationTime=1073741823,a.callbackPriority=99,a.callbackNode=hg(Lj.bind(null,a));else{var b=Oj(a),c=a.callbackNode;if(0===b)null!==c&&(a.callbackNode=null,a.callbackExpirationTime=0,a.callbackPriority=90);else{var d=Pg();1073741823===b?d=99:1===b||2===b?d=95:(d=10*(1073741821-b)-10*(1073741821-d),d=0>=d?99:250>=d?98:5250>=d?97:95);if(null!==c){var e=a.callbackPriority;if(a.callbackExpirationTime===b&&e>=d)return;c!==Xf&&Nf(c)}a.callbackExpirationTime=\nb;a.callbackPriority=d;b=1073741823===b?hg(Lj.bind(null,a)):gg(d,Qj.bind(null,a),{timeout:10*(1073741821-b)-cg()});a.callbackNode=b}}}\nfunction Qj(a,b){Jj=0;if(b)return b=Pg(),Rj(a,b),Z(a),null;var c=Oj(a);if(0!==c){b=a.callbackNode;if((T&(oj|pj))!==S)throw Error(u(327));Sj();a===U&&c===W||Tj(a,c);if(null!==V){var d=T;T|=oj;var e=Uj(a);do try{Vj();break}catch(h){Wj(a,h)}while(1);rg();T=d;lj.current=e;if(X===rj)throw b=wj,Tj(a,c),Mj(a,c),Z(a),b;if(null===V)switch(e=a.finishedWork=a.current.alternate,a.finishedExpirationTime=c,d=X,U=null,d){case qj:case rj:throw Error(u(345));case sj:Rj(a,2=c){a.lastPingedTime=c;Tj(a,c);break}}f=Oj(a);if(0!==f&&f!==c)break;if(0!==d&&d!==c){a.lastPingedTime=d;break}a.timeoutHandle=pe(Yj.bind(null,a),e);break}Yj(a);break;case uj:Mj(a,c);d=a.lastSuspendedTime;c===d&&(a.nextKnownPendingLevel=Xj(e));if(Bj&&(e=a.lastPingedTime,0===e||e>=c)){a.lastPingedTime=c;Tj(a,c);break}e=Oj(a);if(0!==e&&e!==c)break;if(0!==d&&d!==c){a.lastPingedTime=\nd;break}1073741823!==yj?d=10*(1073741821-yj)-cg():1073741823===xj?d=0:(d=10*(1073741821-xj)-5E3,e=cg(),c=10*(1073741821-c)-e,d=e-d,0>d&&(d=0),d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*kj(d/1960))-d,c=d?d=0:(e=g.busyDelayMs|0,f=cg()-(10*(1073741821-f)-(g.timeoutMs|0||5E3)),d=f<=e?0:e+d-f);if(10 component higher in the tree to provide a loading indicator or placeholder to display.\"+Xa(e))}X!==vj&&(X=sj);f=Ni(f,e);k=d;do{switch(k.tag){case 3:g=f;k.effectTag|=4096;k.expirationTime=b;var x=fj(k,g,b);Eg(k,x);break a;case 1:g=f;var A=k.type,p=k.stateNode;if(0===(k.effectTag&64)&&(\"function\"===typeof A.getDerivedStateFromError||null!==p&&\"function\"===typeof p.componentDidCatch&&\n(null===jj||!jj.has(p)))){k.effectTag|=4096;k.expirationTime=b;var t=ij(k,g,b);Eg(k,t);break a}}k=k.return}while(null!==k)}V=ek(V)}catch(v){b=v;continue}break}while(1)}function Uj(){var a=lj.current;lj.current=Lh;return null===a?Lh:a}function Ig(a,b){aAj&&(Aj=a)}function Zj(){for(;null!==V;)V=fk(V)}function Vj(){for(;null!==V&&!Of();)V=fk(V)}\nfunction fk(a){var b=gk(a.alternate,a,W);a.memoizedProps=a.pendingProps;null===b&&(b=ek(a));mj.current=null;return b}\nfunction ek(a){V=a;do{var b=V.alternate;a=V.return;if(0===(V.effectTag&2048)){a:{var c=b;b=V;var d=W;var e=b.pendingProps;switch(b.tag){case 2:break;case 16:break;case 15:case 0:break;case 1:L(b.type)&&Ff(b);break;case 3:nh(b);Gf(b);e=b.stateNode;e.pendingContext&&(e.context=e.pendingContext,e.pendingContext=null);(null===c||null===c.child)&&ki(b)&&Ci(b);Ii(b);break;case 5:ph(b);d=lh(kh.current);var f=b.type;if(null!==c&&null!=b.stateNode)Ji(c,b,f,e,d),c.ref!==b.ref&&(b.effectTag|=128);else if(e){var g=\nlh(ih.current);if(ki(b)){e=b;var h=e.stateNode;c=e.type;var k=e.memoizedProps,l=d;h[ue]=e;h[ve]=k;f=void 0;d=h;switch(c){case \"iframe\":case \"object\":case \"embed\":F(\"load\",d);break;case \"video\":case \"audio\":for(h=0;h\\x3c/script>\",h=k.removeChild(k.firstChild)):\"string\"===typeof k.is?h=h.createElement(l,{is:k.is}):(h=h.createElement(l),\"select\"===l&&(l=h,k.multiple?l.multiple=!0:k.size&&(l.size=k.size))):h=h.createElementNS(g,l);k=h;k[ue]=c;k[ve]=e;Hi(k,b,!1,!1);b.stateNode=k;l=f;c=e;var m=d,C=Zd(l,c);switch(l){case \"iframe\":case \"object\":case \"embed\":F(\"load\",\nk);d=c;break;case \"video\":case \"audio\":for(d=0;de.tailExpiration&&1f&&(f=c),k>f&&(f=k),d=d.sibling;e.childExpirationTime=f}if(null!==b)return b;null!==a&&0===(a.effectTag&2048)&&(null===a.firstEffect&&(a.firstEffect=V.firstEffect),null!==V.lastEffect&&(null!==a.lastEffect&&(a.lastEffect.nextEffect=\nV.firstEffect),a.lastEffect=V.lastEffect),1a?b:a}function Yj(a){var b=dg();fg(99,ik.bind(null,a,b));return null}\nfunction ik(a,b){do Sj();while(null!==Ej);if((T&(oj|pj))!==S)throw Error(u(327));var c=a.finishedWork,d=a.finishedExpirationTime;if(null===c)return null;a.finishedWork=null;a.finishedExpirationTime=0;if(c===a.current)throw Error(u(177));a.callbackNode=null;a.callbackExpirationTime=0;a.callbackPriority=90;a.nextKnownPendingLevel=0;var e=Xj(c);a.firstPendingTime=e;d<=a.lastSuspendedTime?a.firstSuspendedTime=a.lastSuspendedTime=a.nextKnownPendingLevel=0:d<=a.firstSuspendedTime&&(a.firstSuspendedTime=\nd-1);d<=a.lastPingedTime&&(a.lastPingedTime=0);d<=a.lastExpiredTime&&(a.lastExpiredTime=0);a===U&&(V=U=null,W=0);1h&&(l=h,h=g,g=l),l=de(p,g),m=de(p,h),l&&m&&(1!==v.rangeCount||v.anchorNode!==l.node||v.anchorOffset!==l.offset||v.focusNode!==m.node||v.focusOffset!==m.offset)&&(t=t.createRange(),t.setStart(l.node,l.offset),v.removeAllRanges(),g>h?(v.addRange(t),v.extend(m.node,m.offset)):(t.setEnd(m.node,m.offset),v.addRange(t))))));t=[];for(v=p;v=v.parentNode;)1===v.nodeType&&t.push({element:v,left:v.scrollLeft,top:v.scrollTop});\n\"function\"===typeof p.focus&&p.focus();for(p=0;p=c)return yi(a,b,c);I(M,M.current&\n1,b);b=oi(a,b,c);return null!==b?b.sibling:null}I(M,M.current&1,b);break;case 19:d=b.childExpirationTime>=c;if(0!==(a.effectTag&64)){if(d)return Bi(a,b,c);b.effectTag|=64}e=b.memoizedState;null!==e&&(e.rendering=null,e.tail=null);I(M,M.current,b);if(!d)return null}return oi(a,b,c)}wg=!1}}else wg=!1;b.expirationTime=0;switch(b.tag){case 2:d=b.type;null!==a&&(a.alternate=null,b.alternate=null,b.effectTag|=2);a=b.pendingProps;e=Ef(b,J.current);vg(b,c);e=Ih(null,b,d,a,e,c);b.effectTag|=1;if(\"object\"===\ntypeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof){b.tag=1;Mh();if(L(d)){var f=!0;Jf(b)}else f=!1;b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null;var g=d.getDerivedStateFromProps;\"function\"===typeof g&&Og(b,d,g,a);e.updater=Sg;b.stateNode=e;e._reactInternalFiber=b;Wg(b,d,a,c);b=vi(null,b,d,!0,f,c)}else b.tag=0,R(null,b,e,c),b=b.child;return b;case 16:e=b.elementType;null!==a&&(a.alternate=null,b.alternate=null,b.effectTag|=2);a=b.pendingProps;Va(e);if(1!==e._status)throw e._result;\ne=e._result;b.type=e;f=b.tag=nk(e);a=mg(e,a);switch(f){case 0:b=si(null,b,e,a,c);break;case 1:b=ui(null,b,e,a,c);break;case 11:b=ni(null,b,e,a,c);break;case 14:b=pi(null,b,e,mg(e.type,a),d,c);break;default:throw Error(u(306,e,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:mg(d,e),si(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:mg(d,e),ui(a,b,d,e,c);case 3:wi(b);d=b.updateQueue;if(null===d)throw Error(u(282));e=b.memoizedState;e=null!==e?e.element:\nnull;Hg(b,d,b.pendingProps,null,c);d=b.memoizedState.element;if(d===e)li(),b=oi(a,b,c);else{if(e=b.stateNode.hydrate)di=re(b.stateNode.containerInfo.firstChild),ci=b,e=ei=!0;if(e)for(c=gh(b,null,d,c),b.child=c;c;)c.effectTag=c.effectTag&-3|1024,c=c.sibling;else R(a,b,d,c),li();b=b.child}return b;case 5:return oh(b),null===a&&ii(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,oe(d,e)?g=null:null!==f&&oe(d,f)&&(b.effectTag|=16),ti(a,b),b.mode&4&&1!==c&&e.hidden?(b.expirationTime=\nb.childExpirationTime=1,b=null):(R(a,b,g,c),b=b.child),b;case 6:return null===a&&ii(b),null;case 13:return yi(a,b,c);case 4:return mh(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=fh(b,null,d,c):R(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:mg(d,e),ni(a,b,d,e,c);case 7:return R(a,b,b.pendingProps,c),b.child;case 8:return R(a,b,b.pendingProps.children,c),b.child;case 12:return R(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;\ne=b.pendingProps;g=b.memoizedProps;f=e.value;sg(b,f);if(null!==g){var h=g.value;f=of(h,f)?0:(\"function\"===typeof d._calculateChangedBits?d._calculateChangedBits(h,f):1073741823)|0;if(0===f){if(g.children===e.children&&!K.current){b=oi(a,b,c);break a}}else for(h=b.child,null!==h&&(h.return=b);null!==h;){var k=h.dependencies;if(null!==k){g=h.child;for(var l=k.firstContext;null!==l;){if(l.context===d&&0!==(l.observedBits&f)){1===h.tag&&(l=Bg(c,null),l.tag=2,Dg(h,l));h.expirationTime=b&&a<=b}function Mj(a,b){var c=a.firstSuspendedTime,d=a.lastSuspendedTime;cb||0===c)a.lastSuspendedTime=b;b<=a.lastPingedTime&&(a.lastPingedTime=0);b<=a.lastExpiredTime&&(a.lastExpiredTime=0)}\nfunction Nj(a,b){b>a.firstPendingTime&&(a.firstPendingTime=b);var c=a.firstSuspendedTime;0!==c&&(b>=c?a.firstSuspendedTime=a.lastSuspendedTime=a.nextKnownPendingLevel=0:b>=a.lastSuspendedTime&&(a.lastSuspendedTime=b+1),b>a.nextKnownPendingLevel&&(a.nextKnownPendingLevel=b))}function Rj(a,b){var c=a.lastExpiredTime;if(0===c||c>b)a.lastExpiredTime=b}\nfunction rk(a,b,c,d){var e=b.current,f=Pg(),g=Mg.suspense;f=Qg(f,e,g);a:if(c){c=c._reactInternalFiber;b:{if(ec(c)!==c||1!==c.tag)throw Error(u(170));var h=c;do{switch(h.tag){case 3:h=h.stateNode.context;break b;case 1:if(L(h.type)){h=h.stateNode.__reactInternalMemoizedMergedChildContext;break b}}h=h.return}while(null!==h);throw Error(u(171));}if(1===c.tag){var k=c.type;if(L(k)){c=If(c,k,h);break a}}c=h}else c=Cf;null===b.context?b.context=c:b.pendingContext=c;b=Bg(f,g);b.payload={element:a};d=void 0===\nd?null:d;null!==d&&(b.callback=d);Dg(e,b);Rg(e,f);return f}function sk(a){a=a.current;if(!a.child)return null;switch(a.child.tag){case 5:return a.child.stateNode;default:return a.child.stateNode}}function tk(a,b){a=a.memoizedState;null!==a&&null!==a.dehydrated&&a.retryTime=G};l=function(){};exports.unstable_forceFrameRate=function(a){0>a||125K(n,c))void 0!==r&&0>K(r,n)?(a[d]=r,a[v]=c,d=v):(a[d]=n,a[m]=c,d=m);else if(void 0!==r&&0>K(r,c))a[d]=r,a[v]=c,d=v;else break a}}return b}return null}function K(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}var N=[],O=[],P=1,Q=null,R=3,S=!1,T=!1,U=!1;\nfunction V(a){for(var b=L(O);null!==b;){if(null===b.callback)M(O);else if(b.startTime<=a)M(O),b.sortIndex=b.expirationTime,J(N,b);else break;b=L(O)}}function W(a){U=!1;V(a);if(!T)if(null!==L(N))T=!0,f(X);else{var b=L(O);null!==b&&g(W,b.startTime-a)}}\nfunction X(a,b){T=!1;U&&(U=!1,h());S=!0;var c=R;try{V(b);for(Q=L(N);null!==Q&&(!(Q.expirationTime>b)||a&&!k());){var d=Q.callback;if(null!==d){Q.callback=null;R=Q.priorityLevel;var e=d(Q.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?Q.callback=e:Q===L(N)&&M(N);V(b)}else M(N);Q=L(N)}if(null!==Q)var m=!0;else{var n=L(O);null!==n&&g(W,n.startTime-b);m=!1}return m}finally{Q=null,R=c,S=!1}}\nfunction Y(a){switch(a){case 1:return-1;case 2:return 250;case 5:return 1073741823;case 4:return 1E4;default:return 5E3}}var Z=l;exports.unstable_ImmediatePriority=1;exports.unstable_UserBlockingPriority=2;exports.unstable_NormalPriority=3;exports.unstable_IdlePriority=5;exports.unstable_LowPriority=4;exports.unstable_runWithPriority=function(a,b){switch(a){case 1:case 2:case 3:case 4:case 5:break;default:a=3}var c=R;R=a;try{return b()}finally{R=c}};\nexports.unstable_next=function(a){switch(R){case 1:case 2:case 3:var b=3;break;default:b=R}var c=R;R=b;try{return a()}finally{R=c}};\nexports.unstable_scheduleCallback=function(a,b,c){var d=exports.unstable_now();if(\"object\"===typeof c&&null!==c){var e=c.delay;e=\"number\"===typeof e&&0d?(a.sortIndex=e,J(O,a),null===L(N)&&a===L(O)&&(U?h():U=!0,g(W,e-d))):(a.sortIndex=c,J(N,a),T||S||(T=!0,f(X)));return a};exports.unstable_cancelCallback=function(a){a.callback=null};\nexports.unstable_wrapCallback=function(a){var b=R;return function(){var c=R;R=b;try{return a.apply(this,arguments)}finally{R=c}}};exports.unstable_getCurrentPriorityLevel=function(){return R};exports.unstable_shouldYield=function(){var a=exports.unstable_now();V(a);var b=L(N);return b!==Q&&null!==Q&&null!==b&&null!==b.callback&&b.startTime<=a&&b.expirationTime 0 && arguments[0] !== undefined ? arguments[0] : {};\n var defaultState = arguments.length > 1 ? arguments[1] : undefined;\n var opts = {\n payload: true,\n fallback: null\n };\n\n var reducer = _extends(reduce, {\n has: has,\n on: on,\n off: off,\n options: options\n });\n\n function has(typeOrActionCreator) {\n return !!handlers[normalizeType(typeOrActionCreator)];\n }\n\n function on(typeOrActionCreator, handler) {\n if (Array.isArray(typeOrActionCreator)) {\n typeOrActionCreator.forEach(function (action) {\n on(action, handler);\n });\n } else {\n handlers[normalizeType(typeOrActionCreator)] = handler;\n }\n\n return reducer;\n }\n\n function off(typeOrActionCreator) {\n if (Array.isArray(typeOrActionCreator)) {\n typeOrActionCreator.forEach(off);\n } else {\n delete handlers[normalizeType(typeOrActionCreator)];\n }\n\n return reducer;\n }\n\n function options(newOpts) {\n Object.keys(newOpts).forEach(function (name) {\n return opts[name] = newOpts[name];\n });\n return reducer;\n }\n\n if (typeof handlers === 'function') {\n var factory = handlers;\n handlers = {};\n factory(on, off);\n }\n\n if (!has(_batch[\"default\"])) {\n on(_batch[\"default\"], function (state, payload) {\n if (opts.payload) {\n return payload.reduce(reduce, state);\n } else {\n return payload.payload.reduce(reduce, state);\n }\n });\n }\n\n function reduce() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;\n var action = arguments.length > 1 ? arguments[1] : undefined;\n\n if (!action || typeof action.type !== 'string') {\n return state;\n }\n\n if (action.type.startsWith('@@redux/')) {\n return state;\n }\n\n var handler = handlers[action.type] || opts.fallback;\n\n if (handler) {\n if (opts.payload) {\n return handler(state, action.payload, action.meta);\n } else {\n return handler(state, action);\n }\n }\n\n return state;\n }\n\n ;\n return reducer;\n}\n\n;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = assignAll;\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction assignAll(actions, stores) {\n if (Array.isArray(actions)) {\n return actions.map(function (action) {\n return action.assignTo(stores);\n });\n }\n\n return Object.keys(actions).reduce(function (assigns, action) {\n return _extends(assigns, _defineProperty({}, action, actions[action].assignTo(stores)));\n }, {});\n}\n\n;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = bindAll;\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction bindAll(actions, stores) {\n if (Array.isArray(actions)) {\n return actions.map(function (action) {\n return action.bindTo(stores);\n });\n }\n\n return Object.keys(actions).reduce(function (binds, action) {\n return _extends(binds, _defineProperty({}, action, actions[action].bindTo(stores)));\n }, {});\n}\n\n;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = disbatch;\n\nvar _batch = _interopRequireDefault(require(\"./batch\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction disbatch(store) {\n for (var _len = arguments.length, actions = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {\n actions[_key - 1] = arguments[_key];\n }\n\n if (actions && actions.length > 0) {\n if (!store || typeof store !== 'function' && typeof store.dispatch !== 'function') {\n throw new TypeError('disbatch must take either a valid Redux store or a dispatch function as first parameter');\n }\n\n if (typeof store.dispatch === 'function') {\n store = store.dispatch;\n } // store is actually the dispatch function here\n\n\n return store(_batch[\"default\"].apply(void 0, actions));\n } else {\n if (!store || typeof store.dispatch !== 'function') {\n throw new TypeError('disbatch must take a valid Redux store with a dispatch function as first parameter');\n }\n\n return _extends(store, {\n disbatch: disbatch.bind(undefined, store)\n });\n }\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = void 0;\n\nvar reduxLogger = _interopRequireWildcard(require(\"./reduxLogger\"));\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj[\"default\"] = obj; return newObj; } }\n\nvar _default = {\n reduxLogger: reduxLogger\n};\nexports[\"default\"] = _default;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.actionTransformer = actionTransformer;\nexports.logger = void 0;\n\nvar _batch = _interopRequireDefault(require(\"../batch\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nvar batchType = _batch[\"default\"].getType();\n\nfunction actionTransformer(action) {\n if (action && action.type === batchType) {\n action.payload.type = batchType;\n return action.payload;\n }\n\n return action;\n}\n\nvar logger = {};\nexports.logger = logger;\n\nvar _loop = function _loop(level) {\n if (typeof console[level] === 'function') {\n logger[level] = function levelFn() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var lastArg = args.pop();\n\n if (Array.isArray(lastArg) && lastArg.type === batchType) {\n lastArg.forEach(function (action) {\n console[level].apply(console, [].concat(args, [action]));\n });\n } else {\n args.push(lastArg);\n console[level].apply(console, args);\n }\n };\n }\n};\n\nfor (var level in console) {\n _loop(level);\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports[\"default\"] = asError;\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction asError(action) {\n if (_typeof(action) === 'object' && action !== null) {\n action.error = true;\n }\n\n return action;\n}\n\n;","/**\n * Copyright (c) 2014-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nvar runtime = (function (exports) {\n \"use strict\";\n\n var Op = Object.prototype;\n var hasOwn = Op.hasOwnProperty;\n var undefined; // More compressible than void 0.\n var $Symbol = typeof Symbol === \"function\" ? Symbol : {};\n var iteratorSymbol = $Symbol.iterator || \"@@iterator\";\n var asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\";\n var toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\";\n\n function wrap(innerFn, outerFn, self, tryLocsList) {\n // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.\n var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;\n var generator = Object.create(protoGenerator.prototype);\n var context = new Context(tryLocsList || []);\n\n // The ._invoke method unifies the implementations of the .next,\n // .throw, and .return methods.\n generator._invoke = makeInvokeMethod(innerFn, self, context);\n\n return generator;\n }\n exports.wrap = wrap;\n\n // Try/catch helper to minimize deoptimizations. Returns a completion\n // record like context.tryEntries[i].completion. This interface could\n // have been (and was previously) designed to take a closure to be\n // invoked without arguments, but in all the cases we care about we\n // already have an existing method we want to call, so there's no need\n // to create a new function object. We can even get away with assuming\n // the method takes exactly one argument, since that happens to be true\n // in every case, so we don't have to touch the arguments object. The\n // only additional allocation required is the completion record, which\n // has a stable shape and so hopefully should be cheap to allocate.\n function tryCatch(fn, obj, arg) {\n try {\n return { type: \"normal\", arg: fn.call(obj, arg) };\n } catch (err) {\n return { type: \"throw\", arg: err };\n }\n }\n\n var GenStateSuspendedStart = \"suspendedStart\";\n var GenStateSuspendedYield = \"suspendedYield\";\n var GenStateExecuting = \"executing\";\n var GenStateCompleted = \"completed\";\n\n // Returning this object from the innerFn has the same effect as\n // breaking out of the dispatch switch statement.\n var ContinueSentinel = {};\n\n // Dummy constructor functions that we use as the .constructor and\n // .constructor.prototype properties for functions that return Generator\n // objects. For full spec compliance, you may wish to configure your\n // minifier not to mangle the names of these two functions.\n function Generator() {}\n function GeneratorFunction() {}\n function GeneratorFunctionPrototype() {}\n\n // This is a polyfill for %IteratorPrototype% for environments that\n // don't natively support it.\n var IteratorPrototype = {};\n IteratorPrototype[iteratorSymbol] = function () {\n return this;\n };\n\n var getProto = Object.getPrototypeOf;\n var NativeIteratorPrototype = getProto && getProto(getProto(values([])));\n if (NativeIteratorPrototype &&\n NativeIteratorPrototype !== Op &&\n hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {\n // This environment has a native %IteratorPrototype%; use it instead\n // of the polyfill.\n IteratorPrototype = NativeIteratorPrototype;\n }\n\n var Gp = GeneratorFunctionPrototype.prototype =\n Generator.prototype = Object.create(IteratorPrototype);\n GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;\n GeneratorFunctionPrototype.constructor = GeneratorFunction;\n GeneratorFunctionPrototype[toStringTagSymbol] =\n GeneratorFunction.displayName = \"GeneratorFunction\";\n\n // Helper for defining the .next, .throw, and .return methods of the\n // Iterator interface in terms of a single ._invoke method.\n function defineIteratorMethods(prototype) {\n [\"next\", \"throw\", \"return\"].forEach(function(method) {\n prototype[method] = function(arg) {\n return this._invoke(method, arg);\n };\n });\n }\n\n exports.isGeneratorFunction = function(genFun) {\n var ctor = typeof genFun === \"function\" && genFun.constructor;\n return ctor\n ? ctor === GeneratorFunction ||\n // For the native GeneratorFunction constructor, the best we can\n // do is to check its .name property.\n (ctor.displayName || ctor.name) === \"GeneratorFunction\"\n : false;\n };\n\n exports.mark = function(genFun) {\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);\n } else {\n genFun.__proto__ = GeneratorFunctionPrototype;\n if (!(toStringTagSymbol in genFun)) {\n genFun[toStringTagSymbol] = \"GeneratorFunction\";\n }\n }\n genFun.prototype = Object.create(Gp);\n return genFun;\n };\n\n // Within the body of any async function, `await x` is transformed to\n // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test\n // `hasOwn.call(value, \"__await\")` to determine if the yielded value is\n // meant to be awaited.\n exports.awrap = function(arg) {\n return { __await: arg };\n };\n\n function AsyncIterator(generator) {\n function invoke(method, arg, resolve, reject) {\n var record = tryCatch(generator[method], generator, arg);\n if (record.type === \"throw\") {\n reject(record.arg);\n } else {\n var result = record.arg;\n var value = result.value;\n if (value &&\n typeof value === \"object\" &&\n hasOwn.call(value, \"__await\")) {\n return Promise.resolve(value.__await).then(function(value) {\n invoke(\"next\", value, resolve, reject);\n }, function(err) {\n invoke(\"throw\", err, resolve, reject);\n });\n }\n\n return Promise.resolve(value).then(function(unwrapped) {\n // When a yielded Promise is resolved, its final value becomes\n // the .value of the Promise<{value,done}> result for the\n // current iteration.\n result.value = unwrapped;\n resolve(result);\n }, function(error) {\n // If a rejected Promise was yielded, throw the rejection back\n // into the async generator function so it can be handled there.\n return invoke(\"throw\", error, resolve, reject);\n });\n }\n }\n\n var previousPromise;\n\n function enqueue(method, arg) {\n function callInvokeWithMethodAndArg() {\n return new Promise(function(resolve, reject) {\n invoke(method, arg, resolve, reject);\n });\n }\n\n return previousPromise =\n // If enqueue has been called before, then we want to wait until\n // all previous Promises have been resolved before calling invoke,\n // so that results are always delivered in the correct order. If\n // enqueue has not been called before, then it is important to\n // call invoke immediately, without waiting on a callback to fire,\n // so that the async generator function has the opportunity to do\n // any necessary setup in a predictable way. This predictability\n // is why the Promise constructor synchronously invokes its\n // executor callback, and why async functions synchronously\n // execute code before the first await. Since we implement simple\n // async functions in terms of async generators, it is especially\n // important to get this right, even though it requires care.\n previousPromise ? previousPromise.then(\n callInvokeWithMethodAndArg,\n // Avoid propagating failures to Promises returned by later\n // invocations of the iterator.\n callInvokeWithMethodAndArg\n ) : callInvokeWithMethodAndArg();\n }\n\n // Define the unified helper method that is used to implement .next,\n // .throw, and .return (see defineIteratorMethods).\n this._invoke = enqueue;\n }\n\n defineIteratorMethods(AsyncIterator.prototype);\n AsyncIterator.prototype[asyncIteratorSymbol] = function () {\n return this;\n };\n exports.AsyncIterator = AsyncIterator;\n\n // Note that simple async functions are implemented on top of\n // AsyncIterator objects; they just return a Promise for the value of\n // the final result produced by the iterator.\n exports.async = function(innerFn, outerFn, self, tryLocsList) {\n var iter = new AsyncIterator(\n wrap(innerFn, outerFn, self, tryLocsList)\n );\n\n return exports.isGeneratorFunction(outerFn)\n ? iter // If outerFn is a generator, return the full iterator.\n : iter.next().then(function(result) {\n return result.done ? result.value : iter.next();\n });\n };\n\n function makeInvokeMethod(innerFn, self, context) {\n var state = GenStateSuspendedStart;\n\n return function invoke(method, arg) {\n if (state === GenStateExecuting) {\n throw new Error(\"Generator is already running\");\n }\n\n if (state === GenStateCompleted) {\n if (method === \"throw\") {\n throw arg;\n }\n\n // Be forgiving, per 25.3.3.3.3 of the spec:\n // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume\n return doneResult();\n }\n\n context.method = method;\n context.arg = arg;\n\n while (true) {\n var delegate = context.delegate;\n if (delegate) {\n var delegateResult = maybeInvokeDelegate(delegate, context);\n if (delegateResult) {\n if (delegateResult === ContinueSentinel) continue;\n return delegateResult;\n }\n }\n\n if (context.method === \"next\") {\n // Setting context._sent for legacy support of Babel's\n // function.sent implementation.\n context.sent = context._sent = context.arg;\n\n } else if (context.method === \"throw\") {\n if (state === GenStateSuspendedStart) {\n state = GenStateCompleted;\n throw context.arg;\n }\n\n context.dispatchException(context.arg);\n\n } else if (context.method === \"return\") {\n context.abrupt(\"return\", context.arg);\n }\n\n state = GenStateExecuting;\n\n var record = tryCatch(innerFn, self, context);\n if (record.type === \"normal\") {\n // If an exception is thrown from innerFn, we leave state ===\n // GenStateExecuting and loop back for another invocation.\n state = context.done\n ? GenStateCompleted\n : GenStateSuspendedYield;\n\n if (record.arg === ContinueSentinel) {\n continue;\n }\n\n return {\n value: record.arg,\n done: context.done\n };\n\n } else if (record.type === \"throw\") {\n state = GenStateCompleted;\n // Dispatch the exception by looping back around to the\n // context.dispatchException(context.arg) call above.\n context.method = \"throw\";\n context.arg = record.arg;\n }\n }\n };\n }\n\n // Call delegate.iterator[context.method](context.arg) and handle the\n // result, either by returning a { value, done } result from the\n // delegate iterator, or by modifying context.method and context.arg,\n // setting context.delegate to null, and returning the ContinueSentinel.\n function maybeInvokeDelegate(delegate, context) {\n var method = delegate.iterator[context.method];\n if (method === undefined) {\n // A .throw or .return when the delegate iterator has no .throw\n // method always terminates the yield* loop.\n context.delegate = null;\n\n if (context.method === \"throw\") {\n // Note: [\"return\"] must be used for ES3 parsing compatibility.\n if (delegate.iterator[\"return\"]) {\n // If the delegate iterator has a return method, give it a\n // chance to clean up.\n context.method = \"return\";\n context.arg = undefined;\n maybeInvokeDelegate(delegate, context);\n\n if (context.method === \"throw\") {\n // If maybeInvokeDelegate(context) changed context.method from\n // \"return\" to \"throw\", let that override the TypeError below.\n return ContinueSentinel;\n }\n }\n\n context.method = \"throw\";\n context.arg = new TypeError(\n \"The iterator does not provide a 'throw' method\");\n }\n\n return ContinueSentinel;\n }\n\n var record = tryCatch(method, delegate.iterator, context.arg);\n\n if (record.type === \"throw\") {\n context.method = \"throw\";\n context.arg = record.arg;\n context.delegate = null;\n return ContinueSentinel;\n }\n\n var info = record.arg;\n\n if (! info) {\n context.method = \"throw\";\n context.arg = new TypeError(\"iterator result is not an object\");\n context.delegate = null;\n return ContinueSentinel;\n }\n\n if (info.done) {\n // Assign the result of the finished delegate to the temporary\n // variable specified by delegate.resultName (see delegateYield).\n context[delegate.resultName] = info.value;\n\n // Resume execution at the desired location (see delegateYield).\n context.next = delegate.nextLoc;\n\n // If context.method was \"throw\" but the delegate handled the\n // exception, let the outer generator proceed normally. If\n // context.method was \"next\", forget context.arg since it has been\n // \"consumed\" by the delegate iterator. If context.method was\n // \"return\", allow the original .return call to continue in the\n // outer generator.\n if (context.method !== \"return\") {\n context.method = \"next\";\n context.arg = undefined;\n }\n\n } else {\n // Re-yield the result returned by the delegate method.\n return info;\n }\n\n // The delegate iterator is finished, so forget it and continue with\n // the outer generator.\n context.delegate = null;\n return ContinueSentinel;\n }\n\n // Define Generator.prototype.{next,throw,return} in terms of the\n // unified ._invoke helper method.\n defineIteratorMethods(Gp);\n\n Gp[toStringTagSymbol] = \"Generator\";\n\n // A Generator should always return itself as the iterator object when the\n // @@iterator function is called on it. Some browsers' implementations of the\n // iterator prototype chain incorrectly implement this, causing the Generator\n // object to not be returned from this call. This ensures that doesn't happen.\n // See https://github.com/facebook/regenerator/issues/274 for more details.\n Gp[iteratorSymbol] = function() {\n return this;\n };\n\n Gp.toString = function() {\n return \"[object Generator]\";\n };\n\n function pushTryEntry(locs) {\n var entry = { tryLoc: locs[0] };\n\n if (1 in locs) {\n entry.catchLoc = locs[1];\n }\n\n if (2 in locs) {\n entry.finallyLoc = locs[2];\n entry.afterLoc = locs[3];\n }\n\n this.tryEntries.push(entry);\n }\n\n function resetTryEntry(entry) {\n var record = entry.completion || {};\n record.type = \"normal\";\n delete record.arg;\n entry.completion = record;\n }\n\n function Context(tryLocsList) {\n // The root entry object (effectively a try statement without a catch\n // or a finally block) gives us a place to store values thrown from\n // locations where there is no enclosing try statement.\n this.tryEntries = [{ tryLoc: \"root\" }];\n tryLocsList.forEach(pushTryEntry, this);\n this.reset(true);\n }\n\n exports.keys = function(object) {\n var keys = [];\n for (var key in object) {\n keys.push(key);\n }\n keys.reverse();\n\n // Rather than returning an object with a next method, we keep\n // things simple and return the next function itself.\n return function next() {\n while (keys.length) {\n var key = keys.pop();\n if (key in object) {\n next.value = key;\n next.done = false;\n return next;\n }\n }\n\n // To avoid creating an additional object, we just hang the .value\n // and .done properties off the next function object itself. This\n // also ensures that the minifier will not anonymize the function.\n next.done = true;\n return next;\n };\n };\n\n function values(iterable) {\n if (iterable) {\n var iteratorMethod = iterable[iteratorSymbol];\n if (iteratorMethod) {\n return iteratorMethod.call(iterable);\n }\n\n if (typeof iterable.next === \"function\") {\n return iterable;\n }\n\n if (!isNaN(iterable.length)) {\n var i = -1, next = function next() {\n while (++i < iterable.length) {\n if (hasOwn.call(iterable, i)) {\n next.value = iterable[i];\n next.done = false;\n return next;\n }\n }\n\n next.value = undefined;\n next.done = true;\n\n return next;\n };\n\n return next.next = next;\n }\n }\n\n // Return an iterator with no values.\n return { next: doneResult };\n }\n exports.values = values;\n\n function doneResult() {\n return { value: undefined, done: true };\n }\n\n Context.prototype = {\n constructor: Context,\n\n reset: function(skipTempReset) {\n this.prev = 0;\n this.next = 0;\n // Resetting context._sent for legacy support of Babel's\n // function.sent implementation.\n this.sent = this._sent = undefined;\n this.done = false;\n this.delegate = null;\n\n this.method = \"next\";\n this.arg = undefined;\n\n this.tryEntries.forEach(resetTryEntry);\n\n if (!skipTempReset) {\n for (var name in this) {\n // Not sure about the optimal order of these conditions:\n if (name.charAt(0) === \"t\" &&\n hasOwn.call(this, name) &&\n !isNaN(+name.slice(1))) {\n this[name] = undefined;\n }\n }\n }\n },\n\n stop: function() {\n this.done = true;\n\n var rootEntry = this.tryEntries[0];\n var rootRecord = rootEntry.completion;\n if (rootRecord.type === \"throw\") {\n throw rootRecord.arg;\n }\n\n return this.rval;\n },\n\n dispatchException: function(exception) {\n if (this.done) {\n throw exception;\n }\n\n var context = this;\n function handle(loc, caught) {\n record.type = \"throw\";\n record.arg = exception;\n context.next = loc;\n\n if (caught) {\n // If the dispatched exception was caught by a catch block,\n // then let that catch block handle the exception normally.\n context.method = \"next\";\n context.arg = undefined;\n }\n\n return !! caught;\n }\n\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n var record = entry.completion;\n\n if (entry.tryLoc === \"root\") {\n // Exception thrown outside of any try block that could handle\n // it, so set the completion value of the entire function to\n // throw the exception.\n return handle(\"end\");\n }\n\n if (entry.tryLoc <= this.prev) {\n var hasCatch = hasOwn.call(entry, \"catchLoc\");\n var hasFinally = hasOwn.call(entry, \"finallyLoc\");\n\n if (hasCatch && hasFinally) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n } else if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else if (hasCatch) {\n if (this.prev < entry.catchLoc) {\n return handle(entry.catchLoc, true);\n }\n\n } else if (hasFinally) {\n if (this.prev < entry.finallyLoc) {\n return handle(entry.finallyLoc);\n }\n\n } else {\n throw new Error(\"try statement without catch or finally\");\n }\n }\n }\n },\n\n abrupt: function(type, arg) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc <= this.prev &&\n hasOwn.call(entry, \"finallyLoc\") &&\n this.prev < entry.finallyLoc) {\n var finallyEntry = entry;\n break;\n }\n }\n\n if (finallyEntry &&\n (type === \"break\" ||\n type === \"continue\") &&\n finallyEntry.tryLoc <= arg &&\n arg <= finallyEntry.finallyLoc) {\n // Ignore the finally entry if control is not jumping to a\n // location outside the try/catch block.\n finallyEntry = null;\n }\n\n var record = finallyEntry ? finallyEntry.completion : {};\n record.type = type;\n record.arg = arg;\n\n if (finallyEntry) {\n this.method = \"next\";\n this.next = finallyEntry.finallyLoc;\n return ContinueSentinel;\n }\n\n return this.complete(record);\n },\n\n complete: function(record, afterLoc) {\n if (record.type === \"throw\") {\n throw record.arg;\n }\n\n if (record.type === \"break\" ||\n record.type === \"continue\") {\n this.next = record.arg;\n } else if (record.type === \"return\") {\n this.rval = this.arg = record.arg;\n this.method = \"return\";\n this.next = \"end\";\n } else if (record.type === \"normal\" && afterLoc) {\n this.next = afterLoc;\n }\n\n return ContinueSentinel;\n },\n\n finish: function(finallyLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.finallyLoc === finallyLoc) {\n this.complete(entry.completion, entry.afterLoc);\n resetTryEntry(entry);\n return ContinueSentinel;\n }\n }\n },\n\n \"catch\": function(tryLoc) {\n for (var i = this.tryEntries.length - 1; i >= 0; --i) {\n var entry = this.tryEntries[i];\n if (entry.tryLoc === tryLoc) {\n var record = entry.completion;\n if (record.type === \"throw\") {\n var thrown = record.arg;\n resetTryEntry(entry);\n }\n return thrown;\n }\n }\n\n // The context.catch method must only be called with a location\n // argument that corresponds to a known catch block.\n throw new Error(\"illegal catch attempt\");\n },\n\n delegateYield: function(iterable, resultName, nextLoc) {\n this.delegate = {\n iterator: values(iterable),\n resultName: resultName,\n nextLoc: nextLoc\n };\n\n if (this.method === \"next\") {\n // Deliberately forget the last sent value so that we don't\n // accidentally pass it on to the delegate.\n this.arg = undefined;\n }\n\n return ContinueSentinel;\n }\n };\n\n // Regardless of whether this script is executing as a CommonJS module\n // or not, return the runtime object so that we can declare the variable\n // regeneratorRuntime in the outer scope, which allows this module to be\n // injected easily by `bin/regenerator --include-runtime script.js`.\n return exports;\n\n}(\n // If this script is executing as a CommonJS module, use module.exports\n // as the regeneratorRuntime namespace. Otherwise create a new empty\n // object. Either way, the resulting object will be used to initialize\n // the regeneratorRuntime variable at the top of this file.\n typeof module === \"object\" ? module.exports : {}\n));\n\ntry {\n regeneratorRuntime = runtime;\n} catch (accidentalStrictMode) {\n // This module should not be running in strict mode, so the above\n // assignment should always work unless something is misconfigured. Just\n // in case runtime.js accidentally runs in strict mode, we can escape\n // strict mode using a global Function call. This could conceivably fail\n // if a Content Security Policy forbids using Function, but in that case\n // the proper solution is to fix the accidental strict mode problem. If\n // you've misconfigured your bundler to force strict mode and applied a\n // CSP to forbid Function, and you're not willing to fix either of those\n // problems, please detail your unique predicament in a GitHub issue.\n Function(\"r\", \"regeneratorRuntime = r\")(runtime);\n}\n","'use strict';\n\nvar utils = require('./utils');\nvar bind = require('./helpers/bind');\nvar Axios = require('./core/Axios');\nvar mergeConfig = require('./core/mergeConfig');\nvar defaults = require('./defaults');\n\n/**\n * Create an instance of Axios\n *\n * @param {Object} defaultConfig The default config for the instance\n * @return {Axios} A new instance of Axios\n */\nfunction createInstance(defaultConfig) {\n var context = new Axios(defaultConfig);\n var instance = bind(Axios.prototype.request, context);\n\n // Copy axios.prototype to instance\n utils.extend(instance, Axios.prototype, context);\n\n // Copy context to instance\n utils.extend(instance, context);\n\n return instance;\n}\n\n// Create the default instance to be exported\nvar axios = createInstance(defaults);\n\n// Expose Axios class to allow class inheritance\naxios.Axios = Axios;\n\n// Factory for creating new instances\naxios.create = function create(instanceConfig) {\n return createInstance(mergeConfig(axios.defaults, instanceConfig));\n};\n\n// Expose Cancel & CancelToken\naxios.Cancel = require('./cancel/Cancel');\naxios.CancelToken = require('./cancel/CancelToken');\naxios.isCancel = require('./cancel/isCancel');\n\n// Expose all/spread\naxios.all = function all(promises) {\n return Promise.all(promises);\n};\naxios.spread = require('./helpers/spread');\n\n// Expose isAxiosError\naxios.isAxiosError = require('./helpers/isAxiosError');\n\nmodule.exports = axios;\n\n// Allow use of default import syntax in TypeScript\nmodule.exports.default = axios;\n","'use strict';\n\nvar utils = require('./../utils');\nvar buildURL = require('../helpers/buildURL');\nvar InterceptorManager = require('./InterceptorManager');\nvar dispatchRequest = require('./dispatchRequest');\nvar mergeConfig = require('./mergeConfig');\nvar validator = require('../helpers/validator');\n\nvar validators = validator.validators;\n/**\n * Create a new instance of Axios\n *\n * @param {Object} instanceConfig The default config for the instance\n */\nfunction Axios(instanceConfig) {\n this.defaults = instanceConfig;\n this.interceptors = {\n request: new InterceptorManager(),\n response: new InterceptorManager()\n };\n}\n\n/**\n * Dispatch a request\n *\n * @param {Object} config The config specific for this request (merged with this.defaults)\n */\nAxios.prototype.request = function request(config) {\n /*eslint no-param-reassign:0*/\n // Allow for axios('example/url'[, config]) a la fetch API\n if (typeof config === 'string') {\n config = arguments[1] || {};\n config.url = arguments[0];\n } else {\n config = config || {};\n }\n\n config = mergeConfig(this.defaults, config);\n\n // Set config.method\n if (config.method) {\n config.method = config.method.toLowerCase();\n } else if (this.defaults.method) {\n config.method = this.defaults.method.toLowerCase();\n } else {\n config.method = 'get';\n }\n\n var transitional = config.transitional;\n\n if (transitional !== undefined) {\n validator.assertOptions(transitional, {\n silentJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n forcedJSONParsing: validators.transitional(validators.boolean, '1.0.0'),\n clarifyTimeoutError: validators.transitional(validators.boolean, '1.0.0')\n }, false);\n }\n\n // filter out skipped interceptors\n var requestInterceptorChain = [];\n var synchronousRequestInterceptors = true;\n this.interceptors.request.forEach(function unshiftRequestInterceptors(interceptor) {\n if (typeof interceptor.runWhen === 'function' && interceptor.runWhen(config) === false) {\n return;\n }\n\n synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;\n\n requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);\n });\n\n var responseInterceptorChain = [];\n this.interceptors.response.forEach(function pushResponseInterceptors(interceptor) {\n responseInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);\n });\n\n var promise;\n\n if (!synchronousRequestInterceptors) {\n var chain = [dispatchRequest, undefined];\n\n Array.prototype.unshift.apply(chain, requestInterceptorChain);\n chain.concat(responseInterceptorChain);\n\n promise = Promise.resolve(config);\n while (chain.length) {\n promise = promise.then(chain.shift(), chain.shift());\n }\n\n return promise;\n }\n\n\n var newConfig = config;\n while (requestInterceptorChain.length) {\n var onFulfilled = requestInterceptorChain.shift();\n var onRejected = requestInterceptorChain.shift();\n try {\n newConfig = onFulfilled(newConfig);\n } catch (error) {\n onRejected(error);\n break;\n }\n }\n\n try {\n promise = dispatchRequest(newConfig);\n } catch (error) {\n return Promise.reject(error);\n }\n\n while (responseInterceptorChain.length) {\n promise = promise.then(responseInterceptorChain.shift(), responseInterceptorChain.shift());\n }\n\n return promise;\n};\n\nAxios.prototype.getUri = function getUri(config) {\n config = mergeConfig(this.defaults, config);\n return buildURL(config.url, config.params, config.paramsSerializer).replace(/^\\?/, '');\n};\n\n// Provide aliases for supported request methods\nutils.forEach(['delete', 'get', 'head', 'options'], function forEachMethodNoData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: (config || {}).data\n }));\n };\n});\n\nutils.forEach(['post', 'put', 'patch'], function forEachMethodWithData(method) {\n /*eslint func-names:0*/\n Axios.prototype[method] = function(url, data, config) {\n return this.request(mergeConfig(config || {}, {\n method: method,\n url: url,\n data: data\n }));\n };\n});\n\nmodule.exports = Axios;\n","'use strict';\n\nvar utils = require('./../utils');\n\nfunction InterceptorManager() {\n this.handlers = [];\n}\n\n/**\n * Add a new interceptor to the stack\n *\n * @param {Function} fulfilled The function to handle `then` for a `Promise`\n * @param {Function} rejected The function to handle `reject` for a `Promise`\n *\n * @return {Number} An ID used to remove interceptor later\n */\nInterceptorManager.prototype.use = function use(fulfilled, rejected, options) {\n this.handlers.push({\n fulfilled: fulfilled,\n rejected: rejected,\n synchronous: options ? options.synchronous : false,\n runWhen: options ? options.runWhen : null\n });\n return this.handlers.length - 1;\n};\n\n/**\n * Remove an interceptor from the stack\n *\n * @param {Number} id The ID that was returned by `use`\n */\nInterceptorManager.prototype.eject = function eject(id) {\n if (this.handlers[id]) {\n this.handlers[id] = null;\n }\n};\n\n/**\n * Iterate over all the registered interceptors\n *\n * This method is particularly useful for skipping over any\n * interceptors that may have become `null` calling `eject`.\n *\n * @param {Function} fn The function to call for each interceptor\n */\nInterceptorManager.prototype.forEach = function forEach(fn) {\n utils.forEach(this.handlers, function forEachHandler(h) {\n if (h !== null) {\n fn(h);\n }\n });\n};\n\nmodule.exports = InterceptorManager;\n","'use strict';\n\nvar utils = require('./../utils');\nvar transformData = require('./transformData');\nvar isCancel = require('../cancel/isCancel');\nvar defaults = require('../defaults');\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nfunction throwIfCancellationRequested(config) {\n if (config.cancelToken) {\n config.cancelToken.throwIfRequested();\n }\n}\n\n/**\n * Dispatch a request to the server using the configured adapter.\n *\n * @param {object} config The config that is to be used for the request\n * @returns {Promise} The Promise to be fulfilled\n */\nmodule.exports = function dispatchRequest(config) {\n throwIfCancellationRequested(config);\n\n // Ensure headers exist\n config.headers = config.headers || {};\n\n // Transform request data\n config.data = transformData.call(\n config,\n config.data,\n config.headers,\n config.transformRequest\n );\n\n // Flatten headers\n config.headers = utils.merge(\n config.headers.common || {},\n config.headers[config.method] || {},\n config.headers\n );\n\n utils.forEach(\n ['delete', 'get', 'head', 'post', 'put', 'patch', 'common'],\n function cleanHeaderConfig(method) {\n delete config.headers[method];\n }\n );\n\n var adapter = config.adapter || defaults.adapter;\n\n return adapter(config).then(function onAdapterResolution(response) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n response.data = transformData.call(\n config,\n response.data,\n response.headers,\n config.transformResponse\n );\n\n return response;\n }, function onAdapterRejection(reason) {\n if (!isCancel(reason)) {\n throwIfCancellationRequested(config);\n\n // Transform response data\n if (reason && reason.response) {\n reason.response.data = transformData.call(\n config,\n reason.response.data,\n reason.response.headers,\n config.transformResponse\n );\n }\n }\n\n return Promise.reject(reason);\n });\n};\n","'use strict';\n\nvar utils = require('./../utils');\nvar defaults = require('./../defaults');\n\n/**\n * Transform the data for a request or a response\n *\n * @param {Object|String} data The data to be transformed\n * @param {Array} headers The headers for the request or response\n * @param {Array|Function} fns A single function or Array of functions\n * @returns {*} The resulting transformed data\n */\nmodule.exports = function transformData(data, headers, fns) {\n var context = this || defaults;\n /*eslint no-param-reassign:0*/\n utils.forEach(fns, function transform(fn) {\n data = fn.call(context, data, headers);\n });\n\n return data;\n};\n","'use strict';\n\nvar utils = require('../utils');\n\nmodule.exports = function normalizeHeaderName(headers, normalizedName) {\n utils.forEach(headers, function processHeader(value, name) {\n if (name !== normalizedName && name.toUpperCase() === normalizedName.toUpperCase()) {\n headers[normalizedName] = value;\n delete headers[name];\n }\n });\n};\n","'use strict';\n\nvar createError = require('./createError');\n\n/**\n * Resolve or reject a Promise based on response status.\n *\n * @param {Function} resolve A function that resolves the promise.\n * @param {Function} reject A function that rejects the promise.\n * @param {object} response The response.\n */\nmodule.exports = function settle(resolve, reject, response) {\n var validateStatus = response.config.validateStatus;\n if (!response.status || !validateStatus || validateStatus(response.status)) {\n resolve(response);\n } else {\n reject(createError(\n 'Request failed with status code ' + response.status,\n response.config,\n null,\n response.request,\n response\n ));\n }\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs support document.cookie\n (function standardBrowserEnv() {\n return {\n write: function write(name, value, expires, path, domain, secure) {\n var cookie = [];\n cookie.push(name + '=' + encodeURIComponent(value));\n\n if (utils.isNumber(expires)) {\n cookie.push('expires=' + new Date(expires).toGMTString());\n }\n\n if (utils.isString(path)) {\n cookie.push('path=' + path);\n }\n\n if (utils.isString(domain)) {\n cookie.push('domain=' + domain);\n }\n\n if (secure === true) {\n cookie.push('secure');\n }\n\n document.cookie = cookie.join('; ');\n },\n\n read: function read(name) {\n var match = document.cookie.match(new RegExp('(^|;\\\\s*)(' + name + ')=([^;]*)'));\n return (match ? decodeURIComponent(match[3]) : null);\n },\n\n remove: function remove(name) {\n this.write(name, '', Date.now() - 86400000);\n }\n };\n })() :\n\n // Non standard browser env (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return {\n write: function write() {},\n read: function read() { return null; },\n remove: function remove() {}\n };\n })()\n);\n","'use strict';\n\nvar isAbsoluteURL = require('../helpers/isAbsoluteURL');\nvar combineURLs = require('../helpers/combineURLs');\n\n/**\n * Creates a new URL by combining the baseURL with the requestedURL,\n * only when the requestedURL is not already an absolute URL.\n * If the requestURL is absolute, this function returns the requestedURL untouched.\n *\n * @param {string} baseURL The base URL\n * @param {string} requestedURL Absolute or relative URL to combine\n * @returns {string} The combined full path\n */\nmodule.exports = function buildFullPath(baseURL, requestedURL) {\n if (baseURL && !isAbsoluteURL(requestedURL)) {\n return combineURLs(baseURL, requestedURL);\n }\n return requestedURL;\n};\n","'use strict';\n\n/**\n * Determines whether the specified URL is absolute\n *\n * @param {string} url The URL to test\n * @returns {boolean} True if the specified URL is absolute, otherwise false\n */\nmodule.exports = function isAbsoluteURL(url) {\n // A URL is considered absolute if it begins with \"://\" or \"//\" (protocol-relative URL).\n // RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed\n // by any combination of letters, digits, plus, period, or hyphen.\n return /^([a-z][a-z\\d\\+\\-\\.]*:)?\\/\\//i.test(url);\n};\n","'use strict';\n\n/**\n * Creates a new URL by combining the specified URLs\n *\n * @param {string} baseURL The base URL\n * @param {string} relativeURL The relative URL\n * @returns {string} The combined URL\n */\nmodule.exports = function combineURLs(baseURL, relativeURL) {\n return relativeURL\n ? baseURL.replace(/\\/+$/, '') + '/' + relativeURL.replace(/^\\/+/, '')\n : baseURL;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\n// Headers whose duplicates are ignored by node\n// c.f. https://nodejs.org/api/http.html#http_message_headers\nvar ignoreDuplicateOf = [\n 'age', 'authorization', 'content-length', 'content-type', 'etag',\n 'expires', 'from', 'host', 'if-modified-since', 'if-unmodified-since',\n 'last-modified', 'location', 'max-forwards', 'proxy-authorization',\n 'referer', 'retry-after', 'user-agent'\n];\n\n/**\n * Parse headers into an object\n *\n * ```\n * Date: Wed, 27 Aug 2014 08:58:49 GMT\n * Content-Type: application/json\n * Connection: keep-alive\n * Transfer-Encoding: chunked\n * ```\n *\n * @param {String} headers Headers needing to be parsed\n * @returns {Object} Headers parsed into an object\n */\nmodule.exports = function parseHeaders(headers) {\n var parsed = {};\n var key;\n var val;\n var i;\n\n if (!headers) { return parsed; }\n\n utils.forEach(headers.split('\\n'), function parser(line) {\n i = line.indexOf(':');\n key = utils.trim(line.substr(0, i)).toLowerCase();\n val = utils.trim(line.substr(i + 1));\n\n if (key) {\n if (parsed[key] && ignoreDuplicateOf.indexOf(key) >= 0) {\n return;\n }\n if (key === 'set-cookie') {\n parsed[key] = (parsed[key] ? parsed[key] : []).concat([val]);\n } else {\n parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;\n }\n }\n });\n\n return parsed;\n};\n","'use strict';\n\nvar utils = require('./../utils');\n\nmodule.exports = (\n utils.isStandardBrowserEnv() ?\n\n // Standard browser envs have full support of the APIs needed to test\n // whether the request URL is of the same origin as current location.\n (function standardBrowserEnv() {\n var msie = /(msie|trident)/i.test(navigator.userAgent);\n var urlParsingNode = document.createElement('a');\n var originURL;\n\n /**\n * Parse a URL to discover it's components\n *\n * @param {String} url The URL to be parsed\n * @returns {Object}\n */\n function resolveURL(url) {\n var href = url;\n\n if (msie) {\n // IE needs attribute set twice to normalize properties\n urlParsingNode.setAttribute('href', href);\n href = urlParsingNode.href;\n }\n\n urlParsingNode.setAttribute('href', href);\n\n // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils\n return {\n href: urlParsingNode.href,\n protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',\n host: urlParsingNode.host,\n search: urlParsingNode.search ? urlParsingNode.search.replace(/^\\?/, '') : '',\n hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',\n hostname: urlParsingNode.hostname,\n port: urlParsingNode.port,\n pathname: (urlParsingNode.pathname.charAt(0) === '/') ?\n urlParsingNode.pathname :\n '/' + urlParsingNode.pathname\n };\n }\n\n originURL = resolveURL(window.location.href);\n\n /**\n * Determine if a URL shares the same origin as the current location\n *\n * @param {String} requestURL The URL to test\n * @returns {boolean} True if URL shares the same origin, otherwise false\n */\n return function isURLSameOrigin(requestURL) {\n var parsed = (utils.isString(requestURL)) ? resolveURL(requestURL) : requestURL;\n return (parsed.protocol === originURL.protocol &&\n parsed.host === originURL.host);\n };\n })() :\n\n // Non standard browser envs (web workers, react-native) lack needed support.\n (function nonStandardBrowserEnv() {\n return function isURLSameOrigin() {\n return true;\n };\n })()\n);\n","'use strict';\n\nvar pkg = require('./../../package.json');\n\nvar validators = {};\n\n// eslint-disable-next-line func-names\n['object', 'boolean', 'number', 'function', 'string', 'symbol'].forEach(function(type, i) {\n validators[type] = function validator(thing) {\n return typeof thing === type || 'a' + (i < 1 ? 'n ' : ' ') + type;\n };\n});\n\nvar deprecatedWarnings = {};\nvar currentVerArr = pkg.version.split('.');\n\n/**\n * Compare package versions\n * @param {string} version\n * @param {string?} thanVersion\n * @returns {boolean}\n */\nfunction isOlderVersion(version, thanVersion) {\n var pkgVersionArr = thanVersion ? thanVersion.split('.') : currentVerArr;\n var destVer = version.split('.');\n for (var i = 0; i < 3; i++) {\n if (pkgVersionArr[i] > destVer[i]) {\n return true;\n } else if (pkgVersionArr[i] < destVer[i]) {\n return false;\n }\n }\n return false;\n}\n\n/**\n * Transitional option validator\n * @param {function|boolean?} validator\n * @param {string?} version\n * @param {string} message\n * @returns {function}\n */\nvalidators.transitional = function transitional(validator, version, message) {\n var isDeprecated = version && isOlderVersion(version);\n\n function formatMessage(opt, desc) {\n return '[Axios v' + pkg.version + '] Transitional option \\'' + opt + '\\'' + desc + (message ? '. ' + message : '');\n }\n\n // eslint-disable-next-line func-names\n return function(value, opt, opts) {\n if (validator === false) {\n throw new Error(formatMessage(opt, ' has been removed in ' + version));\n }\n\n if (isDeprecated && !deprecatedWarnings[opt]) {\n deprecatedWarnings[opt] = true;\n // eslint-disable-next-line no-console\n console.warn(\n formatMessage(\n opt,\n ' has been deprecated since v' + version + ' and will be removed in the near future'\n )\n );\n }\n\n return validator ? validator(value, opt, opts) : true;\n };\n};\n\n/**\n * Assert object's properties type\n * @param {object} options\n * @param {object} schema\n * @param {boolean?} allowUnknown\n */\n\nfunction assertOptions(options, schema, allowUnknown) {\n if (typeof options !== 'object') {\n throw new TypeError('options must be an object');\n }\n var keys = Object.keys(options);\n var i = keys.length;\n while (i-- > 0) {\n var opt = keys[i];\n var validator = schema[opt];\n if (validator) {\n var value = options[opt];\n var result = value === undefined || validator(value, opt, options);\n if (result !== true) {\n throw new TypeError('option ' + opt + ' must be ' + result);\n }\n continue;\n }\n if (allowUnknown !== true) {\n throw Error('Unknown option ' + opt);\n }\n }\n}\n\nmodule.exports = {\n isOlderVersion: isOlderVersion,\n assertOptions: assertOptions,\n validators: validators\n};\n","'use strict';\n\nvar Cancel = require('./Cancel');\n\n/**\n * A `CancelToken` is an object that can be used to request cancellation of an operation.\n *\n * @class\n * @param {Function} executor The executor function.\n */\nfunction CancelToken(executor) {\n if (typeof executor !== 'function') {\n throw new TypeError('executor must be a function.');\n }\n\n var resolvePromise;\n this.promise = new Promise(function promiseExecutor(resolve) {\n resolvePromise = resolve;\n });\n\n var token = this;\n executor(function cancel(message) {\n if (token.reason) {\n // Cancellation has already been requested\n return;\n }\n\n token.reason = new Cancel(message);\n resolvePromise(token.reason);\n });\n}\n\n/**\n * Throws a `Cancel` if cancellation has been requested.\n */\nCancelToken.prototype.throwIfRequested = function throwIfRequested() {\n if (this.reason) {\n throw this.reason;\n }\n};\n\n/**\n * Returns an object that contains a new `CancelToken` and a function that, when called,\n * cancels the `CancelToken`.\n */\nCancelToken.source = function source() {\n var cancel;\n var token = new CancelToken(function executor(c) {\n cancel = c;\n });\n return {\n token: token,\n cancel: cancel\n };\n};\n\nmodule.exports = CancelToken;\n","'use strict';\n\n/**\n * Syntactic sugar for invoking a function and expanding an array for arguments.\n *\n * Common use case would be to use `Function.prototype.apply`.\n *\n * ```js\n * function f(x, y, z) {}\n * var args = [1, 2, 3];\n * f.apply(null, args);\n * ```\n *\n * With `spread` this example can be re-written.\n *\n * ```js\n * spread(function(x, y, z) {})([1, 2, 3]);\n * ```\n *\n * @param {Function} callback\n * @returns {Function}\n */\nmodule.exports = function spread(callback) {\n return function wrap(arr) {\n return callback.apply(null, arr);\n };\n};\n","'use strict';\n\n/**\n * Determines whether the payload is an error thrown by Axios\n *\n * @param {*} payload The value to test\n * @returns {boolean} True if the payload is an error thrown by Axios, otherwise false\n */\nmodule.exports = function isAxiosError(payload) {\n return (typeof payload === 'object') && (payload.isAxiosError === true);\n};\n","\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\n\nfunction last() {\n var _ref;\n\n return _ref = arguments.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref];\n}\n\nfunction negation(a) {\n return -a;\n}\n\nfunction addition(a, b) {\n return a + b;\n}\n\nfunction subtraction(a, b) {\n return a - b;\n}\n\nfunction multiplication(a, b) {\n return a * b;\n}\n\nfunction division(a, b) {\n return a / b;\n}\n\nfunction max() {\n return Math.max.apply(Math, arguments);\n}\n\nfunction min() {\n return Math.min.apply(Math, arguments);\n}\n\nfunction comma() {\n return Array.of.apply(Array, arguments);\n}\n\nvar defaultSymbols = {\n symbols: {\n '*': {\n infix: {\n symbol: '*',\n f: multiplication,\n notation: 'infix',\n precedence: 4,\n rightToLeft: 0,\n argCount: 2\n },\n symbol: '*',\n regSymbol: '\\\\*'\n },\n '/': {\n infix: {\n symbol: '/',\n f: division,\n notation: 'infix',\n precedence: 4,\n rightToLeft: 0,\n argCount: 2\n },\n symbol: '/',\n regSymbol: '/'\n },\n '+': {\n infix: {\n symbol: '+',\n f: addition,\n notation: 'infix',\n precedence: 2,\n rightToLeft: 0,\n argCount: 2\n },\n prefix: {\n symbol: '+',\n f: last,\n notation: 'prefix',\n precedence: 3,\n rightToLeft: 0,\n argCount: 1\n },\n symbol: '+',\n regSymbol: '\\\\+'\n },\n '-': {\n infix: {\n symbol: '-',\n f: subtraction,\n notation: 'infix',\n precedence: 2,\n rightToLeft: 0,\n argCount: 2\n },\n prefix: {\n symbol: '-',\n f: negation,\n notation: 'prefix',\n precedence: 3,\n rightToLeft: 0,\n argCount: 1\n },\n symbol: '-',\n regSymbol: '-'\n },\n ',': {\n infix: {\n symbol: ',',\n f: comma,\n notation: 'infix',\n precedence: 1,\n rightToLeft: 0,\n argCount: 2\n },\n symbol: ',',\n regSymbol: ','\n },\n '(': {\n prefix: {\n symbol: '(',\n f: last,\n notation: 'prefix',\n precedence: 0,\n rightToLeft: 0,\n argCount: 1\n },\n symbol: '(',\n regSymbol: '\\\\('\n },\n ')': {\n postfix: {\n symbol: ')',\n f: undefined,\n notation: 'postfix',\n precedence: 0,\n rightToLeft: 0,\n argCount: 1\n },\n symbol: ')',\n regSymbol: '\\\\)'\n },\n min: {\n func: {\n symbol: 'min',\n f: min,\n notation: 'func',\n precedence: 0,\n rightToLeft: 0,\n argCount: 1\n },\n symbol: 'min',\n regSymbol: 'min\\\\b'\n },\n max: {\n func: {\n symbol: 'max',\n f: max,\n notation: 'func',\n precedence: 0,\n rightToLeft: 0,\n argCount: 1\n },\n symbol: 'max',\n regSymbol: 'max\\\\b'\n }\n }\n};\nvar _default = defaultSymbols;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;","\"use strict\";\n\nexports.__esModule = true;\nexports[\"default\"] = void 0;\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }\n\nfunction _wrapNativeSuper(Class) { var _cache = typeof Map === \"function\" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== \"function\") { throw new TypeError(\"Super expression must either be null or a function\"); } if (typeof _cache !== \"undefined\") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }\n\nfunction _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _isNativeFunction(fn) { return Function.toString.call(fn).indexOf(\"[native code]\") !== -1; }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n// based on https://github.com/styled-components/styled-components/blob/fcf6f3804c57a14dd7984dfab7bc06ee2edca044/src/utils/error.js\n\n/**\n * Parse errors.md and turn it into a simple hash of code: message\n * @private\n */\nvar ERRORS = {\n \"1\": \"Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).\\n\\n\",\n \"2\": \"Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).\\n\\n\",\n \"3\": \"Passed an incorrect argument to a color function, please pass a string representation of a color.\\n\\n\",\n \"4\": \"Couldn't generate valid rgb string from %s, it returned %s.\\n\\n\",\n \"5\": \"Couldn't parse the color string. Please provide the color as a string in hex, rgb, rgba, hsl or hsla notation.\\n\\n\",\n \"6\": \"Passed invalid arguments to rgb, please pass multiple numbers e.g. rgb(255, 205, 100) or an object e.g. rgb({ red: 255, green: 205, blue: 100 }).\\n\\n\",\n \"7\": \"Passed invalid arguments to rgba, please pass multiple numbers e.g. rgb(255, 205, 100, 0.75) or an object e.g. rgb({ red: 255, green: 205, blue: 100, alpha: 0.75 }).\\n\\n\",\n \"8\": \"Passed invalid argument to toColorString, please pass a RgbColor, RgbaColor, HslColor or HslaColor object.\\n\\n\",\n \"9\": \"Please provide a number of steps to the modularScale helper.\\n\\n\",\n \"10\": \"Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\\n\\n\",\n \"11\": \"Invalid value passed as base to modularScale, expected number or em string but got \\\"%s\\\"\\n\\n\",\n \"12\": \"Expected a string ending in \\\"px\\\" or a number passed as the first argument to %s(), got \\\"%s\\\" instead.\\n\\n\",\n \"13\": \"Expected a string ending in \\\"px\\\" or a number passed as the second argument to %s(), got \\\"%s\\\" instead.\\n\\n\",\n \"14\": \"Passed invalid pixel value (\\\"%s\\\") to %s(), please pass a value like \\\"12px\\\" or 12.\\n\\n\",\n \"15\": \"Passed invalid base value (\\\"%s\\\") to %s(), please pass a value like \\\"12px\\\" or 12.\\n\\n\",\n \"16\": \"You must provide a template to this method.\\n\\n\",\n \"17\": \"You passed an unsupported selector state to this method.\\n\\n\",\n \"18\": \"minScreen and maxScreen must be provided as stringified numbers with the same units.\\n\\n\",\n \"19\": \"fromSize and toSize must be provided as stringified numbers with the same units.\\n\\n\",\n \"20\": \"expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\\n\\n\",\n \"21\": \"expects the objects in the first argument array to have the properties `prop`, `fromSize`, and `toSize`.\\n\\n\",\n \"22\": \"expects the first argument object to have the properties `prop`, `fromSize`, and `toSize`.\\n\\n\",\n \"23\": \"fontFace expects a name of a font-family.\\n\\n\",\n \"24\": \"fontFace expects either the path to the font file(s) or a name of a local copy.\\n\\n\",\n \"25\": \"fontFace expects localFonts to be an array.\\n\\n\",\n \"26\": \"fontFace expects fileFormats to be an array.\\n\\n\",\n \"27\": \"radialGradient requries at least 2 color-stops to properly render.\\n\\n\",\n \"28\": \"Please supply a filename to retinaImage() as the first argument.\\n\\n\",\n \"29\": \"Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\\n\\n\",\n \"30\": \"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\\n\\n\",\n \"31\": \"The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation\\n\\n\",\n \"32\": \"To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s')\\n\\n\",\n \"33\": \"The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation\\n\\n\",\n \"34\": \"borderRadius expects a radius value as a string or number as the second argument.\\n\\n\",\n \"35\": \"borderRadius expects one of \\\"top\\\", \\\"bottom\\\", \\\"left\\\" or \\\"right\\\" as the first argument.\\n\\n\",\n \"36\": \"Property must be a string value.\\n\\n\",\n \"37\": \"Syntax Error at %s.\\n\\n\",\n \"38\": \"Formula contains a function that needs parentheses at %s.\\n\\n\",\n \"39\": \"Formula is missing closing parenthesis at %s.\\n\\n\",\n \"40\": \"Formula has too many closing parentheses at %s.\\n\\n\",\n \"41\": \"All values in a formula must have the same unit or be unitless.\\n\\n\",\n \"42\": \"Please provide a number of steps to the modularScale helper.\\n\\n\",\n \"43\": \"Please pass a number or one of the predefined scales to the modularScale helper as the ratio.\\n\\n\",\n \"44\": \"Invalid value passed as base to modularScale, expected number or em/rem string but got %s.\\n\\n\",\n \"45\": \"Passed invalid argument to hslToColorString, please pass a HslColor or HslaColor object.\\n\\n\",\n \"46\": \"Passed invalid argument to rgbToColorString, please pass a RgbColor or RgbaColor object.\\n\\n\",\n \"47\": \"minScreen and maxScreen must be provided as stringified numbers with the same units.\\n\\n\",\n \"48\": \"fromSize and toSize must be provided as stringified numbers with the same units.\\n\\n\",\n \"49\": \"Expects either an array of objects or a single object with the properties prop, fromSize, and toSize.\\n\\n\",\n \"50\": \"Expects the objects in the first argument array to have the properties prop, fromSize, and toSize.\\n\\n\",\n \"51\": \"Expects the first argument object to have the properties prop, fromSize, and toSize.\\n\\n\",\n \"52\": \"fontFace expects either the path to the font file(s) or a name of a local copy.\\n\\n\",\n \"53\": \"fontFace expects localFonts to be an array.\\n\\n\",\n \"54\": \"fontFace expects fileFormats to be an array.\\n\\n\",\n \"55\": \"fontFace expects a name of a font-family.\\n\\n\",\n \"56\": \"linearGradient requries at least 2 color-stops to properly render.\\n\\n\",\n \"57\": \"radialGradient requries at least 2 color-stops to properly render.\\n\\n\",\n \"58\": \"Please supply a filename to retinaImage() as the first argument.\\n\\n\",\n \"59\": \"Passed invalid argument to triangle, please pass correct pointingDirection e.g. 'right'.\\n\\n\",\n \"60\": \"Passed an invalid value to `height` or `width`. Please provide a pixel based unit.\\n\\n\",\n \"61\": \"Property must be a string value.\\n\\n\",\n \"62\": \"borderRadius expects a radius value as a string or number as the second argument.\\n\\n\",\n \"63\": \"borderRadius expects one of \\\"top\\\", \\\"bottom\\\", \\\"left\\\" or \\\"right\\\" as the first argument.\\n\\n\",\n \"64\": \"The animation shorthand only takes 8 arguments. See the specification for more information: http://mdn.io/animation.\\n\\n\",\n \"65\": \"To pass multiple animations please supply them in arrays, e.g. animation(['rotate', '2s'], ['move', '1s'])\\\\nTo pass a single animation please supply them in simple values, e.g. animation('rotate', '2s').\\n\\n\",\n \"66\": \"The animation shorthand arrays can only have 8 elements. See the specification for more information: http://mdn.io/animation.\\n\\n\",\n \"67\": \"You must provide a template to this method.\\n\\n\",\n \"68\": \"You passed an unsupported selector state to this method.\\n\\n\",\n \"69\": \"Expected a string ending in \\\"px\\\" or a number passed as the first argument to %s(), got %s instead.\\n\\n\",\n \"70\": \"Expected a string ending in \\\"px\\\" or a number passed as the second argument to %s(), got %s instead.\\n\\n\",\n \"71\": \"Passed invalid pixel value %s to %s(), please pass a value like \\\"12px\\\" or 12.\\n\\n\",\n \"72\": \"Passed invalid base value %s to %s(), please pass a value like \\\"12px\\\" or 12.\\n\\n\",\n \"73\": \"Please provide a valid CSS variable.\\n\\n\",\n \"74\": \"CSS variable not found and no default was provided.\\n\\n\",\n \"75\": \"important requires a valid style object, got a %s instead.\\n\\n\",\n \"76\": \"fromSize and toSize must be provided as stringified numbers with the same units as minScreen and maxScreen.\\n\\n\",\n \"77\": \"remToPx expects a value in \\\"rem\\\" but you provided it in \\\"%s\\\".\\n\\n\",\n \"78\": \"base must be set in \\\"px\\\" or \\\"%\\\" but you set it in \\\"%s\\\".\\n\"\n};\n/**\n * super basic version of sprintf\n * @private\n */\n\nfunction format() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var a = args[0];\n var b = [];\n var c;\n\n for (c = 1; c < args.length; c += 1) {\n b.push(args[c]);\n }\n\n b.forEach(function (d) {\n a = a.replace(/%[a-z]/, d);\n });\n return a;\n}\n/**\n * Create an error file out of errors.md for development and a simple web link to the full errors\n * in production mode.\n * @private\n */\n\n\nvar PolishedError = /*#__PURE__*/function (_Error) {\n _inheritsLoose(PolishedError, _Error);\n\n function PolishedError(code) {\n var _this;\n\n if (process.env.NODE_ENV === 'production') {\n _this = _Error.call(this, \"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#\" + code + \" for more information.\") || this;\n } else {\n for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {\n args[_key2 - 1] = arguments[_key2];\n }\n\n _this = _Error.call(this, format.apply(void 0, [ERRORS[code]].concat(args))) || this;\n }\n\n return _assertThisInitialized(_this);\n }\n\n return PolishedError;\n}( /*#__PURE__*/_wrapNativeSuper(Error));\n\nexports[\"default\"] = PolishedError;\nmodule.exports = exports.default;","import React from 'react'\n\nlet renderErr = 'Renderer Error ☝️'\n\nexport const actions = {\n init: 'init',\n}\n\nexport const defaultRenderer = ({ value = '' }) => value;\nexport const emptyRenderer = () => <> ;\n\nexport const defaultColumn = {\n Cell: defaultRenderer,\n width: 150,\n minWidth: 0,\n maxWidth: Number.MAX_SAFE_INTEGER,\n}\n\nfunction mergeProps(...propList) {\n return propList.reduce((props, next) => {\n const { style, className, ...rest } = next\n\n props = {\n ...props,\n ...rest,\n }\n\n if (style) {\n props.style = props.style\n ? { ...(props.style || {}), ...(style || {}) }\n : style\n }\n\n if (className) {\n props.className = props.className\n ? props.className + ' ' + className\n : className\n }\n\n if (props.className === '') {\n delete props.className\n }\n\n return props\n }, {})\n}\n\nfunction handlePropGetter(prevProps, userProps, meta) {\n // Handle a lambda, pass it the previous props\n if (typeof userProps === 'function') {\n return handlePropGetter({}, userProps(prevProps, meta))\n }\n\n // Handle an array, merge each item as separate props\n if (Array.isArray(userProps)) {\n return mergeProps(prevProps, ...userProps)\n }\n\n // Handle an object by default, merge the two objects\n return mergeProps(prevProps, userProps)\n}\n\nexport const makePropGetter = (hooks, meta = {}) => {\n return (userProps = {}) =>\n [...hooks, userProps].reduce(\n (prev, next) =>\n handlePropGetter(prev, next, {\n ...meta,\n userProps,\n }),\n {}\n )\n}\n\nexport const reduceHooks = (hooks, initial, meta = {}, allowUndefined) =>\n hooks.reduce((prev, next) => {\n const nextValue = next(prev, meta)\n if (process.env.NODE_ENV !== 'production') {\n if (!allowUndefined && typeof nextValue === 'undefined') {\n console.info(next)\n throw new Error(\n 'React Table: A reducer hook ☝️ just returned undefined! This is not allowed.'\n )\n }\n }\n return nextValue\n }, initial)\n\nexport const loopHooks = (hooks, context, meta = {}) =>\n hooks.forEach(hook => {\n const nextValue = hook(context, meta)\n if (process.env.NODE_ENV !== 'production') {\n if (typeof nextValue !== 'undefined') {\n console.info(hook, nextValue)\n throw new Error(\n 'React Table: A loop-type hook ☝️ just returned a value! This is not allowed.'\n )\n }\n }\n })\n\nexport function ensurePluginOrder(plugins, befores, pluginName, afters) {\n if (process.env.NODE_ENV !== 'production' && afters) {\n throw new Error(\n `Defining plugins in the \"after\" section of ensurePluginOrder is no longer supported (see plugin ${pluginName})`\n )\n }\n const pluginIndex = plugins.findIndex(\n plugin => plugin.pluginName === pluginName\n )\n\n if (pluginIndex === -1) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(`The plugin \"${pluginName}\" was not found in the plugin list!\nThis usually means you need to need to name your plugin hook by setting the 'pluginName' property of the hook function, eg:\n\n ${pluginName}.pluginName = '${pluginName}'\n`)\n }\n }\n\n befores.forEach(before => {\n const beforeIndex = plugins.findIndex(\n plugin => plugin.pluginName === before\n )\n if (beforeIndex > -1 && beforeIndex > pluginIndex) {\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `React Table: The ${pluginName} plugin hook must be placed after the ${before} plugin hook!`\n )\n }\n }\n })\n}\n\nexport function functionalUpdate(updater, old) {\n return typeof updater === 'function' ? updater(old) : updater\n}\n\nexport function useGetLatest(obj) {\n const ref = React.useRef()\n ref.current = obj\n\n return React.useCallback(() => ref.current, [])\n}\n\n// SSR has issues with useLayoutEffect still, so use useEffect during SSR\nexport const safeUseLayoutEffect =\n typeof document !== 'undefined' ? React.useLayoutEffect : React.useEffect\n\nexport function useMountedLayoutEffect(fn, deps) {\n const mountedRef = React.useRef(false)\n\n safeUseLayoutEffect(() => {\n if (mountedRef.current) {\n fn()\n }\n mountedRef.current = true\n // eslint-disable-next-line\n }, deps)\n}\n\nexport function useAsyncDebounce(defaultFn, defaultWait = 0) {\n const debounceRef = React.useRef({})\n\n const getDefaultFn = useGetLatest(defaultFn)\n const getDefaultWait = useGetLatest(defaultWait)\n\n return React.useCallback(\n async (...args) => {\n if (!debounceRef.current.promise) {\n debounceRef.current.promise = new Promise((resolve, reject) => {\n debounceRef.current.resolve = resolve\n debounceRef.current.reject = reject\n })\n }\n\n if (debounceRef.current.timeout) {\n clearTimeout(debounceRef.current.timeout)\n }\n\n debounceRef.current.timeout = setTimeout(async () => {\n delete debounceRef.current.timeout\n try {\n debounceRef.current.resolve(await getDefaultFn()(...args))\n } catch (err) {\n debounceRef.current.reject(err)\n } finally {\n delete debounceRef.current.promise\n }\n }, getDefaultWait())\n\n return debounceRef.current.promise\n },\n [getDefaultFn, getDefaultWait]\n )\n}\n\nexport function makeRenderer(instance, column, meta = {}) {\n return (type, userProps = {}) => {\n const Comp = typeof type === 'string' ? column[type] : type\n\n if (typeof Comp === 'undefined') {\n console.info(column)\n throw new Error(renderErr)\n }\n\n return flexRender(Comp, { ...instance, column, ...meta, ...userProps })\n }\n}\n\nexport function flexRender(Comp, props) {\n return isReactComponent(Comp) ? : Comp\n}\n\nfunction isReactComponent(component) {\n return (\n isClassComponent(component) ||\n typeof component === 'function' ||\n isExoticComponent(component)\n )\n}\n\nfunction isClassComponent(component) {\n return (\n typeof component === 'function' &&\n (() => {\n const proto = Object.getPrototypeOf(component)\n return proto.prototype && proto.prototype.isReactComponent\n })()\n )\n}\n\nfunction isExoticComponent(component) {\n return (\n typeof component === 'object' &&\n typeof component.$$typeof === 'symbol' &&\n ['react.memo', 'react.forward_ref'].includes(component.$$typeof.description)\n )\n}\n","import { defaultColumn, emptyRenderer } from './publicUtils'\n\n// Find the depth of the columns\nexport function findMaxDepth(columns, depth = 0) {\n return columns.reduce((prev, curr) => {\n if (curr.columns) {\n return Math.max(prev, findMaxDepth(curr.columns, depth + 1))\n }\n return depth\n }, 0)\n}\n\n// Build the visible columns, headers and flat column list\nexport function linkColumnStructure(columns, parent, depth = 0) {\n return columns.map(column => {\n column = {\n ...column,\n parent,\n depth,\n }\n\n assignColumnAccessor(column)\n\n if (column.columns) {\n column.columns = linkColumnStructure(column.columns, column, depth + 1)\n }\n return column\n })\n}\n\nexport function flattenColumns(columns) {\n return flattenBy(columns, 'columns')\n}\n\nexport function assignColumnAccessor(column) {\n // First check for string accessor\n let { id, accessor, Header } = column\n\n if (typeof accessor === 'string') {\n id = id || accessor\n const accessorPath = accessor.split('.')\n accessor = row => getBy(row, accessorPath)\n }\n\n if (!id && typeof Header === 'string' && Header) {\n id = Header\n }\n\n if (!id && column.columns) {\n console.error(column)\n throw new Error('A column ID (or unique \"Header\" value) is required!')\n }\n\n if (!id) {\n console.error(column)\n throw new Error('A column ID (or string accessor) is required!')\n }\n\n Object.assign(column, {\n id,\n accessor,\n })\n\n return column\n}\n\nexport function decorateColumn(column, userDefaultColumn) {\n if (!userDefaultColumn) {\n throw new Error()\n }\n Object.assign(column, {\n // Make sure there is a fallback header, just in case\n Header: emptyRenderer,\n Footer: emptyRenderer,\n ...defaultColumn,\n ...userDefaultColumn,\n ...column,\n })\n\n Object.assign(column, {\n originalWidth: column.width,\n })\n\n return column\n}\n\n// Build the header groups from the bottom up\nexport function makeHeaderGroups(\n allColumns,\n defaultColumn,\n additionalHeaderProperties = () => ({})\n) {\n const headerGroups = []\n\n let scanColumns = allColumns\n\n let uid = 0\n const getUID = () => uid++\n\n while (scanColumns.length) {\n // The header group we are creating\n const headerGroup = {\n headers: [],\n }\n\n // The parent columns we're going to scan next\n const parentColumns = []\n\n const hasParents = scanColumns.some(d => d.parent)\n\n // Scan each column for parents\n scanColumns.forEach(column => {\n // What is the latest (last) parent column?\n let latestParentColumn = [...parentColumns].reverse()[0]\n\n let newParent\n\n if (hasParents) {\n // If the column has a parent, add it if necessary\n if (column.parent) {\n newParent = {\n ...column.parent,\n originalId: column.parent.id,\n id: `${column.parent.id}_${getUID()}`,\n headers: [column],\n ...additionalHeaderProperties(column),\n }\n } else {\n // If other columns have parents, we'll need to add a place holder if necessary\n const originalId = `${column.id}_placeholder`\n newParent = decorateColumn(\n {\n originalId,\n id: `${column.id}_placeholder_${getUID()}`,\n placeholderOf: column,\n headers: [column],\n ...additionalHeaderProperties(column),\n },\n defaultColumn\n )\n }\n\n // If the resulting parent columns are the same, just add\n // the column and increment the header span\n if (\n latestParentColumn &&\n latestParentColumn.originalId === newParent.originalId\n ) {\n latestParentColumn.headers.push(column)\n } else {\n parentColumns.push(newParent)\n }\n }\n\n headerGroup.headers.push(column)\n })\n\n headerGroups.push(headerGroup)\n\n // Start scanning the parent columns\n scanColumns = parentColumns\n }\n\n return headerGroups.reverse()\n}\n\nconst pathObjCache = new Map()\n\nexport function getBy(obj, path, def) {\n if (!path) {\n return obj\n }\n const cacheKey = typeof path === 'function' ? path : JSON.stringify(path)\n\n const pathObj =\n pathObjCache.get(cacheKey) ||\n (() => {\n const pathObj = makePathArray(path)\n pathObjCache.set(cacheKey, pathObj)\n return pathObj\n })()\n\n let val\n\n try {\n val = pathObj.reduce((cursor, pathPart) => cursor[pathPart], obj)\n } catch (e) {\n // continue regardless of error\n }\n return typeof val !== 'undefined' ? val : def\n}\n\nexport function getFirstDefined(...args) {\n for (let i = 0; i < args.length; i += 1) {\n if (typeof args[i] !== 'undefined') {\n return args[i]\n }\n }\n}\n\nexport function getElementDimensions(element) {\n const rect = element.getBoundingClientRect()\n const style = window.getComputedStyle(element)\n const margins = {\n left: parseInt(style.marginLeft),\n right: parseInt(style.marginRight),\n }\n const padding = {\n left: parseInt(style.paddingLeft),\n right: parseInt(style.paddingRight),\n }\n return {\n left: Math.ceil(rect.left),\n width: Math.ceil(rect.width),\n outerWidth: Math.ceil(\n rect.width + margins.left + margins.right + padding.left + padding.right\n ),\n marginLeft: margins.left,\n marginRight: margins.right,\n paddingLeft: padding.left,\n paddingRight: padding.right,\n scrollWidth: element.scrollWidth,\n }\n}\n\nexport function isFunction(a) {\n if (typeof a === 'function') {\n return a\n }\n}\n\nexport function flattenBy(arr, key) {\n const flat = []\n\n const recurse = arr => {\n arr.forEach(d => {\n if (!d[key]) {\n flat.push(d)\n } else {\n recurse(d[key])\n }\n })\n }\n\n recurse(arr)\n\n return flat\n}\n\nexport function expandRows(\n rows,\n { manualExpandedKey, expanded, expandSubRows = true }\n) {\n const expandedRows = []\n\n const handleRow = (row, addToExpandedRows = true) => {\n row.isExpanded =\n (row.original && row.original[manualExpandedKey]) || expanded[row.id]\n\n row.canExpand = row.subRows && !!row.subRows.length\n\n if (addToExpandedRows) {\n expandedRows.push(row)\n }\n\n if (row.subRows && row.subRows.length && row.isExpanded) {\n row.subRows.forEach(row => handleRow(row, expandSubRows))\n }\n }\n\n rows.forEach(row => handleRow(row))\n\n return expandedRows\n}\n\nexport function getFilterMethod(filter, userFilterTypes, filterTypes) {\n return (\n isFunction(filter) ||\n userFilterTypes[filter] ||\n filterTypes[filter] ||\n filterTypes.text\n )\n}\n\nexport function shouldAutoRemoveFilter(autoRemove, value, column) {\n return autoRemove ? autoRemove(value, column) : typeof value === 'undefined'\n}\n\nexport function unpreparedAccessWarning() {\n throw new Error(\n 'React-Table: You have not called prepareRow(row) one or more rows you are attempting to render.'\n )\n}\n\nlet passiveSupported = null\nexport function passiveEventSupported() {\n // memoize support to avoid adding multiple test events\n if (typeof passiveSupported === 'boolean') return passiveSupported\n\n let supported = false\n try {\n const options = {\n get passive() {\n supported = true\n return false\n },\n }\n\n window.addEventListener('test', null, options)\n window.removeEventListener('test', null, options)\n } catch (err) {\n supported = false\n }\n passiveSupported = supported\n return passiveSupported\n}\n\n//\n\nconst reOpenBracket = /\\[/g\nconst reCloseBracket = /\\]/g\n\nfunction makePathArray(obj) {\n return (\n flattenDeep(obj)\n // remove all periods in parts\n .map(d => String(d).replace('.', '_'))\n // join parts using period\n .join('.')\n // replace brackets with periods\n .replace(reOpenBracket, '.')\n .replace(reCloseBracket, '')\n // split it back out on periods\n .split('.')\n )\n}\n\nfunction flattenDeep(arr, newArr = []) {\n if (!Array.isArray(arr)) {\n newArr.push(arr)\n } else {\n for (let i = 0; i < arr.length; i += 1) {\n flattenDeep(arr[i], newArr)\n }\n }\n return newArr\n}\n","const defaultGetTableProps = props => ({\n role: 'table',\n ...props,\n})\n\nconst defaultGetTableBodyProps = props => ({\n role: 'rowgroup',\n ...props,\n})\n\nconst defaultGetHeaderProps = (props, { column }) => ({\n key: `header_${column.id}`,\n colSpan: column.totalVisibleHeaderCount,\n role: 'columnheader',\n ...props,\n})\n\nconst defaultGetFooterProps = (props, { column }) => ({\n key: `footer_${column.id}`,\n colSpan: column.totalVisibleHeaderCount,\n ...props,\n})\n\nconst defaultGetHeaderGroupProps = (props, { index }) => ({\n key: `headerGroup_${index}`,\n role: 'row',\n ...props,\n})\n\nconst defaultGetFooterGroupProps = (props, { index }) => ({\n key: `footerGroup_${index}`,\n ...props,\n})\n\nconst defaultGetRowProps = (props, { row }) => ({\n key: `row_${row.id}`,\n role: 'row',\n ...props,\n})\n\nconst defaultGetCellProps = (props, { cell }) => ({\n key: `cell_${cell.row.id}_${cell.column.id}`,\n role: 'cell',\n ...props,\n})\n\nexport default function makeDefaultPluginHooks() {\n return {\n useOptions: [],\n stateReducers: [],\n useControlledState: [],\n columns: [],\n columnsDeps: [],\n allColumns: [],\n allColumnsDeps: [],\n accessValue: [],\n materializedColumns: [],\n materializedColumnsDeps: [],\n useInstanceAfterData: [],\n visibleColumns: [],\n visibleColumnsDeps: [],\n headerGroups: [],\n headerGroupsDeps: [],\n useInstanceBeforeDimensions: [],\n useInstance: [],\n prepareRow: [],\n getTableProps: [defaultGetTableProps],\n getTableBodyProps: [defaultGetTableBodyProps],\n getHeaderGroupProps: [defaultGetHeaderGroupProps],\n getFooterGroupProps: [defaultGetFooterGroupProps],\n getHeaderProps: [defaultGetHeaderProps],\n getFooterProps: [defaultGetFooterProps],\n getRowProps: [defaultGetRowProps],\n getCellProps: [defaultGetCellProps],\n useFinalInstance: [],\n }\n}\n","import React from 'react'\n\nimport {\n actions,\n functionalUpdate,\n useGetLatest,\n makePropGetter,\n useMountedLayoutEffect,\n} from '../publicUtils'\n\nactions.resetHiddenColumns = 'resetHiddenColumns'\nactions.toggleHideColumn = 'toggleHideColumn'\nactions.setHiddenColumns = 'setHiddenColumns'\nactions.toggleHideAllColumns = 'toggleHideAllColumns'\n\nexport const useColumnVisibility = hooks => {\n hooks.getToggleHiddenProps = [defaultGetToggleHiddenProps]\n hooks.getToggleHideAllColumnsProps = [defaultGetToggleHideAllColumnsProps]\n\n hooks.stateReducers.push(reducer)\n hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions)\n hooks.headerGroupsDeps.push((deps, { instance }) => [\n ...deps,\n instance.state.hiddenColumns,\n ])\n hooks.useInstance.push(useInstance)\n}\n\nuseColumnVisibility.pluginName = 'useColumnVisibility'\n\nconst defaultGetToggleHiddenProps = (props, { column }) => [\n props,\n {\n onChange: e => {\n column.toggleHidden(!e.target.checked)\n },\n style: {\n cursor: 'pointer',\n },\n checked: column.isVisible,\n title: 'Toggle Column Visible',\n },\n]\n\nconst defaultGetToggleHideAllColumnsProps = (props, { instance }) => [\n props,\n {\n onChange: e => {\n instance.toggleHideAllColumns(!e.target.checked)\n },\n style: {\n cursor: 'pointer',\n },\n checked: !instance.allColumnsHidden && !instance.state.hiddenColumns.length,\n title: 'Toggle All Columns Hidden',\n indeterminate:\n !instance.allColumnsHidden && instance.state.hiddenColumns.length,\n },\n]\n\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n hiddenColumns: [],\n ...state,\n }\n }\n\n if (action.type === actions.resetHiddenColumns) {\n return {\n ...state,\n hiddenColumns: instance.initialState.hiddenColumns || [],\n }\n }\n\n if (action.type === actions.toggleHideColumn) {\n const should =\n typeof action.value !== 'undefined'\n ? action.value\n : !state.hiddenColumns.includes(action.columnId)\n\n const hiddenColumns = should\n ? [...state.hiddenColumns, action.columnId]\n : state.hiddenColumns.filter(d => d !== action.columnId)\n\n return {\n ...state,\n hiddenColumns,\n }\n }\n\n if (action.type === actions.setHiddenColumns) {\n return {\n ...state,\n hiddenColumns: functionalUpdate(action.value, state.hiddenColumns),\n }\n }\n\n if (action.type === actions.toggleHideAllColumns) {\n const shouldAll =\n typeof action.value !== 'undefined'\n ? action.value\n : !state.hiddenColumns.length\n\n return {\n ...state,\n hiddenColumns: shouldAll ? instance.allColumns.map(d => d.id) : [],\n }\n }\n}\n\nfunction useInstanceBeforeDimensions(instance) {\n const {\n headers,\n state: { hiddenColumns },\n } = instance\n\n const isMountedRef = React.useRef(false)\n\n if (!isMountedRef.current) {\n }\n\n const handleColumn = (column, parentVisible) => {\n column.isVisible = parentVisible && !hiddenColumns.includes(column.id)\n\n let totalVisibleHeaderCount = 0\n\n if (column.headers && column.headers.length) {\n column.headers.forEach(\n subColumn =>\n (totalVisibleHeaderCount += handleColumn(subColumn, column.isVisible))\n )\n } else {\n totalVisibleHeaderCount = column.isVisible ? 1 : 0\n }\n\n column.totalVisibleHeaderCount = totalVisibleHeaderCount\n\n return totalVisibleHeaderCount\n }\n\n let totalVisibleHeaderCount = 0\n\n headers.forEach(\n subHeader => (totalVisibleHeaderCount += handleColumn(subHeader, true))\n )\n}\n\nfunction useInstance(instance) {\n const {\n columns,\n flatHeaders,\n dispatch,\n allColumns,\n getHooks,\n state: { hiddenColumns },\n autoResetHiddenColumns = true,\n } = instance\n\n const getInstance = useGetLatest(instance)\n\n const allColumnsHidden = allColumns.length === hiddenColumns.length\n\n const toggleHideColumn = React.useCallback(\n (columnId, value) =>\n dispatch({ type: actions.toggleHideColumn, columnId, value }),\n [dispatch]\n )\n\n const setHiddenColumns = React.useCallback(\n value => dispatch({ type: actions.setHiddenColumns, value }),\n [dispatch]\n )\n\n const toggleHideAllColumns = React.useCallback(\n value => dispatch({ type: actions.toggleHideAllColumns, value }),\n [dispatch]\n )\n\n const getToggleHideAllColumnsProps = makePropGetter(\n getHooks().getToggleHideAllColumnsProps,\n { instance: getInstance() }\n )\n\n flatHeaders.forEach(column => {\n column.toggleHidden = value => {\n dispatch({\n type: actions.toggleHideColumn,\n columnId: column.id,\n value,\n })\n }\n\n column.getToggleHiddenProps = makePropGetter(\n getHooks().getToggleHiddenProps,\n {\n instance: getInstance(),\n column,\n }\n )\n })\n\n const getAutoResetHiddenColumns = useGetLatest(autoResetHiddenColumns)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetHiddenColumns()) {\n dispatch({ type: actions.resetHiddenColumns })\n }\n }, [dispatch, columns])\n\n Object.assign(instance, {\n allColumnsHidden,\n toggleHideColumn,\n setHiddenColumns,\n toggleHideAllColumns,\n getToggleHideAllColumnsProps,\n })\n}\n","import React from 'react'\n\n//\n\nimport {\n linkColumnStructure,\n flattenColumns,\n assignColumnAccessor,\n unpreparedAccessWarning,\n makeHeaderGroups,\n decorateColumn,\n} from '../utils'\n\nimport {\n useGetLatest,\n reduceHooks,\n actions,\n loopHooks,\n makePropGetter,\n makeRenderer,\n} from '../publicUtils'\n\nimport makeDefaultPluginHooks from '../makeDefaultPluginHooks'\n\nimport { useColumnVisibility } from './useColumnVisibility'\n\nconst defaultInitialState = {}\nconst defaultColumnInstance = {}\nconst defaultReducer = (state, action, prevState) => state\nconst defaultGetSubRows = (row, index) => row.subRows || []\nconst defaultGetRowId = (row, index, parent) =>\n `${parent ? [parent.id, index].join('.') : index}`\nconst defaultUseControlledState = d => d\n\nfunction applyDefaults(props) {\n const {\n initialState = defaultInitialState,\n defaultColumn = defaultColumnInstance,\n getSubRows = defaultGetSubRows,\n getRowId = defaultGetRowId,\n stateReducer = defaultReducer,\n useControlledState = defaultUseControlledState,\n ...rest\n } = props\n\n return {\n ...rest,\n initialState,\n defaultColumn,\n getSubRows,\n getRowId,\n stateReducer,\n useControlledState,\n }\n}\n\nexport const useTable = (props, ...plugins) => {\n // Apply default props\n props = applyDefaults(props)\n\n // Add core plugins\n plugins = [useColumnVisibility, ...plugins]\n\n // Create the table instance\n let instanceRef = React.useRef({})\n\n // Create a getter for the instance (helps avoid a lot of potential memory leaks)\n const getInstance = useGetLatest(instanceRef.current)\n\n // Assign the props, plugins and hooks to the instance\n Object.assign(getInstance(), {\n ...props,\n plugins,\n hooks: makeDefaultPluginHooks(),\n })\n\n // Allow plugins to register hooks as early as possible\n plugins.filter(Boolean).forEach(plugin => {\n plugin(getInstance().hooks)\n })\n\n // Consume all hooks and make a getter for them\n const getHooks = useGetLatest(getInstance().hooks)\n getInstance().getHooks = getHooks\n delete getInstance().hooks\n\n // Allow useOptions hooks to modify the options coming into the table\n Object.assign(\n getInstance(),\n reduceHooks(getHooks().useOptions, applyDefaults(props))\n )\n\n const {\n data,\n columns: userColumns,\n initialState,\n defaultColumn,\n getSubRows,\n getRowId,\n stateReducer,\n useControlledState,\n } = getInstance()\n\n // Setup user reducer ref\n const getStateReducer = useGetLatest(stateReducer)\n\n // Build the reducer\n const reducer = React.useCallback(\n (state, action) => {\n // Detect invalid actions\n if (!action.type) {\n console.info({ action })\n throw new Error('Unknown Action 👆')\n }\n\n // Reduce the state from all plugin reducers\n return [\n ...getHooks().stateReducers,\n // Allow the user to add their own state reducer(s)\n ...(Array.isArray(getStateReducer())\n ? getStateReducer()\n : [getStateReducer()]),\n ].reduce(\n (s, handler) => handler(s, action, state, getInstance()) || s,\n state\n )\n },\n [getHooks, getStateReducer, getInstance]\n )\n\n // Start the reducer\n const [reducerState, dispatch] = React.useReducer(reducer, undefined, () =>\n reducer(initialState, { type: actions.init })\n )\n\n // Allow the user to control the final state with hooks\n const state = reduceHooks(\n [...getHooks().useControlledState, useControlledState],\n reducerState,\n { instance: getInstance() }\n )\n\n Object.assign(getInstance(), {\n state,\n dispatch,\n })\n\n // Decorate All the columns\n const columns = React.useMemo(\n () =>\n linkColumnStructure(\n reduceHooks(getHooks().columns, userColumns, {\n instance: getInstance(),\n })\n ),\n [\n getHooks,\n getInstance,\n userColumns,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n ...reduceHooks(getHooks().columnsDeps, [], { instance: getInstance() }),\n ]\n )\n getInstance().columns = columns\n\n // Get the flat list of all columns and allow hooks to decorate\n // those columns (and trigger this memoization via deps)\n let allColumns = React.useMemo(\n () =>\n reduceHooks(getHooks().allColumns, flattenColumns(columns), {\n instance: getInstance(),\n }).map(assignColumnAccessor),\n [\n columns,\n getHooks,\n getInstance,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n ...reduceHooks(getHooks().allColumnsDeps, [], {\n instance: getInstance(),\n }),\n ]\n )\n getInstance().allColumns = allColumns\n\n // Access the row model using initial columns\n const [rows, flatRows, rowsById] = React.useMemo(() => {\n let rows = []\n let flatRows = []\n const rowsById = {}\n\n const allColumnsQueue = [...allColumns]\n\n while (allColumnsQueue.length) {\n const column = allColumnsQueue.shift()\n accessRowsForColumn({\n data,\n rows,\n flatRows,\n rowsById,\n column,\n getRowId,\n getSubRows,\n accessValueHooks: getHooks().accessValue,\n getInstance,\n })\n }\n\n return [rows, flatRows, rowsById]\n }, [allColumns, data, getRowId, getSubRows, getHooks, getInstance])\n\n Object.assign(getInstance(), {\n rows,\n initialRows: [...rows],\n flatRows,\n rowsById,\n // materializedColumns,\n })\n\n loopHooks(getHooks().useInstanceAfterData, getInstance())\n\n // Get the flat list of all columns AFTER the rows\n // have been access, and allow hooks to decorate\n // those columns (and trigger this memoization via deps)\n let visibleColumns = React.useMemo(\n () =>\n reduceHooks(getHooks().visibleColumns, allColumns, {\n instance: getInstance(),\n }).map(d => decorateColumn(d, defaultColumn)),\n [\n getHooks,\n allColumns,\n getInstance,\n defaultColumn,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n ...reduceHooks(getHooks().visibleColumnsDeps, [], {\n instance: getInstance(),\n }),\n ]\n )\n\n // Combine new visible columns with all columns\n allColumns = React.useMemo(() => {\n const columns = [...visibleColumns]\n\n allColumns.forEach(column => {\n if (!columns.find(d => d.id === column.id)) {\n columns.push(column)\n }\n })\n\n return columns\n }, [allColumns, visibleColumns])\n getInstance().allColumns = allColumns\n\n if (process.env.NODE_ENV !== 'production') {\n const duplicateColumns = allColumns.filter((column, i) => {\n return allColumns.findIndex(d => d.id === column.id) !== i\n })\n\n if (duplicateColumns.length) {\n console.info(allColumns)\n throw new Error(\n `Duplicate columns were found with ids: \"${duplicateColumns\n .map(d => d.id)\n .join(', ')}\" in the columns array above`\n )\n }\n }\n\n // Make the headerGroups\n const headerGroups = React.useMemo(\n () =>\n reduceHooks(\n getHooks().headerGroups,\n makeHeaderGroups(visibleColumns, defaultColumn),\n getInstance()\n ),\n [\n getHooks,\n visibleColumns,\n defaultColumn,\n getInstance,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n ...reduceHooks(getHooks().headerGroupsDeps, [], {\n instance: getInstance(),\n }),\n ]\n )\n getInstance().headerGroups = headerGroups\n\n // Get the first level of headers\n const headers = React.useMemo(\n () => (headerGroups.length ? headerGroups[0].headers : []),\n [headerGroups]\n )\n getInstance().headers = headers\n\n // Provide a flat header list for utilities\n getInstance().flatHeaders = headerGroups.reduce(\n (all, headerGroup) => [...all, ...headerGroup.headers],\n []\n )\n\n loopHooks(getHooks().useInstanceBeforeDimensions, getInstance())\n\n // Filter columns down to visible ones\n const visibleColumnsDep = visibleColumns\n .filter(d => d.isVisible)\n .map(d => d.id)\n .sort()\n .join('_')\n\n visibleColumns = React.useMemo(\n () => visibleColumns.filter(d => d.isVisible),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [visibleColumns, visibleColumnsDep]\n )\n getInstance().visibleColumns = visibleColumns\n\n // Header Visibility is needed by this point\n const [\n totalColumnsMinWidth,\n totalColumnsWidth,\n totalColumnsMaxWidth,\n ] = calculateHeaderWidths(headers)\n\n getInstance().totalColumnsMinWidth = totalColumnsMinWidth\n getInstance().totalColumnsWidth = totalColumnsWidth\n getInstance().totalColumnsMaxWidth = totalColumnsMaxWidth\n\n loopHooks(getHooks().useInstance, getInstance())\n\n // Each materialized header needs to be assigned a render function and other\n // prop getter properties here.\n ;[...getInstance().flatHeaders, ...getInstance().allColumns].forEach(\n column => {\n // Give columns/headers rendering power\n column.render = makeRenderer(getInstance(), column)\n\n // Give columns/headers a default getHeaderProps\n column.getHeaderProps = makePropGetter(getHooks().getHeaderProps, {\n instance: getInstance(),\n column,\n })\n\n // Give columns/headers a default getFooterProps\n column.getFooterProps = makePropGetter(getHooks().getFooterProps, {\n instance: getInstance(),\n column,\n })\n }\n )\n\n getInstance().headerGroups = React.useMemo(\n () =>\n headerGroups.filter((headerGroup, i) => {\n // Filter out any headers and headerGroups that don't have visible columns\n headerGroup.headers = headerGroup.headers.filter(column => {\n const recurse = headers =>\n headers.filter(column => {\n if (column.headers) {\n return recurse(column.headers)\n }\n return column.isVisible\n }).length\n if (column.headers) {\n return recurse(column.headers)\n }\n return column.isVisible\n })\n\n // Give headerGroups getRowProps\n if (headerGroup.headers.length) {\n headerGroup.getHeaderGroupProps = makePropGetter(\n getHooks().getHeaderGroupProps,\n { instance: getInstance(), headerGroup, index: i }\n )\n\n headerGroup.getFooterGroupProps = makePropGetter(\n getHooks().getFooterGroupProps,\n { instance: getInstance(), headerGroup, index: i }\n )\n\n return true\n }\n\n return false\n }),\n [headerGroups, getInstance, getHooks]\n )\n\n getInstance().footerGroups = [...getInstance().headerGroups].reverse()\n\n // The prepareRow function is absolutely necessary and MUST be called on\n // any rows the user wishes to be displayed.\n\n getInstance().prepareRow = React.useCallback(\n row => {\n row.getRowProps = makePropGetter(getHooks().getRowProps, {\n instance: getInstance(),\n row,\n })\n\n // Build the visible cells for each row\n row.allCells = allColumns.map(column => {\n const value = row.values[column.id]\n\n const cell = {\n column,\n row,\n value,\n }\n\n // Give each cell a getCellProps base\n cell.getCellProps = makePropGetter(getHooks().getCellProps, {\n instance: getInstance(),\n cell,\n })\n\n // Give each cell a renderer function (supports multiple renderers)\n cell.render = makeRenderer(getInstance(), column, {\n row,\n cell,\n value,\n })\n\n return cell\n })\n\n row.cells = visibleColumns.map(column =>\n row.allCells.find(cell => cell.column.id === column.id)\n )\n\n // need to apply any row specific hooks (useExpanded requires this)\n loopHooks(getHooks().prepareRow, row, { instance: getInstance() })\n },\n [getHooks, getInstance, allColumns, visibleColumns]\n )\n\n getInstance().getTableProps = makePropGetter(getHooks().getTableProps, {\n instance: getInstance(),\n })\n\n getInstance().getTableBodyProps = makePropGetter(\n getHooks().getTableBodyProps,\n {\n instance: getInstance(),\n }\n )\n\n loopHooks(getHooks().useFinalInstance, getInstance())\n\n return getInstance()\n}\n\nfunction calculateHeaderWidths(headers, left = 0) {\n let sumTotalMinWidth = 0\n let sumTotalWidth = 0\n let sumTotalMaxWidth = 0\n let sumTotalFlexWidth = 0\n\n headers.forEach(header => {\n let { headers: subHeaders } = header\n\n header.totalLeft = left\n\n if (subHeaders && subHeaders.length) {\n const [\n totalMinWidth,\n totalWidth,\n totalMaxWidth,\n totalFlexWidth,\n ] = calculateHeaderWidths(subHeaders, left)\n header.totalMinWidth = totalMinWidth\n header.totalWidth = totalWidth\n header.totalMaxWidth = totalMaxWidth\n header.totalFlexWidth = totalFlexWidth\n } else {\n header.totalMinWidth = header.minWidth\n header.totalWidth = Math.min(\n Math.max(header.minWidth, header.width),\n header.maxWidth\n )\n header.totalMaxWidth = header.maxWidth\n header.totalFlexWidth = header.canResize ? header.totalWidth : 0\n }\n if (header.isVisible) {\n left += header.totalWidth\n sumTotalMinWidth += header.totalMinWidth\n sumTotalWidth += header.totalWidth\n sumTotalMaxWidth += header.totalMaxWidth\n sumTotalFlexWidth += header.totalFlexWidth\n }\n })\n\n return [sumTotalMinWidth, sumTotalWidth, sumTotalMaxWidth, sumTotalFlexWidth]\n}\n\nfunction accessRowsForColumn({\n data,\n rows,\n flatRows,\n rowsById,\n column,\n getRowId,\n getSubRows,\n accessValueHooks,\n getInstance,\n}) {\n // Access the row's data column-by-column\n // We do it this way so we can incrementally add materialized\n // columns after the first pass and avoid excessive looping\n const accessRow = (originalRow, rowIndex, depth = 0, parent, parentRows) => {\n // Keep the original reference around\n const original = originalRow\n\n const id = getRowId(originalRow, rowIndex, parent)\n\n let row = rowsById[id]\n\n // If the row hasn't been created, let's make it\n if (!row) {\n row = {\n id,\n original,\n index: rowIndex,\n depth,\n cells: [{}], // This is a dummy cell\n }\n\n // Override common array functions (and the dummy cell's getCellProps function)\n // to show an error if it is accessed without calling prepareRow\n row.cells.map = unpreparedAccessWarning\n row.cells.filter = unpreparedAccessWarning\n row.cells.forEach = unpreparedAccessWarning\n row.cells[0].getCellProps = unpreparedAccessWarning\n\n // Create the cells and values\n row.values = {}\n\n // Push this row into the parentRows array\n parentRows.push(row)\n // Keep track of every row in a flat array\n flatRows.push(row)\n // Also keep track of every row by its ID\n rowsById[id] = row\n\n // Get the original subrows\n row.originalSubRows = getSubRows(originalRow, rowIndex)\n\n // Then recursively access them\n if (row.originalSubRows) {\n const subRows = []\n row.originalSubRows.forEach((d, i) =>\n accessRow(d, i, depth + 1, row, subRows)\n )\n // Keep the new subRows array on the row\n row.subRows = subRows\n }\n } else if (row.subRows) {\n // If the row exists, then it's already been accessed\n // Keep recursing, but don't worry about passing the\n // accumlator array (those rows already exist)\n row.originalSubRows.forEach((d, i) => accessRow(d, i, depth + 1, row))\n }\n\n // If the column has an accessor, use it to get a value\n if (column.accessor) {\n row.values[column.id] = column.accessor(\n originalRow,\n rowIndex,\n row,\n parentRows,\n data\n )\n }\n\n // Allow plugins to manipulate the column value\n row.values[column.id] = reduceHooks(\n accessValueHooks,\n row.values[column.id],\n {\n row,\n column,\n instance: getInstance(),\n },\n true\n )\n }\n\n data.forEach((originalRow, rowIndex) =>\n accessRow(originalRow, rowIndex, 0, undefined, rows)\n )\n}\n","import React from 'react'\n\nimport { expandRows } from '../utils'\n\nimport {\n useGetLatest,\n actions,\n useMountedLayoutEffect,\n makePropGetter,\n ensurePluginOrder,\n} from '../publicUtils'\n\n// Actions\nactions.resetExpanded = 'resetExpanded'\nactions.toggleRowExpanded = 'toggleRowExpanded'\nactions.toggleAllRowsExpanded = 'toggleAllRowsExpanded'\n\nexport const useExpanded = hooks => {\n hooks.getToggleAllRowsExpandedProps = [defaultGetToggleAllRowsExpandedProps]\n hooks.getToggleRowExpandedProps = [defaultGetToggleRowExpandedProps]\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n hooks.prepareRow.push(prepareRow)\n}\n\nuseExpanded.pluginName = 'useExpanded'\n\nconst defaultGetToggleAllRowsExpandedProps = (props, { instance }) => [\n props,\n {\n onClick: e => {\n instance.toggleAllRowsExpanded()\n },\n style: {\n cursor: 'pointer',\n },\n title: 'Toggle All Rows Expanded',\n },\n]\n\nconst defaultGetToggleRowExpandedProps = (props, { row }) => [\n props,\n {\n onClick: () => {\n row.toggleRowExpanded()\n },\n style: {\n cursor: 'pointer',\n },\n title: 'Toggle Row Expanded',\n },\n]\n\n// Reducer\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n expanded: {},\n ...state,\n }\n }\n\n if (action.type === actions.resetExpanded) {\n return {\n ...state,\n expanded: instance.initialState.expanded || {},\n }\n }\n\n if (action.type === actions.toggleAllRowsExpanded) {\n const { value } = action\n const { rowsById } = instance\n\n const isAllRowsExpanded =\n Object.keys(rowsById).length === Object.keys(state.expanded).length\n\n const expandAll = typeof value !== 'undefined' ? value : !isAllRowsExpanded\n\n if (expandAll) {\n const expanded = {}\n\n Object.keys(rowsById).forEach(rowId => {\n expanded[rowId] = true\n })\n\n return {\n ...state,\n expanded,\n }\n }\n\n return {\n ...state,\n expanded: {},\n }\n }\n\n if (action.type === actions.toggleRowExpanded) {\n const { id, value: setExpanded } = action\n const exists = state.expanded[id]\n\n const shouldExist =\n typeof setExpanded !== 'undefined' ? setExpanded : !exists\n\n if (!exists && shouldExist) {\n return {\n ...state,\n expanded: {\n ...state.expanded,\n [id]: true,\n },\n }\n } else if (exists && !shouldExist) {\n const { [id]: _, ...rest } = state.expanded\n return {\n ...state,\n expanded: rest,\n }\n } else {\n return state\n }\n }\n}\n\nfunction useInstance(instance) {\n const {\n data,\n rows,\n rowsById,\n manualExpandedKey = 'expanded',\n paginateExpandedRows = true,\n expandSubRows = true,\n autoResetExpanded = true,\n getHooks,\n plugins,\n state: { expanded },\n dispatch,\n } = instance\n\n ensurePluginOrder(\n plugins,\n ['useSortBy', 'useGroupBy', 'usePivotColumns', 'useGlobalFilter'],\n 'useExpanded'\n )\n\n const getAutoResetExpanded = useGetLatest(autoResetExpanded)\n\n let isAllRowsExpanded = Boolean(\n Object.keys(rowsById).length && Object.keys(expanded).length\n )\n\n if (isAllRowsExpanded) {\n if (Object.keys(rowsById).some(id => !expanded[id])) {\n isAllRowsExpanded = false\n }\n }\n\n // Bypass any effects from firing when this changes\n useMountedLayoutEffect(() => {\n if (getAutoResetExpanded()) {\n dispatch({ type: actions.resetExpanded })\n }\n }, [dispatch, data])\n\n const toggleRowExpanded = React.useCallback(\n (id, value) => {\n dispatch({ type: actions.toggleRowExpanded, id, value })\n },\n [dispatch]\n )\n\n const toggleAllRowsExpanded = React.useCallback(\n value => dispatch({ type: actions.toggleAllRowsExpanded, value }),\n [dispatch]\n )\n\n const expandedRows = React.useMemo(() => {\n if (paginateExpandedRows) {\n return expandRows(rows, { manualExpandedKey, expanded, expandSubRows })\n }\n\n return rows\n }, [paginateExpandedRows, rows, manualExpandedKey, expanded, expandSubRows])\n\n const expandedDepth = React.useMemo(() => findExpandedDepth(expanded), [\n expanded,\n ])\n\n const getInstance = useGetLatest(instance)\n\n const getToggleAllRowsExpandedProps = makePropGetter(\n getHooks().getToggleAllRowsExpandedProps,\n { instance: getInstance() }\n )\n\n Object.assign(instance, {\n preExpandedRows: rows,\n expandedRows,\n rows: expandedRows,\n expandedDepth,\n isAllRowsExpanded,\n toggleRowExpanded,\n toggleAllRowsExpanded,\n getToggleAllRowsExpandedProps,\n })\n}\n\nfunction prepareRow(row, { instance: { getHooks }, instance }) {\n row.toggleRowExpanded = set => instance.toggleRowExpanded(row.id, set)\n\n row.getToggleRowExpandedProps = makePropGetter(\n getHooks().getToggleRowExpandedProps,\n {\n instance,\n row,\n }\n )\n}\n\nfunction findExpandedDepth(expanded) {\n let maxDepth = 0\n\n Object.keys(expanded).forEach(id => {\n const splitId = id.split('.')\n maxDepth = Math.max(maxDepth, splitId.length)\n })\n\n return maxDepth\n}\n","export const text = (rows, ids, filterValue) => {\n rows = rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return String(rowValue)\n .toLowerCase()\n .includes(String(filterValue).toLowerCase())\n })\n })\n return rows\n}\n\ntext.autoRemove = val => !val\n\nexport const exactText = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return rowValue !== undefined\n ? String(rowValue).toLowerCase() === String(filterValue).toLowerCase()\n : true\n })\n })\n}\n\nexactText.autoRemove = val => !val\n\nexport const exactTextCase = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return rowValue !== undefined\n ? String(rowValue) === String(filterValue)\n : true\n })\n })\n}\n\nexactTextCase.autoRemove = val => !val\n\nexport const includes = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return rowValue.includes(filterValue)\n })\n })\n}\n\nincludes.autoRemove = val => !val || !val.length\n\nexport const includesAll = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return (\n rowValue &&\n rowValue.length &&\n filterValue.every(val => rowValue.includes(val))\n )\n })\n })\n}\n\nincludesAll.autoRemove = val => !val || !val.length\n\nexport const includesSome = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return (\n rowValue &&\n rowValue.length &&\n filterValue.some(val => rowValue.includes(val))\n )\n })\n })\n}\n\nincludesSome.autoRemove = val => !val || !val.length\n\nexport const includesValue = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return filterValue.includes(rowValue)\n })\n })\n}\n\nincludesValue.autoRemove = val => !val || !val.length\n\nexport const exact = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return rowValue === filterValue\n })\n })\n}\n\nexact.autoRemove = val => typeof val === 'undefined'\n\nexport const equals = (rows, ids, filterValue) => {\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n // eslint-disable-next-line eqeqeq\n return rowValue == filterValue\n })\n })\n}\n\nequals.autoRemove = val => val == null\n\nexport const between = (rows, ids, filterValue) => {\n let [min, max] = filterValue || []\n\n min = typeof min === 'number' ? min : -Infinity\n max = typeof max === 'number' ? max : Infinity\n\n if (min > max) {\n const temp = min\n min = max\n max = temp\n }\n\n return rows.filter(row => {\n return ids.some(id => {\n const rowValue = row.values[id]\n return rowValue >= min && rowValue <= max\n })\n })\n}\n\nbetween.autoRemove = val =>\n !val || (typeof val[0] !== 'number' && typeof val[1] !== 'number')\n","import React from 'react'\n\nimport {\n getFirstDefined,\n getFilterMethod,\n shouldAutoRemoveFilter,\n} from '../utils'\n\nimport {\n actions,\n useGetLatest,\n functionalUpdate,\n useMountedLayoutEffect,\n} from '../publicUtils'\n\nimport * as filterTypes from '../filterTypes'\n\n// Actions\nactions.resetFilters = 'resetFilters'\nactions.setFilter = 'setFilter'\nactions.setAllFilters = 'setAllFilters'\n\nexport const useFilters = hooks => {\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n}\n\nuseFilters.pluginName = 'useFilters'\n\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n filters: [],\n ...state,\n }\n }\n\n if (action.type === actions.resetFilters) {\n return {\n ...state,\n filters: instance.initialState.filters || [],\n }\n }\n\n if (action.type === actions.setFilter) {\n const { columnId, filterValue } = action\n const { allColumns, filterTypes: userFilterTypes } = instance\n\n const column = allColumns.find(d => d.id === columnId)\n\n if (!column) {\n throw new Error(\n `React-Table: Could not find a column with id: ${columnId}`\n )\n }\n\n const filterMethod = getFilterMethod(\n column.filter,\n userFilterTypes || {},\n filterTypes\n )\n\n const previousfilter = state.filters.find(d => d.id === columnId)\n\n const newFilter = functionalUpdate(\n filterValue,\n previousfilter && previousfilter.value\n )\n\n //\n if (shouldAutoRemoveFilter(filterMethod.autoRemove, newFilter, column)) {\n return {\n ...state,\n filters: state.filters.filter(d => d.id !== columnId),\n }\n }\n\n if (previousfilter) {\n return {\n ...state,\n filters: state.filters.map(d => {\n if (d.id === columnId) {\n return { id: columnId, value: newFilter }\n }\n return d\n }),\n }\n }\n\n return {\n ...state,\n filters: [...state.filters, { id: columnId, value: newFilter }],\n }\n }\n\n if (action.type === actions.setAllFilters) {\n const { filters } = action\n const { allColumns, filterTypes: userFilterTypes } = instance\n\n return {\n ...state,\n // Filter out undefined values\n filters: functionalUpdate(filters, state.filters).filter(filter => {\n const column = allColumns.find(d => d.id === filter.id)\n const filterMethod = getFilterMethod(\n column.filter,\n userFilterTypes || {},\n filterTypes\n )\n\n if (\n shouldAutoRemoveFilter(filterMethod.autoRemove, filter.value, column)\n ) {\n return false\n }\n return true\n }),\n }\n }\n}\n\nfunction useInstance(instance) {\n const {\n data,\n rows,\n flatRows,\n rowsById,\n allColumns,\n filterTypes: userFilterTypes,\n manualFilters,\n defaultCanFilter = false,\n disableFilters,\n state: { filters },\n dispatch,\n autoResetFilters = true,\n } = instance\n\n const setFilter = React.useCallback(\n (columnId, filterValue) => {\n dispatch({ type: actions.setFilter, columnId, filterValue })\n },\n [dispatch]\n )\n\n const setAllFilters = React.useCallback(\n filters => {\n dispatch({\n type: actions.setAllFilters,\n filters,\n })\n },\n [dispatch]\n )\n\n allColumns.forEach(column => {\n const {\n id,\n accessor,\n defaultCanFilter: columnDefaultCanFilter,\n disableFilters: columnDisableFilters,\n } = column\n\n // Determine if a column is filterable\n column.canFilter = accessor\n ? getFirstDefined(\n columnDisableFilters === true ? false : undefined,\n disableFilters === true ? false : undefined,\n true\n )\n : getFirstDefined(columnDefaultCanFilter, defaultCanFilter, false)\n\n // Provide the column a way of updating the filter value\n column.setFilter = val => setFilter(column.id, val)\n\n // Provide the current filter value to the column for\n // convenience\n const found = filters.find(d => d.id === id)\n column.filterValue = found && found.value\n })\n\n const [\n filteredRows,\n filteredFlatRows,\n filteredRowsById,\n ] = React.useMemo(() => {\n if (manualFilters || !filters.length) {\n return [rows, flatRows, rowsById]\n }\n\n const filteredFlatRows = []\n const filteredRowsById = {}\n\n // Filters top level and nested rows\n const filterRows = (rows, depth = 0) => {\n let filteredRows = rows\n\n filteredRows = filters.reduce(\n (filteredSoFar, { id: columnId, value: filterValue }) => {\n // Find the filters column\n const column = allColumns.find(d => d.id === columnId)\n\n if (!column) {\n return filteredSoFar\n }\n\n if (depth === 0) {\n column.preFilteredRows = filteredSoFar\n }\n\n const filterMethod = getFilterMethod(\n column.filter,\n userFilterTypes || {},\n filterTypes\n )\n\n if (!filterMethod) {\n console.warn(\n `Could not find a valid 'column.filter' for column with the ID: ${column.id}.`\n )\n return filteredSoFar\n }\n\n // Pass the rows, id, filterValue and column to the filterMethod\n // to get the filtered rows back\n column.filteredRows = filterMethod(\n filteredSoFar,\n [columnId],\n filterValue\n )\n\n return column.filteredRows\n },\n rows\n )\n\n // Apply the filter to any subRows\n // We technically could do this recursively in the above loop,\n // but that would severely hinder the API for the user, since they\n // would be required to do that recursion in some scenarios\n filteredRows.forEach(row => {\n filteredFlatRows.push(row)\n filteredRowsById[row.id] = row\n if (!row.subRows) {\n return\n }\n\n row.subRows =\n row.subRows && row.subRows.length > 0\n ? filterRows(row.subRows, depth + 1)\n : row.subRows\n })\n\n return filteredRows\n }\n\n return [filterRows(rows), filteredFlatRows, filteredRowsById]\n }, [\n manualFilters,\n filters,\n rows,\n flatRows,\n rowsById,\n allColumns,\n userFilterTypes,\n ])\n\n React.useMemo(() => {\n // Now that each filtered column has it's partially filtered rows,\n // lets assign the final filtered rows to all of the other columns\n const nonFilteredColumns = allColumns.filter(\n column => !filters.find(d => d.id === column.id)\n )\n\n // This essentially enables faceted filter options to be built easily\n // using every column's preFilteredRows value\n nonFilteredColumns.forEach(column => {\n column.preFilteredRows = filteredRows\n column.filteredRows = filteredRows\n })\n }, [filteredRows, filters, allColumns])\n\n const getAutoResetFilters = useGetLatest(autoResetFilters)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetFilters()) {\n dispatch({ type: actions.resetFilters })\n }\n }, [dispatch, manualFilters ? null : data])\n\n Object.assign(instance, {\n preFilteredRows: rows,\n preFilteredFlatRows: flatRows,\n preFilteredRowsById: rowsById,\n filteredRows,\n filteredFlatRows,\n filteredRowsById,\n rows: filteredRows,\n flatRows: filteredFlatRows,\n rowsById: filteredRowsById,\n setFilter,\n setAllFilters,\n })\n}\n","import React from 'react'\n\nimport {\n getFilterMethod,\n shouldAutoRemoveFilter,\n getFirstDefined,\n} from '../utils'\n\nimport {\n actions,\n useMountedLayoutEffect,\n functionalUpdate,\n useGetLatest,\n} from '../publicUtils'\n\nimport * as filterTypes from '../filterTypes'\n\n// Actions\nactions.resetGlobalFilter = 'resetGlobalFilter'\nactions.setGlobalFilter = 'setGlobalFilter'\n\nexport const useGlobalFilter = hooks => {\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n}\n\nuseGlobalFilter.pluginName = 'useGlobalFilter'\n\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.resetGlobalFilter) {\n return {\n ...state,\n globalFilter: instance.initialState.globalFilter || undefined,\n }\n }\n\n if (action.type === actions.setGlobalFilter) {\n const { filterValue } = action\n const { userFilterTypes } = instance\n\n const filterMethod = getFilterMethod(\n instance.globalFilter,\n userFilterTypes || {},\n filterTypes\n )\n\n const newFilter = functionalUpdate(filterValue, state.globalFilter)\n\n //\n if (shouldAutoRemoveFilter(filterMethod.autoRemove, newFilter)) {\n const { globalFilter, ...stateWithoutGlobalFilter } = state\n return stateWithoutGlobalFilter\n }\n\n return {\n ...state,\n globalFilter: newFilter,\n }\n }\n}\n\nfunction useInstance(instance) {\n const {\n data,\n rows,\n flatRows,\n rowsById,\n allColumns,\n filterTypes: userFilterTypes,\n globalFilter,\n manualGlobalFilter,\n state: { globalFilter: globalFilterValue },\n dispatch,\n autoResetGlobalFilter = true,\n disableGlobalFilter,\n } = instance\n\n const setGlobalFilter = React.useCallback(\n filterValue => {\n dispatch({ type: actions.setGlobalFilter, filterValue })\n },\n [dispatch]\n )\n\n // TODO: Create a filter cache for incremental high speed multi-filtering\n // This gets pretty complicated pretty fast, since you have to maintain a\n // cache for each row group (top-level rows, and each row's recursive subrows)\n // This would make multi-filtering a lot faster though. Too far?\n\n const [\n globalFilteredRows,\n globalFilteredFlatRows,\n globalFilteredRowsById,\n ] = React.useMemo(() => {\n if (manualGlobalFilter || typeof globalFilterValue === 'undefined') {\n return [rows, flatRows, rowsById]\n }\n\n const filteredFlatRows = []\n const filteredRowsById = {}\n\n const filterMethod = getFilterMethod(\n globalFilter,\n userFilterTypes || {},\n filterTypes\n )\n\n if (!filterMethod) {\n console.warn(`Could not find a valid 'globalFilter' option.`)\n return rows\n }\n\n allColumns.forEach(column => {\n const { disableGlobalFilter: columnDisableGlobalFilter } = column\n\n column.canFilter = getFirstDefined(\n columnDisableGlobalFilter === true ? false : undefined,\n disableGlobalFilter === true ? false : undefined,\n true\n )\n })\n\n const filterableColumns = allColumns.filter(c => c.canFilter === true)\n\n // Filters top level and nested rows\n const filterRows = filteredRows => {\n filteredRows = filterMethod(\n filteredRows,\n filterableColumns.map(d => d.id),\n globalFilterValue\n )\n\n filteredRows.forEach(row => {\n filteredFlatRows.push(row)\n filteredRowsById[row.id] = row\n\n row.subRows =\n row.subRows && row.subRows.length\n ? filterRows(row.subRows)\n : row.subRows\n })\n\n return filteredRows\n }\n\n return [filterRows(rows), filteredFlatRows, filteredRowsById]\n }, [\n manualGlobalFilter,\n globalFilterValue,\n globalFilter,\n userFilterTypes,\n allColumns,\n rows,\n flatRows,\n rowsById,\n disableGlobalFilter,\n ])\n\n const getAutoResetGlobalFilter = useGetLatest(autoResetGlobalFilter)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetGlobalFilter()) {\n dispatch({ type: actions.resetGlobalFilter })\n }\n }, [dispatch, manualGlobalFilter ? null : data])\n\n Object.assign(instance, {\n preGlobalFilteredRows: rows,\n preGlobalFilteredFlatRows: flatRows,\n preGlobalFilteredRowsById: rowsById,\n globalFilteredRows,\n globalFilteredFlatRows,\n globalFilteredRowsById,\n rows: globalFilteredRows,\n flatRows: globalFilteredFlatRows,\n rowsById: globalFilteredRowsById,\n setGlobalFilter,\n disableGlobalFilter,\n })\n}\n","export function sum(values, aggregatedValues) {\n // It's faster to just add the aggregations together instead of\n // process leaf nodes individually\n return aggregatedValues.reduce(\n (sum, next) => sum + (typeof next === 'number' ? next : 0),\n 0\n )\n}\n\nexport function min(values) {\n let min = values[0] || 0\n\n values.forEach(value => {\n if (typeof value === 'number') {\n min = Math.min(min, value)\n }\n })\n\n return min\n}\n\nexport function max(values) {\n let max = values[0] || 0\n\n values.forEach(value => {\n if (typeof value === 'number') {\n max = Math.max(max, value)\n }\n })\n\n return max\n}\n\nexport function minMax(values) {\n let min = values[0] || 0\n let max = values[0] || 0\n\n values.forEach(value => {\n if (typeof value === 'number') {\n min = Math.min(min, value)\n max = Math.max(max, value)\n }\n })\n\n return `${min}..${max}`\n}\n\nexport function average(values) {\n return sum(null, values) / values.length\n}\n\nexport function median(values) {\n if (!values.length) {\n return null\n }\n\n const mid = Math.floor(values.length / 2)\n const nums = [...values].sort((a, b) => a - b)\n return values.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2\n}\n\nexport function unique(values) {\n return Array.from(new Set(values).values())\n}\n\nexport function uniqueCount(values) {\n return new Set(values).size\n}\n\nexport function count(values) {\n return values.length\n}\n","import React from 'react'\n\nimport * as aggregations from '../aggregations'\n\nimport { getFirstDefined, flattenBy } from '../utils'\n\nimport {\n actions,\n makePropGetter,\n ensurePluginOrder,\n useMountedLayoutEffect,\n useGetLatest,\n} from '../publicUtils'\n\nconst emptyArray = []\nconst emptyObject = {}\n\n// Actions\nactions.resetGroupBy = 'resetGroupBy'\nactions.setGroupBy = 'setGroupBy'\nactions.toggleGroupBy = 'toggleGroupBy'\n\nexport const useGroupBy = hooks => {\n hooks.getGroupByToggleProps = [defaultGetGroupByToggleProps]\n hooks.stateReducers.push(reducer)\n hooks.visibleColumnsDeps.push((deps, { instance }) => [\n ...deps,\n instance.state.groupBy,\n ])\n hooks.visibleColumns.push(visibleColumns)\n hooks.useInstance.push(useInstance)\n hooks.prepareRow.push(prepareRow)\n}\n\nuseGroupBy.pluginName = 'useGroupBy'\n\nconst defaultGetGroupByToggleProps = (props, { header }) => [\n props,\n {\n onClick: header.canGroupBy\n ? e => {\n e.persist()\n header.toggleGroupBy()\n }\n : undefined,\n style: {\n cursor: header.canGroupBy ? 'pointer' : undefined,\n },\n title: 'Toggle GroupBy',\n },\n]\n\n// Reducer\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n groupBy: [],\n ...state,\n }\n }\n\n if (action.type === actions.resetGroupBy) {\n return {\n ...state,\n groupBy: instance.initialState.groupBy || [],\n }\n }\n\n if (action.type === actions.setGroupBy) {\n const { value } = action\n return {\n ...state,\n groupBy: value,\n }\n }\n\n if (action.type === actions.toggleGroupBy) {\n const { columnId, value: setGroupBy } = action\n\n const resolvedGroupBy =\n typeof setGroupBy !== 'undefined'\n ? setGroupBy\n : !state.groupBy.includes(columnId)\n\n if (resolvedGroupBy) {\n return {\n ...state,\n groupBy: [...state.groupBy, columnId],\n }\n }\n\n return {\n ...state,\n groupBy: state.groupBy.filter(d => d !== columnId),\n }\n }\n}\n\nfunction visibleColumns(\n columns,\n {\n instance: {\n state: { groupBy },\n },\n }\n) {\n // Sort grouped columns to the start of the column list\n // before the headers are built\n\n const groupByColumns = groupBy\n .map(g => columns.find(col => col.id === g))\n .filter(Boolean)\n\n const nonGroupByColumns = columns.filter(col => !groupBy.includes(col.id))\n\n columns = [...groupByColumns, ...nonGroupByColumns]\n\n columns.forEach(column => {\n column.isGrouped = groupBy.includes(column.id)\n column.groupedIndex = groupBy.indexOf(column.id)\n })\n\n return columns\n}\n\nconst defaultUserAggregations = {}\n\nfunction useInstance(instance) {\n const {\n data,\n rows,\n flatRows,\n rowsById,\n allColumns,\n flatHeaders,\n groupByFn = defaultGroupByFn,\n manualGroupBy,\n aggregations: userAggregations = defaultUserAggregations,\n plugins,\n state: { groupBy },\n dispatch,\n autoResetGroupBy = true,\n disableGroupBy,\n defaultCanGroupBy,\n getHooks,\n } = instance\n\n ensurePluginOrder(plugins, ['useColumnOrder', 'useFilters'], 'useGroupBy')\n\n const getInstance = useGetLatest(instance)\n\n allColumns.forEach(column => {\n const {\n accessor,\n defaultGroupBy: defaultColumnGroupBy,\n disableGroupBy: columnDisableGroupBy,\n } = column\n\n column.canGroupBy = accessor\n ? getFirstDefined(\n column.canGroupBy,\n columnDisableGroupBy === true ? false : undefined,\n disableGroupBy === true ? false : undefined,\n true\n )\n : getFirstDefined(\n column.canGroupBy,\n defaultColumnGroupBy,\n defaultCanGroupBy,\n false\n )\n\n if (column.canGroupBy) {\n column.toggleGroupBy = () => instance.toggleGroupBy(column.id)\n }\n\n column.Aggregated = column.Aggregated || column.Cell\n })\n\n const toggleGroupBy = React.useCallback(\n (columnId, value) => {\n dispatch({ type: actions.toggleGroupBy, columnId, value })\n },\n [dispatch]\n )\n\n const setGroupBy = React.useCallback(\n value => {\n dispatch({ type: actions.setGroupBy, value })\n },\n [dispatch]\n )\n\n flatHeaders.forEach(header => {\n header.getGroupByToggleProps = makePropGetter(\n getHooks().getGroupByToggleProps,\n { instance: getInstance(), header }\n )\n })\n\n const [\n groupedRows,\n groupedFlatRows,\n groupedRowsById,\n onlyGroupedFlatRows,\n onlyGroupedRowsById,\n nonGroupedFlatRows,\n nonGroupedRowsById,\n ] = React.useMemo(() => {\n if (manualGroupBy || !groupBy.length) {\n return [\n rows,\n flatRows,\n rowsById,\n emptyArray,\n emptyObject,\n flatRows,\n rowsById,\n ]\n }\n\n // Ensure that the list of filtered columns exist\n const existingGroupBy = groupBy.filter(g =>\n allColumns.find(col => col.id === g)\n )\n\n // Find the columns that can or are aggregating\n // Uses each column to aggregate rows into a single value\n const aggregateRowsToValues = (leafRows, groupedRows, depth) => {\n const values = {}\n\n allColumns.forEach(column => {\n // Don't aggregate columns that are in the groupBy\n if (existingGroupBy.includes(column.id)) {\n values[column.id] = groupedRows[0]\n ? groupedRows[0].values[column.id]\n : null\n return\n }\n\n // Aggregate the values\n let aggregateFn =\n typeof column.aggregate === 'function'\n ? column.aggregate\n : userAggregations[column.aggregate] ||\n aggregations[column.aggregate]\n\n if (aggregateFn) {\n // Get the columnValues to aggregate\n const groupedValues = groupedRows.map(row => row.values[column.id])\n\n // Get the columnValues to aggregate\n const leafValues = leafRows.map(row => {\n let columnValue = row.values[column.id]\n\n if (!depth && column.aggregateValue) {\n const aggregateValueFn =\n typeof column.aggregateValue === 'function'\n ? column.aggregateValue\n : userAggregations[column.aggregateValue] ||\n aggregations[column.aggregateValue]\n\n if (!aggregateValueFn) {\n console.info({ column })\n throw new Error(\n `React Table: Invalid column.aggregateValue option for column listed above`\n )\n }\n\n columnValue = aggregateValueFn(columnValue, row, column)\n }\n return columnValue\n })\n\n values[column.id] = aggregateFn(leafValues, groupedValues)\n } else if (column.aggregate) {\n console.info({ column })\n throw new Error(\n `React Table: Invalid column.aggregate option for column listed above`\n )\n } else {\n values[column.id] = null\n }\n })\n\n return values\n }\n\n let groupedFlatRows = []\n const groupedRowsById = {}\n const onlyGroupedFlatRows = []\n const onlyGroupedRowsById = {}\n const nonGroupedFlatRows = []\n const nonGroupedRowsById = {}\n\n // Recursively group the data\n const groupUpRecursively = (rows, depth = 0, parentId) => {\n // This is the last level, just return the rows\n if (depth === existingGroupBy.length) {\n return rows.map((row) => ({ ...row, depth }))\n }\n\n const columnId = existingGroupBy[depth]\n\n // Group the rows together for this level\n let rowGroupsMap = groupByFn(rows, columnId)\n\n // Peform aggregations for each group\n const aggregatedGroupedRows = Object.entries(rowGroupsMap).map(\n ([groupByVal, groupedRows], index) => {\n let id = `${columnId}:${groupByVal}`\n id = parentId ? `${parentId}>${id}` : id\n\n // First, Recurse to group sub rows before aggregation\n const subRows = groupUpRecursively(groupedRows, depth + 1, id)\n\n // Flatten the leaf rows of the rows in this group\n const leafRows = depth\n ? flattenBy(groupedRows, 'leafRows')\n : groupedRows\n\n const values = aggregateRowsToValues(leafRows, groupedRows, depth)\n\n const row = {\n id,\n isGrouped: true,\n groupByID: columnId,\n groupByVal,\n values,\n subRows,\n leafRows,\n depth,\n index,\n }\n\n subRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n if (subRow.isGrouped) {\n onlyGroupedFlatRows.push(subRow)\n onlyGroupedRowsById[subRow.id] = subRow\n } else {\n nonGroupedFlatRows.push(subRow)\n nonGroupedRowsById[subRow.id] = subRow\n }\n })\n\n return row\n }\n )\n\n return aggregatedGroupedRows\n }\n\n const groupedRows = groupUpRecursively(rows)\n\n groupedRows.forEach(subRow => {\n groupedFlatRows.push(subRow)\n groupedRowsById[subRow.id] = subRow\n if (subRow.isGrouped) {\n onlyGroupedFlatRows.push(subRow)\n onlyGroupedRowsById[subRow.id] = subRow\n } else {\n nonGroupedFlatRows.push(subRow)\n nonGroupedRowsById[subRow.id] = subRow\n }\n })\n\n // Assign the new data\n return [\n groupedRows,\n groupedFlatRows,\n groupedRowsById,\n onlyGroupedFlatRows,\n onlyGroupedRowsById,\n nonGroupedFlatRows,\n nonGroupedRowsById,\n ]\n }, [\n manualGroupBy,\n groupBy,\n rows,\n flatRows,\n rowsById,\n allColumns,\n userAggregations,\n groupByFn,\n ])\n\n const getAutoResetGroupBy = useGetLatest(autoResetGroupBy)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetGroupBy()) {\n dispatch({ type: actions.resetGroupBy })\n }\n }, [dispatch, manualGroupBy ? null : data])\n\n Object.assign(instance, {\n preGroupedRows: rows,\n preGroupedFlatRow: flatRows,\n preGroupedRowsById: rowsById,\n groupedRows,\n groupedFlatRows,\n groupedRowsById,\n onlyGroupedFlatRows,\n onlyGroupedRowsById,\n nonGroupedFlatRows,\n nonGroupedRowsById,\n rows: groupedRows,\n flatRows: groupedFlatRows,\n rowsById: groupedRowsById,\n toggleGroupBy,\n setGroupBy,\n })\n}\n\nfunction prepareRow(row) {\n row.allCells.forEach(cell => {\n // Grouped cells are in the groupBy and the pivot cell for the row\n cell.isGrouped = cell.column.isGrouped && cell.column.id === row.groupByID\n // Placeholder cells are any columns in the groupBy that are not grouped\n cell.isPlaceholder = !cell.isGrouped && cell.column.isGrouped\n // Aggregated cells are not grouped, not repeated, but still have subRows\n cell.isAggregated =\n !cell.isGrouped && !cell.isPlaceholder && row.subRows?.length\n })\n}\n\nexport function defaultGroupByFn(rows, columnId) {\n return rows.reduce((prev, row, i) => {\n // TODO: Might want to implement a key serializer here so\n // irregular column values can still be grouped if needed?\n const resKey = `${row.values[columnId]}`\n prev[resKey] = Array.isArray(prev[resKey]) ? prev[resKey] : []\n prev[resKey].push(row)\n return prev\n }, {})\n}\n","const reSplitAlphaNumeric = /([0-9]+)/gm\n\n// Mixed sorting is slow, but very inclusive of many edge cases.\n// It handles numbers, mixed alphanumeric combinations, and even\n// null, undefined, and Infinity\nexport const alphanumeric = (rowA, rowB, columnId) => {\n let [a, b] = getRowValuesByColumnID(rowA, rowB, columnId)\n\n // Force to strings (or \"\" for unsupported types)\n a = toString(a)\n b = toString(b)\n\n // Split on number groups, but keep the delimiter\n // Then remove falsey split values\n a = a.split(reSplitAlphaNumeric).filter(Boolean)\n b = b.split(reSplitAlphaNumeric).filter(Boolean)\n\n // While\n while (a.length && b.length) {\n let aa = a.shift()\n let bb = b.shift()\n\n const an = parseInt(aa, 10)\n const bn = parseInt(bb, 10)\n\n const combo = [an, bn].sort()\n\n // Both are string\n if (isNaN(combo[0])) {\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n // One is a string, one is a number\n if (isNaN(combo[1])) {\n return isNaN(an) ? -1 : 1\n }\n\n // Both are numbers\n if (an > bn) {\n return 1\n }\n if (bn > an) {\n return -1\n }\n }\n\n return a.length - b.length\n}\nexport function datetime(rowA, rowB, columnId) {\n let [a, b] = getRowValuesByColumnID(rowA, rowB, columnId)\n\n a = a.getTime()\n b = b.getTime()\n\n return compareBasic(a, b)\n}\n\nexport function basic(rowA, rowB, columnId) {\n let [a, b] = getRowValuesByColumnID(rowA, rowB, columnId)\n\n return compareBasic(a, b)\n}\n\nexport function string(rowA, rowB, columnId) {\n let [a, b] = getRowValuesByColumnID(rowA, rowB, columnId)\n\n a = a.split('').filter(Boolean)\n b = b.split('').filter(Boolean)\n\n while (a.length && b.length) {\n let aa = a.shift()\n let bb = b.shift()\n\n let alower = aa.toLowerCase()\n let blower = bb.toLowerCase()\n\n // Case insensitive comparison until characters match\n if (alower > blower) {\n return 1\n }\n if (blower > alower) {\n return -1\n }\n // If lowercase characters are identical\n if (aa > bb) {\n return 1\n }\n if (bb > aa) {\n return -1\n }\n continue\n }\n\n return a.length - b.length\n}\n\nexport function number(rowA, rowB, columnId) {\n let [a, b] = getRowValuesByColumnID(rowA, rowB, columnId)\n\n const replaceNonNumeric = /[^0-9.]/gi\n\n a = Number(String(a).replace(replaceNonNumeric, ''))\n b = Number(String(b).replace(replaceNonNumeric, ''))\n\n return compareBasic(a, b)\n}\n\n// Utils\n\nfunction compareBasic(a, b) {\n return a === b ? 0 : a > b ? 1 : -1\n}\n\nfunction getRowValuesByColumnID(row1, row2, columnId) {\n return [row1.values[columnId], row2.values[columnId]]\n}\n\nfunction toString(a) {\n if (typeof a === 'number') {\n if (isNaN(a) || a === Infinity || a === -Infinity) {\n return ''\n }\n return String(a)\n }\n if (typeof a === 'string') {\n return a\n }\n return ''\n}\n","import React from 'react'\n\nimport {\n actions,\n ensurePluginOrder,\n defaultColumn,\n makePropGetter,\n useGetLatest,\n useMountedLayoutEffect,\n} from '../publicUtils'\n\nimport { getFirstDefined, isFunction } from '../utils'\n\nimport * as sortTypes from '../sortTypes'\n\n// Actions\nactions.resetSortBy = 'resetSortBy'\nactions.setSortBy = 'setSortBy'\nactions.toggleSortBy = 'toggleSortBy'\nactions.clearSortBy = 'clearSortBy'\n\ndefaultColumn.sortType = 'alphanumeric'\ndefaultColumn.sortDescFirst = false\n\nexport const useSortBy = hooks => {\n hooks.getSortByToggleProps = [defaultGetSortByToggleProps]\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n}\n\nuseSortBy.pluginName = 'useSortBy'\n\nconst defaultGetSortByToggleProps = (props, { instance, column }) => {\n const { isMultiSortEvent = e => e.shiftKey } = instance\n\n return [\n props,\n {\n onClick: column.canSort\n ? e => {\n e.persist()\n column.toggleSortBy(\n undefined,\n !instance.disableMultiSort && isMultiSortEvent(e)\n )\n }\n : undefined,\n style: {\n cursor: column.canSort ? 'pointer' : undefined,\n },\n title: column.canSort ? 'Toggle SortBy' : undefined,\n },\n ]\n}\n\n// Reducer\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n sortBy: [],\n ...state,\n }\n }\n\n if (action.type === actions.resetSortBy) {\n return {\n ...state,\n sortBy: instance.initialState.sortBy || [],\n }\n }\n\n if (action.type === actions.clearSortBy) {\n const { sortBy } = state\n const newSortBy = sortBy.filter(d => d.id !== action.columnId)\n\n return {\n ...state,\n sortBy: newSortBy,\n }\n }\n\n if (action.type === actions.setSortBy) {\n const { sortBy } = action\n return {\n ...state,\n sortBy,\n }\n }\n\n if (action.type === actions.toggleSortBy) {\n const { columnId, desc, multi } = action\n\n const {\n allColumns,\n disableMultiSort,\n disableSortRemove,\n disableMultiRemove,\n maxMultiSortColCount = Number.MAX_SAFE_INTEGER,\n } = instance\n\n const { sortBy } = state\n\n // Find the column for this columnId\n const column = allColumns.find(d => d.id === columnId)\n const { sortDescFirst } = column\n\n // Find any existing sortBy for this column\n const existingSortBy = sortBy.find(d => d.id === columnId)\n const existingIndex = sortBy.findIndex(d => d.id === columnId)\n const hasDescDefined = typeof desc !== 'undefined' && desc !== null\n\n let newSortBy = []\n\n // What should we do with this sort action?\n let sortAction\n\n if (!disableMultiSort && multi) {\n if (existingSortBy) {\n sortAction = 'toggle'\n } else {\n sortAction = 'add'\n }\n } else {\n // Normal mode\n if (existingIndex !== sortBy.length - 1 || sortBy.length !== 1) {\n sortAction = 'replace'\n } else if (existingSortBy) {\n sortAction = 'toggle'\n } else {\n sortAction = 'replace'\n }\n }\n\n // Handle toggle states that will remove the sortBy\n if (\n sortAction === 'toggle' && // Must be toggling\n !disableSortRemove && // If disableSortRemove, disable in general\n !hasDescDefined && // Must not be setting desc\n (multi ? !disableMultiRemove : true) && // If multi, don't allow if disableMultiRemove\n ((existingSortBy && // Finally, detect if it should indeed be removed\n existingSortBy.desc &&\n !sortDescFirst) ||\n (!existingSortBy.desc && sortDescFirst))\n ) {\n sortAction = 'remove'\n }\n\n if (sortAction === 'replace') {\n newSortBy = [\n {\n id: columnId,\n desc: hasDescDefined ? desc : sortDescFirst,\n },\n ]\n } else if (sortAction === 'add') {\n newSortBy = [\n ...sortBy,\n {\n id: columnId,\n desc: hasDescDefined ? desc : sortDescFirst,\n },\n ]\n // Take latest n columns\n newSortBy.splice(0, newSortBy.length - maxMultiSortColCount)\n } else if (sortAction === 'toggle') {\n // This flips (or sets) the\n newSortBy = sortBy.map(d => {\n if (d.id === columnId) {\n return {\n ...d,\n desc: hasDescDefined ? desc : !existingSortBy.desc,\n }\n }\n return d\n })\n } else if (sortAction === 'remove') {\n newSortBy = sortBy.filter(d => d.id !== columnId)\n }\n\n return {\n ...state,\n sortBy: newSortBy,\n }\n }\n}\n\nfunction useInstance(instance) {\n const {\n data,\n rows,\n flatRows,\n allColumns,\n orderByFn = defaultOrderByFn,\n sortTypes: userSortTypes,\n manualSortBy,\n defaultCanSort,\n disableSortBy,\n flatHeaders,\n state: { sortBy },\n dispatch,\n plugins,\n getHooks,\n autoResetSortBy = true,\n } = instance\n\n ensurePluginOrder(\n plugins,\n ['useFilters', 'useGlobalFilter', 'useGroupBy', 'usePivotColumns'],\n 'useSortBy'\n )\n\n const setSortBy = React.useCallback(\n sortBy => {\n dispatch({ type: actions.setSortBy, sortBy })\n },\n [dispatch]\n )\n\n // Updates sorting based on a columnId, desc flag and multi flag\n const toggleSortBy = React.useCallback(\n (columnId, desc, multi) => {\n dispatch({ type: actions.toggleSortBy, columnId, desc, multi })\n },\n [dispatch]\n )\n\n // use reference to avoid memory leak in #1608\n const getInstance = useGetLatest(instance)\n\n // Add the getSortByToggleProps method to columns and headers\n flatHeaders.forEach(column => {\n const {\n accessor,\n canSort: defaultColumnCanSort,\n disableSortBy: columnDisableSortBy,\n id,\n } = column\n\n const canSort = accessor\n ? getFirstDefined(\n columnDisableSortBy === true ? false : undefined,\n disableSortBy === true ? false : undefined,\n true\n )\n : getFirstDefined(defaultCanSort, defaultColumnCanSort, false)\n\n column.canSort = canSort\n\n if (column.canSort) {\n column.toggleSortBy = (desc, multi) =>\n toggleSortBy(column.id, desc, multi)\n\n column.clearSortBy = () => {\n dispatch({ type: actions.clearSortBy, columnId: column.id })\n }\n }\n\n column.getSortByToggleProps = makePropGetter(\n getHooks().getSortByToggleProps,\n {\n instance: getInstance(),\n column,\n }\n )\n\n const columnSort = sortBy.find(d => d.id === id)\n column.isSorted = !!columnSort\n column.sortedIndex = sortBy.findIndex(d => d.id === id)\n column.isSortedDesc = column.isSorted ? columnSort.desc : undefined\n })\n\n const [sortedRows, sortedFlatRows] = React.useMemo(() => {\n if (manualSortBy || !sortBy.length) {\n return [rows, flatRows]\n }\n\n const sortedFlatRows = []\n\n // Filter out sortBys that correspond to non existing columns\n const availableSortBy = sortBy.filter(sort =>\n allColumns.find(col => col.id === sort.id)\n )\n\n const sortData = rows => {\n // Use the orderByFn to compose multiple sortBy's together.\n // This will also perform a stable sorting using the row index\n // if needed.\n const sortedData = orderByFn(\n rows,\n availableSortBy.map(sort => {\n // Support custom sorting methods for each column\n const column = allColumns.find(d => d.id === sort.id)\n\n if (!column) {\n throw new Error(\n `React-Table: Could not find a column with id: ${sort.id} while sorting`\n )\n }\n\n const { sortType } = column\n\n // Look up sortBy functions in this order:\n // column function\n // column string lookup on user sortType\n // column string lookup on built-in sortType\n // default function\n // default string lookup on user sortType\n // default string lookup on built-in sortType\n const sortMethod =\n isFunction(sortType) ||\n (userSortTypes || {})[sortType] ||\n sortTypes[sortType]\n\n if (!sortMethod) {\n throw new Error(\n `React-Table: Could not find a valid sortType of '${sortType}' for column '${sort.id}'.`\n )\n }\n\n // Return the correct sortFn.\n // This function should always return in ascending order\n return (a, b) => sortMethod(a, b, sort.id, sort.desc)\n }),\n // Map the directions\n availableSortBy.map(sort => {\n // Detect and use the sortInverted option\n const column = allColumns.find(d => d.id === sort.id)\n\n if (column && column.sortInverted) {\n return sort.desc\n }\n\n return !sort.desc\n })\n )\n\n // If there are sub-rows, sort them\n sortedData.forEach(row => {\n sortedFlatRows.push(row)\n if (!row.subRows || row.subRows.length === 0) {\n return\n }\n row.subRows = sortData(row.subRows)\n })\n\n return sortedData\n }\n\n return [sortData(rows), sortedFlatRows]\n }, [\n manualSortBy,\n sortBy,\n rows,\n flatRows,\n allColumns,\n orderByFn,\n userSortTypes,\n ])\n\n const getAutoResetSortBy = useGetLatest(autoResetSortBy)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetSortBy()) {\n dispatch({ type: actions.resetSortBy })\n }\n }, [manualSortBy ? null : data])\n\n Object.assign(instance, {\n preSortedRows: rows,\n preSortedFlatRows: flatRows,\n sortedRows,\n sortedFlatRows,\n rows: sortedRows,\n flatRows: sortedFlatRows,\n setSortBy,\n toggleSortBy,\n })\n}\n\nexport function defaultOrderByFn(arr, funcs, dirs) {\n return [...arr].sort((rowA, rowB) => {\n for (let i = 0; i < funcs.length; i += 1) {\n const sortFn = funcs[i]\n const desc = dirs[i] === false || dirs[i] === 'desc'\n const sortInt = sortFn(rowA, rowB)\n if (sortInt !== 0) {\n return desc ? -sortInt : sortInt\n }\n }\n return dirs[0] ? rowA.index - rowB.index : rowB.index - rowA.index\n })\n}\n","import React from 'react'\n\n//\n\nimport {\n actions,\n ensurePluginOrder,\n functionalUpdate,\n useMountedLayoutEffect,\n useGetLatest,\n} from '../publicUtils'\n\nimport { expandRows } from '../utils'\n\nconst pluginName = 'usePagination'\n\n// Actions\nactions.resetPage = 'resetPage'\nactions.gotoPage = 'gotoPage'\nactions.setPageSize = 'setPageSize'\n\nexport const usePagination = hooks => {\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n}\n\nusePagination.pluginName = pluginName\n\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n pageSize: 10,\n pageIndex: 0,\n ...state,\n }\n }\n\n if (action.type === actions.resetPage) {\n return {\n ...state,\n pageIndex: instance.initialState.pageIndex || 0,\n }\n }\n\n if (action.type === actions.gotoPage) {\n const { pageCount, page } = instance\n const newPageIndex = functionalUpdate(action.pageIndex, state.pageIndex)\n let canNavigate = false\n\n if (newPageIndex > state.pageIndex) {\n // next page\n canNavigate =\n pageCount === -1\n ? page.length >= state.pageSize\n : newPageIndex < pageCount\n } else if (newPageIndex < state.pageIndex) {\n // prev page\n canNavigate = newPageIndex > -1\n }\n\n if (!canNavigate) {\n return state\n }\n\n return {\n ...state,\n pageIndex: newPageIndex,\n }\n }\n\n if (action.type === actions.setPageSize) {\n const { pageSize } = action\n const topRowIndex = state.pageSize * state.pageIndex\n const pageIndex = Math.floor(topRowIndex / pageSize)\n\n return {\n ...state,\n pageIndex,\n pageSize,\n }\n }\n}\n\nfunction useInstance(instance) {\n const {\n rows,\n autoResetPage = true,\n manualExpandedKey = 'expanded',\n plugins,\n pageCount: userPageCount,\n paginateExpandedRows = true,\n expandSubRows = true,\n state: {\n pageSize,\n pageIndex,\n expanded,\n globalFilter,\n filters,\n groupBy,\n sortBy,\n },\n dispatch,\n data,\n manualPagination,\n } = instance\n\n ensurePluginOrder(\n plugins,\n ['useGlobalFilter', 'useFilters', 'useGroupBy', 'useSortBy', 'useExpanded'],\n 'usePagination'\n )\n\n const getAutoResetPage = useGetLatest(autoResetPage)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetPage()) {\n dispatch({ type: actions.resetPage })\n }\n }, [\n dispatch,\n manualPagination ? null : data,\n globalFilter,\n filters,\n groupBy,\n sortBy,\n ])\n\n const pageCount = manualPagination\n ? userPageCount\n : Math.ceil(rows.length / pageSize)\n\n const pageOptions = React.useMemo(\n () =>\n pageCount > 0\n ? [...new Array(pageCount)].fill(null).map((d, i) => i)\n : [],\n [pageCount]\n )\n\n const page = React.useMemo(() => {\n let page\n\n if (manualPagination) {\n page = rows\n } else {\n const pageStart = pageSize * pageIndex\n const pageEnd = pageStart + pageSize\n\n page = rows.slice(pageStart, pageEnd)\n }\n\n if (paginateExpandedRows) {\n return page\n }\n\n return expandRows(page, { manualExpandedKey, expanded, expandSubRows })\n }, [\n expandSubRows,\n expanded,\n manualExpandedKey,\n manualPagination,\n pageIndex,\n pageSize,\n paginateExpandedRows,\n rows,\n ])\n\n const canPreviousPage = pageIndex > 0\n const canNextPage =\n pageCount === -1 ? page.length >= pageSize : pageIndex < pageCount - 1\n\n const gotoPage = React.useCallback(\n pageIndex => {\n dispatch({ type: actions.gotoPage, pageIndex })\n },\n [dispatch]\n )\n\n const previousPage = React.useCallback(() => {\n return gotoPage(old => old - 1)\n }, [gotoPage])\n\n const nextPage = React.useCallback(() => {\n return gotoPage(old => old + 1)\n }, [gotoPage])\n\n const setPageSize = React.useCallback(\n pageSize => {\n dispatch({ type: actions.setPageSize, pageSize })\n },\n [dispatch]\n )\n\n Object.assign(instance, {\n pageOptions,\n pageCount,\n page,\n canPreviousPage,\n canNextPage,\n gotoPage,\n previousPage,\n nextPage,\n setPageSize,\n })\n}\n","/* istanbul ignore file */\n\nimport {\n actions,\n makePropGetter,\n ensurePluginOrder,\n useMountedLayoutEffect,\n useGetLatest,\n} from '../publicUtils'\n\nimport { flattenColumns, getFirstDefined } from '../utils'\n\n// Actions\nactions.resetPivot = 'resetPivot'\nactions.togglePivot = 'togglePivot'\n\nexport const _UNSTABLE_usePivotColumns = hooks => {\n hooks.getPivotToggleProps = [defaultGetPivotToggleProps]\n hooks.stateReducers.push(reducer)\n hooks.useInstanceAfterData.push(useInstanceAfterData)\n hooks.allColumns.push(allColumns)\n hooks.accessValue.push(accessValue)\n hooks.materializedColumns.push(materializedColumns)\n hooks.materializedColumnsDeps.push(materializedColumnsDeps)\n hooks.visibleColumns.push(visibleColumns)\n hooks.visibleColumnsDeps.push(visibleColumnsDeps)\n hooks.useInstance.push(useInstance)\n hooks.prepareRow.push(prepareRow)\n}\n\n_UNSTABLE_usePivotColumns.pluginName = 'usePivotColumns'\n\nconst defaultPivotColumns = []\n\nconst defaultGetPivotToggleProps = (props, { header }) => [\n props,\n {\n onClick: header.canPivot\n ? e => {\n e.persist()\n header.togglePivot()\n }\n : undefined,\n style: {\n cursor: header.canPivot ? 'pointer' : undefined,\n },\n title: 'Toggle Pivot',\n },\n]\n\n// Reducer\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n pivotColumns: defaultPivotColumns,\n ...state,\n }\n }\n\n if (action.type === actions.resetPivot) {\n return {\n ...state,\n pivotColumns: instance.initialState.pivotColumns || defaultPivotColumns,\n }\n }\n\n if (action.type === actions.togglePivot) {\n const { columnId, value: setPivot } = action\n\n const resolvedPivot =\n typeof setPivot !== 'undefined'\n ? setPivot\n : !state.pivotColumns.includes(columnId)\n\n if (resolvedPivot) {\n return {\n ...state,\n pivotColumns: [...state.pivotColumns, columnId],\n }\n }\n\n return {\n ...state,\n pivotColumns: state.pivotColumns.filter(d => d !== columnId),\n }\n }\n}\n\nfunction useInstanceAfterData(instance) {\n instance.allColumns.forEach(column => {\n column.isPivotSource = instance.state.pivotColumns.includes(column.id)\n })\n}\n\nfunction allColumns(columns, { instance }) {\n columns.forEach(column => {\n column.isPivotSource = instance.state.pivotColumns.includes(column.id)\n column.uniqueValues = new Set()\n })\n return columns\n}\n\nfunction accessValue(value, { column }) {\n if (column.uniqueValues && typeof value !== 'undefined') {\n column.uniqueValues.add(value)\n }\n return value\n}\n\nfunction materializedColumns(materialized, { instance }) {\n const { allColumns, state } = instance\n\n if (!state.pivotColumns.length || !state.groupBy || !state.groupBy.length) {\n return materialized\n }\n\n const pivotColumns = state.pivotColumns\n .map(id => allColumns.find(d => d.id === id))\n .filter(Boolean)\n\n const sourceColumns = allColumns.filter(\n d =>\n !d.isPivotSource &&\n !state.groupBy.includes(d.id) &&\n !state.pivotColumns.includes(d.id)\n )\n\n const buildPivotColumns = (depth = 0, parent, pivotFilters = []) => {\n const pivotColumn = pivotColumns[depth]\n\n if (!pivotColumn) {\n return sourceColumns.map(sourceColumn => {\n // TODO: We could offer support here for renesting pivoted\n // columns inside copies of their header groups. For now,\n // that seems like it would be (1) overkill on nesting, considering\n // you already get nesting for every pivot level and (2)\n // really hard. :)\n\n return {\n ...sourceColumn,\n canPivot: false,\n isPivoted: true,\n parent,\n depth: depth,\n id: `${parent ? `${parent.id}.${sourceColumn.id}` : sourceColumn.id}`,\n accessor: (originalRow, i, row) => {\n if (pivotFilters.every(filter => filter(row))) {\n return row.values[sourceColumn.id]\n }\n },\n }\n })\n }\n\n const uniqueValues = Array.from(pivotColumn.uniqueValues).sort()\n\n return uniqueValues.map(uniqueValue => {\n const columnGroup = {\n ...pivotColumn,\n Header:\n pivotColumn.PivotHeader || typeof pivotColumn.header === 'string'\n ? `${pivotColumn.Header}: ${uniqueValue}`\n : uniqueValue,\n isPivotGroup: true,\n parent,\n depth,\n id: parent\n ? `${parent.id}.${pivotColumn.id}.${uniqueValue}`\n : `${pivotColumn.id}.${uniqueValue}`,\n pivotValue: uniqueValue,\n }\n\n columnGroup.columns = buildPivotColumns(depth + 1, columnGroup, [\n ...pivotFilters,\n row => row.values[pivotColumn.id] === uniqueValue,\n ])\n\n return columnGroup\n })\n }\n\n const newMaterialized = flattenColumns(buildPivotColumns())\n\n return [...materialized, ...newMaterialized]\n}\n\nfunction materializedColumnsDeps(\n deps,\n {\n instance: {\n state: { pivotColumns, groupBy },\n },\n }\n) {\n return [...deps, pivotColumns, groupBy]\n}\n\nfunction visibleColumns(visibleColumns, { instance: { state } }) {\n visibleColumns = visibleColumns.filter(d => !d.isPivotSource)\n\n if (state.pivotColumns.length && state.groupBy && state.groupBy.length) {\n visibleColumns = visibleColumns.filter(\n column => column.isGrouped || column.isPivoted\n )\n }\n\n return visibleColumns\n}\n\nfunction visibleColumnsDeps(deps, { instance }) {\n return [...deps, instance.state.pivotColumns, instance.state.groupBy]\n}\n\nfunction useInstance(instance) {\n const {\n columns,\n allColumns,\n flatHeaders,\n // pivotFn = defaultPivotFn,\n // manualPivot,\n getHooks,\n plugins,\n dispatch,\n autoResetPivot = true,\n manaulPivot,\n disablePivot,\n defaultCanPivot,\n } = instance\n\n ensurePluginOrder(plugins, ['useGroupBy'], 'usePivotColumns')\n\n const getInstance = useGetLatest(instance)\n\n allColumns.forEach(column => {\n const {\n accessor,\n defaultPivot: defaultColumnPivot,\n disablePivot: columnDisablePivot,\n } = column\n\n column.canPivot = accessor\n ? getFirstDefined(\n column.canPivot,\n columnDisablePivot === true ? false : undefined,\n disablePivot === true ? false : undefined,\n true\n )\n : getFirstDefined(\n column.canPivot,\n defaultColumnPivot,\n defaultCanPivot,\n false\n )\n\n if (column.canPivot) {\n column.togglePivot = () => instance.togglePivot(column.id)\n }\n\n column.Aggregated = column.Aggregated || column.Cell\n })\n\n const togglePivot = (columnId, value) => {\n dispatch({ type: actions.togglePivot, columnId, value })\n }\n\n flatHeaders.forEach(header => {\n header.getPivotToggleProps = makePropGetter(\n getHooks().getPivotToggleProps,\n {\n instance: getInstance(),\n header,\n }\n )\n })\n\n const getAutoResetPivot = useGetLatest(autoResetPivot)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetPivot()) {\n dispatch({ type: actions.resetPivot })\n }\n }, [dispatch, manaulPivot ? null : columns])\n\n Object.assign(instance, {\n togglePivot,\n })\n}\n\nfunction prepareRow(row) {\n row.allCells.forEach(cell => {\n // Grouped cells are in the pivotColumns and the pivot cell for the row\n cell.isPivoted = cell.column.isPivoted\n })\n}\n","import React from 'react'\n\nimport {\n actions,\n makePropGetter,\n ensurePluginOrder,\n useGetLatest,\n useMountedLayoutEffect,\n} from '../publicUtils'\n\nconst pluginName = 'useRowSelect'\n\n// Actions\nactions.resetSelectedRows = 'resetSelectedRows'\nactions.toggleAllRowsSelected = 'toggleAllRowsSelected'\nactions.toggleRowSelected = 'toggleRowSelected'\nactions.toggleAllPageRowsSelected = 'toggleAllPageRowsSelected'\n\nexport const useRowSelect = hooks => {\n hooks.getToggleRowSelectedProps = [defaultGetToggleRowSelectedProps]\n hooks.getToggleAllRowsSelectedProps = [defaultGetToggleAllRowsSelectedProps]\n hooks.getToggleAllPageRowsSelectedProps = [\n defaultGetToggleAllPageRowsSelectedProps,\n ]\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n hooks.prepareRow.push(prepareRow)\n}\n\nuseRowSelect.pluginName = pluginName\n\nconst defaultGetToggleRowSelectedProps = (props, { instance, row }) => {\n const { manualRowSelectedKey = 'isSelected' } = instance\n let checked = false\n\n if (row.original && row.original[manualRowSelectedKey]) {\n checked = true\n } else {\n checked = row.isSelected\n }\n\n return [\n props,\n {\n onChange: e => {\n row.toggleRowSelected(e.target.checked)\n },\n style: {\n cursor: 'pointer',\n },\n checked,\n title: 'Toggle Row Selected',\n indeterminate: row.isSomeSelected,\n },\n ]\n}\n\nconst defaultGetToggleAllRowsSelectedProps = (props, { instance }) => [\n props,\n {\n onChange: e => {\n instance.toggleAllRowsSelected(e.target.checked)\n },\n style: {\n cursor: 'pointer',\n },\n checked: instance.isAllRowsSelected,\n title: 'Toggle All Rows Selected',\n indeterminate: Boolean(\n !instance.isAllRowsSelected &&\n Object.keys(instance.state.selectedRowIds).length\n ),\n },\n]\n\nconst defaultGetToggleAllPageRowsSelectedProps = (props, { instance }) => [\n props,\n {\n onChange(e) {\n instance.toggleAllPageRowsSelected(e.target.checked)\n },\n style: {\n cursor: 'pointer',\n },\n checked: instance.isAllPageRowsSelected,\n title: 'Toggle All Current Page Rows Selected',\n indeterminate: Boolean(\n !instance.isAllPageRowsSelected &&\n instance.page.some(({ id }) => instance.state.selectedRowIds[id])\n ),\n },\n]\n\n// eslint-disable-next-line max-params\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n selectedRowIds: {},\n ...state,\n }\n }\n\n if (action.type === actions.resetSelectedRows) {\n return {\n ...state,\n selectedRowIds: instance.initialState.selectedRowIds || {},\n }\n }\n\n if (action.type === actions.toggleAllRowsSelected) {\n const { value: setSelected } = action\n const {\n isAllRowsSelected,\n rowsById,\n nonGroupedRowsById = rowsById,\n } = instance\n\n const selectAll =\n typeof setSelected !== 'undefined' ? setSelected : !isAllRowsSelected\n\n // Only remove/add the rows that are visible on the screen\n // Leave all the other rows that are selected alone.\n const selectedRowIds = Object.assign({}, state.selectedRowIds)\n\n if (selectAll) {\n Object.keys(nonGroupedRowsById).forEach(rowId => {\n selectedRowIds[rowId] = true\n })\n } else {\n Object.keys(nonGroupedRowsById).forEach(rowId => {\n delete selectedRowIds[rowId]\n })\n }\n\n return {\n ...state,\n selectedRowIds,\n }\n }\n\n if (action.type === actions.toggleRowSelected) {\n const { id, value: setSelected } = action\n const { rowsById, selectSubRows = true, getSubRows } = instance\n const isSelected = state.selectedRowIds[id]\n const shouldExist =\n typeof setSelected !== 'undefined' ? setSelected : !isSelected\n\n if (isSelected === shouldExist) {\n return state\n }\n\n const newSelectedRowIds = { ...state.selectedRowIds }\n\n const handleRowById = id => {\n const row = rowsById[id]\n\n if (row) {\n if (!row.isGrouped) {\n if (shouldExist) {\n newSelectedRowIds[id] = true\n } else {\n delete newSelectedRowIds[id]\n }\n }\n\n if (selectSubRows && getSubRows(row)) {\n return getSubRows(row).forEach(row => handleRowById(row.id))\n }\n }\n }\n\n handleRowById(id)\n\n return {\n ...state,\n selectedRowIds: newSelectedRowIds,\n }\n }\n\n if (action.type === actions.toggleAllPageRowsSelected) {\n const { value: setSelected } = action\n const {\n page,\n rowsById,\n selectSubRows = true,\n isAllPageRowsSelected,\n getSubRows,\n } = instance\n\n const selectAll =\n typeof setSelected !== 'undefined' ? setSelected : !isAllPageRowsSelected\n\n const newSelectedRowIds = { ...state.selectedRowIds }\n\n const handleRowById = id => {\n const row = rowsById[id]\n\n if (!row.isGrouped) {\n if (selectAll) {\n newSelectedRowIds[id] = true\n } else {\n delete newSelectedRowIds[id]\n }\n }\n\n if (selectSubRows && getSubRows(row)) {\n return getSubRows(row).forEach(row => handleRowById(row.id))\n }\n }\n\n page.forEach(row => handleRowById(row.id))\n\n return {\n ...state,\n selectedRowIds: newSelectedRowIds,\n }\n }\n return state\n}\n\nfunction useInstance(instance) {\n const {\n data,\n rows,\n getHooks,\n plugins,\n rowsById,\n nonGroupedRowsById = rowsById,\n autoResetSelectedRows = true,\n state: { selectedRowIds },\n selectSubRows = true,\n dispatch,\n page,\n getSubRows,\n } = instance\n\n ensurePluginOrder(\n plugins,\n ['useFilters', 'useGroupBy', 'useSortBy', 'useExpanded', 'usePagination'],\n 'useRowSelect'\n )\n\n const selectedFlatRows = React.useMemo(() => {\n const selectedFlatRows = []\n\n rows.forEach(row => {\n const isSelected = selectSubRows\n ? getRowIsSelected(row, selectedRowIds, getSubRows)\n : !!selectedRowIds[row.id]\n row.isSelected = !!isSelected\n row.isSomeSelected = isSelected === null\n\n if (isSelected) {\n selectedFlatRows.push(row)\n }\n })\n\n return selectedFlatRows\n }, [rows, selectSubRows, selectedRowIds, getSubRows])\n\n let isAllRowsSelected = Boolean(\n Object.keys(nonGroupedRowsById).length && Object.keys(selectedRowIds).length\n )\n\n let isAllPageRowsSelected = isAllRowsSelected\n\n if (isAllRowsSelected) {\n if (Object.keys(nonGroupedRowsById).some(id => !selectedRowIds[id])) {\n isAllRowsSelected = false\n }\n }\n\n if (!isAllRowsSelected) {\n if (page && page.length && page.some(({ id }) => !selectedRowIds[id])) {\n isAllPageRowsSelected = false\n }\n }\n\n const getAutoResetSelectedRows = useGetLatest(autoResetSelectedRows)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetSelectedRows()) {\n dispatch({ type: actions.resetSelectedRows })\n }\n }, [dispatch, data])\n\n const toggleAllRowsSelected = React.useCallback(\n value => dispatch({ type: actions.toggleAllRowsSelected, value }),\n [dispatch]\n )\n\n const toggleAllPageRowsSelected = React.useCallback(\n value => dispatch({ type: actions.toggleAllPageRowsSelected, value }),\n [dispatch]\n )\n\n const toggleRowSelected = React.useCallback(\n (id, value) => dispatch({ type: actions.toggleRowSelected, id, value }),\n [dispatch]\n )\n\n const getInstance = useGetLatest(instance)\n\n const getToggleAllRowsSelectedProps = makePropGetter(\n getHooks().getToggleAllRowsSelectedProps,\n { instance: getInstance() }\n )\n\n const getToggleAllPageRowsSelectedProps = makePropGetter(\n getHooks().getToggleAllPageRowsSelectedProps,\n { instance: getInstance() }\n )\n\n Object.assign(instance, {\n selectedFlatRows,\n isAllRowsSelected,\n isAllPageRowsSelected,\n toggleRowSelected,\n toggleAllRowsSelected,\n getToggleAllRowsSelectedProps,\n getToggleAllPageRowsSelectedProps,\n toggleAllPageRowsSelected,\n })\n}\n\nfunction prepareRow(row, { instance }) {\n row.toggleRowSelected = set => instance.toggleRowSelected(row.id, set)\n\n row.getToggleRowSelectedProps = makePropGetter(\n instance.getHooks().getToggleRowSelectedProps,\n { instance: instance, row }\n )\n}\n\nfunction getRowIsSelected(row, selectedRowIds, getSubRows) {\n if (selectedRowIds[row.id]) {\n return true\n }\n\n const subRows = getSubRows(row)\n\n if (subRows && subRows.length) {\n let allChildrenSelected = true\n let someSelected = false\n\n subRows.forEach(subRow => {\n // Bail out early if we know both of these\n if (someSelected && !allChildrenSelected) {\n return\n }\n\n if (getRowIsSelected(subRow, selectedRowIds, getSubRows)) {\n someSelected = true\n } else {\n allChildrenSelected = false\n }\n })\n return allChildrenSelected ? true : someSelected ? null : false\n }\n\n return false\n}\n","import React from 'react'\n\nimport {\n actions,\n functionalUpdate,\n useMountedLayoutEffect,\n useGetLatest,\n} from '../publicUtils'\n\nconst defaultInitialRowStateAccessor = row => ({})\nconst defaultInitialCellStateAccessor = cell => ({})\n\n// Actions\nactions.setRowState = 'setRowState'\nactions.setCellState = 'setCellState'\nactions.resetRowState = 'resetRowState'\n\nexport const useRowState = hooks => {\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n hooks.prepareRow.push(prepareRow)\n}\n\nuseRowState.pluginName = 'useRowState'\n\nfunction reducer(state, action, previousState, instance) {\n const {\n initialRowStateAccessor = defaultInitialRowStateAccessor,\n initialCellStateAccessor = defaultInitialCellStateAccessor,\n rowsById,\n } = instance\n\n if (action.type === actions.init) {\n return {\n rowState: {},\n ...state,\n }\n }\n\n if (action.type === actions.resetRowState) {\n return {\n ...state,\n rowState: instance.initialState.rowState || {},\n }\n }\n\n if (action.type === actions.setRowState) {\n const { rowId, value } = action\n\n const oldRowState =\n typeof state.rowState[rowId] !== 'undefined'\n ? state.rowState[rowId]\n : initialRowStateAccessor(rowsById[rowId])\n\n return {\n ...state,\n rowState: {\n ...state.rowState,\n [rowId]: functionalUpdate(value, oldRowState),\n },\n }\n }\n\n if (action.type === actions.setCellState) {\n const { rowId, columnId, value } = action\n\n const oldRowState =\n typeof state.rowState[rowId] !== 'undefined'\n ? state.rowState[rowId]\n : initialRowStateAccessor(rowsById[rowId])\n\n const oldCellState =\n typeof oldRowState?.cellState?.[columnId] !== 'undefined'\n ? oldRowState.cellState[columnId]\n : initialCellStateAccessor(\n rowsById[rowId]?.cells?.find(cell => cell.column.id === columnId)\n )\n\n return {\n ...state,\n rowState: {\n ...state.rowState,\n [rowId]: {\n ...oldRowState,\n cellState: {\n ...(oldRowState.cellState || {}),\n [columnId]: functionalUpdate(value, oldCellState),\n },\n },\n },\n }\n }\n}\n\nfunction useInstance(instance) {\n const { autoResetRowState = true, data, dispatch } = instance\n\n const setRowState = React.useCallback(\n (rowId, value) =>\n dispatch({\n type: actions.setRowState,\n rowId,\n value,\n }),\n [dispatch]\n )\n\n const setCellState = React.useCallback(\n (rowId, columnId, value) =>\n dispatch({\n type: actions.setCellState,\n rowId,\n columnId,\n value,\n }),\n [dispatch]\n )\n\n const getAutoResetRowState = useGetLatest(autoResetRowState)\n\n useMountedLayoutEffect(() => {\n if (getAutoResetRowState()) {\n dispatch({ type: actions.resetRowState })\n }\n }, [data])\n\n Object.assign(instance, {\n setRowState,\n setCellState,\n })\n}\n\nfunction prepareRow(row, { instance }) {\n const {\n initialRowStateAccessor = defaultInitialRowStateAccessor,\n initialCellStateAccessor = defaultInitialCellStateAccessor,\n state: { rowState },\n } = instance\n\n if (row) {\n row.state =\n typeof rowState[row.id] !== 'undefined'\n ? rowState[row.id]\n : initialRowStateAccessor(row)\n\n row.setState = updater => {\n return instance.setRowState(row.id, updater)\n }\n\n row.cells.forEach(cell => {\n if (!row.state.cellState) {\n row.state.cellState = {}\n }\n\n cell.state =\n typeof row.state.cellState[cell.column.id] !== 'undefined'\n ? row.state.cellState[cell.column.id]\n : initialCellStateAccessor(cell)\n\n cell.setState = updater => {\n return instance.setCellState(row.id, cell.column.id, updater)\n }\n })\n }\n}\n","import React from 'react'\n\nimport { functionalUpdate, actions } from '../publicUtils'\n\n// Actions\nactions.resetColumnOrder = 'resetColumnOrder'\nactions.setColumnOrder = 'setColumnOrder'\n\nexport const useColumnOrder = hooks => {\n hooks.stateReducers.push(reducer)\n hooks.visibleColumnsDeps.push((deps, { instance }) => {\n return [...deps, instance.state.columnOrder]\n })\n hooks.visibleColumns.push(visibleColumns)\n hooks.useInstance.push(useInstance)\n}\n\nuseColumnOrder.pluginName = 'useColumnOrder'\n\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n columnOrder: [],\n ...state,\n }\n }\n\n if (action.type === actions.resetColumnOrder) {\n return {\n ...state,\n columnOrder: instance.initialState.columnOrder || [],\n }\n }\n\n if (action.type === actions.setColumnOrder) {\n return {\n ...state,\n columnOrder: functionalUpdate(action.columnOrder, state.columnOrder),\n }\n }\n}\n\nfunction visibleColumns(\n columns,\n {\n instance: {\n state: { columnOrder },\n },\n }\n) {\n // If there is no order, return the normal columns\n if (!columnOrder || !columnOrder.length) {\n return columns\n }\n\n const columnOrderCopy = [...columnOrder]\n\n // If there is an order, make a copy of the columns\n const columnsCopy = [...columns]\n\n // And make a new ordered array of the columns\n const columnsInOrder = []\n\n // Loop over the columns and place them in order into the new array\n while (columnsCopy.length && columnOrderCopy.length) {\n const targetColumnId = columnOrderCopy.shift()\n const foundIndex = columnsCopy.findIndex(d => d.id === targetColumnId)\n if (foundIndex > -1) {\n columnsInOrder.push(columnsCopy.splice(foundIndex, 1)[0])\n }\n }\n\n // If there are any columns left, add them to the end\n return [...columnsInOrder, ...columnsCopy]\n}\n\nfunction useInstance(instance) {\n const { dispatch } = instance\n\n instance.setColumnOrder = React.useCallback(\n columnOrder => {\n return dispatch({ type: actions.setColumnOrder, columnOrder })\n },\n [dispatch]\n )\n}\n","import React from 'react'\n\nimport {\n actions,\n defaultColumn,\n makePropGetter,\n useGetLatest,\n ensurePluginOrder,\n useMountedLayoutEffect,\n} from '../publicUtils'\n\nimport { getFirstDefined, passiveEventSupported } from '../utils'\n\n// Default Column\ndefaultColumn.canResize = true\n\n// Actions\nactions.columnStartResizing = 'columnStartResizing'\nactions.columnResizing = 'columnResizing'\nactions.columnDoneResizing = 'columnDoneResizing'\nactions.resetResize = 'resetResize'\n\nexport const useResizeColumns = hooks => {\n hooks.getResizerProps = [defaultGetResizerProps]\n hooks.getHeaderProps.push({\n style: {\n position: 'relative',\n },\n })\n hooks.stateReducers.push(reducer)\n hooks.useInstance.push(useInstance)\n hooks.useInstanceBeforeDimensions.push(useInstanceBeforeDimensions)\n}\n\nconst defaultGetResizerProps = (props, { instance, header }) => {\n const { dispatch } = instance\n\n const onResizeStart = (e, header) => {\n let isTouchEvent = false\n if (e.type === 'touchstart') {\n // lets not respond to multiple touches (e.g. 2 or 3 fingers)\n if (e.touches && e.touches.length > 1) {\n return\n }\n isTouchEvent = true\n }\n const headersToResize = getLeafHeaders(header)\n const headerIdWidths = headersToResize.map(d => [d.id, d.totalWidth])\n\n const clientX = isTouchEvent ? Math.round(e.touches[0].clientX) : e.clientX\n\n let raf\n let mostRecentClientX\n\n const dispatchEnd = () => {\n window.cancelAnimationFrame(raf)\n raf = null\n dispatch({ type: actions.columnDoneResizing })\n }\n const dispatchMove = () => {\n window.cancelAnimationFrame(raf)\n raf = null\n dispatch({ type: actions.columnResizing, clientX: mostRecentClientX })\n }\n\n const scheduleDispatchMoveOnNextAnimationFrame = clientXPos => {\n mostRecentClientX = clientXPos\n if (!raf) {\n raf = window.requestAnimationFrame(dispatchMove)\n }\n }\n\n const handlersAndEvents = {\n mouse: {\n moveEvent: 'mousemove',\n moveHandler: e => scheduleDispatchMoveOnNextAnimationFrame(e.clientX),\n upEvent: 'mouseup',\n upHandler: e => {\n document.removeEventListener(\n 'mousemove',\n handlersAndEvents.mouse.moveHandler\n )\n document.removeEventListener(\n 'mouseup',\n handlersAndEvents.mouse.upHandler\n )\n dispatchEnd()\n },\n },\n touch: {\n moveEvent: 'touchmove',\n moveHandler: e => {\n if (e.cancelable) {\n e.preventDefault()\n e.stopPropagation()\n }\n scheduleDispatchMoveOnNextAnimationFrame(e.touches[0].clientX)\n return false\n },\n upEvent: 'touchend',\n upHandler: e => {\n document.removeEventListener(\n handlersAndEvents.touch.moveEvent,\n handlersAndEvents.touch.moveHandler\n )\n document.removeEventListener(\n handlersAndEvents.touch.upEvent,\n handlersAndEvents.touch.moveHandler\n )\n dispatchEnd()\n },\n },\n }\n\n const events = isTouchEvent\n ? handlersAndEvents.touch\n : handlersAndEvents.mouse\n const passiveIfSupported = passiveEventSupported()\n ? { passive: false }\n : false\n document.addEventListener(\n events.moveEvent,\n events.moveHandler,\n passiveIfSupported\n )\n document.addEventListener(\n events.upEvent,\n events.upHandler,\n passiveIfSupported\n )\n\n dispatch({\n type: actions.columnStartResizing,\n columnId: header.id,\n columnWidth: header.totalWidth,\n headerIdWidths,\n clientX,\n })\n }\n\n return [\n props,\n {\n onMouseDown: e => e.persist() || onResizeStart(e, header),\n onTouchStart: e => e.persist() || onResizeStart(e, header),\n style: {\n cursor: 'col-resize',\n },\n draggable: false,\n role: 'separator',\n },\n ]\n}\n\nuseResizeColumns.pluginName = 'useResizeColumns'\n\nfunction reducer(state, action) {\n if (action.type === actions.init) {\n return {\n columnResizing: {\n columnWidths: {},\n },\n ...state,\n }\n }\n\n if (action.type === actions.resetResize) {\n return {\n ...state,\n columnResizing: {\n columnWidths: {},\n },\n }\n }\n\n if (action.type === actions.columnStartResizing) {\n const { clientX, columnId, columnWidth, headerIdWidths } = action\n\n return {\n ...state,\n columnResizing: {\n ...state.columnResizing,\n startX: clientX,\n headerIdWidths,\n columnWidth,\n isResizingColumn: columnId,\n },\n }\n }\n\n if (action.type === actions.columnResizing) {\n const { clientX } = action\n const { startX, columnWidth, headerIdWidths = [] } = state.columnResizing\n\n const deltaX = clientX - startX\n const percentageDeltaX = deltaX / columnWidth\n\n const newColumnWidths = {}\n\n headerIdWidths.forEach(([headerId, headerWidth]) => {\n newColumnWidths[headerId] = Math.max(\n headerWidth + headerWidth * percentageDeltaX,\n 0\n )\n })\n\n return {\n ...state,\n columnResizing: {\n ...state.columnResizing,\n columnWidths: {\n ...state.columnResizing.columnWidths,\n ...newColumnWidths,\n },\n },\n }\n }\n\n if (action.type === actions.columnDoneResizing) {\n return {\n ...state,\n columnResizing: {\n ...state.columnResizing,\n startX: null,\n isResizingColumn: null,\n },\n }\n }\n}\n\nconst useInstanceBeforeDimensions = instance => {\n const {\n flatHeaders,\n disableResizing,\n getHooks,\n state: { columnResizing },\n } = instance\n\n const getInstance = useGetLatest(instance)\n\n flatHeaders.forEach(header => {\n const canResize = getFirstDefined(\n header.disableResizing === true ? false : undefined,\n disableResizing === true ? false : undefined,\n true\n )\n\n header.canResize = canResize\n header.width =\n columnResizing.columnWidths[header.id] ||\n header.originalWidth ||\n header.width\n header.isResizing = columnResizing.isResizingColumn === header.id\n\n if (canResize) {\n header.getResizerProps = makePropGetter(getHooks().getResizerProps, {\n instance: getInstance(),\n header,\n })\n }\n })\n}\n\nfunction useInstance(instance) {\n const { plugins, dispatch, autoResetResize = true, columns } = instance\n\n ensurePluginOrder(plugins, ['useAbsoluteLayout'], 'useResizeColumns')\n\n const getAutoResetResize = useGetLatest(autoResetResize)\n useMountedLayoutEffect(() => {\n if (getAutoResetResize()) {\n dispatch({ type: actions.resetResize })\n }\n }, [columns])\n\n const resetResizing = React.useCallback(\n () => dispatch({ type: actions.resetResize }),\n [dispatch]\n )\n\n Object.assign(instance, {\n resetResizing,\n })\n}\n\nfunction getLeafHeaders(header) {\n const leafHeaders = []\n const recurseHeader = header => {\n if (header.columns && header.columns.length) {\n header.columns.map(recurseHeader)\n }\n leafHeaders.push(header)\n }\n recurseHeader(header)\n return leafHeaders\n}\n","const cellStyles = {\n position: 'absolute',\n top: 0,\n}\n\nexport const useAbsoluteLayout = hooks => {\n hooks.getTableBodyProps.push(getRowStyles)\n hooks.getRowProps.push(getRowStyles)\n hooks.getHeaderGroupProps.push(getRowStyles)\n hooks.getFooterGroupProps.push(getRowStyles)\n\n hooks.getHeaderProps.push((props, { column }) => [\n props,\n {\n style: {\n ...cellStyles,\n left: `${column.totalLeft}px`,\n width: `${column.totalWidth}px`,\n },\n },\n ])\n\n hooks.getCellProps.push((props, { cell }) => [\n props,\n {\n style: {\n ...cellStyles,\n left: `${cell.column.totalLeft}px`,\n width: `${cell.column.totalWidth}px`,\n },\n },\n ])\n\n hooks.getFooterProps.push((props, { column }) => [\n props,\n {\n style: {\n ...cellStyles,\n left: `${column.totalLeft}px`,\n width: `${column.totalWidth}px`,\n },\n },\n ])\n}\n\nuseAbsoluteLayout.pluginName = 'useAbsoluteLayout'\n\nconst getRowStyles = (props, { instance }) => [\n props,\n {\n style: {\n position: 'relative',\n width: `${instance.totalColumnsWidth}px`,\n },\n },\n]\n","const cellStyles = {\n display: 'inline-block',\n boxSizing: 'border-box',\n}\n\nconst getRowStyles = (props, { instance }) => [\n props,\n {\n style: {\n display: 'flex',\n width: `${instance.totalColumnsWidth}px`,\n },\n },\n]\n\nexport const useBlockLayout = hooks => {\n hooks.getRowProps.push(getRowStyles)\n hooks.getHeaderGroupProps.push(getRowStyles)\n hooks.getFooterGroupProps.push(getRowStyles)\n\n hooks.getHeaderProps.push((props, { column }) => [\n props,\n {\n style: {\n ...cellStyles,\n width: `${column.totalWidth}px`,\n },\n },\n ])\n\n hooks.getCellProps.push((props, { cell }) => [\n props,\n {\n style: {\n ...cellStyles,\n width: `${cell.column.totalWidth}px`,\n },\n },\n ])\n\n hooks.getFooterProps.push((props, { column }) => [\n props,\n {\n style: {\n ...cellStyles,\n width: `${column.totalWidth}px`,\n },\n },\n ])\n}\n\nuseBlockLayout.pluginName = 'useBlockLayout'\n","export function useFlexLayout(hooks) {\n hooks.getTableProps.push(getTableProps)\n hooks.getRowProps.push(getRowStyles)\n hooks.getHeaderGroupProps.push(getRowStyles)\n hooks.getFooterGroupProps.push(getRowStyles)\n hooks.getHeaderProps.push(getHeaderProps)\n hooks.getCellProps.push(getCellProps)\n hooks.getFooterProps.push(getFooterProps)\n}\n\nuseFlexLayout.pluginName = 'useFlexLayout'\n\nconst getTableProps = (props, { instance }) => [\n props,\n {\n style: {\n minWidth: `${instance.totalColumnsMinWidth}px`,\n },\n },\n]\n\nconst getRowStyles = (props, { instance }) => [\n props,\n {\n style: {\n display: 'flex',\n flex: '1 0 auto',\n minWidth: `${instance.totalColumnsMinWidth}px`,\n },\n },\n]\n\nconst getHeaderProps = (props, { column }) => [\n props,\n {\n style: {\n boxSizing: 'border-box',\n flex: column.totalFlexWidth\n ? `${column.totalFlexWidth} 0 auto`\n : undefined,\n minWidth: `${column.totalMinWidth}px`,\n width: `${column.totalWidth}px`,\n },\n },\n]\n\nconst getCellProps = (props, { cell }) => [\n props,\n {\n style: {\n boxSizing: 'border-box',\n flex: `${cell.column.totalFlexWidth} 0 auto`,\n minWidth: `${cell.column.totalMinWidth}px`,\n width: `${cell.column.totalWidth}px`,\n },\n },\n]\n\nconst getFooterProps = (props, { column }) => [\n props,\n {\n style: {\n boxSizing: 'border-box',\n flex: column.totalFlexWidth\n ? `${column.totalFlexWidth} 0 auto`\n : undefined,\n minWidth: `${column.totalMinWidth}px`,\n width: `${column.totalWidth}px`,\n },\n },\n]\n","import { actions } from '../publicUtils'\n\n// Actions\nactions.columnStartResizing = 'columnStartResizing'\nactions.columnResizing = 'columnResizing'\nactions.columnDoneResizing = 'columnDoneResizing'\nactions.resetResize = 'resetResize'\n\nexport function useGridLayout(hooks) {\n hooks.stateReducers.push(reducer)\n hooks.getTableProps.push(getTableProps)\n hooks.getHeaderProps.push(getHeaderProps)\n hooks.getRowProps.push(getRowProps)\n}\n\nuseGridLayout.pluginName = 'useGridLayout'\n\nconst getTableProps = (props, { instance }) => {\n const gridTemplateColumns = instance.visibleColumns.map(column => {\n if (instance.state.gridLayout.columnWidths[column.id])\n return `${instance.state.gridLayout.columnWidths[column.id]}px`\n // When resizing, lock the width of all unset columns\n // instead of using user-provided width or defaultColumn width,\n // which could potentially be 'auto' or 'fr' units that don't scale linearly\n if (instance.state.columnResizing?.isResizingColumn)\n return `${instance.state.gridLayout.startWidths[column.id]}px`\n if (typeof column.width === 'number') return `${column.width}px`\n return column.width\n })\n return [\n props,\n {\n style: {\n display: `grid`,\n gridTemplateColumns: gridTemplateColumns.join(` `),\n },\n },\n ]\n}\n\nconst getHeaderProps = (props, { column }) => [\n props,\n {\n id: `header-cell-${column.id}`,\n style: {\n position: `sticky`, //enables a scroll wrapper to be placed around the table and have sticky headers\n gridColumn: `span ${column.totalVisibleHeaderCount}`,\n },\n },\n]\n\nconst getRowProps = (props, { row }) => {\n if (row.isExpanded) {\n return [\n props,\n {\n style: {\n gridColumn: `1 / ${row.cells.length + 1}`,\n },\n },\n ]\n }\n return [props, {}]\n}\n\nfunction reducer(state, action, previousState, instance) {\n if (action.type === actions.init) {\n return {\n gridLayout: {\n columnWidths: {},\n },\n ...state,\n }\n }\n\n if (action.type === actions.resetResize) {\n return {\n ...state,\n gridLayout: {\n columnWidths: {},\n },\n }\n }\n\n if (action.type === actions.columnStartResizing) {\n const { columnId, headerIdWidths } = action\n const columnWidth = getElementWidth(columnId)\n\n if (columnWidth !== undefined) {\n const startWidths = instance.visibleColumns.reduce(\n (acc, column) => ({\n ...acc,\n [column.id]: getElementWidth(column.id),\n }),\n {}\n )\n const minWidths = instance.visibleColumns.reduce(\n (acc, column) => ({\n ...acc,\n [column.id]: column.minWidth,\n }),\n {}\n )\n const maxWidths = instance.visibleColumns.reduce(\n (acc, column) => ({\n ...acc,\n [column.id]: column.maxWidth,\n }),\n {}\n )\n\n const headerIdGridWidths = headerIdWidths.map(([headerId]) => [\n headerId,\n getElementWidth(headerId),\n ])\n\n return {\n ...state,\n gridLayout: {\n ...state.gridLayout,\n startWidths,\n minWidths,\n maxWidths,\n headerIdGridWidths,\n columnWidth,\n },\n }\n } else {\n return state\n }\n }\n\n if (action.type === actions.columnResizing) {\n const { clientX } = action\n const { startX } = state.columnResizing\n const {\n columnWidth,\n minWidths,\n maxWidths,\n headerIdGridWidths = [],\n } = state.gridLayout\n\n const deltaX = clientX - startX\n const percentageDeltaX = deltaX / columnWidth\n\n const newColumnWidths = {}\n\n headerIdGridWidths.forEach(([headerId, headerWidth]) => {\n newColumnWidths[headerId] = Math.min(\n Math.max(\n minWidths[headerId],\n headerWidth + headerWidth * percentageDeltaX\n ),\n maxWidths[headerId]\n )\n })\n\n return {\n ...state,\n gridLayout: {\n ...state.gridLayout,\n columnWidths: {\n ...state.gridLayout.columnWidths,\n ...newColumnWidths,\n },\n },\n }\n }\n\n if (action.type === actions.columnDoneResizing) {\n return {\n ...state,\n gridLayout: {\n ...state.gridLayout,\n startWidths: {},\n minWidths: {},\n maxWidths: {},\n },\n }\n }\n}\n\nfunction getElementWidth(columnId) {\n const width = document.getElementById(`header-cell-${columnId}`)?.offsetWidth\n\n if (width !== undefined) {\n return width\n }\n}\n","'use strict';\n\nvar keysShim;\nif (!Object.keys) {\n\t// modified from https://github.com/es-shims/es5-shim\n\tvar has = Object.prototype.hasOwnProperty;\n\tvar toStr = Object.prototype.toString;\n\tvar isArgs = require('./isArguments'); // eslint-disable-line global-require\n\tvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\tvar hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');\n\tvar hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');\n\tvar dontEnums = [\n\t\t'toString',\n\t\t'toLocaleString',\n\t\t'valueOf',\n\t\t'hasOwnProperty',\n\t\t'isPrototypeOf',\n\t\t'propertyIsEnumerable',\n\t\t'constructor'\n\t];\n\tvar equalsConstructorPrototype = function (o) {\n\t\tvar ctor = o.constructor;\n\t\treturn ctor && ctor.prototype === o;\n\t};\n\tvar excludedKeys = {\n\t\t$applicationCache: true,\n\t\t$console: true,\n\t\t$external: true,\n\t\t$frame: true,\n\t\t$frameElement: true,\n\t\t$frames: true,\n\t\t$innerHeight: true,\n\t\t$innerWidth: true,\n\t\t$onmozfullscreenchange: true,\n\t\t$onmozfullscreenerror: true,\n\t\t$outerHeight: true,\n\t\t$outerWidth: true,\n\t\t$pageXOffset: true,\n\t\t$pageYOffset: true,\n\t\t$parent: true,\n\t\t$scrollLeft: true,\n\t\t$scrollTop: true,\n\t\t$scrollX: true,\n\t\t$scrollY: true,\n\t\t$self: true,\n\t\t$webkitIndexedDB: true,\n\t\t$webkitStorageInfo: true,\n\t\t$window: true\n\t};\n\tvar hasAutomationEqualityBug = (function () {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined') { return false; }\n\t\tfor (var k in window) {\n\t\t\ttry {\n\t\t\t\tif (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tequalsConstructorPrototype(window[k]);\n\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (e) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}());\n\tvar equalsConstructorPrototypeIfNotBuggy = function (o) {\n\t\t/* global window */\n\t\tif (typeof window === 'undefined' || !hasAutomationEqualityBug) {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t}\n\t\ttry {\n\t\t\treturn equalsConstructorPrototype(o);\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t}\n\t};\n\n\tkeysShim = function keys(object) {\n\t\tvar isObject = object !== null && typeof object === 'object';\n\t\tvar isFunction = toStr.call(object) === '[object Function]';\n\t\tvar isArguments = isArgs(object);\n\t\tvar isString = isObject && toStr.call(object) === '[object String]';\n\t\tvar theKeys = [];\n\n\t\tif (!isObject && !isFunction && !isArguments) {\n\t\t\tthrow new TypeError('Object.keys called on a non-object');\n\t\t}\n\n\t\tvar skipProto = hasProtoEnumBug && isFunction;\n\t\tif (isString && object.length > 0 && !has.call(object, 0)) {\n\t\t\tfor (var i = 0; i < object.length; ++i) {\n\t\t\t\ttheKeys.push(String(i));\n\t\t\t}\n\t\t}\n\n\t\tif (isArguments && object.length > 0) {\n\t\t\tfor (var j = 0; j < object.length; ++j) {\n\t\t\t\ttheKeys.push(String(j));\n\t\t\t}\n\t\t} else {\n\t\t\tfor (var name in object) {\n\t\t\t\tif (!(skipProto && name === 'prototype') && has.call(object, name)) {\n\t\t\t\t\ttheKeys.push(String(name));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (hasDontEnumBug) {\n\t\t\tvar skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);\n\n\t\t\tfor (var k = 0; k < dontEnums.length; ++k) {\n\t\t\t\tif (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {\n\t\t\t\t\ttheKeys.push(dontEnums[k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn theKeys;\n\t};\n}\nmodule.exports = keysShim;\n","'use strict';\n\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\nvar toStr = Object.prototype.toString;\n\nvar isStandardArguments = function isArguments(value) {\n\tif (hasToStringTag && value && typeof value === 'object' && Symbol.toStringTag in value) {\n\t\treturn false;\n\t}\n\treturn toStr.call(value) === '[object Arguments]';\n};\n\nvar isLegacyArguments = function isArguments(value) {\n\tif (isStandardArguments(value)) {\n\t\treturn true;\n\t}\n\treturn value !== null &&\n\t\ttypeof value === 'object' &&\n\t\ttypeof value.length === 'number' &&\n\t\tvalue.length >= 0 &&\n\t\ttoStr.call(value) !== '[object Array]' &&\n\t\ttoStr.call(value.callee) === '[object Function]';\n};\n\nvar supportsStandardArguments = (function () {\n\treturn isStandardArguments(arguments);\n}());\n\nisStandardArguments.isLegacyArguments = isLegacyArguments; // for tests\n\nmodule.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;\n","\"use strict\";\n\n/* https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.is */\n\nvar NumberIsNaN = function (value) {\n\treturn value !== value;\n};\n\nmodule.exports = function is(a, b) {\n\tif (a === 0 && b === 0) {\n\t\treturn 1 / a === 1 / b;\n\t} else if (a === b) {\n\t\treturn true;\n\t} else if (NumberIsNaN(a) && NumberIsNaN(b)) {\n\t\treturn true;\n\t}\n\treturn false;\n};\n\n","'use strict';\n\nvar has = require('has');\nvar regexExec = RegExp.prototype.exec;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar tryRegexExecCall = function tryRegexExec(value) {\n\ttry {\n\t\tvar lastIndex = value.lastIndex;\n\t\tvalue.lastIndex = 0;\n\n\t\tregexExec.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t} finally {\n\t\tvalue.lastIndex = lastIndex;\n\t}\n};\nvar toStr = Object.prototype.toString;\nvar regexClass = '[object RegExp]';\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\n\nmodule.exports = function isRegex(value) {\n\tif (!value || typeof value !== 'object') {\n\t\treturn false;\n\t}\n\tif (!hasToStringTag) {\n\t\treturn toStr.call(value) === regexClass;\n\t}\n\n\tvar descriptor = gOPD(value, 'lastIndex');\n\tvar hasLastIndexDataProperty = descriptor && has(descriptor, 'value');\n\tif (!hasLastIndexDataProperty) {\n\t\treturn false;\n\t}\n\n\treturn tryRegexExecCall(value);\n};\n","'use strict';\n\n/* eslint no-invalid-this: 1 */\n\nvar ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';\nvar slice = Array.prototype.slice;\nvar toStr = Object.prototype.toString;\nvar funcType = '[object Function]';\n\nmodule.exports = function bind(that) {\n var target = this;\n if (typeof target !== 'function' || toStr.call(target) !== funcType) {\n throw new TypeError(ERROR_MESSAGE + target);\n }\n var args = slice.call(arguments, 1);\n\n var bound;\n var binder = function () {\n if (this instanceof bound) {\n var result = target.apply(\n this,\n args.concat(slice.call(arguments))\n );\n if (Object(result) === result) {\n return result;\n }\n return this;\n } else {\n return target.apply(\n that,\n args.concat(slice.call(arguments))\n );\n }\n };\n\n var boundLength = Math.max(0, target.length - args.length);\n var boundArgs = [];\n for (var i = 0; i < boundLength; i++) {\n boundArgs.push('$' + i);\n }\n\n bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);\n\n if (target.prototype) {\n var Empty = function Empty() {};\n Empty.prototype = target.prototype;\n bound.prototype = new Empty();\n Empty.prototype = null;\n }\n\n return bound;\n};\n","'use strict';\n\nvar define = require('define-properties');\n\nvar implementation = require('./implementation');\nvar getPolyfill = require('./polyfill');\nvar shim = require('./shim');\n\nvar flagsBound = Function.call.bind(implementation);\n\ndefine(flagsBound, {\n\tgetPolyfill: getPolyfill,\n\timplementation: implementation,\n\tshim: shim\n});\n\nmodule.exports = flagsBound;\n","'use strict';\n\nvar supportsDescriptors = require('define-properties').supportsDescriptors;\nvar getPolyfill = require('./polyfill');\nvar gOPD = Object.getOwnPropertyDescriptor;\nvar defineProperty = Object.defineProperty;\nvar TypeErr = TypeError;\nvar getProto = Object.getPrototypeOf;\nvar regex = /a/;\n\nmodule.exports = function shimFlags() {\n\tif (!supportsDescriptors || !getProto) {\n\t\tthrow new TypeErr('RegExp.prototype.flags requires a true ES5 environment that supports property descriptors');\n\t}\n\tvar polyfill = getPolyfill();\n\tvar proto = getProto(regex);\n\tvar descriptor = gOPD(proto, 'flags');\n\tif (!descriptor || descriptor.get !== polyfill) {\n\t\tdefineProperty(proto, 'flags', {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tget: polyfill\n\t\t});\n\t}\n\treturn polyfill;\n};\n","'use strict';\n\nvar getDay = Date.prototype.getDay;\nvar tryDateObject = function tryDateObject(value) {\n\ttry {\n\t\tgetDay.call(value);\n\t\treturn true;\n\t} catch (e) {\n\t\treturn false;\n\t}\n};\n\nvar toStr = Object.prototype.toString;\nvar dateClass = '[object Date]';\nvar hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';\n\nmodule.exports = function isDateObject(value) {\n\tif (typeof value !== 'object' || value === null) { return false; }\n\treturn hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;\n};\n","'use strict';\n\nvar getSideChannel = require('side-channel');\nvar utils = require('./utils');\nvar formats = require('./formats');\nvar has = Object.prototype.hasOwnProperty;\n\nvar arrayPrefixGenerators = {\n brackets: function brackets(prefix) {\n return prefix + '[]';\n },\n comma: 'comma',\n indices: function indices(prefix, key) {\n return prefix + '[' + key + ']';\n },\n repeat: function repeat(prefix) {\n return prefix;\n }\n};\n\nvar isArray = Array.isArray;\nvar split = String.prototype.split;\nvar push = Array.prototype.push;\nvar pushToArray = function (arr, valueOrArray) {\n push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]);\n};\n\nvar toISO = Date.prototype.toISOString;\n\nvar defaultFormat = formats['default'];\nvar defaults = {\n addQueryPrefix: false,\n allowDots: false,\n charset: 'utf-8',\n charsetSentinel: false,\n delimiter: '&',\n encode: true,\n encoder: utils.encode,\n encodeValuesOnly: false,\n format: defaultFormat,\n formatter: formats.formatters[defaultFormat],\n // deprecated\n indices: false,\n serializeDate: function serializeDate(date) {\n return toISO.call(date);\n },\n skipNulls: false,\n strictNullHandling: false\n};\n\nvar isNonNullishPrimitive = function isNonNullishPrimitive(v) {\n return typeof v === 'string'\n || typeof v === 'number'\n || typeof v === 'boolean'\n || typeof v === 'symbol'\n || typeof v === 'bigint';\n};\n\nvar sentinel = {};\n\nvar stringify = function stringify(\n object,\n prefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n format,\n formatter,\n encodeValuesOnly,\n charset,\n sideChannel\n) {\n var obj = object;\n\n var tmpSc = sideChannel;\n var step = 0;\n var findFlag = false;\n while ((tmpSc = tmpSc.get(sentinel)) !== void undefined && !findFlag) {\n // Where object last appeared in the ref tree\n var pos = tmpSc.get(object);\n step += 1;\n if (typeof pos !== 'undefined') {\n if (pos === step) {\n throw new RangeError('Cyclic object value');\n } else {\n findFlag = true; // Break while\n }\n }\n if (typeof tmpSc.get(sentinel) === 'undefined') {\n step = 0;\n }\n }\n\n if (typeof filter === 'function') {\n obj = filter(prefix, obj);\n } else if (obj instanceof Date) {\n obj = serializeDate(obj);\n } else if (generateArrayPrefix === 'comma' && isArray(obj)) {\n obj = utils.maybeMap(obj, function (value) {\n if (value instanceof Date) {\n return serializeDate(value);\n }\n return value;\n });\n }\n\n if (obj === null) {\n if (strictNullHandling) {\n return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key', format) : prefix;\n }\n\n obj = '';\n }\n\n if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) {\n if (encoder) {\n var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key', format);\n if (generateArrayPrefix === 'comma' && encodeValuesOnly) {\n var valuesArray = split.call(String(obj), ',');\n var valuesJoined = '';\n for (var i = 0; i < valuesArray.length; ++i) {\n valuesJoined += (i === 0 ? '' : ',') + formatter(encoder(valuesArray[i], defaults.encoder, charset, 'value', format));\n }\n return [formatter(keyValue) + (isArray(obj) && valuesArray.length === 1 ? '[]' : '') + '=' + valuesJoined];\n }\n return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value', format))];\n }\n return [formatter(prefix) + '=' + formatter(String(obj))];\n }\n\n var values = [];\n\n if (typeof obj === 'undefined') {\n return values;\n }\n\n var objKeys;\n if (generateArrayPrefix === 'comma' && isArray(obj)) {\n // we need to join elements in\n objKeys = [{ value: obj.length > 0 ? obj.join(',') || null : void undefined }];\n } else if (isArray(filter)) {\n objKeys = filter;\n } else {\n var keys = Object.keys(obj);\n objKeys = sort ? keys.sort(sort) : keys;\n }\n\n var adjustedPrefix = generateArrayPrefix === 'comma' && isArray(obj) && obj.length === 1 ? prefix + '[]' : prefix;\n\n for (var j = 0; j < objKeys.length; ++j) {\n var key = objKeys[j];\n var value = typeof key === 'object' && typeof key.value !== 'undefined' ? key.value : obj[key];\n\n if (skipNulls && value === null) {\n continue;\n }\n\n var keyPrefix = isArray(obj)\n ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(adjustedPrefix, key) : adjustedPrefix\n : adjustedPrefix + (allowDots ? '.' + key : '[' + key + ']');\n\n sideChannel.set(object, step);\n var valueSideChannel = getSideChannel();\n valueSideChannel.set(sentinel, sideChannel);\n pushToArray(values, stringify(\n value,\n keyPrefix,\n generateArrayPrefix,\n strictNullHandling,\n skipNulls,\n encoder,\n filter,\n sort,\n allowDots,\n serializeDate,\n format,\n formatter,\n encodeValuesOnly,\n charset,\n valueSideChannel\n ));\n }\n\n return values;\n};\n\nvar normalizeStringifyOptions = function normalizeStringifyOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (opts.encoder !== null && typeof opts.encoder !== 'undefined' && typeof opts.encoder !== 'function') {\n throw new TypeError('Encoder has to be a function.');\n }\n\n var charset = opts.charset || defaults.charset;\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n\n var format = formats['default'];\n if (typeof opts.format !== 'undefined') {\n if (!has.call(formats.formatters, opts.format)) {\n throw new TypeError('Unknown format option provided.');\n }\n format = opts.format;\n }\n var formatter = formats.formatters[format];\n\n var filter = defaults.filter;\n if (typeof opts.filter === 'function' || isArray(opts.filter)) {\n filter = opts.filter;\n }\n\n return {\n addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix,\n allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter,\n encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode,\n encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder,\n encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly,\n filter: filter,\n format: format,\n formatter: formatter,\n serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate,\n skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls,\n sort: typeof opts.sort === 'function' ? opts.sort : null,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (object, opts) {\n var obj = object;\n var options = normalizeStringifyOptions(opts);\n\n var objKeys;\n var filter;\n\n if (typeof options.filter === 'function') {\n filter = options.filter;\n obj = filter('', obj);\n } else if (isArray(options.filter)) {\n filter = options.filter;\n objKeys = filter;\n }\n\n var keys = [];\n\n if (typeof obj !== 'object' || obj === null) {\n return '';\n }\n\n var arrayFormat;\n if (opts && opts.arrayFormat in arrayPrefixGenerators) {\n arrayFormat = opts.arrayFormat;\n } else if (opts && 'indices' in opts) {\n arrayFormat = opts.indices ? 'indices' : 'repeat';\n } else {\n arrayFormat = 'indices';\n }\n\n var generateArrayPrefix = arrayPrefixGenerators[arrayFormat];\n\n if (!objKeys) {\n objKeys = Object.keys(obj);\n }\n\n if (options.sort) {\n objKeys.sort(options.sort);\n }\n\n var sideChannel = getSideChannel();\n for (var i = 0; i < objKeys.length; ++i) {\n var key = objKeys[i];\n\n if (options.skipNulls && obj[key] === null) {\n continue;\n }\n pushToArray(keys, stringify(\n obj[key],\n key,\n generateArrayPrefix,\n options.strictNullHandling,\n options.skipNulls,\n options.encode ? options.encoder : null,\n options.filter,\n options.sort,\n options.allowDots,\n options.serializeDate,\n options.format,\n options.formatter,\n options.encodeValuesOnly,\n options.charset,\n sideChannel\n ));\n }\n\n var joined = keys.join(options.delimiter);\n var prefix = options.addQueryPrefix === true ? '?' : '';\n\n if (options.charsetSentinel) {\n if (options.charset === 'iso-8859-1') {\n // encodeURIComponent('✓'), the \"numeric entity\" representation of a checkmark\n prefix += 'utf8=%26%2310003%3B&';\n } else {\n // encodeURIComponent('✓')\n prefix += 'utf8=%E2%9C%93&';\n }\n }\n\n return joined.length > 0 ? prefix + joined : '';\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\nvar callBound = require('call-bind/callBound');\nvar inspect = require('object-inspect');\n\nvar $TypeError = GetIntrinsic('%TypeError%');\nvar $WeakMap = GetIntrinsic('%WeakMap%', true);\nvar $Map = GetIntrinsic('%Map%', true);\n\nvar $weakMapGet = callBound('WeakMap.prototype.get', true);\nvar $weakMapSet = callBound('WeakMap.prototype.set', true);\nvar $weakMapHas = callBound('WeakMap.prototype.has', true);\nvar $mapGet = callBound('Map.prototype.get', true);\nvar $mapSet = callBound('Map.prototype.set', true);\nvar $mapHas = callBound('Map.prototype.has', true);\n\n/*\n * This function traverses the list returning the node corresponding to the\n * given key.\n *\n * That node is also moved to the head of the list, so that if it's accessed\n * again we don't need to traverse the whole list. By doing so, all the recently\n * used nodes can be accessed relatively quickly.\n */\nvar listGetNode = function (list, key) { // eslint-disable-line consistent-return\n\tfor (var prev = list, curr; (curr = prev.next) !== null; prev = curr) {\n\t\tif (curr.key === key) {\n\t\t\tprev.next = curr.next;\n\t\t\tcurr.next = list.next;\n\t\t\tlist.next = curr; // eslint-disable-line no-param-reassign\n\t\t\treturn curr;\n\t\t}\n\t}\n};\n\nvar listGet = function (objects, key) {\n\tvar node = listGetNode(objects, key);\n\treturn node && node.value;\n};\nvar listSet = function (objects, key, value) {\n\tvar node = listGetNode(objects, key);\n\tif (node) {\n\t\tnode.value = value;\n\t} else {\n\t\t// Prepend the new node to the beginning of the list\n\t\tobjects.next = { // eslint-disable-line no-param-reassign\n\t\t\tkey: key,\n\t\t\tnext: objects.next,\n\t\t\tvalue: value\n\t\t};\n\t}\n};\nvar listHas = function (objects, key) {\n\treturn !!listGetNode(objects, key);\n};\n\nmodule.exports = function getSideChannel() {\n\tvar $wm;\n\tvar $m;\n\tvar $o;\n\tvar channel = {\n\t\tassert: function (key) {\n\t\t\tif (!channel.has(key)) {\n\t\t\t\tthrow new $TypeError('Side channel does not contain ' + inspect(key));\n\t\t\t}\n\t\t},\n\t\tget: function (key) { // eslint-disable-line consistent-return\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapGet($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapGet($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listGet($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\thas: function (key) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif ($wm) {\n\t\t\t\t\treturn $weakMapHas($wm, key);\n\t\t\t\t}\n\t\t\t} else if ($Map) {\n\t\t\t\tif ($m) {\n\t\t\t\t\treturn $mapHas($m, key);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ($o) { // eslint-disable-line no-lonely-if\n\t\t\t\t\treturn listHas($o, key);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\tset: function (key, value) {\n\t\t\tif ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {\n\t\t\t\tif (!$wm) {\n\t\t\t\t\t$wm = new $WeakMap();\n\t\t\t\t}\n\t\t\t\t$weakMapSet($wm, key, value);\n\t\t\t} else if ($Map) {\n\t\t\t\tif (!$m) {\n\t\t\t\t\t$m = new $Map();\n\t\t\t\t}\n\t\t\t\t$mapSet($m, key, value);\n\t\t\t} else {\n\t\t\t\tif (!$o) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Initialize the linked list as an empty node, so that we don't have\n\t\t\t\t\t * to special-case handling of the first node: we can always refer to\n\t\t\t\t\t * it as (previous node).next, instead of something like (list).head\n\t\t\t\t\t */\n\t\t\t\t\t$o = { key: {}, next: null };\n\t\t\t\t}\n\t\t\t\tlistSet($o, key, value);\n\t\t\t}\n\t\t}\n\t};\n\treturn channel;\n};\n","'use strict';\n\nvar origSymbol = typeof Symbol !== 'undefined' && Symbol;\nvar hasSymbolSham = require('./shams');\n\nmodule.exports = function hasNativeSymbols() {\n\tif (typeof origSymbol !== 'function') { return false; }\n\tif (typeof Symbol !== 'function') { return false; }\n\tif (typeof origSymbol('foo') !== 'symbol') { return false; }\n\tif (typeof Symbol('bar') !== 'symbol') { return false; }\n\n\treturn hasSymbolSham();\n};\n","'use strict';\n\n/* eslint complexity: [2, 18], max-statements: [2, 33] */\nmodule.exports = function hasSymbols() {\n\tif (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }\n\tif (typeof Symbol.iterator === 'symbol') { return true; }\n\n\tvar obj = {};\n\tvar sym = Symbol('test');\n\tvar symObj = Object(sym);\n\tif (typeof sym === 'string') { return false; }\n\n\tif (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }\n\tif (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }\n\n\t// temp disabled per https://github.com/ljharb/object.assign/issues/17\n\t// if (sym instanceof Symbol) { return false; }\n\t// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4\n\t// if (!(symObj instanceof Symbol)) { return false; }\n\n\t// if (typeof Symbol.prototype.toString !== 'function') { return false; }\n\t// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }\n\n\tvar symVal = 42;\n\tobj[sym] = symVal;\n\tfor (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop\n\tif (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }\n\n\tif (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }\n\n\tvar syms = Object.getOwnPropertySymbols(obj);\n\tif (syms.length !== 1 || syms[0] !== sym) { return false; }\n\n\tif (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }\n\n\tif (typeof Object.getOwnPropertyDescriptor === 'function') {\n\t\tvar descriptor = Object.getOwnPropertyDescriptor(obj, sym);\n\t\tif (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }\n\t}\n\n\treturn true;\n};\n","'use strict';\n\nvar GetIntrinsic = require('get-intrinsic');\n\nvar callBind = require('./');\n\nvar $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));\n\nmodule.exports = function callBoundIntrinsic(name, allowMissing) {\n\tvar intrinsic = GetIntrinsic(name, !!allowMissing);\n\tif (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {\n\t\treturn callBind(intrinsic);\n\t}\n\treturn intrinsic;\n};\n","'use strict';\n\nvar bind = require('function-bind');\nvar GetIntrinsic = require('get-intrinsic');\n\nvar $apply = GetIntrinsic('%Function.prototype.apply%');\nvar $call = GetIntrinsic('%Function.prototype.call%');\nvar $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);\n\nvar $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);\nvar $defineProperty = GetIntrinsic('%Object.defineProperty%', true);\nvar $max = GetIntrinsic('%Math.max%');\n\nif ($defineProperty) {\n\ttry {\n\t\t$defineProperty({}, 'a', { value: 1 });\n\t} catch (e) {\n\t\t// IE 8 has a broken defineProperty\n\t\t$defineProperty = null;\n\t}\n}\n\nmodule.exports = function callBind(originalFunction) {\n\tvar func = $reflectApply(bind, $call, arguments);\n\tif ($gOPD && $defineProperty) {\n\t\tvar desc = $gOPD(func, 'length');\n\t\tif (desc.configurable) {\n\t\t\t// original length, plus the receiver, minus any additional arguments (after the receiver)\n\t\t\t$defineProperty(\n\t\t\t\tfunc,\n\t\t\t\t'length',\n\t\t\t\t{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }\n\t\t\t);\n\t\t}\n\t}\n\treturn func;\n};\n\nvar applyBind = function applyBind() {\n\treturn $reflectApply(bind, $apply, arguments);\n};\n\nif ($defineProperty) {\n\t$defineProperty(module.exports, 'apply', { value: applyBind });\n} else {\n\tmodule.exports.apply = applyBind;\n}\n","var hasMap = typeof Map === 'function' && Map.prototype;\nvar mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;\nvar mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;\nvar mapForEach = hasMap && Map.prototype.forEach;\nvar hasSet = typeof Set === 'function' && Set.prototype;\nvar setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;\nvar setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;\nvar setForEach = hasSet && Set.prototype.forEach;\nvar hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;\nvar weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;\nvar hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;\nvar weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;\nvar hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;\nvar weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;\nvar booleanValueOf = Boolean.prototype.valueOf;\nvar objectToString = Object.prototype.toString;\nvar functionToString = Function.prototype.toString;\nvar $match = String.prototype.match;\nvar $slice = String.prototype.slice;\nvar $replace = String.prototype.replace;\nvar $toUpperCase = String.prototype.toUpperCase;\nvar $toLowerCase = String.prototype.toLowerCase;\nvar $test = RegExp.prototype.test;\nvar $concat = Array.prototype.concat;\nvar $join = Array.prototype.join;\nvar $arrSlice = Array.prototype.slice;\nvar $floor = Math.floor;\nvar bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;\nvar gOPS = Object.getOwnPropertySymbols;\nvar symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;\nvar hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';\n// ie, `has-tostringtag/shams\nvar toStringTag = typeof Symbol === 'function' && Symbol.toStringTag && (typeof Symbol.toStringTag === hasShammedSymbols ? 'object' : 'symbol')\n ? Symbol.toStringTag\n : null;\nvar isEnumerable = Object.prototype.propertyIsEnumerable;\n\nvar gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (\n [].__proto__ === Array.prototype // eslint-disable-line no-proto\n ? function (O) {\n return O.__proto__; // eslint-disable-line no-proto\n }\n : null\n);\n\nfunction addNumericSeparator(num, str) {\n if (\n num === Infinity\n || num === -Infinity\n || num !== num\n || (num && num > -1000 && num < 1000)\n || $test.call(/e/, str)\n ) {\n return str;\n }\n var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;\n if (typeof num === 'number') {\n var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)\n if (int !== num) {\n var intStr = String(int);\n var dec = $slice.call(str, intStr.length + 1);\n return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');\n }\n }\n return $replace.call(str, sepRegex, '$&_');\n}\n\nvar utilInspect = require('./util.inspect');\nvar inspectCustom = utilInspect.custom;\nvar inspectSymbol = isSymbol(inspectCustom) ? inspectCustom : null;\n\nmodule.exports = function inspect_(obj, options, depth, seen) {\n var opts = options || {};\n\n if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {\n throw new TypeError('option \"quoteStyle\" must be \"single\" or \"double\"');\n }\n if (\n has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'\n ? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity\n : opts.maxStringLength !== null\n )\n ) {\n throw new TypeError('option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`');\n }\n var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;\n if (typeof customInspect !== 'boolean' && customInspect !== 'symbol') {\n throw new TypeError('option \"customInspect\", if provided, must be `true`, `false`, or `\\'symbol\\'`');\n }\n\n if (\n has(opts, 'indent')\n && opts.indent !== null\n && opts.indent !== '\\t'\n && !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)\n ) {\n throw new TypeError('option \"indent\" must be \"\\\\t\", an integer > 0, or `null`');\n }\n if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {\n throw new TypeError('option \"numericSeparator\", if provided, must be `true` or `false`');\n }\n var numericSeparator = opts.numericSeparator;\n\n if (typeof obj === 'undefined') {\n return 'undefined';\n }\n if (obj === null) {\n return 'null';\n }\n if (typeof obj === 'boolean') {\n return obj ? 'true' : 'false';\n }\n\n if (typeof obj === 'string') {\n return inspectString(obj, opts);\n }\n if (typeof obj === 'number') {\n if (obj === 0) {\n return Infinity / obj > 0 ? '0' : '-0';\n }\n var str = String(obj);\n return numericSeparator ? addNumericSeparator(obj, str) : str;\n }\n if (typeof obj === 'bigint') {\n var bigIntStr = String(obj) + 'n';\n return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;\n }\n\n var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;\n if (typeof depth === 'undefined') { depth = 0; }\n if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {\n return isArray(obj) ? '[Array]' : '[Object]';\n }\n\n var indent = getIndent(opts, depth);\n\n if (typeof seen === 'undefined') {\n seen = [];\n } else if (indexOf(seen, obj) >= 0) {\n return '[Circular]';\n }\n\n function inspect(value, from, noIndent) {\n if (from) {\n seen = $arrSlice.call(seen);\n seen.push(from);\n }\n if (noIndent) {\n var newOpts = {\n depth: opts.depth\n };\n if (has(opts, 'quoteStyle')) {\n newOpts.quoteStyle = opts.quoteStyle;\n }\n return inspect_(value, newOpts, depth + 1, seen);\n }\n return inspect_(value, opts, depth + 1, seen);\n }\n\n if (typeof obj === 'function' && !isRegExp(obj)) { // in older engines, regexes are callable\n var name = nameOf(obj);\n var keys = arrObjKeys(obj, inspect);\n return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');\n }\n if (isSymbol(obj)) {\n var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\\(.*\\))_[^)]*$/, '$1') : symToString.call(obj);\n return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;\n }\n if (isElement(obj)) {\n var s = '<' + $toLowerCase.call(String(obj.nodeName));\n var attrs = obj.attributes || [];\n for (var i = 0; i < attrs.length; i++) {\n s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);\n }\n s += '>';\n if (obj.childNodes && obj.childNodes.length) { s += '...'; }\n s += '';\n return s;\n }\n if (isArray(obj)) {\n if (obj.length === 0) { return '[]'; }\n var xs = arrObjKeys(obj, inspect);\n if (indent && !singleLineValues(xs)) {\n return '[' + indentedJoin(xs, indent) + ']';\n }\n return '[ ' + $join.call(xs, ', ') + ' ]';\n }\n if (isError(obj)) {\n var parts = arrObjKeys(obj, inspect);\n if (!('cause' in Error.prototype) && 'cause' in obj && !isEnumerable.call(obj, 'cause')) {\n return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';\n }\n if (parts.length === 0) { return '[' + String(obj) + ']'; }\n return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';\n }\n if (typeof obj === 'object' && customInspect) {\n if (inspectSymbol && typeof obj[inspectSymbol] === 'function' && utilInspect) {\n return utilInspect(obj, { depth: maxDepth - depth });\n } else if (customInspect !== 'symbol' && typeof obj.inspect === 'function') {\n return obj.inspect();\n }\n }\n if (isMap(obj)) {\n var mapParts = [];\n mapForEach.call(obj, function (value, key) {\n mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));\n });\n return collectionOf('Map', mapSize.call(obj), mapParts, indent);\n }\n if (isSet(obj)) {\n var setParts = [];\n setForEach.call(obj, function (value) {\n setParts.push(inspect(value, obj));\n });\n return collectionOf('Set', setSize.call(obj), setParts, indent);\n }\n if (isWeakMap(obj)) {\n return weakCollectionOf('WeakMap');\n }\n if (isWeakSet(obj)) {\n return weakCollectionOf('WeakSet');\n }\n if (isWeakRef(obj)) {\n return weakCollectionOf('WeakRef');\n }\n if (isNumber(obj)) {\n return markBoxed(inspect(Number(obj)));\n }\n if (isBigInt(obj)) {\n return markBoxed(inspect(bigIntValueOf.call(obj)));\n }\n if (isBoolean(obj)) {\n return markBoxed(booleanValueOf.call(obj));\n }\n if (isString(obj)) {\n return markBoxed(inspect(String(obj)));\n }\n if (!isDate(obj) && !isRegExp(obj)) {\n var ys = arrObjKeys(obj, inspect);\n var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;\n var protoTag = obj instanceof Object ? '' : 'null prototype';\n var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';\n var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';\n var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');\n if (ys.length === 0) { return tag + '{}'; }\n if (indent) {\n return tag + '{' + indentedJoin(ys, indent) + '}';\n }\n return tag + '{ ' + $join.call(ys, ', ') + ' }';\n }\n return String(obj);\n};\n\nfunction wrapQuotes(s, defaultStyle, opts) {\n var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '\"' : \"'\";\n return quoteChar + s + quoteChar;\n}\n\nfunction quote(s) {\n return $replace.call(String(s), /\"/g, '"');\n}\n\nfunction isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\nfunction isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }\n\n// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives\nfunction isSymbol(obj) {\n if (hasShammedSymbols) {\n return obj && typeof obj === 'object' && obj instanceof Symbol;\n }\n if (typeof obj === 'symbol') {\n return true;\n }\n if (!obj || typeof obj !== 'object' || !symToString) {\n return false;\n }\n try {\n symToString.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isBigInt(obj) {\n if (!obj || typeof obj !== 'object' || !bigIntValueOf) {\n return false;\n }\n try {\n bigIntValueOf.call(obj);\n return true;\n } catch (e) {}\n return false;\n}\n\nvar hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };\nfunction has(obj, key) {\n return hasOwn.call(obj, key);\n}\n\nfunction toStr(obj) {\n return objectToString.call(obj);\n}\n\nfunction nameOf(f) {\n if (f.name) { return f.name; }\n var m = $match.call(functionToString.call(f), /^function\\s*([\\w$]+)/);\n if (m) { return m[1]; }\n return null;\n}\n\nfunction indexOf(xs, x) {\n if (xs.indexOf) { return xs.indexOf(x); }\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) { return i; }\n }\n return -1;\n}\n\nfunction isMap(x) {\n if (!mapSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n mapSize.call(x);\n try {\n setSize.call(x);\n } catch (s) {\n return true;\n }\n return x instanceof Map; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakMap(x) {\n if (!weakMapHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakMapHas.call(x, weakMapHas);\n try {\n weakSetHas.call(x, weakSetHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakMap; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakRef(x) {\n if (!weakRefDeref || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakRefDeref.call(x);\n return true;\n } catch (e) {}\n return false;\n}\n\nfunction isSet(x) {\n if (!setSize || !x || typeof x !== 'object') {\n return false;\n }\n try {\n setSize.call(x);\n try {\n mapSize.call(x);\n } catch (m) {\n return true;\n }\n return x instanceof Set; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isWeakSet(x) {\n if (!weakSetHas || !x || typeof x !== 'object') {\n return false;\n }\n try {\n weakSetHas.call(x, weakSetHas);\n try {\n weakMapHas.call(x, weakMapHas);\n } catch (s) {\n return true;\n }\n return x instanceof WeakSet; // core-js workaround, pre-v2.5.0\n } catch (e) {}\n return false;\n}\n\nfunction isElement(x) {\n if (!x || typeof x !== 'object') { return false; }\n if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {\n return true;\n }\n return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';\n}\n\nfunction inspectString(str, opts) {\n if (str.length > opts.maxStringLength) {\n var remaining = str.length - opts.maxStringLength;\n var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');\n return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;\n }\n // eslint-disable-next-line no-control-regex\n var s = $replace.call($replace.call(str, /(['\\\\])/g, '\\\\$1'), /[\\x00-\\x1f]/g, lowbyte);\n return wrapQuotes(s, 'single', opts);\n}\n\nfunction lowbyte(c) {\n var n = c.charCodeAt(0);\n var x = {\n 8: 'b',\n 9: 't',\n 10: 'n',\n 12: 'f',\n 13: 'r'\n }[n];\n if (x) { return '\\\\' + x; }\n return '\\\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));\n}\n\nfunction markBoxed(str) {\n return 'Object(' + str + ')';\n}\n\nfunction weakCollectionOf(type) {\n return type + ' { ? }';\n}\n\nfunction collectionOf(type, size, entries, indent) {\n var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');\n return type + ' (' + size + ') {' + joinedEntries + '}';\n}\n\nfunction singleLineValues(xs) {\n for (var i = 0; i < xs.length; i++) {\n if (indexOf(xs[i], '\\n') >= 0) {\n return false;\n }\n }\n return true;\n}\n\nfunction getIndent(opts, depth) {\n var baseIndent;\n if (opts.indent === '\\t') {\n baseIndent = '\\t';\n } else if (typeof opts.indent === 'number' && opts.indent > 0) {\n baseIndent = $join.call(Array(opts.indent + 1), ' ');\n } else {\n return null;\n }\n return {\n base: baseIndent,\n prev: $join.call(Array(depth + 1), baseIndent)\n };\n}\n\nfunction indentedJoin(xs, indent) {\n if (xs.length === 0) { return ''; }\n var lineJoiner = '\\n' + indent.prev + indent.base;\n return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\\n' + indent.prev;\n}\n\nfunction arrObjKeys(obj, inspect) {\n var isArr = isArray(obj);\n var xs = [];\n if (isArr) {\n xs.length = obj.length;\n for (var i = 0; i < obj.length; i++) {\n xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';\n }\n }\n var syms = typeof gOPS === 'function' ? gOPS(obj) : [];\n var symMap;\n if (hasShammedSymbols) {\n symMap = {};\n for (var k = 0; k < syms.length; k++) {\n symMap['$' + syms[k]] = syms[k];\n }\n }\n\n for (var key in obj) { // eslint-disable-line no-restricted-syntax\n if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue\n if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {\n // this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section\n continue; // eslint-disable-line no-restricted-syntax, no-continue\n } else if ($test.call(/[^\\w$]/, key)) {\n xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));\n } else {\n xs.push(key + ': ' + inspect(obj[key], obj));\n }\n }\n if (typeof gOPS === 'function') {\n for (var j = 0; j < syms.length; j++) {\n if (isEnumerable.call(obj, syms[j])) {\n xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));\n }\n }\n }\n return xs;\n}\n","'use strict';\n\nvar utils = require('./utils');\n\nvar has = Object.prototype.hasOwnProperty;\nvar isArray = Array.isArray;\n\nvar defaults = {\n allowDots: false,\n allowPrototypes: false,\n allowSparse: false,\n arrayLimit: 20,\n charset: 'utf-8',\n charsetSentinel: false,\n comma: false,\n decoder: utils.decode,\n delimiter: '&',\n depth: 5,\n ignoreQueryPrefix: false,\n interpretNumericEntities: false,\n parameterLimit: 1000,\n parseArrays: true,\n plainObjects: false,\n strictNullHandling: false\n};\n\nvar interpretNumericEntities = function (str) {\n return str.replace(/&#(\\d+);/g, function ($0, numberStr) {\n return String.fromCharCode(parseInt(numberStr, 10));\n });\n};\n\nvar parseArrayValue = function (val, options) {\n if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) {\n return val.split(',');\n }\n\n return val;\n};\n\n// This is what browsers will submit when the ✓ character occurs in an\n// application/x-www-form-urlencoded body and the encoding of the page containing\n// the form is iso-8859-1, or when the submitted form has an accept-charset\n// attribute of iso-8859-1. Presumably also with other charsets that do not contain\n// the ✓ character, such as us-ascii.\nvar isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓')\n\n// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded.\nvar charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓')\n\nvar parseValues = function parseQueryStringValues(str, options) {\n var obj = {};\n var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\\?/, '') : str;\n var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit;\n var parts = cleanStr.split(options.delimiter, limit);\n var skipIndex = -1; // Keep track of where the utf8 sentinel was found\n var i;\n\n var charset = options.charset;\n if (options.charsetSentinel) {\n for (i = 0; i < parts.length; ++i) {\n if (parts[i].indexOf('utf8=') === 0) {\n if (parts[i] === charsetSentinel) {\n charset = 'utf-8';\n } else if (parts[i] === isoSentinel) {\n charset = 'iso-8859-1';\n }\n skipIndex = i;\n i = parts.length; // The eslint settings do not allow break;\n }\n }\n }\n\n for (i = 0; i < parts.length; ++i) {\n if (i === skipIndex) {\n continue;\n }\n var part = parts[i];\n\n var bracketEqualsPos = part.indexOf(']=');\n var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1;\n\n var key, val;\n if (pos === -1) {\n key = options.decoder(part, defaults.decoder, charset, 'key');\n val = options.strictNullHandling ? null : '';\n } else {\n key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key');\n val = utils.maybeMap(\n parseArrayValue(part.slice(pos + 1), options),\n function (encodedVal) {\n return options.decoder(encodedVal, defaults.decoder, charset, 'value');\n }\n );\n }\n\n if (val && options.interpretNumericEntities && charset === 'iso-8859-1') {\n val = interpretNumericEntities(val);\n }\n\n if (part.indexOf('[]=') > -1) {\n val = isArray(val) ? [val] : val;\n }\n\n if (has.call(obj, key)) {\n obj[key] = utils.combine(obj[key], val);\n } else {\n obj[key] = val;\n }\n }\n\n return obj;\n};\n\nvar parseObject = function (chain, val, options, valuesParsed) {\n var leaf = valuesParsed ? val : parseArrayValue(val, options);\n\n for (var i = chain.length - 1; i >= 0; --i) {\n var obj;\n var root = chain[i];\n\n if (root === '[]' && options.parseArrays) {\n obj = [].concat(leaf);\n } else {\n obj = options.plainObjects ? Object.create(null) : {};\n var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root;\n var index = parseInt(cleanRoot, 10);\n if (!options.parseArrays && cleanRoot === '') {\n obj = { 0: leaf };\n } else if (\n !isNaN(index)\n && root !== cleanRoot\n && String(index) === cleanRoot\n && index >= 0\n && (options.parseArrays && index <= options.arrayLimit)\n ) {\n obj = [];\n obj[index] = leaf;\n } else if (cleanRoot !== '__proto__') {\n obj[cleanRoot] = leaf;\n }\n }\n\n leaf = obj;\n }\n\n return leaf;\n};\n\nvar parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) {\n if (!givenKey) {\n return;\n }\n\n // Transform dot notation to bracket notation\n var key = options.allowDots ? givenKey.replace(/\\.([^.[]+)/g, '[$1]') : givenKey;\n\n // The regex chunks\n\n var brackets = /(\\[[^[\\]]*])/;\n var child = /(\\[[^[\\]]*])/g;\n\n // Get the parent\n\n var segment = options.depth > 0 && brackets.exec(key);\n var parent = segment ? key.slice(0, segment.index) : key;\n\n // Stash the parent if it exists\n\n var keys = [];\n if (parent) {\n // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties\n if (!options.plainObjects && has.call(Object.prototype, parent)) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n\n keys.push(parent);\n }\n\n // Loop through children appending to the array until we hit depth\n\n var i = 0;\n while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) {\n i += 1;\n if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) {\n if (!options.allowPrototypes) {\n return;\n }\n }\n keys.push(segment[1]);\n }\n\n // If there's a remainder, just add whatever is left\n\n if (segment) {\n keys.push('[' + key.slice(segment.index) + ']');\n }\n\n return parseObject(keys, val, options, valuesParsed);\n};\n\nvar normalizeParseOptions = function normalizeParseOptions(opts) {\n if (!opts) {\n return defaults;\n }\n\n if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') {\n throw new TypeError('Decoder has to be a function.');\n }\n\n if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') {\n throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined');\n }\n var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset;\n\n return {\n allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots,\n allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes,\n allowSparse: typeof opts.allowSparse === 'boolean' ? opts.allowSparse : defaults.allowSparse,\n arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit,\n charset: charset,\n charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel,\n comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma,\n decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder,\n delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter,\n // eslint-disable-next-line no-implicit-coercion, no-extra-parens\n depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth,\n ignoreQueryPrefix: opts.ignoreQueryPrefix === true,\n interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities,\n parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit,\n parseArrays: opts.parseArrays !== false,\n plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects,\n strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling\n };\n};\n\nmodule.exports = function (str, opts) {\n var options = normalizeParseOptions(opts);\n\n if (str === '' || str === null || typeof str === 'undefined') {\n return options.plainObjects ? Object.create(null) : {};\n }\n\n var tempObj = typeof str === 'string' ? parseValues(str, options) : str;\n var obj = options.plainObjects ? Object.create(null) : {};\n\n // Iterate over the keys and setup the new object\n\n var keys = Object.keys(tempObj);\n for (var i = 0; i < keys.length; ++i) {\n var key = keys[i];\n var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string');\n obj = utils.merge(obj, newObj, options);\n }\n\n if (options.allowSparse === true) {\n return obj;\n }\n\n return utils.compact(obj);\n};\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/** @license React v17.0.2\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;\nif(\"function\"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x(\"react.element\");c=x(\"react.portal\");d=x(\"react.fragment\");e=x(\"react.strict_mode\");f=x(\"react.profiler\");g=x(\"react.provider\");h=x(\"react.context\");k=x(\"react.forward_ref\");l=x(\"react.suspense\");m=x(\"react.suspense_list\");n=x(\"react.memo\");p=x(\"react.lazy\");q=x(\"react.block\");r=x(\"react.server.block\");u=x(\"react.fundamental\");v=x(\"react.debug_trace_mode\");w=x(\"react.legacy_hidden\")}\nfunction y(a){if(\"object\"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;\nexports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};\nexports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||\"object\"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};\nexports.typeOf=y;\n","'use strict';\n\nvar destroy = require('./plugin/destroy');\nvar initialize = require('./plugin/initialize');\nvar update = require('./plugin/update');\n\nmodule.exports = {\n initialize: initialize,\n update: update,\n destroy: destroy\n};\n","'use strict';\n\nvar _ = require('../lib/helper');\nvar dom = require('../lib/dom');\nvar instances = require('./instances');\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n\n if (!i) {\n return;\n }\n\n i.event.unbindAll();\n dom.remove(i.scrollbarX);\n dom.remove(i.scrollbarY);\n dom.remove(i.scrollbarXRail);\n dom.remove(i.scrollbarYRail);\n _.removePsClasses(element);\n\n instances.remove(element);\n};\n","'use strict';\n\nmodule.exports = {\n handlers: ['click-rail', 'drag-scrollbar', 'keyboard', 'wheel', 'touch'],\n maxScrollbarLength: null,\n minScrollbarLength: null,\n scrollXMarginOffset: 0,\n scrollYMarginOffset: 0,\n suppressScrollX: false,\n suppressScrollY: false,\n swipePropagation: true,\n useBothWheelAxes: false,\n wheelPropagation: false,\n wheelSpeed: 1,\n theme: 'default'\n};\n","'use strict';\n\nvar EventElement = function (element) {\n this.element = element;\n this.events = {};\n};\n\nEventElement.prototype.bind = function (eventName, handler) {\n if (typeof this.events[eventName] === 'undefined') {\n this.events[eventName] = [];\n }\n this.events[eventName].push(handler);\n this.element.addEventListener(eventName, handler, false);\n};\n\nEventElement.prototype.unbind = function (eventName, handler) {\n var isHandlerProvided = (typeof handler !== 'undefined');\n this.events[eventName] = this.events[eventName].filter(function (hdlr) {\n if (isHandlerProvided && hdlr !== handler) {\n return true;\n }\n this.element.removeEventListener(eventName, hdlr, false);\n return false;\n }, this);\n};\n\nEventElement.prototype.unbindAll = function () {\n for (var name in this.events) {\n this.unbind(name);\n }\n};\n\nvar EventManager = function () {\n this.eventElements = [];\n};\n\nEventManager.prototype.eventElement = function (element) {\n var ee = this.eventElements.filter(function (eventElement) {\n return eventElement.element === element;\n })[0];\n if (typeof ee === 'undefined') {\n ee = new EventElement(element);\n this.eventElements.push(ee);\n }\n return ee;\n};\n\nEventManager.prototype.bind = function (element, eventName, handler) {\n this.eventElement(element).bind(eventName, handler);\n};\n\nEventManager.prototype.unbind = function (element, eventName, handler) {\n this.eventElement(element).unbind(eventName, handler);\n};\n\nEventManager.prototype.unbindAll = function () {\n for (var i = 0; i < this.eventElements.length; i++) {\n this.eventElements[i].unbindAll();\n }\n};\n\nEventManager.prototype.once = function (element, eventName, handler) {\n var ee = this.eventElement(element);\n var onceHandler = function (e) {\n ee.unbind(eventName, onceHandler);\n handler(e);\n };\n ee.bind(eventName, onceHandler);\n};\n\nmodule.exports = EventManager;\n","'use strict';\n\nmodule.exports = (function () {\n function s4() {\n return Math.floor((1 + Math.random()) * 0x10000)\n .toString(16)\n .substring(1);\n }\n return function () {\n return s4() + s4() + '-' + s4() + '-' + s4() + '-' +\n s4() + '-' + s4() + s4() + s4();\n };\n})();\n","'use strict';\n\nvar _ = require('../lib/helper');\nvar cls = require('../lib/class');\nvar instances = require('./instances');\nvar updateGeometry = require('./update-geometry');\n\n// Handlers\nvar handlers = {\n 'click-rail': require('./handler/click-rail'),\n 'drag-scrollbar': require('./handler/drag-scrollbar'),\n 'keyboard': require('./handler/keyboard'),\n 'wheel': require('./handler/mouse-wheel'),\n 'touch': require('./handler/touch'),\n 'selection': require('./handler/selection')\n};\nvar nativeScrollHandler = require('./handler/native-scroll');\n\nmodule.exports = function (element, userSettings) {\n userSettings = typeof userSettings === 'object' ? userSettings : {};\n\n cls.add(element, 'ps-container');\n\n // Create a plugin instance.\n var i = instances.add(element);\n\n i.settings = _.extend(i.settings, userSettings);\n cls.add(element, 'ps-theme-' + i.settings.theme);\n\n i.settings.handlers.forEach(function (handlerName) {\n handlers[handlerName](element);\n });\n\n nativeScrollHandler(element);\n\n updateGeometry(element);\n};\n","'use strict';\n\nvar instances = require('../instances');\nvar updateGeometry = require('../update-geometry');\nvar updateScroll = require('../update-scroll');\n\nfunction bindClickRailHandler(element, i) {\n function pageOffset(el) {\n return el.getBoundingClientRect();\n }\n var stopPropagation = function (e) { e.stopPropagation(); };\n\n i.event.bind(i.scrollbarY, 'click', stopPropagation);\n i.event.bind(i.scrollbarYRail, 'click', function (e) {\n var positionTop = e.pageY - window.pageYOffset - pageOffset(i.scrollbarYRail).top;\n var direction = positionTop > i.scrollbarYTop ? 1 : -1;\n\n updateScroll(element, 'top', element.scrollTop + direction * i.containerHeight);\n updateGeometry(element);\n\n e.stopPropagation();\n });\n\n i.event.bind(i.scrollbarX, 'click', stopPropagation);\n i.event.bind(i.scrollbarXRail, 'click', function (e) {\n var positionLeft = e.pageX - window.pageXOffset - pageOffset(i.scrollbarXRail).left;\n var direction = positionLeft > i.scrollbarXLeft ? 1 : -1;\n\n updateScroll(element, 'left', element.scrollLeft + direction * i.containerWidth);\n updateGeometry(element);\n\n e.stopPropagation();\n });\n}\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n bindClickRailHandler(element, i);\n};\n","'use strict';\n\nvar _ = require('../../lib/helper');\nvar dom = require('../../lib/dom');\nvar instances = require('../instances');\nvar updateGeometry = require('../update-geometry');\nvar updateScroll = require('../update-scroll');\n\nfunction bindMouseScrollXHandler(element, i) {\n var currentLeft = null;\n var currentPageX = null;\n\n function updateScrollLeft(deltaX) {\n var newLeft = currentLeft + (deltaX * i.railXRatio);\n var maxLeft = Math.max(0, i.scrollbarXRail.getBoundingClientRect().left) + (i.railXRatio * (i.railXWidth - i.scrollbarXWidth));\n\n if (newLeft < 0) {\n i.scrollbarXLeft = 0;\n } else if (newLeft > maxLeft) {\n i.scrollbarXLeft = maxLeft;\n } else {\n i.scrollbarXLeft = newLeft;\n }\n\n var scrollLeft = _.toInt(i.scrollbarXLeft * (i.contentWidth - i.containerWidth) / (i.containerWidth - (i.railXRatio * i.scrollbarXWidth))) - i.negativeScrollAdjustment;\n updateScroll(element, 'left', scrollLeft);\n }\n\n var mouseMoveHandler = function (e) {\n updateScrollLeft(e.pageX - currentPageX);\n updateGeometry(element);\n e.stopPropagation();\n e.preventDefault();\n };\n\n var mouseUpHandler = function () {\n _.stopScrolling(element, 'x');\n i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);\n };\n\n i.event.bind(i.scrollbarX, 'mousedown', function (e) {\n currentPageX = e.pageX;\n currentLeft = _.toInt(dom.css(i.scrollbarX, 'left')) * i.railXRatio;\n _.startScrolling(element, 'x');\n\n i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);\n i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);\n\n e.stopPropagation();\n e.preventDefault();\n });\n}\n\nfunction bindMouseScrollYHandler(element, i) {\n var currentTop = null;\n var currentPageY = null;\n\n function updateScrollTop(deltaY) {\n var newTop = currentTop + (deltaY * i.railYRatio);\n var maxTop = Math.max(0, i.scrollbarYRail.getBoundingClientRect().top) + (i.railYRatio * (i.railYHeight - i.scrollbarYHeight));\n\n if (newTop < 0) {\n i.scrollbarYTop = 0;\n } else if (newTop > maxTop) {\n i.scrollbarYTop = maxTop;\n } else {\n i.scrollbarYTop = newTop;\n }\n\n var scrollTop = _.toInt(i.scrollbarYTop * (i.contentHeight - i.containerHeight) / (i.containerHeight - (i.railYRatio * i.scrollbarYHeight)));\n updateScroll(element, 'top', scrollTop);\n }\n\n var mouseMoveHandler = function (e) {\n updateScrollTop(e.pageY - currentPageY);\n updateGeometry(element);\n e.stopPropagation();\n e.preventDefault();\n };\n\n var mouseUpHandler = function () {\n _.stopScrolling(element, 'y');\n i.event.unbind(i.ownerDocument, 'mousemove', mouseMoveHandler);\n };\n\n i.event.bind(i.scrollbarY, 'mousedown', function (e) {\n currentPageY = e.pageY;\n currentTop = _.toInt(dom.css(i.scrollbarY, 'top')) * i.railYRatio;\n _.startScrolling(element, 'y');\n\n i.event.bind(i.ownerDocument, 'mousemove', mouseMoveHandler);\n i.event.once(i.ownerDocument, 'mouseup', mouseUpHandler);\n\n e.stopPropagation();\n e.preventDefault();\n });\n}\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n bindMouseScrollXHandler(element, i);\n bindMouseScrollYHandler(element, i);\n};\n","'use strict';\n\nvar _ = require('../../lib/helper');\nvar dom = require('../../lib/dom');\nvar instances = require('../instances');\nvar updateGeometry = require('../update-geometry');\nvar updateScroll = require('../update-scroll');\n\nfunction bindKeyboardHandler(element, i) {\n var hovered = false;\n i.event.bind(element, 'mouseenter', function () {\n hovered = true;\n });\n i.event.bind(element, 'mouseleave', function () {\n hovered = false;\n });\n\n var shouldPrevent = false;\n function shouldPreventDefault(deltaX, deltaY) {\n var scrollTop = element.scrollTop;\n if (deltaX === 0) {\n if (!i.scrollbarYActive) {\n return false;\n }\n if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) {\n return !i.settings.wheelPropagation;\n }\n }\n\n var scrollLeft = element.scrollLeft;\n if (deltaY === 0) {\n if (!i.scrollbarXActive) {\n return false;\n }\n if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) {\n return !i.settings.wheelPropagation;\n }\n }\n return true;\n }\n\n i.event.bind(i.ownerDocument, 'keydown', function (e) {\n if ((e.isDefaultPrevented && e.isDefaultPrevented()) || e.defaultPrevented) {\n return;\n }\n\n var focused = dom.matches(i.scrollbarX, ':focus') ||\n dom.matches(i.scrollbarY, ':focus');\n\n if (!hovered && !focused) {\n return;\n }\n\n var activeElement = document.activeElement ? document.activeElement : i.ownerDocument.activeElement;\n if (activeElement) {\n if (activeElement.tagName === 'IFRAME') {\n activeElement = activeElement.contentDocument.activeElement;\n } else {\n // go deeper if element is a webcomponent\n while (activeElement.shadowRoot) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n }\n if (_.isEditable(activeElement)) {\n return;\n }\n }\n\n var deltaX = 0;\n var deltaY = 0;\n\n switch (e.which) {\n case 37: // left\n if (e.metaKey) {\n deltaX = -i.contentWidth;\n } else if (e.altKey) {\n deltaX = -i.containerWidth;\n } else {\n deltaX = -30;\n }\n break;\n case 38: // up\n if (e.metaKey) {\n deltaY = i.contentHeight;\n } else if (e.altKey) {\n deltaY = i.containerHeight;\n } else {\n deltaY = 30;\n }\n break;\n case 39: // right\n if (e.metaKey) {\n deltaX = i.contentWidth;\n } else if (e.altKey) {\n deltaX = i.containerWidth;\n } else {\n deltaX = 30;\n }\n break;\n case 40: // down\n if (e.metaKey) {\n deltaY = -i.contentHeight;\n } else if (e.altKey) {\n deltaY = -i.containerHeight;\n } else {\n deltaY = -30;\n }\n break;\n case 33: // page up\n deltaY = 90;\n break;\n case 32: // space bar\n if (e.shiftKey) {\n deltaY = 90;\n } else {\n deltaY = -90;\n }\n break;\n case 34: // page down\n deltaY = -90;\n break;\n case 35: // end\n if (e.ctrlKey) {\n deltaY = -i.contentHeight;\n } else {\n deltaY = -i.containerHeight;\n }\n break;\n case 36: // home\n if (e.ctrlKey) {\n deltaY = element.scrollTop;\n } else {\n deltaY = i.containerHeight;\n }\n break;\n default:\n return;\n }\n\n updateScroll(element, 'top', element.scrollTop - deltaY);\n updateScroll(element, 'left', element.scrollLeft + deltaX);\n updateGeometry(element);\n\n shouldPrevent = shouldPreventDefault(deltaX, deltaY);\n if (shouldPrevent) {\n e.preventDefault();\n }\n });\n}\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n bindKeyboardHandler(element, i);\n};\n","'use strict';\n\nvar instances = require('../instances');\nvar updateGeometry = require('../update-geometry');\nvar updateScroll = require('../update-scroll');\n\nfunction bindMouseWheelHandler(element, i) {\n var shouldPrevent = false;\n\n function shouldPreventDefault(deltaX, deltaY) {\n var scrollTop = element.scrollTop;\n if (deltaX === 0) {\n if (!i.scrollbarYActive) {\n return false;\n }\n if ((scrollTop === 0 && deltaY > 0) || (scrollTop >= i.contentHeight - i.containerHeight && deltaY < 0)) {\n return !i.settings.wheelPropagation;\n }\n }\n\n var scrollLeft = element.scrollLeft;\n if (deltaY === 0) {\n if (!i.scrollbarXActive) {\n return false;\n }\n if ((scrollLeft === 0 && deltaX < 0) || (scrollLeft >= i.contentWidth - i.containerWidth && deltaX > 0)) {\n return !i.settings.wheelPropagation;\n }\n }\n return true;\n }\n\n function getDeltaFromEvent(e) {\n var deltaX = e.deltaX;\n var deltaY = -1 * e.deltaY;\n\n if (typeof deltaX === \"undefined\" || typeof deltaY === \"undefined\") {\n // OS X Safari\n deltaX = -1 * e.wheelDeltaX / 6;\n deltaY = e.wheelDeltaY / 6;\n }\n\n if (e.deltaMode && e.deltaMode === 1) {\n // Firefox in deltaMode 1: Line scrolling\n deltaX *= 10;\n deltaY *= 10;\n }\n\n if (deltaX !== deltaX && deltaY !== deltaY/* NaN checks */) {\n // IE in some mouse drivers\n deltaX = 0;\n deltaY = e.wheelDelta;\n }\n\n if (e.shiftKey) {\n // reverse axis with shift key\n return [-deltaY, -deltaX];\n }\n return [deltaX, deltaY];\n }\n\n function shouldBeConsumedByChild(deltaX, deltaY) {\n var child = element.querySelector('textarea:hover, select[multiple]:hover, .ps-child:hover');\n if (child) {\n if (!window.getComputedStyle(child).overflow.match(/(scroll|auto)/)) {\n // if not scrollable\n return false;\n }\n\n var maxScrollTop = child.scrollHeight - child.clientHeight;\n if (maxScrollTop > 0) {\n if (!(child.scrollTop === 0 && deltaY > 0) && !(child.scrollTop === maxScrollTop && deltaY < 0)) {\n return true;\n }\n }\n var maxScrollLeft = child.scrollLeft - child.clientWidth;\n if (maxScrollLeft > 0) {\n if (!(child.scrollLeft === 0 && deltaX < 0) && !(child.scrollLeft === maxScrollLeft && deltaX > 0)) {\n return true;\n }\n }\n }\n return false;\n }\n\n function mousewheelHandler(e) {\n var delta = getDeltaFromEvent(e);\n\n var deltaX = delta[0];\n var deltaY = delta[1];\n\n if (shouldBeConsumedByChild(deltaX, deltaY)) {\n return;\n }\n\n shouldPrevent = false;\n if (!i.settings.useBothWheelAxes) {\n // deltaX will only be used for horizontal scrolling and deltaY will\n // only be used for vertical scrolling - this is the default\n updateScroll(element, 'top', element.scrollTop - (deltaY * i.settings.wheelSpeed));\n updateScroll(element, 'left', element.scrollLeft + (deltaX * i.settings.wheelSpeed));\n } else if (i.scrollbarYActive && !i.scrollbarXActive) {\n // only vertical scrollbar is active and useBothWheelAxes option is\n // active, so let's scroll vertical bar using both mouse wheel axes\n if (deltaY) {\n updateScroll(element, 'top', element.scrollTop - (deltaY * i.settings.wheelSpeed));\n } else {\n updateScroll(element, 'top', element.scrollTop + (deltaX * i.settings.wheelSpeed));\n }\n shouldPrevent = true;\n } else if (i.scrollbarXActive && !i.scrollbarYActive) {\n // useBothWheelAxes and only horizontal bar is active, so use both\n // wheel axes for horizontal bar\n if (deltaX) {\n updateScroll(element, 'left', element.scrollLeft + (deltaX * i.settings.wheelSpeed));\n } else {\n updateScroll(element, 'left', element.scrollLeft - (deltaY * i.settings.wheelSpeed));\n }\n shouldPrevent = true;\n }\n\n updateGeometry(element);\n\n shouldPrevent = (shouldPrevent || shouldPreventDefault(deltaX, deltaY));\n if (shouldPrevent) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n\n if (typeof window.onwheel !== \"undefined\") {\n i.event.bind(element, 'wheel', mousewheelHandler);\n } else if (typeof window.onmousewheel !== \"undefined\") {\n i.event.bind(element, 'mousewheel', mousewheelHandler);\n }\n}\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n bindMouseWheelHandler(element, i);\n};\n","'use strict';\n\nvar _ = require('../../lib/helper');\nvar instances = require('../instances');\nvar updateGeometry = require('../update-geometry');\nvar updateScroll = require('../update-scroll');\n\nfunction bindTouchHandler(element, i, supportsTouch, supportsIePointer) {\n function shouldPreventDefault(deltaX, deltaY) {\n var scrollTop = element.scrollTop;\n var scrollLeft = element.scrollLeft;\n var magnitudeX = Math.abs(deltaX);\n var magnitudeY = Math.abs(deltaY);\n\n if (magnitudeY > magnitudeX) {\n // user is perhaps trying to swipe up/down the page\n\n if (((deltaY < 0) && (scrollTop === i.contentHeight - i.containerHeight)) ||\n ((deltaY > 0) && (scrollTop === 0))) {\n return !i.settings.swipePropagation;\n }\n } else if (magnitudeX > magnitudeY) {\n // user is perhaps trying to swipe left/right across the page\n\n if (((deltaX < 0) && (scrollLeft === i.contentWidth - i.containerWidth)) ||\n ((deltaX > 0) && (scrollLeft === 0))) {\n return !i.settings.swipePropagation;\n }\n }\n\n return true;\n }\n\n function applyTouchMove(differenceX, differenceY) {\n updateScroll(element, 'top', element.scrollTop - differenceY);\n updateScroll(element, 'left', element.scrollLeft - differenceX);\n\n updateGeometry(element);\n }\n\n var startOffset = {};\n var startTime = 0;\n var speed = {};\n var easingLoop = null;\n var inGlobalTouch = false;\n var inLocalTouch = false;\n\n function globalTouchStart() {\n inGlobalTouch = true;\n }\n function globalTouchEnd() {\n inGlobalTouch = false;\n }\n\n function getTouch(e) {\n if (e.targetTouches) {\n return e.targetTouches[0];\n } else {\n // Maybe IE pointer\n return e;\n }\n }\n function shouldHandle(e) {\n if (e.targetTouches && e.targetTouches.length === 1) {\n return true;\n }\n if (e.pointerType && e.pointerType !== 'mouse' && e.pointerType !== e.MSPOINTER_TYPE_MOUSE) {\n return true;\n }\n return false;\n }\n function touchStart(e) {\n if (shouldHandle(e)) {\n inLocalTouch = true;\n\n var touch = getTouch(e);\n\n startOffset.pageX = touch.pageX;\n startOffset.pageY = touch.pageY;\n\n startTime = (new Date()).getTime();\n\n if (easingLoop !== null) {\n clearInterval(easingLoop);\n }\n\n e.stopPropagation();\n }\n }\n function touchMove(e) {\n if (!inLocalTouch && i.settings.swipePropagation) {\n touchStart(e);\n }\n if (!inGlobalTouch && inLocalTouch && shouldHandle(e)) {\n var touch = getTouch(e);\n\n var currentOffset = {pageX: touch.pageX, pageY: touch.pageY};\n\n var differenceX = currentOffset.pageX - startOffset.pageX;\n var differenceY = currentOffset.pageY - startOffset.pageY;\n\n applyTouchMove(differenceX, differenceY);\n startOffset = currentOffset;\n\n var currentTime = (new Date()).getTime();\n\n var timeGap = currentTime - startTime;\n if (timeGap > 0) {\n speed.x = differenceX / timeGap;\n speed.y = differenceY / timeGap;\n startTime = currentTime;\n }\n\n if (shouldPreventDefault(differenceX, differenceY)) {\n e.stopPropagation();\n e.preventDefault();\n }\n }\n }\n function touchEnd() {\n if (!inGlobalTouch && inLocalTouch) {\n inLocalTouch = false;\n\n clearInterval(easingLoop);\n easingLoop = setInterval(function () {\n if (!instances.get(element)) {\n clearInterval(easingLoop);\n return;\n }\n\n if (!speed.x && !speed.y) {\n clearInterval(easingLoop);\n return;\n }\n\n if (Math.abs(speed.x) < 0.01 && Math.abs(speed.y) < 0.01) {\n clearInterval(easingLoop);\n return;\n }\n\n applyTouchMove(speed.x * 30, speed.y * 30);\n\n speed.x *= 0.8;\n speed.y *= 0.8;\n }, 10);\n }\n }\n\n if (supportsTouch) {\n i.event.bind(window, 'touchstart', globalTouchStart);\n i.event.bind(window, 'touchend', globalTouchEnd);\n i.event.bind(element, 'touchstart', touchStart);\n i.event.bind(element, 'touchmove', touchMove);\n i.event.bind(element, 'touchend', touchEnd);\n }\n\n if (supportsIePointer) {\n if (window.PointerEvent) {\n i.event.bind(window, 'pointerdown', globalTouchStart);\n i.event.bind(window, 'pointerup', globalTouchEnd);\n i.event.bind(element, 'pointerdown', touchStart);\n i.event.bind(element, 'pointermove', touchMove);\n i.event.bind(element, 'pointerup', touchEnd);\n } else if (window.MSPointerEvent) {\n i.event.bind(window, 'MSPointerDown', globalTouchStart);\n i.event.bind(window, 'MSPointerUp', globalTouchEnd);\n i.event.bind(element, 'MSPointerDown', touchStart);\n i.event.bind(element, 'MSPointerMove', touchMove);\n i.event.bind(element, 'MSPointerUp', touchEnd);\n }\n }\n}\n\nmodule.exports = function (element) {\n if (!_.env.supportsTouch && !_.env.supportsIePointer) {\n return;\n }\n\n var i = instances.get(element);\n bindTouchHandler(element, i, _.env.supportsTouch, _.env.supportsIePointer);\n};\n","'use strict';\n\nvar _ = require('../../lib/helper');\nvar instances = require('../instances');\nvar updateGeometry = require('../update-geometry');\nvar updateScroll = require('../update-scroll');\n\nfunction bindSelectionHandler(element, i) {\n function getRangeNode() {\n var selection = window.getSelection ? window.getSelection() :\n document.getSelection ? document.getSelection() : '';\n if (selection.toString().length === 0) {\n return null;\n } else {\n return selection.getRangeAt(0).commonAncestorContainer;\n }\n }\n\n var scrollingLoop = null;\n var scrollDiff = {top: 0, left: 0};\n function startScrolling() {\n if (!scrollingLoop) {\n scrollingLoop = setInterval(function () {\n if (!instances.get(element)) {\n clearInterval(scrollingLoop);\n return;\n }\n\n updateScroll(element, 'top', element.scrollTop + scrollDiff.top);\n updateScroll(element, 'left', element.scrollLeft + scrollDiff.left);\n updateGeometry(element);\n }, 50); // every .1 sec\n }\n }\n function stopScrolling() {\n if (scrollingLoop) {\n clearInterval(scrollingLoop);\n scrollingLoop = null;\n }\n _.stopScrolling(element);\n }\n\n var isSelected = false;\n i.event.bind(i.ownerDocument, 'selectionchange', function () {\n if (element.contains(getRangeNode())) {\n isSelected = true;\n } else {\n isSelected = false;\n stopScrolling();\n }\n });\n i.event.bind(window, 'mouseup', function () {\n if (isSelected) {\n isSelected = false;\n stopScrolling();\n }\n });\n i.event.bind(window, 'keyup', function () {\n if (isSelected) {\n isSelected = false;\n stopScrolling();\n }\n });\n\n i.event.bind(window, 'mousemove', function (e) {\n if (isSelected) {\n var mousePosition = {x: e.pageX, y: e.pageY};\n var containerGeometry = {\n left: element.offsetLeft,\n right: element.offsetLeft + element.offsetWidth,\n top: element.offsetTop,\n bottom: element.offsetTop + element.offsetHeight\n };\n\n if (mousePosition.x < containerGeometry.left + 3) {\n scrollDiff.left = -5;\n _.startScrolling(element, 'x');\n } else if (mousePosition.x > containerGeometry.right - 3) {\n scrollDiff.left = 5;\n _.startScrolling(element, 'x');\n } else {\n scrollDiff.left = 0;\n }\n\n if (mousePosition.y < containerGeometry.top + 3) {\n if (containerGeometry.top + 3 - mousePosition.y < 5) {\n scrollDiff.top = -5;\n } else {\n scrollDiff.top = -20;\n }\n _.startScrolling(element, 'y');\n } else if (mousePosition.y > containerGeometry.bottom - 3) {\n if (mousePosition.y - containerGeometry.bottom + 3 < 5) {\n scrollDiff.top = 5;\n } else {\n scrollDiff.top = 20;\n }\n _.startScrolling(element, 'y');\n } else {\n scrollDiff.top = 0;\n }\n\n if (scrollDiff.top === 0 && scrollDiff.left === 0) {\n stopScrolling();\n } else {\n startScrolling();\n }\n }\n });\n}\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n bindSelectionHandler(element, i);\n};\n","'use strict';\n\nvar instances = require('../instances');\nvar updateGeometry = require('../update-geometry');\n\nfunction bindNativeScrollHandler(element, i) {\n i.event.bind(element, 'scroll', function () {\n updateGeometry(element);\n });\n}\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n bindNativeScrollHandler(element, i);\n};\n","'use strict';\n\nvar _ = require('../lib/helper');\nvar dom = require('../lib/dom');\nvar instances = require('./instances');\nvar updateGeometry = require('./update-geometry');\nvar updateScroll = require('./update-scroll');\n\nmodule.exports = function (element) {\n var i = instances.get(element);\n\n if (!i) {\n return;\n }\n\n // Recalcuate negative scrollLeft adjustment\n i.negativeScrollAdjustment = i.isNegativeScroll ? element.scrollWidth - element.clientWidth : 0;\n\n // Recalculate rail margins\n dom.css(i.scrollbarXRail, 'display', 'block');\n dom.css(i.scrollbarYRail, 'display', 'block');\n i.railXMarginWidth = _.toInt(dom.css(i.scrollbarXRail, 'marginLeft')) + _.toInt(dom.css(i.scrollbarXRail, 'marginRight'));\n i.railYMarginHeight = _.toInt(dom.css(i.scrollbarYRail, 'marginTop')) + _.toInt(dom.css(i.scrollbarYRail, 'marginBottom'));\n\n // Hide scrollbars not to affect scrollWidth and scrollHeight\n dom.css(i.scrollbarXRail, 'display', 'none');\n dom.css(i.scrollbarYRail, 'display', 'none');\n\n updateGeometry(element);\n\n // Update top/left scroll to trigger events\n updateScroll(element, 'top', element.scrollTop);\n updateScroll(element, 'left', element.scrollLeft);\n\n dom.css(i.scrollbarXRail, 'display', '');\n dom.css(i.scrollbarYRail, 'display', '');\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar _1 = require(\"./\");\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar should_polyfill_1 = require(\"./should-polyfill\");\nvar to_locale_string_1 = require(\"./src/to_locale_string\");\nif (should_polyfill_1.shouldPolyfill()) {\n ecma402_abstract_1.defineProperty(Intl, 'DateTimeFormat', { value: _1.DateTimeFormat });\n ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleString', {\n value: function toLocaleString(locales, options) {\n return to_locale_string_1.toLocaleString(this, locales, options);\n },\n });\n ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleDateString', {\n value: function toLocaleDateString(locales, options) {\n return to_locale_string_1.toLocaleDateString(this, locales, options);\n },\n });\n ecma402_abstract_1.defineProperty(Date.prototype, 'toLocaleTimeString', {\n value: function toLocaleTimeString(locales, options) {\n return to_locale_string_1.toLocaleTimeString(this, locales, options);\n },\n });\n}\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar tslib_1 = require(\"tslib\");\ntslib_1.__exportStar(require(\"./src/core\"), exports);\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LookupMatcher = void 0;\nvar utils_1 = require(\"./utils\");\nvar BestAvailableLocale_1 = require(\"./BestAvailableLocale\");\n/**\n * https://tc39.es/ecma402/#sec-lookupmatcher\n * @param availableLocales\n * @param requestedLocales\n * @param getDefaultLocale\n */\nfunction LookupMatcher(availableLocales, requestedLocales, getDefaultLocale) {\n var result = { locale: '' };\n for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {\n var locale = requestedLocales_1[_i];\n var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, '');\n var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);\n if (availableLocale) {\n result.locale = availableLocale;\n if (locale !== noExtensionLocale) {\n result.extension = locale.slice(noExtensionLocale.length + 1, locale.length);\n }\n return result;\n }\n }\n result.locale = getDefaultLocale();\n return result;\n}\nexports.LookupMatcher = LookupMatcher;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BestFitMatcher = void 0;\nvar BestAvailableLocale_1 = require(\"./BestAvailableLocale\");\nvar utils_1 = require(\"./utils\");\n/**\n * https://tc39.es/ecma402/#sec-bestfitmatcher\n * @param availableLocales\n * @param requestedLocales\n * @param getDefaultLocale\n */\nfunction BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale) {\n var minimizedAvailableLocaleMap = Array.from(availableLocales).reduce(function (all, l) {\n all[l] = l;\n return all;\n }, {});\n var minimizedAvailableLocales = new Set();\n availableLocales.forEach(function (locale) {\n var minimizedLocale = new Intl.Locale(locale)\n .minimize()\n .toString();\n minimizedAvailableLocaleMap[minimizedLocale] = locale;\n minimizedAvailableLocales.add(minimizedLocale);\n });\n var foundLocale;\n for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {\n var l = requestedLocales_1[_i];\n if (foundLocale) {\n break;\n }\n var noExtensionLocale = l.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, '');\n if (availableLocales.has(noExtensionLocale)) {\n foundLocale = noExtensionLocale;\n break;\n }\n if (minimizedAvailableLocales.has(noExtensionLocale)) {\n foundLocale = noExtensionLocale;\n break;\n }\n var locale = new Intl.Locale(noExtensionLocale);\n var maximizedRequestedLocale = locale.maximize().toString();\n var minimizedRequestedLocale = locale.minimize().toString();\n // Check minimized locale\n if (minimizedAvailableLocales.has(minimizedRequestedLocale)) {\n foundLocale = minimizedRequestedLocale;\n break;\n }\n // Lookup algo on maximized locale\n foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);\n }\n return {\n locale: (foundLocale && minimizedAvailableLocaleMap[foundLocale]) ||\n getDefaultLocale(),\n };\n}\nexports.BestFitMatcher = BestFitMatcher;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.UnicodeExtensionValue = void 0;\nvar utils_1 = require(\"./utils\");\n/**\n * https://tc39.es/ecma402/#sec-unicodeextensionvalue\n * @param extension\n * @param key\n */\nfunction UnicodeExtensionValue(extension, key) {\n utils_1.invariant(key.length === 2, 'key must have 2 elements');\n var size = extension.length;\n var searchValue = \"-\" + key + \"-\";\n var pos = extension.indexOf(searchValue);\n if (pos !== -1) {\n var start = pos + 4;\n var end = start;\n var k = start;\n var done = false;\n while (!done) {\n var e = extension.indexOf('-', k);\n var len = void 0;\n if (e === -1) {\n len = size - k;\n }\n else {\n len = e - k;\n }\n if (len === 2) {\n done = true;\n }\n else if (e === -1) {\n end = size;\n done = true;\n }\n else {\n end = e;\n k = e + 1;\n }\n }\n return extension.slice(start, end);\n }\n searchValue = \"-\" + key;\n pos = extension.indexOf(searchValue);\n if (pos !== -1 && pos + 3 === size) {\n return '';\n }\n return undefined;\n}\nexports.UnicodeExtensionValue = UnicodeExtensionValue;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LookupSupportedLocales = void 0;\nvar utils_1 = require(\"./utils\");\nvar BestAvailableLocale_1 = require(\"./BestAvailableLocale\");\n/**\n * https://tc39.es/ecma402/#sec-lookupsupportedlocales\n * @param availableLocales\n * @param requestedLocales\n */\nfunction LookupSupportedLocales(availableLocales, requestedLocales) {\n var subset = [];\n for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {\n var locale = requestedLocales_1[_i];\n var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, '');\n var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);\n if (availableLocale) {\n subset.push(availableLocale);\n }\n }\n return subset;\n}\nexports.LookupSupportedLocales = LookupSupportedLocales;\n","\"use strict\";\n// Type-only circular import\n// eslint-disable-next-line import/no-cycle\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar internalSlotMap = new WeakMap();\nfunction getInternalSlots(x) {\n var internalSlots = internalSlotMap.get(x);\n if (!internalSlots) {\n internalSlots = Object.create(null);\n internalSlotMap.set(x, internalSlots);\n }\n return internalSlots;\n}\nexports.default = getInternalSlots;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// @generated\n// prettier-ignore\nexports.default = {\n \"Africa/Asmera\": \"Africa/Nairobi\",\n \"Africa/Timbuktu\": \"Africa/Abidjan\",\n \"America/Argentina/ComodRivadavia\": \"America/Argentina/Catamarca\",\n \"America/Atka\": \"America/Adak\",\n \"America/Buenos_Aires\": \"America/Argentina/Buenos_Aires\",\n \"America/Catamarca\": \"America/Argentina/Catamarca\",\n \"America/Coral_Harbour\": \"America/Atikokan\",\n \"America/Cordoba\": \"America/Argentina/Cordoba\",\n \"America/Ensenada\": \"America/Tijuana\",\n \"America/Fort_Wayne\": \"America/Indiana/Indianapolis\",\n \"America/Godthab\": \"America/Nuuk\",\n \"America/Indianapolis\": \"America/Indiana/Indianapolis\",\n \"America/Jujuy\": \"America/Argentina/Jujuy\",\n \"America/Knox_IN\": \"America/Indiana/Knox\",\n \"America/Louisville\": \"America/Kentucky/Louisville\",\n \"America/Mendoza\": \"America/Argentina/Mendoza\",\n \"America/Montreal\": \"America/Toronto\",\n \"America/Porto_Acre\": \"America/Rio_Branco\",\n \"America/Rosario\": \"America/Argentina/Cordoba\",\n \"America/Santa_Isabel\": \"America/Tijuana\",\n \"America/Shiprock\": \"America/Denver\",\n \"America/Virgin\": \"America/Port_of_Spain\",\n \"Antarctica/South_Pole\": \"Pacific/Auckland\",\n \"Asia/Ashkhabad\": \"Asia/Ashgabat\",\n \"Asia/Calcutta\": \"Asia/Kolkata\",\n \"Asia/Chongqing\": \"Asia/Shanghai\",\n \"Asia/Chungking\": \"Asia/Shanghai\",\n \"Asia/Dacca\": \"Asia/Dhaka\",\n \"Asia/Harbin\": \"Asia/Shanghai\",\n \"Asia/Kashgar\": \"Asia/Urumqi\",\n \"Asia/Katmandu\": \"Asia/Kathmandu\",\n \"Asia/Macao\": \"Asia/Macau\",\n \"Asia/Rangoon\": \"Asia/Yangon\",\n \"Asia/Saigon\": \"Asia/Ho_Chi_Minh\",\n \"Asia/Tel_Aviv\": \"Asia/Jerusalem\",\n \"Asia/Thimbu\": \"Asia/Thimphu\",\n \"Asia/Ujung_Pandang\": \"Asia/Makassar\",\n \"Asia/Ulan_Bator\": \"Asia/Ulaanbaatar\",\n \"Atlantic/Faeroe\": \"Atlantic/Faroe\",\n \"Atlantic/Jan_Mayen\": \"Europe/Oslo\",\n \"Australia/ACT\": \"Australia/Sydney\",\n \"Australia/Canberra\": \"Australia/Sydney\",\n \"Australia/Currie\": \"Australia/Hobart\",\n \"Australia/LHI\": \"Australia/Lord_Howe\",\n \"Australia/NSW\": \"Australia/Sydney\",\n \"Australia/North\": \"Australia/Darwin\",\n \"Australia/Queensland\": \"Australia/Brisbane\",\n \"Australia/South\": \"Australia/Adelaide\",\n \"Australia/Tasmania\": \"Australia/Hobart\",\n \"Australia/Victoria\": \"Australia/Melbourne\",\n \"Australia/West\": \"Australia/Perth\",\n \"Australia/Yancowinna\": \"Australia/Broken_Hill\",\n \"Brazil/Acre\": \"America/Rio_Branco\",\n \"Brazil/DeNoronha\": \"America/Noronha\",\n \"Brazil/East\": \"America/Sao_Paulo\",\n \"Brazil/West\": \"America/Manaus\",\n \"Canada/Atlantic\": \"America/Halifax\",\n \"Canada/Central\": \"America/Winnipeg\",\n \"Canada/Eastern\": \"America/Toronto\",\n \"Canada/Mountain\": \"America/Edmonton\",\n \"Canada/Newfoundland\": \"America/St_Johns\",\n \"Canada/Pacific\": \"America/Vancouver\",\n \"Canada/Saskatchewan\": \"America/Regina\",\n \"Canada/Yukon\": \"America/Whitehorse\",\n \"Chile/Continental\": \"America/Santiago\",\n \"Chile/EasterIsland\": \"Pacific/Easter\",\n \"Cuba\": \"America/Havana\",\n \"Egypt\": \"Africa/Cairo\",\n \"Eire\": \"Europe/Dublin\",\n \"Etc/UCT\": \"Etc/UTC\",\n \"Europe/Belfast\": \"Europe/London\",\n \"Europe/Tiraspol\": \"Europe/Chisinau\",\n \"GB\": \"Europe/London\",\n \"GB-Eire\": \"Europe/London\",\n \"GMT+0\": \"Etc/GMT\",\n \"GMT-0\": \"Etc/GMT\",\n \"GMT0\": \"Etc/GMT\",\n \"Greenwich\": \"Etc/GMT\",\n \"Hongkong\": \"Asia/Hong_Kong\",\n \"Iceland\": \"Atlantic/Reykjavik\",\n \"Iran\": \"Asia/Tehran\",\n \"Israel\": \"Asia/Jerusalem\",\n \"Jamaica\": \"America/Jamaica\",\n \"Japan\": \"Asia/Tokyo\",\n \"Kwajalein\": \"Pacific/Kwajalein\",\n \"Libya\": \"Africa/Tripoli\",\n \"Mexico/BajaNorte\": \"America/Tijuana\",\n \"Mexico/BajaSur\": \"America/Mazatlan\",\n \"Mexico/General\": \"America/Mexico_City\",\n \"NZ\": \"Pacific/Auckland\",\n \"NZ-CHAT\": \"Pacific/Chatham\",\n \"Navajo\": \"America/Denver\",\n \"PRC\": \"Asia/Shanghai\",\n \"Pacific/Johnston\": \"Pacific/Honolulu\",\n \"Pacific/Ponape\": \"Pacific/Pohnpei\",\n \"Pacific/Samoa\": \"Pacific/Pago_Pago\",\n \"Pacific/Truk\": \"Pacific/Chuuk\",\n \"Pacific/Yap\": \"Pacific/Chuuk\",\n \"Poland\": \"Europe/Warsaw\",\n \"Portugal\": \"Europe/Lisbon\",\n \"ROC\": \"Asia/Taipei\",\n \"ROK\": \"Asia/Seoul\",\n \"Singapore\": \"Asia/Singapore\",\n \"Turkey\": \"Europe/Istanbul\",\n \"UCT\": \"Etc/UTC\",\n \"US/Alaska\": \"America/Anchorage\",\n \"US/Aleutian\": \"America/Adak\",\n \"US/Arizona\": \"America/Phoenix\",\n \"US/Central\": \"America/Chicago\",\n \"US/East-Indiana\": \"America/Indiana/Indianapolis\",\n \"US/Eastern\": \"America/New_York\",\n \"US/Hawaii\": \"Pacific/Honolulu\",\n \"US/Indiana-Starke\": \"America/Indiana/Knox\",\n \"US/Michigan\": \"America/Detroit\",\n \"US/Mountain\": \"America/Denver\",\n \"US/Pacific\": \"America/Los_Angeles\",\n \"US/Samoa\": \"Pacific/Pago_Pago\",\n \"UTC\": \"Etc/UTC\",\n \"Universal\": \"Etc/UTC\",\n \"W-SU\": \"Europe/Moscow\",\n \"Zulu\": \"Etc/UTC\"\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.unpack = exports.pack = void 0;\nvar tslib_1 = require(\"tslib\");\nfunction pack(data) {\n var zoneNames = Object.keys(data.zones);\n zoneNames.sort(); // so output is stable\n return {\n zones: zoneNames.map(function (zone) {\n return tslib_1.__spreadArray([\n zone\n ], data.zones[zone].map(function (_a) {\n var ts = _a[0], others = _a.slice(1);\n return tslib_1.__spreadArray([ts === '' ? '' : ts.toString(36)], others).join(',');\n })).join('|');\n }),\n abbrvs: data.abbrvs.join('|'),\n offsets: data.offsets.map(function (o) { return o.toString(36); }).join('|'),\n };\n}\nexports.pack = pack;\nfunction unpack(data) {\n var abbrvs = data.abbrvs.split('|');\n var offsets = data.offsets.split('|').map(function (n) { return parseInt(n, 36); });\n var packedZones = data.zones;\n var zones = {};\n for (var _i = 0, packedZones_1 = packedZones; _i < packedZones_1.length; _i++) {\n var d = packedZones_1[_i];\n var _a = d.split('|'), zone = _a[0], zoneData = _a.slice(1);\n zones[zone] = zoneData\n .map(function (z) { return z.split(','); })\n .map(function (_a) {\n var ts = _a[0], abbrvIndex = _a[1], offsetIndex = _a[2], dst = _a[3];\n return [\n ts === '' ? -Infinity : parseInt(ts, 36),\n abbrvs[+abbrvIndex],\n offsets[+offsetIndex],\n dst === '1',\n ];\n });\n }\n return zones;\n}\nexports.unpack = unpack;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FormatDateTime = void 0;\nvar PartitionDateTimePattern_1 = require(\"./PartitionDateTimePattern\");\n/**\n * https://tc39.es/ecma402/#sec-formatdatetime\n * @param dtf DateTimeFormat\n * @param x\n */\nfunction FormatDateTime(dtf, x, implDetails) {\n var parts = PartitionDateTimePattern_1.PartitionDateTimePattern(dtf, x, implDetails);\n var result = '';\n for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n var part = parts_1[_i];\n result += part.value;\n }\n return result;\n}\nexports.FormatDateTime = FormatDateTime;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InitializeDateTimeFormat = void 0;\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar BasicFormatMatcher_1 = require(\"./BasicFormatMatcher\");\nvar BestFitFormatMatcher_1 = require(\"./BestFitFormatMatcher\");\nvar utils_1 = require(\"./utils\");\nvar DateTimeStyleFormat_1 = require(\"./DateTimeStyleFormat\");\nvar ToDateTimeOptions_1 = require(\"./ToDateTimeOptions\");\nvar intl_localematcher_1 = require(\"@formatjs/intl-localematcher\");\nfunction isTimeRelated(opt) {\n for (var _i = 0, _a = ['hour', 'minute', 'second']; _i < _a.length; _i++) {\n var prop = _a[_i];\n var value = opt[prop];\n if (value !== undefined) {\n return true;\n }\n }\n return false;\n}\nfunction resolveHourCycle(hc, hcDefault, hour12) {\n if (hc == null) {\n hc = hcDefault;\n }\n if (hour12 !== undefined) {\n if (hour12) {\n if (hcDefault === 'h11' || hcDefault === 'h23') {\n hc = 'h11';\n }\n else {\n hc = 'h12';\n }\n }\n else {\n ecma402_abstract_1.invariant(!hour12, 'hour12 must not be set');\n if (hcDefault === 'h11' || hcDefault === 'h23') {\n hc = 'h23';\n }\n else {\n hc = 'h24';\n }\n }\n }\n return hc;\n}\nvar TYPE_REGEX = /^[a-z0-9]{3,8}$/i;\n/**\n * https://tc39.es/ecma402/#sec-initializedatetimeformat\n * @param dtf DateTimeFormat\n * @param locales locales\n * @param opts options\n */\nfunction InitializeDateTimeFormat(dtf, locales, opts, _a) {\n var getInternalSlots = _a.getInternalSlots, availableLocales = _a.availableLocales, localeData = _a.localeData, getDefaultLocale = _a.getDefaultLocale, getDefaultTimeZone = _a.getDefaultTimeZone, relevantExtensionKeys = _a.relevantExtensionKeys, tzData = _a.tzData, uppercaseLinks = _a.uppercaseLinks;\n // @ts-ignore\n var requestedLocales = ecma402_abstract_1.CanonicalizeLocaleList(locales);\n var options = ToDateTimeOptions_1.ToDateTimeOptions(opts, 'any', 'date');\n var opt = Object.create(null);\n var matcher = ecma402_abstract_1.GetOption(options, 'localeMatcher', 'string', ['lookup', 'best fit'], 'best fit');\n opt.localeMatcher = matcher;\n var calendar = ecma402_abstract_1.GetOption(options, 'calendar', 'string', undefined, undefined);\n if (calendar !== undefined && !TYPE_REGEX.test(calendar)) {\n throw new RangeError('Malformed calendar');\n }\n var internalSlots = getInternalSlots(dtf);\n opt.ca = calendar;\n var numberingSystem = ecma402_abstract_1.GetOption(options, 'numberingSystem', 'string', undefined, undefined);\n if (numberingSystem !== undefined && !TYPE_REGEX.test(numberingSystem)) {\n throw new RangeError('Malformed numbering system');\n }\n opt.nu = numberingSystem;\n var hour12 = ecma402_abstract_1.GetOption(options, 'hour12', 'boolean', undefined, undefined);\n var hourCycle = ecma402_abstract_1.GetOption(options, 'hourCycle', 'string', ['h11', 'h12', 'h23', 'h24'], undefined);\n if (hour12 !== undefined) {\n // @ts-ignore\n hourCycle = null;\n }\n opt.hc = hourCycle;\n var r = intl_localematcher_1.ResolveLocale(availableLocales, requestedLocales, opt, relevantExtensionKeys, localeData, getDefaultLocale);\n internalSlots.locale = r.locale;\n calendar = r.ca;\n internalSlots.calendar = calendar;\n internalSlots.hourCycle = r.hc;\n internalSlots.numberingSystem = r.nu;\n var dataLocale = r.dataLocale;\n internalSlots.dataLocale = dataLocale;\n var timeZone = options.timeZone;\n if (timeZone !== undefined) {\n timeZone = String(timeZone);\n if (!ecma402_abstract_1.IsValidTimeZoneName(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks })) {\n throw new RangeError('Invalid timeZoneName');\n }\n timeZone = ecma402_abstract_1.CanonicalizeTimeZoneName(timeZone, { tzData: tzData, uppercaseLinks: uppercaseLinks });\n }\n else {\n timeZone = getDefaultTimeZone();\n }\n internalSlots.timeZone = timeZone;\n opt = Object.create(null);\n opt.weekday = ecma402_abstract_1.GetOption(options, 'weekday', 'string', ['narrow', 'short', 'long'], undefined);\n opt.era = ecma402_abstract_1.GetOption(options, 'era', 'string', ['narrow', 'short', 'long'], undefined);\n opt.year = ecma402_abstract_1.GetOption(options, 'year', 'string', ['2-digit', 'numeric'], undefined);\n opt.month = ecma402_abstract_1.GetOption(options, 'month', 'string', ['2-digit', 'numeric', 'narrow', 'short', 'long'], undefined);\n opt.day = ecma402_abstract_1.GetOption(options, 'day', 'string', ['2-digit', 'numeric'], undefined);\n opt.hour = ecma402_abstract_1.GetOption(options, 'hour', 'string', ['2-digit', 'numeric'], undefined);\n opt.minute = ecma402_abstract_1.GetOption(options, 'minute', 'string', ['2-digit', 'numeric'], undefined);\n opt.second = ecma402_abstract_1.GetOption(options, 'second', 'string', ['2-digit', 'numeric'], undefined);\n opt.timeZoneName = ecma402_abstract_1.GetOption(options, 'timeZoneName', 'string', ['short', 'long'], undefined);\n opt.fractionalSecondDigits = ecma402_abstract_1.GetNumberOption(options, 'fractionalSecondDigits', 1, 3, \n // @ts-expect-error\n undefined);\n var dataLocaleData = localeData[dataLocale];\n ecma402_abstract_1.invariant(!!dataLocaleData, \"Missing locale data for \" + dataLocale);\n var formats = dataLocaleData.formats[calendar];\n // UNSPECCED: IMPLEMENTATION DETAILS\n if (!formats) {\n throw new RangeError(\"Calendar \\\"\" + calendar + \"\\\" is not supported. Try setting \\\"calendar\\\" to 1 of the following: \" + Object.keys(dataLocaleData.formats).join(', '));\n }\n var formatMatcher = ecma402_abstract_1.GetOption(options, 'formatMatcher', 'string', ['basic', 'best fit'], 'best fit');\n var dateStyle = ecma402_abstract_1.GetOption(options, 'dateStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);\n internalSlots.dateStyle = dateStyle;\n var timeStyle = ecma402_abstract_1.GetOption(options, 'timeStyle', 'string', ['full', 'long', 'medium', 'short'], undefined);\n internalSlots.timeStyle = timeStyle;\n var bestFormat;\n if (dateStyle === undefined && timeStyle === undefined) {\n if (formatMatcher === 'basic') {\n bestFormat = BasicFormatMatcher_1.BasicFormatMatcher(opt, formats);\n }\n else {\n // IMPL DETAILS START\n if (isTimeRelated(opt)) {\n var hc = resolveHourCycle(internalSlots.hourCycle, dataLocaleData.hourCycle, hour12);\n opt.hour12 = hc === 'h11' || hc === 'h12';\n }\n // IMPL DETAILS END\n bestFormat = BestFitFormatMatcher_1.BestFitFormatMatcher(opt, formats);\n }\n }\n else {\n for (var _i = 0, DATE_TIME_PROPS_1 = utils_1.DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {\n var prop = DATE_TIME_PROPS_1[_i];\n var p = opt[prop];\n if (p !== undefined) {\n throw new TypeError(\"Intl.DateTimeFormat can't set option \" + prop + \" when \" + (dateStyle ? 'dateStyle' : 'timeStyle') + \" is used\");\n }\n }\n bestFormat = DateTimeStyleFormat_1.DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData);\n }\n // IMPL DETAIL START\n // For debugging\n internalSlots.format = bestFormat;\n // IMPL DETAIL END\n for (var prop in opt) {\n var p = bestFormat[prop];\n if (p !== undefined) {\n internalSlots[prop] = p;\n }\n }\n var pattern;\n var rangePatterns;\n if (internalSlots.hour !== undefined) {\n var hc = resolveHourCycle(internalSlots.hourCycle, dataLocaleData.hourCycle, hour12);\n internalSlots.hourCycle = hc;\n if (hc === 'h11' || hc === 'h12') {\n pattern = bestFormat.pattern12;\n rangePatterns = bestFormat.rangePatterns12;\n }\n else {\n pattern = bestFormat.pattern;\n rangePatterns = bestFormat.rangePatterns;\n }\n }\n else {\n // @ts-ignore\n internalSlots.hourCycle = undefined;\n pattern = bestFormat.pattern;\n rangePatterns = bestFormat.rangePatterns;\n }\n internalSlots.pattern = pattern;\n internalSlots.rangePatterns = rangePatterns;\n return dtf;\n}\nexports.InitializeDateTimeFormat = InitializeDateTimeFormat;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BasicFormatMatcher = void 0;\nvar tslib_1 = require(\"tslib\");\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar utils_1 = require(\"./utils\");\n/**\n * https://tc39.es/ecma402/#sec-basicformatmatcher\n * @param options\n * @param formats\n */\nfunction BasicFormatMatcher(options, formats) {\n var bestScore = -Infinity;\n var bestFormat = formats[0];\n ecma402_abstract_1.invariant(Array.isArray(formats), 'formats should be a list of things');\n for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {\n var format = formats_1[_i];\n var score = 0;\n for (var _a = 0, DATE_TIME_PROPS_1 = utils_1.DATE_TIME_PROPS; _a < DATE_TIME_PROPS_1.length; _a++) {\n var prop = DATE_TIME_PROPS_1[_a];\n var optionsProp = options[prop];\n var formatProp = format[prop];\n if (optionsProp === undefined && formatProp !== undefined) {\n score -= utils_1.additionPenalty;\n }\n else if (optionsProp !== undefined && formatProp === undefined) {\n score -= utils_1.removalPenalty;\n }\n else if (optionsProp !== formatProp) {\n var values = void 0;\n if (prop === 'fractionalSecondDigits') {\n values = [1, 2, 3];\n }\n else {\n values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n }\n var optionsPropIndex = values.indexOf(optionsProp);\n var formatPropIndex = values.indexOf(formatProp);\n var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));\n if (delta === 2) {\n score -= utils_1.longMorePenalty;\n }\n else if (delta === 1) {\n score -= utils_1.shortMorePenalty;\n }\n else if (delta === -1) {\n score -= utils_1.shortLessPenalty;\n }\n else if (delta === -2) {\n score -= utils_1.longLessPenalty;\n }\n }\n }\n if (score > bestScore) {\n bestScore = score;\n bestFormat = format;\n }\n }\n return tslib_1.__assign({}, bestFormat);\n}\nexports.BasicFormatMatcher = BasicFormatMatcher;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BestFitFormatMatcher = exports.bestFitFormatMatcherScore = void 0;\nvar tslib_1 = require(\"tslib\");\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nvar utils_1 = require(\"./utils\");\nvar skeleton_1 = require(\"./skeleton\");\nfunction isNumericType(t) {\n return t === 'numeric' || t === '2-digit';\n}\n/**\n * Credit: https://github.com/andyearnshaw/Intl.js/blob/0958dc1ad8153f1056653ea22b8208f0df289a4e/src/12.datetimeformat.js#L611\n * with some modifications\n * @param options\n * @param format\n */\nfunction bestFitFormatMatcherScore(options, format) {\n var score = 0;\n if (options.hour12 && !format.hour12) {\n score -= utils_1.removalPenalty;\n }\n else if (!options.hour12 && format.hour12) {\n score -= utils_1.additionPenalty;\n }\n for (var _i = 0, DATE_TIME_PROPS_1 = utils_1.DATE_TIME_PROPS; _i < DATE_TIME_PROPS_1.length; _i++) {\n var prop = DATE_TIME_PROPS_1[_i];\n var optionsProp = options[prop];\n var formatProp = format[prop];\n if (optionsProp === undefined && formatProp !== undefined) {\n score -= utils_1.additionPenalty;\n }\n else if (optionsProp !== undefined && formatProp === undefined) {\n score -= utils_1.removalPenalty;\n }\n else if (optionsProp !== formatProp) {\n // extra penalty for numeric vs non-numeric\n if (isNumericType(optionsProp) !==\n isNumericType(formatProp)) {\n score -= utils_1.differentNumericTypePenalty;\n }\n else {\n var values = ['2-digit', 'numeric', 'narrow', 'short', 'long'];\n var optionsPropIndex = values.indexOf(optionsProp);\n var formatPropIndex = values.indexOf(formatProp);\n var delta = Math.max(-2, Math.min(formatPropIndex - optionsPropIndex, 2));\n if (delta === 2) {\n score -= utils_1.longMorePenalty;\n }\n else if (delta === 1) {\n score -= utils_1.shortMorePenalty;\n }\n else if (delta === -1) {\n score -= utils_1.shortLessPenalty;\n }\n else if (delta === -2) {\n score -= utils_1.longLessPenalty;\n }\n }\n }\n }\n return score;\n}\nexports.bestFitFormatMatcherScore = bestFitFormatMatcherScore;\n/**\n * https://tc39.es/ecma402/#sec-bestfitformatmatcher\n * Just alias to basic for now\n * @param options\n * @param formats\n * @param implDetails Implementation details\n */\nfunction BestFitFormatMatcher(options, formats) {\n var bestScore = -Infinity;\n var bestFormat = formats[0];\n ecma402_abstract_1.invariant(Array.isArray(formats), 'formats should be a list of things');\n for (var _i = 0, formats_1 = formats; _i < formats_1.length; _i++) {\n var format = formats_1[_i];\n var score = bestFitFormatMatcherScore(options, format);\n if (score > bestScore) {\n bestScore = score;\n bestFormat = format;\n }\n }\n var skeletonFormat = tslib_1.__assign({}, bestFormat);\n var patternFormat = { rawPattern: bestFormat.rawPattern };\n skeleton_1.processDateTimePattern(bestFormat.rawPattern, patternFormat);\n // Kinda following https://github.com/unicode-org/icu/blob/dd50e38f459d84e9bf1b0c618be8483d318458ad/icu4j/main/classes/core/src/com/ibm/icu/text/DateTimePatternGenerator.java\n // Method adjustFieldTypes\n for (var prop in skeletonFormat) {\n var skeletonValue = skeletonFormat[prop];\n var patternValue = patternFormat[prop];\n var requestedValue = options[prop];\n // Don't mess with minute/second or we can get in the situation of\n // 7:0:0 which is weird\n if (prop === 'minute' || prop === 'second') {\n continue;\n }\n // Nothing to do here\n if (!requestedValue) {\n continue;\n }\n // https://unicode.org/reports/tr35/tr35-dates.html#Matching_Skeletons\n // Looks like we should not convert numeric to alphabetic but the other way\n // around is ok\n if (isNumericType(patternValue) &&\n !isNumericType(requestedValue)) {\n continue;\n }\n if (skeletonValue === requestedValue) {\n continue;\n }\n patternFormat[prop] = requestedValue;\n }\n // Copy those over\n patternFormat.pattern = skeletonFormat.pattern;\n patternFormat.pattern12 = skeletonFormat.pattern12;\n patternFormat.skeleton = skeletonFormat.skeleton;\n patternFormat.rangePatterns = skeletonFormat.rangePatterns;\n patternFormat.rangePatterns12 = skeletonFormat.rangePatterns12;\n return patternFormat;\n}\nexports.BestFitFormatMatcher = BestFitFormatMatcher;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DateTimeStyleFormat = void 0;\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\nfunction DateTimeStyleFormat(dateStyle, timeStyle, dataLocaleData) {\n var dateFormat, timeFormat;\n if (timeStyle !== undefined) {\n ecma402_abstract_1.invariant(timeStyle === 'full' ||\n timeStyle === 'long' ||\n timeStyle === 'medium' ||\n timeStyle === 'short', 'invalid timeStyle');\n timeFormat = dataLocaleData.timeFormat[timeStyle];\n }\n if (dateStyle !== undefined) {\n ecma402_abstract_1.invariant(dateStyle === 'full' ||\n dateStyle === 'long' ||\n dateStyle === 'medium' ||\n dateStyle === 'short', 'invalid dateStyle');\n dateFormat = dataLocaleData.dateFormat[dateStyle];\n }\n if (dateStyle !== undefined && timeStyle !== undefined) {\n var format = {};\n for (var field in dateFormat) {\n if (field !== 'pattern') {\n // @ts-ignore\n format[field] = dateFormat[field];\n }\n }\n for (var field in timeFormat) {\n if (field !== 'pattern' && field !== 'pattern12') {\n // @ts-ignore\n format[field] = timeFormat[field];\n }\n }\n var connector = dataLocaleData.dateTimeFormat[dateStyle];\n var pattern = connector\n .replace('{0}', timeFormat.pattern)\n .replace('{1}', dateFormat.pattern);\n format.pattern = pattern;\n if ('pattern12' in timeFormat) {\n var pattern12 = connector\n .replace('{0}', timeFormat.pattern12)\n .replace('{1}', dateFormat.pattern);\n format.pattern12 = pattern12;\n }\n return format;\n }\n if (timeStyle !== undefined) {\n return timeFormat;\n }\n ecma402_abstract_1.invariant(dateStyle !== undefined, 'dateStyle should not be undefined');\n return dateFormat;\n}\nexports.DateTimeStyleFormat = DateTimeStyleFormat;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FormatDateTimeToParts = void 0;\nvar PartitionDateTimePattern_1 = require(\"./PartitionDateTimePattern\");\nvar ecma402_abstract_1 = require(\"@formatjs/ecma402-abstract\");\n/**\n * https://tc39.es/ecma402/#sec-formatdatetimetoparts\n *\n * @param dtf\n * @param x\n * @param implDetails\n */\nfunction FormatDateTimeToParts(dtf, x, implDetails) {\n var parts = PartitionDateTimePattern_1.PartitionDateTimePattern(dtf, x, implDetails);\n var result = ecma402_abstract_1.ArrayCreate(0);\n for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n var part = parts_1[_i];\n result.push({\n type: part.type,\n value: part.value,\n });\n }\n return result;\n}\nexports.FormatDateTimeToParts = FormatDateTimeToParts;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FormatDateTimeRangeToParts = void 0;\nvar PartitionDateTimeRangePattern_1 = require(\"./PartitionDateTimeRangePattern\");\nfunction FormatDateTimeRangeToParts(dtf, x, y, implDetails) {\n var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);\n var result = new Array(0);\n for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n var part = parts_1[_i];\n result.push({\n type: part.type,\n value: part.value,\n source: part.source,\n });\n }\n return result;\n}\nexports.FormatDateTimeRangeToParts = FormatDateTimeRangeToParts;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FormatDateTimeRange = void 0;\nvar PartitionDateTimeRangePattern_1 = require(\"./PartitionDateTimeRangePattern\");\nfunction FormatDateTimeRange(dtf, x, y, implDetails) {\n var parts = PartitionDateTimeRangePattern_1.PartitionDateTimeRangePattern(dtf, x, y, implDetails);\n var result = '';\n for (var _i = 0, parts_1 = parts; _i < parts_1.length; _i++) {\n var part = parts_1[_i];\n result += part.value;\n }\n return result;\n}\nexports.FormatDateTimeRange = FormatDateTimeRange;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.shouldPolyfill = void 0;\nfunction supportsDateStyle() {\n try {\n return !!new Intl.DateTimeFormat(undefined, {\n dateStyle: 'short',\n }).resolvedOptions().dateStyle;\n }\n catch (e) {\n return false;\n }\n}\n/**\n * https://bugs.chromium.org/p/chromium/issues/detail?id=865351\n */\nfunction hasChromeLt71Bug() {\n try {\n return (new Intl.DateTimeFormat('en', {\n hourCycle: 'h11',\n hour: 'numeric',\n }).formatToParts(0)[2].type !== 'dayPeriod');\n }\n catch (e) {\n return false;\n }\n}\n/**\n * Node 14's version of Intl.DateTimeFormat does not throw\n * when dateStyle/timeStyle is used with other options.\n * This was fixed in newer V8 versions\n */\nfunction hasUnthrownDateTimeStyleBug() {\n try {\n return !!new Intl.DateTimeFormat('en', {\n dateStyle: 'short',\n hour: 'numeric',\n }).format(new Date(0));\n }\n catch (e) {\n return false;\n }\n}\nfunction supportedLocalesOf(locale) {\n if (!locale) {\n return true;\n }\n var locales = Array.isArray(locale) ? locale : [locale];\n return (Intl.DateTimeFormat.supportedLocalesOf(locales).length === locales.length);\n}\nfunction shouldPolyfill(locale) {\n return (!('DateTimeFormat' in Intl) ||\n !('formatToParts' in Intl.DateTimeFormat.prototype) ||\n !('formatRange' in Intl.DateTimeFormat.prototype) ||\n hasChromeLt71Bug() ||\n hasUnthrownDateTimeStyleBug() ||\n !supportsDateStyle() ||\n !supportedLocalesOf(locale));\n}\nexports.shouldPolyfill = shouldPolyfill;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.toLocaleTimeString = exports.toLocaleDateString = exports.toLocaleString = void 0;\n// eslint-disable-next-line import/no-cycle\nvar core_1 = require(\"./core\");\nvar ToDateTimeOptions_1 = require(\"./abstract/ToDateTimeOptions\");\n/**\n * Number.prototype.toLocaleString ponyfill\n * https://tc39.es/ecma402/#sup-number.prototype.tolocalestring\n */\nfunction toLocaleString(x, locales, options) {\n var dtf = new core_1.DateTimeFormat(locales, options);\n return dtf.format(x);\n}\nexports.toLocaleString = toLocaleString;\nfunction toLocaleDateString(x, locales, options) {\n var dtf = new core_1.DateTimeFormat(locales, ToDateTimeOptions_1.ToDateTimeOptions(options, 'date', 'date'));\n return dtf.format(x);\n}\nexports.toLocaleDateString = toLocaleDateString;\nfunction toLocaleTimeString(x, locales, options) {\n var dtf = new core_1.DateTimeFormat(locales, ToDateTimeOptions_1.ToDateTimeOptions(options, 'time', 'time'));\n return dtf.format(x);\n}\nexports.toLocaleTimeString = toLocaleTimeString;\n","/* @generated */\t\n\n // prettier-ignore\n if (Intl.DateTimeFormat && typeof Intl.DateTimeFormat.__addLocaleData === 'function') {\n Intl.DateTimeFormat.__addLocaleData({\"data\":{\"am\":\"AM\",\"pm\":\"PM\",\"weekday\":{\"narrow\":[\"S\",\"M\",\"T\",\"W\",\"T\",\"F\",\"S\"],\"short\":[\"Sun\",\"Mon\",\"Tue\",\"Wed\",\"Thu\",\"Fri\",\"Sat\"],\"long\":[\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"]},\"era\":{\"narrow\":{\"BC\":\"B\",\"AD\":\"A\"},\"short\":{\"BC\":\"BC\",\"AD\":\"AD\"},\"long\":{\"BC\":\"Before Christ\",\"AD\":\"Anno Domini\"}},\"month\":{\"narrow\":[\"J\",\"F\",\"M\",\"A\",\"M\",\"J\",\"J\",\"A\",\"S\",\"O\",\"N\",\"D\"],\"short\":[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"],\"long\":[\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"]},\"timeZoneName\":{\"America/Rio_Branco\":{\"long\":[\"Acre Standard Time\",\"Acre Summer Time\"]},\"Asia/Kabul\":{\"long\":[\"Afghanistan Time\",\"Afghanistan Time\"]},\"Africa/Maputo\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Bujumbura\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Gaborone\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Lubumbashi\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Blantyre\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Kigali\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Lusaka\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Harare\":{\"long\":[\"Central Africa Time\",\"Central Africa Time\"]},\"Africa/Nairobi\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Africa/Djibouti\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Africa/Asmera\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Africa/Addis_Ababa\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Indian/Comoro\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Indian/Antananarivo\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Africa/Mogadishu\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Africa/Dar_es_Salaam\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Africa/Kampala\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Indian/Mayotte\":{\"long\":[\"East Africa Time\",\"East Africa Time\"]},\"Africa/Johannesburg\":{\"long\":[\"South Africa Standard Time\",\"South Africa Standard Time\"]},\"Africa/Maseru\":{\"long\":[\"South Africa Standard Time\",\"South Africa Standard Time\"]},\"Africa/Mbabane\":{\"long\":[\"South Africa Standard Time\",\"South Africa Standard Time\"]},\"Africa/Lagos\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Luanda\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Porto-Novo\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Kinshasa\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Bangui\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Brazzaville\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Douala\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Libreville\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Malabo\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Niamey\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Africa/Ndjamena\":{\"long\":[\"West Africa Standard Time\",\"West Africa Summer Time\"]},\"Asia/Aqtobe\":{\"long\":[\"West Kazakhstan Time\",\"West Kazakhstan Time\"]},\"America/Juneau\":{\"long\":[\"Alaska Standard Time\",\"Alaska Daylight Time\"],\"short\":[\"AKST\",\"AKDT\"]},\"Asia/Almaty\":{\"long\":[\"East Kazakhstan Time\",\"East Kazakhstan Time\"]},\"America/Manaus\":{\"long\":[\"Amazon Standard Time\",\"Amazon Summer Time\"]},\"America/Chicago\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/Belize\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/Winnipeg\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/Costa_Rica\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/Guatemala\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/Tegucigalpa\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/Mexico_City\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/El_Salvador\":{\"long\":[\"Central Standard Time\",\"Central Daylight Time\"],\"short\":[\"CST\",\"CDT\"]},\"America/New_York\":{\"long\":[\"Eastern Standard Time\",\"Eastern Daylight Time\"],\"short\":[\"EST\",\"EDT\"]},\"America/Nassau\":{\"long\":[\"Eastern Standard Time\",\"Eastern Daylight Time\"],\"short\":[\"EST\",\"EDT\"]},\"America/Toronto\":{\"long\":[\"Eastern Standard Time\",\"Eastern Daylight Time\"],\"short\":[\"EST\",\"EDT\"]},\"America/Port-au-Prince\":{\"long\":[\"Eastern Standard Time\",\"Eastern Daylight Time\"],\"short\":[\"EST\",\"EDT\"]},\"America/Jamaica\":{\"long\":[\"Eastern Standard Time\",\"Eastern Daylight Time\"],\"short\":[\"EST\",\"EDT\"]},\"America/Cayman\":{\"long\":[\"Eastern Standard Time\",\"Eastern Daylight Time\"],\"short\":[\"EST\",\"EDT\"]},\"America/Panama\":{\"long\":[\"Eastern Standard Time\",\"Eastern Daylight Time\"],\"short\":[\"EST\",\"EDT\"]},\"America/Denver\":{\"long\":[\"Mountain Standard Time\",\"Mountain Daylight Time\"],\"short\":[\"MST\",\"MDT\"]},\"America/Edmonton\":{\"long\":[\"Mountain Standard Time\",\"Mountain Daylight Time\"],\"short\":[\"MST\",\"MDT\"]},\"America/Hermosillo\":{\"long\":[\"Mountain Standard Time\",\"Mountain Daylight Time\"],\"short\":[\"MST\",\"MDT\"]},\"America/Los_Angeles\":{\"long\":[\"Pacific Standard Time\",\"Pacific Daylight Time\"],\"short\":[\"PST\",\"PDT\"]},\"America/Vancouver\":{\"long\":[\"Pacific Standard Time\",\"Pacific Daylight Time\"],\"short\":[\"PST\",\"PDT\"]},\"America/Tijuana\":{\"long\":[\"Pacific Standard Time\",\"Pacific Daylight Time\"],\"short\":[\"PST\",\"PDT\"]},\"Asia/Anadyr\":{\"long\":[\"Anadyr Standard Time\",\"Anadyr Summer Time\"]},\"Pacific/Apia\":{\"long\":[\"Apia Standard Time\",\"Apia Daylight Time\"]},\"Asia/Riyadh\":{\"long\":[\"Arabian Standard Time\",\"Arabian Daylight Time\"]},\"Asia/Bahrain\":{\"long\":[\"Arabian Standard Time\",\"Arabian Daylight Time\"]},\"Asia/Baghdad\":{\"long\":[\"Arabian Standard Time\",\"Arabian Daylight Time\"]},\"Asia/Kuwait\":{\"long\":[\"Arabian Standard Time\",\"Arabian Daylight Time\"]},\"Asia/Qatar\":{\"long\":[\"Arabian Standard Time\",\"Arabian Daylight Time\"]},\"Asia/Aden\":{\"long\":[\"Arabian Standard Time\",\"Arabian Daylight Time\"]},\"America/Buenos_Aires\":{\"long\":[\"Argentina Standard Time\",\"Argentina Summer Time\"]},\"America/Argentina/San_Luis\":{\"long\":[\"Western Argentina Standard Time\",\"Western Argentina Summer Time\"]},\"Asia/Ashgabat\":{\"long\":[\"Turkmenistan Standard Time\",\"Turkmenistan Summer Time\"]},\"America/Halifax\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Antigua\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Anguilla\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Aruba\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Barbados\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"Atlantic/Bermuda\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Kralendijk\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Curacao\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Dominica\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Grenada\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Thule\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Guadeloupe\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/St_Kitts\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/St_Lucia\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Marigot\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Martinique\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Montserrat\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Puerto_Rico\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Lower_Princes\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Port_of_Spain\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/St_Vincent\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/Tortola\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"America/St_Thomas\":{\"long\":[\"Atlantic Standard Time\",\"Atlantic Daylight Time\"],\"short\":[\"AST\",\"ADT\"]},\"Australia/Adelaide\":{\"long\":[\"Australian Central Standard Time\",\"Australian Central Daylight Time\"]},\"Australia/Eucla\":{\"long\":[\"Australian Central Western Standard Time\",\"Australian Central Western Daylight Time\"]},\"Australia/Sydney\":{\"long\":[\"Australian Eastern Standard Time\",\"Australian Eastern Daylight Time\"]},\"Australia/Perth\":{\"long\":[\"Australian Western Standard Time\",\"Australian Western Daylight Time\"]},\"Atlantic/Azores\":{\"long\":[\"Azores Standard Time\",\"Azores Summer Time\"]},\"Asia/Thimphu\":{\"long\":[\"Bhutan Time\",\"Bhutan Time\"]},\"America/La_Paz\":{\"long\":[\"Bolivia Time\",\"Bolivia Time\"]},\"Asia/Kuching\":{\"long\":[\"Malaysia Time\",\"Malaysia Time\"]},\"America/Sao_Paulo\":{\"long\":[\"Brasilia Standard Time\",\"Brasilia Summer Time\"]},\"Europe/London\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Asia/Brunei\":{\"long\":[\"Brunei Darussalam Time\",\"Brunei Darussalam Time\"]},\"Atlantic/Cape_Verde\":{\"long\":[\"Cape Verde Standard Time\",\"Cape Verde Summer Time\"]},\"Antarctica/Casey\":{\"long\":[\"Casey Time\",\"Casey Time\"]},\"Pacific/Saipan\":{\"long\":[\"North Mariana Islands Time\",\"North Mariana Islands Time\"]},\"Pacific/Guam\":{\"long\":[\"Guam Standard Time\",\"Guam Standard Time\"]},\"Pacific/Chatham\":{\"long\":[\"Chatham Standard Time\",\"Chatham Daylight Time\"]},\"America/Santiago\":{\"long\":[\"Chile Standard Time\",\"Chile Summer Time\"]},\"Asia/Shanghai\":{\"long\":[\"China Standard Time\",\"China Daylight Time\"]},\"Asia/Choibalsan\":{\"long\":[\"Choibalsan Standard Time\",\"Choibalsan Summer Time\"]},\"Indian/Christmas\":{\"long\":[\"Christmas Island Time\",\"Christmas Island Time\"]},\"Indian/Cocos\":{\"long\":[\"Cocos Islands Time\",\"Cocos Islands Time\"]},\"America/Bogota\":{\"long\":[\"Colombia Standard Time\",\"Colombia Summer Time\"]},\"Pacific/Rarotonga\":{\"long\":[\"Cook Islands Standard Time\",\"Cook Islands Half Summer Time\"]},\"America/Havana\":{\"long\":[\"Cuba Standard Time\",\"Cuba Daylight Time\"]},\"Antarctica/Davis\":{\"long\":[\"Davis Time\",\"Davis Time\"]},\"Antarctica/DumontDUrville\":{\"long\":[\"Dumont-d’Urville Time\",\"Dumont-d’Urville Time\"]},\"Asia/Dushanbe\":{\"long\":[\"Tajikistan Time\",\"Tajikistan Time\"]},\"America/Paramaribo\":{\"long\":[\"Suriname Time\",\"Suriname Time\"]},\"Asia/Dili\":{\"long\":[\"East Timor Time\",\"East Timor Time\"]},\"Pacific/Easter\":{\"long\":[\"Easter Island Standard Time\",\"Easter Island Summer Time\"]},\"America/Guayaquil\":{\"long\":[\"Ecuador Time\",\"Ecuador Time\"]},\"Europe/Paris\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Andorra\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Tirane\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Vienna\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Sarajevo\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Brussels\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Zurich\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Prague\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Berlin\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Copenhagen\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Madrid\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Gibraltar\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Zagreb\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Budapest\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Rome\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Vaduz\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Luxembourg\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Monaco\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Podgorica\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Skopje\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Malta\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Amsterdam\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Oslo\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Warsaw\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Belgrade\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Stockholm\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Ljubljana\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Arctic/Longyearbyen\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Bratislava\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/San_Marino\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Africa/Tunis\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Vatican\":{\"long\":[\"Central European Standard Time\",\"Central European Summer Time\"]},\"Europe/Bucharest\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Europe/Mariehamn\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Europe/Sofia\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Asia/Nicosia\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Africa/Cairo\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Europe/Helsinki\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Europe/Athens\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Asia/Amman\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Asia/Beirut\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Asia/Damascus\":{\"long\":[\"Eastern European Standard Time\",\"Eastern European Summer Time\"]},\"Europe/Minsk\":{\"long\":[\"Further-eastern European Time\",\"Further-eastern European Time\"]},\"Europe/Kaliningrad\":{\"long\":[\"Further-eastern European Time\",\"Further-eastern European Time\"]},\"Atlantic/Canary\":{\"long\":[\"Western European Standard Time\",\"Western European Summer Time\"]},\"Atlantic/Faeroe\":{\"long\":[\"Western European Standard Time\",\"Western European Summer Time\"]},\"Atlantic/Stanley\":{\"long\":[\"Falkland Islands Standard Time\",\"Falkland Islands Summer Time\"]},\"Pacific/Fiji\":{\"long\":[\"Fiji Standard Time\",\"Fiji Summer Time\"]},\"America/Cayenne\":{\"long\":[\"French Guiana Time\",\"French Guiana Time\"]},\"Indian/Kerguelen\":{\"long\":[\"French Southern & Antarctic Time\",\"French Southern & Antarctic Time\"]},\"Asia/Bishkek\":{\"long\":[\"Kyrgyzstan Time\",\"Kyrgyzstan Time\"]},\"Pacific/Galapagos\":{\"long\":[\"Galapagos Time\",\"Galapagos Time\"]},\"Pacific/Gambier\":{\"long\":[\"Gambier Time\",\"Gambier Time\"]},\"Pacific/Tarawa\":{\"long\":[\"Gilbert Islands Time\",\"Gilbert Islands Time\"]},\"Atlantic/Reykjavik\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Ouagadougou\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Abidjan\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Accra\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Banjul\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Conakry\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Bamako\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Nouakchott\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Atlantic/St_Helena\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Freetown\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Dakar\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"Africa/Lome\":{\"long\":[\"Greenwich Mean Time\",\"Greenwich Mean Time\"],\"short\":[\"GMT\",\"GMT\"]},\"America/Scoresbysund\":{\"long\":[\"East Greenland Standard Time\",\"East Greenland Summer Time\"]},\"America/Godthab\":{\"long\":[\"West Greenland Standard Time\",\"West Greenland Summer Time\"]},\"Asia/Dubai\":{\"long\":[\"Gulf Standard Time\",\"Gulf Standard Time\"]},\"Asia/Muscat\":{\"long\":[\"Gulf Standard Time\",\"Gulf Standard Time\"]},\"America/Guyana\":{\"long\":[\"Guyana Time\",\"Guyana Time\"]},\"Pacific/Honolulu\":{\"long\":[\"Hawaii-Aleutian Standard Time\",\"Hawaii-Aleutian Daylight Time\"],\"short\":[\"HAST\",\"HADT\"]},\"Asia/Hong_Kong\":{\"long\":[\"Hong Kong Standard Time\",\"Hong Kong Summer Time\"]},\"Asia/Hovd\":{\"long\":[\"Hovd Standard Time\",\"Hovd Summer Time\"]},\"Asia/Calcutta\":{\"long\":[\"India Standard Time\",\"India Standard Time\"]},\"Asia/Colombo\":{\"long\":[\"Lanka Time\",\"Lanka Time\"]},\"Indian/Chagos\":{\"long\":[\"Indian Ocean Time\",\"Indian Ocean Time\"]},\"Asia/Bangkok\":{\"long\":[\"Indochina Time\",\"Indochina Time\"]},\"Asia/Phnom_Penh\":{\"long\":[\"Indochina Time\",\"Indochina Time\"]},\"Asia/Vientiane\":{\"long\":[\"Indochina Time\",\"Indochina Time\"]},\"Asia/Makassar\":{\"long\":[\"Central Indonesia Time\",\"Central Indonesia Time\"]},\"Asia/Jayapura\":{\"long\":[\"Eastern Indonesia Time\",\"Eastern Indonesia Time\"]},\"Asia/Jakarta\":{\"long\":[\"Western Indonesia Time\",\"Western Indonesia Time\"]},\"Asia/Tehran\":{\"long\":[\"Iran Standard Time\",\"Iran Daylight Time\"]},\"Asia/Irkutsk\":{\"long\":[\"Irkutsk Standard Time\",\"Irkutsk Summer Time\"]},\"Asia/Jerusalem\":{\"long\":[\"Israel Standard Time\",\"Israel Daylight Time\"]},\"Asia/Tokyo\":{\"long\":[\"Japan Standard Time\",\"Japan Daylight Time\"]},\"Asia/Kamchatka\":{\"long\":[\"Petropavlovsk-Kamchatski Standard Time\",\"Petropavlovsk-Kamchatski Summer Time\"]},\"Asia/Karachi\":{\"long\":[\"Pakistan Standard Time\",\"Pakistan Summer Time\"]},\"Asia/Qyzylorda\":{\"long\":[\"Qyzylorda Standard Time\",\"Qyzylorda Summer Time\"]},\"Asia/Seoul\":{\"long\":[\"Korean Standard Time\",\"Korean Daylight Time\"]},\"Pacific/Kosrae\":{\"long\":[\"Kosrae Time\",\"Kosrae Time\"]},\"Asia/Krasnoyarsk\":{\"long\":[\"Krasnoyarsk Standard Time\",\"Krasnoyarsk Summer Time\"]},\"Europe/Samara\":{\"long\":[\"Samara Standard Time\",\"Samara Summer Time\"]},\"Pacific/Kiritimati\":{\"long\":[\"Line Islands Time\",\"Line Islands Time\"]},\"Australia/Lord_Howe\":{\"long\":[\"Lord Howe Standard Time\",\"Lord Howe Daylight Time\"]},\"Asia/Macau\":{\"long\":[\"Macao Standard Time\",\"Macao Summer Time\"]},\"Antarctica/Macquarie\":{\"long\":[\"Macquarie Island Time\",\"Macquarie Island Time\"]},\"Asia/Magadan\":{\"long\":[\"Magadan Standard Time\",\"Magadan Summer Time\"]},\"Indian/Maldives\":{\"long\":[\"Maldives Time\",\"Maldives Time\"]},\"Pacific/Marquesas\":{\"long\":[\"Marquesas Time\",\"Marquesas Time\"]},\"Pacific/Majuro\":{\"long\":[\"Marshall Islands Time\",\"Marshall Islands Time\"]},\"Indian/Mauritius\":{\"long\":[\"Mauritius Standard Time\",\"Mauritius Summer Time\"]},\"Antarctica/Mawson\":{\"long\":[\"Mawson Time\",\"Mawson Time\"]},\"America/Santa_Isabel\":{\"long\":[\"Northwest Mexico Standard Time\",\"Northwest Mexico Daylight Time\"]},\"America/Mazatlan\":{\"long\":[\"Mexican Pacific Standard Time\",\"Mexican Pacific Daylight Time\"]},\"Asia/Ulaanbaatar\":{\"long\":[\"Ulaanbaatar Standard Time\",\"Ulaanbaatar Summer Time\"]},\"Europe/Moscow\":{\"long\":[\"Moscow Standard Time\",\"Moscow Summer Time\"]},\"Asia/Rangoon\":{\"long\":[\"Myanmar Time\",\"Myanmar Time\"]},\"Pacific/Nauru\":{\"long\":[\"Nauru Time\",\"Nauru Time\"]},\"Asia/Katmandu\":{\"long\":[\"Nepal Time\",\"Nepal Time\"]},\"Pacific/Noumea\":{\"long\":[\"New Caledonia Standard Time\",\"New Caledonia Summer Time\"]},\"Pacific/Auckland\":{\"long\":[\"New Zealand Standard Time\",\"New Zealand Daylight Time\"]},\"Antarctica/McMurdo\":{\"long\":[\"New Zealand Standard Time\",\"New Zealand Daylight Time\"]},\"America/St_Johns\":{\"long\":[\"Newfoundland Standard Time\",\"Newfoundland Daylight Time\"]},\"Pacific/Niue\":{\"long\":[\"Niue Time\",\"Niue Time\"]},\"Pacific/Norfolk\":{\"long\":[\"Norfolk Island Standard Time\",\"Norfolk Island Daylight Time\"]},\"America/Noronha\":{\"long\":[\"Fernando de Noronha Standard Time\",\"Fernando de Noronha Summer Time\"]},\"Asia/Novosibirsk\":{\"long\":[\"Novosibirsk Standard Time\",\"Novosibirsk Summer Time\"]},\"Asia/Omsk\":{\"long\":[\"Omsk Standard Time\",\"Omsk Summer Time\"]},\"Pacific/Palau\":{\"long\":[\"Palau Time\",\"Palau Time\"]},\"Pacific/Port_Moresby\":{\"long\":[\"Papua New Guinea Time\",\"Papua New Guinea Time\"]},\"America/Asuncion\":{\"long\":[\"Paraguay Standard Time\",\"Paraguay Summer Time\"]},\"America/Lima\":{\"long\":[\"Peru Standard Time\",\"Peru Summer Time\"]},\"Asia/Manila\":{\"long\":[\"Philippine Standard Time\",\"Philippine Summer Time\"]},\"Pacific/Enderbury\":{\"long\":[\"Phoenix Islands Time\",\"Phoenix Islands Time\"]},\"America/Miquelon\":{\"long\":[\"St. Pierre & Miquelon Standard Time\",\"St. Pierre & Miquelon Daylight Time\"]},\"Pacific/Pitcairn\":{\"long\":[\"Pitcairn Time\",\"Pitcairn Time\"]},\"Pacific/Ponape\":{\"long\":[\"Ponape Time\",\"Ponape Time\"]},\"Asia/Pyongyang\":{\"long\":[\"Pyongyang Time\",\"Pyongyang Time\"]},\"Indian/Reunion\":{\"long\":[\"Réunion Time\",\"Réunion Time\"]},\"Antarctica/Rothera\":{\"long\":[\"Rothera Time\",\"Rothera Time\"]},\"Asia/Sakhalin\":{\"long\":[\"Sakhalin Standard Time\",\"Sakhalin Summer Time\"]},\"Pacific/Pago_Pago\":{\"long\":[\"Samoa Standard Time\",\"Samoa Daylight Time\"]},\"Indian/Mahe\":{\"long\":[\"Seychelles Time\",\"Seychelles Time\"]},\"Asia/Singapore\":{\"long\":[\"Singapore Standard Time\",\"Singapore Standard Time\"]},\"Pacific/Guadalcanal\":{\"long\":[\"Solomon Islands Time\",\"Solomon Islands Time\"]},\"Atlantic/South_Georgia\":{\"long\":[\"South Georgia Time\",\"South Georgia Time\"]},\"Asia/Yekaterinburg\":{\"long\":[\"Yekaterinburg Standard Time\",\"Yekaterinburg Summer Time\"]},\"Antarctica/Syowa\":{\"long\":[\"Syowa Time\",\"Syowa Time\"]},\"Pacific/Tahiti\":{\"long\":[\"Tahiti Time\",\"Tahiti Time\"]},\"Asia/Taipei\":{\"long\":[\"Taipei Standard Time\",\"Taipei Daylight Time\"]},\"Asia/Tashkent\":{\"long\":[\"Uzbekistan Standard Time\",\"Uzbekistan Summer Time\"]},\"Pacific/Fakaofo\":{\"long\":[\"Tokelau Time\",\"Tokelau Time\"]},\"Pacific/Tongatapu\":{\"long\":[\"Tonga Standard Time\",\"Tonga Summer Time\"]},\"Pacific/Truk\":{\"long\":[\"Chuuk Time\",\"Chuuk Time\"]},\"Pacific/Funafuti\":{\"long\":[\"Tuvalu Time\",\"Tuvalu Time\"]},\"America/Montevideo\":{\"long\":[\"Uruguay Standard Time\",\"Uruguay Summer Time\"]},\"Pacific/Efate\":{\"long\":[\"Vanuatu Standard Time\",\"Vanuatu Summer Time\"]},\"America/Caracas\":{\"long\":[\"Venezuela Time\",\"Venezuela Time\"]},\"Asia/Vladivostok\":{\"long\":[\"Vladivostok Standard Time\",\"Vladivostok Summer Time\"]},\"Europe/Volgograd\":{\"long\":[\"Volgograd Standard Time\",\"Volgograd Summer Time\"]},\"Antarctica/Vostok\":{\"long\":[\"Vostok Time\",\"Vostok Time\"]},\"Pacific/Wake\":{\"long\":[\"Wake Island Time\",\"Wake Island Time\"]},\"Pacific/Wallis\":{\"long\":[\"Wallis & Futuna Time\",\"Wallis & Futuna Time\"]},\"Asia/Yakutsk\":{\"long\":[\"Yakutsk Standard Time\",\"Yakutsk Summer Time\"]},\"UTC\":{\"long\":[\"Coordinated Universal Time\",\"Coordinated Universal Time\"],\"short\":[\"UTC\",\"UTC\"]}},\"gmtFormat\":\"GMT{0}\",\"hourFormat\":\"+HH:mm;-HH:mm\",\"dateFormat\":{\"full\":\"EEEE, MMMM d, y\",\"long\":\"MMMM d, y\",\"medium\":\"MMM d, y\",\"short\":\"M/d/yy\"},\"timeFormat\":{\"full\":\"h:mm:ss a zzzz\",\"long\":\"h:mm:ss a z\",\"medium\":\"h:mm:ss a\",\"short\":\"h:mm a\"},\"dateTimeFormat\":{\"full\":\"{1} 'at' {0}\",\"long\":\"{1} 'at' {0}\",\"medium\":\"{1}, {0}\",\"short\":\"{1}, {0}\"},\"formats\":{\"gregory\":{\"Bh\":\"h B\",\"Bhm\":\"h:mm B\",\"Bhms\":\"h:mm:ss B\",\"d\":\"d\",\"E\":\"ccc\",\"EBhm\":\"E h:mm B\",\"EBhms\":\"E h:mm:ss B\",\"Ed\":\"d E\",\"Ehm\":\"E h:mm a\",\"EHm\":\"E HH:mm\",\"Ehms\":\"E h:mm:ss a\",\"EHms\":\"E HH:mm:ss\",\"Gy\":\"y G\",\"GyMMM\":\"MMM y G\",\"GyMMMd\":\"MMM d, y G\",\"GyMMMEd\":\"E, MMM d, y G\",\"h\":\"h a\",\"H\":\"HH\",\"hm\":\"h:mm a\",\"Hm\":\"HH:mm\",\"hms\":\"h:mm:ss a\",\"Hms\":\"HH:mm:ss\",\"hmsv\":\"h:mm:ss a v\",\"Hmsv\":\"HH:mm:ss v\",\"hmv\":\"h:mm a v\",\"Hmv\":\"HH:mm v\",\"M\":\"L\",\"Md\":\"M/d\",\"MEd\":\"E, M/d\",\"MMM\":\"LLL\",\"MMMd\":\"MMM d\",\"MMMEd\":\"E, MMM d\",\"MMMMd\":\"MMMM d\",\"ms\":\"mm:ss\",\"y\":\"y\",\"yM\":\"M/y\",\"yMd\":\"M/d/y\",\"yMEd\":\"E, M/d/y\",\"yMMM\":\"MMM y\",\"yMMMd\":\"MMM d, y\",\"yMMMEd\":\"E, MMM d, y\",\"yMMMM\":\"MMMM y\",\"EEEE, MMMM d, y\":\"EEEE, MMMM d, y\",\"MMMM d, y\":\"MMMM d, y\",\"MMM d, y\":\"MMM d, y\",\"M/d/yy\":\"M/d/yy\",\"h:mm:ss a zzzz\":\"h:mm:ss a zzzz\",\"h:mm:ss a z\":\"h:mm:ss a z\",\"h:mm:ss a\":\"h:mm:ss a\",\"h:mm a\":\"h:mm a\",\"EEEE, MMMM d, y 'at' h:mm:ss a zzzz\":\"EEEE, MMMM d, y 'at' h:mm:ss a zzzz\",\"MMMM d, y 'at' h:mm:ss a zzzz\":\"MMMM d, y 'at' h:mm:ss a zzzz\",\"MMM d, y, h:mm:ss a zzzz\":\"MMM d, y, h:mm:ss a zzzz\",\"M/d/yy, h:mm:ss a zzzz\":\"M/d/yy, h:mm:ss a zzzz\",\"d, h:mm:ss a zzzz\":\"d, h:mm:ss a zzzz\",\"E, h:mm:ss a zzzz\":\"ccc, h:mm:ss a zzzz\",\"Ed, h:mm:ss a zzzz\":\"d E, h:mm:ss a zzzz\",\"Gy, h:mm:ss a zzzz\":\"y G, h:mm:ss a zzzz\",\"GyMMM, h:mm:ss a zzzz\":\"MMM y G, h:mm:ss a zzzz\",\"GyMMMd, h:mm:ss a zzzz\":\"MMM d, y G, h:mm:ss a zzzz\",\"GyMMMEd, h:mm:ss a zzzz\":\"E, MMM d, y G, h:mm:ss a zzzz\",\"M, h:mm:ss a zzzz\":\"L, h:mm:ss a zzzz\",\"Md, h:mm:ss a zzzz\":\"M/d, h:mm:ss a zzzz\",\"MEd, h:mm:ss a zzzz\":\"E, M/d, h:mm:ss a zzzz\",\"MMM, h:mm:ss a zzzz\":\"LLL, h:mm:ss a zzzz\",\"MMMd, h:mm:ss a zzzz\":\"MMM d, h:mm:ss a zzzz\",\"MMMEd, h:mm:ss a zzzz\":\"E, MMM d, h:mm:ss a zzzz\",\"MMMMd 'at' h:mm:ss a zzzz\":\"MMMM d 'at' h:mm:ss a zzzz\",\"y, h:mm:ss a zzzz\":\"y, h:mm:ss a zzzz\",\"yM, h:mm:ss a zzzz\":\"M/y, h:mm:ss a zzzz\",\"yMd, h:mm:ss a zzzz\":\"M/d/y, h:mm:ss a zzzz\",\"yMEd, h:mm:ss a zzzz\":\"E, M/d/y, h:mm:ss a zzzz\",\"yMMM, h:mm:ss a zzzz\":\"MMM y, h:mm:ss a zzzz\",\"yMMMd, h:mm:ss a zzzz\":\"MMM d, y, h:mm:ss a zzzz\",\"yMMMEd, h:mm:ss a zzzz\":\"E, MMM d, y, h:mm:ss a zzzz\",\"yMMMM 'at' h:mm:ss a zzzz\":\"MMMM y 'at' h:mm:ss a zzzz\",\"EEEE, MMMM d, y 'at' h:mm:ss a z\":\"EEEE, MMMM d, y 'at' h:mm:ss a z\",\"MMMM d, y 'at' h:mm:ss a z\":\"MMMM d, y 'at' h:mm:ss a z\",\"MMM d, y, h:mm:ss a z\":\"MMM d, y, h:mm:ss a z\",\"M/d/yy, h:mm:ss a z\":\"M/d/yy, h:mm:ss a z\",\"d, h:mm:ss a z\":\"d, h:mm:ss a z\",\"E, h:mm:ss a z\":\"ccc, h:mm:ss a z\",\"Ed, h:mm:ss a z\":\"d E, h:mm:ss a z\",\"Gy, h:mm:ss a z\":\"y G, h:mm:ss a z\",\"GyMMM, h:mm:ss a z\":\"MMM y G, h:mm:ss a z\",\"GyMMMd, h:mm:ss a z\":\"MMM d, y G, h:mm:ss a z\",\"GyMMMEd, h:mm:ss a z\":\"E, MMM d, y G, h:mm:ss a z\",\"M, h:mm:ss a z\":\"L, h:mm:ss a z\",\"Md, h:mm:ss a z\":\"M/d, h:mm:ss a z\",\"MEd, h:mm:ss a z\":\"E, M/d, h:mm:ss a z\",\"MMM, h:mm:ss a z\":\"LLL, h:mm:ss a z\",\"MMMd, h:mm:ss a z\":\"MMM d, h:mm:ss a z\",\"MMMEd, h:mm:ss a z\":\"E, MMM d, h:mm:ss a z\",\"MMMMd 'at' h:mm:ss a z\":\"MMMM d 'at' h:mm:ss a z\",\"y, h:mm:ss a z\":\"y, h:mm:ss a z\",\"yM, h:mm:ss a z\":\"M/y, h:mm:ss a z\",\"yMd, h:mm:ss a z\":\"M/d/y, h:mm:ss a z\",\"yMEd, h:mm:ss a z\":\"E, M/d/y, h:mm:ss a z\",\"yMMM, h:mm:ss a z\":\"MMM y, h:mm:ss a z\",\"yMMMd, h:mm:ss a z\":\"MMM d, y, h:mm:ss a z\",\"yMMMEd, h:mm:ss a z\":\"E, MMM d, y, h:mm:ss a z\",\"yMMMM 'at' h:mm:ss a z\":\"MMMM y 'at' h:mm:ss a z\",\"EEEE, MMMM d, y 'at' h:mm:ss a\":\"EEEE, MMMM d, y 'at' h:mm:ss a\",\"MMMM d, y 'at' h:mm:ss a\":\"MMMM d, y 'at' h:mm:ss a\",\"MMM d, y, h:mm:ss a\":\"MMM d, y, h:mm:ss a\",\"M/d/yy, h:mm:ss a\":\"M/d/yy, h:mm:ss a\",\"d, h:mm:ss a\":\"d, h:mm:ss a\",\"E, h:mm:ss a\":\"ccc, h:mm:ss a\",\"Ed, h:mm:ss a\":\"d E, h:mm:ss a\",\"Gy, h:mm:ss a\":\"y G, h:mm:ss a\",\"GyMMM, h:mm:ss a\":\"MMM y G, h:mm:ss a\",\"GyMMMd, h:mm:ss a\":\"MMM d, y G, h:mm:ss a\",\"GyMMMEd, h:mm:ss a\":\"E, MMM d, y G, h:mm:ss a\",\"M, h:mm:ss a\":\"L, h:mm:ss a\",\"Md, h:mm:ss a\":\"M/d, h:mm:ss a\",\"MEd, h:mm:ss a\":\"E, M/d, h:mm:ss a\",\"MMM, h:mm:ss a\":\"LLL, h:mm:ss a\",\"MMMd, h:mm:ss a\":\"MMM d, h:mm:ss a\",\"MMMEd, h:mm:ss a\":\"E, MMM d, h:mm:ss a\",\"MMMMd 'at' h:mm:ss a\":\"MMMM d 'at' h:mm:ss a\",\"y, h:mm:ss a\":\"y, h:mm:ss a\",\"yM, h:mm:ss a\":\"M/y, h:mm:ss a\",\"yMd, h:mm:ss a\":\"M/d/y, h:mm:ss a\",\"yMEd, h:mm:ss a\":\"E, M/d/y, h:mm:ss a\",\"yMMM, h:mm:ss a\":\"MMM y, h:mm:ss a\",\"yMMMd, h:mm:ss a\":\"MMM d, y, h:mm:ss a\",\"yMMMEd, h:mm:ss a\":\"E, MMM d, y, h:mm:ss a\",\"yMMMM 'at' h:mm:ss a\":\"MMMM y 'at' h:mm:ss a\",\"EEEE, MMMM d, y 'at' h:mm a\":\"EEEE, MMMM d, y 'at' h:mm a\",\"MMMM d, y 'at' h:mm a\":\"MMMM d, y 'at' h:mm a\",\"MMM d, y, h:mm a\":\"MMM d, y, h:mm a\",\"M/d/yy, h:mm a\":\"M/d/yy, h:mm a\",\"d, h:mm a\":\"d, h:mm a\",\"E, h:mm a\":\"ccc, h:mm a\",\"Ed, h:mm a\":\"d E, h:mm a\",\"Gy, h:mm a\":\"y G, h:mm a\",\"GyMMM, h:mm a\":\"MMM y G, h:mm a\",\"GyMMMd, h:mm a\":\"MMM d, y G, h:mm a\",\"GyMMMEd, h:mm a\":\"E, MMM d, y G, h:mm a\",\"M, h:mm a\":\"L, h:mm a\",\"Md, h:mm a\":\"M/d, h:mm a\",\"MEd, h:mm a\":\"E, M/d, h:mm a\",\"MMM, h:mm a\":\"LLL, h:mm a\",\"MMMd, h:mm a\":\"MMM d, h:mm a\",\"MMMEd, h:mm a\":\"E, MMM d, h:mm a\",\"MMMMd 'at' h:mm a\":\"MMMM d 'at' h:mm a\",\"y, h:mm a\":\"y, h:mm a\",\"yM, h:mm a\":\"M/y, h:mm a\",\"yMd, h:mm a\":\"M/d/y, h:mm a\",\"yMEd, h:mm a\":\"E, M/d/y, h:mm a\",\"yMMM, h:mm a\":\"MMM y, h:mm a\",\"yMMMd, h:mm a\":\"MMM d, y, h:mm a\",\"yMMMEd, h:mm a\":\"E, MMM d, y, h:mm a\",\"yMMMM 'at' h:mm a\":\"MMMM y 'at' h:mm a\",\"EEEE, MMMM d, y 'at' Bh\":\"EEEE, MMMM d, y 'at' h B\",\"MMMM d, y 'at' Bh\":\"MMMM d, y 'at' h B\",\"MMM d, y, Bh\":\"MMM d, y, h B\",\"M/d/yy, Bh\":\"M/d/yy, h B\",\"d, Bh\":\"d, h B\",\"E, Bh\":\"ccc, h B\",\"Ed, Bh\":\"d E, h B\",\"Gy, Bh\":\"y G, h B\",\"GyMMM, Bh\":\"MMM y G, h B\",\"GyMMMd, Bh\":\"MMM d, y G, h B\",\"GyMMMEd, Bh\":\"E, MMM d, y G, h B\",\"M, Bh\":\"L, h B\",\"Md, Bh\":\"M/d, h B\",\"MEd, Bh\":\"E, M/d, h B\",\"MMM, Bh\":\"LLL, h B\",\"MMMd, Bh\":\"MMM d, h B\",\"MMMEd, Bh\":\"E, MMM d, h B\",\"MMMMd 'at' Bh\":\"MMMM d 'at' h B\",\"y, Bh\":\"y, h B\",\"yM, Bh\":\"M/y, h B\",\"yMd, Bh\":\"M/d/y, h B\",\"yMEd, Bh\":\"E, M/d/y, h B\",\"yMMM, Bh\":\"MMM y, h B\",\"yMMMd, Bh\":\"MMM d, y, h B\",\"yMMMEd, Bh\":\"E, MMM d, y, h B\",\"yMMMM 'at' Bh\":\"MMMM y 'at' h B\",\"EEEE, MMMM d, y 'at' Bhm\":\"EEEE, MMMM d, y 'at' h:mm B\",\"MMMM d, y 'at' Bhm\":\"MMMM d, y 'at' h:mm B\",\"MMM d, y, Bhm\":\"MMM d, y, h:mm B\",\"M/d/yy, Bhm\":\"M/d/yy, h:mm B\",\"d, Bhm\":\"d, h:mm B\",\"E, Bhm\":\"ccc, h:mm B\",\"Ed, Bhm\":\"d E, h:mm B\",\"Gy, Bhm\":\"y G, h:mm B\",\"GyMMM, Bhm\":\"MMM y G, h:mm B\",\"GyMMMd, Bhm\":\"MMM d, y G, h:mm B\",\"GyMMMEd, Bhm\":\"E, MMM d, y G, h:mm B\",\"M, Bhm\":\"L, h:mm B\",\"Md, Bhm\":\"M/d, h:mm B\",\"MEd, Bhm\":\"E, M/d, h:mm B\",\"MMM, Bhm\":\"LLL, h:mm B\",\"MMMd, Bhm\":\"MMM d, h:mm B\",\"MMMEd, Bhm\":\"E, MMM d, h:mm B\",\"MMMMd 'at' Bhm\":\"MMMM d 'at' h:mm B\",\"y, Bhm\":\"y, h:mm B\",\"yM, Bhm\":\"M/y, h:mm B\",\"yMd, Bhm\":\"M/d/y, h:mm B\",\"yMEd, Bhm\":\"E, M/d/y, h:mm B\",\"yMMM, Bhm\":\"MMM y, h:mm B\",\"yMMMd, Bhm\":\"MMM d, y, h:mm B\",\"yMMMEd, Bhm\":\"E, MMM d, y, h:mm B\",\"yMMMM 'at' Bhm\":\"MMMM y 'at' h:mm B\",\"EEEE, MMMM d, y 'at' Bhms\":\"EEEE, MMMM d, y 'at' h:mm:ss B\",\"MMMM d, y 'at' Bhms\":\"MMMM d, y 'at' h:mm:ss B\",\"MMM d, y, Bhms\":\"MMM d, y, h:mm:ss B\",\"M/d/yy, Bhms\":\"M/d/yy, h:mm:ss B\",\"d, Bhms\":\"d, h:mm:ss B\",\"E, Bhms\":\"ccc, h:mm:ss B\",\"Ed, Bhms\":\"d E, h:mm:ss B\",\"Gy, Bhms\":\"y G, h:mm:ss B\",\"GyMMM, Bhms\":\"MMM y G, h:mm:ss B\",\"GyMMMd, Bhms\":\"MMM d, y G, h:mm:ss B\",\"GyMMMEd, Bhms\":\"E, MMM d, y G, h:mm:ss B\",\"M, Bhms\":\"L, h:mm:ss B\",\"Md, Bhms\":\"M/d, h:mm:ss B\",\"MEd, Bhms\":\"E, M/d, h:mm:ss B\",\"MMM, Bhms\":\"LLL, h:mm:ss B\",\"MMMd, Bhms\":\"MMM d, h:mm:ss B\",\"MMMEd, Bhms\":\"E, MMM d, h:mm:ss B\",\"MMMMd 'at' Bhms\":\"MMMM d 'at' h:mm:ss B\",\"y, Bhms\":\"y, h:mm:ss B\",\"yM, Bhms\":\"M/y, h:mm:ss B\",\"yMd, Bhms\":\"M/d/y, h:mm:ss B\",\"yMEd, Bhms\":\"E, M/d/y, h:mm:ss B\",\"yMMM, Bhms\":\"MMM y, h:mm:ss B\",\"yMMMd, Bhms\":\"MMM d, y, h:mm:ss B\",\"yMMMEd, Bhms\":\"E, MMM d, y, h:mm:ss B\",\"yMMMM 'at' Bhms\":\"MMMM y 'at' h:mm:ss B\",\"EEEE, MMMM d, y 'at' h\":\"EEEE, MMMM d, y 'at' h a\",\"MMMM d, y 'at' h\":\"MMMM d, y 'at' h a\",\"MMM d, y, h\":\"MMM d, y, h a\",\"M/d/yy, h\":\"M/d/yy, h a\",\"d, h\":\"d, h a\",\"E, h\":\"ccc, h a\",\"Ed, h\":\"d E, h a\",\"Gy, h\":\"y G, h a\",\"GyMMM, h\":\"MMM y G, h a\",\"GyMMMd, h\":\"MMM d, y G, h a\",\"GyMMMEd, h\":\"E, MMM d, y G, h a\",\"M, h\":\"L, h a\",\"Md, h\":\"M/d, h a\",\"MEd, h\":\"E, M/d, h a\",\"MMM, h\":\"LLL, h a\",\"MMMd, h\":\"MMM d, h a\",\"MMMEd, h\":\"E, MMM d, h a\",\"MMMMd 'at' h\":\"MMMM d 'at' h a\",\"y, h\":\"y, h a\",\"yM, h\":\"M/y, h a\",\"yMd, h\":\"M/d/y, h a\",\"yMEd, h\":\"E, M/d/y, h a\",\"yMMM, h\":\"MMM y, h a\",\"yMMMd, h\":\"MMM d, y, h a\",\"yMMMEd, h\":\"E, MMM d, y, h a\",\"yMMMM 'at' h\":\"MMMM y 'at' h a\",\"EEEE, MMMM d, y 'at' H\":\"EEEE, MMMM d, y 'at' HH\",\"MMMM d, y 'at' H\":\"MMMM d, y 'at' HH\",\"MMM d, y, H\":\"MMM d, y, HH\",\"M/d/yy, H\":\"M/d/yy, HH\",\"d, H\":\"d, HH\",\"E, H\":\"ccc, HH\",\"Ed, H\":\"d E, HH\",\"Gy, H\":\"y G, HH\",\"GyMMM, H\":\"MMM y G, HH\",\"GyMMMd, H\":\"MMM d, y G, HH\",\"GyMMMEd, H\":\"E, MMM d, y G, HH\",\"M, H\":\"L, HH\",\"Md, H\":\"M/d, HH\",\"MEd, H\":\"E, M/d, HH\",\"MMM, H\":\"LLL, HH\",\"MMMd, H\":\"MMM d, HH\",\"MMMEd, H\":\"E, MMM d, HH\",\"MMMMd 'at' H\":\"MMMM d 'at' HH\",\"y, H\":\"y, HH\",\"yM, H\":\"M/y, HH\",\"yMd, H\":\"M/d/y, HH\",\"yMEd, H\":\"E, M/d/y, HH\",\"yMMM, H\":\"MMM y, HH\",\"yMMMd, H\":\"MMM d, y, HH\",\"yMMMEd, H\":\"E, MMM d, y, HH\",\"yMMMM 'at' H\":\"MMMM y 'at' HH\",\"EEEE, MMMM d, y 'at' hm\":\"EEEE, MMMM d, y 'at' h:mm a\",\"MMMM d, y 'at' hm\":\"MMMM d, y 'at' h:mm a\",\"MMM d, y, hm\":\"MMM d, y, h:mm a\",\"M/d/yy, hm\":\"M/d/yy, h:mm a\",\"d, hm\":\"d, h:mm a\",\"E, hm\":\"ccc, h:mm a\",\"Ed, hm\":\"d E, h:mm a\",\"Gy, hm\":\"y G, h:mm a\",\"GyMMM, hm\":\"MMM y G, h:mm a\",\"GyMMMd, hm\":\"MMM d, y G, h:mm a\",\"GyMMMEd, hm\":\"E, MMM d, y G, h:mm a\",\"M, hm\":\"L, h:mm a\",\"Md, hm\":\"M/d, h:mm a\",\"MEd, hm\":\"E, M/d, h:mm a\",\"MMM, hm\":\"LLL, h:mm a\",\"MMMd, hm\":\"MMM d, h:mm a\",\"MMMEd, hm\":\"E, MMM d, h:mm a\",\"MMMMd 'at' hm\":\"MMMM d 'at' h:mm a\",\"y, hm\":\"y, h:mm a\",\"yM, hm\":\"M/y, h:mm a\",\"yMd, hm\":\"M/d/y, h:mm a\",\"yMEd, hm\":\"E, M/d/y, h:mm a\",\"yMMM, hm\":\"MMM y, h:mm a\",\"yMMMd, hm\":\"MMM d, y, h:mm a\",\"yMMMEd, hm\":\"E, MMM d, y, h:mm a\",\"yMMMM 'at' hm\":\"MMMM y 'at' h:mm a\",\"EEEE, MMMM d, y 'at' Hm\":\"EEEE, MMMM d, y 'at' HH:mm\",\"MMMM d, y 'at' Hm\":\"MMMM d, y 'at' HH:mm\",\"MMM d, y, Hm\":\"MMM d, y, HH:mm\",\"M/d/yy, Hm\":\"M/d/yy, HH:mm\",\"d, Hm\":\"d, HH:mm\",\"E, Hm\":\"ccc, HH:mm\",\"Ed, Hm\":\"d E, HH:mm\",\"Gy, Hm\":\"y G, HH:mm\",\"GyMMM, Hm\":\"MMM y G, HH:mm\",\"GyMMMd, Hm\":\"MMM d, y G, HH:mm\",\"GyMMMEd, Hm\":\"E, MMM d, y G, HH:mm\",\"M, Hm\":\"L, HH:mm\",\"Md, Hm\":\"M/d, HH:mm\",\"MEd, Hm\":\"E, M/d, HH:mm\",\"MMM, Hm\":\"LLL, HH:mm\",\"MMMd, Hm\":\"MMM d, HH:mm\",\"MMMEd, Hm\":\"E, MMM d, HH:mm\",\"MMMMd 'at' Hm\":\"MMMM d 'at' HH:mm\",\"y, Hm\":\"y, HH:mm\",\"yM, Hm\":\"M/y, HH:mm\",\"yMd, Hm\":\"M/d/y, HH:mm\",\"yMEd, Hm\":\"E, M/d/y, HH:mm\",\"yMMM, Hm\":\"MMM y, HH:mm\",\"yMMMd, Hm\":\"MMM d, y, HH:mm\",\"yMMMEd, Hm\":\"E, MMM d, y, HH:mm\",\"yMMMM 'at' Hm\":\"MMMM y 'at' HH:mm\",\"EEEE, MMMM d, y 'at' hms\":\"EEEE, MMMM d, y 'at' h:mm:ss a\",\"MMMM d, y 'at' hms\":\"MMMM d, y 'at' h:mm:ss a\",\"MMM d, y, hms\":\"MMM d, y, h:mm:ss a\",\"M/d/yy, hms\":\"M/d/yy, h:mm:ss a\",\"d, hms\":\"d, h:mm:ss a\",\"E, hms\":\"ccc, h:mm:ss a\",\"Ed, hms\":\"d E, h:mm:ss a\",\"Gy, hms\":\"y G, h:mm:ss a\",\"GyMMM, hms\":\"MMM y G, h:mm:ss a\",\"GyMMMd, hms\":\"MMM d, y G, h:mm:ss a\",\"GyMMMEd, hms\":\"E, MMM d, y G, h:mm:ss a\",\"M, hms\":\"L, h:mm:ss a\",\"Md, hms\":\"M/d, h:mm:ss a\",\"MEd, hms\":\"E, M/d, h:mm:ss a\",\"MMM, hms\":\"LLL, h:mm:ss a\",\"MMMd, hms\":\"MMM d, h:mm:ss a\",\"MMMEd, hms\":\"E, MMM d, h:mm:ss a\",\"MMMMd 'at' hms\":\"MMMM d 'at' h:mm:ss a\",\"y, hms\":\"y, h:mm:ss a\",\"yM, hms\":\"M/y, h:mm:ss a\",\"yMd, hms\":\"M/d/y, h:mm:ss a\",\"yMEd, hms\":\"E, M/d/y, h:mm:ss a\",\"yMMM, hms\":\"MMM y, h:mm:ss a\",\"yMMMd, hms\":\"MMM d, y, h:mm:ss a\",\"yMMMEd, hms\":\"E, MMM d, y, h:mm:ss a\",\"yMMMM 'at' hms\":\"MMMM y 'at' h:mm:ss a\",\"EEEE, MMMM d, y 'at' Hms\":\"EEEE, MMMM d, y 'at' HH:mm:ss\",\"MMMM d, y 'at' Hms\":\"MMMM d, y 'at' HH:mm:ss\",\"MMM d, y, Hms\":\"MMM d, y, HH:mm:ss\",\"M/d/yy, Hms\":\"M/d/yy, HH:mm:ss\",\"d, Hms\":\"d, HH:mm:ss\",\"E, Hms\":\"ccc, HH:mm:ss\",\"Ed, Hms\":\"d E, HH:mm:ss\",\"Gy, Hms\":\"y G, HH:mm:ss\",\"GyMMM, Hms\":\"MMM y G, HH:mm:ss\",\"GyMMMd, Hms\":\"MMM d, y G, HH:mm:ss\",\"GyMMMEd, Hms\":\"E, MMM d, y G, HH:mm:ss\",\"M, Hms\":\"L, HH:mm:ss\",\"Md, Hms\":\"M/d, HH:mm:ss\",\"MEd, Hms\":\"E, M/d, HH:mm:ss\",\"MMM, Hms\":\"LLL, HH:mm:ss\",\"MMMd, Hms\":\"MMM d, HH:mm:ss\",\"MMMEd, Hms\":\"E, MMM d, HH:mm:ss\",\"MMMMd 'at' Hms\":\"MMMM d 'at' HH:mm:ss\",\"y, Hms\":\"y, HH:mm:ss\",\"yM, Hms\":\"M/y, HH:mm:ss\",\"yMd, Hms\":\"M/d/y, HH:mm:ss\",\"yMEd, Hms\":\"E, M/d/y, HH:mm:ss\",\"yMMM, Hms\":\"MMM y, HH:mm:ss\",\"yMMMd, Hms\":\"MMM d, y, HH:mm:ss\",\"yMMMEd, Hms\":\"E, MMM d, y, HH:mm:ss\",\"yMMMM 'at' Hms\":\"MMMM y 'at' HH:mm:ss\",\"EEEE, MMMM d, y 'at' hmsv\":\"EEEE, MMMM d, y 'at' h:mm:ss a v\",\"MMMM d, y 'at' hmsv\":\"MMMM d, y 'at' h:mm:ss a v\",\"MMM d, y, hmsv\":\"MMM d, y, h:mm:ss a v\",\"M/d/yy, hmsv\":\"M/d/yy, h:mm:ss a v\",\"d, hmsv\":\"d, h:mm:ss a v\",\"E, hmsv\":\"ccc, h:mm:ss a v\",\"Ed, hmsv\":\"d E, h:mm:ss a v\",\"Gy, hmsv\":\"y G, h:mm:ss a v\",\"GyMMM, hmsv\":\"MMM y G, h:mm:ss a v\",\"GyMMMd, hmsv\":\"MMM d, y G, h:mm:ss a v\",\"GyMMMEd, hmsv\":\"E, MMM d, y G, h:mm:ss a v\",\"M, hmsv\":\"L, h:mm:ss a v\",\"Md, hmsv\":\"M/d, h:mm:ss a v\",\"MEd, hmsv\":\"E, M/d, h:mm:ss a v\",\"MMM, hmsv\":\"LLL, h:mm:ss a v\",\"MMMd, hmsv\":\"MMM d, h:mm:ss a v\",\"MMMEd, hmsv\":\"E, MMM d, h:mm:ss a v\",\"MMMMd 'at' hmsv\":\"MMMM d 'at' h:mm:ss a v\",\"y, hmsv\":\"y, h:mm:ss a v\",\"yM, hmsv\":\"M/y, h:mm:ss a v\",\"yMd, hmsv\":\"M/d/y, h:mm:ss a v\",\"yMEd, hmsv\":\"E, M/d/y, h:mm:ss a v\",\"yMMM, hmsv\":\"MMM y, h:mm:ss a v\",\"yMMMd, hmsv\":\"MMM d, y, h:mm:ss a v\",\"yMMMEd, hmsv\":\"E, MMM d, y, h:mm:ss a v\",\"yMMMM 'at' hmsv\":\"MMMM y 'at' h:mm:ss a v\",\"EEEE, MMMM d, y 'at' Hmsv\":\"EEEE, MMMM d, y 'at' HH:mm:ss v\",\"MMMM d, y 'at' Hmsv\":\"MMMM d, y 'at' HH:mm:ss v\",\"MMM d, y, Hmsv\":\"MMM d, y, HH:mm:ss v\",\"M/d/yy, Hmsv\":\"M/d/yy, HH:mm:ss v\",\"d, Hmsv\":\"d, HH:mm:ss v\",\"E, Hmsv\":\"ccc, HH:mm:ss v\",\"Ed, Hmsv\":\"d E, HH:mm:ss v\",\"Gy, Hmsv\":\"y G, HH:mm:ss v\",\"GyMMM, Hmsv\":\"MMM y G, HH:mm:ss v\",\"GyMMMd, Hmsv\":\"MMM d, y G, HH:mm:ss v\",\"GyMMMEd, Hmsv\":\"E, MMM d, y G, HH:mm:ss v\",\"M, Hmsv\":\"L, HH:mm:ss v\",\"Md, Hmsv\":\"M/d, HH:mm:ss v\",\"MEd, Hmsv\":\"E, M/d, HH:mm:ss v\",\"MMM, Hmsv\":\"LLL, HH:mm:ss v\",\"MMMd, Hmsv\":\"MMM d, HH:mm:ss v\",\"MMMEd, Hmsv\":\"E, MMM d, HH:mm:ss v\",\"MMMMd 'at' Hmsv\":\"MMMM d 'at' HH:mm:ss v\",\"y, Hmsv\":\"y, HH:mm:ss v\",\"yM, Hmsv\":\"M/y, HH:mm:ss v\",\"yMd, Hmsv\":\"M/d/y, HH:mm:ss v\",\"yMEd, Hmsv\":\"E, M/d/y, HH:mm:ss v\",\"yMMM, Hmsv\":\"MMM y, HH:mm:ss v\",\"yMMMd, Hmsv\":\"MMM d, y, HH:mm:ss v\",\"yMMMEd, Hmsv\":\"E, MMM d, y, HH:mm:ss v\",\"yMMMM 'at' Hmsv\":\"MMMM y 'at' HH:mm:ss v\",\"EEEE, MMMM d, y 'at' hmv\":\"EEEE, MMMM d, y 'at' h:mm a v\",\"MMMM d, y 'at' hmv\":\"MMMM d, y 'at' h:mm a v\",\"MMM d, y, hmv\":\"MMM d, y, h:mm a v\",\"M/d/yy, hmv\":\"M/d/yy, h:mm a v\",\"d, hmv\":\"d, h:mm a v\",\"E, hmv\":\"ccc, h:mm a v\",\"Ed, hmv\":\"d E, h:mm a v\",\"Gy, hmv\":\"y G, h:mm a v\",\"GyMMM, hmv\":\"MMM y G, h:mm a v\",\"GyMMMd, hmv\":\"MMM d, y G, h:mm a v\",\"GyMMMEd, hmv\":\"E, MMM d, y G, h:mm a v\",\"M, hmv\":\"L, h:mm a v\",\"Md, hmv\":\"M/d, h:mm a v\",\"MEd, hmv\":\"E, M/d, h:mm a v\",\"MMM, hmv\":\"LLL, h:mm a v\",\"MMMd, hmv\":\"MMM d, h:mm a v\",\"MMMEd, hmv\":\"E, MMM d, h:mm a v\",\"MMMMd 'at' hmv\":\"MMMM d 'at' h:mm a v\",\"y, hmv\":\"y, h:mm a v\",\"yM, hmv\":\"M/y, h:mm a v\",\"yMd, hmv\":\"M/d/y, h:mm a v\",\"yMEd, hmv\":\"E, M/d/y, h:mm a v\",\"yMMM, hmv\":\"MMM y, h:mm a v\",\"yMMMd, hmv\":\"MMM d, y, h:mm a v\",\"yMMMEd, hmv\":\"E, MMM d, y, h:mm a v\",\"yMMMM 'at' hmv\":\"MMMM y 'at' h:mm a v\",\"EEEE, MMMM d, y 'at' Hmv\":\"EEEE, MMMM d, y 'at' HH:mm v\",\"MMMM d, y 'at' Hmv\":\"MMMM d, y 'at' HH:mm v\",\"MMM d, y, Hmv\":\"MMM d, y, HH:mm v\",\"M/d/yy, Hmv\":\"M/d/yy, HH:mm v\",\"d, Hmv\":\"d, HH:mm v\",\"E, Hmv\":\"ccc, HH:mm v\",\"Ed, Hmv\":\"d E, HH:mm v\",\"Gy, Hmv\":\"y G, HH:mm v\",\"GyMMM, Hmv\":\"MMM y G, HH:mm v\",\"GyMMMd, Hmv\":\"MMM d, y G, HH:mm v\",\"GyMMMEd, Hmv\":\"E, MMM d, y G, HH:mm v\",\"M, Hmv\":\"L, HH:mm v\",\"Md, Hmv\":\"M/d, HH:mm v\",\"MEd, Hmv\":\"E, M/d, HH:mm v\",\"MMM, Hmv\":\"LLL, HH:mm v\",\"MMMd, Hmv\":\"MMM d, HH:mm v\",\"MMMEd, Hmv\":\"E, MMM d, HH:mm v\",\"MMMMd 'at' Hmv\":\"MMMM d 'at' HH:mm v\",\"y, Hmv\":\"y, HH:mm v\",\"yM, Hmv\":\"M/y, HH:mm v\",\"yMd, Hmv\":\"M/d/y, HH:mm v\",\"yMEd, Hmv\":\"E, M/d/y, HH:mm v\",\"yMMM, Hmv\":\"MMM y, HH:mm v\",\"yMMMd, Hmv\":\"MMM d, y, HH:mm v\",\"yMMMEd, Hmv\":\"E, MMM d, y, HH:mm v\",\"yMMMM 'at' Hmv\":\"MMMM y 'at' HH:mm v\",\"EEEE, MMMM d, y 'at' ms\":\"EEEE, MMMM d, y 'at' mm:ss\",\"MMMM d, y 'at' ms\":\"MMMM d, y 'at' mm:ss\",\"MMM d, y, ms\":\"MMM d, y, mm:ss\",\"M/d/yy, ms\":\"M/d/yy, mm:ss\",\"d, ms\":\"d, mm:ss\",\"E, ms\":\"ccc, mm:ss\",\"Ed, ms\":\"d E, mm:ss\",\"Gy, ms\":\"y G, mm:ss\",\"GyMMM, ms\":\"MMM y G, mm:ss\",\"GyMMMd, ms\":\"MMM d, y G, mm:ss\",\"GyMMMEd, ms\":\"E, MMM d, y G, mm:ss\",\"M, ms\":\"L, mm:ss\",\"Md, ms\":\"M/d, mm:ss\",\"MEd, ms\":\"E, M/d, mm:ss\",\"MMM, ms\":\"LLL, mm:ss\",\"MMMd, ms\":\"MMM d, mm:ss\",\"MMMEd, ms\":\"E, MMM d, mm:ss\",\"MMMMd 'at' ms\":\"MMMM d 'at' mm:ss\",\"y, ms\":\"y, mm:ss\",\"yM, ms\":\"M/y, mm:ss\",\"yMd, ms\":\"M/d/y, mm:ss\",\"yMEd, ms\":\"E, M/d/y, mm:ss\",\"yMMM, ms\":\"MMM y, mm:ss\",\"yMMMd, ms\":\"MMM d, y, mm:ss\",\"yMMMEd, ms\":\"E, MMM d, y, mm:ss\",\"yMMMM 'at' ms\":\"MMMM y 'at' mm:ss\"}},\"intervalFormats\":{\"intervalFormatFallback\":\"{0} – {1}\",\"Bh\":{\"B\":\"h B – h B\",\"h\":\"h – h B\"},\"Bhm\":{\"B\":\"h:mm B – h:mm B\",\"h\":\"h:mm – h:mm B\",\"m\":\"h:mm – h:mm B\"},\"d\":{\"d\":\"d – d\"},\"Gy\":{\"G\":\"y G – y G\",\"y\":\"y – y G\"},\"GyM\":{\"G\":\"M/y GGGGG – M/y GGGGG\",\"M\":\"M/y – M/y GGGGG\",\"y\":\"M/y – M/y GGGGG\"},\"GyMd\":{\"d\":\"M/d/y – M/d/y GGGGG\",\"G\":\"M/d/y GGGGG – M/d/y GGGGG\",\"M\":\"M/d/y – M/d/y GGGGG\",\"y\":\"M/d/y – M/d/y GGGGG\"},\"GyMEd\":{\"d\":\"E, M/d/y – E, M/d/y GGGGG\",\"G\":\"E, M/d/y GGGGG – E, M/d/y GGGGG\",\"M\":\"E, M/d/y – E, M/d/y GGGGG\",\"y\":\"E, M/d/y – E, M/d/y GGGGG\"},\"GyMMM\":{\"G\":\"MMM y G – MMM y G\",\"M\":\"MMM – MMM y G\",\"y\":\"MMM y – MMM y G\"},\"GyMMMd\":{\"d\":\"MMM d – d, y G\",\"G\":\"MMM d, y G – MMM d, y G\",\"M\":\"MMM d – MMM d, y G\",\"y\":\"MMM d, y – MMM d, y G\"},\"GyMMMEd\":{\"d\":\"E, MMM d – E, MMM d, y G\",\"G\":\"E, MMM d, y G – E, MMM d, y G\",\"M\":\"E, MMM d – E, MMM d, y G\",\"y\":\"E, MMM d, y – E, MMM d, y G\"},\"h\":{\"a\":\"h a – h a\",\"h\":\"h – h a\"},\"H\":{\"H\":\"HH – HH\"},\"hm\":{\"a\":\"h:mm a – h:mm a\",\"h\":\"h:mm – h:mm a\",\"m\":\"h:mm – h:mm a\"},\"Hm\":{\"H\":\"HH:mm – HH:mm\",\"m\":\"HH:mm – HH:mm\"},\"hmv\":{\"a\":\"h:mm a – h:mm a v\",\"h\":\"h:mm – h:mm a v\",\"m\":\"h:mm – h:mm a v\"},\"Hmv\":{\"H\":\"HH:mm – HH:mm v\",\"m\":\"HH:mm – HH:mm v\"},\"hv\":{\"a\":\"h a – h a v\",\"h\":\"h – h a v\"},\"Hv\":{\"H\":\"HH – HH v\"},\"M\":{\"M\":\"M – M\"},\"Md\":{\"d\":\"M/d – M/d\",\"M\":\"M/d – M/d\"},\"MEd\":{\"d\":\"E, M/d – E, M/d\",\"M\":\"E, M/d – E, M/d\"},\"MMM\":{\"M\":\"MMM – MMM\"},\"MMMd\":{\"d\":\"MMM d – d\",\"M\":\"MMM d – MMM d\"},\"MMMEd\":{\"d\":\"E, MMM d – E, MMM d\",\"M\":\"E, MMM d – E, MMM d\"},\"y\":{\"y\":\"y – y\"},\"yM\":{\"M\":\"M/y – M/y\",\"y\":\"M/y – M/y\"},\"yMd\":{\"d\":\"M/d/y – M/d/y\",\"M\":\"M/d/y – M/d/y\",\"y\":\"M/d/y – M/d/y\"},\"yMEd\":{\"d\":\"E, M/d/y – E, M/d/y\",\"M\":\"E, M/d/y – E, M/d/y\",\"y\":\"E, M/d/y – E, M/d/y\"},\"yMMM\":{\"M\":\"MMM – MMM y\",\"y\":\"MMM y – MMM y\"},\"yMMMd\":{\"d\":\"MMM d – d, y\",\"M\":\"MMM d – MMM d, y\",\"y\":\"MMM d, y – MMM d, y\"},\"yMMMEd\":{\"d\":\"E, MMM d – E, MMM d, y\",\"M\":\"E, MMM d – E, MMM d, y\",\"y\":\"E, MMM d, y – E, MMM d, y\"},\"yMMMM\":{\"M\":\"MMMM – MMMM y\",\"y\":\"MMMM y – MMMM y\"}},\"hourCycle\":\"h12\",\"nu\":[\"latn\"],\"ca\":[\"gregory\"],\"hc\":[\"h12\",\"\",\"h23\",\"\"]},\"locale\":\"en\"}\n)\n }","// @generated\n// prettier-ignore\nif ('DateTimeFormat' in Intl && Intl.DateTimeFormat.__addTZData) {\n Intl.DateTimeFormat.__addTZData({\"zones\":[\"Africa/Accra|,0,0,0|-s9p1ak,1,1,0|-q5eqo1,1,1,0|-q5eqo0,2,2,1|-q3g8pd,2,2,1|-q3g8pc,1,1,0|-pqwd41,1,1,0|-pqwd40,2,2,1|-pkmgpd,2,2,1|-pkmgpc,1,1,0|-p84fs1,1,1,0|-p84fs0,2,2,1|-p1ujdd,2,2,1|-p1ujdc,1,1,0|-opcig1,1,1,0|-opcig0,2,2,1|-oj2m1d,2,2,1|-oj2m1c,1,1,0|-o6kl41,1,1,0|-o6kl40,2,2,1|-o0aopd,2,2,1|-o0aopc,1,1,0|-nnqt41,1,1,0|-nnqt40,2,2,1|-nhgwpd,2,2,1|-nhgwpc,1,1,0|-n4yvs1,1,1,0|-n4yvs0,2,2,1|-myozdd,2,2,1|-myozdc,1,1,0|-mm6yg1,1,1,0|-mm6yg0,2,2,1|-mfx21d,2,2,1|-mfx21c,1,1,0|-m3f141,1,1,0|-m3f140,2,2,1|-lx54pd,2,2,1|-lx54pc,1,1,0|-lkl941,1,1,0|-lkl940,2,2,1|-lebcpd,2,2,1|-lebcpc,1,1,0|-l1tbs1,1,1,0|-l1tbs0,2,2,1|-kvjfdd,2,2,1|-kvjfdc,1,1,0|-kj1eg1,1,1,0|-kj1eg0,2,2,1|-kcri1d,2,2,1|-kcri1c,1,1,0|-k09h41,1,1,0|-k09h40,2,2,1|-jtzkpd,2,2,1|-jtzkpc,1,1,0|-jhfp41,1,1,0|-jhfp40,2,2,1|-jb5spd,2,2,1|-jb5spc,1,1,0|-iynrs1,1,1,0|-iynrs0,2,2,1|-isdvdd,2,2,1|-isdvdc,1,1,0|-ifvug1,1,1,0|-ifvug0,2,2,1|-i9ly1d,2,2,1|-i9ly1c,1,1,0|-hx3x41,1,1,0|-hx3x40,2,2,1|-hqu0pd,2,2,1|-hqu0pc,1,1,0|-hea541,1,1,0|-hea540,2,2,1|-h808pd,2,2,1|-h808pc,1,1,0|-gvi7s1,1,1,0|-gvi7s0,2,2,1|-gp8bdd,2,2,1|-gp8bdc,1,1,0|-gcqag1,1,1,0|-gcqag0,2,2,1|-g6ge1d,2,2,1|-g6ge1c,1,1,0|-ftyd41,1,1,0|-ftyd40,2,2,1|-fnogpd,2,2,1|-fnogpc,1,1,0|-fhgd41,1,1,0|-fhgd40,2,2,1|-f4uopd,2,2,1|-f4uopc,1,1,0|-eyofs1,1,1,0|-eyofs0,2,2,1|-em2rdd,2,2,1|-em2rdc,1,1,0|-ek4io1,1,1,0|-ek4io0,3,3,0|-cio421,3,3,0|-cio420,1,1,0|-a39mg1,1,1,0|-a39mg0,3,3,1|-9wzqi1,3,3,1|-9wzqi0,1,1,0|-9khp41,1,1,0|-9khp40,3,3,1|-9e7t61,3,3,1|-9e7t60,1,1,0|-91nx41,1,1,0|-91nx40,3,3,1|-8ve161,3,3,1|-8ve160,1,1,0|-8ivzs1,1,1,0|-8ivzs0,3,3,1|-8cm3u1,3,3,1|-8cm3u0,1,1,0|-8042g1,1,1,0|-8042g0,3,3,1|-7tu6i1,3,3,1|-7tu6i0,1,1,0|-7hc541,1,1,0|-7hc540,3,3,1|-7b2961,3,3,1|-7b2960,1,1,0\",\"Africa/Addis_Ababa|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Africa/Algiers|,0,8,0|-154gb8c,7,9,0|-uozn3m,7,9,0|-uozn3l,8,1,0|-ry2lg1,8,1,0|-ry2lg0,9,10,1|-rsgqs1,9,10,1|-rsgqs0,8,1,0|-rjiis1,8,1,0|-rjiis0,9,10,1|-r9dpg1,9,10,1|-r9dpg0,8,1,0|-r1idg1,8,1,0|-r1idg0,9,10,1|-qqnms1,9,10,1|-qqnms0,8,1,0|-qj59g1,8,1,0|-qj59g0,9,10,1|-q7xk41,9,10,1|-q7xk40,8,1,0|-q15441,8,1,0|-q15440,9,10,1|-po6g41,9,10,1|-po6g40,8,1,0|-pgvhg1,8,1,0|-pgvhg0,9,10,1|-pbs5g1,9,10,1|-pbs5g0,8,1,0|-fte841,8,1,0|-fte840,9,10,1|-fpw801,9,10,1|-fpw800,8,1,0|-fkul41,8,1,0|-fkul40,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d62o01,11,11,1|-d62o00,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cofk41,11,11,1|-cofk40,10,10,0|-c4kqs1,10,10,0|-c4kqs0,8,1,0|-79mio1,8,1,0|-79mio0,10,10,0|-3i8is1,10,10,0|-3i8is0,8,1,0|oot7z,8,1,0|oot80,9,10,1|wlzvz,9,10,1|wlzw0,8,1,0|3tynzz,8,1,0|3tyo00,9,10,1|42lp7z,9,10,1|42lp80,10,10,0|4aiynz,10,10,0|4aiyo0,11,11,1|4jw2rz,11,11,1|4jw2s0,10,10,0|54et7z,10,10,0|54et80,8,1,0|5drxbz,8,1,0|5drxc0,9,10,1|5ni03z,9,10,1|5ni040,8,1,0|5wuynz,8,1,0|5wuyo0,10,10,0\",\"Africa/Asmara|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Africa/Bamako|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Bangui|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Banjul|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Bissau|,0,14,0|-u9rek0,13,15,0|2lxk3z,13,15,0|2lxk40,1,1,0\",\"Africa/Blantyre|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Brazzaville|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Bujumbura|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Cairo|,0,17,0|-1054wgl,15,11,0|-fdls81,15,11,0|-fdls80,16,6,1|-f9lf01,16,6,1|-f9lf00,15,11,0|-ezidk1,15,11,0|-ezidk0,16,6,1|-erl9o1,16,6,1|-erl9o0,15,11,0|-ehgdk1,15,11,0|-ehgdk0,16,6,1|-e6pf01,16,6,1|-e6pf00,15,11,0|-dyog81,15,11,0|-dyog80,16,6,1|-dno8c1,16,6,1|-dno8c0,15,11,0|-dfuo81,15,11,0|-dfuo80,16,6,1|-d4ugc1,16,6,1|-d4ugc0,15,11,0|-cwayw1,15,11,0|-cwayw0,16,6,1|-cm2j01,16,6,1|-cm2j00,15,11,0|-6lluw1,15,11,0|-6lluw0,16,6,1|-6e79o1,16,6,1|-6e79o0,15,11,0|-63alk1,15,11,0|-63alk0,16,6,1|-5vfcc1,16,6,1|-5vfcc0,15,11,0|-5kilg1,15,11,0|-5kilg0,16,6,1|-5cp1c1,16,6,1|-5cp1c0,15,11,0|-51otg1,15,11,0|-51otg0,16,6,1|-4tv9c1,16,6,1|-4tv9c0,15,11,0|-4iww41,15,11,0|-4iww40,16,6,1|-4b3c01,16,6,1|-4b3c00,15,11,0|-404ys1,15,11,0|-404ys0,16,6,1|-3sbeo1,16,6,1|-3sbeo0,15,11,0|-3hd1g1,15,11,0|-3hd1g0,16,6,1|-39jhc1,16,6,1|-39jhc0,15,11,0|-2yj9g1,15,11,0|-2yj9g0,16,6,1|-2qppc1,16,6,1|-2qppc0,15,11,0|-2frc41,15,11,0|-2frc40,16,6,1|-27xs01,16,6,1|-27xs00,15,11,0|-1wzes1,15,11,0|-1wzes0,16,6,1|-1p4001,16,6,1|-1p4000,15,11,0|-1e7hg1,15,11,0|-1e7hg0,16,6,1|-16c2o1,16,6,1|-16c2o0,15,11,0|-vdpg1,15,11,0|-vdpg0,16,6,1|-niao1,16,6,1|-niao0,15,11,0|-cls41,15,11,0|-cls40,16,6,1|-4qdc1,16,6,1|-4qdc0,15,11,0|6657z,15,11,0|66580,16,6,1|e1jzz,16,6,1|e1k00,15,11,0|oy2jz,15,11,0|oy2k0,16,6,1|wthbz,16,6,1|wthc0,15,11,0|17rujz,15,11,0|17ruk0,16,6,1|1fn9bz,16,6,1|1fn9c0,15,11,0|1qjrvz,15,11,0|1qjrw0,16,6,1|1yf6nz,16,6,1|1yf6o0,15,11,0|29bp7z,15,11,0|29bp80,16,6,1|2h73zz,16,6,1|2h7400,15,11,0|2s3mjz,15,11,0|2s3mk0,16,6,1|2zz1bz,16,6,1|2zz1c0,15,11,0|3axejz,15,11,0|3axek0,16,6,1|3istbz,16,6,1|3istc0,15,11,0|3tpbvz,15,11,0|3tpbw0,16,6,1|41kqnz,16,6,1|41kqo0,15,11,0|4ch97z,15,11,0|4ch980,16,6,1|4kcnzz,16,6,1|4kco00,15,11,0|4v96jz,15,11,0|4v96k0,16,6,1|534lbz,16,6,1|534lc0,15,11,0|5e2yjz,15,11,0|5e2yk0,16,6,1|5lydbz,16,6,1|5lydc0,15,11,0|5wuvvz,15,11,0|5wuvw0,16,6,1|64qanz,16,6,1|64qao0,15,11,0|6k07vz,15,11,0|6k07w0,16,6,1|6ni7zz,16,6,1|6ni800,15,11,0|7242jz,15,11,0|7242k0,16,6,1|76a5bz,16,6,1|76a5c0,15,11,0|7h8ijz,15,11,0|7h8ik0,16,6,1|7p3xbz,16,6,1|7p3xc0,15,11,0|800fvz,15,11,0|800fw0,16,6,1|87vunz,16,6,1|87vuo0,15,11,0|8isd7z,15,11,0|8isd80,16,6,1|8qnrzz,16,6,1|8qns00,15,11,0|91kajz,15,11,0|91kak0,16,6,1|99fpbz,16,6,1|99fpc0,15,11,0|9ke2jz,15,11,0|9ke2k0,16,6,1|9s9hbz,16,6,1|9s9hc0,15,11,0|a3f97z,15,11,0|a3f980,16,6,1|ab1enz,16,6,1|ab1eo0,15,11,0|alxx7z,15,11,0|alxx80,16,6,1|attbzz,16,6,1|attc00,15,11,0|b4pujz,15,11,0|b4puk0,16,6,1|bcl9bz,16,6,1|bcl9c0,15,11,0|bnjmjz,15,11,0|bnjmk0,16,6,1|bvf1bz,16,6,1|bvf1c0,15,11,0|c6bjvz,15,11,0|c6bjw0,16,6,1|ce6ynz,16,6,1|ce6yo0,15,11,0|cp3h7z,15,11,0|cp3h80,16,6,1|cwyvzz,16,6,1|cwyw00,15,11,0|d7prrz,15,11,0|d7prs0,16,6,1|dfmvnz,16,6,1|dfmvo0,15,11,0|dqfufz,15,11,0|dqfug0,16,6,1|dycybz,16,6,1|dycyc0,15,11,0|e95x3z,15,11,0|e95x40,16,6,1|eh30zz,16,6,1|eh3100,15,11,0|ervzrz,15,11,0|ervzs0,16,6,1|ezt3nz,16,6,1|ezt3o0,15,11,0|faz13z,15,11,0|faz140,16,6,1|fiw4zz,16,6,1|fiw500,15,11,0|ftp3rz,15,11,0|ftp3s0,16,6,1|g1m7nz,16,6,1|g1m7o0,15,11,0|gcf6fz,15,11,0|gcf6g0,16,6,1|gkcabz,16,6,1|gkcac0,15,11,0|gv593z,15,11,0|gv5940,16,6,1|h32czz,16,6,1|h32d00,15,11,0|hdvbrz,15,11,0|hdvbs0,16,6,1|hlsfnz,16,6,1|hlsfo0,15,11,0|hwyd3z,15,11,0|hwyd40,16,6,1|i4vgzz,16,6,1|i4vh00,15,11,0|ifofrz,15,11,0|ifofs0,16,6,1|inljnz,16,6,1|inljo0,15,11,0|iyeifz,15,11,0|iyeig0,16,6,1|j5ynnz,16,6,1|j5yno0,15,11,0|jh4l3z,15,11,0|jh4l40,16,6,1|jnyszz,16,6,1|jnyt00,15,11,0|jzunrz,15,11,0|jzuns0,16,6,1|k6bwzz,16,6,1|k6bx00,15,11,0|kikqfz,15,11,0|kikqg0,16,6,1|kop0zz,16,6,1|kop100,15,11,0|l1nrrz,15,11,0|l1nrs0,16,6,1|l6yfnz,16,6,1|l6yfo0,15,11,0|l8i2fz,15,11,0|l8i2g0,16,6,1|l9kvnz,16,6,1|l9kvo0,15,11,0|n5myfz,15,11,0|n5myg0,16,6,1|n7snnz,16,6,1|n7sno0,15,11,0|n9ljrz,15,11,0|n9ljs0,16,6,1|nch6bz,16,6,1|nch6c0,15,11,0\",\"Africa/Casablanca|,0,18,0|-tblt9g,17,1,0|-fte5c1,17,1,0|-fte5c0,18,10,1|-fpwas1,18,10,1|-fpwas0,17,1,0|-fkuqo1,17,1,0|-fkuqo0,18,10,1|-cl6w41,18,10,1|-cl6w40,17,1,0|-a7hmo1,17,1,0|-a7hmo0,18,10,1|-a0ag41,18,10,1|-a0ag40,17,1,0|-1chdc1,17,1,0|-1chdc0,18,10,1|-16c5g1,18,10,1|-16c5g0,17,1,0|2c3rzz,17,1,0|2c3s00,18,10,1|2fnh7z,18,10,1|2fnh80,17,1,0|3axhbz,17,1,0|3axhc0,18,10,1|3fnrvz,18,10,1|3fnrw0,17,1,0|3tpenz,17,1,0|3tpeo0,18,10,1|41f3vz,18,10,1|41f3w0,17,1,0|4e2qnz,17,1,0|4e2qo0,18,10,1|4hd6jz,18,10,1|4hd6k0,17,1,0|7evenz,17,1,0|7eveo0,18,10,0|8cm57z,18,10,0|8cm580,17,1,0|k1rbzz,17,1,0|k1rc00,18,10,1|k6hmjz,18,10,1|k6hmk0,17,1,0|kkj9bz,17,1,0|kkj9c0,18,10,1|kop6jz,18,10,1|kop6k0,17,1,0|l1rmnz,17,1,0|l1rmo0,18,10,1|l6t17z,18,10,1|l6t180,17,1,0|lj1unz,17,1,0|lj1uo0,18,10,1|lp657z,18,10,1|lp6580,17,1,0|m37xjz,17,1,0|m37xk0,18,10,1|m7fs7z,18,10,1|m7fs80,17,1,0|m916vz,17,1,0|m916w0,18,10,1|mb547z,18,10,1|mb5480,17,1,0|mly07z,17,1,0|mly080,18,10,1|mpjmvz,18,10,1|mpjmw0,17,1,0|mraljz,17,1,0|mralk0,18,10,1|mvb1jz,18,10,1|mvb1k0,17,1,0|n3887z,17,1,0|n38880,18,10,1|n7uw7z,18,10,1|n7uw80,17,1,0|n9npjz,17,1,0|n9npk0,18,10,1|ne147z,18,10,1|ne1480,17,1,0|nlyavz,17,1,0|nlyaw0,18,10,1|npww7z,18,10,1|npww80,17,1,0|nrppjz,17,1,0|nrppk0,18,10,1|nwr6vz,18,10,1|nwr6w0,17,1,0|o4odjz,17,1,0|o4odk0,18,10,1|o8a07z,18,10,1|o8a080,17,1,0|oa2tjz,17,1,0|oa2tk0,18,10,1|ofu87z,18,10,1|ofu880,17,1,0|oneg7z,17,1,0|oneg80,18,10,1|oqa5jz,18,10,1|oqa5k0,17,1,0|osfxjz,17,1,0|osfxk0,18,10,1|oykavz,18,10,1|oykaw0,17,1,0|p64ivz,17,1,0|p64iw0,18,10,1|p8n9jz,18,10,1|p8n9k0,17,1,0|pag2vz,17,1,0|pag2w0,18,10,1|phadjz,18,10,1|phadk0,18,10,0|pr0djz,18,10,0|pr0dk0,17,1,1|pst6vz,17,1,1|pst6w0,18,10,0|q90ivz,18,10,0|q90iw0,17,1,1|qb6avz,17,1,1|qb6aw0,18,10,0|qrdmvz,18,10,0|qrdmw0,17,1,1|qt6g7z,17,1,1|qt6g80,18,10,0|r9ds7z,18,10,0|r9ds80,17,1,1|rbjk7z,17,1,1|rbjk80,18,10,0|rrqw7z,18,10,0|rrqw80,17,1,1|rtwo7z,17,1,1|rtwo80,18,10,0|sa407z,18,10,0|sa4080,17,1,1|sbwtjz,17,1,1|sbwtk0,18,10,0|ss45jz,18,10,0|ss45k0,17,1,1|su9xjz,17,1,1|su9xk0,18,10,0|tah9jz,18,10,0|tah9k0,17,1,1|tca2vz,17,1,1|tca2w0,18,10,0|tsudjz,18,10,0|tsudk0,17,1,1|tun6vz,17,1,1|tun6w0,18,10,0|uauivz,18,10,0|uauiw0,17,1,1|ud0avz,17,1,1|ud0aw0,18,10,0|ut7mvz,18,10,0|ut7mw0,17,1,1|uv0g7z,17,1,1|uv0g80,18,10,0|vb7s7z,18,10,0|vb7s80,17,1,1|vddk7z,17,1,1|vddk80,18,10,0|vtkw7z,18,10,0|vtkw80,17,1,1|vvqo7z,17,1,1|vvqo80,18,10,0|wby07z,18,10,0|wby080,17,1,1|wdqtjz,17,1,1|wdqtk0,18,10,0|wty5jz,18,10,0|wty5k0,17,1,1|ww3xjz,17,1,1|ww3xk0,18,10,0|xcb9jz,18,10,0|xcb9k0,17,1,1|xe42vz,17,1,1|xe42w0,18,10,0|xubevz,18,10,0|xubew0,17,1,1|xwh6vz,17,1,1|xwh6w0,18,10,0|ycoivz,18,10,0|ycoiw0,17,1,1|yeuavz,17,1,1|yeuaw0,18,10,0|yv1mvz,18,10,0|yv1mw0,17,1,1|ywug7z,17,1,1|ywug80,18,10,0|zd1s7z,18,10,0|zd1s80,17,1,1|zf7k7z,17,1,1|zf7k80,18,10,0\",\"Africa/Ceuta|,0,19,0|-100edc0,8,1,0|-qyiys1,8,1,0|-qyiys0,9,10,1|-qqluw1,9,10,1|-qqluw0,8,1,0|-nusqs1,8,1,0|-nusqs0,9,10,1|-nm0001,9,10,1|-nm0000,8,1,0|-mt71g1,8,1,0|-mt71g0,9,10,1|-mkjuo1,9,10,1|-mkjuo0,8,1,0|-matxg1,8,1,0|-matxg0,9,10,1|-m1ts01,9,10,1|-m1ts00,8,1,0|-lrqtc1,8,1,0|-lrqtc0,9,10,1|-liqqo1,9,10,1|-liqqo0,8,1,0|-1chdc1,8,1,0|-1chdc0,9,10,1|-16c5g1,9,10,1|-16c5g0,8,1,0|2c3rzz,8,1,0|2c3s00,9,10,1|2fnh7z,9,10,1|2fnh80,8,1,0|3axhbz,8,1,0|3axhc0,9,10,1|3fnrvz,9,10,1|3fnrw0,8,1,0|3tpenz,8,1,0|3tpeo0,9,10,1|41f3vz,9,10,1|41f3w0,8,1,0|4e2qnz,8,1,0|4e2qo0,9,10,1|4hd6jz,9,10,1|4hd6k0,8,1,0|7evenz,8,1,0|7eveo0,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Africa/Conakry|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Dakar|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Dar_es_Salaam|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Africa/Djibouti|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Africa/Douala|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/El_Aaiun|,0,20,0|-isdxk0,13,15,0|3a22rz,13,15,0|3a22s0,17,1,0|3axhbz,17,1,0|3axhc0,18,10,1|3fnrvz,18,10,1|3fnrw0,17,1,0|3tpenz,17,1,0|3tpeo0,18,10,1|41f3vz,18,10,1|41f3w0,17,1,0|4e2qnz,17,1,0|4e2qo0,18,10,1|4hd6jz,18,10,1|4hd6k0,17,1,0|k1rbzz,17,1,0|k1rc00,18,10,1|k6hmjz,18,10,1|k6hmk0,17,1,0|kkj9bz,17,1,0|kkj9c0,18,10,1|kop6jz,18,10,1|kop6k0,17,1,0|l1rmnz,17,1,0|l1rmo0,18,10,1|l6t17z,18,10,1|l6t180,17,1,0|lj1unz,17,1,0|lj1uo0,18,10,1|lp657z,18,10,1|lp6580,17,1,0|m37xjz,17,1,0|m37xk0,18,10,1|m7fs7z,18,10,1|m7fs80,17,1,0|m916vz,17,1,0|m916w0,18,10,1|mb547z,18,10,1|mb5480,17,1,0|mly07z,17,1,0|mly080,18,10,1|mpjmvz,18,10,1|mpjmw0,17,1,0|mraljz,17,1,0|mralk0,18,10,1|mvb1jz,18,10,1|mvb1k0,17,1,0|n3887z,17,1,0|n38880,18,10,1|n7uw7z,18,10,1|n7uw80,17,1,0|n9npjz,17,1,0|n9npk0,18,10,1|ne147z,18,10,1|ne1480,17,1,0|nlyavz,17,1,0|nlyaw0,18,10,1|npww7z,18,10,1|npww80,17,1,0|nrppjz,17,1,0|nrppk0,18,10,1|nwr6vz,18,10,1|nwr6w0,17,1,0|o4odjz,17,1,0|o4odk0,18,10,1|o8a07z,18,10,1|o8a080,17,1,0|oa2tjz,17,1,0|oa2tk0,18,10,1|ofu87z,18,10,1|ofu880,17,1,0|oneg7z,17,1,0|oneg80,18,10,1|oqa5jz,18,10,1|oqa5k0,17,1,0|osfxjz,17,1,0|osfxk0,18,10,1|oykavz,18,10,1|oykaw0,17,1,0|p64ivz,17,1,0|p64iw0,18,10,1|p8n9jz,18,10,1|p8n9k0,17,1,0|pag2vz,17,1,0|pag2w0,18,10,1|phadjz,18,10,1|phadk0,18,10,0|pr0djz,18,10,0|pr0dk0,17,1,1|pst6vz,17,1,1|pst6w0,18,10,0|q90ivz,18,10,0|q90iw0,17,1,1|qb6avz,17,1,1|qb6aw0,18,10,0|qrdmvz,18,10,0|qrdmw0,17,1,1|qt6g7z,17,1,1|qt6g80,18,10,0|r9ds7z,18,10,0|r9ds80,17,1,1|rbjk7z,17,1,1|rbjk80,18,10,0|rrqw7z,18,10,0|rrqw80,17,1,1|rtwo7z,17,1,1|rtwo80,18,10,0|sa407z,18,10,0|sa4080,17,1,1|sbwtjz,17,1,1|sbwtk0,18,10,0|ss45jz,18,10,0|ss45k0,17,1,1|su9xjz,17,1,1|su9xk0,18,10,0|tah9jz,18,10,0|tah9k0,17,1,1|tca2vz,17,1,1|tca2w0,18,10,0|tsudjz,18,10,0|tsudk0,17,1,1|tun6vz,17,1,1|tun6w0,18,10,0|uauivz,18,10,0|uauiw0,17,1,1|ud0avz,17,1,1|ud0aw0,18,10,0|ut7mvz,18,10,0|ut7mw0,17,1,1|uv0g7z,17,1,1|uv0g80,18,10,0|vb7s7z,18,10,0|vb7s80,17,1,1|vddk7z,17,1,1|vddk80,18,10,0|vtkw7z,18,10,0|vtkw80,17,1,1|vvqo7z,17,1,1|vvqo80,18,10,0|wby07z,18,10,0|wby080,17,1,1|wdqtjz,17,1,1|wdqtk0,18,10,0|wty5jz,18,10,0|wty5k0,17,1,1|ww3xjz,17,1,1|ww3xk0,18,10,0|xcb9jz,18,10,0|xcb9k0,17,1,1|xe42vz,17,1,1|xe42w0,18,10,0|xubevz,18,10,0|xubew0,17,1,1|xwh6vz,17,1,1|xwh6w0,18,10,0|ycoivz,18,10,0|ycoiw0,17,1,1|yeuavz,17,1,1|yeuaw0,18,10,0|yv1mvz,18,10,0|yv1mw0,17,1,1|ywug7z,17,1,1|ywug80,18,10,0|zd1s7z,18,10,0|zd1s80,17,1,1|zf7k7z,17,1,1|zf7k80,18,10,0\",\"Africa/Freetown|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Gaborone|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Harare|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Johannesburg|,0,21,0|-14nj6io,19,22,0|-yvtdi1,19,22,0|-yvtdi0,19,11,0|-e8lpc1,19,11,0|-e8lpc0,19,6,1|-dz8qs1,19,6,1|-dz8qs0,19,11,0|-dpvmo1,19,11,0|-dpvmo0,19,6,1|-dgio41,19,6,1|-dgio40,19,11,0\",\"Africa/Juba|,0,23,0|-kcrsis,14,11,0|662fz,14,11,0|662g0,20,6,1|er8zz,20,6,1|er900,14,11,0|ow53z,14,11,0|ow540,20,6,1|xj6bz,20,6,1|xj6c0,14,11,0|17px3z,14,11,0|17px40,20,6,1|1gcybz,20,6,1|1gcyc0,14,11,0|1qfzrz,14,11,0|1qfzs0,20,6,1|1z4vnz,20,6,1|1z4vo0,14,11,0|2962fz,14,11,0|2962g0,20,6,1|2hwszz,20,6,1|2hwt00,14,11,0|2rw53z,14,11,0|2rw540,20,6,1|30oqbz,20,6,1|30oqc0,14,11,0|3am7rz,14,11,0|3am7s0,20,6,1|3jiibz,20,6,1|3jiic0,14,11,0|3tcafz,14,11,0|3tcag0,20,6,1|42afnz,20,6,1|42afo0,14,11,0|4cfbrz,14,11,0|4cfbs0,20,6,1|4l2czz,20,6,1|4l2d00,14,11,0|4v5efz,14,11,0|4v5eg0,20,6,1|53uabz,20,6,1|53uac0,14,11,0|5dvh3z,14,11,0|5dvh40,20,6,1|5mo2bz,20,6,1|5mo2c0,14,11,0|5wljrz,14,11,0|5wljs0,20,6,1|65fznz,20,6,1|65fzo0,14,11,0|6fbmfz,14,11,0|6fbmg0,20,6,1|6o7wzz,20,6,1|6o7x00,14,11,0|6y1p3z,14,11,0|6y1p40,20,6,1|76zubz,20,6,1|76zuc0,14,11,0|7h4qfz,14,11,0|7h4qg0,20,6,1|7ptmbz,20,6,1|7ptmc0,14,11,0|7zut3z,14,11,0|7zut40,20,6,1|88ljnz,20,6,1|88ljo0,14,11,0|fodfrz,14,11,0|fodfs0,5,6,0|qntgzz,5,6,0|qnth00,14,11,0\",\"Africa/Kampala|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Africa/Khartoum|,0,24,0|-kcrsow,14,11,0|662fz,14,11,0|662g0,20,6,1|er8zz,20,6,1|er900,14,11,0|ow53z,14,11,0|ow540,20,6,1|xj6bz,20,6,1|xj6c0,14,11,0|17px3z,14,11,0|17px40,20,6,1|1gcybz,20,6,1|1gcyc0,14,11,0|1qfzrz,14,11,0|1qfzs0,20,6,1|1z4vnz,20,6,1|1z4vo0,14,11,0|2962fz,14,11,0|2962g0,20,6,1|2hwszz,20,6,1|2hwt00,14,11,0|2rw53z,14,11,0|2rw540,20,6,1|30oqbz,20,6,1|30oqc0,14,11,0|3am7rz,14,11,0|3am7s0,20,6,1|3jiibz,20,6,1|3jiic0,14,11,0|3tcafz,14,11,0|3tcag0,20,6,1|42afnz,20,6,1|42afo0,14,11,0|4cfbrz,14,11,0|4cfbs0,20,6,1|4l2czz,20,6,1|4l2d00,14,11,0|4v5efz,14,11,0|4v5eg0,20,6,1|53uabz,20,6,1|53uac0,14,11,0|5dvh3z,14,11,0|5dvh40,20,6,1|5mo2bz,20,6,1|5mo2c0,14,11,0|5wljrz,14,11,0|5wljs0,20,6,1|65fznz,20,6,1|65fzo0,14,11,0|6fbmfz,14,11,0|6fbmg0,20,6,1|6o7wzz,20,6,1|6o7x00,14,11,0|6y1p3z,14,11,0|6y1p40,20,6,1|76zubz,20,6,1|76zuc0,14,11,0|7h4qfz,14,11,0|7h4qg0,20,6,1|7ptmbz,20,6,1|7ptmc0,14,11,0|7zut3z,14,11,0|7zut40,20,6,1|88ljnz,20,6,1|88ljo0,14,11,0|fodfrz,14,11,0|fodfs0,5,6,0|oypgzz,5,6,0|oyph00,14,11,0\",\"Africa/Kigali|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Kinshasa|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Lagos|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Libreville|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Lome|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Luanda|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Lubumbashi|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Lusaka|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Malabo|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Maputo|,0,16,0|-yvtfd8,14,11,0\",\"Africa/Maseru|,0,21,0|-14nj6io,19,22,0|-yvtdi1,19,22,0|-yvtdi0,19,11,0|-e8lpc1,19,11,0|-e8lpc0,19,6,1|-dz8qs1,19,6,1|-dz8qs0,19,11,0|-dpvmo1,19,11,0|-dpvmo0,19,6,1|-dgio41,19,6,1|-dgio40,19,11,0\",\"Africa/Mbabane|,0,21,0|-14nj6io,19,22,0|-yvtdi1,19,22,0|-yvtdi0,19,11,0|-e8lpc1,19,11,0|-e8lpc0,19,6,1|-dz8qs1,19,6,1|-dz8qs0,19,11,0|-dpvmo1,19,11,0|-dpvmo0,19,6,1|-dgio41,19,6,1|-dgio40,19,11,0\",\"Africa/Mogadishu|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Africa/Monrovia|,0,25,0|-19xcbc4,21,25,0|-qj6zc5,21,25,0|-qj6zc4,21,26,0|11v0q5,21,26,0|11v0q6,1,1,0\",\"Africa/Nairobi|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Africa/Ndjamena|,0,27,0|-u9rk4c,12,10,0|53sl7z,12,10,0|53sl80,22,11,1|5bavrz,22,11,1|5bavs0,12,10,0\",\"Africa/Niamey|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Nouakchott|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Ouagadougou|,0,12,0|-u9rgl4,1,1,0\",\"Africa/Porto-Novo|,0,13,0|-xnxnan,1,1,0|-w3k001,1,1,0|-w3k000,0,13,0|-t85smo,0,13,0|-t85smn,3,3,0|-q9qc21,3,3,0|-q9qc20,12,10,0\",\"Africa/Sao_Tome|,0,28,0|-18vsjww,0,29,0|-u9rhc1,0,29,0|-u9rhc0,1,1,0|p1uqrz,1,1,0|p1uqs0,12,10,0|pkmo3z,12,10,0|pkmo40,1,1,0\",\"Africa/Tripoli|,0,30,0|-q3gfrw,10,10,0|-9ia581,10,10,0|-9ia580,11,11,1|-9e82w1,11,11,1|-9e82w0,10,10,0|-8gxp81,10,10,0|-8gxp80,11,11,1|-8cmdk1,11,11,1|-8cmdk0,10,10,0|-7fuo41,10,10,0|-7fuo40,11,11,1|-7b2iw1,11,11,1|-7b2iw0,10,10,0|-5qotg1,10,10,0|-5qotg0,15,11,0|69gifz,15,11,0|69gig0,10,10,0|6e397z,10,10,0|6e3980,11,11,1|6ni2fz,11,11,1|6ni2g0,10,10,0|6wv6jz,10,10,0|6wv6k0,11,11,1|769zrz,11,11,1|769zs0,10,10,0|7foyjz,10,10,0|7foyk0,11,11,1|7p3rrz,11,11,1|7p3rs0,10,10,0|7yq57z,10,10,0|7yq580,11,11,1|87vp3z,11,11,1|87vp40,10,10,0|8hed7z,10,10,0|8hed80,11,11,1|8qrbrz,11,11,1|8qrbs0,10,10,0|900qjz,10,10,0|900qk0,11,11,1|99fjrz,11,11,1|99fjs0,10,10,0|9iuijz,10,10,0|9iuik0,11,11,1|9s9brz,11,11,1|9s9bs0,10,10,0|a1mfvz,10,10,0|a1mfw0,11,11,1|ab193z,11,11,1|ab1940,10,10,0|am3h7z,10,10,0|am3h80,15,11,0|dyil3z,15,11,0|dyil40,10,10,0|e833vz,10,10,0|e833w0,11,11,1|ehhx3z,11,11,1|ehhx40,15,11,0|md8vzz,15,11,0|md8w00,10,10,0|mkeanz,10,10,0|mkeao0,11,11,1|mv76nz,11,11,1|mv76o0,15,11,0\",\"Africa/Tunis|,0,31,0|-1a9dr7w,7,9,0|-uozn3m,7,9,0|-uozn3l,10,10,0|-g12881,10,10,0|-g12880,11,11,1|-fpwdk1,11,11,1|-fpwdk0,10,10,0|-fkt1k1,10,10,0|-fkt1k0,11,11,1|-eqk5k1,11,11,1|-eqk5k0,10,10,0|-eimw41,10,10,0|-eimw40,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dxuo01,11,11,1|-dxuo00,10,10,0|-dxfrw1,10,10,0|-dxfrw0,11,11,1|-dp3uo1,11,11,1|-dp3uo0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d62tk1,11,11,1|-d62tk0,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cofmw1,11,11,1|-cofmw0,10,10,0|3tnh7z,10,10,0|3tnh80,11,11,1|417p7z,11,11,1|417p80,10,10,0|4ch97z,10,10,0|4ch980,11,11,1|4kcl7z,11,11,1|4kcl80,10,10,0|9lzh7z,10,10,0|9lzh80,11,11,1|9ryajz,11,11,1|9ryak0,10,10,0|a1bbvz,10,10,0|a1bbw0,11,11,1|aaod7z,11,11,1|aaod80,10,10,0|alxx7z,10,10,0|alxx80,11,11,1|atrejz,11,11,1|atrek0,10,10,0|ifs7vz,10,10,0|ifs7w0,11,11,1|inlrzz,11,11,1|inls00,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0\",\"Africa/Windhoek|,0,32,0|-14nj4i0,23,22,0|-yvtdi1,23,22,0|-yvtdi0,19,11,0|-e8lpc1,19,11,0|-e8lpc0,19,6,1|-dz8qs1,19,6,1|-dz8qs0,19,11,0|ajtx3z,19,11,0|ajtx40,14,11,0|cmzh3z,14,11,0|cmzh40,12,10,1|cvkyrz,12,10,1|cvkys0,14,11,0|d6drzz,14,11,0|d6ds00,12,10,1|deb1fz,12,10,1|deb1g0,14,11,0|dpgtbz,14,11,0|dpgtc0,12,10,1|dx143z,12,10,1|dx1440,14,11,0|e86vzz,14,11,0|e86w00,12,10,1|eg45fz,12,10,1|eg45g0,14,11,0|eqwynz,14,11,0|eqwyo0,12,10,1|eyu83z,12,10,1|eyu840,14,11,0|f9n1bz,14,11,0|f9n1c0,12,10,1|fhkarz,12,10,1|fhkas0,14,11,0|fsd3zz,14,11,0|fsd400,12,10,1|g0adfz,12,10,1|g0adg0,14,11,0|gb36nz,14,11,0|gb36o0,12,10,1|gj0g3z,12,10,1|gj0g40,14,11,0|gu67zz,14,11,0|gu6800,12,10,1|h1qirz,12,10,1|h1qis0,14,11,0|hcwanz,14,11,0|hcwao0,12,10,1|hktk3z,12,10,1|hktk40,14,11,0|hvmdbz,14,11,0|hvmdc0,12,10,1|i3jmrz,12,10,1|i3jms0,14,11,0|iecfzz,14,11,0|iecg00,12,10,1|im9pfz,12,10,1|im9pg0,14,11,0|ix2inz,14,11,0|ix2io0,12,10,1|j4zs3z,12,10,1|j4zs40,14,11,0|jfslbz,14,11,0|jfslc0,12,10,1|jnpurz,12,10,1|jnpus0,14,11,0|jyvmnz,14,11,0|jyvmo0,12,10,1|k6sw3z,12,10,1|k6sw40,14,11,0|khlpbz,14,11,0|khlpc0,12,10,1|kpiyrz,12,10,1|kpiys0,14,11,0|l0brzz,14,11,0|l0bs00,12,10,1|l891fz,12,10,1|l891g0,14,11,0|lj1unz,14,11,0|lj1uo0,12,10,1|lqz43z,12,10,1|lqz440,14,11,0|m1rxbz,14,11,0|m1rxc0,12,10,1|m9p6rz,12,10,1|m9p6s0,14,11,0|mkuynz,14,11,0|mkuyo0,12,10,1|msf9fz,12,10,1|msf9g0,14,11,0|n3l1bz,14,11,0|n3l1c0,12,10,1|nbiarz,12,10,1|nbias0,14,11,0|nmb3zz,14,11,0|nmb400,12,10,1|nu8dfz,12,10,1|nu8dg0,14,11,0|o516nz,14,11,0|o516o0,12,10,1|ocyg3z,12,10,1|ocyg40,14,11,0|onr9bz,14,11,0|onr9c0,12,10,1|ovoirz,12,10,1|ovois0,14,11,0\",\"America/Adak|,0,33,0|-1hc7qjz,0,34,0|-1078omb,0,34,0|-1078oma,24,35,0|-ek1nw1,24,35,0|-ek1nw0,25,36,1|-cq2tg1,25,36,1|-cq2tg0,26,36,1|-cnomo1,26,36,1|-cnomo0,24,35,0|-1fq441,24,35,0|-1fq440,27,35,0|-cs3w1,27,35,0|-cs3w0,28,36,1|-3f5c1,28,36,1|-3f5c0,27,35,0|5xyrz,27,35,0|5xys0,28,36,1|faxbz,28,36,1|faxc0,27,35,0|oo1fz,27,35,0|oo1g0,28,36,1|ydynz,28,36,1|ydyo0,27,35,0|17r2rz,27,35,0|17r2s0,28,36,1|1h41bz,28,36,1|1h41c0,27,35,0|1qh5fz,27,35,0|1qh5g0,28,36,1|1zu3zz,28,36,1|1zu400,27,35,0|23ftfz,27,35,0|23ftg0,28,36,1|2ik6nz,28,36,1|2ik6o0,27,35,0|2oomrz,27,35,0|2ooms0,28,36,1|31a9bz,28,36,1|31a9c0,27,35,0|3andfz,27,35,0|3andg0,28,36,1|3kdanz,28,36,1|3kdao0,27,35,0|3tdg3z,27,35,0|3tdg40,28,36,1|433dbz,28,36,1|433dc0,27,35,0|4cghfz,27,35,0|4cghg0,28,36,1|4ltfzz,28,36,1|4ltg00,27,35,0|4v6k3z,27,35,0|4v6k40,28,36,1|54jinz,28,36,1|54jio0,27,35,0|5dwmrz,27,35,0|5dwms0,28,36,1|5n9lbz,28,36,1|5n9lc0,27,35,0|5wmpfz,27,35,0|5wmpg0,28,36,1|65znzz,28,36,1|65zo00,27,35,0|6fcs3z,27,35,0|6fcs40,28,36,1|6p2pbz,28,36,1|6p2pc0,27,35,0|6y2urz,27,35,0|6y2us0,28,36,1|77srzz,28,36,1|77ss00,29,36,0|79e13z,29,36,0|79e140,30,36,0|7h5tbz,30,36,0|7h5tc0,31,37,1|7qirvz,31,37,1|7qirw0,30,36,0|7zvvzz,30,36,0|7zvw00,31,37,1|898ujz,31,37,1|898uk0,30,36,0|8ilynz,30,36,0|8ilyo0,31,37,1|8ryx7z,31,37,1|8ryx80,30,36,0|9095bz,30,36,0|9095c0,31,37,1|9aozvz,31,37,1|9aozw0,30,36,0|9iz7zz,30,36,0|9iz800,31,37,1|9ts17z,31,37,1|9ts180,30,36,0|a1panz,30,36,0|a1pao0,31,37,1|aci3vz,31,37,1|aci3w0,30,36,0|akfdbz,30,36,0|akfdc0,31,37,1|av86jz,31,37,1|av86k0,30,36,0|b3ienz,30,36,0|b3ieo0,31,37,1|bdy97z,31,37,1|bdy980,30,36,0|bm8hbz,30,36,0|bm8hc0,31,37,1|bwobvz,31,37,1|bwobw0,30,36,0|c4yjzz,30,36,0|c4yk00,31,37,1|cfrd7z,31,37,1|cfrd80,30,36,0|cnomnz,30,36,0|cnomo0,31,37,1|cyhfvz,31,37,1|cyhfw0,30,36,0|d6epbz,30,36,0|d6epc0,31,37,1|dh7ijz,31,37,1|dh7ik0,30,36,0|dphqnz,30,36,0|dphqo0,31,37,1|dzxl7z,31,37,1|dzxl80,30,36,0|e87tbz,30,36,0|e87tc0,31,37,1|einnvz,31,37,1|einnw0,30,36,0|eqxvzz,30,36,0|eqxw00,31,37,1|f1dqjz,31,37,1|f1dqk0,30,36,0|f9nynz,30,36,0|f9nyo0,31,37,1|fkgrvz,31,37,1|fkgrw0,30,36,0|fse1bz,30,36,0|fse1c0,31,37,1|g36ujz,31,37,1|g36uk0,30,36,0|gb43zz,30,36,0|gb4400,31,37,1|glwx7z,31,37,1|glwx80,30,36,0|gu75bz,30,36,0|gu75c0,31,37,1|h4mzvz,31,37,1|h4mzw0,30,36,0|hcx7zz,30,36,0|hcx800,31,37,1|hnd2jz,31,37,1|hnd2k0,30,36,0|hvnanz,30,36,0|hvnao0,31,37,1|i6g3vz,31,37,1|i6g3w0,30,36,0|ieddbz,30,36,0|ieddc0,31,37,1|ip66jz,31,37,1|ip66k0,30,36,0|ix3fzz,30,36,0|ix3g00,31,37,1|j7w97z,31,37,1|j7w980,30,36,0|jeqmnz,30,36,0|jeqmo0,31,37,1|jqzajz,31,37,1|jqzak0,30,36,0|jxgpbz,30,36,0|jxgpc0,31,37,1|k9pd7z,31,37,1|k9pd80,30,36,0|kg6rzz,30,36,0|kg6s00,31,37,1|ksffvz,31,37,1|ksffw0,30,36,0|kz9tbz,30,36,0|kz9tc0,31,37,1|lbih7z,31,37,1|lbih80,30,36,0|lhzvzz,30,36,0|lhzw00,31,37,1|lu8jvz,31,37,1|lu8jw0,30,36,0|m0pynz,30,36,0|m0pyo0,31,37,1|mcymjz,31,37,1|mcymk0,30,36,0|mjg1bz,30,36,0|mjg1c0,31,37,1|mvop7z,31,37,1|mvop80,30,36,0|n263zz,30,36,0|n26400,31,37,1|neervz,31,37,1|neerw0,30,36,0|nkw6nz,30,36,0|nkw6o0,31,37,1|nx4ujz,31,37,1|nx4uk0,30,36,0|o3z7zz,30,36,0|o3z800,31,37,1|og7vvz,31,37,1|og7vw0,30,36,0|ompanz,30,36,0|ompao0,31,37,1|oyxyjz,31,37,1|oyxyk0,30,36,0|p5fdbz,30,36,0|p5fdc0,31,37,1|pho17z,31,37,1|pho180,30,36,0|po5fzz,30,36,0|po5g00,31,37,1|q0e3vz,31,37,1|q0e3w0,30,36,0|q6vinz,30,36,0|q6vio0,31,37,1|qj46jz,31,37,1|qj46k0,30,36,0|qpyjzz,30,36,0|qpyk00,31,37,1|r277vz,31,37,1|r277w0,30,36,0|r8omnz,30,36,0|r8omo0,31,37,1|rkxajz,31,37,1|rkxak0,30,36,0|rrepbz,30,36,0|rrepc0,31,37,1|s3nd7z,31,37,1|s3nd80,30,36,0|sa4rzz,30,36,0|sa4s00,31,37,1|smdfvz,31,37,1|smdfw0,30,36,0|ssuunz,30,36,0|ssuuo0,31,37,1|t53ijz,31,37,1|t53ik0,30,36,0|tbkxbz,30,36,0|tbkxc0,31,37,1|tntl7z,31,37,1|tntl80,30,36,0|tunynz,30,36,0|tunyo0,31,37,1|u6wmjz,31,37,1|u6wmk0,30,36,0|ude1bz,30,36,0|ude1c0,31,37,1|upmp7z,31,37,1|upmp80,30,36,0|uw43zz,30,36,0|uw4400,31,37,1|v8crvz,31,37,1|v8crw0,30,36,0|veu6nz,30,36,0|veu6o0,31,37,1|vr2ujz,31,37,1|vr2uk0,30,36,0|vxk9bz,30,36,0|vxk9c0,31,37,1|w9sx7z,31,37,1|w9sx80,30,36,0|wgnanz,30,36,0|wgnao0,31,37,1|wsvyjz,31,37,1|wsvyk0,30,36,0|wzddbz,30,36,0|wzddc0,31,37,1|xbm17z,31,37,1|xbm180,30,36,0|xi3fzz,30,36,0|xi3g00,31,37,1|xuc3vz,31,37,1|xuc3w0,30,36,0|y0tinz,30,36,0|y0tio0,31,37,1|yd26jz,31,37,1|yd26k0,30,36,0|yjjlbz,30,36,0|yjjlc0,31,37,1|yvs97z,31,37,1|yvs980,30,36,0|z29nzz,30,36,0|z29o00,31,37,1|zeibvz,31,37,1|zeibw0,30,36,0\",\"America/Anchorage|,0,38,0|-1hc7qjz,0,39,0|-1078tkp,0,39,0|-1078tko,32,36,0|-ek1qo1,32,36,0|-ek1qo0,33,37,1|-cq2tg1,33,37,1|-cq2tg0,34,37,1|-cnopg1,34,37,1|-cnopg0,32,36,0|-1fq6w1,32,36,0|-1fq6w0,29,36,0|-cs6o1,29,36,0|-cs6o0,35,37,1|-3f841,35,37,1|-3f840,29,36,0|5xvzz,29,36,0|5xw00,35,37,1|faujz,35,37,1|fauk0,29,36,0|onynz,29,36,0|onyo0,35,37,1|ydvvz,35,37,1|ydvw0,29,36,0|17qzzz,29,36,0|17r000,35,37,1|1h3yjz,35,37,1|1h3yk0,29,36,0|1qh2nz,29,36,0|1qh2o0,35,37,1|1zu17z,35,37,1|1zu180,29,36,0|23fqnz,29,36,0|23fqo0,35,37,1|2ik3vz,35,37,1|2ik3w0,29,36,0|2oojzz,29,36,0|2ook00,35,37,1|31a6jz,35,37,1|31a6k0,29,36,0|3ananz,29,36,0|3anao0,35,37,1|3kd7vz,35,37,1|3kd7w0,29,36,0|3tddbz,29,36,0|3tddc0,35,37,1|433ajz,35,37,1|433ak0,29,36,0|4cgenz,29,36,0|4cgeo0,35,37,1|4ltd7z,35,37,1|4ltd80,29,36,0|4v6hbz,29,36,0|4v6hc0,35,37,1|54jfvz,35,37,1|54jfw0,29,36,0|5dwjzz,29,36,0|5dwk00,35,37,1|5n9ijz,35,37,1|5n9ik0,29,36,0|5wmmnz,29,36,0|5wmmo0,35,37,1|65zl7z,35,37,1|65zl80,29,36,0|6fcpbz,29,36,0|6fcpc0,35,37,1|6p2mjz,35,37,1|6p2mk0,29,36,0|6y2rzz,29,36,0|6y2s00,35,37,1|77sp7z,35,37,1|77sp80,36,37,0|79dybz,36,37,0|79dyc0,37,37,0|7h5qjz,37,37,0|7h5qk0,38,40,1|7qip3z,38,40,1|7qip40,37,37,0|7zvt7z,37,37,0|7zvt80,38,40,1|898rrz,38,40,1|898rs0,37,37,0|8ilvvz,37,37,0|8ilvw0,38,40,1|8ryufz,38,40,1|8ryug0,37,37,0|9092jz,37,37,0|9092k0,38,40,1|9aox3z,38,40,1|9aox40,37,37,0|9iz57z,37,37,0|9iz580,38,40,1|9tryfz,38,40,1|9tryg0,37,37,0|a1p7vz,37,37,0|a1p7w0,38,40,1|aci13z,38,40,1|aci140,37,37,0|akfajz,37,37,0|akfak0,38,40,1|av83rz,38,40,1|av83s0,37,37,0|b3ibvz,37,37,0|b3ibw0,38,40,1|bdy6fz,38,40,1|bdy6g0,37,37,0|bm8ejz,37,37,0|bm8ek0,38,40,1|bwo93z,38,40,1|bwo940,37,37,0|c4yh7z,37,37,0|c4yh80,38,40,1|cfrafz,38,40,1|cfrag0,37,37,0|cnojvz,37,37,0|cnojw0,38,40,1|cyhd3z,38,40,1|cyhd40,37,37,0|d6emjz,37,37,0|d6emk0,38,40,1|dh7frz,38,40,1|dh7fs0,37,37,0|dphnvz,37,37,0|dphnw0,38,40,1|dzxifz,38,40,1|dzxig0,37,37,0|e87qjz,37,37,0|e87qk0,38,40,1|einl3z,38,40,1|einl40,37,37,0|eqxt7z,37,37,0|eqxt80,38,40,1|f1dnrz,38,40,1|f1dns0,37,37,0|f9nvvz,37,37,0|f9nvw0,38,40,1|fkgp3z,38,40,1|fkgp40,37,37,0|fsdyjz,37,37,0|fsdyk0,38,40,1|g36rrz,38,40,1|g36rs0,37,37,0|gb417z,37,37,0|gb4180,38,40,1|glwufz,38,40,1|glwug0,37,37,0|gu72jz,37,37,0|gu72k0,38,40,1|h4mx3z,38,40,1|h4mx40,37,37,0|hcx57z,37,37,0|hcx580,38,40,1|hnczrz,38,40,1|hnczs0,37,37,0|hvn7vz,37,37,0|hvn7w0,38,40,1|i6g13z,38,40,1|i6g140,37,37,0|iedajz,37,37,0|iedak0,38,40,1|ip63rz,38,40,1|ip63s0,37,37,0|ix3d7z,37,37,0|ix3d80,38,40,1|j7w6fz,38,40,1|j7w6g0,37,37,0|jeqjvz,37,37,0|jeqjw0,38,40,1|jqz7rz,38,40,1|jqz7s0,37,37,0|jxgmjz,37,37,0|jxgmk0,38,40,1|k9pafz,38,40,1|k9pag0,37,37,0|kg6p7z,37,37,0|kg6p80,38,40,1|ksfd3z,38,40,1|ksfd40,37,37,0|kz9qjz,37,37,0|kz9qk0,38,40,1|lbiefz,38,40,1|lbieg0,37,37,0|lhzt7z,37,37,0|lhzt80,38,40,1|lu8h3z,38,40,1|lu8h40,37,37,0|m0pvvz,37,37,0|m0pvw0,38,40,1|mcyjrz,38,40,1|mcyjs0,37,37,0|mjfyjz,37,37,0|mjfyk0,38,40,1|mvomfz,38,40,1|mvomg0,37,37,0|n2617z,37,37,0|n26180,38,40,1|neep3z,38,40,1|neep40,37,37,0|nkw3vz,37,37,0|nkw3w0,38,40,1|nx4rrz,38,40,1|nx4rs0,37,37,0|o3z57z,37,37,0|o3z580,38,40,1|og7t3z,38,40,1|og7t40,37,37,0|omp7vz,37,37,0|omp7w0,38,40,1|oyxvrz,38,40,1|oyxvs0,37,37,0|p5fajz,37,37,0|p5fak0,38,40,1|phnyfz,38,40,1|phnyg0,37,37,0|po5d7z,37,37,0|po5d80,38,40,1|q0e13z,38,40,1|q0e140,37,37,0|q6vfvz,37,37,0|q6vfw0,38,40,1|qj43rz,38,40,1|qj43s0,37,37,0|qpyh7z,37,37,0|qpyh80,38,40,1|r2753z,38,40,1|r27540,37,37,0|r8ojvz,37,37,0|r8ojw0,38,40,1|rkx7rz,38,40,1|rkx7s0,37,37,0|rremjz,37,37,0|rremk0,38,40,1|s3nafz,38,40,1|s3nag0,37,37,0|sa4p7z,37,37,0|sa4p80,38,40,1|smdd3z,38,40,1|smdd40,37,37,0|ssurvz,37,37,0|ssurw0,38,40,1|t53frz,38,40,1|t53fs0,37,37,0|tbkujz,37,37,0|tbkuk0,38,40,1|tntifz,38,40,1|tntig0,37,37,0|tunvvz,37,37,0|tunvw0,38,40,1|u6wjrz,38,40,1|u6wjs0,37,37,0|uddyjz,37,37,0|uddyk0,38,40,1|upmmfz,38,40,1|upmmg0,37,37,0|uw417z,37,37,0|uw4180,38,40,1|v8cp3z,38,40,1|v8cp40,37,37,0|veu3vz,37,37,0|veu3w0,38,40,1|vr2rrz,38,40,1|vr2rs0,37,37,0|vxk6jz,37,37,0|vxk6k0,38,40,1|w9sufz,38,40,1|w9sug0,37,37,0|wgn7vz,37,37,0|wgn7w0,38,40,1|wsvvrz,38,40,1|wsvvs0,37,37,0|wzdajz,37,37,0|wzdak0,38,40,1|xblyfz,38,40,1|xblyg0,37,37,0|xi3d7z,37,37,0|xi3d80,38,40,1|xuc13z,38,40,1|xuc140,37,37,0|y0tfvz,37,37,0|y0tfw0,38,40,1|yd23rz,38,40,1|yd23s0,37,37,0|yjjijz,37,37,0|yjjik0,38,40,1|yvs6fz,38,40,1|yvs6g0,37,37,0|z29l7z,37,37,0|z29l80,38,40,1|zei93z,38,40,1|zei940,37,37,0\",\"America/Anguilla|,0,41,0|-u6m79w,32,42,0\",\"America/Antigua|,0,41,0|-u6m79w,32,42,0\",\"America/Araguaina|,0,43,0|-t85j2o,39,44,0|-jylag1,39,44,0|-jylag0,40,45,1|-jpb141,40,45,1|-jpb140,39,44,0|-jfsd01,39,44,0|-jfsd00,40,45,1|-j6j3s1,40,45,1|-j6j3s0,39,44,0|-ahcyc1,39,44,0|-ahcyc0,40,45,1|-aad3o1,40,45,1|-aad3o0,39,44,0|-9yl101,39,44,0|-9yl100,40,45,1|-9sd141,40,45,1|-9sd140,39,44,0|-9ft3o1,39,44,0|-9ft3o0,40,45,1|-99j941,40,45,1|-99j940,39,44,0|-8wzbo1,39,44,0|-8wzbo0,40,45,1|-8scqg1,40,45,1|-8scqg0,39,44,0|-35xmc1,39,44,0|-35xmc0,40,45,1|-31nzs1,40,45,1|-31nzs0,39,44,0|-2kdp01,39,44,0|-2kdp00,40,45,1|-2hcig1,40,45,1|-2hcig0,39,44,0|-24qqc1,39,44,0|-24qqc0,40,45,1|-204541,40,45,1|-204540,39,44,0|-1nid01,39,44,0|-1nid00,40,45,1|-1hc7s1,40,45,1|-1hc7s0,39,44,0|-14qfo1,39,44,0|-14qfo0,40,45,1|-yifs1,40,45,1|-yifs0,39,44,0|89jcbz,39,44,0|89jcc0,40,45,1|8gdk7z,40,45,1|8gdk80,39,44,0|8rwgbz,39,44,0|8rwgc0,40,45,1|8xns7z,40,45,1|8xns80,39,44,0|9aodnz,39,44,0|9aodo0,40,45,1|9g2qvz,40,45,1|9g2qw0,39,44,0|9t1hnz,39,44,0|9t1ho0,40,45,1|9yfuvz,40,45,1|9yfuw0,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|ahvuvz,40,45,1|ahvuw0,39,44,0|dggyzz,39,44,0|dggz00,40,45,1|dml9jz,40,45,1|dml9k0,39,44,0|dyu2zz,39,44,0|dyu300,40,45,1|e5oavz,40,45,1|e5oaw0,39,44,0|ehm0bz,39,44,0|ehm0c0,40,45,1|ep4avz,40,45,1|ep4aw0,39,44,0|f0n6zz,39,44,0|f0n700,40,45,1|f7hevz,40,45,1|f7hew0,39,44,0|fj0azz,39,44,0|fj0b00,40,45,1|fqkg7z,40,45,1|fqkg80,39,44,0|g23cbz,39,44,0|g23cc0,40,45,1|g8xk7z,40,45,1|g8xk80,39,44,0|gl6dnz,39,44,0|gl6do0,40,45,1|grnmvz,40,45,1|grnmw0,39,44,0|h4zcbz,39,44,0|h4zcc0,40,45,1|hadpjz,40,45,1|hadpk0,39,44,0|mc82zz,39,44,0|mc8300,40,45,1|micdjz,40,45,1|micdk0,39,44,0\",\"America/Argentina/Buenos_Aires|,0,46,0|-138aaic,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,39,44,0|bdkobz,39,44,0|bdkoc0,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0|k8ytnz,39,44,0|k8yto0,40,45,1|kgiyvz,40,45,1|kgiyw0,39,44,0\",\"America/Argentina/Catamarca|,0,48,0|-138a95g,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,42,42,0|bdkr3z,42,42,0|bdkr40,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hym0bz,39,44,0|hym0c0,42,42,0|hzl9rz,42,42,0|hzl9s0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Argentina/Cordoba|,0,47,0|-138a9g0,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,42,42,0|bdkr3z,42,42,0|bdkr40,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0|k8ytnz,39,44,0|k8yto0,40,45,1|kgiyvz,40,45,1|kgiyw0,39,44,0\",\"America/Argentina/Jujuy|,0,49,0|-138a98o,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,42,42,0|av7n3z,42,42,0|av7n40,39,44,1|b2etnz,39,44,1|b2eto0,42,42,0|bcutrz,42,42,0|bcuts0,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Argentina/La_Rioja|,0,50,0|-138a8yc,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1l47z,40,45,1|b1l480,42,42,0|b51cfz,42,42,0|b51cg0,39,44,0|bdkobz,39,44,0|bdkoc0,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hym0bz,39,44,0|hym0c0,42,42,0|hzl9rz,42,42,0|hzl9s0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Argentina/Mendoza|,0,51,0|-138a8l8,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,42,42,0|aujkfz,42,42,0|aujkg0,39,44,1|b1l6zz,39,44,1|b1l700,42,42,0|bdbhrz,42,42,0|bdbhs0,39,44,1|bkeyzz,39,44,1|bkez00,42,42,0|bwatrz,42,42,0|bwats0,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hy5cbz,39,44,0|hy5cc0,42,42,0|i4mr3z,42,42,0|i4mr40,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Argentina/Rio_Gallegos|,0,52,0|-138a8ik,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,39,44,0|bdkobz,39,44,0|bdkoc0,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hym0bz,39,44,0|hym0c0,42,42,0|hzl9rz,42,42,0|hzl9s0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Argentina/Salta|,0,53,0|-138a97w,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,42,42,0|bdkr3z,42,42,0|bdkr40,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Argentina/San_Juan|,0,54,0|-138a8n8,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1l47z,40,45,1|b1l480,42,42,0|b51cfz,42,42,0|b51cg0,39,44,0|bdkobz,39,44,0|bdkoc0,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hyk5nz,39,44,0|hyk5o0,42,42,0|i1e33z,42,42,0|i1e340,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Argentina/San_Luis|,0,55,0|-138a91o,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|ajh9jz,40,45,1|ajh9k0,42,42,0|aujkfz,42,42,0|aujkg0,39,44,1|b1l6zz,39,44,1|b1l700,42,42,0|b6bn3z,42,42,0|b6bn40,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hyk5nz,39,44,0|hyk5o0,42,42,0|i1e33z,42,42,0|i1e340,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|juz1jz,40,45,1|juz1k0,39,44,1|jxg0bz,39,44,1|jxg0c0,42,42,0|k8lxrz,42,42,0|k8lxs0,39,44,1|kg62zz,39,44,1|kg6300,42,42,0|krc0fz,42,42,0|krc0g0,39,44,0\",\"America/Argentina/Tucuman|,0,56,0|-138a998,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,42,42,0|bdkr3z,42,42,0|bdkr40,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hym0bz,39,44,0|hym0c0,42,42,0|hz8b3z,42,42,0|hz8b40,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0|k8ytnz,39,44,0|k8yto0,40,45,1|kgiyvz,40,45,1|kgiyw0,39,44,0\",\"America/Argentina/Ushuaia|,0,57,0|-138a8oo,41,47,0|-px7ys1,41,47,0|-px7ys0,42,42,0|-kecq81,42,42,0|-kecq80,39,44,1|-k84qc1,39,44,1|-k84qc0,42,42,0|-jxzu81,42,42,0|-jxzu80,39,44,1|-jqwd01,39,44,1|-jqwd00,42,42,0|-jeakw1,42,42,0|-jeakw0,39,44,1|-j84fo1,39,44,1|-j84fo0,42,42,0|-ivink1,42,42,0|-ivink0,39,44,1|-ipcic1,39,44,1|-ipcic0,42,42,0|-icqq81,42,42,0|-icqq80,39,44,1|-i6kl01,39,44,1|-i6kl00,42,42,0|-htysw1,42,42,0|-htysw0,39,44,1|-hnqt01,39,44,1|-hnqt00,42,42,0|-hb50w1,42,42,0|-hb50w0,39,44,1|-h4yvo1,39,44,1|-h4yvo0,42,42,0|-gsd3k1,42,42,0|-gsd3k0,39,44,1|-gm6yc1,39,44,1|-gm6yc0,42,42,0|-g9l681,42,42,0|-g9l680,39,44,1|-g3f101,39,44,1|-g3f100,42,42,0|-fqt8w1,42,42,0|-fqt8w0,39,44,1|-fkl901,39,44,1|-fkl900,42,42,0|-feb8w1,42,42,0|-feb8w0,39,44,1|-ewd101,39,44,1|-ewd100,42,42,0|-eq30w1,42,42,0|-eq30w0,39,44,1|-dse501,39,44,1|-dse500,42,42,0|-doj681,42,42,0|-doj680,39,44,1|-cfvuc1,39,44,1|-cfvuc0,42,42,0|-c4vgw1,42,42,0|-c4vgw0,39,44,1|-39hec1,39,44,1|-39hec0,42,42,0|-35mfk1,42,42,0|-35mfk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2pxm81,42,42,0|-2pxm80,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|9veobz,39,44,0|9veoc0,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|aiyqvz,40,45,1|aiyqw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,39,44,0|bdkobz,39,44,0|bdkoc0,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c3hxjz,40,45,1|c3hxk0,39,44,0|fj0azz,39,44,0|fj0b00,39,44,1|fqtsbz,39,44,1|fqtsc0,39,44,0|hyiazz,39,44,0|hyib00,42,42,0|hzl9rz,42,42,0|hzl9s0,39,44,0|jtudnz,39,44,0|jtudo0,40,45,1|jxsw7z,40,45,1|jxsw80,39,44,0\",\"America/Aruba|,0,58,0|-u7lckd,43,59,0|-2lx4u1,43,59,0|-2lx4u0,32,42,0\",\"America/Asuncion|,0,60,0|-15r0ynk,44,60,0|-jy93zl,44,60,0|-jy93zk,42,42,0|1fnkfz,42,42,0|1fnkg0,39,44,0|27sgbz,39,44,0|27sgc0,42,42,0|2zzcfz,42,42,0|2zzcg0,39,44,1|37sqzz,39,44,1|37sr00,42,42,0|3it4fz,42,42,0|3it4g0,39,44,1|3qkobz,39,44,1|3qkoc0,42,42,0|41l1rz,42,42,0|41l1s0,39,44,1|49clnz,39,44,1|49clo0,42,42,0|4kcz3z,42,42,0|4kcz40,39,44,1|4tpxnz,39,44,1|4tpxo0,42,42,0|534wfz,42,42,0|534wg0,39,44,1|5cjpnz,39,44,1|5cjpo0,42,42,0|5lyofz,42,42,0|5lyog0,39,44,1|5vbmzz,39,44,1|5vbn00,42,42,0|64qlrz,42,42,0|64qls0,39,44,1|6e3kbz,39,44,1|6e3kc0,42,42,0|6nij3z,42,42,0|6nij40,39,44,1|6wvhnz,39,44,1|6wvho0,42,42,0|76agfz,42,42,0|76agg0,39,44,1|7fp9nz,39,44,1|7fp9o0,42,42,0|7p48fz,42,42,0|7p48g0,39,44,1|7yh6zz,39,44,1|7yh700,42,42,0|87w5rz,42,42,0|87w5s0,39,44,1|8h94bz,39,44,1|8h94c0,42,42,0|8qo33z,42,42,0|8qo340,39,44,1|9011nz,39,44,1|9011o0,42,42,0|99g0fz,42,42,0|99g0g0,39,44,1|9iutnz,39,44,1|9iuto0,42,42,0|9s9sfz,42,42,0|9s9sg0,39,44,1|a1mqzz,39,44,1|a1mr00,42,42,0|ac4lrz,42,42,0|ac4ls0,39,44,1|akeobz,39,44,1|akeoc0,42,42,0|attn3z,42,42,0|attn40,39,44,1|b36lnz,39,44,1|b36lo0,42,42,0|bcutrz,42,42,0|bcuts0,39,44,1|bkeyzz,39,44,1|bkez00,42,42,0|bvmr3z,42,42,0|bvmr40,39,44,1|c4qgbz,39,44,1|c4qgc0,42,42,0|ce79rz,42,42,0|ce79s0,39,44,1|clv4bz,39,44,1|clv4c0,42,42,0|cwz73z,42,42,0|cwz740,39,44,1|d4l6zz,39,44,1|d4l700,42,42,0|dfr4fz,42,42,0|dfr4g0,39,44,1|dnkizz,39,44,1|dnkj00,42,42,0|dyu5rz,42,42,0|dyu5s0,39,44,1|e61cbz,39,44,1|e61cc0,42,42,0|ehk8fz,42,42,0|ehk8g0,39,44,1|ep4dnz,39,44,1|ep4do0,42,42,0|f0ab3z,42,42,0|f0ab40,39,44,1|f87ezz,39,44,1|f87f00,42,42,0|fj0drz,42,42,0|fj0ds0,39,44,1|fqxhnz,39,44,1|fqxho0,42,42,0|g1qgfz,42,42,0|g1qgg0,39,44,1|g9nkbz,39,44,1|g9nkc0,42,42,0|gkthrz,42,42,0|gkths0,39,44,1|gu6gbz,39,44,1|gu6gc0,42,42,0|h1qr3z,42,42,0|h1qr40,39,44,1|hcwizz,39,44,1|hcwj00,42,42,0|hktsfz,42,42,0|hktsg0,39,44,1|hvmlnz,39,44,1|hvmlo0,42,42,0|i5pn3z,42,42,0|i5pn40,39,44,1|id9sbz,39,44,1|id9sc0,42,42,0|iofprz,42,42,0|iofps0,39,44,1|ivzuzz,39,44,1|ivzv00,42,42,0|j75sfz,42,42,0|j75sg0,39,44,1|jepxnz,39,44,1|jepxo0,42,42,0|jq8trz,42,42,0|jq8ts0,39,44,1|jxg0bz,39,44,1|jxg0c0,42,42,0|k8ywfz,42,42,0|k8ywg0,39,44,1|kg62zz,39,44,1|kg6300,42,42,0|kroz3z,42,42,0|kroz40,39,44,1|l0oyzz,39,44,1|l0oz00,42,42,0|l9p4fz,42,42,0|l9p4g0,39,44,1|ljf1nz,39,44,1|ljf1o0,42,42,0|lsf73z,42,42,0|lsf740,39,44,1|m254bz,39,44,1|m254c0,42,42,0|mbi8fz,42,42,0|mbi8g0,39,44,1|mk59nz,39,44,1|mk59o0,42,42,0|mu8b3z,42,42,0|mu8b40,39,44,1|n2vcbz,39,44,1|n2vcc0,42,42,0|ncydrz,42,42,0|ncyds0,39,44,1|nllezz,39,44,1|nllf00,42,42,0|nvogfz,42,42,0|nvogg0,39,44,1|o4ogbz,39,44,1|o4ogc0,42,42,0|oeej3z,42,42,0|oeej40,39,44,1|oneizz,39,44,1|onej00,42,42,0|ox4lrz,42,42,0|ox4ls0,39,44,1|p64lnz,39,44,1|p64lo0,42,42,0|pg7n3z,42,42,0|pg7n40,39,44,1|pouobz,39,44,1|pouoc0,42,42,0|pyxprz,42,42,0|pyxps0,39,44,1|q7kqzz,39,44,1|q7kr00,42,42,0|qhnsfz,42,42,0|qhnsg0,39,44,1|qqnsbz,39,44,1|qqnsc0,42,42,0|r0dv3z,42,42,0|r0dv40,39,44,1|r9duzz,39,44,1|r9dv00,42,42,0|rj3xrz,42,42,0|rj3xs0,39,44,1|rs3xnz,39,44,1|rs3xo0,42,42,0|s1u0fz,42,42,0|s1u0g0,39,44,1|sau0bz,39,44,1|sau0c0,42,42,0|skx1rz,42,42,0|skx1s0,39,44,1|stk2zz,39,44,1|stk300,42,42,0|t3n4fz,42,42,0|t3n4g0,39,44,1|tca5nz,39,44,1|tca5o0,42,42,0|tmd73z,42,42,0|tmd740,39,44,1|tvd6zz,39,44,1|tvd700,42,42,0|u539rz,42,42,0|u539s0,39,44,1|ue39nz,39,44,1|ue39o0,42,42,0|untcfz,42,42,0|untcg0,39,44,1|uwtcbz,39,44,1|uwtcc0,42,42,0|v6wdrz,42,42,0|v6wds0,39,44,1|vfjezz,39,44,1|vfjf00,42,42,0|vpmgfz,42,42,0|vpmgg0,39,44,1|vy9hnz,39,44,1|vy9ho0,42,42,0|w8cj3z,42,42,0|w8cj40,39,44,1|whcizz,39,44,1|whcj00,42,42,0|wr2lrz,42,42,0|wr2ls0,39,44,1|x02lnz,39,44,1|x02lo0,42,42,0|x9sofz,42,42,0|x9sog0,39,44,1|xisobz,39,44,1|xisoc0,42,42,0|xsir3z,42,42,0|xsir40,39,44,1|y1iqzz,39,44,1|y1ir00,42,42,0|yblsfz,42,42,0|yblsg0,39,44,1|yk8tnz,39,44,1|yk8to0,42,42,0|yubv3z,42,42,0|yubv40,39,44,1|z2ywbz,39,44,1|z2ywc0,42,42,0|zd1xrz,42,42,0|zd1xs0,39,44,1\",\"America/Atikokan|,0,61,0|-1353b18,45,62,0|-qzov41,45,62,0|-qzov40,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-f9ofc1,45,62,0|-f9ofc0,46,63,1|-ek21s1,46,63,1|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,49,63,0\",\"America/Bahia|,0,64,0|-t85kv8,39,44,0|-jylag1,39,44,0|-jylag0,40,45,1|-jpb141,40,45,1|-jpb140,39,44,0|-jfsd01,39,44,0|-jfsd00,40,45,1|-j6j3s1,40,45,1|-j6j3s0,39,44,0|-ahcyc1,39,44,0|-ahcyc0,40,45,1|-aad3o1,40,45,1|-aad3o0,39,44,0|-9yl101,39,44,0|-9yl100,40,45,1|-9sd141,40,45,1|-9sd140,39,44,0|-9ft3o1,39,44,0|-9ft3o0,40,45,1|-99j941,40,45,1|-99j940,39,44,0|-8wzbo1,39,44,0|-8wzbo0,40,45,1|-8scqg1,40,45,1|-8scqg0,39,44,0|-35xmc1,39,44,0|-35xmc0,40,45,1|-31nzs1,40,45,1|-31nzs0,39,44,0|-2kdp01,39,44,0|-2kdp00,40,45,1|-2hcig1,40,45,1|-2hcig0,39,44,0|-24qqc1,39,44,0|-24qqc0,40,45,1|-204541,40,45,1|-204540,39,44,0|-1nid01,39,44,0|-1nid00,40,45,1|-1hc7s1,40,45,1|-1hc7s0,39,44,0|-14qfo1,39,44,0|-14qfo0,40,45,1|-yifs1,40,45,1|-yifs0,39,44,0|89jcbz,39,44,0|89jcc0,40,45,1|8gdk7z,40,45,1|8gdk80,39,44,0|8rwgbz,39,44,0|8rwgc0,40,45,1|8xns7z,40,45,1|8xns80,39,44,0|9aodnz,39,44,0|9aodo0,40,45,1|9g2qvz,40,45,1|9g2qw0,39,44,0|9t1hnz,39,44,0|9t1ho0,40,45,1|9yfuvz,40,45,1|9yfuw0,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|ahvuvz,40,45,1|ahvuw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b0yw7z,40,45,1|b0yw80,39,44,0|bdkobz,39,44,0|bdkoc0,40,45,1|bjc07z,40,45,1|bjc080,39,44,0|bwnpnz,39,44,0|bwnpo0,40,45,1|c1p47z,40,45,1|c1p480,39,44,0|cf0tnz,39,44,0|cf0to0,40,45,1|cli2vz,40,45,1|cli2w0,39,44,0|cxqwbz,39,44,0|cxqwc0,40,45,1|d485jz,40,45,1|d485k0,39,44,0|dggyzz,39,44,0|dggz00,40,45,1|dml9jz,40,45,1|dml9k0,39,44,0|dyu2zz,39,44,0|dyu300,40,45,1|e5oavz,40,45,1|e5oaw0,39,44,0|ehm0bz,39,44,0|ehm0c0,40,45,1|ep4avz,40,45,1|ep4aw0,39,44,0|f0n6zz,39,44,0|f0n700,40,45,1|f7hevz,40,45,1|f7hew0,39,44,0|fj0azz,39,44,0|fj0b00,40,45,1|fqkg7z,40,45,1|fqkg80,39,44,0|g23cbz,39,44,0|g23cc0,40,45,1|g8xk7z,40,45,1|g8xk80,39,44,0|gl6dnz,39,44,0|gl6do0,40,45,1|grnmvz,40,45,1|grnmw0,39,44,0|h4zcbz,39,44,0|h4zcc0,40,45,1|hadpjz,40,45,1|hadpk0,39,44,0|lt51nz,39,44,0|lt51o0,40,45,1|lzz9jz,40,45,1|lzz9k0,39,44,0\",\"America/Bahia_Banderas|,0,65,0|-p1u4k0,50,66,0|-m7mko1,50,66,0|-m7mko0,45,62,0|-kf67c1,45,62,0|-kf67c0,50,66,0|-k6j3c1,50,66,0|-k6j3c0,45,62,0|-jypm01,45,62,0|-jypm00,50,66,0|-jpan81,50,66,0|-jpan80,45,62,0|-eg9601,45,62,0|-eg9600,50,66,0|-axv381,50,66,0|-axv380,51,40,0|m7z,51,40,0|m80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gcwozz,50,66,0|gcwp00,52,62,1|gkgu7z,52,62,1|gkgu80,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jftabz,50,66,0|jftac0,52,62,1|jqm3jz,52,62,1|jqm3k0,50,66,0|jywbnz,50,66,0|jywbo0,52,62,1|k9c67z,52,62,1|k9c680,50,66,0|khmebz,50,66,0|khmec0,52,62,1|ks28vz,52,62,1|ks28w0,50,66,0|l0cgzz,50,66,0|l0ch00,46,63,1|lb57fz,46,63,1|lb57g0,45,62,0|lj2gvz,45,62,0|lj2gw0,46,63,1|ltva3z,46,63,1|ltva40,45,62,0|m1sjjz,45,62,0|m1sjk0,46,63,1|mclcrz,46,63,1|mclcs0,45,62,0|mkvkvz,45,62,0|mkvkw0,46,63,1|mvbffz,46,63,1|mvbfg0,45,62,0|n3lnjz,45,62,0|n3lnk0,46,63,1|ne1i3z,46,63,1|ne1i40,45,62,0|nmbq7z,45,62,0|nmbq80,46,63,1|nwrkrz,46,63,1|nwrks0,45,62,0|o51svz,45,62,0|o51sw0,46,63,1|ofum3z,46,63,1|ofum40,45,62,0|onrvjz,45,62,0|onrvk0,46,63,1|oykorz,46,63,1|oykos0,45,62,0|p6hy7z,45,62,0|p6hy80,46,63,1|pharfz,46,63,1|pharg0,45,62,0|ppkzjz,45,62,0|ppkzk0,46,63,1|q00u3z,46,63,1|q00u40,45,62,0|q8b27z,45,62,0|q8b280,46,63,1|qiqwrz,46,63,1|qiqws0,45,62,0|qr14vz,45,62,0|qr14w0,46,63,1|r1ty3z,46,63,1|r1ty40,45,62,0|r9r7jz,45,62,0|r9r7k0,46,63,1|rkk0rz,46,63,1|rkk0s0,45,62,0|rsha7z,45,62,0|rsha80,46,63,1|s3a3fz,46,63,1|s3a3g0,45,62,0|sbkbjz,45,62,0|sbkbk0,46,63,1|sm063z,46,63,1|sm0640,45,62,0|suae7z,45,62,0|suae80,46,63,1|t4q8rz,46,63,1|t4q8s0,45,62,0|td0gvz,45,62,0|td0gw0,46,63,1|tngbfz,46,63,1|tngbg0,45,62,0|tvqjjz,45,62,0|tvqjk0,46,63,1|u6jcrz,46,63,1|u6jcs0,45,62,0|uegm7z,45,62,0|uegm80,46,63,1|up9ffz,46,63,1|up9fg0,45,62,0|ux6ovz,45,62,0|ux6ow0,46,63,1|v7zi3z,46,63,1|v7zi40,45,62,0|vg9q7z,45,62,0|vg9q80,46,63,1|vqpkrz,46,63,1|vqpks0,45,62,0|vyzsvz,45,62,0|vyzsw0,46,63,1|w9fnfz,46,63,1|w9fng0,45,62,0|whpvjz,45,62,0|whpvk0,46,63,1|wsiorz,46,63,1|wsios0,45,62,0|x0fy7z,45,62,0|x0fy80,46,63,1|xb8rfz,46,63,1|xb8rg0,45,62,0|xj60vz,45,62,0|xj60w0,46,63,1|xtyu3z,46,63,1|xtyu40,45,62,0|y1w3jz,45,62,0|y1w3k0,46,63,1|ycowrz,46,63,1|ycows0,45,62,0|ykz4vz,45,62,0|ykz4w0,46,63,1|yvezfz,46,63,1|yvezg0,45,62,0|z3p7jz,45,62,0|z3p7k0,46,63,1|ze523z,46,63,1|ze5240,45,62,0\",\"America/Barbados|,0,67,0|-o0aiaj,53,67,0|-jtzeak,53,67,0|-jtzeaj,32,42,0|3vvnbz,32,42,0|3vvnc0,54,44,1|41mz7z,54,44,1|41mz80,32,42,0|4bq0nz,32,42,0|4bq0o0,54,44,1|4kd1vz,54,44,1|4kd1w0,32,42,0|4ug3bz,32,42,0|4ug3c0,54,44,1|5334jz,54,44,1|5334k0,32,42,0|5dj4nz,32,42,0|5dj4o0,54,44,1|5lnn7z,54,44,1|5lnn80,32,42,0\",\"America/Belem|,0,68,0|-t85j0s,39,44,0|-jylag1,39,44,0|-jylag0,40,45,1|-jpb141,40,45,1|-jpb140,39,44,0|-jfsd01,39,44,0|-jfsd00,40,45,1|-j6j3s1,40,45,1|-j6j3s0,39,44,0|-ahcyc1,39,44,0|-ahcyc0,40,45,1|-aad3o1,40,45,1|-aad3o0,39,44,0|-9yl101,39,44,0|-9yl100,40,45,1|-9sd141,40,45,1|-9sd140,39,44,0|-9ft3o1,39,44,0|-9ft3o0,40,45,1|-99j941,40,45,1|-99j940,39,44,0|-8wzbo1,39,44,0|-8wzbo0,40,45,1|-8scqg1,40,45,1|-8scqg0,39,44,0|-35xmc1,39,44,0|-35xmc0,40,45,1|-31nzs1,40,45,1|-31nzs0,39,44,0|-2kdp01,39,44,0|-2kdp00,40,45,1|-2hcig1,40,45,1|-2hcig0,39,44,0|-24qqc1,39,44,0|-24qqc0,40,45,1|-204541,40,45,1|-204540,39,44,0|-1nid01,39,44,0|-1nid00,40,45,1|-1hc7s1,40,45,1|-1hc7s0,39,44,0|-14qfo1,39,44,0|-14qfo0,40,45,1|-yifs1,40,45,1|-yifs0,39,44,0|89jcbz,39,44,0|89jcc0,40,45,1|8gdk7z,40,45,1|8gdk80,39,44,0|8rwgbz,39,44,0|8rwgc0,40,45,1|8xns7z,40,45,1|8xns80,39,44,0|9aodnz,39,44,0|9aodo0,40,45,1|9g2qvz,40,45,1|9g2qw0,39,44,0\",\"America/Belize|,0,69,0|-u52ic0,45,62,0|-qqoy01,45,62,0|-qqoy00,55,70,1|-qk7ne1,55,70,1|-qk7ne0,45,62,0|-q7yvc1,45,62,0|-q7yvc0,55,70,1|-q14m21,55,70,1|-q14m20,45,62,0|-pp8so1,45,62,0|-pp8so0,55,70,1|-pieje1,55,70,1|-pieje0,45,62,0|-p6iq01,45,62,0|-p6iq00,55,70,1|-ozogq1,55,70,1|-ozogq0,45,62,0|-onfoo1,45,62,0|-onfoo0,55,70,1|-ogye21,55,70,1|-ogye20,45,62,0|-o4pm01,45,62,0|-o4pm00,55,70,1|-ny8be1,55,70,1|-ny8be0,45,62,0|-nlzjc1,45,62,0|-nlzjc0,55,70,1|-nf5a21,55,70,1|-nf5a20,45,62,0|-n39go1,45,62,0|-n39go0,55,70,1|-mwf7e1,55,70,1|-mwf7e0,45,62,0|-mkje01,45,62,0|-mkje00,55,70,1|-mdp4q1,55,70,1|-mdp4q0,45,62,0|-m1tbc1,45,62,0|-m1tbc0,55,70,1|-luz221,55,70,1|-luz220,45,62,0|-liqa01,45,62,0|-liqa00,55,70,1|-lc8ze1,55,70,1|-lc8ze0,45,62,0|-l007c1,45,62,0|-l007c0,55,70,1|-ktiwq1,55,70,1|-ktiwq0,45,62,0|-kha4o1,45,62,0|-kha4o0,55,70,1|-kafve1,55,70,1|-kafve0,45,62,0|-jyk201,45,62,0|-jyk200,55,70,1|-jrpsq1,55,70,1|-jrpsq0,45,62,0|-jftzc1,45,62,0|-jftzc0,55,70,1|-j8zq21,55,70,1|-j8zq20,45,62,0|-iwqy01,45,62,0|-iwqy00,55,70,1|-iq9ne1,55,70,1|-iq9ne0,45,62,0|-ie0vc1,45,62,0|-ie0vc0,55,70,1|-i7jkq1,55,70,1|-i7jkq0,45,62,0|-hvaso1,45,62,0|-hvaso0,55,70,1|-hoti21,55,70,1|-hoti20,45,62,0|-hckq01,45,62,0|-hckq00,55,70,1|-h5qgq1,55,70,1|-h5qgq0,45,62,0|-gtunc1,45,62,0|-gtunc0,55,70,1|-gn0e21,55,70,1|-gn0e20,45,62,0|-gb4ko1,45,62,0|-gb4ko0,55,70,1|-g4abe1,55,70,1|-g4abe0,45,62,0|-fs1jc1,45,62,0|-fs1jc0,55,70,1|-flk8q1,55,70,1|-flk8q0,45,62,0|-f9bgo1,45,62,0|-f9bgo0,55,70,1|-f2u621,55,70,1|-f2u620,45,62,0|-eqle01,45,62,0|-eqle00,55,70,1|-ejr4q1,55,70,1|-ejr4q0,45,62,0|-ecwso1,45,62,0|-ecwso0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cjqks1,48,63,1|-cjqks0,45,62,0|-blvzc1,45,62,0|-blvzc0,55,70,1|-bf1q21,55,70,1|-bf1q20,45,62,0|-b35wo1,45,62,0|-b35wo0,55,70,1|-awbne1,55,70,1|-awbne0,45,62,0|-akfu01,45,62,0|-akfu00,55,70,1|-adlkq1,55,70,1|-adlkq0,45,62,0|-a1cso1,45,62,0|-a1cso0,55,70,1|-9uvi21,55,70,1|-9uvi20,45,62,0|-9imq01,45,62,0|-9imq00,55,70,1|-9c5fe1,55,70,1|-9c5fe0,45,62,0|-8zwnc1,45,62,0|-8zwnc0,55,70,1|-8t2e21,55,70,1|-8t2e20,45,62,0|-8h6ko1,45,62,0|-8h6ko0,55,70,1|-8acbe1,55,70,1|-8acbe0,45,62,0|-7ygi01,45,62,0|-7ygi00,55,70,1|-7rm8q1,55,70,1|-7rm8q0,45,62,0|-7fqfc1,45,62,0|-7fqfc0,55,70,1|-78w621,55,70,1|-78w620,45,62,0|-6wne01,45,62,0|-6wne00,55,70,1|-6q63e1,55,70,1|-6q63e0,45,62,0|-6dxbc1,45,62,0|-6dxbc0,55,70,1|-67g0q1,55,70,1|-67g0q0,45,62,0|-5v78o1,45,62,0|-5v78o0,55,70,1|-5ocze1,55,70,1|-5ocze0,45,62,0|-5ch601,45,62,0|-5ch600,55,70,1|-55mwq1,55,70,1|-55mwq0,45,62,0|-4tr3c1,45,62,0|-4tr3c0,55,70,1|-4mwu21,55,70,1|-4mwu20,45,62,0|-4ao201,45,62,0|-4ao200,55,70,1|-446re1,55,70,1|-446re0,45,62,0|-3rxzc1,45,62,0|-3rxzc0,55,70,1|-3lgoq1,55,70,1|-3lgoq0,45,62,0|-397wo1,45,62,0|-397wo0,55,70,1|-32qm21,55,70,1|-32qm20,45,62,0|-2qhu01,45,62,0|-2qhu00,55,70,1|-2jnkq1,55,70,1|-2jnkq0,45,62,0|-27rrc1,45,62,0|-27rrc0,55,70,1|-20xi21,55,70,1|-20xi20,45,62,0|-1p1oo1,45,62,0|-1p1oo0,55,70,1|-1i7fe1,55,70,1|-1i7fe0,45,62,0|-15ync1,45,62,0|-15ync0,55,70,1|-zhcq1,55,70,1|-zhcq0,45,62,0|21s0nz,45,62,0|21s0o0,46,63,1|2565vz,46,63,1|2565w0,45,62,0|6rj4nz,45,62,0|6rj4o0,46,63,1|6uer7z,46,63,1|6uer80,45,62,0\",\"America/Blanc-Sablon|,0,71,0|-18vs838,32,42,0|-qzp0o1,32,42,0|-qzp0o0,54,44,1|-qpm4s1,54,44,1|-qpm4s0,32,42,0|-ek27c1,32,42,0|-ek27c0,33,44,1|-cq2tg1,33,44,1|-cq2tg0,34,44,1|-cnp641,34,44,1|-cnp640,32,42,0\",\"America/Boa_Vista|,0,72,0|-t85grk,42,42,0|-jyl7o1,42,42,0|-jyl7o0,39,44,1|-jpayc1,39,44,1|-jpayc0,42,42,0|-jfsa81,42,42,0|-jfsa80,39,44,1|-j6j101,39,44,1|-j6j100,42,42,0|-ahcvk1,42,42,0|-ahcvk0,39,44,1|-aad0w1,39,44,1|-aad0w0,42,42,0|-9yky81,42,42,0|-9yky80,39,44,1|-9scyc1,39,44,1|-9scyc0,42,42,0|-9ft0w1,42,42,0|-9ft0w0,39,44,1|-99j6c1,39,44,1|-99j6c0,42,42,0|-8wz8w1,42,42,0|-8wz8w0,39,44,1|-8scno1,39,44,1|-8scno0,42,42,0|-35xjk1,42,42,0|-35xjk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2kdm81,42,42,0|-2kdm80,39,44,1|-2hcfo1,39,44,1|-2hcfo0,42,42,0|-24qnk1,42,42,0|-24qnk0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1nia81,42,42,0|-1nia80,39,44,1|-1hc501,39,44,1|-1hc500,42,42,0|-14qcw1,42,42,0|-14qcw0,39,44,1|-yid01,39,44,1|-yid00,42,42,0|89jf3z,42,42,0|89jf40,39,44,1|8gdmzz,39,44,1|8gdn00,42,42,0|8rwj3z,42,42,0|8rwj40,39,44,1|8xnuzz,39,44,1|8xnv00,42,42,0|9aogfz,42,42,0|9aogg0,39,44,1|9g2tnz,39,44,1|9g2to0,42,42,0|fj0drz,42,42,0|fj0ds0,39,44,1|fqkizz,39,44,1|fqkj00,42,42,0|g23f3z,42,42,0|g23f40,39,44,1|g2gazz,39,44,1|g2gb00,42,42,0\",\"America/Bogota|,0,73,0|-18s2sy8,53,73,0|-srdoy9,53,73,0|-srdoy8,56,63,0|bnnsjz,56,63,0|bnnsk0,42,42,1|c4xxrz,42,42,1|c4xxs0,56,63,0\",\"America/Boise|,0,74,0|-18y0gg0,51,40,0|-r0emw1,51,40,0|-r0emw0,57,66,1|-qplto1,57,66,1|-qplto0,51,40,0|-qhok81,51,40,0|-qhok80,57,66,1|-q6vr01,57,66,1|-q6vr00,51,40,0|-oc9iw1,51,40,0|-oc9iw0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-1e8kc1,50,66,0|-1e8kc0,52,62,1|-14vls1,52,62,1|-14vls0,50,66,0|-viho1,50,66,0|-viho0,52,62,1|-m5j41,52,62,1|-m5j40,50,66,0|-csf01,50,66,0|-csf00,52,62,1|-3fgg1,52,62,1|-3fgg0,50,66,0|5xnnz,50,66,0|5xno0,52,62,1|fam7z,52,62,1|fam80,50,66,0|onqbz,50,66,0|onqc0,52,62,1|ydnjz,52,62,1|ydnk0,50,66,0|17qrnz,50,66,0|17qro0,52,62,1|1h3q7z,52,62,1|1h3q80,50,66,0|1qgubz,50,66,0|1qguc0,52,62,1|1ztsvz,52,62,1|1ztsw0,50,66,0|24vczz,50,66,0|24vd00,52,62,1|2ijvjz,52,62,1|2ijvk0,50,66,0|2oobnz,50,66,0|2oobo0,52,62,1|319y7z,52,62,1|319y80,50,66,0|3an2bz,50,66,0|3an2c0,52,62,1|3kczjz,52,62,1|3kczk0,50,66,0|3td4zz,50,66,0|3td500,52,62,1|43327z,52,62,1|433280,50,66,0|4cg6bz,50,66,0|4cg6c0,52,62,1|4lt4vz,52,62,1|4lt4w0,50,66,0|4v68zz,50,66,0|4v6900,52,62,1|54j7jz,52,62,1|54j7k0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gb3vnz,50,66,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jeqebz,50,66,0|jeqec0,52,62,1|jqz27z,52,62,1|jqz280,50,66,0|jxggzz,50,66,0|jxgh00,52,62,1|k9p4vz,52,62,1|k9p4w0,50,66,0|kg6jnz,50,66,0|kg6jo0,52,62,1|ksf7jz,52,62,1|ksf7k0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,50,66,0|lhznnz,50,66,0|lhzno0,52,62,1|lu8bjz,52,62,1|lu8bk0,50,66,0|m0pqbz,50,66,0|m0pqc0,52,62,1|mcye7z,52,62,1|mcye80,50,66,0|mjfszz,50,66,0|mjft00,52,62,1|mvogvz,52,62,1|mvogw0,50,66,0|n25vnz,50,66,0|n25vo0,52,62,1|neejjz,52,62,1|neejk0,50,66,0|nkvybz,50,66,0|nkvyc0,52,62,1|nx4m7z,52,62,1|nx4m80,50,66,0|o3yznz,50,66,0|o3yzo0,52,62,1|og7njz,52,62,1|og7nk0,50,66,0|omp2bz,50,66,0|omp2c0,52,62,1|oyxq7z,52,62,1|oyxq80,50,66,0|p5f4zz,50,66,0|p5f500,52,62,1|phnsvz,52,62,1|phnsw0,50,66,0|po57nz,50,66,0|po57o0,52,62,1|q0dvjz,52,62,1|q0dvk0,50,66,0|q6vabz,50,66,0|q6vac0,52,62,1|qj3y7z,52,62,1|qj3y80,50,66,0|qpybnz,50,66,0|qpybo0,52,62,1|r26zjz,52,62,1|r26zk0,50,66,0|r8oebz,50,66,0|r8oec0,52,62,1|rkx27z,52,62,1|rkx280,50,66,0|rregzz,50,66,0|rreh00,52,62,1|s3n4vz,52,62,1|s3n4w0,50,66,0|sa4jnz,50,66,0|sa4jo0,52,62,1|smd7jz,52,62,1|smd7k0,50,66,0|ssumbz,50,66,0|ssumc0,52,62,1|t53a7z,52,62,1|t53a80,50,66,0|tbkozz,50,66,0|tbkp00,52,62,1|tntcvz,52,62,1|tntcw0,50,66,0|tunqbz,50,66,0|tunqc0,52,62,1|u6we7z,52,62,1|u6we80,50,66,0|uddszz,50,66,0|uddt00,52,62,1|upmgvz,52,62,1|upmgw0,50,66,0|uw3vnz,50,66,0|uw3vo0,52,62,1|v8cjjz,52,62,1|v8cjk0,50,66,0|vetybz,50,66,0|vetyc0,52,62,1|vr2m7z,52,62,1|vr2m80,50,66,0|vxk0zz,50,66,0|vxk100,52,62,1|w9sovz,52,62,1|w9sow0,50,66,0|wgn2bz,50,66,0|wgn2c0,52,62,1|wsvq7z,52,62,1|wsvq80,50,66,0|wzd4zz,50,66,0|wzd500,52,62,1|xblsvz,52,62,1|xblsw0,50,66,0|xi37nz,50,66,0|xi37o0,52,62,1|xubvjz,52,62,1|xubvk0,50,66,0|y0tabz,50,66,0|y0tac0,52,62,1|yd1y7z,52,62,1|yd1y80,50,66,0|yjjczz,50,66,0|yjjd00,52,62,1|yvs0vz,52,62,1|yvs0w0,50,66,0|z29fnz,50,66,0|z29fo0,52,62,1|zei3jz,52,62,1|zei3k0,50,66,0\",\"America/Cambridge_Bay|,60,1,0|-q3gdc0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-2g1tw1,50,66,0|-2g1tw0,61,63,1|-26btw1,61,63,1|-26btw0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,49,63,0|g3jcjz,49,63,0|g3jck0,45,62,0|gb3vnz,45,62,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jeqebz,50,66,0|jeqec0,52,62,1|jqz27z,52,62,1|jqz280,50,66,0|jxggzz,50,66,0|jxgh00,52,62,1|k9p4vz,52,62,1|k9p4w0,50,66,0|kg6jnz,50,66,0|kg6jo0,52,62,1|ksf7jz,52,62,1|ksf7k0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,50,66,0|lhznnz,50,66,0|lhzno0,52,62,1|lu8bjz,52,62,1|lu8bk0,50,66,0|m0pqbz,50,66,0|m0pqc0,52,62,1|mcye7z,52,62,1|mcye80,50,66,0|mjfszz,50,66,0|mjft00,52,62,1|mvogvz,52,62,1|mvogw0,50,66,0|n25vnz,50,66,0|n25vo0,52,62,1|neejjz,52,62,1|neejk0,50,66,0|nkvybz,50,66,0|nkvyc0,52,62,1|nx4m7z,52,62,1|nx4m80,50,66,0|o3yznz,50,66,0|o3yzo0,52,62,1|og7njz,52,62,1|og7nk0,50,66,0|omp2bz,50,66,0|omp2c0,52,62,1|oyxq7z,52,62,1|oyxq80,50,66,0|p5f4zz,50,66,0|p5f500,52,62,1|phnsvz,52,62,1|phnsw0,50,66,0|po57nz,50,66,0|po57o0,52,62,1|q0dvjz,52,62,1|q0dvk0,50,66,0|q6vabz,50,66,0|q6vac0,52,62,1|qj3y7z,52,62,1|qj3y80,50,66,0|qpybnz,50,66,0|qpybo0,52,62,1|r26zjz,52,62,1|r26zk0,50,66,0|r8oebz,50,66,0|r8oec0,52,62,1|rkx27z,52,62,1|rkx280,50,66,0|rregzz,50,66,0|rreh00,52,62,1|s3n4vz,52,62,1|s3n4w0,50,66,0|sa4jnz,50,66,0|sa4jo0,52,62,1|smd7jz,52,62,1|smd7k0,50,66,0|ssumbz,50,66,0|ssumc0,52,62,1|t53a7z,52,62,1|t53a80,50,66,0|tbkozz,50,66,0|tbkp00,52,62,1|tntcvz,52,62,1|tntcw0,50,66,0|tunqbz,50,66,0|tunqc0,52,62,1|u6we7z,52,62,1|u6we80,50,66,0|uddszz,50,66,0|uddt00,52,62,1|upmgvz,52,62,1|upmgw0,50,66,0|uw3vnz,50,66,0|uw3vo0,52,62,1|v8cjjz,52,62,1|v8cjk0,50,66,0|vetybz,50,66,0|vetyc0,52,62,1|vr2m7z,52,62,1|vr2m80,50,66,0|vxk0zz,50,66,0|vxk100,52,62,1|w9sovz,52,62,1|w9sow0,50,66,0|wgn2bz,50,66,0|wgn2c0,52,62,1|wsvq7z,52,62,1|wsvq80,50,66,0|wzd4zz,50,66,0|wzd500,52,62,1|xblsvz,52,62,1|xblsw0,50,66,0|xi37nz,50,66,0|xi37o0,52,62,1|xubvjz,52,62,1|xubvk0,50,66,0|y0tabz,50,66,0|y0tac0,52,62,1|yd1y7z,52,62,1|yd1y80,50,66,0|yjjczz,50,66,0|yjjd00,52,62,1|yvs0vz,52,62,1|yvs0w0,50,66,0|z29fnz,50,66,0|z29fo0,52,62,1|zei3jz,52,62,1|zei3k0,50,66,0\",\"America/Campo_Grande|,0,75,0|-t85hvw,42,42,0|-jyl7o1,42,42,0|-jyl7o0,39,44,1|-jpayc1,39,44,1|-jpayc0,42,42,0|-jfsa81,42,42,0|-jfsa80,39,44,1|-j6j101,39,44,1|-j6j100,42,42,0|-ahcvk1,42,42,0|-ahcvk0,39,44,1|-aad0w1,39,44,1|-aad0w0,42,42,0|-9yky81,42,42,0|-9yky80,39,44,1|-9scyc1,39,44,1|-9scyc0,42,42,0|-9ft0w1,42,42,0|-9ft0w0,39,44,1|-99j6c1,39,44,1|-99j6c0,42,42,0|-8wz8w1,42,42,0|-8wz8w0,39,44,1|-8scno1,39,44,1|-8scno0,42,42,0|-35xjk1,42,42,0|-35xjk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2kdm81,42,42,0|-2kdm80,39,44,1|-2hcfo1,39,44,1|-2hcfo0,42,42,0|-24qnk1,42,42,0|-24qnk0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1nia81,42,42,0|-1nia80,39,44,1|-1hc501,39,44,1|-1hc500,42,42,0|-14qcw1,42,42,0|-14qcw0,39,44,1|-yid01,39,44,1|-yid00,42,42,0|89jf3z,42,42,0|89jf40,39,44,1|8gdmzz,39,44,1|8gdn00,42,42,0|8rwj3z,42,42,0|8rwj40,39,44,1|8xnuzz,39,44,1|8xnv00,42,42,0|9aogfz,42,42,0|9aogg0,39,44,1|9g2tnz,39,44,1|9g2to0,42,42,0|9t1kfz,42,42,0|9t1kg0,39,44,1|9yfxnz,39,44,1|9yfxo0,42,42,0|abrn3z,42,42,0|abrn40,39,44,1|ahvxnz,39,44,1|ahvxo0,42,42,0|auuofz,42,42,0|auuog0,39,44,1|b0yyzz,39,44,1|b0yz00,42,42,0|bdkr3z,42,42,0|bdkr40,39,44,1|bjc2zz,39,44,1|bjc300,42,42,0|bwnsfz,42,42,0|bwnsg0,39,44,1|c1p6zz,39,44,1|c1p700,42,42,0|cf0wfz,42,42,0|cf0wg0,39,44,1|cli5nz,39,44,1|cli5o0,42,42,0|cxqz3z,42,42,0|cxqz40,39,44,1|d488bz,39,44,1|d488c0,42,42,0|dgh1rz,42,42,0|dgh1s0,39,44,1|dmlcbz,39,44,1|dmlcc0,42,42,0|dyu5rz,42,42,0|dyu5s0,39,44,1|e5odnz,39,44,1|e5odo0,42,42,0|ehm33z,42,42,0|ehm340,39,44,1|ep4dnz,39,44,1|ep4do0,42,42,0|f0n9rz,42,42,0|f0n9s0,39,44,1|f7hhnz,39,44,1|f7hho0,42,42,0|fj0drz,42,42,0|fj0ds0,39,44,1|fqkizz,39,44,1|fqkj00,42,42,0|g23f3z,42,42,0|g23f40,39,44,1|g8xmzz,39,44,1|g8xn00,42,42,0|gl6gfz,42,42,0|gl6gg0,39,44,1|grnpnz,39,44,1|grnpo0,42,42,0|h4zf3z,42,42,0|h4zf40,39,44,1|hadsbz,39,44,1|hadsc0,42,42,0|hmzkfz,42,42,0|hmzkg0,39,44,1|ht3uzz,39,44,1|ht3v00,42,42,0|i6j9rz,42,42,0|i6j9s0,39,44,1|ic6wbz,39,44,1|ic6wc0,42,42,0|iofprz,42,42,0|iofps0,39,44,1|iuwyzz,39,44,1|iuwz00,42,42,0|j88ofz,42,42,0|j88og0,39,44,1|je00bz,39,44,1|je00c0,42,42,0|jpvv3z,42,42,0|jpvv40,39,44,1|jwd4bz,39,44,1|jwd4c0,42,42,0|k8ywfz,42,42,0|k8ywg0,39,44,1|kf36zz,39,44,1|kf3700,42,42,0|kroz3z,42,42,0|kroz40,39,44,1|ky68bz,39,44,1|ky68c0,42,42,0|laf1rz,42,42,0|laf1s0,39,44,1|lgwazz,39,44,1|lgwb00,42,42,0|lt54fz,42,42,0|lt54g0,39,44,1|lzzcbz,39,44,1|lzzcc0,42,42,0|mc85rz,42,42,0|mc85s0,39,44,1|micgbz,39,44,1|micgc0,42,42,0|muy8fz,42,42,0|muy8g0,39,44,1|n12izz,39,44,1|n12j00,42,42,0|ndob3z,42,42,0|ndob40,39,44,1|nk5kbz,39,44,1|nk5kc0,42,42,0|nwedrz,42,42,0|nweds0,39,44,1|o2vmzz,39,44,1|o2vn00,42,42,0|of4gfz,42,42,0|of4gg0,39,44,1|ollpnz,39,44,1|ollpo0,42,42,0|oxuj3z,42,42,0|oxuj40,39,44,1|p4bsbz,39,44,1|p4bsc0,42,42,0|phnhrz,42,42,0|phnhs0,39,44,1|pn1uzz,39,44,1|pn1v00,42,42,0\",\"America/Cancun|,0,76,0|-p1u7c0,45,62,0|690gnz,45,62,0|690go0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|ex1snz,62,42,1|ex1so0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gcwm7z,45,62,0|gcwm80,46,63,1|gkgrfz,46,63,1|gkgrg0,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jft7jz,45,62,0|jft7k0,46,63,1|jqm0rz,46,63,1|jqm0s0,45,62,0|jyw8vz,45,62,0|jyw8w0,46,63,1|k9c3fz,46,63,1|k9c3g0,45,62,0|khmbjz,45,62,0|khmbk0,46,63,1|ks263z,46,63,1|ks2640,45,62,0|l0ce7z,45,62,0|l0ce80,46,63,1|lb57fz,46,63,1|lb57g0,45,62,0|lj2gvz,45,62,0|lj2gw0,46,63,1|ltva3z,46,63,1|ltva40,45,62,0|m1sjjz,45,62,0|m1sjk0,46,63,1|mclcrz,46,63,1|mclcs0,45,62,0|mkvkvz,45,62,0|mkvkw0,46,63,1|mvbffz,46,63,1|mvbfg0,45,62,0|n3lnjz,45,62,0|n3lnk0,46,63,1|ne1i3z,46,63,1|ne1i40,45,62,0|nj327z,45,62,0|nj3280,49,63,0\",\"America/Caracas|,0,77,0|-15r0wxs,41,78,0|-u7lcxx,41,78,0|-u7lcxw,43,59,0|-2lx4u1,43,59,0|-2lx4u0,42,42,0|jsrsrz,42,42,0|jsrss0,43,59,0|o6hkrz,43,59,0|o6hks0,42,42,0\",\"America/Cayenne|,0,79,0|-uj7yb4,42,42,0|-16brk1,42,42,0|-16brk0,39,44,0\",\"America/Cayman|,0,80,0|-15r0uls,41,81,0|-w757vd,41,81,0|-w757vc,49,63,0\",\"America/Chicago|,0,82,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-pv01s1,45,62,0|-pv01s0,46,63,1|-pnsv81,46,63,1|-pnsv80,45,62,0|-pg8kg1,45,62,0|-pg8kg0,46,63,1|-p52sk1,46,63,1|-p52sk0,45,62,0|-ovpog1,45,62,0|-ovpog0,46,63,1|-oo5j81,46,63,1|-oo5j80,45,62,0|-oczls1,45,62,0|-oczls0,46,63,1|-o52hw1,46,63,1|-o52hw0,45,62,0|-nu9j41,45,62,0|-nu9j40,46,63,1|-nmcf81,46,63,1|-nmcf80,45,62,0|-nbjgg1,45,62,0|-nbjgg0,46,63,1|-n3mck1,46,63,1|-n3mck0,45,62,0|-mstds1,45,62,0|-mstds0,46,63,1|-mkw9w1,46,63,1|-mkw9w0,45,62,0|-ma3b41,45,62,0|-ma3b40,46,63,1|-m26781,46,63,1|-m26780,45,62,0|-lr09s1,45,62,0|-lr09s0,46,63,1|-lj35w1,46,63,1|-lj35w0,45,62,0|-l8a741,45,62,0|-l8a740,46,63,1|-l0d381,46,63,1|-l0d380,45,62,0|-kpk4g1,45,62,0|-kpk4g0,46,63,1|-khn0k1,46,63,1|-khn0k0,45,62,0|-k6u1s1,45,62,0|-k6u1s0,46,63,1|-jywxw1,46,63,1|-jywxw0,45,62,0|-jo3z41,45,62,0|-jo3z40,46,63,1|-jg6v81,46,63,1|-jg6v80,45,62,0|-j50xs1,45,62,0|-j50xs0,46,63,1|-ixgsk1,46,63,1|-ixgsk0,45,62,0|-imav41,45,62,0|-imav40,46,63,1|-iedr81,46,63,1|-iedr80,45,62,0|-i3ksg1,45,62,0|-i3ksg0,46,63,1|-hvnok1,46,63,1|-hvnok0,45,62,0|-hnqf41,45,62,0|-hnqf40,49,63,0|-haev81,49,63,0|-haev80,45,62,0|-h24n41,45,62,0|-h24n40,46,63,1|-gu7j81,46,63,1|-gu7j80,45,62,0|-gjekg1,45,62,0|-gjekg0,46,63,1|-gbhgk1,46,63,1|-gbhgk0,45,62,0|-g0bj41,45,62,0|-g0bj40,46,63,1|-fsrdw1,46,63,1|-fsrdw0,45,62,0|-fhlgg1,45,62,0|-fhlgg0,46,63,1|-f9ock1,46,63,1|-f9ock0,45,62,0|-eyvds1,45,62,0|-eyvds0,46,63,1|-eqy9w1,46,63,1|-eqy9w0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-ccw1s1,45,62,0|-ccw1s0,46,63,1|-c4yxw1,46,63,1|-c4yxw0,45,62,0|-bu5z41,45,62,0|-bu5z40,46,63,1|-bm8v81,46,63,1|-bm8v80,45,62,0|-bbfwg1,45,62,0|-bbfwg0,46,63,1|-b3isk1,46,63,1|-b3isk0,45,62,0|-aspts1,45,62,0|-aspts0,46,63,1|-akspw1,46,63,1|-akspw0,45,62,0|-a9msg1,45,62,0|-a9msg0,46,63,1|-a22n81,46,63,1|-a22n80,45,62,0|-9qwps1,45,62,0|-9qwps0,46,63,1|-9izlw1,46,63,1|-9izlw0,45,62,0|-986n41,45,62,0|-986n40,46,63,1|-909j81,46,63,1|-909j80,45,62,0|-8pgkg1,45,62,0|-8pgkg0,46,63,1|-8hjgk1,46,63,1|-8hjgk0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7o0f41,45,62,0|-7o0f40,46,63,1|-7eahw1,46,63,1|-7eahw0,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6vkf81,46,63,1|-6vkf80,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6cuck1,46,63,1|-6cuck0,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5u49w1,46,63,1|-5u49w0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5be781,46,63,1|-5be780,45,62,0|-521341,45,62,0|-521340,46,63,1|-4sb5w1,46,63,1|-4sb5w0,45,62,0|-4iy1s1,45,62,0|-4iy1s0,46,63,1|-49l381,46,63,1|-49l380,45,62,0|-407z41,45,62,0|-407z40,46,63,1|-3qv0k1,46,63,1|-3qv0k0,45,62,0|-3hhwg1,45,62,0|-3hhwg0,46,63,1|-384xw1,46,63,1|-384xw0,45,62,0|-2yrts1,45,62,0|-2yrts0,46,63,1|-2pev81,46,63,1|-2pev80,45,62,0|-2g1r41,45,62,0|-2g1r40,46,63,1|-26btw1,46,63,1|-26btw0,45,62,0|-1xbog1,45,62,0|-1xbog0,46,63,1|-1nlr81,46,63,1|-1nlr80,45,62,0|-1e8n41,45,62,0|-1e8n40,46,63,1|-14vok1,46,63,1|-14vok0,45,62,0|-vikg1,45,62,0|-vikg0,46,63,1|-m5lw1,46,63,1|-m5lw0,45,62,0|-cshs1,45,62,0|-cshs0,46,63,1|-3fj81,46,63,1|-3fj80,45,62,0|5xkvz,45,62,0|5xkw0,46,63,1|fajfz,46,63,1|fajg0,45,62,0|onnjz,45,62,0|onnk0,46,63,1|ydkrz,46,63,1|ydks0,45,62,0|17qovz,45,62,0|17qow0,46,63,1|1h3nfz,46,63,1|1h3ng0,45,62,0|1qgrjz,45,62,0|1qgrk0,46,63,1|1ztq3z,46,63,1|1ztq40,45,62,0|23ffjz,45,62,0|23ffk0,46,63,1|2ijsrz,46,63,1|2ijss0,45,62,0|2oo8vz,45,62,0|2oo8w0,46,63,1|319vfz,46,63,1|319vg0,45,62,0|3amzjz,45,62,0|3amzk0,46,63,1|3kcwrz,46,63,1|3kcws0,45,62,0|3td27z,45,62,0|3td280,46,63,1|432zfz,46,63,1|432zg0,45,62,0|4cg3jz,45,62,0|4cg3k0,46,63,1|4lt23z,46,63,1|4lt240,45,62,0|4v667z,45,62,0|4v6680,46,63,1|54j4rz,46,63,1|54j4s0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n97fz,46,63,1|5n97g0,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65za3z,46,63,1|65za40,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2bfz,46,63,1|6p2bg0,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77se3z,46,63,1|77se40,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qigrz,46,63,1|7qigs0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898jfz,46,63,1|898jg0,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8rym3z,46,63,1|8rym40,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aoorz,46,63,1|9aoos0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achsrz,46,63,1|achss0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7vfz,46,63,1|av7vg0,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdxy3z,46,63,1|bdxy40,45,62,0|bm867z,45,62,0|bm8680,46,63,1|bwo0rz,46,63,1|bwo0s0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr23z,46,63,1|cfr240,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh4rz,46,63,1|cyh4s0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh77fz,46,63,1|dh77g0,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gb3svz,45,62,0|gb3sw0,46,63,1|glwm3z,46,63,1|glwm40,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Chihuahua|,0,83,0|-p1u4k0,50,66,0|-m7mko1,50,66,0|-m7mko0,45,62,0|-kf67c1,45,62,0|-kf67c0,50,66,0|-k6j3c1,50,66,0|-k6j3c0,45,62,0|-jypm01,45,62,0|-jypm00,50,66,0|-jpan81,50,66,0|-jpan80,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxnnz,45,62,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gcwozz,50,66,0|gcwp00,52,62,1|gkgu7z,52,62,1|gkgu80,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jftabz,50,66,0|jftac0,52,62,1|jqm3jz,52,62,1|jqm3k0,50,66,0|jywbnz,50,66,0|jywbo0,52,62,1|k9c67z,52,62,1|k9c680,50,66,0|khmebz,50,66,0|khmec0,52,62,1|ks28vz,52,62,1|ks28w0,50,66,0|l0cgzz,50,66,0|l0ch00,52,62,1|lb5a7z,52,62,1|lb5a80,50,66,0|lj2jnz,50,66,0|lj2jo0,52,62,1|ltvcvz,52,62,1|ltvcw0,50,66,0|m1smbz,50,66,0|m1smc0,52,62,1|mclfjz,52,62,1|mclfk0,50,66,0|mkvnnz,50,66,0|mkvno0,52,62,1|mvbi7z,52,62,1|mvbi80,50,66,0|n3lqbz,50,66,0|n3lqc0,52,62,1|ne1kvz,52,62,1|ne1kw0,50,66,0|nmbszz,50,66,0|nmbt00,52,62,1|nwrnjz,52,62,1|nwrnk0,50,66,0|o51vnz,50,66,0|o51vo0,52,62,1|ofuovz,52,62,1|ofuow0,50,66,0|onrybz,50,66,0|onryc0,52,62,1|oykrjz,52,62,1|oykrk0,50,66,0|p6i0zz,50,66,0|p6i100,52,62,1|phau7z,52,62,1|phau80,50,66,0|ppl2bz,50,66,0|ppl2c0,52,62,1|q00wvz,52,62,1|q00ww0,50,66,0|q8b4zz,50,66,0|q8b500,52,62,1|qiqzjz,52,62,1|qiqzk0,50,66,0|qr17nz,50,66,0|qr17o0,52,62,1|r1u0vz,52,62,1|r1u0w0,50,66,0|r9rabz,50,66,0|r9rac0,52,62,1|rkk3jz,52,62,1|rkk3k0,50,66,0|rshczz,50,66,0|rshd00,52,62,1|s3a67z,52,62,1|s3a680,50,66,0|sbkebz,50,66,0|sbkec0,52,62,1|sm08vz,52,62,1|sm08w0,50,66,0|suagzz,50,66,0|suah00,52,62,1|t4qbjz,52,62,1|t4qbk0,50,66,0|td0jnz,50,66,0|td0jo0,52,62,1|tnge7z,52,62,1|tnge80,50,66,0|tvqmbz,50,66,0|tvqmc0,52,62,1|u6jfjz,52,62,1|u6jfk0,50,66,0|uegozz,50,66,0|uegp00,52,62,1|up9i7z,52,62,1|up9i80,50,66,0|ux6rnz,50,66,0|ux6ro0,52,62,1|v7zkvz,52,62,1|v7zkw0,50,66,0|vg9szz,50,66,0|vg9t00,52,62,1|vqpnjz,52,62,1|vqpnk0,50,66,0|vyzvnz,50,66,0|vyzvo0,52,62,1|w9fq7z,52,62,1|w9fq80,50,66,0|whpybz,50,66,0|whpyc0,52,62,1|wsirjz,52,62,1|wsirk0,50,66,0|x0g0zz,50,66,0|x0g100,52,62,1|xb8u7z,52,62,1|xb8u80,50,66,0|xj63nz,50,66,0|xj63o0,52,62,1|xtywvz,52,62,1|xtyww0,50,66,0|y1w6bz,50,66,0|y1w6c0,52,62,1|ycozjz,52,62,1|ycozk0,50,66,0|ykz7nz,50,66,0|ykz7o0,52,62,1|yvf27z,52,62,1|yvf280,50,66,0|z3pabz,50,66,0|z3pac0,52,62,1|ze54vz,52,62,1|ze54w0,50,66,0\",\"America/Costa_Rica|,0,84,0|-15r0trn,63,84,0|-pjw8fo,63,84,0|-pjw8fn,45,62,0|4rxcnz,45,62,0|4rxco0,46,63,1|4wyr7z,46,63,1|4wyr80,45,62,0|5anfbz,45,62,0|5anfc0,46,63,1|5fotvz,46,63,1|5fotw0,45,62,0|azhhzz,45,62,0|azhi00,46,63,1|b7v9vz,46,63,1|b7v9w0,45,62,0|bi7knz,45,62,0|bi7ko0,46,63,1|bl51vz,46,63,1|bl51w0,45,62,0\",\"America/Creston|,0,85,0|-18vrx38,50,66,0|-rshz81,50,66,0|-rshz80,51,40,0|-qx64g1,51,40,0|-qx64g0,50,66,0\",\"America/Cuiaba|,0,86,0|-t85hm4,42,42,0|-jyl7o1,42,42,0|-jyl7o0,39,44,1|-jpayc1,39,44,1|-jpayc0,42,42,0|-jfsa81,42,42,0|-jfsa80,39,44,1|-j6j101,39,44,1|-j6j100,42,42,0|-ahcvk1,42,42,0|-ahcvk0,39,44,1|-aad0w1,39,44,1|-aad0w0,42,42,0|-9yky81,42,42,0|-9yky80,39,44,1|-9scyc1,39,44,1|-9scyc0,42,42,0|-9ft0w1,42,42,0|-9ft0w0,39,44,1|-99j6c1,39,44,1|-99j6c0,42,42,0|-8wz8w1,42,42,0|-8wz8w0,39,44,1|-8scno1,39,44,1|-8scno0,42,42,0|-35xjk1,42,42,0|-35xjk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2kdm81,42,42,0|-2kdm80,39,44,1|-2hcfo1,39,44,1|-2hcfo0,42,42,0|-24qnk1,42,42,0|-24qnk0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1nia81,42,42,0|-1nia80,39,44,1|-1hc501,39,44,1|-1hc500,42,42,0|-14qcw1,42,42,0|-14qcw0,39,44,1|-yid01,39,44,1|-yid00,42,42,0|89jf3z,42,42,0|89jf40,39,44,1|8gdmzz,39,44,1|8gdn00,42,42,0|8rwj3z,42,42,0|8rwj40,39,44,1|8xnuzz,39,44,1|8xnv00,42,42,0|9aogfz,42,42,0|9aogg0,39,44,1|9g2tnz,39,44,1|9g2to0,42,42,0|9t1kfz,42,42,0|9t1kg0,39,44,1|9yfxnz,39,44,1|9yfxo0,42,42,0|abrn3z,42,42,0|abrn40,39,44,1|ahvxnz,39,44,1|ahvxo0,42,42,0|auuofz,42,42,0|auuog0,39,44,1|b0yyzz,39,44,1|b0yz00,42,42,0|bdkr3z,42,42,0|bdkr40,39,44,1|bjc2zz,39,44,1|bjc300,42,42,0|bwnsfz,42,42,0|bwnsg0,39,44,1|c1p6zz,39,44,1|c1p700,42,42,0|cf0wfz,42,42,0|cf0wg0,39,44,1|cli5nz,39,44,1|cli5o0,42,42,0|cxqz3z,42,42,0|cxqz40,39,44,1|d488bz,39,44,1|d488c0,42,42,0|dgh1rz,42,42,0|dgh1s0,39,44,1|dmlcbz,39,44,1|dmlcc0,42,42,0|dyu5rz,42,42,0|dyu5s0,39,44,1|e5odnz,39,44,1|e5odo0,42,42,0|ehm33z,42,42,0|ehm340,39,44,1|ep4dnz,39,44,1|ep4do0,42,42,0|f0n9rz,42,42,0|f0n9s0,39,44,1|f7hhnz,39,44,1|f7hho0,42,42,0|fj0drz,42,42,0|fj0ds0,39,44,1|fqkizz,39,44,1|fqkj00,42,42,0|g23f3z,42,42,0|g23f40,39,44,1|g8xmzz,39,44,1|g8xn00,42,42,0|gl6gfz,42,42,0|gl6gg0,39,44,1|grnpnz,39,44,1|grnpo0,42,42,0|h4zf3z,42,42,0|h4zf40,39,44,1|hadsbz,39,44,1|hadsc0,42,42,0|i6j9rz,42,42,0|i6j9s0,39,44,1|ic6wbz,39,44,1|ic6wc0,42,42,0|iofprz,42,42,0|iofps0,39,44,1|iuwyzz,39,44,1|iuwz00,42,42,0|j88ofz,42,42,0|j88og0,39,44,1|je00bz,39,44,1|je00c0,42,42,0|jpvv3z,42,42,0|jpvv40,39,44,1|jwd4bz,39,44,1|jwd4c0,42,42,0|k8ywfz,42,42,0|k8ywg0,39,44,1|kf36zz,39,44,1|kf3700,42,42,0|kroz3z,42,42,0|kroz40,39,44,1|ky68bz,39,44,1|ky68c0,42,42,0|laf1rz,42,42,0|laf1s0,39,44,1|lgwazz,39,44,1|lgwb00,42,42,0|lt54fz,42,42,0|lt54g0,39,44,1|lzzcbz,39,44,1|lzzcc0,42,42,0|mc85rz,42,42,0|mc85s0,39,44,1|micgbz,39,44,1|micgc0,42,42,0|muy8fz,42,42,0|muy8g0,39,44,1|n12izz,39,44,1|n12j00,42,42,0|ndob3z,42,42,0|ndob40,39,44,1|nk5kbz,39,44,1|nk5kc0,42,42,0|nwedrz,42,42,0|nweds0,39,44,1|o2vmzz,39,44,1|o2vn00,42,42,0|of4gfz,42,42,0|of4gg0,39,44,1|ollpnz,39,44,1|ollpo0,42,42,0|oxuj3z,42,42,0|oxuj40,39,44,1|p4bsbz,39,44,1|p4bsc0,42,42,0|phnhrz,42,42,0|phnhs0,39,44,1|pn1uzz,39,44,1|pn1v00,42,42,0\",\"America/Curacao|,0,58,0|-u7lckd,43,59,0|-2lx4u1,43,59,0|-2lx4u0,32,42,0\",\"America/Danmarkshavn|,0,87,0|-rvusjk,39,44,0|5ct4jz,39,44,0|5ct4k0,40,45,1|5lsw3z,40,45,1|5lsw40,39,44,0|5v5xfz,39,44,0|5v5xg0,40,45,1|64iyrz,40,45,1|64iys0,39,44,0|6dw03z,39,44,0|6dw040,40,45,1|6n91fz,40,45,1|6n91g0,39,44,0|6wm2rz,39,44,0|6wm2s0,40,45,1|75z43z,40,45,1|75z440,39,44,0|7fc5fz,39,44,0|7fc5g0,40,45,1|7p25fz,40,45,1|7p25g0,39,44,0|7yf6rz,39,44,0|7yf6s0,40,45,1|87s83z,40,45,1|87s840,39,44,0|8h59fz,39,44,0|8h59g0,40,45,1|8qiarz,40,45,1|8qias0,39,44,0|8zvc3z,39,44,0|8zvc40,40,45,1|998dfz,40,45,1|998dg0,39,44,0|9ilerz,39,44,0|9iles0,40,45,1|9ryg3z,40,45,1|9ryg40,39,44,0|a1bhfz,39,44,0|a1bhg0,40,45,1|aaoirz,40,45,1|aaois0,39,44,0|ak1k3z,39,44,0|ak1k40,40,45,1|atrk3z,40,45,1|atrk40,39,44,0|b34lfz,39,44,0|b34lg0,40,45,1|bchmrz,40,45,1|bchms0,39,44,0|bluo3z,39,44,0|bluo40,40,45,1|bv7pfz,40,45,1|bv7pg0,39,44,0|c4kqrz,39,44,0|c4kqs0,40,45,1|cdxs3z,40,45,1|cdxs40,39,44,0|cnatfz,39,44,0|cnatg0,40,45,1|cwnurz,40,45,1|cwnus0,39,44,0|d60w3z,39,44,0|d60w40,40,45,1|dfdxfz,40,45,1|dfdxg0,39,44,0|dkhezz,39,44,0|dkhf00,1,1,0\",\"America/Dawson|,0,88,0|-1079suk,36,37,0|-qzoms1,36,37,0|-qzoms0,64,40,1|-qplqw1,64,40,1|-qplqw0,36,37,0|-qess41,36,37,0|-qess40,64,40,1|-q6kps1,64,40,1|-q6kps0,36,37,0|-ek1tg1,36,37,0|-ek1tg0,65,40,1|-cq2tg1,65,40,1|-cq2tg0,66,40,1|-cnos81,66,40,1|-cnos80,36,37,0|-2g1oc1,36,37,0|-2g1oc0,67,66,1|-26boc1,67,66,1|-26boc0,36,37,0|1ztvnz,36,37,0|1ztvo0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,51,40,0|7h5nrz,51,40,0|7h5ns0,57,66,1|7qimbz,57,66,1|7qimc0,51,40,0|7zvqfz,51,40,0|7zvqg0,57,66,1|898ozz,57,66,1|898p00,51,40,0|8ilt3z,51,40,0|8ilt40,57,66,1|8ryrnz,57,66,1|8ryro0,51,40,0|908zrz,51,40,0|908zs0,57,66,1|9aoubz,57,66,1|9aouc0,51,40,0|9iz2fz,51,40,0|9iz2g0,57,66,1|9trvnz,57,66,1|9trvo0,51,40,0|a1p53z,51,40,0|a1p540,57,66,1|achybz,57,66,1|achyc0,51,40,0|akf7rz,51,40,0|akf7s0,57,66,1|av80zz,57,66,1|av8100,51,40,0|b3i93z,51,40,0|b3i940,57,66,1|bdy3nz,57,66,1|bdy3o0,51,40,0|bm8brz,51,40,0|bm8bs0,57,66,1|bwo6bz,57,66,1|bwo6c0,51,40,0|c4yefz,51,40,0|c4yeg0,57,66,1|cfr7nz,57,66,1|cfr7o0,51,40,0|cnoh3z,51,40,0|cnoh40,57,66,1|cyhabz,57,66,1|cyhac0,51,40,0|d6ejrz,51,40,0|d6ejs0,57,66,1|dh7czz,57,66,1|dh7d00,51,40,0|dphl3z,51,40,0|dphl40,57,66,1|dzxfnz,57,66,1|dzxfo0,51,40,0|e87nrz,51,40,0|e87ns0,57,66,1|einibz,57,66,1|einic0,51,40,0|eqxqfz,51,40,0|eqxqg0,57,66,1|f1dkzz,57,66,1|f1dl00,51,40,0|f9nt3z,51,40,0|f9nt40,57,66,1|fkgmbz,57,66,1|fkgmc0,51,40,0|fsdvrz,51,40,0|fsdvs0,57,66,1|g36ozz,57,66,1|g36p00,51,40,0|gb3yfz,51,40,0|gb3yg0,57,66,1|glwrnz,57,66,1|glwro0,51,40,0|gu6zrz,51,40,0|gu6zs0,57,66,1|h4mubz,57,66,1|h4muc0,51,40,0|hcx2fz,51,40,0|hcx2g0,57,66,1|hncwzz,57,66,1|hncx00,51,40,0|hvn53z,51,40,0|hvn540,57,66,1|i6fybz,57,66,1|i6fyc0,51,40,0|ied7rz,51,40,0|ied7s0,57,66,1|ip60zz,57,66,1|ip6100,51,40,0|ix3afz,51,40,0|ix3ag0,57,66,1|j7w3nz,57,66,1|j7w3o0,51,40,0|jeqh3z,51,40,0|jeqh40,57,66,1|jqz4zz,57,66,1|jqz500,51,40,0|jxgjrz,51,40,0|jxgjs0,57,66,1|k9p7nz,57,66,1|k9p7o0,51,40,0|kg6mfz,51,40,0|kg6mg0,57,66,1|ksfabz,57,66,1|ksfac0,51,40,0|kz9nrz,51,40,0|kz9ns0,57,66,1|lbibnz,57,66,1|lbibo0,51,40,0|lhzqfz,51,40,0|lhzqg0,57,66,1|lu8ebz,57,66,1|lu8ec0,51,40,0|m0pt3z,51,40,0|m0pt40,57,66,1|mcygzz,57,66,1|mcyh00,51,40,0|mjfvrz,51,40,0|mjfvs0,57,66,1|mvojnz,57,66,1|mvojo0,51,40,0|n25yfz,51,40,0|n25yg0,57,66,1|neembz,57,66,1|neemc0,51,40,0|nkw13z,51,40,0|nkw140,57,66,1|nx4ozz,57,66,1|nx4p00,51,40,0|o3z2fz,51,40,0|o3z2g0,57,66,1|og7qbz,57,66,1|og7qc0,51,40,0|omp53z,51,40,0|omp540,57,66,1|oyxszz,57,66,1|oyxt00,51,40,0|p5f7rz,51,40,0|p5f7s0,57,66,1|phnvnz,57,66,1|phnvo0,51,40,0|po5afz,51,40,0|po5ag0,57,66,1|q0dybz,57,66,1|q0dyc0,51,40,0|q6vd3z,51,40,0|q6vd40,57,66,1|qj3vfz,57,66,1|qj3vg0,50,66,0\",\"America/Dawson_Creek|,0,89,0|-18vrweg,51,40,0|-qzopk1,51,40,0|-qzopk0,57,66,1|-qplto1,57,66,1|-qplto0,51,40,0|-ek1w81,51,40,0|-ek1w80,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-cnov01,69,66,1|-cnov00,51,40,0|-bu5tk1,51,40,0|-bu5tk0,57,66,1|-bm8po1,57,66,1|-bm8po0,51,40,0|-bbfqw1,51,40,0|-bbfqw0,57,66,1|-b3in01,57,66,1|-b3in00,51,40,0|-aspo81,51,40,0|-aspo80,57,66,1|-akskc1,57,66,1|-akskc0,51,40,0|-a9mmw1,51,40,0|-a9mmw0,57,66,1|-a22ho1,57,66,1|-a22ho0,51,40,0|-9qwk81,51,40,0|-9qwk80,57,66,1|-9izgc1,57,66,1|-9izgc0,51,40,0|-986hk1,51,40,0|-986hk0,57,66,1|-909do1,57,66,1|-909do0,51,40,0|-8pgew1,51,40,0|-8pgew0,57,66,1|-8hjb01,57,66,1|-8hjb00,51,40,0|-86qc81,51,40,0|-86qc80,57,66,1|-7yt8c1,57,66,1|-7yt8c0,51,40,0|-7o09k1,51,40,0|-7o09k0,57,66,1|-7g35o1,57,66,1|-7g35o0,51,40,0|-74x881,51,40,0|-74x880,57,66,1|-6x04c1,57,66,1|-6x04c0,51,40,0|-6m75k1,51,40,0|-6m75k0,57,66,1|-6ea1o1,57,66,1|-6ea1o0,51,40,0|-63h2w1,51,40,0|-63h2w0,57,66,1|-5vjz01,57,66,1|-5vjz00,51,40,0|-5kr081,51,40,0|-5kr080,57,66,1|-5ctwc1,57,66,1|-5ctwc0,51,40,0|-520xk1,51,40,0|-520xk0,57,66,1|-4u3to1,57,66,1|-4u3to0,51,40,0|-4ixw81,51,40,0|-4ixw80,57,66,1|-4bdr01,57,66,1|-4bdr00,51,40,0|-407tk1,51,40,0|-407tk0,57,66,1|-3quv01,57,66,1|-3quv00,51,40,0|-3hhqw1,51,40,0|-3hhqw0,57,66,1|-384sc1,57,66,1|-384sc0,51,40,0|-2yro81,51,40,0|-2yro80,57,66,1|-2pepo1,57,66,1|-2pepo0,51,40,0|-2g1lk1,51,40,0|-2g1lk0,57,66,1|-26boc1,57,66,1|-26boc0,51,40,0|-1xbiw1,51,40,0|-1xbiw0,57,66,1|-1nllo1,57,66,1|-1nllo0,51,40,0|-1e8hk1,51,40,0|-1e8hk0,57,66,1|-14vj01,57,66,1|-14vj00,51,40,0|-view1,51,40,0|-view0,57,66,1|-m5gc1,57,66,1|-m5gc0,51,40,0|-csc81,51,40,0|-csc80,57,66,1|-3fdo1,57,66,1|-3fdo0,51,40,0|5xqfz,51,40,0|5xqg0,57,66,1|faozz,57,66,1|fap00,51,40,0|ont3z,51,40,0|ont40,57,66,1|ydqbz,57,66,1|ydqc0,51,40,0|17qufz,51,40,0|17qug0,57,66,1|1e0ozz,57,66,1|1e0p00,50,66,0\",\"America/Denver|,0,90,0|-18y0j80,50,66,0|-r0epo1,50,66,0|-r0epo0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-qhon01,50,66,0|-qhon00,52,62,1|-q6vts1,52,62,1|-q6vts0,50,66,0|-pyykc1,50,66,0|-pyykc0,52,62,1|-pnssg1,52,62,1|-pnssg0,50,66,0|-pg8ho1,50,66,0|-pg8ho0,52,62,1|-pdcv41,52,62,1|-pdcv40,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-2g1oc1,50,66,0|-2g1oc0,52,62,1|-26br41,52,62,1|-26br40,50,66,0|-1xblo1,50,66,0|-1xblo0,52,62,1|-1nlog1,52,62,1|-1nlog0,50,66,0|-1e8kc1,50,66,0|-1e8kc0,52,62,1|-14vls1,52,62,1|-14vls0,50,66,0|-viho1,50,66,0|-viho0,52,62,1|-m5j41,52,62,1|-m5j40,50,66,0|-csf01,50,66,0|-csf00,52,62,1|-3fgg1,52,62,1|-3fgg0,50,66,0|5xnnz,50,66,0|5xno0,52,62,1|fam7z,52,62,1|fam80,50,66,0|onqbz,50,66,0|onqc0,52,62,1|ydnjz,52,62,1|ydnk0,50,66,0|17qrnz,50,66,0|17qro0,52,62,1|1h3q7z,52,62,1|1h3q80,50,66,0|1qgubz,50,66,0|1qguc0,52,62,1|1ztsvz,52,62,1|1ztsw0,50,66,0|23fibz,50,66,0|23fic0,52,62,1|2ijvjz,52,62,1|2ijvk0,50,66,0|2oobnz,50,66,0|2oobo0,52,62,1|319y7z,52,62,1|319y80,50,66,0|3an2bz,50,66,0|3an2c0,52,62,1|3kczjz,52,62,1|3kczk0,50,66,0|3td4zz,50,66,0|3td500,52,62,1|43327z,52,62,1|433280,50,66,0|4cg6bz,50,66,0|4cg6c0,52,62,1|4lt4vz,52,62,1|4lt4w0,50,66,0|4v68zz,50,66,0|4v6900,52,62,1|54j7jz,52,62,1|54j7k0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gb3vnz,50,66,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jeqebz,50,66,0|jeqec0,52,62,1|jqz27z,52,62,1|jqz280,50,66,0|jxggzz,50,66,0|jxgh00,52,62,1|k9p4vz,52,62,1|k9p4w0,50,66,0|kg6jnz,50,66,0|kg6jo0,52,62,1|ksf7jz,52,62,1|ksf7k0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,50,66,0|lhznnz,50,66,0|lhzno0,52,62,1|lu8bjz,52,62,1|lu8bk0,50,66,0|m0pqbz,50,66,0|m0pqc0,52,62,1|mcye7z,52,62,1|mcye80,50,66,0|mjfszz,50,66,0|mjft00,52,62,1|mvogvz,52,62,1|mvogw0,50,66,0|n25vnz,50,66,0|n25vo0,52,62,1|neejjz,52,62,1|neejk0,50,66,0|nkvybz,50,66,0|nkvyc0,52,62,1|nx4m7z,52,62,1|nx4m80,50,66,0|o3yznz,50,66,0|o3yzo0,52,62,1|og7njz,52,62,1|og7nk0,50,66,0|omp2bz,50,66,0|omp2c0,52,62,1|oyxq7z,52,62,1|oyxq80,50,66,0|p5f4zz,50,66,0|p5f500,52,62,1|phnsvz,52,62,1|phnsw0,50,66,0|po57nz,50,66,0|po57o0,52,62,1|q0dvjz,52,62,1|q0dvk0,50,66,0|q6vabz,50,66,0|q6vac0,52,62,1|qj3y7z,52,62,1|qj3y80,50,66,0|qpybnz,50,66,0|qpybo0,52,62,1|r26zjz,52,62,1|r26zk0,50,66,0|r8oebz,50,66,0|r8oec0,52,62,1|rkx27z,52,62,1|rkx280,50,66,0|rregzz,50,66,0|rreh00,52,62,1|s3n4vz,52,62,1|s3n4w0,50,66,0|sa4jnz,50,66,0|sa4jo0,52,62,1|smd7jz,52,62,1|smd7k0,50,66,0|ssumbz,50,66,0|ssumc0,52,62,1|t53a7z,52,62,1|t53a80,50,66,0|tbkozz,50,66,0|tbkp00,52,62,1|tntcvz,52,62,1|tntcw0,50,66,0|tunqbz,50,66,0|tunqc0,52,62,1|u6we7z,52,62,1|u6we80,50,66,0|uddszz,50,66,0|uddt00,52,62,1|upmgvz,52,62,1|upmgw0,50,66,0|uw3vnz,50,66,0|uw3vo0,52,62,1|v8cjjz,52,62,1|v8cjk0,50,66,0|vetybz,50,66,0|vetyc0,52,62,1|vr2m7z,52,62,1|vr2m80,50,66,0|vxk0zz,50,66,0|vxk100,52,62,1|w9sovz,52,62,1|w9sow0,50,66,0|wgn2bz,50,66,0|wgn2c0,52,62,1|wsvq7z,52,62,1|wsvq80,50,66,0|wzd4zz,50,66,0|wzd500,52,62,1|xblsvz,52,62,1|xblsw0,50,66,0|xi37nz,50,66,0|xi37o0,52,62,1|xubvjz,52,62,1|xubvk0,50,66,0|y0tabz,50,66,0|y0tac0,52,62,1|yd1y7z,52,62,1|yd1y80,50,66,0|yjjczz,50,66,0|yjjd00,52,62,1|yvs0vz,52,62,1|yvs0w0,50,66,0|z29fnz,50,66,0|z29fo0,52,62,1|zei3jz,52,62,1|zei3k0,50,66,0\",\"America/Detroit|,0,91,0|-xx8dyd,45,62,0|-sih341,45,62,0|-sih340,49,63,0|-ek24k1,49,63,0|-ek24k0,70,42,1|-cq2tg1,70,42,1|-cq2tg0,71,42,1|-cnp3c1,71,42,1|-cnp3c0,49,63,0|-bbfz81,49,63,0|-bbfz80,62,42,1|-b3ivc1,62,42,1|-b3ivc0,49,63,0|-1bxjed,49,63,0|-1bxjec,62,42,1|-14vrc1,62,42,1|-14vrc0,49,63,0|-vin81,49,63,0|-vin80,62,42,1|-m5oo1,62,42,1|-m5oo0,49,63,0|1qgorz,49,63,0|1qgos0,62,42,1|1ztnbz,62,42,1|1ztnc0,49,63,0|23fcrz,49,63,0|23fcs0,62,42,1|2ijpzz,62,42,1|2ijq00,49,63,0|2rwu3z,49,63,0|2rwu40,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Dominica|,0,41,0|-u6m79w,32,42,0\",\"America/Edmonton|,0,92,0|-x1yazk,50,66,0|-qzosc1,50,66,0|-qzosc0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-qgypo1,50,66,0|-qgypo0,52,62,1|-qepb41,52,62,1|-qepb40,50,66,0|-pxipo1,50,66,0|-pxipo0,52,62,1|-pnssg1,52,62,1|-pnssg0,50,66,0|-pesn01,50,66,0|-pesn00,52,62,1|-p6vj41,52,62,1|-p6vj40,50,66,0|-ovplo1,50,66,0|-ovplo0,52,62,1|-oo5gg1,52,62,1|-oo5gg0,50,66,0|-oczj01,50,66,0|-oczj00,52,62,1|-o52f41,52,62,1|-o52f40,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-bu5wc1,50,66,0|-bu5wc0,52,62,1|-bm8sg1,52,62,1|-bm8sg0,50,66,0|17qrnz,50,66,0|17qro0,52,62,1|1h3q7z,52,62,1|1h3q80,50,66,0|1qgubz,50,66,0|1qguc0,52,62,1|1ztsvz,52,62,1|1ztsw0,50,66,0|296wzz,50,66,0|296x00,52,62,1|2ijvjz,52,62,1|2ijvk0,50,66,0|2rwznz,50,66,0|2rwzo0,52,62,1|319y7z,52,62,1|319y80,50,66,0|3an2bz,50,66,0|3an2c0,52,62,1|3kczjz,52,62,1|3kczk0,50,66,0|3td4zz,50,66,0|3td500,52,62,1|43327z,52,62,1|433280,50,66,0|4cg6bz,50,66,0|4cg6c0,52,62,1|4lt4vz,52,62,1|4lt4w0,50,66,0|4v68zz,50,66,0|4v6900,52,62,1|54j7jz,52,62,1|54j7k0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gb3vnz,50,66,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jeqebz,50,66,0|jeqec0,52,62,1|jqz27z,52,62,1|jqz280,50,66,0|jxggzz,50,66,0|jxgh00,52,62,1|k9p4vz,52,62,1|k9p4w0,50,66,0|kg6jnz,50,66,0|kg6jo0,52,62,1|ksf7jz,52,62,1|ksf7k0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,50,66,0|lhznnz,50,66,0|lhzno0,52,62,1|lu8bjz,52,62,1|lu8bk0,50,66,0|m0pqbz,50,66,0|m0pqc0,52,62,1|mcye7z,52,62,1|mcye80,50,66,0|mjfszz,50,66,0|mjft00,52,62,1|mvogvz,52,62,1|mvogw0,50,66,0|n25vnz,50,66,0|n25vo0,52,62,1|neejjz,52,62,1|neejk0,50,66,0|nkvybz,50,66,0|nkvyc0,52,62,1|nx4m7z,52,62,1|nx4m80,50,66,0|o3yznz,50,66,0|o3yzo0,52,62,1|og7njz,52,62,1|og7nk0,50,66,0|omp2bz,50,66,0|omp2c0,52,62,1|oyxq7z,52,62,1|oyxq80,50,66,0|p5f4zz,50,66,0|p5f500,52,62,1|phnsvz,52,62,1|phnsw0,50,66,0|po57nz,50,66,0|po57o0,52,62,1|q0dvjz,52,62,1|q0dvk0,50,66,0|q6vabz,50,66,0|q6vac0,52,62,1|qj3y7z,52,62,1|qj3y80,50,66,0|qpybnz,50,66,0|qpybo0,52,62,1|r26zjz,52,62,1|r26zk0,50,66,0|r8oebz,50,66,0|r8oec0,52,62,1|rkx27z,52,62,1|rkx280,50,66,0|rregzz,50,66,0|rreh00,52,62,1|s3n4vz,52,62,1|s3n4w0,50,66,0|sa4jnz,50,66,0|sa4jo0,52,62,1|smd7jz,52,62,1|smd7k0,50,66,0|ssumbz,50,66,0|ssumc0,52,62,1|t53a7z,52,62,1|t53a80,50,66,0|tbkozz,50,66,0|tbkp00,52,62,1|tntcvz,52,62,1|tntcw0,50,66,0|tunqbz,50,66,0|tunqc0,52,62,1|u6we7z,52,62,1|u6we80,50,66,0|uddszz,50,66,0|uddt00,52,62,1|upmgvz,52,62,1|upmgw0,50,66,0|uw3vnz,50,66,0|uw3vo0,52,62,1|v8cjjz,52,62,1|v8cjk0,50,66,0|vetybz,50,66,0|vetyc0,52,62,1|vr2m7z,52,62,1|vr2m80,50,66,0|vxk0zz,50,66,0|vxk100,52,62,1|w9sovz,52,62,1|w9sow0,50,66,0|wgn2bz,50,66,0|wgn2c0,52,62,1|wsvq7z,52,62,1|wsvq80,50,66,0|wzd4zz,50,66,0|wzd500,52,62,1|xblsvz,52,62,1|xblsw0,50,66,0|xi37nz,50,66,0|xi37o0,52,62,1|xubvjz,52,62,1|xubvk0,50,66,0|y0tabz,50,66,0|y0tac0,52,62,1|yd1y7z,52,62,1|yd1y80,50,66,0|yjjczz,50,66,0|yjjd00,52,62,1|yvs0vz,52,62,1|yvs0w0,50,66,0|z29fnz,50,66,0|z29fo0,52,62,1|zei3jz,52,62,1|zei3k0,50,66,0\",\"America/Eirunepe|,0,93,0|-t85f28,56,63,0|-jyl4w1,56,63,0|-jyl4w0,42,42,1|-jpavk1,42,42,1|-jpavk0,56,63,0|-jfs7g1,56,63,0|-jfs7g0,42,42,1|-j6iy81,42,42,1|-j6iy80,56,63,0|-ahcss1,56,63,0|-ahcss0,42,42,1|-aacy41,42,42,1|-aacy40,56,63,0|-9ykvg1,56,63,0|-9ykvg0,42,42,1|-9scvk1,42,42,1|-9scvk0,56,63,0|-9fsy41,56,63,0|-9fsy40,42,42,1|-99j3k1,42,42,1|-99j3k0,56,63,0|-8wz641,56,63,0|-8wz640,42,42,1|-8sckw1,42,42,1|-8sckw0,56,63,0|-35xgs1,56,63,0|-35xgs0,42,42,1|-31nu81,42,42,1|-31nu80,56,63,0|-2kdjg1,56,63,0|-2kdjg0,42,42,1|-2hccw1,42,42,1|-2hccw0,56,63,0|-24qks1,56,63,0|-24qks0,42,42,1|-203zk1,42,42,1|-203zk0,56,63,0|-1ni7g1,56,63,0|-1ni7g0,42,42,1|-1hc281,42,42,1|-1hc280,56,63,0|-14qa41,56,63,0|-14qa40,42,42,1|-yia81,42,42,1|-yia80,56,63,0|89jhvz,56,63,0|89jhw0,42,42,1|8gdprz,42,42,1|8gdps0,56,63,0|8rwlvz,56,63,0|8rwlw0,42,42,1|8xnxrz,42,42,1|8xnxs0,56,63,0|9aoj7z,56,63,0|9aoj80,42,42,1|9g2wfz,42,42,1|9g2wg0,56,63,0|cf0z7z,56,63,0|cf0z80,42,42,1|cli8fz,42,42,1|cli8g0,56,63,0|k2yb7z,56,63,0|k2yb80,42,42,0|mw14fz,42,42,0|mw14g0,56,63,0\",\"America/El_Salvador|,0,94,0|-pkm4tc,45,62,0|91ojbz,45,62,0|91ojc0,46,63,1|998ojz,46,63,1|998ok0,45,62,0|9kelzz,45,62,0|9kem00,46,63,1|9ryr7z,46,63,1|9ryr80,45,62,0\",\"America/Fort_Nelson|,0,95,0|-18vrvy1,51,40,0|-qzopk1,51,40,0|-qzopk0,57,66,1|-qplto1,57,66,1|-qplto0,51,40,0|-ek1w81,51,40,0|-ek1w80,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-cnov01,69,66,1|-cnov00,51,40,0|-bu5tk1,51,40,0|-bu5tk0,57,66,1|-bm8po1,57,66,1|-bm8po0,51,40,0|-bbfqw1,51,40,0|-bbfqw0,57,66,1|-b3in01,57,66,1|-b3in00,51,40,0|-aspo81,51,40,0|-aspo80,57,66,1|-akskc1,57,66,1|-akskc0,51,40,0|-a9mmw1,51,40,0|-a9mmw0,57,66,1|-a22ho1,57,66,1|-a22ho0,51,40,0|-9qwk81,51,40,0|-9qwk80,57,66,1|-9izgc1,57,66,1|-9izgc0,51,40,0|-986hk1,51,40,0|-986hk0,57,66,1|-909do1,57,66,1|-909do0,51,40,0|-8pgew1,51,40,0|-8pgew0,57,66,1|-8hjb01,57,66,1|-8hjb00,51,40,0|-86qc81,51,40,0|-86qc80,57,66,1|-7yt8c1,57,66,1|-7yt8c0,51,40,0|-7o09k1,51,40,0|-7o09k0,57,66,1|-7g35o1,57,66,1|-7g35o0,51,40,0|-74x881,51,40,0|-74x880,57,66,1|-6x04c1,57,66,1|-6x04c0,51,40,0|-6m75k1,51,40,0|-6m75k0,57,66,1|-6ea1o1,57,66,1|-6ea1o0,51,40,0|-63h2w1,51,40,0|-63h2w0,57,66,1|-5vjz01,57,66,1|-5vjz00,51,40,0|-5kr081,51,40,0|-5kr080,57,66,1|-5ctwc1,57,66,1|-5ctwc0,51,40,0|-520xk1,51,40,0|-520xk0,57,66,1|-4u3to1,57,66,1|-4u3to0,51,40,0|-4ixw81,51,40,0|-4ixw80,57,66,1|-4bdr01,57,66,1|-4bdr00,51,40,0|-407tk1,51,40,0|-407tk0,57,66,1|-3quv01,57,66,1|-3quv00,51,40,0|-3hhqw1,51,40,0|-3hhqw0,57,66,1|-384sc1,57,66,1|-384sc0,51,40,0|-2yro81,51,40,0|-2yro80,57,66,1|-2pepo1,57,66,1|-2pepo0,51,40,0|-2g1lk1,51,40,0|-2g1lk0,57,66,1|-26boc1,57,66,1|-26boc0,51,40,0|-1xbiw1,51,40,0|-1xbiw0,57,66,1|-1nllo1,57,66,1|-1nllo0,51,40,0|-1e8hk1,51,40,0|-1e8hk0,57,66,1|-14vj01,57,66,1|-14vj00,51,40,0|-view1,51,40,0|-view0,57,66,1|-m5gc1,57,66,1|-m5gc0,51,40,0|-csc81,51,40,0|-csc80,57,66,1|-3fdo1,57,66,1|-3fdo0,51,40,0|5xqfz,51,40,0|5xqg0,57,66,1|faozz,57,66,1|fap00,51,40,0|ont3z,51,40,0|ont40,57,66,1|ydqbz,57,66,1|ydqc0,51,40,0|17qufz,51,40,0|17qug0,57,66,1|1h3szz,57,66,1|1h3t00,51,40,0|1qgx3z,51,40,0|1qgx40,57,66,1|1ztvnz,57,66,1|1ztvo0,51,40,0|296zrz,51,40,0|296zs0,57,66,1|2ijybz,57,66,1|2ijyc0,51,40,0|2rx2fz,51,40,0|2rx2g0,57,66,1|31a0zz,57,66,1|31a100,51,40,0|3an53z,51,40,0|3an540,57,66,1|3kd2bz,57,66,1|3kd2c0,51,40,0|3td7rz,51,40,0|3td7s0,57,66,1|4334zz,57,66,1|433500,51,40,0|4cg93z,51,40,0|4cg940,57,66,1|4lt7nz,57,66,1|4lt7o0,51,40,0|4v6brz,51,40,0|4v6bs0,57,66,1|54jabz,57,66,1|54jac0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,51,40,0|7h5nrz,51,40,0|7h5ns0,57,66,1|7qimbz,57,66,1|7qimc0,51,40,0|7zvqfz,51,40,0|7zvqg0,57,66,1|898ozz,57,66,1|898p00,51,40,0|8ilt3z,51,40,0|8ilt40,57,66,1|8ryrnz,57,66,1|8ryro0,51,40,0|908zrz,51,40,0|908zs0,57,66,1|9aoubz,57,66,1|9aouc0,51,40,0|9iz2fz,51,40,0|9iz2g0,57,66,1|9trvnz,57,66,1|9trvo0,51,40,0|a1p53z,51,40,0|a1p540,57,66,1|achybz,57,66,1|achyc0,51,40,0|akf7rz,51,40,0|akf7s0,57,66,1|av80zz,57,66,1|av8100,51,40,0|b3i93z,51,40,0|b3i940,57,66,1|bdy3nz,57,66,1|bdy3o0,51,40,0|bm8brz,51,40,0|bm8bs0,57,66,1|bwo6bz,57,66,1|bwo6c0,51,40,0|c4yefz,51,40,0|c4yeg0,57,66,1|cfr7nz,57,66,1|cfr7o0,51,40,0|cnoh3z,51,40,0|cnoh40,57,66,1|cyhabz,57,66,1|cyhac0,51,40,0|d6ejrz,51,40,0|d6ejs0,57,66,1|dh7czz,57,66,1|dh7d00,51,40,0|dphl3z,51,40,0|dphl40,57,66,1|dzxfnz,57,66,1|dzxfo0,51,40,0|e87nrz,51,40,0|e87ns0,57,66,1|einibz,57,66,1|einic0,51,40,0|eqxqfz,51,40,0|eqxqg0,57,66,1|f1dkzz,57,66,1|f1dl00,51,40,0|f9nt3z,51,40,0|f9nt40,57,66,1|fkgmbz,57,66,1|fkgmc0,51,40,0|fsdvrz,51,40,0|fsdvs0,57,66,1|g36ozz,57,66,1|g36p00,51,40,0|gb3yfz,51,40,0|gb3yg0,57,66,1|glwrnz,57,66,1|glwro0,51,40,0|gu6zrz,51,40,0|gu6zs0,57,66,1|h4mubz,57,66,1|h4muc0,51,40,0|hcx2fz,51,40,0|hcx2g0,57,66,1|hncwzz,57,66,1|hncx00,51,40,0|hvn53z,51,40,0|hvn540,57,66,1|i6fybz,57,66,1|i6fyc0,51,40,0|ied7rz,51,40,0|ied7s0,57,66,1|ip60zz,57,66,1|ip6100,51,40,0|ix3afz,51,40,0|ix3ag0,57,66,1|j7w3nz,57,66,1|j7w3o0,51,40,0|jeqh3z,51,40,0|jeqh40,57,66,1|jqz4zz,57,66,1|jqz500,51,40,0|jxgjrz,51,40,0|jxgjs0,57,66,1|k9p7nz,57,66,1|k9p7o0,51,40,0|kg6mfz,51,40,0|kg6mg0,57,66,1|ksfabz,57,66,1|ksfac0,51,40,0|kz9nrz,51,40,0|kz9ns0,57,66,1|lbibnz,57,66,1|lbibo0,51,40,0|lhzqfz,51,40,0|lhzqg0,57,66,1|lu8ebz,57,66,1|lu8ec0,51,40,0|m0pt3z,51,40,0|m0pt40,57,66,1|mcygzz,57,66,1|mcyh00,51,40,0|mjfvrz,51,40,0|mjfvs0,57,66,1|mvojnz,57,66,1|mvojo0,51,40,0|n25yfz,51,40,0|n25yg0,57,66,1|neembz,57,66,1|neemc0,51,40,0|nkw13z,51,40,0|nkw140,50,66,0\",\"America/Fortaleza|,0,96,0|-t85kvc,39,44,0|-jylag1,39,44,0|-jylag0,40,45,1|-jpb141,40,45,1|-jpb140,39,44,0|-jfsd01,39,44,0|-jfsd00,40,45,1|-j6j3s1,40,45,1|-j6j3s0,39,44,0|-ahcyc1,39,44,0|-ahcyc0,40,45,1|-aad3o1,40,45,1|-aad3o0,39,44,0|-9yl101,39,44,0|-9yl100,40,45,1|-9sd141,40,45,1|-9sd140,39,44,0|-9ft3o1,39,44,0|-9ft3o0,40,45,1|-99j941,40,45,1|-99j940,39,44,0|-8wzbo1,39,44,0|-8wzbo0,40,45,1|-8scqg1,40,45,1|-8scqg0,39,44,0|-35xmc1,39,44,0|-35xmc0,40,45,1|-31nzs1,40,45,1|-31nzs0,39,44,0|-2kdp01,39,44,0|-2kdp00,40,45,1|-2hcig1,40,45,1|-2hcig0,39,44,0|-24qqc1,39,44,0|-24qqc0,40,45,1|-204541,40,45,1|-204540,39,44,0|-1nid01,39,44,0|-1nid00,40,45,1|-1hc7s1,40,45,1|-1hc7s0,39,44,0|-14qfo1,39,44,0|-14qfo0,40,45,1|-yifs1,40,45,1|-yifs0,39,44,0|89jcbz,39,44,0|89jcc0,40,45,1|8gdk7z,40,45,1|8gdk80,39,44,0|8rwgbz,39,44,0|8rwgc0,40,45,1|8xns7z,40,45,1|8xns80,39,44,0|9aodnz,39,44,0|9aodo0,40,45,1|9g2qvz,40,45,1|9g2qw0,39,44,0|9t1hnz,39,44,0|9t1ho0,40,45,1|9yfuvz,40,45,1|9yfuw0,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|ahvuvz,40,45,1|ahvuw0,39,44,0|fj0azz,39,44,0|fj0b00,40,45,1|fqkg7z,40,45,1|fqkg80,39,44,0|g23cbz,39,44,0|g23cc0,40,45,1|g2t6vz,40,45,1|g2t6w0,39,44,0|gl6dnz,39,44,0|gl6do0,40,45,1|grnmvz,40,45,1|grnmw0,39,44,0\",\"America/Glace_Bay|,0,97,0|-z94kwc,32,42,0|-qzp0o1,32,42,0|-qzp0o0,54,44,1|-qpm4s1,54,44,1|-qpm4s0,32,42,0|-ek27c1,32,42,0|-ek27c0,33,44,1|-cq2tg1,33,44,1|-cq2tg0,34,44,1|-cnp641,34,44,1|-cnp640,32,42,0|-8pgq01,32,42,0|-8pgq00,54,44,1|-8hjm41,54,44,1|-8hjm40,32,42,0|17qjbz,32,42,0|17qjc0,54,44,1|1h3hvz,54,44,1|1h3hw0,32,42,0|1qglzz,32,42,0|1qgm00,54,44,1|1ztkjz,54,44,1|1ztkk0,32,42,0|296onz,32,42,0|296oo0,54,44,1|2ijn7z,54,44,1|2ijn80,32,42,0|2rwrbz,32,42,0|2rwrc0,54,44,1|319pvz,54,44,1|319pw0,32,42,0|3amtzz,32,42,0|3amu00,54,44,1|3kcr7z,54,44,1|3kcr80,32,42,0|3tcwnz,32,42,0|3tcwo0,54,44,1|432tvz,54,44,1|432tw0,32,42,0|4cfxzz,32,42,0|4cfy00,54,44,1|4lswjz,54,44,1|4lswk0,32,42,0|4v60nz,32,42,0|4v60o0,54,44,1|54iz7z,54,44,1|54iz80,32,42,0|5dw3bz,32,42,0|5dw3c0,54,44,1|5n91vz,54,44,1|5n91w0,32,42,0|5wm5zz,32,42,0|5wm600,54,44,1|65z4jz,54,44,1|65z4k0,32,42,0|6fc8nz,32,42,0|6fc8o0,54,44,1|6p25vz,54,44,1|6p25w0,32,42,0|6y2bbz,32,42,0|6y2bc0,54,44,1|77s8jz,54,44,1|77s8k0,32,42,0|7h5cnz,32,42,0|7h5co0,54,44,1|7qib7z,54,44,1|7qib80,32,42,0|7zvfbz,32,42,0|7zvfc0,54,44,1|898dvz,54,44,1|898dw0,32,42,0|8ilhzz,32,42,0|8ili00,54,44,1|8rygjz,54,44,1|8rygk0,32,42,0|908onz,32,42,0|908oo0,54,44,1|9aoj7z,54,44,1|9aoj80,32,42,0|9iyrbz,32,42,0|9iyrc0,54,44,1|9trkjz,54,44,1|9trkk0,32,42,0|a1otzz,32,42,0|a1ou00,54,44,1|achn7z,54,44,1|achn80,32,42,0|akewnz,32,42,0|akewo0,54,44,1|av7pvz,54,44,1|av7pw0,32,42,0|b3hxzz,32,42,0|b3hy00,54,44,1|bdxsjz,54,44,1|bdxsk0,32,42,0|bm80nz,32,42,0|bm80o0,54,44,1|bwnv7z,54,44,1|bwnv80,32,42,0|c4y3bz,32,42,0|c4y3c0,54,44,1|cfqwjz,54,44,1|cfqwk0,32,42,0|cno5zz,32,42,0|cno600,54,44,1|cygz7z,54,44,1|cygz80,32,42,0|d6e8nz,32,42,0|d6e8o0,54,44,1|dh71vz,54,44,1|dh71w0,32,42,0|dph9zz,32,42,0|dpha00,54,44,1|dzx4jz,54,44,1|dzx4k0,32,42,0|e87cnz,32,42,0|e87co0,54,44,1|ein77z,54,44,1|ein780,32,42,0|eqxfbz,32,42,0|eqxfc0,54,44,1|f1d9vz,54,44,1|f1d9w0,32,42,0|f9nhzz,32,42,0|f9ni00,54,44,1|fkgb7z,54,44,1|fkgb80,32,42,0|fsdknz,32,42,0|fsdko0,54,44,1|g36dvz,54,44,1|g36dw0,32,42,0|gb3nbz,32,42,0|gb3nc0,54,44,1|glwgjz,54,44,1|glwgk0,32,42,0|gu6onz,32,42,0|gu6oo0,54,44,1|h4mj7z,54,44,1|h4mj80,32,42,0|hcwrbz,32,42,0|hcwrc0,54,44,1|hnclvz,54,44,1|hnclw0,32,42,0|hvmtzz,32,42,0|hvmu00,54,44,1|i6fn7z,54,44,1|i6fn80,32,42,0|iecwnz,32,42,0|iecwo0,54,44,1|ip5pvz,54,44,1|ip5pw0,32,42,0|ix2zbz,32,42,0|ix2zc0,54,44,1|j7vsjz,54,44,1|j7vsk0,32,42,0|jeq5zz,32,42,0|jeq600,54,44,1|jqytvz,54,44,1|jqytw0,32,42,0|jxg8nz,32,42,0|jxg8o0,54,44,1|k9owjz,54,44,1|k9owk0,32,42,0|kg6bbz,32,42,0|kg6bc0,54,44,1|ksez7z,54,44,1|ksez80,32,42,0|kz9cnz,32,42,0|kz9co0,54,44,1|lbi0jz,54,44,1|lbi0k0,32,42,0|lhzfbz,32,42,0|lhzfc0,54,44,1|lu837z,54,44,1|lu8380,32,42,0|m0phzz,32,42,0|m0pi00,54,44,1|mcy5vz,54,44,1|mcy5w0,32,42,0|mjfknz,32,42,0|mjfko0,54,44,1|mvo8jz,54,44,1|mvo8k0,32,42,0|n25nbz,32,42,0|n25nc0,54,44,1|neeb7z,54,44,1|neeb80,32,42,0|nkvpzz,32,42,0|nkvq00,54,44,1|nx4dvz,54,44,1|nx4dw0,32,42,0|o3yrbz,32,42,0|o3yrc0,54,44,1|og7f7z,54,44,1|og7f80,32,42,0|omotzz,32,42,0|omou00,54,44,1|oyxhvz,54,44,1|oyxhw0,32,42,0|p5ewnz,32,42,0|p5ewo0,54,44,1|phnkjz,54,44,1|phnkk0,32,42,0|po4zbz,32,42,0|po4zc0,54,44,1|q0dn7z,54,44,1|q0dn80,32,42,0|q6v1zz,32,42,0|q6v200,54,44,1|qj3pvz,54,44,1|qj3pw0,32,42,0|qpy3bz,32,42,0|qpy3c0,54,44,1|r26r7z,54,44,1|r26r80,32,42,0|r8o5zz,32,42,0|r8o600,54,44,1|rkwtvz,54,44,1|rkwtw0,32,42,0|rre8nz,32,42,0|rre8o0,54,44,1|s3mwjz,54,44,1|s3mwk0,32,42,0|sa4bbz,32,42,0|sa4bc0,54,44,1|smcz7z,54,44,1|smcz80,32,42,0|ssudzz,32,42,0|ssue00,54,44,1|t531vz,54,44,1|t531w0,32,42,0|tbkgnz,32,42,0|tbkgo0,54,44,1|tnt4jz,54,44,1|tnt4k0,32,42,0|tunhzz,32,42,0|tuni00,54,44,1|u6w5vz,54,44,1|u6w5w0,32,42,0|uddknz,32,42,0|uddko0,54,44,1|upm8jz,54,44,1|upm8k0,32,42,0|uw3nbz,32,42,0|uw3nc0,54,44,1|v8cb7z,54,44,1|v8cb80,32,42,0|vetpzz,32,42,0|vetq00,54,44,1|vr2dvz,54,44,1|vr2dw0,32,42,0|vxjsnz,32,42,0|vxjso0,54,44,1|w9sgjz,54,44,1|w9sgk0,32,42,0|wgmtzz,32,42,0|wgmu00,54,44,1|wsvhvz,54,44,1|wsvhw0,32,42,0|wzcwnz,32,42,0|wzcwo0,54,44,1|xblkjz,54,44,1|xblkk0,32,42,0|xi2zbz,32,42,0|xi2zc0,54,44,1|xubn7z,54,44,1|xubn80,32,42,0|y0t1zz,32,42,0|y0t200,54,44,1|yd1pvz,54,44,1|yd1pw0,32,42,0|yjj4nz,32,42,0|yjj4o0,54,44,1|yvrsjz,54,44,1|yvrsk0,32,42,0|z297bz,32,42,0|z297c0,54,44,1|zehv7z,54,44,1|zehv80,32,42,0\",\"America/Goose_Bay|,0,98,0|-18vs7h8,24,99,0|-qzp20l,24,99,0|-qzp20k,72,100,1|-qpm64l,72,100,1|-qpm64k,24,99,0|-i52u8l,24,99,0|-i52u8k,24,101,0|-hk3aa1,24,101,0|-hk3aa0,72,102,1|-hcj521,72,102,1|-hcj520,24,101,0|-h1d7m1,24,101,0|-h1d7m0,72,102,1|-gtt2e1,72,102,1|-gtt2e0,24,101,0|-gin4y1,24,101,0|-gin4y0,72,102,1|-gb2zq1,72,102,1|-gb2zq0,24,101,0|-fzk3m1,24,101,0|-fzk3m0,72,102,1|-fscx21,72,102,1|-fscx20,24,101,0|-fgu0y1,24,101,0|-fgu0y0,72,102,1|-f99vq1,72,102,1|-f99vq0,24,101,0|-ey3ya1,24,101,0|-ey3ya0,72,102,1|-eqjt21,72,102,1|-eqjt20,24,101,0|-efdvm1,24,101,0|-efdvm0,25,102,1|-cq2tg1,25,102,1|-cq2tg0,26,102,1|-cnp7i1,26,102,1|-cnp7i0,24,101,0|-cc6be1,24,101,0|-cc6be0,72,102,1|-c4m661,72,102,1|-c4m660,24,101,0|-btg8q1,24,101,0|-btg8q0,72,102,1|-blw3i1,72,102,1|-blw3i0,24,101,0|-baq621,24,101,0|-baq620,72,102,1|-b360u1,72,102,1|-b360u0,24,101,0|-as03e1,24,101,0|-as03e0,72,102,1|-akfy61,72,102,1|-akfy60,24,101,0|-a8x221,24,101,0|-a8x220,72,102,1|-a1cwu1,72,102,1|-a1cwu0,24,101,0|-9qwwq1,24,101,0|-9qwwq0,72,102,1|-9izsu1,72,102,1|-9izsu0,24,101,0|-986u21,24,101,0|-986u20,72,102,1|-909q61,72,102,1|-909q60,24,101,0|-8pgre1,24,101,0|-8pgre0,72,102,1|-8hjni1,72,102,1|-8hjni0,24,101,0|-86qoq1,24,101,0|-86qoq0,72,102,1|-7ytku1,72,102,1|-7ytku0,24,101,0|-7o0m21,24,101,0|-7o0m20,72,102,1|-7g3i61,72,102,1|-7g3i60,24,101,0|-74xkq1,24,101,0|-74xkq0,72,102,1|-6x0gu1,72,102,1|-6x0gu0,24,101,0|-6m7i21,24,101,0|-6m7i20,72,102,1|-6eae61,72,102,1|-6eae60,24,101,0|-63hfe1,24,101,0|-63hfe0,72,102,1|-5vkbi1,72,102,1|-5vkbi0,24,101,0|-5krcq1,24,101,0|-5krcq0,72,102,1|-5cu8u1,72,102,1|-5cu8u0,24,101,0|-521a21,24,101,0|-521a20,72,102,1|-4sbcu1,72,102,1|-4sbcu0,24,101,0|-4iy8q1,24,101,0|-4iy8q0,72,102,1|-49la61,72,102,1|-49la60,24,101,0|-408621,24,101,0|-408620,72,102,1|-3qv7i1,72,102,1|-3qv7i0,24,101,0|-3hi3e1,24,101,0|-3hi3e0,72,102,1|-3854u1,72,102,1|-3854u0,24,101,0|-2ys0q1,24,101,0|-2ys0q0,72,102,1|-2pf261,72,102,1|-2pf260,24,101,0|-2g1y21,24,101,0|-2g1y20,72,102,1|-26c0u1,72,102,1|-26c0u0,24,101,0|-1zdy21,24,101,0|-1zdy20,32,42,0|-1xbu01,32,42,0|-1xbu00,54,44,1|-1nlws1,54,44,1|-1nlws0,32,42,0|-1e8so1,32,42,0|-1e8so0,54,44,1|-14vu41,54,44,1|-14vu40,32,42,0|-viq01,32,42,0|-viq00,54,44,1|-m5rg1,54,44,1|-m5rg0,32,42,0|-csnc1,32,42,0|-csnc0,54,44,1|-3fos1,54,44,1|-3fos0,32,42,0|5xfbz,32,42,0|5xfc0,54,44,1|fadvz,54,44,1|fadw0,32,42,0|onhzz,32,42,0|oni00,54,44,1|ydf7z,54,44,1|ydf80,32,42,0|17qjbz,32,42,0|17qjc0,54,44,1|1h3hvz,54,44,1|1h3hw0,32,42,0|1qglzz,32,42,0|1qgm00,54,44,1|1ztkjz,54,44,1|1ztkk0,32,42,0|296onz,32,42,0|296oo0,54,44,1|2ijn7z,54,44,1|2ijn80,32,42,0|2rwrbz,32,42,0|2rwrc0,54,44,1|319pvz,54,44,1|319pw0,32,42,0|3amtzz,32,42,0|3amu00,54,44,1|3kcr7z,54,44,1|3kcr80,32,42,0|3tcwnz,32,42,0|3tcwo0,54,44,1|432tvz,54,44,1|432tw0,32,42,0|4cfxzz,32,42,0|4cfy00,54,44,1|4lswjz,54,44,1|4lswk0,32,42,0|4v60nz,32,42,0|4v60o0,54,44,1|54iz7z,54,44,1|54iz80,32,42,0|5dw3bz,32,42,0|5dw3c0,54,44,1|5n91vz,54,44,1|5n91w0,32,42,0|5wm5zz,32,42,0|5wm600,54,44,1|65z4jz,54,44,1|65z4k0,32,42,0|6fc8nz,32,42,0|6fc8o0,54,44,1|6p25vz,54,44,1|6p25w0,32,42,0|6y2bbz,32,42,0|6y2bc0,54,44,1|77s8jz,54,44,1|77s8k0,32,42,0|7h5cnz,32,42,0|7h5co0,54,44,1|7qib7z,54,44,1|7qib80,32,42,0|7zvfbz,32,42,0|7zvfc0,54,44,1|898dvz,54,44,1|898dw0,32,42,0|8ilhzz,32,42,0|8ili00,54,44,1|8rygjz,54,44,1|8rygk0,32,42,0|908j5n,32,42,0|908j5o,54,44,1|9aodpn,54,44,1|9aodpo,32,42,0|9iyltn,32,42,0|9iylto,73,45,1|9trc9n,73,45,1|9trc9o,32,42,0|a1oohn,32,42,0|a1ooho,54,44,1|achhpn,54,44,1|achhpo,32,42,0|aker5n,32,42,0|aker5o,54,44,1|av7kdn,54,44,1|av7kdo,32,42,0|b3hshn,32,42,0|b3hsho,54,44,1|bdxn1n,54,44,1|bdxn1o,32,42,0|bm7v5n,32,42,0|bm7v5o,54,44,1|bwnppn,54,44,1|bwnppo,32,42,0|c4xxtn,32,42,0|c4xxto,54,44,1|cfqr1n,54,44,1|cfqr1o,32,42,0|cno0hn,32,42,0|cno0ho,54,44,1|cygtpn,54,44,1|cygtpo,32,42,0|d6e35n,32,42,0|d6e35o,54,44,1|dh6wdn,54,44,1|dh6wdo,32,42,0|dph4hn,32,42,0|dph4ho,54,44,1|dzwz1n,54,44,1|dzwz1o,32,42,0|e8775n,32,42,0|e8775o,54,44,1|ein1pn,54,44,1|ein1po,32,42,0|eqx9tn,32,42,0|eqx9to,54,44,1|f1d4dn,54,44,1|f1d4do,32,42,0|f9nchn,32,42,0|f9ncho,54,44,1|fkg5pn,54,44,1|fkg5po,32,42,0|fsdf5n,32,42,0|fsdf5o,54,44,1|g368dn,54,44,1|g368do,32,42,0|gb3htn,32,42,0|gb3hto,54,44,1|glwb1n,54,44,1|glwb1o,32,42,0|gu6j5n,32,42,0|gu6j5o,54,44,1|h4mdpn,54,44,1|h4mdpo,32,42,0|hcwltn,32,42,0|hcwlto,54,44,1|hncgdn,54,44,1|hncgdo,32,42,0|hvmohn,32,42,0|hvmoho,54,44,1|i6fhpn,54,44,1|i6fhpo,32,42,0|iecr5n,32,42,0|iecr5o,54,44,1|ip5kdn,54,44,1|ip5kdo,32,42,0|ix2ttn,32,42,0|ix2tto,54,44,1|j7vn1n,54,44,1|j7vn1o,32,42,0|jeq0hn,32,42,0|jeq0ho,54,44,1|jqyodn,54,44,1|jqyodo,32,42,0|jxg35n,32,42,0|jxg35o,54,44,1|k9or1n,54,44,1|k9or1o,32,42,0|kg65tn,32,42,0|kg65to,54,44,1|ksetpn,54,44,1|ksetpo,32,42,0|kz975n,32,42,0|kz975o,54,44,1|lbhv1n,54,44,1|lbhv1o,32,42,0|lhz9tn,32,42,0|lhz9to,54,44,1|lu837z,54,44,1|lu8380,32,42,0|m0phzz,32,42,0|m0pi00,54,44,1|mcy5vz,54,44,1|mcy5w0,32,42,0|mjfknz,32,42,0|mjfko0,54,44,1|mvo8jz,54,44,1|mvo8k0,32,42,0|n25nbz,32,42,0|n25nc0,54,44,1|neeb7z,54,44,1|neeb80,32,42,0|nkvpzz,32,42,0|nkvq00,54,44,1|nx4dvz,54,44,1|nx4dw0,32,42,0|o3yrbz,32,42,0|o3yrc0,54,44,1|og7f7z,54,44,1|og7f80,32,42,0|omotzz,32,42,0|omou00,54,44,1|oyxhvz,54,44,1|oyxhw0,32,42,0|p5ewnz,32,42,0|p5ewo0,54,44,1|phnkjz,54,44,1|phnkk0,32,42,0|po4zbz,32,42,0|po4zc0,54,44,1|q0dn7z,54,44,1|q0dn80,32,42,0|q6v1zz,32,42,0|q6v200,54,44,1|qj3pvz,54,44,1|qj3pw0,32,42,0|qpy3bz,32,42,0|qpy3c0,54,44,1|r26r7z,54,44,1|r26r80,32,42,0|r8o5zz,32,42,0|r8o600,54,44,1|rkwtvz,54,44,1|rkwtw0,32,42,0|rre8nz,32,42,0|rre8o0,54,44,1|s3mwjz,54,44,1|s3mwk0,32,42,0|sa4bbz,32,42,0|sa4bc0,54,44,1|smcz7z,54,44,1|smcz80,32,42,0|ssudzz,32,42,0|ssue00,54,44,1|t531vz,54,44,1|t531w0,32,42,0|tbkgnz,32,42,0|tbkgo0,54,44,1|tnt4jz,54,44,1|tnt4k0,32,42,0|tunhzz,32,42,0|tuni00,54,44,1|u6w5vz,54,44,1|u6w5w0,32,42,0|uddknz,32,42,0|uddko0,54,44,1|upm8jz,54,44,1|upm8k0,32,42,0|uw3nbz,32,42,0|uw3nc0,54,44,1|v8cb7z,54,44,1|v8cb80,32,42,0|vetpzz,32,42,0|vetq00,54,44,1|vr2dvz,54,44,1|vr2dw0,32,42,0|vxjsnz,32,42,0|vxjso0,54,44,1|w9sgjz,54,44,1|w9sgk0,32,42,0|wgmtzz,32,42,0|wgmu00,54,44,1|wsvhvz,54,44,1|wsvhw0,32,42,0|wzcwnz,32,42,0|wzcwo0,54,44,1|xblkjz,54,44,1|xblkk0,32,42,0|xi2zbz,32,42,0|xi2zc0,54,44,1|xubn7z,54,44,1|xubn80,32,42,0|y0t1zz,32,42,0|y0t200,54,44,1|yd1pvz,54,44,1|yd1pw0,32,42,0|yjj4nz,32,42,0|yjj4o0,54,44,1|yvrsjz,54,44,1|yvrsk0,32,42,0|z297bz,32,42,0|z297c0,54,44,1|zehv7z,54,44,1|zehv80,32,42,0\",\"America/Grand_Turk|,0,103,0|-15r0w5s,74,104,0|-u85og3,74,104,0|-u85og2,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,32,42,0|p5ezfz,32,42,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Grenada|,0,41,0|-u6m79w,32,42,0\",\"America/Guadeloupe|,0,41,0|-u6m79w,32,42,0\",\"America/Guatemala|,0,105,0|-qqqskk,45,62,0|219hzz,45,62,0|219i00,46,63,1|25xxvz,46,63,1|25xxw0,45,62,0|6zgbbz,45,62,0|6zgbc0,46,63,1|75tv7z,46,63,1|75tv80,45,62,0|b2q5zz,45,62,0|b2q600,46,63,1|bbd77z,46,63,1|bbd780,45,62,0|iyitzz,45,62,0|iyiu00,46,63,1|j6fxvz,46,63,1|j6fxw0,45,62,0\",\"America/Guayaquil|,0,106,0|-15r0ujs,75,107,0|-kcr84p,75,107,0|-kcr84o,56,63,0|byetvz,56,63,0|byetw0,42,42,1|c1yj3z,42,42,1|c1yj40,56,63,0\",\"America/Guyana|,0,108,0|-smcak8,76,109,0|2wsiez,76,109,0|2wsif0,39,44,0|ayjxnz,39,44,0|ayjxo0,42,42,0\",\"America/Halifax|,0,110,0|-z94k80,32,42,0|-s1x3k1,32,42,0|-s1x3k0,54,44,1|-rsiac1,54,44,1|-rsiac0,32,42,0|-qzp0o1,32,42,0|-qzp0o0,54,44,1|-qpm4s1,54,44,1|-qpm4s0,32,42,0|-pwt681,32,42,0|-pwt680,54,44,1|-pr1uc1,54,44,1|-pr1uc0,32,42,0|-pe6sw1,32,42,0|-pe6sw0,54,44,1|-p7wyc1,54,44,1|-p7wyc0,32,42,0|-ovpzk1,32,42,0|-ovpzk0,54,44,1|-op5101,54,44,1|-op5100,32,42,0|-ocmy81,32,42,0|-ocmy80,54,44,1|-o6eyc1,54,44,1|-o6eyc0,32,42,0|-ntwvk1,32,42,0|-ntwvk0,54,44,1|-nn0t01,54,44,1|-nn0t00,32,42,0|-nb6sw1,32,42,0|-nb6sw0,54,44,1|-n3kt01,54,44,1|-n3kt00,32,42,0|-mrqsw1,32,42,0|-mrqsw0,54,44,1|-mlkno1,54,44,1|-mlkno0,32,42,0|-m9qnk1,32,42,0|-m9qnk0,54,44,1|-m24no1,54,44,1|-m24no0,32,42,0|-lqank1,32,42,0|-lqank0,54,44,1|-lk6d01,54,44,1|-lk6d00,32,42,0|-l7kkw1,32,42,0|-l7kkw0,54,44,1|-l1pjo1,54,44,1|-l1pjo0,32,42,0|-koui81,32,42,0|-koui80,54,44,1|-kibec1,54,44,1|-kibec0,32,42,0|-k64fk1,32,42,0|-k64fk0,54,44,1|-jyvec1,54,44,1|-jyvec0,32,42,0|-jnrbk1,32,42,0|-jnrbk0,54,44,1|-jg5bo1,54,44,1|-jg5bo0,32,42,0|-j518w1,32,42,0|-j518w0,54,44,1|-ix2ac1,54,44,1|-ix2ac0,32,42,0|-il8a81,32,42,0|-il8a80,54,44,1|-if3zo1,54,44,1|-if3zo0,32,42,0|-i1sa81,32,42,0|-i1sa80,54,44,1|-hvm501,54,44,1|-hvm500,32,42,0|-hj0cw1,32,42,0|-hj0cw0,54,44,1|-hdlzo1,54,44,1|-hdlzo0,32,42,0|-h1rzk1,32,42,0|-h1rzk0,54,44,1|-gu5zo1,54,44,1|-gu5zo0,32,42,0|-gj1ww1,32,42,0|-gj1ww0,54,44,1|-gbfx01,54,44,1|-gbfx00,32,42,0|-fyvzk1,32,42,0|-fyvzk0,54,44,1|-fspuc1,54,44,1|-fspuc0,32,42,0|-fh8sw1,32,42,0|-fh8sw0,54,44,1|-f9mt01,54,44,1|-f9mt00,32,42,0|-eyiq81,32,42,0|-eyiq80,54,44,1|-eqwqc1,54,44,1|-eqwqc0,32,42,0|-ek27c1,32,42,0|-ek27c0,33,44,1|-cq2tg1,33,44,1|-cq2tg0,34,44,1|-cnp641,34,44,1|-cnp640,32,42,0|-ccw7c1,32,42,0|-ccw7c0,54,44,1|-c4z3g1,54,44,1|-c4z3g0,32,42,0|-bu64o1,32,42,0|-bu64o0,54,44,1|-bm90s1,54,44,1|-bm90s0,32,42,0|-bbg201,32,42,0|-bbg200,54,44,1|-b3iy41,54,44,1|-b3iy40,32,42,0|-aspzc1,32,42,0|-aspzc0,54,44,1|-aksvg1,54,44,1|-aksvg0,32,42,0|-9qwvc1,32,42,0|-9qwvc0,54,44,1|-9izrg1,54,44,1|-9izrg0,32,42,0|-986so1,32,42,0|-986so0,54,44,1|-909os1,54,44,1|-909os0,32,42,0|-8pgq01,32,42,0|-8pgq00,54,44,1|-8hjm41,54,44,1|-8hjm40,32,42,0|-86qnc1,32,42,0|-86qnc0,54,44,1|-7ytjg1,54,44,1|-7ytjg0,32,42,0|-74xjc1,32,42,0|-74xjc0,54,44,1|-6x0fg1,54,44,1|-6x0fg0,32,42,0|-6m7go1,32,42,0|-6m7go0,54,44,1|-6eacs1,54,44,1|-6eacs0,32,42,0|-63he01,32,42,0|-63he00,54,44,1|-5vka41,54,44,1|-5vka40,32,42,0|-5krbc1,32,42,0|-5krbc0,54,44,1|-5cu7g1,54,44,1|-5cu7g0,32,42,0|-4084o1,32,42,0|-4084o0,54,44,1|-3qv641,54,44,1|-3qv640,32,42,0|-3hi201,32,42,0|-3hi200,54,44,1|-3853g1,54,44,1|-3853g0,32,42,0|-2yrzc1,32,42,0|-2yrzc0,54,44,1|-2pf0s1,54,44,1|-2pf0s0,32,42,0|-2g1wo1,32,42,0|-2g1wo0,54,44,1|-26bzg1,54,44,1|-26bzg0,32,42,0|-1xbu01,32,42,0|-1xbu00,54,44,1|-1nlws1,54,44,1|-1nlws0,32,42,0|-1e8so1,32,42,0|-1e8so0,54,44,1|-14vu41,54,44,1|-14vu40,32,42,0|-viq01,32,42,0|-viq00,54,44,1|-m5rg1,54,44,1|-m5rg0,32,42,0|-csnc1,32,42,0|-csnc0,54,44,1|-3fos1,54,44,1|-3fos0,32,42,0|5xfbz,32,42,0|5xfc0,54,44,1|fadvz,54,44,1|fadw0,32,42,0|onhzz,32,42,0|oni00,54,44,1|ydf7z,54,44,1|ydf80,32,42,0|17qjbz,32,42,0|17qjc0,54,44,1|1h3hvz,54,44,1|1h3hw0,32,42,0|1qglzz,32,42,0|1qgm00,54,44,1|1ztkjz,54,44,1|1ztkk0,32,42,0|296onz,32,42,0|296oo0,54,44,1|2ijn7z,54,44,1|2ijn80,32,42,0|2rwrbz,32,42,0|2rwrc0,54,44,1|319pvz,54,44,1|319pw0,32,42,0|3amtzz,32,42,0|3amu00,54,44,1|3kcr7z,54,44,1|3kcr80,32,42,0|3tcwnz,32,42,0|3tcwo0,54,44,1|432tvz,54,44,1|432tw0,32,42,0|4cfxzz,32,42,0|4cfy00,54,44,1|4lswjz,54,44,1|4lswk0,32,42,0|4v60nz,32,42,0|4v60o0,54,44,1|54iz7z,54,44,1|54iz80,32,42,0|5dw3bz,32,42,0|5dw3c0,54,44,1|5n91vz,54,44,1|5n91w0,32,42,0|5wm5zz,32,42,0|5wm600,54,44,1|65z4jz,54,44,1|65z4k0,32,42,0|6fc8nz,32,42,0|6fc8o0,54,44,1|6p25vz,54,44,1|6p25w0,32,42,0|6y2bbz,32,42,0|6y2bc0,54,44,1|77s8jz,54,44,1|77s8k0,32,42,0|7h5cnz,32,42,0|7h5co0,54,44,1|7qib7z,54,44,1|7qib80,32,42,0|7zvfbz,32,42,0|7zvfc0,54,44,1|898dvz,54,44,1|898dw0,32,42,0|8ilhzz,32,42,0|8ili00,54,44,1|8rygjz,54,44,1|8rygk0,32,42,0|908onz,32,42,0|908oo0,54,44,1|9aoj7z,54,44,1|9aoj80,32,42,0|9iyrbz,32,42,0|9iyrc0,54,44,1|9trkjz,54,44,1|9trkk0,32,42,0|a1otzz,32,42,0|a1ou00,54,44,1|achn7z,54,44,1|achn80,32,42,0|akewnz,32,42,0|akewo0,54,44,1|av7pvz,54,44,1|av7pw0,32,42,0|b3hxzz,32,42,0|b3hy00,54,44,1|bdxsjz,54,44,1|bdxsk0,32,42,0|bm80nz,32,42,0|bm80o0,54,44,1|bwnv7z,54,44,1|bwnv80,32,42,0|c4y3bz,32,42,0|c4y3c0,54,44,1|cfqwjz,54,44,1|cfqwk0,32,42,0|cno5zz,32,42,0|cno600,54,44,1|cygz7z,54,44,1|cygz80,32,42,0|d6e8nz,32,42,0|d6e8o0,54,44,1|dh71vz,54,44,1|dh71w0,32,42,0|dph9zz,32,42,0|dpha00,54,44,1|dzx4jz,54,44,1|dzx4k0,32,42,0|e87cnz,32,42,0|e87co0,54,44,1|ein77z,54,44,1|ein780,32,42,0|eqxfbz,32,42,0|eqxfc0,54,44,1|f1d9vz,54,44,1|f1d9w0,32,42,0|f9nhzz,32,42,0|f9ni00,54,44,1|fkgb7z,54,44,1|fkgb80,32,42,0|fsdknz,32,42,0|fsdko0,54,44,1|g36dvz,54,44,1|g36dw0,32,42,0|gb3nbz,32,42,0|gb3nc0,54,44,1|glwgjz,54,44,1|glwgk0,32,42,0|gu6onz,32,42,0|gu6oo0,54,44,1|h4mj7z,54,44,1|h4mj80,32,42,0|hcwrbz,32,42,0|hcwrc0,54,44,1|hnclvz,54,44,1|hnclw0,32,42,0|hvmtzz,32,42,0|hvmu00,54,44,1|i6fn7z,54,44,1|i6fn80,32,42,0|iecwnz,32,42,0|iecwo0,54,44,1|ip5pvz,54,44,1|ip5pw0,32,42,0|ix2zbz,32,42,0|ix2zc0,54,44,1|j7vsjz,54,44,1|j7vsk0,32,42,0|jeq5zz,32,42,0|jeq600,54,44,1|jqytvz,54,44,1|jqytw0,32,42,0|jxg8nz,32,42,0|jxg8o0,54,44,1|k9owjz,54,44,1|k9owk0,32,42,0|kg6bbz,32,42,0|kg6bc0,54,44,1|ksez7z,54,44,1|ksez80,32,42,0|kz9cnz,32,42,0|kz9co0,54,44,1|lbi0jz,54,44,1|lbi0k0,32,42,0|lhzfbz,32,42,0|lhzfc0,54,44,1|lu837z,54,44,1|lu8380,32,42,0|m0phzz,32,42,0|m0pi00,54,44,1|mcy5vz,54,44,1|mcy5w0,32,42,0|mjfknz,32,42,0|mjfko0,54,44,1|mvo8jz,54,44,1|mvo8k0,32,42,0|n25nbz,32,42,0|n25nc0,54,44,1|neeb7z,54,44,1|neeb80,32,42,0|nkvpzz,32,42,0|nkvq00,54,44,1|nx4dvz,54,44,1|nx4dw0,32,42,0|o3yrbz,32,42,0|o3yrc0,54,44,1|og7f7z,54,44,1|og7f80,32,42,0|omotzz,32,42,0|omou00,54,44,1|oyxhvz,54,44,1|oyxhw0,32,42,0|p5ewnz,32,42,0|p5ewo0,54,44,1|phnkjz,54,44,1|phnkk0,32,42,0|po4zbz,32,42,0|po4zc0,54,44,1|q0dn7z,54,44,1|q0dn80,32,42,0|q6v1zz,32,42,0|q6v200,54,44,1|qj3pvz,54,44,1|qj3pw0,32,42,0|qpy3bz,32,42,0|qpy3c0,54,44,1|r26r7z,54,44,1|r26r80,32,42,0|r8o5zz,32,42,0|r8o600,54,44,1|rkwtvz,54,44,1|rkwtw0,32,42,0|rre8nz,32,42,0|rre8o0,54,44,1|s3mwjz,54,44,1|s3mwk0,32,42,0|sa4bbz,32,42,0|sa4bc0,54,44,1|smcz7z,54,44,1|smcz80,32,42,0|ssudzz,32,42,0|ssue00,54,44,1|t531vz,54,44,1|t531w0,32,42,0|tbkgnz,32,42,0|tbkgo0,54,44,1|tnt4jz,54,44,1|tnt4k0,32,42,0|tunhzz,32,42,0|tuni00,54,44,1|u6w5vz,54,44,1|u6w5w0,32,42,0|uddknz,32,42,0|uddko0,54,44,1|upm8jz,54,44,1|upm8k0,32,42,0|uw3nbz,32,42,0|uw3nc0,54,44,1|v8cb7z,54,44,1|v8cb80,32,42,0|vetpzz,32,42,0|vetq00,54,44,1|vr2dvz,54,44,1|vr2dw0,32,42,0|vxjsnz,32,42,0|vxjso0,54,44,1|w9sgjz,54,44,1|w9sgk0,32,42,0|wgmtzz,32,42,0|wgmu00,54,44,1|wsvhvz,54,44,1|wsvhw0,32,42,0|wzcwnz,32,42,0|wzcwo0,54,44,1|xblkjz,54,44,1|xblkk0,32,42,0|xi2zbz,32,42,0|xi2zc0,54,44,1|xubn7z,54,44,1|xubn80,32,42,0|y0t1zz,32,42,0|y0t200,54,44,1|yd1pvz,54,44,1|yd1pw0,32,42,0|yjj4nz,32,42,0|yjj4o0,54,44,1|yvrsjz,54,44,1|yvrsk0,32,42,0|z297bz,32,42,0|z297c0,54,44,1|zehv7z,54,44,1|zehv80,32,42,0\",\"America/Havana|,0,111,0|-15r0u2w,77,112,0|-n7762p,77,112,0|-n7762o,45,63,0|-louq41,45,63,0|-louq40,46,42,1|-likvk1,46,42,1|-likvk0,45,63,0|-ffsvg1,45,63,0|-ffsvg0,46,42,1|-fb4fk1,46,42,1|-fb4fk0,45,63,0|-ex2ss1,45,63,0|-ex2ss0,46,42,1|-es1e81,46,42,1|-es1e80,45,63,0|-edzrg1,45,63,0|-edzrg0,46,42,1|-e9bbk1,46,42,1|-e9bbk0,45,63,0|-cttjg1,45,63,0|-cttjg0,46,42,1|-cp53k1,46,42,1|-cp53k0,45,63,0|-cb3gs1,45,63,0|-cb3gs0,46,42,1|-c6f0w1,46,42,1|-c6f0w0,45,63,0|-2e5gs1,45,63,0|-2e5gs0,46,42,1|-27xgw1,46,42,1|-27xgw0,45,63,0|-1vj3g1,45,63,0|-1vj3g0,46,42,1|-1p1u81,46,42,1|-1p1u80,45,63,0|-1fdm41,45,63,0|-1fdm40,46,42,1|-17enk1,46,42,1|-17enk0,45,63,0|-w8q41,45,63,0|-w8q40,46,42,1|-ookw1,46,42,1|-ookw0,45,63,0|-csq41,45,63,0|-csq40,46,42,1|-3frk1,46,42,1|-3frk0,45,63,0|5xcjz,45,63,0|5xck0,46,42,1|fab3z,46,42,1|fab40,45,63,0|onf7z,45,63,0|onf80,46,42,1|ydcfz,46,42,1|ydcg0,45,63,0|17qgjz,45,63,0|17qgk0,46,42,1|1g0j3z,46,42,1|1g0j40,45,63,0|1qgj7z,45,63,0|1qgj80,46,42,1|1ysgfz,46,42,1|1ysgg0,45,63,0|296lvz,45,63,0|296lw0,46,42,1|2hkdrz,46,42,1|2hkds0,45,63,0|2rwojz,45,63,0|2rwok0,46,42,1|319n3z,46,42,1|319n40,45,63,0|3amr7z,45,63,0|3amr80,46,42,1|3kcofz,46,42,1|3kcog0,45,63,0|3tctvz,45,63,0|3tctw0,46,42,1|432r3z,46,42,1|432r40,45,63,0|4cstvz,45,63,0|4cstw0,46,42,1|4kpxrz,46,42,1|4kpxs0,45,63,0|4t05vz,45,63,0|4t05w0,46,42,1|53sz3z,46,42,1|53sz40,45,63,0|5bq8jz,45,63,0|5bq8k0,46,42,1|5mj1rz,46,42,1|5mj1s0,45,63,0|5xc0jz,45,63,0|5xc0k0,46,42,1|6594fz,46,42,1|6594g0,45,63,0|6g237z,45,63,0|6g2380,46,42,1|6nz73z,46,42,1|6nz740,45,63,0|6ys5vz,45,63,0|6ys5w0,46,42,1|76p9rz,46,42,1|76p9s0,45,63,0|7hi8jz,45,63,0|7hi8k0,46,42,1|7psb3z,46,42,1|7psb40,45,63,0|808b7z,45,63,0|808b80,46,42,1|88idrz,46,42,1|88ids0,45,63,0|8gfn7z,45,63,0|8gfn80,46,42,1|8r8gfz,46,42,1|8r8gg0,45,63,0|8z5pvz,45,63,0|8z5pw0,46,42,1|99yj3z,46,42,1|99yj40,45,63,0|9i8r7z,45,63,0|9i8r80,46,42,1|9solrz,46,42,1|9sols0,45,63,0|a0ytvz,45,63,0|a0ytw0,46,42,1|abeofz,46,42,1|abeog0,45,63,0|aketvz,45,63,0|aketw0,46,42,1|auhprz,46,42,1|auhps0,45,63,0|b3hv7z,45,63,0|b3hv80,46,42,1|bd7v7z,46,42,1|bd7v80,45,63,0|bm7xvz,45,63,0|bm7xw0,46,42,1|bvxxvz,46,42,1|bvxxw0,45,63,0|c4y0jz,45,63,0|c4y0k0,46,42,1|ceo0jz,46,42,1|ceo0k0,45,63,0|cno37z,45,63,0|cno380,46,42,1|cxe37z,46,42,1|cxe380,45,63,0|d6e5vz,45,63,0|d6e5w0,46,42,1|dg45vz,46,42,1|dg45w0,45,63,0|dph77z,45,63,0|dph780,46,42,1|dyu8jz,46,42,1|dyu8k0,45,63,0|e879vz,45,63,0|e879w0,46,42,1|ehx9vz,46,42,1|ehx9w0,45,63,0|eqkdvz,45,63,0|eqkdw0,46,42,1|f1d9vz,46,42,1|f1d9w0,45,63,0|f9agjz,45,63,0|f9agk0,46,42,1|fkgb7z,46,42,1|fkgb80,45,63,0|fsdhvz,45,63,0|fsdhw0,46,42,1|g36dvz,46,42,1|g36dw0,45,63,0|gb3kjz,45,63,0|gb3kk0,46,42,1|glwgjz,46,42,1|glwgk0,45,63,0|gu6lvz,45,63,0|gu6lw0,46,42,1|h4mj7z,46,42,1|h4mj80,45,63,0|hcwojz,45,63,0|hcwok0,46,42,1|hnclvz,46,42,1|hnclw0,45,63,0|hv9sjz,45,63,0|hv9sk0,46,42,1|j7vsjz,46,42,1|j7vsk0,45,63,0|jeq37z,45,63,0|jeq380,46,42,1|jqlv7z,46,42,1|jqlv80,45,63,0|jxt4jz,45,63,0|jxt4k0,46,42,1|k9bxvz,46,42,1|k9bxw0,45,63,0|kg68jz,45,63,0|kg68k0,46,42,1|ks20jz,46,42,1|ks20k0,45,63,0|kz99vz,45,63,0|kz99w0,46,42,1|lb51vz,46,42,1|lb51w0,45,63,0|licb7z,45,63,0|licb80,46,42,1|lul1vz,46,42,1|lul1w0,45,63,0|m1sb7z,45,63,0|m1sb80,46,42,1|mcy5vz,46,42,1|mcy5w0,45,63,0|mjfhvz,45,63,0|mjfhw0,46,42,1|mvo8jz,46,42,1|mvo8k0,45,63,0|n25kjz,45,63,0|n25kk0,46,42,1|neeb7z,46,42,1|neeb80,45,63,0|nkvn7z,45,63,0|nkvn80,46,42,1|nx4dvz,46,42,1|nx4dw0,45,63,0|o3yojz,45,63,0|o3yok0,46,42,1|og7f7z,46,42,1|og7f80,45,63,0|omor7z,45,63,0|omor80,46,42,1|oyxhvz,46,42,1|oyxhw0,45,63,0|p5etvz,45,63,0|p5etw0,46,42,1|phnkjz,46,42,1|phnkk0,45,63,0|po4wjz,45,63,0|po4wk0,46,42,1|q0dn7z,46,42,1|q0dn80,45,63,0|q6uz7z,45,63,0|q6uz80,46,42,1|qj3pvz,46,42,1|qj3pw0,45,63,0|qpy0jz,45,63,0|qpy0k0,46,42,1|r26r7z,46,42,1|r26r80,45,63,0|r8o37z,45,63,0|r8o380,46,42,1|rkwtvz,46,42,1|rkwtw0,45,63,0|rre5vz,45,63,0|rre5w0,46,42,1|s3mwjz,46,42,1|s3mwk0,45,63,0|sa48jz,45,63,0|sa48k0,46,42,1|smcz7z,46,42,1|smcz80,45,63,0|ssub7z,45,63,0|ssub80,46,42,1|t531vz,46,42,1|t531w0,45,63,0|tbkdvz,45,63,0|tbkdw0,46,42,1|tnt4jz,46,42,1|tnt4k0,45,63,0|tunf7z,45,63,0|tunf80,46,42,1|u6w5vz,46,42,1|u6w5w0,45,63,0|uddhvz,45,63,0|uddhw0,46,42,1|upm8jz,46,42,1|upm8k0,45,63,0|uw3kjz,45,63,0|uw3kk0,46,42,1|v8cb7z,46,42,1|v8cb80,45,63,0|vetn7z,45,63,0|vetn80,46,42,1|vr2dvz,46,42,1|vr2dw0,45,63,0|vxjpvz,45,63,0|vxjpw0,46,42,1|w9sgjz,46,42,1|w9sgk0,45,63,0|wgmr7z,45,63,0|wgmr80,46,42,1|wsvhvz,46,42,1|wsvhw0,45,63,0|wzctvz,45,63,0|wzctw0,46,42,1|xblkjz,46,42,1|xblkk0,45,63,0|xi2wjz,45,63,0|xi2wk0,46,42,1|xubn7z,46,42,1|xubn80,45,63,0|y0sz7z,45,63,0|y0sz80,46,42,1|yd1pvz,46,42,1|yd1pw0,45,63,0|yjj1vz,45,63,0|yjj1w0,46,42,1|yvrsjz,46,42,1|yvrsk0,45,63,0|z294jz,45,63,0|z294k0,46,42,1|zehv7z,46,42,1|zehv80,45,63,0\",\"America/Hermosillo|,0,113,0|-p1u4k0,50,66,0|-m7mko1,50,66,0|-m7mko0,45,62,0|-kf67c1,45,62,0|-kf67c0,50,66,0|-k6j3c1,50,66,0|-k6j3c0,45,62,0|-jypm01,45,62,0|-jypm00,50,66,0|-jpan81,50,66,0|-jpan80,45,62,0|-eg9601,45,62,0|-eg9600,50,66,0|-axv381,50,66,0|-axv380,51,40,0|m7z,51,40,0|m80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0\",\"America/Indiana/Indianapolis|,0,114,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-evzog1,45,62,0|-evzog0,46,63,1|-eqy9w1,46,63,1|-eqy9w0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-ccw1s1,45,62,0|-ccw1s0,46,63,1|-c4yxw1,46,63,1|-c4yxw0,45,62,0|-bu5z41,45,62,0|-bu5z40,46,63,1|-bm8v81,46,63,1|-bm8v80,45,62,0|-bbfwg1,45,62,0|-bbfwg0,46,63,1|-b3isk1,46,63,1|-b3isk0,45,62,0|-aspts1,45,62,0|-aspts0,46,63,1|-akspw1,46,63,1|-akspw0,45,62,0|-a9msg1,45,62,0|-a9msg0,46,63,1|-a22n81,46,63,1|-a22n80,45,62,0|-9qwps1,45,62,0|-9qwps0,46,63,1|-9izlw1,46,63,1|-9izlw0,45,62,0|-986n41,45,62,0|-986n40,46,63,1|-909j81,46,63,1|-909j80,45,62,0|-8pgkg1,45,62,0|-8pgkg0,46,63,1|-8hjgk1,46,63,1|-8hjgk0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7o0f41,45,62,0|-7o0f40,49,63,0|-6ea781,49,63,0|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Indiana/Knox|,0,115,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-bu5z41,45,62,0|-bu5z40,46,63,1|-bm8v81,46,63,1|-bm8v80,45,62,0|-bbfwg1,45,62,0|-bbfwg0,46,63,1|-b3isk1,46,63,1|-b3isk0,45,62,0|-aspts1,45,62,0|-aspts0,46,63,1|-akspw1,46,63,1|-akspw0,45,62,0|-a9msg1,45,62,0|-a9msg0,46,63,1|-a22n81,46,63,1|-a22n80,45,62,0|-9qwps1,45,62,0|-9qwps0,46,63,1|-9izlw1,46,63,1|-9izlw0,45,62,0|-986n41,45,62,0|-986n40,46,63,1|-909j81,46,63,1|-909j80,45,62,0|-8pgkg1,45,62,0|-8pgkg0,46,63,1|-8hjgk1,46,63,1|-8hjgk0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7o0f41,45,62,0|-7o0f40,46,63,1|-7eahw1,46,63,1|-7eahw0,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6vkf81,46,63,1|-6vkf80,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6ea781,46,63,1|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5vk4k1,46,63,1|-5vk4k0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5be781,46,63,1|-5be780,45,62,0|-521341,45,62,0|-521340,46,63,1|-4sb5w1,46,63,1|-4sb5w0,45,62,0|-4iy1s1,45,62,0|-4iy1s0,46,63,1|-49l381,46,63,1|-49l380,45,62,0|-407z41,45,62,0|-407z40,49,63,0|-384xw1,49,63,0|-384xw0,45,62,0|-1e8n41,45,62,0|-1e8n40,46,63,1|-14vok1,46,63,1|-14vok0,45,62,0|-vikg1,45,62,0|-vikg0,46,63,1|-m5lw1,46,63,1|-m5lw0,45,62,0|-cshs1,45,62,0|-cshs0,46,63,1|-3fj81,46,63,1|-3fj80,45,62,0|5xkvz,45,62,0|5xkw0,46,63,1|fajfz,46,63,1|fajg0,45,62,0|onnjz,45,62,0|onnk0,46,63,1|ydkrz,46,63,1|ydks0,45,62,0|17qovz,45,62,0|17qow0,46,63,1|1h3nfz,46,63,1|1h3ng0,45,62,0|1qgrjz,45,62,0|1qgrk0,46,63,1|1ztq3z,46,63,1|1ztq40,45,62,0|23ffjz,45,62,0|23ffk0,46,63,1|2ijsrz,46,63,1|2ijss0,45,62,0|2oo8vz,45,62,0|2oo8w0,46,63,1|319vfz,46,63,1|319vg0,45,62,0|3amzjz,45,62,0|3amzk0,46,63,1|3kcwrz,46,63,1|3kcws0,45,62,0|3td27z,45,62,0|3td280,46,63,1|432zfz,46,63,1|432zg0,45,62,0|4cg3jz,45,62,0|4cg3k0,46,63,1|4lt23z,46,63,1|4lt240,45,62,0|4v667z,45,62,0|4v6680,46,63,1|54j4rz,46,63,1|54j4s0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n97fz,46,63,1|5n97g0,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65za3z,46,63,1|65za40,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2bfz,46,63,1|6p2bg0,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77se3z,46,63,1|77se40,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qigrz,46,63,1|7qigs0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898jfz,46,63,1|898jg0,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8rym3z,46,63,1|8rym40,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aoorz,46,63,1|9aoos0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achsrz,46,63,1|achss0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7vfz,46,63,1|av7vg0,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdxy3z,46,63,1|bdxy40,49,63,0|ix323z,49,63,0|ix3240,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Indiana/Marengo|,0,116,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-9qwps1,45,62,0|-9qwps0,46,63,1|-9izlw1,46,63,1|-9izlw0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7o0f41,45,62,0|-7o0f40,46,63,1|-7g3b81,46,63,1|-7g3b80,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6x09w1,46,63,1|-6x09w0,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6ea781,46,63,1|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5vk4k1,46,63,1|-5vk4k0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5cu1w1,46,63,1|-5cu1w0,45,62,0|-521341,45,62,0|-521340,46,63,1|-4u3z81,46,63,1|-4u3z80,45,62,0|-4iy1s1,45,62,0|-4iy1s0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|onkrz,49,63,0|onks0,62,42,1|ydhzz,62,42,1|ydi00,49,63,0|17qm3z,49,63,0|17qm40,62,42,1|1h3knz,62,42,1|1h3ko0,49,63,0|1qgorz,49,63,0|1qgos0,62,42,1|1ztnbz,62,42,1|1ztnc0,49,63,0|23fcrz,49,63,0|23fcs0,46,63,1|2ijsrz,46,63,1|2ijss0,49,63,0|2oo63z,49,63,0|2oo640,62,42,1|319snz,62,42,1|319so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Indiana/Petersburg|,0,117,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-7nnm01,45,62,0|-7nnm00,46,63,1|-7g3b81,46,63,1|-7g3b80,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6x09w1,46,63,1|-6x09w0,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6ea781,46,63,1|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5vk4k1,46,63,1|-5vk4k0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5cu1w1,46,63,1|-5cu1w0,45,62,0|-521341,45,62,0|-521340,46,63,1|-4u3z81,46,63,1|-4u3z80,45,62,0|-4iy1s1,45,62,0|-4iy1s0,46,63,1|-49l381,46,63,1|-49l380,45,62,0|-407z41,45,62,0|-407z40,46,63,1|-3qv0k1,46,63,1|-3qv0k0,45,62,0|-3hhwg1,45,62,0|-3hhwg0,46,63,1|-384xw1,46,63,1|-384xw0,45,62,0|-2yrts1,45,62,0|-2yrts0,46,63,1|-2pev81,46,63,1|-2pev80,45,62,0|-2g1r41,45,62,0|-2g1r40,49,63,0|-1nlr81,49,63,0|-1nlr80,45,62,0|-1e8n41,45,62,0|-1e8n40,46,63,1|-14vok1,46,63,1|-14vok0,45,62,0|-vikg1,45,62,0|-vikg0,46,63,1|-m5lw1,46,63,1|-m5lw0,45,62,0|-cshs1,45,62,0|-cshs0,46,63,1|-3fj81,46,63,1|-3fj80,45,62,0|5xkvz,45,62,0|5xkw0,46,63,1|fajfz,46,63,1|fajg0,45,62,0|onnjz,45,62,0|onnk0,46,63,1|ydkrz,46,63,1|ydks0,45,62,0|17qovz,45,62,0|17qow0,46,63,1|1h3nfz,46,63,1|1h3ng0,45,62,0|1qgrjz,45,62,0|1qgrk0,46,63,1|1ztq3z,46,63,1|1ztq40,45,62,0|23ffjz,45,62,0|23ffk0,46,63,1|2ijsrz,46,63,1|2ijss0,45,62,0|2oo8vz,45,62,0|2oo8w0,46,63,1|319vfz,46,63,1|319vg0,45,62,0|3amzjz,45,62,0|3amzk0,46,63,1|3kcwrz,46,63,1|3kcws0,45,62,0|3td27z,45,62,0|3td280,46,63,1|432zfz,46,63,1|432zg0,49,63,0|ix323z,49,63,0|ix3240,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Indiana/Tell_City|,0,118,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-7nnm01,45,62,0|-7nnm00,46,63,1|-7g3b81,46,63,1|-7g3b80,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6x09w1,46,63,1|-6x09w0,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6ea781,46,63,1|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5vk4k1,46,63,1|-5vk4k0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5cu1w1,46,63,1|-5cu1w0,45,62,0|-521341,45,62,0|-521340,46,63,1|-4u3z81,46,63,1|-4u3z80,45,62,0|-4iy1s1,45,62,0|-4iy1s0,46,63,1|-49l381,46,63,1|-49l380,45,62,0|-407z41,45,62,0|-407z40,46,63,1|-3qv0k1,46,63,1|-3qv0k0,45,62,0|-3hhwg1,45,62,0|-3hhwg0,46,63,1|-384xw1,46,63,1|-384xw0,45,62,0|-2yrts1,45,62,0|-2yrts0,49,63,0|-14vok1,49,63,0|-14vok0,45,62,0|-vikg1,45,62,0|-vikg0,46,63,1|-m5lw1,46,63,1|-m5lw0,45,62,0|-cshs1,45,62,0|-cshs0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|ix323z,49,63,0|ix3240,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Indiana/Vevay|,0,119,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-86qhs1,45,62,0|-86qhs0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|onkrz,49,63,0|onks0,62,42,1|ydhzz,62,42,1|ydi00,49,63,0|17qm3z,49,63,0|17qm40,62,42,1|1h3knz,62,42,1|1h3ko0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Indiana/Vincennes|,0,120,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-ccw1s1,45,62,0|-ccw1s0,46,63,1|-c4yxw1,46,63,1|-c4yxw0,45,62,0|-8pgkg1,45,62,0|-8pgkg0,46,63,1|-8hjgk1,46,63,1|-8hjgk0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7nnm01,45,62,0|-7nnm00,46,63,1|-7g3b81,46,63,1|-7g3b80,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6x09w1,46,63,1|-6x09w0,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6ea781,46,63,1|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5vk4k1,46,63,1|-5vk4k0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5cu1w1,46,63,1|-5cu1w0,45,62,0|-521341,45,62,0|-521340,46,63,1|-4sb5w1,46,63,1|-4sb5w0,45,62,0|-4iy1s1,45,62,0|-4iy1s0,46,63,1|-4bdwk1,46,63,1|-4bdwk0,45,62,0|-407z41,45,62,0|-407z40,46,63,1|-3qv0k1,46,63,1|-3qv0k0,45,62,0|-3hhwg1,45,62,0|-3hhwg0,46,63,1|-384xw1,46,63,1|-384xw0,45,62,0|-2yrts1,45,62,0|-2yrts0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|ix323z,49,63,0|ix3240,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Indiana/Winamac|,0,121,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-ccw1s1,45,62,0|-ccw1s0,46,63,1|-c4yxw1,46,63,1|-c4yxw0,45,62,0|-bu5z41,45,62,0|-bu5z40,46,63,1|-bm8v81,46,63,1|-bm8v80,45,62,0|-bbfwg1,45,62,0|-bbfwg0,46,63,1|-b3isk1,46,63,1|-b3isk0,45,62,0|-aspts1,45,62,0|-aspts0,46,63,1|-akspw1,46,63,1|-akspw0,45,62,0|-a9msg1,45,62,0|-a9msg0,46,63,1|-a22n81,46,63,1|-a22n80,45,62,0|-9qwps1,45,62,0|-9qwps0,46,63,1|-9izlw1,46,63,1|-9izlw0,45,62,0|-986n41,45,62,0|-986n40,46,63,1|-909j81,46,63,1|-909j80,45,62,0|-8pgkg1,45,62,0|-8pgkg0,46,63,1|-8hjgk1,46,63,1|-8hjgk0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7o0f41,45,62,0|-7o0f40,46,63,1|-7eahw1,46,63,1|-7eahw0,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6vkf81,46,63,1|-6vkf80,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6ea781,46,63,1|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5vk4k1,46,63,1|-5vk4k0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5cu1w1,46,63,1|-5cu1w0,45,62,0|-521341,45,62,0|-521340,46,63,1|-4u3z81,46,63,1|-4u3z80,45,62,0|-4iy1s1,45,62,0|-4iy1s0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|ix323z,49,63,0|ix3240,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Inuvik|,60,1,0|-8ve5c0,51,40,0|-2g1r41,51,40,0|-2g1r40,78,62,1|-26br41,78,62,1|-26br40,51,40,0|4v6brz,51,40,0|4v6bs0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gb3vnz,50,66,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jeqebz,50,66,0|jeqec0,52,62,1|jqz27z,52,62,1|jqz280,50,66,0|jxggzz,50,66,0|jxgh00,52,62,1|k9p4vz,52,62,1|k9p4w0,50,66,0|kg6jnz,50,66,0|kg6jo0,52,62,1|ksf7jz,52,62,1|ksf7k0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,50,66,0|lhznnz,50,66,0|lhzno0,52,62,1|lu8bjz,52,62,1|lu8bk0,50,66,0|m0pqbz,50,66,0|m0pqc0,52,62,1|mcye7z,52,62,1|mcye80,50,66,0|mjfszz,50,66,0|mjft00,52,62,1|mvogvz,52,62,1|mvogw0,50,66,0|n25vnz,50,66,0|n25vo0,52,62,1|neejjz,52,62,1|neejk0,50,66,0|nkvybz,50,66,0|nkvyc0,52,62,1|nx4m7z,52,62,1|nx4m80,50,66,0|o3yznz,50,66,0|o3yzo0,52,62,1|og7njz,52,62,1|og7nk0,50,66,0|omp2bz,50,66,0|omp2c0,52,62,1|oyxq7z,52,62,1|oyxq80,50,66,0|p5f4zz,50,66,0|p5f500,52,62,1|phnsvz,52,62,1|phnsw0,50,66,0|po57nz,50,66,0|po57o0,52,62,1|q0dvjz,52,62,1|q0dvk0,50,66,0|q6vabz,50,66,0|q6vac0,52,62,1|qj3y7z,52,62,1|qj3y80,50,66,0|qpybnz,50,66,0|qpybo0,52,62,1|r26zjz,52,62,1|r26zk0,50,66,0|r8oebz,50,66,0|r8oec0,52,62,1|rkx27z,52,62,1|rkx280,50,66,0|rregzz,50,66,0|rreh00,52,62,1|s3n4vz,52,62,1|s3n4w0,50,66,0|sa4jnz,50,66,0|sa4jo0,52,62,1|smd7jz,52,62,1|smd7k0,50,66,0|ssumbz,50,66,0|ssumc0,52,62,1|t53a7z,52,62,1|t53a80,50,66,0|tbkozz,50,66,0|tbkp00,52,62,1|tntcvz,52,62,1|tntcw0,50,66,0|tunqbz,50,66,0|tunqc0,52,62,1|u6we7z,52,62,1|u6we80,50,66,0|uddszz,50,66,0|uddt00,52,62,1|upmgvz,52,62,1|upmgw0,50,66,0|uw3vnz,50,66,0|uw3vo0,52,62,1|v8cjjz,52,62,1|v8cjk0,50,66,0|vetybz,50,66,0|vetyc0,52,62,1|vr2m7z,52,62,1|vr2m80,50,66,0|vxk0zz,50,66,0|vxk100,52,62,1|w9sovz,52,62,1|w9sow0,50,66,0|wgn2bz,50,66,0|wgn2c0,52,62,1|wsvq7z,52,62,1|wsvq80,50,66,0|wzd4zz,50,66,0|wzd500,52,62,1|xblsvz,52,62,1|xblsw0,50,66,0|xi37nz,50,66,0|xi37o0,52,62,1|xubvjz,52,62,1|xubvk0,50,66,0|y0tabz,50,66,0|y0tac0,52,62,1|yd1y7z,52,62,1|yd1y80,50,66,0|yjjczz,50,66,0|yjjd00,52,62,1|yvs0vz,52,62,1|yvs0w0,50,66,0|z29fnz,50,66,0|z29fo0,52,62,1|zei3jz,52,62,1|zei3k0,50,66,0\",\"America/Iqaluit|,60,1,0|-eb6ao0,70,42,1|-cq2tg1,70,42,1|-cq2tg0,71,42,1|-cnp3c1,71,42,1|-cnp3c0,49,63,0|-2g1zg1,49,63,0|-2g1zg0,79,44,1|-26bzg1,79,44,1|-26bzg0,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Jamaica|,0,104,0|-15r0v42,74,104,0|-u85og3,74,104,0|-u85og2,49,63,0|23fcrz,49,63,0|23fcs0,62,42,1|2ijpzz,62,42,1|2ijq00,49,63,0|2oo63z,49,63,0|2oo640,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0\",\"America/Juneau|,0,122,0|-1hc7qjz,0,123,0|-1078wfw,0,123,0|-1078wfv,51,40,0|-ek1w81,51,40,0|-ek1w80,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-cnov01,69,66,1|-cnov00,51,40,0|-csc81,51,40,0|-csc80,57,66,1|-3fdo1,57,66,1|-3fdo0,51,40,0|5xqfz,51,40,0|5xqg0,57,66,1|faozz,57,66,1|fap00,51,40,0|ont3z,51,40,0|ont40,57,66,1|ydqbz,57,66,1|ydqc0,51,40,0|17qufz,51,40,0|17qug0,57,66,1|1h3szz,57,66,1|1h3t00,51,40,0|1qgx3z,51,40,0|1qgx40,57,66,1|1ztvnz,57,66,1|1ztvo0,51,40,0|23fl3z,51,40,0|23fl40,57,66,1|2ijybz,57,66,1|2ijyc0,51,40,0|2ooefz,51,40,0|2ooeg0,57,66,1|31a0zz,57,66,1|31a100,51,40,0|3an53z,51,40,0|3an540,57,66,1|3kd2bz,57,66,1|3kd2c0,51,40,0|3td7rz,51,40,0|3td7s0,57,66,1|4334zz,57,66,1|433500,51,40,0|4cg93z,51,40,0|4cg940,57,66,1|4lt7nz,57,66,1|4lt7o0,51,40,0|4v6brz,51,40,0|4v6bs0,57,66,1|54jabz,57,66,1|54jac0,51,40,0|5dwefz,51,40,0|5dweg0,64,40,1|5n9frz,64,40,1|5n9fs0,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,36,37,0|79dybz,36,37,0|79dyc0,37,37,0|7h5qjz,37,37,0|7h5qk0,38,40,1|7qip3z,38,40,1|7qip40,37,37,0|7zvt7z,37,37,0|7zvt80,38,40,1|898rrz,38,40,1|898rs0,37,37,0|8ilvvz,37,37,0|8ilvw0,38,40,1|8ryufz,38,40,1|8ryug0,37,37,0|9092jz,37,37,0|9092k0,38,40,1|9aox3z,38,40,1|9aox40,37,37,0|9iz57z,37,37,0|9iz580,38,40,1|9tryfz,38,40,1|9tryg0,37,37,0|a1p7vz,37,37,0|a1p7w0,38,40,1|aci13z,38,40,1|aci140,37,37,0|akfajz,37,37,0|akfak0,38,40,1|av83rz,38,40,1|av83s0,37,37,0|b3ibvz,37,37,0|b3ibw0,38,40,1|bdy6fz,38,40,1|bdy6g0,37,37,0|bm8ejz,37,37,0|bm8ek0,38,40,1|bwo93z,38,40,1|bwo940,37,37,0|c4yh7z,37,37,0|c4yh80,38,40,1|cfrafz,38,40,1|cfrag0,37,37,0|cnojvz,37,37,0|cnojw0,38,40,1|cyhd3z,38,40,1|cyhd40,37,37,0|d6emjz,37,37,0|d6emk0,38,40,1|dh7frz,38,40,1|dh7fs0,37,37,0|dphnvz,37,37,0|dphnw0,38,40,1|dzxifz,38,40,1|dzxig0,37,37,0|e87qjz,37,37,0|e87qk0,38,40,1|einl3z,38,40,1|einl40,37,37,0|eqxt7z,37,37,0|eqxt80,38,40,1|f1dnrz,38,40,1|f1dns0,37,37,0|f9nvvz,37,37,0|f9nvw0,38,40,1|fkgp3z,38,40,1|fkgp40,37,37,0|fsdyjz,37,37,0|fsdyk0,38,40,1|g36rrz,38,40,1|g36rs0,37,37,0|gb417z,37,37,0|gb4180,38,40,1|glwufz,38,40,1|glwug0,37,37,0|gu72jz,37,37,0|gu72k0,38,40,1|h4mx3z,38,40,1|h4mx40,37,37,0|hcx57z,37,37,0|hcx580,38,40,1|hnczrz,38,40,1|hnczs0,37,37,0|hvn7vz,37,37,0|hvn7w0,38,40,1|i6g13z,38,40,1|i6g140,37,37,0|iedajz,37,37,0|iedak0,38,40,1|ip63rz,38,40,1|ip63s0,37,37,0|ix3d7z,37,37,0|ix3d80,38,40,1|j7w6fz,38,40,1|j7w6g0,37,37,0|jeqjvz,37,37,0|jeqjw0,38,40,1|jqz7rz,38,40,1|jqz7s0,37,37,0|jxgmjz,37,37,0|jxgmk0,38,40,1|k9pafz,38,40,1|k9pag0,37,37,0|kg6p7z,37,37,0|kg6p80,38,40,1|ksfd3z,38,40,1|ksfd40,37,37,0|kz9qjz,37,37,0|kz9qk0,38,40,1|lbiefz,38,40,1|lbieg0,37,37,0|lhzt7z,37,37,0|lhzt80,38,40,1|lu8h3z,38,40,1|lu8h40,37,37,0|m0pvvz,37,37,0|m0pvw0,38,40,1|mcyjrz,38,40,1|mcyjs0,37,37,0|mjfyjz,37,37,0|mjfyk0,38,40,1|mvomfz,38,40,1|mvomg0,37,37,0|n2617z,37,37,0|n26180,38,40,1|neep3z,38,40,1|neep40,37,37,0|nkw3vz,37,37,0|nkw3w0,38,40,1|nx4rrz,38,40,1|nx4rs0,37,37,0|o3z57z,37,37,0|o3z580,38,40,1|og7t3z,38,40,1|og7t40,37,37,0|omp7vz,37,37,0|omp7w0,38,40,1|oyxvrz,38,40,1|oyxvs0,37,37,0|p5fajz,37,37,0|p5fak0,38,40,1|phnyfz,38,40,1|phnyg0,37,37,0|po5d7z,37,37,0|po5d80,38,40,1|q0e13z,38,40,1|q0e140,37,37,0|q6vfvz,37,37,0|q6vfw0,38,40,1|qj43rz,38,40,1|qj43s0,37,37,0|qpyh7z,37,37,0|qpyh80,38,40,1|r2753z,38,40,1|r27540,37,37,0|r8ojvz,37,37,0|r8ojw0,38,40,1|rkx7rz,38,40,1|rkx7s0,37,37,0|rremjz,37,37,0|rremk0,38,40,1|s3nafz,38,40,1|s3nag0,37,37,0|sa4p7z,37,37,0|sa4p80,38,40,1|smdd3z,38,40,1|smdd40,37,37,0|ssurvz,37,37,0|ssurw0,38,40,1|t53frz,38,40,1|t53fs0,37,37,0|tbkujz,37,37,0|tbkuk0,38,40,1|tntifz,38,40,1|tntig0,37,37,0|tunvvz,37,37,0|tunvw0,38,40,1|u6wjrz,38,40,1|u6wjs0,37,37,0|uddyjz,37,37,0|uddyk0,38,40,1|upmmfz,38,40,1|upmmg0,37,37,0|uw417z,37,37,0|uw4180,38,40,1|v8cp3z,38,40,1|v8cp40,37,37,0|veu3vz,37,37,0|veu3w0,38,40,1|vr2rrz,38,40,1|vr2rs0,37,37,0|vxk6jz,37,37,0|vxk6k0,38,40,1|w9sufz,38,40,1|w9sug0,37,37,0|wgn7vz,37,37,0|wgn7w0,38,40,1|wsvvrz,38,40,1|wsvvs0,37,37,0|wzdajz,37,37,0|wzdak0,38,40,1|xblyfz,38,40,1|xblyg0,37,37,0|xi3d7z,37,37,0|xi3d80,38,40,1|xuc13z,38,40,1|xuc140,37,37,0|y0tfvz,37,37,0|y0tfw0,38,40,1|yd23rz,38,40,1|yd23s0,37,37,0|yjjijz,37,37,0|yjjik0,38,40,1|yvs6fz,38,40,1|yvs6g0,37,37,0|z29l7z,37,37,0|z29l80,38,40,1|zei93z,38,40,1|zei940,37,37,0\",\"America/Kentucky/Louisville|,0,124,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-pefr41,45,62,0|-pefr40,46,63,1|-p841w1,46,63,1|-p841w0,45,62,0|-eyvds1,45,62,0|-eyvds0,46,63,1|-eqy9w1,46,63,1|-eqy9w0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-ccw7ad,45,62,0|-ccw7ac,46,63,1|-cb3b81,46,63,1|-cb3b80,45,62,0|-a9msg1,45,62,0|-a9msg0,46,63,1|-a22n81,46,63,1|-a22n80,45,62,0|-9qwps1,45,62,0|-9qwps0,46,63,1|-9izlw1,46,63,1|-9izlw0,45,62,0|-986n41,45,62,0|-986n40,46,63,1|-909j81,46,63,1|-909j80,45,62,0|-8pgkg1,45,62,0|-8pgkg0,46,63,1|-8hjgk1,46,63,1|-8hjgk0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7o0f41,45,62,0|-7o0f40,46,63,1|-7g3b81,46,63,1|-7g3b80,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6vkf81,46,63,1|-6vkf80,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6cuck1,46,63,1|-6cuck0,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5u49w1,46,63,1|-5u49w0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5be781,46,63,1|-5be780,45,62,0|-521341,45,62,0|-521340,46,63,1|-4sb5w1,46,63,1|-4sb5w0,45,62,0|-4iy1s1,45,62,0|-4iy1s0,46,63,1|-4emkk1,46,63,1|-4emkk0,49,63,0|-vin81,49,63,0|-vin80,62,42,1|-m5oo1,62,42,1|-m5oo0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|onkrz,49,63,0|onks0,62,42,1|ydhzz,62,42,1|ydi00,49,63,0|17qm3z,49,63,0|17qm40,62,42,1|1h3knz,62,42,1|1h3ko0,49,63,0|1qgorz,49,63,0|1qgos0,62,42,1|1ztnbz,62,42,1|1ztnc0,49,63,0|23fcrz,49,63,0|23fcs0,46,63,1|2ijsrz,46,63,1|2ijss0,49,63,0|2oo63z,49,63,0|2oo640,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Kentucky/Monticello|,0,125,0|-18y0m00,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-vikg1,45,62,0|-vikg0,46,63,1|-m5lw1,46,63,1|-m5lw0,45,62,0|-cshs1,45,62,0|-cshs0,46,63,1|-3fj81,46,63,1|-3fj80,45,62,0|5xkvz,45,62,0|5xkw0,46,63,1|fajfz,46,63,1|fajg0,45,62,0|onnjz,45,62,0|onnk0,46,63,1|ydkrz,46,63,1|ydks0,45,62,0|17qovz,45,62,0|17qow0,46,63,1|1h3nfz,46,63,1|1h3ng0,45,62,0|1qgrjz,45,62,0|1qgrk0,46,63,1|1ztq3z,46,63,1|1ztq40,45,62,0|23ffjz,45,62,0|23ffk0,46,63,1|2ijsrz,46,63,1|2ijss0,45,62,0|2oo8vz,45,62,0|2oo8w0,46,63,1|319vfz,46,63,1|319vg0,45,62,0|3amzjz,45,62,0|3amzk0,46,63,1|3kcwrz,46,63,1|3kcws0,45,62,0|3td27z,45,62,0|3td280,46,63,1|432zfz,46,63,1|432zg0,45,62,0|4cg3jz,45,62,0|4cg3k0,46,63,1|4lt23z,46,63,1|4lt240,45,62,0|4v667z,45,62,0|4v6680,46,63,1|54j4rz,46,63,1|54j4s0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n97fz,46,63,1|5n97g0,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65za3z,46,63,1|65za40,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2bfz,46,63,1|6p2bg0,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77se3z,46,63,1|77se40,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qigrz,46,63,1|7qigs0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898jfz,46,63,1|898jg0,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8rym3z,46,63,1|8rym40,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aoorz,46,63,1|9aoos0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achsrz,46,63,1|achss0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7vfz,46,63,1|av7vg0,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdxy3z,46,63,1|bdxy40,45,62,0|bm867z,45,62,0|bm8680,46,63,1|bwo0rz,46,63,1|bwo0s0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr23z,46,63,1|cfr240,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh4rz,46,63,1|cyh4s0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh77fz,46,63,1|dh77g0,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Kralendijk|,0,58,0|-u7lckd,43,59,0|-2lx4u1,43,59,0|-2lx4u0,32,42,0\",\"America/La_Paz|,0,126,0|-15r0wpo,41,126,0|-jxzspp,41,126,0|-jxzspo,27,127,1|-jpva5p,27,127,1|-jpva5o,42,42,0\",\"America/Lima|,0,128,0|-15r0v2c,0,129,0|-w25lpp,0,129,0|-w25lpo,56,63,0|-gp8241,56,63,0|-gp8240,42,42,1|-gklgw1,42,42,1|-gklgw0,56,63,0|-gbhm41,56,63,0|-gbhm40,42,42,1|-g24nk1,42,42,1|-g24nk0,56,63,0|-fsrjg1,56,63,0|-fsrjg0,42,42,1|-fjekw1,42,42,1|-fjekw0,56,63,0|8cmlvz,56,63,0|8cmlw0,42,42,1|8h973z,42,42,1|8h9740,56,63,0|8vej7z,56,63,0|8vej80,42,42,1|9014fz,42,42,1|9014g0,56,63,0|afs5vz,56,63,0|afs5w0,42,42,1|aker3z,42,42,1|aker40,56,63,0|cixpvz,56,63,0|cixpw0,42,42,1|cnkb3z,42,42,1|cnkb40,56,63,0\",\"America/Los_Angeles|,0,130,0|-18y0gg0,51,40,0|-r0emw1,51,40,0|-r0emw0,57,66,1|-qplto1,57,66,1|-qplto0,51,40,0|-qhok81,51,40,0|-qhok80,57,66,1|-q6vr01,57,66,1|-q6vr00,51,40,0|-ek1w81,51,40,0|-ek1w80,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-cnov01,69,66,1|-cnov00,51,40,0|-bdliud,51,40,0|-bdliuc,57,66,1|-ayj0c1,57,66,1|-ayj0c0,51,40,0|-a9mpo1,51,40,0|-a9mpo0,57,66,1|-a22ho1,57,66,1|-a22ho0,51,40,0|-9qwn01,51,40,0|-9qwn00,57,66,1|-9izgc1,57,66,1|-9izgc0,51,40,0|-986kc1,51,40,0|-986kc0,57,66,1|-909do1,57,66,1|-909do0,51,40,0|-8pgho1,51,40,0|-8pgho0,57,66,1|-8hjb01,57,66,1|-8hjb00,51,40,0|-86qf01,51,40,0|-86qf00,57,66,1|-7yt8c1,57,66,1|-7yt8c0,51,40,0|-7o0cc1,51,40,0|-7o0cc0,57,66,1|-7g35o1,57,66,1|-7g35o0,51,40,0|-74xb01,51,40,0|-74xb00,57,66,1|-6x04c1,57,66,1|-6x04c0,51,40,0|-6m78c1,51,40,0|-6m78c0,57,66,1|-6ea1o1,57,66,1|-6ea1o0,51,40,0|-63h5o1,51,40,0|-63h5o0,57,66,1|-5vjz01,57,66,1|-5vjz00,51,40,0|-5kr301,51,40,0|-5kr300,57,66,1|-5ctwc1,57,66,1|-5ctwc0,51,40,0|-5210c1,51,40,0|-5210c0,57,66,1|-4u3to1,57,66,1|-4u3to0,51,40,0|-4ixz01,51,40,0|-4ixz00,57,66,1|-4bdr01,57,66,1|-4bdr00,51,40,0|-407wc1,51,40,0|-407wc0,57,66,1|-3quv01,57,66,1|-3quv00,51,40,0|-3hhto1,51,40,0|-3hhto0,57,66,1|-384sc1,57,66,1|-384sc0,51,40,0|-2yrr01,51,40,0|-2yrr00,57,66,1|-2pepo1,57,66,1|-2pepo0,51,40,0|-2g1oc1,51,40,0|-2g1oc0,57,66,1|-26boc1,57,66,1|-26boc0,51,40,0|-1xblo1,51,40,0|-1xblo0,57,66,1|-1nllo1,57,66,1|-1nllo0,51,40,0|-1e8hk1,51,40,0|-1e8hk0,57,66,1|-14vj01,57,66,1|-14vj00,51,40,0|-view1,51,40,0|-view0,57,66,1|-m5gc1,57,66,1|-m5gc0,51,40,0|-csc81,51,40,0|-csc80,57,66,1|-3fdo1,57,66,1|-3fdo0,51,40,0|5xqfz,51,40,0|5xqg0,57,66,1|faozz,57,66,1|fap00,51,40,0|ont3z,51,40,0|ont40,57,66,1|ydqbz,57,66,1|ydqc0,51,40,0|17qufz,51,40,0|17qug0,57,66,1|1h3szz,57,66,1|1h3t00,51,40,0|1qgx3z,51,40,0|1qgx40,57,66,1|1ztvnz,57,66,1|1ztvo0,51,40,0|23fl3z,51,40,0|23fl40,57,66,1|2ijybz,57,66,1|2ijyc0,51,40,0|2ooefz,51,40,0|2ooeg0,57,66,1|31a0zz,57,66,1|31a100,51,40,0|3an53z,51,40,0|3an540,57,66,1|3kd2bz,57,66,1|3kd2c0,51,40,0|3td7rz,51,40,0|3td7s0,57,66,1|4334zz,57,66,1|433500,51,40,0|4cg93z,51,40,0|4cg940,57,66,1|4lt7nz,57,66,1|4lt7o0,51,40,0|4v6brz,51,40,0|4v6bs0,57,66,1|54jabz,57,66,1|54jac0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,51,40,0|7h5nrz,51,40,0|7h5ns0,57,66,1|7qimbz,57,66,1|7qimc0,51,40,0|7zvqfz,51,40,0|7zvqg0,57,66,1|898ozz,57,66,1|898p00,51,40,0|8ilt3z,51,40,0|8ilt40,57,66,1|8ryrnz,57,66,1|8ryro0,51,40,0|908zrz,51,40,0|908zs0,57,66,1|9aoubz,57,66,1|9aouc0,51,40,0|9iz2fz,51,40,0|9iz2g0,57,66,1|9trvnz,57,66,1|9trvo0,51,40,0|a1p53z,51,40,0|a1p540,57,66,1|achybz,57,66,1|achyc0,51,40,0|akf7rz,51,40,0|akf7s0,57,66,1|av80zz,57,66,1|av8100,51,40,0|b3i93z,51,40,0|b3i940,57,66,1|bdy3nz,57,66,1|bdy3o0,51,40,0|bm8brz,51,40,0|bm8bs0,57,66,1|bwo6bz,57,66,1|bwo6c0,51,40,0|c4yefz,51,40,0|c4yeg0,57,66,1|cfr7nz,57,66,1|cfr7o0,51,40,0|cnoh3z,51,40,0|cnoh40,57,66,1|cyhabz,57,66,1|cyhac0,51,40,0|d6ejrz,51,40,0|d6ejs0,57,66,1|dh7czz,57,66,1|dh7d00,51,40,0|dphl3z,51,40,0|dphl40,57,66,1|dzxfnz,57,66,1|dzxfo0,51,40,0|e87nrz,51,40,0|e87ns0,57,66,1|einibz,57,66,1|einic0,51,40,0|eqxqfz,51,40,0|eqxqg0,57,66,1|f1dkzz,57,66,1|f1dl00,51,40,0|f9nt3z,51,40,0|f9nt40,57,66,1|fkgmbz,57,66,1|fkgmc0,51,40,0|fsdvrz,51,40,0|fsdvs0,57,66,1|g36ozz,57,66,1|g36p00,51,40,0|gb3yfz,51,40,0|gb3yg0,57,66,1|glwrnz,57,66,1|glwro0,51,40,0|gu6zrz,51,40,0|gu6zs0,57,66,1|h4mubz,57,66,1|h4muc0,51,40,0|hcx2fz,51,40,0|hcx2g0,57,66,1|hncwzz,57,66,1|hncx00,51,40,0|hvn53z,51,40,0|hvn540,57,66,1|i6fybz,57,66,1|i6fyc0,51,40,0|ied7rz,51,40,0|ied7s0,57,66,1|ip60zz,57,66,1|ip6100,51,40,0|ix3afz,51,40,0|ix3ag0,57,66,1|j7w3nz,57,66,1|j7w3o0,51,40,0|jeqh3z,51,40,0|jeqh40,57,66,1|jqz4zz,57,66,1|jqz500,51,40,0|jxgjrz,51,40,0|jxgjs0,57,66,1|k9p7nz,57,66,1|k9p7o0,51,40,0|kg6mfz,51,40,0|kg6mg0,57,66,1|ksfabz,57,66,1|ksfac0,51,40,0|kz9nrz,51,40,0|kz9ns0,57,66,1|lbibnz,57,66,1|lbibo0,51,40,0|lhzqfz,51,40,0|lhzqg0,57,66,1|lu8ebz,57,66,1|lu8ec0,51,40,0|m0pt3z,51,40,0|m0pt40,57,66,1|mcygzz,57,66,1|mcyh00,51,40,0|mjfvrz,51,40,0|mjfvs0,57,66,1|mvojnz,57,66,1|mvojo0,51,40,0|n25yfz,51,40,0|n25yg0,57,66,1|neembz,57,66,1|neemc0,51,40,0|nkw13z,51,40,0|nkw140,57,66,1|nx4ozz,57,66,1|nx4p00,51,40,0|o3z2fz,51,40,0|o3z2g0,57,66,1|og7qbz,57,66,1|og7qc0,51,40,0|omp53z,51,40,0|omp540,57,66,1|oyxszz,57,66,1|oyxt00,51,40,0|p5f7rz,51,40,0|p5f7s0,57,66,1|phnvnz,57,66,1|phnvo0,51,40,0|po5afz,51,40,0|po5ag0,57,66,1|q0dybz,57,66,1|q0dyc0,51,40,0|q6vd3z,51,40,0|q6vd40,57,66,1|qj40zz,57,66,1|qj4100,51,40,0|qpyefz,51,40,0|qpyeg0,57,66,1|r272bz,57,66,1|r272c0,51,40,0|r8oh3z,51,40,0|r8oh40,57,66,1|rkx4zz,57,66,1|rkx500,51,40,0|rrejrz,51,40,0|rrejs0,57,66,1|s3n7nz,57,66,1|s3n7o0,51,40,0|sa4mfz,51,40,0|sa4mg0,57,66,1|smdabz,57,66,1|smdac0,51,40,0|ssup3z,51,40,0|ssup40,57,66,1|t53czz,57,66,1|t53d00,51,40,0|tbkrrz,51,40,0|tbkrs0,57,66,1|tntfnz,57,66,1|tntfo0,51,40,0|tunt3z,51,40,0|tunt40,57,66,1|u6wgzz,57,66,1|u6wh00,51,40,0|uddvrz,51,40,0|uddvs0,57,66,1|upmjnz,57,66,1|upmjo0,51,40,0|uw3yfz,51,40,0|uw3yg0,57,66,1|v8cmbz,57,66,1|v8cmc0,51,40,0|veu13z,51,40,0|veu140,57,66,1|vr2ozz,57,66,1|vr2p00,51,40,0|vxk3rz,51,40,0|vxk3s0,57,66,1|w9srnz,57,66,1|w9sro0,51,40,0|wgn53z,51,40,0|wgn540,57,66,1|wsvszz,57,66,1|wsvt00,51,40,0|wzd7rz,51,40,0|wzd7s0,57,66,1|xblvnz,57,66,1|xblvo0,51,40,0|xi3afz,51,40,0|xi3ag0,57,66,1|xubybz,57,66,1|xubyc0,51,40,0|y0td3z,51,40,0|y0td40,57,66,1|yd20zz,57,66,1|yd2100,51,40,0|yjjfrz,51,40,0|yjjfs0,57,66,1|yvs3nz,57,66,1|yvs3o0,51,40,0|z29ifz,51,40,0|z29ig0,57,66,1|zei6bz,57,66,1|zei6c0,51,40,0\",\"America/Lower_Princes|,0,58,0|-u7lckd,43,59,0|-2lx4u1,43,59,0|-2lx4u0,32,42,0\",\"America/Maceio|,0,131,0|-t85ldw,39,44,0|-jylag1,39,44,0|-jylag0,40,45,1|-jpb141,40,45,1|-jpb140,39,44,0|-jfsd01,39,44,0|-jfsd00,40,45,1|-j6j3s1,40,45,1|-j6j3s0,39,44,0|-ahcyc1,39,44,0|-ahcyc0,40,45,1|-aad3o1,40,45,1|-aad3o0,39,44,0|-9yl101,39,44,0|-9yl100,40,45,1|-9sd141,40,45,1|-9sd140,39,44,0|-9ft3o1,39,44,0|-9ft3o0,40,45,1|-99j941,40,45,1|-99j940,39,44,0|-8wzbo1,39,44,0|-8wzbo0,40,45,1|-8scqg1,40,45,1|-8scqg0,39,44,0|-35xmc1,39,44,0|-35xmc0,40,45,1|-31nzs1,40,45,1|-31nzs0,39,44,0|-2kdp01,39,44,0|-2kdp00,40,45,1|-2hcig1,40,45,1|-2hcig0,39,44,0|-24qqc1,39,44,0|-24qqc0,40,45,1|-204541,40,45,1|-204540,39,44,0|-1nid01,39,44,0|-1nid00,40,45,1|-1hc7s1,40,45,1|-1hc7s0,39,44,0|-14qfo1,39,44,0|-14qfo0,40,45,1|-yifs1,40,45,1|-yifs0,39,44,0|89jcbz,39,44,0|89jcc0,40,45,1|8gdk7z,40,45,1|8gdk80,39,44,0|8rwgbz,39,44,0|8rwgc0,40,45,1|8xns7z,40,45,1|8xns80,39,44,0|9aodnz,39,44,0|9aodo0,40,45,1|9g2qvz,40,45,1|9g2qw0,39,44,0|9t1hnz,39,44,0|9t1ho0,40,45,1|9yfuvz,40,45,1|9yfuw0,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|ahvuvz,40,45,1|ahvuw0,39,44,0|dggyzz,39,44,0|dggz00,40,45,1|dml9jz,40,45,1|dml9k0,39,44,0|fj0azz,39,44,0|fj0b00,40,45,1|fqkg7z,40,45,1|fqkg80,39,44,0|g23cbz,39,44,0|g23cc0,40,45,1|g2t6vz,40,45,1|g2t6w0,39,44,0|gl6dnz,39,44,0|gl6do0,40,45,1|grnmvz,40,45,1|grnmw0,39,44,0\",\"America/Managua|,0,132,0|-15r0tcs,21,133,0|-ijh6op,21,133,0|-ijh6oo,45,62,0|1qkbbz,45,62,0|1qkbc0,49,63,0|2ob1vz,49,63,0|2ob1w0,45,62,0|4t08nz,45,62,0|4t08o0,46,63,1|4y3hvz,46,63,1|4y3hw0,45,62,0|5bqbbz,45,62,0|5bqbc0,46,63,1|5gtkjz,46,63,1|5gtkk0,45,62,0|bhcefz,45,62,0|bhceg0,49,63,0|bv2gjz,49,63,0|bv2gk0,45,62,0|c05vbz,45,62,0|c05vc0,49,63,0|e3bcjz,49,63,0|e3bck0,45,62,0|iepvbz,45,62,0|iepvc0,46,63,1|inpv7z,46,63,1|inpv80,45,62,0|iyizjz,45,62,0|iyizk0,46,63,1|j6g0nz,46,63,1|j6g0o0,45,62,0\",\"America/Manaus|,0,134,0|-t85gvw,42,42,0|-jyl7o1,42,42,0|-jyl7o0,39,44,1|-jpayc1,39,44,1|-jpayc0,42,42,0|-jfsa81,42,42,0|-jfsa80,39,44,1|-j6j101,39,44,1|-j6j100,42,42,0|-ahcvk1,42,42,0|-ahcvk0,39,44,1|-aad0w1,39,44,1|-aad0w0,42,42,0|-9yky81,42,42,0|-9yky80,39,44,1|-9scyc1,39,44,1|-9scyc0,42,42,0|-9ft0w1,42,42,0|-9ft0w0,39,44,1|-99j6c1,39,44,1|-99j6c0,42,42,0|-8wz8w1,42,42,0|-8wz8w0,39,44,1|-8scno1,39,44,1|-8scno0,42,42,0|-35xjk1,42,42,0|-35xjk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2kdm81,42,42,0|-2kdm80,39,44,1|-2hcfo1,39,44,1|-2hcfo0,42,42,0|-24qnk1,42,42,0|-24qnk0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1nia81,42,42,0|-1nia80,39,44,1|-1hc501,39,44,1|-1hc500,42,42,0|-14qcw1,42,42,0|-14qcw0,39,44,1|-yid01,39,44,1|-yid00,42,42,0|89jf3z,42,42,0|89jf40,39,44,1|8gdmzz,39,44,1|8gdn00,42,42,0|8rwj3z,42,42,0|8rwj40,39,44,1|8xnuzz,39,44,1|8xnv00,42,42,0|9aogfz,42,42,0|9aogg0,39,44,1|9g2tnz,39,44,1|9g2to0,42,42,0|cf0wfz,42,42,0|cf0wg0,39,44,1|cli5nz,39,44,1|cli5o0,42,42,0\",\"America/Marigot|,0,41,0|-u6m79w,32,42,0\",\"America/Martinique|,0,135,0|-15r0y0s,80,135,0|-umcvct,80,135,0|-umcvcs,32,42,0|5ct1rz,32,42,0|5ct1s0,54,44,1|5lt1nz,54,44,1|5lt1o0,32,42,0\",\"America/Matamoros|,0,136,0|-p1u7c0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gcwm7z,45,62,0|gcwm80,46,63,1|gkgrfz,46,63,1|gkgrg0,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jft7jz,45,62,0|jft7k0,46,63,1|jqm0rz,46,63,1|jqm0s0,45,62,0|jyw8vz,45,62,0|jyw8w0,46,63,1|k9c3fz,46,63,1|k9c3g0,45,62,0|khmbjz,45,62,0|khmbk0,46,63,1|ks263z,46,63,1|ks2640,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Mazatlan|,0,137,0|-p1u4k0,50,66,0|-m7mko1,50,66,0|-m7mko0,45,62,0|-kf67c1,45,62,0|-kf67c0,50,66,0|-k6j3c1,50,66,0|-k6j3c0,45,62,0|-jypm01,45,62,0|-jypm00,50,66,0|-jpan81,50,66,0|-jpan80,45,62,0|-eg9601,45,62,0|-eg9600,50,66,0|-axv381,50,66,0|-axv380,51,40,0|m7z,51,40,0|m80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gcwozz,50,66,0|gcwp00,52,62,1|gkgu7z,52,62,1|gkgu80,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jftabz,50,66,0|jftac0,52,62,1|jqm3jz,52,62,1|jqm3k0,50,66,0|jywbnz,50,66,0|jywbo0,52,62,1|k9c67z,52,62,1|k9c680,50,66,0|khmebz,50,66,0|khmec0,52,62,1|ks28vz,52,62,1|ks28w0,50,66,0|l0cgzz,50,66,0|l0ch00,52,62,1|lb5a7z,52,62,1|lb5a80,50,66,0|lj2jnz,50,66,0|lj2jo0,52,62,1|ltvcvz,52,62,1|ltvcw0,50,66,0|m1smbz,50,66,0|m1smc0,52,62,1|mclfjz,52,62,1|mclfk0,50,66,0|mkvnnz,50,66,0|mkvno0,52,62,1|mvbi7z,52,62,1|mvbi80,50,66,0|n3lqbz,50,66,0|n3lqc0,52,62,1|ne1kvz,52,62,1|ne1kw0,50,66,0|nmbszz,50,66,0|nmbt00,52,62,1|nwrnjz,52,62,1|nwrnk0,50,66,0|o51vnz,50,66,0|o51vo0,52,62,1|ofuovz,52,62,1|ofuow0,50,66,0|onrybz,50,66,0|onryc0,52,62,1|oykrjz,52,62,1|oykrk0,50,66,0|p6i0zz,50,66,0|p6i100,52,62,1|phau7z,52,62,1|phau80,50,66,0|ppl2bz,50,66,0|ppl2c0,52,62,1|q00wvz,52,62,1|q00ww0,50,66,0|q8b4zz,50,66,0|q8b500,52,62,1|qiqzjz,52,62,1|qiqzk0,50,66,0|qr17nz,50,66,0|qr17o0,52,62,1|r1u0vz,52,62,1|r1u0w0,50,66,0|r9rabz,50,66,0|r9rac0,52,62,1|rkk3jz,52,62,1|rkk3k0,50,66,0|rshczz,50,66,0|rshd00,52,62,1|s3a67z,52,62,1|s3a680,50,66,0|sbkebz,50,66,0|sbkec0,52,62,1|sm08vz,52,62,1|sm08w0,50,66,0|suagzz,50,66,0|suah00,52,62,1|t4qbjz,52,62,1|t4qbk0,50,66,0|td0jnz,50,66,0|td0jo0,52,62,1|tnge7z,52,62,1|tnge80,50,66,0|tvqmbz,50,66,0|tvqmc0,52,62,1|u6jfjz,52,62,1|u6jfk0,50,66,0|uegozz,50,66,0|uegp00,52,62,1|up9i7z,52,62,1|up9i80,50,66,0|ux6rnz,50,66,0|ux6ro0,52,62,1|v7zkvz,52,62,1|v7zkw0,50,66,0|vg9szz,50,66,0|vg9t00,52,62,1|vqpnjz,52,62,1|vqpnk0,50,66,0|vyzvnz,50,66,0|vyzvo0,52,62,1|w9fq7z,52,62,1|w9fq80,50,66,0|whpybz,50,66,0|whpyc0,52,62,1|wsirjz,52,62,1|wsirk0,50,66,0|x0g0zz,50,66,0|x0g100,52,62,1|xb8u7z,52,62,1|xb8u80,50,66,0|xj63nz,50,66,0|xj63o0,52,62,1|xtywvz,52,62,1|xtyww0,50,66,0|y1w6bz,50,66,0|y1w6c0,52,62,1|ycozjz,52,62,1|ycozk0,50,66,0|ykz7nz,50,66,0|ykz7o0,52,62,1|yvf27z,52,62,1|yvf280,50,66,0|z3pabz,50,66,0|z3pac0,52,62,1|ze54vz,52,62,1|ze54w0,50,66,0\",\"America/Menominee|,0,138,0|-17zjvrx,45,62,0|-r0esg1,45,62,0|-r0esg0,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-qhops1,45,62,0|-qhops0,46,63,1|-q6vwk1,46,63,1|-q6vwk0,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-ccw1s1,45,62,0|-ccw1s0,46,63,1|-c4yxw1,46,63,1|-c4yxw0,45,62,0|-1xbog1,45,62,0|-1xbog0,46,63,1|-1nlr81,46,63,1|-1nlr80,45,62,0|-cshs1,45,62,0|-cshs0,49,63,0|1qgorz,49,63,0|1qgos0,46,63,1|1ztq3z,46,63,1|1ztq40,45,62,0|23ffjz,45,62,0|23ffk0,46,63,1|2ijsrz,46,63,1|2ijss0,45,62,0|2oo8vz,45,62,0|2oo8w0,46,63,1|319vfz,46,63,1|319vg0,45,62,0|3amzjz,45,62,0|3amzk0,46,63,1|3kcwrz,46,63,1|3kcws0,45,62,0|3td27z,45,62,0|3td280,46,63,1|432zfz,46,63,1|432zg0,45,62,0|4cg3jz,45,62,0|4cg3k0,46,63,1|4lt23z,46,63,1|4lt240,45,62,0|4v667z,45,62,0|4v6680,46,63,1|54j4rz,46,63,1|54j4s0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n97fz,46,63,1|5n97g0,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65za3z,46,63,1|65za40,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2bfz,46,63,1|6p2bg0,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77se3z,46,63,1|77se40,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qigrz,46,63,1|7qigs0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898jfz,46,63,1|898jg0,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8rym3z,46,63,1|8rym40,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aoorz,46,63,1|9aoos0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achsrz,46,63,1|achss0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7vfz,46,63,1|av7vg0,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdxy3z,46,63,1|bdxy40,45,62,0|bm867z,45,62,0|bm8680,46,63,1|bwo0rz,46,63,1|bwo0s0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr23z,46,63,1|cfr240,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh4rz,46,63,1|cyh4s0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh77fz,46,63,1|dh77g0,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gb3svz,45,62,0|gb3sw0,46,63,1|glwm3z,46,63,1|glwm40,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Merida|,0,139,0|-p1u7c0,45,62,0|690gnz,45,62,0|690go0,49,63,0|6qpf7z,49,63,0|6qpf80,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gcwm7z,45,62,0|gcwm80,46,63,1|gkgrfz,46,63,1|gkgrg0,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jft7jz,45,62,0|jft7k0,46,63,1|jqm0rz,46,63,1|jqm0s0,45,62,0|jyw8vz,45,62,0|jyw8w0,46,63,1|k9c3fz,46,63,1|k9c3g0,45,62,0|khmbjz,45,62,0|khmbk0,46,63,1|ks263z,46,63,1|ks2640,45,62,0|l0ce7z,45,62,0|l0ce80,46,63,1|lb57fz,46,63,1|lb57g0,45,62,0|lj2gvz,45,62,0|lj2gw0,46,63,1|ltva3z,46,63,1|ltva40,45,62,0|m1sjjz,45,62,0|m1sjk0,46,63,1|mclcrz,46,63,1|mclcs0,45,62,0|mkvkvz,45,62,0|mkvkw0,46,63,1|mvbffz,46,63,1|mvbfg0,45,62,0|n3lnjz,45,62,0|n3lnk0,46,63,1|ne1i3z,46,63,1|ne1i40,45,62,0|nmbq7z,45,62,0|nmbq80,46,63,1|nwrkrz,46,63,1|nwrks0,45,62,0|o51svz,45,62,0|o51sw0,46,63,1|ofum3z,46,63,1|ofum40,45,62,0|onrvjz,45,62,0|onrvk0,46,63,1|oykorz,46,63,1|oykos0,45,62,0|p6hy7z,45,62,0|p6hy80,46,63,1|pharfz,46,63,1|pharg0,45,62,0|ppkzjz,45,62,0|ppkzk0,46,63,1|q00u3z,46,63,1|q00u40,45,62,0|q8b27z,45,62,0|q8b280,46,63,1|qiqwrz,46,63,1|qiqws0,45,62,0|qr14vz,45,62,0|qr14w0,46,63,1|r1ty3z,46,63,1|r1ty40,45,62,0|r9r7jz,45,62,0|r9r7k0,46,63,1|rkk0rz,46,63,1|rkk0s0,45,62,0|rsha7z,45,62,0|rsha80,46,63,1|s3a3fz,46,63,1|s3a3g0,45,62,0|sbkbjz,45,62,0|sbkbk0,46,63,1|sm063z,46,63,1|sm0640,45,62,0|suae7z,45,62,0|suae80,46,63,1|t4q8rz,46,63,1|t4q8s0,45,62,0|td0gvz,45,62,0|td0gw0,46,63,1|tngbfz,46,63,1|tngbg0,45,62,0|tvqjjz,45,62,0|tvqjk0,46,63,1|u6jcrz,46,63,1|u6jcs0,45,62,0|uegm7z,45,62,0|uegm80,46,63,1|up9ffz,46,63,1|up9fg0,45,62,0|ux6ovz,45,62,0|ux6ow0,46,63,1|v7zi3z,46,63,1|v7zi40,45,62,0|vg9q7z,45,62,0|vg9q80,46,63,1|vqpkrz,46,63,1|vqpks0,45,62,0|vyzsvz,45,62,0|vyzsw0,46,63,1|w9fnfz,46,63,1|w9fng0,45,62,0|whpvjz,45,62,0|whpvk0,46,63,1|wsiorz,46,63,1|wsios0,45,62,0|x0fy7z,45,62,0|x0fy80,46,63,1|xb8rfz,46,63,1|xb8rg0,45,62,0|xj60vz,45,62,0|xj60w0,46,63,1|xtyu3z,46,63,1|xtyu40,45,62,0|y1w3jz,45,62,0|y1w3k0,46,63,1|ycowrz,46,63,1|ycows0,45,62,0|ykz4vz,45,62,0|ykz4w0,46,63,1|yvezfz,46,63,1|yvezg0,45,62,0|z3p7jz,45,62,0|z3p7k0,46,63,1|ze523z,46,63,1|ze5240,45,62,0\",\"America/Metlakatla|,0,140,0|-1hc7qjz,0,141,0|-1078wyv,0,141,0|-1078wyu,51,40,0|-ek1w81,51,40,0|-ek1w80,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-cnov01,69,66,1|-cnov00,51,40,0|-csc81,51,40,0|-csc80,57,66,1|-3fdo1,57,66,1|-3fdo0,51,40,0|5xqfz,51,40,0|5xqg0,57,66,1|faozz,57,66,1|fap00,51,40,0|ont3z,51,40,0|ont40,57,66,1|ydqbz,57,66,1|ydqc0,51,40,0|17qufz,51,40,0|17qug0,57,66,1|1h3szz,57,66,1|1h3t00,51,40,0|1qgx3z,51,40,0|1qgx40,57,66,1|1ztvnz,57,66,1|1ztvo0,51,40,0|23fl3z,51,40,0|23fl40,57,66,1|2ijybz,57,66,1|2ijyc0,51,40,0|2ooefz,51,40,0|2ooeg0,57,66,1|31a0zz,57,66,1|31a100,51,40,0|3an53z,51,40,0|3an540,57,66,1|3kd2bz,57,66,1|3kd2c0,51,40,0|3td7rz,51,40,0|3td7s0,57,66,1|4334zz,57,66,1|433500,51,40,0|4cg93z,51,40,0|4cg940,57,66,1|4lt7nz,57,66,1|4lt7o0,51,40,0|4v6brz,51,40,0|4v6bs0,57,66,1|54jabz,57,66,1|54jac0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,51,40,0|nx4rrz,51,40,0|nx4rs0,37,37,0|o3z57z,37,37,0|o3z580,38,40,1|og7t3z,38,40,1|og7t40,37,37,0|omp7vz,37,37,0|omp7w0,38,40,1|oyxvrz,38,40,1|oyxvs0,37,37,0|p5fajz,37,37,0|p5fak0,38,40,1|phnyfz,38,40,1|phnyg0,51,40,0|plmjrz,51,40,0|plmjs0,37,37,0|po5d7z,37,37,0|po5d80,38,40,1|q0e13z,38,40,1|q0e140,37,37,0|q6vfvz,37,37,0|q6vfw0,38,40,1|qj43rz,38,40,1|qj43s0,37,37,0|qpyh7z,37,37,0|qpyh80,38,40,1|r2753z,38,40,1|r27540,37,37,0|r8ojvz,37,37,0|r8ojw0,38,40,1|rkx7rz,38,40,1|rkx7s0,37,37,0|rremjz,37,37,0|rremk0,38,40,1|s3nafz,38,40,1|s3nag0,37,37,0|sa4p7z,37,37,0|sa4p80,38,40,1|smdd3z,38,40,1|smdd40,37,37,0|ssurvz,37,37,0|ssurw0,38,40,1|t53frz,38,40,1|t53fs0,37,37,0|tbkujz,37,37,0|tbkuk0,38,40,1|tntifz,38,40,1|tntig0,37,37,0|tunvvz,37,37,0|tunvw0,38,40,1|u6wjrz,38,40,1|u6wjs0,37,37,0|uddyjz,37,37,0|uddyk0,38,40,1|upmmfz,38,40,1|upmmg0,37,37,0|uw417z,37,37,0|uw4180,38,40,1|v8cp3z,38,40,1|v8cp40,37,37,0|veu3vz,37,37,0|veu3w0,38,40,1|vr2rrz,38,40,1|vr2rs0,37,37,0|vxk6jz,37,37,0|vxk6k0,38,40,1|w9sufz,38,40,1|w9sug0,37,37,0|wgn7vz,37,37,0|wgn7w0,38,40,1|wsvvrz,38,40,1|wsvvs0,37,37,0|wzdajz,37,37,0|wzdak0,38,40,1|xblyfz,38,40,1|xblyg0,37,37,0|xi3d7z,37,37,0|xi3d80,38,40,1|xuc13z,38,40,1|xuc140,37,37,0|y0tfvz,37,37,0|y0tfw0,38,40,1|yd23rz,38,40,1|yd23s0,37,37,0|yjjijz,37,37,0|yjjik0,38,40,1|yvs6fz,38,40,1|yvs6g0,37,37,0|z29l7z,37,37,0|z29l80,38,40,1|zei93z,38,40,1|zei940,37,37,0\",\"America/Mexico_City|,0,142,0|-p1u4k0,50,66,0|-m7mko1,50,66,0|-m7mko0,45,62,0|-kf67c1,45,62,0|-kf67c0,50,66,0|-k6j3c1,50,66,0|-k6j3c0,45,62,0|-jypm01,45,62,0|-jypm00,50,66,0|-jpan81,50,66,0|-jpan80,45,62,0|-g4n8o1,45,62,0|-g4n8o0,46,63,1|-fxg241,46,63,1|-fxg240,45,62,0|-f60y01,45,62,0|-f60y00,46,63,1|-f07rg1,46,63,1|-f07rg0,45,62,0|-dlc7c1,45,62,0|-dlc7c0,47,63,1|-deaks1,47,63,1|-deaks0,45,62,0|-adljc1,45,62,0|-adljc0,46,63,1|-a4yi41,46,63,1|-a4yi40,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gcwm7z,45,62,0|gcwm80,46,63,1|gkgrfz,46,63,1|gkgrg0,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jft7jz,45,62,0|jft7k0,46,63,1|jqm0rz,46,63,1|jqm0s0,45,62,0|jyw8vz,45,62,0|jyw8w0,46,63,1|k9c3fz,46,63,1|k9c3g0,45,62,0|khmbjz,45,62,0|khmbk0,46,63,1|ks263z,46,63,1|ks2640,45,62,0|l0ce7z,45,62,0|l0ce80,46,63,1|lb57fz,46,63,1|lb57g0,45,62,0|lj2gvz,45,62,0|lj2gw0,46,63,1|ltva3z,46,63,1|ltva40,45,62,0|m1sjjz,45,62,0|m1sjk0,46,63,1|mclcrz,46,63,1|mclcs0,45,62,0|mkvkvz,45,62,0|mkvkw0,46,63,1|mvbffz,46,63,1|mvbfg0,45,62,0|n3lnjz,45,62,0|n3lnk0,46,63,1|ne1i3z,46,63,1|ne1i40,45,62,0|nmbq7z,45,62,0|nmbq80,46,63,1|nwrkrz,46,63,1|nwrks0,45,62,0|o51svz,45,62,0|o51sw0,46,63,1|ofum3z,46,63,1|ofum40,45,62,0|onrvjz,45,62,0|onrvk0,46,63,1|oykorz,46,63,1|oykos0,45,62,0|p6hy7z,45,62,0|p6hy80,46,63,1|pharfz,46,63,1|pharg0,45,62,0|ppkzjz,45,62,0|ppkzk0,46,63,1|q00u3z,46,63,1|q00u40,45,62,0|q8b27z,45,62,0|q8b280,46,63,1|qiqwrz,46,63,1|qiqws0,45,62,0|qr14vz,45,62,0|qr14w0,46,63,1|r1ty3z,46,63,1|r1ty40,45,62,0|r9r7jz,45,62,0|r9r7k0,46,63,1|rkk0rz,46,63,1|rkk0s0,45,62,0|rsha7z,45,62,0|rsha80,46,63,1|s3a3fz,46,63,1|s3a3g0,45,62,0|sbkbjz,45,62,0|sbkbk0,46,63,1|sm063z,46,63,1|sm0640,45,62,0|suae7z,45,62,0|suae80,46,63,1|t4q8rz,46,63,1|t4q8s0,45,62,0|td0gvz,45,62,0|td0gw0,46,63,1|tngbfz,46,63,1|tngbg0,45,62,0|tvqjjz,45,62,0|tvqjk0,46,63,1|u6jcrz,46,63,1|u6jcs0,45,62,0|uegm7z,45,62,0|uegm80,46,63,1|up9ffz,46,63,1|up9fg0,45,62,0|ux6ovz,45,62,0|ux6ow0,46,63,1|v7zi3z,46,63,1|v7zi40,45,62,0|vg9q7z,45,62,0|vg9q80,46,63,1|vqpkrz,46,63,1|vqpks0,45,62,0|vyzsvz,45,62,0|vyzsw0,46,63,1|w9fnfz,46,63,1|w9fng0,45,62,0|whpvjz,45,62,0|whpvk0,46,63,1|wsiorz,46,63,1|wsios0,45,62,0|x0fy7z,45,62,0|x0fy80,46,63,1|xb8rfz,46,63,1|xb8rg0,45,62,0|xj60vz,45,62,0|xj60w0,46,63,1|xtyu3z,46,63,1|xtyu40,45,62,0|y1w3jz,45,62,0|y1w3k0,46,63,1|ycowrz,46,63,1|ycows0,45,62,0|ykz4vz,45,62,0|ykz4w0,46,63,1|yvezfz,46,63,1|yvezg0,45,62,0|z3p7jz,45,62,0|z3p7k0,46,63,1|ze523z,46,63,1|ze5240,45,62,0\",\"America/Miquelon|,0,143,0|-ulmyxk,32,42,0|5e3cfz,32,42,0|5e3cg0,39,44,0|908lvz,39,44,0|908lw0,40,45,1|9aogfz,40,45,1|9aogg0,39,44,0|9iyojz,39,44,0|9iyok0,40,45,1|9trhrz,40,45,1|9trhs0,39,44,0|a1or7z,39,44,0|a1or80,40,45,1|achkfz,40,45,1|achkg0,39,44,0|aketvz,39,44,0|aketw0,40,45,1|av7n3z,40,45,1|av7n40,39,44,0|b3hv7z,39,44,0|b3hv80,40,45,1|bdxprz,40,45,1|bdxps0,39,44,0|bm7xvz,39,44,0|bm7xw0,40,45,1|bwnsfz,40,45,1|bwnsg0,39,44,0|c4y0jz,39,44,0|c4y0k0,40,45,1|cfqtrz,40,45,1|cfqts0,39,44,0|cno37z,39,44,0|cno380,40,45,1|cygwfz,40,45,1|cygwg0,39,44,0|d6e5vz,39,44,0|d6e5w0,40,45,1|dh6z3z,40,45,1|dh6z40,39,44,0|dph77z,39,44,0|dph780,40,45,1|dzx1rz,40,45,1|dzx1s0,39,44,0|e879vz,39,44,0|e879w0,40,45,1|ein4fz,40,45,1|ein4g0,39,44,0|eqxcjz,39,44,0|eqxck0,40,45,1|f1d73z,40,45,1|f1d740,39,44,0|f9nf7z,39,44,0|f9nf80,40,45,1|fkg8fz,40,45,1|fkg8g0,39,44,0|fsdhvz,39,44,0|fsdhw0,40,45,1|g36b3z,40,45,1|g36b40,39,44,0|gb3kjz,39,44,0|gb3kk0,40,45,1|glwdrz,40,45,1|glwds0,39,44,0|gu6lvz,39,44,0|gu6lw0,40,45,1|h4mgfz,40,45,1|h4mgg0,39,44,0|hcwojz,39,44,0|hcwok0,40,45,1|hncj3z,40,45,1|hncj40,39,44,0|hvmr7z,39,44,0|hvmr80,40,45,1|i6fkfz,40,45,1|i6fkg0,39,44,0|iectvz,39,44,0|iectw0,40,45,1|ip5n3z,40,45,1|ip5n40,39,44,0|ix2wjz,39,44,0|ix2wk0,40,45,1|j7vprz,40,45,1|j7vps0,39,44,0|jeq37z,39,44,0|jeq380,40,45,1|jqyr3z,40,45,1|jqyr40,39,44,0|jxg5vz,39,44,0|jxg5w0,40,45,1|k9otrz,40,45,1|k9ots0,39,44,0|kg68jz,39,44,0|kg68k0,40,45,1|ksewfz,40,45,1|ksewg0,39,44,0|kz99vz,39,44,0|kz99w0,40,45,1|lbhxrz,40,45,1|lbhxs0,39,44,0|lhzcjz,39,44,0|lhzck0,40,45,1|lu80fz,40,45,1|lu80g0,39,44,0|m0pf7z,39,44,0|m0pf80,40,45,1|mcy33z,40,45,1|mcy340,39,44,0|mjfhvz,39,44,0|mjfhw0,40,45,1|mvo5rz,40,45,1|mvo5s0,39,44,0|n25kjz,39,44,0|n25kk0,40,45,1|nee8fz,40,45,1|nee8g0,39,44,0|nkvn7z,39,44,0|nkvn80,40,45,1|nx4b3z,40,45,1|nx4b40,39,44,0|o3yojz,39,44,0|o3yok0,40,45,1|og7cfz,40,45,1|og7cg0,39,44,0|omor7z,39,44,0|omor80,40,45,1|oyxf3z,40,45,1|oyxf40,39,44,0|p5etvz,39,44,0|p5etw0,40,45,1|phnhrz,40,45,1|phnhs0,39,44,0|po4wjz,39,44,0|po4wk0,40,45,1|q0dkfz,40,45,1|q0dkg0,39,44,0|q6uz7z,39,44,0|q6uz80,40,45,1|qj3n3z,40,45,1|qj3n40,39,44,0|qpy0jz,39,44,0|qpy0k0,40,45,1|r26ofz,40,45,1|r26og0,39,44,0|r8o37z,39,44,0|r8o380,40,45,1|rkwr3z,40,45,1|rkwr40,39,44,0|rre5vz,39,44,0|rre5w0,40,45,1|s3mtrz,40,45,1|s3mts0,39,44,0|sa48jz,39,44,0|sa48k0,40,45,1|smcwfz,40,45,1|smcwg0,39,44,0|ssub7z,39,44,0|ssub80,40,45,1|t52z3z,40,45,1|t52z40,39,44,0|tbkdvz,39,44,0|tbkdw0,40,45,1|tnt1rz,40,45,1|tnt1s0,39,44,0|tunf7z,39,44,0|tunf80,40,45,1|u6w33z,40,45,1|u6w340,39,44,0|uddhvz,39,44,0|uddhw0,40,45,1|upm5rz,40,45,1|upm5s0,39,44,0|uw3kjz,39,44,0|uw3kk0,40,45,1|v8c8fz,40,45,1|v8c8g0,39,44,0|vetn7z,39,44,0|vetn80,40,45,1|vr2b3z,40,45,1|vr2b40,39,44,0|vxjpvz,39,44,0|vxjpw0,40,45,1|w9sdrz,40,45,1|w9sds0,39,44,0|wgmr7z,39,44,0|wgmr80,40,45,1|wsvf3z,40,45,1|wsvf40,39,44,0|wzctvz,39,44,0|wzctw0,40,45,1|xblhrz,40,45,1|xblhs0,39,44,0|xi2wjz,39,44,0|xi2wk0,40,45,1|xubkfz,40,45,1|xubkg0,39,44,0|y0sz7z,39,44,0|y0sz80,40,45,1|yd1n3z,40,45,1|yd1n40,39,44,0|yjj1vz,39,44,0|yjj1w0,40,45,1|yvrprz,40,45,1|yvrps0,39,44,0|z294jz,39,44,0|z294k0,40,45,1|zehsfz,40,45,1|zehsg0,39,44,0\",\"America/Moncton|,0,144,0|-18wys04,49,63,0|-z94i41,49,63,0|-z94i40,32,42,0|-qzp0o1,32,42,0|-qzp0o0,54,44,1|-qpm4s1,54,44,1|-qpm4s0,32,42,0|-j2ve41,32,42,0|-j2ve40,54,44,1|-iy6y81,54,44,1|-iy6y80,32,42,0|-ik5bg1,32,42,0|-ik5bg0,54,44,1|-ifgvk1,54,44,1|-ifgvk0,32,42,0|-i1f8s1,32,42,0|-i1f8s0,54,44,1|-hwqsw1,54,44,1|-hwqsw0,32,42,0|-hip641,32,42,0|-hip640,54,44,1|-he0q81,54,44,1|-he0q80,32,42,0|-gzz3g1,32,42,0|-gzz3g0,54,44,1|-gvank1,54,44,1|-gvank0,32,42,0|-gh90s1,32,42,0|-gh90s0,54,44,1|-gckkw1,54,44,1|-gckkw0,32,42,0|-fyxrg1,32,42,0|-fyxrg0,54,44,1|-fstgw1,54,44,1|-fstgw0,32,42,0|-fgiss1,32,42,0|-fgiss0,54,44,1|-fa3e81,54,44,1|-fa3e80,32,42,0|-eying1,32,42,0|-eying0,54,44,1|-er0cw1,54,44,1|-er0cw0,32,42,0|-ek27c1,32,42,0|-ek27c0,33,44,1|-cq2tg1,33,44,1|-cq2tg0,34,44,1|-cnp641,34,44,1|-cnp640,32,42,0|-ccw7c1,32,42,0|-ccw7c0,54,44,1|-c4z3g1,54,44,1|-c4z3g0,32,42,0|-bu64o1,32,42,0|-bu64o0,54,44,1|-bm90s1,54,44,1|-bm90s0,32,42,0|-bbg201,32,42,0|-bbg200,54,44,1|-b3iy41,54,44,1|-b3iy40,32,42,0|-aspzc1,32,42,0|-aspzc0,54,44,1|-aksvg1,54,44,1|-aksvg0,32,42,0|-a9my01,32,42,0|-a9my00,54,44,1|-a22ss1,54,44,1|-a22ss0,32,42,0|-9qwvc1,32,42,0|-9qwvc0,54,44,1|-9izrg1,54,44,1|-9izrg0,32,42,0|-986so1,32,42,0|-986so0,54,44,1|-909os1,54,44,1|-909os0,32,42,0|-8pgq01,32,42,0|-8pgq00,54,44,1|-8hjm41,54,44,1|-8hjm40,32,42,0|-86qnc1,32,42,0|-86qnc0,54,44,1|-7ytjg1,54,44,1|-7ytjg0,32,42,0|-7o0ko1,32,42,0|-7o0ko0,54,44,1|-7g3gs1,54,44,1|-7g3gs0,32,42,0|-74xjc1,32,42,0|-74xjc0,54,44,1|-6x0fg1,54,44,1|-6x0fg0,32,42,0|-6m7go1,32,42,0|-6m7go0,54,44,1|-6cui41,54,44,1|-6cui40,32,42,0|-63he01,32,42,0|-63he00,54,44,1|-5u4fg1,54,44,1|-5u4fg0,32,42,0|-5krbc1,32,42,0|-5krbc0,54,44,1|-5becs1,54,44,1|-5becs0,32,42,0|-5218o1,32,42,0|-5218o0,54,44,1|-4sbbg1,54,44,1|-4sbbg0,32,42,0|-4iy7c1,32,42,0|-4iy7c0,54,44,1|-49l8s1,54,44,1|-49l8s0,32,42,0|-4084o1,32,42,0|-4084o0,54,44,1|-3qv641,54,44,1|-3qv640,32,42,0|-3hi201,32,42,0|-3hi200,54,44,1|-3853g1,54,44,1|-3853g0,32,42,0|-2yrzc1,32,42,0|-2yrzc0,54,44,1|-2pf0s1,54,44,1|-2pf0s0,32,42,0|-2g1wo1,32,42,0|-2g1wo0,54,44,1|-26bzg1,54,44,1|-26bzg0,32,42,0|-1xbu01,32,42,0|-1xbu00,54,44,1|-1nlws1,54,44,1|-1nlws0,32,42,0|-1e8so1,32,42,0|-1e8so0,54,44,1|-14vu41,54,44,1|-14vu40,32,42,0|-viq01,32,42,0|-viq00,54,44,1|-m5rg1,54,44,1|-m5rg0,32,42,0|-csnc1,32,42,0|-csnc0,54,44,1|-3fos1,54,44,1|-3fos0,32,42,0|5xfbz,32,42,0|5xfc0,54,44,1|fadvz,54,44,1|fadw0,32,42,0|onhzz,32,42,0|oni00,54,44,1|ydf7z,54,44,1|ydf80,32,42,0|17qjbz,32,42,0|17qjc0,54,44,1|1h3hvz,54,44,1|1h3hw0,32,42,0|296onz,32,42,0|296oo0,54,44,1|2ijn7z,54,44,1|2ijn80,32,42,0|2rwrbz,32,42,0|2rwrc0,54,44,1|319pvz,54,44,1|319pw0,32,42,0|3amtzz,32,42,0|3amu00,54,44,1|3kcr7z,54,44,1|3kcr80,32,42,0|3tcwnz,32,42,0|3tcwo0,54,44,1|432tvz,54,44,1|432tw0,32,42,0|4cfxzz,32,42,0|4cfy00,54,44,1|4lswjz,54,44,1|4lswk0,32,42,0|4v60nz,32,42,0|4v60o0,54,44,1|54iz7z,54,44,1|54iz80,32,42,0|5dw3bz,32,42,0|5dw3c0,54,44,1|5n91vz,54,44,1|5n91w0,32,42,0|5wm5zz,32,42,0|5wm600,54,44,1|65z4jz,54,44,1|65z4k0,32,42,0|6fc8nz,32,42,0|6fc8o0,54,44,1|6p25vz,54,44,1|6p25w0,32,42,0|6y2bbz,32,42,0|6y2bc0,54,44,1|77s8jz,54,44,1|77s8k0,32,42,0|7h5cnz,32,42,0|7h5co0,54,44,1|7qib7z,54,44,1|7qib80,32,42,0|7zvfbz,32,42,0|7zvfc0,54,44,1|898dvz,54,44,1|898dw0,32,42,0|8ilhzz,32,42,0|8ili00,54,44,1|8rygjz,54,44,1|8rygk0,32,42,0|908onz,32,42,0|908oo0,54,44,1|9aoj7z,54,44,1|9aoj80,32,42,0|9iyrbz,32,42,0|9iyrc0,54,44,1|9trkjz,54,44,1|9trkk0,32,42,0|a1otzz,32,42,0|a1ou00,54,44,1|achn7z,54,44,1|achn80,32,42,0|akewnz,32,42,0|akewo0,54,44,1|av7pvz,54,44,1|av7pw0,32,42,0|b3hxzz,32,42,0|b3hy00,54,44,1|bdxsjz,54,44,1|bdxsk0,32,42,0|bm80nz,32,42,0|bm80o0,54,44,1|bwnv7z,54,44,1|bwnv80,32,42,0|c4xxtn,32,42,0|c4xxto,54,44,1|cfqr1n,54,44,1|cfqr1o,32,42,0|cno0hn,32,42,0|cno0ho,54,44,1|cygtpn,54,44,1|cygtpo,32,42,0|d6e35n,32,42,0|d6e35o,54,44,1|dh6wdn,54,44,1|dh6wdo,32,42,0|dph4hn,32,42,0|dph4ho,54,44,1|dzwz1n,54,44,1|dzwz1o,32,42,0|e8775n,32,42,0|e8775o,54,44,1|ein1pn,54,44,1|ein1po,32,42,0|eqx9tn,32,42,0|eqx9to,54,44,1|f1d4dn,54,44,1|f1d4do,32,42,0|f9nchn,32,42,0|f9ncho,54,44,1|fkg5pn,54,44,1|fkg5po,32,42,0|fsdf5n,32,42,0|fsdf5o,54,44,1|g368dn,54,44,1|g368do,32,42,0|gb3htn,32,42,0|gb3hto,54,44,1|glwb1n,54,44,1|glwb1o,32,42,0|gu6j5n,32,42,0|gu6j5o,54,44,1|h4mdpn,54,44,1|h4mdpo,32,42,0|hcwltn,32,42,0|hcwlto,54,44,1|hncgdn,54,44,1|hncgdo,32,42,0|hvmohn,32,42,0|hvmoho,54,44,1|i6fhpn,54,44,1|i6fhpo,32,42,0|iecr5n,32,42,0|iecr5o,54,44,1|ip5kdn,54,44,1|ip5kdo,32,42,0|ix2ttn,32,42,0|ix2tto,54,44,1|j7vn1n,54,44,1|j7vn1o,32,42,0|jeq5zz,32,42,0|jeq600,54,44,1|jqytvz,54,44,1|jqytw0,32,42,0|jxg8nz,32,42,0|jxg8o0,54,44,1|k9owjz,54,44,1|k9owk0,32,42,0|kg6bbz,32,42,0|kg6bc0,54,44,1|ksez7z,54,44,1|ksez80,32,42,0|kz9cnz,32,42,0|kz9co0,54,44,1|lbi0jz,54,44,1|lbi0k0,32,42,0|lhzfbz,32,42,0|lhzfc0,54,44,1|lu837z,54,44,1|lu8380,32,42,0|m0phzz,32,42,0|m0pi00,54,44,1|mcy5vz,54,44,1|mcy5w0,32,42,0|mjfknz,32,42,0|mjfko0,54,44,1|mvo8jz,54,44,1|mvo8k0,32,42,0|n25nbz,32,42,0|n25nc0,54,44,1|neeb7z,54,44,1|neeb80,32,42,0|nkvpzz,32,42,0|nkvq00,54,44,1|nx4dvz,54,44,1|nx4dw0,32,42,0|o3yrbz,32,42,0|o3yrc0,54,44,1|og7f7z,54,44,1|og7f80,32,42,0|omotzz,32,42,0|omou00,54,44,1|oyxhvz,54,44,1|oyxhw0,32,42,0|p5ewnz,32,42,0|p5ewo0,54,44,1|phnkjz,54,44,1|phnkk0,32,42,0|po4zbz,32,42,0|po4zc0,54,44,1|q0dn7z,54,44,1|q0dn80,32,42,0|q6v1zz,32,42,0|q6v200,54,44,1|qj3pvz,54,44,1|qj3pw0,32,42,0|qpy3bz,32,42,0|qpy3c0,54,44,1|r26r7z,54,44,1|r26r80,32,42,0|r8o5zz,32,42,0|r8o600,54,44,1|rkwtvz,54,44,1|rkwtw0,32,42,0|rre8nz,32,42,0|rre8o0,54,44,1|s3mwjz,54,44,1|s3mwk0,32,42,0|sa4bbz,32,42,0|sa4bc0,54,44,1|smcz7z,54,44,1|smcz80,32,42,0|ssudzz,32,42,0|ssue00,54,44,1|t531vz,54,44,1|t531w0,32,42,0|tbkgnz,32,42,0|tbkgo0,54,44,1|tnt4jz,54,44,1|tnt4k0,32,42,0|tunhzz,32,42,0|tuni00,54,44,1|u6w5vz,54,44,1|u6w5w0,32,42,0|uddknz,32,42,0|uddko0,54,44,1|upm8jz,54,44,1|upm8k0,32,42,0|uw3nbz,32,42,0|uw3nc0,54,44,1|v8cb7z,54,44,1|v8cb80,32,42,0|vetpzz,32,42,0|vetq00,54,44,1|vr2dvz,54,44,1|vr2dw0,32,42,0|vxjsnz,32,42,0|vxjso0,54,44,1|w9sgjz,54,44,1|w9sgk0,32,42,0|wgmtzz,32,42,0|wgmu00,54,44,1|wsvhvz,54,44,1|wsvhw0,32,42,0|wzcwnz,32,42,0|wzcwo0,54,44,1|xblkjz,54,44,1|xblkk0,32,42,0|xi2zbz,32,42,0|xi2zc0,54,44,1|xubn7z,54,44,1|xubn80,32,42,0|y0t1zz,32,42,0|y0t200,54,44,1|yd1pvz,54,44,1|yd1pw0,32,42,0|yjj4nz,32,42,0|yjj4o0,54,44,1|yvrsjz,54,44,1|yvrsk0,32,42,0|z297bz,32,42,0|z297c0,54,44,1|zehv7z,54,44,1|zehv80,32,42,0\",\"America/Monterrey|,0,145,0|-p1u7c0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gcwm7z,45,62,0|gcwm80,46,63,1|gkgrfz,46,63,1|gkgrg0,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jft7jz,45,62,0|jft7k0,46,63,1|jqm0rz,46,63,1|jqm0s0,45,62,0|jyw8vz,45,62,0|jyw8w0,46,63,1|k9c3fz,46,63,1|k9c3g0,45,62,0|khmbjz,45,62,0|khmbk0,46,63,1|ks263z,46,63,1|ks2640,45,62,0|l0ce7z,45,62,0|l0ce80,46,63,1|lb57fz,46,63,1|lb57g0,45,62,0|lj2gvz,45,62,0|lj2gw0,46,63,1|ltva3z,46,63,1|ltva40,45,62,0|m1sjjz,45,62,0|m1sjk0,46,63,1|mclcrz,46,63,1|mclcs0,45,62,0|mkvkvz,45,62,0|mkvkw0,46,63,1|mvbffz,46,63,1|mvbfg0,45,62,0|n3lnjz,45,62,0|n3lnk0,46,63,1|ne1i3z,46,63,1|ne1i40,45,62,0|nmbq7z,45,62,0|nmbq80,46,63,1|nwrkrz,46,63,1|nwrks0,45,62,0|o51svz,45,62,0|o51sw0,46,63,1|ofum3z,46,63,1|ofum40,45,62,0|onrvjz,45,62,0|onrvk0,46,63,1|oykorz,46,63,1|oykos0,45,62,0|p6hy7z,45,62,0|p6hy80,46,63,1|pharfz,46,63,1|pharg0,45,62,0|ppkzjz,45,62,0|ppkzk0,46,63,1|q00u3z,46,63,1|q00u40,45,62,0|q8b27z,45,62,0|q8b280,46,63,1|qiqwrz,46,63,1|qiqws0,45,62,0|qr14vz,45,62,0|qr14w0,46,63,1|r1ty3z,46,63,1|r1ty40,45,62,0|r9r7jz,45,62,0|r9r7k0,46,63,1|rkk0rz,46,63,1|rkk0s0,45,62,0|rsha7z,45,62,0|rsha80,46,63,1|s3a3fz,46,63,1|s3a3g0,45,62,0|sbkbjz,45,62,0|sbkbk0,46,63,1|sm063z,46,63,1|sm0640,45,62,0|suae7z,45,62,0|suae80,46,63,1|t4q8rz,46,63,1|t4q8s0,45,62,0|td0gvz,45,62,0|td0gw0,46,63,1|tngbfz,46,63,1|tngbg0,45,62,0|tvqjjz,45,62,0|tvqjk0,46,63,1|u6jcrz,46,63,1|u6jcs0,45,62,0|uegm7z,45,62,0|uegm80,46,63,1|up9ffz,46,63,1|up9fg0,45,62,0|ux6ovz,45,62,0|ux6ow0,46,63,1|v7zi3z,46,63,1|v7zi40,45,62,0|vg9q7z,45,62,0|vg9q80,46,63,1|vqpkrz,46,63,1|vqpks0,45,62,0|vyzsvz,45,62,0|vyzsw0,46,63,1|w9fnfz,46,63,1|w9fng0,45,62,0|whpvjz,45,62,0|whpvk0,46,63,1|wsiorz,46,63,1|wsios0,45,62,0|x0fy7z,45,62,0|x0fy80,46,63,1|xb8rfz,46,63,1|xb8rg0,45,62,0|xj60vz,45,62,0|xj60w0,46,63,1|xtyu3z,46,63,1|xtyu40,45,62,0|y1w3jz,45,62,0|y1w3k0,46,63,1|ycowrz,46,63,1|ycows0,45,62,0|ykz4vz,45,62,0|ykz4w0,46,63,1|yvezfz,46,63,1|yvezg0,45,62,0|z3p7jz,45,62,0|z3p7k0,46,63,1|ze523z,46,63,1|ze5240,45,62,0\",\"America/Montevideo|,0,146,0|-w4mll9,21,146,0|-px809a,21,146,0|-px8099,42,42,0|-o50vk1,42,42,0|-o50vk0,39,44,1|-nvm2c1,39,44,1|-nvm2c0,81,101,0|-nm74y1,81,101,0|-nm74y0,39,44,1|-ncu501,39,44,1|-ncu500,81,101,0|-n3f7m1,81,101,0|-n3f7m0,39,44,1|-mu27o1,39,44,1|-mu27o0,81,101,0|-ivo8y1,81,101,0|-ivo8y0,39,44,1|-inr3o1,39,44,1|-inr3o0,81,101,0|-icy6a1,81,101,0|-icy6a0,39,44,1|-i51101,39,44,1|-i51100,81,101,0|-hu83m1,81,101,0|-hu83m0,39,44,1|-hmayc1,39,44,1|-hmayc0,81,101,0|-hbi0y1,81,101,0|-hbi0y0,39,44,1|-h3kvo1,39,44,1|-h3kvo0,81,101,0|-gsezm1,81,101,0|-gsezm0,39,44,1|-gkut01,39,44,1|-gkut00,81,101,0|-g9owy1,81,101,0|-g9owy0,39,44,1|-g24qc1,39,44,1|-g24qc0,81,101,0|-fseoy1,81,101,0|-fseoy0,39,44,1|-fj1p01,39,44,1|-fj1p00,81,101,0|-f88rm1,81,101,0|-f88rm0,39,44,1|-f0bmc1,39,44,1|-f0bmc0,81,101,0|-etxya1,81,101,0|-etxya0,39,44,1|-e482c1,39,44,1|-e482c0,82,102,1|-dzlfq1,82,102,1|-dzlfq0,39,44,0|-5jbp01,39,44,0|-5jbp00,82,102,1|-5abnq1,82,102,1|-5abnq0,39,44,0|-572yc1,39,44,0|-572yc0,40,45,1|-54kag1,40,45,1|-54kag0,39,44,0|-2h5101,39,44,0|-2h5100,40,45,1|-285141,40,45,1|-285140,39,44,0|-u1901,39,44,0|-u1900,82,102,1|-kd521,82,102,1|-kd520,39,44,0|5vcbz,39,44,0|5vcc0,40,45,1|8fuvz,40,45,1|8fuw0,39,44,0|17dcbz,39,44,0|17dcc0,40,45,1|1botjz,40,45,1|1botk0,39,44,0|23s0bz,39,44,0|23s0c0,83,147,1|26nlhz,83,147,1|26nli0,82,102,1|2fnqxz,82,102,1|2fnqy0,39,44,0|2lf6zz,39,44,0|2lf700,40,45,1|2qgljz,40,45,1|2qglk0,39,44,0|3mvcbz,39,44,0|3mvcc0,40,45,1|3qtuvz,40,45,1|3qtuw0,39,44,0|44vhnz,39,44,0|44vho0,40,45,1|49jxjz,40,45,1|49jxk0,39,44,0|4obhnz,39,44,0|4obho0,40,45,1|4sa07z,40,45,1|4sa080,39,44,0|4v5sbz,39,44,0|4v5sc0,40,45,1|5bq07z,40,45,1|5bq080,39,44,0|9d8yzz,39,44,0|9d8z00,40,45,1|9h5mvz,40,45,1|9h5mw0,39,44,0|9vx6zz,39,44,0|9vx700,40,45,1|a08o7z,40,45,1|a08o80,39,44,0|achhnz,39,44,0|achho0,40,45,1|ails7z,40,45,1|ails80,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b1otjz,40,45,1|b1otk0,39,44,0|bdxmzz,39,44,0|bdxn00,40,45,1|bkew7z,40,45,1|bkew80,39,44,0|bwaqzz,39,44,0|bwar00,40,45,1|c34yvz,40,45,1|c34yw0,39,44,0|i49pnz,39,44,0|i49po0,40,45,1|idzsfz,40,45,1|idzsg0,39,44,0|io2tvz,39,44,0|io2tw0,40,45,1|ivzxrz,40,45,1|ivzxs0,39,44,0|j6fxvz,39,44,0|j6fxw0,40,45,1|jeq0fz,40,45,1|jeq0g0,39,44,0|jpiz7z,39,44,0|jpiz80,40,45,1|jxg33z,40,45,1|jxg340,39,44,0|k891vz,39,44,0|k891w0,40,45,1|kg65rz,40,45,1|kg65s0,39,44,0|kqz4jz,39,44,0|kqz4k0,40,45,1|kz973z,40,45,1|kz9740,39,44,0|l9p77z,39,44,0|l9p780,40,45,1|lhz9rz,40,45,1|lhz9s0,39,44,0|lsf9vz,39,44,0|lsf9w0,40,45,1|m0pcfz,40,45,1|m0pcg0,39,44,0|mbib7z,39,44,0|mbib80,40,45,1|mjff3z,40,45,1|mjff40,39,44,0|mu8dvz,39,44,0|mu8dw0,40,45,1|n25hrz,40,45,1|n25hs0,39,44,0|ncygjz,39,44,0|ncygk0,40,45,1|nkvkfz,40,45,1|nkvkg0,39,44,0\",\"America/Montserrat|,0,41,0|-u6m79w,32,42,0\",\"America/Nassau|,0,148,0|-u6m4c6,49,63,0|-efufg1,49,63,0|-efufg0,70,42,1|-d1oy81,70,42,1|-d1oy80,49,63,0|-d03gs1,49,63,0|-d03gs0,70,42,1|-cq2tg1,70,42,1|-cq2tg0,71,42,1|-cmrww1,71,42,1|-cmrww0,49,63,0|-2yrwk1,49,63,0|-2yrwk0,62,42,1|-2pey01,62,42,1|-2pey00,49,63,0|-2g1tw1,49,63,0|-2g1tw0,62,42,1|-26bwo1,62,42,1|-26bwo0,49,63,0|-1xbr81,49,63,0|-1xbr80,62,42,1|-1nlu01,62,42,1|-1nlu00,49,63,0|-1e8pw1,49,63,0|-1e8pw0,62,42,1|-14vrc1,62,42,1|-14vrc0,49,63,0|-vin81,49,63,0|-vin80,62,42,1|-m5oo1,62,42,1|-m5oo0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|onkrz,49,63,0|onks0,62,42,1|ydhzz,62,42,1|ydi00,49,63,0|17qm3z,49,63,0|17qm40,62,42,1|1h3knz,62,42,1|1h3ko0,49,63,0|1qgorz,49,63,0|1qgos0,62,42,1|1ztnbz,62,42,1|1ztnc0,49,63,0|296rfz,49,63,0|296rg0,62,42,1|2ijpzz,62,42,1|2ijq00,49,63,0|2rwu3z,49,63,0|2rwu40,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/New_York|,0,149,0|-18y0os0,49,63,0|-r0ev81,49,63,0|-r0ev80,62,42,1|-qpm201,62,42,1|-qpm200,49,63,0|-qhosk1,49,63,0|-qhosk0,62,42,1|-q6vzc1,62,42,1|-q6vzc0,49,63,0|-pyypw1,49,63,0|-pyypw0,62,42,1|-pnsy01,62,42,1|-pnsy00,49,63,0|-pessk1,49,63,0|-pessk0,62,42,1|-p6voo1,62,42,1|-p6voo0,49,63,0|-ovpr81,49,63,0|-ovpr80,62,42,1|-oo5m01,62,42,1|-oo5m00,49,63,0|-oczok1,49,63,0|-oczok0,62,42,1|-o52ko1,62,42,1|-o52ko0,49,63,0|-nu9lw1,49,63,0|-nu9lw0,62,42,1|-nmci01,62,42,1|-nmci00,49,63,0|-nbjj81,49,63,0|-nbjj80,62,42,1|-n3mfc1,62,42,1|-n3mfc0,49,63,0|-mstgk1,49,63,0|-mstgk0,62,42,1|-mkwco1,62,42,1|-mkwco0,49,63,0|-ma3dw1,49,63,0|-ma3dw0,62,42,1|-m26a01,62,42,1|-m26a00,49,63,0|-lr0ck1,49,63,0|-lr0ck0,62,42,1|-lj38o1,62,42,1|-lj38o0,49,63,0|-l8a9w1,49,63,0|-l8a9w0,62,42,1|-l0d601,62,42,1|-l0d600,49,63,0|-kpk781,49,63,0|-kpk780,62,42,1|-khn3c1,62,42,1|-khn3c0,49,63,0|-k6u4k1,49,63,0|-k6u4k0,62,42,1|-jyx0o1,62,42,1|-jyx0o0,49,63,0|-jo41w1,49,63,0|-jo41w0,62,42,1|-jg6y01,62,42,1|-jg6y00,49,63,0|-j510k1,49,63,0|-j510k0,62,42,1|-ixgvc1,62,42,1|-ixgvc0,49,63,0|-imaxw1,49,63,0|-imaxw0,62,42,1|-iedu01,62,42,1|-iedu00,49,63,0|-i3kv81,49,63,0|-i3kv80,62,42,1|-hvnrc1,62,42,1|-hvnrc0,49,63,0|-hkusk1,49,63,0|-hkusk0,62,42,1|-hcxoo1,62,42,1|-hcxoo0,49,63,0|-h24pw1,49,63,0|-h24pw0,62,42,1|-gu7m01,62,42,1|-gu7m00,49,63,0|-gjen81,49,63,0|-gjen80,62,42,1|-gbhjc1,62,42,1|-gbhjc0,49,63,0|-g0blw1,49,63,0|-g0blw0,62,42,1|-fsrgo1,62,42,1|-fsrgo0,49,63,0|-fhlj81,49,63,0|-fhlj80,62,42,1|-f9ofc1,62,42,1|-f9ofc0,49,63,0|-eyvgk1,49,63,0|-eyvgk0,62,42,1|-eqyco1,62,42,1|-eqyco0,49,63,0|-ek24k1,49,63,0|-ek24k0,70,42,1|-cq2tg1,70,42,1|-cq2tg0,71,42,1|-cnp3c1,71,42,1|-cnp3c0,49,63,0|-ccw4k1,49,63,0|-ccw4k0,62,42,1|-c4z0o1,62,42,1|-c4z0o0,49,63,0|-bu61w1,49,63,0|-bu61w0,62,42,1|-bm8y01,62,42,1|-bm8y00,49,63,0|-bbfz81,49,63,0|-bbfz80,62,42,1|-b3ivc1,62,42,1|-b3ivc0,49,63,0|-aspwk1,49,63,0|-aspwk0,62,42,1|-aksso1,62,42,1|-aksso0,49,63,0|-a9mv81,49,63,0|-a9mv80,62,42,1|-a22q01,62,42,1|-a22q00,49,63,0|-9qwsk1,49,63,0|-9qwsk0,62,42,1|-9izoo1,62,42,1|-9izoo0,49,63,0|-986pw1,49,63,0|-986pw0,62,42,1|-909m01,62,42,1|-909m00,49,63,0|-8pgn81,49,63,0|-8pgn80,62,42,1|-8hjjc1,62,42,1|-8hjjc0,49,63,0|-86qkk1,49,63,0|-86qkk0,62,42,1|-7ytgo1,62,42,1|-7ytgo0,49,63,0|-7o0hw1,49,63,0|-7o0hw0,62,42,1|-7eako1,62,42,1|-7eako0,49,63,0|-74xgk1,49,63,0|-74xgk0,62,42,1|-6vki01,62,42,1|-6vki00,49,63,0|-6m7dw1,49,63,0|-6m7dw0,62,42,1|-6cufc1,62,42,1|-6cufc0,49,63,0|-63hb81,49,63,0|-63hb80,62,42,1|-5u4co1,62,42,1|-5u4co0,49,63,0|-5kr8k1,49,63,0|-5kr8k0,62,42,1|-5bea01,62,42,1|-5bea00,49,63,0|-5215w1,49,63,0|-5215w0,62,42,1|-4sb8o1,62,42,1|-4sb8o0,49,63,0|-4iy4k1,49,63,0|-4iy4k0,62,42,1|-49l601,62,42,1|-49l600,49,63,0|-4081w1,49,63,0|-4081w0,62,42,1|-3qv3c1,62,42,1|-3qv3c0,49,63,0|-3hhz81,49,63,0|-3hhz80,62,42,1|-3850o1,62,42,1|-3850o0,49,63,0|-2yrwk1,49,63,0|-2yrwk0,62,42,1|-2pey01,62,42,1|-2pey00,49,63,0|-2g1tw1,49,63,0|-2g1tw0,62,42,1|-26bwo1,62,42,1|-26bwo0,49,63,0|-1xbr81,49,63,0|-1xbr80,62,42,1|-1nlu01,62,42,1|-1nlu00,49,63,0|-1e8pw1,49,63,0|-1e8pw0,62,42,1|-14vrc1,62,42,1|-14vrc0,49,63,0|-vin81,49,63,0|-vin80,62,42,1|-m5oo1,62,42,1|-m5oo0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|onkrz,49,63,0|onks0,62,42,1|ydhzz,62,42,1|ydi00,49,63,0|17qm3z,49,63,0|17qm40,62,42,1|1h3knz,62,42,1|1h3ko0,49,63,0|1qgorz,49,63,0|1qgos0,62,42,1|1ztnbz,62,42,1|1ztnc0,49,63,0|23fcrz,49,63,0|23fcs0,62,42,1|2ijpzz,62,42,1|2ijq00,49,63,0|2oo63z,49,63,0|2oo640,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Nipigon|,0,150,0|-1353bnk,49,63,0|-qzoxw1,49,63,0|-qzoxw0,62,42,1|-qpm201,62,42,1|-qpm200,49,63,0|-f9oi41,49,63,0|-f9oi40,62,42,1|-ek24k1,62,42,1|-ek24k0,70,42,1|-cq2tg1,70,42,1|-cq2tg0,71,42,1|-cnp3c1,71,42,1|-cnp3c0,49,63,0|296rfz,49,63,0|296rg0,62,42,1|2ijpzz,62,42,1|2ijq00,49,63,0|2rwu3z,49,63,0|2rwu40,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Nome|,0,151,0|-1hc7qjz,0,152,0|-1078qpb,0,152,0|-1078qpa,24,35,0|-ek1nw1,24,35,0|-ek1nw0,25,36,1|-cq2tg1,25,36,1|-cq2tg0,26,36,1|-cnomo1,26,36,1|-cnomo0,24,35,0|-1fq441,24,35,0|-1fq440,27,35,0|-cs3w1,27,35,0|-cs3w0,28,36,1|-3f5c1,28,36,1|-3f5c0,27,35,0|5xyrz,27,35,0|5xys0,28,36,1|faxbz,28,36,1|faxc0,27,35,0|oo1fz,27,35,0|oo1g0,28,36,1|ydynz,28,36,1|ydyo0,27,35,0|17r2rz,27,35,0|17r2s0,28,36,1|1h41bz,28,36,1|1h41c0,27,35,0|1qh5fz,27,35,0|1qh5g0,28,36,1|1zu3zz,28,36,1|1zu400,27,35,0|23ftfz,27,35,0|23ftg0,28,36,1|2ik6nz,28,36,1|2ik6o0,27,35,0|2oomrz,27,35,0|2ooms0,28,36,1|31a9bz,28,36,1|31a9c0,27,35,0|3andfz,27,35,0|3andg0,28,36,1|3kdanz,28,36,1|3kdao0,27,35,0|3tdg3z,27,35,0|3tdg40,28,36,1|433dbz,28,36,1|433dc0,27,35,0|4cghfz,27,35,0|4cghg0,28,36,1|4ltfzz,28,36,1|4ltg00,27,35,0|4v6k3z,27,35,0|4v6k40,28,36,1|54jinz,28,36,1|54jio0,27,35,0|5dwmrz,27,35,0|5dwms0,28,36,1|5n9lbz,28,36,1|5n9lc0,27,35,0|5wmpfz,27,35,0|5wmpg0,28,36,1|65znzz,28,36,1|65zo00,27,35,0|6fcs3z,27,35,0|6fcs40,28,36,1|6p2pbz,28,36,1|6p2pc0,27,35,0|6y2urz,27,35,0|6y2us0,28,36,1|77srzz,28,36,1|77ss00,36,37,0|79dybz,36,37,0|79dyc0,37,37,0|7h5qjz,37,37,0|7h5qk0,38,40,1|7qip3z,38,40,1|7qip40,37,37,0|7zvt7z,37,37,0|7zvt80,38,40,1|898rrz,38,40,1|898rs0,37,37,0|8ilvvz,37,37,0|8ilvw0,38,40,1|8ryufz,38,40,1|8ryug0,37,37,0|9092jz,37,37,0|9092k0,38,40,1|9aox3z,38,40,1|9aox40,37,37,0|9iz57z,37,37,0|9iz580,38,40,1|9tryfz,38,40,1|9tryg0,37,37,0|a1p7vz,37,37,0|a1p7w0,38,40,1|aci13z,38,40,1|aci140,37,37,0|akfajz,37,37,0|akfak0,38,40,1|av83rz,38,40,1|av83s0,37,37,0|b3ibvz,37,37,0|b3ibw0,38,40,1|bdy6fz,38,40,1|bdy6g0,37,37,0|bm8ejz,37,37,0|bm8ek0,38,40,1|bwo93z,38,40,1|bwo940,37,37,0|c4yh7z,37,37,0|c4yh80,38,40,1|cfrafz,38,40,1|cfrag0,37,37,0|cnojvz,37,37,0|cnojw0,38,40,1|cyhd3z,38,40,1|cyhd40,37,37,0|d6emjz,37,37,0|d6emk0,38,40,1|dh7frz,38,40,1|dh7fs0,37,37,0|dphnvz,37,37,0|dphnw0,38,40,1|dzxifz,38,40,1|dzxig0,37,37,0|e87qjz,37,37,0|e87qk0,38,40,1|einl3z,38,40,1|einl40,37,37,0|eqxt7z,37,37,0|eqxt80,38,40,1|f1dnrz,38,40,1|f1dns0,37,37,0|f9nvvz,37,37,0|f9nvw0,38,40,1|fkgp3z,38,40,1|fkgp40,37,37,0|fsdyjz,37,37,0|fsdyk0,38,40,1|g36rrz,38,40,1|g36rs0,37,37,0|gb417z,37,37,0|gb4180,38,40,1|glwufz,38,40,1|glwug0,37,37,0|gu72jz,37,37,0|gu72k0,38,40,1|h4mx3z,38,40,1|h4mx40,37,37,0|hcx57z,37,37,0|hcx580,38,40,1|hnczrz,38,40,1|hnczs0,37,37,0|hvn7vz,37,37,0|hvn7w0,38,40,1|i6g13z,38,40,1|i6g140,37,37,0|iedajz,37,37,0|iedak0,38,40,1|ip63rz,38,40,1|ip63s0,37,37,0|ix3d7z,37,37,0|ix3d80,38,40,1|j7w6fz,38,40,1|j7w6g0,37,37,0|jeqjvz,37,37,0|jeqjw0,38,40,1|jqz7rz,38,40,1|jqz7s0,37,37,0|jxgmjz,37,37,0|jxgmk0,38,40,1|k9pafz,38,40,1|k9pag0,37,37,0|kg6p7z,37,37,0|kg6p80,38,40,1|ksfd3z,38,40,1|ksfd40,37,37,0|kz9qjz,37,37,0|kz9qk0,38,40,1|lbiefz,38,40,1|lbieg0,37,37,0|lhzt7z,37,37,0|lhzt80,38,40,1|lu8h3z,38,40,1|lu8h40,37,37,0|m0pvvz,37,37,0|m0pvw0,38,40,1|mcyjrz,38,40,1|mcyjs0,37,37,0|mjfyjz,37,37,0|mjfyk0,38,40,1|mvomfz,38,40,1|mvomg0,37,37,0|n2617z,37,37,0|n26180,38,40,1|neep3z,38,40,1|neep40,37,37,0|nkw3vz,37,37,0|nkw3w0,38,40,1|nx4rrz,38,40,1|nx4rs0,37,37,0|o3z57z,37,37,0|o3z580,38,40,1|og7t3z,38,40,1|og7t40,37,37,0|omp7vz,37,37,0|omp7w0,38,40,1|oyxvrz,38,40,1|oyxvs0,37,37,0|p5fajz,37,37,0|p5fak0,38,40,1|phnyfz,38,40,1|phnyg0,37,37,0|po5d7z,37,37,0|po5d80,38,40,1|q0e13z,38,40,1|q0e140,37,37,0|q6vfvz,37,37,0|q6vfw0,38,40,1|qj43rz,38,40,1|qj43s0,37,37,0|qpyh7z,37,37,0|qpyh80,38,40,1|r2753z,38,40,1|r27540,37,37,0|r8ojvz,37,37,0|r8ojw0,38,40,1|rkx7rz,38,40,1|rkx7s0,37,37,0|rremjz,37,37,0|rremk0,38,40,1|s3nafz,38,40,1|s3nag0,37,37,0|sa4p7z,37,37,0|sa4p80,38,40,1|smdd3z,38,40,1|smdd40,37,37,0|ssurvz,37,37,0|ssurw0,38,40,1|t53frz,38,40,1|t53fs0,37,37,0|tbkujz,37,37,0|tbkuk0,38,40,1|tntifz,38,40,1|tntig0,37,37,0|tunvvz,37,37,0|tunvw0,38,40,1|u6wjrz,38,40,1|u6wjs0,37,37,0|uddyjz,37,37,0|uddyk0,38,40,1|upmmfz,38,40,1|upmmg0,37,37,0|uw417z,37,37,0|uw4180,38,40,1|v8cp3z,38,40,1|v8cp40,37,37,0|veu3vz,37,37,0|veu3w0,38,40,1|vr2rrz,38,40,1|vr2rs0,37,37,0|vxk6jz,37,37,0|vxk6k0,38,40,1|w9sufz,38,40,1|w9sug0,37,37,0|wgn7vz,37,37,0|wgn7w0,38,40,1|wsvvrz,38,40,1|wsvvs0,37,37,0|wzdajz,37,37,0|wzdak0,38,40,1|xblyfz,38,40,1|xblyg0,37,37,0|xi3d7z,37,37,0|xi3d80,38,40,1|xuc13z,38,40,1|xuc140,37,37,0|y0tfvz,37,37,0|y0tfw0,38,40,1|yd23rz,38,40,1|yd23s0,37,37,0|yjjijz,37,37,0|yjjik0,38,40,1|yvs6fz,38,40,1|yvs6g0,37,37,0|z29l7z,37,37,0|z29l80,38,40,1|zei93z,38,40,1|zei940,37,37,0\",\"America/Noronha|,0,153,0|-t85lzw,40,45,0|-jyld81,40,45,0|-jyld80,13,15,1|-jpb3w1,13,15,1|-jpb3w0,40,45,0|-jfsfs1,40,45,0|-jfsfs0,13,15,1|-j6j6k1,13,15,1|-j6j6k0,40,45,0|-ahd141,40,45,0|-ahd140,13,15,1|-aad6g1,13,15,1|-aad6g0,40,45,0|-9yl3s1,40,45,0|-9yl3s0,13,15,1|-9sd3w1,13,15,1|-9sd3w0,40,45,0|-9ft6g1,40,45,0|-9ft6g0,13,15,1|-99jbw1,13,15,1|-99jbw0,40,45,0|-8wzeg1,40,45,0|-8wzeg0,13,15,1|-8sct81,13,15,1|-8sct80,40,45,0|-35xp41,40,45,0|-35xp40,13,15,1|-31o2k1,13,15,1|-31o2k0,40,45,0|-2kdrs1,40,45,0|-2kdrs0,13,15,1|-2hcl81,13,15,1|-2hcl80,40,45,0|-24qt41,40,45,0|-24qt40,13,15,1|-2047w1,13,15,1|-2047w0,40,45,0|-1nifs1,40,45,0|-1nifs0,13,15,1|-1hcak1,13,15,1|-1hcak0,40,45,0|-14qig1,40,45,0|-14qig0,13,15,1|-yiik1,13,15,1|-yiik0,40,45,0|89j9jz,40,45,0|89j9k0,13,15,1|8gdhfz,13,15,1|8gdhg0,40,45,0|8rwdjz,40,45,0|8rwdk0,13,15,1|8xnpfz,13,15,1|8xnpg0,40,45,0|9aoavz,40,45,0|9aoaw0,13,15,1|9g2o3z,13,15,1|9g2o40,40,45,0|9t1evz,40,45,0|9t1ew0,13,15,1|9yfs3z,13,15,1|9yfs40,40,45,0|abrhjz,40,45,0|abrhk0,13,15,1|ahvs3z,13,15,1|ahvs40,40,45,0|fj087z,40,45,0|fj0880,13,15,1|fqkdfz,13,15,1|fqkdg0,40,45,0|g239jz,40,45,0|g239k0,13,15,1|g2g5fz,13,15,1|g2g5g0,40,45,0|gl6avz,40,45,0|gl6aw0,13,15,1|grnk3z,13,15,1|grnk40,40,45,0\",\"America/North_Dakota/Beulah|,0,154,0|-18y0j80,50,66,0|-r0epo1,50,66,0|-r0epo0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-qhon01,50,66,0|-qhon00,52,62,1|-q6vts1,52,62,1|-q6vts0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-1e8kc1,50,66,0|-1e8kc0,52,62,1|-14vls1,52,62,1|-14vls0,50,66,0|-viho1,50,66,0|-viho0,52,62,1|-m5j41,52,62,1|-m5j40,50,66,0|-csf01,50,66,0|-csf00,52,62,1|-3fgg1,52,62,1|-3fgg0,50,66,0|5xnnz,50,66,0|5xno0,52,62,1|fam7z,52,62,1|fam80,50,66,0|onqbz,50,66,0|onqc0,52,62,1|ydnjz,52,62,1|ydnk0,50,66,0|17qrnz,50,66,0|17qro0,52,62,1|1h3q7z,52,62,1|1h3q80,50,66,0|1qgubz,50,66,0|1qguc0,52,62,1|1ztsvz,52,62,1|1ztsw0,50,66,0|23fibz,50,66,0|23fic0,52,62,1|2ijvjz,52,62,1|2ijvk0,50,66,0|2oobnz,50,66,0|2oobo0,52,62,1|319y7z,52,62,1|319y80,50,66,0|3an2bz,50,66,0|3an2c0,52,62,1|3kczjz,52,62,1|3kczk0,50,66,0|3td4zz,50,66,0|3td500,52,62,1|43327z,52,62,1|433280,50,66,0|4cg6bz,50,66,0|4cg6c0,52,62,1|4lt4vz,52,62,1|4lt4w0,50,66,0|4v68zz,50,66,0|4v6900,52,62,1|54j7jz,52,62,1|54j7k0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gb3vnz,50,66,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jeqebz,50,66,0|jeqec0,52,62,1|jqz27z,52,62,1|jqz280,50,66,0|jxggzz,50,66,0|jxgh00,52,62,1|k9p4vz,52,62,1|k9p4w0,50,66,0|kg6jnz,50,66,0|kg6jo0,52,62,1|ksf7jz,52,62,1|ksf7k0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/North_Dakota/Center|,0,155,0|-18y0j80,50,66,0|-r0epo1,50,66,0|-r0epo0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-qhon01,50,66,0|-qhon00,52,62,1|-q6vts1,52,62,1|-q6vts0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-1e8kc1,50,66,0|-1e8kc0,52,62,1|-14vls1,52,62,1|-14vls0,50,66,0|-viho1,50,66,0|-viho0,52,62,1|-m5j41,52,62,1|-m5j40,50,66,0|-csf01,50,66,0|-csf00,52,62,1|-3fgg1,52,62,1|-3fgg0,50,66,0|5xnnz,50,66,0|5xno0,52,62,1|fam7z,52,62,1|fam80,50,66,0|onqbz,50,66,0|onqc0,52,62,1|ydnjz,52,62,1|ydnk0,50,66,0|17qrnz,50,66,0|17qro0,52,62,1|1h3q7z,52,62,1|1h3q80,50,66,0|1qgubz,50,66,0|1qguc0,52,62,1|1ztsvz,52,62,1|1ztsw0,50,66,0|23fibz,50,66,0|23fic0,52,62,1|2ijvjz,52,62,1|2ijvk0,50,66,0|2oobnz,50,66,0|2oobo0,52,62,1|319y7z,52,62,1|319y80,50,66,0|3an2bz,50,66,0|3an2c0,52,62,1|3kczjz,52,62,1|3kczk0,50,66,0|3td4zz,50,66,0|3td500,52,62,1|43327z,52,62,1|433280,50,66,0|4cg6bz,50,66,0|4cg6c0,52,62,1|4lt4vz,52,62,1|4lt4w0,50,66,0|4v68zz,50,66,0|4v6900,52,62,1|54j7jz,52,62,1|54j7k0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr23z,46,63,1|cfr240,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh4rz,46,63,1|cyh4s0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh77fz,46,63,1|dh77g0,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gb3svz,45,62,0|gb3sw0,46,63,1|glwm3z,46,63,1|glwm40,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/North_Dakota/New_Salem|,0,156,0|-18y0j80,50,66,0|-r0epo1,50,66,0|-r0epo0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-qhon01,50,66,0|-qhon00,52,62,1|-q6vts1,52,62,1|-q6vts0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-1e8kc1,50,66,0|-1e8kc0,52,62,1|-14vls1,52,62,1|-14vls0,50,66,0|-viho1,50,66,0|-viho0,52,62,1|-m5j41,52,62,1|-m5j40,50,66,0|-csf01,50,66,0|-csf00,52,62,1|-3fgg1,52,62,1|-3fgg0,50,66,0|5xnnz,50,66,0|5xno0,52,62,1|fam7z,52,62,1|fam80,50,66,0|onqbz,50,66,0|onqc0,52,62,1|ydnjz,52,62,1|ydnk0,50,66,0|17qrnz,50,66,0|17qro0,52,62,1|1h3q7z,52,62,1|1h3q80,50,66,0|1qgubz,50,66,0|1qguc0,52,62,1|1ztsvz,52,62,1|1ztsw0,50,66,0|23fibz,50,66,0|23fic0,52,62,1|2ijvjz,52,62,1|2ijvk0,50,66,0|2oobnz,50,66,0|2oobo0,52,62,1|319y7z,52,62,1|319y80,50,66,0|3an2bz,50,66,0|3an2c0,52,62,1|3kczjz,52,62,1|3kczk0,50,66,0|3td4zz,50,66,0|3td500,52,62,1|43327z,52,62,1|433280,50,66,0|4cg6bz,50,66,0|4cg6c0,52,62,1|4lt4vz,52,62,1|4lt4w0,50,66,0|4v68zz,50,66,0|4v6900,52,62,1|54j7jz,52,62,1|54j7k0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gb3vnz,50,66,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Nuuk|,0,157,0|-rvumf4,39,44,0|5ct4jz,39,44,0|5ct4k0,40,45,1|5lsw3z,40,45,1|5lsw40,39,44,0|5v5xfz,39,44,0|5v5xg0,40,45,1|64iyrz,40,45,1|64iys0,39,44,0|6dw03z,39,44,0|6dw040,40,45,1|6n91fz,40,45,1|6n91g0,39,44,0|6wm2rz,39,44,0|6wm2s0,40,45,1|75z43z,40,45,1|75z440,39,44,0|7fc5fz,39,44,0|7fc5g0,40,45,1|7p25fz,40,45,1|7p25g0,39,44,0|7yf6rz,39,44,0|7yf6s0,40,45,1|87s83z,40,45,1|87s840,39,44,0|8h59fz,39,44,0|8h59g0,40,45,1|8qiarz,40,45,1|8qias0,39,44,0|8zvc3z,39,44,0|8zvc40,40,45,1|998dfz,40,45,1|998dg0,39,44,0|9ilerz,39,44,0|9iles0,40,45,1|9ryg3z,40,45,1|9ryg40,39,44,0|a1bhfz,39,44,0|a1bhg0,40,45,1|aaoirz,40,45,1|aaois0,39,44,0|ak1k3z,39,44,0|ak1k40,40,45,1|atrk3z,40,45,1|atrk40,39,44,0|b34lfz,39,44,0|b34lg0,40,45,1|bchmrz,40,45,1|bchms0,39,44,0|bluo3z,39,44,0|bluo40,40,45,1|bv7pfz,40,45,1|bv7pg0,39,44,0|c4kqrz,39,44,0|c4kqs0,40,45,1|cdxs3z,40,45,1|cdxs40,39,44,0|cnatfz,39,44,0|cnatg0,40,45,1|cwnurz,40,45,1|cwnus0,39,44,0|d60w3z,39,44,0|d60w40,40,45,1|dfdxfz,40,45,1|dfdxg0,39,44,0|dp3xfz,39,44,0|dp3xg0,40,45,1|dzwtfz,40,45,1|dzwtg0,39,44,0|e7u03z,39,44,0|e7u040,40,45,1|eimw3z,40,45,1|eimw40,39,44,0|eqk2rz,39,44,0|eqk2s0,40,45,1|f1cyrz,40,45,1|f1cys0,39,44,0|f9a5fz,39,44,0|f9a5g0,40,45,1|fkg03z,40,45,1|fkg040,39,44,0|fs083z,39,44,0|fs0840,40,45,1|g362rz,40,45,1|g362s0,39,44,0|gaqarz,39,44,0|gaqas0,40,45,1|glw5fz,40,45,1|glw5g0,39,44,0|gttc3z,39,44,0|gttc40,40,45,1|h4m83z,40,45,1|h4m840,39,44,0|hcjerz,39,44,0|hcjes0,40,45,1|hncarz,40,45,1|hncas0,39,44,0|hv9hfz,39,44,0|hv9hg0,40,45,1|i6fc3z,40,45,1|i6fc40,39,44,0|idzk3z,39,44,0|idzk40,40,45,1|ip5erz,40,45,1|ip5es0,39,44,0|iwpmrz,39,44,0|iwpms0,40,45,1|j7vhfz,40,45,1|j7vhg0,39,44,0|jffpfz,39,44,0|jffpg0,40,45,1|jqlk3z,40,45,1|jqlk40,39,44,0|jyiqrz,39,44,0|jyiqs0,40,45,1|k9bmrz,40,45,1|k9bms0,39,44,0|kh8tfz,39,44,0|kh8tg0,40,45,1|ks1pfz,40,45,1|ks1pg0,39,44,0|kzyw3z,39,44,0|kzyw40,40,45,1|lb4qrz,40,45,1|lb4qs0,39,44,0|lioyrz,39,44,0|lioys0,40,45,1|ltutfz,40,45,1|ltutg0,39,44,0|m1f1fz,39,44,0|m1f1g0,40,45,1|mckw3z,40,45,1|mckw40,39,44,0|mki2rz,39,44,0|mki2s0,40,45,1|mvayrz,40,45,1|mvays0,39,44,0|n385fz,39,44,0|n385g0,40,45,1|ne11fz,40,45,1|ne11g0,39,44,0|nly83z,39,44,0|nly840,40,45,1|nwr43z,40,45,1|nwr440,39,44,0|o4oarz,39,44,0|o4oas0,40,45,1|ofu5fz,40,45,1|ofu5g0,39,44,0|onedfz,39,44,0|onedg0,40,45,1|oyk83z,40,45,1|oyk840,39,44,0|p64g3z,39,44,0|p64g40,40,45,1|phaarz,40,45,1|phaas0,39,44,0|pp7hfz,39,44,0|pp7hg0,40,45,1|q00dfz,40,45,1|q00dg0,39,44,0|q7xk3z,39,44,0|q7xk40,40,45,1|qiqg3z,40,45,1|qiqg40,39,44,0|qqnmrz,39,44,0|qqnms0,40,45,1|r1thfz,40,45,1|r1thg0,39,44,0|r9dpfz,39,44,0|r9dpg0,40,45,1|rkjk3z,40,45,1|rkjk40,39,44,0|rs3s3z,39,44,0|rs3s40,40,45,1|s39mrz,40,45,1|s39ms0,39,44,0|sb6tfz,39,44,0|sb6tg0,40,45,1|slzpfz,40,45,1|slzpg0,39,44,0|stww3z,39,44,0|stww40,40,45,1|t4ps3z,40,45,1|t4ps40,39,44,0|tcmyrz,39,44,0|tcmys0,40,45,1|tnfurz,40,45,1|tnfus0,39,44,0|tvd1fz,39,44,0|tvd1g0,40,45,1|u6iw3z,40,45,1|u6iw40,39,44,0|ue343z,39,44,0|ue3440,40,45,1|up8yrz,40,45,1|up8ys0,39,44,0|uwt6rz,39,44,0|uwt6s0,40,45,1|v7z1fz,40,45,1|v7z1g0,39,44,0|vfw83z,39,44,0|vfw840,40,45,1|vqp43z,40,45,1|vqp440,39,44,0|vymarz,39,44,0|vymas0,40,45,1|w9f6rz,40,45,1|w9f6s0,39,44,0|whcdfz,39,44,0|whcdg0,40,45,1|wsi83z,40,45,1|wsi840,39,44,0|x02g3z,39,44,0|x02g40,40,45,1|xb8arz,40,45,1|xb8as0,39,44,0|xisirz,39,44,0|xisis0,40,45,1|xtydfz,40,45,1|xtydg0,39,44,0|y1ilfz,39,44,0|y1ilg0,40,45,1|ycog3z,40,45,1|ycog40,39,44,0|yklmrz,39,44,0|yklms0,40,45,1|yveirz,40,45,1|yveis0,39,44,0|z3bpfz,39,44,0|z3bpg0,40,45,1|ze4lfz,40,45,1|ze4lg0,39,44,0\",\"America/Ojinaga|,0,158,0|-p1u4k0,50,66,0|-m7mko1,50,66,0|-m7mko0,45,62,0|-kf67c1,45,62,0|-kf67c0,50,66,0|-k6j3c1,50,66,0|-k6j3c0,45,62,0|-jypm01,45,62,0|-jypm00,50,66,0|-jpan81,50,66,0|-jpan80,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxnnz,45,62,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gcwozz,50,66,0|gcwp00,52,62,1|gkgu7z,52,62,1|gkgu80,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jftabz,50,66,0|jftac0,52,62,1|jqm3jz,52,62,1|jqm3k0,50,66,0|jywbnz,50,66,0|jywbo0,52,62,1|k9c67z,52,62,1|k9c680,50,66,0|khmebz,50,66,0|khmec0,52,62,1|ks28vz,52,62,1|ks28w0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,50,66,0|lhznnz,50,66,0|lhzno0,52,62,1|lu8bjz,52,62,1|lu8bk0,50,66,0|m0pqbz,50,66,0|m0pqc0,52,62,1|mcye7z,52,62,1|mcye80,50,66,0|mjfszz,50,66,0|mjft00,52,62,1|mvogvz,52,62,1|mvogw0,50,66,0|n25vnz,50,66,0|n25vo0,52,62,1|neejjz,52,62,1|neejk0,50,66,0|nkvybz,50,66,0|nkvyc0,52,62,1|nx4m7z,52,62,1|nx4m80,50,66,0|o3yznz,50,66,0|o3yzo0,52,62,1|og7njz,52,62,1|og7nk0,50,66,0|omp2bz,50,66,0|omp2c0,52,62,1|oyxq7z,52,62,1|oyxq80,50,66,0|p5f4zz,50,66,0|p5f500,52,62,1|phnsvz,52,62,1|phnsw0,50,66,0|po57nz,50,66,0|po57o0,52,62,1|q0dvjz,52,62,1|q0dvk0,50,66,0|q6vabz,50,66,0|q6vac0,52,62,1|qj3y7z,52,62,1|qj3y80,50,66,0|qpybnz,50,66,0|qpybo0,52,62,1|r26zjz,52,62,1|r26zk0,50,66,0|r8oebz,50,66,0|r8oec0,52,62,1|rkx27z,52,62,1|rkx280,50,66,0|rregzz,50,66,0|rreh00,52,62,1|s3n4vz,52,62,1|s3n4w0,50,66,0|sa4jnz,50,66,0|sa4jo0,52,62,1|smd7jz,52,62,1|smd7k0,50,66,0|ssumbz,50,66,0|ssumc0,52,62,1|t53a7z,52,62,1|t53a80,50,66,0|tbkozz,50,66,0|tbkp00,52,62,1|tntcvz,52,62,1|tntcw0,50,66,0|tunqbz,50,66,0|tunqc0,52,62,1|u6we7z,52,62,1|u6we80,50,66,0|uddszz,50,66,0|uddt00,52,62,1|upmgvz,52,62,1|upmgw0,50,66,0|uw3vnz,50,66,0|uw3vo0,52,62,1|v8cjjz,52,62,1|v8cjk0,50,66,0|vetybz,50,66,0|vetyc0,52,62,1|vr2m7z,52,62,1|vr2m80,50,66,0|vxk0zz,50,66,0|vxk100,52,62,1|w9sovz,52,62,1|w9sow0,50,66,0|wgn2bz,50,66,0|wgn2c0,52,62,1|wsvq7z,52,62,1|wsvq80,50,66,0|wzd4zz,50,66,0|wzd500,52,62,1|xblsvz,52,62,1|xblsw0,50,66,0|xi37nz,50,66,0|xi37o0,52,62,1|xubvjz,52,62,1|xubvk0,50,66,0|y0tabz,50,66,0|y0tac0,52,62,1|yd1y7z,52,62,1|yd1y80,50,66,0|yjjczz,50,66,0|yjjd00,52,62,1|yvs0vz,52,62,1|yvs0w0,50,66,0|z29fnz,50,66,0|z29fo0,52,62,1|zei3jz,52,62,1|zei3k0,50,66,0\",\"America/Panama|,0,80,0|-15r0uls,41,81,0|-w757vd,41,81,0|-w757vc,49,63,0\",\"America/Pangnirtung|,60,1,0|-pkmlc0,32,42,0|-ek27c1,32,42,0|-ek27c0,33,44,1|-cq2tg1,33,44,1|-cq2tg0,34,44,1|-cnp641,34,44,1|-cnp640,32,42,0|-2g2281,32,42,0|-2g2280,73,45,1|-26c281,73,45,1|-26c280,32,42,0|5dw3bz,32,42,0|5dw3c0,54,44,1|5n91vz,54,44,1|5n91w0,32,42,0|5wm5zz,32,42,0|5wm600,54,44,1|65z4jz,54,44,1|65z4k0,32,42,0|6fc8nz,32,42,0|6fc8o0,54,44,1|6p25vz,54,44,1|6p25w0,32,42,0|6y2bbz,32,42,0|6y2bc0,54,44,1|77s8jz,54,44,1|77s8k0,32,42,0|7h5cnz,32,42,0|7h5co0,54,44,1|7qib7z,54,44,1|7qib80,32,42,0|7zvfbz,32,42,0|7zvfc0,54,44,1|898dvz,54,44,1|898dw0,32,42,0|8ilhzz,32,42,0|8ili00,54,44,1|8rygjz,54,44,1|8rygk0,32,42,0|908onz,32,42,0|908oo0,54,44,1|9aoj7z,54,44,1|9aoj80,32,42,0|9iyrbz,32,42,0|9iyrc0,54,44,1|9trkjz,54,44,1|9trkk0,32,42,0|a1otzz,32,42,0|a1ou00,54,44,1|achn7z,54,44,1|achn80,32,42,0|akewnz,32,42,0|akewo0,54,44,1|av7pvz,54,44,1|av7pw0,32,42,0|b3hxzz,32,42,0|b3hy00,54,44,1|bdxsjz,54,44,1|bdxsk0,32,42,0|bm80nz,32,42,0|bm80o0,54,44,1|bwnv7z,54,44,1|bwnv80,32,42,0|c4y3bz,32,42,0|c4y3c0,54,44,1|cfqwjz,54,44,1|cfqwk0,32,42,0|cno5zz,32,42,0|cno600,54,44,1|cygz7z,54,44,1|cygz80,32,42,0|d6e8nz,32,42,0|d6e8o0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Paramaribo|,0,159,0|-usj4g8,7,160,0|-i9lsfx,7,160,0|-i9lsfw,7,161,0|-cnnf4d,7,161,0|-cnnf4c,81,101,0|7p471z,81,101,0|7p4720,39,44,0\",\"America/Phoenix|,0,162,0|-18y0j80,50,66,0|-r0epo1,50,66,0|-r0epo0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-qhon01,50,66,0|-qhon00,52,62,1|-q6vts1,52,62,1|-q6vts0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-dkikmd,58,62,1|-dkikmc,50,66,0|-dftz6d,50,66,0|-dftz6c,58,62,1|-d6f5yd,58,62,1|-d6f5yc,50,66,0|-1e8kc1,50,66,0|-1e8kc0,52,62,1|-14vls1,52,62,1|-14vls0,50,66,0\",\"America/Port-au-Prince|,0,163,0|-15r0vxs,84,164,0|-rmk9ad,84,164,0|-rmk9ac,49,63,0|6ys5vz,49,63,0|6ys5w0,62,42,1|77s5rz,62,42,1|77s5s0,49,63,0|7h59vz,49,63,0|7h59w0,62,42,1|7qi8fz,62,42,1|7qi8g0,49,63,0|7zvcjz,49,63,0|7zvck0,62,42,1|898b3z,62,42,1|898b40,49,63,0|8ilf7z,49,63,0|8ilf80,62,42,1|8rydrz,62,42,1|8ryds0,49,63,0|91bhvz,49,63,0|91bhw0,62,42,1|9aogfz,62,42,1|9aogg0,49,63,0|9iyrbz,49,63,0|9iyrc0,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1otzz,49,63,0|a1ou00,62,42,1|achpzz,62,42,1|achq00,49,63,0|akewnz,49,63,0|akewo0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3hxzz,49,63,0|b3hy00,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm80nz,49,63,0|bm80o0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y3bz,49,63,0|c4y3c0,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno5zz,49,63,0|cno600,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6e8nz,49,63,0|d6e8o0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dph9zz,49,63,0|dpha00,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87cnz,49,63,0|e87co0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|iectvz,49,63,0|iectw0,62,42,1|ip5n3z,62,42,1|ip5n40,49,63,0|ix2wjz,49,63,0|ix2wk0,62,42,1|j7vprz,62,42,1|j7vps0,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Port_of_Spain|,0,41,0|-u6m79w,32,42,0\",\"America/Porto_Velho|,0,165,0|-t85g60,42,42,0|-jyl7o1,42,42,0|-jyl7o0,39,44,1|-jpayc1,39,44,1|-jpayc0,42,42,0|-jfsa81,42,42,0|-jfsa80,39,44,1|-j6j101,39,44,1|-j6j100,42,42,0|-ahcvk1,42,42,0|-ahcvk0,39,44,1|-aad0w1,39,44,1|-aad0w0,42,42,0|-9yky81,42,42,0|-9yky80,39,44,1|-9scyc1,39,44,1|-9scyc0,42,42,0|-9ft0w1,42,42,0|-9ft0w0,39,44,1|-99j6c1,39,44,1|-99j6c0,42,42,0|-8wz8w1,42,42,0|-8wz8w0,39,44,1|-8scno1,39,44,1|-8scno0,42,42,0|-35xjk1,42,42,0|-35xjk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2kdm81,42,42,0|-2kdm80,39,44,1|-2hcfo1,39,44,1|-2hcfo0,42,42,0|-24qnk1,42,42,0|-24qnk0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1nia81,42,42,0|-1nia80,39,44,1|-1hc501,39,44,1|-1hc500,42,42,0|-14qcw1,42,42,0|-14qcw0,39,44,1|-yid01,39,44,1|-yid00,42,42,0|89jf3z,42,42,0|89jf40,39,44,1|8gdmzz,39,44,1|8gdn00,42,42,0|8rwj3z,42,42,0|8rwj40,39,44,1|8xnuzz,39,44,1|8xnv00,42,42,0|9aogfz,42,42,0|9aogg0,39,44,1|9g2tnz,39,44,1|9g2to0,42,42,0\",\"America/Puerto_Rico|,0,166,0|-10xhp3b,32,42,0|-efsnk1,32,42,0|-efsnk0,33,44,1|-cq2tg1,33,44,1|-cq2tg0,34,44,1|-cnp641,34,44,1|-cnp640,32,42,0\",\"America/Punta_Arenas|,0,167,0|-15r0w78,85,168,0|-vauawr,85,168,0|-vauawq,56,63,0|-rx8i41,56,63,0|-rx8i40,85,168,0|-qs16wr,85,168,0|-qs16wq,42,42,0|-qcwsw1,42,42,0|-qcwsw0,85,168,0|-m3etkr,85,168,0|-m3etkq,42,42,1|-lsgfk1,42,42,1|-lsgfk0,56,63,0|-lkl0s1,56,63,0|-lkl0s0,42,42,1|-l9oi81,42,42,1|-l9oi80,56,63,0|-l1t3g1,56,63,0|-l1t3g0,42,42,1|-kqwkw1,42,42,1|-kqwkw0,56,63,0|-kj1641,56,63,0|-kj1640,42,42,1|-k84nk1,42,42,1|-k84nk0,56,63,0|-k098s1,56,63,0|-k098s0,42,42,1|-jpavk1,42,42,1|-jpavk0,56,63,0|-jhfgs1,56,63,0|-jhfgs0,42,42,0|-eeay81,42,42,0|-eeay80,56,63,0|-eb5ws1,56,63,0|-eb5ws0,42,42,0|-bvifk1,42,42,0|-bvifk0,56,63,0|-bsvzk1,56,63,0|-bsvzk0,42,42,0|-lsvk1,42,42,0|-lsvk0,39,44,1|-e8qc1,39,44,1|-e8qc0,42,42,0|-1zww1,42,42,0|-1zww0,39,44,1|4hcbz,39,44,1|4hcc0,42,42,0|ekdrz,42,42,0|ekds0,39,44,1|mhhnz,39,44,1|mhho0,42,42,0|xagfz,42,42,0|xagg0,39,44,1|157kbz,39,44,1|157kc0,42,42,0|1gdhrz,42,42,0|1gdhs0,39,44,1|1nxmzz,39,44,1|1nxn00,42,42,0|1ydn3z,42,42,0|1ydn40,39,44,1|26npnz,39,44,1|26npo0,42,42,0|2htn3z,42,42,0|2htn40,39,44,1|2pdsbz,39,44,1|2pdsc0,42,42,0|30jprz,42,42,0|30jps0,39,44,1|38gtnz,39,44,1|38gto0,42,42,0|3j9sfz,42,42,0|3j9sg0,39,44,1|3r6wbz,39,44,1|3r6wc0,42,42,0|41zv3z,42,42,0|41zv40,39,44,1|49wyzz,39,44,1|49wz00,42,42,0|4l2wfz,42,42,0|4l2wg0,39,44,1|4sn1nz,39,44,1|4sn1o0,42,42,0|53sz3z,42,42,0|53sz40,39,44,1|5bd4bz,39,44,1|5bd4c0,42,42,0|5mj1rz,42,42,0|5mj1s0,39,44,1|5ug5nz,39,44,1|5ug5o0,42,42,0|6594fz,42,42,0|6594g0,39,44,1|6d68bz,39,44,1|6d68c0,42,42,0|6nz73z,42,42,0|6nz740,39,44,1|6vwazz,39,44,1|6vwb00,42,42,0|76p9rz,42,42,0|76p9s0,39,44,1|7emdnz,39,44,1|7emdo0,42,42,0|7psb3z,42,42,0|7psb40,39,44,1|7xcgbz,39,44,1|7xcgc0,42,42,0|88idrz,42,42,0|88ids0,39,44,1|8g2izz,39,44,1|8g2j00,42,42,0|8r8gfz,42,42,0|8r8gg0,39,44,1|90lezz,39,44,1|90lf00,42,42,0|99yj3z,42,42,0|99yj40,39,44,1|9hvmzz,39,44,1|9hvn00,42,42,0|9solrz,42,42,0|9sols0,39,44,1|a0lpnz,39,44,1|a0lpo0,42,42,0|abrn3z,42,42,0|abrn40,39,44,1|ajbsbz,39,44,1|ajbsc0,42,42,0|at1v3z,42,42,0|at1v40,39,44,1|b21uzz,39,44,1|b21v00,42,42,0|bd7sfz,42,42,0|bd7sg0,39,44,1|bl4wbz,39,44,1|bl4wc0,42,42,0|bvxv3z,42,42,0|bvxv40,39,44,1|c3uyzz,39,44,1|c3uz00,42,42,0|cenxrz,42,42,0|cenxs0,39,44,1|cml1nz,39,44,1|cml1o0,42,42,0|cxe0fz,42,42,0|cxe0g0,39,44,1|d5b4bz,39,44,1|d5b4c0,42,42,0|dgh1rz,42,42,0|dgh1s0,39,44,1|do16zz,39,44,1|do1700,42,42,0|dz74fz,42,42,0|dz74g0,39,44,1|e7u5nz,39,44,1|e7u5o0,42,42,0|ehx73z,42,42,0|ehx740,39,44,1|epuazz,39,44,1|epub00,42,42,0|ezxcfz,42,42,0|ezxcg0,39,44,1|f9n9nz,39,44,1|f9n9o0,42,42,0|fjdcfz,42,42,0|fjdcg0,39,44,1|fragbz,39,44,1|fragc0,42,42,0|g2gdrz,42,42,0|g2gds0,39,44,1|ga0izz,39,44,1|ga0j00,42,42,0|gl6gfz,42,42,0|gl6gg0,39,44,1|gsqlnz,39,44,1|gsqlo0,42,42,0|h3wj3z,42,42,0|h3wj40,39,44,1|hbgobz,39,44,1|hbgoc0,42,42,0|hmmlrz,42,42,0|hmmls0,39,44,1|hujpnz,39,44,1|hujpo0,42,42,0|i5cofz,42,42,0|i5cog0,39,44,1|id9sbz,39,44,1|id9sc0,42,42,0|io2r3z,42,42,0|io2r40,39,44,1|ivzuzz,39,44,1|ivzv00,42,42,0|j75sfz,42,42,0|j75sg0,39,44,1|jepxnz,39,44,1|jepxo0,42,42,0|jpvv3z,42,42,0|jpvv40,39,44,1|jyiwbz,39,44,1|jyiwc0,42,42,0|k8lxrz,42,42,0|k8lxs0,39,44,1|kgj1nz,39,44,1|kgj1o0,42,42,0|krc0fz,42,42,0|krc0g0,39,44,1|l0c0bz,39,44,1|l0c0c0,42,42,0|la233z,42,42,0|la2340,39,44,1|lkuwbz,39,44,1|lkuwc0,42,42,0|lq9f3z,42,42,0|lq9f40,39,44,1|m380bz,39,44,1|m380c0,42,42,0|m9pf3z,42,42,0|m9pf40,39,44,1|mly2zz,39,44,1|mly300,42,42,0|mssgfz,42,42,0|mssgg0,39,44,1|n4o5nz,39,44,1|n4o5o0,42,42,0|nbij3z,42,42,0|nbij40,39,44,1|o776zz,39,44,1|o77700,42,42,0|obvsfz,42,42,0|obvsg0,39,44,1|ohn4bz,39,44,1|ohn4c0,39,44,0\",\"America/Rainy_River|,0,169,0|-1353ahk,45,62,0|-qzov41,45,62,0|-qzov40,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-f9ofc1,45,62,0|-f9ofc0,46,63,1|-ek21s1,46,63,1|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|296u7z,45,62,0|296u80,46,63,1|2ijsrz,46,63,1|2ijss0,45,62,0|2rwwvz,45,62,0|2rwww0,46,63,1|319vfz,46,63,1|319vg0,45,62,0|3amzjz,45,62,0|3amzk0,46,63,1|3kcwrz,46,63,1|3kcws0,45,62,0|3td27z,45,62,0|3td280,46,63,1|432zfz,46,63,1|432zg0,45,62,0|4cg3jz,45,62,0|4cg3k0,46,63,1|4lt23z,46,63,1|4lt240,45,62,0|4v667z,45,62,0|4v6680,46,63,1|54j4rz,46,63,1|54j4s0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n97fz,46,63,1|5n97g0,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65za3z,46,63,1|65za40,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2bfz,46,63,1|6p2bg0,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77se3z,46,63,1|77se40,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qigrz,46,63,1|7qigs0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898jfz,46,63,1|898jg0,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8rym3z,46,63,1|8rym40,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aoorz,46,63,1|9aoos0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achsrz,46,63,1|achss0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7vfz,46,63,1|av7vg0,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdxy3z,46,63,1|bdxy40,45,62,0|bm867z,45,62,0|bm8680,46,63,1|bwo0rz,46,63,1|bwo0s0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr23z,46,63,1|cfr240,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh4rz,46,63,1|cyh4s0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh77fz,46,63,1|dh77g0,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,45,62,0|gb3svz,45,62,0|gb3sw0,46,63,1|glwm3z,46,63,1|glwm40,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Rankin_Inlet|,60,1,0|-6s8lc0,45,62,0|-2g1wo1,45,62,0|-2g1wo0,86,42,1|-26bwo1,86,42,1|-26bwo0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n97fz,46,63,1|5n97g0,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65za3z,46,63,1|65za40,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2bfz,46,63,1|6p2bg0,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77se3z,46,63,1|77se40,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qigrz,46,63,1|7qigs0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898jfz,46,63,1|898jg0,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8rym3z,46,63,1|8rym40,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aoorz,46,63,1|9aoos0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achsrz,46,63,1|achss0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7vfz,46,63,1|av7vg0,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdxy3z,46,63,1|bdxy40,45,62,0|bm867z,45,62,0|bm8680,46,63,1|bwo0rz,46,63,1|bwo0s0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr23z,46,63,1|cfr240,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh4rz,46,63,1|cyh4s0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh77fz,46,63,1|dh77g0,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,49,63,0|gb3svz,49,63,0|gb3sw0,46,63,1|glwm3z,46,63,1|glwm40,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Recife|,0,170,0|-t85ljc,39,44,0|-jylag1,39,44,0|-jylag0,40,45,1|-jpb141,40,45,1|-jpb140,39,44,0|-jfsd01,39,44,0|-jfsd00,40,45,1|-j6j3s1,40,45,1|-j6j3s0,39,44,0|-ahcyc1,39,44,0|-ahcyc0,40,45,1|-aad3o1,40,45,1|-aad3o0,39,44,0|-9yl101,39,44,0|-9yl100,40,45,1|-9sd141,40,45,1|-9sd140,39,44,0|-9ft3o1,39,44,0|-9ft3o0,40,45,1|-99j941,40,45,1|-99j940,39,44,0|-8wzbo1,39,44,0|-8wzbo0,40,45,1|-8scqg1,40,45,1|-8scqg0,39,44,0|-35xmc1,39,44,0|-35xmc0,40,45,1|-31nzs1,40,45,1|-31nzs0,39,44,0|-2kdp01,39,44,0|-2kdp00,40,45,1|-2hcig1,40,45,1|-2hcig0,39,44,0|-24qqc1,39,44,0|-24qqc0,40,45,1|-204541,40,45,1|-204540,39,44,0|-1nid01,39,44,0|-1nid00,40,45,1|-1hc7s1,40,45,1|-1hc7s0,39,44,0|-14qfo1,39,44,0|-14qfo0,40,45,1|-yifs1,40,45,1|-yifs0,39,44,0|89jcbz,39,44,0|89jcc0,40,45,1|8gdk7z,40,45,1|8gdk80,39,44,0|8rwgbz,39,44,0|8rwgc0,40,45,1|8xns7z,40,45,1|8xns80,39,44,0|9aodnz,39,44,0|9aodo0,40,45,1|9g2qvz,40,45,1|9g2qw0,39,44,0|9t1hnz,39,44,0|9t1ho0,40,45,1|9yfuvz,40,45,1|9yfuw0,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|ahvuvz,40,45,1|ahvuw0,39,44,0|fj0azz,39,44,0|fj0b00,40,45,1|fqkg7z,40,45,1|fqkg80,39,44,0|g23cbz,39,44,0|g23cc0,40,45,1|g2g87z,40,45,1|g2g880,39,44,0|gl6dnz,39,44,0|gl6do0,40,45,1|grnmvz,40,45,1|grnmw0,39,44,0\",\"America/Regina|,0,171,0|-xkq9yc,50,66,0|-qzosc1,50,66,0|-qzosc0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-kp78k1,50,66,0|-kp78k0,52,62,1|-kha4o1,52,62,1|-kha4o0,50,66,0|-k6h5w1,50,66,0|-k6h5w0,52,62,1|-jyk201,52,62,1|-jyk200,50,66,0|-jnr381,50,66,0|-jnr380,52,62,1|-jftzc1,52,62,1|-jftzc0,50,66,0|-j4o1w1,50,66,0|-j4o1w0,52,62,1|-ix3wo1,52,62,1|-ix3wo0,50,66,0|-ilxz81,50,66,0|-ilxz80,52,62,1|-ie0vc1,52,62,1|-ie0vc0,50,66,0|-h2un81,50,66,0|-h2un80,52,62,1|-gthoo1,52,62,1|-gthoo0,50,66,0|-gk4kk1,50,66,0|-gk4kk0,52,62,1|-gb4ko1,52,62,1|-gb4ko0,50,66,0|-g1ehw1,50,66,0|-g1ehw0,52,62,1|-fs1jc1,52,62,1|-fs1jc0,50,66,0|-fibgk1,50,66,0|-fibgk0,52,62,1|-f8yi01,52,62,1|-f8yi00,50,66,0|-ezldw1,50,66,0|-ezldw0,52,62,1|-eq8fc1,52,62,1|-eq8fc0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-cdlwc1,50,66,0|-cdlwc0,52,62,1|-c48xs1,52,62,1|-c48xs0,50,66,0|-bu5wc1,50,66,0|-bu5wc0,52,62,1|-bm8sg1,52,62,1|-bm8sg0,50,66,0|-bbfto1,50,66,0|-bbfto0,52,62,1|-b3ips1,52,62,1|-b3ips0,50,66,0|-aspr01,50,66,0|-aspr00,52,62,1|-aksn41,52,62,1|-aksn40,50,66,0|-a9mpo1,50,66,0|-a9mpo0,52,62,1|-a22kg1,52,62,1|-a22kg0,50,66,0|-9qwn01,50,66,0|-9qwn00,52,62,1|-9izj41,52,62,1|-9izj40,50,66,0|-986kc1,50,66,0|-986kc0,52,62,1|-909gg1,52,62,1|-909gg0,50,66,0|-8pgho1,50,66,0|-8pgho0,52,62,1|-8hjds1,52,62,1|-8hjds0,50,66,0|-86qf01,50,66,0|-86qf00,52,62,1|-7ytb41,52,62,1|-7ytb40,50,66,0|-7o0cc1,50,66,0|-7o0cc0,52,62,1|-7g38g1,52,62,1|-7g38g0,50,66,0|-74xb01,50,66,0|-74xb00,52,62,1|-6x0741,52,62,1|-6x0740,50,66,0|-6m78c1,50,66,0|-6m78c0,52,62,1|-6ea4g1,52,62,1|-6ea4g0,50,66,0|-5kr301,50,66,0|-5kr300,52,62,1|-5be4g1,52,62,1|-5be4g0,50,66,0|-5210c1,50,66,0|-5210c0,45,62,0\",\"America/Resolute|,60,1,0|-bnp9c0,45,62,0|-2g1wo1,45,62,0|-2g1wo0,86,42,1|-26bwo1,86,42,1|-26bwo0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n97fz,46,63,1|5n97g0,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65za3z,46,63,1|65za40,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2bfz,46,63,1|6p2bg0,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77se3z,46,63,1|77se40,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qigrz,46,63,1|7qigs0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898jfz,46,63,1|898jg0,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8rym3z,46,63,1|8rym40,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aoorz,46,63,1|9aoos0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trq3z,46,63,1|9trq40,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achsrz,46,63,1|achss0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7vfz,46,63,1|av7vg0,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdxy3z,46,63,1|bdxy40,45,62,0|bm867z,45,62,0|bm8680,46,63,1|bwo0rz,46,63,1|bwo0s0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr23z,46,63,1|cfr240,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh4rz,46,63,1|cyh4s0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh77fz,46,63,1|dh77g0,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxa3z,46,63,1|dzxa40,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|eincrz,46,63,1|eincs0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1dffz,46,63,1|f1dfg0,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkggrz,46,63,1|fkggs0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36jfz,46,63,1|g36jg0,49,63,0|gb3svz,49,63,0|gb3sw0,46,63,1|glwm3z,46,63,1|glwm40,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4morz,46,63,1|h4mos0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncrfz,46,63,1|hncrg0,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fsrz,46,63,1|i6fss0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5vfz,46,63,1|ip5vg0,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,49,63,0|jeqbjz,49,63,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Rio_Branco|,0,172,0|-t85fg0,56,63,0|-jyl4w1,56,63,0|-jyl4w0,42,42,1|-jpavk1,42,42,1|-jpavk0,56,63,0|-jfs7g1,56,63,0|-jfs7g0,42,42,1|-j6iy81,42,42,1|-j6iy80,56,63,0|-ahcss1,56,63,0|-ahcss0,42,42,1|-aacy41,42,42,1|-aacy40,56,63,0|-9ykvg1,56,63,0|-9ykvg0,42,42,1|-9scvk1,42,42,1|-9scvk0,56,63,0|-9fsy41,56,63,0|-9fsy40,42,42,1|-99j3k1,42,42,1|-99j3k0,56,63,0|-8wz641,56,63,0|-8wz640,42,42,1|-8sckw1,42,42,1|-8sckw0,56,63,0|-35xgs1,56,63,0|-35xgs0,42,42,1|-31nu81,42,42,1|-31nu80,56,63,0|-2kdjg1,56,63,0|-2kdjg0,42,42,1|-2hccw1,42,42,1|-2hccw0,56,63,0|-24qks1,56,63,0|-24qks0,42,42,1|-203zk1,42,42,1|-203zk0,56,63,0|-1ni7g1,56,63,0|-1ni7g0,42,42,1|-1hc281,42,42,1|-1hc280,56,63,0|-14qa41,56,63,0|-14qa40,42,42,1|-yia81,42,42,1|-yia80,56,63,0|89jhvz,56,63,0|89jhw0,42,42,1|8gdprz,42,42,1|8gdps0,56,63,0|8rwlvz,56,63,0|8rwlw0,42,42,1|8xnxrz,42,42,1|8xnxs0,56,63,0|9aoj7z,56,63,0|9aoj80,42,42,1|9g2wfz,42,42,1|9g2wg0,56,63,0|k2yb7z,56,63,0|k2yb80,42,42,0|mw14fz,42,42,0|mw14g0,56,63,0\",\"America/Santarem|,0,173,0|-t85hvc,42,42,0|-jyl7o1,42,42,0|-jyl7o0,39,44,1|-jpayc1,39,44,1|-jpayc0,42,42,0|-jfsa81,42,42,0|-jfsa80,39,44,1|-j6j101,39,44,1|-j6j100,42,42,0|-ahcvk1,42,42,0|-ahcvk0,39,44,1|-aad0w1,39,44,1|-aad0w0,42,42,0|-9yky81,42,42,0|-9yky80,39,44,1|-9scyc1,39,44,1|-9scyc0,42,42,0|-9ft0w1,42,42,0|-9ft0w0,39,44,1|-99j6c1,39,44,1|-99j6c0,42,42,0|-8wz8w1,42,42,0|-8wz8w0,39,44,1|-8scno1,39,44,1|-8scno0,42,42,0|-35xjk1,42,42,0|-35xjk0,39,44,1|-31nx01,39,44,1|-31nx00,42,42,0|-2kdm81,42,42,0|-2kdm80,39,44,1|-2hcfo1,39,44,1|-2hcfo0,42,42,0|-24qnk1,42,42,0|-24qnk0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1nia81,42,42,0|-1nia80,39,44,1|-1hc501,39,44,1|-1hc500,42,42,0|-14qcw1,42,42,0|-14qcw0,39,44,1|-yid01,39,44,1|-yid00,42,42,0|89jf3z,42,42,0|89jf40,39,44,1|8gdmzz,39,44,1|8gdn00,42,42,0|8rwj3z,42,42,0|8rwj40,39,44,1|8xnuzz,39,44,1|8xnv00,42,42,0|9aogfz,42,42,0|9aogg0,39,44,1|9g2tnz,39,44,1|9g2to0,42,42,0|k2y8fz,42,42,0|k2y8g0,39,44,0\",\"America/Santiago|,0,168,0|-15r0w8q,85,168,0|-vauawr,85,168,0|-vauawq,56,63,0|-rx8i41,56,63,0|-rx8i40,85,168,0|-qs16wr,85,168,0|-qs16wq,42,42,0|-qcwsw1,42,42,0|-qcwsw0,85,168,0|-m3etkr,85,168,0|-m3etkq,42,42,1|-lsgfk1,42,42,1|-lsgfk0,56,63,0|-lkl0s1,56,63,0|-lkl0s0,42,42,1|-l9oi81,42,42,1|-l9oi80,56,63,0|-l1t3g1,56,63,0|-l1t3g0,42,42,1|-kqwkw1,42,42,1|-kqwkw0,56,63,0|-kj1641,56,63,0|-kj1640,42,42,1|-k84nk1,42,42,1|-k84nk0,56,63,0|-k098s1,56,63,0|-k098s0,42,42,1|-jpavk1,42,42,1|-jpavk0,56,63,0|-jhfgs1,56,63,0|-jhfgs0,42,42,0|-eeay81,42,42,0|-eeay80,56,63,0|-eb5ws1,56,63,0|-eb5ws0,42,42,0|-c8vww1,42,42,0|-c8vww0,39,44,1|-c6f3o1,39,44,1|-c6f3o0,42,42,0|-bvifk1,42,42,0|-bvifk0,56,63,0|-bsvzk1,56,63,0|-bsvzk0,42,42,0|-lsvk1,42,42,0|-lsvk0,39,44,1|-e8qc1,39,44,1|-e8qc0,42,42,0|-1zww1,42,42,0|-1zww0,39,44,1|4hcbz,39,44,1|4hcc0,42,42,0|ekdrz,42,42,0|ekds0,39,44,1|mhhnz,39,44,1|mhho0,42,42,0|xagfz,42,42,0|xagg0,39,44,1|157kbz,39,44,1|157kc0,42,42,0|1gdhrz,42,42,0|1gdhs0,39,44,1|1nxmzz,39,44,1|1nxn00,42,42,0|1ydn3z,42,42,0|1ydn40,39,44,1|26npnz,39,44,1|26npo0,42,42,0|2htn3z,42,42,0|2htn40,39,44,1|2pdsbz,39,44,1|2pdsc0,42,42,0|30jprz,42,42,0|30jps0,39,44,1|38gtnz,39,44,1|38gto0,42,42,0|3j9sfz,42,42,0|3j9sg0,39,44,1|3r6wbz,39,44,1|3r6wc0,42,42,0|41zv3z,42,42,0|41zv40,39,44,1|49wyzz,39,44,1|49wz00,42,42,0|4l2wfz,42,42,0|4l2wg0,39,44,1|4sn1nz,39,44,1|4sn1o0,42,42,0|53sz3z,42,42,0|53sz40,39,44,1|5bd4bz,39,44,1|5bd4c0,42,42,0|5mj1rz,42,42,0|5mj1s0,39,44,1|5ug5nz,39,44,1|5ug5o0,42,42,0|6594fz,42,42,0|6594g0,39,44,1|6d68bz,39,44,1|6d68c0,42,42,0|6nz73z,42,42,0|6nz740,39,44,1|6vwazz,39,44,1|6vwb00,42,42,0|76p9rz,42,42,0|76p9s0,39,44,1|7emdnz,39,44,1|7emdo0,42,42,0|7psb3z,42,42,0|7psb40,39,44,1|7xcgbz,39,44,1|7xcgc0,42,42,0|88idrz,42,42,0|88ids0,39,44,1|8g2izz,39,44,1|8g2j00,42,42,0|8r8gfz,42,42,0|8r8gg0,39,44,1|90lezz,39,44,1|90lf00,42,42,0|99yj3z,42,42,0|99yj40,39,44,1|9hvmzz,39,44,1|9hvn00,42,42,0|9solrz,42,42,0|9sols0,39,44,1|a0lpnz,39,44,1|a0lpo0,42,42,0|abrn3z,42,42,0|abrn40,39,44,1|ajbsbz,39,44,1|ajbsc0,42,42,0|at1v3z,42,42,0|at1v40,39,44,1|b21uzz,39,44,1|b21v00,42,42,0|bd7sfz,42,42,0|bd7sg0,39,44,1|bl4wbz,39,44,1|bl4wc0,42,42,0|bvxv3z,42,42,0|bvxv40,39,44,1|c3uyzz,39,44,1|c3uz00,42,42,0|cenxrz,42,42,0|cenxs0,39,44,1|cml1nz,39,44,1|cml1o0,42,42,0|cxe0fz,42,42,0|cxe0g0,39,44,1|d5b4bz,39,44,1|d5b4c0,42,42,0|dgh1rz,42,42,0|dgh1s0,39,44,1|do16zz,39,44,1|do1700,42,42,0|dz74fz,42,42,0|dz74g0,39,44,1|e7u5nz,39,44,1|e7u5o0,42,42,0|ehx73z,42,42,0|ehx740,39,44,1|epuazz,39,44,1|epub00,42,42,0|ezxcfz,42,42,0|ezxcg0,39,44,1|f9n9nz,39,44,1|f9n9o0,42,42,0|fjdcfz,42,42,0|fjdcg0,39,44,1|fragbz,39,44,1|fragc0,42,42,0|g2gdrz,42,42,0|g2gds0,39,44,1|ga0izz,39,44,1|ga0j00,42,42,0|gl6gfz,42,42,0|gl6gg0,39,44,1|gsqlnz,39,44,1|gsqlo0,42,42,0|h3wj3z,42,42,0|h3wj40,39,44,1|hbgobz,39,44,1|hbgoc0,42,42,0|hmmlrz,42,42,0|hmmls0,39,44,1|hujpnz,39,44,1|hujpo0,42,42,0|i5cofz,42,42,0|i5cog0,39,44,1|id9sbz,39,44,1|id9sc0,42,42,0|io2r3z,42,42,0|io2r40,39,44,1|ivzuzz,39,44,1|ivzv00,42,42,0|j75sfz,42,42,0|j75sg0,39,44,1|jepxnz,39,44,1|jepxo0,42,42,0|jpvv3z,42,42,0|jpvv40,39,44,1|jyiwbz,39,44,1|jyiwc0,42,42,0|k8lxrz,42,42,0|k8lxs0,39,44,1|kgj1nz,39,44,1|kgj1o0,42,42,0|krc0fz,42,42,0|krc0g0,39,44,1|l0c0bz,39,44,1|l0c0c0,42,42,0|la233z,42,42,0|la2340,39,44,1|lkuwbz,39,44,1|lkuwc0,42,42,0|lq9f3z,42,42,0|lq9f40,39,44,1|m380bz,39,44,1|m380c0,42,42,0|m9pf3z,42,42,0|m9pf40,39,44,1|mly2zz,39,44,1|mly300,42,42,0|mssgfz,42,42,0|mssgg0,39,44,1|n4o5nz,39,44,1|n4o5o0,42,42,0|nbij3z,42,42,0|nbij40,39,44,1|o776zz,39,44,1|o77700,42,42,0|obvsfz,42,42,0|obvsg0,39,44,1|opx9nz,39,44,1|opx9o0,42,42,0|oulv3z,42,42,0|oulv40,39,44,1|p8ncbz,39,44,1|p8ncc0,42,42,0|pdbxrz,42,42,0|pdbxs0,39,44,1|ppklnz,39,44,1|ppklo0,42,42,0|pxhv3z,42,42,0|pxhv40,39,44,1|q8aobz,39,44,1|q8aoc0,42,42,0|qg7xrz,42,42,0|qg7xs0,39,44,1|qr0qzz,39,44,1|qr0r00,42,42,0|qyy0fz,42,42,0|qyy0g0,39,44,1|r9qtnz,39,44,1|r9qto0,42,42,0|rho33z,42,42,0|rho340,39,44,1|rsgwbz,39,44,1|rsgwc0,42,42,0|s0e5rz,42,42,0|s0e5s0,39,44,1|sbjxnz,39,44,1|sbjxo0,42,42,0|sjh73z,42,42,0|sjh740,39,44,1|sua0bz,39,44,1|sua0c0,42,42,0|t279rz,42,42,0|t279s0,39,44,1|td02zz,39,44,1|td0300,42,42,0|tkxcfz,42,42,0|tkxcg0,39,44,1|tvq5nz,39,44,1|tvq5o0,42,42,0|u3nf3z,42,42,0|u3nf40,39,44,1|ueg8bz,39,44,1|ueg8c0,42,42,0|umdhrz,42,42,0|umdhs0,39,44,1|uxj9nz,39,44,1|uxj9o0,42,42,0|v53kfz,42,42,0|v53kg0,39,44,1|vg9cbz,39,44,1|vg9cc0,42,42,0|vo6lrz,42,42,0|vo6ls0,39,44,1|vyzezz,39,44,1|vyzf00,42,42,0|w6wofz,42,42,0|w6wog0,39,44,1|whphnz,39,44,1|whpho0,42,42,0|wpmr3z,42,42,0|wpmr40,39,44,1|x0fkbz,39,44,1|x0fkc0,42,42,0|x8ctrz,42,42,0|x8cts0,39,44,1|xj5mzz,39,44,1|xj5n00,42,42,0|xr2wfz,42,42,0|xr2wg0,39,44,1|y28obz,39,44,1|y28oc0,42,42,0|y9sz3z,42,42,0|y9sz40,39,44,1|ykyqzz,39,44,1|ykyr00,42,42,0|ysw0fz,42,42,0|ysw0g0,39,44,1|z3otnz,39,44,1|z3oto0,42,42,0|zbm33z,42,42,0|zbm340,39,44,1\",\"America/Santo_Domingo|,0,174,0|-15r0we0,87,175,0|-j6hz1d,87,175,0|-j6hz1c,49,63,0|-1nlws1,49,63,0|-1nlws0,62,42,1|-1hdww1,62,42,1|-1hdww0,49,63,0|-3fos1,49,63,0|-3fos0,43,59,1|2mshz,43,59,1|2msi0,49,63,0|fadvz,49,63,0|fadw0,43,59,1|jrghz,43,59,1|jrgi0,49,63,0|ydf7z,49,63,0|ydf80,43,59,1|12l8hz,43,59,1|12l8i0,49,63,0|1h3hvz,49,63,0|1h3hw0,43,59,1|1lf0hz,43,59,1|1lf0i0,49,63,0|1ztkjz,49,63,0|1ztkk0,43,59,1|246xtz,43,59,1|246xu0,49,63,0|2ijn7z,49,63,0|2ijn80,32,42,0|g36gnz,32,42,0|g36go0,49,63,0|g4z9zz,49,63,0|g4za00,32,42,0\",\"America/Sao_Paulo|,0,176,0|-t85jd8,39,44,0|-jylag1,39,44,0|-jylag0,40,45,1|-jpb141,40,45,1|-jpb140,39,44,0|-jfsd01,39,44,0|-jfsd00,40,45,1|-j6j3s1,40,45,1|-j6j3s0,39,44,0|-ahcyc1,39,44,0|-ahcyc0,40,45,1|-aad3o1,40,45,1|-aad3o0,39,44,0|-9yl101,39,44,0|-9yl100,40,45,1|-9sd141,40,45,1|-9sd140,39,44,0|-9ft3o1,39,44,0|-9ft3o0,40,45,1|-99j941,40,45,1|-99j940,39,44,0|-8wzbo1,39,44,0|-8wzbo0,40,45,1|-8scqg1,40,45,1|-8scqg0,39,44,0|-38cno1,39,44,0|-38cno0,40,45,1|-31nzs1,40,45,1|-31nzs0,39,44,0|-2kdp01,39,44,0|-2kdp00,40,45,1|-2hcig1,40,45,1|-2hcig0,39,44,0|-24qqc1,39,44,0|-24qqc0,40,45,1|-204541,40,45,1|-204540,39,44,0|-1nid01,39,44,0|-1nid00,40,45,1|-1hc7s1,40,45,1|-1hc7s0,39,44,0|-14qfo1,39,44,0|-14qfo0,40,45,1|-yifs1,40,45,1|-yifs0,39,44,0|89jcbz,39,44,0|89jcc0,40,45,1|8gdk7z,40,45,1|8gdk80,39,44,0|8rwgbz,39,44,0|8rwgc0,40,45,1|8xns7z,40,45,1|8xns80,39,44,0|9aodnz,39,44,0|9aodo0,40,45,1|9g2qvz,40,45,1|9g2qw0,39,44,0|9t1hnz,39,44,0|9t1ho0,40,45,1|9yfuvz,40,45,1|9yfuw0,39,44,0|abrkbz,39,44,0|abrkc0,40,45,1|ahvuvz,40,45,1|ahvuw0,39,44,0|auulnz,39,44,0|auulo0,40,45,1|b0yw7z,40,45,1|b0yw80,39,44,0|bdkobz,39,44,0|bdkoc0,40,45,1|bjc07z,40,45,1|bjc080,39,44,0|bwnpnz,39,44,0|bwnpo0,40,45,1|c1p47z,40,45,1|c1p480,39,44,0|cf0tnz,39,44,0|cf0to0,40,45,1|cli2vz,40,45,1|cli2w0,39,44,0|cxqwbz,39,44,0|cxqwc0,40,45,1|d485jz,40,45,1|d485k0,39,44,0|dggyzz,39,44,0|dggz00,40,45,1|dml9jz,40,45,1|dml9k0,39,44,0|dyu2zz,39,44,0|dyu300,40,45,1|e5oavz,40,45,1|e5oaw0,39,44,0|ehm0bz,39,44,0|ehm0c0,40,45,1|ep4avz,40,45,1|ep4aw0,39,44,0|f0n6zz,39,44,0|f0n700,40,45,1|f7hevz,40,45,1|f7hew0,39,44,0|fj0azz,39,44,0|fj0b00,40,45,1|fqkg7z,40,45,1|fqkg80,39,44,0|g23cbz,39,44,0|g23cc0,40,45,1|g8xk7z,40,45,1|g8xk80,39,44,0|gl6dnz,39,44,0|gl6do0,40,45,1|grnmvz,40,45,1|grnmw0,39,44,0|h4zcbz,39,44,0|h4zcc0,40,45,1|hadpjz,40,45,1|hadpk0,39,44,0|hmzhnz,39,44,0|hmzho0,40,45,1|ht3s7z,40,45,1|ht3s80,39,44,0|i6j6zz,39,44,0|i6j700,40,45,1|ic6tjz,40,45,1|ic6tk0,39,44,0|iofmzz,39,44,0|iofn00,40,45,1|iuww7z,40,45,1|iuww80,39,44,0|j88lnz,39,44,0|j88lo0,40,45,1|jdzxjz,40,45,1|jdzxk0,39,44,0|jpvsbz,39,44,0|jpvsc0,40,45,1|jwd1jz,40,45,1|jwd1k0,39,44,0|k8ytnz,39,44,0|k8yto0,40,45,1|kf347z,40,45,1|kf3480,39,44,0|krowbz,39,44,0|krowc0,40,45,1|ky65jz,40,45,1|ky65k0,39,44,0|laeyzz,39,44,0|laez00,40,45,1|lgw87z,40,45,1|lgw880,39,44,0|lt51nz,39,44,0|lt51o0,40,45,1|lzz9jz,40,45,1|lzz9k0,39,44,0|mc82zz,39,44,0|mc8300,40,45,1|micdjz,40,45,1|micdk0,39,44,0|muy5nz,39,44,0|muy5o0,40,45,1|n12g7z,40,45,1|n12g80,39,44,0|ndo8bz,39,44,0|ndo8c0,40,45,1|nk5hjz,40,45,1|nk5hk0,39,44,0|nweazz,39,44,0|nweb00,40,45,1|o2vk7z,40,45,1|o2vk80,39,44,0|of4dnz,39,44,0|of4do0,40,45,1|ollmvz,40,45,1|ollmw0,39,44,0|oxugbz,39,44,0|oxugc0,40,45,1|p4bpjz,40,45,1|p4bpk0,39,44,0|phnezz,39,44,0|phnf00,40,45,1|pn1s7z,40,45,1|pn1s80,39,44,0\",\"America/Scoresbysund|,0,177,0|-rvurxk,40,45,0|5ct1rz,40,45,0|5ct1s0,13,15,1|5lt4fz,13,15,1|5lt4g0,40,45,0|5v607z,40,45,0|5v6080,17,1,1|64iyrz,17,1,1|64iys0,13,15,0|6dw03z,13,15,0|6dw040,17,1,1|6n91fz,17,1,1|6n91g0,13,15,0|6wm2rz,13,15,0|6wm2s0,17,1,1|75z43z,17,1,1|75z440,13,15,0|7fc5fz,13,15,0|7fc5g0,17,1,1|7p25fz,17,1,1|7p25g0,13,15,0|7yf6rz,13,15,0|7yf6s0,17,1,1|87s83z,17,1,1|87s840,13,15,0|8h59fz,13,15,0|8h59g0,17,1,1|8qiarz,17,1,1|8qias0,13,15,0|8zvc3z,13,15,0|8zvc40,17,1,1|998dfz,17,1,1|998dg0,13,15,0|9ilerz,13,15,0|9iles0,17,1,1|9ryg3z,17,1,1|9ryg40,13,15,0|a1bhfz,13,15,0|a1bhg0,17,1,1|aaoirz,17,1,1|aaois0,13,15,0|ak1k3z,13,15,0|ak1k40,17,1,1|atrk3z,17,1,1|atrk40,13,15,0|b34lfz,13,15,0|b34lg0,17,1,1|bchmrz,17,1,1|bchms0,13,15,0|bluo3z,13,15,0|bluo40,17,1,1|bv7pfz,17,1,1|bv7pg0,13,15,0|c4kqrz,13,15,0|c4kqs0,17,1,1|cdxs3z,17,1,1|cdxs40,13,15,0|cnatfz,13,15,0|cnatg0,17,1,1|cwnurz,17,1,1|cwnus0,13,15,0|d60w3z,13,15,0|d60w40,17,1,1|dfdxfz,17,1,1|dfdxg0,13,15,0|dp3xfz,13,15,0|dp3xg0,17,1,1|dzwtfz,17,1,1|dzwtg0,13,15,0|e7u03z,13,15,0|e7u040,17,1,1|eimw3z,17,1,1|eimw40,13,15,0|eqk2rz,13,15,0|eqk2s0,17,1,1|f1cyrz,17,1,1|f1cys0,13,15,0|f9a5fz,13,15,0|f9a5g0,17,1,1|fkg03z,17,1,1|fkg040,13,15,0|fs083z,13,15,0|fs0840,17,1,1|g362rz,17,1,1|g362s0,13,15,0|gaqarz,13,15,0|gaqas0,17,1,1|glw5fz,17,1,1|glw5g0,13,15,0|gttc3z,13,15,0|gttc40,17,1,1|h4m83z,17,1,1|h4m840,13,15,0|hcjerz,13,15,0|hcjes0,17,1,1|hncarz,17,1,1|hncas0,13,15,0|hv9hfz,13,15,0|hv9hg0,17,1,1|i6fc3z,17,1,1|i6fc40,13,15,0|idzk3z,13,15,0|idzk40,17,1,1|ip5erz,17,1,1|ip5es0,13,15,0|iwpmrz,13,15,0|iwpms0,17,1,1|j7vhfz,17,1,1|j7vhg0,13,15,0|jffpfz,13,15,0|jffpg0,17,1,1|jqlk3z,17,1,1|jqlk40,13,15,0|jyiqrz,13,15,0|jyiqs0,17,1,1|k9bmrz,17,1,1|k9bms0,13,15,0|kh8tfz,13,15,0|kh8tg0,17,1,1|ks1pfz,17,1,1|ks1pg0,13,15,0|kzyw3z,13,15,0|kzyw40,17,1,1|lb4qrz,17,1,1|lb4qs0,13,15,0|lioyrz,13,15,0|lioys0,17,1,1|ltutfz,17,1,1|ltutg0,13,15,0|m1f1fz,13,15,0|m1f1g0,17,1,1|mckw3z,17,1,1|mckw40,13,15,0|mki2rz,13,15,0|mki2s0,17,1,1|mvayrz,17,1,1|mvays0,13,15,0|n385fz,13,15,0|n385g0,17,1,1|ne11fz,17,1,1|ne11g0,13,15,0|nly83z,13,15,0|nly840,17,1,1|nwr43z,17,1,1|nwr440,13,15,0|o4oarz,13,15,0|o4oas0,17,1,1|ofu5fz,17,1,1|ofu5g0,13,15,0|onedfz,13,15,0|onedg0,17,1,1|oyk83z,17,1,1|oyk840,13,15,0|p64g3z,13,15,0|p64g40,17,1,1|phaarz,17,1,1|phaas0,13,15,0|pp7hfz,13,15,0|pp7hg0,17,1,1|q00dfz,17,1,1|q00dg0,13,15,0|q7xk3z,13,15,0|q7xk40,17,1,1|qiqg3z,17,1,1|qiqg40,13,15,0|qqnmrz,13,15,0|qqnms0,17,1,1|r1thfz,17,1,1|r1thg0,13,15,0|r9dpfz,13,15,0|r9dpg0,17,1,1|rkjk3z,17,1,1|rkjk40,13,15,0|rs3s3z,13,15,0|rs3s40,17,1,1|s39mrz,17,1,1|s39ms0,13,15,0|sb6tfz,13,15,0|sb6tg0,17,1,1|slzpfz,17,1,1|slzpg0,13,15,0|stww3z,13,15,0|stww40,17,1,1|t4ps3z,17,1,1|t4ps40,13,15,0|tcmyrz,13,15,0|tcmys0,17,1,1|tnfurz,17,1,1|tnfus0,13,15,0|tvd1fz,13,15,0|tvd1g0,17,1,1|u6iw3z,17,1,1|u6iw40,13,15,0|ue343z,13,15,0|ue3440,17,1,1|up8yrz,17,1,1|up8ys0,13,15,0|uwt6rz,13,15,0|uwt6s0,17,1,1|v7z1fz,17,1,1|v7z1g0,13,15,0|vfw83z,13,15,0|vfw840,17,1,1|vqp43z,17,1,1|vqp440,13,15,0|vymarz,13,15,0|vymas0,17,1,1|w9f6rz,17,1,1|w9f6s0,13,15,0|whcdfz,13,15,0|whcdg0,17,1,1|wsi83z,17,1,1|wsi840,13,15,0|x02g3z,13,15,0|x02g40,17,1,1|xb8arz,17,1,1|xb8as0,13,15,0|xisirz,13,15,0|xisis0,17,1,1|xtydfz,17,1,1|xtydg0,13,15,0|y1ilfz,13,15,0|y1ilg0,17,1,1|ycog3z,17,1,1|ycog40,13,15,0|yklmrz,13,15,0|yklms0,17,1,1|yveirz,17,1,1|yveis0,13,15,0|z3bpfz,13,15,0|z3bpg0,17,1,1|ze4lfz,17,1,1|ze4lg0,13,15,0\",\"America/Sitka|,0,178,0|-1hc7qjz,0,179,0|-1078wa0,0,179,0|-1078w9z,51,40,0|-ek1w81,51,40,0|-ek1w80,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-cnov01,69,66,1|-cnov00,51,40,0|-csc81,51,40,0|-csc80,57,66,1|-3fdo1,57,66,1|-3fdo0,51,40,0|5xqfz,51,40,0|5xqg0,57,66,1|faozz,57,66,1|fap00,51,40,0|ont3z,51,40,0|ont40,57,66,1|ydqbz,57,66,1|ydqc0,51,40,0|17qufz,51,40,0|17qug0,57,66,1|1h3szz,57,66,1|1h3t00,51,40,0|1qgx3z,51,40,0|1qgx40,57,66,1|1ztvnz,57,66,1|1ztvo0,51,40,0|23fl3z,51,40,0|23fl40,57,66,1|2ijybz,57,66,1|2ijyc0,51,40,0|2ooefz,51,40,0|2ooeg0,57,66,1|31a0zz,57,66,1|31a100,51,40,0|3an53z,51,40,0|3an540,57,66,1|3kd2bz,57,66,1|3kd2c0,51,40,0|3td7rz,51,40,0|3td7s0,57,66,1|4334zz,57,66,1|433500,51,40,0|4cg93z,51,40,0|4cg940,57,66,1|4lt7nz,57,66,1|4lt7o0,51,40,0|4v6brz,51,40,0|4v6bs0,57,66,1|54jabz,57,66,1|54jac0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,36,37,0|79dybz,36,37,0|79dyc0,37,37,0|7h5qjz,37,37,0|7h5qk0,38,40,1|7qip3z,38,40,1|7qip40,37,37,0|7zvt7z,37,37,0|7zvt80,38,40,1|898rrz,38,40,1|898rs0,37,37,0|8ilvvz,37,37,0|8ilvw0,38,40,1|8ryufz,38,40,1|8ryug0,37,37,0|9092jz,37,37,0|9092k0,38,40,1|9aox3z,38,40,1|9aox40,37,37,0|9iz57z,37,37,0|9iz580,38,40,1|9tryfz,38,40,1|9tryg0,37,37,0|a1p7vz,37,37,0|a1p7w0,38,40,1|aci13z,38,40,1|aci140,37,37,0|akfajz,37,37,0|akfak0,38,40,1|av83rz,38,40,1|av83s0,37,37,0|b3ibvz,37,37,0|b3ibw0,38,40,1|bdy6fz,38,40,1|bdy6g0,37,37,0|bm8ejz,37,37,0|bm8ek0,38,40,1|bwo93z,38,40,1|bwo940,37,37,0|c4yh7z,37,37,0|c4yh80,38,40,1|cfrafz,38,40,1|cfrag0,37,37,0|cnojvz,37,37,0|cnojw0,38,40,1|cyhd3z,38,40,1|cyhd40,37,37,0|d6emjz,37,37,0|d6emk0,38,40,1|dh7frz,38,40,1|dh7fs0,37,37,0|dphnvz,37,37,0|dphnw0,38,40,1|dzxifz,38,40,1|dzxig0,37,37,0|e87qjz,37,37,0|e87qk0,38,40,1|einl3z,38,40,1|einl40,37,37,0|eqxt7z,37,37,0|eqxt80,38,40,1|f1dnrz,38,40,1|f1dns0,37,37,0|f9nvvz,37,37,0|f9nvw0,38,40,1|fkgp3z,38,40,1|fkgp40,37,37,0|fsdyjz,37,37,0|fsdyk0,38,40,1|g36rrz,38,40,1|g36rs0,37,37,0|gb417z,37,37,0|gb4180,38,40,1|glwufz,38,40,1|glwug0,37,37,0|gu72jz,37,37,0|gu72k0,38,40,1|h4mx3z,38,40,1|h4mx40,37,37,0|hcx57z,37,37,0|hcx580,38,40,1|hnczrz,38,40,1|hnczs0,37,37,0|hvn7vz,37,37,0|hvn7w0,38,40,1|i6g13z,38,40,1|i6g140,37,37,0|iedajz,37,37,0|iedak0,38,40,1|ip63rz,38,40,1|ip63s0,37,37,0|ix3d7z,37,37,0|ix3d80,38,40,1|j7w6fz,38,40,1|j7w6g0,37,37,0|jeqjvz,37,37,0|jeqjw0,38,40,1|jqz7rz,38,40,1|jqz7s0,37,37,0|jxgmjz,37,37,0|jxgmk0,38,40,1|k9pafz,38,40,1|k9pag0,37,37,0|kg6p7z,37,37,0|kg6p80,38,40,1|ksfd3z,38,40,1|ksfd40,37,37,0|kz9qjz,37,37,0|kz9qk0,38,40,1|lbiefz,38,40,1|lbieg0,37,37,0|lhzt7z,37,37,0|lhzt80,38,40,1|lu8h3z,38,40,1|lu8h40,37,37,0|m0pvvz,37,37,0|m0pvw0,38,40,1|mcyjrz,38,40,1|mcyjs0,37,37,0|mjfyjz,37,37,0|mjfyk0,38,40,1|mvomfz,38,40,1|mvomg0,37,37,0|n2617z,37,37,0|n26180,38,40,1|neep3z,38,40,1|neep40,37,37,0|nkw3vz,37,37,0|nkw3w0,38,40,1|nx4rrz,38,40,1|nx4rs0,37,37,0|o3z57z,37,37,0|o3z580,38,40,1|og7t3z,38,40,1|og7t40,37,37,0|omp7vz,37,37,0|omp7w0,38,40,1|oyxvrz,38,40,1|oyxvs0,37,37,0|p5fajz,37,37,0|p5fak0,38,40,1|phnyfz,38,40,1|phnyg0,37,37,0|po5d7z,37,37,0|po5d80,38,40,1|q0e13z,38,40,1|q0e140,37,37,0|q6vfvz,37,37,0|q6vfw0,38,40,1|qj43rz,38,40,1|qj43s0,37,37,0|qpyh7z,37,37,0|qpyh80,38,40,1|r2753z,38,40,1|r27540,37,37,0|r8ojvz,37,37,0|r8ojw0,38,40,1|rkx7rz,38,40,1|rkx7s0,37,37,0|rremjz,37,37,0|rremk0,38,40,1|s3nafz,38,40,1|s3nag0,37,37,0|sa4p7z,37,37,0|sa4p80,38,40,1|smdd3z,38,40,1|smdd40,37,37,0|ssurvz,37,37,0|ssurw0,38,40,1|t53frz,38,40,1|t53fs0,37,37,0|tbkujz,37,37,0|tbkuk0,38,40,1|tntifz,38,40,1|tntig0,37,37,0|tunvvz,37,37,0|tunvw0,38,40,1|u6wjrz,38,40,1|u6wjs0,37,37,0|uddyjz,37,37,0|uddyk0,38,40,1|upmmfz,38,40,1|upmmg0,37,37,0|uw417z,37,37,0|uw4180,38,40,1|v8cp3z,38,40,1|v8cp40,37,37,0|veu3vz,37,37,0|veu3w0,38,40,1|vr2rrz,38,40,1|vr2rs0,37,37,0|vxk6jz,37,37,0|vxk6k0,38,40,1|w9sufz,38,40,1|w9sug0,37,37,0|wgn7vz,37,37,0|wgn7w0,38,40,1|wsvvrz,38,40,1|wsvvs0,37,37,0|wzdajz,37,37,0|wzdak0,38,40,1|xblyfz,38,40,1|xblyg0,37,37,0|xi3d7z,37,37,0|xi3d80,38,40,1|xuc13z,38,40,1|xuc140,37,37,0|y0tfvz,37,37,0|y0tfw0,38,40,1|yd23rz,38,40,1|yd23s0,37,37,0|yjjijz,37,37,0|yjjik0,38,40,1|yvs6fz,38,40,1|yvs6g0,37,37,0|z29l7z,37,37,0|z29l80,38,40,1|zei93z,38,40,1|zei940,37,37,0\",\"America/St_Barthelemy|,0,41,0|-u6m79w,32,42,0\",\"America/St_Johns|,0,99,0|-18vs8wk,24,99,0|-ris3cl,24,99,0|-ris3ck,72,100,1|-rag64l,72,100,1|-rag64k,24,99,0|-qzp20l,24,99,0|-qzp20k,72,100,1|-qpm64l,72,100,1|-qpm64k,24,99,0|-qfsmcl,24,99,0|-qfsmck,72,100,1|-qapd4l,72,100,1|-qapd4k,24,99,0|-px4ecl,24,99,0|-px4eck,72,100,1|-pnrfsl,72,100,1|-pnrfsk,24,99,0|-peebol,24,99,0|-peebok,72,100,1|-p51d4l,72,100,1|-p51d4k,24,99,0|-ovbacl,24,99,0|-ovback,72,100,1|-ombagl,72,100,1|-ombagk,24,99,0|-ocl7ol,24,99,0|-ocl7ok,72,100,1|-o3l7sl,72,100,1|-o3l7sk,24,99,0|-ntv50l,24,99,0|-ntv50k,72,100,1|-nkv54l,72,100,1|-nkv54k,24,99,0|-nb52cl,24,99,0|-nb52ck,72,100,1|-n252gl,72,100,1|-n252gk,24,99,0|-msezol,24,99,0|-msezok,72,100,1|-mj214l,72,100,1|-mj214k,24,99,0|-m9ox0l,24,99,0|-m9ox0k,72,100,1|-m0bygl,72,100,1|-m0bygk,24,99,0|-lqlvol,24,99,0|-lqlvok,72,100,1|-lhlvsl,72,100,1|-lhlvsk,24,99,0|-l7vt0l,24,99,0|-l7vt0k,72,100,1|-kyvt4l,72,100,1|-kyvt4k,24,99,0|-kp5qcl,24,99,0|-kp5qck,72,100,1|-kg5qgl,72,100,1|-kg5qgk,24,99,0|-k6fnol,24,99,0|-k6fnok,72,100,1|-jxfnsl,72,100,1|-jxfnsk,24,99,0|-jnpl0l,24,99,0|-jnpl0k,72,100,1|-jecmgl,72,100,1|-jecmgk,24,99,0|-j4mjol,24,99,0|-j4mjok,72,100,1|-ivmjsl,72,100,1|-ivmjsk,24,99,0|-ilwh0l,24,99,0|-ilwh0k,72,100,1|-icwh4l,72,100,1|-icwh4k,24,99,0|-i52u8l,24,99,0|-i52u8k,24,101,0|-i36ee1,24,101,0|-i36ee0,72,102,1|-hu6ei1,72,102,1|-hu6ei0,24,101,0|-hk3aa1,24,101,0|-hk3aa0,72,102,1|-hcj521,72,102,1|-hcj520,24,101,0|-h1d7m1,24,101,0|-h1d7m0,72,102,1|-gtt2e1,72,102,1|-gtt2e0,24,101,0|-gin4y1,24,101,0|-gin4y0,72,102,1|-gb2zq1,72,102,1|-gb2zq0,24,101,0|-fzk3m1,24,101,0|-fzk3m0,72,102,1|-fscx21,72,102,1|-fscx20,24,101,0|-fgu0y1,24,101,0|-fgu0y0,72,102,1|-f99vq1,72,102,1|-f99vq0,24,101,0|-ey3ya1,24,101,0|-ey3ya0,72,102,1|-eqjt21,72,102,1|-eqjt20,24,101,0|-efdvm1,24,101,0|-efdvm0,25,102,1|-cq2tg1,25,102,1|-cq2tg0,26,102,1|-cnp7i1,26,102,1|-cnp7i0,24,101,0|-cc6be1,24,101,0|-cc6be0,72,102,1|-c4m661,72,102,1|-c4m660,24,101,0|-btg8q1,24,101,0|-btg8q0,72,102,1|-blw3i1,72,102,1|-blw3i0,24,101,0|-baq621,24,101,0|-baq620,72,102,1|-b360u1,72,102,1|-b360u0,24,101,0|-as03e1,24,101,0|-as03e0,72,102,1|-akfy61,72,102,1|-akfy60,24,101,0|-a8x221,24,101,0|-a8x220,72,102,1|-a1cwu1,72,102,1|-a1cwu0,24,101,0|-9qwwq1,24,101,0|-9qwwq0,72,102,1|-9izsu1,72,102,1|-9izsu0,24,101,0|-986u21,24,101,0|-986u20,72,102,1|-909q61,72,102,1|-909q60,24,101,0|-8pgre1,24,101,0|-8pgre0,72,102,1|-8hjni1,72,102,1|-8hjni0,24,101,0|-86qoq1,24,101,0|-86qoq0,72,102,1|-7ytku1,72,102,1|-7ytku0,24,101,0|-7o0m21,24,101,0|-7o0m20,72,102,1|-7g3i61,72,102,1|-7g3i60,24,101,0|-74xkq1,24,101,0|-74xkq0,72,102,1|-6x0gu1,72,102,1|-6x0gu0,24,101,0|-6m7i21,24,101,0|-6m7i20,72,102,1|-6eae61,72,102,1|-6eae60,24,101,0|-63hfe1,24,101,0|-63hfe0,72,102,1|-5vkbi1,72,102,1|-5vkbi0,24,101,0|-5krcq1,24,101,0|-5krcq0,72,102,1|-5cu8u1,72,102,1|-5cu8u0,24,101,0|-521a21,24,101,0|-521a20,72,102,1|-4sbcu1,72,102,1|-4sbcu0,24,101,0|-4iy8q1,24,101,0|-4iy8q0,72,102,1|-49la61,72,102,1|-49la60,24,101,0|-408621,24,101,0|-408620,72,102,1|-3qv7i1,72,102,1|-3qv7i0,24,101,0|-3hi3e1,24,101,0|-3hi3e0,72,102,1|-3854u1,72,102,1|-3854u0,24,101,0|-2ys0q1,24,101,0|-2ys0q0,72,102,1|-2pf261,72,102,1|-2pf260,24,101,0|-2g1y21,24,101,0|-2g1y20,72,102,1|-26c0u1,72,102,1|-26c0u0,24,101,0|-1xbve1,24,101,0|-1xbve0,72,102,1|-1nly61,72,102,1|-1nly60,24,101,0|-1e8u21,24,101,0|-1e8u20,72,102,1|-14vvi1,72,102,1|-14vvi0,24,101,0|-vire1,24,101,0|-vire0,72,102,1|-m5su1,72,102,1|-m5su0,24,101,0|-csoq1,24,101,0|-csoq0,72,102,1|-3fq61,72,102,1|-3fq60,24,101,0|5xdxz,24,101,0|5xdy0,72,102,1|fachz,72,102,1|faci0,24,101,0|onglz,24,101,0|ongm0,72,102,1|yddtz,72,102,1|yddu0,24,101,0|17qhxz,24,101,0|17qhy0,72,102,1|1h3ghz,72,102,1|1h3gi0,24,101,0|1qgklz,24,101,0|1qgkm0,72,102,1|1ztj5z,72,102,1|1ztj60,24,101,0|296n9z,24,101,0|296na0,72,102,1|2ijltz,72,102,1|2ijlu0,24,101,0|2rwpxz,24,101,0|2rwpy0,72,102,1|319ohz,72,102,1|319oi0,24,101,0|3amslz,24,101,0|3amsm0,72,102,1|3kcptz,72,102,1|3kcpu0,24,101,0|3tcv9z,24,101,0|3tcva0,72,102,1|432shz,72,102,1|432si0,24,101,0|4cfwlz,24,101,0|4cfwm0,72,102,1|4lsv5z,72,102,1|4lsv60,24,101,0|4v5z9z,24,101,0|4v5za0,72,102,1|54ixtz,72,102,1|54ixu0,24,101,0|5dw1xz,24,101,0|5dw1y0,72,102,1|5n90hz,72,102,1|5n90i0,24,101,0|5wm4lz,24,101,0|5wm4m0,72,102,1|65z35z,72,102,1|65z360,24,101,0|6fc79z,24,101,0|6fc7a0,72,102,1|6p24hz,72,102,1|6p24i0,24,101,0|6y29xz,24,101,0|6y29y0,72,102,1|77s75z,72,102,1|77s760,24,101,0|7h5b9z,24,101,0|7h5ba0,72,102,1|7qi9tz,72,102,1|7qi9u0,24,101,0|7zvdxz,24,101,0|7zvdy0,72,102,1|898chz,72,102,1|898ci0,24,101,0|8ilglz,24,101,0|8ilgm0,72,102,1|8ryf5z,72,102,1|8ryf60,24,101,0|908hrn,24,101,0|908hro,72,102,1|9aocbn,72,102,1|9aocbo,24,101,0|9iykfn,24,101,0|9iykfo,88,147,1|9travn,88,147,1|9travo,24,101,0|a1on3n,24,101,0|a1on3o,72,102,1|achgbn,72,102,1|achgbo,24,101,0|akeprn,24,101,0|akepro,72,102,1|av7izn,72,102,1|av7izo,24,101,0|b3hr3n,24,101,0|b3hr3o,72,102,1|bdxlnn,72,102,1|bdxlno,24,101,0|bm7trn,24,101,0|bm7tro,72,102,1|bwnobn,72,102,1|bwnobo,24,101,0|c4xwfn,24,101,0|c4xwfo,72,102,1|cfqpnn,72,102,1|cfqpno,24,101,0|cnnz3n,24,101,0|cnnz3o,72,102,1|cygsbn,72,102,1|cygsbo,24,101,0|d6e1rn,24,101,0|d6e1ro,72,102,1|dh6uzn,72,102,1|dh6uzo,24,101,0|dph33n,24,101,0|dph33o,72,102,1|dzwxnn,72,102,1|dzwxno,24,101,0|e875rn,24,101,0|e875ro,72,102,1|ein0bn,72,102,1|ein0bo,24,101,0|eqx8fn,24,101,0|eqx8fo,72,102,1|f1d2zn,72,102,1|f1d2zo,24,101,0|f9nb3n,24,101,0|f9nb3o,72,102,1|fkg4bn,72,102,1|fkg4bo,24,101,0|fsddrn,24,101,0|fsddro,72,102,1|g366zn,72,102,1|g366zo,24,101,0|gb3gfn,24,101,0|gb3gfo,72,102,1|glw9nn,72,102,1|glw9no,24,101,0|gu6hrn,24,101,0|gu6hro,72,102,1|h4mcbn,72,102,1|h4mcbo,24,101,0|hcwkfn,24,101,0|hcwkfo,72,102,1|hncezn,72,102,1|hncezo,24,101,0|hvmn3n,24,101,0|hvmn3o,72,102,1|i6fgbn,72,102,1|i6fgbo,24,101,0|iecprn,24,101,0|iecpro,72,102,1|ip5izn,72,102,1|ip5izo,24,101,0|ix2sfn,24,101,0|ix2sfo,72,102,1|j7vlnn,72,102,1|j7vlno,24,101,0|jepz3n,24,101,0|jepz3o,72,102,1|jqymzn,72,102,1|jqymzo,24,101,0|jxg1rn,24,101,0|jxg1ro,72,102,1|k9opnn,72,102,1|k9opno,24,101,0|kg64fn,24,101,0|kg64fo,72,102,1|ksesbn,72,102,1|ksesbo,24,101,0|kz95rn,24,101,0|kz95ro,72,102,1|lbhtnn,72,102,1|lbhtno,24,101,0|lhz8fn,24,101,0|lhz8fo,72,102,1|lu81tz,72,102,1|lu81u0,24,101,0|m0pglz,24,101,0|m0pgm0,72,102,1|mcy4hz,72,102,1|mcy4i0,24,101,0|mjfj9z,24,101,0|mjfja0,72,102,1|mvo75z,72,102,1|mvo760,24,101,0|n25lxz,24,101,0|n25ly0,72,102,1|nee9tz,72,102,1|nee9u0,24,101,0|nkvolz,24,101,0|nkvom0,72,102,1|nx4chz,72,102,1|nx4ci0,24,101,0|o3ypxz,24,101,0|o3ypy0,72,102,1|og7dtz,72,102,1|og7du0,24,101,0|omoslz,24,101,0|omosm0,72,102,1|oyxghz,72,102,1|oyxgi0,24,101,0|p5ev9z,24,101,0|p5eva0,72,102,1|phnj5z,72,102,1|phnj60,24,101,0|po4xxz,24,101,0|po4xy0,72,102,1|q0dltz,72,102,1|q0dlu0,24,101,0|q6v0lz,24,101,0|q6v0m0,72,102,1|qj3ohz,72,102,1|qj3oi0,24,101,0|qpy1xz,24,101,0|qpy1y0,72,102,1|r26ptz,72,102,1|r26pu0,24,101,0|r8o4lz,24,101,0|r8o4m0,72,102,1|rkwshz,72,102,1|rkwsi0,24,101,0|rre79z,24,101,0|rre7a0,72,102,1|s3mv5z,72,102,1|s3mv60,24,101,0|sa49xz,24,101,0|sa49y0,72,102,1|smcxtz,72,102,1|smcxu0,24,101,0|ssuclz,24,101,0|ssucm0,72,102,1|t530hz,72,102,1|t530i0,24,101,0|tbkf9z,24,101,0|tbkfa0,72,102,1|tnt35z,72,102,1|tnt360,24,101,0|tunglz,24,101,0|tungm0,72,102,1|u6w4hz,72,102,1|u6w4i0,24,101,0|uddj9z,24,101,0|uddja0,72,102,1|upm75z,72,102,1|upm760,24,101,0|uw3lxz,24,101,0|uw3ly0,72,102,1|v8c9tz,72,102,1|v8c9u0,24,101,0|vetolz,24,101,0|vetom0,72,102,1|vr2chz,72,102,1|vr2ci0,24,101,0|vxjr9z,24,101,0|vxjra0,72,102,1|w9sf5z,72,102,1|w9sf60,24,101,0|wgmslz,24,101,0|wgmsm0,72,102,1|wsvghz,72,102,1|wsvgi0,24,101,0|wzcv9z,24,101,0|wzcva0,72,102,1|xblj5z,72,102,1|xblj60,24,101,0|xi2xxz,24,101,0|xi2xy0,72,102,1|xubltz,72,102,1|xublu0,24,101,0|y0t0lz,24,101,0|y0t0m0,72,102,1|yd1ohz,72,102,1|yd1oi0,24,101,0|yjj39z,24,101,0|yjj3a0,72,102,1|yvrr5z,72,102,1|yvrr60,24,101,0|z295xz,24,101,0|z295y0,72,102,1|zehttz,72,102,1|zehtu0,24,101,0\",\"America/St_Kitts|,0,41,0|-u6m79w,32,42,0\",\"America/St_Lucia|,0,41,0|-u6m79w,32,42,0\",\"America/St_Thomas|,0,41,0|-u6m79w,32,42,0\",\"America/St_Vincent|,0,41,0|-u6m79w,32,42,0\",\"America/Swift_Current|,0,180,0|-xkq9d4,50,66,0|-qzosc1,50,66,0|-qzosc0,52,62,1|-qplwg1,52,62,1|-qplwg0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-ccvz01,50,66,0|-ccvz00,52,62,1|-c48xs1,52,62,1|-c48xs0,50,66,0|-bu5wc1,50,66,0|-bu5wc0,52,62,1|-bm8sg1,52,62,1|-bm8sg0,50,66,0|-bbfto1,50,66,0|-bbfto0,52,62,1|-b3ips1,52,62,1|-b3ips0,50,66,0|-aspr01,50,66,0|-aspr00,52,62,1|-aksn41,52,62,1|-aksn40,50,66,0|-6m78c1,50,66,0|-6m78c0,52,62,1|-6cu9s1,52,62,1|-6cu9s0,50,66,0|-5kr301,50,66,0|-5kr300,52,62,1|-5be4g1,52,62,1|-5be4g0,50,66,0|-5210c1,50,66,0|-5210c0,52,62,1|-4u3wg1,52,62,1|-4u3wg0,50,66,0|-4ixz01,50,66,0|-4ixz00,52,62,1|-4bdts1,52,62,1|-4bdts0,50,66,0|17qrnz,50,66,0|17qro0,45,62,0\",\"America/Tegucigalpa|,0,181,0|-pfzh6k,45,62,0|91ojbz,45,62,0|91ojc0,46,63,1|998ojz,46,63,1|998ok0,45,62,0|9kelzz,45,62,0|9kem00,46,63,1|9ryr7z,46,63,1|9ryr80,45,62,0|iyvsnz,45,62,0|iyvso0,46,63,1|j3m37z,46,63,1|j3m380,45,62,0\",\"America/Thule|,0,182,0|-rvuj9g,32,42,0|b34zbz,32,42,0|b34zc0,54,44,1|bchxvz,54,44,1|bchxw0,32,42,0|blv1zz,32,42,0|blv200,54,44,1|bv80jz,54,44,1|bv80k0,32,42,0|c4y3bz,32,42,0|c4y3c0,54,44,1|cfqwjz,54,44,1|cfqwk0,32,42,0|cno5zz,32,42,0|cno600,54,44,1|cygz7z,54,44,1|cygz80,32,42,0|d6e8nz,32,42,0|d6e8o0,54,44,1|dh71vz,54,44,1|dh71w0,32,42,0|dph9zz,32,42,0|dpha00,54,44,1|dzx4jz,54,44,1|dzx4k0,32,42,0|e87cnz,32,42,0|e87co0,54,44,1|ein77z,54,44,1|ein780,32,42,0|eqxfbz,32,42,0|eqxfc0,54,44,1|f1d9vz,54,44,1|f1d9w0,32,42,0|f9nhzz,32,42,0|f9ni00,54,44,1|fkgb7z,54,44,1|fkgb80,32,42,0|fsdknz,32,42,0|fsdko0,54,44,1|g36dvz,54,44,1|g36dw0,32,42,0|gb3nbz,32,42,0|gb3nc0,54,44,1|glwgjz,54,44,1|glwgk0,32,42,0|gu6onz,32,42,0|gu6oo0,54,44,1|h4mj7z,54,44,1|h4mj80,32,42,0|hcwrbz,32,42,0|hcwrc0,54,44,1|hnclvz,54,44,1|hnclw0,32,42,0|hvmtzz,32,42,0|hvmu00,54,44,1|i6fn7z,54,44,1|i6fn80,32,42,0|iecwnz,32,42,0|iecwo0,54,44,1|ip5pvz,54,44,1|ip5pw0,32,42,0|ix2zbz,32,42,0|ix2zc0,54,44,1|j7vsjz,54,44,1|j7vsk0,32,42,0|jeq5zz,32,42,0|jeq600,54,44,1|jqytvz,54,44,1|jqytw0,32,42,0|jxg8nz,32,42,0|jxg8o0,54,44,1|k9owjz,54,44,1|k9owk0,32,42,0|kg6bbz,32,42,0|kg6bc0,54,44,1|ksez7z,54,44,1|ksez80,32,42,0|kz9cnz,32,42,0|kz9co0,54,44,1|lbi0jz,54,44,1|lbi0k0,32,42,0|lhzfbz,32,42,0|lhzfc0,54,44,1|lu837z,54,44,1|lu8380,32,42,0|m0phzz,32,42,0|m0pi00,54,44,1|mcy5vz,54,44,1|mcy5w0,32,42,0|mjfknz,32,42,0|mjfko0,54,44,1|mvo8jz,54,44,1|mvo8k0,32,42,0|n25nbz,32,42,0|n25nc0,54,44,1|neeb7z,54,44,1|neeb80,32,42,0|nkvpzz,32,42,0|nkvq00,54,44,1|nx4dvz,54,44,1|nx4dw0,32,42,0|o3yrbz,32,42,0|o3yrc0,54,44,1|og7f7z,54,44,1|og7f80,32,42,0|omotzz,32,42,0|omou00,54,44,1|oyxhvz,54,44,1|oyxhw0,32,42,0|p5ewnz,32,42,0|p5ewo0,54,44,1|phnkjz,54,44,1|phnkk0,32,42,0|po4zbz,32,42,0|po4zc0,54,44,1|q0dn7z,54,44,1|q0dn80,32,42,0|q6v1zz,32,42,0|q6v200,54,44,1|qj3pvz,54,44,1|qj3pw0,32,42,0|qpy3bz,32,42,0|qpy3c0,54,44,1|r26r7z,54,44,1|r26r80,32,42,0|r8o5zz,32,42,0|r8o600,54,44,1|rkwtvz,54,44,1|rkwtw0,32,42,0|rre8nz,32,42,0|rre8o0,54,44,1|s3mwjz,54,44,1|s3mwk0,32,42,0|sa4bbz,32,42,0|sa4bc0,54,44,1|smcz7z,54,44,1|smcz80,32,42,0|ssudzz,32,42,0|ssue00,54,44,1|t531vz,54,44,1|t531w0,32,42,0|tbkgnz,32,42,0|tbkgo0,54,44,1|tnt4jz,54,44,1|tnt4k0,32,42,0|tunhzz,32,42,0|tuni00,54,44,1|u6w5vz,54,44,1|u6w5w0,32,42,0|uddknz,32,42,0|uddko0,54,44,1|upm8jz,54,44,1|upm8k0,32,42,0|uw3nbz,32,42,0|uw3nc0,54,44,1|v8cb7z,54,44,1|v8cb80,32,42,0|vetpzz,32,42,0|vetq00,54,44,1|vr2dvz,54,44,1|vr2dw0,32,42,0|vxjsnz,32,42,0|vxjso0,54,44,1|w9sgjz,54,44,1|w9sgk0,32,42,0|wgmtzz,32,42,0|wgmu00,54,44,1|wsvhvz,54,44,1|wsvhw0,32,42,0|wzcwnz,32,42,0|wzcwo0,54,44,1|xblkjz,54,44,1|xblkk0,32,42,0|xi2zbz,32,42,0|xi2zc0,54,44,1|xubn7z,54,44,1|xubn80,32,42,0|y0t1zz,32,42,0|y0t200,54,44,1|yd1pvz,54,44,1|yd1pw0,32,42,0|yjj4nz,32,42,0|yjj4o0,54,44,1|yvrsjz,54,44,1|yvrsk0,32,42,0|z297bz,32,42,0|z297c0,54,44,1|zehv7z,54,44,1|zehv80,32,42,0\",\"America/Thunder_Bay|,0,183,0|-1353bh0,45,62,0|-vbavc1,45,62,0|-vbavc0,49,63,0|-ek24k1,49,63,0|-ek24k0,70,42,1|-cq2tg1,70,42,1|-cq2tg0,71,42,1|-cnp3c1,71,42,1|-cnp3c0,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|onkrz,49,63,0|onks0,62,42,1|ydhzz,62,42,1|ydi00,49,63,0|17qm3z,49,63,0|17qm40,62,42,1|1h3knz,62,42,1|1h3ko0,49,63,0|296rfz,49,63,0|296rg0,62,42,1|2ijpzz,62,42,1|2ijq00,49,63,0|2rwu3z,49,63,0|2rwu40,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Tijuana|,0,184,0|-p1u1s0,50,66,0|-o0a9w1,50,66,0|-o0a9w0,51,40,0|-m7mhw1,51,40,0|-m7mhw0,50,66,0|-kf64k1,50,66,0|-kf64k0,51,40,0|-k84cg1,51,40,0|-k84cg0,57,66,1|-jyrdw1,57,66,1|-jyrdw0,51,40,0|-eg90g1,51,40,0|-eg90g0,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-clhdw1,69,66,1|-clhdw0,51,40,0|-bcgxs1,51,40,0|-bcgxs0,57,66,1|-axv381,57,66,1|-axv380,51,40,0|-86qf01,51,40,0|-86qf00,57,66,1|-7yt8c1,57,66,1|-7yt8c0,51,40,0|-7o0cc1,51,40,0|-7o0cc0,57,66,1|-7g35o1,57,66,1|-7g35o0,51,40,0|-74xb01,51,40,0|-74xb00,57,66,1|-6x04c1,57,66,1|-6x04c0,51,40,0|-6m78c1,51,40,0|-6m78c0,57,66,1|-6ea1o1,57,66,1|-6ea1o0,51,40,0|-63h5o1,51,40,0|-63h5o0,57,66,1|-5vjz01,57,66,1|-5vjz00,51,40,0|-5kr301,51,40,0|-5kr300,57,66,1|-5ctwc1,57,66,1|-5ctwc0,51,40,0|-5210c1,51,40,0|-5210c0,57,66,1|-4u3to1,57,66,1|-4u3to0,51,40,0|3an53z,51,40,0|3an540,57,66,1|3kd2bz,57,66,1|3kd2c0,51,40,0|3td7rz,51,40,0|3td7s0,57,66,1|4334zz,57,66,1|433500,51,40,0|4cg93z,51,40,0|4cg940,57,66,1|4lt7nz,57,66,1|4lt7o0,51,40,0|4v6brz,51,40,0|4v6bs0,57,66,1|54jabz,57,66,1|54jac0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,51,40,0|7h5nrz,51,40,0|7h5ns0,57,66,1|7qimbz,57,66,1|7qimc0,51,40,0|7zvqfz,51,40,0|7zvqg0,57,66,1|898ozz,57,66,1|898p00,51,40,0|8ilt3z,51,40,0|8ilt40,57,66,1|8ryrnz,57,66,1|8ryro0,51,40,0|908zrz,51,40,0|908zs0,57,66,1|9aoubz,57,66,1|9aouc0,51,40,0|9iz2fz,51,40,0|9iz2g0,57,66,1|9trvnz,57,66,1|9trvo0,51,40,0|a1p53z,51,40,0|a1p540,57,66,1|achybz,57,66,1|achyc0,51,40,0|akf7rz,51,40,0|akf7s0,57,66,1|av80zz,57,66,1|av8100,51,40,0|b3i93z,51,40,0|b3i940,57,66,1|bdy3nz,57,66,1|bdy3o0,51,40,0|bm8brz,51,40,0|bm8bs0,57,66,1|bwo6bz,57,66,1|bwo6c0,51,40,0|c4yefz,51,40,0|c4yeg0,57,66,1|cfr7nz,57,66,1|cfr7o0,51,40,0|cnoh3z,51,40,0|cnoh40,57,66,1|cyhabz,57,66,1|cyhac0,51,40,0|d6ejrz,51,40,0|d6ejs0,57,66,1|dh7czz,57,66,1|dh7d00,51,40,0|dphl3z,51,40,0|dphl40,57,66,1|dzxfnz,57,66,1|dzxfo0,51,40,0|e87nrz,51,40,0|e87ns0,57,66,1|einibz,57,66,1|einic0,51,40,0|eqxqfz,51,40,0|eqxqg0,57,66,1|f1dkzz,57,66,1|f1dl00,51,40,0|f9nt3z,51,40,0|f9nt40,57,66,1|fkgmbz,57,66,1|fkgmc0,51,40,0|fsdvrz,51,40,0|fsdvs0,57,66,1|g36ozz,57,66,1|g36p00,51,40,0|gb3yfz,51,40,0|gb3yg0,57,66,1|glwrnz,57,66,1|glwro0,51,40,0|gu6zrz,51,40,0|gu6zs0,57,66,1|h4mubz,57,66,1|h4muc0,51,40,0|hcx2fz,51,40,0|hcx2g0,57,66,1|hncwzz,57,66,1|hncx00,51,40,0|hvn53z,51,40,0|hvn540,57,66,1|i6fybz,57,66,1|i6fyc0,51,40,0|ied7rz,51,40,0|ied7s0,57,66,1|ip60zz,57,66,1|ip6100,51,40,0|ix3afz,51,40,0|ix3ag0,57,66,1|j7w3nz,57,66,1|j7w3o0,51,40,0|jftd3z,51,40,0|jftd40,57,66,1|jqm6bz,57,66,1|jqm6c0,51,40,0|jywefz,51,40,0|jyweg0,57,66,1|k9c8zz,57,66,1|k9c900,51,40,0|khmh3z,51,40,0|khmh40,57,66,1|ks2bnz,57,66,1|ks2bo0,51,40,0|kz9nrz,51,40,0|kz9ns0,57,66,1|lbibnz,57,66,1|lbibo0,51,40,0|lhzqfz,51,40,0|lhzqg0,57,66,1|lu8ebz,57,66,1|lu8ec0,51,40,0|m0pt3z,51,40,0|m0pt40,57,66,1|mcygzz,57,66,1|mcyh00,51,40,0|mjfvrz,51,40,0|mjfvs0,57,66,1|mvojnz,57,66,1|mvojo0,51,40,0|n25yfz,51,40,0|n25yg0,57,66,1|neembz,57,66,1|neemc0,51,40,0|nkw13z,51,40,0|nkw140,57,66,1|nx4ozz,57,66,1|nx4p00,51,40,0|o3z2fz,51,40,0|o3z2g0,57,66,1|og7qbz,57,66,1|og7qc0,51,40,0|omp53z,51,40,0|omp540,57,66,1|oyxszz,57,66,1|oyxt00,51,40,0|p5f7rz,51,40,0|p5f7s0,57,66,1|phnvnz,57,66,1|phnvo0,51,40,0|po5afz,51,40,0|po5ag0,57,66,1|q0dybz,57,66,1|q0dyc0,51,40,0|q6vd3z,51,40,0|q6vd40,57,66,1|qj40zz,57,66,1|qj4100,51,40,0|qpyefz,51,40,0|qpyeg0,57,66,1|r272bz,57,66,1|r272c0,51,40,0|r8oh3z,51,40,0|r8oh40,57,66,1|rkx4zz,57,66,1|rkx500,51,40,0|rrejrz,51,40,0|rrejs0,57,66,1|s3n7nz,57,66,1|s3n7o0,51,40,0|sa4mfz,51,40,0|sa4mg0,57,66,1|smdabz,57,66,1|smdac0,51,40,0|ssup3z,51,40,0|ssup40,57,66,1|t53czz,57,66,1|t53d00,51,40,0|tbkrrz,51,40,0|tbkrs0,57,66,1|tntfnz,57,66,1|tntfo0,51,40,0|tunt3z,51,40,0|tunt40,57,66,1|u6wgzz,57,66,1|u6wh00,51,40,0|uddvrz,51,40,0|uddvs0,57,66,1|upmjnz,57,66,1|upmjo0,51,40,0|uw3yfz,51,40,0|uw3yg0,57,66,1|v8cmbz,57,66,1|v8cmc0,51,40,0|veu13z,51,40,0|veu140,57,66,1|vr2ozz,57,66,1|vr2p00,51,40,0|vxk3rz,51,40,0|vxk3s0,57,66,1|w9srnz,57,66,1|w9sro0,51,40,0|wgn53z,51,40,0|wgn540,57,66,1|wsvszz,57,66,1|wsvt00,51,40,0|wzd7rz,51,40,0|wzd7s0,57,66,1|xblvnz,57,66,1|xblvo0,51,40,0|xi3afz,51,40,0|xi3ag0,57,66,1|xubybz,57,66,1|xubyc0,51,40,0|y0td3z,51,40,0|y0td40,57,66,1|yd20zz,57,66,1|yd2100,51,40,0|yjjfrz,51,40,0|yjjfs0,57,66,1|yvs3nz,57,66,1|yvs3o0,51,40,0|z29ifz,51,40,0|z29ig0,57,66,1|zei6bz,57,66,1|zei6c0,51,40,0\",\"America/Toronto|,0,185,0|-1353das,49,63,0|-qzoxw1,49,63,0|-qzoxw0,62,42,1|-qpm201,62,42,1|-qpm200,49,63,0|-qhn4u1,49,63,0|-qhn4u0,62,42,1|-q6w4w1,62,42,1|-q6w4w0,49,63,0|-px5wk1,49,63,0|-px5wk0,62,42,1|-pplww1,62,42,1|-pplww0,49,63,0|-pdpwk1,49,63,0|-pdpwk0,62,42,1|-p7e7c1,62,42,1|-p7e7c0,49,63,0|-ouztw1,49,63,0|-ouztw0,62,42,1|-ooiko1,62,42,1|-ooiko0,49,63,0|-oc9r81,49,63,0|-oc9r80,62,42,1|-o5si01,62,42,1|-o5si00,49,63,0|-ntwn81,49,63,0|-ntwn80,62,42,1|-nmpgo1,62,42,1|-nmpgo0,49,63,0|-nb6kk1,49,63,0|-nb6kk0,62,42,1|-n3ze01,62,42,1|-n3ze00,49,63,0|-msghw1,49,63,0|-msghw0,62,42,1|-ml9bc1,62,42,1|-ml9bc0,49,63,0|-m9qf81,49,63,0|-m9qf80,62,42,1|-m26a01,62,42,1|-m26a00,49,63,0|-lr0ck1,49,63,0|-lr0ck0,62,42,1|-lj38o1,62,42,1|-lj38o0,49,63,0|-l8a9w1,49,63,0|-l8a9w0,62,42,1|-l0d601,62,42,1|-l0d600,49,63,0|-kpk781,49,63,0|-kpk780,62,42,1|-khn3c1,62,42,1|-khn3c0,49,63,0|-k6u4k1,49,63,0|-k6u4k0,62,42,1|-jyx0o1,62,42,1|-jyx0o0,49,63,0|-jnr381,49,63,0|-jnr380,62,42,1|-jg6y01,62,42,1|-jg6y00,49,63,0|-j510k1,49,63,0|-j510k0,62,42,1|-ix3wo1,62,42,1|-ix3wo0,49,63,0|-imaxw1,49,63,0|-imaxw0,62,42,1|-iedu01,62,42,1|-iedu00,49,63,0|-i3kv81,49,63,0|-i3kv80,62,42,1|-hvnrc1,62,42,1|-hvnrc0,49,63,0|-hkusk1,49,63,0|-hkusk0,62,42,1|-hcxoo1,62,42,1|-hcxoo0,49,63,0|-h24pw1,49,63,0|-h24pw0,62,42,1|-gu7m01,62,42,1|-gu7m00,49,63,0|-gjen81,49,63,0|-gjen80,62,42,1|-gbhjc1,62,42,1|-gbhjc0,49,63,0|-g0blw1,49,63,0|-g0blw0,62,42,1|-fsrgo1,62,42,1|-fsrgo0,49,63,0|-fhlj81,49,63,0|-fhlj80,62,42,1|-ek24k1,62,42,1|-ek24k0,70,42,1|-cq2tg1,70,42,1|-cq2tg0,71,42,1|-cnp3c1,71,42,1|-cnp3c0,49,63,0|-ccw4k1,49,63,0|-ccw4k0,62,42,1|-c4z0o1,62,42,1|-c4z0o0,49,63,0|-bu67g1,49,63,0|-bu67g0,62,42,1|-bm93k1,62,42,1|-bm93k0,49,63,0|-bbg4s1,49,63,0|-bbg4s0,62,42,1|-b3j0w1,62,42,1|-b3j0w0,49,63,0|-asq241,49,63,0|-asq240,62,42,1|-ahka81,62,42,1|-ahka80,49,63,0|-a9mv81,49,63,0|-a9mv80,62,42,1|-9yu201,62,42,1|-9yu200,49,63,0|-9qwsk1,49,63,0|-9qwsk0,62,42,1|-9izoo1,62,42,1|-9izoo0,49,63,0|-986pw1,49,63,0|-986pw0,62,42,1|-909m01,62,42,1|-909m00,49,63,0|-8pgn81,49,63,0|-8pgn80,62,42,1|-8hjjc1,62,42,1|-8hjjc0,49,63,0|-86qkk1,49,63,0|-86qkk0,62,42,1|-7ytgo1,62,42,1|-7ytgo0,49,63,0|-7o0hw1,49,63,0|-7o0hw0,62,42,1|-7g3e01,62,42,1|-7g3e00,49,63,0|-74xgk1,49,63,0|-74xgk0,62,42,1|-6x0co1,62,42,1|-6x0co0,49,63,0|-6m7dw1,49,63,0|-6m7dw0,62,42,1|-6cufc1,62,42,1|-6cufc0,49,63,0|-63hb81,49,63,0|-63hb80,62,42,1|-5u4co1,62,42,1|-5u4co0,49,63,0|-5kr8k1,49,63,0|-5kr8k0,62,42,1|-5bea01,62,42,1|-5bea00,49,63,0|-5215w1,49,63,0|-5215w0,62,42,1|-4sb8o1,62,42,1|-4sb8o0,49,63,0|-4iy4k1,49,63,0|-4iy4k0,62,42,1|-49l601,62,42,1|-49l600,49,63,0|-4081w1,49,63,0|-4081w0,62,42,1|-3qv3c1,62,42,1|-3qv3c0,49,63,0|-3hhz81,49,63,0|-3hhz80,62,42,1|-3850o1,62,42,1|-3850o0,49,63,0|-2yrwk1,49,63,0|-2yrwk0,62,42,1|-2pey01,62,42,1|-2pey00,49,63,0|-2g1tw1,49,63,0|-2g1tw0,62,42,1|-26bwo1,62,42,1|-26bwo0,49,63,0|-1xbr81,49,63,0|-1xbr80,62,42,1|-1nlu01,62,42,1|-1nlu00,49,63,0|-1e8pw1,49,63,0|-1e8pw0,62,42,1|-14vrc1,62,42,1|-14vrc0,49,63,0|-vin81,49,63,0|-vin80,62,42,1|-m5oo1,62,42,1|-m5oo0,49,63,0|-cskk1,49,63,0|-cskk0,62,42,1|-3fm01,62,42,1|-3fm00,49,63,0|5xi3z,49,63,0|5xi40,62,42,1|fagnz,62,42,1|fago0,49,63,0|onkrz,49,63,0|onks0,62,42,1|ydhzz,62,42,1|ydi00,49,63,0|17qm3z,49,63,0|17qm40,62,42,1|1h3knz,62,42,1|1h3ko0,49,63,0|1qgorz,49,63,0|1qgos0,62,42,1|1ztnbz,62,42,1|1ztnc0,49,63,0|296rfz,49,63,0|296rg0,62,42,1|2ijpzz,62,42,1|2ijq00,49,63,0|2rwu3z,49,63,0|2rwu40,62,42,1|319snz,62,42,1|319so0,49,63,0|3amwrz,49,63,0|3amws0,62,42,1|3kctzz,62,42,1|3kcu00,49,63,0|3tczfz,49,63,0|3tczg0,62,42,1|432wnz,62,42,1|432wo0,49,63,0|4cg0rz,49,63,0|4cg0s0,62,42,1|4lszbz,62,42,1|4lszc0,49,63,0|4v63fz,49,63,0|4v63g0,62,42,1|54j1zz,62,42,1|54j200,49,63,0|5dw63z,49,63,0|5dw640,62,42,1|5n94nz,62,42,1|5n94o0,49,63,0|5wm8rz,49,63,0|5wm8s0,62,42,1|65z7bz,62,42,1|65z7c0,49,63,0|6fcbfz,49,63,0|6fcbg0,62,42,1|6p28nz,62,42,1|6p28o0,49,63,0|6y2e3z,49,63,0|6y2e40,62,42,1|77sbbz,62,42,1|77sbc0,49,63,0|7h5ffz,49,63,0|7h5fg0,62,42,1|7qidzz,62,42,1|7qie00,49,63,0|7zvi3z,49,63,0|7zvi40,62,42,1|898gnz,62,42,1|898go0,49,63,0|8ilkrz,49,63,0|8ilks0,62,42,1|8ryjbz,62,42,1|8ryjc0,49,63,0|908rfz,49,63,0|908rg0,62,42,1|9aolzz,62,42,1|9aom00,49,63,0|9iyu3z,49,63,0|9iyu40,62,42,1|9trnbz,62,42,1|9trnc0,49,63,0|a1owrz,49,63,0|a1ows0,62,42,1|achpzz,62,42,1|achq00,49,63,0|akezfz,49,63,0|akezg0,62,42,1|av7snz,62,42,1|av7so0,49,63,0|b3i0rz,49,63,0|b3i0s0,62,42,1|bdxvbz,62,42,1|bdxvc0,49,63,0|bm83fz,49,63,0|bm83g0,62,42,1|bwnxzz,62,42,1|bwny00,49,63,0|c4y63z,49,63,0|c4y640,62,42,1|cfqzbz,62,42,1|cfqzc0,49,63,0|cno8rz,49,63,0|cno8s0,62,42,1|cyh1zz,62,42,1|cyh200,49,63,0|d6ebfz,49,63,0|d6ebg0,62,42,1|dh74nz,62,42,1|dh74o0,49,63,0|dphcrz,49,63,0|dphcs0,62,42,1|dzx7bz,62,42,1|dzx7c0,49,63,0|e87ffz,49,63,0|e87fg0,62,42,1|ein9zz,62,42,1|eina00,49,63,0|eqxi3z,49,63,0|eqxi40,62,42,1|f1dcnz,62,42,1|f1dco0,49,63,0|f9nkrz,49,63,0|f9nks0,62,42,1|fkgdzz,62,42,1|fkge00,49,63,0|fsdnfz,49,63,0|fsdng0,62,42,1|g36gnz,62,42,1|g36go0,49,63,0|gb3q3z,49,63,0|gb3q40,62,42,1|glwjbz,62,42,1|glwjc0,49,63,0|gu6rfz,49,63,0|gu6rg0,62,42,1|h4mlzz,62,42,1|h4mm00,49,63,0|hcwu3z,49,63,0|hcwu40,62,42,1|hnconz,62,42,1|hncoo0,49,63,0|hvmwrz,49,63,0|hvmws0,62,42,1|i6fpzz,62,42,1|i6fq00,49,63,0|ieczfz,49,63,0|ieczg0,62,42,1|ip5snz,62,42,1|ip5so0,49,63,0|ix323z,49,63,0|ix3240,62,42,1|j7vvbz,62,42,1|j7vvc0,49,63,0|jeq8rz,49,63,0|jeq8s0,62,42,1|jqywnz,62,42,1|jqywo0,49,63,0|jxgbfz,49,63,0|jxgbg0,62,42,1|k9ozbz,62,42,1|k9ozc0,49,63,0|kg6e3z,49,63,0|kg6e40,62,42,1|ksf1zz,62,42,1|ksf200,49,63,0|kz9ffz,49,63,0|kz9fg0,62,42,1|lbi3bz,62,42,1|lbi3c0,49,63,0|lhzi3z,49,63,0|lhzi40,62,42,1|lu85zz,62,42,1|lu8600,49,63,0|m0pkrz,49,63,0|m0pks0,62,42,1|mcy8nz,62,42,1|mcy8o0,49,63,0|mjfnfz,49,63,0|mjfng0,62,42,1|mvobbz,62,42,1|mvobc0,49,63,0|n25q3z,49,63,0|n25q40,62,42,1|needzz,62,42,1|neee00,49,63,0|nkvsrz,49,63,0|nkvss0,62,42,1|nx4gnz,62,42,1|nx4go0,49,63,0|o3yu3z,49,63,0|o3yu40,62,42,1|og7hzz,62,42,1|og7i00,49,63,0|omowrz,49,63,0|omows0,62,42,1|oyxknz,62,42,1|oyxko0,49,63,0|p5ezfz,49,63,0|p5ezg0,62,42,1|phnnbz,62,42,1|phnnc0,49,63,0|po523z,49,63,0|po5240,62,42,1|q0dpzz,62,42,1|q0dq00,49,63,0|q6v4rz,49,63,0|q6v4s0,62,42,1|qj3snz,62,42,1|qj3so0,49,63,0|qpy63z,49,63,0|qpy640,62,42,1|r26tzz,62,42,1|r26u00,49,63,0|r8o8rz,49,63,0|r8o8s0,62,42,1|rkwwnz,62,42,1|rkwwo0,49,63,0|rrebfz,49,63,0|rrebg0,62,42,1|s3mzbz,62,42,1|s3mzc0,49,63,0|sa4e3z,49,63,0|sa4e40,62,42,1|smd1zz,62,42,1|smd200,49,63,0|ssugrz,49,63,0|ssugs0,62,42,1|t534nz,62,42,1|t534o0,49,63,0|tbkjfz,49,63,0|tbkjg0,62,42,1|tnt7bz,62,42,1|tnt7c0,49,63,0|tunkrz,49,63,0|tunks0,62,42,1|u6w8nz,62,42,1|u6w8o0,49,63,0|uddnfz,49,63,0|uddng0,62,42,1|upmbbz,62,42,1|upmbc0,49,63,0|uw3q3z,49,63,0|uw3q40,62,42,1|v8cdzz,62,42,1|v8ce00,49,63,0|vetsrz,49,63,0|vetss0,62,42,1|vr2gnz,62,42,1|vr2go0,49,63,0|vxjvfz,49,63,0|vxjvg0,62,42,1|w9sjbz,62,42,1|w9sjc0,49,63,0|wgmwrz,49,63,0|wgmws0,62,42,1|wsvknz,62,42,1|wsvko0,49,63,0|wzczfz,49,63,0|wzczg0,62,42,1|xblnbz,62,42,1|xblnc0,49,63,0|xi323z,49,63,0|xi3240,62,42,1|xubpzz,62,42,1|xubq00,49,63,0|y0t4rz,49,63,0|y0t4s0,62,42,1|yd1snz,62,42,1|yd1so0,49,63,0|yjj7fz,49,63,0|yjj7g0,62,42,1|yvrvbz,62,42,1|yvrvc0,49,63,0|z29a3z,49,63,0|z29a40,62,42,1|zehxzz,62,42,1|zehy00,49,63,0\",\"America/Tortola|,0,41,0|-u6m79w,32,42,0\",\"America/Vancouver|,0,186,0|-18vrvv8,51,40,0|-qzopk1,51,40,0|-qzopk0,57,66,1|-qplto1,57,66,1|-qplto0,51,40,0|-ek1w81,51,40,0|-ek1w80,68,66,1|-cq2tg1,68,66,1|-cq2tg0,69,66,1|-cnov01,69,66,1|-cnov00,51,40,0|-ccvw81,51,40,0|-ccvw80,57,66,1|-c4ysc1,57,66,1|-c4ysc0,51,40,0|-bu5tk1,51,40,0|-bu5tk0,57,66,1|-bm8po1,57,66,1|-bm8po0,51,40,0|-bbfqw1,51,40,0|-bbfqw0,57,66,1|-b3in01,57,66,1|-b3in00,51,40,0|-aspo81,51,40,0|-aspo80,57,66,1|-akskc1,57,66,1|-akskc0,51,40,0|-a9mmw1,51,40,0|-a9mmw0,57,66,1|-a22ho1,57,66,1|-a22ho0,51,40,0|-9qwk81,51,40,0|-9qwk80,57,66,1|-9izgc1,57,66,1|-9izgc0,51,40,0|-986hk1,51,40,0|-986hk0,57,66,1|-909do1,57,66,1|-909do0,51,40,0|-8pgew1,51,40,0|-8pgew0,57,66,1|-8hjb01,57,66,1|-8hjb00,51,40,0|-86qc81,51,40,0|-86qc80,57,66,1|-7yt8c1,57,66,1|-7yt8c0,51,40,0|-7o09k1,51,40,0|-7o09k0,57,66,1|-7g35o1,57,66,1|-7g35o0,51,40,0|-74x881,51,40,0|-74x880,57,66,1|-6x04c1,57,66,1|-6x04c0,51,40,0|-6m75k1,51,40,0|-6m75k0,57,66,1|-6ea1o1,57,66,1|-6ea1o0,51,40,0|-63h2w1,51,40,0|-63h2w0,57,66,1|-5vjz01,57,66,1|-5vjz00,51,40,0|-5kr081,51,40,0|-5kr080,57,66,1|-5ctwc1,57,66,1|-5ctwc0,51,40,0|-520xk1,51,40,0|-520xk0,57,66,1|-4u3to1,57,66,1|-4u3to0,51,40,0|-4ixw81,51,40,0|-4ixw80,57,66,1|-4bdr01,57,66,1|-4bdr00,51,40,0|-407tk1,51,40,0|-407tk0,57,66,1|-3quv01,57,66,1|-3quv00,51,40,0|-3hhqw1,51,40,0|-3hhqw0,57,66,1|-384sc1,57,66,1|-384sc0,51,40,0|-2yro81,51,40,0|-2yro80,57,66,1|-2pepo1,57,66,1|-2pepo0,51,40,0|-2g1lk1,51,40,0|-2g1lk0,57,66,1|-26boc1,57,66,1|-26boc0,51,40,0|-1xbiw1,51,40,0|-1xbiw0,57,66,1|-1nllo1,57,66,1|-1nllo0,51,40,0|-1e8hk1,51,40,0|-1e8hk0,57,66,1|-14vj01,57,66,1|-14vj00,51,40,0|-view1,51,40,0|-view0,57,66,1|-m5gc1,57,66,1|-m5gc0,51,40,0|-csc81,51,40,0|-csc80,57,66,1|-3fdo1,57,66,1|-3fdo0,51,40,0|5xqfz,51,40,0|5xqg0,57,66,1|faozz,57,66,1|fap00,51,40,0|ont3z,51,40,0|ont40,57,66,1|ydqbz,57,66,1|ydqc0,51,40,0|17qufz,51,40,0|17qug0,57,66,1|1h3szz,57,66,1|1h3t00,51,40,0|1qgx3z,51,40,0|1qgx40,57,66,1|1ztvnz,57,66,1|1ztvo0,51,40,0|296zrz,51,40,0|296zs0,57,66,1|2ijybz,57,66,1|2ijyc0,51,40,0|2rx2fz,51,40,0|2rx2g0,57,66,1|31a0zz,57,66,1|31a100,51,40,0|3an53z,51,40,0|3an540,57,66,1|3kd2bz,57,66,1|3kd2c0,51,40,0|3td7rz,51,40,0|3td7s0,57,66,1|4334zz,57,66,1|433500,51,40,0|4cg93z,51,40,0|4cg940,57,66,1|4lt7nz,57,66,1|4lt7o0,51,40,0|4v6brz,51,40,0|4v6bs0,57,66,1|54jabz,57,66,1|54jac0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,51,40,0|7h5nrz,51,40,0|7h5ns0,57,66,1|7qimbz,57,66,1|7qimc0,51,40,0|7zvqfz,51,40,0|7zvqg0,57,66,1|898ozz,57,66,1|898p00,51,40,0|8ilt3z,51,40,0|8ilt40,57,66,1|8ryrnz,57,66,1|8ryro0,51,40,0|908zrz,51,40,0|908zs0,57,66,1|9aoubz,57,66,1|9aouc0,51,40,0|9iz2fz,51,40,0|9iz2g0,57,66,1|9trvnz,57,66,1|9trvo0,51,40,0|a1p53z,51,40,0|a1p540,57,66,1|achybz,57,66,1|achyc0,51,40,0|akf7rz,51,40,0|akf7s0,57,66,1|av80zz,57,66,1|av8100,51,40,0|b3i93z,51,40,0|b3i940,57,66,1|bdy3nz,57,66,1|bdy3o0,51,40,0|bm8brz,51,40,0|bm8bs0,57,66,1|bwo6bz,57,66,1|bwo6c0,51,40,0|c4yefz,51,40,0|c4yeg0,57,66,1|cfr7nz,57,66,1|cfr7o0,51,40,0|cnoh3z,51,40,0|cnoh40,57,66,1|cyhabz,57,66,1|cyhac0,51,40,0|d6ejrz,51,40,0|d6ejs0,57,66,1|dh7czz,57,66,1|dh7d00,51,40,0|dphl3z,51,40,0|dphl40,57,66,1|dzxfnz,57,66,1|dzxfo0,51,40,0|e87nrz,51,40,0|e87ns0,57,66,1|einibz,57,66,1|einic0,51,40,0|eqxqfz,51,40,0|eqxqg0,57,66,1|f1dkzz,57,66,1|f1dl00,51,40,0|f9nt3z,51,40,0|f9nt40,57,66,1|fkgmbz,57,66,1|fkgmc0,51,40,0|fsdvrz,51,40,0|fsdvs0,57,66,1|g36ozz,57,66,1|g36p00,51,40,0|gb3yfz,51,40,0|gb3yg0,57,66,1|glwrnz,57,66,1|glwro0,51,40,0|gu6zrz,51,40,0|gu6zs0,57,66,1|h4mubz,57,66,1|h4muc0,51,40,0|hcx2fz,51,40,0|hcx2g0,57,66,1|hncwzz,57,66,1|hncx00,51,40,0|hvn53z,51,40,0|hvn540,57,66,1|i6fybz,57,66,1|i6fyc0,51,40,0|ied7rz,51,40,0|ied7s0,57,66,1|ip60zz,57,66,1|ip6100,51,40,0|ix3afz,51,40,0|ix3ag0,57,66,1|j7w3nz,57,66,1|j7w3o0,51,40,0|jeqh3z,51,40,0|jeqh40,57,66,1|jqz4zz,57,66,1|jqz500,51,40,0|jxgjrz,51,40,0|jxgjs0,57,66,1|k9p7nz,57,66,1|k9p7o0,51,40,0|kg6mfz,51,40,0|kg6mg0,57,66,1|ksfabz,57,66,1|ksfac0,51,40,0|kz9nrz,51,40,0|kz9ns0,57,66,1|lbibnz,57,66,1|lbibo0,51,40,0|lhzqfz,51,40,0|lhzqg0,57,66,1|lu8ebz,57,66,1|lu8ec0,51,40,0|m0pt3z,51,40,0|m0pt40,57,66,1|mcygzz,57,66,1|mcyh00,51,40,0|mjfvrz,51,40,0|mjfvs0,57,66,1|mvojnz,57,66,1|mvojo0,51,40,0|n25yfz,51,40,0|n25yg0,57,66,1|neembz,57,66,1|neemc0,51,40,0|nkw13z,51,40,0|nkw140,57,66,1|nx4ozz,57,66,1|nx4p00,51,40,0|o3z2fz,51,40,0|o3z2g0,57,66,1|og7qbz,57,66,1|og7qc0,51,40,0|omp53z,51,40,0|omp540,57,66,1|oyxszz,57,66,1|oyxt00,51,40,0|p5f7rz,51,40,0|p5f7s0,57,66,1|phnvnz,57,66,1|phnvo0,51,40,0|po5afz,51,40,0|po5ag0,57,66,1|q0dybz,57,66,1|q0dyc0,51,40,0|q6vd3z,51,40,0|q6vd40,57,66,1|qj40zz,57,66,1|qj4100,51,40,0|qpyefz,51,40,0|qpyeg0,57,66,1|r272bz,57,66,1|r272c0,51,40,0|r8oh3z,51,40,0|r8oh40,57,66,1|rkx4zz,57,66,1|rkx500,51,40,0|rrejrz,51,40,0|rrejs0,57,66,1|s3n7nz,57,66,1|s3n7o0,51,40,0|sa4mfz,51,40,0|sa4mg0,57,66,1|smdabz,57,66,1|smdac0,51,40,0|ssup3z,51,40,0|ssup40,57,66,1|t53czz,57,66,1|t53d00,51,40,0|tbkrrz,51,40,0|tbkrs0,57,66,1|tntfnz,57,66,1|tntfo0,51,40,0|tunt3z,51,40,0|tunt40,57,66,1|u6wgzz,57,66,1|u6wh00,51,40,0|uddvrz,51,40,0|uddvs0,57,66,1|upmjnz,57,66,1|upmjo0,51,40,0|uw3yfz,51,40,0|uw3yg0,57,66,1|v8cmbz,57,66,1|v8cmc0,51,40,0|veu13z,51,40,0|veu140,57,66,1|vr2ozz,57,66,1|vr2p00,51,40,0|vxk3rz,51,40,0|vxk3s0,57,66,1|w9srnz,57,66,1|w9sro0,51,40,0|wgn53z,51,40,0|wgn540,57,66,1|wsvszz,57,66,1|wsvt00,51,40,0|wzd7rz,51,40,0|wzd7s0,57,66,1|xblvnz,57,66,1|xblvo0,51,40,0|xi3afz,51,40,0|xi3ag0,57,66,1|xubybz,57,66,1|xubyc0,51,40,0|y0td3z,51,40,0|y0td40,57,66,1|yd20zz,57,66,1|yd2100,51,40,0|yjjfrz,51,40,0|yjjfs0,57,66,1|yvs3nz,57,66,1|yvs3o0,51,40,0|z29ifz,51,40,0|z29ig0,57,66,1|zei6bz,57,66,1|zei6c0,51,40,0\",\"America/Whitehorse|,0,187,0|-1079tno,36,37,0|-qzoms1,36,37,0|-qzoms0,64,40,1|-qplqw1,64,40,1|-qplqw0,36,37,0|-qess41,36,37,0|-qess40,64,40,1|-q6kps1,64,40,1|-q6kps0,36,37,0|-ek1tg1,36,37,0|-ek1tg0,65,40,1|-cq2tg1,65,40,1|-cq2tg0,66,40,1|-cnos81,66,40,1|-cnos80,36,37,0|-2g1oc1,36,37,0|-2g1oc0,67,66,1|-26boc1,67,66,1|-26boc0,36,37,0|-1cspo1,36,37,0|-1cspo0,51,40,0|5dwefz,51,40,0|5dweg0,57,66,1|5n9czz,57,66,1|5n9d00,51,40,0|5wmh3z,51,40,0|5wmh40,57,66,1|65zfnz,57,66,1|65zfo0,51,40,0|6fcjrz,51,40,0|6fcjs0,57,66,1|6p2gzz,57,66,1|6p2h00,51,40,0|6y2mfz,51,40,0|6y2mg0,57,66,1|77sjnz,57,66,1|77sjo0,51,40,0|7h5nrz,51,40,0|7h5ns0,57,66,1|7qimbz,57,66,1|7qimc0,51,40,0|7zvqfz,51,40,0|7zvqg0,57,66,1|898ozz,57,66,1|898p00,51,40,0|8ilt3z,51,40,0|8ilt40,57,66,1|8ryrnz,57,66,1|8ryro0,51,40,0|908zrz,51,40,0|908zs0,57,66,1|9aoubz,57,66,1|9aouc0,51,40,0|9iz2fz,51,40,0|9iz2g0,57,66,1|9trvnz,57,66,1|9trvo0,51,40,0|a1p53z,51,40,0|a1p540,57,66,1|achybz,57,66,1|achyc0,51,40,0|akf7rz,51,40,0|akf7s0,57,66,1|av80zz,57,66,1|av8100,51,40,0|b3i93z,51,40,0|b3i940,57,66,1|bdy3nz,57,66,1|bdy3o0,51,40,0|bm8brz,51,40,0|bm8bs0,57,66,1|bwo6bz,57,66,1|bwo6c0,51,40,0|c4yefz,51,40,0|c4yeg0,57,66,1|cfr7nz,57,66,1|cfr7o0,51,40,0|cnoh3z,51,40,0|cnoh40,57,66,1|cyhabz,57,66,1|cyhac0,51,40,0|d6ejrz,51,40,0|d6ejs0,57,66,1|dh7czz,57,66,1|dh7d00,51,40,0|dphl3z,51,40,0|dphl40,57,66,1|dzxfnz,57,66,1|dzxfo0,51,40,0|e87nrz,51,40,0|e87ns0,57,66,1|einibz,57,66,1|einic0,51,40,0|eqxqfz,51,40,0|eqxqg0,57,66,1|f1dkzz,57,66,1|f1dl00,51,40,0|f9nt3z,51,40,0|f9nt40,57,66,1|fkgmbz,57,66,1|fkgmc0,51,40,0|fsdvrz,51,40,0|fsdvs0,57,66,1|g36ozz,57,66,1|g36p00,51,40,0|gb3yfz,51,40,0|gb3yg0,57,66,1|glwrnz,57,66,1|glwro0,51,40,0|gu6zrz,51,40,0|gu6zs0,57,66,1|h4mubz,57,66,1|h4muc0,51,40,0|hcx2fz,51,40,0|hcx2g0,57,66,1|hncwzz,57,66,1|hncx00,51,40,0|hvn53z,51,40,0|hvn540,57,66,1|i6fybz,57,66,1|i6fyc0,51,40,0|ied7rz,51,40,0|ied7s0,57,66,1|ip60zz,57,66,1|ip6100,51,40,0|ix3afz,51,40,0|ix3ag0,57,66,1|j7w3nz,57,66,1|j7w3o0,51,40,0|jeqh3z,51,40,0|jeqh40,57,66,1|jqz4zz,57,66,1|jqz500,51,40,0|jxgjrz,51,40,0|jxgjs0,57,66,1|k9p7nz,57,66,1|k9p7o0,51,40,0|kg6mfz,51,40,0|kg6mg0,57,66,1|ksfabz,57,66,1|ksfac0,51,40,0|kz9nrz,51,40,0|kz9ns0,57,66,1|lbibnz,57,66,1|lbibo0,51,40,0|lhzqfz,51,40,0|lhzqg0,57,66,1|lu8ebz,57,66,1|lu8ec0,51,40,0|m0pt3z,51,40,0|m0pt40,57,66,1|mcygzz,57,66,1|mcyh00,51,40,0|mjfvrz,51,40,0|mjfvs0,57,66,1|mvojnz,57,66,1|mvojo0,51,40,0|n25yfz,51,40,0|n25yg0,57,66,1|neembz,57,66,1|neemc0,51,40,0|nkw13z,51,40,0|nkw140,57,66,1|nx4ozz,57,66,1|nx4p00,51,40,0|o3z2fz,51,40,0|o3z2g0,57,66,1|og7qbz,57,66,1|og7qc0,51,40,0|omp53z,51,40,0|omp540,57,66,1|oyxszz,57,66,1|oyxt00,51,40,0|p5f7rz,51,40,0|p5f7s0,57,66,1|phnvnz,57,66,1|phnvo0,51,40,0|po5afz,51,40,0|po5ag0,57,66,1|q0dybz,57,66,1|q0dyc0,51,40,0|q6vd3z,51,40,0|q6vd40,57,66,1|qj3vfz,57,66,1|qj3vg0,50,66,0\",\"America/Winnipeg|,0,188,0|-171bfcc,45,62,0|-s0s7c1,45,62,0|-s0s7c0,46,63,1|-rt8241,46,63,1|-rt8240,45,62,0|-qzov41,45,62,0|-qzov40,46,63,1|-qplz81,46,63,1|-qplz80,45,62,0|-h11r41,45,62,0|-h11r40,46,63,1|-gu7j81,46,63,1|-gu7j80,45,62,0|-ek21s1,45,62,0|-ek21s0,47,63,1|-cq2tg1,47,63,1|-cq2tg0,48,63,1|-cnp0k1,48,63,1|-cnp0k0,45,62,0|-cc64g1,45,62,0|-cc64g0,46,63,1|-c490k1,46,63,1|-c490k0,45,62,0|-bu5z41,45,62,0|-bu5z40,46,63,1|-bm8v81,46,63,1|-bm8v80,45,62,0|-bbfwg1,45,62,0|-bbfwg0,46,63,1|-b3isk1,46,63,1|-b3isk0,45,62,0|-aspts1,45,62,0|-aspts0,46,63,1|-akspw1,46,63,1|-akspw0,45,62,0|-a9kxs1,45,62,0|-a9kxs0,46,63,1|-a1rj81,46,63,1|-a1rj80,45,62,0|-9qwps1,45,62,0|-9qwps0,46,63,1|-9izlw1,46,63,1|-9izlw0,45,62,0|-986n41,45,62,0|-986n40,46,63,1|-909j81,46,63,1|-909j80,45,62,0|-8pgkg1,45,62,0|-8pgkg0,46,63,1|-8hjgk1,46,63,1|-8hjgk0,45,62,0|-86qhs1,45,62,0|-86qhs0,46,63,1|-7ytdw1,46,63,1|-7ytdw0,45,62,0|-7o0f41,45,62,0|-7o0f40,46,63,1|-7g3b81,46,63,1|-7g3b80,45,62,0|-74xds1,45,62,0|-74xds0,46,63,1|-6x09w1,46,63,1|-6x09w0,45,62,0|-6m7b41,45,62,0|-6m7b40,46,63,1|-6ea781,46,63,1|-6ea780,45,62,0|-63h8g1,45,62,0|-63h8g0,46,63,1|-5vk4k1,46,63,1|-5vk4k0,45,62,0|-5kr5s1,45,62,0|-5kr5s0,46,63,1|-5be781,46,63,1|-5be780,45,62,0|-521341,45,62,0|-521340,46,63,1|-4u3z81,46,63,1|-4u3z80,45,62,0|-3hhwg1,45,62,0|-3hhwg0,46,63,1|-39xr81,46,63,1|-39xr80,45,62,0|-1xbog1,45,62,0|-1xbog0,46,63,1|-1nlog1,46,63,1|-1nlog0,45,62,0|-1e8n41,45,62,0|-1e8n40,46,63,1|-14vls1,46,63,1|-14vls0,45,62,0|-vikg1,45,62,0|-vikg0,46,63,1|-m5j41,46,63,1|-m5j40,45,62,0|-cshs1,45,62,0|-cshs0,46,63,1|-3fgg1,46,63,1|-3fgg0,45,62,0|5xkvz,45,62,0|5xkw0,46,63,1|fam7z,46,63,1|fam80,45,62,0|onnjz,45,62,0|onnk0,46,63,1|ydnjz,46,63,1|ydnk0,45,62,0|17qovz,45,62,0|17qow0,46,63,1|1h3q7z,46,63,1|1h3q80,45,62,0|1qgrjz,45,62,0|1qgrk0,46,63,1|1ztsvz,46,63,1|1ztsw0,45,62,0|296u7z,45,62,0|296u80,46,63,1|2ijvjz,46,63,1|2ijvk0,45,62,0|2rwwvz,45,62,0|2rwww0,46,63,1|319y7z,46,63,1|319y80,45,62,0|3amzjz,45,62,0|3amzk0,46,63,1|3kczjz,46,63,1|3kczk0,45,62,0|3td27z,45,62,0|3td280,46,63,1|43327z,46,63,1|433280,45,62,0|4cg3jz,45,62,0|4cg3k0,46,63,1|4lt4vz,46,63,1|4lt4w0,45,62,0|4v667z,45,62,0|4v6680,46,63,1|54j7jz,46,63,1|54j7k0,45,62,0|5dw8vz,45,62,0|5dw8w0,46,63,1|5n9a7z,46,63,1|5n9a80,45,62,0|5wmbjz,45,62,0|5wmbk0,46,63,1|65zcvz,46,63,1|65zcw0,45,62,0|6fce7z,45,62,0|6fce80,46,63,1|6p2e7z,46,63,1|6p2e80,45,62,0|6y2gvz,45,62,0|6y2gw0,46,63,1|77sgvz,46,63,1|77sgw0,45,62,0|7h5i7z,45,62,0|7h5i80,46,63,1|7qijjz,46,63,1|7qijk0,45,62,0|7zvkvz,45,62,0|7zvkw0,46,63,1|898m7z,46,63,1|898m80,45,62,0|8ilnjz,45,62,0|8ilnk0,46,63,1|8ryovz,46,63,1|8ryow0,45,62,0|908u7z,45,62,0|908u80,46,63,1|9aorjz,46,63,1|9aork0,45,62,0|9iywvz,45,62,0|9iyww0,46,63,1|9trsvz,46,63,1|9trsw0,45,62,0|a1ozjz,45,62,0|a1ozk0,46,63,1|achvjz,46,63,1|achvk0,45,62,0|akf27z,45,62,0|akf280,46,63,1|av7y7z,46,63,1|av7y80,45,62,0|b3i3jz,45,62,0|b3i3k0,46,63,1|bdy0vz,46,63,1|bdy0w0,45,62,0|bm867z,45,62,0|bm8680,46,63,1|bwo3jz,46,63,1|bwo3k0,45,62,0|c4y8vz,45,62,0|c4y8w0,46,63,1|cfr4vz,46,63,1|cfr4w0,45,62,0|cnobjz,45,62,0|cnobk0,46,63,1|cyh7jz,46,63,1|cyh7k0,45,62,0|d6ee7z,45,62,0|d6ee80,46,63,1|dh7a7z,46,63,1|dh7a80,45,62,0|dphfjz,45,62,0|dphfk0,46,63,1|dzxcvz,46,63,1|dzxcw0,45,62,0|e87i7z,45,62,0|e87i80,46,63,1|einfjz,46,63,1|einfk0,45,62,0|eqxkvz,45,62,0|eqxkw0,46,63,1|f1di7z,46,63,1|f1di80,45,62,0|f9nnjz,45,62,0|f9nnk0,46,63,1|fkgjjz,46,63,1|fkgjk0,45,62,0|fsdq7z,45,62,0|fsdq80,46,63,1|g36m7z,46,63,1|g36m80,45,62,0|gb3svz,45,62,0|gb3sw0,46,63,1|glwovz,46,63,1|glwow0,45,62,0|gu6u7z,45,62,0|gu6u80,46,63,1|h4mrjz,46,63,1|h4mrk0,45,62,0|hcwwvz,45,62,0|hcwww0,46,63,1|hncu7z,46,63,1|hncu80,45,62,0|hvmzjz,45,62,0|hvmzk0,46,63,1|i6fvjz,46,63,1|i6fvk0,45,62,0|ied27z,45,62,0|ied280,46,63,1|ip5y7z,46,63,1|ip5y80,45,62,0|ix34vz,45,62,0|ix34w0,46,63,1|j7vy3z,46,63,1|j7vy40,45,62,0|jeqbjz,45,62,0|jeqbk0,46,63,1|jqyzfz,46,63,1|jqyzg0,45,62,0|jxge7z,45,62,0|jxge80,46,63,1|k9p23z,46,63,1|k9p240,45,62,0|kg6gvz,45,62,0|kg6gw0,46,63,1|ksf4rz,46,63,1|ksf4s0,45,62,0|kz9i7z,45,62,0|kz9i80,46,63,1|lbi63z,46,63,1|lbi640,45,62,0|lhzkvz,45,62,0|lhzkw0,46,63,1|lu88rz,46,63,1|lu88s0,45,62,0|m0pnjz,45,62,0|m0pnk0,46,63,1|mcybfz,46,63,1|mcybg0,45,62,0|mjfq7z,45,62,0|mjfq80,46,63,1|mvoe3z,46,63,1|mvoe40,45,62,0|n25svz,45,62,0|n25sw0,46,63,1|neegrz,46,63,1|neegs0,45,62,0|nkvvjz,45,62,0|nkvvk0,46,63,1|nx4jfz,46,63,1|nx4jg0,45,62,0|o3ywvz,45,62,0|o3yww0,46,63,1|og7krz,46,63,1|og7ks0,45,62,0|omozjz,45,62,0|omozk0,46,63,1|oyxnfz,46,63,1|oyxng0,45,62,0|p5f27z,45,62,0|p5f280,46,63,1|phnq3z,46,63,1|phnq40,45,62,0|po54vz,45,62,0|po54w0,46,63,1|q0dsrz,46,63,1|q0dss0,45,62,0|q6v7jz,45,62,0|q6v7k0,46,63,1|qj3vfz,46,63,1|qj3vg0,45,62,0|qpy8vz,45,62,0|qpy8w0,46,63,1|r26wrz,46,63,1|r26ws0,45,62,0|r8objz,45,62,0|r8obk0,46,63,1|rkwzfz,46,63,1|rkwzg0,45,62,0|rree7z,45,62,0|rree80,46,63,1|s3n23z,46,63,1|s3n240,45,62,0|sa4gvz,45,62,0|sa4gw0,46,63,1|smd4rz,46,63,1|smd4s0,45,62,0|ssujjz,45,62,0|ssujk0,46,63,1|t537fz,46,63,1|t537g0,45,62,0|tbkm7z,45,62,0|tbkm80,46,63,1|tnta3z,46,63,1|tnta40,45,62,0|tunnjz,45,62,0|tunnk0,46,63,1|u6wbfz,46,63,1|u6wbg0,45,62,0|uddq7z,45,62,0|uddq80,46,63,1|upme3z,46,63,1|upme40,45,62,0|uw3svz,45,62,0|uw3sw0,46,63,1|v8cgrz,46,63,1|v8cgs0,45,62,0|vetvjz,45,62,0|vetvk0,46,63,1|vr2jfz,46,63,1|vr2jg0,45,62,0|vxjy7z,45,62,0|vxjy80,46,63,1|w9sm3z,46,63,1|w9sm40,45,62,0|wgmzjz,45,62,0|wgmzk0,46,63,1|wsvnfz,46,63,1|wsvng0,45,62,0|wzd27z,45,62,0|wzd280,46,63,1|xblq3z,46,63,1|xblq40,45,62,0|xi34vz,45,62,0|xi34w0,46,63,1|xubsrz,46,63,1|xubss0,45,62,0|y0t7jz,45,62,0|y0t7k0,46,63,1|yd1vfz,46,63,1|yd1vg0,45,62,0|yjja7z,45,62,0|yjja80,46,63,1|yvry3z,46,63,1|yvry40,45,62,0|z29cvz,45,62,0|z29cw0,46,63,1|zei0rz,46,63,1|zei0s0,45,62,0\",\"America/Yakutat|,0,189,0|-1hc7qjz,0,190,0|-1078vgi,0,190,0|-1078vgh,36,37,0|-ek1tg1,36,37,0|-ek1tg0,65,40,1|-cq2tg1,65,40,1|-cq2tg0,66,40,1|-cnos81,66,40,1|-cnos80,36,37,0|-cs9g1,36,37,0|-cs9g0,64,40,1|-3faw1,64,40,1|-3faw0,36,37,0|5xt7z,36,37,0|5xt80,64,40,1|farrz,64,40,1|fars0,36,37,0|onvvz,36,37,0|onvw0,64,40,1|ydt3z,64,40,1|ydt40,36,37,0|17qx7z,36,37,0|17qx80,64,40,1|1h3vrz,64,40,1|1h3vs0,36,37,0|1qgzvz,36,37,0|1qgzw0,64,40,1|1ztyfz,64,40,1|1ztyg0,36,37,0|23fnvz,36,37,0|23fnw0,64,40,1|2ik13z,64,40,1|2ik140,36,37,0|2ooh7z,36,37,0|2ooh80,64,40,1|31a3rz,64,40,1|31a3s0,36,37,0|3an7vz,36,37,0|3an7w0,64,40,1|3kd53z,64,40,1|3kd540,36,37,0|3tdajz,36,37,0|3tdak0,64,40,1|4337rz,64,40,1|4337s0,36,37,0|4cgbvz,36,37,0|4cgbw0,64,40,1|4ltafz,64,40,1|4ltag0,36,37,0|4v6ejz,36,37,0|4v6ek0,64,40,1|54jd3z,64,40,1|54jd40,36,37,0|5dwh7z,36,37,0|5dwh80,64,40,1|5n9frz,64,40,1|5n9fs0,36,37,0|5wmjvz,36,37,0|5wmjw0,64,40,1|65zifz,64,40,1|65zig0,36,37,0|6fcmjz,36,37,0|6fcmk0,64,40,1|6p2jrz,64,40,1|6p2js0,36,37,0|6y2p7z,36,37,0|6y2p80,64,40,1|77smfz,64,40,1|77smg0,36,37,0|79dybz,36,37,0|79dyc0,37,37,0|7h5qjz,37,37,0|7h5qk0,38,40,1|7qip3z,38,40,1|7qip40,37,37,0|7zvt7z,37,37,0|7zvt80,38,40,1|898rrz,38,40,1|898rs0,37,37,0|8ilvvz,37,37,0|8ilvw0,38,40,1|8ryufz,38,40,1|8ryug0,37,37,0|9092jz,37,37,0|9092k0,38,40,1|9aox3z,38,40,1|9aox40,37,37,0|9iz57z,37,37,0|9iz580,38,40,1|9tryfz,38,40,1|9tryg0,37,37,0|a1p7vz,37,37,0|a1p7w0,38,40,1|aci13z,38,40,1|aci140,37,37,0|akfajz,37,37,0|akfak0,38,40,1|av83rz,38,40,1|av83s0,37,37,0|b3ibvz,37,37,0|b3ibw0,38,40,1|bdy6fz,38,40,1|bdy6g0,37,37,0|bm8ejz,37,37,0|bm8ek0,38,40,1|bwo93z,38,40,1|bwo940,37,37,0|c4yh7z,37,37,0|c4yh80,38,40,1|cfrafz,38,40,1|cfrag0,37,37,0|cnojvz,37,37,0|cnojw0,38,40,1|cyhd3z,38,40,1|cyhd40,37,37,0|d6emjz,37,37,0|d6emk0,38,40,1|dh7frz,38,40,1|dh7fs0,37,37,0|dphnvz,37,37,0|dphnw0,38,40,1|dzxifz,38,40,1|dzxig0,37,37,0|e87qjz,37,37,0|e87qk0,38,40,1|einl3z,38,40,1|einl40,37,37,0|eqxt7z,37,37,0|eqxt80,38,40,1|f1dnrz,38,40,1|f1dns0,37,37,0|f9nvvz,37,37,0|f9nvw0,38,40,1|fkgp3z,38,40,1|fkgp40,37,37,0|fsdyjz,37,37,0|fsdyk0,38,40,1|g36rrz,38,40,1|g36rs0,37,37,0|gb417z,37,37,0|gb4180,38,40,1|glwufz,38,40,1|glwug0,37,37,0|gu72jz,37,37,0|gu72k0,38,40,1|h4mx3z,38,40,1|h4mx40,37,37,0|hcx57z,37,37,0|hcx580,38,40,1|hnczrz,38,40,1|hnczs0,37,37,0|hvn7vz,37,37,0|hvn7w0,38,40,1|i6g13z,38,40,1|i6g140,37,37,0|iedajz,37,37,0|iedak0,38,40,1|ip63rz,38,40,1|ip63s0,37,37,0|ix3d7z,37,37,0|ix3d80,38,40,1|j7w6fz,38,40,1|j7w6g0,37,37,0|jeqjvz,37,37,0|jeqjw0,38,40,1|jqz7rz,38,40,1|jqz7s0,37,37,0|jxgmjz,37,37,0|jxgmk0,38,40,1|k9pafz,38,40,1|k9pag0,37,37,0|kg6p7z,37,37,0|kg6p80,38,40,1|ksfd3z,38,40,1|ksfd40,37,37,0|kz9qjz,37,37,0|kz9qk0,38,40,1|lbiefz,38,40,1|lbieg0,37,37,0|lhzt7z,37,37,0|lhzt80,38,40,1|lu8h3z,38,40,1|lu8h40,37,37,0|m0pvvz,37,37,0|m0pvw0,38,40,1|mcyjrz,38,40,1|mcyjs0,37,37,0|mjfyjz,37,37,0|mjfyk0,38,40,1|mvomfz,38,40,1|mvomg0,37,37,0|n2617z,37,37,0|n26180,38,40,1|neep3z,38,40,1|neep40,37,37,0|nkw3vz,37,37,0|nkw3w0,38,40,1|nx4rrz,38,40,1|nx4rs0,37,37,0|o3z57z,37,37,0|o3z580,38,40,1|og7t3z,38,40,1|og7t40,37,37,0|omp7vz,37,37,0|omp7w0,38,40,1|oyxvrz,38,40,1|oyxvs0,37,37,0|p5fajz,37,37,0|p5fak0,38,40,1|phnyfz,38,40,1|phnyg0,37,37,0|po5d7z,37,37,0|po5d80,38,40,1|q0e13z,38,40,1|q0e140,37,37,0|q6vfvz,37,37,0|q6vfw0,38,40,1|qj43rz,38,40,1|qj43s0,37,37,0|qpyh7z,37,37,0|qpyh80,38,40,1|r2753z,38,40,1|r27540,37,37,0|r8ojvz,37,37,0|r8ojw0,38,40,1|rkx7rz,38,40,1|rkx7s0,37,37,0|rremjz,37,37,0|rremk0,38,40,1|s3nafz,38,40,1|s3nag0,37,37,0|sa4p7z,37,37,0|sa4p80,38,40,1|smdd3z,38,40,1|smdd40,37,37,0|ssurvz,37,37,0|ssurw0,38,40,1|t53frz,38,40,1|t53fs0,37,37,0|tbkujz,37,37,0|tbkuk0,38,40,1|tntifz,38,40,1|tntig0,37,37,0|tunvvz,37,37,0|tunvw0,38,40,1|u6wjrz,38,40,1|u6wjs0,37,37,0|uddyjz,37,37,0|uddyk0,38,40,1|upmmfz,38,40,1|upmmg0,37,37,0|uw417z,37,37,0|uw4180,38,40,1|v8cp3z,38,40,1|v8cp40,37,37,0|veu3vz,37,37,0|veu3w0,38,40,1|vr2rrz,38,40,1|vr2rs0,37,37,0|vxk6jz,37,37,0|vxk6k0,38,40,1|w9sufz,38,40,1|w9sug0,37,37,0|wgn7vz,37,37,0|wgn7w0,38,40,1|wsvvrz,38,40,1|wsvvs0,37,37,0|wzdajz,37,37,0|wzdak0,38,40,1|xblyfz,38,40,1|xblyg0,37,37,0|xi3d7z,37,37,0|xi3d80,38,40,1|xuc13z,38,40,1|xuc140,37,37,0|y0tfvz,37,37,0|y0tfw0,38,40,1|yd23rz,38,40,1|yd23s0,37,37,0|yjjijz,37,37,0|yjjik0,38,40,1|yvs6fz,38,40,1|yvs6g0,37,37,0|z29l7z,37,37,0|z29l80,38,40,1|zei93z,38,40,1|zei940,37,37,0\",\"America/Yellowknife|,60,1,0|-i9m2o0,50,66,0|-ek1z01,50,66,0|-ek1z00,58,62,1|-cq2tg1,58,62,1|-cq2tg0,59,62,1|-cnoxs1,59,62,1|-cnoxs0,50,66,0|-2g1tw1,50,66,0|-2g1tw0,61,63,1|-26btw1,61,63,1|-26btw0,50,66,0|5dwbnz,50,66,0|5dwbo0,52,62,1|5n9a7z,52,62,1|5n9a80,50,66,0|5wmebz,50,66,0|5wmec0,52,62,1|65zcvz,52,62,1|65zcw0,50,66,0|6fcgzz,50,66,0|6fch00,52,62,1|6p2e7z,52,62,1|6p2e80,50,66,0|6y2jnz,50,66,0|6y2jo0,52,62,1|77sgvz,52,62,1|77sgw0,50,66,0|7h5kzz,50,66,0|7h5l00,52,62,1|7qijjz,52,62,1|7qijk0,50,66,0|7zvnnz,50,66,0|7zvno0,52,62,1|898m7z,52,62,1|898m80,50,66,0|8ilqbz,50,66,0|8ilqc0,52,62,1|8ryovz,52,62,1|8ryow0,50,66,0|908wzz,50,66,0|908x00,52,62,1|9aorjz,52,62,1|9aork0,50,66,0|9iyznz,50,66,0|9iyzo0,52,62,1|9trsvz,52,62,1|9trsw0,50,66,0|a1p2bz,50,66,0|a1p2c0,52,62,1|achvjz,52,62,1|achvk0,50,66,0|akf4zz,50,66,0|akf500,52,62,1|av7y7z,52,62,1|av7y80,50,66,0|b3i6bz,50,66,0|b3i6c0,52,62,1|bdy0vz,52,62,1|bdy0w0,50,66,0|bm88zz,50,66,0|bm8900,52,62,1|bwo3jz,52,62,1|bwo3k0,50,66,0|c4ybnz,50,66,0|c4ybo0,52,62,1|cfr4vz,52,62,1|cfr4w0,50,66,0|cnoebz,50,66,0|cnoec0,52,62,1|cyh7jz,52,62,1|cyh7k0,50,66,0|d6egzz,50,66,0|d6eh00,52,62,1|dh7a7z,52,62,1|dh7a80,50,66,0|dphibz,50,66,0|dphic0,52,62,1|dzxcvz,52,62,1|dzxcw0,50,66,0|e87kzz,50,66,0|e87l00,52,62,1|einfjz,52,62,1|einfk0,50,66,0|eqxnnz,50,66,0|eqxno0,52,62,1|f1di7z,52,62,1|f1di80,50,66,0|f9nqbz,50,66,0|f9nqc0,52,62,1|fkgjjz,52,62,1|fkgjk0,50,66,0|fsdszz,50,66,0|fsdt00,52,62,1|g36m7z,52,62,1|g36m80,50,66,0|gb3vnz,50,66,0|gb3vo0,52,62,1|glwovz,52,62,1|glwow0,50,66,0|gu6wzz,50,66,0|gu6x00,52,62,1|h4mrjz,52,62,1|h4mrk0,50,66,0|hcwznz,50,66,0|hcwzo0,52,62,1|hncu7z,52,62,1|hncu80,50,66,0|hvn2bz,50,66,0|hvn2c0,52,62,1|i6fvjz,52,62,1|i6fvk0,50,66,0|ied4zz,50,66,0|ied500,52,62,1|ip5y7z,52,62,1|ip5y80,50,66,0|ix37nz,50,66,0|ix37o0,52,62,1|j7w0vz,52,62,1|j7w0w0,50,66,0|jeqebz,50,66,0|jeqec0,52,62,1|jqz27z,52,62,1|jqz280,50,66,0|jxggzz,50,66,0|jxgh00,52,62,1|k9p4vz,52,62,1|k9p4w0,50,66,0|kg6jnz,50,66,0|kg6jo0,52,62,1|ksf7jz,52,62,1|ksf7k0,50,66,0|kz9kzz,50,66,0|kz9l00,52,62,1|lbi8vz,52,62,1|lbi8w0,50,66,0|lhznnz,50,66,0|lhzno0,52,62,1|lu8bjz,52,62,1|lu8bk0,50,66,0|m0pqbz,50,66,0|m0pqc0,52,62,1|mcye7z,52,62,1|mcye80,50,66,0|mjfszz,50,66,0|mjft00,52,62,1|mvogvz,52,62,1|mvogw0,50,66,0|n25vnz,50,66,0|n25vo0,52,62,1|neejjz,52,62,1|neejk0,50,66,0|nkvybz,50,66,0|nkvyc0,52,62,1|nx4m7z,52,62,1|nx4m80,50,66,0|o3yznz,50,66,0|o3yzo0,52,62,1|og7njz,52,62,1|og7nk0,50,66,0|omp2bz,50,66,0|omp2c0,52,62,1|oyxq7z,52,62,1|oyxq80,50,66,0|p5f4zz,50,66,0|p5f500,52,62,1|phnsvz,52,62,1|phnsw0,50,66,0|po57nz,50,66,0|po57o0,52,62,1|q0dvjz,52,62,1|q0dvk0,50,66,0|q6vabz,50,66,0|q6vac0,52,62,1|qj3y7z,52,62,1|qj3y80,50,66,0|qpybnz,50,66,0|qpybo0,52,62,1|r26zjz,52,62,1|r26zk0,50,66,0|r8oebz,50,66,0|r8oec0,52,62,1|rkx27z,52,62,1|rkx280,50,66,0|rregzz,50,66,0|rreh00,52,62,1|s3n4vz,52,62,1|s3n4w0,50,66,0|sa4jnz,50,66,0|sa4jo0,52,62,1|smd7jz,52,62,1|smd7k0,50,66,0|ssumbz,50,66,0|ssumc0,52,62,1|t53a7z,52,62,1|t53a80,50,66,0|tbkozz,50,66,0|tbkp00,52,62,1|tntcvz,52,62,1|tntcw0,50,66,0|tunqbz,50,66,0|tunqc0,52,62,1|u6we7z,52,62,1|u6we80,50,66,0|uddszz,50,66,0|uddt00,52,62,1|upmgvz,52,62,1|upmgw0,50,66,0|uw3vnz,50,66,0|uw3vo0,52,62,1|v8cjjz,52,62,1|v8cjk0,50,66,0|vetybz,50,66,0|vetyc0,52,62,1|vr2m7z,52,62,1|vr2m80,50,66,0|vxk0zz,50,66,0|vxk100,52,62,1|w9sovz,52,62,1|w9sow0,50,66,0|wgn2bz,50,66,0|wgn2c0,52,62,1|wsvq7z,52,62,1|wsvq80,50,66,0|wzd4zz,50,66,0|wzd500,52,62,1|xblsvz,52,62,1|xblsw0,50,66,0|xi37nz,50,66,0|xi37o0,52,62,1|xubvjz,52,62,1|xubvk0,50,66,0|y0tabz,50,66,0|y0tac0,52,62,1|yd1y7z,52,62,1|yd1y80,50,66,0|yjjczz,50,66,0|yjjd00,52,62,1|yvs0vz,52,62,1|yvs0w0,50,66,0|z29fnz,50,66,0|z29fo0,52,62,1|zei3jz,52,62,1|zei3k0,50,66,0\",\"Antarctica/Casey|,60,1,0|-irxc0,89,191,0|kro7bz,89,191,0|kro7c0,90,192,0|kyrizz,90,192,0|kyrj00,89,191,0|ltqknz,89,191,0|ltqko0,90,192,0|lzr5vz,90,192,0|lzr5w0,89,191,0|ofen3z,89,191,0|ofen40,90,192,0|p5dwjz,90,192,0|p5dwk0,89,191,0|pg70vz,89,191,0|pg70w0,90,192,0|pogv3z,90,192,0|pogv40,89,191,0|pytbfz,89,191,0|pytbg0,90,192,0|q6tz3z,90,192,0|q6tz40,89,191,0|qhmv5n,89,191,0|qhmv5o,90,192,0\",\"Antarctica/Davis|,60,1,0|-6rmdc0,91,193,0|-2p2zg1,91,193,0|-2p2zg0,60,1,0|-h6io1,60,1,0|-h6io0,91,193,0|kroa3z,91,193,0|kroa40,92,194,0|kz30vz,92,194,0|kz30w0,91,193,0|ltqnfz,91,193,0|ltqng0,92,194,0|lzre7z,92,194,0|lzre80,91,193,0\",\"Antarctica/DumontDUrville|,60,1,0|-c05eo0,93,195,0|-9dkmg1,93,195,0|-9dkmg0,60,1,0|-6vdk01,60,1,0|-6vdk00,93,195,0\",\"Antarctica/Macquarie|,60,1,0|-10mb9c0,94,195,0|-rsj4w1,94,195,0|-rsj4w0,95,192,1|-rjj281,95,192,1|-rjj280,94,195,0|-qhmeg1,94,195,0|-qhmeg0,60,1,0|-bd1xc1,60,1,0|-bd1xc0,94,195,0|-16cow1,94,195,0|-16cow0,95,192,1|-wznk1,95,192,1|-wznk0,94,195,0|-m6rk1,94,195,0|-m6rk0,95,192,1|-fcgw1,95,192,1|-fcgw0,94,195,0|-3gow1,94,195,0|-3gow0,95,192,1|3dlrz,95,192,1|3dls0,94,195,0|f9drz,94,195,0|f9ds0,95,192,1|mgn3z,95,192,1|mgn40,94,195,0|ycf3z,94,195,0|ycf40,95,192,1|14gsfz,95,192,1|14gsg0,94,195,0|1h2hrz,94,195,0|1h2hs0,95,192,1|1njtrz,95,192,1|1njts0,94,195,0|1zskfz,94,195,0|1zskg0,95,192,1|269wfz,95,192,1|269wg0,94,195,0|2iin3z,94,195,0|2iin40,95,192,1|2ozz3z,95,192,1|2ozz40,94,195,0|318prz,94,195,0|318ps0,95,192,1|3830fz,95,192,1|3830g0,94,195,0|3kbr3z,94,195,0|3kbr40,95,192,1|3qt33z,95,192,1|3qt340,94,195,0|431trz,94,195,0|431ts0,95,192,1|49j5rz,95,192,1|49j5s0,94,195,0|4lrwfz,94,195,0|4lrwg0,95,192,1|4s98fz,95,192,1|4s98g0,94,195,0|54hz3z,94,195,0|54hz40,95,192,1|5azb3z,95,192,1|5azb40,94,195,0|5n81rz,94,195,0|5n81s0,95,192,1|5tpdrz,95,192,1|5tpds0,94,195,0|65y4fz,94,195,0|65y4g0,95,192,1|6dvb3z,95,192,1|6dvb40,94,195,0|6p15rz,94,195,0|6p15s0,95,192,1|6wldrz,95,192,1|6wlds0,94,195,0|77r8fz,94,195,0|77r8g0,95,192,1|7e8kfz,95,192,1|7e8kg0,94,195,0|7qhb3z,94,195,0|7qhb40,95,192,1|7wyn3z,95,192,1|7wyn40,94,195,0|897drz,94,195,0|897ds0,95,192,1|8foprz,95,192,1|8fops0,94,195,0|8rkhrz,94,195,0|8rkhs0,95,192,1|8z4prz,95,192,1|8z4ps0,94,195,0|9anj3z,94,195,0|9anj40,95,192,1|9i7r3z,95,192,1|9i7r40,94,195,0|9tqkfz,94,195,0|9tqkg0,95,192,1|a0xtrz,95,192,1|a0xts0,94,195,0|acgn3z,94,195,0|acgn40,95,192,1|ajnwfz,95,192,1|ajnwg0,94,195,0|av6prz,94,195,0|av6ps0,95,192,1|b33wfz,95,192,1|b33wg0,94,195,0|bctwfz,94,195,0|bctwg0,95,192,1|bltz3z,95,192,1|bltz40,94,195,0|bvjz3z,94,195,0|bvjz40,95,192,1|c4k1rz,95,192,1|c4k1s0,94,195,0|cea1rz,94,195,0|cea1s0,95,192,1|cna4fz,95,192,1|cna4g0,94,195,0|cx04fz,94,195,0|cx04g0,95,192,1|d6073z,95,192,1|d60740,94,195,0|dfq73z,94,195,0|dfq740,95,192,1|dp38fz,95,192,1|dp38g0,94,195,0|dyt8fz,94,195,0|dyt8g0,95,192,1|e7tb3z,95,192,1|e7tb40,94,195,0|ehjb3z,94,195,0|ehjb40,95,192,1|eqjdrz,95,192,1|eqjds0,94,195,0|f09drz,94,195,0|f09ds0,95,192,1|f99gfz,95,192,1|f99gg0,94,195,0|fizgfz,94,195,0|fizgg0,95,192,1|frzj3z,95,192,1|frzj40,94,195,0|fzwprz,94,195,0|fzwps0,95,192,1|gaplrz,95,192,1|gapls0,94,195,0|gkskfz,94,195,0|gkskg0,95,192,1|gtsn3z,95,192,1|gtsn40,94,195,0|h3in3z,94,195,0|h3in40,95,192,1|hciprz,95,192,1|hcips0,94,195,0|hm8prz,94,195,0|hm8ps0,95,192,1|hv8sfz,95,192,1|hv8sg0,94,195,0|i4ysfz,94,195,0|i4ysg0,95,192,1|idyv3z,95,192,1|idyv40,94,195,0|inov3z,94,195,0|inov40,95,192,1|ix1wfz,95,192,1|ix1wg0,94,195,0|j6exrz,94,195,0|j6exs0,95,192,1|jff0fz,95,192,1|jff0g0,94,195,0|jphz3z,94,195,0|jphz40,95,192,1|jyv0fz,95,192,1|jyv0g0,94,195,0|k881rz,94,195,0|k881s0,95,192,1|khl33z,95,192,1|khl340,94,195,0|kqy4fz,94,195,0|kqy4g0,95,192,1|lj18fz,95,192,1|lj18g0,94,195,0|lse9rz,94,195,0|lse9s0,95,192,1|m1rb3z,95,192,1|m1rb40,94,195,0|mbhb3z,94,195,0|mbhb40,95,192,1|mkucfz,95,192,1|mkucg0,94,195,0|mu7drz,94,195,0|mu7ds0,95,192,1|n3kf3z,95,192,1|n3kf40,94,195,0|ncxgfz,94,195,0|ncxgg0,95,192,1|nmahrz,95,192,1|nmahs0,94,195,0|nvnj3z,94,195,0|nvnj40,95,192,1|o50kfz,95,192,1|o50kg0,94,195,0|oedlrz,94,195,0|oedls0,95,192,1|onqn3z,95,192,1|onqn40,94,195,0|ox3ofz,94,195,0|ox3og0,95,192,1|p6gprz,95,192,1|p6gps0,94,195,0|pg6prz,94,195,0|pg6ps0,95,192,1|ppjr3z,95,192,1|ppjr40,94,195,0|pywsfz,94,195,0|pywsg0,95,192,1|q89trz,95,192,1|q89ts0,94,195,0|qhmv3z,94,195,0|qhmv40,95,192,1|qqzwfz,95,192,1|qqzwg0,94,195,0|r0cxrz,94,195,0|r0cxs0,95,192,1|r9pz3z,95,192,1|r9pz40,94,195,0|rj30fz,94,195,0|rj30g0,95,192,1|rsg1rz,95,192,1|rsg1s0,94,195,0|s1t33z,94,195,0|s1t340,95,192,1|sbj33z,95,192,1|sbj340,94,195,0|skw4fz,94,195,0|skw4g0,95,192,1|su95rz,95,192,1|su95s0,94,195,0|t3m73z,94,195,0|t3m740,95,192,1|tcz8fz,95,192,1|tcz8g0,94,195,0|tmc9rz,94,195,0|tmc9s0,95,192,1|tvpb3z,95,192,1|tvpb40,94,195,0|u52cfz,94,195,0|u52cg0,95,192,1|uefdrz,95,192,1|uefds0,94,195,0|unsf3z,94,195,0|unsf40,95,192,1|ux5gfz,95,192,1|ux5gg0,94,195,0|v6vgfz,94,195,0|v6vgg0,95,192,1|vg8hrz,95,192,1|vg8hs0,94,195,0|vplj3z,94,195,0|vplj40,95,192,1|vyykfz,95,192,1|vyykg0,94,195,0|w8blrz,94,195,0|w8bls0,95,192,1|whon3z,95,192,1|whon40,94,195,0|wr1ofz,94,195,0|wr1og0,95,192,1|x0eprz,95,192,1|x0eps0,94,195,0|x9rr3z,94,195,0|x9rr40,95,192,1|xj4sfz,95,192,1|xj4sg0,94,195,0|xshtrz,94,195,0|xshts0,95,192,1|y1uv3z,95,192,1|y1uv40,94,195,0|ybkv3z,94,195,0|ybkv40,95,192,1|ykxwfz,95,192,1|ykxwg0,94,195,0|yuaxrz,94,195,0|yuaxs0,95,192,1|z3nz3z,95,192,1|z3nz40,94,195,0|zd10fz,94,195,0|zd10g0,95,192,1\",\"Antarctica/Mawson|,60,1,0|-8aelc0,96,196,0|krocvz,96,196,0|krocw0,92,194,0\",\"Antarctica/McMurdo|,0,197,0|-1gsoz14,97,198,0|-m01p21,97,198,0|-m01p20,98,199,1|-ltxei1,98,199,1|-ltxei0,97,198,0|-lieie1,97,198,0|-lieie0,98,200,1|-lahd41,98,200,1|-lahd40,97,198,0|-kzofq1,97,198,0|-kzofq0,98,200,1|-krrag1,98,200,1|-krrag0,97,198,0|-kgyd21,97,198,0|-kgyd20,98,200,1|-k917s1,98,200,1|-k917s0,97,198,0|-jy8ae1,97,198,0|-jy8ae0,98,200,1|-jpy6g1,98,200,1|-jpy6g0,97,198,0|-jfi7q1,97,198,0|-jfi7q0,98,200,1|-j783s1,98,200,1|-j783s0,97,198,0|-iws521,97,198,0|-iws520,98,200,1|-imc941,98,200,1|-imc940,97,198,0|-ief121,97,198,0|-ief120,98,200,1|-i3m6g1,98,200,1|-i3m6g0,97,198,0|-hvoye1,97,198,0|-hvoye0,98,200,1|-hkw3s1,98,200,1|-hkw3s0,97,198,0|-hcyvq1,97,198,0|-hcyvq0,98,200,1|-h26141,98,200,1|-h26140,97,198,0|-gu8t21,97,198,0|-gu8t20,98,200,1|-gjfyg1,98,200,1|-gjfyg0,97,198,0|-gbiqe1,97,198,0|-gbiqe0,98,200,1|-g0cx41,98,200,1|-g0cx40,97,198,0|-fssnq1,97,198,0|-fssnq0,98,200,1|-fhmug1,98,200,1|-fhmug0,97,198,0|-f9pme1,97,198,0|-f9pme0,98,200,1|-ciy9c1,98,200,1|-ciy9c0,98,200,0|2ivg7z,98,200,0|2ivg80,99,201,1|2omuvz,99,201,1|2omuw0,98,200,0|318k7z,98,200,0|318k80,99,201,1|382uvz,99,201,1|382uw0,98,200,0|3kbljz,98,200,0|3kblk0,99,201,1|3qsxjz,99,201,1|3qsxk0,98,200,0|431o7z,98,200,0|431o80,99,201,1|49j07z,99,201,1|49j080,98,200,0|4lrqvz,98,200,0|4lrqw0,99,201,1|4s92vz,99,201,1|4s92w0,98,200,0|54htjz,98,200,0|54htk0,99,201,1|5az5jz,99,201,1|5az5k0,98,200,0|5n7w7z,98,200,0|5n7w80,99,201,1|5tp87z,99,201,1|5tp880,98,200,0|65xyvz,98,200,0|65xyw0,99,201,1|6cs9jz,99,201,1|6cs9k0,98,200,0|6p107z,98,200,0|6p1080,99,201,1|6vic7z,99,201,1|6vic80,98,200,0|77r2vz,98,200,0|77r2w0,99,201,1|7e8evz,99,201,1|7e8ew0,98,200,0|7qh5jz,98,200,0|7qh5k0,99,201,1|7wyhjz,99,201,1|7wyhk0,98,200,0|89787z,98,200,0|897880,99,201,1|8fok7z,99,201,1|8fok80,98,200,0|8rxavz,98,200,0|8rxaw0,99,201,1|8yemvz,99,201,1|8yemw0,98,200,0|9andjz,98,200,0|9andk0,99,201,1|9hho7z,99,201,1|9hho80,98,200,0|9tqevz,98,200,0|9tqew0,99,201,1|a07qvz,99,201,1|a07qw0,98,200,0|abdljz,98,200,0|abdlk0,99,201,1|ajnqvz,99,201,1|ajnqw0,98,200,0|au3o7z,98,200,0|au3o80,99,201,1|b2dtjz,99,201,1|b2dtk0,98,200,0|bctqvz,98,200,0|bctqw0,99,201,1|bl3w7z,99,201,1|bl3w80,98,200,0|bvjtjz,98,200,0|bvjtk0,99,201,1|c46xjz,99,201,1|c46xk0,98,200,0|ce9w7z,98,200,0|ce9w80,99,201,1|cmx07z,99,201,1|cmx080,98,200,0|cwzyvz,98,200,0|cwzyw0,99,201,1|d5n2vz,99,201,1|d5n2w0,98,200,0|dfq1jz,98,200,0|dfq1k0,99,201,1|dod5jz,99,201,1|dod5k0,98,200,0|dyt2vz,98,200,0|dyt2w0,99,201,1|e7387z,99,201,1|e73880,98,200,0|ehj5jz,98,200,0|ehj5k0,99,201,1|eptavz,99,201,1|eptaw0,98,200,0|f0987z,98,200,0|f09880,99,201,1|f8wc7z,99,201,1|f8wc80,98,200,0|fizavz,98,200,0|fizaw0,99,201,1|frmevz,99,201,1|frmew0,98,200,0|g1pdjz,98,200,0|g1pdk0,99,201,1|gachjz,99,201,1|gachk0,98,200,0|gksevz,98,200,0|gksew0,99,201,1|gt2k7z,99,201,1|gt2k80,98,200,0|h3ihjz,98,200,0|h3ihk0,99,201,1|hbsmvz,99,201,1|hbsmw0,98,200,0|hm8k7z,98,200,0|hm8k80,99,201,1|huvo7z,99,201,1|huvo80,98,200,0|i4ymvz,98,200,0|i4ymw0,99,201,1|idlqvz,99,201,1|idlqw0,98,200,0|inopjz,98,200,0|inopk0,99,201,1|iwbtjz,99,201,1|iwbtk0,98,200,0|j6es7z,98,200,0|j6es80,99,201,1|jf1w7z,99,201,1|jf1w80,98,200,0|jp4uvz,98,200,0|jp4uw0,99,201,1|jyuuvz,99,201,1|jyuuw0,98,200,0|k7uxjz,98,200,0|k7uxk0,99,201,1|khkxjz,99,201,1|khkxk0,98,200,0|kql07z,98,200,0|kql080,99,201,1|l0b07z,99,201,1|l0b080,98,200,0|l9b2vz,98,200,0|l9b2w0,99,201,1|lj12vz,99,201,1|lj12w0,98,200,0|ls15jz,98,200,0|ls15k0,99,201,1|m1r5jz,99,201,1|m1r5k0,98,200,0|mb46vz,98,200,0|mb46w0,99,201,1|mku6vz,99,201,1|mku6w0,98,200,0|mtu9jz,98,200,0|mtu9k0,99,201,1|n3k9jz,99,201,1|n3k9k0,98,200,0|nckc7z,98,200,0|nckc80,99,201,1|nmac7z,99,201,1|nmac80,98,200,0|nvaevz,98,200,0|nvaew0,99,201,1|o50evz,99,201,1|o50ew0,98,200,0|oe0hjz,98,200,0|oe0hk0,99,201,1|onqhjz,99,201,1|onqhk0,98,200,0|owqk7z,98,200,0|owqk80,99,201,1|p6gk7z,99,201,1|p6gk80,98,200,0|pftljz,98,200,0|pftlk0,99,201,1|ppjljz,99,201,1|ppjlk0,98,200,0|pyjo7z,98,200,0|pyjo80,99,201,1|q89o7z,99,201,1|q89o80,98,200,0|qh9qvz,98,200,0|qh9qw0,99,201,1|qqzqvz,99,201,1|qqzqw0,98,200,0|qzztjz,98,200,0|qzztk0,99,201,1|r9ptjz,99,201,1|r9ptk0,98,200,0|ripw7z,98,200,0|ripw80,99,201,1|rsfw7z,99,201,1|rsfw80,98,200,0|s1fyvz,98,200,0|s1fyw0,99,201,1|sbixjz,99,201,1|sbixk0,98,200,0|skj07z,98,200,0|skj080,99,201,1|su907z,99,201,1|su9080,98,200,0|t392vz,98,200,0|t392w0,99,201,1|tcz2vz,99,201,1|tcz2w0,98,200,0|tlz5jz,98,200,0|tlz5k0,99,201,1|tvp5jz,99,201,1|tvp5k0,98,200,0|u4p87z,98,200,0|u4p880,99,201,1|uef87z,99,201,1|uef880,98,200,0|unfavz,98,200,0|unfaw0,99,201,1|ux5avz,99,201,1|ux5aw0,98,200,0|v6ic7z,98,200,0|v6ic80,99,201,1|vg8c7z,99,201,1|vg8c80,98,200,0|vp8evz,98,200,0|vp8ew0,99,201,1|vyyevz,99,201,1|vyyew0,98,200,0|w7yhjz,98,200,0|w7yhk0,99,201,1|whohjz,99,201,1|whohk0,98,200,0|wqok7z,98,200,0|wqok80,99,201,1|x0ek7z,99,201,1|x0ek80,98,200,0|x9emvz,98,200,0|x9emw0,99,201,1|xj4mvz,99,201,1|xj4mw0,98,200,0|xs4pjz,98,200,0|xs4pk0,99,201,1|y1upjz,99,201,1|y1upk0,98,200,0|yb7qvz,98,200,0|yb7qw0,99,201,1|ykxqvz,99,201,1|ykxqw0,98,200,0|ytxtjz,98,200,0|ytxtk0,99,201,1|z3ntjz,99,201,1|z3ntk0,98,200,0|zcnw7z,98,200,0|zcnw80,99,201,1\",\"Antarctica/Palmer|,60,1,0|-2lxhc0,39,44,1|-2ivzo1,39,44,1|-2ivzo0,42,42,0|-275ow1,42,42,0|-275ow0,39,44,1|-2042c1,39,44,1|-2042c0,42,42,0|-1odrk1,42,42,0|-1odrk0,39,44,1|-1fovo1,39,44,1|-1fovo0,42,42,0|-16brk1,42,42,0|-16brk0,39,44,1|-wluc1,39,44,1|-wluc0,42,42,0|-n8q81,42,42,0|-n8q80,39,44,1|-dvro1,39,44,1|-dvro0,42,42,0|-4ink1,42,42,0|-4ink0,39,44,0|24aizz,39,44,0|24aj00,40,45,1|29bxjz,40,45,1|29bxk0,39,44,0|6fn4bz,39,44,0|6fn4c0,42,42,0|6nz73z,42,42,0|6nz740,39,44,1|6vwazz,39,44,1|6vwb00,42,42,0|76p9rz,42,42,0|76p9s0,39,44,1|7emdnz,39,44,1|7emdo0,42,42,0|7psb3z,42,42,0|7psb40,39,44,1|7xcgbz,39,44,1|7xcgc0,42,42,0|88idrz,42,42,0|88ids0,39,44,1|8g2izz,39,44,1|8g2j00,42,42,0|8r8gfz,42,42,0|8r8gg0,39,44,1|90lezz,39,44,1|90lf00,42,42,0|99yj3z,42,42,0|99yj40,39,44,1|9hvmzz,39,44,1|9hvn00,42,42,0|9solrz,42,42,0|9sols0,39,44,1|a0lpnz,39,44,1|a0lpo0,42,42,0|abrn3z,42,42,0|abrn40,39,44,1|ajbsbz,39,44,1|ajbsc0,42,42,0|at1v3z,42,42,0|at1v40,39,44,1|b21uzz,39,44,1|b21v00,42,42,0|bd7sfz,42,42,0|bd7sg0,39,44,1|bl4wbz,39,44,1|bl4wc0,42,42,0|bvxv3z,42,42,0|bvxv40,39,44,1|c3uyzz,39,44,1|c3uz00,42,42,0|cenxrz,42,42,0|cenxs0,39,44,1|cml1nz,39,44,1|cml1o0,42,42,0|cxe0fz,42,42,0|cxe0g0,39,44,1|d5b4bz,39,44,1|d5b4c0,42,42,0|dgh1rz,42,42,0|dgh1s0,39,44,1|do16zz,39,44,1|do1700,42,42,0|dz74fz,42,42,0|dz74g0,39,44,1|e7u5nz,39,44,1|e7u5o0,42,42,0|ehx73z,42,42,0|ehx740,39,44,1|epuazz,39,44,1|epub00,42,42,0|ezxcfz,42,42,0|ezxcg0,39,44,1|f9n9nz,39,44,1|f9n9o0,42,42,0|fjdcfz,42,42,0|fjdcg0,39,44,1|fragbz,39,44,1|fragc0,42,42,0|g2gdrz,42,42,0|g2gds0,39,44,1|ga0izz,39,44,1|ga0j00,42,42,0|gl6gfz,42,42,0|gl6gg0,39,44,1|gsqlnz,39,44,1|gsqlo0,42,42,0|h3wj3z,42,42,0|h3wj40,39,44,1|hbgobz,39,44,1|hbgoc0,42,42,0|hmmlrz,42,42,0|hmmls0,39,44,1|hujpnz,39,44,1|hujpo0,42,42,0|i5cofz,42,42,0|i5cog0,39,44,1|id9sbz,39,44,1|id9sc0,42,42,0|io2r3z,42,42,0|io2r40,39,44,1|ivzuzz,39,44,1|ivzv00,42,42,0|j75sfz,42,42,0|j75sg0,39,44,1|jepxnz,39,44,1|jepxo0,42,42,0|jpvv3z,42,42,0|jpvv40,39,44,1|jyiwbz,39,44,1|jyiwc0,42,42,0|k8lxrz,42,42,0|k8lxs0,39,44,1|kgj1nz,39,44,1|kgj1o0,42,42,0|krc0fz,42,42,0|krc0g0,39,44,1|l0c0bz,39,44,1|l0c0c0,42,42,0|la233z,42,42,0|la2340,39,44,1|lkuwbz,39,44,1|lkuwc0,42,42,0|lq9f3z,42,42,0|lq9f40,39,44,1|m380bz,39,44,1|m380c0,42,42,0|m9pf3z,42,42,0|m9pf40,39,44,1|mly2zz,39,44,1|mly300,42,42,0|mssgfz,42,42,0|mssgg0,39,44,1|n4o5nz,39,44,1|n4o5o0,42,42,0|nbij3z,42,42,0|nbij40,39,44,1|o776zz,39,44,1|o77700,42,42,0|obvsfz,42,42,0|obvsg0,39,44,1|ohn4bz,39,44,1|ohn4c0,39,44,0\",\"Antarctica/Rothera|,60,1,0|3lxs00,39,44,0\",\"Antarctica/Syowa|,60,1,0|-6qsqo0,100,6,0\",\"Antarctica/Troll|,60,1,0|ibruo0,17,1,0|idzk3z,17,1,0|idzk40,101,11,1|ip5erz,101,11,1|ip5es0,17,1,0|iwpmrz,17,1,0|iwpms0,101,11,1|j7vhfz,101,11,1|j7vhg0,17,1,0|jffpfz,17,1,0|jffpg0,101,11,1|jqlk3z,101,11,1|jqlk40,17,1,0|jyiqrz,17,1,0|jyiqs0,101,11,1|k9bmrz,101,11,1|k9bms0,17,1,0|kh8tfz,17,1,0|kh8tg0,101,11,1|ks1pfz,101,11,1|ks1pg0,17,1,0|kzyw3z,17,1,0|kzyw40,101,11,1|lb4qrz,101,11,1|lb4qs0,17,1,0|lioyrz,17,1,0|lioys0,101,11,1|ltutfz,101,11,1|ltutg0,17,1,0|m1f1fz,17,1,0|m1f1g0,101,11,1|mckw3z,101,11,1|mckw40,17,1,0|mki2rz,17,1,0|mki2s0,101,11,1|mvayrz,101,11,1|mvays0,17,1,0|n385fz,17,1,0|n385g0,101,11,1|ne11fz,101,11,1|ne11g0,17,1,0|nly83z,17,1,0|nly840,101,11,1|nwr43z,101,11,1|nwr440,17,1,0|o4oarz,17,1,0|o4oas0,101,11,1|ofu5fz,101,11,1|ofu5g0,17,1,0|onedfz,17,1,0|onedg0,101,11,1|oyk83z,101,11,1|oyk840,17,1,0|p64g3z,17,1,0|p64g40,101,11,1|phaarz,101,11,1|phaas0,17,1,0|pp7hfz,17,1,0|pp7hg0,101,11,1|q00dfz,101,11,1|q00dg0,17,1,0|q7xk3z,17,1,0|q7xk40,101,11,1|qiqg3z,101,11,1|qiqg40,17,1,0|qqnmrz,17,1,0|qqnms0,101,11,1|r1thfz,101,11,1|r1thg0,17,1,0|r9dpfz,17,1,0|r9dpg0,101,11,1|rkjk3z,101,11,1|rkjk40,17,1,0|rs3s3z,17,1,0|rs3s40,101,11,1|s39mrz,101,11,1|s39ms0,17,1,0|sb6tfz,17,1,0|sb6tg0,101,11,1|slzpfz,101,11,1|slzpg0,17,1,0|stww3z,17,1,0|stww40,101,11,1|t4ps3z,101,11,1|t4ps40,17,1,0|tcmyrz,17,1,0|tcmys0,101,11,1|tnfurz,101,11,1|tnfus0,17,1,0|tvd1fz,17,1,0|tvd1g0,101,11,1|u6iw3z,101,11,1|u6iw40,17,1,0|ue343z,17,1,0|ue3440,101,11,1|up8yrz,101,11,1|up8ys0,17,1,0|uwt6rz,17,1,0|uwt6s0,101,11,1|v7z1fz,101,11,1|v7z1g0,17,1,0|vfw83z,17,1,0|vfw840,101,11,1|vqp43z,101,11,1|vqp440,17,1,0|vymarz,17,1,0|vymas0,101,11,1|w9f6rz,101,11,1|w9f6s0,17,1,0|whcdfz,17,1,0|whcdg0,101,11,1|wsi83z,101,11,1|wsi840,17,1,0|x02g3z,17,1,0|x02g40,101,11,1|xb8arz,101,11,1|xb8as0,17,1,0|xisirz,17,1,0|xisis0,101,11,1|xtydfz,101,11,1|xtydg0,17,1,0|y1ilfz,17,1,0|y1ilg0,101,11,1|ycog3z,101,11,1|ycog40,17,1,0|yklmrz,17,1,0|yklms0,101,11,1|yveirz,101,11,1|yveis0,17,1,0|z3bpfz,17,1,0|z3bpg0,101,11,1|ze4lfz,101,11,1|ze4lg0,17,1,0\",\"Antarctica/Vostok|,60,1,0|-6aaao0,96,196,0\",\"Arctic/Longyearbyen|,0,202,0|-1353tzo,10,10,0|-rzayo1,10,10,0|-rzayo0,11,11,1|-rskiw1,11,11,1|-rskiw0,10,10,0|-fc7s81,10,10,0|-fc7s80,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cnnmk1,11,11,1|-cnnmk0,10,10,0|-5mxh81,10,10,0|-5mxh80,11,11,1|-5d7h81,11,11,1|-5d7h80,10,10,0|-53ufw1,10,10,0|-53ufw0,11,11,1|-4uhek1,11,11,1|-4uhek0,10,10,0|-4l4d81,10,10,0|-4l4d80,11,11,1|-4brbw1,11,11,1|-4brbw0,10,10,0|-42eak1,10,10,0|-42eak0,11,11,1|-3t1981,11,11,1|-3t1980,10,10,0|-3jo7w1,10,10,0|-3jo7w0,11,11,1|-3ab6k1,11,11,1|-3ab6k0,10,10,0|-30y581,10,10,0|-30y580,11,11,1|-2r8581,11,11,1|-2r8580,10,10,0|-2g2ak1,10,10,0|-2g2ak0,11,11,1|-28i2k1,11,11,1|-28i2k0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Asia/Aden|,0,203,0|-bwgbbg,100,6,0\",\"Asia/Almaty|,0,204,0|-nu1a90,92,194,0|-kmr9w1,92,194,0|-kmr9w0,96,196,0|5vaxzz,96,196,0|5vay00,91,193,1|64pr7z,91,193,1|64pr80,96,196,0|6e2vbz,96,196,0|6e2vc0,91,193,1|6nhojz,91,193,1|6nhok0,96,196,0|6wusnz,96,196,0|6wuso0,91,193,1|769lvz,91,193,1|769lw0,96,196,0|7foknz,96,196,0|7foko0,91,193,1|7p1rjz,91,193,1|7p1rk0,96,196,0|7yesvz,96,196,0|7yesw0,91,193,1|87ru7z,91,193,1|87ru80,96,196,0|8h4vjz,96,196,0|8h4vk0,91,193,1|8qhwvz,91,193,1|8qhww0,96,196,0|8zuy7z,96,196,0|8zuy80,91,193,1|997zjz,91,193,1|997zk0,96,196,0|9il0vz,96,196,0|9il0w0,91,193,1|9ry27z,91,193,1|9ry280,96,196,0|a1b3jz,96,196,0|a1b3k0,91,193,1|aao4vz,91,193,1|aao4w0,96,196,0|ak167z,96,196,0|ak1680,91,193,1|atr67z,91,193,1|atr680,96,196,0|b347jz,96,196,0|b347k0,96,196,1|bchbnz,96,196,1|bchbo0,92,194,0|bi8qbz,92,194,0|bi8qc0,96,196,0|blua7z,96,196,0|blua80,91,193,1|bv7bjz,91,193,1|bv7bk0,96,196,0|c4kcvz,96,196,0|c4kcw0,91,193,1|cdxe7z,91,193,1|cdxe80,96,196,0|cnafjz,96,196,0|cnafk0,91,193,1|cwngvz,91,193,1|cwngw0,96,196,0|d60i7z,96,196,0|d60i80,91,193,1|dfdjjz,91,193,1|dfdjk0,96,196,0|dp3jjz,96,196,0|dp3jk0,91,193,1|dzwfjz,91,193,1|dzwfk0,96,196,0|e7tm7z,96,196,0|e7tm80,91,193,1|eimi7z,91,193,1|eimi80,96,196,0|eqjovz,96,196,0|eqjow0,91,193,1|f1ckvz,91,193,1|f1ckw0,96,196,0|f99rjz,96,196,0|f99rk0,91,193,1|fkfm7z,91,193,1|fkfm80,96,196,0|frzu7z,96,196,0|frzu80,91,193,1|g35ovz,91,193,1|g35ow0,96,196,0|gapwvz,96,196,0|gapww0,91,193,1|glvrjz,91,193,1|glvrk0,96,196,0|gtsy7z,96,196,0|gtsy80,91,193,1|h4lu7z,91,193,1|h4lu80,96,196,0|hcj0vz,96,196,0|hcj0w0,91,193,1|hnbwvz,91,193,1|hnbww0,96,196,0|hv93jz,96,196,0|hv93k0,91,193,1|i6ey7z,91,193,1|i6ey80,96,196,0\",\"Asia/Amman|,0,205,0|-kcrtbk,15,11,0|1sed3z,15,11,0|1sed40,16,6,1|1yeybz,16,6,1|1yeyc0,15,11,0|29bmfz,15,11,0|29bmg0,16,6,1|2h6vnz,16,6,1|2h6vo0,15,11,0|2s3jrz,15,11,0|2s3js0,16,6,1|2zyszz,16,6,1|2zyt00,15,11,0|3axbrz,15,11,0|3axbs0,16,6,1|3kdznz,16,6,1|3kdzo0,15,11,0|3tp93z,15,11,0|3tp940,16,6,1|41kibz,16,6,1|41kic0,15,11,0|4cfbrz,15,11,0|4cfbs0,16,6,1|4kakzz,16,6,1|4kal00,15,11,0|7ygt3z,15,11,0|7ygt40,16,6,1|87vmbz,16,6,1|87vmc0,15,11,0|8heafz,15,11,0|8heag0,16,6,1|8qr8zz,16,6,1|8qr900,15,11,0|904d3z,15,11,0|904d40,16,6,1|99hbnz,16,6,1|99hbo0,15,11,0|9iufrz,15,11,0|9iufs0,16,6,1|9skczz,16,6,1|9skd00,15,11,0|a3ivrz,15,11,0|a3ivs0,16,6,1|abafnz,16,6,1|abafo0,15,11,0|alqfrz,15,11,0|alqfs0,16,6,1|au0ibz,16,6,1|au0ic0,15,11,0|b3zufz,15,11,0|b3zug0,16,6,1|bcdmbz,16,6,1|bcdmc0,15,11,0|bmgnrz,15,11,0|bmgns0,16,6,1|bvgnnz,16,6,1|bvgno0,15,11,0|c4trrz,15,11,0|c4trs0,16,6,1|ce6qbz,16,6,1|ce6qc0,15,11,0|cnjufz,15,11,0|cnjug0,16,6,1|cw6vnz,16,6,1|cw6vo0,15,11,0|d6mvrz,15,11,0|d6mvs0,16,6,1|dex13z,16,6,1|dex140,15,11,0|dpcyfz,15,11,0|dpcyg0,16,6,1|dy02fz,16,6,1|dy02g0,15,11,0|e8313z,15,11,0|e83140,16,6,1|egq53z,16,6,1|egq540,15,11,0|eqt3rz,15,11,0|eqt3s0,16,6,1|ezg7rz,16,6,1|ezg7s0,15,11,0|fe5ufz,15,11,0|fe5ug0,16,6,1|fij93z,16,6,1|fij940,15,11,0|fs7efz,15,11,0|fs7eg0,16,6,1|g1mafz,16,6,1|g1mag0,15,11,0|gaxh3z,15,11,0|gaxh40,16,6,1|gkcd3z,16,6,1|gkcd40,15,11,0|gtpefz,15,11,0|gtpeg0,16,6,1|h32frz,16,6,1|h32fs0,15,11,0|hcfh3z,15,11,0|hcfh40,16,6,1|hn8d3z,16,6,1|hn8d40,15,11,0|hv5jrz,15,11,0|hv5js0,16,6,1|i5lh3z,16,6,1|i5lh40,15,11,0|ie8l3z,15,11,0|ie8l40,16,6,1|inlmfz,16,6,1|inlmg0,15,11,0|iwynrz,15,11,0|iwyns0,16,6,1|j7rjrz,16,6,1|j7rjs0,15,11,0|jfoqfz,15,11,0|jfoqg0,16,6,1|jqhmfz,16,6,1|jqhmg0,15,11,0|jyet3z,15,11,0|jyet40,16,6,1|k9knrz,16,6,1|k9kns0,15,11,0|kh4vrz,15,11,0|kh4vs0,16,6,1|ksaqfz,16,6,1|ksaqg0,15,11,0|kzuyfz,15,11,0|kzuyg0,16,6,1|lb0t3z,16,6,1|lb0t40,15,11,0|lixzrz,15,11,0|lixzs0,16,6,1|ltqvrz,16,6,1|ltqvs0,15,11,0|m1o2fz,15,11,0|m1o2g0,16,6,1|my2nnz,16,6,1|my2no0,15,11,0|n347rz,15,11,0|n347s0,16,6,1|nea2fz,16,6,1|nea2g0,15,11,0|nluafz,15,11,0|nluag0,16,6,1|nx053z,16,6,1|nx0540,15,11,0|o4xbrz,15,11,0|o4xbs0,16,6,1|ofq7rz,16,6,1|ofq7s0,15,11,0|onnefz,15,11,0|onneg0,16,6,1|oygafz,16,6,1|oygag0,15,11,0|p6dh3z,15,11,0|p6dh40,16,6,1|ph6d3z,16,6,1|ph6d40,15,11,0|pp3jrz,15,11,0|pp3js0,16,6,1|pzwfrz,16,6,1|pzwfs0,15,11,0|q7tmfz,15,11,0|q7tmg0,16,6,1|qizh3z,16,6,1|qizh40,15,11,0|qqjp3z,15,11,0|qqjp40,16,6,1|r1pjrz,16,6,1|r1pjs0,15,11,0|r9mqfz,15,11,0|r9mqg0,16,6,1|rkfmfz,16,6,1|rkfmg0,15,11,0|rsct3z,15,11,0|rsct40,16,6,1|s35p3z,16,6,1|s35p40,15,11,0|sb2vrz,15,11,0|sb2vs0,16,6,1|slvrrz,16,6,1|slvrs0,15,11,0|stsyfz,15,11,0|stsyg0,16,6,1|t4yt3z,16,6,1|t4yt40,15,11,0|tcj13z,15,11,0|tcj140,16,6,1|tnovrz,16,6,1|tnovs0,15,11,0|tv93rz,15,11,0|tv93s0,16,6,1|u6eyfz,16,6,1|u6eyg0,15,11,0|uec53z,15,11,0|uec540,16,6,1|up513z,16,6,1|up5140,15,11,0|ux27rz,15,11,0|ux27s0,16,6,1|v7v3rz,16,6,1|v7v3s0,15,11,0|vfsafz,15,11,0|vfsag0,16,6,1|vql6fz,16,6,1|vql6g0,15,11,0|vyid3z,15,11,0|vyid40,16,6,1|w9o7rz,16,6,1|w9o7s0,15,11,0|wh8frz,15,11,0|wh8fs0,16,6,1|wseafz,16,6,1|wseag0,15,11,0|x0bh3z,15,11,0|x0bh40,16,6,1|xb4d3z,16,6,1|xb4d40,15,11,0|xj1jrz,15,11,0|xj1js0,16,6,1|xtufrz,16,6,1|xtufs0,15,11,0|y1rmfz,15,11,0|y1rmg0,16,6,1|yckifz,16,6,1|yckig0,15,11,0|ykhp3z,15,11,0|ykhp40,16,6,1|yvnjrz,16,6,1|yvnjs0,15,11,0|z37rrz,15,11,0|z37rs0,16,6,1|zedmfz,16,6,1|zedmg0,15,11,0\",\"Asia/Anadyr|,0,206,0|-nu1sv8,102,200,0|-kmrtc1,102,200,0|-kmrtc0,103,201,0|5vaejz,103,201,0|5vaek0,104,207,1|64p7rz,104,207,1|64p7s0,103,201,0|6e2bvz,103,201,0|6e2bw0,103,201,1|6nh7vz,103,201,1|6nh7w0,102,200,0|6wubzz,102,200,0|6wuc00,103,201,1|76957z,103,201,1|769580,102,200,0|7fo3zz,102,200,0|7fo400,103,201,1|7p1avz,103,201,1|7p1aw0,102,200,0|7yec7z,102,200,0|7yec80,103,201,1|87rdjz,103,201,1|87rdk0,102,200,0|8h4evz,102,200,0|8h4ew0,103,201,1|8qhg7z,103,201,1|8qhg80,102,200,0|8zuhjz,102,200,0|8zuhk0,103,201,1|997ivz,103,201,1|997iw0,102,200,0|9ikk7z,102,200,0|9ikk80,103,201,1|9rxljz,103,201,1|9rxlk0,102,200,0|a1amvz,102,200,0|a1amw0,103,201,1|aano7z,103,201,1|aano80,102,200,0|ak0pjz,102,200,0|ak0pk0,103,201,1|atqpjz,103,201,1|atqpk0,102,200,0|b33qvz,102,200,0|b33qw0,102,200,1|bcguzz,102,200,1|bcgv00,90,192,0|bi89nz,90,192,0|bi89o0,102,200,0|blttjz,102,200,0|blttk0,103,201,1|bv6uvz,103,201,1|bv6uw0,102,200,0|c4jw7z,102,200,0|c4jw80,103,201,1|cdwxjz,103,201,1|cdwxk0,102,200,0|cn9yvz,102,200,0|cn9yw0,103,201,1|cwn07z,103,201,1|cwn080,102,200,0|d601jz,102,200,0|d601k0,103,201,1|dfd2vz,103,201,1|dfd2w0,102,200,0|dp32vz,102,200,0|dp32w0,103,201,1|dzvyvz,103,201,1|dzvyw0,102,200,0|e7t5jz,102,200,0|e7t5k0,103,201,1|eim1jz,103,201,1|eim1k0,102,200,0|eqj87z,102,200,0|eqj880,103,201,1|f1c47z,103,201,1|f1c480,102,200,0|f99avz,102,200,0|f99aw0,103,201,1|fkf5jz,103,201,1|fkf5k0,102,200,0|frzdjz,102,200,0|frzdk0,103,201,1|g3587z,103,201,1|g35880,102,200,0|gapg7z,102,200,0|gapg80,103,201,1|glvavz,103,201,1|glvaw0,102,200,0|gtshjz,102,200,0|gtshk0,103,201,1|h4ldjz,103,201,1|h4ldk0,102,200,0|hcik7z,102,200,0|hcik80,103,201,1|hnbg7z,103,201,1|hnbg80,102,200,0|hv8mvz,102,200,0|hv8mw0,103,201,1|i6ehjz,103,201,1|i6ehk0,102,200,0|idypjz,102,200,0|idypk0,103,201,1|ip4k7z,103,201,1|ip4k80,102,200,0|iwos7z,102,200,0|iwos80,103,201,1|j7umvz,103,201,1|j7umw0,102,200,0|jfeuvz,102,200,0|jfeuw0,103,201,1|jqkpjz,103,201,1|jqkpk0,102,200,0|jyhw7z,102,200,0|jyhw80,103,201,1|k9as7z,103,201,1|k9as80,102,200,0|kh7yvz,102,200,0|kh7yw0,103,201,1|ks0uvz,103,201,1|ks0uw0,102,200,0|kzy1jz,102,200,0|kzy1k0,102,200,1|lb3yzz,102,200,1|lb3z00,90,192,0|lio6zz,90,192,0|lio700,102,200,0\",\"Asia/Aqtau|,0,208,0|-nu15b4,105,209,0|-kmr741,105,209,0|-kmr740,92,194,0|64pwrz,92,194,0|64pws0,96,196,0|6e2vbz,96,196,0|6e2vc0,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,92,194,1|bchefz,92,194,1|bcheg0,105,209,0|bi8t3z,105,209,0|bi8t40,92,194,0|bluczz,92,194,0|blud00,96,196,1|bv7ebz,96,196,1|bv7ec0,92,194,0|c4kfnz,92,194,0|c4kfo0,96,196,1|cdxgzz,96,196,1|cdxh00,92,194,0|cnaibz,92,194,0|cnaic0,96,196,1|cwnjnz,96,196,1|cwnjo0,105,209,0|d60nrz,105,209,0|d60ns0,92,194,1|dfdp3z,92,194,1|dfdp40,105,209,0|dp3p3z,105,209,0|dp3p40,92,194,1|dzwl3z,92,194,1|dzwl40,105,209,0|e7trrz,105,209,0|e7trs0,92,194,1|eimnrz,92,194,1|eimns0,105,209,0|eqjufz,105,209,0|eqjug0,92,194,1|f1cqfz,92,194,1|f1cqg0,105,209,0|f99x3z,105,209,0|f99x40,92,194,1|fkfrrz,92,194,1|fkfrs0,105,209,0|frzzrz,105,209,0|frzzs0,92,194,1|g35ufz,92,194,1|g35ug0,105,209,0|gaq2fz,105,209,0|gaq2g0,92,194,1|glvx3z,92,194,1|glvx40,105,209,0|gtt3rz,105,209,0|gtt3s0,92,194,1|h4lzrz,92,194,1|h4lzs0,105,209,0|hcj6fz,105,209,0|hcj6g0,92,194,1|hnc2fz,92,194,1|hnc2g0,105,209,0|hv993z,105,209,0|hv9940,92,194,1|i6f3rz,92,194,1|i6f3s0,92,194,0\",\"Asia/Aqtobe|,0,210,0|-nu16l4,105,209,0|-kmr741,105,209,0|-kmr740,92,194,0|5vb0rz,92,194,0|5vb0s0,96,196,1|64ptzz,96,196,1|64pu00,96,196,0|6e2vbz,96,196,0|6e2vc0,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,92,194,1|bchefz,92,194,1|bcheg0,105,209,0|bi8t3z,105,209,0|bi8t40,92,194,0|bluczz,92,194,0|blud00,96,196,1|bv7ebz,96,196,1|bv7ec0,92,194,0|c4kfnz,92,194,0|c4kfo0,96,196,1|cdxgzz,96,196,1|cdxh00,92,194,0|cnaibz,92,194,0|cnaic0,96,196,1|cwnjnz,96,196,1|cwnjo0,92,194,0|d60kzz,92,194,0|d60l00,96,196,1|dfdmbz,96,196,1|dfdmc0,92,194,0|dp3mbz,92,194,0|dp3mc0,96,196,1|dzwibz,96,196,1|dzwic0,92,194,0|e7tozz,92,194,0|e7tp00,96,196,1|eimkzz,96,196,1|eiml00,92,194,0|eqjrnz,92,194,0|eqjro0,96,196,1|f1cnnz,96,196,1|f1cno0,92,194,0|f99ubz,92,194,0|f99uc0,96,196,1|fkfozz,96,196,1|fkfp00,92,194,0|frzwzz,92,194,0|frzx00,96,196,1|g35rnz,96,196,1|g35ro0,92,194,0|gapznz,92,194,0|gapzo0,96,196,1|glvubz,96,196,1|glvuc0,92,194,0|gtt0zz,92,194,0|gtt100,96,196,1|h4lwzz,96,196,1|h4lx00,92,194,0|hcj3nz,92,194,0|hcj3o0,96,196,1|hnbznz,96,196,1|hnbzo0,92,194,0|hv96bz,92,194,0|hv96c0,96,196,1|i6f0zz,96,196,1|i6f100,92,194,0\",\"Asia/Ashgabat|,0,211,0|-nu16t8,105,209,0|-kmr741,105,209,0|-kmr740,92,194,0|5vb0rz,92,194,0|5vb0s0,96,196,1|64ptzz,96,196,1|64pu00,92,194,0|6e2y3z,92,194,0|6e2y40,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,92,194,1|bchefz,92,194,1|bcheg0,105,209,0|bi8t3z,105,209,0|bi8t40,92,194,0\",\"Asia/Atyrau|,0,212,0|-nu15m8,100,6,0|-kmr4c1,100,6,0|-kmr4c0,92,194,0|64pwrz,92,194,0|64pws0,96,196,0|6e2vbz,96,196,0|6e2vc0,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,92,194,1|bchefz,92,194,1|bcheg0,105,209,0|bi8t3z,105,209,0|bi8t40,92,194,0|bluczz,92,194,0|blud00,96,196,1|bv7ebz,96,196,1|bv7ec0,92,194,0|c4kfnz,92,194,0|c4kfo0,96,196,1|cdxgzz,96,196,1|cdxh00,92,194,0|cnaibz,92,194,0|cnaic0,96,196,1|cwnjnz,96,196,1|cwnjo0,92,194,0|d60kzz,92,194,0|d60l00,96,196,1|dfdmbz,96,196,1|dfdmc0,92,194,0|dp3mbz,92,194,0|dp3mc0,96,196,1|dzwibz,96,196,1|dzwic0,92,194,0|e7tozz,92,194,0|e7tp00,96,196,1|eimkzz,96,196,1|eiml00,92,194,0|eqjrnz,92,194,0|eqjro0,96,196,1|f1cnnz,96,196,1|f1cno0,92,194,0|f99ubz,92,194,0|f99uc0,92,194,1|fkfrrz,92,194,1|fkfrs0,105,209,0|frzzrz,105,209,0|frzzs0,92,194,1|g35ufz,92,194,1|g35ug0,105,209,0|gaq2fz,105,209,0|gaq2g0,92,194,1|glvx3z,92,194,1|glvx40,105,209,0|gtt3rz,105,209,0|gtt3s0,92,194,1|h4lzrz,92,194,1|h4lzs0,105,209,0|hcj6fz,105,209,0|hcj6g0,92,194,1|hnc2fz,92,194,1|hnc2g0,105,209,0|hv993z,105,209,0|hv9940,92,194,1|i6f3rz,92,194,1|i6f3s0,92,194,0\",\"Asia/Baghdad|,0,213,0|-15r1hk4,53,214,0|-r50g81,53,214,0|-r50g80,100,6,0|6fmnnz,100,6,0|6fmno0,105,209,1|6nhwvz,105,209,1|6nhww0,100,6,0|6wt6bz,100,6,0|6wt6c0,105,209,1|769u7z,105,209,1|769u80,100,6,0|7foszz,100,6,0|7fot00,105,209,1|7p3m7z,105,209,1|7p3m80,100,6,0|7ygqbz,100,6,0|7ygqc0,105,209,1|87rzrz,105,209,1|87rzs0,100,6,0|8h513z,100,6,0|8h5140,105,209,1|8qi2fz,105,209,1|8qi2g0,100,6,0|8zv3rz,100,6,0|8zv3s0,105,209,1|99853z,105,209,1|998540,100,6,0|9il6fz,100,6,0|9il6g0,105,209,1|9ry7rz,105,209,1|9ry7s0,100,6,0|a1b93z,100,6,0|a1b940,105,209,1|aaoafz,105,209,1|aaoag0,100,6,0|ak1brz,100,6,0|ak1bs0,105,209,1|atrbrz,105,209,1|atrbs0,100,6,0|b36dbz,100,6,0|b36dc0,105,209,1|bcl9bz,105,209,1|bcl9c0,100,6,0|bm05bz,100,6,0|bm05c0,105,209,1|bvf1bz,105,209,1|bvf1c0,100,6,0|c4s2nz,100,6,0|c4s2o0,105,209,1|ce6ynz,105,209,1|ce6yo0,100,6,0|cnjzzz,100,6,0|cnk000,105,209,1|cwyvzz,105,209,1|cwyw00,100,6,0|d6bxbz,100,6,0|d6bxc0,105,209,1|dfqtbz,105,209,1|dfqtc0,100,6,0|dp5pbz,100,6,0|dp5pc0,105,209,1|dyklbz,105,209,1|dyklc0,100,6,0|e7xmnz,100,6,0|e7xmo0,105,209,1|ehcinz,105,209,1|ehcio0,100,6,0|eqpjzz,100,6,0|eqpk00,105,209,1|f04fzz,105,209,1|f04g00,100,6,0|f9hhbz,100,6,0|f9hhc0,105,209,1|fiwdbz,105,209,1|fiwdc0,100,6,0|fsb9bz,100,6,0|fsb9c0,105,209,1|g1q5bz,105,209,1|g1q5c0,100,6,0|gb36nz,100,6,0|gb36o0,105,209,1|gki2nz,105,209,1|gki2o0,100,6,0|gtv3zz,100,6,0|gtv400,105,209,1|h39zzz,105,209,1|h3a000,100,6,0|hcn1bz,100,6,0|hcn1c0,105,209,1|hm1xbz,105,209,1|hm1xc0,100,6,0|hvgtbz,100,6,0|hvgtc0,105,209,1|i4vpbz,105,209,1|i4vpc0,100,6,0|ie8qnz,100,6,0|ie8qo0,105,209,1|innmnz,105,209,1|innmo0,100,6,0|ix0nzz,100,6,0|ix0o00,105,209,1|j6fjzz,105,209,1|j6fk00,100,6,0|jfslbz,100,6,0|jfslc0,105,209,1|jp7hbz,105,209,1|jp7hc0,100,6,0\",\"Asia/Bahrain|,0,215,0|-q3gmvk,105,209,0|19d0vz,105,209,0|19d0w0,100,6,0\",\"Asia/Baku|,0,216,0|-nu158c,100,6,0|-6p7kc1,100,6,0|-6p7kc0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,92,194,1|9ry7rz,92,194,1|9ry7s0,105,209,0|a1b93z,105,209,0|a1b940,92,194,1|aaoafz,92,194,1|aaoag0,105,209,0|ak1brz,105,209,0|ak1bs0,92,194,1|atrbrz,92,194,1|atrbs0,105,209,0|b34d3z,105,209,0|b34d40,105,209,1|bchh7z,105,209,1|bchh80,100,6,0|bluijz,100,6,0|bluik0,105,209,1|bv7jvz,105,209,1|bv7jw0,105,209,0|dp3xfz,105,209,0|dp3xg0,92,194,1|dzwtfz,92,194,1|dzwtg0,105,209,0|e7txbz,105,209,0|e7txc0,92,194,1|eimtbz,92,194,1|eimtc0,105,209,0|eqjzzz,105,209,0|eqk000,92,194,1|f1cvzz,92,194,1|f1cw00,105,209,0|f9a2nz,105,209,0|f9a2o0,92,194,1|fkfxbz,92,194,1|fkfxc0,105,209,0|fs05bz,105,209,0|fs05c0,92,194,1|g35zzz,92,194,1|g36000,105,209,0|gaq7zz,105,209,0|gaq800,92,194,1|glw2nz,92,194,1|glw2o0,105,209,0|gtt9bz,105,209,0|gtt9c0,92,194,1|h4m5bz,92,194,1|h4m5c0,105,209,0|hcjbzz,105,209,0|hcjc00,92,194,1|hnc7zz,92,194,1|hnc800,105,209,0|hv9enz,105,209,0|hv9eo0,92,194,1|i6f9bz,92,194,1|i6f9c0,105,209,0|idzhbz,105,209,0|idzhc0,92,194,1|ip5bzz,92,194,1|ip5c00,105,209,0|iwpjzz,105,209,0|iwpk00,92,194,1|j7venz,92,194,1|j7veo0,105,209,0|jffmnz,105,209,0|jffmo0,92,194,1|jqlhbz,92,194,1|jqlhc0,105,209,0|jyinzz,105,209,0|jyio00,92,194,1|k9bjzz,92,194,1|k9bk00,105,209,0|kh8qnz,105,209,0|kh8qo0,92,194,1|ks1mnz,92,194,1|ks1mo0,105,209,0|kzytbz,105,209,0|kzytc0,92,194,1|lb4nzz,92,194,1|lb4o00,105,209,0|liovzz,105,209,0|liow00,92,194,1|ltuqnz,92,194,1|ltuqo0,105,209,0|m1eynz,105,209,0|m1eyo0,92,194,1|mcktbz,92,194,1|mcktc0,105,209,0|mkhzzz,105,209,0|mki000,92,194,1|mvavzz,92,194,1|mvaw00,105,209,0|n382nz,105,209,0|n382o0,92,194,1|ne0ynz,92,194,1|ne0yo0,105,209,0|nly5bz,105,209,0|nly5c0,92,194,1|nwr1bz,92,194,1|nwr1c0,105,209,0\",\"Asia/Bangkok|,0,217,0|-1ayyla4,53,217,0|-pysda5,53,217,0|-pysda4,91,193,0\",\"Asia/Barnaul|,0,218,0|-q4ljic,96,196,0|-kmrco1,96,196,0|-kmrco0,91,193,0|5vav7z,91,193,0|5vav80,89,191,1|64pofz,89,191,1|64pog0,91,193,0|6e2sjz,91,193,0|6e2sk0,89,191,1|6nhlrz,89,191,1|6nhls0,91,193,0|6wupvz,91,193,0|6wupw0,89,191,1|769j3z,89,191,1|769j40,91,193,0|7fohvz,91,193,0|7fohw0,89,191,1|7p1orz,89,191,1|7p1os0,91,193,0|7yeq3z,91,193,0|7yeq40,89,191,1|87rrfz,89,191,1|87rrg0,91,193,0|8h4srz,91,193,0|8h4ss0,89,191,1|8qhu3z,89,191,1|8qhu40,91,193,0|8zuvfz,91,193,0|8zuvg0,89,191,1|997wrz,89,191,1|997ws0,91,193,0|9iky3z,91,193,0|9iky40,89,191,1|9rxzfz,89,191,1|9rxzg0,91,193,0|a1b0rz,91,193,0|a1b0s0,89,191,1|aao23z,89,191,1|aao240,91,193,0|ak13fz,91,193,0|ak13g0,89,191,1|atr3fz,89,191,1|atr3g0,91,193,0|b344rz,91,193,0|b344s0,91,193,1|bch8vz,91,193,1|bch8w0,96,196,0|bi8njz,96,196,0|bi8nk0,91,193,0|blu7fz,91,193,0|blu7g0,89,191,1|bv78rz,89,191,1|bv78s0,91,193,0|c4ka3z,91,193,0|c4ka40,89,191,1|cdxbfz,89,191,1|cdxbg0,91,193,0|cnacrz,91,193,0|cnacs0,89,191,1|cwne3z,89,191,1|cwne40,91,193,0|d60ffz,91,193,0|d60fg0,89,191,1|d98v3z,89,191,1|d98v40,91,193,1|dfdjjz,91,193,1|dfdjk0,96,196,0|dp3jjz,96,196,0|dp3jk0,91,193,1|dzwfjz,91,193,1|dzwfk0,96,196,0|e7tm7z,96,196,0|e7tm80,91,193,1|eimi7z,91,193,1|eimi80,96,196,0|eqjovz,96,196,0|eqjow0,91,193,1|f1ckvz,91,193,1|f1ckw0,96,196,0|f99rjz,96,196,0|f99rk0,91,193,1|fkfm7z,91,193,1|fkfm80,96,196,0|frzu7z,96,196,0|frzu80,91,193,1|g35ovz,91,193,1|g35ow0,96,196,0|gapwvz,96,196,0|gapww0,91,193,1|glvrjz,91,193,1|glvrk0,96,196,0|gtsy7z,96,196,0|gtsy80,91,193,1|h4lu7z,91,193,1|h4lu80,96,196,0|hcj0vz,96,196,0|hcj0w0,91,193,1|hnbwvz,91,193,1|hnbww0,96,196,0|hv93jz,96,196,0|hv93k0,91,193,1|i6ey7z,91,193,1|i6ey80,96,196,0|idz67z,96,196,0|idz680,91,193,1|ip50vz,91,193,1|ip50w0,96,196,0|iwp8vz,96,196,0|iwp8w0,91,193,1|j7v3jz,91,193,1|j7v3k0,96,196,0|jffbjz,96,196,0|jffbk0,91,193,1|jql67z,91,193,1|jql680,96,196,0|jyicvz,96,196,0|jyicw0,91,193,1|k9b8vz,91,193,1|k9b8w0,96,196,0|kh8fjz,96,196,0|kh8fk0,91,193,1|ks1bjz,91,193,1|ks1bk0,96,196,0|kzyi7z,96,196,0|kzyi80,91,193,1|lb4cvz,91,193,1|lb4cw0,96,196,0|liokvz,96,196,0|liokw0,91,193,0|ne0krz,91,193,0|ne0ks0,96,196,0|o4nwvz,96,196,0|o4nww0,91,193,0\",\"Asia/Beirut|,0,219,0|-1ayy98o,15,11,0|-pyzew1,15,11,0|-pyzew0,16,6,1|-po4r01,16,6,1|-po4r00,15,11,0|-pfwdk1,15,11,0|-pfwdk0,16,6,1|-p6hkc1,16,6,1|-p6hkc0,15,11,0|-oxj9k1,15,11,0|-oxj9k0,16,6,1|-ongdo1,16,6,1|-ongdo0,15,11,0|-oddc81,15,11,0|-oddc80,16,6,1|-o5t701,16,6,1|-o5t700,15,11,0|-6m2iw1,15,11,0|-6m2iw0,16,6,1|-6e79o1,16,6,1|-6e79o0,15,11,0|-63alk1,15,11,0|-63alk0,16,6,1|-5vfcc1,16,6,1|-5vfcc0,15,11,0|-5kio81,15,11,0|-5kio80,16,6,1|-5cnf01,16,6,1|-5cnf00,15,11,0|-51ow81,15,11,0|-51ow80,16,6,1|-4ttn01,16,6,1|-4ttn00,15,11,0|-4iwyw1,15,11,0|-4iwyw0,16,6,1|-4b1po1,16,6,1|-4b1po0,15,11,0|1ag2fz,15,11,0|1ag2g0,16,6,1|1fn0zz,16,6,1|1fn100,15,11,0|1qjp3z,15,11,0|1qjp40,16,6,1|1yeybz,16,6,1|1yeyc0,15,11,0|29bmfz,15,11,0|29bmg0,16,6,1|2h6vnz,16,6,1|2h6vo0,15,11,0|2s3jrz,15,11,0|2s3js0,16,6,1|2zyszz,16,6,1|2zyt00,15,11,0|3axbrz,15,11,0|3axbs0,16,6,1|3iskzz,16,6,1|3isl00,15,11,0|3tp93z,15,11,0|3tp940,16,6,1|41kibz,16,6,1|41kic0,15,11,0|4cfbrz,15,11,0|4cfbs0,16,6,1|4kakzz,16,6,1|4kal00,15,11,0|7h8frz,15,11,0|7h8fs0,16,6,1|7pvgzz,16,6,1|7pvh00,15,11,0|800d3z,15,11,0|800d40,16,6,1|88nebz,16,6,1|88nec0,15,11,0|8isafz,15,11,0|8isag0,16,6,1|8rfbnz,16,6,1|8rfbo0,15,11,0|91k7rz,15,11,0|91k7s0,16,6,1|9a78zz,16,6,1|9a7900,15,11,0|9lzefz,15,11,0|9lzeg0,16,6,1|9t10zz,16,6,1|9t1100,15,11,0|a3ml3z,15,11,0|a3ml40,16,6,1|absybz,16,6,1|absyc0,15,11,0|alxufz,15,11,0|alxug0,16,6,1|aukvnz,16,6,1|aukvo0,15,11,0|b4prrz,15,11,0|b4prs0,16,6,1|bdcszz,16,6,1|bdct00,15,11,0|bnjjrz,15,11,0|bnjjs0,16,6,1|bvkczz,16,6,1|bvkd00,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60nrz,15,11,0|d60ns0,16,6,1|dfdmbz,16,6,1|dfdmc0,15,11,0|dp3p3z,15,11,0|dp3p40,16,6,1|dygnnz,16,6,1|dygno0,15,11,0|e7trrz,15,11,0|e7trs0,16,6,1|eh6qbz,16,6,1|eh6qc0,15,11,0|eqjufz,15,11,0|eqjug0,16,6,1|ezwszz,16,6,1|ezwt00,15,11,0|f99x3z,15,11,0|f99x40,16,6,1|fkfozz,16,6,1|fkfp00,15,11,0|frzzrz,15,11,0|frzzs0,16,6,1|g35rnz,16,6,1|g35ro0,15,11,0|gaq2fz,15,11,0|gaq2g0,16,6,1|glvubz,16,6,1|glvuc0,15,11,0|gtt3rz,15,11,0|gtt3s0,16,6,1|h4lwzz,16,6,1|h4lx00,15,11,0|hcj6fz,15,11,0|hcj6g0,16,6,1|hnbznz,16,6,1|hnbzo0,15,11,0|hv993z,15,11,0|hv9940,16,6,1|i6f0zz,16,6,1|i6f100,15,11,0|idzbrz,15,11,0|idzbs0,16,6,1|ip53nz,16,6,1|ip53o0,15,11,0|iwpefz,15,11,0|iwpeg0,16,6,1|j7v6bz,16,6,1|j7v6c0,15,11,0|jffh3z,15,11,0|jffh40,16,6,1|jql8zz,16,6,1|jql900,15,11,0|jyiifz,15,11,0|jyiig0,16,6,1|k9bbnz,16,6,1|k9bbo0,15,11,0|kh8l3z,15,11,0|kh8l40,16,6,1|ks1ebz,16,6,1|ks1ec0,15,11,0|kzynrz,15,11,0|kzyns0,16,6,1|lb4fnz,16,6,1|lb4fo0,15,11,0|lioqfz,15,11,0|lioqg0,16,6,1|ltuibz,16,6,1|ltuic0,15,11,0|m1et3z,15,11,0|m1et40,16,6,1|mckkzz,16,6,1|mckl00,15,11,0|mkhufz,15,11,0|mkhug0,16,6,1|mvannz,16,6,1|mvano0,15,11,0|n37x3z,15,11,0|n37x40,16,6,1|ne0qbz,16,6,1|ne0qc0,15,11,0|nlxzrz,15,11,0|nlxzs0,16,6,1|nwqszz,16,6,1|nwqt00,15,11,0|o4o2fz,15,11,0|o4o2g0,16,6,1|oftubz,16,6,1|oftuc0,15,11,0|one53z,15,11,0|one540,16,6,1|oyjwzz,16,6,1|oyjx00,15,11,0|p647rz,15,11,0|p647s0,16,6,1|ph9znz,16,6,1|ph9zo0,15,11,0|pp793z,15,11,0|pp7940,16,6,1|q002bz,16,6,1|q002c0,15,11,0|q7xbrz,15,11,0|q7xbs0,16,6,1|qiq4zz,16,6,1|qiq500,15,11,0|qqnefz,15,11,0|qqneg0,16,6,1|r1t6bz,16,6,1|r1t6c0,15,11,0|r9dh3z,15,11,0|r9dh40,16,6,1|rkj8zz,16,6,1|rkj900,15,11,0|rs3jrz,15,11,0|rs3js0,16,6,1|s39bnz,16,6,1|s39bo0,15,11,0|sb6l3z,15,11,0|sb6l40,16,6,1|slzebz,16,6,1|slzec0,15,11,0|stwnrz,15,11,0|stwns0,16,6,1|t4pgzz,16,6,1|t4ph00,15,11,0|tcmqfz,15,11,0|tcmqg0,16,6,1|tnfjnz,16,6,1|tnfjo0,15,11,0|tvct3z,15,11,0|tvct40,16,6,1|u6ikzz,16,6,1|u6il00,15,11,0|ue2vrz,15,11,0|ue2vs0,16,6,1|up8nnz,16,6,1|up8no0,15,11,0|uwsyfz,15,11,0|uwsyg0,16,6,1|v7yqbz,16,6,1|v7yqc0,15,11,0|vfvzrz,15,11,0|vfvzs0,16,6,1|vqoszz,16,6,1|vqot00,15,11,0|vym2fz,15,11,0|vym2g0,16,6,1|w9evnz,16,6,1|w9evo0,15,11,0|whc53z,15,11,0|whc540,16,6,1|wshwzz,16,6,1|wshx00,15,11,0|x027rz,15,11,0|x027s0,16,6,1|xb7znz,16,6,1|xb7zo0,15,11,0|xisafz,15,11,0|xisag0,16,6,1|xty2bz,16,6,1|xty2c0,15,11,0|y1id3z,15,11,0|y1id40,16,6,1|yco4zz,16,6,1|yco500,15,11,0|yklefz,15,11,0|ykleg0,16,6,1|yve7nz,16,6,1|yve7o0,15,11,0|z3bh3z,15,11,0|z3bh40,16,6,1|ze4abz,16,6,1|ze4ac0,15,11,0\",\"Asia/Bishkek|,0,220,0|-nu19tc,92,194,0|-kmr9w1,92,194,0|-kmr9w0,96,196,0|5vaxzz,96,196,0|5vay00,91,193,1|64pr7z,91,193,1|64pr80,96,196,0|6e2vbz,96,196,0|6e2vc0,91,193,1|6nhojz,91,193,1|6nhok0,96,196,0|6wusnz,96,196,0|6wuso0,91,193,1|769lvz,91,193,1|769lw0,96,196,0|7foknz,96,196,0|7foko0,91,193,1|7p1rjz,91,193,1|7p1rk0,96,196,0|7yesvz,96,196,0|7yesw0,91,193,1|87ru7z,91,193,1|87ru80,96,196,0|8h4vjz,96,196,0|8h4vk0,91,193,1|8qhwvz,91,193,1|8qhww0,96,196,0|8zuy7z,96,196,0|8zuy80,91,193,1|997zjz,91,193,1|997zk0,96,196,0|9il0vz,96,196,0|9il0w0,91,193,1|9ry27z,91,193,1|9ry280,96,196,0|a1b3jz,96,196,0|a1b3k0,91,193,1|aao4vz,91,193,1|aao4w0,96,196,0|ak167z,96,196,0|ak1680,91,193,1|atr67z,91,193,1|atr680,96,196,0|b347jz,96,196,0|b347k0,96,196,1|bazjjz,96,196,1|bazjk0,92,194,0|bmk4rz,92,194,0|bmk4s0,96,196,1|bv75zz,96,196,1|bv7600,92,194,0|c5a7fz,92,194,0|c5a7g0,96,196,1|cdx8nz,96,196,1|cdx8o0,92,194,0|co0a3z,92,194,0|co0a40,96,196,1|cwnbbz,96,196,1|cwnbc0,92,194,0|d6qcrz,92,194,0|d6qcs0,96,196,1|dfddzz,96,196,1|dfde00,92,194,0|dpgffz,92,194,0|dpgfg0,96,196,1|dygfbz,96,196,1|dygfc0,92,194,0|e7tqdz,92,194,0|e7tqe0,96,196,1|eimjlz,96,196,1|eimjm0,92,194,0|eqjt1z,92,194,0|eqjt20,96,196,1|f1cm9z,96,196,1|f1cma0,92,194,0|f99vpz,92,194,0|f99vq0,96,196,1|fkfnlz,96,196,1|fkfnm0,92,194,0|frzydz,92,194,0|frzye0,96,196,1|g35q9z,96,196,1|g35qa0,92,194,0|gaq11z,92,194,0|gaq120,96,196,1|glvsxz,96,196,1|glvsy0,92,194,0|gtt2dz,92,194,0|gtt2e0,96,196,1|h4lvlz,96,196,1|h4lvm0,92,194,0|hcj51z,92,194,0|hcj520,96,196,1|hnby9z,96,196,1|hnbya0,92,194,0|hv97pz,92,194,0|hv97q0,96,196,1|i6ezlz,96,196,1|i6ezm0,92,194,0|idzadz,92,194,0|idzae0,96,196,1|il2knz,96,196,1|il2ko0,96,196,0\",\"Asia/Brunei|,0,221,0|-mvofy4,106,222,0|-jb6i61,106,222,0|-jb6i60,89,191,0\",\"Asia/Chita|,0,223,0|-q4cfog,89,191,0|-kmri81,89,191,0|-kmri80,107,224,0|5vapnz,107,224,0|5vapo0,93,195,1|64pivz,93,195,1|64piw0,107,224,0|6e2mzz,107,224,0|6e2n00,93,195,1|6nhg7z,93,195,1|6nhg80,107,224,0|6wukbz,107,224,0|6wukc0,93,195,1|769djz,93,195,1|769dk0,107,224,0|7focbz,107,224,0|7focc0,93,195,1|7p1j7z,93,195,1|7p1j80,107,224,0|7yekjz,107,224,0|7yekk0,93,195,1|87rlvz,93,195,1|87rlw0,107,224,0|8h4n7z,107,224,0|8h4n80,93,195,1|8qhojz,93,195,1|8qhok0,107,224,0|8zupvz,107,224,0|8zupw0,93,195,1|997r7z,93,195,1|997r80,107,224,0|9iksjz,107,224,0|9iksk0,93,195,1|9rxtvz,93,195,1|9rxtw0,107,224,0|a1av7z,107,224,0|a1av80,93,195,1|aanwjz,93,195,1|aanwk0,107,224,0|ak0xvz,107,224,0|ak0xw0,93,195,1|atqxvz,93,195,1|atqxw0,107,224,0|b33z7z,107,224,0|b33z80,107,224,1|bch3bz,107,224,1|bch3c0,89,191,0|bi8hzz,89,191,0|bi8i00,107,224,0|blu1vz,107,224,0|blu1w0,93,195,1|bv737z,93,195,1|bv7380,107,224,0|c4k4jz,107,224,0|c4k4k0,93,195,1|cdx5vz,93,195,1|cdx5w0,107,224,0|cna77z,107,224,0|cna780,93,195,1|cwn8jz,93,195,1|cwn8k0,107,224,0|d609vz,107,224,0|d609w0,93,195,1|dfdb7z,93,195,1|dfdb80,107,224,0|dp3b7z,107,224,0|dp3b80,93,195,1|dzw77z,93,195,1|dzw780,107,224,0|e7tdvz,107,224,0|e7tdw0,93,195,1|eim9vz,93,195,1|eim9w0,107,224,0|eqjgjz,107,224,0|eqjgk0,93,195,1|f1ccjz,93,195,1|f1cck0,107,224,0|f99j7z,107,224,0|f99j80,93,195,1|fkfdvz,93,195,1|fkfdw0,107,224,0|frzlvz,107,224,0|frzlw0,93,195,1|g35gjz,93,195,1|g35gk0,107,224,0|gapojz,107,224,0|gapok0,93,195,1|glvj7z,93,195,1|glvj80,107,224,0|gtspvz,107,224,0|gtspw0,93,195,1|h4llvz,93,195,1|h4llw0,107,224,0|hcisjz,107,224,0|hcisk0,93,195,1|hnbojz,93,195,1|hnbok0,107,224,0|hv8v7z,107,224,0|hv8v80,93,195,1|i6epvz,93,195,1|i6epw0,107,224,0|idyxvz,107,224,0|idyxw0,93,195,1|ip4sjz,93,195,1|ip4sk0,107,224,0|iwp0jz,107,224,0|iwp0k0,93,195,1|j7uv7z,93,195,1|j7uv80,107,224,0|jff37z,107,224,0|jff380,93,195,1|jqkxvz,93,195,1|jqkxw0,107,224,0|jyi4jz,107,224,0|jyi4k0,93,195,1|k9b0jz,93,195,1|k9b0k0,107,224,0|kh877z,107,224,0|kh8780,93,195,1|ks137z,93,195,1|ks1380,107,224,0|kzy9vz,107,224,0|kzy9w0,93,195,1|lb44jz,93,195,1|lb44k0,107,224,0|liocjz,107,224,0|liock0,93,195,0|ne0cfz,93,195,0|ne0cg0,89,191,0|o4nrbz,89,191,0|o4nrc0,107,224,0\",\"Asia/Choibalsan|,0,225,0|-xmct7c,91,193,0|46akjz,91,193,0|46akk0,89,191,0|6wun3z,89,191,0|6wun40,93,195,1|769djz,93,195,1|769dk0,107,224,0|7focbz,107,224,0|7focc0,93,195,1|7p1avz,93,195,1|7p1aw0,107,224,0|7yeezz,107,224,0|7yef00,93,195,1|87rdjz,93,195,1|87rdk0,107,224,0|8h4hnz,107,224,0|8h4ho0,93,195,1|8qhg7z,93,195,1|8qhg80,107,224,0|8zukbz,107,224,0|8zukc0,93,195,1|997ivz,93,195,1|997iw0,107,224,0|9ikmzz,107,224,0|9ikn00,93,195,1|9rxljz,93,195,1|9rxlk0,107,224,0|a1apnz,107,224,0|a1apo0,93,195,1|aano7z,93,195,1|aano80,107,224,0|ak0sbz,107,224,0|ak0sc0,93,195,1|atqpjz,93,195,1|atqpk0,107,224,0|b33tnz,107,224,0|b33to0,93,195,1|bcgs7z,93,195,1|bcgs80,107,224,0|bltwbz,107,224,0|bltwc0,93,195,1|bv6uvz,93,195,1|bv6uw0,107,224,0|c4jyzz,107,224,0|c4jz00,93,195,1|cdwxjz,93,195,1|cdwxk0,107,224,0|cna1nz,107,224,0|cna1o0,93,195,1|cwn07z,93,195,1|cwn080,107,224,0|d604bz,107,224,0|d604c0,93,195,1|dfd2vz,93,195,1|dfd2w0,107,224,0|dp35nz,107,224,0|dp35o0,93,195,1|dyg47z,93,195,1|dyg480,107,224,0|e7t8bz,107,224,0|e7t8c0,93,195,1|eh66vz,93,195,1|eh66w0,107,224,0|eqjazz,107,224,0|eqjb00,93,195,1|ezw9jz,93,195,1|ezw9k0,107,224,0|gcgn7z,107,224,0|gcgn80,93,195,1|gkdr3z,93,195,1|gkdr40,107,224,0|gtqv7z,107,224,0|gtqv80,93,195,1|h33trz,93,195,1|h33ts0,107,224,0|hcgxvz,107,224,0|hcgxw0,93,195,1|hltwfz,93,195,1|hltwg0,107,224,0|hv70jz,107,224,0|hv70k0,93,195,1|i4jz3z,93,195,1|i4jz40,107,224,0|idx37z,107,224,0|idx380,93,195,1|ina1rz,93,195,1|ina1s0,107,224,0|iwn5vz,107,224,0|iwn5w0,93,195,1|j6d33z,93,195,1|j6d340,107,224,0|jyjtnz,107,224,0|jyjto0,89,191,0|nlvtzz,89,191,0|nlvu00,107,224,1|nv8mzz,107,224,1|nv8n00,89,191,0|o4lwnz,89,191,0|o4lwo0,107,224,1|odypnz,107,224,1|odypo0,89,191,0\",\"Asia/Colombo|,0,226,0|-1ayyhgc,21,227,0|-xehasl,21,227,0|-xehask,108,228,0|-elvwm1,108,228,0|-elvwm0,96,196,1|-e9lco1,96,196,1|-e9lco0,109,229,1|-cmw9u1,109,229,1|-cmw9u0,108,228,0|drxa1z,108,228,0|drxa20,109,229,0|dzufbz,109,229,0|dzufc0,96,196,0|ixq61z,96,196,0|ixq620,108,228,0\",\"Asia/Damascus|,0,230,0|-q3gk20,15,11,0|-pxwdc1,15,11,0|-pxwdc0,16,6,1|-pp9c41,16,6,1|-pp9c40,15,11,0|-pf6ao1,15,11,0|-pf6ao0,16,6,1|-p6j9g1,16,6,1|-p6j9g0,15,11,0|-owg801,15,11,0|-owg800,16,6,1|-ont6s1,16,6,1|-ont6s0,15,11,0|-odq5c1,15,11,0|-odq5c0,16,6,1|-o4q5g1,16,6,1|-o4q5g0,15,11,0|-408lc1,15,11,0|-408lc0,16,6,1|-3s9ms1,16,6,1|-3s9ms0,15,11,0|-3hcyo1,15,11,0|-3hcyo0,16,6,1|-39jk41,16,6,1|-39jk40,15,11,0|-2yj6o1,15,11,0|-2yj6o0,16,6,1|-2qnxg1,16,6,1|-2qnxg0,15,11,0|-2fr9c1,15,11,0|-2fr9c0,16,6,1|-27xus1,16,6,1|-27xus0,15,11,0|-1xcao1,15,11,0|-1xcao0,16,6,1|-1p42s1,16,6,1|-1p42s0,15,11,0|-1e7eo1,15,11,0|-1e7eo0,16,6,1|-16c5g1,16,6,1|-16c5g0,15,11,0|-vdmo1,15,11,0|-vdmo0,16,6,1|-nidg1,16,6,1|-nidg0,15,11,0|-clpc1,15,11,0|-clpc0,16,6,1|-4qg41,16,6,1|-4qg40,15,11,0|667zz,15,11,0|66800,16,6,1|e1h7z,16,6,1|e1h80,15,11,0|oy5bz,15,11,0|oy5c0,16,6,1|wtejz,16,6,1|wtek0,15,11,0|17rxbz,15,11,0|17rxc0,16,6,1|1fn6jz,16,6,1|1fn6k0,15,11,0|1qjunz,15,11,0|1qjuo0,16,6,1|1yf3vz,16,6,1|1yf3w0,15,11,0|29brzz,15,11,0|29bs00,16,6,1|2h717z,16,6,1|2h7180,15,11,0|2s3pbz,15,11,0|2s3pc0,16,6,1|2zyyjz,16,6,1|2zyyk0,15,11,0|3axhbz,15,11,0|3axhc0,16,6,1|3isqjz,16,6,1|3isqk0,15,11,0|3tpenz,15,11,0|3tpeo0,16,6,1|4013vz,16,6,1|4013w0,15,11,0|4chbzz,15,11,0|4chc00,16,6,1|4it17z,16,6,1|4it180,15,11,0|6xa2nz,15,11,0|6xa2o0,16,6,1|76a2jz,16,6,1|76a2k0,15,11,0|7g3unz,15,11,0|7g3uo0,16,6,1|7p3ujz,16,6,1|7p3uk0,15,11,0|8ezenz,15,11,0|8ezeo0,16,6,1|8r2ijz,16,6,1|8r2ik0,15,11,0|8yfenz,15,11,0|8yfeo0,16,6,1|9az6jz,16,6,1|9az6k0,15,11,0|9hz3zz,15,11,0|9hz400,16,6,1|9tsyjz,16,6,1|9tsyk0,15,11,0|a1knzz,15,11,0|a1ko00,16,6,1|ab1bvz,16,6,1|ab1bw0,15,11,0|akefzz,15,11,0|akeg00,16,6,1|atrejz,16,6,1|atrek0,15,11,0|b367rz,15,11,0|b367s0,16,6,1|bcl0zz,16,6,1|bcl100,15,11,0|bmcyfz,15,11,0|bmcyg0,16,6,1|bveszz,16,6,1|bvet00,15,11,0|c4gt3z,15,11,0|c4gt40,16,6,1|cdvmbz,16,6,1|cdvmc0,15,11,0|cnjufz,15,11,0|cnjug0,16,6,1|cwynnz,16,6,1|cwyno0,15,11,0|d6brrz,15,11,0|d6brs0,16,6,1|dfqkzz,16,6,1|dfql00,15,11,0|dp5jrz,15,11,0|dp5js0,16,6,1|dykczz,16,6,1|dykd00,15,11,0|e7vmfz,15,11,0|e7vmg0,16,6,1|ehcabz,16,6,1|ehcac0,15,11,0|eqlp3z,15,11,0|eqlp40,16,6,1|f047nz,16,6,1|f047o0,15,11,0|f9hbrz,15,11,0|f9hbs0,16,6,1|fiw4zz,16,6,1|fiw500,15,11,0|fsb3rz,15,11,0|fsb3s0,16,6,1|g1pwzz,16,6,1|g1px00,15,11,0|gb313z,15,11,0|gb3140,16,6,1|gkhubz,16,6,1|gkhuc0,15,11,0|gtuyfz,15,11,0|gtuyg0,16,6,1|h39rnz,16,6,1|h39ro0,15,11,0|hcmvrz,15,11,0|hcmvs0,16,6,1|hm1ozz,16,6,1|hm1p00,15,11,0|hvgnrz,15,11,0|hvgns0,16,6,1|i4vgzz,16,6,1|i4vh00,15,11,0|ie8l3z,15,11,0|ie8l40,16,6,1|innebz,16,6,1|innec0,15,11,0|ix0ifz,15,11,0|ix0ig0,16,6,1|j5ynnz,16,6,1|j5yno0,15,11,0|jfoqfz,15,11,0|jfoqg0,16,6,1|jquibz,16,6,1|jquic0,15,11,0|jyrrrz,15,11,0|jyrrs0,16,6,1|k9mfnz,16,6,1|k9mfo0,15,11,0|kh4vrz,15,11,0|kh4vs0,16,6,1|ksannz,16,6,1|ksano0,15,11,0|l07x3z,15,11,0|l07x40,16,6,1|lb0qbz,16,6,1|lb0qc0,15,11,0|lixzrz,15,11,0|lixzs0,16,6,1|ltqszz,16,6,1|ltqt00,15,11,0|m1o2fz,15,11,0|m1o2g0,16,6,1|mcgvnz,16,6,1|mcgvo0,15,11,0|mke53z,15,11,0|mke540,16,6,1|mv6ybz,16,6,1|mv6yc0,15,11,0|n347rz,15,11,0|n347s0,16,6,1|ne9znz,16,6,1|ne9zo0,15,11,0|nluafz,15,11,0|nluag0,16,6,1|nx02bz,16,6,1|nx02c0,15,11,0|o4kd3z,15,11,0|o4kd40,16,6,1|ofq4zz,16,6,1|ofq500,15,11,0|onnefz,15,11,0|onneg0,16,6,1|oyg7nz,16,6,1|oyg7o0,15,11,0|p6dh3z,15,11,0|p6dh40,16,6,1|ph6abz,16,6,1|ph6ac0,15,11,0|pp3jrz,15,11,0|pp3js0,16,6,1|pzwczz,16,6,1|pzwd00,15,11,0|q7tmfz,15,11,0|q7tmg0,16,6,1|qizebz,16,6,1|qizec0,15,11,0|qqjp3z,15,11,0|qqjp40,16,6,1|r1pgzz,16,6,1|r1ph00,15,11,0|r99rrz,15,11,0|r99rs0,16,6,1|rkfjnz,16,6,1|rkfjo0,15,11,0|rsct3z,15,11,0|rsct40,16,6,1|s35mbz,16,6,1|s35mc0,15,11,0|sb2vrz,15,11,0|sb2vs0,16,6,1|slvozz,16,6,1|slvp00,15,11,0|stsyfz,15,11,0|stsyg0,16,6,1|t4yqbz,16,6,1|t4yqc0,15,11,0|tcj13z,15,11,0|tcj140,16,6,1|tnoszz,16,6,1|tnot00,15,11,0|tv93rz,15,11,0|tv93s0,16,6,1|u6evnz,16,6,1|u6evo0,15,11,0|uec53z,15,11,0|uec540,16,6,1|up4ybz,16,6,1|up4yc0,15,11,0|ux27rz,15,11,0|ux27s0,16,6,1|v7v0zz,16,6,1|v7v100,15,11,0|vfsafz,15,11,0|vfsag0,16,6,1|vql3nz,16,6,1|vql3o0,15,11,0|vyid3z,15,11,0|vyid40,16,6,1|w9o4zz,16,6,1|w9o500,15,11,0|wh8frz,15,11,0|wh8fs0,16,6,1|wse7nz,16,6,1|wse7o0,15,11,0|wzyifz,15,11,0|wzyig0,16,6,1|xb4abz,16,6,1|xb4ac0,15,11,0|xj1jrz,15,11,0|xj1js0,16,6,1|xtuczz,16,6,1|xtud00,15,11,0|y1rmfz,15,11,0|y1rmg0,16,6,1|yckfnz,16,6,1|yckfo0,15,11,0|ykhp3z,15,11,0|ykhp40,16,6,1|yvngzz,16,6,1|yvnh00,15,11,0|z37rrz,15,11,0|z37rs0,16,6,1|zedjnz,16,6,1|zedjo0,15,11,0\",\"Asia/Dhaka|,0,231,0|-15r1q2s,77,232,0|-eqtpox,77,232,0|-eqtpow,109,229,0|-ef78q1,109,229,0|-ef78q0,108,228,0|-e9lba1,108,228,0|-e9lba0,109,229,0|-9j0ne1,109,229,0|-9j0ne0,96,196,0|klhwjz,96,196,0|klhwk0,91,193,1|kvj0jz,91,193,1|kvj0k0,96,196,0\",\"Asia/Dili|,0,233,0|-u9s4l8,89,191,0|-ejfac1,89,191,0|-ejfac0,107,224,0|3b0hnz,107,224,0|3b0ho0,89,191,0|g0zlrz,89,191,0|g0zls0,107,224,0\",\"Asia/Dubai|,0,234,0|-q3gnko,105,209,0\",\"Asia/Dushanbe|,0,235,0|-nu18qo,92,194,0|-kmr9w1,92,194,0|-kmr9w0,96,196,0|5vaxzz,96,196,0|5vay00,91,193,1|64pr7z,91,193,1|64pr80,96,196,0|6e2vbz,96,196,0|6e2vc0,91,193,1|6nhojz,91,193,1|6nhok0,96,196,0|6wusnz,96,196,0|6wuso0,91,193,1|769lvz,91,193,1|769lw0,96,196,0|7foknz,96,196,0|7foko0,91,193,1|7p1rjz,91,193,1|7p1rk0,96,196,0|7yesvz,96,196,0|7yesw0,91,193,1|87ru7z,91,193,1|87ru80,96,196,0|8h4vjz,96,196,0|8h4vk0,91,193,1|8qhwvz,91,193,1|8qhww0,96,196,0|8zuy7z,96,196,0|8zuy80,91,193,1|997zjz,91,193,1|997zk0,96,196,0|9il0vz,96,196,0|9il0w0,91,193,1|9ry27z,91,193,1|9ry280,96,196,0|a1b3jz,96,196,0|a1b3k0,91,193,1|aao4vz,91,193,1|aao4w0,96,196,0|ak167z,96,196,0|ak1680,91,193,1|atr67z,91,193,1|atr680,96,196,0|b347jz,96,196,0|b347k0,96,196,1|bbgabz,96,196,1|bbgac0,92,194,0\",\"Asia/Famagusta|,0,236,0|-p4bqac,15,11,0|2r67rz,15,11,0|2r67s0,16,6,1|30j6bz,16,6,1|30j6c0,15,11,0|3bn93z,15,11,0|3bn940,16,6,1|3jb3nz,16,6,1|3jb3o0,15,11,0|3s9efz,15,11,0|3s9eg0,16,6,1|419ebz,16,6,1|419ec0,15,11,0|4azh3z,15,11,0|4azh40,16,6,1|4keabz,16,6,1|4keac0,15,11,0|4tpjrz,15,11,0|4tpjs0,16,6,1|532ibz,16,6,1|532ic0,15,11,0|5csl3z,15,11,0|5csl40,16,6,1|5lskzz,16,6,1|5lsl00,15,11,0|5v5p3z,15,11,0|5v5p40,16,6,1|64innz,16,6,1|64ino0,15,11,0|6dvrrz,15,11,0|6dvrs0,16,6,1|6n8qbz,16,6,1|6n8qc0,15,11,0|6wlufz,15,11,0|6wlug0,16,6,1|75yszz,16,6,1|75yt00,15,11,0|7fbx3z,15,11,0|7fbx40,16,6,1|7p1ubz,16,6,1|7p1uc0,15,11,0|7yeyfz,15,11,0|7yeyg0,16,6,1|87rwzz,16,6,1|87rx00,15,11,0|8h513z,15,11,0|8h5140,16,6,1|8qhznz,16,6,1|8qhzo0,15,11,0|8zv3rz,15,11,0|8zv3s0,16,6,1|9982bz,16,6,1|9982c0,15,11,0|9il6fz,15,11,0|9il6g0,16,6,1|9ry4zz,16,6,1|9ry500,15,11,0|a1b93z,15,11,0|a1b940,16,6,1|aao7nz,16,6,1|aao7o0,15,11,0|ak1brz,15,11,0|ak1bs0,16,6,1|atr8zz,16,6,1|atr900,15,11,0|b34d3z,15,11,0|b34d40,16,6,1|bchbnz,16,6,1|bchbo0,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60nrz,15,11,0|d60ns0,16,6,1|dfdmbz,16,6,1|dfdmc0,15,11,0|dp3p3z,15,11,0|dp3p40,16,6,1|dygnnz,16,6,1|dygno0,15,11,0|e7trrz,15,11,0|e7trs0,16,6,1|eh6qbz,16,6,1|eh6qc0,15,11,0|eqjufz,15,11,0|eqjug0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|od5jnz,16,6,1|od5jo0,100,6,0|oyk83z,100,6,0|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Asia/Gaza|,0,237,0|-1054x1s,15,11,0|-ffv401,15,11,0|-ffv400,16,6,1|-f9l6o1,16,6,1|-f9l6o0,15,11,0|-f765c1,15,11,0|-f765c0,16,6,1|-e6fxc1,16,6,1|-e6fxc0,15,11,0|-dyoao1,15,11,0|-dyoao0,16,6,1|-dno001,16,6,1|-dno000,15,11,0|-dfuio1,15,11,0|-dfuio0,16,6,1|-d4u801,16,6,1|-d4u800,15,11,0|-cwatc1,15,11,0|-cwatc0,16,6,1|-cm2ao1,16,6,1|-cm2ao0,15,11,0|-cdiw01,15,11,0|-cdiw00,16,6,1|-c3adc1,16,6,1|-c3adc0,15,11,0|-6lluw1,15,11,0|-6lluw0,16,6,1|-6e79o1,16,6,1|-6e79o0,15,11,0|-63alk1,15,11,0|-63alk0,16,6,1|-5vfcc1,16,6,1|-5vfcc0,15,11,0|-5kilg1,15,11,0|-5kilg0,16,6,1|-5cp1c1,16,6,1|-5cp1c0,15,11,0|-51otg1,15,11,0|-51otg0,16,6,1|-4tv9c1,16,6,1|-4tv9c0,15,11,0|-4iww41,15,11,0|-4iww40,16,6,1|-4b3c01,16,6,1|-4b3c00,15,11,0|-404ys1,15,11,0|-404ys0,16,6,1|-3sbeo1,16,6,1|-3sbeo0,15,11,0|-3hd1g1,15,11,0|-3hd1g0,16,6,1|-39jhc1,16,6,1|-39jhc0,15,11,0|-2yj9g1,15,11,0|-2yj9g0,16,6,1|-2qppc1,16,6,1|-2qppc0,15,11,0|-2frc41,15,11,0|-2frc40,16,6,1|-27xs01,16,6,1|-27xs00,15,11,0|-1wzes1,15,11,0|-1wzes0,16,6,1|-1p4001,16,6,1|-1p4000,15,11,0|-1e7hg1,15,11,0|-1e7hg0,16,6,1|-1ceto1,16,6,1|-1ceto0,110,11,0|2crp3z,110,11,0|2crp40,111,6,1|2ht3nz,111,6,1|2ht3o0,110,11,0|2rj6fz,110,11,0|2rj6g0,111,6,1|2ydebz,111,6,1|2ydec0,110,11,0|5iwyfz,110,11,0|5iwyg0,111,6,1|5l2qfz,111,6,1|5l2qg0,110,11,0|7hhp3z,110,11,0|7hhp40,111,6,1|7n93rz,111,6,1|7n93s0,110,11,0|7z4vrz,110,11,0|7z4vs0,111,6,1|86c2bz,111,6,1|86c2c0,110,11,0|8jnrrz,110,11,0|8jnrs0,111,6,1|8pf3nz,111,6,1|8pf3o0,110,11,0|90ql3z,110,11,0|90ql40,111,6,1|98i4zz,111,6,1|98i500,110,11,0|9jb3rz,110,11,0|9jb3s0,111,6,1|9qv8zz,111,6,1|9qv900,110,11,0|a342fz,110,11,0|a342g0,111,6,1|a9lbnz,111,6,1|a9lbo0,110,11,0|ak1brz,110,11,0|ak1bs0,111,6,1|aryfnz,111,6,1|aryfo0,110,11,0|b2refz,110,11,0|b2reg0,111,6,1|bb1gzz,111,6,1|bb1h00,110,11,0|blufrz,110,11,0|blufs0,111,6,1|bu4ibz,111,6,1|bu4ic0,110,11,0|c4trrz,110,11,0|c4trs0,111,6,1|ccukzz,111,6,1|ccul00,110,11,0|cnjufz,110,11,0|cnjug0,111,6,1|cv7ozz,111,6,1|cv7p00,110,11,0|d69x3z,110,11,0|d69x40,111,6,1|deaqbz,111,6,1|deaqc0,110,11,0|dkh13z,110,11,0|dkh140,15,11,0|dpcyfz,15,11,0|dpcyg0,16,6,1|dy02fz,16,6,1|dy02g0,15,11,0|e8313z,15,11,0|e83140,16,6,1|egq53z,16,6,1|egq540,15,11,0|eqt3rz,15,11,0|eqt3s0,16,6,1|ezg7rz,16,6,1|ezg7s0,15,11,0|fa93rz,15,11,0|fa93s0,16,6,1|fjm2bz,16,6,1|fjm2c0,15,11,0|ftc53z,15,11,0|ftc540,16,6,1|g2p3nz,16,6,1|g2p3o0,15,11,0|gc27rz,15,11,0|gc27s0,16,6,1|glf6bz,16,6,1|glf6c0,15,11,0|gusafz,15,11,0|gusag0,16,6,1|h458zz,16,6,1|h45900,15,11,0|hdid3z,15,11,0|hdid40,16,6,1|hmvbnz,16,6,1|hmvbo0,15,11,0|hw8frz,15,11,0|hw8fs0,16,6,1|i4vjrz,16,6,1|i4vjs0,15,11,0|ieyifz,15,11,0|ieyig0,16,6,1|int3vz,16,6,1|int3w0,15,11,0|ix0ifz,15,11,0|ix0ig0,16,6,1|j5ynnz,16,6,1|j5yno0,15,11,0|jfsfrz,15,11,0|jfsfs0,16,6,1|joa2jz,16,6,1|joa2k0,15,11,0|jyet3z,15,11,0|jyet40,16,6,1|k6bwzz,16,6,1|k6bx00,15,11,0|kh4vrz,15,11,0|kh4vs0,16,6,1|kpf13z,16,6,1|kpf140,15,11,0|kzwt5n,15,11,0|kzwt5o,16,6,1|l6yfnz,16,6,1|l6yfo0,15,11,0|lixztn,15,11,0|lixzto,16,6,1|lp7ubz,16,6,1|lp7uc0,15,11,0|m1o2fz,15,11,0|m1o2g0,16,6,1|mao53z,16,6,1|mao540,15,11,0|mke53z,15,11,0|mke540,16,6,1|mtr3nz,16,6,1|mtr3o0,15,11,0|n347rz,15,11,0|n347s0,16,6,1|ndx0zz,16,6,1|ndx100,15,11,0|nlw53z,15,11,0|nlw540,16,6,1|nwn6fz,16,6,1|nwn6g0,15,11,0|o4majz,15,11,0|o4mak0,16,6,1|ofs2fz,16,6,1|ofs2g0,15,11,0|oncd7z,15,11,0|oncd80,16,6,1|oyi53z,16,6,1|oyi540,15,11,0|p62fvz,15,11,0|p62fw0,16,6,1|ph87rz,16,6,1|ph87s0,15,11,0|pp3jrz,15,11,0|pp3js0,16,6,1|pzy7nz,16,6,1|pzy7o0,15,11,0|q7vh3z,15,11,0|q7vh40,16,6,1|qiod3z,16,6,1|qiod40,15,11,0|qqljrz,15,11,0|qqljs0,16,6,1|r1refz,16,6,1|r1reg0,15,11,0|r9bmfz,15,11,0|r9bmg0,16,6,1|rkhh3z,16,6,1|rkhh40,15,11,0|rs1p3z,15,11,0|rs1p40,16,6,1|s37jrz,16,6,1|s37js0,15,11,0|sb4qfz,15,11,0|sb4qg0,16,6,1|slxmfz,16,6,1|slxmg0,15,11,0|stut3z,15,11,0|stut40,16,6,1|t4np3z,16,6,1|t4np40,15,11,0|tckvrz,15,11,0|tckvs0,16,6,1|tndrrz,16,6,1|tndrs0,15,11,0|tvayfz,15,11,0|tvayg0,16,6,1|u6gt3z,16,6,1|u6gt40,15,11,0|ue113z,15,11,0|ue1140,16,6,1|up6vrz,16,6,1|up6vs0,15,11,0|uwr3rz,15,11,0|uwr3s0,16,6,1|v7wyfz,16,6,1|v7wyg0,15,11,0|vfu53z,15,11,0|vfu540,16,6,1|vqn13z,16,6,1|vqn140,15,11,0|vyk7rz,15,11,0|vyk7s0,16,6,1|w9d3rz,16,6,1|w9d3s0,15,11,0|whaafz,15,11,0|whaag0,16,6,1|wsg53z,16,6,1|wsg540,15,11,0|x00d3z,15,11,0|x00d40,16,6,1|xb67rz,16,6,1|xb67s0,15,11,0|xiqfrz,15,11,0|xiqfs0,16,6,1|xtwafz,16,6,1|xtwag0,15,11,0|y1gifz,15,11,0|y1gig0,16,6,1|ycmd3z,16,6,1|ycmd40,15,11,0|ykjjrz,15,11,0|ykjjs0,16,6,1|yvcfrz,16,6,1|yvcfs0,15,11,0|z39mfz,15,11,0|z39mg0,16,6,1|ze2ifz,16,6,1|ze2ig0,15,11,0\",\"Asia/Hebron|,0,238,0|-1054x5z,15,11,0|-ffv401,15,11,0|-ffv400,16,6,1|-f9l6o1,16,6,1|-f9l6o0,15,11,0|-f765c1,15,11,0|-f765c0,16,6,1|-e6fxc1,16,6,1|-e6fxc0,15,11,0|-dyoao1,15,11,0|-dyoao0,16,6,1|-dno001,16,6,1|-dno000,15,11,0|-dfuio1,15,11,0|-dfuio0,16,6,1|-d4u801,16,6,1|-d4u800,15,11,0|-cwatc1,15,11,0|-cwatc0,16,6,1|-cm2ao1,16,6,1|-cm2ao0,15,11,0|-cdiw01,15,11,0|-cdiw00,16,6,1|-c3adc1,16,6,1|-c3adc0,15,11,0|-6lluw1,15,11,0|-6lluw0,16,6,1|-6e79o1,16,6,1|-6e79o0,15,11,0|-63alk1,15,11,0|-63alk0,16,6,1|-5vfcc1,16,6,1|-5vfcc0,15,11,0|-5kilg1,15,11,0|-5kilg0,16,6,1|-5cp1c1,16,6,1|-5cp1c0,15,11,0|-51otg1,15,11,0|-51otg0,16,6,1|-4tv9c1,16,6,1|-4tv9c0,15,11,0|-4iww41,15,11,0|-4iww40,16,6,1|-4b3c01,16,6,1|-4b3c00,15,11,0|-404ys1,15,11,0|-404ys0,16,6,1|-3sbeo1,16,6,1|-3sbeo0,15,11,0|-3hd1g1,15,11,0|-3hd1g0,16,6,1|-39jhc1,16,6,1|-39jhc0,15,11,0|-2yj9g1,15,11,0|-2yj9g0,16,6,1|-2qppc1,16,6,1|-2qppc0,15,11,0|-2frc41,15,11,0|-2frc40,16,6,1|-27xs01,16,6,1|-27xs00,15,11,0|-1wzes1,15,11,0|-1wzes0,16,6,1|-1p4001,16,6,1|-1p4000,15,11,0|-1e7hg1,15,11,0|-1e7hg0,16,6,1|-1ceto1,16,6,1|-1ceto0,110,11,0|2crp3z,110,11,0|2crp40,111,6,1|2ht3nz,111,6,1|2ht3o0,110,11,0|2rj6fz,110,11,0|2rj6g0,111,6,1|2ydebz,111,6,1|2ydec0,110,11,0|5iwyfz,110,11,0|5iwyg0,111,6,1|5l2qfz,111,6,1|5l2qg0,110,11,0|7hhp3z,110,11,0|7hhp40,111,6,1|7n93rz,111,6,1|7n93s0,110,11,0|7z4vrz,110,11,0|7z4vs0,111,6,1|86c2bz,111,6,1|86c2c0,110,11,0|8jnrrz,110,11,0|8jnrs0,111,6,1|8pf3nz,111,6,1|8pf3o0,110,11,0|90ql3z,110,11,0|90ql40,111,6,1|98i4zz,111,6,1|98i500,110,11,0|9jb3rz,110,11,0|9jb3s0,111,6,1|9qv8zz,111,6,1|9qv900,110,11,0|a342fz,110,11,0|a342g0,111,6,1|a9lbnz,111,6,1|a9lbo0,110,11,0|ak1brz,110,11,0|ak1bs0,111,6,1|aryfnz,111,6,1|aryfo0,110,11,0|b2refz,110,11,0|b2reg0,111,6,1|bb1gzz,111,6,1|bb1h00,110,11,0|blufrz,110,11,0|blufs0,111,6,1|bu4ibz,111,6,1|bu4ic0,110,11,0|c4trrz,110,11,0|c4trs0,111,6,1|ccukzz,111,6,1|ccul00,110,11,0|cnjufz,110,11,0|cnjug0,111,6,1|cv7ozz,111,6,1|cv7p00,110,11,0|d69x3z,110,11,0|d69x40,111,6,1|deaqbz,111,6,1|deaqc0,110,11,0|dkh13z,110,11,0|dkh140,15,11,0|dpcyfz,15,11,0|dpcyg0,16,6,1|dy02fz,16,6,1|dy02g0,15,11,0|e8313z,15,11,0|e83140,16,6,1|egq53z,16,6,1|egq540,15,11,0|eqt3rz,15,11,0|eqt3s0,16,6,1|ezg7rz,16,6,1|ezg7s0,15,11,0|fa93rz,15,11,0|fa93s0,16,6,1|fjm2bz,16,6,1|fjm2c0,15,11,0|ftc53z,15,11,0|ftc540,16,6,1|g2p3nz,16,6,1|g2p3o0,15,11,0|gc27rz,15,11,0|gc27s0,16,6,1|glf6bz,16,6,1|glf6c0,15,11,0|gusafz,15,11,0|gusag0,16,6,1|h458zz,16,6,1|h45900,15,11,0|hdid3z,15,11,0|hdid40,16,6,1|hmvbnz,16,6,1|hmvbo0,15,11,0|hw8frz,15,11,0|hw8fs0,16,6,1|i4vjrz,16,6,1|i4vjs0,15,11,0|ieyifz,15,11,0|ieyig0,16,6,1|int3vz,16,6,1|int3w0,15,11,0|ix0ifz,15,11,0|ix0ig0,16,6,1|j5ynnz,16,6,1|j5yno0,15,11,0|jfsfrz,15,11,0|jfsfs0,16,6,1|joa2jz,16,6,1|joa2k0,15,11,0|jyet3z,15,11,0|jyet40,16,6,1|k6hgzz,16,6,1|k6hh00,15,11,0|kh4vrz,15,11,0|kh4vs0,16,6,1|kpf13z,16,6,1|kpf140,15,11,0|kzuyfz,15,11,0|kzuyg0,16,6,1|l6yfnz,16,6,1|l6yfo0,15,11,0|lixztn,15,11,0|lixzto,16,6,1|lp7ubz,16,6,1|lp7uc0,15,11,0|lqpmfz,15,11,0|lqpmg0,16,6,1|lsaybz,16,6,1|lsayc0,15,11,0|m1o2fz,15,11,0|m1o2g0,16,6,1|mao53z,16,6,1|mao540,15,11,0|mke53z,15,11,0|mke540,16,6,1|mtr3nz,16,6,1|mtr3o0,15,11,0|n347rz,15,11,0|n347s0,16,6,1|ndx0zz,16,6,1|ndx100,15,11,0|nlw53z,15,11,0|nlw540,16,6,1|nwn6fz,16,6,1|nwn6g0,15,11,0|o4majz,15,11,0|o4mak0,16,6,1|ofs2fz,16,6,1|ofs2g0,15,11,0|oncd7z,15,11,0|oncd80,16,6,1|oyi53z,16,6,1|oyi540,15,11,0|p62fvz,15,11,0|p62fw0,16,6,1|ph87rz,16,6,1|ph87s0,15,11,0|pp3jrz,15,11,0|pp3js0,16,6,1|pzy7nz,16,6,1|pzy7o0,15,11,0|q7vh3z,15,11,0|q7vh40,16,6,1|qiod3z,16,6,1|qiod40,15,11,0|qqljrz,15,11,0|qqljs0,16,6,1|r1refz,16,6,1|r1reg0,15,11,0|r9bmfz,15,11,0|r9bmg0,16,6,1|rkhh3z,16,6,1|rkhh40,15,11,0|rs1p3z,15,11,0|rs1p40,16,6,1|s37jrz,16,6,1|s37js0,15,11,0|sb4qfz,15,11,0|sb4qg0,16,6,1|slxmfz,16,6,1|slxmg0,15,11,0|stut3z,15,11,0|stut40,16,6,1|t4np3z,16,6,1|t4np40,15,11,0|tckvrz,15,11,0|tckvs0,16,6,1|tndrrz,16,6,1|tndrs0,15,11,0|tvayfz,15,11,0|tvayg0,16,6,1|u6gt3z,16,6,1|u6gt40,15,11,0|ue113z,15,11,0|ue1140,16,6,1|up6vrz,16,6,1|up6vs0,15,11,0|uwr3rz,15,11,0|uwr3s0,16,6,1|v7wyfz,16,6,1|v7wyg0,15,11,0|vfu53z,15,11,0|vfu540,16,6,1|vqn13z,16,6,1|vqn140,15,11,0|vyk7rz,15,11,0|vyk7s0,16,6,1|w9d3rz,16,6,1|w9d3s0,15,11,0|whaafz,15,11,0|whaag0,16,6,1|wsg53z,16,6,1|wsg540,15,11,0|x00d3z,15,11,0|x00d40,16,6,1|xb67rz,16,6,1|xb67s0,15,11,0|xiqfrz,15,11,0|xiqfs0,16,6,1|xtwafz,16,6,1|xtwag0,15,11,0|y1gifz,15,11,0|y1gig0,16,6,1|ycmd3z,16,6,1|ycmd40,15,11,0|ykjjrz,15,11,0|ykjjs0,16,6,1|yvcfrz,16,6,1|yvcfs0,15,11,0|z39mfz,15,11,0|z39mg0,16,6,1|ze2ifz,16,6,1|ze2ig0,15,11,0\",\"Asia/Ho_Chi_Minh|,0,239,0|-x56934,112,240,0|-umdqev,112,240,0|-umdqeu,91,193,0|-e3bkw1,91,193,0|-e3bkw0,89,191,0|-cxyro1,89,191,0|-cxyro0,107,224,0|-cp63o1,107,224,0|-cp63o0,91,193,0|-bvja41,91,193,0|-bvja40,89,191,0|-7kjq81,89,191,0|-7kjq80,91,193,0|-57xfk1,91,193,0|-57xfk0,89,191,0|2uaprz,89,191,0|2uaps0,91,193,0\",\"Asia/Hong_Kong|,0,241,0|-y0i0s0,113,191,0|-ewdn81,113,191,0|-ewdn80,114,224,1|-eqtn81,114,224,1|-eqtn80,115,242,1|-emgia1,115,242,1|-emgia0,116,224,0|-cl7cs1,116,224,0|-cl7cs0,113,191,0|-cda8w1,113,191,0|-cda8w0,114,224,1|-c1r5u1,114,224,1|-c1r5u0,113,191,0|-buwv61,113,191,0|-buwv60,114,224,1|-bj1361,114,224,1|-bj1360,113,191,0|-bb3wi1,113,191,0|-bb3wi0,114,224,1|-b1qv61,114,224,1|-b1qv60,113,191,0|-attoi1,113,191,0|-attoi0,114,224,1|-aj0si1,114,224,1|-aj0si0,113,191,0|-ab3lu1,113,191,0|-ab3lu0,114,224,1|-a0apu1,114,224,1|-a0apu0,113,191,0|-9sdj61,113,191,0|-9sdj60,114,224,1|-9hkn61,114,224,1|-9hkn60,113,191,0|-99ahu1,113,191,0|-99ahu0,114,224,1|-8yhlu1,114,224,1|-8yhlu0,113,191,0|-8qkf61,113,191,0|-8qkf60,114,224,1|-8frly1,114,224,1|-8frly0,113,191,0|-88k9u1,113,191,0|-88k9u0,114,224,1|-7x1ja1,114,224,1|-7x1ja0,113,191,0|-7pu761,113,191,0|-7pu760,114,224,1|-7dyhy1,114,224,1|-7dyhy0,113,191,0|-7744i1,113,191,0|-7744i0,114,224,1|-6v8fa1,114,224,1|-6v8fa0,113,191,0|-6o1361,113,191,0|-6o1360,114,224,1|-6cicm1,114,224,1|-6cicm0,113,191,0|-65b0i1,113,191,0|-65b0i0,114,224,1|-5ts9y1,114,224,1|-5ts9y0,113,191,0|-5mkxu1,113,191,0|-5mkxu0,114,224,1|-5b27a1,114,224,1|-5b27a0,113,191,0|-53uv61,113,191,0|-53uv60,114,224,1|-4rz5y1,114,224,1|-4rz5y0,113,191,0|-4l4si1,113,191,0|-4l4si0,114,224,1|-4993a1,114,224,1|-4993a0,113,191,0|-42epu1,113,191,0|-42epu0,114,224,1|-3qj0m1,114,224,1|-3qj0m0,113,191,0|-3jboi1,113,191,0|-3jboi0,114,224,1|-37sxy1,114,224,1|-37sxy0,113,191,0|-30llu1,113,191,0|-30llu0,114,224,1|-2p2va1,114,224,1|-2p2va0,113,191,0|-2gfoi1,113,191,0|-2gfoi0,114,224,1|-272py1,114,224,1|-272py0,113,191,0|-1xplu1,113,191,0|-1xplu0,114,224,1|-1ocna1,114,224,1|-1ocna0,113,191,0|-1ezj61,113,191,0|-1ezj60,114,224,1|-159ly1,114,224,1|-159ly0,113,191,0|-vwhu1,113,191,0|-vwhu0,114,224,1|-mjja1,114,224,1|-mjja0,113,191,0|-d6f61,113,191,0|-d6f60,114,224,1|-3tgm1,114,224,1|-3tgm0,113,191,0|5jnhz,113,191,0|5jni0,114,224,1|ewm1z,114,224,1|ewm20,113,191,0|o9q5z,113,191,0|o9q60,114,224,1|xmopz,114,224,1|xmoq0,113,191,0|16zstz,113,191,0|16zsu0,114,224,1|1gpq1z,114,224,1|1gpq20,113,191,0|1q2u5z,113,191,0|1q2u60,114,224,1|1zfspz,114,224,1|1zfsq0,113,191,0|231i5z,113,191,0|231i60,114,224,1|2i5vdz,114,224,1|2i5ve0,113,191,0|2rizhz,113,191,0|2rizi0,114,224,1|30vy1z,114,224,1|30vy20,113,191,0|3a925z,113,191,0|3a9260,114,224,1|3jm0pz,114,224,1|3jm0q0,113,191,0|4vv4tz,113,191,0|4vv4u0,114,224,1|5457dz,114,224,1|5457e0,113,191,0\",\"Asia/Hovd|,0,243,0|-xmcoz0,96,196,0|46anbz,96,196,0|46anc0,91,193,0|6wupvz,91,193,0|6wupw0,89,191,1|769j3z,89,191,1|769j40,91,193,0|7fohvz,91,193,0|7fohw0,89,191,1|7p1gfz,89,191,1|7p1gg0,91,193,0|7yekjz,91,193,0|7yekk0,89,191,1|87rj3z,89,191,1|87rj40,91,193,0|8h4n7z,91,193,0|8h4n80,89,191,1|8qhlrz,89,191,1|8qhls0,91,193,0|8zupvz,91,193,0|8zupw0,89,191,1|997ofz,89,191,1|997og0,91,193,0|9iksjz,91,193,0|9iksk0,89,191,1|9rxr3z,89,191,1|9rxr40,91,193,0|a1av7z,91,193,0|a1av80,89,191,1|aantrz,89,191,1|aants0,91,193,0|ak0xvz,91,193,0|ak0xw0,89,191,1|atqv3z,89,191,1|atqv40,91,193,0|b33z7z,91,193,0|b33z80,89,191,1|bcgxrz,89,191,1|bcgxs0,91,193,0|blu1vz,91,193,0|blu1w0,89,191,1|bv70fz,89,191,1|bv70g0,91,193,0|c4k4jz,91,193,0|c4k4k0,89,191,1|cdx33z,89,191,1|cdx340,91,193,0|cna77z,91,193,0|cna780,89,191,1|cwn5rz,89,191,1|cwn5s0,91,193,0|d609vz,91,193,0|d609w0,89,191,1|dfd8fz,89,191,1|dfd8g0,91,193,0|dp3b7z,91,193,0|dp3b80,89,191,1|dyg9rz,89,191,1|dyg9s0,91,193,0|e7tdvz,91,193,0|e7tdw0,89,191,1|eh6cfz,89,191,1|eh6cg0,91,193,0|eqjgjz,91,193,0|eqjgk0,89,191,1|ezwf3z,89,191,1|ezwf40,91,193,0|gcgsrz,91,193,0|gcgss0,89,191,1|gkdwnz,89,191,1|gkdwo0,91,193,0|gtr0rz,91,193,0|gtr0s0,89,191,1|h33zbz,89,191,1|h33zc0,91,193,0|hch3fz,91,193,0|hch3g0,89,191,1|hlu1zz,89,191,1|hlu200,91,193,0|hv763z,91,193,0|hv7640,89,191,1|i4k4nz,89,191,1|i4k4o0,91,193,0|idx8rz,91,193,0|idx8s0,89,191,1|ina7bz,89,191,1|ina7c0,91,193,0|iwnbfz,91,193,0|iwnbg0,89,191,1|j6d8nz,89,191,1|j6d8o0,91,193,0|nlvwrz,91,193,0|nlvws0,89,191,1|nv8prz,89,191,1|nv8ps0,91,193,0|o4lzfz,91,193,0|o4lzg0,89,191,1|odysfz,89,191,1|odysg0,91,193,0\",\"Asia/Irkutsk|,0,244,0|-1ayylz5,117,244,0|-q28gn6,117,244,0|-q28gn5,91,193,0|-kmrfg1,91,193,0|-kmrfg0,89,191,0|5vasfz,89,191,0|5vasg0,107,224,1|64plnz,107,224,1|64plo0,89,191,0|6e2prz,89,191,0|6e2ps0,107,224,1|6nhizz,107,224,1|6nhj00,89,191,0|6wun3z,89,191,0|6wun40,107,224,1|769gbz,107,224,1|769gc0,89,191,0|7fof3z,89,191,0|7fof40,107,224,1|7p1lzz,107,224,1|7p1m00,89,191,0|7yenbz,89,191,0|7yenc0,107,224,1|87ronz,107,224,1|87roo0,89,191,0|8h4pzz,89,191,0|8h4q00,107,224,1|8qhrbz,107,224,1|8qhrc0,89,191,0|8zusnz,89,191,0|8zuso0,107,224,1|997tzz,107,224,1|997u00,89,191,0|9ikvbz,89,191,0|9ikvc0,107,224,1|9rxwnz,107,224,1|9rxwo0,89,191,0|a1axzz,89,191,0|a1ay00,107,224,1|aanzbz,107,224,1|aanzc0,89,191,0|ak10nz,89,191,0|ak10o0,107,224,1|atr0nz,107,224,1|atr0o0,89,191,0|b341zz,89,191,0|b34200,89,191,1|bch63z,89,191,1|bch640,91,193,0|bi8krz,91,193,0|bi8ks0,89,191,0|blu4nz,89,191,0|blu4o0,107,224,1|bv75zz,107,224,1|bv7600,89,191,0|c4k7bz,89,191,0|c4k7c0,107,224,1|cdx8nz,107,224,1|cdx8o0,89,191,0|cna9zz,89,191,0|cnaa00,107,224,1|cwnbbz,107,224,1|cwnbc0,89,191,0|d60cnz,89,191,0|d60co0,107,224,1|dfddzz,107,224,1|dfde00,89,191,0|dp3dzz,89,191,0|dp3e00,107,224,1|dzw9zz,107,224,1|dzwa00,89,191,0|e7tgnz,89,191,0|e7tgo0,107,224,1|eimcnz,107,224,1|eimco0,89,191,0|eqjjbz,89,191,0|eqjjc0,107,224,1|f1cfbz,107,224,1|f1cfc0,89,191,0|f99lzz,89,191,0|f99m00,107,224,1|fkfgnz,107,224,1|fkfgo0,89,191,0|frzonz,89,191,0|frzoo0,107,224,1|g35jbz,107,224,1|g35jc0,89,191,0|gaprbz,89,191,0|gaprc0,107,224,1|glvlzz,107,224,1|glvm00,89,191,0|gtssnz,89,191,0|gtsso0,107,224,1|h4lonz,107,224,1|h4loo0,89,191,0|hcivbz,89,191,0|hcivc0,107,224,1|hnbrbz,107,224,1|hnbrc0,89,191,0|hv8xzz,89,191,0|hv8y00,107,224,1|i6esnz,107,224,1|i6eso0,89,191,0|idz0nz,89,191,0|idz0o0,107,224,1|ip4vbz,107,224,1|ip4vc0,89,191,0|iwp3bz,89,191,0|iwp3c0,107,224,1|j7uxzz,107,224,1|j7uy00,89,191,0|jff5zz,89,191,0|jff600,107,224,1|jql0nz,107,224,1|jql0o0,89,191,0|jyi7bz,89,191,0|jyi7c0,107,224,1|k9b3bz,107,224,1|k9b3c0,89,191,0|kh89zz,89,191,0|kh8a00,107,224,1|ks15zz,107,224,1|ks1600,89,191,0|kzycnz,89,191,0|kzyco0,107,224,1|lb47bz,107,224,1|lb47c0,89,191,0|liofbz,89,191,0|liofc0,107,224,0|ne0f7z,107,224,0|ne0f80,89,191,0\",\"Asia/Jakarta|,0,245,0|-1hftyg0,53,245,0|-o0bdpd,53,245,0|-o0bdpc,118,246,0|-jebgdd,118,246,0|-jebgdc,106,222,0|-ehxgu1,106,222,0|-ehxgu0,107,224,0|-co37o1,107,224,0|-co37o0,106,222,0|-bb5zi1,106,222,0|-bb5zi0,89,191,0|-a9m681,89,191,0|-a9m680,106,222,0|-34ru61,106,222,0|-34ru60,119,193,0\",\"Asia/Jayapura|,0,247,0|-jebm20,107,224,0|-d7zvo1,107,224,0|-d7zvo0,120,248,0|-34rzq1,120,248,0|-34rzq0,121,224,0\",\"Asia/Jerusalem|,0,249,0|-1ayy96u,122,250,0|-r50eih,122,250,0|-r50eig,110,11,0|-ffv401,110,11,0|-ffv400,111,6,1|-f9l6o1,111,6,1|-f9l6o0,110,11,0|-f765c1,110,11,0|-f765c0,111,6,1|-e6fxc1,111,6,1|-e6fxc0,110,11,0|-dyoao1,110,11,0|-dyoao0,111,6,1|-dno001,111,6,1|-dno000,110,11,0|-dfuio1,110,11,0|-dfuio0,111,6,1|-d4u801,111,6,1|-d4u800,110,11,0|-cwatc1,110,11,0|-cwatc0,111,6,1|-cm2ao1,111,6,1|-cm2ao0,110,11,0|-cdiw01,110,11,0|-cdiw00,111,6,1|-c3adc1,111,6,1|-c3adc0,110,11,0|-ba0o01,110,11,0|-ba0o00,123,209,1|-b4tmo1,123,209,1|-b4tmo0,111,6,1|-b1oo01,111,6,1|-b1oo00,110,11,0|-asdhc1,110,11,0|-asdhc0,111,6,1|-aiwqo1,111,6,1|-aiwqo0,110,11,0|-aadc01,110,11,0|-aadc00,111,6,1|-a2juo1,111,6,1|-a2juo0,110,11,0|-9sd6o1,110,11,0|-9sd6o0,111,6,1|-9gudc1,111,6,1|-9gudc0,110,11,0|-98k801,110,11,0|-98k800,111,6,1|-8z76o1,111,6,1|-8z76o0,110,11,0|-8q7401,110,11,0|-8q7400,111,6,1|-8i9xc1,111,6,1|-8i9xc0,110,11,0|-848dc1,110,11,0|-848dc0,111,6,1|-7zjuo1,111,6,1|-7zjuo0,110,11,0|-7liao1,110,11,0|-7liao0,111,6,1|-7gts01,111,6,1|-7gts00,110,11,0|-7356o1,110,11,0|-7356o0,111,6,1|-6x0tc1,111,6,1|-6x0tc0,110,11,0|-6m7xc1,110,11,0|-6m7xc0,111,6,1|-6enpc1,111,6,1|-6enpc0,110,11,0|2crp3z,110,11,0|2crp40,111,6,1|2ht3nz,111,6,1|2ht3o0,110,11,0|2rj6fz,110,11,0|2rj6g0,111,6,1|2ydebz,111,6,1|2ydec0,110,11,0|5iwyfz,110,11,0|5iwyg0,111,6,1|5l2qfz,111,6,1|5l2qg0,110,11,0|7hhp3z,110,11,0|7hhp40,111,6,1|7n93rz,111,6,1|7n93s0,110,11,0|7z4vrz,110,11,0|7z4vs0,111,6,1|86c2bz,111,6,1|86c2c0,110,11,0|8jnrrz,110,11,0|8jnrs0,111,6,1|8pf3nz,111,6,1|8pf3o0,110,11,0|90ql3z,110,11,0|90ql40,111,6,1|98i4zz,111,6,1|98i500,110,11,0|9jb3rz,110,11,0|9jb3s0,111,6,1|9qv8zz,111,6,1|9qv900,110,11,0|a342fz,110,11,0|a342g0,111,6,1|a9lbnz,111,6,1|a9lbo0,110,11,0|ak1brz,110,11,0|ak1bs0,111,6,1|aryfnz,111,6,1|aryfo0,110,11,0|b2refz,110,11,0|b2reg0,111,6,1|bb1gzz,111,6,1|bb1h00,110,11,0|blufrz,110,11,0|blufs0,111,6,1|bu4ibz,111,6,1|bu4ic0,110,11,0|c4trrz,110,11,0|c4trs0,111,6,1|ccukzz,111,6,1|ccul00,110,11,0|cnjufz,110,11,0|cnjug0,111,6,1|cv7ozz,111,6,1|cv7p00,110,11,0|d69x3z,110,11,0|d69x40,111,6,1|deaqbz,111,6,1|deaqc0,110,11,0|doa2fz,110,11,0|doa2g0,111,6,1|dxskzz,111,6,1|dxsl00,110,11,0|e7d3rz,110,11,0|e7d3s0,111,6,1|eggszz,111,6,1|eggt00,110,11,0|eq36fz,110,11,0|eq36g0,111,6,1|eytwzz,111,6,1|eytx00,110,11,0|f9jbzz,110,11,0|f9jc00,111,6,1|fhgfvz,111,6,1|fhgfw0,110,11,0|fszbzz,110,11,0|fszc00,111,6,1|g1z93z,111,6,1|g1z940,110,11,0|gbhx7z,110,11,0|gbhx80,111,6,1|gk4yfz,111,6,1|gk4yg0,110,11,0|gtph7z,110,11,0|gtph80,111,6,1|h3kyfz,111,6,1|h3kyg0,110,11,0|hcfjvz,110,11,0|hcfjw0,111,6,1|hm5h3z,111,6,1|hm5h40,110,11,0|hvrujz,110,11,0|hvruk0,111,6,1|i4evrz,111,6,1|i4evs0,110,11,0|ie8qnz,110,11,0|ie8qo0,111,6,1|io2d7z,111,6,1|io2d80,110,11,0|iwytbz,110,11,0|iwytc0,111,6,1|j6fh7z,111,6,1|j6fh80,110,11,0|jfovzz,110,11,0|jfow00,111,6,1|jofmjz,111,6,1|jofmk0,110,11,0|jyeynz,110,11,0|jyeyo0,111,6,1|k88l7z,111,6,1|k88l80,110,11,0|kh51bz,110,11,0|kh51c0,111,6,1|kqlp7z,111,6,1|kqlp80,110,11,0|kzv3zz,110,11,0|kzv400,111,6,1|l8lujz,111,6,1|l8luk0,110,11,0|liy5bz,110,11,0|liy5c0,111,6,1|lset7z,111,6,1|lset80,110,11,0|m1o7zz,110,11,0|m1o800,111,6,1|marx7z,111,6,1|marx80,110,11,0|mkeanz,110,11,0|mkeao0,111,6,1|mvat7z,111,6,1|mvat80,110,11,0|n34dbz,110,11,0|n34dc0,111,6,1|ne0vvz,111,6,1|ne0vw0,110,11,0|nlufzz,110,11,0|nlug00,111,6,1|nwqyjz,111,6,1|nwqyk0,110,11,0|o4kinz,110,11,0|o4kio0,111,6,1|oftzvz,111,6,1|oftzw0,110,11,0|onalbz,110,11,0|onalc0,111,6,1|oyk2jz,111,6,1|oyk2k0,110,11,0|p60nzz,110,11,0|p60o00,111,6,1|pha57z,111,6,1|pha580,110,11,0|pp3pbz,110,11,0|pp3pc0,111,6,1|q007vz,111,6,1|q007w0,110,11,0|q7trzz,110,11,0|q7ts00,111,6,1|qiqajz,111,6,1|qiqak0,110,11,0|qqjunz,110,11,0|qqjuo0,111,6,1|r1tbvz,111,6,1|r1tbw0,110,11,0|r99xbz,110,11,0|r99xc0,111,6,1|rkjejz,111,6,1|rkjek0,110,11,0|rrzzzz,110,11,0|rs0000,111,6,1|s39h7z,111,6,1|s39h80,110,11,0|sb31bz,110,11,0|sb31c0,111,6,1|slzjvz,111,6,1|slzjw0,110,11,0|stt3zz,110,11,0|stt400,111,6,1|t4pmjz,111,6,1|t4pmk0,110,11,0|tcj6nz,110,11,0|tcj6o0,111,6,1|tnfp7z,111,6,1|tnfp80,110,11,0|tv99bz,110,11,0|tv99c0,111,6,1|u6iqjz,111,6,1|u6iqk0,110,11,0|udzbzz,110,11,0|udzc00,111,6,1|up8t7z,111,6,1|up8t80,110,11,0|uwpenz,110,11,0|uwpeo0,111,6,1|v7yvvz,111,6,1|v7yvw0,110,11,0|vfsfzz,110,11,0|vfsg00,111,6,1|vqoyjz,111,6,1|vqoyk0,110,11,0|vyiinz,110,11,0|vyiio0,111,6,1|w9f17z,111,6,1|w9f180,110,11,0|wh8lbz,110,11,0|wh8lc0,111,6,1|wsi2jz,111,6,1|wsi2k0,110,11,0|wzynzz,110,11,0|wzyo00,111,6,1|xb857z,111,6,1|xb8580,110,11,0|xioqnz,110,11,0|xioqo0,111,6,1|xty7vz,111,6,1|xty7w0,110,11,0|y1etbz,110,11,0|y1etc0,111,6,1|ycoajz,111,6,1|ycoak0,110,11,0|ykhunz,110,11,0|ykhuo0,111,6,1|yved7z,111,6,1|yved80,110,11,0|z37xbz,110,11,0|z37xc0,111,6,1|ze4fvz,111,6,1|ze4fw0,110,11,0\",\"Asia/Kabul|,0,251,0|-15r1m5c,105,209,0|-d1pkg1,105,209,0|-d1pkg0,124,252,0\",\"Asia/Kamchatka|,0,253,0|-olrupo,90,192,0|-kmrqk1,90,192,0|-kmrqk0,102,200,0|5vahbz,102,200,0|5vahc0,103,201,1|64pajz,103,201,1|64pak0,102,200,0|6e2enz,102,200,0|6e2eo0,103,201,1|6nh7vz,103,201,1|6nh7w0,102,200,0|6wubzz,102,200,0|6wuc00,103,201,1|76957z,103,201,1|769580,102,200,0|7fo3zz,102,200,0|7fo400,103,201,1|7p1avz,103,201,1|7p1aw0,102,200,0|7yec7z,102,200,0|7yec80,103,201,1|87rdjz,103,201,1|87rdk0,102,200,0|8h4evz,102,200,0|8h4ew0,103,201,1|8qhg7z,103,201,1|8qhg80,102,200,0|8zuhjz,102,200,0|8zuhk0,103,201,1|997ivz,103,201,1|997iw0,102,200,0|9ikk7z,102,200,0|9ikk80,103,201,1|9rxljz,103,201,1|9rxlk0,102,200,0|a1amvz,102,200,0|a1amw0,103,201,1|aano7z,103,201,1|aano80,102,200,0|ak0pjz,102,200,0|ak0pk0,103,201,1|atqpjz,103,201,1|atqpk0,102,200,0|b33qvz,102,200,0|b33qw0,102,200,1|bcguzz,102,200,1|bcgv00,90,192,0|bi89nz,90,192,0|bi89o0,102,200,0|blttjz,102,200,0|blttk0,103,201,1|bv6uvz,103,201,1|bv6uw0,102,200,0|c4jw7z,102,200,0|c4jw80,103,201,1|cdwxjz,103,201,1|cdwxk0,102,200,0|cn9yvz,102,200,0|cn9yw0,103,201,1|cwn07z,103,201,1|cwn080,102,200,0|d601jz,102,200,0|d601k0,103,201,1|dfd2vz,103,201,1|dfd2w0,102,200,0|dp32vz,102,200,0|dp32w0,103,201,1|dzvyvz,103,201,1|dzvyw0,102,200,0|e7t5jz,102,200,0|e7t5k0,103,201,1|eim1jz,103,201,1|eim1k0,102,200,0|eqj87z,102,200,0|eqj880,103,201,1|f1c47z,103,201,1|f1c480,102,200,0|f99avz,102,200,0|f99aw0,103,201,1|fkf5jz,103,201,1|fkf5k0,102,200,0|frzdjz,102,200,0|frzdk0,103,201,1|g3587z,103,201,1|g35880,102,200,0|gapg7z,102,200,0|gapg80,103,201,1|glvavz,103,201,1|glvaw0,102,200,0|gtshjz,102,200,0|gtshk0,103,201,1|h4ldjz,103,201,1|h4ldk0,102,200,0|hcik7z,102,200,0|hcik80,103,201,1|hnbg7z,103,201,1|hnbg80,102,200,0|hv8mvz,102,200,0|hv8mw0,103,201,1|i6ehjz,103,201,1|i6ehk0,102,200,0|idypjz,102,200,0|idypk0,103,201,1|ip4k7z,103,201,1|ip4k80,102,200,0|iwos7z,102,200,0|iwos80,103,201,1|j7umvz,103,201,1|j7umw0,102,200,0|jfeuvz,102,200,0|jfeuw0,103,201,1|jqkpjz,103,201,1|jqkpk0,102,200,0|jyhw7z,102,200,0|jyhw80,103,201,1|k9as7z,103,201,1|k9as80,102,200,0|kh7yvz,102,200,0|kh7yw0,103,201,1|ks0uvz,103,201,1|ks0uw0,102,200,0|kzy1jz,102,200,0|kzy1k0,102,200,1|lb3yzz,102,200,1|lb3z00,90,192,0|lio6zz,90,192,0|lio700,102,200,0\",\"Asia/Karachi|,0,254,0|-wvpb30,108,228,0|-e9lba1,108,228,0|-e9lba0,109,229,1|-cmya21,109,229,1|-cmya20,108,228,0|-9j0km1,108,228,0|-9j0km0,92,194,0|n33fz,92,194,0|n33g0,125,194,0|gu5u3z,125,194,0|gu5u40,126,196,1|h3isnz,126,196,1|h3iso0,125,194,0|k1qy3z,125,194,0|k1qy40,126,196,1|k9m7bz,126,196,1|k9m7c0,125,194,0|ki3u3z,125,194,0|ki3u40,126,196,1|kse4nz,126,196,1|kse4o0,125,194,0\",\"Asia/Kathmandu|,0,255,0|-q3gt4s,108,228,0|8clspz,108,228,0|8clsq0,127,256,0\",\"Asia/Khandyga|,0,257,0|-q4cjrp,89,191,0|-kmri81,89,191,0|-kmri80,107,224,0|5vapnz,107,224,0|5vapo0,93,195,1|64pivz,93,195,1|64piw0,107,224,0|6e2mzz,107,224,0|6e2n00,93,195,1|6nhg7z,93,195,1|6nhg80,107,224,0|6wukbz,107,224,0|6wukc0,93,195,1|769djz,93,195,1|769dk0,107,224,0|7focbz,107,224,0|7focc0,93,195,1|7p1j7z,93,195,1|7p1j80,107,224,0|7yekjz,107,224,0|7yekk0,93,195,1|87rlvz,93,195,1|87rlw0,107,224,0|8h4n7z,107,224,0|8h4n80,93,195,1|8qhojz,93,195,1|8qhok0,107,224,0|8zupvz,107,224,0|8zupw0,93,195,1|997r7z,93,195,1|997r80,107,224,0|9iksjz,107,224,0|9iksk0,93,195,1|9rxtvz,93,195,1|9rxtw0,107,224,0|a1av7z,107,224,0|a1av80,93,195,1|aanwjz,93,195,1|aanwk0,107,224,0|ak0xvz,107,224,0|ak0xw0,93,195,1|atqxvz,93,195,1|atqxw0,107,224,0|b33z7z,107,224,0|b33z80,107,224,1|bch3bz,107,224,1|bch3c0,89,191,0|bi8hzz,89,191,0|bi8i00,107,224,0|blu1vz,107,224,0|blu1w0,93,195,1|bv737z,93,195,1|bv7380,107,224,0|c4k4jz,107,224,0|c4k4k0,93,195,1|cdx5vz,93,195,1|cdx5w0,107,224,0|cna77z,107,224,0|cna780,93,195,1|cwn8jz,93,195,1|cwn8k0,107,224,0|d609vz,107,224,0|d609w0,93,195,1|dfdb7z,93,195,1|dfdb80,107,224,0|dp3b7z,107,224,0|dp3b80,93,195,1|dzw77z,93,195,1|dzw780,107,224,0|e7tdvz,107,224,0|e7tdw0,93,195,1|eim9vz,93,195,1|eim9w0,107,224,0|eqjgjz,107,224,0|eqjgk0,93,195,1|f1ccjz,93,195,1|f1cck0,107,224,0|f99j7z,107,224,0|f99j80,93,195,1|fkfdvz,93,195,1|fkfdw0,107,224,0|frzlvz,107,224,0|frzlw0,93,195,1|g35gjz,93,195,1|g35gk0,107,224,0|gapojz,107,224,0|gapok0,93,195,1|glvj7z,93,195,1|glvj80,107,224,0|gtspvz,107,224,0|gtspw0,93,195,1|h4llvz,93,195,1|h4llw0,107,224,0|hcisjz,107,224,0|hcisk0,93,195,1|hnbojz,93,195,1|hnbok0,107,224,0|hqrlnz,107,224,0|hqrlo0,93,195,0|hv8sfz,93,195,0|hv8sg0,90,192,1|i6en3z,90,192,1|i6en40,93,195,0|idyv3z,93,195,0|idyv40,90,192,1|ip4prz,90,192,1|ip4ps0,93,195,0|iwoxrz,93,195,0|iwoxs0,90,192,1|j7usfz,90,192,1|j7usg0,93,195,0|jff0fz,93,195,0|jff0g0,90,192,1|jqkv3z,90,192,1|jqkv40,93,195,0|jyi1rz,93,195,0|jyi1s0,90,192,1|k9axrz,90,192,1|k9axs0,93,195,0|kh84fz,93,195,0|kh84g0,90,192,1|ks10fz,90,192,1|ks10g0,93,195,0|kzy73z,93,195,0|kzy740,90,192,1|lb41rz,90,192,1|lb41s0,93,195,0|lio9rz,93,195,0|lio9s0,90,192,0|lreurz,90,192,0|lreus0,93,195,0|ne0cfz,93,195,0|ne0cg0,107,224,0\",\"Asia/Kolkata|,0,258,0|-1oaa314,77,232,0|-1g6thox,77,232,0|-1g6thow,21,259,0|-xehavb,21,259,0|-xehava,110,228,0|-eqtom1,110,228,0|-eqtom0,109,229,1|-ef78q1,109,229,1|-ef78q0,110,228,0|-e9lba1,110,228,0|-e9lba0,109,229,1|-cmya21,109,229,1|-cmya20,110,228,0\",\"Asia/Krasnoyarsk|,0,260,0|-q37l72,96,196,0|-kmrco1,96,196,0|-kmrco0,91,193,0|5vav7z,91,193,0|5vav80,89,191,1|64pofz,89,191,1|64pog0,91,193,0|6e2sjz,91,193,0|6e2sk0,89,191,1|6nhlrz,89,191,1|6nhls0,91,193,0|6wupvz,91,193,0|6wupw0,89,191,1|769j3z,89,191,1|769j40,91,193,0|7fohvz,91,193,0|7fohw0,89,191,1|7p1orz,89,191,1|7p1os0,91,193,0|7yeq3z,91,193,0|7yeq40,89,191,1|87rrfz,89,191,1|87rrg0,91,193,0|8h4srz,91,193,0|8h4ss0,89,191,1|8qhu3z,89,191,1|8qhu40,91,193,0|8zuvfz,91,193,0|8zuvg0,89,191,1|997wrz,89,191,1|997ws0,91,193,0|9iky3z,91,193,0|9iky40,89,191,1|9rxzfz,89,191,1|9rxzg0,91,193,0|a1b0rz,91,193,0|a1b0s0,89,191,1|aao23z,89,191,1|aao240,91,193,0|ak13fz,91,193,0|ak13g0,89,191,1|atr3fz,89,191,1|atr3g0,91,193,0|b344rz,91,193,0|b344s0,91,193,1|bch8vz,91,193,1|bch8w0,96,196,0|bi8njz,96,196,0|bi8nk0,91,193,0|blu7fz,91,193,0|blu7g0,89,191,1|bv78rz,89,191,1|bv78s0,91,193,0|c4ka3z,91,193,0|c4ka40,89,191,1|cdxbfz,89,191,1|cdxbg0,91,193,0|cnacrz,91,193,0|cnacs0,89,191,1|cwne3z,89,191,1|cwne40,91,193,0|d60ffz,91,193,0|d60fg0,89,191,1|dfdgrz,89,191,1|dfdgs0,91,193,0|dp3grz,91,193,0|dp3gs0,89,191,1|dzwcrz,89,191,1|dzwcs0,91,193,0|e7tjfz,91,193,0|e7tjg0,89,191,1|eimffz,89,191,1|eimfg0,91,193,0|eqjm3z,91,193,0|eqjm40,89,191,1|f1ci3z,89,191,1|f1ci40,91,193,0|f99orz,91,193,0|f99os0,89,191,1|fkfjfz,89,191,1|fkfjg0,91,193,0|frzrfz,91,193,0|frzrg0,89,191,1|g35m3z,89,191,1|g35m40,91,193,0|gapu3z,91,193,0|gapu40,89,191,1|glvorz,89,191,1|glvos0,91,193,0|gtsvfz,91,193,0|gtsvg0,89,191,1|h4lrfz,89,191,1|h4lrg0,91,193,0|hciy3z,91,193,0|hciy40,89,191,1|hnbu3z,89,191,1|hnbu40,91,193,0|hv90rz,91,193,0|hv90s0,89,191,1|i6evfz,89,191,1|i6evg0,91,193,0|idz3fz,91,193,0|idz3g0,89,191,1|ip4y3z,89,191,1|ip4y40,91,193,0|iwp63z,91,193,0|iwp640,89,191,1|j7v0rz,89,191,1|j7v0s0,91,193,0|jff8rz,91,193,0|jff8s0,89,191,1|jql3fz,89,191,1|jql3g0,91,193,0|jyia3z,91,193,0|jyia40,89,191,1|k9b63z,89,191,1|k9b640,91,193,0|kh8crz,91,193,0|kh8cs0,89,191,1|ks18rz,89,191,1|ks18s0,91,193,0|kzyffz,91,193,0|kzyfg0,89,191,1|lb4a3z,89,191,1|lb4a40,91,193,0|lioi3z,91,193,0|lioi40,89,191,0|ne0hzz,89,191,0|ne0i00,91,193,0\",\"Asia/Kuala_Lumpur|,0,261,0|-100ew5y,85,262,0|-xphpwe,85,262,0|-xphpwd,91,193,0|-jb6gs1,91,193,0|-jb6gs0,118,246,1|-hquppd,118,246,1|-hquppc,118,246,0|-esddpd,118,246,0|-esddpc,106,222,0|-ejqa61,106,222,0|-ejqa60,107,224,0|-conl01,107,224,0|-conl00,106,222,0|69g35z,106,222,0|69g360,89,191,0\",\"Asia/Kuching|,0,263,0|-mvof3k,106,222,0|-jb6i61,106,222,0|-jb6i60,89,191,0|-hwgm81,89,191,0|-hwgm80,128,264,1|-hrs4hd,128,264,1|-hrs4hc,89,191,0|-hdmu81,89,191,0|-hdmu80,128,264,1|-h8ychd,128,264,1|-h8ychc,89,191,0|-guuww1,89,191,0|-guuww0,128,264,1|-gq6f5d,128,264,1|-gq6f5c,89,191,0|-gc2zk1,89,191,0|-gc2zk0,128,264,1|-g7ehtd,128,264,1|-g7ehtc,89,191,0|-ftb281,89,191,0|-ftb280,128,264,1|-fomkhd,128,264,1|-fomkhc,89,191,0|-faha81,89,191,0|-faha80,128,264,1|-f5sshd,128,264,1|-f5sshc,89,191,0|-erpcw1,89,191,0|-erpcw0,128,264,1|-en0v5d,128,264,1|-en0v5c,89,191,0|-ejqbk1,89,191,0|-ejqbk0,107,224,0|-conl01,107,224,0|-conl00,89,191,0\",\"Asia/Kuwait|,0,203,0|-bwgbbg,100,6,0\",\"Asia/Macau|,0,265,0|-y0i2cy,45,191,0|-emm3o1,45,191,0|-emm3o0,107,224,0|-efxfs1,107,224,0|-efxfs0,93,195,1|-e5lak1,93,195,1|-e5lak0,107,224,0|-dx5ig1,107,224,0|-dx5ig0,93,195,1|-dpa981,93,195,1|-dpa980,107,224,0|-cnoec1,107,224,0|-cnoec0,45,191,0|-ccrt01,45,191,0|-ccrt00,46,224,1|-c4wh01,46,224,1|-c4wh00,45,191,0|-buk901,45,191,0|-buk900,46,224,1|-bizl01,46,224,1|-bizl00,45,191,0|-bb2ec1,45,191,0|-bb2ec0,46,224,1|-b1pd01,46,224,1|-b1pd00,45,191,0|-atu101,45,191,0|-atu100,46,224,1|-aj1501,46,224,1|-aj1500,45,191,0|-ab3yc1,45,191,0|-ab3yc0,46,224,1|-a0b2c1,46,224,1|-a0b2c0,45,191,0|-9sdvo1,45,191,0|-9sdvo0,46,224,1|-9hj501,46,224,1|-9hj500,45,191,0|-99auc1,45,191,0|-99auc0,46,224,1|-8yhyc1,46,224,1|-8yhyc0,45,191,0|-8qkro1,45,191,0|-8qkro0,46,224,1|-8frvo1,46,224,1|-8frvo0,45,191,0|-88kmc1,45,191,0|-88kmc0,46,224,1|-7x1t01,46,224,1|-7x1t00,45,191,0|-7pujo1,45,191,0|-7pujo0,46,224,1|-7dyro1,46,224,1|-7dyro0,45,191,0|-774h01,45,191,0|-774h00,46,224,1|-6v8fa1,46,224,1|-6v8fa0,45,191,0|-6o1361,45,191,0|-6o1360,46,224,1|-6cicm1,46,224,1|-6cicm0,45,191,0|-65b0i1,45,191,0|-65b0i0,46,224,1|-5ts9y1,46,224,1|-5ts9y0,45,191,0|-5mkxu1,45,191,0|-5mkxu0,46,224,1|-5b27a1,46,224,1|-5b27a0,45,191,0|-53uv61,45,191,0|-53uv60,46,224,1|-4rz5y1,46,224,1|-4rz5y0,45,191,0|-4l4si1,45,191,0|-4l4si0,46,224,1|-4993a1,46,224,1|-4993a0,45,191,0|-42epu1,45,191,0|-42epu0,46,224,1|-3qj0m1,46,224,1|-3qj0m0,45,191,0|-3jboi1,45,191,0|-3jboi0,46,224,1|-37sxy1,46,224,1|-37sxy0,45,191,0|-30llu1,45,191,0|-30llu0,46,224,1|-2p2va1,46,224,1|-2p2va0,45,191,0|-2gfoi1,45,191,0|-2gfoi0,46,224,1|-272sq1,46,224,1|-272sq0,45,191,0|-1xplu1,45,191,0|-1xplu0,46,224,1|-1ocq21,46,224,1|-1ocq20,45,191,0|-1ezj61,45,191,0|-1ezj60,46,224,1|-159ly1,46,224,1|-159ly0,45,191,0|-vwhu1,45,191,0|-vwhu0,46,224,1|-mjja1,46,224,1|-mjja0,45,191,0|-d6f61,45,191,0|-d6f60,46,224,1|-3tgm1,46,224,1|-3tgm0,45,191,0|5jnhz,45,191,0|5jni0,46,224,1|ewm1z,46,224,1|ewm20,45,191,0|o9q5z,45,191,0|o9q60,46,224,1|xmopz,46,224,1|xmoq0,45,191,0|16zstz,45,191,0|16zsu0,46,224,1|1gpq1z,46,224,1|1gpq20,45,191,0|1q2u5z,45,191,0|1q2u60,46,224,1|1zfspz,46,224,1|1zfsq0,45,191,0|231i5z,45,191,0|231i60,46,224,1|2i5vdz,46,224,1|2i5ve0,45,191,0|2rizhz,45,191,0|2rizi0,46,224,1|30vy1z,46,224,1|30vy20,45,191,0|3a925z,45,191,0|3a9260,46,224,1|3jm0pz,46,224,1|3jm0q0,45,191,0|4vv4tz,45,191,0|4vv4u0,46,224,1|5457dz,46,224,1|5457e0,45,191,0\",\"Asia/Magadan|,0,266,0|-nu1nxc,93,195,0|-kmrns1,93,195,0|-kmrns0,90,192,0|5vak3z,90,192,0|5vak40,102,200,1|64pdbz,102,200,1|64pdc0,90,192,0|6e2hfz,90,192,0|6e2hg0,102,200,1|6nhanz,102,200,1|6nhao0,90,192,0|6wuerz,90,192,0|6wues0,102,200,1|7697zz,102,200,1|769800,90,192,0|7fo6rz,90,192,0|7fo6s0,102,200,1|7p1dnz,102,200,1|7p1do0,90,192,0|7yeezz,90,192,0|7yef00,102,200,1|87rgbz,102,200,1|87rgc0,90,192,0|8h4hnz,90,192,0|8h4ho0,102,200,1|8qhizz,102,200,1|8qhj00,90,192,0|8zukbz,90,192,0|8zukc0,102,200,1|997lnz,102,200,1|997lo0,90,192,0|9ikmzz,90,192,0|9ikn00,102,200,1|9rxobz,102,200,1|9rxoc0,90,192,0|a1apnz,90,192,0|a1apo0,102,200,1|aanqzz,102,200,1|aanr00,90,192,0|ak0sbz,90,192,0|ak0sc0,102,200,1|atqsbz,102,200,1|atqsc0,90,192,0|b33tnz,90,192,0|b33to0,90,192,1|bcgxrz,90,192,1|bcgxs0,93,195,0|bi8cfz,93,195,0|bi8cg0,90,192,0|bltwbz,90,192,0|bltwc0,102,200,1|bv6xnz,102,200,1|bv6xo0,90,192,0|c4jyzz,90,192,0|c4jz00,102,200,1|cdx0bz,102,200,1|cdx0c0,90,192,0|cna1nz,90,192,0|cna1o0,102,200,1|cwn2zz,102,200,1|cwn300,90,192,0|d604bz,90,192,0|d604c0,102,200,1|dfd5nz,102,200,1|dfd5o0,90,192,0|dp35nz,90,192,0|dp35o0,102,200,1|dzw1nz,102,200,1|dzw1o0,90,192,0|e7t8bz,90,192,0|e7t8c0,102,200,1|eim4bz,102,200,1|eim4c0,90,192,0|eqjazz,90,192,0|eqjb00,102,200,1|f1c6zz,102,200,1|f1c700,90,192,0|f99dnz,90,192,0|f99do0,102,200,1|fkf8bz,102,200,1|fkf8c0,90,192,0|frzgbz,90,192,0|frzgc0,102,200,1|g35azz,102,200,1|g35b00,90,192,0|gapizz,90,192,0|gapj00,102,200,1|glvdnz,102,200,1|glvdo0,90,192,0|gtskbz,90,192,0|gtskc0,102,200,1|h4lgbz,102,200,1|h4lgc0,90,192,0|hcimzz,90,192,0|hcin00,102,200,1|hnbizz,102,200,1|hnbj00,90,192,0|hv8pnz,90,192,0|hv8po0,102,200,1|i6ekbz,102,200,1|i6ekc0,90,192,0|idysbz,90,192,0|idysc0,102,200,1|ip4mzz,102,200,1|ip4n00,90,192,0|iwouzz,90,192,0|iwov00,102,200,1|j7upnz,102,200,1|j7upo0,90,192,0|jfexnz,90,192,0|jfexo0,102,200,1|jqksbz,102,200,1|jqksc0,90,192,0|jyhyzz,90,192,0|jyhz00,102,200,1|k9auzz,102,200,1|k9av00,90,192,0|kh81nz,90,192,0|kh81o0,102,200,1|ks0xnz,102,200,1|ks0xo0,90,192,0|kzy4bz,90,192,0|kzy4c0,102,200,1|lb3yzz,102,200,1|lb3z00,90,192,0|lio6zz,90,192,0|lio700,102,200,0|ne06vz,102,200,0|ne06w0,93,195,0|o63gfz,93,195,0|o63gg0,90,192,0\",\"Asia/Makassar|,0,267,0|-q3gzg0,21,267,0|-jebi41,21,267,0|-jebi40,89,191,0|-ek3a81,89,191,0|-ek3a80,107,224,0|-co37o1,107,224,0|-co37o0,129,191,0\",\"Asia/Manila|,0,268,0|-1t8ix2o,0,269,0|-10va3qp,0,269,0|-10va3qo,51,191,0|-hb5y81,51,191,0|-hb5y80,57,224,1|-h6fno1,57,224,1|-h6fno0,51,191,0|-efxa81,51,191,0|-efxa80,116,224,0|-d4ux01,116,224,0|-d4ux00,51,191,0|-87fsw1,51,191,0|-87fsw0,57,224,1|-83bqc1,57,224,1|-83bqc0,51,191,0|4aen3z,51,191,0|4aen40,57,224,1|4jtgbz,57,224,1|4jtgc0,51,191,0\",\"Asia/Muscat|,0,234,0|-q3gnko,105,209,0\",\"Asia/Nicosia|,0,270,0|-p4bq6g,15,11,0|2r67rz,15,11,0|2r67s0,16,6,1|30j6bz,16,6,1|30j6c0,15,11,0|3bn93z,15,11,0|3bn940,16,6,1|3jb3nz,16,6,1|3jb3o0,15,11,0|3s9efz,15,11,0|3s9eg0,16,6,1|419ebz,16,6,1|419ec0,15,11,0|4azh3z,15,11,0|4azh40,16,6,1|4keabz,16,6,1|4keac0,15,11,0|4tpjrz,15,11,0|4tpjs0,16,6,1|532ibz,16,6,1|532ic0,15,11,0|5csl3z,15,11,0|5csl40,16,6,1|5lskzz,16,6,1|5lsl00,15,11,0|5v5p3z,15,11,0|5v5p40,16,6,1|64innz,16,6,1|64ino0,15,11,0|6dvrrz,15,11,0|6dvrs0,16,6,1|6n8qbz,16,6,1|6n8qc0,15,11,0|6wlufz,15,11,0|6wlug0,16,6,1|75yszz,16,6,1|75yt00,15,11,0|7fbx3z,15,11,0|7fbx40,16,6,1|7p1ubz,16,6,1|7p1uc0,15,11,0|7yeyfz,15,11,0|7yeyg0,16,6,1|87rwzz,16,6,1|87rx00,15,11,0|8h513z,15,11,0|8h5140,16,6,1|8qhznz,16,6,1|8qhzo0,15,11,0|8zv3rz,15,11,0|8zv3s0,16,6,1|9982bz,16,6,1|9982c0,15,11,0|9il6fz,15,11,0|9il6g0,16,6,1|9ry4zz,16,6,1|9ry500,15,11,0|a1b93z,15,11,0|a1b940,16,6,1|aao7nz,16,6,1|aao7o0,15,11,0|ak1brz,15,11,0|ak1bs0,16,6,1|atr8zz,16,6,1|atr900,15,11,0|b34d3z,15,11,0|b34d40,16,6,1|bchbnz,16,6,1|bchbo0,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60nrz,15,11,0|d60ns0,16,6,1|dfdmbz,16,6,1|dfdmc0,15,11,0|dp3p3z,15,11,0|dp3p40,16,6,1|dygnnz,16,6,1|dygno0,15,11,0|e7trrz,15,11,0|e7trs0,16,6,1|eh6qbz,16,6,1|eh6qc0,15,11,0|eqjufz,15,11,0|eqjug0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Asia/Novokuznetsk|,0,271,0|-nu36tc,96,196,0|-kmrco1,96,196,0|-kmrco0,91,193,0|5vav7z,91,193,0|5vav80,89,191,1|64pofz,89,191,1|64pog0,91,193,0|6e2sjz,91,193,0|6e2sk0,89,191,1|6nhlrz,89,191,1|6nhls0,91,193,0|6wupvz,91,193,0|6wupw0,89,191,1|769j3z,89,191,1|769j40,91,193,0|7fohvz,91,193,0|7fohw0,89,191,1|7p1orz,89,191,1|7p1os0,91,193,0|7yeq3z,91,193,0|7yeq40,89,191,1|87rrfz,89,191,1|87rrg0,91,193,0|8h4srz,91,193,0|8h4ss0,89,191,1|8qhu3z,89,191,1|8qhu40,91,193,0|8zuvfz,91,193,0|8zuvg0,89,191,1|997wrz,89,191,1|997ws0,91,193,0|9iky3z,91,193,0|9iky40,89,191,1|9rxzfz,89,191,1|9rxzg0,91,193,0|a1b0rz,91,193,0|a1b0s0,89,191,1|aao23z,89,191,1|aao240,91,193,0|ak13fz,91,193,0|ak13g0,89,191,1|atr3fz,89,191,1|atr3g0,91,193,0|b344rz,91,193,0|b344s0,91,193,1|bch8vz,91,193,1|bch8w0,96,196,0|bi8njz,96,196,0|bi8nk0,91,193,0|blu7fz,91,193,0|blu7g0,89,191,1|bv78rz,89,191,1|bv78s0,91,193,0|c4ka3z,91,193,0|c4ka40,89,191,1|cdxbfz,89,191,1|cdxbg0,91,193,0|cnacrz,91,193,0|cnacs0,89,191,1|cwne3z,89,191,1|cwne40,91,193,0|d60ffz,91,193,0|d60fg0,89,191,1|dfdgrz,89,191,1|dfdgs0,91,193,0|dp3grz,91,193,0|dp3gs0,89,191,1|dzwcrz,89,191,1|dzwcs0,91,193,0|e7tjfz,91,193,0|e7tjg0,89,191,1|eimffz,89,191,1|eimfg0,91,193,0|eqjm3z,91,193,0|eqjm40,89,191,1|f1ci3z,89,191,1|f1ci40,91,193,0|f99orz,91,193,0|f99os0,89,191,1|fkfjfz,89,191,1|fkfjg0,91,193,0|frzrfz,91,193,0|frzrg0,89,191,1|g35m3z,89,191,1|g35m40,91,193,0|gapu3z,91,193,0|gapu40,89,191,1|glvorz,89,191,1|glvos0,91,193,0|gtsvfz,91,193,0|gtsvg0,89,191,1|h4lrfz,89,191,1|h4lrg0,91,193,0|hciy3z,91,193,0|hciy40,89,191,1|hnbu3z,89,191,1|hnbu40,91,193,0|hv90rz,91,193,0|hv90s0,89,191,1|i6evfz,89,191,1|i6evg0,91,193,0|idz3fz,91,193,0|idz3g0,89,191,1|ip4y3z,89,191,1|ip4y40,91,193,0|iwp63z,91,193,0|iwp640,89,191,1|j7v0rz,89,191,1|j7v0s0,91,193,0|jff8rz,91,193,0|jff8s0,89,191,1|jql3fz,89,191,1|jql3g0,91,193,0|jyia3z,91,193,0|jyia40,89,191,1|k9b63z,89,191,1|k9b640,91,193,0|kh8crz,91,193,0|kh8cs0,89,191,1|ks18rz,89,191,1|ks18s0,91,193,0|kzyffz,91,193,0|kzyfg0,91,193,1|lb4cvz,91,193,1|lb4cw0,96,196,0|liokvz,96,196,0|liokw0,91,193,0\",\"Asia/Novosibirsk|,0,272,0|-q4do0s,96,196,0|-kmrco1,96,196,0|-kmrco0,91,193,0|5vav7z,91,193,0|5vav80,89,191,1|64pofz,89,191,1|64pog0,91,193,0|6e2sjz,91,193,0|6e2sk0,89,191,1|6nhlrz,89,191,1|6nhls0,91,193,0|6wupvz,91,193,0|6wupw0,89,191,1|769j3z,89,191,1|769j40,91,193,0|7fohvz,91,193,0|7fohw0,89,191,1|7p1orz,89,191,1|7p1os0,91,193,0|7yeq3z,91,193,0|7yeq40,89,191,1|87rrfz,89,191,1|87rrg0,91,193,0|8h4srz,91,193,0|8h4ss0,89,191,1|8qhu3z,89,191,1|8qhu40,91,193,0|8zuvfz,91,193,0|8zuvg0,89,191,1|997wrz,89,191,1|997ws0,91,193,0|9iky3z,91,193,0|9iky40,89,191,1|9rxzfz,89,191,1|9rxzg0,91,193,0|a1b0rz,91,193,0|a1b0s0,89,191,1|aao23z,89,191,1|aao240,91,193,0|ak13fz,91,193,0|ak13g0,89,191,1|atr3fz,89,191,1|atr3g0,91,193,0|b344rz,91,193,0|b344s0,91,193,1|bch8vz,91,193,1|bch8w0,96,196,0|bi8njz,96,196,0|bi8nk0,91,193,0|blu7fz,91,193,0|blu7g0,89,191,1|bv78rz,89,191,1|bv78s0,91,193,0|c4ka3z,91,193,0|c4ka40,89,191,1|c7fr3z,89,191,1|c7fr40,91,193,1|cdxe7z,91,193,1|cdxe80,96,196,0|cnafjz,96,196,0|cnafk0,91,193,1|cwngvz,91,193,1|cwngw0,96,196,0|d60i7z,96,196,0|d60i80,91,193,1|dfdjjz,91,193,1|dfdjk0,96,196,0|dp3jjz,96,196,0|dp3jk0,91,193,1|dzwfjz,91,193,1|dzwfk0,96,196,0|e7tm7z,96,196,0|e7tm80,91,193,1|eimi7z,91,193,1|eimi80,96,196,0|eqjovz,96,196,0|eqjow0,91,193,1|f1ckvz,91,193,1|f1ckw0,96,196,0|f99rjz,96,196,0|f99rk0,91,193,1|fkfm7z,91,193,1|fkfm80,96,196,0|frzu7z,96,196,0|frzu80,91,193,1|g35ovz,91,193,1|g35ow0,96,196,0|gapwvz,96,196,0|gapww0,91,193,1|glvrjz,91,193,1|glvrk0,96,196,0|gtsy7z,96,196,0|gtsy80,91,193,1|h4lu7z,91,193,1|h4lu80,96,196,0|hcj0vz,96,196,0|hcj0w0,91,193,1|hnbwvz,91,193,1|hnbww0,96,196,0|hv93jz,96,196,0|hv93k0,91,193,1|i6ey7z,91,193,1|i6ey80,96,196,0|idz67z,96,196,0|idz680,91,193,1|ip50vz,91,193,1|ip50w0,96,196,0|iwp8vz,96,196,0|iwp8w0,91,193,1|j7v3jz,91,193,1|j7v3k0,96,196,0|jffbjz,96,196,0|jffbk0,91,193,1|jql67z,91,193,1|jql680,96,196,0|jyicvz,96,196,0|jyicw0,91,193,1|k9b8vz,91,193,1|k9b8w0,96,196,0|kh8fjz,96,196,0|kh8fk0,91,193,1|ks1bjz,91,193,1|ks1bk0,96,196,0|kzyi7z,96,196,0|kzyi80,91,193,1|lb4cvz,91,193,1|lb4cw0,96,196,0|liokvz,96,196,0|liokw0,91,193,0|ne0krz,91,193,0|ne0ks0,96,196,0|oasa7z,96,196,0|oasa80,91,193,0\",\"Asia/Omsk|,0,273,0|-q5xmx6,92,194,0|-kmr9w1,92,194,0|-kmr9w0,96,196,0|5vaxzz,96,196,0|5vay00,91,193,1|64pr7z,91,193,1|64pr80,96,196,0|6e2vbz,96,196,0|6e2vc0,91,193,1|6nhojz,91,193,1|6nhok0,96,196,0|6wusnz,96,196,0|6wuso0,91,193,1|769lvz,91,193,1|769lw0,96,196,0|7foknz,96,196,0|7foko0,91,193,1|7p1rjz,91,193,1|7p1rk0,96,196,0|7yesvz,96,196,0|7yesw0,91,193,1|87ru7z,91,193,1|87ru80,96,196,0|8h4vjz,96,196,0|8h4vk0,91,193,1|8qhwvz,91,193,1|8qhww0,96,196,0|8zuy7z,96,196,0|8zuy80,91,193,1|997zjz,91,193,1|997zk0,96,196,0|9il0vz,96,196,0|9il0w0,91,193,1|9ry27z,91,193,1|9ry280,96,196,0|a1b3jz,96,196,0|a1b3k0,91,193,1|aao4vz,91,193,1|aao4w0,96,196,0|ak167z,96,196,0|ak1680,91,193,1|atr67z,91,193,1|atr680,96,196,0|b347jz,96,196,0|b347k0,96,196,1|bchbnz,96,196,1|bchbo0,92,194,0|bi8qbz,92,194,0|bi8qc0,96,196,0|blua7z,96,196,0|blua80,91,193,1|bv7bjz,91,193,1|bv7bk0,96,196,0|c4kcvz,96,196,0|c4kcw0,91,193,1|cdxe7z,91,193,1|cdxe80,96,196,0|cnafjz,96,196,0|cnafk0,91,193,1|cwngvz,91,193,1|cwngw0,96,196,0|d60i7z,96,196,0|d60i80,91,193,1|dfdjjz,91,193,1|dfdjk0,96,196,0|dp3jjz,96,196,0|dp3jk0,91,193,1|dzwfjz,91,193,1|dzwfk0,96,196,0|e7tm7z,96,196,0|e7tm80,91,193,1|eimi7z,91,193,1|eimi80,96,196,0|eqjovz,96,196,0|eqjow0,91,193,1|f1ckvz,91,193,1|f1ckw0,96,196,0|f99rjz,96,196,0|f99rk0,91,193,1|fkfm7z,91,193,1|fkfm80,96,196,0|frzu7z,96,196,0|frzu80,91,193,1|g35ovz,91,193,1|g35ow0,96,196,0|gapwvz,96,196,0|gapww0,91,193,1|glvrjz,91,193,1|glvrk0,96,196,0|gtsy7z,96,196,0|gtsy80,91,193,1|h4lu7z,91,193,1|h4lu80,96,196,0|hcj0vz,96,196,0|hcj0w0,91,193,1|hnbwvz,91,193,1|hnbww0,96,196,0|hv93jz,96,196,0|hv93k0,91,193,1|i6ey7z,91,193,1|i6ey80,96,196,0|idz67z,96,196,0|idz680,91,193,1|ip50vz,91,193,1|ip50w0,96,196,0|iwp8vz,96,196,0|iwp8w0,91,193,1|j7v3jz,91,193,1|j7v3k0,96,196,0|jffbjz,96,196,0|jffbk0,91,193,1|jql67z,91,193,1|jql680,96,196,0|jyicvz,96,196,0|jyicw0,91,193,1|k9b8vz,91,193,1|k9b8w0,96,196,0|kh8fjz,96,196,0|kh8fk0,91,193,1|ks1bjz,91,193,1|ks1bk0,96,196,0|kzyi7z,96,196,0|kzyi80,91,193,1|lb4cvz,91,193,1|lb4cw0,96,196,0|liokvz,96,196,0|liokw0,91,193,0|ne0krz,91,193,0|ne0ks0,96,196,0\",\"Asia/Oral|,0,274,0|-nu15ic,100,6,0|-kmr4c1,100,6,0|-kmr4c0,92,194,0|5vb0rz,92,194,0|5vb0s0,96,196,1|64ptzz,96,196,1|64pu00,96,196,0|6e2vbz,96,196,0|6e2vc0,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,92,194,1|aaoafz,92,194,1|aaoag0,105,209,0|ak1brz,105,209,0|ak1bs0,92,194,1|atrbrz,92,194,1|atrbs0,105,209,0|b34d3z,105,209,0|b34d40,92,194,1|bchefz,92,194,1|bcheg0,105,209,0|bi8t3z,105,209,0|bi8t40,92,194,0|bluczz,92,194,0|blud00,92,194,1|bv7h3z,92,194,1|bv7h40,105,209,0|c4kifz,105,209,0|c4kig0,92,194,1|cdxjrz,92,194,1|cdxjs0,105,209,0|cnal3z,105,209,0|cnal40,92,194,1|cwnmfz,92,194,1|cwnmg0,105,209,0|d60nrz,105,209,0|d60ns0,92,194,1|dfdp3z,92,194,1|dfdp40,105,209,0|dp3p3z,105,209,0|dp3p40,92,194,1|dzwl3z,92,194,1|dzwl40,105,209,0|e7trrz,105,209,0|e7trs0,92,194,1|eimnrz,92,194,1|eimns0,105,209,0|eqjufz,105,209,0|eqjug0,92,194,1|f1cqfz,92,194,1|f1cqg0,105,209,0|f99x3z,105,209,0|f99x40,92,194,1|fkfrrz,92,194,1|fkfrs0,105,209,0|frzzrz,105,209,0|frzzs0,92,194,1|g35ufz,92,194,1|g35ug0,105,209,0|gaq2fz,105,209,0|gaq2g0,92,194,1|glvx3z,92,194,1|glvx40,105,209,0|gtt3rz,105,209,0|gtt3s0,92,194,1|h4lzrz,92,194,1|h4lzs0,105,209,0|hcj6fz,105,209,0|hcj6g0,92,194,1|hnc2fz,92,194,1|hnc2g0,105,209,0|hv993z,105,209,0|hv9940,92,194,1|i6f3rz,92,194,1|i6f3s0,92,194,0\",\"Asia/Phnom_Penh|,0,217,0|-1ayyla4,53,217,0|-pysda5,53,217,0|-pysda4,91,193,0\",\"Asia/Pontianak|,0,275,0|-w6piww,7,275,0|-jebg8x,7,275,0|-jebg8w,106,222,0|-eknm61,106,222,0|-eknm60,107,224,0|-co37o1,107,224,0|-co37o0,106,222,0|-bb5zi1,106,222,0|-bb5zi0,89,191,0|-a9m681,89,191,0|-a9m680,106,222,0|-34ru61,106,222,0|-34ru60,129,191,0|9e5gfz,129,191,0|9e5gg0,119,193,0\",\"Asia/Pyongyang|,0,276,0|-w895yc,130,242,0|-u9s4y1,130,242,0|-u9s4y0,116,224,0|-cpmro1,116,224,0|-cpmro0,130,224,0|nt2uzz,130,224,0|nt2v00,130,242,0|p87lnz,130,242,0|p87lo0,130,224,0\",\"Asia/Qatar|,0,215,0|-q3gmvk,105,209,0|19d0vz,105,209,0|19d0w0,100,6,0\",\"Asia/Qostanay|,0,277,0|-nu17s4,105,209,0|-kmr741,105,209,0|-kmr740,92,194,0|5vb0rz,92,194,0|5vb0s0,96,196,1|64ptzz,96,196,1|64pu00,96,196,0|6e2vbz,96,196,0|6e2vc0,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,92,194,1|bchefz,92,194,1|bcheg0,105,209,0|bi8t3z,105,209,0|bi8t40,92,194,0|bluczz,92,194,0|blud00,96,196,1|bv7ebz,96,196,1|bv7ec0,92,194,0|c4kfnz,92,194,0|c4kfo0,96,196,1|cdxgzz,96,196,1|cdxh00,92,194,0|cnaibz,92,194,0|cnaic0,96,196,1|cwnjnz,96,196,1|cwnjo0,92,194,0|d60kzz,92,194,0|d60l00,96,196,1|dfdmbz,96,196,1|dfdmc0,92,194,0|dp3mbz,92,194,0|dp3mc0,96,196,1|dzwibz,96,196,1|dzwic0,92,194,0|e7tozz,92,194,0|e7tp00,96,196,1|eimkzz,96,196,1|eiml00,92,194,0|eqjrnz,92,194,0|eqjro0,96,196,1|f1cnnz,96,196,1|f1cno0,92,194,0|f99ubz,92,194,0|f99uc0,96,196,1|fkfozz,96,196,1|fkfp00,92,194,0|frzwzz,92,194,0|frzx00,96,196,1|g35rnz,96,196,1|g35ro0,92,194,0|gapznz,92,194,0|gapzo0,96,196,1|glvubz,96,196,1|glvuc0,92,194,0|gtt0zz,92,194,0|gtt100,96,196,1|h4lwzz,96,196,1|h4lx00,92,194,0|hcj3nz,92,194,0|hcj3o0,96,196,1|hnbznz,96,196,1|hnbzo0,92,194,0|hv96bz,92,194,0|hv96c0,96,196,1|i6f0zz,96,196,1|i6f100,96,196,0\",\"Asia/Qyzylorda|,0,278,0|-nu184g,105,209,0|-kmr741,105,209,0|-kmr740,92,194,0|5vb0rz,92,194,0|5vb0s0,96,196,1|64ptzz,96,196,1|64pu00,96,196,0|6e2vbz,96,196,0|6e2vc0,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,92,194,1|bchefz,92,194,1|bcheg0,92,194,0|bi8qbz,92,194,0|bi8qc0,96,196,0|blua7z,96,196,0|blua80,96,196,1|bv7ebz,96,196,1|bv7ec0,92,194,0|c4kfnz,92,194,0|c4kfo0,96,196,1|cdxgzz,96,196,1|cdxh00,92,194,0|cnaibz,92,194,0|cnaic0,96,196,1|cwnjnz,96,196,1|cwnjo0,92,194,0|d60kzz,92,194,0|d60l00,96,196,1|dfdmbz,96,196,1|dfdmc0,92,194,0|dp3mbz,92,194,0|dp3mc0,96,196,1|dzwibz,96,196,1|dzwic0,92,194,0|e7tozz,92,194,0|e7tp00,96,196,1|eimkzz,96,196,1|eiml00,92,194,0|eqjrnz,92,194,0|eqjro0,96,196,1|f1cnnz,96,196,1|f1cno0,92,194,0|f99ubz,92,194,0|f99uc0,96,196,1|fkfozz,96,196,1|fkfp00,92,194,0|frzwzz,92,194,0|frzx00,96,196,1|g35rnz,96,196,1|g35ro0,92,194,0|gapznz,92,194,0|gapzo0,96,196,1|glvubz,96,196,1|glvuc0,92,194,0|gtt0zz,92,194,0|gtt100,96,196,1|h4lwzz,96,196,1|h4lx00,92,194,0|hcj3nz,92,194,0|hcj3o0,96,196,1|hnbznz,96,196,1|hnbzo0,92,194,0|hv96bz,92,194,0|hv96c0,96,196,1|i6f0zz,96,196,1|i6f100,96,196,0|pk1rbz,96,196,0|pk1rc0,92,194,0\",\"Asia/Riyadh|,0,203,0|-bwgbbg,100,6,0\",\"Asia/Sakhalin|,0,279,0|-xl87rc,107,224,0|-cpkx01,107,224,0|-cpkx00,90,192,0|5vak3z,90,192,0|5vak40,102,200,1|64pdbz,102,200,1|64pdc0,90,192,0|6e2hfz,90,192,0|6e2hg0,102,200,1|6nhanz,102,200,1|6nhao0,90,192,0|6wuerz,90,192,0|6wues0,102,200,1|7697zz,102,200,1|769800,90,192,0|7fo6rz,90,192,0|7fo6s0,102,200,1|7p1dnz,102,200,1|7p1do0,90,192,0|7yeezz,90,192,0|7yef00,102,200,1|87rgbz,102,200,1|87rgc0,90,192,0|8h4hnz,90,192,0|8h4ho0,102,200,1|8qhizz,102,200,1|8qhj00,90,192,0|8zukbz,90,192,0|8zukc0,102,200,1|997lnz,102,200,1|997lo0,90,192,0|9ikmzz,90,192,0|9ikn00,102,200,1|9rxobz,102,200,1|9rxoc0,90,192,0|a1apnz,90,192,0|a1apo0,102,200,1|aanqzz,102,200,1|aanr00,90,192,0|ak0sbz,90,192,0|ak0sc0,102,200,1|atqsbz,102,200,1|atqsc0,90,192,0|b33tnz,90,192,0|b33to0,90,192,1|bcgxrz,90,192,1|bcgxs0,93,195,0|bi8cfz,93,195,0|bi8cg0,90,192,0|bltwbz,90,192,0|bltwc0,102,200,1|bv6xnz,102,200,1|bv6xo0,90,192,0|c4jyzz,90,192,0|c4jz00,102,200,1|cdx0bz,102,200,1|cdx0c0,90,192,0|cna1nz,90,192,0|cna1o0,102,200,1|cwn2zz,102,200,1|cwn300,90,192,0|d604bz,90,192,0|d604c0,102,200,1|dfd5nz,102,200,1|dfd5o0,90,192,0|dp35nz,90,192,0|dp35o0,102,200,1|dzw1nz,102,200,1|dzw1o0,90,192,0|e7t8bz,90,192,0|e7t8c0,90,192,1|eim73z,90,192,1|eim740,93,195,0|eqjdrz,93,195,0|eqjds0,90,192,1|f1c9rz,90,192,1|f1c9s0,93,195,0|f99gfz,93,195,0|f99gg0,90,192,1|fkfb3z,90,192,1|fkfb40,93,195,0|frzj3z,93,195,0|frzj40,90,192,1|g35drz,90,192,1|g35ds0,93,195,0|gaplrz,93,195,0|gapls0,90,192,1|glvgfz,90,192,1|glvgg0,93,195,0|gtsn3z,93,195,0|gtsn40,90,192,1|h4lj3z,90,192,1|h4lj40,93,195,0|hciprz,93,195,0|hcips0,90,192,1|hnblrz,90,192,1|hnbls0,93,195,0|hv8sfz,93,195,0|hv8sg0,90,192,1|i6en3z,90,192,1|i6en40,93,195,0|idyv3z,93,195,0|idyv40,90,192,1|ip4prz,90,192,1|ip4ps0,93,195,0|iwoxrz,93,195,0|iwoxs0,90,192,1|j7usfz,90,192,1|j7usg0,93,195,0|jff0fz,93,195,0|jff0g0,90,192,1|jqkv3z,90,192,1|jqkv40,93,195,0|jyi1rz,93,195,0|jyi1s0,90,192,1|k9axrz,90,192,1|k9axs0,93,195,0|kh84fz,93,195,0|kh84g0,90,192,1|ks10fz,90,192,1|ks10g0,93,195,0|kzy73z,93,195,0|kzy740,90,192,1|lb41rz,90,192,1|lb41s0,93,195,0|lio9rz,93,195,0|lio9s0,90,192,0|ne09nz,90,192,0|ne09o0,93,195,0|o4nlrz,93,195,0|o4nls0,90,192,0\",\"Asia/Samarkand|,0,280,0|-nu18eh,105,209,0|-kmr741,105,209,0|-kmr740,92,194,0|5vb0rz,92,194,0|5vb0s0,96,196,1|64ptzz,96,196,1|64pu00,96,196,0|6e2vbz,96,196,0|6e2vc0,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,96,196,1|bchbnz,96,196,1|bchbo0,92,194,0\",\"Asia/Seoul|,0,281,0|-w8966g,130,242,0|-u9s4y1,130,242,0|-u9s4y0,116,224,0|-couzo1,116,224,0|-couzo0,130,224,0|-b9kp01,130,224,0|-b9kp00,131,195,1|-b486g1,131,195,1|-b486g0,130,224,0|-atu101,130,224,0|-atu100,131,195,1|-aljyg1,131,195,1|-aljyg0,130,224,0|-ab5t01,130,224,0|-ab5t00,131,195,1|-a2tvs1,131,195,1|-a2tvs0,130,224,0|-9ql2c1,130,224,0|-9ql2c0,131,195,1|-9k3t41,131,195,1|-9k3t40,130,224,0|-88kmc1,130,224,0|-88kmc0,130,242,0|-7nhbm1,130,242,0|-7nhbm0,131,248,1|-7gy7q1,131,248,1|-7gy7q0,130,242,0|-73vrm1,130,242,0|-73vrm0,131,248,1|-6x1jq1,131,248,1|-6x1jq0,130,242,0|-6lvma1,130,242,0|-6lvma0,131,248,1|-6eofq1,131,248,1|-6eofq0,130,242,0|-635jm1,130,242,0|-635jm0,131,248,1|-5vyd21,131,248,1|-5vyd20,130,242,0|-5kfgy1,130,242,0|-5kfgy0,131,248,1|-5d8ae1,131,248,1|-5d8ae0,130,242,0|-51pea1,130,242,0|-51pea0,131,248,1|-4ui7q1,131,248,1|-4ui7q0,130,242,0|-4dqfm1,130,242,0|-4dqfm0,130,224,0|920hvz,130,224,0|920hw0,131,195,1|99xojz,131,195,1|99xok0,130,224,0|9kqkjz,130,224,0|9kqkk0,131,195,1|9snr7z,131,195,1|9snr80,130,224,0\",\"Asia/Shanghai|,0,282,0|-100eztj,45,191,0|-qh00w1,45,191,0|-qh00w0,46,224,1|-q87fo1,46,224,1|-q87fo0,45,191,0|-ffvq81,45,191,0|-ffvq80,46,224,1|-f8zno1,46,224,1|-f8zno0,45,191,0|-f148w1,45,191,0|-f148w0,46,224,1|-ep6p01,46,224,1|-ep6p00,45,191,0|-ekjy81,45,191,0|-ekjy80,46,224,1|-cp63o1,46,224,1|-cp63o0,45,191,0|-cc1sw1,45,191,0|-cc1sw0,46,224,1|-c4wh01,46,224,1|-c4wh00,45,191,0|-butfk1,45,191,0|-butfk0,46,224,1|-bkj501,46,224,1|-bkj500,45,191,0|-bb60w1,45,191,0|-bb60w0,46,224,1|-b3aro1,46,224,1|-b3aro0,45,191,0|-ase3k1,45,191,0|-ase3k0,46,224,1|-ar06c1,46,224,1|-ar06c0,45,191,0|8ixjbz,45,191,0|8ixjc0,46,224,1|8prr7z,46,224,1|8prr80,45,191,0|90kpzz,45,191,0|90kq00,46,224,1|98htvz,46,224,1|98htw0,45,191,0|9jnrbz,45,191,0|9jnrc0,46,224,1|9r7wjz,46,224,1|9r7wk0,45,191,0|a2dtzz,45,191,0|a2du00,46,224,1|aaaxvz,46,224,1|aaaxw0,45,191,0|al3wnz,45,191,0|al3wo0,46,224,1|at10jz,46,224,1|at10k0,45,191,0|b3tzbz,45,191,0|b3tzc0,46,224,1|bbr37z,46,224,1|bbr380,45,191,0\",\"Asia/Singapore|,0,262,0|-100ewkd,85,262,0|-xphpwe,85,262,0|-xphpwd,91,193,0|-jb6gs1,91,193,0|-jb6gs0,118,246,1|-hquppd,118,246,1|-hquppc,118,246,0|-esddpd,118,246,0|-esddpc,106,222,0|-ejqa61,106,222,0|-ejqa60,107,224,0|-conl01,107,224,0|-conl00,106,222,0|69g35z,106,222,0|69g360,89,191,0\",\"Asia/Srednekolymsk|,0,283,0|-nu1ogs,93,195,0|-kmrns1,93,195,0|-kmrns0,90,192,0|5vak3z,90,192,0|5vak40,102,200,1|64pdbz,102,200,1|64pdc0,90,192,0|6e2hfz,90,192,0|6e2hg0,102,200,1|6nhanz,102,200,1|6nhao0,90,192,0|6wuerz,90,192,0|6wues0,102,200,1|7697zz,102,200,1|769800,90,192,0|7fo6rz,90,192,0|7fo6s0,102,200,1|7p1dnz,102,200,1|7p1do0,90,192,0|7yeezz,90,192,0|7yef00,102,200,1|87rgbz,102,200,1|87rgc0,90,192,0|8h4hnz,90,192,0|8h4ho0,102,200,1|8qhizz,102,200,1|8qhj00,90,192,0|8zukbz,90,192,0|8zukc0,102,200,1|997lnz,102,200,1|997lo0,90,192,0|9ikmzz,90,192,0|9ikn00,102,200,1|9rxobz,102,200,1|9rxoc0,90,192,0|a1apnz,90,192,0|a1apo0,102,200,1|aanqzz,102,200,1|aanr00,90,192,0|ak0sbz,90,192,0|ak0sc0,102,200,1|atqsbz,102,200,1|atqsc0,90,192,0|b33tnz,90,192,0|b33to0,90,192,1|bcgxrz,90,192,1|bcgxs0,93,195,0|bi8cfz,93,195,0|bi8cg0,90,192,0|bltwbz,90,192,0|bltwc0,102,200,1|bv6xnz,102,200,1|bv6xo0,90,192,0|c4jyzz,90,192,0|c4jz00,102,200,1|cdx0bz,102,200,1|cdx0c0,90,192,0|cna1nz,90,192,0|cna1o0,102,200,1|cwn2zz,102,200,1|cwn300,90,192,0|d604bz,90,192,0|d604c0,102,200,1|dfd5nz,102,200,1|dfd5o0,90,192,0|dp35nz,90,192,0|dp35o0,102,200,1|dzw1nz,102,200,1|dzw1o0,90,192,0|e7t8bz,90,192,0|e7t8c0,102,200,1|eim4bz,102,200,1|eim4c0,90,192,0|eqjazz,90,192,0|eqjb00,102,200,1|f1c6zz,102,200,1|f1c700,90,192,0|f99dnz,90,192,0|f99do0,102,200,1|fkf8bz,102,200,1|fkf8c0,90,192,0|frzgbz,90,192,0|frzgc0,102,200,1|g35azz,102,200,1|g35b00,90,192,0|gapizz,90,192,0|gapj00,102,200,1|glvdnz,102,200,1|glvdo0,90,192,0|gtskbz,90,192,0|gtskc0,102,200,1|h4lgbz,102,200,1|h4lgc0,90,192,0|hcimzz,90,192,0|hcin00,102,200,1|hnbizz,102,200,1|hnbj00,90,192,0|hv8pnz,90,192,0|hv8po0,102,200,1|i6ekbz,102,200,1|i6ekc0,90,192,0|idysbz,90,192,0|idysc0,102,200,1|ip4mzz,102,200,1|ip4n00,90,192,0|iwouzz,90,192,0|iwov00,102,200,1|j7upnz,102,200,1|j7upo0,90,192,0|jfexnz,90,192,0|jfexo0,102,200,1|jqksbz,102,200,1|jqksc0,90,192,0|jyhyzz,90,192,0|jyhz00,102,200,1|k9auzz,102,200,1|k9av00,90,192,0|kh81nz,90,192,0|kh81o0,102,200,1|ks0xnz,102,200,1|ks0xo0,90,192,0|kzy4bz,90,192,0|kzy4c0,102,200,1|lb3yzz,102,200,1|lb3z00,90,192,0|lio6zz,90,192,0|lio700,102,200,0|ne06vz,102,200,0|ne06w0,90,192,0\",\"Asia/Taipei|,0,284,0|-12mch60,45,191,0|-gtzfk1,45,191,0|-gtzfk0,116,224,0|-co6u81,116,224,0|-co6u80,45,191,0|-cc1sw1,45,191,0|-cc1sw0,46,224,1|-c4wh01,46,224,1|-c4wh00,45,191,0|-butfk1,45,191,0|-butfk0,46,224,1|-bkj501,46,224,1|-bkj500,45,191,0|-bb60w1,45,191,0|-bb60w0,46,224,1|-b3aro1,46,224,1|-b3aro0,45,191,0|-ase3k1,45,191,0|-ase3k0,46,224,1|-akiuc1,46,224,1|-akiuc0,45,191,0|-a9m681,45,191,0|-a9m680,46,224,1|-a1qx01,46,224,1|-a1qx00,45,191,0|-9qu8w1,45,191,0|-9qu8w0,46,224,1|-9iyzo1,46,224,1|-9iyzo0,45,191,0|-9b5fk1,45,191,0|-9b5fk0,46,224,1|-8yjt01,46,224,1|-8yjt00,45,191,0|-8qs3k1,45,191,0|-8qs3k0,46,224,1|-8frvo1,46,224,1|-8frvo0,45,191,0|-880681,45,191,0|-880680,46,224,1|-7wzyc1,46,224,1|-7wzyc0,45,191,0|-7p88w1,45,191,0|-7p88w0,46,224,1|-7ftfo1,46,224,1|-7ftfo0,45,191,0|-76egw1,45,191,0|-76egw0,46,224,1|-6wzno1,46,224,1|-6wzno0,45,191,0|-6nmjk1,45,191,0|-6nmjk0,46,224,1|-6e7qc1,46,224,1|-6e7qc0,45,191,0|-64um81,45,191,0|-64um80,46,224,1|-5vft01,46,224,1|-5vft00,45,191,0|-5m2ow1,45,191,0|-5m2ow0,46,224,1|-5cnvo1,46,224,1|-5cnvo0,45,191,0|-503y81,45,191,0|-503y80,46,224,1|-4tu3o1,46,224,1|-4tu3o0,45,191,0|-4hc0w1,45,191,0|-4hc0w0,46,224,1|-4b26c1,46,224,1|-4b26c0,45,191,0|27rlrz,45,191,0|27rls0,46,224,1|2h6ezz,46,224,1|2h6f00,45,191,0|2qjj3z,45,191,0|2qjj40,46,224,1|2zycbz,46,224,1|2zycc0,45,191,0|4ydlrz,45,191,0|4ydls0,46,224,1|533wbz,46,224,1|533wc0,45,191,0\",\"Asia/Tashkent|,0,285,0|-nu18tz,92,194,0|-kmr9w1,92,194,0|-kmr9w0,96,196,0|5vaxzz,96,196,0|5vay00,91,193,1|64pr7z,91,193,1|64pr80,96,196,0|6e2vbz,96,196,0|6e2vc0,91,193,1|6nhojz,91,193,1|6nhok0,96,196,0|6wusnz,96,196,0|6wuso0,91,193,1|769lvz,91,193,1|769lw0,96,196,0|7foknz,96,196,0|7foko0,91,193,1|7p1rjz,91,193,1|7p1rk0,96,196,0|7yesvz,96,196,0|7yesw0,91,193,1|87ru7z,91,193,1|87ru80,96,196,0|8h4vjz,96,196,0|8h4vk0,91,193,1|8qhwvz,91,193,1|8qhww0,96,196,0|8zuy7z,96,196,0|8zuy80,91,193,1|997zjz,91,193,1|997zk0,96,196,0|9il0vz,96,196,0|9il0w0,91,193,1|9ry27z,91,193,1|9ry280,96,196,0|a1b3jz,96,196,0|a1b3k0,91,193,1|aao4vz,91,193,1|aao4w0,96,196,0|ak167z,96,196,0|ak1680,91,193,1|atr67z,91,193,1|atr680,96,196,0|b347jz,96,196,0|b347k0,96,196,1|bchbnz,96,196,1|bchbo0,92,194,0\",\"Asia/Tbilisi|,0,286,0|-1ayyayn,132,286,0|-nu14ao,132,286,0|-nu14an,100,6,0|-6p7kc1,100,6,0|-6p7kc0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,92,194,1|9ry7rz,92,194,1|9ry7s0,105,209,0|a1b93z,105,209,0|a1b940,92,194,1|aaoafz,92,194,1|aaoag0,105,209,0|ak1brz,105,209,0|ak1bs0,92,194,1|atrbrz,92,194,1|atrbs0,105,209,0|b34d3z,105,209,0|b34d40,105,209,1|bchh7z,105,209,1|bchh80,100,6,0|bluczz,100,6,0|blud00,105,209,1|bv7bjz,105,209,1|bv7bk0,100,6,0|c4kfnz,100,6,0|c4kfo0,105,209,1|cdxe7z,105,209,1|cdxe80,100,6,0|cnaibz,100,6,0|cnaic0,105,209,1|cwngvz,105,209,1|cwngw0,105,209,0|d60i7z,105,209,0|d60i80,92,194,1|dfdgrz,92,194,1|dfdgs0,105,209,0|dp3jjz,105,209,0|dp3jk0,92,194,1|eimffz,92,194,1|eimfg0,105,209,0|eqjovz,105,209,0|eqjow0,92,194,1|f1ci3z,92,194,1|f1ci40,105,209,0|f99rjz,105,209,0|f99rk0,92,194,1|fkfjfz,92,194,1|fkfjg0,105,209,0|frzu7z,105,209,0|frzu80,92,194,1|g35m3z,92,194,1|g35m40,105,209,0|gapwvz,105,209,0|gapww0,92,194,1|glvorz,92,194,1|glvos0,105,209,0|gtsy7z,105,209,0|gtsy80,92,194,1|h4lrfz,92,194,1|h4lrg0,105,209,0|hcj0vz,105,209,0|hcj0w0,92,194,1|hnbu3z,92,194,1|hnbu40,105,209,0|hv93jz,105,209,0|hv93k0,92,194,1|hzxjfz,92,194,1|hzxjg0,105,209,1|i6f6jz,105,209,1|i6f6k0,100,6,0|idzejz,100,6,0|idzek0,105,209,0\",\"Asia/Tehran|,0,287,0|-s6m6uw,133,287,0|-cixlix,133,287,0|-cixliw,134,288,0|435vlz,134,288,0|435vm0,105,209,0|4ad3jz,105,209,0|4ad3k0,92,194,1|4ldbfz,92,194,1|4ldbg0,105,209,0|4p2q7z,105,209,0|4p2q80,134,288,0|4t529z,134,288,0|4t52a0,124,252,1|52i0tz,124,252,1|52i0u0,134,288,0|5byu9z,134,288,0|5byua0,124,252,1|5lj7hz,124,252,1|5lj7i0,134,288,0|b4tcxz,134,288,0|b4tcy0,124,252,1|bc48tz,124,252,1|bc48u0,134,288,0|blhcxz,134,288,0|blhcy0,124,252,1|buy0tz,124,252,1|buy0u0,134,288,0|c49a9z,134,288,0|c49aa0,124,252,1|cdpy5z,124,252,1|cdpy60,134,288,0|cn17lz,134,288,0|cn17m0,124,252,1|cwhvhz,124,252,1|cwhvi0,134,288,0|d5t4xz,134,288,0|d5t4y0,124,252,1|df9stz,124,252,1|df9su0,134,288,0|dol29z,134,288,0|dol2a0,124,252,1|dy1q5z,124,252,1|dy1q60,134,288,0|e7eu9z,134,288,0|e7eua0,124,252,1|egvi5z,124,252,1|egvi60,134,288,0|eq6rlz,134,288,0|eq6rm0,124,252,1|eznfhz,124,252,1|eznfi0,134,288,0|f8yoxz,134,288,0|f8yoy0,124,252,1|fifctz,124,252,1|fifcu0,134,288,0|frqm9z,134,288,0|frqma0,124,252,1|g17a5z,124,252,1|g17a60,134,288,0|gake9z,134,288,0|gakea0,124,252,1|gk125z,124,252,1|gk1260,134,288,0|gtcblz,134,288,0|gtcbm0,124,252,1|h2szhz,124,252,1|h2szi0,134,288,0|hc48xz,134,288,0|hc48y0,124,252,1|hlkwtz,124,252,1|hlkwu0,134,288,0|huw69z,134,288,0|huw6a0,124,252,1|i4cu5z,124,252,1|i4cu60,134,288,0|idpy9z,134,288,0|idpya0,124,252,1|in6m5z,124,252,1|in6m60,134,288,0|jy1q9z,134,288,0|jy1qa0,124,252,1|k7ie5z,124,252,1|k7ie60,134,288,0|kgvi9z,134,288,0|kgvia0,124,252,1|kqc65z,124,252,1|kqc660,134,288,0|kznflz,134,288,0|kznfm0,124,252,1|l943hz,124,252,1|l943i0,134,288,0|lifcxz,134,288,0|lifcy0,124,252,1|lrw0tz,124,252,1|lrw0u0,134,288,0|m17a9z,134,288,0|m17aa0,124,252,1|many5z,124,252,1|many60,134,288,0|mk129z,134,288,0|mk12a0,124,252,1|mthq5z,124,252,1|mthq60,134,288,0|n2szlz,134,288,0|n2szm0,124,252,1|nc9nhz,124,252,1|nc9ni0,134,288,0|nlkwxz,134,288,0|nlkwy0,124,252,1|nv1ktz,124,252,1|nv1ku0,134,288,0|o4cu9z,134,288,0|o4cua0,124,252,1|odti5z,124,252,1|odti60,134,288,0|on6m9z,134,288,0|on6ma0,124,252,1|owna5z,124,252,1|owna60,134,288,0|p5yjlz,134,288,0|p5yjm0,124,252,1|pff7hz,124,252,1|pff7i0,134,288,0|poqgxz,134,288,0|poqgy0,124,252,1|py74tz,124,252,1|py74u0,134,288,0|q7ie9z,134,288,0|q7iea0,124,252,1|qgz25z,124,252,1|qgz260,134,288,0|qqc69z,134,288,0|qqc6a0,124,252,1|qzsu5z,124,252,1|qzsu60,134,288,0|r943lz,134,288,0|r943m0,124,252,1|rikrhz,124,252,1|rikri0,134,288,0|rrw0xz,134,288,0|rrw0y0,124,252,1|s1cotz,124,252,1|s1cou0,134,288,0|sany9z,134,288,0|sanya0,124,252,1|sk4m5z,124,252,1|sk4m60,134,288,0|sthq9z,134,288,0|sthqa0,124,252,1|t2ye5z,124,252,1|t2ye60,134,288,0|tc9nlz,134,288,0|tc9nm0,124,252,1|tlqbhz,124,252,1|tlqbi0,134,288,0|tv1kxz,134,288,0|tv1ky0,124,252,1|u4i8tz,124,252,1|u4i8u0,134,288,0|udti9z,134,288,0|udtia0,124,252,1|una65z,124,252,1|una660,134,288,0|uwlflz,134,288,0|uwlfm0,124,252,1|v623hz,124,252,1|v623i0,134,288,0|vff7lz,134,288,0|vff7m0,124,252,1|vovvhz,124,252,1|vovvi0,134,288,0|vy74xz,134,288,0|vy74y0,124,252,1|w7nstz,124,252,1|w7nsu0,134,288,0|wgz29z,134,288,0|wgz2a0,124,252,1|wqfq5z,124,252,1|wqfq60,134,288,0|wzqzlz,134,288,0|wzqzm0,124,252,1|x97nhz,124,252,1|x97ni0,134,288,0|xikrlz,134,288,0|xikrm0,124,252,1|xs1fhz,124,252,1|xs1fi0,134,288,0|y1coxz,134,288,0|y1coy0,124,252,1|yatctz,124,252,1|yatcu0,134,288,0|yk4m9z,134,288,0|yk4ma0,124,252,1|ytla5z,124,252,1|ytla60,134,288,0|z2wjlz,134,288,0|z2wjm0,124,252,1|zcd7hz,124,252,1|zcd7i0,134,288,0\",\"Asia/Thimphu|,0,289,0|-bojclo,108,228,0|99fa1z,108,228,0|99fa20,96,196,0\",\"Asia/Tokyo|,0,290,0|-16snno0,116,224,0|-bb4901,116,224,0|-bb4900,135,195,1|-b49yc1,135,195,1|-b49yc0,116,224,0|-atu101,116,224,0|-atu100,135,195,1|-aljvo1,135,195,1|-aljvo0,116,224,0|-a9b501,116,224,0|-a9b500,135,195,1|-a2tt01,135,195,1|-a2tt00,116,224,0|-9ql2c1,116,224,0|-9ql2c0,135,195,1|-9k3qc1,135,195,1|-9k3qc0,116,224,0\",\"Asia/Tomsk|,0,291,0|-q3zbqf,96,196,0|-kmrco1,96,196,0|-kmrco0,91,193,0|5vav7z,91,193,0|5vav80,89,191,1|64pofz,89,191,1|64pog0,91,193,0|6e2sjz,91,193,0|6e2sk0,89,191,1|6nhlrz,89,191,1|6nhls0,91,193,0|6wupvz,91,193,0|6wupw0,89,191,1|769j3z,89,191,1|769j40,91,193,0|7fohvz,91,193,0|7fohw0,89,191,1|7p1orz,89,191,1|7p1os0,91,193,0|7yeq3z,91,193,0|7yeq40,89,191,1|87rrfz,89,191,1|87rrg0,91,193,0|8h4srz,91,193,0|8h4ss0,89,191,1|8qhu3z,89,191,1|8qhu40,91,193,0|8zuvfz,91,193,0|8zuvg0,89,191,1|997wrz,89,191,1|997ws0,91,193,0|9iky3z,91,193,0|9iky40,89,191,1|9rxzfz,89,191,1|9rxzg0,91,193,0|a1b0rz,91,193,0|a1b0s0,89,191,1|aao23z,89,191,1|aao240,91,193,0|ak13fz,91,193,0|ak13g0,89,191,1|atr3fz,89,191,1|atr3g0,91,193,0|b344rz,91,193,0|b344s0,91,193,1|bch8vz,91,193,1|bch8w0,96,196,0|bi8njz,96,196,0|bi8nk0,91,193,0|blu7fz,91,193,0|blu7g0,89,191,1|bv78rz,89,191,1|bv78s0,91,193,0|c4ka3z,91,193,0|c4ka40,89,191,1|cdxbfz,89,191,1|cdxbg0,91,193,0|cnacrz,91,193,0|cnacs0,89,191,1|cwne3z,89,191,1|cwne40,91,193,0|d60ffz,91,193,0|d60fg0,89,191,1|dfdgrz,89,191,1|dfdgs0,91,193,0|dp3grz,91,193,0|dp3gs0,89,191,1|dzwcrz,89,191,1|dzwcs0,91,193,0|e7tjfz,91,193,0|e7tjg0,89,191,1|eimffz,89,191,1|eimfg0,91,193,0|eqjm3z,91,193,0|eqjm40,89,191,1|f1ci3z,89,191,1|f1ci40,91,193,0|f99orz,91,193,0|f99os0,89,191,1|fkfjfz,89,191,1|fkfjg0,91,193,0|frzrfz,91,193,0|frzrg0,89,191,1|g35m3z,89,191,1|g35m40,91,193,0|gapu3z,91,193,0|gapu40,89,191,1|glvorz,89,191,1|glvos0,91,193,0|gtsvfz,91,193,0|gtsvg0,89,191,1|gvea3z,89,191,1|gvea40,91,193,1|h4lu7z,91,193,1|h4lu80,96,196,0|hcj0vz,96,196,0|hcj0w0,91,193,1|hnbwvz,91,193,1|hnbww0,96,196,0|hv93jz,96,196,0|hv93k0,91,193,1|i6ey7z,91,193,1|i6ey80,96,196,0|idz67z,96,196,0|idz680,91,193,1|ip50vz,91,193,1|ip50w0,96,196,0|iwp8vz,96,196,0|iwp8w0,91,193,1|j7v3jz,91,193,1|j7v3k0,96,196,0|jffbjz,96,196,0|jffbk0,91,193,1|jql67z,91,193,1|jql680,96,196,0|jyicvz,96,196,0|jyicw0,91,193,1|k9b8vz,91,193,1|k9b8w0,96,196,0|kh8fjz,96,196,0|kh8fk0,91,193,1|ks1bjz,91,193,1|ks1bk0,96,196,0|kzyi7z,96,196,0|kzyi80,91,193,1|lb4cvz,91,193,1|lb4cw0,96,196,0|liokvz,96,196,0|liokw0,91,193,0|ne0krz,91,193,0|ne0ks0,96,196,0|o7wkvz,96,196,0|o7wkw0,91,193,0\",\"Asia/Ulaanbaatar|,0,292,0|-xmcrsk,91,193,0|46akjz,91,193,0|46akk0,89,191,0|6wun3z,89,191,0|6wun40,107,224,1|769gbz,107,224,1|769gc0,89,191,0|7fof3z,89,191,0|7fof40,107,224,1|7p1dnz,107,224,1|7p1do0,89,191,0|7yehrz,89,191,0|7yehs0,107,224,1|87rgbz,107,224,1|87rgc0,89,191,0|8h4kfz,89,191,0|8h4kg0,107,224,1|8qhizz,107,224,1|8qhj00,89,191,0|8zun3z,89,191,0|8zun40,107,224,1|997lnz,107,224,1|997lo0,89,191,0|9ikprz,89,191,0|9ikps0,107,224,1|9rxobz,107,224,1|9rxoc0,89,191,0|a1asfz,89,191,0|a1asg0,107,224,1|aanqzz,107,224,1|aanr00,89,191,0|ak0v3z,89,191,0|ak0v40,107,224,1|atqsbz,107,224,1|atqsc0,89,191,0|b33wfz,89,191,0|b33wg0,107,224,1|bcguzz,107,224,1|bcgv00,89,191,0|bltz3z,89,191,0|bltz40,107,224,1|bv6xnz,107,224,1|bv6xo0,89,191,0|c4k1rz,89,191,0|c4k1s0,107,224,1|cdx0bz,107,224,1|cdx0c0,89,191,0|cna4fz,89,191,0|cna4g0,107,224,1|cwn2zz,107,224,1|cwn300,89,191,0|d6073z,89,191,0|d60740,107,224,1|dfd5nz,107,224,1|dfd5o0,89,191,0|dp38fz,89,191,0|dp38g0,107,224,1|dyg6zz,107,224,1|dyg700,89,191,0|e7tb3z,89,191,0|e7tb40,107,224,1|eh69nz,107,224,1|eh69o0,89,191,0|eqjdrz,89,191,0|eqjds0,107,224,1|ezwcbz,107,224,1|ezwcc0,89,191,0|gcgpzz,89,191,0|gcgq00,107,224,1|gkdtvz,107,224,1|gkdtw0,89,191,0|gtqxzz,89,191,0|gtqy00,107,224,1|h33wjz,107,224,1|h33wk0,89,191,0|hch0nz,89,191,0|hch0o0,107,224,1|hltz7z,107,224,1|hltz80,89,191,0|hv73bz,89,191,0|hv73c0,107,224,1|i4k1vz,107,224,1|i4k1w0,89,191,0|idx5zz,89,191,0|idx600,107,224,1|ina4jz,107,224,1|ina4k0,89,191,0|iwn8nz,89,191,0|iwn8o0,107,224,1|j6d5vz,107,224,1|j6d5w0,89,191,0|nlvtzz,89,191,0|nlvu00,107,224,1|nv8mzz,107,224,1|nv8n00,89,191,0|o4lwnz,89,191,0|o4lwo0,107,224,1|odypnz,107,224,1|odypo0,89,191,0\",\"Asia/Urumqi|,0,293,0|-lx5pjw,96,196,0\",\"Asia/Ust-Nera|,0,294,0|-q4cl6u,89,191,0|-kmri81,89,191,0|-kmri80,107,224,0|5vapnz,107,224,0|5vapo0,102,200,1|64pdbz,102,200,1|64pdc0,90,192,0|6e2hfz,90,192,0|6e2hg0,102,200,1|6nhanz,102,200,1|6nhao0,90,192,0|6wuerz,90,192,0|6wues0,102,200,1|7697zz,102,200,1|769800,90,192,0|7fo6rz,90,192,0|7fo6s0,102,200,1|7p1dnz,102,200,1|7p1do0,90,192,0|7yeezz,90,192,0|7yef00,102,200,1|87rgbz,102,200,1|87rgc0,90,192,0|8h4hnz,90,192,0|8h4ho0,102,200,1|8qhizz,102,200,1|8qhj00,90,192,0|8zukbz,90,192,0|8zukc0,102,200,1|997lnz,102,200,1|997lo0,90,192,0|9ikmzz,90,192,0|9ikn00,102,200,1|9rxobz,102,200,1|9rxoc0,90,192,0|a1apnz,90,192,0|a1apo0,102,200,1|aanqzz,102,200,1|aanr00,90,192,0|ak0sbz,90,192,0|ak0sc0,102,200,1|atqsbz,102,200,1|atqsc0,90,192,0|b33tnz,90,192,0|b33to0,90,192,1|bcgxrz,90,192,1|bcgxs0,93,195,0|bi8cfz,93,195,0|bi8cg0,90,192,0|bltwbz,90,192,0|bltwc0,102,200,1|bv6xnz,102,200,1|bv6xo0,90,192,0|c4jyzz,90,192,0|c4jz00,102,200,1|cdx0bz,102,200,1|cdx0c0,90,192,0|cna1nz,90,192,0|cna1o0,102,200,1|cwn2zz,102,200,1|cwn300,90,192,0|d604bz,90,192,0|d604c0,102,200,1|dfd5nz,102,200,1|dfd5o0,90,192,0|dp35nz,90,192,0|dp35o0,102,200,1|dzw1nz,102,200,1|dzw1o0,90,192,0|e7t8bz,90,192,0|e7t8c0,102,200,1|eim4bz,102,200,1|eim4c0,90,192,0|eqjazz,90,192,0|eqjb00,102,200,1|f1c6zz,102,200,1|f1c700,90,192,0|f99dnz,90,192,0|f99do0,102,200,1|fkf8bz,102,200,1|fkf8c0,90,192,0|frzgbz,90,192,0|frzgc0,102,200,1|g35azz,102,200,1|g35b00,90,192,0|gapizz,90,192,0|gapj00,102,200,1|glvdnz,102,200,1|glvdo0,90,192,0|gtskbz,90,192,0|gtskc0,102,200,1|h4lgbz,102,200,1|h4lgc0,90,192,0|hcimzz,90,192,0|hcin00,102,200,1|hnbizz,102,200,1|hnbj00,90,192,0|hv8pnz,90,192,0|hv8po0,102,200,1|i6ekbz,102,200,1|i6ekc0,90,192,0|idysbz,90,192,0|idysc0,102,200,1|ip4mzz,102,200,1|ip4n00,90,192,0|iwouzz,90,192,0|iwov00,102,200,1|j7upnz,102,200,1|j7upo0,90,192,0|jfexnz,90,192,0|jfexo0,102,200,1|jqksbz,102,200,1|jqksc0,90,192,0|jyhyzz,90,192,0|jyhz00,102,200,1|k9auzz,102,200,1|k9av00,90,192,0|kh81nz,90,192,0|kh81o0,102,200,1|ks0xnz,102,200,1|ks0xo0,90,192,0|kzy4bz,90,192,0|kzy4c0,102,200,1|lb3yzz,102,200,1|lb3z00,90,192,0|lio6zz,90,192,0|lio700,102,200,0|lrerzz,102,200,0|lres00,90,192,0|ne09nz,90,192,0|ne09o0,93,195,0\",\"Asia/Vientiane|,0,217,0|-1ayyla4,53,217,0|-pysda5,53,217,0|-pysda4,91,193,0\",\"Asia/Vladivostok|,0,295,0|-oligf7,107,224,0|-kmrl01,107,224,0|-kmrl00,93,195,0|5vamvz,93,195,0|5vamw0,90,192,1|64pg3z,90,192,1|64pg40,93,195,0|6e2k7z,93,195,0|6e2k80,90,192,1|6nhdfz,90,192,1|6nhdg0,93,195,0|6wuhjz,93,195,0|6wuhk0,90,192,1|769arz,90,192,1|769as0,93,195,0|7fo9jz,93,195,0|7fo9k0,90,192,1|7p1gfz,90,192,1|7p1gg0,93,195,0|7yehrz,93,195,0|7yehs0,90,192,1|87rj3z,90,192,1|87rj40,93,195,0|8h4kfz,93,195,0|8h4kg0,90,192,1|8qhlrz,90,192,1|8qhls0,93,195,0|8zun3z,93,195,0|8zun40,90,192,1|997ofz,90,192,1|997og0,93,195,0|9ikprz,93,195,0|9ikps0,90,192,1|9rxr3z,90,192,1|9rxr40,93,195,0|a1asfz,93,195,0|a1asg0,90,192,1|aantrz,90,192,1|aants0,93,195,0|ak0v3z,93,195,0|ak0v40,90,192,1|atqv3z,90,192,1|atqv40,93,195,0|b33wfz,93,195,0|b33wg0,93,195,1|bch0jz,93,195,1|bch0k0,107,224,0|bi8f7z,107,224,0|bi8f80,93,195,0|bltz3z,93,195,0|bltz40,90,192,1|bv70fz,90,192,1|bv70g0,93,195,0|c4k1rz,93,195,0|c4k1s0,90,192,1|cdx33z,90,192,1|cdx340,93,195,0|cna4fz,93,195,0|cna4g0,90,192,1|cwn5rz,90,192,1|cwn5s0,93,195,0|d6073z,93,195,0|d60740,90,192,1|dfd8fz,90,192,1|dfd8g0,93,195,0|dp38fz,93,195,0|dp38g0,90,192,1|dzw4fz,90,192,1|dzw4g0,93,195,0|e7tb3z,93,195,0|e7tb40,90,192,1|eim73z,90,192,1|eim740,93,195,0|eqjdrz,93,195,0|eqjds0,90,192,1|f1c9rz,90,192,1|f1c9s0,93,195,0|f99gfz,93,195,0|f99gg0,90,192,1|fkfb3z,90,192,1|fkfb40,93,195,0|frzj3z,93,195,0|frzj40,90,192,1|g35drz,90,192,1|g35ds0,93,195,0|gaplrz,93,195,0|gapls0,90,192,1|glvgfz,90,192,1|glvgg0,93,195,0|gtsn3z,93,195,0|gtsn40,90,192,1|h4lj3z,90,192,1|h4lj40,93,195,0|hciprz,93,195,0|hcips0,90,192,1|hnblrz,90,192,1|hnbls0,93,195,0|hv8sfz,93,195,0|hv8sg0,90,192,1|i6en3z,90,192,1|i6en40,93,195,0|idyv3z,93,195,0|idyv40,90,192,1|ip4prz,90,192,1|ip4ps0,93,195,0|iwoxrz,93,195,0|iwoxs0,90,192,1|j7usfz,90,192,1|j7usg0,93,195,0|jff0fz,93,195,0|jff0g0,90,192,1|jqkv3z,90,192,1|jqkv40,93,195,0|jyi1rz,93,195,0|jyi1s0,90,192,1|k9axrz,90,192,1|k9axs0,93,195,0|kh84fz,93,195,0|kh84g0,90,192,1|ks10fz,90,192,1|ks10g0,93,195,0|kzy73z,93,195,0|kzy740,90,192,1|lb41rz,90,192,1|lb41s0,93,195,0|lio9rz,93,195,0|lio9s0,90,192,0|ne09nz,90,192,0|ne09o0,93,195,0\",\"Asia/Yakutsk|,0,296,0|-q4cioy,89,191,0|-kmri81,89,191,0|-kmri80,107,224,0|5vapnz,107,224,0|5vapo0,93,195,1|64pivz,93,195,1|64piw0,107,224,0|6e2mzz,107,224,0|6e2n00,93,195,1|6nhg7z,93,195,1|6nhg80,107,224,0|6wukbz,107,224,0|6wukc0,93,195,1|769djz,93,195,1|769dk0,107,224,0|7focbz,107,224,0|7focc0,93,195,1|7p1j7z,93,195,1|7p1j80,107,224,0|7yekjz,107,224,0|7yekk0,93,195,1|87rlvz,93,195,1|87rlw0,107,224,0|8h4n7z,107,224,0|8h4n80,93,195,1|8qhojz,93,195,1|8qhok0,107,224,0|8zupvz,107,224,0|8zupw0,93,195,1|997r7z,93,195,1|997r80,107,224,0|9iksjz,107,224,0|9iksk0,93,195,1|9rxtvz,93,195,1|9rxtw0,107,224,0|a1av7z,107,224,0|a1av80,93,195,1|aanwjz,93,195,1|aanwk0,107,224,0|ak0xvz,107,224,0|ak0xw0,93,195,1|atqxvz,93,195,1|atqxw0,107,224,0|b33z7z,107,224,0|b33z80,107,224,1|bch3bz,107,224,1|bch3c0,89,191,0|bi8hzz,89,191,0|bi8i00,107,224,0|blu1vz,107,224,0|blu1w0,93,195,1|bv737z,93,195,1|bv7380,107,224,0|c4k4jz,107,224,0|c4k4k0,93,195,1|cdx5vz,93,195,1|cdx5w0,107,224,0|cna77z,107,224,0|cna780,93,195,1|cwn8jz,93,195,1|cwn8k0,107,224,0|d609vz,107,224,0|d609w0,93,195,1|dfdb7z,93,195,1|dfdb80,107,224,0|dp3b7z,107,224,0|dp3b80,93,195,1|dzw77z,93,195,1|dzw780,107,224,0|e7tdvz,107,224,0|e7tdw0,93,195,1|eim9vz,93,195,1|eim9w0,107,224,0|eqjgjz,107,224,0|eqjgk0,93,195,1|f1ccjz,93,195,1|f1cck0,107,224,0|f99j7z,107,224,0|f99j80,93,195,1|fkfdvz,93,195,1|fkfdw0,107,224,0|frzlvz,107,224,0|frzlw0,93,195,1|g35gjz,93,195,1|g35gk0,107,224,0|gapojz,107,224,0|gapok0,93,195,1|glvj7z,93,195,1|glvj80,107,224,0|gtspvz,107,224,0|gtspw0,93,195,1|h4llvz,93,195,1|h4llw0,107,224,0|hcisjz,107,224,0|hcisk0,93,195,1|hnbojz,93,195,1|hnbok0,107,224,0|hv8v7z,107,224,0|hv8v80,93,195,1|i6epvz,93,195,1|i6epw0,107,224,0|idyxvz,107,224,0|idyxw0,93,195,1|ip4sjz,93,195,1|ip4sk0,107,224,0|iwp0jz,107,224,0|iwp0k0,93,195,1|j7uv7z,93,195,1|j7uv80,107,224,0|jff37z,107,224,0|jff380,93,195,1|jqkxvz,93,195,1|jqkxw0,107,224,0|jyi4jz,107,224,0|jyi4k0,93,195,1|k9b0jz,93,195,1|k9b0k0,107,224,0|kh877z,107,224,0|kh8780,93,195,1|ks137z,93,195,1|ks1380,107,224,0|kzy9vz,107,224,0|kzy9w0,93,195,1|lb44jz,93,195,1|lb44k0,107,224,0|liocjz,107,224,0|liock0,93,195,0|ne0cfz,93,195,0|ne0cg0,107,224,0\",\"Asia/Yangon|,0,297,0|-1ayykhb,136,297,0|-q3gv5c,136,297,0|-q3gv5b,109,229,0|-efx621,109,229,0|-efx620,107,224,0|-cvg101,107,224,0|-cvg100,109,229,0\",\"Asia/Yekaterinburg|,0,298,0|-rx5hw9,7,299,0|-qc75z6,7,299,0|-qc75z5,105,209,0|-kmr741,105,209,0|-kmr740,92,194,0|5vb0rz,92,194,0|5vb0s0,96,196,1|64ptzz,96,196,1|64pu00,92,194,0|6e2y3z,92,194,0|6e2y40,96,196,1|6nhrbz,96,196,1|6nhrc0,92,194,0|6wuvfz,92,194,0|6wuvg0,96,196,1|769onz,96,196,1|769oo0,92,194,0|7fonfz,92,194,0|7fong0,96,196,1|7p1ubz,96,196,1|7p1uc0,92,194,0|7yevnz,92,194,0|7yevo0,96,196,1|87rwzz,96,196,1|87rx00,92,194,0|8h4ybz,92,194,0|8h4yc0,96,196,1|8qhznz,96,196,1|8qhzo0,92,194,0|8zv0zz,92,194,0|8zv100,96,196,1|9982bz,96,196,1|9982c0,92,194,0|9il3nz,92,194,0|9il3o0,96,196,1|9ry4zz,96,196,1|9ry500,92,194,0|a1b6bz,92,194,0|a1b6c0,96,196,1|aao7nz,96,196,1|aao7o0,92,194,0|ak18zz,92,194,0|ak1900,96,196,1|atr8zz,96,196,1|atr900,92,194,0|b34abz,92,194,0|b34ac0,92,194,1|bchefz,92,194,1|bcheg0,105,209,0|bi8t3z,105,209,0|bi8t40,92,194,0|bluczz,92,194,0|blud00,96,196,1|bv7ebz,96,196,1|bv7ec0,92,194,0|c4kfnz,92,194,0|c4kfo0,96,196,1|cdxgzz,96,196,1|cdxh00,92,194,0|cnaibz,92,194,0|cnaic0,96,196,1|cwnjnz,96,196,1|cwnjo0,92,194,0|d60kzz,92,194,0|d60l00,96,196,1|dfdmbz,96,196,1|dfdmc0,92,194,0|dp3mbz,92,194,0|dp3mc0,96,196,1|dzwibz,96,196,1|dzwic0,92,194,0|e7tozz,92,194,0|e7tp00,96,196,1|eimkzz,96,196,1|eiml00,92,194,0|eqjrnz,92,194,0|eqjro0,96,196,1|f1cnnz,96,196,1|f1cno0,92,194,0|f99ubz,92,194,0|f99uc0,96,196,1|fkfozz,96,196,1|fkfp00,92,194,0|frzwzz,92,194,0|frzx00,96,196,1|g35rnz,96,196,1|g35ro0,92,194,0|gapznz,92,194,0|gapzo0,96,196,1|glvubz,96,196,1|glvuc0,92,194,0|gtt0zz,92,194,0|gtt100,96,196,1|h4lwzz,96,196,1|h4lx00,92,194,0|hcj3nz,92,194,0|hcj3o0,96,196,1|hnbznz,96,196,1|hnbzo0,92,194,0|hv96bz,92,194,0|hv96c0,96,196,1|i6f0zz,96,196,1|i6f100,92,194,0|idz8zz,92,194,0|idz900,96,196,1|ip53nz,96,196,1|ip53o0,92,194,0|iwpbnz,92,194,0|iwpbo0,96,196,1|j7v6bz,96,196,1|j7v6c0,92,194,0|jffebz,92,194,0|jffec0,96,196,1|jql8zz,96,196,1|jql900,92,194,0|jyifnz,92,194,0|jyifo0,96,196,1|k9bbnz,96,196,1|k9bbo0,92,194,0|kh8ibz,92,194,0|kh8ic0,96,196,1|ks1ebz,96,196,1|ks1ec0,92,194,0|kzykzz,92,194,0|kzyl00,96,196,1|lb4fnz,96,196,1|lb4fo0,92,194,0|lionnz,92,194,0|liono0,96,196,0|ne0njz,96,196,0|ne0nk0,92,194,0\",\"Asia/Yerevan|,0,300,0|-nu148o,100,6,0|-6p7kc1,100,6,0|-6p7kc0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,92,194,1|9ry7rz,92,194,1|9ry7s0,105,209,0|a1b93z,105,209,0|a1b940,92,194,1|aaoafz,92,194,1|aaoag0,105,209,0|ak1brz,105,209,0|ak1bs0,92,194,1|atrbrz,92,194,1|atrbs0,105,209,0|b34d3z,105,209,0|b34d40,105,209,1|bchh7z,105,209,1|bchh80,100,6,0|bluijz,100,6,0|bluik0,105,209,1|bv7jvz,105,209,1|bv7jw0,100,6,0|c4kl7z,100,6,0|c4kl80,105,209,1|cdxmjz,105,209,1|cdxmk0,100,6,0|cnanvz,100,6,0|cnanw0,105,209,1|cwnp7z,105,209,1|cwnp80,100,6,0|d60qjz,100,6,0|d60qk0,105,209,1|dfdrvz,105,209,1|dfdrw0,105,209,0|e7trrz,105,209,0|e7trs0,92,194,1|eimnrz,92,194,1|eimns0,105,209,0|eqjufz,105,209,0|eqjug0,92,194,1|f1cqfz,92,194,1|f1cqg0,105,209,0|f99x3z,105,209,0|f99x40,92,194,1|fkfrrz,92,194,1|fkfrs0,105,209,0|frzzrz,105,209,0|frzzs0,92,194,1|g35ufz,92,194,1|g35ug0,105,209,0|gaq2fz,105,209,0|gaq2g0,92,194,1|glvx3z,92,194,1|glvx40,105,209,0|gtt3rz,105,209,0|gtt3s0,92,194,1|h4lzrz,92,194,1|h4lzs0,105,209,0|hcj6fz,105,209,0|hcj6g0,92,194,1|hnc2fz,92,194,1|hnc2g0,105,209,0|hv993z,105,209,0|hv9940,92,194,1|i6f3rz,92,194,1|i6f3s0,105,209,0|idzbrz,105,209,0|idzbs0,92,194,1|ip56fz,92,194,1|ip56g0,105,209,0|iwpefz,105,209,0|iwpeg0,92,194,1|j7v93z,92,194,1|j7v940,105,209,0|jffh3z,105,209,0|jffh40,92,194,1|jqlbrz,92,194,1|jqlbs0,105,209,0|jyiifz,105,209,0|jyiig0,92,194,1|k9befz,92,194,1|k9beg0,105,209,0|kh8l3z,105,209,0|kh8l40,92,194,1|ks1h3z,92,194,1|ks1h40,105,209,0|kzynrz,105,209,0|kzyns0,92,194,1|lb4ifz,92,194,1|lb4ig0,105,209,0|lioqfz,105,209,0|lioqg0,92,194,1|ltul3z,92,194,1|ltul40,105,209,0\",\"Atlantic/Azores|,0,301,0|-18vsdww,77,302,0|-u9rbs1,77,302,0|-u9rbs0,40,45,0|-rxwvw1,40,45,0|-rxwvw0,13,15,1|-rqwyg1,13,15,1|-rqwyg0,40,45,0|-rkqt81,40,45,0|-rkqt80,13,15,1|-r90l81,13,15,1|-r90l80,40,45,0|-r1x181,40,45,0|-r1x180,13,15,1|-qq8nw1,13,15,1|-qq8nw0,40,45,0|-qj6yk1,40,45,0|-qj6yk0,13,15,1|-q7gqk1,13,15,1|-q7gqk0,40,45,0|-q0d6k1,40,45,0|-q0d6k0,13,15,1|-pomyk1,13,15,1|-pomyk0,40,45,0|-phl981,40,45,0|-phl980,13,15,1|-p5v181,13,15,1|-p5v180,40,45,0|-nusl81,40,45,0|-nusl80,13,15,1|-nlhek1,13,15,1|-nlhek0,40,45,0|-mt6vw1,40,45,0|-mt6vw0,13,15,1|-mkjrw1,13,15,1|-mkjrw0,40,45,0|-matrw1,40,45,0|-matrw0,13,15,1|-m1tp81,13,15,1|-m1tp80,40,45,0|-lrqqk1,40,45,0|-lrqqk0,13,15,1|-liqnw1,13,15,1|-liqnw0,40,45,0|-l8np81,40,45,0|-l8np80,13,15,1|-l00l81,13,15,1|-l00l80,40,45,0|-k77jw1,40,45,0|-k77jw0,13,15,1|-jykfw1,13,15,1|-jykfw0,40,45,0|-jp7ek1,40,45,0|-jp7ek0,13,15,1|-jfud81,13,15,1|-jfud80,40,45,0|-ineak1,40,45,0|-ineak0,13,15,1|-ie1981,13,15,1|-ie1980,40,45,0|-i516k1,40,45,0|-i516k0,13,15,1|-hvb6k1,13,15,1|-hvb6k0,40,45,0|-hl87w1,40,45,0|-hl87w0,13,15,1|-hcl3w1,13,15,1|-hcl3w0,40,45,0|-h382k1,40,45,0|-h382k0,13,15,1|-gtv181,13,15,1|-gtv180,40,45,0|-gkuyk1,40,45,0|-gkuyk0,13,15,1|-gb4yk1,13,15,1|-gb4yk0,40,45,0|-g11zw1,40,45,0|-g11zw0,13,15,1|-fpw581,13,15,1|-fpw580,40,45,0|-fkunw1,40,45,0|-fkunw0,13,15,1|-f9buk1,13,15,1|-f9buk0,40,45,0|-ezyt81,40,45,0|-ezyt80,13,15,1|-eqjx81,13,15,1|-eqjx80,40,45,0|-eibmk1,40,45,0|-eibmk0,13,15,1|-eg5xc1,13,15,1|-eg5xc0,17,1,1|-eaeio1,17,1,1|-eaeio0,13,15,1|-e6st81,13,15,1|-e6st80,40,45,0|-dzljw1,40,45,0|-dzljw0,13,15,1|-dxstc1,13,15,1|-dxstc0,17,1,1|-dqyio1,17,1,1|-dqyio0,13,15,1|-dnprw1,13,15,1|-dnprw0,40,45,0|-dgvh81,40,45,0|-dgvh80,13,15,1|-deps01,13,15,1|-deps00,17,1,1|-d88g01,17,1,1|-d88g00,13,15,1|-d4zp81,13,15,1|-d4zp80,40,45,0|-cy5ek1,40,45,0|-cy5ek0,13,15,1|-cvzpc1,13,15,1|-cvzpc0,17,1,1|-cpidc1,17,1,1|-cpidc0,13,15,1|-cm9mk1,13,15,1|-cm9mk0,40,45,0|-cdzh81,40,45,0|-cdzh80,13,15,1|-c4mfw1,13,15,1|-c4mfw0,40,45,0|-bv9681,40,45,0|-bv9680,13,15,1|-blw4w1,13,15,1|-blw4w0,40,45,0|-bcj3k1,40,45,0|-bcj3k0,13,15,1|-b36281,13,15,1|-b36280,40,45,0|-att0w1,40,45,0|-att0w0,13,15,1|-akfzk1,13,15,1|-akfzk0,40,45,0|-9scvk1,40,45,0|-9scvk0,13,15,1|-9imvk1,13,15,1|-9imvk0,40,45,0|-999u81,40,45,0|-999u80,13,15,1|-8zwsw1,13,15,1|-8zwsw0,40,45,0|-8qjrk1,40,45,0|-8qjrk0,13,15,1|-8h6q81,13,15,1|-8h6q80,40,45,0|-87tow1,40,45,0|-87tow0,13,15,1|-7ygnk1,13,15,1|-7ygnk0,40,45,0|-7p3m81,40,45,0|-7p3m80,13,15,1|-7fqkw1,13,15,1|-7fqkw0,40,45,0|-76djk1,40,45,0|-76djk0,13,15,1|-6wnjk1,13,15,1|-6wnjk0,40,45,0|-6nai81,40,45,0|-6nai80,13,15,1|-6dxgw1,13,15,1|-6dxgw0,40,45,0|-64kfk1,40,45,0|-64kfk0,13,15,1|-5v7e81,13,15,1|-5v7e80,40,45,0|-5lucw1,40,45,0|-5lucw0,13,15,1|-5chbk1,13,15,1|-5chbk0,40,45,0|-534a81,40,45,0|-534a80,13,15,1|-4tr8w1,13,15,1|-4tr8w0,40,45,0|-4ke7k1,40,45,0|-4ke7k0,13,15,1|-4b1681,13,15,1|-4b1680,40,45,0|-41o4w1,40,45,0|-41o4w0,13,15,1|-3ry4w1,13,15,1|-3ry4w0,40,45,0|-3il3k1,40,45,0|-3il3k0,13,15,1|-398281,13,15,1|-398280,40,45,0|-2zv0w1,40,45,0|-2zv0w0,13,15,1|-2qhzk1,13,15,1|-2qhzk0,40,45,0|-2h4y81,40,45,0|-2h4y80,13,15,1|-27rww1,13,15,1|-27rww0,40,45,0|-1yevk1,40,45,0|-1yevk0,13,15,0|3rwo3z,13,15,0|3rwo40,17,1,1|419pfz,17,1,1|419pg0,13,15,0|4azpfz,13,15,0|4azpg0,17,1,1|4kcqrz,17,1,1|4kcqs0,13,15,0|4tps3z,13,15,0|4tps40,17,1,1|532w7z,17,1,1|532w80,13,15,0|5cfurz,13,15,0|5cfus0,17,1,1|5lsyvz,17,1,1|5lsyw0,13,15,0|5v607z,13,15,0|5v6080,17,1,1|64j1jz,17,1,1|64j1k0,13,15,0|6dw2vz,13,15,0|6dw2w0,17,1,1|6n947z,17,1,1|6n9480,13,15,0|6wm8bz,13,15,0|6wm8c0,17,1,1|75z6vz,17,1,1|75z6w0,13,15,0|7fc87z,13,15,0|7fc880,17,1,1|7p287z,17,1,1|7p2880,13,15,0|7yf9jz,13,15,0|7yf9k0,17,1,1|87savz,17,1,1|87saw0,13,15,0|8h5c7z,13,15,0|8h5c80,17,1,1|8qidjz,17,1,1|8qidk0,13,15,0|8zvevz,13,15,0|8zvew0,17,1,1|998g7z,17,1,1|998g80,13,15,0|9ilhjz,13,15,0|9ilhk0,17,1,1|9ryivz,17,1,1|9ryiw0,13,15,0|a1bk7z,13,15,0|a1bk80,17,1,1|aaoljz,17,1,1|aaolk0,13,15,0|ak1mvz,13,15,0|ak1mw0,17,1,1|atrmvz,17,1,1|atrmw0,13,15,0|b34o7z,13,15,0|b34o80,17,1,1|bchpjz,17,1,1|bchpk0,13,15,0|bluqvz,13,15,0|bluqw0,17,1,1|bv7s7z,17,1,1|bv7s80,8,1,0|c4kqrz,8,1,0|c4kqs0,17,1,1|cdxs3z,17,1,1|cdxs40,13,15,0|cnatfz,13,15,0|cnatg0,17,1,1|cwnurz,17,1,1|cwnus0,13,15,0|d60w3z,13,15,0|d60w40,17,1,1|dfdxfz,17,1,1|dfdxg0,13,15,0|dp3xfz,13,15,0|dp3xg0,17,1,1|dzwtfz,17,1,1|dzwtg0,13,15,0|e7u03z,13,15,0|e7u040,17,1,1|eimw3z,17,1,1|eimw40,13,15,0|eqk2rz,13,15,0|eqk2s0,17,1,1|f1cyrz,17,1,1|f1cys0,13,15,0|f9a5fz,13,15,0|f9a5g0,17,1,1|fkg03z,17,1,1|fkg040,13,15,0|fs083z,13,15,0|fs0840,17,1,1|g362rz,17,1,1|g362s0,13,15,0|gaqarz,13,15,0|gaqas0,17,1,1|glw5fz,17,1,1|glw5g0,13,15,0|gttc3z,13,15,0|gttc40,17,1,1|h4m83z,17,1,1|h4m840,13,15,0|hcjerz,13,15,0|hcjes0,17,1,1|hncarz,17,1,1|hncas0,13,15,0|hv9hfz,13,15,0|hv9hg0,17,1,1|i6fc3z,17,1,1|i6fc40,13,15,0|idzk3z,13,15,0|idzk40,17,1,1|ip5erz,17,1,1|ip5es0,13,15,0|iwpmrz,13,15,0|iwpms0,17,1,1|j7vhfz,17,1,1|j7vhg0,13,15,0|jffpfz,13,15,0|jffpg0,17,1,1|jqlk3z,17,1,1|jqlk40,13,15,0|jyiqrz,13,15,0|jyiqs0,17,1,1|k9bmrz,17,1,1|k9bms0,13,15,0|kh8tfz,13,15,0|kh8tg0,17,1,1|ks1pfz,17,1,1|ks1pg0,13,15,0|kzyw3z,13,15,0|kzyw40,17,1,1|lb4qrz,17,1,1|lb4qs0,13,15,0|lioyrz,13,15,0|lioys0,17,1,1|ltutfz,17,1,1|ltutg0,13,15,0|m1f1fz,13,15,0|m1f1g0,17,1,1|mckw3z,17,1,1|mckw40,13,15,0|mki2rz,13,15,0|mki2s0,17,1,1|mvayrz,17,1,1|mvays0,13,15,0|n385fz,13,15,0|n385g0,17,1,1|ne11fz,17,1,1|ne11g0,13,15,0|nly83z,13,15,0|nly840,17,1,1|nwr43z,17,1,1|nwr440,13,15,0|o4oarz,13,15,0|o4oas0,17,1,1|ofu5fz,17,1,1|ofu5g0,13,15,0|onedfz,13,15,0|onedg0,17,1,1|oyk83z,17,1,1|oyk840,13,15,0|p64g3z,13,15,0|p64g40,17,1,1|phaarz,17,1,1|phaas0,13,15,0|pp7hfz,13,15,0|pp7hg0,17,1,1|q00dfz,17,1,1|q00dg0,13,15,0|q7xk3z,13,15,0|q7xk40,17,1,1|qiqg3z,17,1,1|qiqg40,13,15,0|qqnmrz,13,15,0|qqnms0,17,1,1|r1thfz,17,1,1|r1thg0,13,15,0|r9dpfz,13,15,0|r9dpg0,17,1,1|rkjk3z,17,1,1|rkjk40,13,15,0|rs3s3z,13,15,0|rs3s40,17,1,1|s39mrz,17,1,1|s39ms0,13,15,0|sb6tfz,13,15,0|sb6tg0,17,1,1|slzpfz,17,1,1|slzpg0,13,15,0|stww3z,13,15,0|stww40,17,1,1|t4ps3z,17,1,1|t4ps40,13,15,0|tcmyrz,13,15,0|tcmys0,17,1,1|tnfurz,17,1,1|tnfus0,13,15,0|tvd1fz,13,15,0|tvd1g0,17,1,1|u6iw3z,17,1,1|u6iw40,13,15,0|ue343z,13,15,0|ue3440,17,1,1|up8yrz,17,1,1|up8ys0,13,15,0|uwt6rz,13,15,0|uwt6s0,17,1,1|v7z1fz,17,1,1|v7z1g0,13,15,0|vfw83z,13,15,0|vfw840,17,1,1|vqp43z,17,1,1|vqp440,13,15,0|vymarz,13,15,0|vymas0,17,1,1|w9f6rz,17,1,1|w9f6s0,13,15,0|whcdfz,13,15,0|whcdg0,17,1,1|wsi83z,17,1,1|wsi840,13,15,0|x02g3z,13,15,0|x02g40,17,1,1|xb8arz,17,1,1|xb8as0,13,15,0|xisirz,13,15,0|xisis0,17,1,1|xtydfz,17,1,1|xtydg0,13,15,0|y1ilfz,13,15,0|y1ilg0,17,1,1|ycog3z,17,1,1|ycog40,13,15,0|yklmrz,13,15,0|yklms0,17,1,1|yveirz,17,1,1|yveis0,13,15,0|z3bpfz,13,15,0|z3bpg0,17,1,1|ze4lfz,17,1,1|ze4lg0,13,15,0\",\"Atlantic/Bermuda|,0,303,0|-15r0xbu,53,303,0|-rivvzv,53,303,0|-rivvzu,27,304,1|-r9qc3v,27,304,1|-r9qc3u,53,303,0|-qzp5bv,53,303,0|-qzp5bu,27,304,1|-qrq6rv,27,304,1|-qrq6ru,53,303,0|-kvj2fv,53,303,0|-kvj2fu,32,42,0|-eljwo1,32,42,0|-eljwo0,54,44,1|-e75gs1,54,44,1|-e75gs0,32,42,0|-dz87c1,32,42,0|-dz87c0,54,44,1|-dnpgs1,54,44,1|-dnpgs0,32,42,0|-dgv3c1,32,42,0|-dgv3c0,54,44,1|-d4mfg1,54,44,1|-d4mfg0,32,42,0|-cy50o1,32,42,0|-cy50o0,54,44,1|-clwcs1,54,44,1|-clwcs0,32,42,0|-bt38o1,32,42,0|-bt38o0,54,44,1|-bmyy41,54,44,1|-bmyy40,32,42,0|-ba07c1,32,42,0|-ba07c0,54,44,1|-b4lu41,54,44,1|-b4lu40,32,42,0|-ara4o1,32,42,0|-ara4o0,54,44,1|-alvrg1,54,44,1|-alvrg0,32,42,0|-a873c1,32,42,0|-a873c0,54,44,1|-a35os1,54,44,1|-a35os0,32,42,0|-9ph0o1,32,42,0|-9ph0o0,54,44,1|-9kfm41,54,44,1|-9kfm40,32,42,0|-96qy01,32,42,0|-96qy00,54,44,1|-91cks1,54,44,1|-91cks0,32,42,0|-73hoo1,32,42,0|-73hoo0,54,44,1|-6vkks1,54,44,1|-6vkks0,32,42,0|296onz,32,42,0|296oo0,54,44,1|2ijn7z,54,44,1|2ijn80,32,42,0|2rwrbz,32,42,0|2rwrc0,54,44,1|319pvz,54,44,1|319pw0,32,42,0|3amtzz,32,42,0|3amu00,54,44,1|3kcr7z,54,44,1|3kcr80,32,42,0|3tcwnz,32,42,0|3tcwo0,54,44,1|432tvz,54,44,1|432tw0,32,42,0|4cfxzz,32,42,0|4cfy00,54,44,1|4lswjz,54,44,1|4lswk0,32,42,0|4v60nz,32,42,0|4v60o0,54,44,1|54iz7z,54,44,1|54iz80,32,42,0|5dw3bz,32,42,0|5dw3c0,54,44,1|5n91vz,54,44,1|5n91w0,32,42,0|5wm5zz,32,42,0|5wm600,54,44,1|65z4jz,54,44,1|65z4k0,32,42,0|6fc8nz,32,42,0|6fc8o0,54,44,1|6p25vz,54,44,1|6p25w0,32,42,0|6y2bbz,32,42,0|6y2bc0,54,44,1|77s8jz,54,44,1|77s8k0,32,42,0|7h5cnz,32,42,0|7h5co0,54,44,1|7qib7z,54,44,1|7qib80,32,42,0|7zvfbz,32,42,0|7zvfc0,54,44,1|898dvz,54,44,1|898dw0,32,42,0|8ilhzz,32,42,0|8ili00,54,44,1|8rygjz,54,44,1|8rygk0,32,42,0|908onz,32,42,0|908oo0,54,44,1|9aoj7z,54,44,1|9aoj80,32,42,0|9iyrbz,32,42,0|9iyrc0,54,44,1|9trkjz,54,44,1|9trkk0,32,42,0|a1otzz,32,42,0|a1ou00,54,44,1|achn7z,54,44,1|achn80,32,42,0|akewnz,32,42,0|akewo0,54,44,1|av7pvz,54,44,1|av7pw0,32,42,0|b3hxzz,32,42,0|b3hy00,54,44,1|bdxsjz,54,44,1|bdxsk0,32,42,0|bm80nz,32,42,0|bm80o0,54,44,1|bwnv7z,54,44,1|bwnv80,32,42,0|c4y3bz,32,42,0|c4y3c0,54,44,1|cfqwjz,54,44,1|cfqwk0,32,42,0|cno5zz,32,42,0|cno600,54,44,1|cygz7z,54,44,1|cygz80,32,42,0|d6e8nz,32,42,0|d6e8o0,54,44,1|dh71vz,54,44,1|dh71w0,32,42,0|dph9zz,32,42,0|dpha00,54,44,1|dzx4jz,54,44,1|dzx4k0,32,42,0|e87cnz,32,42,0|e87co0,54,44,1|ein77z,54,44,1|ein780,32,42,0|eqxfbz,32,42,0|eqxfc0,54,44,1|f1d9vz,54,44,1|f1d9w0,32,42,0|f9nhzz,32,42,0|f9ni00,54,44,1|fkgb7z,54,44,1|fkgb80,32,42,0|fsdknz,32,42,0|fsdko0,54,44,1|g36dvz,54,44,1|g36dw0,32,42,0|gb3nbz,32,42,0|gb3nc0,54,44,1|glwgjz,54,44,1|glwgk0,32,42,0|gu6onz,32,42,0|gu6oo0,54,44,1|h4mj7z,54,44,1|h4mj80,32,42,0|hcwrbz,32,42,0|hcwrc0,54,44,1|hnclvz,54,44,1|hnclw0,32,42,0|hvmtzz,32,42,0|hvmu00,54,44,1|i6fn7z,54,44,1|i6fn80,32,42,0|iecwnz,32,42,0|iecwo0,54,44,1|ip5pvz,54,44,1|ip5pw0,32,42,0|ix2zbz,32,42,0|ix2zc0,54,44,1|j7vsjz,54,44,1|j7vsk0,32,42,0|jeq5zz,32,42,0|jeq600,54,44,1|jqytvz,54,44,1|jqytw0,32,42,0|jxg8nz,32,42,0|jxg8o0,54,44,1|k9owjz,54,44,1|k9owk0,32,42,0|kg6bbz,32,42,0|kg6bc0,54,44,1|ksez7z,54,44,1|ksez80,32,42,0|kz9cnz,32,42,0|kz9co0,54,44,1|lbi0jz,54,44,1|lbi0k0,32,42,0|lhzfbz,32,42,0|lhzfc0,54,44,1|lu837z,54,44,1|lu8380,32,42,0|m0phzz,32,42,0|m0pi00,54,44,1|mcy5vz,54,44,1|mcy5w0,32,42,0|mjfknz,32,42,0|mjfko0,54,44,1|mvo8jz,54,44,1|mvo8k0,32,42,0|n25nbz,32,42,0|n25nc0,54,44,1|neeb7z,54,44,1|neeb80,32,42,0|nkvpzz,32,42,0|nkvq00,54,44,1|nx4dvz,54,44,1|nx4dw0,32,42,0|o3yrbz,32,42,0|o3yrc0,54,44,1|og7f7z,54,44,1|og7f80,32,42,0|omotzz,32,42,0|omou00,54,44,1|oyxhvz,54,44,1|oyxhw0,32,42,0|p5ewnz,32,42,0|p5ewo0,54,44,1|phnkjz,54,44,1|phnkk0,32,42,0|po4zbz,32,42,0|po4zc0,54,44,1|q0dn7z,54,44,1|q0dn80,32,42,0|q6v1zz,32,42,0|q6v200,54,44,1|qj3pvz,54,44,1|qj3pw0,32,42,0|qpy3bz,32,42,0|qpy3c0,54,44,1|r26r7z,54,44,1|r26r80,32,42,0|r8o5zz,32,42,0|r8o600,54,44,1|rkwtvz,54,44,1|rkwtw0,32,42,0|rre8nz,32,42,0|rre8o0,54,44,1|s3mwjz,54,44,1|s3mwk0,32,42,0|sa4bbz,32,42,0|sa4bc0,54,44,1|smcz7z,54,44,1|smcz80,32,42,0|ssudzz,32,42,0|ssue00,54,44,1|t531vz,54,44,1|t531w0,32,42,0|tbkgnz,32,42,0|tbkgo0,54,44,1|tnt4jz,54,44,1|tnt4k0,32,42,0|tunhzz,32,42,0|tuni00,54,44,1|u6w5vz,54,44,1|u6w5w0,32,42,0|uddknz,32,42,0|uddko0,54,44,1|upm8jz,54,44,1|upm8k0,32,42,0|uw3nbz,32,42,0|uw3nc0,54,44,1|v8cb7z,54,44,1|v8cb80,32,42,0|vetpzz,32,42,0|vetq00,54,44,1|vr2dvz,54,44,1|vr2dw0,32,42,0|vxjsnz,32,42,0|vxjso0,54,44,1|w9sgjz,54,44,1|w9sgk0,32,42,0|wgmtzz,32,42,0|wgmu00,54,44,1|wsvhvz,54,44,1|wsvhw0,32,42,0|wzcwnz,32,42,0|wzcwo0,54,44,1|xblkjz,54,44,1|xblkk0,32,42,0|xi2zbz,32,42,0|xi2zc0,54,44,1|xubn7z,54,44,1|xubn80,32,42,0|y0t1zz,32,42,0|y0t200,54,44,1|yd1pvz,54,44,1|yd1pw0,32,42,0|yjj4nz,32,42,0|yjj4o0,54,44,1|yvrsjz,54,44,1|yvrsk0,32,42,0|z297bz,32,42,0|z297c0,54,44,1|zehv7z,54,44,1|zehv80,32,42,0\",\"Atlantic/Canary|,0,305,0|-oytbtc,13,15,0|-c4xh41,13,15,0|-c4xh40,8,1,0|5csqnz,8,1,0|5csqo0,9,10,1|5lsw3z,9,10,1|5lsw40,8,1,0|5v5xfz,8,1,0|5v5xg0,9,10,1|64iyrz,9,10,1|64iys0,8,1,0|6dw03z,8,1,0|6dw040,9,10,1|6n91fz,9,10,1|6n91g0,8,1,0|6wm2rz,8,1,0|6wm2s0,9,10,1|75z43z,9,10,1|75z440,8,1,0|7fc5fz,8,1,0|7fc5g0,9,10,1|7p25fz,9,10,1|7p25g0,8,1,0|7yf6rz,8,1,0|7yf6s0,9,10,1|87s83z,9,10,1|87s840,8,1,0|8h59fz,8,1,0|8h59g0,9,10,1|8qiarz,9,10,1|8qias0,8,1,0|8zvc3z,8,1,0|8zvc40,9,10,1|998dfz,9,10,1|998dg0,8,1,0|9ilerz,8,1,0|9iles0,9,10,1|9ryg3z,9,10,1|9ryg40,8,1,0|a1bhfz,8,1,0|a1bhg0,9,10,1|aaoirz,9,10,1|aaois0,8,1,0|ak1k3z,8,1,0|ak1k40,9,10,1|atrk3z,9,10,1|atrk40,8,1,0|b34lfz,8,1,0|b34lg0,9,10,1|bchmrz,9,10,1|bchms0,8,1,0|bluo3z,8,1,0|bluo40,9,10,1|bv7pfz,9,10,1|bv7pg0,8,1,0|c4kqrz,8,1,0|c4kqs0,9,10,1|cdxs3z,9,10,1|cdxs40,8,1,0|cnatfz,8,1,0|cnatg0,9,10,1|cwnurz,9,10,1|cwnus0,8,1,0|d60w3z,8,1,0|d60w40,9,10,1|dfdxfz,9,10,1|dfdxg0,8,1,0|dp3xfz,8,1,0|dp3xg0,9,10,1|dzwtfz,9,10,1|dzwtg0,8,1,0|e7u03z,8,1,0|e7u040,9,10,1|eimw3z,9,10,1|eimw40,8,1,0|eqk2rz,8,1,0|eqk2s0,9,10,1|f1cyrz,9,10,1|f1cys0,8,1,0|f9a5fz,8,1,0|f9a5g0,9,10,1|fkg03z,9,10,1|fkg040,8,1,0|fs083z,8,1,0|fs0840,9,10,1|g362rz,9,10,1|g362s0,8,1,0|gaqarz,8,1,0|gaqas0,9,10,1|glw5fz,9,10,1|glw5g0,8,1,0|gttc3z,8,1,0|gttc40,9,10,1|h4m83z,9,10,1|h4m840,8,1,0|hcjerz,8,1,0|hcjes0,9,10,1|hncarz,9,10,1|hncas0,8,1,0|hv9hfz,8,1,0|hv9hg0,9,10,1|i6fc3z,9,10,1|i6fc40,8,1,0|idzk3z,8,1,0|idzk40,9,10,1|ip5erz,9,10,1|ip5es0,8,1,0|iwpmrz,8,1,0|iwpms0,9,10,1|j7vhfz,9,10,1|j7vhg0,8,1,0|jffpfz,8,1,0|jffpg0,9,10,1|jqlk3z,9,10,1|jqlk40,8,1,0|jyiqrz,8,1,0|jyiqs0,9,10,1|k9bmrz,9,10,1|k9bms0,8,1,0|kh8tfz,8,1,0|kh8tg0,9,10,1|ks1pfz,9,10,1|ks1pg0,8,1,0|kzyw3z,8,1,0|kzyw40,9,10,1|lb4qrz,9,10,1|lb4qs0,8,1,0|lioyrz,8,1,0|lioys0,9,10,1|ltutfz,9,10,1|ltutg0,8,1,0|m1f1fz,8,1,0|m1f1g0,9,10,1|mckw3z,9,10,1|mckw40,8,1,0|mki2rz,8,1,0|mki2s0,9,10,1|mvayrz,9,10,1|mvays0,8,1,0|n385fz,8,1,0|n385g0,9,10,1|ne11fz,9,10,1|ne11g0,8,1,0|nly83z,8,1,0|nly840,9,10,1|nwr43z,9,10,1|nwr440,8,1,0|o4oarz,8,1,0|o4oas0,9,10,1|ofu5fz,9,10,1|ofu5g0,8,1,0|onedfz,8,1,0|onedg0,9,10,1|oyk83z,9,10,1|oyk840,8,1,0|p64g3z,8,1,0|p64g40,9,10,1|phaarz,9,10,1|phaas0,8,1,0|pp7hfz,8,1,0|pp7hg0,9,10,1|q00dfz,9,10,1|q00dg0,8,1,0|q7xk3z,8,1,0|q7xk40,9,10,1|qiqg3z,9,10,1|qiqg40,8,1,0|qqnmrz,8,1,0|qqnms0,9,10,1|r1thfz,9,10,1|r1thg0,8,1,0|r9dpfz,8,1,0|r9dpg0,9,10,1|rkjk3z,9,10,1|rkjk40,8,1,0|rs3s3z,8,1,0|rs3s40,9,10,1|s39mrz,9,10,1|s39ms0,8,1,0|sb6tfz,8,1,0|sb6tg0,9,10,1|slzpfz,9,10,1|slzpg0,8,1,0|stww3z,8,1,0|stww40,9,10,1|t4ps3z,9,10,1|t4ps40,8,1,0|tcmyrz,8,1,0|tcmys0,9,10,1|tnfurz,9,10,1|tnfus0,8,1,0|tvd1fz,8,1,0|tvd1g0,9,10,1|u6iw3z,9,10,1|u6iw40,8,1,0|ue343z,8,1,0|ue3440,9,10,1|up8yrz,9,10,1|up8ys0,8,1,0|uwt6rz,8,1,0|uwt6s0,9,10,1|v7z1fz,9,10,1|v7z1g0,8,1,0|vfw83z,8,1,0|vfw840,9,10,1|vqp43z,9,10,1|vqp440,8,1,0|vymarz,8,1,0|vymas0,9,10,1|w9f6rz,9,10,1|w9f6s0,8,1,0|whcdfz,8,1,0|whcdg0,9,10,1|wsi83z,9,10,1|wsi840,8,1,0|x02g3z,8,1,0|x02g40,9,10,1|xb8arz,9,10,1|xb8as0,8,1,0|xisirz,8,1,0|xisis0,9,10,1|xtydfz,9,10,1|xtydg0,8,1,0|y1ilfz,8,1,0|y1ilg0,9,10,1|ycog3z,9,10,1|ycog40,8,1,0|yklmrz,8,1,0|yklms0,9,10,1|yveirz,9,10,1|yveis0,8,1,0|z3bpfz,8,1,0|z3bpg0,9,10,1|ze4lfz,9,10,1|ze4lg0,8,1,0\",\"Atlantic/Cape_Verde|,0,306,0|-u9rbs0,40,45,0|-e9kqg1,40,45,0|-e9kqg0,13,15,1|-cmxp81,13,15,1|-cmxp80,40,45,0|32t73z,40,45,0|32t740,13,15,0\",\"Atlantic/Faroe|,0,307,0|-wcehew,8,1,0|5v5xfz,8,1,0|5v5xg0,9,10,1|64iyrz,9,10,1|64iys0,8,1,0|6dw03z,8,1,0|6dw040,9,10,1|6n91fz,9,10,1|6n91g0,8,1,0|6wm2rz,8,1,0|6wm2s0,9,10,1|75z43z,9,10,1|75z440,8,1,0|7fc5fz,8,1,0|7fc5g0,9,10,1|7p25fz,9,10,1|7p25g0,8,1,0|7yf6rz,8,1,0|7yf6s0,9,10,1|87s83z,9,10,1|87s840,8,1,0|8h59fz,8,1,0|8h59g0,9,10,1|8qiarz,9,10,1|8qias0,8,1,0|8zvc3z,8,1,0|8zvc40,9,10,1|998dfz,9,10,1|998dg0,8,1,0|9ilerz,8,1,0|9iles0,9,10,1|9ryg3z,9,10,1|9ryg40,8,1,0|a1bhfz,8,1,0|a1bhg0,9,10,1|aaoirz,9,10,1|aaois0,8,1,0|ak1k3z,8,1,0|ak1k40,9,10,1|atrk3z,9,10,1|atrk40,8,1,0|b34lfz,8,1,0|b34lg0,9,10,1|bchmrz,9,10,1|bchms0,8,1,0|bluo3z,8,1,0|bluo40,9,10,1|bv7pfz,9,10,1|bv7pg0,8,1,0|c4kqrz,8,1,0|c4kqs0,9,10,1|cdxs3z,9,10,1|cdxs40,8,1,0|cnatfz,8,1,0|cnatg0,9,10,1|cwnurz,9,10,1|cwnus0,8,1,0|d60w3z,8,1,0|d60w40,9,10,1|dfdxfz,9,10,1|dfdxg0,8,1,0|dp3xfz,8,1,0|dp3xg0,9,10,1|dzwtfz,9,10,1|dzwtg0,8,1,0|e7u03z,8,1,0|e7u040,9,10,1|eimw3z,9,10,1|eimw40,8,1,0|eqk2rz,8,1,0|eqk2s0,9,10,1|f1cyrz,9,10,1|f1cys0,8,1,0|f9a5fz,8,1,0|f9a5g0,9,10,1|fkg03z,9,10,1|fkg040,8,1,0|fs083z,8,1,0|fs0840,9,10,1|g362rz,9,10,1|g362s0,8,1,0|gaqarz,8,1,0|gaqas0,9,10,1|glw5fz,9,10,1|glw5g0,8,1,0|gttc3z,8,1,0|gttc40,9,10,1|h4m83z,9,10,1|h4m840,8,1,0|hcjerz,8,1,0|hcjes0,9,10,1|hncarz,9,10,1|hncas0,8,1,0|hv9hfz,8,1,0|hv9hg0,9,10,1|i6fc3z,9,10,1|i6fc40,8,1,0|idzk3z,8,1,0|idzk40,9,10,1|ip5erz,9,10,1|ip5es0,8,1,0|iwpmrz,8,1,0|iwpms0,9,10,1|j7vhfz,9,10,1|j7vhg0,8,1,0|jffpfz,8,1,0|jffpg0,9,10,1|jqlk3z,9,10,1|jqlk40,8,1,0|jyiqrz,8,1,0|jyiqs0,9,10,1|k9bmrz,9,10,1|k9bms0,8,1,0|kh8tfz,8,1,0|kh8tg0,9,10,1|ks1pfz,9,10,1|ks1pg0,8,1,0|kzyw3z,8,1,0|kzyw40,9,10,1|lb4qrz,9,10,1|lb4qs0,8,1,0|lioyrz,8,1,0|lioys0,9,10,1|ltutfz,9,10,1|ltutg0,8,1,0|m1f1fz,8,1,0|m1f1g0,9,10,1|mckw3z,9,10,1|mckw40,8,1,0|mki2rz,8,1,0|mki2s0,9,10,1|mvayrz,9,10,1|mvays0,8,1,0|n385fz,8,1,0|n385g0,9,10,1|ne11fz,9,10,1|ne11g0,8,1,0|nly83z,8,1,0|nly840,9,10,1|nwr43z,9,10,1|nwr440,8,1,0|o4oarz,8,1,0|o4oas0,9,10,1|ofu5fz,9,10,1|ofu5g0,8,1,0|onedfz,8,1,0|onedg0,9,10,1|oyk83z,9,10,1|oyk840,8,1,0|p64g3z,8,1,0|p64g40,9,10,1|phaarz,9,10,1|phaas0,8,1,0|pp7hfz,8,1,0|pp7hg0,9,10,1|q00dfz,9,10,1|q00dg0,8,1,0|q7xk3z,8,1,0|q7xk40,9,10,1|qiqg3z,9,10,1|qiqg40,8,1,0|qqnmrz,8,1,0|qqnms0,9,10,1|r1thfz,9,10,1|r1thg0,8,1,0|r9dpfz,8,1,0|r9dpg0,9,10,1|rkjk3z,9,10,1|rkjk40,8,1,0|rs3s3z,8,1,0|rs3s40,9,10,1|s39mrz,9,10,1|s39ms0,8,1,0|sb6tfz,8,1,0|sb6tg0,9,10,1|slzpfz,9,10,1|slzpg0,8,1,0|stww3z,8,1,0|stww40,9,10,1|t4ps3z,9,10,1|t4ps40,8,1,0|tcmyrz,8,1,0|tcmys0,9,10,1|tnfurz,9,10,1|tnfus0,8,1,0|tvd1fz,8,1,0|tvd1g0,9,10,1|u6iw3z,9,10,1|u6iw40,8,1,0|ue343z,8,1,0|ue3440,9,10,1|up8yrz,9,10,1|up8ys0,8,1,0|uwt6rz,8,1,0|uwt6s0,9,10,1|v7z1fz,9,10,1|v7z1g0,8,1,0|vfw83z,8,1,0|vfw840,9,10,1|vqp43z,9,10,1|vqp440,8,1,0|vymarz,8,1,0|vymas0,9,10,1|w9f6rz,9,10,1|w9f6s0,8,1,0|whcdfz,8,1,0|whcdg0,9,10,1|wsi83z,9,10,1|wsi840,8,1,0|x02g3z,8,1,0|x02g40,9,10,1|xb8arz,9,10,1|xb8as0,8,1,0|xisirz,8,1,0|xisis0,9,10,1|xtydfz,9,10,1|xtydg0,8,1,0|y1ilfz,8,1,0|y1ilg0,9,10,1|ycog3z,9,10,1|ycog40,8,1,0|yklmrz,8,1,0|yklms0,9,10,1|yveirz,9,10,1|yveis0,8,1,0|z3bpfz,8,1,0|z3bpg0,9,10,1|ze4lfz,9,10,1|ze4lg0,8,1,0\",\"Atlantic/Madeira|,0,308,0|-18vsfjc,137,308,0|-u9rek1,137,308,0|-u9rek0,13,15,0|-rxwyo1,13,15,0|-rxwyo0,17,1,1|-rqx181,17,1,1|-rqx180,13,15,0|-rkqw01,13,15,0|-rkqw00,17,1,1|-r90o01,17,1,1|-r90o00,13,15,0|-r1x401,13,15,0|-r1x400,17,1,1|-qq8qo1,17,1,1|-qq8qo0,13,15,0|-qj71c1,13,15,0|-qj71c0,17,1,1|-q7gtc1,17,1,1|-q7gtc0,13,15,0|-q0d9c1,13,15,0|-q0d9c0,17,1,1|-pon1c1,17,1,1|-pon1c0,13,15,0|-phlc01,13,15,0|-phlc00,17,1,1|-p5v401,17,1,1|-p5v400,13,15,0|-nuso01,13,15,0|-nuso00,17,1,1|-nlhhc1,17,1,1|-nlhhc0,13,15,0|-mt6yo1,13,15,0|-mt6yo0,17,1,1|-mkjuo1,17,1,1|-mkjuo0,13,15,0|-matuo1,13,15,0|-matuo0,17,1,1|-m1ts01,17,1,1|-m1ts00,13,15,0|-lrqtc1,13,15,0|-lrqtc0,17,1,1|-liqqo1,17,1,1|-liqqo0,13,15,0|-l8ns01,13,15,0|-l8ns00,17,1,1|-l00o01,17,1,1|-l00o00,13,15,0|-k77mo1,13,15,0|-k77mo0,17,1,1|-jykio1,17,1,1|-jykio0,13,15,0|-jp7hc1,13,15,0|-jp7hc0,17,1,1|-jfug01,17,1,1|-jfug00,13,15,0|-inedc1,13,15,0|-inedc0,17,1,1|-ie1c01,17,1,1|-ie1c00,13,15,0|-i519c1,13,15,0|-i519c0,17,1,1|-hvb9c1,17,1,1|-hvb9c0,13,15,0|-hl8ao1,13,15,0|-hl8ao0,17,1,1|-hcl6o1,17,1,1|-hcl6o0,13,15,0|-h385c1,13,15,0|-h385c0,17,1,1|-gtv401,17,1,1|-gtv400,13,15,0|-gkv1c1,13,15,0|-gkv1c0,17,1,1|-gb51c1,17,1,1|-gb51c0,13,15,0|-g122o1,13,15,0|-g122o0,17,1,1|-fpw801,17,1,1|-fpw800,13,15,0|-fkuqo1,13,15,0|-fkuqo0,17,1,1|-f9bxc1,17,1,1|-f9bxc0,13,15,0|-ezyw01,13,15,0|-ezyw00,17,1,1|-eqk001,17,1,1|-eqk000,13,15,0|-eibpc1,13,15,0|-eibpc0,17,1,1|-eg6041,17,1,1|-eg6040,18,10,1|-eaelg1,18,10,1|-eaelg0,17,1,1|-e6sw01,17,1,1|-e6sw00,13,15,0|-dzlmo1,13,15,0|-dzlmo0,17,1,1|-dxsw41,17,1,1|-dxsw40,18,10,1|-dqylg1,18,10,1|-dqylg0,17,1,1|-dnpuo1,17,1,1|-dnpuo0,13,15,0|-dgvk01,13,15,0|-dgvk00,17,1,1|-depus1,17,1,1|-depus0,18,10,1|-d88is1,18,10,1|-d88is0,17,1,1|-d4zs01,17,1,1|-d4zs00,13,15,0|-cy5hc1,13,15,0|-cy5hc0,17,1,1|-cvzs41,17,1,1|-cvzs40,18,10,1|-cpig41,18,10,1|-cpig40,17,1,1|-cm9pc1,17,1,1|-cm9pc0,13,15,0|-cdzk01,13,15,0|-cdzk00,17,1,1|-c4mio1,17,1,1|-c4mio0,13,15,0|-bv9901,13,15,0|-bv9900,17,1,1|-blw7o1,17,1,1|-blw7o0,13,15,0|-bcj6c1,13,15,0|-bcj6c0,17,1,1|-b36501,17,1,1|-b36500,13,15,0|-att3o1,13,15,0|-att3o0,17,1,1|-akg2c1,17,1,1|-akg2c0,13,15,0|-9scyc1,13,15,0|-9scyc0,17,1,1|-9imyc1,17,1,1|-9imyc0,13,15,0|-999x01,13,15,0|-999x00,17,1,1|-8zwvo1,17,1,1|-8zwvo0,13,15,0|-8qjuc1,13,15,0|-8qjuc0,17,1,1|-8h6t01,17,1,1|-8h6t00,13,15,0|-87tro1,13,15,0|-87tro0,17,1,1|-7ygqc1,17,1,1|-7ygqc0,13,15,0|-7p3p01,13,15,0|-7p3p00,17,1,1|-7fqno1,17,1,1|-7fqno0,13,15,0|-76dmc1,13,15,0|-76dmc0,17,1,1|-6wnmc1,17,1,1|-6wnmc0,13,15,0|-6nal01,13,15,0|-6nal00,17,1,1|-6dxjo1,17,1,1|-6dxjo0,13,15,0|-64kic1,13,15,0|-64kic0,17,1,1|-5v7h01,17,1,1|-5v7h00,13,15,0|-5lufo1,13,15,0|-5lufo0,17,1,1|-5chec1,17,1,1|-5chec0,13,15,0|-534d01,13,15,0|-534d00,17,1,1|-4trbo1,17,1,1|-4trbo0,13,15,0|-4keac1,13,15,0|-4keac0,17,1,1|-4b1901,17,1,1|-4b1900,13,15,0|-41o7o1,13,15,0|-41o7o0,17,1,1|-3ry7o1,17,1,1|-3ry7o0,13,15,0|-3il6c1,13,15,0|-3il6c0,17,1,1|-398501,17,1,1|-398500,13,15,0|-2zv3o1,13,15,0|-2zv3o0,17,1,1|-2qi2c1,17,1,1|-2qi2c0,13,15,0|-2h5101,13,15,0|-2h5100,17,1,1|-27rzo1,17,1,1|-27rzo0,13,15,0|-1yeyc1,13,15,0|-1yeyc0,8,1,0|3rwlbz,8,1,0|3rwlc0,9,10,1|419mnz,9,10,1|419mo0,8,1,0|4azmnz,8,1,0|4azmo0,9,10,1|4kcnzz,9,10,1|4kco00,8,1,0|4tppbz,8,1,0|4tppc0,9,10,1|532tfz,9,10,1|532tg0,8,1,0|5cfrzz,8,1,0|5cfs00,9,10,1|5lsw3z,9,10,1|5lsw40,8,1,0|5v5xfz,8,1,0|5v5xg0,9,10,1|64iyrz,9,10,1|64iys0,8,1,0|6dw03z,8,1,0|6dw040,9,10,1|6n91fz,9,10,1|6n91g0,8,1,0|6wm5jz,8,1,0|6wm5k0,9,10,1|75z43z,9,10,1|75z440,8,1,0|7fc5fz,8,1,0|7fc5g0,9,10,1|7p25fz,9,10,1|7p25g0,8,1,0|7yf6rz,8,1,0|7yf6s0,9,10,1|87s83z,9,10,1|87s840,8,1,0|8h59fz,8,1,0|8h59g0,9,10,1|8qiarz,9,10,1|8qias0,8,1,0|8zvc3z,8,1,0|8zvc40,9,10,1|998dfz,9,10,1|998dg0,8,1,0|9ilerz,8,1,0|9iles0,9,10,1|9ryg3z,9,10,1|9ryg40,8,1,0|a1bhfz,8,1,0|a1bhg0,9,10,1|aaoirz,9,10,1|aaois0,8,1,0|ak1k3z,8,1,0|ak1k40,9,10,1|atrk3z,9,10,1|atrk40,8,1,0|b34lfz,8,1,0|b34lg0,9,10,1|bchmrz,9,10,1|bchms0,8,1,0|bluo3z,8,1,0|bluo40,9,10,1|bv7pfz,9,10,1|bv7pg0,8,1,0|c4kqrz,8,1,0|c4kqs0,9,10,1|cdxs3z,9,10,1|cdxs40,8,1,0|cnatfz,8,1,0|cnatg0,9,10,1|cwnurz,9,10,1|cwnus0,8,1,0|d60w3z,8,1,0|d60w40,9,10,1|dfdxfz,9,10,1|dfdxg0,8,1,0|dp3xfz,8,1,0|dp3xg0,9,10,1|dzwtfz,9,10,1|dzwtg0,8,1,0|e7u03z,8,1,0|e7u040,9,10,1|eimw3z,9,10,1|eimw40,8,1,0|eqk2rz,8,1,0|eqk2s0,9,10,1|f1cyrz,9,10,1|f1cys0,8,1,0|f9a5fz,8,1,0|f9a5g0,9,10,1|fkg03z,9,10,1|fkg040,8,1,0|fs083z,8,1,0|fs0840,9,10,1|g362rz,9,10,1|g362s0,8,1,0|gaqarz,8,1,0|gaqas0,9,10,1|glw5fz,9,10,1|glw5g0,8,1,0|gttc3z,8,1,0|gttc40,9,10,1|h4m83z,9,10,1|h4m840,8,1,0|hcjerz,8,1,0|hcjes0,9,10,1|hncarz,9,10,1|hncas0,8,1,0|hv9hfz,8,1,0|hv9hg0,9,10,1|i6fc3z,9,10,1|i6fc40,8,1,0|idzk3z,8,1,0|idzk40,9,10,1|ip5erz,9,10,1|ip5es0,8,1,0|iwpmrz,8,1,0|iwpms0,9,10,1|j7vhfz,9,10,1|j7vhg0,8,1,0|jffpfz,8,1,0|jffpg0,9,10,1|jqlk3z,9,10,1|jqlk40,8,1,0|jyiqrz,8,1,0|jyiqs0,9,10,1|k9bmrz,9,10,1|k9bms0,8,1,0|kh8tfz,8,1,0|kh8tg0,9,10,1|ks1pfz,9,10,1|ks1pg0,8,1,0|kzyw3z,8,1,0|kzyw40,9,10,1|lb4qrz,9,10,1|lb4qs0,8,1,0|lioyrz,8,1,0|lioys0,9,10,1|ltutfz,9,10,1|ltutg0,8,1,0|m1f1fz,8,1,0|m1f1g0,9,10,1|mckw3z,9,10,1|mckw40,8,1,0|mki2rz,8,1,0|mki2s0,9,10,1|mvayrz,9,10,1|mvays0,8,1,0|n385fz,8,1,0|n385g0,9,10,1|ne11fz,9,10,1|ne11g0,8,1,0|nly83z,8,1,0|nly840,9,10,1|nwr43z,9,10,1|nwr440,8,1,0|o4oarz,8,1,0|o4oas0,9,10,1|ofu5fz,9,10,1|ofu5g0,8,1,0|onedfz,8,1,0|onedg0,9,10,1|oyk83z,9,10,1|oyk840,8,1,0|p64g3z,8,1,0|p64g40,9,10,1|phaarz,9,10,1|phaas0,8,1,0|pp7hfz,8,1,0|pp7hg0,9,10,1|q00dfz,9,10,1|q00dg0,8,1,0|q7xk3z,8,1,0|q7xk40,9,10,1|qiqg3z,9,10,1|qiqg40,8,1,0|qqnmrz,8,1,0|qqnms0,9,10,1|r1thfz,9,10,1|r1thg0,8,1,0|r9dpfz,8,1,0|r9dpg0,9,10,1|rkjk3z,9,10,1|rkjk40,8,1,0|rs3s3z,8,1,0|rs3s40,9,10,1|s39mrz,9,10,1|s39ms0,8,1,0|sb6tfz,8,1,0|sb6tg0,9,10,1|slzpfz,9,10,1|slzpg0,8,1,0|stww3z,8,1,0|stww40,9,10,1|t4ps3z,9,10,1|t4ps40,8,1,0|tcmyrz,8,1,0|tcmys0,9,10,1|tnfurz,9,10,1|tnfus0,8,1,0|tvd1fz,8,1,0|tvd1g0,9,10,1|u6iw3z,9,10,1|u6iw40,8,1,0|ue343z,8,1,0|ue3440,9,10,1|up8yrz,9,10,1|up8ys0,8,1,0|uwt6rz,8,1,0|uwt6s0,9,10,1|v7z1fz,9,10,1|v7z1g0,8,1,0|vfw83z,8,1,0|vfw840,9,10,1|vqp43z,9,10,1|vqp440,8,1,0|vymarz,8,1,0|vymas0,9,10,1|w9f6rz,9,10,1|w9f6s0,8,1,0|whcdfz,8,1,0|whcdg0,9,10,1|wsi83z,9,10,1|wsi840,8,1,0|x02g3z,8,1,0|x02g40,9,10,1|xb8arz,9,10,1|xb8as0,8,1,0|xisirz,8,1,0|xisis0,9,10,1|xtydfz,9,10,1|xtydg0,8,1,0|y1ilfz,8,1,0|y1ilg0,9,10,1|ycog3z,9,10,1|ycog40,8,1,0|yklmrz,8,1,0|yklms0,9,10,1|yveirz,9,10,1|yveis0,8,1,0|z3bpfz,8,1,0|z3bpg0,9,10,1|ze4lfz,9,10,1|ze4lg0,8,1,0\",\"Atlantic/Reykjavik|,0,309,0|-wcwx9c,13,15,0|-rl7k01,13,15,0|-rl7k00,17,1,1|-r8ph81,17,1,1|-r8ph80,13,15,0|-r2fmo1,13,15,0|-r2fmo0,17,1,1|-qolek1,17,1,1|-qolek0,13,15,0|-qjnpc1,13,15,0|-qjnpc0,17,1,1|-q5th81,17,1,1|-q5th80,13,15,0|-pgm5c1,13,15,0|-pgm5c0,17,1,1|-pbq581,17,1,1|-pbq580,13,15,0|-g0c5c1,13,15,0|-g0c5c0,17,1,1|-fqyyg1,17,1,1|-fqyyg0,13,15,0|-fkuic1,13,15,0|-fkuic0,17,1,1|-f7vx41,17,1,1|-f7vx40,13,15,0|-f1rjs1,13,15,0|-f1rjs0,17,1,1|-ep5ug1,17,1,1|-ep5ug0,13,15,0|-eioig1,13,15,0|-eioig0,17,1,1|-e6sqg1,17,1,1|-e6sqg0,13,15,0|-dzyfs1,13,15,0|-dzyfs0,17,1,1|-do2ns1,17,1,1|-do2ns0,13,15,0|-dh8d41,13,15,0|-dh8d40,17,1,1|-d5cl41,17,1,1|-d5cl40,13,15,0|-cyiag1,13,15,0|-cyiag0,17,1,1|-cm9js1,17,1,1|-cm9js0,13,15,0|-cfs7s1,13,15,0|-cfs7s0,17,1,1|-c3jh41,17,1,1|-c3jh40,13,15,0|-bv9bs1,13,15,0|-bv9bs0,17,1,1|-bkteg1,17,1,1|-bkteg0,13,15,0|-bcj941,13,15,0|-bcj940,17,1,1|-b23bs1,17,1,1|-b23bs0,13,15,0|-att6g1,13,15,0|-att6g0,17,1,1|-aj0ag1,17,1,1|-aj0ag0,13,15,0|-ab33s1,13,15,0|-ab33s0,17,1,1|-a0n6g1,17,1,1|-a0n6g0,13,15,0|-9sd141,13,15,0|-9sd140,17,1,1|-9hk541,17,1,1|-9hk540,13,15,0|-999zs1,13,15,0|-999zs0,17,1,1|-8yu2g1,17,1,1|-8yu2g0,13,15,0|-8qjx41,13,15,0|-8qjx40,17,1,1|-8g3zs1,17,1,1|-8g3zs0,13,15,0|-87tug1,13,15,0|-87tug0,17,1,1|-7xdx41,17,1,1|-7xdx40,13,15,0|-7p3rs1,13,15,0|-7p3rs0,17,1,1|-7enug1,17,1,1|-7enug0,13,15,0|-76dp41,13,15,0|-76dp40,17,1,1|-6vkt41,17,1,1|-6vkt40,13,15,0|-6nans1,13,15,0|-6nans0,17,1,1|-6cuqg1,17,1,1|-6cuqg0,13,15,0|-64kl41,13,15,0|-64kl40,17,1,1|-5u4ns1,17,1,1|-5u4ns0,13,15,0|-5luig1,13,15,0|-5luig0,17,1,1|-5bel41,17,1,1|-5bel40,13,15,0|-534fs1,13,15,0|-534fs0,17,1,1|-4soig1,17,1,1|-4soig0,13,15,0|-4ked41,13,15,0|-4ked40,17,1,1|-49yfs1,17,1,1|-49yfs0,13,15,0|-41oag1,13,15,0|-41oag0,17,1,1|-3qveg1,17,1,1|-3qveg0,13,15,0|-3il941,13,15,0|-3il940,17,1,1|-385bs1,17,1,1|-385bs0,13,15,0|-2zv6g1,13,15,0|-2zv6g0,17,1,1|-2pf941,17,1,1|-2pf940,13,15,0|-2h53s1,13,15,0|-2h53s0,17,1,1|-26p6g1,17,1,1|-26p6g0,13,15,0|-1yf141,13,15,0|-1yf140,17,1,1|-1nz3s1,17,1,1|-1nz3s0,13,15,0|-1foyg1,13,15,0|-1foyg0,17,1,1|-14w2g1,17,1,1|-14w2g0,13,15,0|-wlx41,13,15,0|-wlx40,1,1,0\",\"Atlantic/South_Georgia|,0,310,0|-15r12kg,40,45,0\",\"Atlantic/St_Helena|,0,12,0|-u9rgl4,1,1,0\",\"Atlantic/Stanley|,0,311,0|-15r0ymc,85,311,0|-u63pad,85,311,0|-u63pac,42,42,0|-gu7rk1,42,42,0|-gu7rk0,39,44,1|-gl7ro1,39,44,1|-gl7ro0,42,42,0|-gbhow1,42,42,0|-gbhow0,39,44,1|-g2hp01,39,44,1|-g2hp00,42,42,0|-fsenk1,42,42,0|-fsenk0,39,44,1|-fjeno1,39,44,1|-fjeno0,42,42,0|-f9okw1,42,42,0|-f9okw0,39,44,1|-f0ol01,39,44,1|-f0ol00,42,42,0|-eqyi81,42,42,0|-eqyi80,39,44,1|-ehyic1,39,44,1|-ehyic0,42,42,0|-e88fk1,42,42,0|-e88fk0,39,44,1|-e3aqc1,39,44,1|-e3aqc0,42,42,0|6yf4fz,42,42,0|6yf4g0,39,44,0|75z9nz,39,44,0|75z9o0,40,45,1|7h51jz,40,45,1|7h51k0,39,44,0|7ocdnz,39,44,0|7ocdo0,40,45,1|7zv47z,40,45,1|7zv480,39,44,0|872gbz,39,44,0|872gc0,39,44,1|8i8azz,39,44,1|8i8b00,42,42,0|8pslrz,42,42,0|8psls0,39,44,1|90ydnz,39,44,1|90ydo0,42,42,0|98iofz,42,42,0|98iog0,39,44,1|9jogbz,39,44,1|9jogc0,42,42,0|9r8r3z,42,42,0|9r8r40,39,44,1|a2eizz,39,44,1|a2ej00,42,42,0|a9ytrz,42,42,0|a9yts0,39,44,1|alhkbz,39,44,1|alhkc0,42,42,0|asowfz,42,42,0|asowg0,39,44,1|b47mzz,39,44,1|b47n00,42,42,0|bbrxrz,42,42,0|bbrxs0,39,44,1|bmxpnz,39,44,1|bmxpo0,42,42,0|bui0fz,42,42,0|bui0g0,39,44,1|c5nsbz,39,44,1|c5nsc0,42,42,0|cd833z,42,42,0|cd8340,39,44,1|coduzz,39,44,1|codv00,42,42,0|cvy5rz,42,42,0|cvy5s0,39,44,1|d73xnz,39,44,1|d73xo0,42,42,0|deo8fz,42,42,0|deo8g0,39,44,1|dq6yzz,39,44,1|dq6z00,42,42,0|dxr9rz,42,42,0|dxr9s0,39,44,1|e8x1nz,39,44,1|e8x1o0,42,42,0|eghcfz,42,42,0|eghcg0,39,44,1|ern4bz,39,44,1|ern4c0,42,42,0|ez7f3z,42,42,0|ez7f40,39,44,1|fad6zz,39,44,1|fad700,42,42,0|fhxhrz,42,42,0|fhxhs0,39,44,1|ft39nz,39,44,1|ft39o0,42,42,0|g0nkfz,42,42,0|g0nkg0,39,44,1|gbthvz,39,44,1|gbthw0,42,42,0|gj0tzz,42,42,0|gj0u00,39,44,1|guwj7z,39,44,1|guwj80,42,42,0|h1qwnz,42,42,0|h1qwo0,39,44,1|hdmlvz,39,44,1|hdmlw0,42,42,0|hktxzz,42,42,0|hkty00,39,44,1|hwcojz,39,44,1|hwcok0,42,42,0|i3k0nz,42,42,0|i3k0o0,39,44,1|if2r7z,39,44,1|if2r80,42,42,0|ima3bz,42,42,0|ima3c0,39,44,1|ixstvz,39,44,1|ixstw0,42,42,0|j505zz,42,42,0|j50600,39,44,1|jgiwjz,39,44,1|jgiwk0,42,42,0|jnq8nz,42,42,0|jnq8o0,39,44,1|jzlxvz,39,44,1|jzlxw0,42,42,0|k6t9zz,42,42,0|k6ta00,39,44,1|kic0jz,39,44,1|kic0k0,42,42,0|kpjcnz,42,42,0|kpjco0,39,44,1|l1237z,39,44,1|l12380,42,42,0|l89fbz,42,42,0|l89fc0,39,44,0\",\"Australia/Adelaide|,0,312,0|-133j2zw,138,224,0|-10vsp01,138,224,0|-10vsp00,138,248,0|-rnsq61,138,248,0|-rnsq60,139,313,1|-rjj0u1,139,313,1|-rjj0u0,138,248,0|-em3gu1,138,248,0|-em3gu0,139,313,1|-ehmcu1,139,313,1|-ehmcu0,138,248,0|-e89bi1,138,248,0|-e89bi0,139,313,1|-dywa61,139,313,1|-dywa60,138,248,0|-dp6a61,138,248,0|-dp6a60,139,313,1|-dg67i1,139,313,1|-dg67i0,138,248,0|ycghz,138,248,0|ycgi0,139,313,1|14gttz,139,313,1|14gtu0,138,248,0|1h2j5z,138,248,0|1h2j60,139,313,1|1njv5z,139,313,1|1njv60,138,248,0|1zsltz,138,248,0|1zslu0,139,313,1|269xtz,139,313,1|269xu0,138,248,0|2iiohz,138,248,0|2iioi0,139,313,1|2p00hz,139,313,1|2p00i0,138,248,0|318r5z,138,248,0|318r60,139,313,1|3831tz,139,313,1|3831u0,138,248,0|3kbshz,138,248,0|3kbsi0,139,313,1|3qt4hz,139,313,1|3qt4i0,138,248,0|431v5z,138,248,0|431v60,139,313,1|49j75z,139,313,1|49j760,138,248,0|4lrxtz,138,248,0|4lrxu0,139,313,1|4s99tz,139,313,1|4s99u0,138,248,0|54i0hz,138,248,0|54i0i0,139,313,1|5azchz,139,313,1|5azci0,138,248,0|5n835z,138,248,0|5n8360,139,313,1|5tpf5z,139,313,1|5tpf60,138,248,0|65y5tz,138,248,0|65y5u0,139,313,1|6csghz,139,313,1|6csgi0,138,248,0|6p175z,138,248,0|6p1760,139,313,1|6vij5z,139,313,1|6vij60,138,248,0|77r9tz,138,248,0|77r9u0,139,313,1|7e8ltz,139,313,1|7e8lu0,138,248,0|7qhchz,138,248,0|7qhci0,139,313,1|7wyohz,139,313,1|7wyoi0,138,248,0|897f5z,138,248,0|897f60,139,313,1|8geohz,139,313,1|8geoi0,138,248,0|8rkj5z,138,248,0|8rkj60,139,313,1|8z4r5z,139,313,1|8z4r60,138,248,0|9ankhz,138,248,0|9anki0,139,313,1|9i7shz,139,313,1|9i7si0,138,248,0|9tqltz,138,248,0|9tqlu0,139,313,1|a0xv5z,139,313,1|a0xv60,138,248,0|acgohz,138,248,0|acgoi0,139,313,1|ajnxtz,139,313,1|ajnxu0,138,248,0|av6r5z,138,248,0|av6r60,139,313,1|b1o35z,139,313,1|b1o360,138,248,0|bdwttz,138,248,0|bdwtu0,139,313,1|blh1tz,139,313,1|blh1u0,138,248,0|bwmwhz,138,248,0|bwmwi0,139,313,1|c3h75z,139,313,1|c3h760,138,248,0|cfpxtz,138,248,0|cfpxu0,139,313,1|cmx75z,139,313,1|cmx760,138,248,0|cyg0hz,138,248,0|cyg0i0,139,313,1|d608hz,139,313,1|d608i0,138,248,0|dh635z,138,248,0|dh6360,139,313,1|dp39tz,139,313,1|dp39u0,138,248,0|dzw5tz,138,248,0|dzw5u0,139,313,1|e7tchz,139,313,1|e7tci0,138,248,0|eim8hz,138,248,0|eim8i0,139,313,1|eqjf5z,139,313,1|eqjf60,138,248,0|f1cb5z,138,248,0|f1cb60,139,313,1|f99htz,139,313,1|f99hu0,138,248,0|fkfchz,138,248,0|fkfci0,139,313,1|frzkhz,139,313,1|frzki0,138,248,0|g35f5z,138,248,0|g35f60,139,313,1|gapn5z,139,313,1|gapn60,138,248,0|glvhtz,138,248,0|glvhu0,139,313,1|gtsohz,139,313,1|gtsoi0,138,248,0|h4lkhz,138,248,0|h4lki0,139,313,1|hcir5z,139,313,1|hcir60,138,248,0|hnbn5z,138,248,0|hnbn60,139,313,1|hv8ttz,139,313,1|hv8tu0,138,248,0|i6eohz,138,248,0|i6eoi0,139,313,1|idywhz,139,313,1|idywi0,138,248,0|ip4r5z,138,248,0|ip4r60,139,313,1|ix1xtz,139,313,1|ix1xu0,138,248,0|j7uttz,138,248,0|j7utu0,139,313,1|jff1tz,139,313,1|jff1u0,138,248,0|jqkwhz,138,248,0|jqkwi0,139,313,1|jyv1tz,139,313,1|jyv1u0,138,248,0|k8835z,138,248,0|k88360,139,313,1|khl4hz,139,313,1|khl4i0,138,248,0|kqy5tz,138,248,0|kqy5u0,139,313,1|l0b75z,139,313,1|l0b760,138,248,0|l9o8hz,138,248,0|l9o8i0,139,313,1|lj19tz,139,313,1|lj19u0,138,248,0|lseb5z,138,248,0|lseb60,139,313,1|m1rchz,139,313,1|m1rci0,138,248,0|mbhchz,138,248,0|mbhci0,139,313,1|mkudtz,139,313,1|mkudu0,138,248,0|mu7f5z,138,248,0|mu7f60,139,313,1|n3kghz,139,313,1|n3kgi0,138,248,0|ncxhtz,138,248,0|ncxhu0,139,313,1|nmaj5z,139,313,1|nmaj60,138,248,0|nvnkhz,138,248,0|nvnki0,139,313,1|o50ltz,139,313,1|o50lu0,138,248,0|oedn5z,138,248,0|oedn60,139,313,1|onqohz,139,313,1|onqoi0,138,248,0|ox3ptz,138,248,0|ox3pu0,139,313,1|p6gr5z,139,313,1|p6gr60,138,248,0|pg6r5z,138,248,0|pg6r60,139,313,1|ppjshz,139,313,1|ppjsi0,138,248,0|pywttz,138,248,0|pywtu0,139,313,1|q89v5z,139,313,1|q89v60,138,248,0|qhmwhz,138,248,0|qhmwi0,139,313,1|qqzxtz,139,313,1|qqzxu0,138,248,0|r0cz5z,138,248,0|r0cz60,139,313,1|r9q0hz,139,313,1|r9q0i0,138,248,0|rj31tz,138,248,0|rj31u0,139,313,1|rsg35z,139,313,1|rsg360,138,248,0|s1t4hz,138,248,0|s1t4i0,139,313,1|sbj4hz,139,313,1|sbj4i0,138,248,0|skw5tz,138,248,0|skw5u0,139,313,1|su975z,139,313,1|su9760,138,248,0|t3m8hz,138,248,0|t3m8i0,139,313,1|tcz9tz,139,313,1|tcz9u0,138,248,0|tmcb5z,138,248,0|tmcb60,139,313,1|tvpchz,139,313,1|tvpci0,138,248,0|u52dtz,138,248,0|u52du0,139,313,1|ueff5z,139,313,1|ueff60,138,248,0|unsghz,138,248,0|unsgi0,139,313,1|ux5htz,139,313,1|ux5hu0,138,248,0|v6vhtz,138,248,0|v6vhu0,139,313,1|vg8j5z,139,313,1|vg8j60,138,248,0|vplkhz,138,248,0|vplki0,139,313,1|vyyltz,139,313,1|vyylu0,138,248,0|w8bn5z,138,248,0|w8bn60,139,313,1|whoohz,139,313,1|whooi0,138,248,0|wr1ptz,138,248,0|wr1pu0,139,313,1|x0er5z,139,313,1|x0er60,138,248,0|x9rshz,138,248,0|x9rsi0,139,313,1|xj4ttz,139,313,1|xj4tu0,138,248,0|xshv5z,138,248,0|xshv60,139,313,1|y1uwhz,139,313,1|y1uwi0,138,248,0|ybkwhz,138,248,0|ybkwi0,139,313,1|ykxxtz,139,313,1|ykxxu0,138,248,0|yuaz5z,138,248,0|yuaz60,139,313,1|z3o0hz,139,313,1|z3o0i0,138,248,0|zd11tz,138,248,0|zd11u0,139,313,1\",\"Australia/Brisbane|,0,314,0|-1354kc8,94,195,0|-rnsrk1,94,195,0|-rnsrk0,95,192,1|-rjj281,95,192,1|-rjj280,94,195,0|-em3i81,94,195,0|-em3i80,95,192,1|-ehme81,95,192,1|-ehme80,94,195,0|-e89cw1,94,195,0|-e89cw0,95,192,1|-dywbk1,95,192,1|-dywbk0,94,195,0|-dp6bk1,94,195,0|-dp6bk0,95,192,1|-dg68w1,95,192,1|-dg68w0,94,195,0|ycf3z,94,195,0|ycf40,95,192,1|14gsfz,95,192,1|14gsg0,94,195,0|acgn3z,94,195,0|acgn40,95,192,1|aixz3z,95,192,1|aixz40,94,195,0|av6prz,94,195,0|av6ps0,95,192,1|b1o1rz,95,192,1|b1o1s0,94,195,0|bdwsfz,94,195,0|bdwsg0,95,192,1|bke4fz,95,192,1|bke4g0,94,195,0\",\"Australia/Broken_Hill|,0,315,0|-133j3j0,94,195,0|-12a9fs1,94,195,0|-12a9fs0,138,224,0|-10vsp01,138,224,0|-10vsp00,138,248,0|-rnsq61,138,248,0|-rnsq60,139,313,1|-rjj0u1,139,313,1|-rjj0u0,138,248,0|-em3gu1,138,248,0|-em3gu0,139,313,1|-ehmcu1,139,313,1|-ehmcu0,138,248,0|-e89bi1,138,248,0|-e89bi0,139,313,1|-dywa61,139,313,1|-dywa60,138,248,0|-dp6a61,138,248,0|-dp6a60,139,313,1|-dg67i1,139,313,1|-dg67i0,138,248,0|ycghz,138,248,0|ycgi0,139,313,1|14gttz,139,313,1|14gtu0,138,248,0|1h2j5z,138,248,0|1h2j60,139,313,1|1njv5z,139,313,1|1njv60,138,248,0|1zsltz,138,248,0|1zslu0,139,313,1|269xtz,139,313,1|269xu0,138,248,0|2iiohz,138,248,0|2iioi0,139,313,1|2p00hz,139,313,1|2p00i0,138,248,0|318r5z,138,248,0|318r60,139,313,1|3831tz,139,313,1|3831u0,138,248,0|3kbshz,138,248,0|3kbsi0,139,313,1|3qt4hz,139,313,1|3qt4i0,138,248,0|431v5z,138,248,0|431v60,139,313,1|49j75z,139,313,1|49j760,138,248,0|4lrxtz,138,248,0|4lrxu0,139,313,1|4s99tz,139,313,1|4s99u0,138,248,0|54i0hz,138,248,0|54i0i0,139,313,1|5azchz,139,313,1|5azci0,138,248,0|5n835z,138,248,0|5n8360,139,313,1|5tpf5z,139,313,1|5tpf60,138,248,0|65y5tz,138,248,0|65y5u0,139,313,1|6e8b5z,139,313,1|6e8b60,138,248,0|6p175z,138,248,0|6p1760,139,313,1|6vij5z,139,313,1|6vij60,138,248,0|77r9tz,138,248,0|77r9u0,139,313,1|7e8ltz,139,313,1|7e8lu0,138,248,0|7qhchz,138,248,0|7qhci0,139,313,1|7wyohz,139,313,1|7wyoi0,138,248,0|897f5z,138,248,0|897f60,139,313,1|8geohz,139,313,1|8geoi0,138,248,0|8rkj5z,138,248,0|8rkj60,139,313,1|8z4r5z,139,313,1|8z4r60,138,248,0|9ankhz,138,248,0|9anki0,139,313,1|9i7shz,139,313,1|9i7si0,138,248,0|9tqltz,138,248,0|9tqlu0,139,313,1|a0xv5z,139,313,1|a0xv60,138,248,0|acgohz,138,248,0|acgoi0,139,313,1|aiy0hz,139,313,1|aiy0i0,138,248,0|av6r5z,138,248,0|av6r60,139,313,1|b1o35z,139,313,1|b1o360,138,248,0|bdwttz,138,248,0|bdwtu0,139,313,1|bke5tz,139,313,1|bke5u0,138,248,0|bwmwhz,138,248,0|bwmwi0,139,313,1|c3h75z,139,313,1|c3h760,138,248,0|cfpxtz,138,248,0|cfpxu0,139,313,1|cm79tz,139,313,1|cm79u0,138,248,0|cyg0hz,138,248,0|cyg0i0,139,313,1|d4xchz,139,313,1|d4xci0,138,248,0|dh635z,138,248,0|dh6360,139,313,1|dp39tz,139,313,1|dp39u0,138,248,0|dzw5tz,138,248,0|dzw5u0,139,313,1|e7tchz,139,313,1|e7tci0,138,248,0|eim8hz,138,248,0|eim8i0,139,313,1|eqjf5z,139,313,1|eqjf60,138,248,0|f1cb5z,138,248,0|f1cb60,139,313,1|f99htz,139,313,1|f99hu0,138,248,0|fkfchz,138,248,0|fkfci0,139,313,1|frzkhz,139,313,1|frzki0,138,248,0|g35f5z,138,248,0|g35f60,139,313,1|gapn5z,139,313,1|gapn60,138,248,0|glvhtz,138,248,0|glvhu0,139,313,1|gtsohz,139,313,1|gtsoi0,138,248,0|h4lkhz,138,248,0|h4lki0,139,313,1|hcir5z,139,313,1|hcir60,138,248,0|hnbn5z,138,248,0|hnbn60,139,313,1|hv8ttz,139,313,1|hv8tu0,138,248,0|i6eohz,138,248,0|i6eoi0,139,313,1|idywhz,139,313,1|idywi0,138,248,0|ip4r5z,138,248,0|ip4r60,139,313,1|ix1xtz,139,313,1|ix1xu0,138,248,0|j7uttz,138,248,0|j7utu0,139,313,1|jff1tz,139,313,1|jff1u0,138,248,0|jqkwhz,138,248,0|jqkwi0,139,313,1|jyv1tz,139,313,1|jyv1u0,138,248,0|k8835z,138,248,0|k88360,139,313,1|khl4hz,139,313,1|khl4i0,138,248,0|kqy5tz,138,248,0|kqy5u0,139,313,1|l0b75z,139,313,1|l0b760,138,248,0|l9o8hz,138,248,0|l9o8i0,139,313,1|lj19tz,139,313,1|lj19u0,138,248,0|lseb5z,138,248,0|lseb60,139,313,1|m1rchz,139,313,1|m1rci0,138,248,0|mbhchz,138,248,0|mbhci0,139,313,1|mkudtz,139,313,1|mkudu0,138,248,0|mu7f5z,138,248,0|mu7f60,139,313,1|n3kghz,139,313,1|n3kgi0,138,248,0|ncxhtz,138,248,0|ncxhu0,139,313,1|nmaj5z,139,313,1|nmaj60,138,248,0|nvnkhz,138,248,0|nvnki0,139,313,1|o50ltz,139,313,1|o50lu0,138,248,0|oedn5z,138,248,0|oedn60,139,313,1|onqohz,139,313,1|onqoi0,138,248,0|ox3ptz,138,248,0|ox3pu0,139,313,1|p6gr5z,139,313,1|p6gr60,138,248,0|pg6r5z,138,248,0|pg6r60,139,313,1|ppjshz,139,313,1|ppjsi0,138,248,0|pywttz,138,248,0|pywtu0,139,313,1|q89v5z,139,313,1|q89v60,138,248,0|qhmwhz,138,248,0|qhmwi0,139,313,1|qqzxtz,139,313,1|qqzxu0,138,248,0|r0cz5z,138,248,0|r0cz60,139,313,1|r9q0hz,139,313,1|r9q0i0,138,248,0|rj31tz,138,248,0|rj31u0,139,313,1|rsg35z,139,313,1|rsg360,138,248,0|s1t4hz,138,248,0|s1t4i0,139,313,1|sbj4hz,139,313,1|sbj4i0,138,248,0|skw5tz,138,248,0|skw5u0,139,313,1|su975z,139,313,1|su9760,138,248,0|t3m8hz,138,248,0|t3m8i0,139,313,1|tcz9tz,139,313,1|tcz9u0,138,248,0|tmcb5z,138,248,0|tmcb60,139,313,1|tvpchz,139,313,1|tvpci0,138,248,0|u52dtz,138,248,0|u52du0,139,313,1|ueff5z,139,313,1|ueff60,138,248,0|unsghz,138,248,0|unsgi0,139,313,1|ux5htz,139,313,1|ux5hu0,138,248,0|v6vhtz,138,248,0|v6vhu0,139,313,1|vg8j5z,139,313,1|vg8j60,138,248,0|vplkhz,138,248,0|vplki0,139,313,1|vyyltz,139,313,1|vyylu0,138,248,0|w8bn5z,138,248,0|w8bn60,139,313,1|whoohz,139,313,1|whooi0,138,248,0|wr1ptz,138,248,0|wr1pu0,139,313,1|x0er5z,139,313,1|x0er60,138,248,0|x9rshz,138,248,0|x9rsi0,139,313,1|xj4ttz,139,313,1|xj4tu0,138,248,0|xshv5z,138,248,0|xshv60,139,313,1|y1uwhz,139,313,1|y1uwi0,138,248,0|ybkwhz,138,248,0|ybkwi0,139,313,1|ykxxtz,139,313,1|ykxxu0,138,248,0|yuaz5z,138,248,0|yuaz60,139,313,1|z3o0hz,139,313,1|z3o0i0,138,248,0|zd11tz,138,248,0|zd11u0,139,313,1\",\"Australia/Currie|,0,316,0|-12smja4,94,195,0|-rsj4w1,94,195,0|-rsj4w0,95,192,1|-rjj281,95,192,1|-rjj280,94,195,0|-r8d7k1,94,195,0|-r8d7k0,95,192,1|-r1vvk1,95,192,1|-r1vvk0,94,195,0|-qpn4w1,94,195,0|-qpn4w0,95,192,1|-qj5sw1,95,192,1|-qj5sw0,94,195,0|-em3i81,94,195,0|-em3i80,95,192,1|-ehme81,95,192,1|-ehme80,94,195,0|-e89cw1,94,195,0|-e89cw0,95,192,1|-dywbk1,95,192,1|-dywbk0,94,195,0|-dp6bk1,94,195,0|-dp6bk0,95,192,1|-dg68w1,95,192,1|-dg68w0,94,195,0|-16cow1,94,195,0|-16cow0,95,192,1|-wznk1,95,192,1|-wznk0,94,195,0|-m6rk1,94,195,0|-m6rk0,95,192,1|-fcgw1,95,192,1|-fcgw0,94,195,0|-3gow1,94,195,0|-3gow0,95,192,1|3dlrz,95,192,1|3dls0,94,195,0|f9drz,94,195,0|f9ds0,95,192,1|mgn3z,95,192,1|mgn40,94,195,0|ycf3z,94,195,0|ycf40,95,192,1|14gsfz,95,192,1|14gsg0,94,195,0|1h2hrz,94,195,0|1h2hs0,95,192,1|1njtrz,95,192,1|1njts0,94,195,0|1zskfz,94,195,0|1zskg0,95,192,1|269wfz,95,192,1|269wg0,94,195,0|2iin3z,94,195,0|2iin40,95,192,1|2ozz3z,95,192,1|2ozz40,94,195,0|318prz,94,195,0|318ps0,95,192,1|3830fz,95,192,1|3830g0,94,195,0|3kbr3z,94,195,0|3kbr40,95,192,1|3qt33z,95,192,1|3qt340,94,195,0|431trz,94,195,0|431ts0,95,192,1|49j5rz,95,192,1|49j5s0,94,195,0|4lrwfz,94,195,0|4lrwg0,95,192,1|4s98fz,95,192,1|4s98g0,94,195,0|54hz3z,94,195,0|54hz40,95,192,1|5azb3z,95,192,1|5azb40,94,195,0|5n81rz,94,195,0|5n81s0,95,192,1|5tpdrz,95,192,1|5tpds0,94,195,0|65y4fz,94,195,0|65y4g0,95,192,1|6dvb3z,95,192,1|6dvb40,94,195,0|6p15rz,94,195,0|6p15s0,95,192,1|6wldrz,95,192,1|6wlds0,94,195,0|77r8fz,94,195,0|77r8g0,95,192,1|7e8kfz,95,192,1|7e8kg0,94,195,0|7qhb3z,94,195,0|7qhb40,95,192,1|7wyn3z,95,192,1|7wyn40,94,195,0|897drz,94,195,0|897ds0,95,192,1|8foprz,95,192,1|8fops0,94,195,0|8rkhrz,94,195,0|8rkhs0,95,192,1|8z4prz,95,192,1|8z4ps0,94,195,0|9anj3z,94,195,0|9anj40,95,192,1|9i7r3z,95,192,1|9i7r40,94,195,0|9tqkfz,94,195,0|9tqkg0,95,192,1|a0xtrz,95,192,1|a0xts0,94,195,0|acgn3z,94,195,0|acgn40,95,192,1|ajnwfz,95,192,1|ajnwg0,94,195,0|av6prz,94,195,0|av6ps0,95,192,1|b33wfz,95,192,1|b33wg0,94,195,0|bctwfz,94,195,0|bctwg0,95,192,1|bltz3z,95,192,1|bltz40,94,195,0|bvjz3z,94,195,0|bvjz40,95,192,1|c4k1rz,95,192,1|c4k1s0,94,195,0|cea1rz,94,195,0|cea1s0,95,192,1|cna4fz,95,192,1|cna4g0,94,195,0|cx04fz,94,195,0|cx04g0,95,192,1|d6073z,95,192,1|d60740,94,195,0|dfq73z,94,195,0|dfq740,95,192,1|dp38fz,95,192,1|dp38g0,94,195,0|dyt8fz,94,195,0|dyt8g0,95,192,1|e7tb3z,95,192,1|e7tb40,94,195,0|ehjb3z,94,195,0|ehjb40,95,192,1|eqjdrz,95,192,1|eqjds0,94,195,0|f09drz,94,195,0|f09ds0,95,192,1|f99gfz,95,192,1|f99gg0,94,195,0|fizgfz,94,195,0|fizgg0,95,192,1|frzj3z,95,192,1|frzj40,94,195,0|fzwprz,94,195,0|fzwps0,95,192,1|gaplrz,95,192,1|gapls0,94,195,0|gkskfz,94,195,0|gkskg0,95,192,1|gtsn3z,95,192,1|gtsn40,94,195,0|h3in3z,94,195,0|h3in40,95,192,1|hciprz,95,192,1|hcips0,94,195,0|hm8prz,94,195,0|hm8ps0,95,192,1|hv8sfz,95,192,1|hv8sg0,94,195,0|i4ysfz,94,195,0|i4ysg0,95,192,1|idyv3z,95,192,1|idyv40,94,195,0|inov3z,94,195,0|inov40,95,192,1|ix1wfz,95,192,1|ix1wg0,94,195,0|j6exrz,94,195,0|j6exs0,95,192,1|jff0fz,95,192,1|jff0g0,94,195,0|jphz3z,94,195,0|jphz40,95,192,1|jyv0fz,95,192,1|jyv0g0,94,195,0|k881rz,94,195,0|k881s0,95,192,1|khl33z,95,192,1|khl340,94,195,0|kqy4fz,94,195,0|kqy4g0,95,192,1|l0b5rz,95,192,1|l0b5s0,94,195,0|l9o73z,94,195,0|l9o740,95,192,1|lj18fz,95,192,1|lj18g0,94,195,0|lse9rz,94,195,0|lse9s0,95,192,1|m1rb3z,95,192,1|m1rb40,94,195,0|mbhb3z,94,195,0|mbhb40,95,192,1|mkucfz,95,192,1|mkucg0,94,195,0|mu7drz,94,195,0|mu7ds0,95,192,1|n3kf3z,95,192,1|n3kf40,94,195,0|ncxgfz,94,195,0|ncxgg0,95,192,1|nmahrz,95,192,1|nmahs0,94,195,0|nvnj3z,94,195,0|nvnj40,95,192,1|o50kfz,95,192,1|o50kg0,94,195,0|oedlrz,94,195,0|oedls0,95,192,1|onqn3z,95,192,1|onqn40,94,195,0|ox3ofz,94,195,0|ox3og0,95,192,1|p6gprz,95,192,1|p6gps0,94,195,0|pg6prz,94,195,0|pg6ps0,95,192,1|ppjr3z,95,192,1|ppjr40,94,195,0|pywsfz,94,195,0|pywsg0,95,192,1|q89trz,95,192,1|q89ts0,94,195,0|qhmv3z,94,195,0|qhmv40,95,192,1|qqzwfz,95,192,1|qqzwg0,94,195,0|r0cxrz,94,195,0|r0cxs0,95,192,1|r9pz3z,95,192,1|r9pz40,94,195,0|rj30fz,94,195,0|rj30g0,95,192,1|rsg1rz,95,192,1|rsg1s0,94,195,0|s1t33z,94,195,0|s1t340,95,192,1|sbj33z,95,192,1|sbj340,94,195,0|skw4fz,94,195,0|skw4g0,95,192,1|su95rz,95,192,1|su95s0,94,195,0|t3m73z,94,195,0|t3m740,95,192,1|tcz8fz,95,192,1|tcz8g0,94,195,0|tmc9rz,94,195,0|tmc9s0,95,192,1|tvpb3z,95,192,1|tvpb40,94,195,0|u52cfz,94,195,0|u52cg0,95,192,1|uefdrz,95,192,1|uefds0,94,195,0|unsf3z,94,195,0|unsf40,95,192,1|ux5gfz,95,192,1|ux5gg0,94,195,0|v6vgfz,94,195,0|v6vgg0,95,192,1|vg8hrz,95,192,1|vg8hs0,94,195,0|vplj3z,94,195,0|vplj40,95,192,1|vyykfz,95,192,1|vyykg0,94,195,0|w8blrz,94,195,0|w8bls0,95,192,1|whon3z,95,192,1|whon40,94,195,0|wr1ofz,94,195,0|wr1og0,95,192,1|x0eprz,95,192,1|x0eps0,94,195,0|x9rr3z,94,195,0|x9rr40,95,192,1|xj4sfz,95,192,1|xj4sg0,94,195,0|xshtrz,94,195,0|xshts0,95,192,1|y1uv3z,95,192,1|y1uv40,94,195,0|ybkv3z,94,195,0|ybkv40,95,192,1|ykxwfz,95,192,1|ykxwg0,94,195,0|yuaxrz,94,195,0|yuaxs0,95,192,1|z3nz3z,95,192,1|z3nz40,94,195,0|zd10fz,94,195,0|zd10g0,95,192,1\",\"Australia/Darwin|,0,317,0|-133j1k8,138,224,0|-10vsp01,138,224,0|-10vsp00,138,248,0|-rnsq61,138,248,0|-rnsq60,139,313,1|-rjj0u1,139,313,1|-rjj0u0,138,248,0|-em3gu1,138,248,0|-em3gu0,139,313,1|-ehmcu1,139,313,1|-ehmcu0,138,248,0|-e89bi1,138,248,0|-e89bi0,139,313,1|-dywa61,139,313,1|-dywa60,138,248,0|-dp6a61,138,248,0|-dp6a60,139,313,1|-dg67i1,139,313,1|-dg67i0,138,248,0\",\"Australia/Eucla|,0,318,0|-12nxx74,140,319,0|-rnso31,140,319,0|-rnso30,141,320,1|-rjiyr1,141,320,1|-rjiyr0,140,319,0|-em3er1,140,319,0|-em3er0,141,320,1|-ehmar1,141,320,1|-ehmar0,140,319,0|-e899f1,140,319,0|-e899f0,141,320,1|-dyw831,141,320,1|-dyw830,140,319,0|2iiqkz,140,319,0|2iiql0,141,320,1|2p02kz,141,320,1|2p02l0,140,319,0|77rbwz,140,319,0|77rbx0,141,320,1|7e8nwz,141,320,1|7e8nx0,140,319,0|bezrwz,140,319,0|bezrx0,141,320,1|bke7wz,141,320,1|bke7x0,140,319,0|j9np8z,140,319,0|j9np90,141,320,1|jff3wz,141,320,1|jff3x0,140,319,0|jqkykz,140,319,0|jqkyl0,141,320,1|jyi58z,141,320,1|jyi590,140,319,0|k9b18z,140,319,0|k9b190,141,320,1|kh87wz,141,320,1|kh87x0,140,319,0\",\"Australia/Hobart|,0,316,0|-12smja4,94,195,0|-rsj4w1,94,195,0|-rsj4w0,95,192,1|-rjj281,95,192,1|-rjj280,94,195,0|-r8d7k1,94,195,0|-r8d7k0,95,192,1|-r1vvk1,95,192,1|-r1vvk0,94,195,0|-qpn4w1,94,195,0|-qpn4w0,95,192,1|-qj5sw1,95,192,1|-qj5sw0,94,195,0|-em3i81,94,195,0|-em3i80,95,192,1|-ehme81,95,192,1|-ehme80,94,195,0|-e89cw1,94,195,0|-e89cw0,95,192,1|-dywbk1,95,192,1|-dywbk0,94,195,0|-dp6bk1,94,195,0|-dp6bk0,95,192,1|-dg68w1,95,192,1|-dg68w0,94,195,0|-16cow1,94,195,0|-16cow0,95,192,1|-wznk1,95,192,1|-wznk0,94,195,0|-m6rk1,94,195,0|-m6rk0,95,192,1|-fcgw1,95,192,1|-fcgw0,94,195,0|-3gow1,94,195,0|-3gow0,95,192,1|3dlrz,95,192,1|3dls0,94,195,0|f9drz,94,195,0|f9ds0,95,192,1|mgn3z,95,192,1|mgn40,94,195,0|ycf3z,94,195,0|ycf40,95,192,1|14gsfz,95,192,1|14gsg0,94,195,0|1h2hrz,94,195,0|1h2hs0,95,192,1|1njtrz,95,192,1|1njts0,94,195,0|1zskfz,94,195,0|1zskg0,95,192,1|269wfz,95,192,1|269wg0,94,195,0|2iin3z,94,195,0|2iin40,95,192,1|2ozz3z,95,192,1|2ozz40,94,195,0|318prz,94,195,0|318ps0,95,192,1|3830fz,95,192,1|3830g0,94,195,0|3kbr3z,94,195,0|3kbr40,95,192,1|3qt33z,95,192,1|3qt340,94,195,0|431trz,94,195,0|431ts0,95,192,1|49j5rz,95,192,1|49j5s0,94,195,0|4lrwfz,94,195,0|4lrwg0,95,192,1|4s98fz,95,192,1|4s98g0,94,195,0|54hz3z,94,195,0|54hz40,95,192,1|5azb3z,95,192,1|5azb40,94,195,0|5n81rz,94,195,0|5n81s0,95,192,1|5tpdrz,95,192,1|5tpds0,94,195,0|65y4fz,94,195,0|65y4g0,95,192,1|6dvb3z,95,192,1|6dvb40,94,195,0|6p15rz,94,195,0|6p15s0,95,192,1|6wldrz,95,192,1|6wlds0,94,195,0|77r8fz,94,195,0|77r8g0,95,192,1|7e8kfz,95,192,1|7e8kg0,94,195,0|7qhb3z,94,195,0|7qhb40,95,192,1|7wyn3z,95,192,1|7wyn40,94,195,0|897drz,94,195,0|897ds0,95,192,1|8foprz,95,192,1|8fops0,94,195,0|8rkhrz,94,195,0|8rkhs0,95,192,1|8z4prz,95,192,1|8z4ps0,94,195,0|9anj3z,94,195,0|9anj40,95,192,1|9i7r3z,95,192,1|9i7r40,94,195,0|9tqkfz,94,195,0|9tqkg0,95,192,1|a0xtrz,95,192,1|a0xts0,94,195,0|acgn3z,94,195,0|acgn40,95,192,1|ajnwfz,95,192,1|ajnwg0,94,195,0|av6prz,94,195,0|av6ps0,95,192,1|b33wfz,95,192,1|b33wg0,94,195,0|bctwfz,94,195,0|bctwg0,95,192,1|bltz3z,95,192,1|bltz40,94,195,0|bvjz3z,94,195,0|bvjz40,95,192,1|c4k1rz,95,192,1|c4k1s0,94,195,0|cea1rz,94,195,0|cea1s0,95,192,1|cna4fz,95,192,1|cna4g0,94,195,0|cx04fz,94,195,0|cx04g0,95,192,1|d6073z,95,192,1|d60740,94,195,0|dfq73z,94,195,0|dfq740,95,192,1|dp38fz,95,192,1|dp38g0,94,195,0|dyt8fz,94,195,0|dyt8g0,95,192,1|e7tb3z,95,192,1|e7tb40,94,195,0|ehjb3z,94,195,0|ehjb40,95,192,1|eqjdrz,95,192,1|eqjds0,94,195,0|f09drz,94,195,0|f09ds0,95,192,1|f99gfz,95,192,1|f99gg0,94,195,0|fizgfz,94,195,0|fizgg0,95,192,1|frzj3z,95,192,1|frzj40,94,195,0|fzwprz,94,195,0|fzwps0,95,192,1|gaplrz,95,192,1|gapls0,94,195,0|gkskfz,94,195,0|gkskg0,95,192,1|gtsn3z,95,192,1|gtsn40,94,195,0|h3in3z,94,195,0|h3in40,95,192,1|hciprz,95,192,1|hcips0,94,195,0|hm8prz,94,195,0|hm8ps0,95,192,1|hv8sfz,95,192,1|hv8sg0,94,195,0|i4ysfz,94,195,0|i4ysg0,95,192,1|idyv3z,95,192,1|idyv40,94,195,0|inov3z,94,195,0|inov40,95,192,1|ix1wfz,95,192,1|ix1wg0,94,195,0|j6exrz,94,195,0|j6exs0,95,192,1|jff0fz,95,192,1|jff0g0,94,195,0|jphz3z,94,195,0|jphz40,95,192,1|jyv0fz,95,192,1|jyv0g0,94,195,0|k881rz,94,195,0|k881s0,95,192,1|khl33z,95,192,1|khl340,94,195,0|kqy4fz,94,195,0|kqy4g0,95,192,1|l0b5rz,95,192,1|l0b5s0,94,195,0|l9o73z,94,195,0|l9o740,95,192,1|lj18fz,95,192,1|lj18g0,94,195,0|lse9rz,94,195,0|lse9s0,95,192,1|m1rb3z,95,192,1|m1rb40,94,195,0|mbhb3z,94,195,0|mbhb40,95,192,1|mkucfz,95,192,1|mkucg0,94,195,0|mu7drz,94,195,0|mu7ds0,95,192,1|n3kf3z,95,192,1|n3kf40,94,195,0|ncxgfz,94,195,0|ncxgg0,95,192,1|nmahrz,95,192,1|nmahs0,94,195,0|nvnj3z,94,195,0|nvnj40,95,192,1|o50kfz,95,192,1|o50kg0,94,195,0|oedlrz,94,195,0|oedls0,95,192,1|onqn3z,95,192,1|onqn40,94,195,0|ox3ofz,94,195,0|ox3og0,95,192,1|p6gprz,95,192,1|p6gps0,94,195,0|pg6prz,94,195,0|pg6ps0,95,192,1|ppjr3z,95,192,1|ppjr40,94,195,0|pywsfz,94,195,0|pywsg0,95,192,1|q89trz,95,192,1|q89ts0,94,195,0|qhmv3z,94,195,0|qhmv40,95,192,1|qqzwfz,95,192,1|qqzwg0,94,195,0|r0cxrz,94,195,0|r0cxs0,95,192,1|r9pz3z,95,192,1|r9pz40,94,195,0|rj30fz,94,195,0|rj30g0,95,192,1|rsg1rz,95,192,1|rsg1s0,94,195,0|s1t33z,94,195,0|s1t340,95,192,1|sbj33z,95,192,1|sbj340,94,195,0|skw4fz,94,195,0|skw4g0,95,192,1|su95rz,95,192,1|su95s0,94,195,0|t3m73z,94,195,0|t3m740,95,192,1|tcz8fz,95,192,1|tcz8g0,94,195,0|tmc9rz,94,195,0|tmc9s0,95,192,1|tvpb3z,95,192,1|tvpb40,94,195,0|u52cfz,94,195,0|u52cg0,95,192,1|uefdrz,95,192,1|uefds0,94,195,0|unsf3z,94,195,0|unsf40,95,192,1|ux5gfz,95,192,1|ux5gg0,94,195,0|v6vgfz,94,195,0|v6vgg0,95,192,1|vg8hrz,95,192,1|vg8hs0,94,195,0|vplj3z,94,195,0|vplj40,95,192,1|vyykfz,95,192,1|vyykg0,94,195,0|w8blrz,94,195,0|w8bls0,95,192,1|whon3z,95,192,1|whon40,94,195,0|wr1ofz,94,195,0|wr1og0,95,192,1|x0eprz,95,192,1|x0eps0,94,195,0|x9rr3z,94,195,0|x9rr40,95,192,1|xj4sfz,95,192,1|xj4sg0,94,195,0|xshtrz,94,195,0|xshts0,95,192,1|y1uv3z,95,192,1|y1uv40,94,195,0|ybkv3z,94,195,0|ybkv40,95,192,1|ykxwfz,95,192,1|ykxwg0,94,195,0|yuaxrz,94,195,0|yuaxs0,95,192,1|z3nz3z,95,192,1|z3nz40,94,195,0|zd10fz,94,195,0|zd10g0,95,192,1\",\"Australia/Lindeman|,0,321,0|-1354jl8,94,195,0|-rnsrk1,94,195,0|-rnsrk0,95,192,1|-rjj281,95,192,1|-rjj280,94,195,0|-em3i81,94,195,0|-em3i80,95,192,1|-ehme81,95,192,1|-ehme80,94,195,0|-e89cw1,94,195,0|-e89cw0,95,192,1|-dywbk1,95,192,1|-dywbk0,94,195,0|-dp6bk1,94,195,0|-dp6bk0,95,192,1|-dg68w1,95,192,1|-dg68w0,94,195,0|ycf3z,94,195,0|ycf40,95,192,1|14gsfz,95,192,1|14gsg0,94,195,0|acgn3z,94,195,0|acgn40,95,192,1|aixz3z,95,192,1|aixz40,94,195,0|av6prz,94,195,0|av6ps0,95,192,1|b1o1rz,95,192,1|b1o1s0,94,195,0|bdwsfz,94,195,0|bdwsg0,95,192,1|bke4fz,95,192,1|bke4g0,94,195,0|bwmv3z,94,195,0|bwmv40,95,192,1|c3h5rz,95,192,1|c3h5s0,94,195,0|cfpwfz,94,195,0|cfpwg0,95,192,1|cm78fz,95,192,1|cm78g0,94,195,0\",\"Australia/Lord_Howe|,0,322,0|-133j6sk,94,195,0|5tp87z,94,195,0|5tp880,142,313,0|65y31z,142,313,0|65y320,143,198,1|6csaxz,143,198,1|6csay0,142,313,0|6p14dz,142,313,0|6p14e0,143,198,1|6vidlz,143,198,1|6vidm0,142,313,0|77r71z,142,313,0|77r720,143,198,1|7e8g9z,143,198,1|7e8ga0,142,313,0|7qh9pz,142,313,0|7qh9q0,143,198,1|7wyixz,143,198,1|7wyiy0,142,313,0|897cdz,142,313,0|897ce0,90,192,1|8gekbz,90,192,1|8gekc0,142,313,0|8rkgdz,142,313,0|8rkge0,90,192,1|8z4mzz,90,192,1|8z4n00,142,313,0|9anhpz,142,313,0|9anhq0,90,192,1|9i7obz,90,192,1|9i7oc0,142,313,0|9tqj1z,142,313,0|9tqj20,90,192,1|a0xqzz,90,192,1|a0xr00,142,313,0|acglpz,142,313,0|acglq0,90,192,1|aixwbz,90,192,1|aixwc0,142,313,0|av6odz,142,313,0|av6oe0,90,192,1|b1nyzz,90,192,1|b1nz00,142,313,0|bdwr1z,142,313,0|bdwr20,90,192,1|bke1nz,90,192,1|bke1o0,142,313,0|bwmtpz,142,313,0|bwmtq0,90,192,1|c3h2zz,90,192,1|c3h300,142,313,0|cfpv1z,142,313,0|cfpv20,90,192,1|cm75nz,90,192,1|cm75o0,142,313,0|cyfxpz,142,313,0|cyfxq0,90,192,1|d4x8bz,90,192,1|d4x8c0,142,313,0|dh60dz,142,313,0|dh60e0,90,192,1|dp35nz,90,192,1|dp35o0,142,313,0|dzw31z,142,313,0|dzw320,90,192,1|e7t8bz,90,192,1|e7t8c0,142,313,0|eim5pz,142,313,0|eim5q0,90,192,1|eqjazz,90,192,1|eqjb00,142,313,0|f1c8dz,142,313,0|f1c8e0,90,192,1|f99dnz,90,192,1|f99do0,142,313,0|fkf9pz,142,313,0|fkf9q0,90,192,1|frzgbz,90,192,1|frzgc0,142,313,0|fzwodz,142,313,0|fzwoe0,90,192,1|gapizz,90,192,1|gapj00,142,313,0|glvf1z,142,313,0|glvf20,90,192,1|gtskbz,90,192,1|gtskc0,142,313,0|h4lhpz,142,313,0|h4lhq0,90,192,1|hcimzz,90,192,1|hcin00,142,313,0|hnbkdz,142,313,0|hnbke0,90,192,1|hv8pnz,90,192,1|hv8po0,142,313,0|i6elpz,142,313,0|i6elq0,90,192,1|idysbz,90,192,1|idysc0,142,313,0|ip4odz,142,313,0|ip4oe0,90,192,1|ix1tnz,90,192,1|ix1to0,142,313,0|j7ur1z,142,313,0|j7ur20,90,192,1|jfexnz,90,192,1|jfexo0,142,313,0|jqktpz,142,313,0|jqktq0,90,192,1|jyuxnz,90,192,1|jyuxo0,142,313,0|k880dz,142,313,0|k880e0,90,192,1|khl0bz,90,192,1|khl0c0,142,313,0|kqy31z,142,313,0|kqy320,90,192,1|l0b2zz,90,192,1|l0b300,142,313,0|l9o5pz,142,313,0|l9o5q0,90,192,1|lj15nz,90,192,1|lj15o0,142,313,0|lse8dz,142,313,0|lse8e0,90,192,1|m1r8bz,90,192,1|m1r8c0,142,313,0|mbh9pz,142,313,0|mbh9q0,90,192,1|mku9nz,90,192,1|mku9o0,142,313,0|mu7cdz,142,313,0|mu7ce0,90,192,1|n3kcbz,90,192,1|n3kcc0,142,313,0|ncxf1z,142,313,0|ncxf20,90,192,1|nmaezz,90,192,1|nmaf00,142,313,0|nvnhpz,142,313,0|nvnhq0,90,192,1|o50hnz,90,192,1|o50ho0,142,313,0|oedkdz,142,313,0|oedke0,90,192,1|onqkbz,90,192,1|onqkc0,142,313,0|ox3n1z,142,313,0|ox3n20,90,192,1|p6gmzz,90,192,1|p6gn00,142,313,0|pg6odz,142,313,0|pg6oe0,90,192,1|ppjobz,90,192,1|ppjoc0,142,313,0|pywr1z,142,313,0|pywr20,90,192,1|q89qzz,90,192,1|q89r00,142,313,0|qhmtpz,142,313,0|qhmtq0,90,192,1|qqztnz,90,192,1|qqzto0,142,313,0|r0cwdz,142,313,0|r0cwe0,90,192,1|r9pwbz,90,192,1|r9pwc0,142,313,0|rj2z1z,142,313,0|rj2z20,90,192,1|rsfyzz,90,192,1|rsfz00,142,313,0|s1t1pz,142,313,0|s1t1q0,90,192,1|sbj0bz,90,192,1|sbj0c0,142,313,0|skw31z,142,313,0|skw320,90,192,1|su92zz,90,192,1|su9300,142,313,0|t3m5pz,142,313,0|t3m5q0,90,192,1|tcz5nz,90,192,1|tcz5o0,142,313,0|tmc8dz,142,313,0|tmc8e0,90,192,1|tvp8bz,90,192,1|tvp8c0,142,313,0|u52b1z,142,313,0|u52b20,90,192,1|uefazz,90,192,1|uefb00,142,313,0|unsdpz,142,313,0|unsdq0,90,192,1|ux5dnz,90,192,1|ux5do0,142,313,0|v6vf1z,142,313,0|v6vf20,90,192,1|vg8ezz,90,192,1|vg8f00,142,313,0|vplhpz,142,313,0|vplhq0,90,192,1|vyyhnz,90,192,1|vyyho0,142,313,0|w8bkdz,142,313,0|w8bke0,90,192,1|whokbz,90,192,1|whokc0,142,313,0|wr1n1z,142,313,0|wr1n20,90,192,1|x0emzz,90,192,1|x0en00,142,313,0|x9rppz,142,313,0|x9rpq0,90,192,1|xj4pnz,90,192,1|xj4po0,142,313,0|xshsdz,142,313,0|xshse0,90,192,1|y1usbz,90,192,1|y1usc0,142,313,0|ybktpz,142,313,0|ybktq0,90,192,1|ykxtnz,90,192,1|ykxto0,142,313,0|yuawdz,142,313,0|yuawe0,90,192,1|z3nwbz,90,192,1|z3nwc0,142,313,0|zd0z1z,142,313,0|zd0z20,90,192,1\",\"Australia/Melbourne|,0,323,0|-133j46g,94,195,0|-rnsrk1,94,195,0|-rnsrk0,95,192,1|-rjj281,95,192,1|-rjj280,94,195,0|-em3i81,94,195,0|-em3i80,95,192,1|-ehme81,95,192,1|-ehme80,94,195,0|-e89cw1,94,195,0|-e89cw0,95,192,1|-dywbk1,95,192,1|-dywbk0,94,195,0|-dp6bk1,94,195,0|-dp6bk0,95,192,1|-dg68w1,95,192,1|-dg68w0,94,195,0|ycf3z,94,195,0|ycf40,95,192,1|14gsfz,95,192,1|14gsg0,94,195,0|1h2hrz,94,195,0|1h2hs0,95,192,1|1njtrz,95,192,1|1njts0,94,195,0|1zskfz,94,195,0|1zskg0,95,192,1|269wfz,95,192,1|269wg0,94,195,0|2iin3z,94,195,0|2iin40,95,192,1|2ozz3z,95,192,1|2ozz40,94,195,0|318prz,94,195,0|318ps0,95,192,1|3830fz,95,192,1|3830g0,94,195,0|3kbr3z,94,195,0|3kbr40,95,192,1|3qt33z,95,192,1|3qt340,94,195,0|431trz,94,195,0|431ts0,95,192,1|49j5rz,95,192,1|49j5s0,94,195,0|4lrwfz,94,195,0|4lrwg0,95,192,1|4s98fz,95,192,1|4s98g0,94,195,0|54hz3z,94,195,0|54hz40,95,192,1|5azb3z,95,192,1|5azb40,94,195,0|5n81rz,94,195,0|5n81s0,95,192,1|5tpdrz,95,192,1|5tpds0,94,195,0|65y4fz,94,195,0|65y4g0,95,192,1|6csf3z,95,192,1|6csf40,94,195,0|6p15rz,94,195,0|6p15s0,95,192,1|6vihrz,95,192,1|6vihs0,94,195,0|77r8fz,94,195,0|77r8g0,95,192,1|7e8kfz,95,192,1|7e8kg0,94,195,0|7qhb3z,94,195,0|7qhb40,95,192,1|7wyn3z,95,192,1|7wyn40,94,195,0|897drz,94,195,0|897ds0,95,192,1|8gen3z,95,192,1|8gen40,94,195,0|8rkhrz,94,195,0|8rkhs0,95,192,1|8z4prz,95,192,1|8z4ps0,94,195,0|9aakfz,94,195,0|9aakg0,95,192,1|9i7r3z,95,192,1|9i7r40,94,195,0|9tqkfz,94,195,0|9tqkg0,95,192,1|a0xtrz,95,192,1|a0xts0,94,195,0|acgn3z,94,195,0|acgn40,95,192,1|ajnwfz,95,192,1|ajnwg0,94,195,0|av6prz,94,195,0|av6ps0,95,192,1|b1o1rz,95,192,1|b1o1s0,94,195,0|bdwsfz,94,195,0|bdwsg0,95,192,1|bke4fz,95,192,1|bke4g0,94,195,0|bwmv3z,94,195,0|bwmv40,95,192,1|c3h5rz,95,192,1|c3h5s0,94,195,0|cfpwfz,94,195,0|cfpwg0,95,192,1|cm78fz,95,192,1|cm78g0,94,195,0|cyfz3z,94,195,0|cyfz40,95,192,1|d6073z,95,192,1|d60740,94,195,0|dh61rz,94,195,0|dh61s0,95,192,1|dp38fz,95,192,1|dp38g0,94,195,0|dzw4fz,94,195,0|dzw4g0,95,192,1|e7tb3z,95,192,1|e7tb40,94,195,0|eim73z,94,195,0|eim740,95,192,1|eqjdrz,95,192,1|eqjds0,94,195,0|f1c9rz,94,195,0|f1c9s0,95,192,1|f99gfz,95,192,1|f99gg0,94,195,0|fkfb3z,94,195,0|fkfb40,95,192,1|frzj3z,95,192,1|frzj40,94,195,0|fzwprz,94,195,0|fzwps0,95,192,1|gaplrz,95,192,1|gapls0,94,195,0|glvgfz,94,195,0|glvgg0,95,192,1|gtsn3z,95,192,1|gtsn40,94,195,0|h4lj3z,94,195,0|h4lj40,95,192,1|hciprz,95,192,1|hcips0,94,195,0|hnblrz,94,195,0|hnbls0,95,192,1|hv8sfz,95,192,1|hv8sg0,94,195,0|i6en3z,94,195,0|i6en40,95,192,1|idyv3z,95,192,1|idyv40,94,195,0|ip4prz,94,195,0|ip4ps0,95,192,1|ix1wfz,95,192,1|ix1wg0,94,195,0|j7usfz,94,195,0|j7usg0,95,192,1|jff0fz,95,192,1|jff0g0,94,195,0|jqkv3z,94,195,0|jqkv40,95,192,1|jyv0fz,95,192,1|jyv0g0,94,195,0|k881rz,94,195,0|k881s0,95,192,1|khl33z,95,192,1|khl340,94,195,0|kqy4fz,94,195,0|kqy4g0,95,192,1|l0b5rz,95,192,1|l0b5s0,94,195,0|l9o73z,94,195,0|l9o740,95,192,1|lj18fz,95,192,1|lj18g0,94,195,0|lse9rz,94,195,0|lse9s0,95,192,1|m1rb3z,95,192,1|m1rb40,94,195,0|mbhb3z,94,195,0|mbhb40,95,192,1|mkucfz,95,192,1|mkucg0,94,195,0|mu7drz,94,195,0|mu7ds0,95,192,1|n3kf3z,95,192,1|n3kf40,94,195,0|ncxgfz,94,195,0|ncxgg0,95,192,1|nmahrz,95,192,1|nmahs0,94,195,0|nvnj3z,94,195,0|nvnj40,95,192,1|o50kfz,95,192,1|o50kg0,94,195,0|oedlrz,94,195,0|oedls0,95,192,1|onqn3z,95,192,1|onqn40,94,195,0|ox3ofz,94,195,0|ox3og0,95,192,1|p6gprz,95,192,1|p6gps0,94,195,0|pg6prz,94,195,0|pg6ps0,95,192,1|ppjr3z,95,192,1|ppjr40,94,195,0|pywsfz,94,195,0|pywsg0,95,192,1|q89trz,95,192,1|q89ts0,94,195,0|qhmv3z,94,195,0|qhmv40,95,192,1|qqzwfz,95,192,1|qqzwg0,94,195,0|r0cxrz,94,195,0|r0cxs0,95,192,1|r9pz3z,95,192,1|r9pz40,94,195,0|rj30fz,94,195,0|rj30g0,95,192,1|rsg1rz,95,192,1|rsg1s0,94,195,0|s1t33z,94,195,0|s1t340,95,192,1|sbj33z,95,192,1|sbj340,94,195,0|skw4fz,94,195,0|skw4g0,95,192,1|su95rz,95,192,1|su95s0,94,195,0|t3m73z,94,195,0|t3m740,95,192,1|tcz8fz,95,192,1|tcz8g0,94,195,0|tmc9rz,94,195,0|tmc9s0,95,192,1|tvpb3z,95,192,1|tvpb40,94,195,0|u52cfz,94,195,0|u52cg0,95,192,1|uefdrz,95,192,1|uefds0,94,195,0|unsf3z,94,195,0|unsf40,95,192,1|ux5gfz,95,192,1|ux5gg0,94,195,0|v6vgfz,94,195,0|v6vgg0,95,192,1|vg8hrz,95,192,1|vg8hs0,94,195,0|vplj3z,94,195,0|vplj40,95,192,1|vyykfz,95,192,1|vyykg0,94,195,0|w8blrz,94,195,0|w8bls0,95,192,1|whon3z,95,192,1|whon40,94,195,0|wr1ofz,94,195,0|wr1og0,95,192,1|x0eprz,95,192,1|x0eps0,94,195,0|x9rr3z,94,195,0|x9rr40,95,192,1|xj4sfz,95,192,1|xj4sg0,94,195,0|xshtrz,94,195,0|xshts0,95,192,1|y1uv3z,95,192,1|y1uv40,94,195,0|ybkv3z,94,195,0|ybkv40,95,192,1|ykxwfz,95,192,1|ykxwg0,94,195,0|yuaxrz,94,195,0|yuaxs0,95,192,1|z3nz3z,95,192,1|z3nz40,94,195,0|zd10fz,94,195,0|zd10g0,95,192,1\",\"Australia/Perth|,0,324,0|-12nxusc,144,191,0|-rnsm01,144,191,0|-rnsm00,145,224,1|-rjiwo1,145,224,1|-rjiwo0,144,191,0|-em3co1,144,191,0|-em3co0,145,224,1|-ehm8o1,145,224,1|-ehm8o0,144,191,0|-e897c1,144,191,0|-e897c0,145,224,1|-dyw601,145,224,1|-dyw600,144,191,0|2iisnz,144,191,0|2iiso0,145,224,1|2p04nz,145,224,1|2p04o0,144,191,0|77rdzz,144,191,0|77re00,145,224,1|7e8pzz,145,224,1|7e8q00,144,191,0|beztzz,144,191,0|bezu00,145,224,1|bke9zz,145,224,1|bkea00,144,191,0|j9nrbz,144,191,0|j9nrc0,145,224,1|jff5zz,145,224,1|jff600,144,191,0|jql0nz,144,191,0|jql0o0,145,224,1|jyi7bz,145,224,1|jyi7c0,144,191,0|k9b3bz,144,191,0|k9b3c0,145,224,1|kh89zz,145,224,1|kh8a00,144,191,0\",\"Australia/Sydney|,0,325,0|-133j5c4,94,195,0|-rnsrk1,94,195,0|-rnsrk0,95,192,1|-rjj281,95,192,1|-rjj280,94,195,0|-em3i81,94,195,0|-em3i80,95,192,1|-ehme81,95,192,1|-ehme80,94,195,0|-e89cw1,94,195,0|-e89cw0,95,192,1|-dywbk1,95,192,1|-dywbk0,94,195,0|-dp6bk1,94,195,0|-dp6bk0,95,192,1|-dg68w1,95,192,1|-dg68w0,94,195,0|ycf3z,94,195,0|ycf40,95,192,1|14gsfz,95,192,1|14gsg0,94,195,0|1h2hrz,94,195,0|1h2hs0,95,192,1|1njtrz,95,192,1|1njts0,94,195,0|1zskfz,94,195,0|1zskg0,95,192,1|269wfz,95,192,1|269wg0,94,195,0|2iin3z,94,195,0|2iin40,95,192,1|2ozz3z,95,192,1|2ozz40,94,195,0|318prz,94,195,0|318ps0,95,192,1|3830fz,95,192,1|3830g0,94,195,0|3kbr3z,94,195,0|3kbr40,95,192,1|3qt33z,95,192,1|3qt340,94,195,0|431trz,94,195,0|431ts0,95,192,1|49j5rz,95,192,1|49j5s0,94,195,0|4lrwfz,94,195,0|4lrwg0,95,192,1|4s98fz,95,192,1|4s98g0,94,195,0|54hz3z,94,195,0|54hz40,95,192,1|5azb3z,95,192,1|5azb40,94,195,0|5n81rz,94,195,0|5n81s0,95,192,1|5tpdrz,95,192,1|5tpds0,94,195,0|65y4fz,94,195,0|65y4g0,95,192,1|6e89rz,95,192,1|6e89s0,94,195,0|6p15rz,94,195,0|6p15s0,95,192,1|6vihrz,95,192,1|6vihs0,94,195,0|77r8fz,94,195,0|77r8g0,95,192,1|7e8kfz,95,192,1|7e8kg0,94,195,0|7qhb3z,94,195,0|7qhb40,95,192,1|7wyn3z,95,192,1|7wyn40,94,195,0|897drz,94,195,0|897ds0,95,192,1|8gen3z,95,192,1|8gen40,94,195,0|8rkhrz,94,195,0|8rkhs0,95,192,1|8z4prz,95,192,1|8z4ps0,94,195,0|9anj3z,94,195,0|9anj40,95,192,1|9i7r3z,95,192,1|9i7r40,94,195,0|9tqkfz,94,195,0|9tqkg0,95,192,1|a0xtrz,95,192,1|a0xts0,94,195,0|acgn3z,94,195,0|acgn40,95,192,1|aixz3z,95,192,1|aixz40,94,195,0|av6prz,94,195,0|av6ps0,95,192,1|b1o1rz,95,192,1|b1o1s0,94,195,0|bdwsfz,94,195,0|bdwsg0,95,192,1|bke4fz,95,192,1|bke4g0,94,195,0|bwmv3z,94,195,0|bwmv40,95,192,1|c3h5rz,95,192,1|c3h5s0,94,195,0|cfpwfz,94,195,0|cfpwg0,95,192,1|cm78fz,95,192,1|cm78g0,94,195,0|cyfz3z,94,195,0|cyfz40,95,192,1|d4xb3z,95,192,1|d4xb40,94,195,0|dh61rz,94,195,0|dh61s0,95,192,1|dp38fz,95,192,1|dp38g0,94,195,0|dzw4fz,94,195,0|dzw4g0,95,192,1|e7tb3z,95,192,1|e7tb40,94,195,0|eim73z,94,195,0|eim740,95,192,1|eqjdrz,95,192,1|eqjds0,94,195,0|f1c9rz,94,195,0|f1c9s0,95,192,1|f99gfz,95,192,1|f99gg0,94,195,0|fkfb3z,94,195,0|fkfb40,95,192,1|frzj3z,95,192,1|frzj40,94,195,0|fzwprz,94,195,0|fzwps0,95,192,1|gaplrz,95,192,1|gapls0,94,195,0|glvgfz,94,195,0|glvgg0,95,192,1|gtsn3z,95,192,1|gtsn40,94,195,0|h4lj3z,94,195,0|h4lj40,95,192,1|hciprz,95,192,1|hcips0,94,195,0|hnblrz,94,195,0|hnbls0,95,192,1|hv8sfz,95,192,1|hv8sg0,94,195,0|i6en3z,94,195,0|i6en40,95,192,1|idyv3z,95,192,1|idyv40,94,195,0|ip4prz,94,195,0|ip4ps0,95,192,1|ix1wfz,95,192,1|ix1wg0,94,195,0|j7usfz,94,195,0|j7usg0,95,192,1|jff0fz,95,192,1|jff0g0,94,195,0|jqkv3z,94,195,0|jqkv40,95,192,1|jyv0fz,95,192,1|jyv0g0,94,195,0|k881rz,94,195,0|k881s0,95,192,1|khl33z,95,192,1|khl340,94,195,0|kqy4fz,94,195,0|kqy4g0,95,192,1|l0b5rz,95,192,1|l0b5s0,94,195,0|l9o73z,94,195,0|l9o740,95,192,1|lj18fz,95,192,1|lj18g0,94,195,0|lse9rz,94,195,0|lse9s0,95,192,1|m1rb3z,95,192,1|m1rb40,94,195,0|mbhb3z,94,195,0|mbhb40,95,192,1|mkucfz,95,192,1|mkucg0,94,195,0|mu7drz,94,195,0|mu7ds0,95,192,1|n3kf3z,95,192,1|n3kf40,94,195,0|ncxgfz,94,195,0|ncxgg0,95,192,1|nmahrz,95,192,1|nmahs0,94,195,0|nvnj3z,94,195,0|nvnj40,95,192,1|o50kfz,95,192,1|o50kg0,94,195,0|oedlrz,94,195,0|oedls0,95,192,1|onqn3z,95,192,1|onqn40,94,195,0|ox3ofz,94,195,0|ox3og0,95,192,1|p6gprz,95,192,1|p6gps0,94,195,0|pg6prz,94,195,0|pg6ps0,95,192,1|ppjr3z,95,192,1|ppjr40,94,195,0|pywsfz,94,195,0|pywsg0,95,192,1|q89trz,95,192,1|q89ts0,94,195,0|qhmv3z,94,195,0|qhmv40,95,192,1|qqzwfz,95,192,1|qqzwg0,94,195,0|r0cxrz,94,195,0|r0cxs0,95,192,1|r9pz3z,95,192,1|r9pz40,94,195,0|rj30fz,94,195,0|rj30g0,95,192,1|rsg1rz,95,192,1|rsg1s0,94,195,0|s1t33z,94,195,0|s1t340,95,192,1|sbj33z,95,192,1|sbj340,94,195,0|skw4fz,94,195,0|skw4g0,95,192,1|su95rz,95,192,1|su95s0,94,195,0|t3m73z,94,195,0|t3m740,95,192,1|tcz8fz,95,192,1|tcz8g0,94,195,0|tmc9rz,94,195,0|tmc9s0,95,192,1|tvpb3z,95,192,1|tvpb40,94,195,0|u52cfz,94,195,0|u52cg0,95,192,1|uefdrz,95,192,1|uefds0,94,195,0|unsf3z,94,195,0|unsf40,95,192,1|ux5gfz,95,192,1|ux5gg0,94,195,0|v6vgfz,94,195,0|v6vgg0,95,192,1|vg8hrz,95,192,1|vg8hs0,94,195,0|vplj3z,94,195,0|vplj40,95,192,1|vyykfz,95,192,1|vyykg0,94,195,0|w8blrz,94,195,0|w8bls0,95,192,1|whon3z,95,192,1|whon40,94,195,0|wr1ofz,94,195,0|wr1og0,95,192,1|x0eprz,95,192,1|x0eps0,94,195,0|x9rr3z,94,195,0|x9rr40,95,192,1|xj4sfz,95,192,1|xj4sg0,94,195,0|xshtrz,94,195,0|xshts0,95,192,1|y1uv3z,95,192,1|y1uv40,94,195,0|ybkv3z,94,195,0|ybkv40,95,192,1|ykxwfz,95,192,1|ykxwg0,94,195,0|yuaxrz,94,195,0|yuaxs0,95,192,1|z3nz3z,95,192,1|z3nz40,94,195,0|zd10fz,94,195,0|zd10g0,95,192,1\",\"Etc/GMT+1|,199,15,0\",\"Etc/GMT+10|,208,36,0\",\"Etc/GMT+11|,209,35,0\",\"Etc/GMT+12|,210,403,0\",\"Etc/GMT+2|,200,45,0\",\"Etc/GMT+3|,201,44,0\",\"Etc/GMT+4|,202,42,0\",\"Etc/GMT+5|,203,63,0\",\"Etc/GMT+6|,204,62,0\",\"Etc/GMT+7|,205,66,0\",\"Etc/GMT+8|,206,40,0\",\"Etc/GMT+9|,207,37,0\",\"Etc/GMT-1|,198,10,0\",\"Etc/GMT-10|,189,195,0\",\"Etc/GMT-11|,188,192,0\",\"Etc/GMT-12|,187,200,0\",\"Etc/GMT-13|,186,201,0\",\"Etc/GMT-14|,185,207,0\",\"Etc/GMT-2|,197,11,0\",\"Etc/GMT-3|,196,6,0\",\"Etc/GMT-4|,195,209,0\",\"Etc/GMT-5|,194,194,0\",\"Etc/GMT-6|,193,196,0\",\"Etc/GMT-7|,192,193,0\",\"Etc/GMT-8|,191,191,0\",\"Etc/GMT-9|,190,224,0\",\"Europe/Amsterdam|,0,326,0|-1ygf4wk,44,326,0|-s0dvkl,44,326,0|-s0dvkk,24,327,1|-rsimcl,24,327,1|-rsimck,44,326,0|-ridkol,44,326,0|-ridkok,24,327,1|-rage0l,24,327,1|-rage0k,44,326,0|-r0dfcl,44,326,0|-r0dfck,24,327,1|-qr0e0l,24,327,1|-qr0e0k,44,326,0|-qhae0l,44,326,0|-qhae0k,24,327,1|-q8abcl,24,327,1|-q8abck,44,326,0|-pykbcl,44,326,0|-pykbck,24,327,1|-ppk8ol,24,327,1|-ppk8ok,44,326,0|-pfu8ol,44,326,0|-pfu8ok,24,327,1|-p6u60l,24,327,1|-p6u60k,44,326,0|-oxizcl,44,326,0|-oxizck,24,327,1|-ong0ol,24,327,1|-ong0ok,44,326,0|-obazcl,44,326,0|-obazck,24,327,1|-o4py0l,24,327,1|-o4py0k,44,326,0|-nvpvcl,44,326,0|-nvpvck,24,327,1|-nlzvcl,24,327,1|-nlzvck,44,326,0|-n9hvcl,44,326,0|-n9hvck,24,327,1|-n39sol,24,327,1|-n39sok,44,326,0|-mrsu0l,44,326,0|-mrsu0k,24,327,1|-mkjq0l,24,327,1|-mkjq0k,44,326,0|-m90wol,44,326,0|-m90wok,24,327,1|-m1tncl,24,327,1|-m1tnck,44,326,0|-lq74ol,44,326,0|-lq74ok,24,327,1|-liqm0l,24,327,1|-liqm0k,44,326,0|-l7f7cl,44,326,0|-l7f7ck,24,327,1|-l00jcl,24,327,1|-l00jck,44,326,0|-kona0l,44,326,0|-kona0k,24,327,1|-khagol,24,327,1|-khagok,44,326,0|-k5vcol,44,326,0|-k5vcok,24,327,1|-jyke0l,24,327,1|-jyke0k,44,326,0|-jmom0l,44,326,0|-jmom0k,24,327,1|-jfubcl,24,327,1|-jfubck,44,326,0|-j49ncl,44,326,0|-j49nck,24,327,1|-iwra0l,24,327,1|-iwra0k,44,326,0|-ilhq0l,44,326,0|-ilhq0k,24,327,1|-ie17cl,24,327,1|-ie17ck,44,326,0|-i2psol,44,326,0|-i2psok,24,327,1|-hvb4ol,24,327,1|-hvb4ok,44,326,0|-hjw0ol,44,326,0|-hjw0ok,24,327,1|-hcl20l,24,327,1|-hcl20k,44,326,0|-h0r4ol,44,326,0|-h0r4ok,24,327,1|-gypacl,24,327,1|-gypack,146,328,1|-gtuzdd,146,328,1|-gtuzdc,2,2,0|-gic61d,2,2,0|-gic61c,146,328,1|-gb4wpd,146,328,1|-gb4wpc,2,2,0|-fzk8pd,2,2,0|-fzk8pc,146,328,1|-fs1vdd,146,328,1|-fs1vdc,2,2,0|-fgorld,2,2,0|-fgorlc,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|3s9mrz,10,10,0|3s9ms0,11,11,1|419pfz,11,11,1|419pg0,10,10,0|4azpfz,10,10,0|4azpg0,11,11,1|4kcqrz,11,11,1|4kcqs0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Andorra|,0,329,0|-100edm4,8,1,0|-c4xmo1,8,1,0|-c4xmo0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Astrakhan|,0,330,0|-nu2zkc,100,6,0|-kmr4c1,100,6,0|-kmr4c0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,92,194,1|9ry7rz,92,194,1|9ry7s0,105,209,0|a1b93z,105,209,0|a1b940,105,209,1|aaod7z,105,209,1|aaod80,100,6,0|ak1ejz,100,6,0|ak1ek0,105,209,1|atrejz,105,209,1|atrek0,100,6,0|b34fvz,100,6,0|b34fw0,105,209,0|blufrz,105,209,0|blufs0,105,209,1|bv7jvz,105,209,1|bv7jw0,100,6,0|c4kl7z,100,6,0|c4kl80,105,209,1|cdxmjz,105,209,1|cdxmk0,100,6,0|cnanvz,100,6,0|cnanw0,105,209,1|cwnp7z,105,209,1|cwnp80,100,6,0|d60qjz,100,6,0|d60qk0,105,209,1|dfdrvz,105,209,1|dfdrw0,100,6,0|dp3rvz,100,6,0|dp3rw0,105,209,1|dzwnvz,105,209,1|dzwnw0,100,6,0|e7tujz,100,6,0|e7tuk0,105,209,1|eimqjz,105,209,1|eimqk0,100,6,0|eqjx7z,100,6,0|eqjx80,105,209,1|f1ct7z,105,209,1|f1ct80,100,6,0|f99zvz,100,6,0|f99zw0,105,209,1|fkfujz,105,209,1|fkfuk0,100,6,0|fs02jz,100,6,0|fs02k0,105,209,1|g35x7z,105,209,1|g35x80,100,6,0|gaq57z,100,6,0|gaq580,105,209,1|glvzvz,105,209,1|glvzw0,100,6,0|gtt6jz,100,6,0|gtt6k0,105,209,1|h4m2jz,105,209,1|h4m2k0,100,6,0|hcj97z,100,6,0|hcj980,105,209,1|hnc57z,105,209,1|hnc580,100,6,0|hv9bvz,100,6,0|hv9bw0,105,209,1|i6f6jz,105,209,1|i6f6k0,100,6,0|idzejz,100,6,0|idzek0,105,209,1|ip597z,105,209,1|ip5980,100,6,0|iwph7z,100,6,0|iwph80,105,209,1|j7vbvz,105,209,1|j7vbw0,100,6,0|jffjvz,100,6,0|jffjw0,105,209,1|jqlejz,105,209,1|jqlek0,100,6,0|jyil7z,100,6,0|jyil80,105,209,1|k9bh7z,105,209,1|k9bh80,100,6,0|kh8nvz,100,6,0|kh8nw0,105,209,1|ks1jvz,105,209,1|ks1jw0,100,6,0|kzyqjz,100,6,0|kzyqk0,105,209,1|lb4l7z,105,209,1|lb4l80,100,6,0|liot7z,100,6,0|liot80,105,209,0|ne0t3z,105,209,0|ne0t40,100,6,0|o4o57z,100,6,0|o4o580,105,209,0\",\"Europe/Athens|,0,331,0|-12rxtq4,44,331,0|-rvv0ch,44,331,0|-rvv0cg,15,11,0|-jkbpk1,15,11,0|-jkbpk0,16,6,1|-jhg301,16,6,1|-jhg300,15,11,0|-ezx6w1,15,11,0|-ezx6w0,16,6,1|-eyqoc1,16,6,1|-eyqoc0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dys2s1,10,10,0|-dys2s0,11,11,1|-dp4081,11,11,1|-dp4080,10,10,0|-dfp1g1,10,10,0|-dfp1g0,15,11,0|-94v1k1,15,11,0|-94v1k0,16,6,1|-8yhho1,16,6,1|-8yhho0,15,11,0|2r4d3z,15,11,0|2r4d40,16,6,1|32ul3z,16,6,1|32ul40,15,11,0|39wfzz,15,11,0|39wg00,16,6,1|3j9hbz,16,6,1|3j9hc0,15,11,0|3s9jzz,15,11,0|3s9k00,16,6,1|41bhbz,16,6,1|41bhc0,15,11,0|4azmnz,15,11,0|4azmo0,16,6,1|4jzs3z,16,6,1|4jzs40,15,11,0|4tq8rz,15,11,0|4tq8s0,16,6,1|530t7z,16,6,1|530t80,15,11,0|5cjbrz,15,11,0|5cjbs0,16,6,1|5lskzz,16,6,1|5lsl00,15,11,0|5v5xfz,15,11,0|5v5xg0,16,6,1|64iyrz,16,6,1|64iys0,15,11,0|6dw03z,15,11,0|6dw040,16,6,1|6n91fz,16,6,1|6n91g0,15,11,0|6wm2rz,15,11,0|6wm2s0,16,6,1|75z43z,16,6,1|75z440,15,11,0|7fc5fz,15,11,0|7fc5g0,16,6,1|7p25fz,16,6,1|7p25g0,15,11,0|7yf6rz,15,11,0|7yf6s0,16,6,1|87s83z,16,6,1|87s840,15,11,0|8h59fz,15,11,0|8h59g0,16,6,1|8qiarz,16,6,1|8qias0,15,11,0|8zvc3z,15,11,0|8zvc40,16,6,1|998dfz,16,6,1|998dg0,15,11,0|9ilerz,15,11,0|9iles0,16,6,1|9ryg3z,16,6,1|9ryg40,15,11,0|a1bhfz,15,11,0|a1bhg0,16,6,1|aaoirz,16,6,1|aaois0,15,11,0|ak1k3z,15,11,0|ak1k40,16,6,1|atrk3z,16,6,1|atrk40,15,11,0|b34lfz,15,11,0|b34lg0,16,6,1|bchmrz,16,6,1|bchms0,15,11,0|bluo3z,15,11,0|bluo40,16,6,1|bv7pfz,16,6,1|bv7pg0,15,11,0|c4kqrz,15,11,0|c4kqs0,16,6,1|cdxs3z,16,6,1|cdxs40,15,11,0|cnatfz,15,11,0|cnatg0,16,6,1|cwnurz,16,6,1|cwnus0,15,11,0|d60w3z,15,11,0|d60w40,16,6,1|dfdxfz,16,6,1|dfdxg0,15,11,0|dp3xfz,15,11,0|dp3xg0,16,6,1|dzwtfz,16,6,1|dzwtg0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Belgrade|,0,332,0|-18vsmgo,10,10,0|-ezayw1,10,10,0|-ezayw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cv5zw1,10,10,0|-cv5zw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Berlin|,0,333,0|-1421154,10,10,0|-s0e081,10,10,0|-s0e080,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-fizzw1,10,10,0|-fizzw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cucg01,11,11,1|-cucg00,147,6,1|-co0o01,147,6,1|-co0o00,11,11,1|-cl6qk1,11,11,1|-cl6qk0,10,10,0|-cdmik1,10,10,0|-cdmik0,11,11,1|-c4kl81,11,11,1|-c4kl80,10,10,0|-bv9bs1,10,10,0|-bv9bs0,11,11,1|-btgl81,11,11,1|-btgl80,147,6,1|-bqxxc1,147,6,1|-bqxxc0,11,11,1|-blwd81,11,11,1|-blwd80,10,10,0|-bbtek1,10,10,0|-bbtek0,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-atgak1,10,10,0|-atgak0,11,11,1|-akg7w1,11,11,1|-akg7w0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Bratislava|,0,334,0|-1qmkw08,7,334,0|-14u7uo9,7,334,0|-14u7uo8,10,10,0|-s0e081,10,10,0|-s0e080,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-fizzw1,10,10,0|-fizzw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cnnmk1,11,11,1|-cnnmk0,10,10,0|-cchrw1,10,10,0|-cchrw0,11,11,1|-c4mfw1,11,11,1|-c4mfw0,10,10,0|-c1qns1,10,10,0|-c1qns0,1,1,1|-bxf3s1,1,1,1|-bxf3s0,10,10,0|-bujh81,10,10,0|-bujh80,11,11,1|-blwd81,11,11,1|-blwd80,10,10,0|-bbtek1,10,10,0|-bbtek0,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-ati581,10,10,0|-ati580,11,11,1|-akg7w1,11,11,1|-akg7w0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Brussels|,0,335,0|-1ayy3h6,53,335,0|-14j9c01,53,335,0|-14j9c00,8,1,0|-ss5uo1,8,1,0|-ss5uo0,10,10,0|-s0dxg1,10,10,0|-s0dxg0,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-qotw41,10,10,0|-qotw40,8,1,0|-qj59g1,8,1,0|-qj59g0,9,10,1|-q7zes1,9,10,1|-q7zes0,8,1,0|-q15441,8,1,0|-q15440,9,10,1|-po6g41,9,10,1|-po6g40,8,1,0|-pgvhg1,8,1,0|-pgvhg0,9,10,1|-p5atg1,9,10,1|-p5atg0,8,1,0|-oxj6s1,8,1,0|-oxj6s0,9,10,1|-ong841,9,10,1|-ong840,8,1,0|-odd9g1,8,1,0|-odd9g0,9,10,1|-o4q5g1,9,10,1|-o4q5g0,8,1,0|-nvq2s1,8,1,0|-nvq2s0,9,10,1|-nm02s1,9,10,1|-nm02s0,8,1,0|-ncn1g1,8,1,0|-ncn1g0,9,10,1|-n3a041,9,10,1|-n3a040,8,1,0|-mt71g1,8,1,0|-mt71g0,9,10,1|-mkjxg1,9,10,1|-mkjxg0,8,1,0|-matxg1,8,1,0|-matxg0,9,10,1|-m1tus1,9,10,1|-m1tus0,8,1,0|-lrqw41,8,1,0|-lrqw40,9,10,1|-liql41,9,10,1|-liql40,8,1,0|-l8nmg1,8,1,0|-l8nmg0,9,10,1|-l00ig1,9,10,1|-l00ig0,8,1,0|-kqaig1,8,1,0|-kqaig0,9,10,1|-khafs1,9,10,1|-khafs0,8,1,0|-k77h41,8,1,0|-k77h40,9,10,1|-jykd41,9,10,1|-jykd40,8,1,0|-jp7bs1,8,1,0|-jp7bs0,9,10,1|-jfuag1,9,10,1|-jfuag0,8,1,0|-j6u7s1,8,1,0|-j6u7s0,9,10,1|-iwr941,9,10,1|-iwr940,8,1,0|-ine7s1,8,1,0|-ine7s0,9,10,1|-ie16g1,9,10,1|-ie16g0,8,1,0|-i513s1,8,1,0|-i513s0,9,10,1|-hvb3s1,9,10,1|-hvb3s0,8,1,0|-hl8541,8,1,0|-hl8540,9,10,1|-hcl141,9,10,1|-hcl140,8,1,0|-h37zs1,8,1,0|-h37zs0,9,10,1|-gtuyg1,9,10,1|-gtuyg0,8,1,0|-gkuvs1,8,1,0|-gkuvs0,9,10,1|-gb4vs1,9,10,1|-gb4vs0,8,1,0|-g11x41,8,1,0|-g11x40,9,10,1|-fpw2g1,9,10,1|-fpw2g0,8,1,0|-fkul41,8,1,0|-fkul40,9,10,1|-fgh6g1,9,10,1|-fgh6g0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d75h81,11,11,1|-d75h80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|-cbtp81,10,10,0|-cbtp80,11,11,1|-c4kl81,11,11,1|-c4kl80,10,10,0|3s9mrz,10,10,0|3s9ms0,11,11,1|419pfz,11,11,1|419pg0,10,10,0|4azpfz,10,10,0|4azpg0,11,11,1|4kcqrz,11,11,1|4kcqs0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Bucharest|,0,336,0|-14u7wu0,53,336,0|-k29zi1,53,336,0|-k29zi0,15,11,0|-jmqqw1,15,11,0|-jmqqw0,16,6,1|-jfulk1,16,6,1|-jfulk0,15,11,0|-j6hk81,15,11,0|-j6hk80,16,6,1|-ix4iw1,16,6,1|-ix4iw0,15,11,0|-ineiw1,15,11,0|-ineiw0,16,6,1|-ie1hk1,16,6,1|-ie1hk0,15,11,0|-i4og81,15,11,0|-i4og80,16,6,1|-hvbew1,16,6,1|-hvbew0,15,11,0|-hlydk1,15,11,0|-hlydk0,16,6,1|-hclc81,16,6,1|-hclc80,15,11,0|-h38aw1,15,11,0|-h38aw0,16,6,1|-gtv9k1,16,6,1|-gtv9k0,15,11,0|-gki881,15,11,0|-gki880,16,6,1|-gb56w1,16,6,1|-gb56w0,15,11,0|-g1s5k1,15,11,0|-g1s5k0,16,6,1|-fsf481,16,6,1|-fsf480,15,11,0|4wl93z,15,11,0|4wl940,16,6,1|532ibz,16,6,1|532ic0,15,11,0|5csibz,15,11,0|5csic0,16,6,1|5lsnrz,16,6,1|5lsns0,15,11,0|5v5unz,15,11,0|5v5uo0,16,6,1|64ivzz,16,6,1|64iw00,15,11,0|6dvxbz,15,11,0|6dvxc0,16,6,1|6n8ynz,16,6,1|6n8yo0,15,11,0|6wlzzz,15,11,0|6wm000,16,6,1|75z1bz,16,6,1|75z1c0,15,11,0|7fc2nz,15,11,0|7fc2o0,16,6,1|7p22nz,16,6,1|7p22o0,15,11,0|7yf3zz,15,11,0|7yf400,16,6,1|87s5bz,16,6,1|87s5c0,15,11,0|8h56nz,15,11,0|8h56o0,16,6,1|8qi7zz,16,6,1|8qi800,15,11,0|8zv9bz,15,11,0|8zv9c0,16,6,1|998anz,16,6,1|998ao0,15,11,0|9ilbzz,15,11,0|9ilc00,16,6,1|9rydbz,16,6,1|9rydc0,15,11,0|a1benz,15,11,0|a1beo0,16,6,1|aaofzz,16,6,1|aaog00,15,11,0|ak1hbz,15,11,0|ak1hc0,16,6,1|atrhbz,16,6,1|atrhc0,15,11,0|b34d3z,15,11,0|b34d40,16,6,1|bchefz,16,6,1|bcheg0,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7h3z,16,6,1|bv7h40,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxjrz,16,6,1|cdxjs0,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60nrz,15,11,0|d60ns0,16,6,1|dfdmbz,16,6,1|dfdmc0,15,11,0|dp3p3z,15,11,0|dp3p40,16,6,1|dzwibz,16,6,1|dzwic0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Budapest|,0,337,0|-15bee78,10,10,0|-s0e081,10,10,0|-s0e080,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-qgvmk1,10,10,0|-qgvmk0,11,11,1|-q90ak1,11,11,1|-q90ak0,10,10,0|-pykd81,10,10,0|-pykd80,11,11,1|-ppx981,11,11,1|-ppx980,10,10,0|-ezvc81,10,10,0|-ezvc80,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cvhc81,10,10,0|-cvhc80,11,11,1|-cm2dg1,11,11,1|-cm2dg0,10,10,0|-cecfw1,10,10,0|-cecfw0,11,11,1|-c4ko01,11,11,1|-c4ko00,10,10,0|-bv9ek1,10,10,0|-bv9ek0,11,11,1|-blwd81,11,11,1|-blwd80,10,10,0|-bcjbw1,10,10,0|-bcjbw0,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-atgak1,10,10,0|-atgak0,11,11,1|-akg7w1,11,11,1|-akg7w0,10,10,0|-85bc41,10,10,0|-85bc40,11,11,1|-7yh481,11,11,1|-7yh480,10,10,0|-7ml3w1,10,10,0|-7ml3w0,11,11,1|-7fqt81,11,11,1|-7fqt80,10,10,0|-7353w1,10,10,0|-7353w0,11,11,1|-6x0qk1,11,11,1|-6x0qk0,10,10,0|-6kf181,10,10,0|-6kf180,11,11,1|-6eanw1,11,11,1|-6eanw0,10,10,0|5csnvz,10,10,0|5csnw0,11,11,1|5lsqjz,11,11,1|5lsqk0,10,10,0|5v5rvz,10,10,0|5v5rw0,11,11,1|64it7z,11,11,1|64it80,10,10,0|6dvujz,10,10,0|6dvuk0,11,11,1|6n8vvz,11,11,1|6n8vw0,10,10,0|6wlx7z,10,10,0|6wlx80,11,11,1|75yyjz,11,11,1|75yyk0,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Busingen|,0,338,0|-1os49kw,53,339,0|-13g441n,53,339,0|-13g441m,10,10,0|-eyh6o1,10,10,0|-eyh6o0,11,11,1|-eqk001,11,11,1|-eqk000,10,10,0|-efr401,10,10,0|-efr400,11,11,1|-e7txc1,11,11,1|-e7txc0,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Chisinau|,0,340,0|-1ayy808,41,341,0|-r2p1bp,41,341,0|-r2p1bo,53,336,0|-k29zi1,53,336,0|-k29zi0,15,11,0|-jmqqw1,15,11,0|-jmqqw0,16,6,1|-jfulk1,16,6,1|-jfulk0,15,11,0|-j6hk81,15,11,0|-j6hk80,16,6,1|-ix4iw1,16,6,1|-ix4iw0,15,11,0|-ineiw1,15,11,0|-ineiw0,16,6,1|-ie1hk1,16,6,1|-ie1hk0,15,11,0|-i4og81,15,11,0|-i4og80,16,6,1|-hvbew1,16,6,1|-hvbew0,15,11,0|-hlydk1,15,11,0|-hlydk0,16,6,1|-hclc81,16,6,1|-hclc80,15,11,0|-h38aw1,15,11,0|-h38aw0,16,6,1|-gtv9k1,16,6,1|-gtv9k0,15,11,0|-gki881,15,11,0|-gki880,16,6,1|-gb56w1,16,6,1|-gb56w0,15,11,0|-g1s5k1,15,11,0|-g1s5k0,16,6,1|-fsf481,16,6,1|-fsf480,15,11,0|-fc0dk1,15,11,0|-fc0dk0,16,6,1|-euq8c1,16,6,1|-euq8c0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d8e5k1,11,11,1|-d8e5k0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,149,209,1|aaod7z,149,209,1|aaod80,148,6,0|ak1ejz,148,6,0|ak1ek0,149,209,1|am73rz,149,209,1|am73s0,16,6,1|atrhbz,16,6,1|atrhc0,15,11,0|b34inz,15,11,0|b34io0,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60nrz,15,11,0|d60ns0,16,6,1|dfdmbz,16,6,1|dfdmc0,15,11,0|dp3p3z,15,11,0|dp3p40,16,6,1|dzwibz,16,6,1|dzwic0,15,11,0|e7txbz,15,11,0|e7txc0,16,6,1|eimtbz,16,6,1|eimtc0,15,11,0|eqjzzz,15,11,0|eqk000,16,6,1|f1cvzz,16,6,1|f1cw00,15,11,0|f9a2nz,15,11,0|f9a2o0,16,6,1|fkfxbz,16,6,1|fkfxc0,15,11,0|fs05bz,15,11,0|fs05c0,16,6,1|g35zzz,16,6,1|g36000,15,11,0|gaq7zz,15,11,0|gaq800,16,6,1|glw2nz,16,6,1|glw2o0,15,11,0|gtt9bz,15,11,0|gtt9c0,16,6,1|h4m5bz,16,6,1|h4m5c0,15,11,0|hcjbzz,15,11,0|hcjc00,16,6,1|hnc7zz,16,6,1|hnc800,15,11,0|hv9enz,15,11,0|hv9eo0,16,6,1|i6f9bz,16,6,1|i6f9c0,15,11,0|idzhbz,15,11,0|idzhc0,16,6,1|ip5bzz,16,6,1|ip5c00,15,11,0|iwpjzz,15,11,0|iwpk00,16,6,1|j7venz,16,6,1|j7veo0,15,11,0|jffmnz,15,11,0|jffmo0,16,6,1|jqlhbz,16,6,1|jqlhc0,15,11,0|jyinzz,15,11,0|jyio00,16,6,1|k9bjzz,16,6,1|k9bk00,15,11,0|kh8qnz,15,11,0|kh8qo0,16,6,1|ks1mnz,16,6,1|ks1mo0,15,11,0|kzytbz,15,11,0|kzytc0,16,6,1|lb4nzz,16,6,1|lb4o00,15,11,0|liovzz,15,11,0|liow00,16,6,1|ltuqnz,16,6,1|ltuqo0,15,11,0|m1eynz,15,11,0|m1eyo0,16,6,1|mcktbz,16,6,1|mcktc0,15,11,0|mkhzzz,15,11,0|mki000,16,6,1|mvavzz,16,6,1|mvaw00,15,11,0|n382nz,15,11,0|n382o0,16,6,1|ne0ynz,16,6,1|ne0yo0,15,11,0|nly5bz,15,11,0|nly5c0,16,6,1|nwr1bz,16,6,1|nwr1c0,15,11,0|o4o7zz,15,11,0|o4o800,16,6,1|ofu2nz,16,6,1|ofu2o0,15,11,0|oneanz,15,11,0|oneao0,16,6,1|oyk5bz,16,6,1|oyk5c0,15,11,0|p64dbz,15,11,0|p64dc0,16,6,1|pha7zz,16,6,1|pha800,15,11,0|pp7enz,15,11,0|pp7eo0,16,6,1|q00anz,16,6,1|q00ao0,15,11,0|q7xhbz,15,11,0|q7xhc0,16,6,1|qiqdbz,16,6,1|qiqdc0,15,11,0|qqnjzz,15,11,0|qqnk00,16,6,1|r1tenz,16,6,1|r1teo0,15,11,0|r9dmnz,15,11,0|r9dmo0,16,6,1|rkjhbz,16,6,1|rkjhc0,15,11,0|rs3pbz,15,11,0|rs3pc0,16,6,1|s39jzz,16,6,1|s39k00,15,11,0|sb6qnz,15,11,0|sb6qo0,16,6,1|slzmnz,16,6,1|slzmo0,15,11,0|stwtbz,15,11,0|stwtc0,16,6,1|t4ppbz,16,6,1|t4ppc0,15,11,0|tcmvzz,15,11,0|tcmw00,16,6,1|tnfrzz,16,6,1|tnfs00,15,11,0|tvcynz,15,11,0|tvcyo0,16,6,1|u6itbz,16,6,1|u6itc0,15,11,0|ue31bz,15,11,0|ue31c0,16,6,1|up8vzz,16,6,1|up8w00,15,11,0|uwt3zz,15,11,0|uwt400,16,6,1|v7yynz,16,6,1|v7yyo0,15,11,0|vfw5bz,15,11,0|vfw5c0,16,6,1|vqp1bz,16,6,1|vqp1c0,15,11,0|vym7zz,15,11,0|vym800,16,6,1|w9f3zz,16,6,1|w9f400,15,11,0|whcanz,15,11,0|whcao0,16,6,1|wsi5bz,16,6,1|wsi5c0,15,11,0|x02dbz,15,11,0|x02dc0,16,6,1|xb87zz,16,6,1|xb8800,15,11,0|xisfzz,15,11,0|xisg00,16,6,1|xtyanz,16,6,1|xtyao0,15,11,0|y1iinz,15,11,0|y1iio0,16,6,1|ycodbz,16,6,1|ycodc0,15,11,0|ykljzz,15,11,0|yklk00,16,6,1|yvefzz,16,6,1|yveg00,15,11,0|z3bmnz,15,11,0|z3bmo0,16,6,1|ze4inz,16,6,1|ze4io0,15,11,0\",\"Europe/Copenhagen|,0,342,0|-15r1bnw,41,342,0|-13nvrnx,41,342,0|-13nvrnw,10,10,0|-rzo2w1,10,10,0|-rzo2w0,11,11,1|-rsir01,11,11,1|-rsir00,10,10,0|-fgqo41,10,10,0|-fgqo40,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cq2nw1,11,11,1|-cq2nw0,10,10,0|-ccr181,10,10,0|-ccr180,11,11,1|-c6f981,11,11,1|-c6f980,10,10,0|-bttjw1,10,10,0|-bttjw0,11,11,1|-bos2k1,11,11,1|-bos2k0,10,10,0|-baqik1,10,10,0|-baqik0,11,11,1|-b61zw1,11,11,1|-b61zw0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Dublin|,0,343,0|-1anxquc,150,344,0|-rzcmls,150,344,0|-rzcmlr,110,345,1|-rsibxs,110,345,1|-rsibxr,1,1,0|-risd41,1,1,0|-risd40,27,10,1|-ragd41,27,10,1|-ragd40,1,1,0|-r0s7s1,1,1,0|-r0s7s0,27,10,1|-qr0d41,27,10,1|-qr0d40,1,1,0|-qhp6g1,1,1,0|-qhp6g0,27,10,1|-q8aag1,27,10,1|-q8aag0,1,1,0|-pyz3s1,1,1,0|-pyz3s0,27,10,1|-po4d41,27,10,1|-po4d40,1,1,0|-pfw2g1,1,1,0|-pfw2g0,27,10,1|-p6h6g1,27,10,1|-p6h6g0,1,1,0|-oxiyg1,1,1,0|-oxiyg0,110,10,1|-onfzs1,110,10,1|-onfzs0,1,1,0|-odd141,1,1,0|-odd140,110,10,1|-o5st41,110,10,1|-o5st40,1,1,0|-nuzx41,1,1,0|-nuzx40,110,10,1|-nmprs1,110,10,1|-nmprs0,1,1,0|-nbwvs1,1,1,0|-nbwvs0,110,10,1|-n39rs1,110,10,1|-n39rs0,1,1,0|-mt6t41,1,1,0|-mt6t40,110,10,1|-mkjp41,110,10,1|-mkjp40,1,1,0|-matp41,1,1,0|-matp40,110,10,1|-m1tmg1,110,10,1|-m1tmg0,1,1,0|-lrdp41,1,1,0|-lrdp40,110,10,1|-liql41,110,10,1|-liql40,1,1,0|-l8nmg1,1,1,0|-l8nmg0,110,10,1|-l00ig1,110,10,1|-l00ig0,1,1,0|-kqaig1,1,1,0|-kqaig0,110,10,1|-khafs1,110,10,1|-khafs0,1,1,0|-k77h41,1,1,0|-k77h40,110,10,1|-jykd41,110,10,1|-jykd40,1,1,0|-joheg1,1,1,0|-joheg0,110,10,1|-jfuag1,110,10,1|-jfuag0,1,1,0|-j64ag1,1,1,0|-j64ag0,110,10,1|-iwr941,110,10,1|-iwr940,1,1,0|-imoag1,1,1,0|-imoag0,110,10,1|-ie16g1,110,10,1|-ie16g0,1,1,0|-i4b6g1,1,1,0|-i4b6g0,110,10,1|-hvb3s1,110,10,1|-hvb3s0,1,1,0|-hl8541,1,1,0|-hl8540,110,10,1|-hcl141,110,10,1|-hcl140,1,1,0|-h2i2g1,1,1,0|-h2i2g0,110,10,1|-gtuyg1,110,10,1|-gtuyg0,1,1,0|-gk4yg1,1,1,0|-gk4yg0,110,10,1|-gb4vs1,110,10,1|-gb4vs0,1,1,0|-g11x41,1,1,0|-g11x40,110,10,1|-fpw2g1,110,10,1|-fpw2g0,1,1,0|-fkul41,1,1,0|-fkul40,110,10,1|-c4md41,110,10,1|-c4md40,1,1,0|-bwc7s1,1,1,0|-bwc7s0,110,10,1|-bkgfs1,110,10,1|-bkgfs0,1,1,0|-bbtbs1,1,1,0|-bbtbs0,110,10,1|-b1qd41,110,10,1|-b1qd40,1,1,0|-att6g1,1,1,0|-att6g0,110,10,1|-aj0ag1,110,10,1|-aj0ag0,1,1,0|-aad6g1,1,1,0|-aad6g0,110,10,1|-a0n6g1,110,10,1|-a0n6g0,1,1,0|-9rn3s1,1,1,0|-9rn3s0,110,10,1|-9hx3s1,110,10,1|-9hx3s0,1,1,0|-98k2g1,1,1,0|-98k2g0,110,10,1|-8yu2g1,110,10,1|-8yu2g0,1,1,0|-8ptzs1,1,1,0|-8ptzs0,110,10,1|-8h6vs1,110,10,1|-8h6vs0,1,1,0|-87gvs1,1,1,0|-87gvs0,110,10,1|-7ygt41,110,10,1|-7ygt40,1,1,0|-7odug1,1,1,0|-7odug0,110,10,1|-7fqqg1,110,10,1|-7fqqg0,1,1,0|-75at41,1,1,0|-75at40,110,10,1|-6wnp41,110,10,1|-6wnp40,1,1,0|-6mxp41,1,1,0|-6mxp40,110,10,1|-6dxmg1,110,10,1|-6dxmg0,1,1,0|-63uns1,1,1,0|-63uns0,110,10,1|-5v7js1,110,10,1|-5v7js0,1,1,0|-5l4l41,1,1,0|-5l4l40,110,10,1|-5chh41,110,10,1|-5chh40,1,1,0|-52rh41,1,1,0|-52rh40,110,10,1|-4treg1,110,10,1|-4treg0,1,1,0|-4krbs1,1,1,0|-4krbs0,110,10,1|-49lh41,110,10,1|-49lh40,1,1,0|-421941,1,1,0|-421940,110,10,1|-3qveg1,110,10,1|-3qveg0,1,1,0|-3iy7s1,1,1,0|-3iy7s0,110,10,1|-385bs1,110,10,1|-385bs0,1,1,0|-30l3s1,1,1,0|-30l3s0,110,10,1|-2pf941,110,10,1|-2pf940,1,1,0|-2hv141,1,1,0|-2hv140,110,10,1|-26p6g1,110,10,1|-26p6g0,1,1,0|-1z4yg1,1,1,0|-1z4yg0,110,10,1|-1nz3s1,110,10,1|-1nz3s0,1,1,0|-1gevs1,1,1,0|-1gevs0,110,10,1|-14w2g1,110,10,1|-14w2g0,1,1,0|-z4ns1,1,1,0|-z4ns0,110,10,1|-m6841,110,10,1|-m6840,110,10,0|yd6vz,110,10,0|yd6w0,1,1,1|15kg7z,1,1,1|15kg80,110,10,0|1h39jz,110,10,0|1h39k0,1,1,1|1oaivz,1,1,1|1oaiw0,110,10,0|1ztc7z,110,10,0|1ztc80,1,1,1|270ljz,1,1,1|270lk0,110,10,0|2ijevz,110,10,0|2ijew0,1,1,1|2pqo7z,1,1,1|2pqo80,110,10,0|319hjz,110,10,0|319hk0,1,1,1|38tpjz,1,1,1|38tpk0,110,10,0|3jzk7z,110,10,0|3jzk80,1,1,1|3rjs7z,1,1,1|3rjs80,110,10,0|42pmvz,110,10,0|42pmw0,1,1,1|4a9uvz,1,1,1|4a9uw0,110,10,0|4lso7z,110,10,0|4lso80,1,1,1|4szxjz,1,1,1|4szxk0,110,10,0|54iqvz,110,10,0|54iqw0,1,1,1|5bq07z,1,1,1|5bq080,110,10,0|5n8tjz,110,10,0|5n8tk0,1,1,1|5v5xfz,1,1,1|5v5xg0,110,10,0|65ytfz,110,10,0|65ytg0,1,1,1|6dw03z,1,1,1|6dw040,110,10,0|6oow3z,110,10,0|6oow40,1,1,1|6wm2rz,1,1,1|6wm2s0,110,10,0|77eyrz,110,10,0|77eys0,1,1,1|7fc5fz,1,1,1|7fc5g0,110,10,0|7qi03z,110,10,0|7qi040,1,1,1|7yf6rz,1,1,1|7yf6s0,110,10,0|8982rz,110,10,0|8982s0,1,1,1|8h59fz,1,1,1|8h59g0,110,10,0|8ry5fz,110,10,0|8ry5g0,1,1,1|8zvc3z,1,1,1|8zvc40,110,10,0|9ao83z,110,10,0|9ao840,1,1,1|9ilerz,1,1,1|9iles0,110,10,0|9tearz,110,10,0|9teas0,1,1,1|a1bhfz,1,1,1|a1bhg0,110,10,0|achc3z,110,10,0|achc40,1,1,1|ak1k3z,1,1,1|ak1k40,110,10,0|av7erz,110,10,0|av7es0,1,1,1|b34lfz,1,1,1|b34lg0,110,10,0|bdxhfz,110,10,0|bdxhg0,1,1,1|bluo3z,1,1,1|bluo40,110,10,0|bwnk3z,110,10,0|bwnk40,1,1,1|c4kqrz,1,1,1|c4kqs0,110,10,0|cfdmrz,110,10,0|cfdms0,1,1,1|cnatfz,1,1,1|cnatg0,110,10,0|cy3pfz,110,10,0|cy3pg0,1,1,1|d60w3z,1,1,1|d60w40,110,10,0|dgts3z,110,10,0|dgts40,1,1,1|dp3xfz,1,1,1|dp3xg0,110,10,0|dzwtfz,110,10,0|dzwtg0,1,1,1|e7u03z,1,1,1|e7u040,110,10,0|eimw3z,110,10,0|eimw40,1,1,1|eqk2rz,1,1,1|eqk2s0,110,10,0|f1cyrz,110,10,0|f1cys0,1,1,1|f9a5fz,1,1,1|f9a5g0,110,10,0|fkg03z,110,10,0|fkg040,1,1,1|fs083z,1,1,1|fs0840,110,10,0|g362rz,110,10,0|g362s0,1,1,1|gaqarz,1,1,1|gaqas0,110,10,0|glw5fz,110,10,0|glw5g0,1,1,1|gttc3z,1,1,1|gttc40,110,10,0|h4m83z,110,10,0|h4m840,1,1,1|hcjerz,1,1,1|hcjes0,110,10,0|hncarz,110,10,0|hncas0,1,1,1|hv9hfz,1,1,1|hv9hg0,110,10,0|i6fc3z,110,10,0|i6fc40,1,1,1|idzk3z,1,1,1|idzk40,110,10,0|ip5erz,110,10,0|ip5es0,1,1,1|iwpmrz,1,1,1|iwpms0,110,10,0|j7vhfz,110,10,0|j7vhg0,1,1,1|jffpfz,1,1,1|jffpg0,110,10,0|jqlk3z,110,10,0|jqlk40,1,1,1|jyiqrz,1,1,1|jyiqs0,110,10,0|k9bmrz,110,10,0|k9bms0,1,1,1|kh8tfz,1,1,1|kh8tg0,110,10,0|ks1pfz,110,10,0|ks1pg0,1,1,1|kzyw3z,1,1,1|kzyw40,110,10,0|lb4qrz,110,10,0|lb4qs0,1,1,1|lioyrz,1,1,1|lioys0,110,10,0|ltutfz,110,10,0|ltutg0,1,1,1|m1f1fz,1,1,1|m1f1g0,110,10,0|mckw3z,110,10,0|mckw40,1,1,1|mki2rz,1,1,1|mki2s0,110,10,0|mvayrz,110,10,0|mvays0,1,1,1|n385fz,1,1,1|n385g0,110,10,0|ne11fz,110,10,0|ne11g0,1,1,1|nly83z,1,1,1|nly840,110,10,0|nwr43z,110,10,0|nwr440,1,1,1|o4oarz,1,1,1|o4oas0,110,10,0|ofu5fz,110,10,0|ofu5g0,1,1,1|onedfz,1,1,1|onedg0,110,10,0|oyk83z,110,10,0|oyk840,1,1,1|p64g3z,1,1,1|p64g40,110,10,0|phaarz,110,10,0|phaas0,1,1,1|pp7hfz,1,1,1|pp7hg0,110,10,0|q00dfz,110,10,0|q00dg0,1,1,1|q7xk3z,1,1,1|q7xk40,110,10,0|qiqg3z,110,10,0|qiqg40,1,1,1|qqnmrz,1,1,1|qqnms0,110,10,0|r1thfz,110,10,0|r1thg0,1,1,1|r9dpfz,1,1,1|r9dpg0,110,10,0|rkjk3z,110,10,0|rkjk40,1,1,1|rs3s3z,1,1,1|rs3s40,110,10,0|s39mrz,110,10,0|s39ms0,1,1,1|sb6tfz,1,1,1|sb6tg0,110,10,0|slzpfz,110,10,0|slzpg0,1,1,1|stww3z,1,1,1|stww40,110,10,0|t4ps3z,110,10,0|t4ps40,1,1,1|tcmyrz,1,1,1|tcmys0,110,10,0|tnfurz,110,10,0|tnfus0,1,1,1|tvd1fz,1,1,1|tvd1g0,110,10,0|u6iw3z,110,10,0|u6iw40,1,1,1|ue343z,1,1,1|ue3440,110,10,0|up8yrz,110,10,0|up8ys0,1,1,1|uwt6rz,1,1,1|uwt6s0,110,10,0|v7z1fz,110,10,0|v7z1g0,1,1,1|vfw83z,1,1,1|vfw840,110,10,0|vqp43z,110,10,0|vqp440,1,1,1|vymarz,1,1,1|vymas0,110,10,0|w9f6rz,110,10,0|w9f6s0,1,1,1|whcdfz,1,1,1|whcdg0,110,10,0|wsi83z,110,10,0|wsi840,1,1,1|x02g3z,1,1,1|x02g40,110,10,0|xb8arz,110,10,0|xb8as0,1,1,1|xisirz,1,1,1|xisis0,110,10,0|xtydfz,110,10,0|xtydg0,1,1,1|y1ilfz,1,1,1|y1ilg0,110,10,0|ycog3z,110,10,0|ycog40,1,1,1|yklmrz,1,1,1|yklms0,110,10,0|yveirz,110,10,0|yveis0,1,1,1|z3bpfz,1,1,1|z3bpg0,110,10,0|ze4lfz,110,10,0|ze4lg0,1,1,1\",\"Europe/Gibraltar|,0,346,0|-1anxr0c,1,1,0|-rzcns1,1,1,0|-rzcns0,27,10,1|-rsid41,27,10,1|-rsid40,1,1,0|-risd41,1,1,0|-risd40,27,10,1|-ragd41,27,10,1|-ragd40,1,1,0|-r0s7s1,1,1,0|-r0s7s0,27,10,1|-qr0d41,27,10,1|-qr0d40,1,1,0|-qhp6g1,1,1,0|-qhp6g0,27,10,1|-q8aag1,27,10,1|-q8aag0,1,1,0|-pyz3s1,1,1,0|-pyz3s0,27,10,1|-po4d41,27,10,1|-po4d40,1,1,0|-pfw2g1,1,1,0|-pfw2g0,27,10,1|-p6h6g1,27,10,1|-p6h6g0,1,1,0|-oxiyg1,1,1,0|-oxiyg0,27,10,1|-onfzs1,27,10,1|-onfzs0,1,1,0|-odd141,1,1,0|-odd140,27,10,1|-o5st41,27,10,1|-o5st40,1,1,0|-nuzx41,1,1,0|-nuzx40,27,10,1|-nmprs1,27,10,1|-nmprs0,1,1,0|-nbwvs1,1,1,0|-nbwvs0,27,10,1|-n39rs1,27,10,1|-n39rs0,1,1,0|-mt6t41,1,1,0|-mt6t40,27,10,1|-mkjp41,27,10,1|-mkjp40,1,1,0|-matp41,1,1,0|-matp40,27,10,1|-m1tmg1,27,10,1|-m1tmg0,1,1,0|-lrdp41,1,1,0|-lrdp40,27,10,1|-liql41,27,10,1|-liql40,1,1,0|-l8nmg1,1,1,0|-l8nmg0,27,10,1|-l00ig1,27,10,1|-l00ig0,1,1,0|-kqaig1,1,1,0|-kqaig0,27,10,1|-khafs1,27,10,1|-khafs0,1,1,0|-k77h41,1,1,0|-k77h40,27,10,1|-jykd41,27,10,1|-jykd40,1,1,0|-joheg1,1,1,0|-joheg0,27,10,1|-jfuag1,27,10,1|-jfuag0,1,1,0|-j64ag1,1,1,0|-j64ag0,27,10,1|-iwr941,27,10,1|-iwr940,1,1,0|-imoag1,1,1,0|-imoag0,27,10,1|-ie16g1,27,10,1|-ie16g0,1,1,0|-i4b6g1,1,1,0|-i4b6g0,27,10,1|-hvb3s1,27,10,1|-hvb3s0,1,1,0|-hl8541,1,1,0|-hl8540,27,10,1|-hcl141,27,10,1|-hcl140,1,1,0|-h2i2g1,1,1,0|-h2i2g0,27,10,1|-gtuyg1,27,10,1|-gtuyg0,1,1,0|-gk4yg1,1,1,0|-gk4yg0,27,10,1|-gb4vs1,27,10,1|-gb4vs0,1,1,0|-g11x41,1,1,0|-g11x40,27,10,1|-fpw2g1,27,10,1|-fpw2g0,1,1,0|-fkul41,1,1,0|-fkul40,27,10,1|-eyiyk1,27,10,1|-eyiyk0,151,11,1|-ethh81,151,11,1|-ethh80,27,10,1|-eh8qk1,27,10,1|-eh8qk0,151,11,1|-earek1,151,11,1|-earek0,27,10,1|-dyinw1,27,10,1|-dyinw0,151,11,1|-drod81,151,11,1|-drod80,27,10,1|-dfsl81,27,10,1|-dfsl80,151,11,1|-d75h81,151,11,1|-d75h80,27,10,1|-cx0nw1,27,10,1|-cx0nw0,151,11,1|-cro2k1,151,11,1|-cro2k0,27,10,1|-cncfs1,27,10,1|-cncfs0,1,1,0|-cdmfs1,1,1,0|-cdmfs0,27,10,1|-c4md41,27,10,1|-c4md40,1,1,0|-bwc7s1,1,1,0|-bwc7s0,27,10,1|-buwfw1,27,10,1|-buwfw0,151,11,1|-bos2k1,151,11,1|-bos2k0,27,10,1|-bkgfs1,27,10,1|-bkgfs0,1,1,0|-bdm541,1,1,0|-bdm540,27,10,1|-b1qd41,27,10,1|-b1qd40,1,1,0|-att6g1,1,1,0|-att6g0,27,10,1|-aj0ag1,27,10,1|-aj0ag0,1,1,0|-aad6g1,1,1,0|-aad6g0,27,10,1|-a0n6g1,27,10,1|-a0n6g0,1,1,0|-9rn3s1,1,1,0|-9rn3s0,27,10,1|-9hx3s1,27,10,1|-9hx3s0,1,1,0|-98k2g1,1,1,0|-98k2g0,27,10,1|-8yu2g1,27,10,1|-8yu2g0,1,1,0|-8ptzs1,1,1,0|-8ptzs0,27,10,1|-8h6vs1,27,10,1|-8h6vs0,1,1,0|-87gvs1,1,1,0|-87gvs0,27,10,1|-7ygt41,27,10,1|-7ygt40,1,1,0|-7odug1,1,1,0|-7odug0,27,10,1|-7fqqg1,27,10,1|-7fqqg0,1,1,0|-75at41,1,1,0|-75at40,27,10,1|-6wnp41,27,10,1|-6wnp40,1,1,0|-6mxp41,1,1,0|-6mxp40,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Guernsey|,0,347,0|-1rprx9x,1,1,0|-rzcns1,1,1,0|-rzcns0,27,10,1|-rsid41,27,10,1|-rsid40,1,1,0|-risd41,1,1,0|-risd40,27,10,1|-ragd41,27,10,1|-ragd40,1,1,0|-r0s7s1,1,1,0|-r0s7s0,27,10,1|-qr0d41,27,10,1|-qr0d40,1,1,0|-qhp6g1,1,1,0|-qhp6g0,27,10,1|-q8aag1,27,10,1|-q8aag0,1,1,0|-pyz3s1,1,1,0|-pyz3s0,27,10,1|-po4d41,27,10,1|-po4d40,1,1,0|-pfw2g1,1,1,0|-pfw2g0,27,10,1|-p6h6g1,27,10,1|-p6h6g0,1,1,0|-oxiyg1,1,1,0|-oxiyg0,27,10,1|-onfzs1,27,10,1|-onfzs0,1,1,0|-odd141,1,1,0|-odd140,27,10,1|-o5st41,27,10,1|-o5st40,1,1,0|-nuzx41,1,1,0|-nuzx40,27,10,1|-nmprs1,27,10,1|-nmprs0,1,1,0|-nbwvs1,1,1,0|-nbwvs0,27,10,1|-n39rs1,27,10,1|-n39rs0,1,1,0|-mt6t41,1,1,0|-mt6t40,27,10,1|-mkjp41,27,10,1|-mkjp40,1,1,0|-matp41,1,1,0|-matp40,27,10,1|-m1tmg1,27,10,1|-m1tmg0,1,1,0|-lrdp41,1,1,0|-lrdp40,27,10,1|-liql41,27,10,1|-liql40,1,1,0|-l8nmg1,1,1,0|-l8nmg0,27,10,1|-l00ig1,27,10,1|-l00ig0,1,1,0|-kqaig1,1,1,0|-kqaig0,27,10,1|-khafs1,27,10,1|-khafs0,1,1,0|-k77h41,1,1,0|-k77h40,27,10,1|-jykd41,27,10,1|-jykd40,1,1,0|-joheg1,1,1,0|-joheg0,27,10,1|-jfuag1,27,10,1|-jfuag0,1,1,0|-j64ag1,1,1,0|-j64ag0,27,10,1|-iwr941,27,10,1|-iwr940,1,1,0|-imoag1,1,1,0|-imoag0,27,10,1|-ie16g1,27,10,1|-ie16g0,1,1,0|-i4b6g1,1,1,0|-i4b6g0,27,10,1|-hvb3s1,27,10,1|-hvb3s0,1,1,0|-hl8541,1,1,0|-hl8540,27,10,1|-hcl141,27,10,1|-hcl140,1,1,0|-h2i2g1,1,1,0|-h2i2g0,27,10,1|-gtuyg1,27,10,1|-gtuyg0,1,1,0|-gk4yg1,1,1,0|-gk4yg0,27,10,1|-gb4vs1,27,10,1|-gb4vs0,1,1,0|-g11x41,1,1,0|-g11x40,27,10,1|-fpw2g1,27,10,1|-fpw2g0,1,1,0|-fkul41,1,1,0|-fkul40,27,10,1|-eyiyk1,27,10,1|-eyiyk0,151,11,1|-ethh81,151,11,1|-ethh80,27,10,1|-eh8qk1,27,10,1|-eh8qk0,151,11,1|-earek1,151,11,1|-earek0,27,10,1|-dyinw1,27,10,1|-dyinw0,151,11,1|-drod81,151,11,1|-drod80,27,10,1|-dfsl81,27,10,1|-dfsl80,151,11,1|-d75h81,151,11,1|-d75h80,27,10,1|-cx0nw1,27,10,1|-cx0nw0,151,11,1|-cro2k1,151,11,1|-cro2k0,27,10,1|-cncfs1,27,10,1|-cncfs0,1,1,0|-cdmfs1,1,1,0|-cdmfs0,27,10,1|-c4md41,27,10,1|-c4md40,1,1,0|-bwc7s1,1,1,0|-bwc7s0,27,10,1|-buwfw1,27,10,1|-buwfw0,151,11,1|-bos2k1,151,11,1|-bos2k0,27,10,1|-bkgfs1,27,10,1|-bkgfs0,1,1,0|-bdm541,1,1,0|-bdm540,27,10,1|-b1qd41,27,10,1|-b1qd40,1,1,0|-att6g1,1,1,0|-att6g0,27,10,1|-aj0ag1,27,10,1|-aj0ag0,1,1,0|-aad6g1,1,1,0|-aad6g0,27,10,1|-a0n6g1,27,10,1|-a0n6g0,1,1,0|-9rn3s1,1,1,0|-9rn3s0,27,10,1|-9hx3s1,27,10,1|-9hx3s0,1,1,0|-98k2g1,1,1,0|-98k2g0,27,10,1|-8yu2g1,27,10,1|-8yu2g0,1,1,0|-8ptzs1,1,1,0|-8ptzs0,27,10,1|-8h6vs1,27,10,1|-8h6vs0,1,1,0|-87gvs1,1,1,0|-87gvs0,27,10,1|-7ygt41,27,10,1|-7ygt40,1,1,0|-7odug1,1,1,0|-7odug0,27,10,1|-7fqqg1,27,10,1|-7fqqg0,1,1,0|-75at41,1,1,0|-75at40,27,10,1|-6wnp41,27,10,1|-6wnp40,1,1,0|-6mxp41,1,1,0|-6mxp40,27,10,1|-6dxmg1,27,10,1|-6dxmg0,1,1,0|-63uns1,1,1,0|-63uns0,27,10,1|-5v7js1,27,10,1|-5v7js0,1,1,0|-5l4l41,1,1,0|-5l4l40,27,10,1|-5chh41,27,10,1|-5chh40,1,1,0|-52rh41,1,1,0|-52rh40,27,10,1|-4treg1,27,10,1|-4treg0,1,1,0|-4krbs1,1,1,0|-4krbs0,27,10,1|-49lh41,27,10,1|-49lh40,1,1,0|-421941,1,1,0|-421940,27,10,1|-3qveg1,27,10,1|-3qveg0,1,1,0|-3iy7s1,1,1,0|-3iy7s0,27,10,1|-385bs1,27,10,1|-385bs0,1,1,0|-30l3s1,1,1,0|-30l3s0,27,10,1|-2pf941,27,10,1|-2pf940,1,1,0|-2hv141,1,1,0|-2hv140,27,10,1|-26p6g1,27,10,1|-26p6g0,1,1,0|-1z4yg1,1,1,0|-1z4yg0,27,10,1|-1nz3s1,27,10,1|-1nz3s0,1,1,0|-1gevs1,1,1,0|-1gevs0,27,10,1|-14w2g1,27,10,1|-14w2g0,1,1,0|-z4ns1,1,1,0|-z4ns0,27,10,1|-m6841,27,10,1|-m6840,27,10,0|yd6vz,27,10,0|yd6w0,1,1,0|15kg7z,1,1,0|15kg80,27,10,1|1h39jz,27,10,1|1h39k0,1,1,0|1oaivz,1,1,0|1oaiw0,27,10,1|1ztc7z,27,10,1|1ztc80,1,1,0|270ljz,1,1,0|270lk0,27,10,1|2ijevz,27,10,1|2ijew0,1,1,0|2pqo7z,1,1,0|2pqo80,27,10,1|319hjz,27,10,1|319hk0,1,1,0|38tpjz,1,1,0|38tpk0,27,10,1|3jzk7z,27,10,1|3jzk80,1,1,0|3rjs7z,1,1,0|3rjs80,27,10,1|42pmvz,27,10,1|42pmw0,1,1,0|4a9uvz,1,1,0|4a9uw0,27,10,1|4lso7z,27,10,1|4lso80,1,1,0|4szxjz,1,1,0|4szxk0,27,10,1|54iqvz,27,10,1|54iqw0,1,1,0|5bq07z,1,1,0|5bq080,27,10,1|5n8tjz,27,10,1|5n8tk0,1,1,0|5v5xfz,1,1,0|5v5xg0,27,10,1|65ytfz,27,10,1|65ytg0,1,1,0|6dw03z,1,1,0|6dw040,27,10,1|6oow3z,27,10,1|6oow40,1,1,0|6wm2rz,1,1,0|6wm2s0,27,10,1|77eyrz,27,10,1|77eys0,1,1,0|7fc5fz,1,1,0|7fc5g0,27,10,1|7qi03z,27,10,1|7qi040,1,1,0|7yf6rz,1,1,0|7yf6s0,27,10,1|8982rz,27,10,1|8982s0,1,1,0|8h59fz,1,1,0|8h59g0,27,10,1|8ry5fz,27,10,1|8ry5g0,1,1,0|8zvc3z,1,1,0|8zvc40,27,10,1|9ao83z,27,10,1|9ao840,1,1,0|9ilerz,1,1,0|9iles0,27,10,1|9tearz,27,10,1|9teas0,1,1,0|a1bhfz,1,1,0|a1bhg0,27,10,1|achc3z,27,10,1|achc40,1,1,0|ak1k3z,1,1,0|ak1k40,27,10,1|av7erz,27,10,1|av7es0,1,1,0|b34lfz,1,1,0|b34lg0,27,10,1|bdxhfz,27,10,1|bdxhg0,1,1,0|bluo3z,1,1,0|bluo40,27,10,1|bwnk3z,27,10,1|bwnk40,1,1,0|c4kqrz,1,1,0|c4kqs0,27,10,1|cfdmrz,27,10,1|cfdms0,1,1,0|cnatfz,1,1,0|cnatg0,27,10,1|cy3pfz,27,10,1|cy3pg0,1,1,0|d60w3z,1,1,0|d60w40,27,10,1|dgts3z,27,10,1|dgts40,1,1,0|dp3xfz,1,1,0|dp3xg0,27,10,1|dzwtfz,27,10,1|dzwtg0,1,1,0|e7u03z,1,1,0|e7u040,27,10,1|eimw3z,27,10,1|eimw40,1,1,0|eqk2rz,1,1,0|eqk2s0,27,10,1|f1cyrz,27,10,1|f1cys0,1,1,0|f9a5fz,1,1,0|f9a5g0,27,10,1|fkg03z,27,10,1|fkg040,1,1,0|fs083z,1,1,0|fs0840,27,10,1|g362rz,27,10,1|g362s0,1,1,0|gaqarz,1,1,0|gaqas0,27,10,1|glw5fz,27,10,1|glw5g0,1,1,0|gttc3z,1,1,0|gttc40,27,10,1|h4m83z,27,10,1|h4m840,1,1,0|hcjerz,1,1,0|hcjes0,27,10,1|hncarz,27,10,1|hncas0,1,1,0|hv9hfz,1,1,0|hv9hg0,27,10,1|i6fc3z,27,10,1|i6fc40,1,1,0|idzk3z,1,1,0|idzk40,27,10,1|ip5erz,27,10,1|ip5es0,1,1,0|iwpmrz,1,1,0|iwpms0,27,10,1|j7vhfz,27,10,1|j7vhg0,1,1,0|jffpfz,1,1,0|jffpg0,27,10,1|jqlk3z,27,10,1|jqlk40,1,1,0|jyiqrz,1,1,0|jyiqs0,27,10,1|k9bmrz,27,10,1|k9bms0,1,1,0|kh8tfz,1,1,0|kh8tg0,27,10,1|ks1pfz,27,10,1|ks1pg0,1,1,0|kzyw3z,1,1,0|kzyw40,27,10,1|lb4qrz,27,10,1|lb4qs0,1,1,0|lioyrz,1,1,0|lioys0,27,10,1|ltutfz,27,10,1|ltutg0,1,1,0|m1f1fz,1,1,0|m1f1g0,27,10,1|mckw3z,27,10,1|mckw40,1,1,0|mki2rz,1,1,0|mki2s0,27,10,1|mvayrz,27,10,1|mvays0,1,1,0|n385fz,1,1,0|n385g0,27,10,1|ne11fz,27,10,1|ne11g0,1,1,0|nly83z,1,1,0|nly840,27,10,1|nwr43z,27,10,1|nwr440,1,1,0|o4oarz,1,1,0|o4oas0,27,10,1|ofu5fz,27,10,1|ofu5g0,1,1,0|onedfz,1,1,0|onedg0,27,10,1|oyk83z,27,10,1|oyk840,1,1,0|p64g3z,1,1,0|p64g40,27,10,1|phaarz,27,10,1|phaas0,1,1,0|pp7hfz,1,1,0|pp7hg0,27,10,1|q00dfz,27,10,1|q00dg0,1,1,0|q7xk3z,1,1,0|q7xk40,27,10,1|qiqg3z,27,10,1|qiqg40,1,1,0|qqnmrz,1,1,0|qqnms0,27,10,1|r1thfz,27,10,1|r1thg0,1,1,0|r9dpfz,1,1,0|r9dpg0,27,10,1|rkjk3z,27,10,1|rkjk40,1,1,0|rs3s3z,1,1,0|rs3s40,27,10,1|s39mrz,27,10,1|s39ms0,1,1,0|sb6tfz,1,1,0|sb6tg0,27,10,1|slzpfz,27,10,1|slzpg0,1,1,0|stww3z,1,1,0|stww40,27,10,1|t4ps3z,27,10,1|t4ps40,1,1,0|tcmyrz,1,1,0|tcmys0,27,10,1|tnfurz,27,10,1|tnfus0,1,1,0|tvd1fz,1,1,0|tvd1g0,27,10,1|u6iw3z,27,10,1|u6iw40,1,1,0|ue343z,1,1,0|ue3440,27,10,1|up8yrz,27,10,1|up8ys0,1,1,0|uwt6rz,1,1,0|uwt6s0,27,10,1|v7z1fz,27,10,1|v7z1g0,1,1,0|vfw83z,1,1,0|vfw840,27,10,1|vqp43z,27,10,1|vqp440,1,1,0|vymarz,1,1,0|vymas0,27,10,1|w9f6rz,27,10,1|w9f6s0,1,1,0|whcdfz,1,1,0|whcdg0,27,10,1|wsi83z,27,10,1|wsi840,1,1,0|x02g3z,1,1,0|x02g40,27,10,1|xb8arz,27,10,1|xb8as0,1,1,0|xisirz,1,1,0|xisis0,27,10,1|xtydfz,27,10,1|xtydg0,1,1,0|y1ilfz,1,1,0|y1ilg0,27,10,1|ycog3z,27,10,1|ycog40,1,1,0|yklmrz,1,1,0|yklms0,27,10,1|yveirz,27,10,1|yveis0,1,1,0|z3bpfz,1,1,0|z3bpg0,27,10,1|ze4lfz,27,10,1|ze4lg0,1,1,0\",\"Europe/Helsinki|,0,348,0|-1bss9yd,77,348,0|-peghye,77,348,0|-peghyd,15,11,0|-ehco81,15,11,0|-ehco80,16,6,1|-e7vxk1,16,6,1|-e7vxk0,15,11,0|5v5unz,15,11,0|5v5uo0,16,6,1|64ivzz,16,6,1|64iw00,15,11,0|6dvxbz,15,11,0|6dvxc0,16,6,1|6n8ynz,16,6,1|6n8yo0,15,11,0|6wm2rz,15,11,0|6wm2s0,16,6,1|75z43z,16,6,1|75z440,15,11,0|7fc5fz,15,11,0|7fc5g0,16,6,1|7p25fz,16,6,1|7p25g0,15,11,0|7yf6rz,15,11,0|7yf6s0,16,6,1|87s83z,16,6,1|87s840,15,11,0|8h59fz,15,11,0|8h59g0,16,6,1|8qiarz,16,6,1|8qias0,15,11,0|8zvc3z,15,11,0|8zvc40,16,6,1|998dfz,16,6,1|998dg0,15,11,0|9ilerz,15,11,0|9iles0,16,6,1|9ryg3z,16,6,1|9ryg40,15,11,0|a1bhfz,15,11,0|a1bhg0,16,6,1|aaoirz,16,6,1|aaois0,15,11,0|ak1k3z,15,11,0|ak1k40,16,6,1|atrk3z,16,6,1|atrk40,15,11,0|b34lfz,15,11,0|b34lg0,16,6,1|bchmrz,16,6,1|bchms0,15,11,0|bluo3z,15,11,0|bluo40,16,6,1|bv7pfz,16,6,1|bv7pg0,15,11,0|c4kqrz,15,11,0|c4kqs0,16,6,1|cdxs3z,16,6,1|cdxs40,15,11,0|cnatfz,15,11,0|cnatg0,16,6,1|cwnurz,16,6,1|cwnus0,15,11,0|d60w3z,15,11,0|d60w40,16,6,1|dfdxfz,16,6,1|dfdxg0,15,11,0|dp3xfz,15,11,0|dp3xg0,16,6,1|dzwtfz,16,6,1|dzwtg0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Isle_of_Man|,0,347,0|-1rprx9x,1,1,0|-rzcns1,1,1,0|-rzcns0,27,10,1|-rsid41,27,10,1|-rsid40,1,1,0|-risd41,1,1,0|-risd40,27,10,1|-ragd41,27,10,1|-ragd40,1,1,0|-r0s7s1,1,1,0|-r0s7s0,27,10,1|-qr0d41,27,10,1|-qr0d40,1,1,0|-qhp6g1,1,1,0|-qhp6g0,27,10,1|-q8aag1,27,10,1|-q8aag0,1,1,0|-pyz3s1,1,1,0|-pyz3s0,27,10,1|-po4d41,27,10,1|-po4d40,1,1,0|-pfw2g1,1,1,0|-pfw2g0,27,10,1|-p6h6g1,27,10,1|-p6h6g0,1,1,0|-oxiyg1,1,1,0|-oxiyg0,27,10,1|-onfzs1,27,10,1|-onfzs0,1,1,0|-odd141,1,1,0|-odd140,27,10,1|-o5st41,27,10,1|-o5st40,1,1,0|-nuzx41,1,1,0|-nuzx40,27,10,1|-nmprs1,27,10,1|-nmprs0,1,1,0|-nbwvs1,1,1,0|-nbwvs0,27,10,1|-n39rs1,27,10,1|-n39rs0,1,1,0|-mt6t41,1,1,0|-mt6t40,27,10,1|-mkjp41,27,10,1|-mkjp40,1,1,0|-matp41,1,1,0|-matp40,27,10,1|-m1tmg1,27,10,1|-m1tmg0,1,1,0|-lrdp41,1,1,0|-lrdp40,27,10,1|-liql41,27,10,1|-liql40,1,1,0|-l8nmg1,1,1,0|-l8nmg0,27,10,1|-l00ig1,27,10,1|-l00ig0,1,1,0|-kqaig1,1,1,0|-kqaig0,27,10,1|-khafs1,27,10,1|-khafs0,1,1,0|-k77h41,1,1,0|-k77h40,27,10,1|-jykd41,27,10,1|-jykd40,1,1,0|-joheg1,1,1,0|-joheg0,27,10,1|-jfuag1,27,10,1|-jfuag0,1,1,0|-j64ag1,1,1,0|-j64ag0,27,10,1|-iwr941,27,10,1|-iwr940,1,1,0|-imoag1,1,1,0|-imoag0,27,10,1|-ie16g1,27,10,1|-ie16g0,1,1,0|-i4b6g1,1,1,0|-i4b6g0,27,10,1|-hvb3s1,27,10,1|-hvb3s0,1,1,0|-hl8541,1,1,0|-hl8540,27,10,1|-hcl141,27,10,1|-hcl140,1,1,0|-h2i2g1,1,1,0|-h2i2g0,27,10,1|-gtuyg1,27,10,1|-gtuyg0,1,1,0|-gk4yg1,1,1,0|-gk4yg0,27,10,1|-gb4vs1,27,10,1|-gb4vs0,1,1,0|-g11x41,1,1,0|-g11x40,27,10,1|-fpw2g1,27,10,1|-fpw2g0,1,1,0|-fkul41,1,1,0|-fkul40,27,10,1|-eyiyk1,27,10,1|-eyiyk0,151,11,1|-ethh81,151,11,1|-ethh80,27,10,1|-eh8qk1,27,10,1|-eh8qk0,151,11,1|-earek1,151,11,1|-earek0,27,10,1|-dyinw1,27,10,1|-dyinw0,151,11,1|-drod81,151,11,1|-drod80,27,10,1|-dfsl81,27,10,1|-dfsl80,151,11,1|-d75h81,151,11,1|-d75h80,27,10,1|-cx0nw1,27,10,1|-cx0nw0,151,11,1|-cro2k1,151,11,1|-cro2k0,27,10,1|-cncfs1,27,10,1|-cncfs0,1,1,0|-cdmfs1,1,1,0|-cdmfs0,27,10,1|-c4md41,27,10,1|-c4md40,1,1,0|-bwc7s1,1,1,0|-bwc7s0,27,10,1|-buwfw1,27,10,1|-buwfw0,151,11,1|-bos2k1,151,11,1|-bos2k0,27,10,1|-bkgfs1,27,10,1|-bkgfs0,1,1,0|-bdm541,1,1,0|-bdm540,27,10,1|-b1qd41,27,10,1|-b1qd40,1,1,0|-att6g1,1,1,0|-att6g0,27,10,1|-aj0ag1,27,10,1|-aj0ag0,1,1,0|-aad6g1,1,1,0|-aad6g0,27,10,1|-a0n6g1,27,10,1|-a0n6g0,1,1,0|-9rn3s1,1,1,0|-9rn3s0,27,10,1|-9hx3s1,27,10,1|-9hx3s0,1,1,0|-98k2g1,1,1,0|-98k2g0,27,10,1|-8yu2g1,27,10,1|-8yu2g0,1,1,0|-8ptzs1,1,1,0|-8ptzs0,27,10,1|-8h6vs1,27,10,1|-8h6vs0,1,1,0|-87gvs1,1,1,0|-87gvs0,27,10,1|-7ygt41,27,10,1|-7ygt40,1,1,0|-7odug1,1,1,0|-7odug0,27,10,1|-7fqqg1,27,10,1|-7fqqg0,1,1,0|-75at41,1,1,0|-75at40,27,10,1|-6wnp41,27,10,1|-6wnp40,1,1,0|-6mxp41,1,1,0|-6mxp40,27,10,1|-6dxmg1,27,10,1|-6dxmg0,1,1,0|-63uns1,1,1,0|-63uns0,27,10,1|-5v7js1,27,10,1|-5v7js0,1,1,0|-5l4l41,1,1,0|-5l4l40,27,10,1|-5chh41,27,10,1|-5chh40,1,1,0|-52rh41,1,1,0|-52rh40,27,10,1|-4treg1,27,10,1|-4treg0,1,1,0|-4krbs1,1,1,0|-4krbs0,27,10,1|-49lh41,27,10,1|-49lh40,1,1,0|-421941,1,1,0|-421940,27,10,1|-3qveg1,27,10,1|-3qveg0,1,1,0|-3iy7s1,1,1,0|-3iy7s0,27,10,1|-385bs1,27,10,1|-385bs0,1,1,0|-30l3s1,1,1,0|-30l3s0,27,10,1|-2pf941,27,10,1|-2pf940,1,1,0|-2hv141,1,1,0|-2hv140,27,10,1|-26p6g1,27,10,1|-26p6g0,1,1,0|-1z4yg1,1,1,0|-1z4yg0,27,10,1|-1nz3s1,27,10,1|-1nz3s0,1,1,0|-1gevs1,1,1,0|-1gevs0,27,10,1|-14w2g1,27,10,1|-14w2g0,1,1,0|-z4ns1,1,1,0|-z4ns0,27,10,1|-m6841,27,10,1|-m6840,27,10,0|yd6vz,27,10,0|yd6w0,1,1,0|15kg7z,1,1,0|15kg80,27,10,1|1h39jz,27,10,1|1h39k0,1,1,0|1oaivz,1,1,0|1oaiw0,27,10,1|1ztc7z,27,10,1|1ztc80,1,1,0|270ljz,1,1,0|270lk0,27,10,1|2ijevz,27,10,1|2ijew0,1,1,0|2pqo7z,1,1,0|2pqo80,27,10,1|319hjz,27,10,1|319hk0,1,1,0|38tpjz,1,1,0|38tpk0,27,10,1|3jzk7z,27,10,1|3jzk80,1,1,0|3rjs7z,1,1,0|3rjs80,27,10,1|42pmvz,27,10,1|42pmw0,1,1,0|4a9uvz,1,1,0|4a9uw0,27,10,1|4lso7z,27,10,1|4lso80,1,1,0|4szxjz,1,1,0|4szxk0,27,10,1|54iqvz,27,10,1|54iqw0,1,1,0|5bq07z,1,1,0|5bq080,27,10,1|5n8tjz,27,10,1|5n8tk0,1,1,0|5v5xfz,1,1,0|5v5xg0,27,10,1|65ytfz,27,10,1|65ytg0,1,1,0|6dw03z,1,1,0|6dw040,27,10,1|6oow3z,27,10,1|6oow40,1,1,0|6wm2rz,1,1,0|6wm2s0,27,10,1|77eyrz,27,10,1|77eys0,1,1,0|7fc5fz,1,1,0|7fc5g0,27,10,1|7qi03z,27,10,1|7qi040,1,1,0|7yf6rz,1,1,0|7yf6s0,27,10,1|8982rz,27,10,1|8982s0,1,1,0|8h59fz,1,1,0|8h59g0,27,10,1|8ry5fz,27,10,1|8ry5g0,1,1,0|8zvc3z,1,1,0|8zvc40,27,10,1|9ao83z,27,10,1|9ao840,1,1,0|9ilerz,1,1,0|9iles0,27,10,1|9tearz,27,10,1|9teas0,1,1,0|a1bhfz,1,1,0|a1bhg0,27,10,1|achc3z,27,10,1|achc40,1,1,0|ak1k3z,1,1,0|ak1k40,27,10,1|av7erz,27,10,1|av7es0,1,1,0|b34lfz,1,1,0|b34lg0,27,10,1|bdxhfz,27,10,1|bdxhg0,1,1,0|bluo3z,1,1,0|bluo40,27,10,1|bwnk3z,27,10,1|bwnk40,1,1,0|c4kqrz,1,1,0|c4kqs0,27,10,1|cfdmrz,27,10,1|cfdms0,1,1,0|cnatfz,1,1,0|cnatg0,27,10,1|cy3pfz,27,10,1|cy3pg0,1,1,0|d60w3z,1,1,0|d60w40,27,10,1|dgts3z,27,10,1|dgts40,1,1,0|dp3xfz,1,1,0|dp3xg0,27,10,1|dzwtfz,27,10,1|dzwtg0,1,1,0|e7u03z,1,1,0|e7u040,27,10,1|eimw3z,27,10,1|eimw40,1,1,0|eqk2rz,1,1,0|eqk2s0,27,10,1|f1cyrz,27,10,1|f1cys0,1,1,0|f9a5fz,1,1,0|f9a5g0,27,10,1|fkg03z,27,10,1|fkg040,1,1,0|fs083z,1,1,0|fs0840,27,10,1|g362rz,27,10,1|g362s0,1,1,0|gaqarz,1,1,0|gaqas0,27,10,1|glw5fz,27,10,1|glw5g0,1,1,0|gttc3z,1,1,0|gttc40,27,10,1|h4m83z,27,10,1|h4m840,1,1,0|hcjerz,1,1,0|hcjes0,27,10,1|hncarz,27,10,1|hncas0,1,1,0|hv9hfz,1,1,0|hv9hg0,27,10,1|i6fc3z,27,10,1|i6fc40,1,1,0|idzk3z,1,1,0|idzk40,27,10,1|ip5erz,27,10,1|ip5es0,1,1,0|iwpmrz,1,1,0|iwpms0,27,10,1|j7vhfz,27,10,1|j7vhg0,1,1,0|jffpfz,1,1,0|jffpg0,27,10,1|jqlk3z,27,10,1|jqlk40,1,1,0|jyiqrz,1,1,0|jyiqs0,27,10,1|k9bmrz,27,10,1|k9bms0,1,1,0|kh8tfz,1,1,0|kh8tg0,27,10,1|ks1pfz,27,10,1|ks1pg0,1,1,0|kzyw3z,1,1,0|kzyw40,27,10,1|lb4qrz,27,10,1|lb4qs0,1,1,0|lioyrz,1,1,0|lioys0,27,10,1|ltutfz,27,10,1|ltutg0,1,1,0|m1f1fz,1,1,0|m1f1g0,27,10,1|mckw3z,27,10,1|mckw40,1,1,0|mki2rz,1,1,0|mki2s0,27,10,1|mvayrz,27,10,1|mvays0,1,1,0|n385fz,1,1,0|n385g0,27,10,1|ne11fz,27,10,1|ne11g0,1,1,0|nly83z,1,1,0|nly840,27,10,1|nwr43z,27,10,1|nwr440,1,1,0|o4oarz,1,1,0|o4oas0,27,10,1|ofu5fz,27,10,1|ofu5g0,1,1,0|onedfz,1,1,0|onedg0,27,10,1|oyk83z,27,10,1|oyk840,1,1,0|p64g3z,1,1,0|p64g40,27,10,1|phaarz,27,10,1|phaas0,1,1,0|pp7hfz,1,1,0|pp7hg0,27,10,1|q00dfz,27,10,1|q00dg0,1,1,0|q7xk3z,1,1,0|q7xk40,27,10,1|qiqg3z,27,10,1|qiqg40,1,1,0|qqnmrz,1,1,0|qqnms0,27,10,1|r1thfz,27,10,1|r1thg0,1,1,0|r9dpfz,1,1,0|r9dpg0,27,10,1|rkjk3z,27,10,1|rkjk40,1,1,0|rs3s3z,1,1,0|rs3s40,27,10,1|s39mrz,27,10,1|s39ms0,1,1,0|sb6tfz,1,1,0|sb6tg0,27,10,1|slzpfz,27,10,1|slzpg0,1,1,0|stww3z,1,1,0|stww40,27,10,1|t4ps3z,27,10,1|t4ps40,1,1,0|tcmyrz,1,1,0|tcmys0,27,10,1|tnfurz,27,10,1|tnfus0,1,1,0|tvd1fz,1,1,0|tvd1g0,27,10,1|u6iw3z,27,10,1|u6iw40,1,1,0|ue343z,1,1,0|ue3440,27,10,1|up8yrz,27,10,1|up8ys0,1,1,0|uwt6rz,1,1,0|uwt6s0,27,10,1|v7z1fz,27,10,1|v7z1g0,1,1,0|vfw83z,1,1,0|vfw840,27,10,1|vqp43z,27,10,1|vqp440,1,1,0|vymarz,1,1,0|vymas0,27,10,1|w9f6rz,27,10,1|w9f6s0,1,1,0|whcdfz,1,1,0|whcdg0,27,10,1|wsi83z,27,10,1|wsi840,1,1,0|x02g3z,1,1,0|x02g40,27,10,1|xb8arz,27,10,1|xb8as0,1,1,0|xisirz,1,1,0|xisis0,27,10,1|xtydfz,27,10,1|xtydg0,1,1,0|y1ilfz,1,1,0|y1ilg0,27,10,1|ycog3z,27,10,1|ycog40,1,1,0|yklmrz,1,1,0|yklms0,27,10,1|yveirz,27,10,1|yveis0,1,1,0|z3bpfz,1,1,0|z3bpg0,27,10,1|ze4lfz,27,10,1|ze4lg0,1,1,0\",\"Europe/Istanbul|,0,349,0|-1ayy814,117,350,0|-ux9xex,117,350,0|-ux9xew,15,11,0|-s0e081,15,11,0|-s0e080,16,6,1|-rsir01,16,6,1|-rsir00,15,11,0|-pyzew1,15,11,0|-pyzew0,16,6,1|-po4r01,16,6,1|-po4r00,15,11,0|-pfwdk1,15,11,0|-pfwdk0,16,6,1|-p6hkc1,16,6,1|-p6hkc0,15,11,0|-oxj9k1,15,11,0|-oxj9k0,16,6,1|-ongdo1,16,6,1|-ongdo0,15,11,0|-ntgo81,15,11,0|-ntgo80,16,6,1|-nm7n01,16,6,1|-nm7n00,15,11,0|-nbayw1,15,11,0|-nbayw0,16,6,1|-n3fpo1,16,6,1|-n3fpo0,15,11,0|-febpk1,15,11,0|-febpk0,16,6,1|-f9c5o1,16,6,1|-f9c5o0,15,11,0|-f6gdk1,15,11,0|-f6gdk0,16,6,1|-erc0c1,16,6,1|-erc0c0,15,11,0|-ehgdk1,15,11,0|-ehgdk0,16,6,1|-cnaz01,16,6,1|-cnaz00,15,11,0|-cb5uw1,15,11,0|-cb5uw0,16,6,1|-c4w0c1,16,6,1|-c4w0c0,15,11,0|-bujpk1,15,11,0|-bujpk0,16,6,1|-blwoc1,16,6,1|-blwoc0,15,11,0|-bbtmw1,15,11,0|-bbtmw0,16,6,1|-b36lo1,16,6,1|-b36lo0,15,11,0|-atgiw1,15,11,0|-atgiw0,16,6,1|-akgj01,16,6,1|-akgj00,15,11,0|-aadhk1,15,11,0|-aadhk0,16,6,1|-a1dho1,16,6,1|-a1dho0,15,11,0|-9rag81,15,11,0|-9rag80,16,6,1|-9inf01,16,6,1|-9inf00,15,11,0|-3wa5k1,15,11,0|-3wa5k0,16,6,1|-3805o1,16,6,1|-3805o0,15,11,0|-2xtew1,15,11,0|-2xtew0,16,6,1|-2qo301,16,6,1|-2qo300,15,11,0|1s8vvz,15,11,0|1s8vw0,16,6,1|2062jz,16,6,1|2062k0,15,11,0|27qdbz,15,11,0|27qdc0,16,6,1|2iw57z,16,6,1|2iw580,15,11,0|2q1mnz,15,11,0|2q1mo0,16,6,1|31m7vz,16,6,1|31m7w0,15,11,0|38tjzz,15,11,0|38tk00,16,6,1|3kcajz,16,6,1|3kcak0,15,11,0|3s9jzz,15,11,0|3s9k00,16,6,1|42cfvz,16,6,1|42cfw0,15,11,0|4azmnz,15,11,0|4azmo0,16,6,1|4ficzz,16,6,1|4fid00,100,6,0|73397z,100,6,0|733980,105,209,1|76bufz,105,209,1|76bug0,100,6,0|7qp97z,100,6,0|7qp980,15,11,0|7zg2jz,15,11,0|7zg2k0,16,6,1|87q7vz,16,6,1|87q7w0,15,11,0|8h53vz,15,11,0|8h53w0,16,6,1|8qi57z,16,6,1|8qi580,15,11,0|8zv6jz,15,11,0|8zv6k0,16,6,1|9987vz,16,6,1|9987w0,15,11,0|9il97z,15,11,0|9il980,16,6,1|9ryajz,16,6,1|9ryak0,15,11,0|a1bbvz,15,11,0|a1bbw0,16,6,1|aaod7z,16,6,1|aaod80,15,11,0|ak1ejz,15,11,0|ak1ek0,16,6,1|atrejz,16,6,1|atrek0,15,11,0|b34fvz,15,11,0|b34fw0,16,6,1|bchh7z,16,6,1|bchh80,15,11,0|bluijz,15,11,0|bluik0,16,6,1|bv7jvz,16,6,1|bv7jw0,15,11,0|c4kl7z,15,11,0|c4kl80,16,6,1|cdxmjz,16,6,1|cdxmk0,15,11,0|cmxp7z,15,11,0|cmxp80,16,6,1|cwnp7z,16,6,1|cwnp80,15,11,0|d60qjz,15,11,0|d60qk0,16,6,1|dfdrvz,16,6,1|dfdrw0,15,11,0|dp3rvz,15,11,0|dp3rw0,16,6,1|dzwnvz,16,6,1|dzwnw0,15,11,0|e7tujz,15,11,0|e7tuk0,16,6,1|eimqjz,16,6,1|eimqk0,15,11,0|eqjx7z,15,11,0|eqjx80,16,6,1|f1ct7z,16,6,1|f1ct80,15,11,0|f99zvz,15,11,0|f99zw0,16,6,1|fkfujz,16,6,1|fkfuk0,15,11,0|fs02jz,15,11,0|fs02k0,16,6,1|g35x7z,16,6,1|g35x80,15,11,0|gaq57z,15,11,0|gaq580,16,6,1|glvzvz,16,6,1|glvzw0,15,11,0|gtt6jz,15,11,0|gtt6k0,16,6,1|h4m2jz,16,6,1|h4m2k0,15,11,0|hcj97z,15,11,0|hcj980,16,6,1|hnc57z,16,6,1|hnc580,15,11,0|hv9bvz,15,11,0|hv9bw0,16,6,1|i6f6jz,16,6,1|i6f6k0,15,11,0|idzejz,15,11,0|idzek0,16,6,1|ip597z,16,6,1|ip5980,15,11,0|iwph7z,15,11,0|iwph80,16,6,1|j7vbvz,16,6,1|j7vbw0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|liqtfz,15,11,0|liqtg0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n3a03z,15,11,0|n3a040,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nxh1fz,16,6,1|nxh1g0,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|od3ozz,16,6,1|od3p00,100,6,0\",\"Europe/Jersey|,0,347,0|-1rprx9x,1,1,0|-rzcns1,1,1,0|-rzcns0,27,10,1|-rsid41,27,10,1|-rsid40,1,1,0|-risd41,1,1,0|-risd40,27,10,1|-ragd41,27,10,1|-ragd40,1,1,0|-r0s7s1,1,1,0|-r0s7s0,27,10,1|-qr0d41,27,10,1|-qr0d40,1,1,0|-qhp6g1,1,1,0|-qhp6g0,27,10,1|-q8aag1,27,10,1|-q8aag0,1,1,0|-pyz3s1,1,1,0|-pyz3s0,27,10,1|-po4d41,27,10,1|-po4d40,1,1,0|-pfw2g1,1,1,0|-pfw2g0,27,10,1|-p6h6g1,27,10,1|-p6h6g0,1,1,0|-oxiyg1,1,1,0|-oxiyg0,27,10,1|-onfzs1,27,10,1|-onfzs0,1,1,0|-odd141,1,1,0|-odd140,27,10,1|-o5st41,27,10,1|-o5st40,1,1,0|-nuzx41,1,1,0|-nuzx40,27,10,1|-nmprs1,27,10,1|-nmprs0,1,1,0|-nbwvs1,1,1,0|-nbwvs0,27,10,1|-n39rs1,27,10,1|-n39rs0,1,1,0|-mt6t41,1,1,0|-mt6t40,27,10,1|-mkjp41,27,10,1|-mkjp40,1,1,0|-matp41,1,1,0|-matp40,27,10,1|-m1tmg1,27,10,1|-m1tmg0,1,1,0|-lrdp41,1,1,0|-lrdp40,27,10,1|-liql41,27,10,1|-liql40,1,1,0|-l8nmg1,1,1,0|-l8nmg0,27,10,1|-l00ig1,27,10,1|-l00ig0,1,1,0|-kqaig1,1,1,0|-kqaig0,27,10,1|-khafs1,27,10,1|-khafs0,1,1,0|-k77h41,1,1,0|-k77h40,27,10,1|-jykd41,27,10,1|-jykd40,1,1,0|-joheg1,1,1,0|-joheg0,27,10,1|-jfuag1,27,10,1|-jfuag0,1,1,0|-j64ag1,1,1,0|-j64ag0,27,10,1|-iwr941,27,10,1|-iwr940,1,1,0|-imoag1,1,1,0|-imoag0,27,10,1|-ie16g1,27,10,1|-ie16g0,1,1,0|-i4b6g1,1,1,0|-i4b6g0,27,10,1|-hvb3s1,27,10,1|-hvb3s0,1,1,0|-hl8541,1,1,0|-hl8540,27,10,1|-hcl141,27,10,1|-hcl140,1,1,0|-h2i2g1,1,1,0|-h2i2g0,27,10,1|-gtuyg1,27,10,1|-gtuyg0,1,1,0|-gk4yg1,1,1,0|-gk4yg0,27,10,1|-gb4vs1,27,10,1|-gb4vs0,1,1,0|-g11x41,1,1,0|-g11x40,27,10,1|-fpw2g1,27,10,1|-fpw2g0,1,1,0|-fkul41,1,1,0|-fkul40,27,10,1|-eyiyk1,27,10,1|-eyiyk0,151,11,1|-ethh81,151,11,1|-ethh80,27,10,1|-eh8qk1,27,10,1|-eh8qk0,151,11,1|-earek1,151,11,1|-earek0,27,10,1|-dyinw1,27,10,1|-dyinw0,151,11,1|-drod81,151,11,1|-drod80,27,10,1|-dfsl81,27,10,1|-dfsl80,151,11,1|-d75h81,151,11,1|-d75h80,27,10,1|-cx0nw1,27,10,1|-cx0nw0,151,11,1|-cro2k1,151,11,1|-cro2k0,27,10,1|-cncfs1,27,10,1|-cncfs0,1,1,0|-cdmfs1,1,1,0|-cdmfs0,27,10,1|-c4md41,27,10,1|-c4md40,1,1,0|-bwc7s1,1,1,0|-bwc7s0,27,10,1|-buwfw1,27,10,1|-buwfw0,151,11,1|-bos2k1,151,11,1|-bos2k0,27,10,1|-bkgfs1,27,10,1|-bkgfs0,1,1,0|-bdm541,1,1,0|-bdm540,27,10,1|-b1qd41,27,10,1|-b1qd40,1,1,0|-att6g1,1,1,0|-att6g0,27,10,1|-aj0ag1,27,10,1|-aj0ag0,1,1,0|-aad6g1,1,1,0|-aad6g0,27,10,1|-a0n6g1,27,10,1|-a0n6g0,1,1,0|-9rn3s1,1,1,0|-9rn3s0,27,10,1|-9hx3s1,27,10,1|-9hx3s0,1,1,0|-98k2g1,1,1,0|-98k2g0,27,10,1|-8yu2g1,27,10,1|-8yu2g0,1,1,0|-8ptzs1,1,1,0|-8ptzs0,27,10,1|-8h6vs1,27,10,1|-8h6vs0,1,1,0|-87gvs1,1,1,0|-87gvs0,27,10,1|-7ygt41,27,10,1|-7ygt40,1,1,0|-7odug1,1,1,0|-7odug0,27,10,1|-7fqqg1,27,10,1|-7fqqg0,1,1,0|-75at41,1,1,0|-75at40,27,10,1|-6wnp41,27,10,1|-6wnp40,1,1,0|-6mxp41,1,1,0|-6mxp40,27,10,1|-6dxmg1,27,10,1|-6dxmg0,1,1,0|-63uns1,1,1,0|-63uns0,27,10,1|-5v7js1,27,10,1|-5v7js0,1,1,0|-5l4l41,1,1,0|-5l4l40,27,10,1|-5chh41,27,10,1|-5chh40,1,1,0|-52rh41,1,1,0|-52rh40,27,10,1|-4treg1,27,10,1|-4treg0,1,1,0|-4krbs1,1,1,0|-4krbs0,27,10,1|-49lh41,27,10,1|-49lh40,1,1,0|-421941,1,1,0|-421940,27,10,1|-3qveg1,27,10,1|-3qveg0,1,1,0|-3iy7s1,1,1,0|-3iy7s0,27,10,1|-385bs1,27,10,1|-385bs0,1,1,0|-30l3s1,1,1,0|-30l3s0,27,10,1|-2pf941,27,10,1|-2pf940,1,1,0|-2hv141,1,1,0|-2hv140,27,10,1|-26p6g1,27,10,1|-26p6g0,1,1,0|-1z4yg1,1,1,0|-1z4yg0,27,10,1|-1nz3s1,27,10,1|-1nz3s0,1,1,0|-1gevs1,1,1,0|-1gevs0,27,10,1|-14w2g1,27,10,1|-14w2g0,1,1,0|-z4ns1,1,1,0|-z4ns0,27,10,1|-m6841,27,10,1|-m6840,27,10,0|yd6vz,27,10,0|yd6w0,1,1,0|15kg7z,1,1,0|15kg80,27,10,1|1h39jz,27,10,1|1h39k0,1,1,0|1oaivz,1,1,0|1oaiw0,27,10,1|1ztc7z,27,10,1|1ztc80,1,1,0|270ljz,1,1,0|270lk0,27,10,1|2ijevz,27,10,1|2ijew0,1,1,0|2pqo7z,1,1,0|2pqo80,27,10,1|319hjz,27,10,1|319hk0,1,1,0|38tpjz,1,1,0|38tpk0,27,10,1|3jzk7z,27,10,1|3jzk80,1,1,0|3rjs7z,1,1,0|3rjs80,27,10,1|42pmvz,27,10,1|42pmw0,1,1,0|4a9uvz,1,1,0|4a9uw0,27,10,1|4lso7z,27,10,1|4lso80,1,1,0|4szxjz,1,1,0|4szxk0,27,10,1|54iqvz,27,10,1|54iqw0,1,1,0|5bq07z,1,1,0|5bq080,27,10,1|5n8tjz,27,10,1|5n8tk0,1,1,0|5v5xfz,1,1,0|5v5xg0,27,10,1|65ytfz,27,10,1|65ytg0,1,1,0|6dw03z,1,1,0|6dw040,27,10,1|6oow3z,27,10,1|6oow40,1,1,0|6wm2rz,1,1,0|6wm2s0,27,10,1|77eyrz,27,10,1|77eys0,1,1,0|7fc5fz,1,1,0|7fc5g0,27,10,1|7qi03z,27,10,1|7qi040,1,1,0|7yf6rz,1,1,0|7yf6s0,27,10,1|8982rz,27,10,1|8982s0,1,1,0|8h59fz,1,1,0|8h59g0,27,10,1|8ry5fz,27,10,1|8ry5g0,1,1,0|8zvc3z,1,1,0|8zvc40,27,10,1|9ao83z,27,10,1|9ao840,1,1,0|9ilerz,1,1,0|9iles0,27,10,1|9tearz,27,10,1|9teas0,1,1,0|a1bhfz,1,1,0|a1bhg0,27,10,1|achc3z,27,10,1|achc40,1,1,0|ak1k3z,1,1,0|ak1k40,27,10,1|av7erz,27,10,1|av7es0,1,1,0|b34lfz,1,1,0|b34lg0,27,10,1|bdxhfz,27,10,1|bdxhg0,1,1,0|bluo3z,1,1,0|bluo40,27,10,1|bwnk3z,27,10,1|bwnk40,1,1,0|c4kqrz,1,1,0|c4kqs0,27,10,1|cfdmrz,27,10,1|cfdms0,1,1,0|cnatfz,1,1,0|cnatg0,27,10,1|cy3pfz,27,10,1|cy3pg0,1,1,0|d60w3z,1,1,0|d60w40,27,10,1|dgts3z,27,10,1|dgts40,1,1,0|dp3xfz,1,1,0|dp3xg0,27,10,1|dzwtfz,27,10,1|dzwtg0,1,1,0|e7u03z,1,1,0|e7u040,27,10,1|eimw3z,27,10,1|eimw40,1,1,0|eqk2rz,1,1,0|eqk2s0,27,10,1|f1cyrz,27,10,1|f1cys0,1,1,0|f9a5fz,1,1,0|f9a5g0,27,10,1|fkg03z,27,10,1|fkg040,1,1,0|fs083z,1,1,0|fs0840,27,10,1|g362rz,27,10,1|g362s0,1,1,0|gaqarz,1,1,0|gaqas0,27,10,1|glw5fz,27,10,1|glw5g0,1,1,0|gttc3z,1,1,0|gttc40,27,10,1|h4m83z,27,10,1|h4m840,1,1,0|hcjerz,1,1,0|hcjes0,27,10,1|hncarz,27,10,1|hncas0,1,1,0|hv9hfz,1,1,0|hv9hg0,27,10,1|i6fc3z,27,10,1|i6fc40,1,1,0|idzk3z,1,1,0|idzk40,27,10,1|ip5erz,27,10,1|ip5es0,1,1,0|iwpmrz,1,1,0|iwpms0,27,10,1|j7vhfz,27,10,1|j7vhg0,1,1,0|jffpfz,1,1,0|jffpg0,27,10,1|jqlk3z,27,10,1|jqlk40,1,1,0|jyiqrz,1,1,0|jyiqs0,27,10,1|k9bmrz,27,10,1|k9bms0,1,1,0|kh8tfz,1,1,0|kh8tg0,27,10,1|ks1pfz,27,10,1|ks1pg0,1,1,0|kzyw3z,1,1,0|kzyw40,27,10,1|lb4qrz,27,10,1|lb4qs0,1,1,0|lioyrz,1,1,0|lioys0,27,10,1|ltutfz,27,10,1|ltutg0,1,1,0|m1f1fz,1,1,0|m1f1g0,27,10,1|mckw3z,27,10,1|mckw40,1,1,0|mki2rz,1,1,0|mki2s0,27,10,1|mvayrz,27,10,1|mvays0,1,1,0|n385fz,1,1,0|n385g0,27,10,1|ne11fz,27,10,1|ne11g0,1,1,0|nly83z,1,1,0|nly840,27,10,1|nwr43z,27,10,1|nwr440,1,1,0|o4oarz,1,1,0|o4oas0,27,10,1|ofu5fz,27,10,1|ofu5g0,1,1,0|onedfz,1,1,0|onedg0,27,10,1|oyk83z,27,10,1|oyk840,1,1,0|p64g3z,1,1,0|p64g40,27,10,1|phaarz,27,10,1|phaas0,1,1,0|pp7hfz,1,1,0|pp7hg0,27,10,1|q00dfz,27,10,1|q00dg0,1,1,0|q7xk3z,1,1,0|q7xk40,27,10,1|qiqg3z,27,10,1|qiqg40,1,1,0|qqnmrz,1,1,0|qqnms0,27,10,1|r1thfz,27,10,1|r1thg0,1,1,0|r9dpfz,1,1,0|r9dpg0,27,10,1|rkjk3z,27,10,1|rkjk40,1,1,0|rs3s3z,1,1,0|rs3s40,27,10,1|s39mrz,27,10,1|s39ms0,1,1,0|sb6tfz,1,1,0|sb6tg0,27,10,1|slzpfz,27,10,1|slzpg0,1,1,0|stww3z,1,1,0|stww40,27,10,1|t4ps3z,27,10,1|t4ps40,1,1,0|tcmyrz,1,1,0|tcmys0,27,10,1|tnfurz,27,10,1|tnfus0,1,1,0|tvd1fz,1,1,0|tvd1g0,27,10,1|u6iw3z,27,10,1|u6iw40,1,1,0|ue343z,1,1,0|ue3440,27,10,1|up8yrz,27,10,1|up8ys0,1,1,0|uwt6rz,1,1,0|uwt6s0,27,10,1|v7z1fz,27,10,1|v7z1g0,1,1,0|vfw83z,1,1,0|vfw840,27,10,1|vqp43z,27,10,1|vqp440,1,1,0|vymarz,1,1,0|vymas0,27,10,1|w9f6rz,27,10,1|w9f6s0,1,1,0|whcdfz,1,1,0|whcdg0,27,10,1|wsi83z,27,10,1|wsi840,1,1,0|x02g3z,1,1,0|x02g40,27,10,1|xb8arz,27,10,1|xb8as0,1,1,0|xisirz,1,1,0|xisis0,27,10,1|xtydfz,27,10,1|xtydg0,1,1,0|y1ilfz,1,1,0|y1ilg0,27,10,1|ycog3z,27,10,1|ycog40,1,1,0|yklmrz,1,1,0|yklms0,27,10,1|yveirz,27,10,1|yveis0,1,1,0|z3bpfz,1,1,0|z3bpg0,27,10,1|ze4lfz,27,10,1|ze4lg0,1,1,0\",\"Europe/Kaliningrad|,0,332,0|-14212go,10,10,0|-s0e081,10,10,0|-s0e080,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-fizzw1,10,10,0|-fizzw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cwm2w1,11,11,1|-cwm2w0,15,11,0|-cvmw81,15,11,0|-cvmw80,16,6,1|-cm2j01,16,6,1|-cm2j00,15,11,0|-cdzpk1,15,11,0|-cdzpk0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,16,6,1|aaofzz,16,6,1|aaog00,15,11,0|ak1hbz,15,11,0|ak1hc0,16,6,1|atrhbz,16,6,1|atrhc0,15,11,0|b34inz,15,11,0|b34io0,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|blulbz,15,11,0|blulc0,16,6,1|bv7mnz,16,6,1|bv7mo0,15,11,0|c4knzz,15,11,0|c4ko00,16,6,1|cdxpbz,16,6,1|cdxpc0,15,11,0|cnaqnz,15,11,0|cnaqo0,16,6,1|cwnrzz,16,6,1|cwns00,15,11,0|d60tbz,15,11,0|d60tc0,16,6,1|dfdunz,16,6,1|dfduo0,15,11,0|dp3unz,15,11,0|dp3uo0,16,6,1|dzwqnz,16,6,1|dzwqo0,15,11,0|e7txbz,15,11,0|e7txc0,16,6,1|eimtbz,16,6,1|eimtc0,15,11,0|eqjzzz,15,11,0|eqk000,16,6,1|f1cvzz,16,6,1|f1cw00,15,11,0|f9a2nz,15,11,0|f9a2o0,16,6,1|fkfxbz,16,6,1|fkfxc0,15,11,0|fs05bz,15,11,0|fs05c0,16,6,1|g35zzz,16,6,1|g36000,15,11,0|gaq7zz,15,11,0|gaq800,16,6,1|glw2nz,16,6,1|glw2o0,15,11,0|gtt9bz,15,11,0|gtt9c0,16,6,1|h4m5bz,16,6,1|h4m5c0,15,11,0|hcjbzz,15,11,0|hcjc00,16,6,1|hnc7zz,16,6,1|hnc800,15,11,0|hv9enz,15,11,0|hv9eo0,16,6,1|i6f9bz,16,6,1|i6f9c0,15,11,0|idzhbz,15,11,0|idzhc0,16,6,1|ip5bzz,16,6,1|ip5c00,15,11,0|iwpjzz,15,11,0|iwpk00,16,6,1|j7venz,16,6,1|j7veo0,15,11,0|jffmnz,15,11,0|jffmo0,16,6,1|jqlhbz,16,6,1|jqlhc0,15,11,0|jyinzz,15,11,0|jyio00,16,6,1|k9bjzz,16,6,1|k9bk00,15,11,0|kh8qnz,15,11,0|kh8qo0,16,6,1|ks1mnz,16,6,1|ks1mo0,15,11,0|kzytbz,15,11,0|kzytc0,16,6,1|lb4nzz,16,6,1|lb4o00,15,11,0|liovzz,15,11,0|liow00,100,6,0|ne0vvz,100,6,0|ne0vw0,15,11,0\",\"Europe/Kiev|,0,351,0|-1ayy8bg,74,351,0|-nu11nh,74,351,0|-nu11ng,15,11,0|-kmr1k1,15,11,0|-kmr1k0,148,6,0|-erdv01,148,6,0|-erdv00,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dnetg1,10,10,0|-dnetg0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,149,209,1|aaod7z,149,209,1|aaod80,148,6,0|ak1ejz,148,6,0|ak1ek0,149,209,1|ap2t3z,149,209,1|ap2t40,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60w3z,15,11,0|d60w40,16,6,1|dfdxfz,16,6,1|dfdxg0,15,11,0|dp3xfz,15,11,0|dp3xg0,16,6,1|dzwtfz,16,6,1|dzwtg0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Kirov|,0,352,0|-qcx400,100,6,0|-kmr4c1,100,6,0|-kmr4c0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,92,194,1|9ry7rz,92,194,1|9ry7s0,105,209,0|a1b93z,105,209,0|a1b940,105,209,1|aaod7z,105,209,1|aaod80,100,6,0|ak1ejz,100,6,0|ak1ek0,105,209,1|atrejz,105,209,1|atrek0,100,6,0|b34fvz,100,6,0|b34fw0,105,209,0|blufrz,105,209,0|blufs0,105,209,1|bv7jvz,105,209,1|bv7jw0,100,6,0|c4kl7z,100,6,0|c4kl80,105,209,1|cdxmjz,105,209,1|cdxmk0,100,6,0|cnanvz,100,6,0|cnanw0,105,209,1|cwnp7z,105,209,1|cwnp80,100,6,0|d60qjz,100,6,0|d60qk0,105,209,1|dfdrvz,105,209,1|dfdrw0,100,6,0|dp3rvz,100,6,0|dp3rw0,105,209,1|dzwnvz,105,209,1|dzwnw0,100,6,0|e7tujz,100,6,0|e7tuk0,105,209,1|eimqjz,105,209,1|eimqk0,100,6,0|eqjx7z,100,6,0|eqjx80,105,209,1|f1ct7z,105,209,1|f1ct80,100,6,0|f99zvz,100,6,0|f99zw0,105,209,1|fkfujz,105,209,1|fkfuk0,100,6,0|fs02jz,100,6,0|fs02k0,105,209,1|g35x7z,105,209,1|g35x80,100,6,0|gaq57z,100,6,0|gaq580,105,209,1|glvzvz,105,209,1|glvzw0,100,6,0|gtt6jz,100,6,0|gtt6k0,105,209,1|h4m2jz,105,209,1|h4m2k0,100,6,0|hcj97z,100,6,0|hcj980,105,209,1|hnc57z,105,209,1|hnc580,100,6,0|hv9bvz,100,6,0|hv9bw0,105,209,1|i6f6jz,105,209,1|i6f6k0,100,6,0|idzejz,100,6,0|idzek0,105,209,1|ip597z,105,209,1|ip5980,100,6,0|iwph7z,100,6,0|iwph80,105,209,1|j7vbvz,105,209,1|j7vbw0,100,6,0|jffjvz,100,6,0|jffjw0,105,209,1|jqlejz,105,209,1|jqlek0,100,6,0|jyil7z,100,6,0|jyil80,105,209,1|k9bh7z,105,209,1|k9bh80,100,6,0|kh8nvz,100,6,0|kh8nw0,105,209,1|ks1jvz,105,209,1|ks1jw0,100,6,0|kzyqjz,100,6,0|kzyqk0,105,209,1|lb4l7z,105,209,1|lb4l80,100,6,0|liot7z,100,6,0|liot80,105,209,0|ne0t3z,105,209,0|ne0t40,100,6,0\",\"Europe/Lisbon|,0,29,0|-u9rhc0,8,1,0|-rxx1g1,8,1,0|-rxx1g0,9,10,1|-rqx401,9,10,1|-rqx400,8,1,0|-rkqys1,8,1,0|-rkqys0,9,10,1|-r90qs1,9,10,1|-r90qs0,8,1,0|-r1x6s1,8,1,0|-r1x6s0,9,10,1|-qq8tg1,9,10,1|-qq8tg0,8,1,0|-qj7441,8,1,0|-qj7440,9,10,1|-q7gw41,9,10,1|-q7gw40,8,1,0|-q0dc41,8,1,0|-q0dc40,9,10,1|-pon441,9,10,1|-pon440,8,1,0|-phles1,8,1,0|-phles0,9,10,1|-p5v6s1,9,10,1|-p5v6s0,8,1,0|-nusqs1,8,1,0|-nusqs0,9,10,1|-nlhk41,9,10,1|-nlhk40,8,1,0|-mt71g1,8,1,0|-mt71g0,9,10,1|-mkjxg1,9,10,1|-mkjxg0,8,1,0|-matxg1,8,1,0|-matxg0,9,10,1|-m1tus1,9,10,1|-m1tus0,8,1,0|-lrqw41,8,1,0|-lrqw40,9,10,1|-liqtg1,9,10,1|-liqtg0,8,1,0|-l8nus1,8,1,0|-l8nus0,9,10,1|-l00qs1,9,10,1|-l00qs0,8,1,0|-k77pg1,8,1,0|-k77pg0,9,10,1|-jyklg1,9,10,1|-jyklg0,8,1,0|-jp7k41,8,1,0|-jp7k40,9,10,1|-jfuis1,9,10,1|-jfuis0,8,1,0|-ineg41,8,1,0|-ineg40,9,10,1|-ie1es1,9,10,1|-ie1es0,8,1,0|-i51c41,8,1,0|-i51c40,9,10,1|-hvbc41,9,10,1|-hvbc40,8,1,0|-hl8dg1,8,1,0|-hl8dg0,9,10,1|-hcl9g1,9,10,1|-hcl9g0,8,1,0|-h38841,8,1,0|-h38840,9,10,1|-gtv6s1,9,10,1|-gtv6s0,8,1,0|-gkv441,8,1,0|-gkv440,9,10,1|-gb5441,9,10,1|-gb5440,8,1,0|-g125g1,8,1,0|-g125g0,9,10,1|-fpwas1,9,10,1|-fpwas0,8,1,0|-fkutg1,8,1,0|-fkutg0,9,10,1|-f9c041,9,10,1|-f9c040,8,1,0|-ezyys1,8,1,0|-ezyys0,9,10,1|-eqk2s1,9,10,1|-eqk2s0,8,1,0|-eibs41,8,1,0|-eibs40,9,10,1|-eg62w1,9,10,1|-eg62w0,152,11,1|-eaeo81,152,11,1|-eaeo80,9,10,1|-e6sys1,9,10,1|-e6sys0,8,1,0|-dzlpg1,8,1,0|-dzlpg0,9,10,1|-dxsyw1,9,10,1|-dxsyw0,152,11,1|-dqyo81,152,11,1|-dqyo80,9,10,1|-dnpxg1,9,10,1|-dnpxg0,8,1,0|-dgvms1,8,1,0|-dgvms0,9,10,1|-depxk1,9,10,1|-depxk0,152,11,1|-d88lk1,152,11,1|-d88lk0,9,10,1|-d4zus1,9,10,1|-d4zus0,8,1,0|-cy5k41,8,1,0|-cy5k40,9,10,1|-cvzuw1,9,10,1|-cvzuw0,152,11,1|-cpiiw1,152,11,1|-cpiiw0,9,10,1|-cm9s41,9,10,1|-cm9s40,8,1,0|-cdzms1,8,1,0|-cdzms0,9,10,1|-c4mlg1,9,10,1|-c4mlg0,8,1,0|-bv9bs1,8,1,0|-bv9bs0,9,10,1|-blwag1,9,10,1|-blwag0,8,1,0|-bcj941,8,1,0|-bcj940,9,10,1|-b367s1,9,10,1|-b367s0,8,1,0|-att6g1,8,1,0|-att6g0,9,10,1|-akg541,9,10,1|-akg540,8,1,0|-9sd141,8,1,0|-9sd140,9,10,1|-9in141,9,10,1|-9in140,8,1,0|-999zs1,8,1,0|-999zs0,9,10,1|-8zwyg1,9,10,1|-8zwyg0,8,1,0|-8qjx41,8,1,0|-8qjx40,9,10,1|-8h6vs1,9,10,1|-8h6vs0,8,1,0|-87tug1,8,1,0|-87tug0,9,10,1|-7ygt41,9,10,1|-7ygt40,8,1,0|-7p3rs1,8,1,0|-7p3rs0,9,10,1|-7fqqg1,9,10,1|-7fqqg0,8,1,0|-76dp41,8,1,0|-76dp40,9,10,1|-6wnp41,9,10,1|-6wnp40,8,1,0|-6nans1,8,1,0|-6nans0,9,10,1|-6dxmg1,9,10,1|-6dxmg0,8,1,0|-64kl41,8,1,0|-64kl40,9,10,1|-5v7js1,9,10,1|-5v7js0,8,1,0|-5luig1,8,1,0|-5luig0,9,10,1|-5chh41,9,10,1|-5chh40,8,1,0|-534fs1,8,1,0|-534fs0,9,10,1|-4treg1,9,10,1|-4treg0,8,1,0|-4ked41,8,1,0|-4ked40,9,10,1|-4b1bs1,9,10,1|-4b1bs0,8,1,0|-41oag1,8,1,0|-41oag0,9,10,1|-3ryag1,9,10,1|-3ryag0,8,1,0|-3il941,8,1,0|-3il940,9,10,1|-3987s1,9,10,1|-3987s0,8,1,0|-2zv6g1,8,1,0|-2zv6g0,9,10,1|-2qi541,9,10,1|-2qi540,8,1,0|-2h53s1,8,1,0|-2h53s0,9,10,1|-27s2g1,9,10,1|-27s2g0,8,1,0|-1yf141,8,1,0|-1yf140,10,10,0|3ijjzz,10,10,0|3ijk00,8,1,0|3rwlbz,8,1,0|3rwlc0,9,10,1|419mnz,9,10,1|419mo0,8,1,0|4azmnz,8,1,0|4azmo0,9,10,1|4kcnzz,9,10,1|4kco00,8,1,0|4tppbz,8,1,0|4tppc0,9,10,1|532tfz,9,10,1|532tg0,8,1,0|5cfrzz,8,1,0|5cfs00,9,10,1|5lsw3z,9,10,1|5lsw40,8,1,0|5v5xfz,8,1,0|5v5xg0,9,10,1|64iyrz,9,10,1|64iys0,8,1,0|6dw03z,8,1,0|6dw040,9,10,1|6n91fz,9,10,1|6n91g0,8,1,0|6wm5jz,8,1,0|6wm5k0,9,10,1|75z43z,9,10,1|75z440,8,1,0|7fc5fz,8,1,0|7fc5g0,9,10,1|7p25fz,9,10,1|7p25g0,8,1,0|7yf6rz,8,1,0|7yf6s0,9,10,1|87s83z,9,10,1|87s840,8,1,0|8h59fz,8,1,0|8h59g0,9,10,1|8qiarz,9,10,1|8qias0,8,1,0|8zvc3z,8,1,0|8zvc40,9,10,1|998dfz,9,10,1|998dg0,8,1,0|9ilerz,8,1,0|9iles0,9,10,1|9ryg3z,9,10,1|9ryg40,8,1,0|a1bhfz,8,1,0|a1bhg0,9,10,1|aaoirz,9,10,1|aaois0,8,1,0|ak1k3z,8,1,0|ak1k40,9,10,1|atrk3z,9,10,1|atrk40,8,1,0|b34lfz,8,1,0|b34lg0,9,10,1|bchmrz,9,10,1|bchms0,8,1,0|bluo3z,8,1,0|bluo40,9,10,1|bv7pfz,9,10,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,9,10,1|dzwtfz,9,10,1|dzwtg0,8,1,0|e7u03z,8,1,0|e7u040,9,10,1|eimw3z,9,10,1|eimw40,8,1,0|eqk2rz,8,1,0|eqk2s0,9,10,1|f1cyrz,9,10,1|f1cys0,8,1,0|f9a5fz,8,1,0|f9a5g0,9,10,1|fkg03z,9,10,1|fkg040,8,1,0|fs083z,8,1,0|fs0840,9,10,1|g362rz,9,10,1|g362s0,8,1,0|gaqarz,8,1,0|gaqas0,9,10,1|glw5fz,9,10,1|glw5g0,8,1,0|gttc3z,8,1,0|gttc40,9,10,1|h4m83z,9,10,1|h4m840,8,1,0|hcjerz,8,1,0|hcjes0,9,10,1|hncarz,9,10,1|hncas0,8,1,0|hv9hfz,8,1,0|hv9hg0,9,10,1|i6fc3z,9,10,1|i6fc40,8,1,0|idzk3z,8,1,0|idzk40,9,10,1|ip5erz,9,10,1|ip5es0,8,1,0|iwpmrz,8,1,0|iwpms0,9,10,1|j7vhfz,9,10,1|j7vhg0,8,1,0|jffpfz,8,1,0|jffpg0,9,10,1|jqlk3z,9,10,1|jqlk40,8,1,0|jyiqrz,8,1,0|jyiqs0,9,10,1|k9bmrz,9,10,1|k9bms0,8,1,0|kh8tfz,8,1,0|kh8tg0,9,10,1|ks1pfz,9,10,1|ks1pg0,8,1,0|kzyw3z,8,1,0|kzyw40,9,10,1|lb4qrz,9,10,1|lb4qs0,8,1,0|lioyrz,8,1,0|lioys0,9,10,1|ltutfz,9,10,1|ltutg0,8,1,0|m1f1fz,8,1,0|m1f1g0,9,10,1|mckw3z,9,10,1|mckw40,8,1,0|mki2rz,8,1,0|mki2s0,9,10,1|mvayrz,9,10,1|mvays0,8,1,0|n385fz,8,1,0|n385g0,9,10,1|ne11fz,9,10,1|ne11g0,8,1,0|nly83z,8,1,0|nly840,9,10,1|nwr43z,9,10,1|nwr440,8,1,0|o4oarz,8,1,0|o4oas0,9,10,1|ofu5fz,9,10,1|ofu5g0,8,1,0|onedfz,8,1,0|onedg0,9,10,1|oyk83z,9,10,1|oyk840,8,1,0|p64g3z,8,1,0|p64g40,9,10,1|phaarz,9,10,1|phaas0,8,1,0|pp7hfz,8,1,0|pp7hg0,9,10,1|q00dfz,9,10,1|q00dg0,8,1,0|q7xk3z,8,1,0|q7xk40,9,10,1|qiqg3z,9,10,1|qiqg40,8,1,0|qqnmrz,8,1,0|qqnms0,9,10,1|r1thfz,9,10,1|r1thg0,8,1,0|r9dpfz,8,1,0|r9dpg0,9,10,1|rkjk3z,9,10,1|rkjk40,8,1,0|rs3s3z,8,1,0|rs3s40,9,10,1|s39mrz,9,10,1|s39ms0,8,1,0|sb6tfz,8,1,0|sb6tg0,9,10,1|slzpfz,9,10,1|slzpg0,8,1,0|stww3z,8,1,0|stww40,9,10,1|t4ps3z,9,10,1|t4ps40,8,1,0|tcmyrz,8,1,0|tcmys0,9,10,1|tnfurz,9,10,1|tnfus0,8,1,0|tvd1fz,8,1,0|tvd1g0,9,10,1|u6iw3z,9,10,1|u6iw40,8,1,0|ue343z,8,1,0|ue3440,9,10,1|up8yrz,9,10,1|up8ys0,8,1,0|uwt6rz,8,1,0|uwt6s0,9,10,1|v7z1fz,9,10,1|v7z1g0,8,1,0|vfw83z,8,1,0|vfw840,9,10,1|vqp43z,9,10,1|vqp440,8,1,0|vymarz,8,1,0|vymas0,9,10,1|w9f6rz,9,10,1|w9f6s0,8,1,0|whcdfz,8,1,0|whcdg0,9,10,1|wsi83z,9,10,1|wsi840,8,1,0|x02g3z,8,1,0|x02g40,9,10,1|xb8arz,9,10,1|xb8as0,8,1,0|xisirz,8,1,0|xisis0,9,10,1|xtydfz,9,10,1|xtydg0,8,1,0|y1ilfz,8,1,0|y1ilg0,9,10,1|ycog3z,9,10,1|ycog40,8,1,0|yklmrz,8,1,0|yklms0,9,10,1|yveirz,9,10,1|yveis0,8,1,0|z3bpfz,8,1,0|z3bpg0,9,10,1|ze4lfz,9,10,1|ze4lg0,8,1,0\",\"Europe/Ljubljana|,0,332,0|-18vsmgo,10,10,0|-ezayw1,10,10,0|-ezayw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cv5zw1,10,10,0|-cv5zw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/London|,0,347,0|-1rprx9x,1,1,0|-rzcns1,1,1,0|-rzcns0,27,10,1|-rsid41,27,10,1|-rsid40,1,1,0|-risd41,1,1,0|-risd40,27,10,1|-ragd41,27,10,1|-ragd40,1,1,0|-r0s7s1,1,1,0|-r0s7s0,27,10,1|-qr0d41,27,10,1|-qr0d40,1,1,0|-qhp6g1,1,1,0|-qhp6g0,27,10,1|-q8aag1,27,10,1|-q8aag0,1,1,0|-pyz3s1,1,1,0|-pyz3s0,27,10,1|-po4d41,27,10,1|-po4d40,1,1,0|-pfw2g1,1,1,0|-pfw2g0,27,10,1|-p6h6g1,27,10,1|-p6h6g0,1,1,0|-oxiyg1,1,1,0|-oxiyg0,27,10,1|-onfzs1,27,10,1|-onfzs0,1,1,0|-odd141,1,1,0|-odd140,27,10,1|-o5st41,27,10,1|-o5st40,1,1,0|-nuzx41,1,1,0|-nuzx40,27,10,1|-nmprs1,27,10,1|-nmprs0,1,1,0|-nbwvs1,1,1,0|-nbwvs0,27,10,1|-n39rs1,27,10,1|-n39rs0,1,1,0|-mt6t41,1,1,0|-mt6t40,27,10,1|-mkjp41,27,10,1|-mkjp40,1,1,0|-matp41,1,1,0|-matp40,27,10,1|-m1tmg1,27,10,1|-m1tmg0,1,1,0|-lrdp41,1,1,0|-lrdp40,27,10,1|-liql41,27,10,1|-liql40,1,1,0|-l8nmg1,1,1,0|-l8nmg0,27,10,1|-l00ig1,27,10,1|-l00ig0,1,1,0|-kqaig1,1,1,0|-kqaig0,27,10,1|-khafs1,27,10,1|-khafs0,1,1,0|-k77h41,1,1,0|-k77h40,27,10,1|-jykd41,27,10,1|-jykd40,1,1,0|-joheg1,1,1,0|-joheg0,27,10,1|-jfuag1,27,10,1|-jfuag0,1,1,0|-j64ag1,1,1,0|-j64ag0,27,10,1|-iwr941,27,10,1|-iwr940,1,1,0|-imoag1,1,1,0|-imoag0,27,10,1|-ie16g1,27,10,1|-ie16g0,1,1,0|-i4b6g1,1,1,0|-i4b6g0,27,10,1|-hvb3s1,27,10,1|-hvb3s0,1,1,0|-hl8541,1,1,0|-hl8540,27,10,1|-hcl141,27,10,1|-hcl140,1,1,0|-h2i2g1,1,1,0|-h2i2g0,27,10,1|-gtuyg1,27,10,1|-gtuyg0,1,1,0|-gk4yg1,1,1,0|-gk4yg0,27,10,1|-gb4vs1,27,10,1|-gb4vs0,1,1,0|-g11x41,1,1,0|-g11x40,27,10,1|-fpw2g1,27,10,1|-fpw2g0,1,1,0|-fkul41,1,1,0|-fkul40,27,10,1|-eyiyk1,27,10,1|-eyiyk0,151,11,1|-ethh81,151,11,1|-ethh80,27,10,1|-eh8qk1,27,10,1|-eh8qk0,151,11,1|-earek1,151,11,1|-earek0,27,10,1|-dyinw1,27,10,1|-dyinw0,151,11,1|-drod81,151,11,1|-drod80,27,10,1|-dfsl81,27,10,1|-dfsl80,151,11,1|-d75h81,151,11,1|-d75h80,27,10,1|-cx0nw1,27,10,1|-cx0nw0,151,11,1|-cro2k1,151,11,1|-cro2k0,27,10,1|-cncfs1,27,10,1|-cncfs0,1,1,0|-cdmfs1,1,1,0|-cdmfs0,27,10,1|-c4md41,27,10,1|-c4md40,1,1,0|-bwc7s1,1,1,0|-bwc7s0,27,10,1|-buwfw1,27,10,1|-buwfw0,151,11,1|-bos2k1,151,11,1|-bos2k0,27,10,1|-bkgfs1,27,10,1|-bkgfs0,1,1,0|-bdm541,1,1,0|-bdm540,27,10,1|-b1qd41,27,10,1|-b1qd40,1,1,0|-att6g1,1,1,0|-att6g0,27,10,1|-aj0ag1,27,10,1|-aj0ag0,1,1,0|-aad6g1,1,1,0|-aad6g0,27,10,1|-a0n6g1,27,10,1|-a0n6g0,1,1,0|-9rn3s1,1,1,0|-9rn3s0,27,10,1|-9hx3s1,27,10,1|-9hx3s0,1,1,0|-98k2g1,1,1,0|-98k2g0,27,10,1|-8yu2g1,27,10,1|-8yu2g0,1,1,0|-8ptzs1,1,1,0|-8ptzs0,27,10,1|-8h6vs1,27,10,1|-8h6vs0,1,1,0|-87gvs1,1,1,0|-87gvs0,27,10,1|-7ygt41,27,10,1|-7ygt40,1,1,0|-7odug1,1,1,0|-7odug0,27,10,1|-7fqqg1,27,10,1|-7fqqg0,1,1,0|-75at41,1,1,0|-75at40,27,10,1|-6wnp41,27,10,1|-6wnp40,1,1,0|-6mxp41,1,1,0|-6mxp40,27,10,1|-6dxmg1,27,10,1|-6dxmg0,1,1,0|-63uns1,1,1,0|-63uns0,27,10,1|-5v7js1,27,10,1|-5v7js0,1,1,0|-5l4l41,1,1,0|-5l4l40,27,10,1|-5chh41,27,10,1|-5chh40,1,1,0|-52rh41,1,1,0|-52rh40,27,10,1|-4treg1,27,10,1|-4treg0,1,1,0|-4krbs1,1,1,0|-4krbs0,27,10,1|-49lh41,27,10,1|-49lh40,1,1,0|-421941,1,1,0|-421940,27,10,1|-3qveg1,27,10,1|-3qveg0,1,1,0|-3iy7s1,1,1,0|-3iy7s0,27,10,1|-385bs1,27,10,1|-385bs0,1,1,0|-30l3s1,1,1,0|-30l3s0,27,10,1|-2pf941,27,10,1|-2pf940,1,1,0|-2hv141,1,1,0|-2hv140,27,10,1|-26p6g1,27,10,1|-26p6g0,1,1,0|-1z4yg1,1,1,0|-1z4yg0,27,10,1|-1nz3s1,27,10,1|-1nz3s0,1,1,0|-1gevs1,1,1,0|-1gevs0,27,10,1|-14w2g1,27,10,1|-14w2g0,1,1,0|-z4ns1,1,1,0|-z4ns0,27,10,1|-m6841,27,10,1|-m6840,27,10,0|yd6vz,27,10,0|yd6w0,1,1,0|15kg7z,1,1,0|15kg80,27,10,1|1h39jz,27,10,1|1h39k0,1,1,0|1oaivz,1,1,0|1oaiw0,27,10,1|1ztc7z,27,10,1|1ztc80,1,1,0|270ljz,1,1,0|270lk0,27,10,1|2ijevz,27,10,1|2ijew0,1,1,0|2pqo7z,1,1,0|2pqo80,27,10,1|319hjz,27,10,1|319hk0,1,1,0|38tpjz,1,1,0|38tpk0,27,10,1|3jzk7z,27,10,1|3jzk80,1,1,0|3rjs7z,1,1,0|3rjs80,27,10,1|42pmvz,27,10,1|42pmw0,1,1,0|4a9uvz,1,1,0|4a9uw0,27,10,1|4lso7z,27,10,1|4lso80,1,1,0|4szxjz,1,1,0|4szxk0,27,10,1|54iqvz,27,10,1|54iqw0,1,1,0|5bq07z,1,1,0|5bq080,27,10,1|5n8tjz,27,10,1|5n8tk0,1,1,0|5v5xfz,1,1,0|5v5xg0,27,10,1|65ytfz,27,10,1|65ytg0,1,1,0|6dw03z,1,1,0|6dw040,27,10,1|6oow3z,27,10,1|6oow40,1,1,0|6wm2rz,1,1,0|6wm2s0,27,10,1|77eyrz,27,10,1|77eys0,1,1,0|7fc5fz,1,1,0|7fc5g0,27,10,1|7qi03z,27,10,1|7qi040,1,1,0|7yf6rz,1,1,0|7yf6s0,27,10,1|8982rz,27,10,1|8982s0,1,1,0|8h59fz,1,1,0|8h59g0,27,10,1|8ry5fz,27,10,1|8ry5g0,1,1,0|8zvc3z,1,1,0|8zvc40,27,10,1|9ao83z,27,10,1|9ao840,1,1,0|9ilerz,1,1,0|9iles0,27,10,1|9tearz,27,10,1|9teas0,1,1,0|a1bhfz,1,1,0|a1bhg0,27,10,1|achc3z,27,10,1|achc40,1,1,0|ak1k3z,1,1,0|ak1k40,27,10,1|av7erz,27,10,1|av7es0,1,1,0|b34lfz,1,1,0|b34lg0,27,10,1|bdxhfz,27,10,1|bdxhg0,1,1,0|bluo3z,1,1,0|bluo40,27,10,1|bwnk3z,27,10,1|bwnk40,1,1,0|c4kqrz,1,1,0|c4kqs0,27,10,1|cfdmrz,27,10,1|cfdms0,1,1,0|cnatfz,1,1,0|cnatg0,27,10,1|cy3pfz,27,10,1|cy3pg0,1,1,0|d60w3z,1,1,0|d60w40,27,10,1|dgts3z,27,10,1|dgts40,1,1,0|dp3xfz,1,1,0|dp3xg0,27,10,1|dzwtfz,27,10,1|dzwtg0,1,1,0|e7u03z,1,1,0|e7u040,27,10,1|eimw3z,27,10,1|eimw40,1,1,0|eqk2rz,1,1,0|eqk2s0,27,10,1|f1cyrz,27,10,1|f1cys0,1,1,0|f9a5fz,1,1,0|f9a5g0,27,10,1|fkg03z,27,10,1|fkg040,1,1,0|fs083z,1,1,0|fs0840,27,10,1|g362rz,27,10,1|g362s0,1,1,0|gaqarz,1,1,0|gaqas0,27,10,1|glw5fz,27,10,1|glw5g0,1,1,0|gttc3z,1,1,0|gttc40,27,10,1|h4m83z,27,10,1|h4m840,1,1,0|hcjerz,1,1,0|hcjes0,27,10,1|hncarz,27,10,1|hncas0,1,1,0|hv9hfz,1,1,0|hv9hg0,27,10,1|i6fc3z,27,10,1|i6fc40,1,1,0|idzk3z,1,1,0|idzk40,27,10,1|ip5erz,27,10,1|ip5es0,1,1,0|iwpmrz,1,1,0|iwpms0,27,10,1|j7vhfz,27,10,1|j7vhg0,1,1,0|jffpfz,1,1,0|jffpg0,27,10,1|jqlk3z,27,10,1|jqlk40,1,1,0|jyiqrz,1,1,0|jyiqs0,27,10,1|k9bmrz,27,10,1|k9bms0,1,1,0|kh8tfz,1,1,0|kh8tg0,27,10,1|ks1pfz,27,10,1|ks1pg0,1,1,0|kzyw3z,1,1,0|kzyw40,27,10,1|lb4qrz,27,10,1|lb4qs0,1,1,0|lioyrz,1,1,0|lioys0,27,10,1|ltutfz,27,10,1|ltutg0,1,1,0|m1f1fz,1,1,0|m1f1g0,27,10,1|mckw3z,27,10,1|mckw40,1,1,0|mki2rz,1,1,0|mki2s0,27,10,1|mvayrz,27,10,1|mvays0,1,1,0|n385fz,1,1,0|n385g0,27,10,1|ne11fz,27,10,1|ne11g0,1,1,0|nly83z,1,1,0|nly840,27,10,1|nwr43z,27,10,1|nwr440,1,1,0|o4oarz,1,1,0|o4oas0,27,10,1|ofu5fz,27,10,1|ofu5g0,1,1,0|onedfz,1,1,0|onedg0,27,10,1|oyk83z,27,10,1|oyk840,1,1,0|p64g3z,1,1,0|p64g40,27,10,1|phaarz,27,10,1|phaas0,1,1,0|pp7hfz,1,1,0|pp7hg0,27,10,1|q00dfz,27,10,1|q00dg0,1,1,0|q7xk3z,1,1,0|q7xk40,27,10,1|qiqg3z,27,10,1|qiqg40,1,1,0|qqnmrz,1,1,0|qqnms0,27,10,1|r1thfz,27,10,1|r1thg0,1,1,0|r9dpfz,1,1,0|r9dpg0,27,10,1|rkjk3z,27,10,1|rkjk40,1,1,0|rs3s3z,1,1,0|rs3s40,27,10,1|s39mrz,27,10,1|s39ms0,1,1,0|sb6tfz,1,1,0|sb6tg0,27,10,1|slzpfz,27,10,1|slzpg0,1,1,0|stww3z,1,1,0|stww40,27,10,1|t4ps3z,27,10,1|t4ps40,1,1,0|tcmyrz,1,1,0|tcmys0,27,10,1|tnfurz,27,10,1|tnfus0,1,1,0|tvd1fz,1,1,0|tvd1g0,27,10,1|u6iw3z,27,10,1|u6iw40,1,1,0|ue343z,1,1,0|ue3440,27,10,1|up8yrz,27,10,1|up8ys0,1,1,0|uwt6rz,1,1,0|uwt6s0,27,10,1|v7z1fz,27,10,1|v7z1g0,1,1,0|vfw83z,1,1,0|vfw840,27,10,1|vqp43z,27,10,1|vqp440,1,1,0|vymarz,1,1,0|vymas0,27,10,1|w9f6rz,27,10,1|w9f6s0,1,1,0|whcdfz,1,1,0|whcdg0,27,10,1|wsi83z,27,10,1|wsi840,1,1,0|x02g3z,1,1,0|x02g40,27,10,1|xb8arz,27,10,1|xb8as0,1,1,0|xisirz,1,1,0|xisis0,27,10,1|xtydfz,27,10,1|xtydg0,1,1,0|y1ilfz,1,1,0|y1ilg0,27,10,1|ycog3z,27,10,1|ycog40,1,1,0|yklmrz,1,1,0|yklms0,27,10,1|yveirz,27,10,1|yveis0,1,1,0|z3bpfz,1,1,0|z3bpg0,27,10,1|ze4lfz,27,10,1|ze4lg0,1,1,0\",\"Europe/Luxembourg|,0,353,0|-y89550,10,10,0|-rzo2w1,10,10,0|-rzo2w0,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-rhps81,10,10,0|-rhps80,11,11,1|-raglg1,11,11,1|-raglg0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-qo4w41,10,10,0|-qo4w40,8,1,0|-qj59g1,8,1,0|-qj59g0,9,10,1|-q7z6g1,9,10,1|-q7z6g0,8,1,0|-q15441,8,1,0|-q15440,9,10,1|-po6ak1,9,10,1|-po6ak0,8,1,0|-pgvhg1,8,1,0|-pgvhg0,9,10,1|-p5anw1,9,10,1|-p5anw0,8,1,0|-oxj6s1,8,1,0|-oxj6s0,9,10,1|-ong5c1,9,10,1|-ong5c0,8,1,0|-odd9g1,8,1,0|-odd9g0,9,10,1|-o4pzw1,9,10,1|-o4pzw0,8,1,0|-nvq2s1,8,1,0|-nvq2s0,9,10,1|-nm0001,9,10,1|-nm0000,8,1,0|-ncl6s1,8,1,0|-ncl6s0,9,10,1|-n39xc1,9,10,1|-n39xc0,8,1,0|-mt71g1,8,1,0|-mt71g0,9,10,1|-mkjuo1,9,10,1|-mkjuo0,8,1,0|-matxg1,8,1,0|-matxg0,9,10,1|-m1ts01,9,10,1|-m1ts00,8,1,0|-lrqw41,8,1,0|-lrqw40,9,10,1|-liqqo1,9,10,1|-liqqo0,8,1,0|-l8nus1,8,1,0|-l8nus0,9,10,1|-l00ig1,9,10,1|-l00ig0,8,1,0|-kqaig1,8,1,0|-kqaig0,9,10,1|-khafs1,9,10,1|-khafs0,8,1,0|-k77h41,8,1,0|-k77h40,9,10,1|-jykd41,9,10,1|-jykd40,8,1,0|-jp7bs1,8,1,0|-jp7bs0,9,10,1|-jfuag1,9,10,1|-jfuag0,8,1,0|-j6u7s1,8,1,0|-j6u7s0,9,10,1|-iwr941,9,10,1|-iwr940,8,1,0|-ine7s1,8,1,0|-ine7s0,9,10,1|-ie16g1,9,10,1|-ie16g0,8,1,0|-i513s1,8,1,0|-i513s0,9,10,1|-hvb3s1,9,10,1|-hvb3s0,8,1,0|-hl8541,8,1,0|-hl8540,9,10,1|-hcl141,9,10,1|-hcl140,8,1,0|-h37zs1,8,1,0|-h37zs0,9,10,1|-gtuyg1,9,10,1|-gtuyg0,8,1,0|-gkuvs1,8,1,0|-gkuvs0,9,10,1|-gb4vs1,9,10,1|-gb4vs0,8,1,0|-g11x41,8,1,0|-g11x40,9,10,1|-fpw2g1,9,10,1|-fpw2g0,8,1,0|-fkul41,8,1,0|-fkul40,9,10,1|-fgsag1,9,10,1|-fgsag0,9,11,1|-e6dzw1,9,11,1|-e6dzw0,8,10,0|-dytrw1,8,10,0|-dytrw0,9,11,1|-dp3rw1,9,11,1|-dp3rw0,8,10,0|-dfqqk1,8,10,0|-dfqqk0,9,11,1|-d73mk1,9,11,1|-d73mk0,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|-cbtp81,10,10,0|-cbtp80,11,11,1|-c4kl81,11,11,1|-c4kl80,10,10,0|3s9mrz,10,10,0|3s9ms0,11,11,1|419pfz,11,11,1|419pg0,10,10,0|4azpfz,10,10,0|4azpg0,11,11,1|4kcqrz,11,11,1|4kcqs0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Madrid|,0,354,0|-100edc0,8,1,0|-qzlus1,8,1,0|-qzlus0,9,10,1|-qqnk01,9,10,1|-qqnk00,8,1,0|-qhalg1,8,1,0|-qhalg0,9,10,1|-q7vmo1,9,10,1|-q7vmo0,8,1,0|-nusqs1,8,1,0|-nusqs0,9,10,1|-nm0001,9,10,1|-nm0000,8,1,0|-mt71g1,8,1,0|-mt71g0,9,10,1|-mkjuo1,9,10,1|-mkjuo0,8,1,0|-matxg1,8,1,0|-matxg0,9,10,1|-m1ts01,9,10,1|-m1ts00,8,1,0|-lrqtc1,8,1,0|-lrqtc0,9,10,1|-liqqo1,9,10,1|-liqqo0,8,1,0|-l8nus1,8,1,0|-l8nus0,9,10,1|-l00o01,9,10,1|-l00o00,8,1,0|-gzf6s1,8,1,0|-gzf6s0,9,10,1|-gtv401,9,10,1|-gtv400,8,1,0|-gki5g1,8,1,0|-gki5g0,9,10,1|-gj2dk1,9,10,1|-gj2dk0,152,11,1|-gb3c81,152,11,1|-gb3c80,9,10,1|-fs2001,9,10,1|-fs2000,8,1,0|-fjrxg1,8,1,0|-fjrxg0,10,10,0|-eft481,10,10,0|-eft480,11,11,1|-e9kys1,11,11,1|-e9kys0,10,10,0|-dxsyw1,10,10,0|-dxsyw0,11,11,1|-dp5s41,11,11,1|-dp5s40,10,10,0|-df2w81,10,10,0|-df2w80,11,11,1|-d6fpg1,11,11,1|-d6fpg0,10,10,0|-cwctk1,10,10,0|-cwctk0,11,11,1|-cnpms1,11,11,1|-cnpms0,10,10,0|-cdmqw1,10,10,0|-cdmqw0,11,11,1|-c4zk41,11,11,1|-c4zk40,10,10,0|-asdmw1,10,10,0|-asdmw0,11,11,1|-akgdg1,11,11,1|-akgdg0,10,10,0|28g53z,10,10,0|28g540,11,11,1|2hgajz,11,11,1|2hgak0,10,10,0|2r67rz,10,10,0|2r67s0,11,11,1|306d7z,11,11,1|306d80,10,10,0|396d3z,10,10,0|396d40,11,11,1|3ijh7z,11,11,1|3ijh80,10,10,0|3s9efz,10,10,0|3s9eg0,11,11,1|419jvz,11,11,1|419jw0,10,10,0|4azpfz,10,10,0|4azpg0,11,11,1|4kcqrz,11,11,1|4kcqs0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Malta|,0,355,0|-13qyw0s,10,10,0|-rymys1,10,10,0|-rymys0,11,11,1|-rsio81,11,11,1|-rsio80,10,10,0|-rj5k41,10,10,0|-rj5k40,11,11,1|-r9qqw1,11,11,1|-r9qqw0,10,10,0|-r1idg1,10,10,0|-r1idg0,11,11,1|-qqnpk1,11,11,1|-qqnpk0,10,10,0|-qj59g1,10,10,0|-qj59g0,11,11,1|-q7zhk1,11,11,1|-q7zhk0,10,10,0|-pzcas1,10,10,0|-pzcas0,11,11,1|-ppzc81,11,11,1|-ppzc80,10,10,0|-ff59g1,10,10,0|-ff59g0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfsl81,10,10,0|-dfsl80,11,11,1|-d75h81,11,11,1|-d75h80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cohes1,11,11,1|-cohes0,10,10,0|-cf2d81,10,10,0|-cf2d80,11,11,1|-c4mfw1,11,11,1|-c4mfw0,10,10,0|-bwcg41,10,10,0|-bwcg40,11,11,1|-blwis1,11,11,1|-blwis0,10,10,0|-bec581,10,10,0|-bec580,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-1vwis1,10,10,0|-1vwis0,11,11,1|-1pf9k1,11,11,1|-1pf9k0,10,10,0|-1cthg1,10,10,0|-1cthg0,11,11,1|-16p441,11,11,1|-16p440,10,10,0|-u3es1,10,10,0|-u3es0,11,11,1|-nz1g1,11,11,1|-nz1g0,10,10,0|-b0dg1,10,10,0|-b0dg0,11,11,1|-4w041,11,11,1|-4w040,10,10,0|7pp7z,10,10,0|7pp80,11,11,1|du2jz,11,11,1|du2k0,10,10,0|q2t7z,10,10,0|q2t80,11,11,1|wk57z,11,11,1|wk580,10,10,0|195ujz,10,10,0|195uk0,11,11,1|1fn6jz,11,11,1|1fn6k0,10,10,0|1oyd7z,10,10,0|1oyd80,11,11,1|1ybejz,11,11,1|1ybek0,10,10,0|28t6jz,10,10,0|28t6k0,11,11,1|2gf97z,11,11,1|2gf980,10,10,0|2rjerz,10,10,0|2rjes0,11,11,1|2zginz,11,11,1|2zgio0,10,10,0|3a9hfz,10,10,0|3a9hg0,11,11,1|3i6lbz,11,11,1|3i6lc0,10,10,0|3szk3z,10,10,0|3szk40,11,11,1|40wnzz,11,11,1|40wo00,10,10,0|4bpmrz,10,10,0|4bpms0,11,11,1|4jmqnz,11,11,1|4jmqo0,10,10,0|4ufpfz,10,10,0|4ufpg0,11,11,1|52ctbz,11,11,1|52ctc0,10,10,0|5chpfz,10,10,0|5chpg0,11,11,1|5lfunz,11,11,1|5lfuo0,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Mariehamn|,0,348,0|-1bss9yd,77,348,0|-peghye,77,348,0|-peghyd,15,11,0|-ehco81,15,11,0|-ehco80,16,6,1|-e7vxk1,16,6,1|-e7vxk0,15,11,0|5v5unz,15,11,0|5v5uo0,16,6,1|64ivzz,16,6,1|64iw00,15,11,0|6dvxbz,15,11,0|6dvxc0,16,6,1|6n8ynz,16,6,1|6n8yo0,15,11,0|6wm2rz,15,11,0|6wm2s0,16,6,1|75z43z,16,6,1|75z440,15,11,0|7fc5fz,15,11,0|7fc5g0,16,6,1|7p25fz,16,6,1|7p25g0,15,11,0|7yf6rz,15,11,0|7yf6s0,16,6,1|87s83z,16,6,1|87s840,15,11,0|8h59fz,15,11,0|8h59g0,16,6,1|8qiarz,16,6,1|8qias0,15,11,0|8zvc3z,15,11,0|8zvc40,16,6,1|998dfz,16,6,1|998dg0,15,11,0|9ilerz,15,11,0|9iles0,16,6,1|9ryg3z,16,6,1|9ryg40,15,11,0|a1bhfz,15,11,0|a1bhg0,16,6,1|aaoirz,16,6,1|aaois0,15,11,0|ak1k3z,15,11,0|ak1k40,16,6,1|atrk3z,16,6,1|atrk40,15,11,0|b34lfz,15,11,0|b34lg0,16,6,1|bchmrz,16,6,1|bchms0,15,11,0|bluo3z,15,11,0|bluo40,16,6,1|bv7pfz,16,6,1|bv7pg0,15,11,0|c4kqrz,15,11,0|c4kqs0,16,6,1|cdxs3z,16,6,1|cdxs40,15,11,0|cnatfz,15,11,0|cnatg0,16,6,1|cwnurz,16,6,1|cwnus0,15,11,0|d60w3z,15,11,0|d60w40,16,6,1|dfdxfz,16,6,1|dfdxg0,15,11,0|dp3xfz,15,11,0|dp3xg0,16,6,1|dzwtfz,16,6,1|dzwtg0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Minsk|,0,356,0|-1ayy7rs,21,357,0|-nu113d,21,357,0|-nu113c,15,11,0|-kmr1k1,15,11,0|-kmr1k0,148,6,0|-evpf01,148,6,0|-evpf00,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-db2g81,11,11,1|-db2g80,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,149,209,1|aaod7z,149,209,1|aaod80,148,6,0|b34fvz,148,6,0|b34fw0,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|blulbz,15,11,0|blulc0,16,6,1|bv7mnz,16,6,1|bv7mo0,15,11,0|c4knzz,15,11,0|c4ko00,16,6,1|cdxpbz,16,6,1|cdxpc0,15,11,0|cnaqnz,15,11,0|cnaqo0,16,6,1|cwnrzz,16,6,1|cwns00,15,11,0|d60tbz,15,11,0|d60tc0,16,6,1|dfdunz,16,6,1|dfduo0,15,11,0|dp3unz,15,11,0|dp3uo0,16,6,1|dzwqnz,16,6,1|dzwqo0,15,11,0|e7txbz,15,11,0|e7txc0,16,6,1|eimtbz,16,6,1|eimtc0,15,11,0|eqjzzz,15,11,0|eqk000,16,6,1|f1cvzz,16,6,1|f1cw00,15,11,0|f9a2nz,15,11,0|f9a2o0,16,6,1|fkfxbz,16,6,1|fkfxc0,15,11,0|fs05bz,15,11,0|fs05c0,16,6,1|g35zzz,16,6,1|g36000,15,11,0|gaq7zz,15,11,0|gaq800,16,6,1|glw2nz,16,6,1|glw2o0,15,11,0|gtt9bz,15,11,0|gtt9c0,16,6,1|h4m5bz,16,6,1|h4m5c0,15,11,0|hcjbzz,15,11,0|hcjc00,16,6,1|hnc7zz,16,6,1|hnc800,15,11,0|hv9enz,15,11,0|hv9eo0,16,6,1|i6f9bz,16,6,1|i6f9c0,15,11,0|idzhbz,15,11,0|idzhc0,16,6,1|ip5bzz,16,6,1|ip5c00,15,11,0|iwpjzz,15,11,0|iwpk00,16,6,1|j7venz,16,6,1|j7veo0,15,11,0|jffmnz,15,11,0|jffmo0,16,6,1|jqlhbz,16,6,1|jqlhc0,15,11,0|jyinzz,15,11,0|jyio00,16,6,1|k9bjzz,16,6,1|k9bk00,15,11,0|kh8qnz,15,11,0|kh8qo0,16,6,1|ks1mnz,16,6,1|ks1mo0,15,11,0|kzytbz,15,11,0|kzytc0,16,6,1|lb4nzz,16,6,1|lb4o00,15,11,0|liovzz,15,11,0|liow00,100,6,0\",\"Europe/Monaco|,0,358,0|-14hnyp8,7,9,0|-uo2b3m,7,9,0|-uo2b3l,8,1,0|-ry2lg1,8,1,0|-ry2lg0,9,10,1|-rsgqs1,9,10,1|-rsgqs0,8,1,0|-rjiis1,8,1,0|-rjiis0,9,10,1|-r9dpg1,9,10,1|-r9dpg0,8,1,0|-r1idg1,8,1,0|-r1idg0,9,10,1|-qqnms1,9,10,1|-qqnms0,8,1,0|-qj59g1,8,1,0|-qj59g0,9,10,1|-q7xk41,9,10,1|-q7xk40,8,1,0|-q15441,8,1,0|-q15440,9,10,1|-po6g41,9,10,1|-po6g40,8,1,0|-pgvhg1,8,1,0|-pgvhg0,9,10,1|-p5atg1,9,10,1|-p5atg0,8,1,0|-oxj6s1,8,1,0|-oxj6s0,9,10,1|-ong841,9,10,1|-ong840,8,1,0|-obkg41,8,1,0|-obkg40,9,10,1|-o4q5g1,9,10,1|-o4q5g0,8,1,0|-nvq2s1,8,1,0|-nvq2s0,9,10,1|-nm02s1,9,10,1|-nm02s0,8,1,0|-ncn1g1,8,1,0|-ncn1g0,9,10,1|-n3a041,9,10,1|-n3a040,8,1,0|-mt71g1,8,1,0|-mt71g0,9,10,1|-mkjxg1,9,10,1|-mkjxg0,8,1,0|-matxg1,8,1,0|-matxg0,9,10,1|-m1tus1,9,10,1|-m1tus0,8,1,0|-lrqw41,8,1,0|-lrqw40,9,10,1|-liqtg1,9,10,1|-liqtg0,8,1,0|-l8nus1,8,1,0|-l8nus0,9,10,1|-l00qs1,9,10,1|-l00qs0,8,1,0|-kqaqs1,8,1,0|-kqaqs0,9,10,1|-khao41,9,10,1|-khao40,8,1,0|-k77pg1,8,1,0|-k77pg0,9,10,1|-jyklg1,9,10,1|-jyklg0,8,1,0|-jp7k41,8,1,0|-jp7k40,9,10,1|-jfuis1,9,10,1|-jfuis0,8,1,0|-j6ug41,8,1,0|-j6ug40,9,10,1|-iwrhg1,9,10,1|-iwrhg0,8,1,0|-ineg41,8,1,0|-ineg40,9,10,1|-ie1es1,9,10,1|-ie1es0,8,1,0|-i51c41,8,1,0|-i51c40,9,10,1|-hvbc41,9,10,1|-hvbc40,8,1,0|-hl8dg1,8,1,0|-hl8dg0,9,10,1|-hcl9g1,9,10,1|-hcl9g0,8,1,0|-h38841,8,1,0|-h38840,9,10,1|-gtv6s1,9,10,1|-gtv6s0,8,1,0|-gkv441,8,1,0|-gkv440,9,10,1|-gb5441,9,10,1|-gb5440,8,1,0|-g125g1,8,1,0|-g125g0,9,10,1|-fpwas1,9,10,1|-fpwas0,8,1,0|-fkul41,8,1,0|-fkul40,9,10,1|-eyh9g1,9,10,1|-eyh9g0,152,11,1|-eqk5k1,152,11,1|-eqk5k0,9,10,1|-eimw41,9,10,1|-eimw40,152,11,1|-e6dzw1,152,11,1|-e6dzw0,9,10,1|-dytrw1,9,10,1|-dytrw0,152,11,1|-dp3rw1,152,11,1|-dp3rw0,9,10,1|-dfqqk1,9,10,1|-dfqqk0,152,11,1|-d62qs1,152,11,1|-d62qs0,9,10,1|-cx0nw1,9,10,1|-cx0nw0,152,11,1|-cofek1,152,11,1|-cofek0,10,10,0|396inz,10,10,0|396io0,11,11,1|3ijh7z,11,11,1|3ijh80,10,10,0|3s9mrz,10,10,0|3s9ms0,11,11,1|419pfz,11,11,1|419pg0,10,10,0|4azpfz,10,10,0|4azpg0,11,11,1|4kcqrz,11,11,1|4kcqs0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Moscow|,0,359,0|-1ayy9mh,21,359,0|-rx5dmi,21,359,0|-rx5dmh,21,360,0|-refds8,21,360,0|-refds7,50,361,1|-r57wg8,50,361,1|-r57wg7,21,360,0|-qx8xw8,21,360,0|-qx8xw7,153,362,1|-qrqps8,153,362,1|-qrqps7,50,361,1|-qeh0k8,50,361,1|-qeh0k7,153,362,1|-qcx401,153,362,1|-qcx400,149,209,1|-qak8g1,149,209,1|-qak8g0,148,6,0|-pibkg1,148,6,0|-pibkg0,149,209,1|-pgkok1,149,209,1|-pgkok0,92,194,1|-p84z81,92,194,1|-p84z80,149,209,1|-p6lcg1,149,209,1|-p6lcg0,148,6,0|-ontcc1,148,6,0|-ontcc0,15,11,0|-kmr1k1,15,11,0|-kmr1k0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,149,209,1|aaod7z,149,209,1|aaod80,148,6,0|ak1ejz,148,6,0|ak1ek0,149,209,1|atrejz,149,209,1|atrek0,148,6,0|b34fvz,148,6,0|b34fw0,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|bi8ynz,15,11,0|bi8yo0,148,6,0|bluijz,148,6,0|bluik0,149,209,1|bv7jvz,149,209,1|bv7jw0,148,6,0|c4kl7z,148,6,0|c4kl80,149,209,1|cdxmjz,149,209,1|cdxmk0,148,6,0|cnanvz,148,6,0|cnanw0,149,209,1|cwnp7z,149,209,1|cwnp80,148,6,0|d60qjz,148,6,0|d60qk0,149,209,1|dfdrvz,149,209,1|dfdrw0,148,6,0|dp3rvz,148,6,0|dp3rw0,149,209,1|dzwnvz,149,209,1|dzwnw0,148,6,0|e7tujz,148,6,0|e7tuk0,149,209,1|eimqjz,149,209,1|eimqk0,148,6,0|eqjx7z,148,6,0|eqjx80,149,209,1|f1ct7z,149,209,1|f1ct80,148,6,0|f99zvz,148,6,0|f99zw0,149,209,1|fkfujz,149,209,1|fkfuk0,148,6,0|fs02jz,148,6,0|fs02k0,149,209,1|g35x7z,149,209,1|g35x80,148,6,0|gaq57z,148,6,0|gaq580,149,209,1|glvzvz,149,209,1|glvzw0,148,6,0|gtt6jz,148,6,0|gtt6k0,149,209,1|h4m2jz,149,209,1|h4m2k0,148,6,0|hcj97z,148,6,0|hcj980,149,209,1|hnc57z,149,209,1|hnc580,148,6,0|hv9bvz,148,6,0|hv9bw0,149,209,1|i6f6jz,149,209,1|i6f6k0,148,6,0|idzejz,148,6,0|idzek0,149,209,1|ip597z,149,209,1|ip5980,148,6,0|iwph7z,148,6,0|iwph80,149,209,1|j7vbvz,149,209,1|j7vbw0,148,6,0|jffjvz,148,6,0|jffjw0,149,209,1|jqlejz,149,209,1|jqlek0,148,6,0|jyil7z,148,6,0|jyil80,149,209,1|k9bh7z,149,209,1|k9bh80,148,6,0|kh8nvz,148,6,0|kh8nw0,149,209,1|ks1jvz,149,209,1|ks1jw0,148,6,0|kzyqjz,148,6,0|kzyqk0,149,209,1|lb4l7z,149,209,1|lb4l80,148,6,0|liot7z,148,6,0|liot80,148,209,0|ne0t3z,148,209,0|ne0t40,148,6,0\",\"Europe/Oslo|,0,202,0|-1353tzo,10,10,0|-rzayo1,10,10,0|-rzayo0,11,11,1|-rskiw1,11,11,1|-rskiw0,10,10,0|-fc7s81,10,10,0|-fc7s80,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cnnmk1,11,11,1|-cnnmk0,10,10,0|-5mxh81,10,10,0|-5mxh80,11,11,1|-5d7h81,11,11,1|-5d7h80,10,10,0|-53ufw1,10,10,0|-53ufw0,11,11,1|-4uhek1,11,11,1|-4uhek0,10,10,0|-4l4d81,10,10,0|-4l4d80,11,11,1|-4brbw1,11,11,1|-4brbw0,10,10,0|-42eak1,10,10,0|-42eak0,11,11,1|-3t1981,11,11,1|-3t1980,10,10,0|-3jo7w1,10,10,0|-3jo7w0,11,11,1|-3ab6k1,11,11,1|-3ab6k0,10,10,0|-30y581,10,10,0|-30y580,11,11,1|-2r8581,11,11,1|-2r8580,10,10,0|-2g2ak1,10,10,0|-2g2ak0,11,11,1|-28i2k1,11,11,1|-28i2k0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Paris|,0,9,0|-154gb3l,7,9,0|-uozn3m,7,9,0|-uozn3l,8,1,0|-ry2lg1,8,1,0|-ry2lg0,9,10,1|-rsgqs1,9,10,1|-rsgqs0,8,1,0|-rjiis1,8,1,0|-rjiis0,9,10,1|-r9dpg1,9,10,1|-r9dpg0,8,1,0|-r1idg1,8,1,0|-r1idg0,9,10,1|-qqnms1,9,10,1|-qqnms0,8,1,0|-qj59g1,8,1,0|-qj59g0,9,10,1|-q7xk41,9,10,1|-q7xk40,8,1,0|-q15441,8,1,0|-q15440,9,10,1|-po6g41,9,10,1|-po6g40,8,1,0|-pgvhg1,8,1,0|-pgvhg0,9,10,1|-p5atg1,9,10,1|-p5atg0,8,1,0|-oxj6s1,8,1,0|-oxj6s0,9,10,1|-ong841,9,10,1|-ong840,8,1,0|-obkg41,8,1,0|-obkg40,9,10,1|-o4q5g1,9,10,1|-o4q5g0,8,1,0|-nvq2s1,8,1,0|-nvq2s0,9,10,1|-nm02s1,9,10,1|-nm02s0,8,1,0|-ncn1g1,8,1,0|-ncn1g0,9,10,1|-n3a041,9,10,1|-n3a040,8,1,0|-mt71g1,8,1,0|-mt71g0,9,10,1|-mkjxg1,9,10,1|-mkjxg0,8,1,0|-matxg1,8,1,0|-matxg0,9,10,1|-m1tus1,9,10,1|-m1tus0,8,1,0|-lrqw41,8,1,0|-lrqw40,9,10,1|-liqtg1,9,10,1|-liqtg0,8,1,0|-l8nus1,8,1,0|-l8nus0,9,10,1|-l00qs1,9,10,1|-l00qs0,8,1,0|-kqaqs1,8,1,0|-kqaqs0,9,10,1|-khao41,9,10,1|-khao40,8,1,0|-k77pg1,8,1,0|-k77pg0,9,10,1|-jyklg1,9,10,1|-jyklg0,8,1,0|-jp7k41,8,1,0|-jp7k40,9,10,1|-jfuis1,9,10,1|-jfuis0,8,1,0|-j6ug41,8,1,0|-j6ug40,9,10,1|-iwrhg1,9,10,1|-iwrhg0,8,1,0|-ineg41,8,1,0|-ineg40,9,10,1|-ie1es1,9,10,1|-ie1es0,8,1,0|-i51c41,8,1,0|-i51c40,9,10,1|-hvbc41,9,10,1|-hvbc40,8,1,0|-hl8dg1,8,1,0|-hl8dg0,9,10,1|-hcl9g1,9,10,1|-hcl9g0,8,1,0|-h38841,8,1,0|-h38840,9,10,1|-gtv6s1,9,10,1|-gtv6s0,8,1,0|-gkv441,8,1,0|-gkv440,9,10,1|-gb5441,9,10,1|-gb5440,8,1,0|-g125g1,8,1,0|-g125g0,9,10,1|-fpwas1,9,10,1|-fpwas0,8,1,0|-fkul41,8,1,0|-fkul40,9,10,1|-ff5c81,9,10,1|-ff5c80,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d8caw1,11,11,1|-d8caw0,152,11,1|-d62qs1,152,11,1|-d62qs0,9,10,1|-cx0nw1,9,10,1|-cx0nw0,152,11,1|-cofek1,152,11,1|-cofek0,10,10,0|396inz,10,10,0|396io0,11,11,1|3ijh7z,11,11,1|3ijh80,10,10,0|3s9mrz,10,10,0|3s9ms0,11,11,1|419pfz,11,11,1|419pg0,10,10,0|4azpfz,10,10,0|4azpg0,11,11,1|4kcqrz,11,11,1|4kcqs0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Podgorica|,0,332,0|-18vsmgo,10,10,0|-ezayw1,10,10,0|-ezayw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cv5zw1,10,10,0|-cv5zw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Prague|,0,334,0|-1qmkw08,7,334,0|-14u7uo9,7,334,0|-14u7uo8,10,10,0|-s0e081,10,10,0|-s0e080,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-fizzw1,10,10,0|-fizzw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cnnmk1,11,11,1|-cnnmk0,10,10,0|-cchrw1,10,10,0|-cchrw0,11,11,1|-c4mfw1,11,11,1|-c4mfw0,10,10,0|-c1qns1,10,10,0|-c1qns0,1,1,1|-bxf3s1,1,1,1|-bxf3s0,10,10,0|-bujh81,10,10,0|-bujh80,11,11,1|-blwd81,11,11,1|-blwd80,10,10,0|-bbtek1,10,10,0|-bbtek0,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-ati581,10,10,0|-ati580,11,11,1|-akg7w1,11,11,1|-akg7w0,10,10,0|4tps3z,10,10,0|4tps40,11,11,1|532tfz,11,11,1|532tg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Riga|,0,363,0|-1ayy74y,136,363,0|-qznlkz,136,363,0|-qznlky,154,364,1|-qrqewz,154,364,1|-qrqewy,136,363,0|-qhllkz,136,363,0|-qhllky,154,364,1|-qez5kz,154,364,1|-qez5ky,136,363,0|-ms0hsz,136,363,0|-ms0hsy,15,11,0|-fciw81,15,11,0|-fciw80,148,6,0|-evjv01,148,6,0|-evjv00,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-d5thg1,10,10,0|-d5thg0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,16,6,1|aaofzz,16,6,1|aaog00,15,11,0|ak1hbz,15,11,0|ak1hc0,16,6,1|atrhbz,16,6,1|atrhc0,15,11,0|b34inz,15,11,0|b34io0,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|blulbz,15,11,0|blulc0,16,6,1|bv7mnz,16,6,1|bv7mo0,15,11,0|c4knzz,15,11,0|c4ko00,16,6,1|cdxpbz,16,6,1|cdxpc0,15,11,0|cnaqnz,15,11,0|cnaqo0,16,6,1|cwnrzz,16,6,1|cwns00,15,11,0|d60tbz,15,11,0|d60tc0,16,6,1|dfdunz,16,6,1|dfduo0,15,11,0|dp3unz,15,11,0|dp3uo0,16,6,1|dygvzz,16,6,1|dygw00,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Rome|,0,365,0|-1hs7rn8,136,365,0|-13r0qs1,136,365,0|-13r0qs0,10,10,0|-rymys1,10,10,0|-rymys0,11,11,1|-rsio81,11,11,1|-rsio80,10,10,0|-rj5k41,10,10,0|-rj5k40,11,11,1|-r9qqw1,11,11,1|-r9qqw0,10,10,0|-r1idg1,10,10,0|-r1idg0,11,11,1|-qqnpk1,11,11,1|-qqnpk0,10,10,0|-qj59g1,10,10,0|-qj59g0,11,11,1|-q7zhk1,11,11,1|-q7zhk0,10,10,0|-pzcas1,10,10,0|-pzcas0,11,11,1|-ppzc81,11,11,1|-ppzc80,10,10,0|-ff59g1,10,10,0|-ff59g0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d75h81,11,11,1|-d75h80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cohes1,11,11,1|-cohes0,10,10,0|-cf2d81,10,10,0|-cf2d80,11,11,1|-c4mfw1,11,11,1|-c4mfw0,10,10,0|-bwcg41,10,10,0|-bwcg40,11,11,1|-blwis1,11,11,1|-blwis0,10,10,0|-bec581,10,10,0|-bec580,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-1vwis1,10,10,0|-1vwis0,11,11,1|-1pf9k1,11,11,1|-1pf9k0,10,10,0|-1cthg1,10,10,0|-1cthg0,11,11,1|-16p441,11,11,1|-16p440,10,10,0|-u3es1,10,10,0|-u3es0,11,11,1|-nz1g1,11,11,1|-nz1g0,10,10,0|-b0dg1,10,10,0|-b0dg0,11,11,1|-4w041,11,11,1|-4w040,10,10,0|7pp7z,10,10,0|7pp80,11,11,1|du2jz,11,11,1|du2k0,10,10,0|q2t7z,10,10,0|q2t80,11,11,1|wk57z,11,11,1|wk580,10,10,0|195ujz,10,10,0|195uk0,11,11,1|1fn6jz,11,11,1|1fn6k0,10,10,0|1s8vvz,10,10,0|1s8vw0,11,11,1|1yd97z,11,11,1|1yd980,10,10,0|2alzvz,10,10,0|2alzw0,11,11,1|2h3bvz,11,11,1|2h3bw0,10,10,0|2tp17z,10,10,0|2tp180,11,11,1|2ztejz,11,11,1|2ztek0,10,10,0|3cf3vz,10,10,0|3cf3w0,11,11,1|3ijh7z,11,11,1|3ijh80,10,10,0|3us7vz,10,10,0|3us7w0,11,11,1|419jvz,11,11,1|419jw0,10,10,0|4dv97z,10,10,0|4dv980,11,11,1|4kcl7z,11,11,1|4kcl80,10,10,0|4wlbvz,10,10,0|4wlbw0,11,11,1|532nvz,11,11,1|532nw0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Samara|,0,366,0|-qcx400,100,6,0|-kmr4c1,100,6,0|-kmr4c0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,92,194,1|9ry7rz,92,194,1|9ry7s0,105,209,0|a1b93z,105,209,0|a1b940,105,209,1|aaod7z,105,209,1|aaod80,100,6,0|ak1ejz,100,6,0|ak1ek0,105,209,1|atrejz,105,209,1|atrek0,100,6,0|b34fvz,100,6,0|b34fw0,100,6,1|bchjzz,100,6,1|bchk00,100,6,0|bdkfzz,100,6,0|bdkg00,105,209,0|blufrz,105,209,0|blufs0,92,194,1|bv7h3z,92,194,1|bv7h40,105,209,0|c4kifz,105,209,0|c4kig0,92,194,1|cdxjrz,92,194,1|cdxjs0,105,209,0|cnal3z,105,209,0|cnal40,92,194,1|cwnmfz,92,194,1|cwnmg0,105,209,0|d60nrz,105,209,0|d60ns0,92,194,1|dfdp3z,92,194,1|dfdp40,105,209,0|dp3p3z,105,209,0|dp3p40,92,194,1|dzwl3z,92,194,1|dzwl40,105,209,0|e7trrz,105,209,0|e7trs0,92,194,1|eimnrz,92,194,1|eimns0,105,209,0|eqjufz,105,209,0|eqjug0,92,194,1|f1cqfz,92,194,1|f1cqg0,105,209,0|f99x3z,105,209,0|f99x40,92,194,1|fkfrrz,92,194,1|fkfrs0,105,209,0|frzzrz,105,209,0|frzzs0,92,194,1|g35ufz,92,194,1|g35ug0,105,209,0|gaq2fz,105,209,0|gaq2g0,92,194,1|glvx3z,92,194,1|glvx40,105,209,0|gtt3rz,105,209,0|gtt3s0,92,194,1|h4lzrz,92,194,1|h4lzs0,105,209,0|hcj6fz,105,209,0|hcj6g0,92,194,1|hnc2fz,92,194,1|hnc2g0,105,209,0|hv993z,105,209,0|hv9940,92,194,1|i6f3rz,92,194,1|i6f3s0,105,209,0|idzbrz,105,209,0|idzbs0,92,194,1|ip56fz,92,194,1|ip56g0,105,209,0|iwpefz,105,209,0|iwpeg0,92,194,1|j7v93z,92,194,1|j7v940,105,209,0|jffh3z,105,209,0|jffh40,92,194,1|jqlbrz,92,194,1|jqlbs0,105,209,0|jyiifz,105,209,0|jyiig0,92,194,1|k9befz,92,194,1|k9beg0,105,209,0|kh8l3z,105,209,0|kh8l40,92,194,1|ks1h3z,92,194,1|ks1h40,105,209,0|kzynrz,105,209,0|kzyns0,105,209,1|lb4l7z,105,209,1|lb4l80,100,6,0|liot7z,100,6,0|liot80,105,209,0\",\"Europe/San_Marino|,0,365,0|-1hs7rn8,136,365,0|-13r0qs1,136,365,0|-13r0qs0,10,10,0|-rymys1,10,10,0|-rymys0,11,11,1|-rsio81,11,11,1|-rsio80,10,10,0|-rj5k41,10,10,0|-rj5k40,11,11,1|-r9qqw1,11,11,1|-r9qqw0,10,10,0|-r1idg1,10,10,0|-r1idg0,11,11,1|-qqnpk1,11,11,1|-qqnpk0,10,10,0|-qj59g1,10,10,0|-qj59g0,11,11,1|-q7zhk1,11,11,1|-q7zhk0,10,10,0|-pzcas1,10,10,0|-pzcas0,11,11,1|-ppzc81,11,11,1|-ppzc80,10,10,0|-ff59g1,10,10,0|-ff59g0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d75h81,11,11,1|-d75h80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cohes1,11,11,1|-cohes0,10,10,0|-cf2d81,10,10,0|-cf2d80,11,11,1|-c4mfw1,11,11,1|-c4mfw0,10,10,0|-bwcg41,10,10,0|-bwcg40,11,11,1|-blwis1,11,11,1|-blwis0,10,10,0|-bec581,10,10,0|-bec580,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-1vwis1,10,10,0|-1vwis0,11,11,1|-1pf9k1,11,11,1|-1pf9k0,10,10,0|-1cthg1,10,10,0|-1cthg0,11,11,1|-16p441,11,11,1|-16p440,10,10,0|-u3es1,10,10,0|-u3es0,11,11,1|-nz1g1,11,11,1|-nz1g0,10,10,0|-b0dg1,10,10,0|-b0dg0,11,11,1|-4w041,11,11,1|-4w040,10,10,0|7pp7z,10,10,0|7pp80,11,11,1|du2jz,11,11,1|du2k0,10,10,0|q2t7z,10,10,0|q2t80,11,11,1|wk57z,11,11,1|wk580,10,10,0|195ujz,10,10,0|195uk0,11,11,1|1fn6jz,11,11,1|1fn6k0,10,10,0|1s8vvz,10,10,0|1s8vw0,11,11,1|1yd97z,11,11,1|1yd980,10,10,0|2alzvz,10,10,0|2alzw0,11,11,1|2h3bvz,11,11,1|2h3bw0,10,10,0|2tp17z,10,10,0|2tp180,11,11,1|2ztejz,11,11,1|2ztek0,10,10,0|3cf3vz,10,10,0|3cf3w0,11,11,1|3ijh7z,11,11,1|3ijh80,10,10,0|3us7vz,10,10,0|3us7w0,11,11,1|419jvz,11,11,1|419jw0,10,10,0|4dv97z,10,10,0|4dv980,11,11,1|4kcl7z,11,11,1|4kcl80,10,10,0|4wlbvz,10,10,0|4wlbw0,11,11,1|532nvz,11,11,1|532nw0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Sarajevo|,0,332,0|-18vsmgo,10,10,0|-ezayw1,10,10,0|-ezayw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cv5zw1,10,10,0|-cv5zw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Saratov|,0,367,0|-qcx400,100,6,0|-kmr4c1,100,6,0|-kmr4c0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,105,209,1|9ryajz,105,209,1|9ryak0,100,6,0|a1bbvz,100,6,0|a1bbw0,105,209,1|aaod7z,105,209,1|aaod80,100,6,0|ak1ejz,100,6,0|ak1ek0,105,209,1|atrejz,105,209,1|atrek0,100,6,0|b34fvz,100,6,0|b34fw0,105,209,0|blufrz,105,209,0|blufs0,105,209,1|bv7jvz,105,209,1|bv7jw0,100,6,0|c4kl7z,100,6,0|c4kl80,105,209,1|cdxmjz,105,209,1|cdxmk0,100,6,0|cnanvz,100,6,0|cnanw0,105,209,1|cwnp7z,105,209,1|cwnp80,100,6,0|d60qjz,100,6,0|d60qk0,105,209,1|dfdrvz,105,209,1|dfdrw0,100,6,0|dp3rvz,100,6,0|dp3rw0,105,209,1|dzwnvz,105,209,1|dzwnw0,100,6,0|e7tujz,100,6,0|e7tuk0,105,209,1|eimqjz,105,209,1|eimqk0,100,6,0|eqjx7z,100,6,0|eqjx80,105,209,1|f1ct7z,105,209,1|f1ct80,100,6,0|f99zvz,100,6,0|f99zw0,105,209,1|fkfujz,105,209,1|fkfuk0,100,6,0|fs02jz,100,6,0|fs02k0,105,209,1|g35x7z,105,209,1|g35x80,100,6,0|gaq57z,100,6,0|gaq580,105,209,1|glvzvz,105,209,1|glvzw0,100,6,0|gtt6jz,100,6,0|gtt6k0,105,209,1|h4m2jz,105,209,1|h4m2k0,100,6,0|hcj97z,100,6,0|hcj980,105,209,1|hnc57z,105,209,1|hnc580,100,6,0|hv9bvz,100,6,0|hv9bw0,105,209,1|i6f6jz,105,209,1|i6f6k0,100,6,0|idzejz,100,6,0|idzek0,105,209,1|ip597z,105,209,1|ip5980,100,6,0|iwph7z,100,6,0|iwph80,105,209,1|j7vbvz,105,209,1|j7vbw0,100,6,0|jffjvz,100,6,0|jffjw0,105,209,1|jqlejz,105,209,1|jqlek0,100,6,0|jyil7z,100,6,0|jyil80,105,209,1|k9bh7z,105,209,1|k9bh80,100,6,0|kh8nvz,100,6,0|kh8nw0,105,209,1|ks1jvz,105,209,1|ks1jw0,100,6,0|kzyqjz,100,6,0|kzyqk0,105,209,1|lb4l7z,105,209,1|lb4l80,100,6,0|liot7z,100,6,0|liot80,105,209,0|ne0t3z,105,209,0|ne0t40,100,6,0|ohmt7z,100,6,0|ohmt80,105,209,0\",\"Europe/Simferopol|,0,368,0|-1ayy8zc,85,369,0|-nu12ap,85,369,0|-nu12ao,15,11,0|-kmr1k1,15,11,0|-kmr1k0,148,6,0|-ep8301,148,6,0|-ep8300,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-df8g81,11,11,1|-df8g80,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,149,209,1|aaod7z,149,209,1|aaod80,148,6,0|ap2vvz,148,6,0|ap2vw0,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cp3bnz,16,6,1|cp3bo0,149,209,1|cwngvz,149,209,1|cwngw0,148,6,0|d60kzz,148,6,0|d60l00,149,209,1|dfdjjz,149,209,1|dfdjk0,148,6,0|dp3mbz,148,6,0|dp3mc0,149,209,1|dzwqnz,149,209,1|dzwqo0,148,6,0|e7u03z,148,6,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n382nz,15,11,0|n382o0,148,209,0|ne0t3z,148,209,0|ne0t40,148,6,0\",\"Europe/Skopje|,0,332,0|-18vsmgo,10,10,0|-ezayw1,10,10,0|-ezayw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cv5zw1,10,10,0|-cv5zw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Sofia|,0,370,0|-1ayy6zg,117,350,0|-136r6qx,117,350,0|-136r6qw,15,11,0|-e6dzw1,15,11,0|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0l41,10,10,0|-cx0l40,15,11,0|4tpgzz,15,11,0|4tph00,16,6,1|534frz,16,6,1|534fs0,15,11,0|5csibz,15,11,0|5csic0,16,6,1|5luifz,16,6,1|5luig0,15,11,0|5vikzz,15,11,0|5vil00,16,6,1|64it7z,16,6,1|64it80,15,11,0|6e8nnz,15,11,0|6e8no0,16,6,1|6n8ynz,16,6,1|6n8yo0,15,11,0|6wlzzz,15,11,0|6wm000,16,6,1|75z1bz,16,6,1|75z1c0,15,11,0|7fc2nz,15,11,0|7fc2o0,16,6,1|7p22nz,16,6,1|7p22o0,15,11,0|7yf3zz,15,11,0|7yf400,16,6,1|87s5bz,16,6,1|87s5c0,15,11,0|8h56nz,15,11,0|8h56o0,16,6,1|8qi7zz,16,6,1|8qi800,15,11,0|8zv9bz,15,11,0|8zv9c0,16,6,1|998anz,16,6,1|998ao0,15,11,0|9ilbzz,15,11,0|9ilc00,16,6,1|9rydbz,16,6,1|9rydc0,15,11,0|a1benz,15,11,0|a1beo0,16,6,1|aaofzz,16,6,1|aaog00,15,11,0|ak1hbz,15,11,0|ak1hc0,16,6,1|atrhbz,16,6,1|atrhc0,15,11,0|b34d3z,15,11,0|b34d40,16,6,1|bchbnz,16,6,1|bchbo0,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60nrz,15,11,0|d60ns0,16,6,1|dfdmbz,16,6,1|dfdmc0,15,11,0|dp3p3z,15,11,0|dp3p40,16,6,1|dzwibz,16,6,1|dzwic0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Stockholm|,0,371,0|-1bhq3cc,155,372,0|-10j6dgf,155,372,0|-10j6dge,10,10,0|-rzo2w1,10,10,0|-rzo2w0,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Tallinn|,0,373,0|-1ayy790,133,373,0|-r3exx1,133,373,0|-r3exx0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-qcx6s1,10,10,0|-qcx6s0,133,373,0|-peghx1,133,373,0|-peghx0,15,11,0|-fch1k1,15,11,0|-fch1k0,148,6,0|-ern4c1,148,6,0|-ern4c0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6wg81,11,11,1|-d6wg80,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,16,6,1|aaofzz,16,6,1|aaog00,15,11,0|ak1hbz,15,11,0|ak1hc0,16,6,1|atrhbz,16,6,1|atrhc0,15,11,0|b34inz,15,11,0|b34io0,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|blulbz,15,11,0|blulc0,16,6,1|bv7mnz,16,6,1|bv7mo0,15,11,0|c4knzz,15,11,0|c4ko00,16,6,1|cdxpbz,16,6,1|cdxpc0,15,11,0|cnaqnz,15,11,0|cnaqo0,16,6,1|cwnrzz,16,6,1|cwns00,15,11,0|d60tbz,15,11,0|d60tc0,16,6,1|dfdunz,16,6,1|dfduo0,15,11,0|dp3unz,15,11,0|dp3uo0,16,6,1|dzwqnz,16,6,1|dzwqo0,15,11,0|e7txbz,15,11,0|e7txc0,16,6,1|eimtbz,16,6,1|eimtc0,15,11,0|eqjzzz,15,11,0|eqk000,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Tirane|,0,374,0|-t85vo8,10,10,0|-ff3es1,10,10,0|-ff3es0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dy7jw1,11,11,1|-dy7jw0,10,10,0|29h97z,10,10,0|29h980,11,11,1|2h8t3z,11,11,1|2h8t40,10,10,0|2s3mjz,10,10,0|2s3mk0,11,11,1|300qfz,11,11,1|300qg0,10,10,0|3az97z,10,10,0|3az980,11,11,1|3iwd3z,11,11,1|3iwd40,10,10,0|3u2ajz,10,10,0|3u2ak0,11,11,1|41mfrz,11,11,1|41mfs0,10,10,0|4cqijz,10,10,0|4cqik0,11,11,1|4kcifz,11,11,1|4kcig0,10,10,0|4vgl7z,10,10,0|4vgl80,11,11,1|532l3z,11,11,1|532l40,10,10,0|5e6nvz,10,10,0|5e6nw0,11,11,1|5m3rrz,11,11,1|5m3rs0,10,10,0|5wlmjz,10,10,0|5wlmk0,11,11,1|64iqfz,11,11,1|64iqg0,10,10,0|6fonvz,10,10,0|6fonw0,11,11,1|6nlrrz,11,11,1|6nlrs0,10,10,0|6xqnvz,10,10,0|6xqnw0,11,11,1|769zrz,11,11,1|769zs0,10,10,0|7foyjz,10,10,0|7foyk0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Ulyanovsk|,0,375,0|-qcx400,100,6,0|-kmr4c1,100,6,0|-kmr4c0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,92,194,1|9ry7rz,92,194,1|9ry7s0,105,209,0|a1b93z,105,209,0|a1b940,105,209,1|aaod7z,105,209,1|aaod80,100,6,0|ak1ejz,100,6,0|ak1ek0,105,209,1|atrejz,105,209,1|atrek0,100,6,0|b34fvz,100,6,0|b34fw0,100,6,1|bchjzz,100,6,1|bchk00,101,11,0|bi8ynz,101,11,0|bi8yo0,100,6,0|bluijz,100,6,0|bluik0,105,209,1|bv7jvz,105,209,1|bv7jw0,100,6,0|c4kl7z,100,6,0|c4kl80,105,209,1|cdxmjz,105,209,1|cdxmk0,100,6,0|cnanvz,100,6,0|cnanw0,105,209,1|cwnp7z,105,209,1|cwnp80,100,6,0|d60qjz,100,6,0|d60qk0,105,209,1|dfdrvz,105,209,1|dfdrw0,100,6,0|dp3rvz,100,6,0|dp3rw0,105,209,1|dzwnvz,105,209,1|dzwnw0,100,6,0|e7tujz,100,6,0|e7tuk0,105,209,1|eimqjz,105,209,1|eimqk0,100,6,0|eqjx7z,100,6,0|eqjx80,105,209,1|f1ct7z,105,209,1|f1ct80,100,6,0|f99zvz,100,6,0|f99zw0,105,209,1|fkfujz,105,209,1|fkfuk0,100,6,0|fs02jz,100,6,0|fs02k0,105,209,1|g35x7z,105,209,1|g35x80,100,6,0|gaq57z,100,6,0|gaq580,105,209,1|glvzvz,105,209,1|glvzw0,100,6,0|gtt6jz,100,6,0|gtt6k0,105,209,1|h4m2jz,105,209,1|h4m2k0,100,6,0|hcj97z,100,6,0|hcj980,105,209,1|hnc57z,105,209,1|hnc580,100,6,0|hv9bvz,100,6,0|hv9bw0,105,209,1|i6f6jz,105,209,1|i6f6k0,100,6,0|idzejz,100,6,0|idzek0,105,209,1|ip597z,105,209,1|ip5980,100,6,0|iwph7z,100,6,0|iwph80,105,209,1|j7vbvz,105,209,1|j7vbw0,100,6,0|jffjvz,100,6,0|jffjw0,105,209,1|jqlejz,105,209,1|jqlek0,100,6,0|jyil7z,100,6,0|jyil80,105,209,1|k9bh7z,105,209,1|k9bh80,100,6,0|kh8nvz,100,6,0|kh8nw0,105,209,1|ks1jvz,105,209,1|ks1jw0,100,6,0|kzyqjz,100,6,0|kzyqk0,105,209,1|lb4l7z,105,209,1|lb4l80,100,6,0|liot7z,100,6,0|liot80,105,209,0|ne0t3z,105,209,0|ne0t40,100,6,0|o4o57z,100,6,0|o4o580,105,209,0\",\"Europe/Uzhgorod|,0,376,0|-15cztgo,10,10,0|-fizzw1,10,10,0|-fizzw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d55hk1,11,11,1|-d55hk0,10,10,0|-cshus1,10,10,0|-cshus0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,149,209,1|aaod7z,149,209,1|aaod80,148,6,0|ap2vvz,148,6,0|ap2vw0,10,10,0|b34o7z,10,10,0|b34o80,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60w3z,15,11,0|d60w40,16,6,1|dfdxfz,16,6,1|dfdxg0,15,11,0|dp3xfz,15,11,0|dp3xg0,16,6,1|dzwtfz,16,6,1|dzwtg0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Vaduz|,0,338,0|-1os49kw,53,339,0|-13g441n,53,339,0|-13g441m,10,10,0|-eyh6o1,10,10,0|-eyh6o0,11,11,1|-eqk001,11,11,1|-eqk000,10,10,0|-efr401,10,10,0|-efr400,11,11,1|-e7txc1,11,11,1|-e7txc0,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Vatican|,0,365,0|-1hs7rn8,136,365,0|-13r0qs1,136,365,0|-13r0qs0,10,10,0|-rymys1,10,10,0|-rymys0,11,11,1|-rsio81,11,11,1|-rsio80,10,10,0|-rj5k41,10,10,0|-rj5k40,11,11,1|-r9qqw1,11,11,1|-r9qqw0,10,10,0|-r1idg1,10,10,0|-r1idg0,11,11,1|-qqnpk1,11,11,1|-qqnpk0,10,10,0|-qj59g1,10,10,0|-qj59g0,11,11,1|-q7zhk1,11,11,1|-q7zhk0,10,10,0|-pzcas1,10,10,0|-pzcas0,11,11,1|-ppzc81,11,11,1|-ppzc80,10,10,0|-ff59g1,10,10,0|-ff59g0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d75h81,11,11,1|-d75h80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cohes1,11,11,1|-cohes0,10,10,0|-cf2d81,10,10,0|-cf2d80,11,11,1|-c4mfw1,11,11,1|-c4mfw0,10,10,0|-bwcg41,10,10,0|-bwcg40,11,11,1|-blwis1,11,11,1|-blwis0,10,10,0|-bec581,10,10,0|-bec580,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-1vwis1,10,10,0|-1vwis0,11,11,1|-1pf9k1,11,11,1|-1pf9k0,10,10,0|-1cthg1,10,10,0|-1cthg0,11,11,1|-16p441,11,11,1|-16p440,10,10,0|-u3es1,10,10,0|-u3es0,11,11,1|-nz1g1,11,11,1|-nz1g0,10,10,0|-b0dg1,10,10,0|-b0dg0,11,11,1|-4w041,11,11,1|-4w040,10,10,0|7pp7z,10,10,0|7pp80,11,11,1|du2jz,11,11,1|du2k0,10,10,0|q2t7z,10,10,0|q2t80,11,11,1|wk57z,11,11,1|wk580,10,10,0|195ujz,10,10,0|195uk0,11,11,1|1fn6jz,11,11,1|1fn6k0,10,10,0|1s8vvz,10,10,0|1s8vw0,11,11,1|1yd97z,11,11,1|1yd980,10,10,0|2alzvz,10,10,0|2alzw0,11,11,1|2h3bvz,11,11,1|2h3bw0,10,10,0|2tp17z,10,10,0|2tp180,11,11,1|2ztejz,11,11,1|2ztek0,10,10,0|3cf3vz,10,10,0|3cf3w0,11,11,1|3ijh7z,11,11,1|3ijh80,10,10,0|3us7vz,10,10,0|3us7w0,11,11,1|419jvz,11,11,1|419jw0,10,10,0|4dv97z,10,10,0|4dv980,11,11,1|4kcl7z,11,11,1|4kcl80,10,10,0|4wlbvz,10,10,0|4wlbw0,11,11,1|532nvz,11,11,1|532nw0,10,10,0|5cstfz,10,10,0|5cstg0,11,11,1|5lsw3z,11,11,1|5lsw40,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Vienna|,0,377,0|-14211ox,10,10,0|-s0e081,10,10,0|-s0e080,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,10,10,0|-pykd81,10,10,0|-pykd80,11,11,1|-pqa7w1,11,11,1|-pqa7w0,10,10,0|-fizzw1,10,10,0|-fizzw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cx0nw1,10,10,0|-cx0nw0,11,11,1|-cwi581,11,11,1|-cwi580,10,10,0|-cdmik1,10,10,0|-cdmik0,11,11,1|-c4kl81,11,11,1|-c4kl80,10,10,0|-bv9ek1,10,10,0|-bv9ek0,11,11,1|-blwd81,11,11,1|-blwd80,10,10,0|-bbtek1,10,10,0|-bbtek0,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|5csnvz,10,10,0|5csnw0,11,11,1|5lsnrz,11,11,1|5lsns0,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Vilnius|,0,378,0|-1ayy7cs,156,379,0|-rns981,156,379,0|-rns980,74,380,0|-q7q73d,74,380,0|-q7q73c,10,10,0|-ptj1g1,10,10,0|-ptj1g0,15,11,0|-poyaw1,15,11,0|-poyaw0,10,10,0|-fcmis1,10,10,0|-fcmis0,148,6,0|-evwto1,148,6,0|-evwto0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d9kqw1,11,11,1|-d9kqw0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,16,6,1|aaofzz,16,6,1|aaog00,15,11,0|ak1hbz,15,11,0|ak1hc0,16,6,1|atrhbz,16,6,1|atrhc0,15,11,0|b34inz,15,11,0|b34io0,16,6,1|bchjzz,16,6,1|bchk00,15,11,0|blulbz,15,11,0|blulc0,16,6,1|bv7mnz,16,6,1|bv7mo0,15,11,0|c4knzz,15,11,0|c4ko00,16,6,1|cdxpbz,16,6,1|cdxpc0,15,11,0|cnaqnz,15,11,0|cnaqo0,16,6,1|cwnrzz,16,6,1|cwns00,15,11,0|d60tbz,15,11,0|d60tc0,16,6,1|dfdunz,16,6,1|dfduo0,15,11,0|dp3unz,15,11,0|dp3uo0,16,6,1|dzwqnz,16,6,1|dzwqo0,15,11,0|e7txbz,15,11,0|e7txc0,16,6,1|eimtbz,16,6,1|eimtc0,15,11,0|eqk2rz,15,11,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Volgograd|,0,213,0|-q3cw84,100,6,0|-kmr4c1,100,6,0|-kmr4c0,105,209,0|5vb3jz,105,209,0|5vb3k0,92,194,1|64pwrz,92,194,1|64pws0,105,209,0|6e30vz,105,209,0|6e30w0,92,194,1|6nhu3z,92,194,1|6nhu40,105,209,0|6wuy7z,105,209,0|6wuy80,92,194,1|769rfz,92,194,1|769rg0,105,209,0|7foq7z,105,209,0|7foq80,92,194,1|7p1x3z,92,194,1|7p1x40,105,209,0|7yeyfz,105,209,0|7yeyg0,92,194,1|87rzrz,92,194,1|87rzs0,105,209,0|8h513z,105,209,0|8h5140,92,194,1|8qi2fz,92,194,1|8qi2g0,105,209,0|8zv3rz,105,209,0|8zv3s0,92,194,1|99853z,92,194,1|998540,105,209,0|9il6fz,105,209,0|9il6g0,105,209,1|9ryajz,105,209,1|9ryak0,100,6,0|a1bbvz,100,6,0|a1bbw0,105,209,1|aaod7z,105,209,1|aaod80,100,6,0|ak1ejz,100,6,0|ak1ek0,105,209,1|atrejz,105,209,1|atrek0,100,6,0|b34fvz,100,6,0|b34fw0,105,209,0|blufrz,105,209,0|blufs0,105,209,1|bv7jvz,105,209,1|bv7jw0,100,6,0|c4kl7z,100,6,0|c4kl80,105,209,1|cdxmjz,105,209,1|cdxmk0,100,6,0|cnanvz,100,6,0|cnanw0,105,209,1|cwnp7z,105,209,1|cwnp80,100,6,0|d60qjz,100,6,0|d60qk0,105,209,1|dfdrvz,105,209,1|dfdrw0,100,6,0|dp3rvz,100,6,0|dp3rw0,105,209,1|dzwnvz,105,209,1|dzwnw0,100,6,0|e7tujz,100,6,0|e7tuk0,105,209,1|eimqjz,105,209,1|eimqk0,100,6,0|eqjx7z,100,6,0|eqjx80,105,209,1|f1ct7z,105,209,1|f1ct80,100,6,0|f99zvz,100,6,0|f99zw0,105,209,1|fkfujz,105,209,1|fkfuk0,100,6,0|fs02jz,100,6,0|fs02k0,105,209,1|g35x7z,105,209,1|g35x80,100,6,0|gaq57z,100,6,0|gaq580,105,209,1|glvzvz,105,209,1|glvzw0,100,6,0|gtt6jz,100,6,0|gtt6k0,105,209,1|h4m2jz,105,209,1|h4m2k0,100,6,0|hcj97z,100,6,0|hcj980,105,209,1|hnc57z,105,209,1|hnc580,100,6,0|hv9bvz,100,6,0|hv9bw0,105,209,1|i6f6jz,105,209,1|i6f6k0,100,6,0|idzejz,100,6,0|idzek0,105,209,1|ip597z,105,209,1|ip5980,100,6,0|iwph7z,100,6,0|iwph80,105,209,1|j7vbvz,105,209,1|j7vbw0,100,6,0|jffjvz,100,6,0|jffjw0,105,209,1|jqlejz,105,209,1|jqlek0,100,6,0|jyil7z,100,6,0|jyil80,105,209,1|k9bh7z,105,209,1|k9bh80,100,6,0|kh8nvz,100,6,0|kh8nw0,105,209,1|ks1jvz,105,209,1|ks1jw0,100,6,0|kzyqjz,100,6,0|kzyqk0,105,209,1|lb4l7z,105,209,1|lb4l80,100,6,0|liot7z,100,6,0|liot80,105,209,0|ne0t3z,105,209,0|ne0t40,100,6,0|pha57z,100,6,0|pha580,105,209,0|qlyvrz,105,209,0|qlyvs0,100,6,0\",\"Europe/Warsaw|,0,379,0|-1ayy6k0,156,379,0|-se9yk1,156,379,0|-se9yk0,10,10,0|-s0e081,10,10,0|-s0e080,11,11,1|-rsilg1,11,11,1|-rsilg0,10,10,0|-ridmk1,10,10,0|-ridmk0,11,11,1|-ragfw1,11,11,1|-ragfw0,10,10,0|-qznjw1,10,10,0|-qznjw0,11,11,1|-qrqd81,11,11,1|-qrqd80,15,11,0|-qgvpc1,15,11,0|-qgvpc0,16,6,1|-q8yio1,16,6,1|-q8yio0,15,11,0|-ou36w1,15,11,0|-ou36w0,10,10,0|-feqak1,10,10,0|-feqak0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6a2o1,11,11,1|-d6a2o0,10,10,0|-cvmtg1,10,10,0|-cvmtg0,11,11,1|-cm2g81,11,11,1|-cm2g80,10,10,0|-cdmo41,10,10,0|-cdmo40,11,11,1|-c4kl81,11,11,1|-c4kl80,10,10,0|-bttjw1,10,10,0|-bttjw0,11,11,1|-blwd81,11,11,1|-blwd80,10,10,0|-bbtek1,10,10,0|-bbtek0,11,11,1|-b36ak1,11,11,1|-b36ak0,10,10,0|-atgak1,10,10,0|-atgak0,11,11,1|-akg7w1,11,11,1|-akg7w0,10,10,0|-6kf401,10,10,0|-6kf400,11,11,1|-6eaqo1,11,11,1|-6eaqo0,10,10,0|-64xpc1,10,10,0|-64xpc0,11,11,1|-5vko01,11,11,1|-5vko00,10,10,0|-5iyyo1,10,10,0|-5iyyo0,11,11,1|-5chmo1,11,11,1|-5chmo0,10,10,0|-534lc1,10,10,0|-534lc0,11,11,1|-4trk01,11,11,1|-4trk00,10,10,0|-4hitc1,10,10,0|-4hitc0,11,11,1|-4b1hc1,11,11,1|-4b1hc0,10,10,0|-3ysqo1,10,10,0|-3ysqo0,11,11,1|-3sbeo1,11,11,1|-3sbeo0,10,10,0|-3g2o01,10,10,0|-3g2o00,11,11,1|-39lc01,11,11,1|-39lc00,10,10,0|-2wzmo1,10,10,0|-2wzmo0,11,11,1|-2qv9c1,11,11,1|-2qv9c0,10,10,0|3s9jzz,10,10,0|3s9k00,11,11,1|419mnz,11,11,1|419mo0,10,10,0|4azmnz,10,10,0|4azmo0,11,11,1|4kcnzz,11,11,1|4kco00,10,10,0|4tppbz,10,10,0|4tppc0,11,11,1|532qnz,11,11,1|532qo0,10,10,0|5csqnz,10,10,0|5csqo0,11,11,1|5lstbz,11,11,1|5lstc0,10,10,0|5v5unz,10,10,0|5v5uo0,11,11,1|64ivzz,11,11,1|64iw00,10,10,0|6dvxbz,10,10,0|6dvxc0,11,11,1|6n8ynz,11,11,1|6n8yo0,10,10,0|6wlzzz,10,10,0|6wm000,11,11,1|75z1bz,11,11,1|75z1c0,10,10,0|7fc2nz,10,10,0|7fc2o0,11,11,1|7p22nz,11,11,1|7p22o0,10,10,0|7yf3zz,10,10,0|7yf400,11,11,1|87s5bz,11,11,1|87s5c0,10,10,0|8h56nz,10,10,0|8h56o0,11,11,1|8qi7zz,11,11,1|8qi800,10,10,0|8zv9bz,10,10,0|8zv9c0,11,11,1|998anz,11,11,1|998ao0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Zagreb|,0,332,0|-18vsmgo,10,10,0|-ezayw1,10,10,0|-ezayw0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-dfqqk1,10,10,0|-dfqqk0,11,11,1|-d6dp81,11,11,1|-d6dp80,10,10,0|-cv5zw1,10,10,0|-cv5zw0,11,11,1|-cofek1,11,11,1|-cofek0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Europe/Zaporozhye|,0,250,0|-1ayy96g,157,381,0|-nu12hd,157,381,0|-nu12hc,15,11,0|-kmr1k1,15,11,0|-kmr1k0,148,6,0|-esq0c1,148,6,0|-esq0c0,11,11,1|-e6dzw1,11,11,1|-e6dzw0,10,10,0|-dytrw1,10,10,0|-dytrw0,11,11,1|-dp3rw1,11,11,1|-dp3rw0,10,10,0|-do11g1,10,10,0|-do11g0,148,6,0|5vb6bz,148,6,0|5vb6c0,149,209,1|64pzjz,149,209,1|64pzk0,148,6,0|6e33nz,148,6,0|6e33o0,149,209,1|6nhwvz,149,209,1|6nhww0,148,6,0|6wv0zz,148,6,0|6wv100,149,209,1|769u7z,149,209,1|769u80,148,6,0|7foszz,148,6,0|7fot00,149,209,1|7p1zvz,149,209,1|7p1zw0,148,6,0|7yf17z,148,6,0|7yf180,149,209,1|87s2jz,149,209,1|87s2k0,148,6,0|8h53vz,148,6,0|8h53w0,149,209,1|8qi57z,149,209,1|8qi580,148,6,0|8zv6jz,148,6,0|8zv6k0,149,209,1|9987vz,149,209,1|9987w0,148,6,0|9il97z,148,6,0|9il980,149,209,1|9ryajz,149,209,1|9ryak0,148,6,0|a1bbvz,148,6,0|a1bbw0,149,209,1|aaod7z,149,209,1|aaod80,148,6,0|ak1ejz,148,6,0|ak1ek0,149,209,1|atrejz,149,209,1|atrek0,148,6,0|b34fvz,148,6,0|b34fw0,16,6,1|bchbnz,16,6,1|bchbo0,15,11,0|blufrz,15,11,0|blufs0,16,6,1|bv7ebz,16,6,1|bv7ec0,15,11,0|c4kifz,15,11,0|c4kig0,16,6,1|cdxgzz,16,6,1|cdxh00,15,11,0|cnal3z,15,11,0|cnal40,16,6,1|cwnjnz,16,6,1|cwnjo0,15,11,0|d60w3z,15,11,0|d60w40,16,6,1|dfdxfz,16,6,1|dfdxg0,15,11,0|dp3xfz,15,11,0|dp3xg0,16,6,1|dzwtfz,16,6,1|dzwtg0,15,11,0|e7u03z,15,11,0|e7u040,16,6,1|eimw3z,16,6,1|eimw40,15,11,0|eqk2rz,15,11,0|eqk2s0,16,6,1|f1cyrz,16,6,1|f1cys0,15,11,0|f9a5fz,15,11,0|f9a5g0,16,6,1|fkg03z,16,6,1|fkg040,15,11,0|fs083z,15,11,0|fs0840,16,6,1|g362rz,16,6,1|g362s0,15,11,0|gaqarz,15,11,0|gaqas0,16,6,1|glw5fz,16,6,1|glw5g0,15,11,0|gttc3z,15,11,0|gttc40,16,6,1|h4m83z,16,6,1|h4m840,15,11,0|hcjerz,15,11,0|hcjes0,16,6,1|hncarz,16,6,1|hncas0,15,11,0|hv9hfz,15,11,0|hv9hg0,16,6,1|i6fc3z,16,6,1|i6fc40,15,11,0|idzk3z,15,11,0|idzk40,16,6,1|ip5erz,16,6,1|ip5es0,15,11,0|iwpmrz,15,11,0|iwpms0,16,6,1|j7vhfz,16,6,1|j7vhg0,15,11,0|jffpfz,15,11,0|jffpg0,16,6,1|jqlk3z,16,6,1|jqlk40,15,11,0|jyiqrz,15,11,0|jyiqs0,16,6,1|k9bmrz,16,6,1|k9bms0,15,11,0|kh8tfz,15,11,0|kh8tg0,16,6,1|ks1pfz,16,6,1|ks1pg0,15,11,0|kzyw3z,15,11,0|kzyw40,16,6,1|lb4qrz,16,6,1|lb4qs0,15,11,0|lioyrz,15,11,0|lioys0,16,6,1|ltutfz,16,6,1|ltutg0,15,11,0|m1f1fz,15,11,0|m1f1g0,16,6,1|mckw3z,16,6,1|mckw40,15,11,0|mki2rz,15,11,0|mki2s0,16,6,1|mvayrz,16,6,1|mvays0,15,11,0|n385fz,15,11,0|n385g0,16,6,1|ne11fz,16,6,1|ne11g0,15,11,0|nly83z,15,11,0|nly840,16,6,1|nwr43z,16,6,1|nwr440,15,11,0|o4oarz,15,11,0|o4oas0,16,6,1|ofu5fz,16,6,1|ofu5g0,15,11,0|onedfz,15,11,0|onedg0,16,6,1|oyk83z,16,6,1|oyk840,15,11,0|p64g3z,15,11,0|p64g40,16,6,1|phaarz,16,6,1|phaas0,15,11,0|pp7hfz,15,11,0|pp7hg0,16,6,1|q00dfz,16,6,1|q00dg0,15,11,0|q7xk3z,15,11,0|q7xk40,16,6,1|qiqg3z,16,6,1|qiqg40,15,11,0|qqnmrz,15,11,0|qqnms0,16,6,1|r1thfz,16,6,1|r1thg0,15,11,0|r9dpfz,15,11,0|r9dpg0,16,6,1|rkjk3z,16,6,1|rkjk40,15,11,0|rs3s3z,15,11,0|rs3s40,16,6,1|s39mrz,16,6,1|s39ms0,15,11,0|sb6tfz,15,11,0|sb6tg0,16,6,1|slzpfz,16,6,1|slzpg0,15,11,0|stww3z,15,11,0|stww40,16,6,1|t4ps3z,16,6,1|t4ps40,15,11,0|tcmyrz,15,11,0|tcmys0,16,6,1|tnfurz,16,6,1|tnfus0,15,11,0|tvd1fz,15,11,0|tvd1g0,16,6,1|u6iw3z,16,6,1|u6iw40,15,11,0|ue343z,15,11,0|ue3440,16,6,1|up8yrz,16,6,1|up8ys0,15,11,0|uwt6rz,15,11,0|uwt6s0,16,6,1|v7z1fz,16,6,1|v7z1g0,15,11,0|vfw83z,15,11,0|vfw840,16,6,1|vqp43z,16,6,1|vqp440,15,11,0|vymarz,15,11,0|vymas0,16,6,1|w9f6rz,16,6,1|w9f6s0,15,11,0|whcdfz,15,11,0|whcdg0,16,6,1|wsi83z,16,6,1|wsi840,15,11,0|x02g3z,15,11,0|x02g40,16,6,1|xb8arz,16,6,1|xb8as0,15,11,0|xisirz,15,11,0|xisis0,16,6,1|xtydfz,16,6,1|xtydg0,15,11,0|y1ilfz,15,11,0|y1ilg0,16,6,1|ycog3z,16,6,1|ycog40,15,11,0|yklmrz,15,11,0|yklms0,16,6,1|yveirz,16,6,1|yveis0,15,11,0|z3bpfz,15,11,0|z3bpg0,16,6,1|ze4lfz,16,6,1|ze4lg0,15,11,0\",\"Europe/Zurich|,0,338,0|-1os49kw,53,339,0|-13g441n,53,339,0|-13g441m,10,10,0|-eyh6o1,10,10,0|-eyh6o0,11,11,1|-eqk001,11,11,1|-eqk000,10,10,0|-efr401,10,10,0|-efr400,11,11,1|-e7txc1,11,11,1|-e7txc0,10,10,0|5v5xfz,10,10,0|5v5xg0,11,11,1|64iyrz,11,11,1|64iys0,10,10,0|6dw03z,10,10,0|6dw040,11,11,1|6n91fz,11,11,1|6n91g0,10,10,0|6wm2rz,10,10,0|6wm2s0,11,11,1|75z43z,11,11,1|75z440,10,10,0|7fc5fz,10,10,0|7fc5g0,11,11,1|7p25fz,11,11,1|7p25g0,10,10,0|7yf6rz,10,10,0|7yf6s0,11,11,1|87s83z,11,11,1|87s840,10,10,0|8h59fz,10,10,0|8h59g0,11,11,1|8qiarz,11,11,1|8qias0,10,10,0|8zvc3z,10,10,0|8zvc40,11,11,1|998dfz,11,11,1|998dg0,10,10,0|9ilerz,10,10,0|9iles0,11,11,1|9ryg3z,11,11,1|9ryg40,10,10,0|a1bhfz,10,10,0|a1bhg0,11,11,1|aaoirz,11,11,1|aaois0,10,10,0|ak1k3z,10,10,0|ak1k40,11,11,1|atrk3z,11,11,1|atrk40,10,10,0|b34lfz,10,10,0|b34lg0,11,11,1|bchmrz,11,11,1|bchms0,10,10,0|bluo3z,10,10,0|bluo40,11,11,1|bv7pfz,11,11,1|bv7pg0,10,10,0|c4kqrz,10,10,0|c4kqs0,11,11,1|cdxs3z,11,11,1|cdxs40,10,10,0|cnatfz,10,10,0|cnatg0,11,11,1|cwnurz,11,11,1|cwnus0,10,10,0|d60w3z,10,10,0|d60w40,11,11,1|dfdxfz,11,11,1|dfdxg0,10,10,0|dp3xfz,10,10,0|dp3xg0,11,11,1|dzwtfz,11,11,1|dzwtg0,10,10,0|e7u03z,10,10,0|e7u040,11,11,1|eimw3z,11,11,1|eimw40,10,10,0|eqk2rz,10,10,0|eqk2s0,11,11,1|f1cyrz,11,11,1|f1cys0,10,10,0|f9a5fz,10,10,0|f9a5g0,11,11,1|fkg03z,11,11,1|fkg040,10,10,0|fs083z,10,10,0|fs0840,11,11,1|g362rz,11,11,1|g362s0,10,10,0|gaqarz,10,10,0|gaqas0,11,11,1|glw5fz,11,11,1|glw5g0,10,10,0|gttc3z,10,10,0|gttc40,11,11,1|h4m83z,11,11,1|h4m840,10,10,0|hcjerz,10,10,0|hcjes0,11,11,1|hncarz,11,11,1|hncas0,10,10,0|hv9hfz,10,10,0|hv9hg0,11,11,1|i6fc3z,11,11,1|i6fc40,10,10,0|idzk3z,10,10,0|idzk40,11,11,1|ip5erz,11,11,1|ip5es0,10,10,0|iwpmrz,10,10,0|iwpms0,11,11,1|j7vhfz,11,11,1|j7vhg0,10,10,0|jffpfz,10,10,0|jffpg0,11,11,1|jqlk3z,11,11,1|jqlk40,10,10,0|jyiqrz,10,10,0|jyiqs0,11,11,1|k9bmrz,11,11,1|k9bms0,10,10,0|kh8tfz,10,10,0|kh8tg0,11,11,1|ks1pfz,11,11,1|ks1pg0,10,10,0|kzyw3z,10,10,0|kzyw40,11,11,1|lb4qrz,11,11,1|lb4qs0,10,10,0|lioyrz,10,10,0|lioys0,11,11,1|ltutfz,11,11,1|ltutg0,10,10,0|m1f1fz,10,10,0|m1f1g0,11,11,1|mckw3z,11,11,1|mckw40,10,10,0|mki2rz,10,10,0|mki2s0,11,11,1|mvayrz,11,11,1|mvays0,10,10,0|n385fz,10,10,0|n385g0,11,11,1|ne11fz,11,11,1|ne11g0,10,10,0|nly83z,10,10,0|nly840,11,11,1|nwr43z,11,11,1|nwr440,10,10,0|o4oarz,10,10,0|o4oas0,11,11,1|ofu5fz,11,11,1|ofu5g0,10,10,0|onedfz,10,10,0|onedg0,11,11,1|oyk83z,11,11,1|oyk840,10,10,0|p64g3z,10,10,0|p64g40,11,11,1|phaarz,11,11,1|phaas0,10,10,0|pp7hfz,10,10,0|pp7hg0,11,11,1|q00dfz,11,11,1|q00dg0,10,10,0|q7xk3z,10,10,0|q7xk40,11,11,1|qiqg3z,11,11,1|qiqg40,10,10,0|qqnmrz,10,10,0|qqnms0,11,11,1|r1thfz,11,11,1|r1thg0,10,10,0|r9dpfz,10,10,0|r9dpg0,11,11,1|rkjk3z,11,11,1|rkjk40,10,10,0|rs3s3z,10,10,0|rs3s40,11,11,1|s39mrz,11,11,1|s39ms0,10,10,0|sb6tfz,10,10,0|sb6tg0,11,11,1|slzpfz,11,11,1|slzpg0,10,10,0|stww3z,10,10,0|stww40,11,11,1|t4ps3z,11,11,1|t4ps40,10,10,0|tcmyrz,10,10,0|tcmys0,11,11,1|tnfurz,11,11,1|tnfus0,10,10,0|tvd1fz,10,10,0|tvd1g0,11,11,1|u6iw3z,11,11,1|u6iw40,10,10,0|ue343z,10,10,0|ue3440,11,11,1|up8yrz,11,11,1|up8ys0,10,10,0|uwt6rz,10,10,0|uwt6s0,11,11,1|v7z1fz,11,11,1|v7z1g0,10,10,0|vfw83z,10,10,0|vfw840,11,11,1|vqp43z,11,11,1|vqp440,10,10,0|vymarz,10,10,0|vymas0,11,11,1|w9f6rz,11,11,1|w9f6s0,10,10,0|whcdfz,10,10,0|whcdg0,11,11,1|wsi83z,11,11,1|wsi840,10,10,0|x02g3z,10,10,0|x02g40,11,11,1|xb8arz,11,11,1|xb8as0,10,10,0|xisirz,10,10,0|xisis0,11,11,1|xtydfz,11,11,1|xtydg0,10,10,0|y1ilfz,10,10,0|y1ilg0,11,11,1|ycog3z,11,11,1|ycog40,10,10,0|yklmrz,10,10,0|yklms0,11,11,1|yveirz,11,11,1|yveis0,10,10,0|z3bpfz,10,10,0|z3bpg0,11,11,1|ze4lfz,11,11,1|ze4lg0,10,10,0\",\"Indian/Antananarivo|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Indian/Chagos|,0,382,0|-wvpc2s,92,194,0|dkgsrz,92,194,0|dkgss0,96,196,0\",\"Indian/Christmas|,0,383,0|-133iwws,91,193,0\",\"Indian/Cocos|,0,384,0|-10j6sm4,109,229,0\",\"Indian/Comoro|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Indian/Kerguelen|,60,1,0|-afrs00,92,194,0\",\"Indian/Mahe|,0,385,0|-wvp8xo,105,209,0\",\"Indian/Maldives|,0,386,0|-1ayyga0,21,386,0|-57x6y1,21,386,0|-57x6y0,92,194,0\",\"Indian/Mauritius|,0,387,0|-wvp9bc,105,209,0|6nykvz,105,209,0|6nykw0,92,194,1|6wai3z,92,194,1|6wai40,105,209,0|k9befz,105,209,0|k9beg0,92,194,1|kh8ibz,92,194,1|kh8ic0,105,209,0\",\"Indian/Mayotte|,0,4,0|-w6p5hg,4,5,0|-lnsey1,4,5,0|-lnsey0,5,6,0|-kvcdo1,5,6,0|-kvcdo0,4,5,0|-h80ka1,4,5,0|-h80ka0,6,7,0|-eb6ib1,6,7,0|-eb6ib0,5,6,0\",\"Indian/Reunion|,0,388,0|-uks29s,105,209,0\",\"Pacific/Apia|,0,389,0|-14fxxj4,0,390,0|-usiiv5,0,390,0|-usiiv4,158,391,0|-afqw21,158,391,0|-afqw20,159,35,0|l9cp7z,159,35,0|l9cp80,160,36,1|lj12vz,160,36,1|lj12w0,159,35,0|ls15jz,159,35,0|ls15k0,160,36,1|lx0h3z,160,36,1|lx0h40,104,207,1|m1r5jz,104,207,1|m1r5k0,103,201,0|mb46vz,103,201,0|mb46w0,104,207,1|mku6vz,104,207,1|mku6w0,103,201,0|mtu9jz,103,201,0|mtu9k0,104,207,1|n3k9jz,104,207,1|n3k9k0,103,201,0|nckc7z,103,201,0|nckc80,104,207,1|nmac7z,104,207,1|nmac80,103,201,0|nvaevz,103,201,0|nvaew0,104,207,1|o50evz,104,207,1|o50ew0,103,201,0|oe0hjz,103,201,0|oe0hk0,104,207,1|onqhjz,104,207,1|onqhk0,103,201,0|owqk7z,103,201,0|owqk80,104,207,1|p6gk7z,104,207,1|p6gk80,103,201,0|pftljz,103,201,0|pftlk0,104,207,1|ppjljz,104,207,1|ppjlk0,103,201,0|pyjo7z,103,201,0|pyjo80,104,207,1|q89o7z,104,207,1|q89o80,103,201,0|qh9qvz,103,201,0|qh9qw0,104,207,1|qqzqvz,104,207,1|qqzqw0,103,201,0|qzztjz,103,201,0|qzztk0,104,207,1|r9ptjz,104,207,1|r9ptk0,103,201,0|ripw7z,103,201,0|ripw80,104,207,1|rsfw7z,104,207,1|rsfw80,103,201,0|s1fyvz,103,201,0|s1fyw0,104,207,1|sbixjz,104,207,1|sbixk0,103,201,0|skj07z,103,201,0|skj080,104,207,1|su907z,104,207,1|su9080,103,201,0|t392vz,103,201,0|t392w0,104,207,1|tcz2vz,104,207,1|tcz2w0,103,201,0|tlz5jz,103,201,0|tlz5k0,104,207,1|tvp5jz,104,207,1|tvp5k0,103,201,0|u4p87z,103,201,0|u4p880,104,207,1|uef87z,104,207,1|uef880,103,201,0|unfavz,103,201,0|unfaw0,104,207,1|ux5avz,104,207,1|ux5aw0,103,201,0|v6ic7z,103,201,0|v6ic80,104,207,1|vg8c7z,104,207,1|vg8c80,103,201,0|vp8evz,103,201,0|vp8ew0,104,207,1|vyyevz,104,207,1|vyyew0,103,201,0|w7yhjz,103,201,0|w7yhk0,104,207,1|whohjz,104,207,1|whohk0,103,201,0|wqok7z,103,201,0|wqok80,104,207,1|x0ek7z,104,207,1|x0ek80,103,201,0|x9emvz,103,201,0|x9emw0,104,207,1|xj4mvz,104,207,1|xj4mw0,103,201,0|xs4pjz,103,201,0|xs4pk0,104,207,1|y1upjz,104,207,1|y1upk0,103,201,0|yb7qvz,103,201,0|yb7qw0,104,207,1|ykxqvz,104,207,1|ykxqw0,103,201,0|ytxtjz,103,201,0|ytxtk0,104,207,1|z3ntjz,104,207,1|z3ntk0,103,201,0|zcnw7z,103,201,0|zcnw80,104,207,1\",\"Pacific/Auckland|,0,197,0|-1gsoz14,97,198,0|-m01p21,97,198,0|-m01p20,98,199,1|-ltxei1,98,199,1|-ltxei0,97,198,0|-lieie1,97,198,0|-lieie0,98,200,1|-lahd41,98,200,1|-lahd40,97,198,0|-kzofq1,97,198,0|-kzofq0,98,200,1|-krrag1,98,200,1|-krrag0,97,198,0|-kgyd21,97,198,0|-kgyd20,98,200,1|-k917s1,98,200,1|-k917s0,97,198,0|-jy8ae1,97,198,0|-jy8ae0,98,200,1|-jpy6g1,98,200,1|-jpy6g0,97,198,0|-jfi7q1,97,198,0|-jfi7q0,98,200,1|-j783s1,98,200,1|-j783s0,97,198,0|-iws521,97,198,0|-iws520,98,200,1|-imc941,98,200,1|-imc940,97,198,0|-ief121,97,198,0|-ief120,98,200,1|-i3m6g1,98,200,1|-i3m6g0,97,198,0|-hvoye1,97,198,0|-hvoye0,98,200,1|-hkw3s1,98,200,1|-hkw3s0,97,198,0|-hcyvq1,97,198,0|-hcyvq0,98,200,1|-h26141,98,200,1|-h26140,97,198,0|-gu8t21,97,198,0|-gu8t20,98,200,1|-gjfyg1,98,200,1|-gjfyg0,97,198,0|-gbiqe1,97,198,0|-gbiqe0,98,200,1|-g0cx41,98,200,1|-g0cx40,97,198,0|-fssnq1,97,198,0|-fssnq0,98,200,1|-fhmug1,98,200,1|-fhmug0,97,198,0|-f9pme1,97,198,0|-f9pme0,98,200,1|-ciy9c1,98,200,1|-ciy9c0,98,200,0|2ivg7z,98,200,0|2ivg80,99,201,1|2omuvz,99,201,1|2omuw0,98,200,0|318k7z,98,200,0|318k80,99,201,1|382uvz,99,201,1|382uw0,98,200,0|3kbljz,98,200,0|3kblk0,99,201,1|3qsxjz,99,201,1|3qsxk0,98,200,0|431o7z,98,200,0|431o80,99,201,1|49j07z,99,201,1|49j080,98,200,0|4lrqvz,98,200,0|4lrqw0,99,201,1|4s92vz,99,201,1|4s92w0,98,200,0|54htjz,98,200,0|54htk0,99,201,1|5az5jz,99,201,1|5az5k0,98,200,0|5n7w7z,98,200,0|5n7w80,99,201,1|5tp87z,99,201,1|5tp880,98,200,0|65xyvz,98,200,0|65xyw0,99,201,1|6cs9jz,99,201,1|6cs9k0,98,200,0|6p107z,98,200,0|6p1080,99,201,1|6vic7z,99,201,1|6vic80,98,200,0|77r2vz,98,200,0|77r2w0,99,201,1|7e8evz,99,201,1|7e8ew0,98,200,0|7qh5jz,98,200,0|7qh5k0,99,201,1|7wyhjz,99,201,1|7wyhk0,98,200,0|89787z,98,200,0|897880,99,201,1|8fok7z,99,201,1|8fok80,98,200,0|8rxavz,98,200,0|8rxaw0,99,201,1|8yemvz,99,201,1|8yemw0,98,200,0|9andjz,98,200,0|9andk0,99,201,1|9hho7z,99,201,1|9hho80,98,200,0|9tqevz,98,200,0|9tqew0,99,201,1|a07qvz,99,201,1|a07qw0,98,200,0|abdljz,98,200,0|abdlk0,99,201,1|ajnqvz,99,201,1|ajnqw0,98,200,0|au3o7z,98,200,0|au3o80,99,201,1|b2dtjz,99,201,1|b2dtk0,98,200,0|bctqvz,98,200,0|bctqw0,99,201,1|bl3w7z,99,201,1|bl3w80,98,200,0|bvjtjz,98,200,0|bvjtk0,99,201,1|c46xjz,99,201,1|c46xk0,98,200,0|ce9w7z,98,200,0|ce9w80,99,201,1|cmx07z,99,201,1|cmx080,98,200,0|cwzyvz,98,200,0|cwzyw0,99,201,1|d5n2vz,99,201,1|d5n2w0,98,200,0|dfq1jz,98,200,0|dfq1k0,99,201,1|dod5jz,99,201,1|dod5k0,98,200,0|dyt2vz,98,200,0|dyt2w0,99,201,1|e7387z,99,201,1|e73880,98,200,0|ehj5jz,98,200,0|ehj5k0,99,201,1|eptavz,99,201,1|eptaw0,98,200,0|f0987z,98,200,0|f09880,99,201,1|f8wc7z,99,201,1|f8wc80,98,200,0|fizavz,98,200,0|fizaw0,99,201,1|frmevz,99,201,1|frmew0,98,200,0|g1pdjz,98,200,0|g1pdk0,99,201,1|gachjz,99,201,1|gachk0,98,200,0|gksevz,98,200,0|gksew0,99,201,1|gt2k7z,99,201,1|gt2k80,98,200,0|h3ihjz,98,200,0|h3ihk0,99,201,1|hbsmvz,99,201,1|hbsmw0,98,200,0|hm8k7z,98,200,0|hm8k80,99,201,1|huvo7z,99,201,1|huvo80,98,200,0|i4ymvz,98,200,0|i4ymw0,99,201,1|idlqvz,99,201,1|idlqw0,98,200,0|inopjz,98,200,0|inopk0,99,201,1|iwbtjz,99,201,1|iwbtk0,98,200,0|j6es7z,98,200,0|j6es80,99,201,1|jf1w7z,99,201,1|jf1w80,98,200,0|jp4uvz,98,200,0|jp4uw0,99,201,1|jyuuvz,99,201,1|jyuuw0,98,200,0|k7uxjz,98,200,0|k7uxk0,99,201,1|khkxjz,99,201,1|khkxk0,98,200,0|kql07z,98,200,0|kql080,99,201,1|l0b07z,99,201,1|l0b080,98,200,0|l9b2vz,98,200,0|l9b2w0,99,201,1|lj12vz,99,201,1|lj12w0,98,200,0|ls15jz,98,200,0|ls15k0,99,201,1|m1r5jz,99,201,1|m1r5k0,98,200,0|mb46vz,98,200,0|mb46w0,99,201,1|mku6vz,99,201,1|mku6w0,98,200,0|mtu9jz,98,200,0|mtu9k0,99,201,1|n3k9jz,99,201,1|n3k9k0,98,200,0|nckc7z,98,200,0|nckc80,99,201,1|nmac7z,99,201,1|nmac80,98,200,0|nvaevz,98,200,0|nvaew0,99,201,1|o50evz,99,201,1|o50ew0,98,200,0|oe0hjz,98,200,0|oe0hk0,99,201,1|onqhjz,99,201,1|onqhk0,98,200,0|owqk7z,98,200,0|owqk80,99,201,1|p6gk7z,99,201,1|p6gk80,98,200,0|pftljz,98,200,0|pftlk0,99,201,1|ppjljz,99,201,1|ppjlk0,98,200,0|pyjo7z,98,200,0|pyjo80,99,201,1|q89o7z,99,201,1|q89o80,98,200,0|qh9qvz,98,200,0|qh9qw0,99,201,1|qqzqvz,99,201,1|qqzqw0,98,200,0|qzztjz,98,200,0|qzztk0,99,201,1|r9ptjz,99,201,1|r9ptk0,98,200,0|ripw7z,98,200,0|ripw80,99,201,1|rsfw7z,99,201,1|rsfw80,98,200,0|s1fyvz,98,200,0|s1fyw0,99,201,1|sbixjz,99,201,1|sbixk0,98,200,0|skj07z,98,200,0|skj080,99,201,1|su907z,99,201,1|su9080,98,200,0|t392vz,98,200,0|t392w0,99,201,1|tcz2vz,99,201,1|tcz2w0,98,200,0|tlz5jz,98,200,0|tlz5k0,99,201,1|tvp5jz,99,201,1|tvp5k0,98,200,0|u4p87z,98,200,0|u4p880,99,201,1|uef87z,99,201,1|uef880,98,200,0|unfavz,98,200,0|unfaw0,99,201,1|ux5avz,99,201,1|ux5aw0,98,200,0|v6ic7z,98,200,0|v6ic80,99,201,1|vg8c7z,99,201,1|vg8c80,98,200,0|vp8evz,98,200,0|vp8ew0,99,201,1|vyyevz,99,201,1|vyyew0,98,200,0|w7yhjz,98,200,0|w7yhk0,99,201,1|whohjz,99,201,1|whohk0,98,200,0|wqok7z,98,200,0|wqok80,99,201,1|x0ek7z,99,201,1|x0ek80,98,200,0|x9emvz,98,200,0|x9emw0,99,201,1|xj4mvz,99,201,1|xj4mw0,98,200,0|xs4pjz,98,200,0|xs4pk0,99,201,1|y1upjz,99,201,1|y1upk0,98,200,0|yb7qvz,98,200,0|yb7qw0,99,201,1|ykxqvz,99,201,1|ykxqw0,98,200,0|ytxtjz,98,200,0|ytxtk0,99,201,1|z3ntjz,99,201,1|z3ntk0,98,200,0|zcnw7z,98,200,0|zcnw80,99,201,1\",\"Pacific/Bougainville|,0,392,0|-1ayyvh4,161,393,0|-1354j8x,161,393,0|-1354j8w,93,195,0|-ecsh41,93,195,0|-ecsh40,107,224,0|-cpsbo1,107,224,0|-cpsbo0,93,195,0|nh90fz,93,195,0|nh90g0,90,192,0\",\"Pacific/Chatham|,0,394,0|-1gsp0n0,162,395,0|-ciya11,162,395,0|-ciya10,163,396,0|2ivg7z,163,396,0|2ivg80,164,397,1|2omuvz,164,397,1|2omuw0,163,396,0|318k7z,163,396,0|318k80,164,397,1|382uvz,164,397,1|382uw0,163,396,0|3kbljz,163,396,0|3kblk0,164,397,1|3qsxjz,164,397,1|3qsxk0,163,396,0|431o7z,163,396,0|431o80,164,397,1|49j07z,164,397,1|49j080,163,396,0|4lrqvz,163,396,0|4lrqw0,164,397,1|4s92vz,164,397,1|4s92w0,163,396,0|54htjz,163,396,0|54htk0,164,397,1|5az5jz,164,397,1|5az5k0,163,396,0|5n7w7z,163,396,0|5n7w80,164,397,1|5tp87z,164,397,1|5tp880,163,396,0|65xyvz,163,396,0|65xyw0,164,397,1|6cs9jz,164,397,1|6cs9k0,163,396,0|6p107z,163,396,0|6p1080,164,397,1|6vic7z,164,397,1|6vic80,163,396,0|77r2vz,163,396,0|77r2w0,164,397,1|7e8evz,164,397,1|7e8ew0,163,396,0|7qh5jz,163,396,0|7qh5k0,164,397,1|7wyhjz,164,397,1|7wyhk0,163,396,0|89787z,163,396,0|897880,164,397,1|8fok7z,164,397,1|8fok80,163,396,0|8rxavz,163,396,0|8rxaw0,164,397,1|8yemvz,164,397,1|8yemw0,163,396,0|9andjz,163,396,0|9andk0,164,397,1|9hho7z,164,397,1|9hho80,163,396,0|9tqevz,163,396,0|9tqew0,164,397,1|a07qvz,164,397,1|a07qw0,163,396,0|abdljz,163,396,0|abdlk0,164,397,1|ajnqvz,164,397,1|ajnqw0,163,396,0|au3o7z,163,396,0|au3o80,164,397,1|b2dtjz,164,397,1|b2dtk0,163,396,0|bctqvz,163,396,0|bctqw0,164,397,1|bl3w7z,164,397,1|bl3w80,163,396,0|bvjtjz,163,396,0|bvjtk0,164,397,1|c46xjz,164,397,1|c46xk0,163,396,0|ce9w7z,163,396,0|ce9w80,164,397,1|cmx07z,164,397,1|cmx080,163,396,0|cwzyvz,163,396,0|cwzyw0,164,397,1|d5n2vz,164,397,1|d5n2w0,163,396,0|dfq1jz,163,396,0|dfq1k0,164,397,1|dod5jz,164,397,1|dod5k0,163,396,0|dyt2vz,163,396,0|dyt2w0,164,397,1|e7387z,164,397,1|e73880,163,396,0|ehj5jz,163,396,0|ehj5k0,164,397,1|eptavz,164,397,1|eptaw0,163,396,0|f0987z,163,396,0|f09880,164,397,1|f8wc7z,164,397,1|f8wc80,163,396,0|fizavz,163,396,0|fizaw0,164,397,1|frmevz,164,397,1|frmew0,163,396,0|g1pdjz,163,396,0|g1pdk0,164,397,1|gachjz,164,397,1|gachk0,163,396,0|gksevz,163,396,0|gksew0,164,397,1|gt2k7z,164,397,1|gt2k80,163,396,0|h3ihjz,163,396,0|h3ihk0,164,397,1|hbsmvz,164,397,1|hbsmw0,163,396,0|hm8k7z,163,396,0|hm8k80,164,397,1|huvo7z,164,397,1|huvo80,163,396,0|i4ymvz,163,396,0|i4ymw0,164,397,1|idlqvz,164,397,1|idlqw0,163,396,0|inopjz,163,396,0|inopk0,164,397,1|iwbtjz,164,397,1|iwbtk0,163,396,0|j6es7z,163,396,0|j6es80,164,397,1|jf1w7z,164,397,1|jf1w80,163,396,0|jp4uvz,163,396,0|jp4uw0,164,397,1|jyuuvz,164,397,1|jyuuw0,163,396,0|k7uxjz,163,396,0|k7uxk0,164,397,1|khkxjz,164,397,1|khkxk0,163,396,0|kql07z,163,396,0|kql080,164,397,1|l0b07z,164,397,1|l0b080,163,396,0|l9b2vz,163,396,0|l9b2w0,164,397,1|lj12vz,164,397,1|lj12w0,163,396,0|ls15jz,163,396,0|ls15k0,164,397,1|m1r5jz,164,397,1|m1r5k0,163,396,0|mb46vz,163,396,0|mb46w0,164,397,1|mku6vz,164,397,1|mku6w0,163,396,0|mtu9jz,163,396,0|mtu9k0,164,397,1|n3k9jz,164,397,1|n3k9k0,163,396,0|nckc7z,163,396,0|nckc80,164,397,1|nmac7z,164,397,1|nmac80,163,396,0|nvaevz,163,396,0|nvaew0,164,397,1|o50evz,164,397,1|o50ew0,163,396,0|oe0hjz,163,396,0|oe0hk0,164,397,1|onqhjz,164,397,1|onqhk0,163,396,0|owqk7z,163,396,0|owqk80,164,397,1|p6gk7z,164,397,1|p6gk80,163,396,0|pftljz,163,396,0|pftlk0,164,397,1|ppjljz,164,397,1|ppjlk0,163,396,0|pyjo7z,163,396,0|pyjo80,164,397,1|q89o7z,164,397,1|q89o80,163,396,0|qh9qvz,163,396,0|qh9qw0,164,397,1|qqzqvz,164,397,1|qqzqw0,163,396,0|qzztjz,163,396,0|qzztk0,164,397,1|r9ptjz,164,397,1|r9ptk0,163,396,0|ripw7z,163,396,0|ripw80,164,397,1|rsfw7z,164,397,1|rsfw80,163,396,0|s1fyvz,163,396,0|s1fyw0,164,397,1|sbixjz,164,397,1|sbixk0,163,396,0|skj07z,163,396,0|skj080,164,397,1|su907z,164,397,1|su9080,163,396,0|t392vz,163,396,0|t392w0,164,397,1|tcz2vz,164,397,1|tcz2w0,163,396,0|tlz5jz,163,396,0|tlz5k0,164,397,1|tvp5jz,164,397,1|tvp5k0,163,396,0|u4p87z,163,396,0|u4p880,164,397,1|uef87z,164,397,1|uef880,163,396,0|unfavz,163,396,0|unfaw0,164,397,1|ux5avz,164,397,1|ux5aw0,163,396,0|v6ic7z,163,396,0|v6ic80,164,397,1|vg8c7z,164,397,1|vg8c80,163,396,0|vp8evz,163,396,0|vp8ew0,164,397,1|vyyevz,164,397,1|vyyew0,163,396,0|w7yhjz,163,396,0|w7yhk0,164,397,1|whohjz,164,397,1|whohk0,163,396,0|wqok7z,163,396,0|wqok80,164,397,1|x0ek7z,164,397,1|x0ek80,163,396,0|x9emvz,163,396,0|x9emw0,164,397,1|xj4mvz,164,397,1|xj4mw0,163,396,0|xs4pjz,163,396,0|xs4pk0,164,397,1|y1upjz,164,397,1|y1upk0,163,396,0|yb7qvz,163,396,0|yb7qw0,164,397,1|ykxqvz,164,397,1|ykxqw0,163,396,0|ytxtjz,163,396,0|ytxtk0,164,397,1|z3ntjz,164,397,1|z3ntk0,163,396,0|zcnw7z,163,396,0|zcnw80,164,397,1\",\"Pacific/Chuuk|,0,398,0|-1t8j2rw,0,399,0|-100f5fx,0,399,0|-100f5fw,93,195,0|-su4zs1,93,195,0|-su4zs0,107,224,0|-qknl01,107,224,0|-qknl00,93,195,0|-f08x41,93,195,0|-f08x40,107,224,0|-cqtd01,107,224,0|-cqtd00,93,195,0\",\"Pacific/Easter|,0,400,0|-15r0p2w,165,400,0|-jhfaex,165,400,0|-jhfaew,166,66,0|-lsvk1,166,66,0|-lsvk0,167,62,1|-e8qc1,167,62,1|-e8qc0,166,66,0|-1zww1,166,66,0|-1zww0,167,62,1|4hcbz,167,62,1|4hcc0,166,66,0|ekdrz,166,66,0|ekds0,167,62,1|mhhnz,167,62,1|mhho0,166,66,0|xagfz,166,66,0|xagg0,167,62,1|157kbz,167,62,1|157kc0,166,66,0|1gdhrz,166,66,0|1gdhs0,167,62,1|1nxmzz,167,62,1|1nxn00,166,66,0|1ydn3z,166,66,0|1ydn40,167,62,1|26npnz,167,62,1|26npo0,166,66,0|2htn3z,166,66,0|2htn40,167,62,1|2pdsbz,167,62,1|2pdsc0,166,66,0|30jprz,166,66,0|30jps0,167,62,1|38gtnz,167,62,1|38gto0,166,66,0|3j9sfz,166,66,0|3j9sg0,167,62,1|3r6wbz,167,62,1|3r6wc0,166,66,0|41zv3z,166,66,0|41zv40,167,62,1|49wyzz,167,62,1|49wz00,166,66,0|4l2wfz,166,66,0|4l2wg0,167,62,1|4sn1nz,167,62,1|4sn1o0,166,66,0|53sz3z,166,66,0|53sz40,167,62,1|5bd4bz,167,62,1|5bd4c0,166,66,0|5mj1rz,166,66,0|5mj1s0,167,62,1|5ug5nz,167,62,1|5ug5o0,166,66,0|6594fz,166,66,0|6594g0,167,62,1|6d68bz,167,62,1|6d68c0,167,62,0|6nz73z,167,62,0|6nz740,56,63,1|6vwazz,56,63,1|6vwb00,167,62,0|76p9rz,167,62,0|76p9s0,56,63,1|7emdnz,56,63,1|7emdo0,167,62,0|7psb3z,167,62,0|7psb40,56,63,1|7xcgbz,56,63,1|7xcgc0,167,62,0|88idrz,167,62,0|88ids0,56,63,1|8g2izz,56,63,1|8g2j00,167,62,0|8r8gfz,167,62,0|8r8gg0,56,63,1|90lezz,56,63,1|90lf00,167,62,0|99yj3z,167,62,0|99yj40,56,63,1|9hvmzz,56,63,1|9hvn00,167,62,0|9solrz,167,62,0|9sols0,56,63,1|a0lpnz,56,63,1|a0lpo0,167,62,0|abrn3z,167,62,0|abrn40,56,63,1|ajbsbz,56,63,1|ajbsc0,167,62,0|at1v3z,167,62,0|at1v40,56,63,1|b21uzz,56,63,1|b21v00,167,62,0|bd7sfz,167,62,0|bd7sg0,56,63,1|bl4wbz,56,63,1|bl4wc0,167,62,0|bvxv3z,167,62,0|bvxv40,56,63,1|c3uyzz,56,63,1|c3uz00,167,62,0|cenxrz,167,62,0|cenxs0,56,63,1|cml1nz,56,63,1|cml1o0,167,62,0|cxe0fz,167,62,0|cxe0g0,56,63,1|d5b4bz,56,63,1|d5b4c0,167,62,0|dgh1rz,167,62,0|dgh1s0,56,63,1|do16zz,56,63,1|do1700,167,62,0|dz74fz,167,62,0|dz74g0,56,63,1|e7u5nz,56,63,1|e7u5o0,167,62,0|ehx73z,167,62,0|ehx740,56,63,1|epuazz,56,63,1|epub00,167,62,0|ezxcfz,167,62,0|ezxcg0,56,63,1|f9n9nz,56,63,1|f9n9o0,167,62,0|fjdcfz,167,62,0|fjdcg0,56,63,1|fragbz,56,63,1|fragc0,167,62,0|g2gdrz,167,62,0|g2gds0,56,63,1|ga0izz,56,63,1|ga0j00,167,62,0|gl6gfz,167,62,0|gl6gg0,56,63,1|gsqlnz,56,63,1|gsqlo0,167,62,0|h3wj3z,167,62,0|h3wj40,56,63,1|hbgobz,56,63,1|hbgoc0,167,62,0|hmmlrz,167,62,0|hmmls0,56,63,1|hujpnz,56,63,1|hujpo0,167,62,0|i5cofz,167,62,0|i5cog0,56,63,1|id9sbz,56,63,1|id9sc0,167,62,0|io2r3z,167,62,0|io2r40,56,63,1|ivzuzz,56,63,1|ivzv00,167,62,0|j75sfz,167,62,0|j75sg0,56,63,1|jepxnz,56,63,1|jepxo0,167,62,0|jpvv3z,167,62,0|jpvv40,56,63,1|jyiwbz,56,63,1|jyiwc0,167,62,0|k8lxrz,167,62,0|k8lxs0,56,63,1|kgj1nz,56,63,1|kgj1o0,167,62,0|krc0fz,167,62,0|krc0g0,56,63,1|l0c0bz,56,63,1|l0c0c0,167,62,0|la233z,167,62,0|la2340,56,63,1|lkuwbz,56,63,1|lkuwc0,167,62,0|lq9f3z,167,62,0|lq9f40,56,63,1|m380bz,56,63,1|m380c0,167,62,0|m9pf3z,167,62,0|m9pf40,56,63,1|mly2zz,56,63,1|mly300,167,62,0|mssgfz,167,62,0|mssgg0,56,63,1|n4o5nz,56,63,1|n4o5o0,167,62,0|nbij3z,167,62,0|nbij40,56,63,1|o776zz,56,63,1|o77700,167,62,0|obvsfz,167,62,0|obvsg0,56,63,1|opx9nz,56,63,1|opx9o0,167,62,0|oulv3z,167,62,0|oulv40,56,63,1|p8ncbz,56,63,1|p8ncc0,167,62,0|pdbxrz,167,62,0|pdbxs0,56,63,1|ppklnz,56,63,1|ppklo0,167,62,0|pxhv3z,167,62,0|pxhv40,56,63,1|q8aobz,56,63,1|q8aoc0,167,62,0|qg7xrz,167,62,0|qg7xs0,56,63,1|qr0qzz,56,63,1|qr0r00,167,62,0|qyy0fz,167,62,0|qyy0g0,56,63,1|r9qtnz,56,63,1|r9qto0,167,62,0|rho33z,167,62,0|rho340,56,63,1|rsgwbz,56,63,1|rsgwc0,167,62,0|s0e5rz,167,62,0|s0e5s0,56,63,1|sbjxnz,56,63,1|sbjxo0,167,62,0|sjh73z,167,62,0|sjh740,56,63,1|sua0bz,56,63,1|sua0c0,167,62,0|t279rz,167,62,0|t279s0,56,63,1|td02zz,56,63,1|td0300,167,62,0|tkxcfz,167,62,0|tkxcg0,56,63,1|tvq5nz,56,63,1|tvq5o0,167,62,0|u3nf3z,167,62,0|u3nf40,56,63,1|ueg8bz,56,63,1|ueg8c0,167,62,0|umdhrz,167,62,0|umdhs0,56,63,1|uxj9nz,56,63,1|uxj9o0,167,62,0|v53kfz,167,62,0|v53kg0,56,63,1|vg9cbz,56,63,1|vg9cc0,167,62,0|vo6lrz,167,62,0|vo6ls0,56,63,1|vyzezz,56,63,1|vyzf00,167,62,0|w6wofz,167,62,0|w6wog0,56,63,1|whphnz,56,63,1|whpho0,167,62,0|wpmr3z,167,62,0|wpmr40,56,63,1|x0fkbz,56,63,1|x0fkc0,167,62,0|x8ctrz,167,62,0|x8cts0,56,63,1|xj5mzz,56,63,1|xj5n00,167,62,0|xr2wfz,167,62,0|xr2wg0,56,63,1|y28obz,56,63,1|y28oc0,167,62,0|y9sz3z,167,62,0|y9sz40,56,63,1|ykyqzz,56,63,1|ykyr00,167,62,0|ysw0fz,167,62,0|ysw0g0,56,63,1|z3otnz,56,63,1|z3oto0,167,62,0|zbm33z,167,62,0|zbm340,56,63,1\",\"Pacific/Efate|,0,401,0|-u964i4,90,192,0|22nynz,90,192,0|22nyo0,102,200,1|27pfzz,102,200,1|27pg00,90,192,0|75y6rz,90,192,0|75y6s0,102,200,1|7fb5bz,102,200,1|7fb5c0,90,192,0|7oo9fz,90,192,0|7oo9g0,102,200,1|7y17zz,102,200,1|7y1800,90,192,0|87rarz,90,192,0|87ras0,102,200,1|8granz,102,200,1|8grao0,90,192,0|8qhdfz,90,192,0|8qhdg0,102,200,1|8zubzz,102,200,1|8zuc00,90,192,0|997g3z,90,192,0|997g40,102,200,1|9ikenz,102,200,1|9ikeo0,90,192,0|9rxirz,90,192,0|9rxis0,102,200,1|a1ahbz,102,200,1|a1ahc0,90,192,0|aanlfz,90,192,0|aanlg0,102,200,1|ak0jzz,102,200,1|ak0k00,90,192,0|atdo3z,90,192,0|atdo40,102,200,1|b2qmnz,102,200,1|b2qmo0,90,192,0|bcgpfz,90,192,0|bcgpg0,102,200,1|bikzzz,102,200,1|bil000,90,192,0|bwmmrz,90,192,0|bwmms0,102,200,1|c1b2nz,102,200,1|c1b2o0,90,192,0\",\"Pacific/Enderbury|,0,402,0|-100dhng,168,403,0|535inz,168,403,0|535io0,159,35,0|d1o97z,159,35,0|d1o980,103,201,0\",\"Pacific/Fakaofo|,0,404,0|-100dhmg,159,35,0|lx0jvz,159,35,0|lx0jw0,103,201,0\",\"Pacific/Fiji|,0,405,0|-sa2x4w,102,200,0|f1p2vz,102,200,0|f1p2w0,103,201,1|f7tg7z,103,201,1|f7tg80,102,200,0|fks47z,102,200,0|fks480,103,201,1|fqjivz,103,201,1|fqjiw0,102,200,0|ktto7z,102,200,0|ktto80,103,201,1|kzy1jz,103,201,1|kzy1k0,102,200,0|laqxjz,102,200,0|laqxk0,103,201,1|lhl87z,103,201,1|lhl880,102,200,0|lth07z,102,200,0|lth080,103,201,1|ly5ivz,103,201,1|ly5iw0,102,200,0|mc72vz,102,200,0|mc72w0,103,201,1|mgvljz,103,201,1|mgvlk0,102,200,0|mva47z,102,200,0|mva480,103,201,1|mzllfz,103,201,1|mzllg0,102,200,0|ned5jz,102,200,0|ned5k0,103,201,1|nibqvz,103,201,1|nibqw0,102,200,0|nx387z,102,200,0|nx3880,103,201,1|o11tjz,103,201,1|o11tk0,102,200,0|og69jz,102,200,0|og69k0,103,201,1|ojrw7z,103,201,1|ojrw80,102,200,0|oywc7z,102,200,0|oywc80,103,201,1|p2hyvz,103,201,1|p2hyw0,102,200,0|phmevz,102,200,0|phmew0,103,201,1|pl81jz,103,201,1|pl81k0,102,200,0|q0pg7z,102,200,0|q0pg80,103,201,1|q3y47z,103,201,1|q3y480,102,200,0|qllavz,102,200,0|qllaw0,103,201,1|qn15jz,103,201,1|qn15k0,102,200,0|r2ik7z,102,200,0|r2ik80,103,201,1|r5r87z,103,201,1|r5r880,102,200,0|rl8mvz,102,200,0|rl8mw0,103,201,1|rohavz,103,201,1|rohaw0,102,200,0|s3ypjz,102,200,0|s3ypk0,103,201,1|s77djz,103,201,1|s77dk0,102,200,0|smos7z,102,200,0|smos80,103,201,1|spxg7z,103,201,1|spxg80,102,200,0|t5euvz,102,200,0|t5euw0,103,201,1|t90hjz,103,201,1|t90hk0,102,200,0|to4xjz,102,200,0|to4xk0,103,201,1|trqk7z,103,201,1|trqk80,102,200,0|u77yvz,102,200,0|u77yw0,103,201,1|uagmvz,103,201,1|uagmw0,102,200,0|upy1jz,102,200,0|upy1k0,103,201,1|ut6pjz,103,201,1|ut6pk0,102,200,0|v8o47z,102,200,0|v8o480,103,201,1|vbws7z,103,201,1|vbws80,102,200,0|vre6vz,102,200,0|vre6w0,103,201,1|vumuvz,103,201,1|vumuw0,102,200,0|wa49jz,102,200,0|wa49k0,103,201,1|wdpw7z,103,201,1|wdpw80,102,200,0|wt7avz,102,200,0|wt7aw0,103,201,1|wwfyvz,103,201,1|wwfyw0,102,200,0|xbxdjz,102,200,0|xbxdk0,103,201,1|xf61jz,103,201,1|xf61k0,102,200,0|xung7z,102,200,0|xung80,103,201,1|xxw47z,103,201,1|xxw480,102,200,0|yddivz,102,200,0|yddiw0,103,201,1|ygm6vz,103,201,1|ygm6w0,102,200,0|yw3ljz,102,200,0|yw3lk0,103,201,1|yzp87z,103,201,1|yzp880,102,200,0|zeto7z,102,200,0|zeto80,103,201,1\",\"Pacific/Funafuti|,0,406,0|-100fais,102,200,0\",\"Pacific/Galapagos|,0,407,0|-kcr62o,56,63,0|8cmlvz,56,63,0|8cmlw0,167,62,0|byewnz,167,62,0|byewo0,56,63,1|c1ylvz,56,63,1|c1ylw0,167,62,0\",\"Pacific/Gambier|,0,408,0|-tvndoc,169,37,0\",\"Pacific/Guadalcanal|,0,409,0|-tvowac,90,192,0\",\"Pacific/Guam|,0,410,0|-1t8j1h0,0,411,0|-100f451,0,411,0|-100f450,170,195,0|-en8eg1,170,195,0|-en8eg0,107,224,0|-d9n501,107,224,0|-d9n500,170,195,0|-5hlkw1,170,195,0|-5hlkw0,171,192,1|-4nnvo1,171,192,1|-4nnvo0,170,195,0|-17w8w1,170,195,0|-17w8w0,171,192,1|-hih6d,171,192,1|-hih6c,170,195,0|-9y0w1,170,195,0|-9y0w0,171,192,1|-6ch01,171,192,1|-6ch00,170,195,0|5wcfz,170,195,0|5wcg0,171,192,1|cqkbz,171,192,1|cqkc0,170,195,0|omf3z,170,195,0|omf40,171,192,1|vgmzz,171,192,1|vgn00,170,195,0|22bb3z,170,195,0|22bb40,171,192,1|25wuzz,171,192,1|25wv00,170,195,0|3c75rz,170,195,0|3c75s0,171,192,1|3gq1pn,171,192,1|3gq1po,170,195,0|3tbtrz,170,195,0|3tbts0,171,192,1|3zt2zz,171,192,1|3zt300,170,195,0|g5z2vz,170,195,0|g5z2w0,172,195,0\",\"Pacific/Honolulu|,0,412,0|-12lnw3m,30,413,0|-j50la1,30,413,0|-j50la0,31,414,1|-j3x0a1,31,414,1|-j3x0a0,30,413,0|-ek1pa1,30,413,0|-ek1pa0,173,414,1|-cq2tg1,173,414,1|-cq2tg0,174,414,1|-cnoo21,174,414,1|-cnoo20,30,413,0|-brzum1,30,413,0|-brzum0,30,36,0\",\"Pacific/Kiritimati|,0,415,0|-100dk74,175,416,0|535eyn,175,416,0|535eyo,160,36,0|d1o6fz,160,36,0|d1o6g0,104,207,0\",\"Pacific/Kosrae|,0,417,0|-1t8j4uk,0,418,0|-100f7il,0,418,0|-100f7ik,90,192,0|-su52k1,90,192,0|-su52k0,107,224,0|-qknl01,107,224,0|-qknl00,90,192,0|-h817w1,90,192,0|-h817w0,93,195,0|-f08x41,93,195,0|-f08x40,107,224,0|-cqtd01,107,224,0|-cqtd00,90,192,0|-4r7w1,90,192,0|-4r7w0,102,200,0|f4tvzz,102,200,0|f4tw00,90,192,0\",\"Pacific/Kwajalein|,0,419,0|-100f8bk,90,192,0|-h817w1,90,192,0|-h817w0,93,195,0|-f08x41,93,195,0|-f08x40,107,224,0|-dip2c1,107,224,0|-dip2c0,90,192,0|-4r7w1,90,192,0|-4r7w0,168,403,0|cc3ynz,168,403,0|cc3yo0,102,200,0\",\"Pacific/Majuro|,0,420,0|-100f91c,90,192,0|-su52k1,90,192,0|-su52k0,107,224,0|-qknl01,107,224,0|-qknl00,90,192,0|-h817w1,90,192,0|-h817w0,93,195,0|-f08x41,93,195,0|-f08x40,107,224,0|-dj2101,107,224,0|-dj2100,90,192,0|-4r7w1,90,192,0|-4r7w0,102,200,0\",\"Pacific/Marquesas|,0,421,0|-tvncu0,176,414,0\",\"Pacific/Midway|,0,422,0|-14fxxq0,0,423,0|-usij21,0,423,0|-usij20,177,35,0\",\"Pacific/Nauru|,0,424,0|-pjxiws,143,198,0|-e9rby1,143,198,0|-e9rby0,107,224,0|-couzo1,107,224,0|-couzo0,143,198,0|4r4dlz,143,198,0|4r4dm0,102,200,0\",\"Pacific/Niue|,0,425,0|-100dhv8,178,426,0|-9wyz6p,178,426,0|-9wyz6o,158,391,0|4kdjxz,158,391,0|4kdjy0,159,35,0\",\"Pacific/Norfolk|,0,427,0|-100f8fs,179,428,0|-9x0ps1,179,428,0|-9x0ps0,143,198,0|2iiixz,143,198,0|2iiiy0,180,199,1|2ozuxz,180,199,1|2ozuy0,143,198,0|nvnexz,143,198,0|nvney0,90,192,0|pywpnz,90,192,0|pywpo0,102,200,1|q89qzz,102,200,1|q89r00,90,192,0|qhmsbz,90,192,0|qhmsc0,102,200,1|qqztnz,102,200,1|qqzto0,90,192,0|r0cuzz,90,192,0|r0cv00,102,200,1|r9pwbz,102,200,1|r9pwc0,90,192,0|rj2xnz,90,192,0|rj2xo0,102,200,1|rsfyzz,102,200,1|rsfz00,90,192,0|s1t0bz,90,192,0|s1t0c0,102,200,1|sbj0bz,102,200,1|sbj0c0,90,192,0|skw1nz,90,192,0|skw1o0,102,200,1|su92zz,102,200,1|su9300,90,192,0|t3m4bz,90,192,0|t3m4c0,102,200,1|tcz5nz,102,200,1|tcz5o0,90,192,0|tmc6zz,90,192,0|tmc700,102,200,1|tvp8bz,102,200,1|tvp8c0,90,192,0|u529nz,90,192,0|u529o0,102,200,1|uefazz,102,200,1|uefb00,90,192,0|unscbz,90,192,0|unscc0,102,200,1|ux5dnz,102,200,1|ux5do0,90,192,0|v6vdnz,90,192,0|v6vdo0,102,200,1|vg8ezz,102,200,1|vg8f00,90,192,0|vplgbz,90,192,0|vplgc0,102,200,1|vyyhnz,102,200,1|vyyho0,90,192,0|w8bizz,90,192,0|w8bj00,102,200,1|whokbz,102,200,1|whokc0,90,192,0|wr1lnz,90,192,0|wr1lo0,102,200,1|x0emzz,102,200,1|x0en00,90,192,0|x9robz,90,192,0|x9roc0,102,200,1|xj4pnz,102,200,1|xj4po0,90,192,0|xshqzz,90,192,0|xshr00,102,200,1|y1usbz,102,200,1|y1usc0,90,192,0|ybksbz,90,192,0|ybksc0,102,200,1|ykxtnz,102,200,1|ykxto0,90,192,0|yuauzz,90,192,0|yuav00,102,200,1|z3nwbz,102,200,1|z3nwc0,90,192,0|zd0xnz,90,192,0|zd0xo0,102,200,1\",\"Pacific/Noumea|,0,429,0|-u9645o,90,192,0|44uerz,90,192,0|44ues0,102,200,1|497qnz,102,200,1|497qo0,90,192,0|4nkhfz,90,192,0|4nkhg0,102,200,1|4rznzz,102,200,1|4rzo00,90,192,0|e1ouzz,90,192,0|e1ov00,102,200,1|e6ddnz,102,200,1|e6ddo0,90,192,0\",\"Pacific/Pago_Pago|,0,422,0|-14fxxq0,0,423,0|-usij21,0,423,0|-usij20,177,35,0\",\"Pacific/Palau|,0,430,0|-1t8izkk,0,431,0|-100f28l,0,431,0|-100f28k,107,224,0\",\"Pacific/Pitcairn|,0,432,0|-100dp8s,181,433,0|es2cxz,181,433,0|es2cy0,182,40,0\",\"Pacific/Pohnpei|,0,434,0|-1t8j3ys,0,435,0|-100f6mt,0,435,0|-100f6ms,90,192,0|-su52k1,90,192,0|-su52k0,107,224,0|-qknl01,107,224,0|-qknl00,90,192,0|-h817w1,90,192,0|-h817w0,93,195,0|-f08x41,93,195,0|-f08x40,107,224,0|-cqtd01,107,224,0|-cqtd00,90,192,0\",\"Pacific/Port_Moresby|,0,436,0|-1ayytx4,161,393,0|-1354j8x,161,393,0|-1354j8w,93,195,0\",\"Pacific/Rarotonga|,0,437,0|-100djqw,183,413,0|4mj95z,183,413,0|4mj960,176,414,1|4sal1z,176,414,1|4sal20,160,36,0|54jd3z,160,36,0|54jd40,176,414,1|5b0npz,176,414,1|5b0nq0,160,36,0|5n9frz,160,36,0|5n9fs0,176,414,1|5tqqdz,176,414,1|5tqqe0,160,36,0|65zifz,160,36,0|65zig0,176,414,1|6ctrpz,176,414,1|6ctrq0,160,36,0|6p2jrz,160,36,0|6p2js0,176,414,1|6vjudz,176,414,1|6vjue0,160,36,0|77smfz,160,36,0|77smg0,176,414,1|7e9x1z,176,414,1|7e9x20,160,36,0|7qip3z,160,36,0|7qip40,176,414,1|7wzzpz,176,414,1|7wzzq0,160,36,0|898rrz,160,36,0|898rs0,176,414,1|8fq2dz,176,414,1|8fq2e0,160,36,0|8ryufz,160,36,0|8ryug0,176,414,1|8yg51z,176,414,1|8yg520,160,36,0|9aox3z,160,36,0|9aox40,176,414,1|9hj6dz,176,414,1|9hj6e0,160,36,0|9tryfz,160,36,0|9tryg0,176,414,1|a0991z,176,414,1|a09920,160,36,0|aci13z,160,36,0|aci140,176,414,1|aizbpz,176,414,1|aizbq0,160,36,0|av83rz,160,36,0|av83s0,176,414,1|b1pedz,176,414,1|b1pee0,160,36,0\",\"Pacific/Saipan|,0,410,0|-1t8j1h0,0,411,0|-100f451,0,411,0|-100f450,170,195,0|-en8eg1,170,195,0|-en8eg0,107,224,0|-d9n501,107,224,0|-d9n500,170,195,0|-5hlkw1,170,195,0|-5hlkw0,171,192,1|-4nnvo1,171,192,1|-4nnvo0,170,195,0|-17w8w1,170,195,0|-17w8w0,171,192,1|-hih6d,171,192,1|-hih6c,170,195,0|-9y0w1,170,195,0|-9y0w0,171,192,1|-6ch01,171,192,1|-6ch00,170,195,0|5wcfz,170,195,0|5wcg0,171,192,1|cqkbz,171,192,1|cqkc0,170,195,0|omf3z,170,195,0|omf40,171,192,1|vgmzz,171,192,1|vgn00,170,195,0|22bb3z,170,195,0|22bb40,171,192,1|25wuzz,171,192,1|25wv00,170,195,0|3c75rz,170,195,0|3c75s0,171,192,1|3gq1pn,171,192,1|3gq1po,170,195,0|3tbtrz,170,195,0|3tbts0,171,192,1|3zt2zz,171,192,1|3zt300,170,195,0|g5z2vz,170,195,0|g5z2w0,172,195,0\",\"Pacific/Tahiti|,0,438,0|-tvnayw,160,36,0\",\"Pacific/Tarawa|,0,439,0|-100f9dg,102,200,0\",\"Pacific/Tongatapu|,0,440,0|-100fbk8,184,441,0|-f4vrld,184,441,0|-f4vrlc,103,201,0|fj6mrz,103,201,0|fj6ms0,104,207,1|frmc3z,104,207,1|frmc40,103,201,0|g3i43z,103,201,0|g3i440,104,207,1|g7tlbz,104,207,1|g7tlc0,103,201,0|gm86rz,103,201,0|gm86s0,104,207,1|gqjnzz,104,207,1|gqjo00,103,201,0|og66rz,103,201,0|og66s0,104,207,1|ojrtfz,104,207,1|ojrtg0,103,201,0\",\"Pacific/Wake|,0,442,0|-100f86s,102,200,0\",\"Pacific/Wallis|,0,443,0|-100fbdk,102,200,0\"],\"abbrvs\":\"LMT|GMT|+0020|+0030|+0230|EAT|+0245|PMT|WET|WEST|CET|CEST|WAT|-01|CAT|EET|EEST|+00|+01|SAST|CAST|MMT|WAST|+0130|NST|NWT|NPT|BST|BDT|AHST|HST|HDT|AST|AWT|APT|AHDT|YST|AKST|AKDT|-03|-02|CMT|-04|-0430|AMT|CST|CDT|CWT|CPT|EST|MST|PST|MDT|BMT|ADT|-0530|-05|PDT|MWT|MPT|-00|MDDT|EDT|SJMT|YDT|YWT|YPT|YDDT|PWT|PPT|EWT|EPT|NDT|ADDT|KMT|QMT|-0345|HMT|PDDT|EDDT|FFMT|-0330|-0230|-0130|PPMT|SMT|CDDT|SDMT|NDDT|+08|+11|+07|+05|+10|AEST|AEDT|+06|NZMT|NZST|NZDT|+03|+02|+12|+13|+14|+04|+0730|+09|+0530|+0630|IST|IDT|PLMT|HKT|HKST|HKWT|JST|IMT|+0720|WIB|+0930|WIT|JMT|IDDT|+0430|PKT|PKST|+0545|+0820|WITA|KST|KDT|TBMT|TMT|+0330|JDT|RMT|FMT|ACST|ACDT|+0845|+0945|+1030|+1130|AWST|AWDT|+0120|CEMT|MSK|MSD|DMT|BDST|WEMT|MDST|LST|SET|WMT|+0220|-1130|-11|-10|PMMT|+1215|+1245|+1345|EMT|-07|-06|-12|-09|GST|GDT|ChST|HWT|HPT|-1040|-0930|SST|-1120|+1112|+1230|-0830|-08|-1030|+1220|GMT+14|GMT+13|GMT+12|GMT+11|GMT+10|GMT+9|GMT+8|GMT+7|GMT+6|GMT+5|GMT+4|GMT+3|GMT+2|GMT+1|GMT-1|GMT-2|GMT-3|GMT-4|GMT-5|GMT-6|GMT-7|GMT-8|GMT-9|GMT-10|GMT-11|GMT-12\",\"offsets\":\"-1g|0|xc|1e0|6tg|6y0|8c0|7n0|kc|fl|2s0|5k0|-qw|mn|-2vw|-2s0|618|5sl|-1ek|-zg|-2g0|56o|460|5us|60w|-1zw|-226|2sc|18w|-1p9|2fw|1vw|360|xya|-wpq|-uk0|-rs0|-p00|12wo|-rrc|-m80|-be4|-b40|-8xc|-8c0|-5k0|-ato|-bw0|-c6k|-c3c|-cdo|-cqs|-ctg|-c44|-cos|-cac|-c2s|-cnc|-crn|-ci0|-aog|-gys|-go0|-dw0|-74s|-jho|-jg0|-b1h|-8z8|-gc0|-fa0|-aks|-b8g|-dps|-lip|-a44|-g2g|-ce8|-ce4|-9ow|-eq8|-eso|-g8c|-jn8|-fkd|-lks|-adw|-3gg|-ptg|-m9k|-jfw|-fdn|-l0g|-cxs|-gio|-mpz|-74o|-b3o|-b6s|-9rg|-6zg|-9q0|-6y0|-d68|-e7y|-grg|-es8|-ejc|-ars|-af0|-bs0|-f94|-f9c|-kjs|-fye|-g1i|-fzn|-g5v|-g2f|-fr4|-g7j|-g1d|15rv|-ow5|-fvq|-fpo|-cmc|-9uc|-e9o|-eac|-lwa|-6m4|-fz8|-fzc|-b44|-bb8|-iio|-jpg|-g83|-glg|16au|-od6|-id0|-aeg|-bzw|-iks|-aer|-460|-ebu|-dpe|-gcg|101a|-umq|-604|-iuj|-irc|-is3|-9kw|-jc4|-a7s|-a84|-a7o|-kr6|-de8|-ddo|-bu0|-c8p|-d4s|-d3a|-hig|-6go|-jdo|-ck0|-a4o|-cy0|-cyo|-8ms|-42g|15lz|-p21|-jyw|-g5g|-cqk|-gj0|-lo4|-ep8|-mss|-p0c|-hzo|14sh|-pvj|m80|uk0|jg0|dw0|rs0|go0|wd4|vy0|yq0|xc0|1040|1zo|8ng|e90|6nk|wv8|12w0|9b4|b40|al4|at8|9m8|884|880|9jk|98c|im4|fic|6ko|dtc|la4|ku0|l0g|p00|l7c|esc|esk|fa0|i20|6q0|gqs|gcw|n98|a8o|cqo|6ac|6ds|6hz|jr4|jqu|l56|nm0|gz0|jb5|js0|kdc|q20|qe0|6iu|6ig|ctc|ci0|tdo|cf0|fss|fz0|p3p|gd4|eva|h72|ity|j8d|kfk|n5c|l0y|rxc|m40|-189c|meo|66g|g5c|fcs|dl6|9ic|k8w|nac|bs4|c4g|qfc|ceh|nig|mhj|sgs|mi0|ctz|8an|9iw|9q0|glo|pvn|fqf|jsk|g7w|qiu|of7|o0y|htb|b89|af5|88o|-4r4|-5aw|-c06|-986|-2uo|-4cs|-194|-34o|-42o|-6rk|-apo|pnw|t60|sc8|q70|ra4|o88|nv4|ob0|r30|rl8|tgk|qug|lgc|s04|wk|3ok|3pc|a4|8wc|4e4|3so|2h4|2o8|t6|4u0|3j8|1kw|1dm|5c8|5bo|2bw|-15o|-169|1lr|-zo|-23|4md|5d4|5ew|5ng|97c|150|-ok|2os|53s|53c|1d8|6yh|707|9s7|ck7|4gy|78y|2b8|99w|8j6|6bc|6ao|4bg|3cc|2se|4l0|3o8|8yo|44o|30x|4os|3w0|4fc|6hc|des|jks|hy4|a9o|dm0|anc|a9s|yv4|-vsw|-vy0|st4|r8w|xz0|y10|zf0|1270|-12k4|s3w|-k94|v64|-vok|-xc0|-vpk|x4w|x6s|-glc|-ozo|tmc|-13v0|qt0|-t8e|-t60|-qe0|-t4w|-tmo|-10hg|u6k|uzk|vpc|-pu0|z20|-vm0|uws|-vgs|-vhc|v3s|v40|uto|-15rg|owk|-o38|-nm0|-11d8|tas|r94|-tl4|-rp4|w1g|y88|y9c|uus|y1k\"}) \n}","// This file is autogenerated via the `commonjs` Grunt task. You can require() this file in a CommonJS environment.\nrequire('../../js/transition.js')\nrequire('../../js/alert.js')\nrequire('../../js/button.js')\nrequire('../../js/carousel.js')\nrequire('../../js/collapse.js')\nrequire('../../js/dropdown.js')\nrequire('../../js/modal.js')\nrequire('../../js/tooltip.js')\nrequire('../../js/popover.js')\nrequire('../../js/scrollspy.js')\nrequire('../../js/tab.js')\nrequire('../../js/affix.js')","/* ========================================================================\n * Bootstrap: transition.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#transitions\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/)\n // ============================================================\n\n function transitionEnd() {\n var el = document.createElement('bootstrap')\n\n var transEndEventNames = {\n WebkitTransition : 'webkitTransitionEnd',\n MozTransition : 'transitionend',\n OTransition : 'oTransitionEnd otransitionend',\n transition : 'transitionend'\n }\n\n for (var name in transEndEventNames) {\n if (el.style[name] !== undefined) {\n return { end: transEndEventNames[name] }\n }\n }\n\n return false // explicit for ie8 ( ._.)\n }\n\n // https://blog.alexmaccaw.com/css-transitions\n $.fn.emulateTransitionEnd = function (duration) {\n var called = false\n var $el = this\n $(this).one('bsTransitionEnd', function () { called = true })\n var callback = function () { if (!called) $($el).trigger($.support.transition.end) }\n setTimeout(callback, duration)\n return this\n }\n\n $(function () {\n $.support.transition = transitionEnd()\n\n if (!$.support.transition) return\n\n $.event.special.bsTransitionEnd = {\n bindType: $.support.transition.end,\n delegateType: $.support.transition.end,\n handle: function (e) {\n if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments)\n }\n }\n })\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: alert.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#alerts\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // ALERT CLASS DEFINITION\n // ======================\n\n var dismiss = '[data-dismiss=\"alert\"]'\n var Alert = function (el) {\n $(el).on('click', dismiss, this.close)\n }\n\n Alert.VERSION = '3.4.1'\n\n Alert.TRANSITION_DURATION = 150\n\n Alert.prototype.close = function (e) {\n var $this = $(this)\n var selector = $this.attr('data-target')\n\n if (!selector) {\n selector = $this.attr('href')\n selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n }\n\n selector = selector === '#' ? [] : selector\n var $parent = $(document).find(selector)\n\n if (e) e.preventDefault()\n\n if (!$parent.length) {\n $parent = $this.closest('.alert')\n }\n\n $parent.trigger(e = $.Event('close.bs.alert'))\n\n if (e.isDefaultPrevented()) return\n\n $parent.removeClass('in')\n\n function removeElement() {\n // detach from parent, fire event then clean up data\n $parent.detach().trigger('closed.bs.alert').remove()\n }\n\n $.support.transition && $parent.hasClass('fade') ?\n $parent\n .one('bsTransitionEnd', removeElement)\n .emulateTransitionEnd(Alert.TRANSITION_DURATION) :\n removeElement()\n }\n\n\n // ALERT PLUGIN DEFINITION\n // =======================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.alert')\n\n if (!data) $this.data('bs.alert', (data = new Alert(this)))\n if (typeof option == 'string') data[option].call($this)\n })\n }\n\n var old = $.fn.alert\n\n $.fn.alert = Plugin\n $.fn.alert.Constructor = Alert\n\n\n // ALERT NO CONFLICT\n // =================\n\n $.fn.alert.noConflict = function () {\n $.fn.alert = old\n return this\n }\n\n\n // ALERT DATA-API\n // ==============\n\n $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close)\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: button.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#buttons\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // BUTTON PUBLIC CLASS DEFINITION\n // ==============================\n\n var Button = function (element, options) {\n this.$element = $(element)\n this.options = $.extend({}, Button.DEFAULTS, options)\n this.isLoading = false\n }\n\n Button.VERSION = '3.4.1'\n\n Button.DEFAULTS = {\n loadingText: 'loading...'\n }\n\n Button.prototype.setState = function (state) {\n var d = 'disabled'\n var $el = this.$element\n var val = $el.is('input') ? 'val' : 'html'\n var data = $el.data()\n\n state += 'Text'\n\n if (data.resetText == null) $el.data('resetText', $el[val]())\n\n // push to event loop to allow forms to submit\n setTimeout($.proxy(function () {\n $el[val](data[state] == null ? this.options[state] : data[state])\n\n if (state == 'loadingText') {\n this.isLoading = true\n $el.addClass(d).attr(d, d).prop(d, true)\n } else if (this.isLoading) {\n this.isLoading = false\n $el.removeClass(d).removeAttr(d).prop(d, false)\n }\n }, this), 0)\n }\n\n Button.prototype.toggle = function () {\n var changed = true\n var $parent = this.$element.closest('[data-toggle=\"buttons\"]')\n\n if ($parent.length) {\n var $input = this.$element.find('input')\n if ($input.prop('type') == 'radio') {\n if ($input.prop('checked')) changed = false\n $parent.find('.active').removeClass('active')\n this.$element.addClass('active')\n } else if ($input.prop('type') == 'checkbox') {\n if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false\n this.$element.toggleClass('active')\n }\n $input.prop('checked', this.$element.hasClass('active'))\n if (changed) $input.trigger('change')\n } else {\n this.$element.attr('aria-pressed', !this.$element.hasClass('active'))\n this.$element.toggleClass('active')\n }\n }\n\n\n // BUTTON PLUGIN DEFINITION\n // ========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.button')\n var options = typeof option == 'object' && option\n\n if (!data) $this.data('bs.button', (data = new Button(this, options)))\n\n if (option == 'toggle') data.toggle()\n else if (option) data.setState(option)\n })\n }\n\n var old = $.fn.button\n\n $.fn.button = Plugin\n $.fn.button.Constructor = Button\n\n\n // BUTTON NO CONFLICT\n // ==================\n\n $.fn.button.noConflict = function () {\n $.fn.button = old\n return this\n }\n\n\n // BUTTON DATA-API\n // ===============\n\n $(document)\n .on('click.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n var $btn = $(e.target).closest('.btn')\n Plugin.call($btn, 'toggle')\n if (!($(e.target).is('input[type=\"radio\"], input[type=\"checkbox\"]'))) {\n // Prevent double click on radios, and the double selections (so cancellation) on checkboxes\n e.preventDefault()\n // The target component still receive the focus\n if ($btn.is('input,button')) $btn.trigger('focus')\n else $btn.find('input:visible,button:visible').first().trigger('focus')\n }\n })\n .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^=\"button\"]', function (e) {\n $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type))\n })\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: carousel.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#carousel\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // CAROUSEL CLASS DEFINITION\n // =========================\n\n var Carousel = function (element, options) {\n this.$element = $(element)\n this.$indicators = this.$element.find('.carousel-indicators')\n this.options = options\n this.paused = null\n this.sliding = null\n this.interval = null\n this.$active = null\n this.$items = null\n\n this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this))\n\n this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element\n .on('mouseenter.bs.carousel', $.proxy(this.pause, this))\n .on('mouseleave.bs.carousel', $.proxy(this.cycle, this))\n }\n\n Carousel.VERSION = '3.4.1'\n\n Carousel.TRANSITION_DURATION = 600\n\n Carousel.DEFAULTS = {\n interval: 5000,\n pause: 'hover',\n wrap: true,\n keyboard: true\n }\n\n Carousel.prototype.keydown = function (e) {\n if (/input|textarea/i.test(e.target.tagName)) return\n switch (e.which) {\n case 37: this.prev(); break\n case 39: this.next(); break\n default: return\n }\n\n e.preventDefault()\n }\n\n Carousel.prototype.cycle = function (e) {\n e || (this.paused = false)\n\n this.interval && clearInterval(this.interval)\n\n this.options.interval\n && !this.paused\n && (this.interval = setInterval($.proxy(this.next, this), this.options.interval))\n\n return this\n }\n\n Carousel.prototype.getItemIndex = function (item) {\n this.$items = item.parent().children('.item')\n return this.$items.index(item || this.$active)\n }\n\n Carousel.prototype.getItemForDirection = function (direction, active) {\n var activeIndex = this.getItemIndex(active)\n var willWrap = (direction == 'prev' && activeIndex === 0)\n || (direction == 'next' && activeIndex == (this.$items.length - 1))\n if (willWrap && !this.options.wrap) return active\n var delta = direction == 'prev' ? -1 : 1\n var itemIndex = (activeIndex + delta) % this.$items.length\n return this.$items.eq(itemIndex)\n }\n\n Carousel.prototype.to = function (pos) {\n var that = this\n var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))\n\n if (pos > (this.$items.length - 1) || pos < 0) return\n\n if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, \"slid\"\n if (activeIndex == pos) return this.pause().cycle()\n\n return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))\n }\n\n Carousel.prototype.pause = function (e) {\n e || (this.paused = true)\n\n if (this.$element.find('.next, .prev').length && $.support.transition) {\n this.$element.trigger($.support.transition.end)\n this.cycle(true)\n }\n\n this.interval = clearInterval(this.interval)\n\n return this\n }\n\n Carousel.prototype.next = function () {\n if (this.sliding) return\n return this.slide('next')\n }\n\n Carousel.prototype.prev = function () {\n if (this.sliding) return\n return this.slide('prev')\n }\n\n Carousel.prototype.slide = function (type, next) {\n var $active = this.$element.find('.item.active')\n var $next = next || this.getItemForDirection(type, $active)\n var isCycling = this.interval\n var direction = type == 'next' ? 'left' : 'right'\n var that = this\n\n if ($next.hasClass('active')) return (this.sliding = false)\n\n var relatedTarget = $next[0]\n var slideEvent = $.Event('slide.bs.carousel', {\n relatedTarget: relatedTarget,\n direction: direction\n })\n this.$element.trigger(slideEvent)\n if (slideEvent.isDefaultPrevented()) return\n\n this.sliding = true\n\n isCycling && this.pause()\n\n if (this.$indicators.length) {\n this.$indicators.find('.active').removeClass('active')\n var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)])\n $nextIndicator && $nextIndicator.addClass('active')\n }\n\n var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, \"slid\"\n if ($.support.transition && this.$element.hasClass('slide')) {\n $next.addClass(type)\n if (typeof $next === 'object' && $next.length) {\n $next[0].offsetWidth // force reflow\n }\n $active.addClass(direction)\n $next.addClass(direction)\n $active\n .one('bsTransitionEnd', function () {\n $next.removeClass([type, direction].join(' ')).addClass('active')\n $active.removeClass(['active', direction].join(' '))\n that.sliding = false\n setTimeout(function () {\n that.$element.trigger(slidEvent)\n }, 0)\n })\n .emulateTransitionEnd(Carousel.TRANSITION_DURATION)\n } else {\n $active.removeClass('active')\n $next.addClass('active')\n this.sliding = false\n this.$element.trigger(slidEvent)\n }\n\n isCycling && this.cycle()\n\n return this\n }\n\n\n // CAROUSEL PLUGIN DEFINITION\n // ==========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.carousel')\n var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option)\n var action = typeof option == 'string' ? option : options.slide\n\n if (!data) $this.data('bs.carousel', (data = new Carousel(this, options)))\n if (typeof option == 'number') data.to(option)\n else if (action) data[action]()\n else if (options.interval) data.pause().cycle()\n })\n }\n\n var old = $.fn.carousel\n\n $.fn.carousel = Plugin\n $.fn.carousel.Constructor = Carousel\n\n\n // CAROUSEL NO CONFLICT\n // ====================\n\n $.fn.carousel.noConflict = function () {\n $.fn.carousel = old\n return this\n }\n\n\n // CAROUSEL DATA-API\n // =================\n\n var clickHandler = function (e) {\n var $this = $(this)\n var href = $this.attr('href')\n if (href) {\n href = href.replace(/.*(?=#[^\\s]+$)/, '') // strip for ie7\n }\n\n var target = $this.attr('data-target') || href\n var $target = $(document).find(target)\n\n if (!$target.hasClass('carousel')) return\n\n var options = $.extend({}, $target.data(), $this.data())\n var slideIndex = $this.attr('data-slide-to')\n if (slideIndex) options.interval = false\n\n Plugin.call($target, options)\n\n if (slideIndex) {\n $target.data('bs.carousel').to(slideIndex)\n }\n\n e.preventDefault()\n }\n\n $(document)\n .on('click.bs.carousel.data-api', '[data-slide]', clickHandler)\n .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler)\n\n $(window).on('load', function () {\n $('[data-ride=\"carousel\"]').each(function () {\n var $carousel = $(this)\n Plugin.call($carousel, $carousel.data())\n })\n })\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: collapse.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#collapse\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n/* jshint latedef: false */\n\n+function ($) {\n 'use strict';\n\n // COLLAPSE PUBLIC CLASS DEFINITION\n // ================================\n\n var Collapse = function (element, options) {\n this.$element = $(element)\n this.options = $.extend({}, Collapse.DEFAULTS, options)\n this.$trigger = $('[data-toggle=\"collapse\"][href=\"#' + element.id + '\"],' +\n '[data-toggle=\"collapse\"][data-target=\"#' + element.id + '\"]')\n this.transitioning = null\n\n if (this.options.parent) {\n this.$parent = this.getParent()\n } else {\n this.addAriaAndCollapsedClass(this.$element, this.$trigger)\n }\n\n if (this.options.toggle) this.toggle()\n }\n\n Collapse.VERSION = '3.4.1'\n\n Collapse.TRANSITION_DURATION = 350\n\n Collapse.DEFAULTS = {\n toggle: true\n }\n\n Collapse.prototype.dimension = function () {\n var hasWidth = this.$element.hasClass('width')\n return hasWidth ? 'width' : 'height'\n }\n\n Collapse.prototype.show = function () {\n if (this.transitioning || this.$element.hasClass('in')) return\n\n var activesData\n var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing')\n\n if (actives && actives.length) {\n activesData = actives.data('bs.collapse')\n if (activesData && activesData.transitioning) return\n }\n\n var startEvent = $.Event('show.bs.collapse')\n this.$element.trigger(startEvent)\n if (startEvent.isDefaultPrevented()) return\n\n if (actives && actives.length) {\n Plugin.call(actives, 'hide')\n activesData || actives.data('bs.collapse', null)\n }\n\n var dimension = this.dimension()\n\n this.$element\n .removeClass('collapse')\n .addClass('collapsing')[dimension](0)\n .attr('aria-expanded', true)\n\n this.$trigger\n .removeClass('collapsed')\n .attr('aria-expanded', true)\n\n this.transitioning = 1\n\n var complete = function () {\n this.$element\n .removeClass('collapsing')\n .addClass('collapse in')[dimension]('')\n this.transitioning = 0\n this.$element\n .trigger('shown.bs.collapse')\n }\n\n if (!$.support.transition) return complete.call(this)\n\n var scrollSize = $.camelCase(['scroll', dimension].join('-'))\n\n this.$element\n .one('bsTransitionEnd', $.proxy(complete, this))\n .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize])\n }\n\n Collapse.prototype.hide = function () {\n if (this.transitioning || !this.$element.hasClass('in')) return\n\n var startEvent = $.Event('hide.bs.collapse')\n this.$element.trigger(startEvent)\n if (startEvent.isDefaultPrevented()) return\n\n var dimension = this.dimension()\n\n this.$element[dimension](this.$element[dimension]())[0].offsetHeight\n\n this.$element\n .addClass('collapsing')\n .removeClass('collapse in')\n .attr('aria-expanded', false)\n\n this.$trigger\n .addClass('collapsed')\n .attr('aria-expanded', false)\n\n this.transitioning = 1\n\n var complete = function () {\n this.transitioning = 0\n this.$element\n .removeClass('collapsing')\n .addClass('collapse')\n .trigger('hidden.bs.collapse')\n }\n\n if (!$.support.transition) return complete.call(this)\n\n this.$element\n [dimension](0)\n .one('bsTransitionEnd', $.proxy(complete, this))\n .emulateTransitionEnd(Collapse.TRANSITION_DURATION)\n }\n\n Collapse.prototype.toggle = function () {\n this[this.$element.hasClass('in') ? 'hide' : 'show']()\n }\n\n Collapse.prototype.getParent = function () {\n return $(document).find(this.options.parent)\n .find('[data-toggle=\"collapse\"][data-parent=\"' + this.options.parent + '\"]')\n .each($.proxy(function (i, element) {\n var $element = $(element)\n this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element)\n }, this))\n .end()\n }\n\n Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) {\n var isOpen = $element.hasClass('in')\n\n $element.attr('aria-expanded', isOpen)\n $trigger\n .toggleClass('collapsed', !isOpen)\n .attr('aria-expanded', isOpen)\n }\n\n function getTargetFromTrigger($trigger) {\n var href\n var target = $trigger.attr('data-target')\n || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\\s]+$)/, '') // strip for ie7\n\n return $(document).find(target)\n }\n\n\n // COLLAPSE PLUGIN DEFINITION\n // ==========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.collapse')\n var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option)\n\n if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false\n if (!data) $this.data('bs.collapse', (data = new Collapse(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.collapse\n\n $.fn.collapse = Plugin\n $.fn.collapse.Constructor = Collapse\n\n\n // COLLAPSE NO CONFLICT\n // ====================\n\n $.fn.collapse.noConflict = function () {\n $.fn.collapse = old\n return this\n }\n\n\n // COLLAPSE DATA-API\n // =================\n\n $(document).on('click.bs.collapse.data-api', '[data-toggle=\"collapse\"]', function (e) {\n var $this = $(this)\n\n if (!$this.attr('data-target')) e.preventDefault()\n\n var $target = getTargetFromTrigger($this)\n var data = $target.data('bs.collapse')\n var option = data ? 'toggle' : $this.data()\n\n Plugin.call($target, option)\n })\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: dropdown.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#dropdowns\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // DROPDOWN CLASS DEFINITION\n // =========================\n\n var backdrop = '.dropdown-backdrop'\n var toggle = '[data-toggle=\"dropdown\"]'\n var Dropdown = function (element) {\n $(element).on('click.bs.dropdown', this.toggle)\n }\n\n Dropdown.VERSION = '3.4.1'\n\n function getParent($this) {\n var selector = $this.attr('data-target')\n\n if (!selector) {\n selector = $this.attr('href')\n selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n }\n\n var $parent = selector !== '#' ? $(document).find(selector) : null\n\n return $parent && $parent.length ? $parent : $this.parent()\n }\n\n function clearMenus(e) {\n if (e && e.which === 3) return\n $(backdrop).remove()\n $(toggle).each(function () {\n var $this = $(this)\n var $parent = getParent($this)\n var relatedTarget = { relatedTarget: this }\n\n if (!$parent.hasClass('open')) return\n\n if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return\n\n $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget))\n\n if (e.isDefaultPrevented()) return\n\n $this.attr('aria-expanded', 'false')\n $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget))\n })\n }\n\n Dropdown.prototype.toggle = function (e) {\n var $this = $(this)\n\n if ($this.is('.disabled, :disabled')) return\n\n var $parent = getParent($this)\n var isActive = $parent.hasClass('open')\n\n clearMenus()\n\n if (!isActive) {\n if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) {\n // if mobile we use a backdrop because click events don't delegate\n $(document.createElement('div'))\n .addClass('dropdown-backdrop')\n .insertAfter($(this))\n .on('click', clearMenus)\n }\n\n var relatedTarget = { relatedTarget: this }\n $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget))\n\n if (e.isDefaultPrevented()) return\n\n $this\n .trigger('focus')\n .attr('aria-expanded', 'true')\n\n $parent\n .toggleClass('open')\n .trigger($.Event('shown.bs.dropdown', relatedTarget))\n }\n\n return false\n }\n\n Dropdown.prototype.keydown = function (e) {\n if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return\n\n var $this = $(this)\n\n e.preventDefault()\n e.stopPropagation()\n\n if ($this.is('.disabled, :disabled')) return\n\n var $parent = getParent($this)\n var isActive = $parent.hasClass('open')\n\n if (!isActive && e.which != 27 || isActive && e.which == 27) {\n if (e.which == 27) $parent.find(toggle).trigger('focus')\n return $this.trigger('click')\n }\n\n var desc = ' li:not(.disabled):visible a'\n var $items = $parent.find('.dropdown-menu' + desc)\n\n if (!$items.length) return\n\n var index = $items.index(e.target)\n\n if (e.which == 38 && index > 0) index-- // up\n if (e.which == 40 && index < $items.length - 1) index++ // down\n if (!~index) index = 0\n\n $items.eq(index).trigger('focus')\n }\n\n\n // DROPDOWN PLUGIN DEFINITION\n // ==========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.dropdown')\n\n if (!data) $this.data('bs.dropdown', (data = new Dropdown(this)))\n if (typeof option == 'string') data[option].call($this)\n })\n }\n\n var old = $.fn.dropdown\n\n $.fn.dropdown = Plugin\n $.fn.dropdown.Constructor = Dropdown\n\n\n // DROPDOWN NO CONFLICT\n // ====================\n\n $.fn.dropdown.noConflict = function () {\n $.fn.dropdown = old\n return this\n }\n\n\n // APPLY TO STANDARD DROPDOWN ELEMENTS\n // ===================================\n\n $(document)\n .on('click.bs.dropdown.data-api', clearMenus)\n .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() })\n .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle)\n .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown)\n .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown)\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: modal.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#modals\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // MODAL CLASS DEFINITION\n // ======================\n\n var Modal = function (element, options) {\n this.options = options\n this.$body = $(document.body)\n this.$element = $(element)\n this.$dialog = this.$element.find('.modal-dialog')\n this.$backdrop = null\n this.isShown = null\n this.originalBodyPad = null\n this.scrollbarWidth = 0\n this.ignoreBackdropClick = false\n this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom'\n\n if (this.options.remote) {\n this.$element\n .find('.modal-content')\n .load(this.options.remote, $.proxy(function () {\n this.$element.trigger('loaded.bs.modal')\n }, this))\n }\n }\n\n Modal.VERSION = '3.4.1'\n\n Modal.TRANSITION_DURATION = 300\n Modal.BACKDROP_TRANSITION_DURATION = 150\n\n Modal.DEFAULTS = {\n backdrop: true,\n keyboard: true,\n show: true\n }\n\n Modal.prototype.toggle = function (_relatedTarget) {\n return this.isShown ? this.hide() : this.show(_relatedTarget)\n }\n\n Modal.prototype.show = function (_relatedTarget) {\n var that = this\n var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })\n\n this.$element.trigger(e)\n\n if (this.isShown || e.isDefaultPrevented()) return\n\n this.isShown = true\n\n this.checkScrollbar()\n this.setScrollbar()\n this.$body.addClass('modal-open')\n\n this.escape()\n this.resize()\n\n this.$element.on('click.dismiss.bs.modal', '[data-dismiss=\"modal\"]', $.proxy(this.hide, this))\n\n this.$dialog.on('mousedown.dismiss.bs.modal', function () {\n that.$element.one('mouseup.dismiss.bs.modal', function (e) {\n if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true\n })\n })\n\n this.backdrop(function () {\n var transition = $.support.transition && that.$element.hasClass('fade')\n\n if (!that.$element.parent().length) {\n that.$element.appendTo(that.$body) // don't move modals dom position\n }\n\n that.$element\n .show()\n .scrollTop(0)\n\n that.adjustDialog()\n\n if (transition) {\n that.$element[0].offsetWidth // force reflow\n }\n\n that.$element.addClass('in')\n\n that.enforceFocus()\n\n var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget })\n\n transition ?\n that.$dialog // wait for modal to slide in\n .one('bsTransitionEnd', function () {\n that.$element.trigger('focus').trigger(e)\n })\n .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n that.$element.trigger('focus').trigger(e)\n })\n }\n\n Modal.prototype.hide = function (e) {\n if (e) e.preventDefault()\n\n e = $.Event('hide.bs.modal')\n\n this.$element.trigger(e)\n\n if (!this.isShown || e.isDefaultPrevented()) return\n\n this.isShown = false\n\n this.escape()\n this.resize()\n\n $(document).off('focusin.bs.modal')\n\n this.$element\n .removeClass('in')\n .off('click.dismiss.bs.modal')\n .off('mouseup.dismiss.bs.modal')\n\n this.$dialog.off('mousedown.dismiss.bs.modal')\n\n $.support.transition && this.$element.hasClass('fade') ?\n this.$element\n .one('bsTransitionEnd', $.proxy(this.hideModal, this))\n .emulateTransitionEnd(Modal.TRANSITION_DURATION) :\n this.hideModal()\n }\n\n Modal.prototype.enforceFocus = function () {\n $(document)\n .off('focusin.bs.modal') // guard against infinite focus loop\n .on('focusin.bs.modal', $.proxy(function (e) {\n if (document !== e.target &&\n this.$element[0] !== e.target &&\n !this.$element.has(e.target).length) {\n this.$element.trigger('focus')\n }\n }, this))\n }\n\n Modal.prototype.escape = function () {\n if (this.isShown && this.options.keyboard) {\n this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) {\n e.which == 27 && this.hide()\n }, this))\n } else if (!this.isShown) {\n this.$element.off('keydown.dismiss.bs.modal')\n }\n }\n\n Modal.prototype.resize = function () {\n if (this.isShown) {\n $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this))\n } else {\n $(window).off('resize.bs.modal')\n }\n }\n\n Modal.prototype.hideModal = function () {\n var that = this\n this.$element.hide()\n this.backdrop(function () {\n that.$body.removeClass('modal-open')\n that.resetAdjustments()\n that.resetScrollbar()\n that.$element.trigger('hidden.bs.modal')\n })\n }\n\n Modal.prototype.removeBackdrop = function () {\n this.$backdrop && this.$backdrop.remove()\n this.$backdrop = null\n }\n\n Modal.prototype.backdrop = function (callback) {\n var that = this\n var animate = this.$element.hasClass('fade') ? 'fade' : ''\n\n if (this.isShown && this.options.backdrop) {\n var doAnimate = $.support.transition && animate\n\n this.$backdrop = $(document.createElement('div'))\n .addClass('modal-backdrop ' + animate)\n .appendTo(this.$body)\n\n this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) {\n if (this.ignoreBackdropClick) {\n this.ignoreBackdropClick = false\n return\n }\n if (e.target !== e.currentTarget) return\n this.options.backdrop == 'static'\n ? this.$element[0].focus()\n : this.hide()\n }, this))\n\n if (doAnimate) this.$backdrop[0].offsetWidth // force reflow\n\n this.$backdrop.addClass('in')\n\n if (!callback) return\n\n doAnimate ?\n this.$backdrop\n .one('bsTransitionEnd', callback)\n .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n callback()\n\n } else if (!this.isShown && this.$backdrop) {\n this.$backdrop.removeClass('in')\n\n var callbackRemove = function () {\n that.removeBackdrop()\n callback && callback()\n }\n $.support.transition && this.$element.hasClass('fade') ?\n this.$backdrop\n .one('bsTransitionEnd', callbackRemove)\n .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) :\n callbackRemove()\n\n } else if (callback) {\n callback()\n }\n }\n\n // these following methods are used to handle overflowing modals\n\n Modal.prototype.handleUpdate = function () {\n this.adjustDialog()\n }\n\n Modal.prototype.adjustDialog = function () {\n var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight\n\n this.$element.css({\n paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '',\n paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : ''\n })\n }\n\n Modal.prototype.resetAdjustments = function () {\n this.$element.css({\n paddingLeft: '',\n paddingRight: ''\n })\n }\n\n Modal.prototype.checkScrollbar = function () {\n var fullWindowWidth = window.innerWidth\n if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8\n var documentElementRect = document.documentElement.getBoundingClientRect()\n fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left)\n }\n this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth\n this.scrollbarWidth = this.measureScrollbar()\n }\n\n Modal.prototype.setScrollbar = function () {\n var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10)\n this.originalBodyPad = document.body.style.paddingRight || ''\n var scrollbarWidth = this.scrollbarWidth\n if (this.bodyIsOverflowing) {\n this.$body.css('padding-right', bodyPad + scrollbarWidth)\n $(this.fixedContent).each(function (index, element) {\n var actualPadding = element.style.paddingRight\n var calculatedPadding = $(element).css('padding-right')\n $(element)\n .data('padding-right', actualPadding)\n .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px')\n })\n }\n }\n\n Modal.prototype.resetScrollbar = function () {\n this.$body.css('padding-right', this.originalBodyPad)\n $(this.fixedContent).each(function (index, element) {\n var padding = $(element).data('padding-right')\n $(element).removeData('padding-right')\n element.style.paddingRight = padding ? padding : ''\n })\n }\n\n Modal.prototype.measureScrollbar = function () { // thx walsh\n var scrollDiv = document.createElement('div')\n scrollDiv.className = 'modal-scrollbar-measure'\n this.$body.append(scrollDiv)\n var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth\n this.$body[0].removeChild(scrollDiv)\n return scrollbarWidth\n }\n\n\n // MODAL PLUGIN DEFINITION\n // =======================\n\n function Plugin(option, _relatedTarget) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.modal')\n var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option)\n\n if (!data) $this.data('bs.modal', (data = new Modal(this, options)))\n if (typeof option == 'string') data[option](_relatedTarget)\n else if (options.show) data.show(_relatedTarget)\n })\n }\n\n var old = $.fn.modal\n\n $.fn.modal = Plugin\n $.fn.modal.Constructor = Modal\n\n\n // MODAL NO CONFLICT\n // =================\n\n $.fn.modal.noConflict = function () {\n $.fn.modal = old\n return this\n }\n\n\n // MODAL DATA-API\n // ==============\n\n $(document).on('click.bs.modal.data-api', '[data-toggle=\"modal\"]', function (e) {\n var $this = $(this)\n var href = $this.attr('href')\n var target = $this.attr('data-target') ||\n (href && href.replace(/.*(?=#[^\\s]+$)/, '')) // strip for ie7\n\n var $target = $(document).find(target)\n var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data())\n\n if ($this.is('a')) e.preventDefault()\n\n $target.one('show.bs.modal', function (showEvent) {\n if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown\n $target.one('hidden.bs.modal', function () {\n $this.is(':visible') && $this.trigger('focus')\n })\n })\n Plugin.call($target, option, this)\n })\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: tooltip.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#tooltip\n * Inspired by the original jQuery.tipsy by Jason Frame\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n+function ($) {\n 'use strict';\n\n var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']\n\n var uriAttrs = [\n 'background',\n 'cite',\n 'href',\n 'itemtype',\n 'longdesc',\n 'poster',\n 'src',\n 'xlink:href'\n ]\n\n var ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i\n\n var DefaultWhitelist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n div: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n }\n\n /**\n * A pattern that recognizes a commonly useful subset of URLs that are safe.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\n var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi\n\n /**\n * A pattern that matches safe data URLs. Only matches image, video and audio types.\n *\n * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts\n */\n var DATA_URL_PATTERN = /^data:(?:image\\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\\/(?:mpeg|mp4|ogg|webm)|audio\\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i\n\n function allowedAttribute(attr, allowedAttributeList) {\n var attrName = attr.nodeName.toLowerCase()\n\n if ($.inArray(attrName, allowedAttributeList) !== -1) {\n if ($.inArray(attrName, uriAttrs) !== -1) {\n return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN))\n }\n\n return true\n }\n\n var regExp = $(allowedAttributeList).filter(function (index, value) {\n return value instanceof RegExp\n })\n\n // Check if a regular expression validates the attribute.\n for (var i = 0, l = regExp.length; i < l; i++) {\n if (attrName.match(regExp[i])) {\n return true\n }\n }\n\n return false\n }\n\n function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) {\n if (unsafeHtml.length === 0) {\n return unsafeHtml\n }\n\n if (sanitizeFn && typeof sanitizeFn === 'function') {\n return sanitizeFn(unsafeHtml)\n }\n\n // IE 8 and below don't support createHTMLDocument\n if (!document.implementation || !document.implementation.createHTMLDocument) {\n return unsafeHtml\n }\n\n var createdDocument = document.implementation.createHTMLDocument('sanitization')\n createdDocument.body.innerHTML = unsafeHtml\n\n var whitelistKeys = $.map(whiteList, function (el, i) { return i })\n var elements = $(createdDocument.body).find('*')\n\n for (var i = 0, len = elements.length; i < len; i++) {\n var el = elements[i]\n var elName = el.nodeName.toLowerCase()\n\n if ($.inArray(elName, whitelistKeys) === -1) {\n el.parentNode.removeChild(el)\n\n continue\n }\n\n var attributeList = $.map(el.attributes, function (el) { return el })\n var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || [])\n\n for (var j = 0, len2 = attributeList.length; j < len2; j++) {\n if (!allowedAttribute(attributeList[j], whitelistedAttributes)) {\n el.removeAttribute(attributeList[j].nodeName)\n }\n }\n }\n\n return createdDocument.body.innerHTML\n }\n\n // TOOLTIP PUBLIC CLASS DEFINITION\n // ===============================\n\n var Tooltip = function (element, options) {\n this.type = null\n this.options = null\n this.enabled = null\n this.timeout = null\n this.hoverState = null\n this.$element = null\n this.inState = null\n\n this.init('tooltip', element, options)\n }\n\n Tooltip.VERSION = '3.4.1'\n\n Tooltip.TRANSITION_DURATION = 150\n\n Tooltip.DEFAULTS = {\n animation: true,\n placement: 'top',\n selector: false,\n template: '
    ',\n trigger: 'hover focus',\n title: '',\n delay: 0,\n html: false,\n container: false,\n viewport: {\n selector: 'body',\n padding: 0\n },\n sanitize : true,\n sanitizeFn : null,\n whiteList : DefaultWhitelist\n }\n\n Tooltip.prototype.init = function (type, element, options) {\n this.enabled = true\n this.type = type\n this.$element = $(element)\n this.options = this.getOptions(options)\n this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport))\n this.inState = { click: false, hover: false, focus: false }\n\n if (this.$element[0] instanceof document.constructor && !this.options.selector) {\n throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!')\n }\n\n var triggers = this.options.trigger.split(' ')\n\n for (var i = triggers.length; i--;) {\n var trigger = triggers[i]\n\n if (trigger == 'click') {\n this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this))\n } else if (trigger != 'manual') {\n var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin'\n var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout'\n\n this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this))\n this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this))\n }\n }\n\n this.options.selector ?\n (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) :\n this.fixTitle()\n }\n\n Tooltip.prototype.getDefaults = function () {\n return Tooltip.DEFAULTS\n }\n\n Tooltip.prototype.getOptions = function (options) {\n var dataAttributes = this.$element.data()\n\n for (var dataAttr in dataAttributes) {\n if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) {\n delete dataAttributes[dataAttr]\n }\n }\n\n options = $.extend({}, this.getDefaults(), dataAttributes, options)\n\n if (options.delay && typeof options.delay == 'number') {\n options.delay = {\n show: options.delay,\n hide: options.delay\n }\n }\n\n if (options.sanitize) {\n options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn)\n }\n\n return options\n }\n\n Tooltip.prototype.getDelegateOptions = function () {\n var options = {}\n var defaults = this.getDefaults()\n\n this._options && $.each(this._options, function (key, value) {\n if (defaults[key] != value) options[key] = value\n })\n\n return options\n }\n\n Tooltip.prototype.enter = function (obj) {\n var self = obj instanceof this.constructor ?\n obj : $(obj.currentTarget).data('bs.' + this.type)\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions())\n $(obj.currentTarget).data('bs.' + this.type, self)\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true\n }\n\n if (self.tip().hasClass('in') || self.hoverState == 'in') {\n self.hoverState = 'in'\n return\n }\n\n clearTimeout(self.timeout)\n\n self.hoverState = 'in'\n\n if (!self.options.delay || !self.options.delay.show) return self.show()\n\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'in') self.show()\n }, self.options.delay.show)\n }\n\n Tooltip.prototype.isInStateTrue = function () {\n for (var key in this.inState) {\n if (this.inState[key]) return true\n }\n\n return false\n }\n\n Tooltip.prototype.leave = function (obj) {\n var self = obj instanceof this.constructor ?\n obj : $(obj.currentTarget).data('bs.' + this.type)\n\n if (!self) {\n self = new this.constructor(obj.currentTarget, this.getDelegateOptions())\n $(obj.currentTarget).data('bs.' + this.type, self)\n }\n\n if (obj instanceof $.Event) {\n self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false\n }\n\n if (self.isInStateTrue()) return\n\n clearTimeout(self.timeout)\n\n self.hoverState = 'out'\n\n if (!self.options.delay || !self.options.delay.hide) return self.hide()\n\n self.timeout = setTimeout(function () {\n if (self.hoverState == 'out') self.hide()\n }, self.options.delay.hide)\n }\n\n Tooltip.prototype.show = function () {\n var e = $.Event('show.bs.' + this.type)\n\n if (this.hasContent() && this.enabled) {\n this.$element.trigger(e)\n\n var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0])\n if (e.isDefaultPrevented() || !inDom) return\n var that = this\n\n var $tip = this.tip()\n\n var tipId = this.getUID(this.type)\n\n this.setContent()\n $tip.attr('id', tipId)\n this.$element.attr('aria-describedby', tipId)\n\n if (this.options.animation) $tip.addClass('fade')\n\n var placement = typeof this.options.placement == 'function' ?\n this.options.placement.call(this, $tip[0], this.$element[0]) :\n this.options.placement\n\n var autoToken = /\\s?auto?\\s?/i\n var autoPlace = autoToken.test(placement)\n if (autoPlace) placement = placement.replace(autoToken, '') || 'top'\n\n $tip\n .detach()\n .css({ top: 0, left: 0, display: 'block' })\n .addClass(placement)\n .data('bs.' + this.type, this)\n\n this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element)\n this.$element.trigger('inserted.bs.' + this.type)\n\n var pos = this.getPosition()\n var actualWidth = $tip[0].offsetWidth\n var actualHeight = $tip[0].offsetHeight\n\n if (autoPlace) {\n var orgPlacement = placement\n var viewportDim = this.getPosition(this.$viewport)\n\n placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' :\n placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' :\n placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' :\n placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' :\n placement\n\n $tip\n .removeClass(orgPlacement)\n .addClass(placement)\n }\n\n var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight)\n\n this.applyPlacement(calculatedOffset, placement)\n\n var complete = function () {\n var prevHoverState = that.hoverState\n that.$element.trigger('shown.bs.' + that.type)\n that.hoverState = null\n\n if (prevHoverState == 'out') that.leave(that)\n }\n\n $.support.transition && this.$tip.hasClass('fade') ?\n $tip\n .one('bsTransitionEnd', complete)\n .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :\n complete()\n }\n }\n\n Tooltip.prototype.applyPlacement = function (offset, placement) {\n var $tip = this.tip()\n var width = $tip[0].offsetWidth\n var height = $tip[0].offsetHeight\n\n // manually read margins because getBoundingClientRect includes difference\n var marginTop = parseInt($tip.css('margin-top'), 10)\n var marginLeft = parseInt($tip.css('margin-left'), 10)\n\n // we must check for NaN for ie 8/9\n if (isNaN(marginTop)) marginTop = 0\n if (isNaN(marginLeft)) marginLeft = 0\n\n offset.top += marginTop\n offset.left += marginLeft\n\n // $.fn.offset doesn't round pixel values\n // so we use setOffset directly with our own function B-0\n $.offset.setOffset($tip[0], $.extend({\n using: function (props) {\n $tip.css({\n top: Math.round(props.top),\n left: Math.round(props.left)\n })\n }\n }, offset), 0)\n\n $tip.addClass('in')\n\n // check to see if placing tip in new offset caused the tip to resize itself\n var actualWidth = $tip[0].offsetWidth\n var actualHeight = $tip[0].offsetHeight\n\n if (placement == 'top' && actualHeight != height) {\n offset.top = offset.top + height - actualHeight\n }\n\n var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight)\n\n if (delta.left) offset.left += delta.left\n else offset.top += delta.top\n\n var isVertical = /top|bottom/.test(placement)\n var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight\n var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight'\n\n $tip.offset(offset)\n this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical)\n }\n\n Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) {\n this.arrow()\n .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%')\n .css(isVertical ? 'top' : 'left', '')\n }\n\n Tooltip.prototype.setContent = function () {\n var $tip = this.tip()\n var title = this.getTitle()\n\n if (this.options.html) {\n if (this.options.sanitize) {\n title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn)\n }\n\n $tip.find('.tooltip-inner').html(title)\n } else {\n $tip.find('.tooltip-inner').text(title)\n }\n\n $tip.removeClass('fade in top bottom left right')\n }\n\n Tooltip.prototype.hide = function (callback) {\n var that = this\n var $tip = $(this.$tip)\n var e = $.Event('hide.bs.' + this.type)\n\n function complete() {\n if (that.hoverState != 'in') $tip.detach()\n if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary.\n that.$element\n .removeAttr('aria-describedby')\n .trigger('hidden.bs.' + that.type)\n }\n callback && callback()\n }\n\n this.$element.trigger(e)\n\n if (e.isDefaultPrevented()) return\n\n $tip.removeClass('in')\n\n $.support.transition && $tip.hasClass('fade') ?\n $tip\n .one('bsTransitionEnd', complete)\n .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) :\n complete()\n\n this.hoverState = null\n\n return this\n }\n\n Tooltip.prototype.fixTitle = function () {\n var $e = this.$element\n if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') {\n $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')\n }\n }\n\n Tooltip.prototype.hasContent = function () {\n return this.getTitle()\n }\n\n Tooltip.prototype.getPosition = function ($element) {\n $element = $element || this.$element\n\n var el = $element[0]\n var isBody = el.tagName == 'BODY'\n\n var elRect = el.getBoundingClientRect()\n if (elRect.width == null) {\n // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093\n elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top })\n }\n var isSvg = window.SVGElement && el instanceof window.SVGElement\n // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3.\n // See https://github.com/twbs/bootstrap/issues/20280\n var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset())\n var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() }\n var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null\n\n return $.extend({}, elRect, scroll, outerDims, elOffset)\n }\n\n Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) {\n return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } :\n placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } :\n placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } :\n /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }\n\n }\n\n Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) {\n var delta = { top: 0, left: 0 }\n if (!this.$viewport) return delta\n\n var viewportPadding = this.options.viewport && this.options.viewport.padding || 0\n var viewportDimensions = this.getPosition(this.$viewport)\n\n if (/right|left/.test(placement)) {\n var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll\n var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight\n if (topEdgeOffset < viewportDimensions.top) { // top overflow\n delta.top = viewportDimensions.top - topEdgeOffset\n } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow\n delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset\n }\n } else {\n var leftEdgeOffset = pos.left - viewportPadding\n var rightEdgeOffset = pos.left + viewportPadding + actualWidth\n if (leftEdgeOffset < viewportDimensions.left) { // left overflow\n delta.left = viewportDimensions.left - leftEdgeOffset\n } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow\n delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset\n }\n }\n\n return delta\n }\n\n Tooltip.prototype.getTitle = function () {\n var title\n var $e = this.$element\n var o = this.options\n\n title = $e.attr('data-original-title')\n || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title)\n\n return title\n }\n\n Tooltip.prototype.getUID = function (prefix) {\n do prefix += ~~(Math.random() * 1000000)\n while (document.getElementById(prefix))\n return prefix\n }\n\n Tooltip.prototype.tip = function () {\n if (!this.$tip) {\n this.$tip = $(this.options.template)\n if (this.$tip.length != 1) {\n throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!')\n }\n }\n return this.$tip\n }\n\n Tooltip.prototype.arrow = function () {\n return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow'))\n }\n\n Tooltip.prototype.enable = function () {\n this.enabled = true\n }\n\n Tooltip.prototype.disable = function () {\n this.enabled = false\n }\n\n Tooltip.prototype.toggleEnabled = function () {\n this.enabled = !this.enabled\n }\n\n Tooltip.prototype.toggle = function (e) {\n var self = this\n if (e) {\n self = $(e.currentTarget).data('bs.' + this.type)\n if (!self) {\n self = new this.constructor(e.currentTarget, this.getDelegateOptions())\n $(e.currentTarget).data('bs.' + this.type, self)\n }\n }\n\n if (e) {\n self.inState.click = !self.inState.click\n if (self.isInStateTrue()) self.enter(self)\n else self.leave(self)\n } else {\n self.tip().hasClass('in') ? self.leave(self) : self.enter(self)\n }\n }\n\n Tooltip.prototype.destroy = function () {\n var that = this\n clearTimeout(this.timeout)\n this.hide(function () {\n that.$element.off('.' + that.type).removeData('bs.' + that.type)\n if (that.$tip) {\n that.$tip.detach()\n }\n that.$tip = null\n that.$arrow = null\n that.$viewport = null\n that.$element = null\n })\n }\n\n Tooltip.prototype.sanitizeHtml = function (unsafeHtml) {\n return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn)\n }\n\n // TOOLTIP PLUGIN DEFINITION\n // =========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.tooltip')\n var options = typeof option == 'object' && option\n\n if (!data && /destroy|hide/.test(option)) return\n if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.tooltip\n\n $.fn.tooltip = Plugin\n $.fn.tooltip.Constructor = Tooltip\n\n\n // TOOLTIP NO CONFLICT\n // ===================\n\n $.fn.tooltip.noConflict = function () {\n $.fn.tooltip = old\n return this\n }\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: popover.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#popovers\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // POPOVER PUBLIC CLASS DEFINITION\n // ===============================\n\n var Popover = function (element, options) {\n this.init('popover', element, options)\n }\n\n if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js')\n\n Popover.VERSION = '3.4.1'\n\n Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, {\n placement: 'right',\n trigger: 'click',\n content: '',\n template: '

    '\n })\n\n\n // NOTE: POPOVER EXTENDS tooltip.js\n // ================================\n\n Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype)\n\n Popover.prototype.constructor = Popover\n\n Popover.prototype.getDefaults = function () {\n return Popover.DEFAULTS\n }\n\n Popover.prototype.setContent = function () {\n var $tip = this.tip()\n var title = this.getTitle()\n var content = this.getContent()\n\n if (this.options.html) {\n var typeContent = typeof content\n\n if (this.options.sanitize) {\n title = this.sanitizeHtml(title)\n\n if (typeContent === 'string') {\n content = this.sanitizeHtml(content)\n }\n }\n\n $tip.find('.popover-title').html(title)\n $tip.find('.popover-content').children().detach().end()[\n typeContent === 'string' ? 'html' : 'append'\n ](content)\n } else {\n $tip.find('.popover-title').text(title)\n $tip.find('.popover-content').children().detach().end().text(content)\n }\n\n $tip.removeClass('fade top bottom left right in')\n\n // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do\n // this manually by checking the contents.\n if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide()\n }\n\n Popover.prototype.hasContent = function () {\n return this.getTitle() || this.getContent()\n }\n\n Popover.prototype.getContent = function () {\n var $e = this.$element\n var o = this.options\n\n return $e.attr('data-content')\n || (typeof o.content == 'function' ?\n o.content.call($e[0]) :\n o.content)\n }\n\n Popover.prototype.arrow = function () {\n return (this.$arrow = this.$arrow || this.tip().find('.arrow'))\n }\n\n\n // POPOVER PLUGIN DEFINITION\n // =========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.popover')\n var options = typeof option == 'object' && option\n\n if (!data && /destroy|hide/.test(option)) return\n if (!data) $this.data('bs.popover', (data = new Popover(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.popover\n\n $.fn.popover = Plugin\n $.fn.popover.Constructor = Popover\n\n\n // POPOVER NO CONFLICT\n // ===================\n\n $.fn.popover.noConflict = function () {\n $.fn.popover = old\n return this\n }\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: scrollspy.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#scrollspy\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // SCROLLSPY CLASS DEFINITION\n // ==========================\n\n function ScrollSpy(element, options) {\n this.$body = $(document.body)\n this.$scrollElement = $(element).is(document.body) ? $(window) : $(element)\n this.options = $.extend({}, ScrollSpy.DEFAULTS, options)\n this.selector = (this.options.target || '') + ' .nav li > a'\n this.offsets = []\n this.targets = []\n this.activeTarget = null\n this.scrollHeight = 0\n\n this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this))\n this.refresh()\n this.process()\n }\n\n ScrollSpy.VERSION = '3.4.1'\n\n ScrollSpy.DEFAULTS = {\n offset: 10\n }\n\n ScrollSpy.prototype.getScrollHeight = function () {\n return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight)\n }\n\n ScrollSpy.prototype.refresh = function () {\n var that = this\n var offsetMethod = 'offset'\n var offsetBase = 0\n\n this.offsets = []\n this.targets = []\n this.scrollHeight = this.getScrollHeight()\n\n if (!$.isWindow(this.$scrollElement[0])) {\n offsetMethod = 'position'\n offsetBase = this.$scrollElement.scrollTop()\n }\n\n this.$body\n .find(this.selector)\n .map(function () {\n var $el = $(this)\n var href = $el.data('target') || $el.attr('href')\n var $href = /^#./.test(href) && $(href)\n\n return ($href\n && $href.length\n && $href.is(':visible')\n && [[$href[offsetMethod]().top + offsetBase, href]]) || null\n })\n .sort(function (a, b) { return a[0] - b[0] })\n .each(function () {\n that.offsets.push(this[0])\n that.targets.push(this[1])\n })\n }\n\n ScrollSpy.prototype.process = function () {\n var scrollTop = this.$scrollElement.scrollTop() + this.options.offset\n var scrollHeight = this.getScrollHeight()\n var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height()\n var offsets = this.offsets\n var targets = this.targets\n var activeTarget = this.activeTarget\n var i\n\n if (this.scrollHeight != scrollHeight) {\n this.refresh()\n }\n\n if (scrollTop >= maxScroll) {\n return activeTarget != (i = targets[targets.length - 1]) && this.activate(i)\n }\n\n if (activeTarget && scrollTop < offsets[0]) {\n this.activeTarget = null\n return this.clear()\n }\n\n for (i = offsets.length; i--;) {\n activeTarget != targets[i]\n && scrollTop >= offsets[i]\n && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1])\n && this.activate(targets[i])\n }\n }\n\n ScrollSpy.prototype.activate = function (target) {\n this.activeTarget = target\n\n this.clear()\n\n var selector = this.selector +\n '[data-target=\"' + target + '\"],' +\n this.selector + '[href=\"' + target + '\"]'\n\n var active = $(selector)\n .parents('li')\n .addClass('active')\n\n if (active.parent('.dropdown-menu').length) {\n active = active\n .closest('li.dropdown')\n .addClass('active')\n }\n\n active.trigger('activate.bs.scrollspy')\n }\n\n ScrollSpy.prototype.clear = function () {\n $(this.selector)\n .parentsUntil(this.options.target, '.active')\n .removeClass('active')\n }\n\n\n // SCROLLSPY PLUGIN DEFINITION\n // ===========================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.scrollspy')\n var options = typeof option == 'object' && option\n\n if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.scrollspy\n\n $.fn.scrollspy = Plugin\n $.fn.scrollspy.Constructor = ScrollSpy\n\n\n // SCROLLSPY NO CONFLICT\n // =====================\n\n $.fn.scrollspy.noConflict = function () {\n $.fn.scrollspy = old\n return this\n }\n\n\n // SCROLLSPY DATA-API\n // ==================\n\n $(window).on('load.bs.scrollspy.data-api', function () {\n $('[data-spy=\"scroll\"]').each(function () {\n var $spy = $(this)\n Plugin.call($spy, $spy.data())\n })\n })\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: tab.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#tabs\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // TAB CLASS DEFINITION\n // ====================\n\n var Tab = function (element) {\n // jscs:disable requireDollarBeforejQueryAssignment\n this.element = $(element)\n // jscs:enable requireDollarBeforejQueryAssignment\n }\n\n Tab.VERSION = '3.4.1'\n\n Tab.TRANSITION_DURATION = 150\n\n Tab.prototype.show = function () {\n var $this = this.element\n var $ul = $this.closest('ul:not(.dropdown-menu)')\n var selector = $this.data('target')\n\n if (!selector) {\n selector = $this.attr('href')\n selector = selector && selector.replace(/.*(?=#[^\\s]*$)/, '') // strip for ie7\n }\n\n if ($this.parent('li').hasClass('active')) return\n\n var $previous = $ul.find('.active:last a')\n var hideEvent = $.Event('hide.bs.tab', {\n relatedTarget: $this[0]\n })\n var showEvent = $.Event('show.bs.tab', {\n relatedTarget: $previous[0]\n })\n\n $previous.trigger(hideEvent)\n $this.trigger(showEvent)\n\n if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return\n\n var $target = $(document).find(selector)\n\n this.activate($this.closest('li'), $ul)\n this.activate($target, $target.parent(), function () {\n $previous.trigger({\n type: 'hidden.bs.tab',\n relatedTarget: $this[0]\n })\n $this.trigger({\n type: 'shown.bs.tab',\n relatedTarget: $previous[0]\n })\n })\n }\n\n Tab.prototype.activate = function (element, container, callback) {\n var $active = container.find('> .active')\n var transition = callback\n && $.support.transition\n && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length)\n\n function next() {\n $active\n .removeClass('active')\n .find('> .dropdown-menu > .active')\n .removeClass('active')\n .end()\n .find('[data-toggle=\"tab\"]')\n .attr('aria-expanded', false)\n\n element\n .addClass('active')\n .find('[data-toggle=\"tab\"]')\n .attr('aria-expanded', true)\n\n if (transition) {\n element[0].offsetWidth // reflow for transition\n element.addClass('in')\n } else {\n element.removeClass('fade')\n }\n\n if (element.parent('.dropdown-menu').length) {\n element\n .closest('li.dropdown')\n .addClass('active')\n .end()\n .find('[data-toggle=\"tab\"]')\n .attr('aria-expanded', true)\n }\n\n callback && callback()\n }\n\n $active.length && transition ?\n $active\n .one('bsTransitionEnd', next)\n .emulateTransitionEnd(Tab.TRANSITION_DURATION) :\n next()\n\n $active.removeClass('in')\n }\n\n\n // TAB PLUGIN DEFINITION\n // =====================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.tab')\n\n if (!data) $this.data('bs.tab', (data = new Tab(this)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.tab\n\n $.fn.tab = Plugin\n $.fn.tab.Constructor = Tab\n\n\n // TAB NO CONFLICT\n // ===============\n\n $.fn.tab.noConflict = function () {\n $.fn.tab = old\n return this\n }\n\n\n // TAB DATA-API\n // ============\n\n var clickHandler = function (e) {\n e.preventDefault()\n Plugin.call($(this), 'show')\n }\n\n $(document)\n .on('click.bs.tab.data-api', '[data-toggle=\"tab\"]', clickHandler)\n .on('click.bs.tab.data-api', '[data-toggle=\"pill\"]', clickHandler)\n\n}(jQuery);\n","/* ========================================================================\n * Bootstrap: affix.js v3.4.1\n * https://getbootstrap.com/docs/3.4/javascript/#affix\n * ========================================================================\n * Copyright 2011-2019 Twitter, Inc.\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * ======================================================================== */\n\n\n+function ($) {\n 'use strict';\n\n // AFFIX CLASS DEFINITION\n // ======================\n\n var Affix = function (element, options) {\n this.options = $.extend({}, Affix.DEFAULTS, options)\n\n var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target)\n\n this.$target = target\n .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this))\n .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this))\n\n this.$element = $(element)\n this.affixed = null\n this.unpin = null\n this.pinnedOffset = null\n\n this.checkPosition()\n }\n\n Affix.VERSION = '3.4.1'\n\n Affix.RESET = 'affix affix-top affix-bottom'\n\n Affix.DEFAULTS = {\n offset: 0,\n target: window\n }\n\n Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) {\n var scrollTop = this.$target.scrollTop()\n var position = this.$element.offset()\n var targetHeight = this.$target.height()\n\n if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false\n\n if (this.affixed == 'bottom') {\n if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom'\n return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom'\n }\n\n var initializing = this.affixed == null\n var colliderTop = initializing ? scrollTop : position.top\n var colliderHeight = initializing ? targetHeight : height\n\n if (offsetTop != null && scrollTop <= offsetTop) return 'top'\n if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom'\n\n return false\n }\n\n Affix.prototype.getPinnedOffset = function () {\n if (this.pinnedOffset) return this.pinnedOffset\n this.$element.removeClass(Affix.RESET).addClass('affix')\n var scrollTop = this.$target.scrollTop()\n var position = this.$element.offset()\n return (this.pinnedOffset = position.top - scrollTop)\n }\n\n Affix.prototype.checkPositionWithEventLoop = function () {\n setTimeout($.proxy(this.checkPosition, this), 1)\n }\n\n Affix.prototype.checkPosition = function () {\n if (!this.$element.is(':visible')) return\n\n var height = this.$element.height()\n var offset = this.options.offset\n var offsetTop = offset.top\n var offsetBottom = offset.bottom\n var scrollHeight = Math.max($(document).height(), $(document.body).height())\n\n if (typeof offset != 'object') offsetBottom = offsetTop = offset\n if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element)\n if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element)\n\n var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom)\n\n if (this.affixed != affix) {\n if (this.unpin != null) this.$element.css('top', '')\n\n var affixType = 'affix' + (affix ? '-' + affix : '')\n var e = $.Event(affixType + '.bs.affix')\n\n this.$element.trigger(e)\n\n if (e.isDefaultPrevented()) return\n\n this.affixed = affix\n this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null\n\n this.$element\n .removeClass(Affix.RESET)\n .addClass(affixType)\n .trigger(affixType.replace('affix', 'affixed') + '.bs.affix')\n }\n\n if (affix == 'bottom') {\n this.$element.offset({\n top: scrollHeight - height - offsetBottom\n })\n }\n }\n\n\n // AFFIX PLUGIN DEFINITION\n // =======================\n\n function Plugin(option) {\n return this.each(function () {\n var $this = $(this)\n var data = $this.data('bs.affix')\n var options = typeof option == 'object' && option\n\n if (!data) $this.data('bs.affix', (data = new Affix(this, options)))\n if (typeof option == 'string') data[option]()\n })\n }\n\n var old = $.fn.affix\n\n $.fn.affix = Plugin\n $.fn.affix.Constructor = Affix\n\n\n // AFFIX NO CONFLICT\n // =================\n\n $.fn.affix.noConflict = function () {\n $.fn.affix = old\n return this\n }\n\n\n // AFFIX DATA-API\n // ==============\n\n $(window).on('load', function () {\n $('[data-spy=\"affix\"]').each(function () {\n var $spy = $(this)\n var data = $spy.data()\n\n data.offset = data.offset || {}\n\n if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom\n if (data.offsetTop != null) data.offset.top = data.offsetTop\n\n Plugin.call($spy, data)\n })\n })\n\n}(jQuery);\n","/*! ========================================================================\n * Bootstrap Toggle: bootstrap-toggle.js v2.2.0\n * http://www.bootstraptoggle.com\n * ========================================================================\n * Copyright 2014 Min Hur, The New York Times Company\n * Licensed under MIT\n * ======================================================================== */\n\n\n +function ($) {\n \t'use strict';\n\n\t// TOGGLE PUBLIC CLASS DEFINITION\n\t// ==============================\n\n\tvar Toggle = function (element, options) {\n\t\tthis.$element = $(element)\n\t\tthis.options = $.extend({}, this.defaults(), options)\n\t\tthis.render()\n\t}\n\n\tToggle.VERSION = '2.2.0'\n\n\tToggle.DEFAULTS = {\n\t\ton: 'On',\n\t\toff: 'Off',\n\t\tonstyle: 'primary',\n\t\toffstyle: 'default',\n\t\tsize: 'normal',\n\t\tstyle: '',\n\t\twidth: null,\n\t\theight: null\n\t}\n\n\tToggle.prototype.defaults = function() {\n\t\treturn {\n\t\t\ton: this.$element.attr('data-on') || Toggle.DEFAULTS.on,\n\t\t\toff: this.$element.attr('data-off') || Toggle.DEFAULTS.off,\n\t\t\tonstyle: this.$element.attr('data-onstyle') || Toggle.DEFAULTS.onstyle,\n\t\t\toffstyle: this.$element.attr('data-offstyle') || Toggle.DEFAULTS.offstyle,\n\t\t\tsize: this.$element.attr('data-size') || Toggle.DEFAULTS.size,\n\t\t\tstyle: this.$element.attr('data-style') || Toggle.DEFAULTS.style,\n\t\t\twidth: this.$element.attr('data-width') || Toggle.DEFAULTS.width,\n\t\t\theight: this.$element.attr('data-height') || Toggle.DEFAULTS.height\n\t\t}\n\t}\n\n\tToggle.prototype.render = function () {\n\t\tthis._onstyle = 'btn-' + this.options.onstyle\n\t\tthis._offstyle = 'btn-' + this.options.offstyle\n\t\tvar size = this.options.size === 'large' ? 'btn-lg'\n\t\t\t: this.options.size === 'small' ? 'btn-sm'\n\t\t\t: this.options.size === 'mini' ? 'btn-xs'\n\t\t\t: ''\n\t\tvar $toggleOn = $('